From: Jim Evins Date: Sun, 24 Feb 2002 01:24:45 +0000 (+0000) Subject: Initial revision X-Git-Tag: glabels-2_3_0~874 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1852a103b62f3106bd032dc6e7a55b6ebec5449c;p=glabels Initial revision git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@2 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels1/ABOUT-NLS b/glabels1/ABOUT-NLS new file mode 100644 index 00000000..28d38c76 --- /dev/null +++ b/glabels1/ABOUT-NLS @@ -0,0 +1,226 @@ +Notes on the Free Translation Project +************************************* + + Free software is going international! The Free Translation Project +is a way to get maintainers of free software, translators, and users all +together, so that will gradually become able to speak many languages. +A few packages already provide translations for their messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do *not* +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work at translations should contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +One advise in advance +===================== + + If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias or message inheritance) as the +implementation here. It is also not possible to offer this additional +functionality on top of a `catgets' implementation. Future versions of +GNU `gettext' will very likely convey even more functionality. So it +might be a good idea to change to GNU `gettext' as soon as possible. + + So you need not provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +INSTALL Matters +=============== + + Some packages are "localizable" when properly installed; the +programs they contain can be made to speak your own native language. +Most such packages use GNU `gettext'. Other packages have their own +ways to internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system provides +usable `catgets' (if using this is selected by the installer) or +`gettext' functions. If neither is available, the GNU `gettext' own +library will be used. This library is wholly contained within this +package, usually in the `intl/' subdirectory, so prior installation of +the GNU `gettext' package is *not* required. Installers may use +special options at configuration time for changing the default +behaviour. The commands: + + ./configure --with-included-gettext + ./configure --with-catgets + ./configure --disable-nls + +will respectively bypass any pre-existing `catgets' or `gettext' to use +the internationalizing routines provided within this package, enable +the use of the `catgets' functions (if found on the locale system), or +else, *totally* disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might be not what is desirable. You +should use the more recent version of the GNU `gettext' library. I.e. +if the file `intl/VERSION' shows that the library which comes with this +package is more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + By default the configuration process will not test for the `catgets' +function and therefore they will not be used. The reasons are already +given above: the emulation on top of `catgets' cannot provide all the +extensions provided by the GNU `gettext' library. If you nevertheless +want to use the `catgets' functions use + + ./configure --with-catgets + +to enable the test for `catgets' (this causes no harm if `catgets' is +not available on your system). If you really select this option we +would like to hear about the reasons because we cannot think of any +good one ourself. + + Internationalized packages have usually many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +Using This Package +================== + + As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +ISO 639 `LL' two-letter code prior to using the programs in the +package. For example, let's suppose that you speak German. At the +shell prompt, merely execute `setenv LANG de' (in `csh'), +`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This +can be done from your `.login' or `.profile' file, once and for all. + + An operating system might already offer message localization for +many of its programs, while other programs have been installed locally +with the full capabilities of GNU `gettext'. Just using `gettext' +extended syntax for `LANG' would break proper localization of already +available operating system programs. In this case, users should set +both `LANGUAGE' and `LANG' variables in their environment, as programs +using GNU `gettext' give preference to `LANGUAGE'. For example, some +Swedish users would rather read translations in German than English for +when Swedish is not available. This is easily accomplished by setting +`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'. + +Translating Teams +================= + + For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list, courtesy of Linux +International. You may reach your translation team at the address +`LL@li.org', replacing LL by the two-letter ISO 639 code for your +language. Language codes are *not* the same as the country codes given +in ISO 3166. The following translation teams exist, as of December +1997: + + Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en', + Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian + `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja', + Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish + `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es', + Swedish `sv', and Turkish `tr'. + +For example, you may reach the Chinese translation team by writing to +`zh@li.org'. + + If you'd like to volunteer to *work* at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is *not* the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +*actively* in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +Available Packages +================== + + Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of December +1997. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination. + + Ready PO files cs da de en es fi fr it ja ko nl no pl pt ru sl sv + .----------------------------------------------------. + bash | [] [] [] | 3 + bison | [] [] [] | 3 + clisp | [] [] [] [] | 4 + cpio | [] [] [] [] [] [] | 6 + diffutils | [] [] [] [] [] | 5 + enscript | [] [] [] [] [] [] | 6 + fileutils | [] [] [] [] [] [] [] [] [] [] | 10 + findutils | [] [] [] [] [] [] [] [] [] | 9 + flex | [] [] [] [] | 4 + gcal | [] [] [] [] [] | 5 + gettext | [] [] [] [] [] [] [] [] [] [] [] | 12 + grep | [] [] [] [] [] [] [] [] [] [] | 10 + hello | [] [] [] [] [] [] [] [] [] [] [] | 11 + id-utils | [] [] [] | 3 + indent | [] [] [] [] [] | 5 + libc | [] [] [] [] [] [] [] | 7 + m4 | [] [] [] [] [] [] | 6 + make | [] [] [] [] [] [] | 6 + music | [] [] | 2 + ptx | [] [] [] [] [] [] [] [] | 8 + recode | [] [] [] [] [] [] [] [] [] | 9 + sh-utils | [] [] [] [] [] [] [] [] | 8 + sharutils | [] [] [] [] [] [] | 6 + tar | [] [] [] [] [] [] [] [] [] [] [] | 11 + texinfo | [] [] [] | 3 + textutils | [] [] [] [] [] [] [] [] [] | 9 + wdiff | [] [] [] [] [] [] [] [] | 8 + `----------------------------------------------------' + 17 languages cs da de en es fi fr it ja ko nl no pl pt ru sl sv + 27 packages 6 4 25 1 18 1 26 2 1 12 20 9 19 7 4 7 17 179 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If December 1997 seems to be old, you may fetch a more recent copy +of this `ABOUT-NLS' file on most GNU archive sites. + diff --git a/glabels1/AUTHORS b/glabels1/AUTHORS new file mode 100644 index 00000000..2aeff8af --- /dev/null +++ b/glabels1/AUTHORS @@ -0,0 +1,44 @@ +gLabels Author +============== + +Jim Evins + +Acknowledgments +=============== + +nestor di -- Contributed the excellent splash +screen new in 0.4.3. + +Alessandro Rubini -- Author of the GNU Barcode Library. +This library provides a large chunk of the barcode functionality and is +distributed with glabels. See ./barcode-0.96/README for more information. + +Olivier Berger -- French translations +Marcus Bauer -- German translations +Takeshi AIHANA -- Japanese translations +Paulo Rogério Ormenese -- Brazilian Portuguese trans. + +The following people have submitted label templates or information about +particular products: + + Hap + Olivier Berger + Marcus Bauer + Jochen Hein + Jonathan Buzzard + Jeff Davis + Ludger Solbach + Darren Ross + George Mitchell + Douglas Bollinger + Tim Jackson + John Stoffel + Dany De Bontridder + Andy Longton + Bostjan Muller + John Helms + no-exit + Mozilla from marela + Holger + +And many others for their many helpful suggestions and bug reports -- thanks. diff --git a/glabels1/COPYING b/glabels1/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/glabels1/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/glabels1/ChangeLog b/glabels1/ChangeLog new file mode 100644 index 00000000..e69de29b diff --git a/glabels1/INSTALL b/glabels1/INSTALL new file mode 100644 index 00000000..b42a17ac --- /dev/null +++ b/glabels1/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/glabels1/Makefile.am b/glabels1/Makefile.am new file mode 100644 index 00000000..832a65d1 --- /dev/null +++ b/glabels1/Makefile.am @@ -0,0 +1,58 @@ +## Process this file with automake to produce Makefile.in + +LIB_BARCODE_DIR = barcode-0.96 + +SUBDIRS = intl po macros src doc + +EXTRA_DIST = \ + glabels.desktop glabels.spec.in glabels.spec autogen.sh + +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/glabels1/Makefile.in b/glabels1/Makefile.in new file mode 100644 index 00000000..8264a654 --- /dev/null +++ b/glabels1/Makefile.in @@ -0,0 +1,482 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 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@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@ +GNOMEUI_LIBS = @GNOMEUI_LIBS@ +GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@ +GNOME_CANVAS_PIXBUF_CFLAGS = @GNOME_CANVAS_PIXBUF_CFLAGS@ +GNOME_CANVAS_PIXBUF_LIBS = @GNOME_CANVAS_PIXBUF_LIBS@ +GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@ +GNOME_CONFIG = @GNOME_CONFIG@ +GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@ +GNOME_LIBDIR = @GNOME_LIBDIR@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_PRINT_CFLAGS = @GNOME_PRINT_CFLAGS@ +GNOME_PRINT_LIBS = @GNOME_PRINT_LIBS@ +GNOME_XML_CFLAGS = @GNOME_XML_CFLAGS@ +GNOME_XML_LIBS = @GNOME_XML_LIBS@ +GNORBA_CFLAGS = @GNORBA_CFLAGS@ +GNORBA_LIBS = @GNORBA_LIBS@ +GTKXMHTML_LIBS = @GTKXMHTML_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +ORBIT_CFLAGS = @ORBIT_CFLAGS@ +ORBIT_CONFIG = @ORBIT_CONFIG@ +ORBIT_IDL = @ORBIT_IDL@ +ORBIT_LIBS = @ORBIT_LIBS@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PTHREAD_LIB = @PTHREAD_LIB@ +RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XPM_LIBS = @XPM_LIBS@ +ZVT_LIBS = @ZVT_LIBS@ +cflags_set = @cflags_set@ +cxxflags_set = @cxxflags_set@ +l = @l@ + +LIB_BARCODE_DIR = barcode-0.96 + +SUBDIRS = intl po macros src doc + +EXTRA_DIST = glabels.desktop glabels.spec.in glabels.spec autogen.sh + + +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 ABOUT-NLS 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: 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): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(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: $(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 --with-included-gettext --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/glabels1/NEWS b/glabels1/NEWS new file mode 100644 index 00000000..e69de29b diff --git a/glabels1/README b/glabels1/README new file mode 100644 index 00000000..cc3c6a92 --- /dev/null +++ b/glabels1/README @@ -0,0 +1,121 @@ +Copyright +========= + + gLabels - a GNOME-based label and business card creation program + + Copyright (C) 2000 Jim Evins + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + 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 +=================== + +GNOME-LIBS-1.2.x +GTK+-1.2.x +LIBXML-1.8.x +GNOME-PRINT-0.25 +GDK-PIXBUF-0.11 + +All of these libraries are available as part of Gnome 1.4. + +NOTE: +----- +To compile gLabels on RPM based systems, you will need the development +RPMs (e.g. gnome-print-devel) installed for each of these libraries. For +example, the following './configure' error would indicate that you may +need to install the development RPM for the gnome-print library. + + checking for GNOME-PRINT >= 0.25... not found + configure: error: + + You need GNOME-PRINT 0.25 or later to build gLabels + If you think you already have this installed, consult the README. + +To verify this, do the following: + + $ rpm -q -a | grep gnome-print + +You should get something like this (your version numbers may be different): + + gnome-print-0.31-ximian.1 + gnome-print-devel-0.31-ximian.1 + +If you get no output, you will need to install both the library and +development RPMs. If you only get the first of these lines, you still +need to install the development RPMs. If you get the above error and +you get both of these lines, you probably have a fundamental configuration +problem. These RPMs should be available from wherever you received +your gnome distribution. + +NOTE: +----- +Special Note for Mandrake 8.1: I recently installed Mandrake 8.1 on a +partition of a test machine. I found that an rpm for gdk-pixbuf-devel +was on the 2nd CD, but it has a broken dependency (it's looking for +libgr-devel, which isn't on any of the CDs) so it did not show up in +Mandrake's package manager (at least that is what I suspect). I manually +installed it with rpm using the --nodeps option, and was able to compile +with no problem. + + +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/glabels1/TODO b/glabels1/TODO new file mode 100644 index 00000000..0f23255c --- /dev/null +++ b/glabels1/TODO @@ -0,0 +1,142 @@ +Architecture/Design +------------------- + +- Port to Gnome 2.0 Platform + +- Should we create a new shell, perhaps based on bonoboMDI (see gedit2). + +- File format issues: + + - rather than + - If text ever becomes rich, should we use a more apropos markup within + text objects? + - 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. + - 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. + +- Should our "models" (labels, label objects, templates) become real objects? + +- Audit for memory leaks + + +Feature wishlist +---------------- + +- Add preferences option to suppress the splash screen. + +- Add preferences option for MDI style (assuming we keep MDI or bonoboMDI) + +- Ability to select/unselect individual records during a merge-print. + +- Add additional "merge" backends. Candidates include: + vCard + generic XML + freedb (CDDB) for CD labels + +- Add object rotation and flipping functions. + +- Add a configurable grid. Also add a "snap-to" capability. + +- Set object defaults in preferences dialog. + +- Investigate a property dialog that can run non-modal -- + Whenever a new item is selected, change that dialog (much like the properties + dialog in Glade). The property dialog should be a full fledged view of the + selected item, so that changes are made outside of the dialog the dialog + is notified and updated. + +- 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. + +- Add statusbar showing: + + % Zoom + X, Y position + Object parameters (size and origin) while being drawn by user + + Probably need to emit some additional signals from the display widget + to support this. + +- 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. + +- Capability to edit text in-place. + +- Add support for the import of vector graphics formats such as EPS or SVG. + +- 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. + +- Text effects. (follow contour, shadows, ...) If we can support SVG and + EPS objects, this can be accomplished in a more suitable program. + +- Support label sheets with more than one type of label, i.e. a cd/dvd label + sheet might also contain a jewel case label. Can we assume labels are + grouped? Arrange in a tabbed notebook. + +- Support labels not exactly layed out on a grid, but in some other regular + pattern. Like a running-bond: + + +------+ +------+ + | | | | + +------+ +------+ + +------+ +------+ + | | | | + +------+ +------+ + ... + +- Tools to change color, line width, and font for all selected objects. + Perhaps just an edit properties dialog, with these common elements: + + Line Properties + color, width + Fill Properties + color + Text Properites + font, size, B, I, color, alignment + +- Undo, Redo capability + +- Make text items rich. I.e. allow multiple characteristics to exist within + a single object. I believe this may be facilitated better in the Gnome 2.0 + platform. + +- Add rounding option to rectangles + +- Add a mini style preview for barcode properties (possibly text too?). + +- Have some way to access property dialogs from the menu. Perhaps, each + object should be given a unique name. Perhaps: + + Properties --> Label + --> Objects -- Text1 + Line1 + Line2 + + Or maybe there should simply be a properties-explorer that uses a tree + widget or something. Once the objects have been given default names, + one should also be able to name the objects in their property dialogs. + +- Investigate making "full fledged" objects for canvas items. Currently + a lot of data is being hung off of these items in the form of + gtk_object_data. Perhaps an item would be a simple object, with various + backend objects. + +- Create a custom widget to replace spin buttons for positioning and sizing + that have arrows in the proper direction. Eye candy. + + <- X -> + + ->||<- W |<-->| + + diff --git a/glabels1/acconfig.h b/glabels1/acconfig.h new file mode 100644 index 00000000..c6f3e036 --- /dev/null +++ b/glabels1/acconfig.h @@ -0,0 +1,10 @@ +#undef ENABLE_NLS +#undef HAVE_CATGETS +#undef HAVE_GETTEXT +#undef HAVE_LC_MESSAGES +#undef HAVE_STPCPY +#undef HAVE_LIBSM +#undef PACKAGE_LOCALE_DIR +#undef PACKAGE_DATA_DIR +#undef PACKAGE_SOURCE_DIR +#undef HACKTEXT diff --git a/glabels1/aclocal.m4 b/glabels1/aclocal.m4 new file mode 100644 index 00000000..d49347b8 --- /dev/null +++ b/glabels1/aclocal.m4 @@ -0,0 +1,1227 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 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)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# aclocal-include.m4 +# +# This macro adds the name macrodir to the set of directories +# that `aclocal' searches for macros. + +# serial 1 + +dnl AM_ACLOCAL_INCLUDE(macrodir) +AC_DEFUN([AM_ACLOCAL_INCLUDE], +[ + AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y) + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done +]) + +# 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]) + +dnl +dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits]) +dnl +dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh +dnl is not found. +dnl + +AC_DEFUN([GNOME_INIT_HOOK],[ + AC_SUBST(GNOME_LIBS) + AC_SUBST(GNOMEUI_LIBS) + AC_SUBST(GNOMEGNORBA_LIBS) + AC_SUBST(GTKXMHTML_LIBS) + AC_SUBST(ZVT_LIBS) + AC_SUBST(GNOME_LIBDIR) + AC_SUBST(GNOME_INCLUDEDIR) + + AC_ARG_WITH(gnome-includes, + [ --with-gnome-includes Specify location of GNOME headers],[ + CFLAGS="$CFLAGS -I$withval" + ]) + + AC_ARG_WITH(gnome-libs, + [ --with-gnome-libs Specify location of GNOME libs],[ + LDFLAGS="$LDFLAGS -L$withval" + gnome_prefix=$withval + ]) + + AC_ARG_WITH(gnome, + [ --with-gnome Specify prefix for GNOME files], + if test x$withval = xyes; then + want_gnome=yes + dnl Note that an empty true branch is not + dnl valid sh syntax. + ifelse([$1], [], :, [$1]) + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi, + want_gnome=yes) + + if test "x$want_gnome" = xyes; then + + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = "no"; then + no_gnome_config="yes" + else + AC_MSG_CHECKING(if $GNOME_CONFIG works) + if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then + AC_MSG_RESULT(yes) + GNOME_GNORBA_HOOK([],$2) + GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" + GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" + GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" + GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" + ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" + GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" + GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" + $1 + else + AC_MSG_RESULT(no) + no_gnome_config="yes" + fi + fi + + if test x$exec_prefix = xNONE; then + if test x$prefix = xNONE; then + gnome_prefix=$ac_default_prefix/lib + else + gnome_prefix=$prefix/lib + fi + else + gnome_prefix=`eval echo \`echo $libdir\`` + fi + + if test "$no_gnome_config" = "yes"; then + AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix) + if test -f $gnome_prefix/gnomeConf.sh; then + AC_MSG_RESULT(found) + echo "loading gnome configuration from" \ + "$gnome_prefix/gnomeConf.sh" + . $gnome_prefix/gnomeConf.sh + $1 + else + AC_MSG_RESULT(not found) + if test x$2 = xfail; then + AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install) + fi + fi + fi + fi + + if test -n "$3"; then + n="$3" + for i in $n; do + AC_MSG_CHECKING(extra library \"$i\") + case $i in + applets) + AC_SUBST(GNOME_APPLETS_LIBS) + GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` + AC_MSG_RESULT($GNOME_APPLETS_LIBS);; + capplet) + AC_SUBST(GNOME_CAPPLET_LIBS) + GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` + AC_MSG_RESULT($GNOME_CAPPLET_LIBS);; + *) + AC_MSG_RESULT(unknown library) + esac + done + fi +]) + +dnl +dnl GNOME_INIT ([additional-inits]) +dnl + +AC_DEFUN([GNOME_INIT],[ + GNOME_INIT_HOOK([],fail,$1) +]) + +dnl +dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag) +dnl +dnl if failflag is "failure" it aborts if gnorba is not found. +dnl + +AC_DEFUN([GNOME_GNORBA_HOOK],[ + GNOME_ORBIT_HOOK([],$2) + AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[ + gnome_cv_gnorba_found=no + if test x$gnome_cv_orbit_found = xyes; then + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + if test -n "$GNORBA_LIBS"; then + gnome_cv_gnorba_found=yes + fi + fi + ]) + AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + AC_SUBST(GNORBA_CFLAGS) + AC_SUBST(GNORBA_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(gnorba library not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_GNORBA_CHECK], [ + GNOME_GNORBA_HOOK([],failure) +]) + +dnl +dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag) +dnl +dnl if failflag is "failure" it aborts if orbit is not found. +dnl + +AC_DEFUN([GNOME_ORBIT_HOOK],[ + AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no) + AC_PATH_PROG(ORBIT_IDL,orbit-idl,no) + AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[ + if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then + gnome_cv_orbit_found=no + else + gnome_cv_orbit_found=yes + fi + ]) + AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + ORBIT_CFLAGS=`orbit-config --cflags client server` + ORBIT_LIBS=`orbit-config --use-service=name --libs client server` + AC_SUBST(ORBIT_CFLAGS) + AC_SUBST(ORBIT_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(ORBit not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_ORBIT_CHECK], [ + GNOME_ORBIT_HOOK([],failure) +]) + + +# serial 1 + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN(AM_PROG_CC_STDC, +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + +dnl GNOME_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([GNOME_COMPILE_WARNINGS],[ + AC_ARG_ENABLE(compile-warnings, + [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCFLAGS="-Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith" + fi + fi + fi + AC_MSG_RESULT($warnCFLAGS) + + 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) + if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + AC_SUBST(cflags_set) + fi +]) + +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 -Wpointer-arith -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 GNOME_X_CHECKS +dnl +dnl Basic X11 related checks for X11. At the end, the following will be +dnl defined/changed: +dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK +dnl CPPFLAGS Will include $X_CFLAGS +dnl GNOME_HAVE_SM `true' or `false' depending on whether session +dnl management is available. It is available if +dnl both -lSM and X11/SM/SMlib.h exist. (Some +dnl Solaris boxes have the library but not the header) +dnl XPM_LIBS -lXpm if Xpm library is present, otherwise "" +dnl +dnl The following configure cache variables are defined (but not used): +dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS} +dnl +AC_DEFUN([GNOME_X_CHECKS], +[ + AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path)) + dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could + dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes" + dnl + dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses + dnl CPPFLAGS, not CFLAGS + CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" + + saved_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS $GTK_LIBS" + + gnome_cv_passdown_x_libs="$GTK_LIBS" + gnome_cv_passdown_X_LIBS="$GTK_LIBS" + gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" + gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" + + LDFLAGS="$saved_ldflags $GTK_LIBS" + +dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow. + USE_DEVGTK=true + +dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x]) +dnl AC_EGREP_CPP(answer_affirmatively, +dnl [#include +dnl #ifdef GTK_HAVE_FEATURES_1_1_0 +dnl answer_affirmatively +dnl #endif +dnl ], dev_gtk=yes, dev_gtk=no) +dnl if test "$dev_gtk" = "yes"; then +dnl USE_DEVGTK=true +dnl fi +dnl AC_MSG_RESULT("$dev_gtk") + + GNOME_HAVE_SM=true + case "$GTK_LIBS" in + *-lSM*) + dnl Already found it. + ;; + *) + dnl Assume that if we have -lSM then we also have -lICE. + AC_CHECK_LIB(SM, SmcSaveYourselfDone, + [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false, + $x_libs -lICE) + ;; + esac + + if test "$GNOME_HAVE_SM" = true; then + AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false) + fi + + if test "$GNOME_HAVE_SM" = true; then + AC_DEFINE(HAVE_LIBSM) + fi + + XPM_LIBS="" + AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs) + AC_SUBST(XPM_LIBS) + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + LDFLAGS="$saved_ldflags" + + AC_PROVIDE([GNOME_X_CHECKS]) +]) + +# Configure paths for GTK+ +# Owen Taylor 97-11-3 + +dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS +dnl +AC_DEFUN(AM_PATH_GTK, +[dnl +dnl Get the cflags and libraries from the gtk-config script +dnl +AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], + gtk_config_prefix="$withval", gtk_config_prefix="") +AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], + gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") +AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], + , enable_gtktest=yes) + + for module in . $4 + do + case "$module" in + gthread) + gtk_config_args="$gtk_config_args gthread" + ;; + esac + done + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + AC_PATH_PROG(GTK_CONFIG, gtk-config, no) + min_gtk_version=ifelse([$1], ,0.99.7,$1) + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) + no_gtk="" + if test "$GTK_CONFIG" = "no" ; then + no_gtk=yes + else + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$GTK_LIBS $LIBS" +dnl +dnl Now check if the installed GTK is sufficiently new. (Also sanity +dnl checks the results of gtk-config to some extent +dnl + rm -f conf.gtktest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gtktest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If gtk-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } +#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) + else if ((gtk_major_version != GTK_MAJOR_VERSION) || + (gtk_minor_version != GTK_MINOR_VERSION) || + (gtk_micro_version != GTK_MICRO_VERSION)) + { + printf("*** GTK+ header files (version %d.%d.%d) do not match\n", + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + } +#endif /* defined (GTK_MAJOR_VERSION) ... */ + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GTK_CONFIG" = "no" ; then + echo "*** The gtk-config script installed by GTK could not be found" + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTK_CONFIG environment variable to the" + echo "*** full path to gtk-config." + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK test program, checking why..." + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK or finding the wrong" + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** or that you have moved GTK since it was installed. In the latter case, you" + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + rm -f conf.gtktest +]) + +dnl +dnl And better, use gthreads instead... +dnl + +AC_DEFUN([GNOME_PTHREAD_CHECK],[ + PTHREAD_LIB="" + AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread", + [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads", + [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r", + [AC_CHECK_FUNC(pthread_create)] + )] + )] + ) + AC_SUBST(PTHREAD_LIB) + AC_PROVIDE([GNOME_PTHREAD_CHECK]) +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 5 + +AC_DEFUN(AM_WITH_NLS, + [AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + USE_INCLUDED_LIBINTL=no + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + AC_DEFINE(ENABLE_NLS) + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + 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 gettext in libc], gt_cv_func_gettext_libc, + [AC_TRY_LINK([#include ], [return (int) gettext ("")], + gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) + + if test "$gt_cv_func_gettext_libc" != "yes"; then + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CACHE_CHECK([for gettext in libintl], + gt_cv_func_gettext_libintl, + [AC_CHECK_LIB(intl, gettext, + gt_cv_func_gettext_libintl=yes, + gt_cv_func_gettext_libintl=no)], + gt_cv_func_gettext_libintl=no)]) + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + AC_DEFINE(HAVE_GETTEXT) + 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 + ]) + + if test "$CATOBJEXT" = "NONE"; then + AC_MSG_CHECKING([whether catgets can be used]) + AC_ARG_WITH(catgets, + [ --with-catgets use catgets functions if available], + nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) + AC_MSG_RESULT($nls_cv_use_catgets) + + if test "$nls_cv_use_catgets" = "yes"; then + dnl No gettext in C library. Try catgets next. + AC_CHECK_LIB(i, main) + AC_CHECK_FUNC(catgets, + [AC_DEFINE(HAVE_CATGETS) + INTLOBJS="\$(CATOBJS)" + AC_PATH_PROG(GENCAT, gencat, no)dnl + if test "$GENCAT" != "no"; then + AC_PATH_PROG(GMSGFMT, gmsgfmt, no) + if test "$GMSGFMT" = "no"; then + AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) + fi + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.cat + INSTOBJEXT=.cat + DATADIRNAME=lib + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi]) + fi + 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 + dnl Mark actions used to generate GNU NLS library. + INTLOBJS="\$(GETTOBJS)" + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) + 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_SUBST(MSGFMT) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + 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 + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + 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(USE_INCLUDED_LIBINTL) + 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_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])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]) + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + AC_CHECK_FUNCS(stpcpy) + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + AC_DEFINE(HAVE_STPCPY) + fi + + AM_LC_MESSAGES + AM_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 The reference to in the installed file + dnl must be resolved because we cannot expect the users of this + dnl to define HAVE_LOCALE_H. + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + AC_SUBST(INCLUDE_LOCALE_H) + + 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 intl || mkdir intl + 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/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + dnl po2tbl.sed is always needed. + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + dnl In the intl/Makefile.in we have a special dependency which makes + dnl only sense for gettext. We comment this out for non-gettext + dnl packages. + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + AC_SUBST(GT_NO) + AC_SUBST(GT_YES) + + 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 *** For now the libtool support in intl/Makefile is not for real. + l= + AC_SUBST(l) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES) + fi + fi]) + diff --git a/glabels1/autogen.sh b/glabels1/autogen.sh new file mode 100755 index 00000000..36a7320f --- /dev/null +++ b/glabels1/autogen.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PKG_NAME="the package." + +(test -f $srcdir/configure.in) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level directory" + exit 1 +} + +. $srcdir/macros/autogen.sh diff --git a/glabels1/config.h.in b/glabels1/config.h.in new file mode 100644 index 00000000..7202e6c8 --- /dev/null +++ b/glabels1/config.h.in @@ -0,0 +1,134 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to empty if the keyword does not work. */ +#undef const + +/* 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 you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define to `long' if doesn't define. */ +#undef off_t + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* 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 + +#undef ENABLE_NLS +#undef HAVE_CATGETS +#undef HAVE_GETTEXT +#undef HAVE_LC_MESSAGES +#undef HAVE_STPCPY +#undef HAVE_LIBSM +#undef PACKAGE_LOCALE_DIR +#undef PACKAGE_DATA_DIR +#undef PACKAGE_SOURCE_DIR +#undef HACKTEXT + +/* 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 + +/* 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 you have the munmap function. */ +#undef HAVE_MUNMAP + +/* 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 stpcpy function. */ +#undef HAVE_STPCPY + +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the strchr function. */ +#undef HAVE_STRCHR + +/* Define if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define if you have the header file. */ +#undef HAVE_X11_SM_SMLIB_H + +/* Define if you have the header file. */ +#undef HAVE_ARGZ_H + +/* Define if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define if you have the header file. */ +#undef HAVE_NL_TYPES_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the i library (-li). */ +#undef HAVE_LIBI + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + diff --git a/glabels1/configure b/glabels1/configure new file mode 100755 index 00000000..aec4c187 --- /dev/null +++ b/glabels1/configure @@ -0,0 +1,5112 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --with-gnome-includes Specify location of GNOME headers" +ac_help="$ac_help + --with-gnome-libs Specify location of GNOME libs" +ac_help="$ac_help + --with-gnome Specify prefix for GNOME files" +ac_help="$ac_help + --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings." +ac_help="$ac_help + --enable-iso-c Try to warn if code is not ISO C " +ac_help="$ac_help + --with-gtk-prefix=PFX Prefix where GTK is installed (optional)" +ac_help="$ac_help + --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)" +ac_help="$ac_help + --disable-gtktest Do not try to compile and run a test GTK program" +ac_help="$ac_help + --disable-nls do not use Native Language Support" +ac_help="$ac_help + --with-included-gettext use the GNU gettext library included here" +ac_help="$ac_help + --with-catgets use catgets functions if available" +ac_help="$ac_help +--disable-hacktext don't use hacktext canvas item for AA text" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +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' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +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 + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # 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 ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) 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) + # 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 +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --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 + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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 ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + 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 "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +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_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# 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 + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=src/glabels.c + +# 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 "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# 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 "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +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 + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$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 +# 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 $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:580: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/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 test -f $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. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +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 "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:633: checking whether build environment is sane" >&5 +# 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 "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +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" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:690: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 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 conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=glabels + +VERSION=0.4.3 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:736: checking for working aclocal" >&5 +# 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 "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:749: checking for working autoconf" >&5 +# 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 "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:762: checking for working automake" >&5 +# 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 "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:775: checking for working autoheader" >&5 +# 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 "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:788: checking for working makeinfo" >&5 +# 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 "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + + + + + + + +if test x = y; then + INSIDE_GNOME_COMMON_TRUE= + INSIDE_GNOME_COMMON_FALSE='#' +else + INSIDE_GNOME_COMMON_TRUE='#' + INSIDE_GNOME_COMMON_FALSE= +fi + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in macros ; do ACLOCAL="$ACLOCAL -I $k" ; done + + + + + + + + + + + + + # Check whether --with-gnome-includes or --without-gnome-includes was given. +if test "${with_gnome_includes+set}" = set; then + withval="$with_gnome_includes" + + CFLAGS="$CFLAGS -I$withval" + +fi + + + # Check whether --with-gnome-libs or --without-gnome-libs was given. +if test "${with_gnome_libs+set}" = set; then + withval="$with_gnome_libs" + + LDFLAGS="$LDFLAGS -L$withval" + gnome_prefix=$withval + +fi + + + # Check whether --with-gnome or --without-gnome was given. +if test "${with_gnome+set}" = set; then + withval="$with_gnome" + if test x$withval = xyes; then + want_gnome=yes + : + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi +else + want_gnome=yes +fi + + + if test "x$want_gnome" = xyes; then + + # Extract the first word of "gnome-config", so it can be a program name with args. +set dummy gnome-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:876: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GNOME_CONFIG" in + /*) + ac_cv_path_GNOME_CONFIG="$GNOME_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GNOME_CONFIG="$GNOME_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GNOME_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GNOME_CONFIG" && ac_cv_path_GNOME_CONFIG="no" + ;; +esac +fi +GNOME_CONFIG="$ac_cv_path_GNOME_CONFIG" +if test -n "$GNOME_CONFIG"; then + echo "$ac_t""$GNOME_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$GNOME_CONFIG" = "no"; then + no_gnome_config="yes" + else + echo $ac_n "checking if $GNOME_CONFIG works""... $ac_c" 1>&6 +echo "configure:913: checking if $GNOME_CONFIG works" >&5 + if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then + echo "$ac_t""yes" 1>&6 + + + # Extract the first word of "orbit-config", so it can be a program name with args. +set dummy orbit-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:921: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_ORBIT_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$ORBIT_CONFIG" in + /*) + ac_cv_path_ORBIT_CONFIG="$ORBIT_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_ORBIT_CONFIG="$ORBIT_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_ORBIT_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_ORBIT_CONFIG" && ac_cv_path_ORBIT_CONFIG="no" + ;; +esac +fi +ORBIT_CONFIG="$ac_cv_path_ORBIT_CONFIG" +if test -n "$ORBIT_CONFIG"; then + echo "$ac_t""$ORBIT_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "orbit-idl", so it can be a program name with args. +set dummy orbit-idl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:957: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_ORBIT_IDL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$ORBIT_IDL" in + /*) + ac_cv_path_ORBIT_IDL="$ORBIT_IDL" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_ORBIT_IDL="$ORBIT_IDL" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_ORBIT_IDL="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_ORBIT_IDL" && ac_cv_path_ORBIT_IDL="no" + ;; +esac +fi +ORBIT_IDL="$ac_cv_path_ORBIT_IDL" +if test -n "$ORBIT_IDL"; then + echo "$ac_t""$ORBIT_IDL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking for working ORBit environment""... $ac_c" 1>&6 +echo "configure:991: checking for working ORBit environment" >&5 +if eval "test \"`echo '$''{'gnome_cv_orbit_found'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then + gnome_cv_orbit_found=no + else + gnome_cv_orbit_found=yes + fi + +fi + +echo "$ac_t""$gnome_cv_orbit_found" 1>&6 + + +if test x$gnome_cv_orbit_found = xyes; then + HAVE_ORBIT_TRUE= + HAVE_ORBIT_FALSE='#' +else + HAVE_ORBIT_TRUE='#' + HAVE_ORBIT_FALSE= +fi + if test x$gnome_cv_orbit_found = xyes; then + + ORBIT_CFLAGS=`orbit-config --cflags client server` + ORBIT_LIBS=`orbit-config --use-service=name --libs client server` + + + else + if test xfail = xfailure; then + { echo "configure: error: ORBit not installed or installation problem" 1>&2; exit 1; } + fi + fi + + echo $ac_n "checking for gnorba libraries""... $ac_c" 1>&6 +echo "configure:1027: checking for gnorba libraries" >&5 +if eval "test \"`echo '$''{'gnome_cv_gnorba_found'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + gnome_cv_gnorba_found=no + if test x$gnome_cv_orbit_found = xyes; then + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + if test -n "$GNORBA_LIBS"; then + gnome_cv_gnorba_found=yes + fi + fi + +fi + +echo "$ac_t""$gnome_cv_gnorba_found" 1>&6 + + +if test x$gnome_cv_gnorba_found = xyes; then + HAVE_GNORBA_TRUE= + HAVE_GNORBA_FALSE='#' +else + HAVE_GNORBA_TRUE='#' + HAVE_GNORBA_FALSE= +fi + if test x$gnome_cv_orbit_found = xyes; then + + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + + + else + if test xfail = xfailure; then + { echo "configure: error: gnorba library not installed or installation problem" 1>&2; exit 1; } + fi + fi + + GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" + GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" + GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" + GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" + ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" + GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" + GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" + + else + echo "$ac_t""no" 1>&6 + no_gnome_config="yes" + fi + fi + + if test x$exec_prefix = xNONE; then + if test x$prefix = xNONE; then + gnome_prefix=$ac_default_prefix/lib + else + gnome_prefix=$prefix/lib + fi + else + gnome_prefix=`eval echo \`echo $libdir\`` + fi + + if test "$no_gnome_config" = "yes"; then + echo $ac_n "checking for gnomeConf.sh file in $gnome_prefix""... $ac_c" 1>&6 +echo "configure:1091: checking for gnomeConf.sh file in $gnome_prefix" >&5 + if test -f $gnome_prefix/gnomeConf.sh; then + echo "$ac_t""found" 1>&6 + echo "loading gnome configuration from" \ + "$gnome_prefix/gnomeConf.sh" + . $gnome_prefix/gnomeConf.sh + + else + echo "$ac_t""not found" 1>&6 + if test xfail = xfail; then + { echo "configure: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install" 1>&2; exit 1; } + fi + fi + fi + fi + + if test -n ""; then + n="" + for i in $n; do + echo $ac_n "checking extra library \"$i\"""... $ac_c" 1>&6 +echo "configure:1111: checking extra library \"$i\"" >&5 + case $i in + applets) + + GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` + echo "$ac_t""$GNOME_APPLETS_LIBS" 1>&6;; + capplet) + + GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` + echo "$ac_t""$GNOME_CAPPLET_LIBS" 1>&6;; + *) + echo "$ac_t""unknown library" 1>&6 + esac + done + fi + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1131: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1161: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1212: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1244: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1255 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1286: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1291: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1319: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&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 + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:1351: checking for POSIXized ISC" >&5 +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 +then + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1374: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1404: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1455: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1487: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1498 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1529: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1534: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1562: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&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 + + + + +echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 +echo "configure:1597: checking for ${CC-cc} option to accept ANSI C" >&5 +if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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 < +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; + +int main() { + +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + +; return 0; } +EOF +if { (eval echo configure:1650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + am_cv_prog_cc_stdc="$ac_arg"; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +CC="$ac_save_CC" + +fi + +if test -z "$am_cv_prog_cc_stdc"; then + echo "$ac_t""none needed" 1>&6 +else + echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6 +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1674: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1754: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + 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 < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + 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 < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#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); } + +EOF +if { (eval echo configure:1834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + + + + # Check whether --enable-compile-warnings or --disable-compile-warnings was given. +if test "${enable_compile_warnings+set}" = set; then + enableval="$enable_compile_warnings" + : +else + enable_compile_warnings=minimum +fi + + + echo $ac_n "checking what warning flags to pass to the C compiler""... $ac_c" 1>&6 +echo "configure:1869: checking what warning flags to pass to the C compiler" >&5 + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *\ \ -Wall\ \ *) ;; + *) warnCFLAGS="-Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith" + fi + fi + fi + echo "$ac_t""$warnCFLAGS" 1>&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 $ac_n "checking what language compliance flags to pass to the C compiler""... $ac_c" 1>&6 +echo "configure:1901: checking what language compliance flags to pass to the C compiler" >&5 + 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 "$ac_t""$complCFLAGS" 1>&6 + if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + + fi + + + PTHREAD_LIB="" + echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:1926: checking for pthread_create in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + PTHREAD_LIB="-lpthread" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 +echo "configure:1964: checking for pthread_create in -lpthreads" >&5 +ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthreads $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + PTHREAD_LIB="-lpthreads" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 +echo "configure:2002: checking for pthread_create in -lc_r" >&5 +ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lc_r $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + PTHREAD_LIB="-lc_r" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 +echo "configure:2040: checking for pthread_create" >&5 +if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create(); + +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_pthread_create) || defined (__stub___pthread_create) +choke me +#else +pthread_create(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_pthread_create=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_pthread_create=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'pthread_create`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + + + + + # Check whether --with-gtk-prefix or --without-gtk-prefix was given. +if test "${with_gtk_prefix+set}" = set; then + withval="$with_gtk_prefix" + gtk_config_prefix="$withval" +else + gtk_config_prefix="" +fi + +# Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given. +if test "${with_gtk_exec_prefix+set}" = set; then + withval="$with_gtk_exec_prefix" + gtk_config_exec_prefix="$withval" +else + gtk_config_exec_prefix="" +fi + +# Check whether --enable-gtktest or --disable-gtktest was given. +if test "${enable_gtktest+set}" = set; then + enableval="$enable_gtktest" + : +else + enable_gtktest=yes +fi + + + for module in . + do + case "$module" in + gthread) + gtk_config_args="$gtk_config_args gthread" + ;; + esac + done + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + # Extract the first word of "gtk-config", so it can be a program name with args. +set dummy gtk-config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2150: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GTK_CONFIG" in + /*) + ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" + ;; +esac +fi +GTK_CONFIG="$ac_cv_path_GTK_CONFIG" +if test -n "$GTK_CONFIG"; then + echo "$ac_t""$GTK_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + min_gtk_version=1.2.0 + echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 +echo "configure:2185: checking for GTK - version >= $min_gtk_version" >&5 + no_gtk="" + if test "$GTK_CONFIG" = "no" ; then + no_gtk=yes + else + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$GTK_LIBS $LIBS" + rm -f conf.gtktest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat > conftest.$ac_ext < +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gtktest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If gtk-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } +#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) + else if ((gtk_major_version != GTK_MAJOR_VERSION) || + (gtk_minor_version != GTK_MINOR_VERSION) || + (gtk_micro_version != GTK_MICRO_VERSION)) + { + printf("*** GTK+ header files (version %d.%d.%d) do not match\n", + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + } +#endif /* defined (GTK_MAJOR_VERSION) ... */ + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +EOF +if { (eval echo configure:2286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + no_gtk=yes +fi +rm -fr conftest* +fi + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + echo "$ac_t""yes" 1>&6 + : + else + echo "$ac_t""no" 1>&6 + if test "$GTK_CONFIG" = "no" ; then + echo "*** The gtk-config script installed by GTK could not be found" + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTK_CONFIG environment variable to the" + echo "*** full path to gtk-config." + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK test program, checking why..." + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + cat > conftest.$ac_ext < +#include + +int main() { + return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); +; return 0; } +EOF +if { (eval echo configure:2330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK or finding the wrong" + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** or that you have moved GTK since it was installed. In the latter case, you" + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" +fi +rm -f conftest* + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + { echo "configure: error: GTK not installed" 1>&2; exit 1; } + fi + + + rm -f conf.gtktest + + CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" + + saved_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS $GTK_LIBS" + + gnome_cv_passdown_x_libs="$GTK_LIBS" + gnome_cv_passdown_X_LIBS="$GTK_LIBS" + gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" + gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" + + LDFLAGS="$saved_ldflags $GTK_LIBS" + + USE_DEVGTK=true + + + GNOME_HAVE_SM=true + case "$GTK_LIBS" in + *-lSM*) + ;; + *) + echo $ac_n "checking for SmcSaveYourselfDone in -lSM""... $ac_c" 1>&6 +echo "configure:2389: checking for SmcSaveYourselfDone in -lSM" >&5 +ac_lib_var=`echo SM'_'SmcSaveYourselfDone | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lSM $x_libs -lICE $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + GTK_LIBS="-lSM -lICE $GTK_LIBS" +else + echo "$ac_t""no" 1>&6 +GNOME_HAVE_SM=false +fi + + ;; + esac + + if test "$GNOME_HAVE_SM" = true; then + for ac_hdr in X11/SM/SMlib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2437: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2447: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +GNOME_HAVE_SM=false +fi +done + + fi + + if test "$GNOME_HAVE_SM" = true; then + cat >> confdefs.h <<\EOF +#define HAVE_LIBSM 1 +EOF + + fi + + XPM_LIBS="" + echo $ac_n "checking for XpmFreeXpmImage in -lXpm""... $ac_c" 1>&6 +echo "configure:2485: checking for XpmFreeXpmImage in -lXpm" >&5 +ac_lib_var=`echo Xpm'_'XpmFreeXpmImage | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lXpm $x_libs $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + XPM_LIBS="-lXpm" +else + echo "$ac_t""no" 1>&6 +fi + + + + + LDFLAGS="$saved_ldflags" + + + + + + + + + + dispname="LIBXML" + dispvers="1.8.10" + pkgname="xml" + + echo $ac_n "checking for $dispname >= $dispvers""... $ac_c" 1>&6 +echo "configure:2542: checking for $dispname >= $dispvers" >&5 + cmpvers=`echo $dispvers | awk -F. '{ print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` + if gnome-config --libs $pkgname > /dev/null 2>&1; then + pkgvers=`gnome-config --modversion $pkgname | sed -e 's/^[^0-9]*//'` + else + pkgvers=not + fi + echo "$ac_t""$pkgvers found" 1>&6 + + pkgvers=`echo $pkgvers | awk -F. '{ print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` + if test "$pkgvers" -lt $cmpvers; then + { echo "configure: error: +"" +"You need $dispname $dispvers or later to build gLabels" +"If you think you already have this installed, consult the README."" 1>&2; exit 1; } + fi + +GNOME_XML_CFLAGS=`gnome-config --cflags xml` +GNOME_XML_LIBS=`gnome-config --libs xml` + + + + + dispname="GNOME-PRINT" + dispvers="0.25" + pkgname="print" + + echo $ac_n "checking for $dispname >= $dispvers""... $ac_c" 1>&6 +echo "configure:2570: checking for $dispname >= $dispvers" >&5 + cmpvers=`echo $dispvers | awk -F. '{ print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` + if gnome-config --libs $pkgname > /dev/null 2>&1; then + pkgvers=`gnome-config --modversion $pkgname | sed -e 's/^[^0-9]*//'` + else + pkgvers=not + fi + echo "$ac_t""$pkgvers found" 1>&6 + + pkgvers=`echo $pkgvers | awk -F. '{ print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` + if test "$pkgvers" -lt $cmpvers; then + { echo "configure: error: +"" +"You need $dispname $dispvers or later to build gLabels" +"If you think you already have this installed, consult the README."" 1>&2; exit 1; } + fi + +GNOME_PRINT_CFLAGS=`gnome-config --cflags print` +GNOME_PRINT_LIBS=`gnome-config --libs print` + + + + + dispname="GDK-PIXBUF" + dispvers="0.11.0" + pkgname="gdk_pixbuf" + + echo $ac_n "checking for $dispname >= $dispvers""... $ac_c" 1>&6 +echo "configure:2598: checking for $dispname >= $dispvers" >&5 + cmpvers=`echo $dispvers | awk -F. '{ print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` + if gnome-config --libs $pkgname > /dev/null 2>&1; then + pkgvers=`gnome-config --modversion $pkgname | sed -e 's/^[^0-9]*//'` + else + pkgvers=not + fi + echo "$ac_t""$pkgvers found" 1>&6 + + pkgvers=`echo $pkgvers | awk -F. '{ print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` + if test "$pkgvers" -lt $cmpvers; then + { echo "configure: error: +"" +"You need $dispname $dispvers or later to build gLabels" +"If you think you already have this installed, consult the README."" 1>&2; exit 1; } + fi + +GDK_PIXBUF_CFLAGS=`gnome-config --cflags gdk_pixbuf` +GDK_PIXBUF_LIBS=`gnome-config --libs gdk_pixbuf` + + + + + dispname="GNOME-CANVAS-PIXBUF" + dispvers="0.11.0" + pkgname="gnomecanvaspixbuf" + + echo $ac_n "checking for $dispname >= $dispvers""... $ac_c" 1>&6 +echo "configure:2626: checking for $dispname >= $dispvers" >&5 + cmpvers=`echo $dispvers | awk -F. '{ print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` + if gnome-config --libs $pkgname > /dev/null 2>&1; then + pkgvers=`gnome-config --modversion $pkgname | sed -e 's/^[^0-9]*//'` + else + pkgvers=not + fi + echo "$ac_t""$pkgvers found" 1>&6 + + pkgvers=`echo $pkgvers | awk -F. '{ print $1 * 1000000 + $2 * 10000 + $3 * 100 + $4;}'` + if test "$pkgvers" -lt $cmpvers; then + { echo "configure: error: +"" +"You need $dispname $dispvers or later to build gLabels" +"If you think you already have this installed, consult the README."" 1>&2; exit 1; } + fi + +GNOME_CANVAS_PIXBUF_CFLAGS=`gnome-config --cflags gnomecanvaspixbuf` +GNOME_CANVAS_PIXBUF_LIBS=`gnome-config --libs gnomecanvaspixbuf` + + + + +ALL_LINGUAS="fr de ja pt_BR" +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2653: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:2681: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:2735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:2756: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <&6 +echo "configure:2796: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:2829: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + 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 $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:2864: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:2876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:2897: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:2930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # 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 $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:2962: checking whether alloca needs Cray hooks" >&5 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2992: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* 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(); + +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 +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:3047: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext < addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:3074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <&6 +echo "configure:3099: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3109: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3138: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* 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(); + +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 +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +echo $ac_n "checking for working mmap""... $ac_c" 1>&6 +echo "configure:3191: checking for working mmap" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat > conftest.$ac_ext < +#include +#include + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 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("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = 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 = 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); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:3339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_fixed_mapped=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi + + + for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h sys/param.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3367: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ +strdup __argz_count __argz_stringify __argz_next +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3407: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* 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(); + +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 +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + for ac_func in stpcpy +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3464: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* 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(); + +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 +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_STPCPY 1 +EOF + + fi + + if test $ac_cv_header_locale_h = yes; then + echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 +echo "configure:3526: checking for LC_MESSAGES" >&5 +if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return LC_MESSAGES +; return 0; } +EOF +if { (eval echo configure:3538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_val_LC_MESSAGES=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_val_LC_MESSAGES=no +fi +rm -f conftest* +fi + +echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 + if test $am_cv_val_LC_MESSAGES = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LC_MESSAGES 1 +EOF + + fi + fi + echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 +echo "configure:3559: checking whether NLS is requested" >&5 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi + + echo "$ac_t""$USE_NLS" 1>&6 + + + USE_INCLUDED_LIBINTL=no + + if test "$USE_NLS" = "yes"; then + cat >> confdefs.h <<\EOF +#define ENABLE_NLS 1 +EOF + + echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 +echo "configure:3579: checking whether included gettext is requested" >&5 + # Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval +else + nls_cv_force_use_gnu_gettext=no +fi + + echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 + + 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 + + ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 +echo "configure:3598: checking for libintl.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 +echo "configure:3625: checking for gettext in libc" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return (int) gettext ("") +; return 0; } +EOF +if { (eval echo configure:3637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + gt_cv_func_gettext_libc=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gettext_libc=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 + + if test "$gt_cv_func_gettext_libc" != "yes"; then + echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 +echo "configure:3653: checking for bindtextdomain in -lintl" >&5 +ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lintl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 +echo "configure:3688: checking for gettext in libintl" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6 +echo "configure:3693: checking for gettext in -lintl" >&5 +ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lintl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + gt_cv_func_gettext_libintl=yes +else + echo "$ac_t""no" 1>&6 +gt_cv_func_gettext_libintl=no +fi + +fi + +echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3751: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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 "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$MSGFMT" != "no"; then + for ac_func in dcgettext +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3785: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* 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(); + +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 +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3840: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3876: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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 "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + CATOBJEXT=.gmo + DATADIRNAME=share +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CATOBJEXT=.mo + DATADIRNAME=lib +fi +rm -f conftest* + INSTOBJEXT=.mo + fi + fi + +else + echo "$ac_t""no" 1>&6 +fi + + + if test "$CATOBJEXT" = "NONE"; then + echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6 +echo "configure:3939: checking whether catgets can be used" >&5 + # Check whether --with-catgets or --without-catgets was given. +if test "${with_catgets+set}" = set; then + withval="$with_catgets" + nls_cv_use_catgets=$withval +else + nls_cv_use_catgets=no +fi + + echo "$ac_t""$nls_cv_use_catgets" 1>&6 + + if test "$nls_cv_use_catgets" = "yes"; then + echo $ac_n "checking for main in -li""... $ac_c" 1>&6 +echo "configure:3952: checking for main in -li" >&5 +ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-li $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo i | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + echo $ac_n "checking for catgets""... $ac_c" 1>&6 +echo "configure:3995: checking for catgets" >&5 +if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char catgets(); + +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_catgets) || defined (__stub___catgets) +choke me +#else +catgets(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_catgets=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_catgets=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'catgets`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_CATGETS 1 +EOF + + INTLOBJS="\$(CATOBJS)" + # Extract the first word of "gencat", so it can be a program name with args. +set dummy gencat; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4045: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GENCAT" in + /*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GENCAT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no" + ;; +esac +fi +GENCAT="$ac_cv_path_GENCAT" +if test -n "$GENCAT"; then + echo "$ac_t""$GENCAT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$GENCAT" != "no"; then + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4081: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$GMSGFMT" = "no"; then + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4118: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # 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_GMSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4153: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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 "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.cat + INSTOBJEXT=.cat + DATADIRNAME=lib + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi +else + echo "$ac_t""no" 1>&6 +fi + + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + INTLOBJS="\$(GETTOBJS)" + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4211: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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="msgfmt" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4245: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4281: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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 "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS='$(top_builddir)/intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6 + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + + + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + 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 $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 +echo "configure:4374: checking for catalogs to be installed" >&5 + 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 "$ac_t""$LINGUAS" 1>&6 + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + + + test -d intl || mkdir intl + if test "$CATOBJEXT" = ".cat"; then + ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 +echo "configure:4402: checking for linux/version.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:4412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + msgformat=linux +else + echo "$ac_t""no" 1>&6 +msgformat=xopen +fi + + + sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + 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 + + + l= + + + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + + +if test "x${prefix}" = "xNONE"; then + cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <<\EOF +#define HACKTEXT 1 +EOF + +fi + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# 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 \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo " +Makefile +macros/Makefile +src/Makefile +src/pixmaps/Makefile +intl/Makefile +po/Makefile.in +doc/Makefile +doc/C/Makefile +glabels.spec + config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@INSIDE_GNOME_COMMON_TRUE@%$INSIDE_GNOME_COMMON_TRUE%g +s%@INSIDE_GNOME_COMMON_FALSE@%$INSIDE_GNOME_COMMON_FALSE%g +s%@GNOME_LIBS@%$GNOME_LIBS%g +s%@GNOMEUI_LIBS@%$GNOMEUI_LIBS%g +s%@GNOMEGNORBA_LIBS@%$GNOMEGNORBA_LIBS%g +s%@GTKXMHTML_LIBS@%$GTKXMHTML_LIBS%g +s%@ZVT_LIBS@%$ZVT_LIBS%g +s%@GNOME_LIBDIR@%$GNOME_LIBDIR%g +s%@GNOME_INCLUDEDIR@%$GNOME_INCLUDEDIR%g +s%@GNOME_CONFIG@%$GNOME_CONFIG%g +s%@ORBIT_CONFIG@%$ORBIT_CONFIG%g +s%@ORBIT_IDL@%$ORBIT_IDL%g +s%@HAVE_ORBIT_TRUE@%$HAVE_ORBIT_TRUE%g +s%@HAVE_ORBIT_FALSE@%$HAVE_ORBIT_FALSE%g +s%@ORBIT_CFLAGS@%$ORBIT_CFLAGS%g +s%@ORBIT_LIBS@%$ORBIT_LIBS%g +s%@HAVE_GNORBA_TRUE@%$HAVE_GNORBA_TRUE%g +s%@HAVE_GNORBA_FALSE@%$HAVE_GNORBA_FALSE%g +s%@GNORBA_CFLAGS@%$GNORBA_CFLAGS%g +s%@GNORBA_LIBS@%$GNORBA_LIBS%g +s%@GNOME_APPLETS_LIBS@%$GNOME_APPLETS_LIBS%g +s%@GNOME_CAPPLET_LIBS@%$GNOME_CAPPLET_LIBS%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@cflags_set@%$cflags_set%g +s%@GTK_CONFIG@%$GTK_CONFIG%g +s%@GTK_CFLAGS@%$GTK_CFLAGS%g +s%@GTK_LIBS@%$GTK_LIBS%g +s%@XPM_LIBS@%$XPM_LIBS%g +s%@PTHREAD_LIB@%$PTHREAD_LIB%g +s%@GNOME_XML_CFLAGS@%$GNOME_XML_CFLAGS%g +s%@GNOME_XML_LIBS@%$GNOME_XML_LIBS%g +s%@GNOME_PRINT_CFLAGS@%$GNOME_PRINT_CFLAGS%g +s%@GNOME_PRINT_LIBS@%$GNOME_PRINT_LIBS%g +s%@GDK_PIXBUF_CFLAGS@%$GDK_PIXBUF_CFLAGS%g +s%@GDK_PIXBUF_LIBS@%$GDK_PIXBUF_LIBS%g +s%@GNOME_CANVAS_PIXBUF_CFLAGS@%$GNOME_CANVAS_PIXBUF_CFLAGS%g +s%@GNOME_CANVAS_PIXBUF_LIBS@%$GNOME_CANVAS_PIXBUF_LIBS%g +s%@RANLIB@%$RANLIB%g +s%@ALLOCA@%$ALLOCA%g +s%@USE_NLS@%$USE_NLS%g +s%@MSGFMT@%$MSGFMT%g +s%@GMSGFMT@%$GMSGFMT%g +s%@XGETTEXT@%$XGETTEXT%g +s%@GENCAT@%$GENCAT%g +s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g +s%@CATALOGS@%$CATALOGS%g +s%@CATOBJEXT@%$CATOBJEXT%g +s%@DATADIRNAME@%$DATADIRNAME%g +s%@GMOFILES@%$GMOFILES%g +s%@INSTOBJEXT@%$INSTOBJEXT%g +s%@INTLDEPS@%$INTLDEPS%g +s%@INTLLIBS@%$INTLLIBS%g +s%@INTLOBJS@%$INTLOBJS%g +s%@POFILES@%$POFILES%g +s%@POSUB@%$POSUB%g +s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g +s%@GT_NO@%$GT_NO%g +s%@GT_YES@%$GT_YES%g +s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g +s%@l@%$l%g +s%@subdirs@%$subdirs%g + +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_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # 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" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + 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 "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# 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='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. 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.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# 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.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$1; shift; ac_dests=$* + set $ac_sources; ac_source=$1; shift; ac_sources=$* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } + fi +done +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h +case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +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=*) + ;; + -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_config_dir in barcode-0.96; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&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 + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + + + diff --git a/glabels1/configure.in b/glabels1/configure.in new file mode 100644 index 00000000..182d96c4 --- /dev/null +++ b/glabels1/configure.in @@ -0,0 +1,138 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(src/glabels.c) +AM_INIT_AUTOMAKE(glabels, 0.4.3) +AM_CONFIG_HEADER(config.h) + +dnl Pick up the Gnome macros. +AM_ACLOCAL_INCLUDE(macros) + +GNOME_INIT +AC_ISC_POSIX +AC_PROG_CC +AM_PROG_CC_STDC +AC_HEADER_STDC + +GNOME_COMPILE_WARNINGS +GNOME_X_CHECKS + + + +dnl ******************************************************************* +dnl * Check for required package and version (borrowed from Evolution) +dnl ******************************************************************* +AC_DEFUN(GLABELS_CHECK_LIB, [ + dispname="$1" + dispvers="$2" + pkgname="$3" + + AC_MSG_CHECKING(for $dispname >= $dispvers) + cmpvers=`echo $dispvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'` + if gnome-config --libs $pkgname > /dev/null 2>&1; then + pkgvers=`gnome-config --modversion $pkgname | sed -e 's/^[[^0-9]]*//'` + else + pkgvers=not + fi + AC_MSG_RESULT($pkgvers found) + + pkgvers=`echo $pkgvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'` + if test "$pkgvers" -lt $cmpvers; then + AC_MSG_ERROR([ +"" +"You need $dispname $dispvers or later to build gLabels" +"If you think you already have this installed, consult the README."]) + fi +]) + +dnl **************************************** +dnl * LIBXML +dnl **************************************** +GLABELS_CHECK_LIB(LIBXML, 1.8.10, xml) +GNOME_XML_CFLAGS=`gnome-config --cflags xml` +GNOME_XML_LIBS=`gnome-config --libs xml` +AC_SUBST(GNOME_XML_CFLAGS) +AC_SUBST(GNOME_XML_LIBS) + +dnl **************************************** +dnl * GNOME-PRINT +dnl **************************************** +GLABELS_CHECK_LIB(GNOME-PRINT, 0.25, print) +GNOME_PRINT_CFLAGS=`gnome-config --cflags print` +GNOME_PRINT_LIBS=`gnome-config --libs print` +AC_SUBST(GNOME_PRINT_CFLAGS) +AC_SUBST(GNOME_PRINT_LIBS) + +dnl **************************************** +dnl * GDK-PIXBUF +dnl **************************************** +GLABELS_CHECK_LIB(GDK-PIXBUF, 0.11.0, gdk_pixbuf) +GDK_PIXBUF_CFLAGS=`gnome-config --cflags gdk_pixbuf` +GDK_PIXBUF_LIBS=`gnome-config --libs gdk_pixbuf` +AC_SUBST(GDK_PIXBUF_CFLAGS) +AC_SUBST(GDK_PIXBUF_LIBS) + +dnl **************************************** +dnl * GNOME-CANVAS-PIXBUF +dnl **************************************** +GLABELS_CHECK_LIB(GNOME-CANVAS-PIXBUF, 0.11.0, gnomecanvaspixbuf) +GNOME_CANVAS_PIXBUF_CFLAGS=`gnome-config --cflags gnomecanvaspixbuf` +GNOME_CANVAS_PIXBUF_LIBS=`gnome-config --libs gnomecanvaspixbuf` +AC_SUBST(GNOME_CANVAS_PIXBUF_CFLAGS) +AC_SUBST(GNOME_CANVAS_PIXBUF_LIBS) + + +dnl **************************************** +dnl * Supported languages +dnl **************************************** +dnl Add the languages which your application supports here. +ALL_LINGUAS="fr de ja pt_BR" +AM_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.96) + + + +dnl **************************************** +dnl * Disable use of hacktext canvas item +dnl **************************************** +AC_ARG_ENABLE(hacktext, +[--disable-hacktext don't use hacktext canvas item for AA text], +enable_hacktext=$enableval, +enable_hacktext=yes) +if test "x$enable_hacktext" = "xyes"; then + AC_DEFINE(HACKTEXT) +fi + + + +dnl **************************************** +dnl * Makefiles +dnl **************************************** +AC_OUTPUT([ +Makefile +macros/Makefile +src/Makefile +src/pixmaps/Makefile +intl/Makefile +po/Makefile.in +doc/Makefile +doc/C/Makefile +glabels.spec +]) + + diff --git a/glabels1/data/predefined-labels.template b/glabels1/data/predefined-labels.template new file mode 100644 index 00000000..e2a95e01 --- /dev/null +++ b/glabels1/data/predefined-labels.template @@ -0,0 +1,469 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/glabels1/doc/C/Makefile.am b/glabels1/doc/C/Makefile.am new file mode 100644 index 00000000..51f464a5 --- /dev/null +++ b/glabels1/doc/C/Makefile.am @@ -0,0 +1,55 @@ +glabels_helpdir = $(datadir)/gnome/help/glabels/C + +glabels_help_DATA = \ + index.html \ + topic.dat + +SGML_FILES = \ + glabels.sgml + +EXTRA_DIST = \ + topic.dat \ + $(SGML_FILES) + +all: index.html + +index.html: glabels/index.html + -cp glabels/index.html . + +glabels/index.html: $(SGML_FILES) + -db2html glabels.sgml + -cp -rp images glabels/images + +dist-hook: index.html + -mkdir $(distdir)/glabels + -mkdir $(distdir)/glabels/stylesheet-images + -mkdir $(distdir)/glabels/images + -cp glabels/*.html $(distdir)/glabels + -cp glabels/*.css $(distdir)/glabels + -cp glabels/stylesheet-images/*.gif $(distdir)/glabels/stylesheet-images + -cp glabels/images/*.jpg $(distdir)/glabels/images + -mkdir $(distdir)/images + -cp images/*.jpg $(distdir)/images + +install-data-local: index.html + -$(mkinstalldirs) $(DESTDIR)$(glabels_helpdir)/images + -$(mkinstalldirs) $(DESTDIR)$(glabels_helpdir)/stylesheet-images + -for file in $(srcdir)/glabels/*.html $(srcdir)/glabels/*.css; do \ + basefile=`echo $$file | sed -e 's,^.*/,,'`; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(glabels_helpdir)/$$basefile; \ + done + -for file in $(srcdir)/glabels/images/*.jpg; do \ + basefile=`echo $$file | sed -e 's,^.*/,,'`; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(glabels_helpdir)/images/$$basefile; \ + done + -for file in $(srcdir)/glabels/stylesheet-images/*.gif; do \ + basefile=`echo $$file | sed -e 's,^.*/,,'`; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(glabels_helpdir)/stylesheet-images/$$basefile; \ + done + +glabels.ps: glabels.sgml + -db2ps $< + +glabels.rtf: glabels.sgml + -db2rtf $< + diff --git a/glabels1/doc/C/Makefile.in b/glabels1/doc/C/Makefile.in new file mode 100644 index 00000000..d066f16a --- /dev/null +++ b/glabels1/doc/C/Makefile.in @@ -0,0 +1,294 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 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@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@ +GNOMEUI_LIBS = @GNOMEUI_LIBS@ +GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@ +GNOME_CANVAS_PIXBUF_CFLAGS = @GNOME_CANVAS_PIXBUF_CFLAGS@ +GNOME_CANVAS_PIXBUF_LIBS = @GNOME_CANVAS_PIXBUF_LIBS@ +GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@ +GNOME_CONFIG = @GNOME_CONFIG@ +GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@ +GNOME_LIBDIR = @GNOME_LIBDIR@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_PRINT_CFLAGS = @GNOME_PRINT_CFLAGS@ +GNOME_PRINT_LIBS = @GNOME_PRINT_LIBS@ +GNOME_XML_CFLAGS = @GNOME_XML_CFLAGS@ +GNOME_XML_LIBS = @GNOME_XML_LIBS@ +GNORBA_CFLAGS = @GNORBA_CFLAGS@ +GNORBA_LIBS = @GNORBA_LIBS@ +GTKXMHTML_LIBS = @GTKXMHTML_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +ORBIT_CFLAGS = @ORBIT_CFLAGS@ +ORBIT_CONFIG = @ORBIT_CONFIG@ +ORBIT_IDL = @ORBIT_IDL@ +ORBIT_LIBS = @ORBIT_LIBS@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PTHREAD_LIB = @PTHREAD_LIB@ +RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XPM_LIBS = @XPM_LIBS@ +ZVT_LIBS = @ZVT_LIBS@ +cflags_set = @cflags_set@ +cxxflags_set = @cxxflags_set@ +l = @l@ + +glabels_helpdir = $(datadir)/gnome/help/glabels/C + +glabels_help_DATA = index.html topic.dat + + +SGML_FILES = glabels.sgml + + +EXTRA_DIST = topic.dat $(SGML_FILES) + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../config.h +CONFIG_CLEAN_FILES = +DATA = $(glabels_help_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: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps doc/C/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +install-glabels_helpDATA: $(glabels_help_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(glabels_helpdir) + @list='$(glabels_help_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(glabels_helpdir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(glabels_helpdir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(glabels_helpdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(glabels_helpdir)/$$p; \ + fi; fi; \ + done + +uninstall-glabels_helpDATA: + @$(NORMAL_UNINSTALL) + list='$(glabels_help_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(glabels_helpdir)/$$p; \ + done +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = doc/C + +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 + $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook +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-glabels_helpDATA install-data-local +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-glabels_helpDATA +uninstall: uninstall-am +all-am: Makefile $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(glabels_helpdir) + + +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: uninstall-glabels_helpDATA install-glabels_helpDATA tags distdir \ +info-am info dvi-am dvi check check-am installcheck-am installcheck \ +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 mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean + + +all: index.html + +index.html: glabels/index.html + -cp glabels/index.html . + +glabels/index.html: $(SGML_FILES) + -db2html glabels.sgml + -cp -rp images glabels/images + +dist-hook: index.html + -mkdir $(distdir)/glabels + -mkdir $(distdir)/glabels/stylesheet-images + -mkdir $(distdir)/glabels/images + -cp glabels/*.html $(distdir)/glabels + -cp glabels/*.css $(distdir)/glabels + -cp glabels/stylesheet-images/*.gif $(distdir)/glabels/stylesheet-images + -cp glabels/images/*.jpg $(distdir)/glabels/images + -mkdir $(distdir)/images + -cp images/*.jpg $(distdir)/images + +install-data-local: index.html + -$(mkinstalldirs) $(DESTDIR)$(glabels_helpdir)/images + -$(mkinstalldirs) $(DESTDIR)$(glabels_helpdir)/stylesheet-images + -for file in $(srcdir)/glabels/*.html $(srcdir)/glabels/*.css; do \ + basefile=`echo $$file | sed -e 's,^.*/,,'`; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(glabels_helpdir)/$$basefile; \ + done + -for file in $(srcdir)/glabels/images/*.jpg; do \ + basefile=`echo $$file | sed -e 's,^.*/,,'`; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(glabels_helpdir)/images/$$basefile; \ + done + -for file in $(srcdir)/glabels/stylesheet-images/*.gif; do \ + basefile=`echo $$file | sed -e 's,^.*/,,'`; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(glabels_helpdir)/stylesheet-images/$$basefile; \ + done + +glabels.ps: glabels.sgml + -db2ps $< + +glabels.rtf: glabels.sgml + -db2rtf $< + +# 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/glabels1/doc/C/glabels.sgml b/glabels1/doc/C/glabels.sgml new file mode 100644 index 00000000..2104f270 --- /dev/null +++ b/glabels1/doc/C/glabels.sgml @@ -0,0 +1,73 @@ +]> + + + + +
+ + + gLabels Manual + 2001Jim Evins + + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation + License, Version 1.1 or any later version published + by the Free Software Foundation with no Invariant Sections, no + Front-Cover Texts, and no Back-Cover Texts. You may obtain a copy + of the GNU Free Documentation License from + the Free Software Foundation by visiting their Web site or by writing to: + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + + Many of the names used by companies to distinguish their products and + services are claimed as trademarks. Where those names appear in any + GNOME documentation, and those trademarks are made aware to the members + of the GNOME Documentation Project, the names have been printed in caps + or initial caps. + + + + + + This is version &version; of the gLabels manual. + + + + + + + + + + + + Introduction + +See the README file. + + + + + + +
+ + + + + + + + + diff --git a/glabels1/doc/C/glabels/index.html b/glabels1/doc/C/glabels/index.html new file mode 100644 index 00000000..8f975ccd --- /dev/null +++ b/glabels1/doc/C/glabels/index.html @@ -0,0 +1,64 @@ + +gLabels Manual

gLabels Manual

Copyright © 2001 by Jim Evins


Table of Contents
Introduction

Introduction

See the README file.
\ No newline at end of file diff --git a/glabels1/doc/C/glabels/ln7.html b/glabels1/doc/C/glabels/ln7.html new file mode 100644 index 00000000..a0dd927f --- /dev/null +++ b/glabels1/doc/C/glabels/ln7.html @@ -0,0 +1,128 @@ + +
gLabels Manual

Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation + License, Version 1.1 or any later version published + by the Free Software Foundation with no Invariant Sections, no + Front-Cover Texts, and no Back-Cover Texts. You may obtain a copy + of the GNU Free Documentation License from + the Free Software Foundation by visiting their Web site or by writing to: + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +

Many of the names used by companies to distinguish their products and + services are claimed as trademarks. Where those names appear in any + GNOME documentation, and those trademarks are made aware to the members + of the GNOME Documentation Project, the names have been printed in caps + or initial caps. +


 Home 
 Up 
\ No newline at end of file diff --git a/glabels1/doc/C/topic.dat b/glabels1/doc/C/topic.dat new file mode 100644 index 00000000..368844b6 --- /dev/null +++ b/glabels1/doc/C/topic.dat @@ -0,0 +1 @@ +index.html gLabels Manual diff --git a/glabels1/doc/Makefile.am b/glabels1/doc/Makefile.am new file mode 100644 index 00000000..a68e4e50 --- /dev/null +++ b/glabels1/doc/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in. + +SUBDIRS = C diff --git a/glabels1/doc/Makefile.in b/glabels1/doc/Makefile.in new file mode 100644 index 00000000..878fdd3e --- /dev/null +++ b/glabels1/doc/Makefile.in @@ -0,0 +1,323 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 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@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@ +GNOMEUI_LIBS = @GNOMEUI_LIBS@ +GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@ +GNOME_CANVAS_PIXBUF_CFLAGS = @GNOME_CANVAS_PIXBUF_CFLAGS@ +GNOME_CANVAS_PIXBUF_LIBS = @GNOME_CANVAS_PIXBUF_LIBS@ +GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@ +GNOME_CONFIG = @GNOME_CONFIG@ +GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@ +GNOME_LIBDIR = @GNOME_LIBDIR@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_PRINT_CFLAGS = @GNOME_PRINT_CFLAGS@ +GNOME_PRINT_LIBS = @GNOME_PRINT_LIBS@ +GNOME_XML_CFLAGS = @GNOME_XML_CFLAGS@ +GNOME_XML_LIBS = @GNOME_XML_LIBS@ +GNORBA_CFLAGS = @GNORBA_CFLAGS@ +GNORBA_LIBS = @GNORBA_LIBS@ +GTKXMHTML_LIBS = @GTKXMHTML_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +ORBIT_CFLAGS = @ORBIT_CFLAGS@ +ORBIT_CONFIG = @ORBIT_CONFIG@ +ORBIT_IDL = @ORBIT_IDL@ +ORBIT_LIBS = @ORBIT_LIBS@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PTHREAD_LIB = @PTHREAD_LIB@ +RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XPM_LIBS = @XPM_LIBS@ +ZVT_LIBS = @ZVT_LIBS@ +cflags_set = @cflags_set@ +cxxflags_set = @cxxflags_set@ +l = @l@ + +SUBDIRS = C +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: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps doc/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +# 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 = doc + +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-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +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-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + +maintainer-clean-am: 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: 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 + + +# 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/glabels1/glabels.desktop b/glabels1/glabels.desktop new file mode 100644 index 00000000..0459cb15 --- /dev/null +++ b/glabels1/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/glabels1/glabels.spec b/glabels1/glabels.spec new file mode 100644 index 00000000..d2b30090 --- /dev/null +++ b/glabels1/glabels.spec @@ -0,0 +1,56 @@ +%define name glabels +%define ver 0.4.3 +%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.2 +Requires: gnome-libs >= 1.2.8 +Requires: gnome-print >= 0.25 +Requires: gdk-pixbuf >= 0.11.0 + +%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}/share/* + + +%changelog +* Sat May 19 2001 Jim Evins +- Created + diff --git a/glabels1/glabels.spec.in b/glabels1/glabels.spec.in new file mode 100644 index 00000000..d28a871d --- /dev/null +++ b/glabels1/glabels.spec.in @@ -0,0 +1,56 @@ +%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.2 +Requires: gnome-libs >= 1.2.8 +Requires: gnome-print >= 0.25 +Requires: gdk-pixbuf >= 0.11.0 + +%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}/share/* + + +%changelog +* Sat May 19 2001 Jim Evins +- Created + diff --git a/glabels1/install-sh b/glabels1/install-sh new file mode 100755 index 00000000..e9de2384 --- /dev/null +++ b/glabels1/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/glabels1/intl/ChangeLog b/glabels1/intl/ChangeLog new file mode 100644 index 00000000..19895015 --- /dev/null +++ b/glabels1/intl/ChangeLog @@ -0,0 +1,1086 @@ +1998-04-29 Ulrich Drepper + + * intl/localealias.c (read_alias_file): Use unsigned char for + local variables. Remove unused variable tp. + * intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char * + for type of codeset. For loosing Solaris systems. + * intl/loadinfo.h: Adapt prototype of _nl_normalize_codeset. + * intl/bindtextdom.c (BINDTEXTDOMAIN): Don't define local variable + len if not needed. + Patches by Jim Meyering. + +1998-04-28 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Don't assign the element use_mmap if + mmap is not supported. + + * hash-string.h: Don't include . + +1998-04-27 Ulrich Drepper + + * textdomain.c: Use strdup is available. + + * localealias.c: Define HAVE_MEMPCPY so that we can use this + function. Define and use semapahores to protect modfication of + global objects when compiling for glibc. Add code to allow + freeing alias table. + + * l10nflist.c: Don't assume stpcpy not being a macro. + + * gettextP.h: Define internal_function macri if not already done. + Use glibc byte-swap macros instead of defining SWAP when compiled + for glibc. + (struct loaded_domain): Add elements to allow unloading. + + * Makefile.in (distclean): Don't remove libintl.h here. + + * bindtextdomain.c: Carry over changes from glibc. Use strdup if + available. + + * dcgettext.c: Don't assume stpcpy not being a macro. Mark internal + functions. Add memory freeing code for glibc. + + * dgettext.c: Update copyright. + + * explodename.c: Include stdlib.h and string.h only if they exist. + Use strings.h eventually. + + * finddomain.c: Mark internal functions. Use strdup if available. + Add memory freeing code for glibc. + +1997-10-10 20:00 Ulrich Drepper + + * libgettext.h: Fix dummy textdomain and bindtextdomain macros. + They should return reasonable values. + Reported by Tom Tromey . + +1997-09-16 03:33 Ulrich Drepper + + * libgettext.h: Define PARAMS also to `args' if __cplusplus is defined. + * intlh.inst.in: Likewise. + Reported by Jean-Marc Lasgouttes . + + * libintl.glibc: Update from current glibc version. + +1997-09-06 02:10 Ulrich Drepper + + * intlh.inst.in: Reformat copyright. + +1997-08-19 15:22 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Remove wrong comment. + +1997-08-16 00:13 Ulrich Drepper + + * Makefile.in (install-data): Don't change directory to install. + +1997-08-01 14:30 Ulrich Drepper + + * cat-compat.c: Fix copyright. + + * localealias.c: Don't define strchr unless !HAVE_STRCHR. + + * loadmsgcat.c: Update copyright. Fix typos. + + * l10nflist.c: Don't define strchr unless !HAVE_STRCHR. + (_nl_make_l10nflist): Handle sponsor and revision correctly. + + * gettext.c: Update copyright. + * gettext.h: Likewise. + * hash-string.h: Likewise. + + * finddomain.c: Remoave dead code. Define strchr only if + !HAVE_STRCHR. + + * explodename.c: Include . + + * explodename.c: Reformat copyright text. + (_nl_explode_name): Fix typo. + + * dcgettext.c: Define and use __set_errno. + (guess_category_value): Don't use setlocale if HAVE_LC_MESSAGES is + not defined. + + * bindtextdom.c: Pretty printing. + +1997-05-01 02:25 Ulrich Drepper + + * dcgettext.c (guess_category_value): Don't depend on + HAVE_LC_MESSAGES. We don't need the macro here. + Patch by Bruno Haible . + + * cat-compat.c (textdomain): DoN't refer to HAVE_SETLOCALE_NULL + macro. Instead use HAVE_LOCALE_NULL and define it when using + glibc, as in dcgettext.c. + Patch by Bruno Haible . + + * Makefile.in (CPPFLAGS): New variable. Reported by Franc,ois + Pinard. + +Mon Mar 10 06:51:17 1997 Ulrich Drepper + + * Makefile.in: Implement handling of libtool. + + * gettextP.h: Change data structures for use of generic lowlevel + i18n file handling. + +Wed Dec 4 20:21:18 1996 Ulrich Drepper + + * textdomain.c: Put parentheses around arguments of memcpy macro + definition. + * localealias.c: Likewise. + * l10nflist.c: Likewise. + * finddomain.c: Likewise. + * bindtextdom.c: Likewise. + Reported by Thomas Esken. + +Mon Nov 25 22:57:51 1996 Ulrich Drepper + + * textdomain.c: Move definition of `memcpy` macro to right + position. + +Fri Nov 22 04:01:58 1996 Ulrich Drepper + + * finddomain.c [!HAVE_STRING_H && !_LIBC]: Define memcpy using + bcopy if not already defined. Reported by Thomas Esken. + * bindtextdom.c: Likewise. + * l10nflist.c: Likewise. + * localealias.c: Likewise. + * textdomain.c: Likewise. + +Tue Oct 29 11:10:27 1996 Ulrich Drepper + + * Makefile.in (libdir): Change to use exec_prefix instead of + prefix. Reported by Knut-HåvardAksnes . + +Sat Aug 31 03:07:09 1996 Ulrich Drepper + + * l10nflist.c (_nl_normalize_codeset): We convert to lower case, + so don't prepend uppercase `ISO' for only numeric arg. + +Fri Jul 19 00:15:46 1996 Ulrich Drepper + + * l10nflist.c: Move inclusion of argz.h, ctype.h, stdlib.h after + definition of _GNU_SOURCE. Patch by Roland McGrath. + + * Makefile.in (uninstall): Fix another bug with `for' loop and + empty arguments. Patch by Jim Meyering. Correct name os + uninstalled files: no intl- prefix anymore. + + * Makefile.in (install-data): Again work around shells which + cannot handle mpty for list. Reported by Jim Meyering. + +Sat Jul 13 18:11:35 1996 Ulrich Drepper + + * Makefile.in (install): Split goal. Now depend on install-exec + and install-data. + (install-exec, install-data): New goals. Created from former + install goal. + Reported by Karl Berry. + +Sat Jun 22 04:58:14 1996 Ulrich Drepper + + * Makefile.in (MKINSTALLDIRS): New variable. Path to + mkinstalldirs script. + (install): use MKINSTALLDIRS variable or if the script is not present + try to find it in the $top_scrdir). + +Wed Jun 19 02:56:56 1996 Ulrich Drepper + + * l10nflist.c: Linux libc *partly* includes the argz_* functions. + Grr. Work around by renaming the static version and use macros + for renaming. + +Tue Jun 18 20:11:17 1996 Ulrich Drepper + + * l10nflist.c: Correct presence test macros of __argz_* functions. + + * l10nflist.c: Include based on test of it instead when + __argz_* functions are available. + Reported by Andreas Schwab. + +Thu Jun 13 15:17:44 1996 Ulrich Drepper + + * explodename.c, l10nflist.c: Define NULL for dumb systems. + +Tue Jun 11 17:05:13 1996 Ulrich Drepper + + * intlh.inst.in, libgettext.h (dcgettext): Rename local variable + result to __result to prevent name clash. + + * l10nflist.c, localealias.c, dcgettext.c: Define _GNU_SOURCE to + get prototype for stpcpy and strcasecmp. + + * intlh.inst.in, libgettext.h: Move declaration of + `_nl_msg_cat_cntr' outside __extension__ block to prevent warning + from gcc's -Wnested-extern option. + +Fri Jun 7 01:58:00 1996 Ulrich Drepper + + * Makefile.in (install): Remove comment. + +Thu Jun 6 17:28:17 1996 Ulrich Drepper + + * Makefile.in (install): Work around for another Buglix stupidity. + Always use an `else' close for `if's. Reported by Nelson Beebe. + + * Makefile.in (intlh.inst): Correct typo in phony rule. + Reported by Nelson Beebe. + +Thu Jun 6 01:49:52 1996 Ulrich Drepper + + * dcgettext.c (read_alias_file): Rename variable alloca_list to + block_list as the macro calls assume. + Patch by Eric Backus. + + * localealias.c [!HAVE_ALLOCA]: Define alloca as macro using + malloc. + (read_alias_file): Rename varriabe alloca_list to block_list as the + macro calls assume. + Patch by Eric Backus. + + * l10nflist.c: Correct conditional for inclusion. + Reported by Roland McGrath. + + * Makefile.in (all): Depend on all-@USE_INCLUDED_LIBINTL@, not + all-@USE_NLS@. + + * Makefile.in (install): intlh.inst comes from local dir, not + $(srcdir). + + * Makefile.in (intlh.inst): Special handling of this goal. If + used in gettext, this is really a rul to construct this file. If + used in any other package it is defined as a .PHONY rule with + empty body. + + * finddomain.c: Extract locale file information handling into + l10nfile.c. Rename local stpcpy__ function to stpcpy. + + * dcgettext.c (stpcpy): Add local definition. + + * l10nflist.c: Solve some portability problems. Patches partly by + Thomas Esken. Add local definition of stpcpy. + +Tue Jun 4 02:47:49 1996 Ulrich Drepper + + * intlh.inst.in: Don't depend including on + HAVE_LOCALE_H. Instead configure must rewrite this fiile + depending on the result of the configure run. + + * Makefile.in (install): libintl.inst is now called intlh.inst. + Add rules for updating intlh.inst from intlh.inst.in. + + * libintl.inst: Renamed to intlh.inst.in. + + * localealias.c, dcgettext.c [__GNUC__]: Define HAVE_ALLOCA to 1 + because gcc has __buitlin_alloca. + Reported by Roland McGrath. + +Mon Jun 3 00:32:16 1996 Ulrich Drepper + + * Makefile.in (installcheck): New goal to fulfill needs of + automake's distcheck. + + * Makefile.in (install): Reorder commands so that VERSION is + found. + + * Makefile.in (gettextsrcdir): Now use subdirectory intl/ in + @datadir@/gettext. + (COMSRCS): Add l10nfile.c. + (OBJECTS): Add l10nfile.o. + (DISTFILES): Rename to DISTFILE.normal. Remove $(DISTFILES.common). + (DISTFILE.gettext): Remove $(DISTFILES.common). + (all-gettext): Remove goal. + (install): If $(PACKAGE) = gettext install, otherwose do nothing. No + package but gettext itself should install libintl.h + headers. + (dist): Extend goal to work for gettext, too. + (dist-gettext): Remove goal. + + * dcgettext.c [!HAVE_ALLOCA]: Define macro alloca by using malloc. + +Sun Jun 2 17:33:06 1996 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Parameter is now comes from + find_l10nfile. + +Sat Jun 1 02:23:03 1996 Ulrich Drepper + + * l10nflist.c (__argz_next): Add definition. + + * dcgettext.c [!HAVE_ALLOCA]: Add code for handling missing alloca + code. Use new l10nfile handling. + + * localealias.c [!HAVE_ALLOCA]: Add code for handling missing + alloca code. + + * l10nflist.c: Initial revision. + +Tue Apr 2 18:51:18 1996 Ulrich Drepper + + * Makefile.in (all-gettext): New goal. Same as all-yes. + +Thu Mar 28 23:01:22 1996 Karl Eichwalder + + * Makefile.in (gettextsrcdir): Define using @datadir@. + +Tue Mar 26 12:39:14 1996 Ulrich Drepper + + * finddomain.c: Include . Reported by Roland McGrath. + +Sat Mar 23 02:00:35 1996 Ulrich Drepper + + * finddomain.c (stpcpy): Rename to stpcpy__ to prevent clashing + with external declaration. + +Sat Mar 2 00:47:09 1996 Ulrich Drepper + + * Makefile.in (all-no): Rename from all_no. + +Sat Feb 17 00:25:59 1996 Ulrich Drepper + + * gettextP.h [loaded_domain]: Array `successor' must now contain up + to 63 elements (because of codeset name normalization). + + * finddomain.c: Implement codeset name normalization. + +Thu Feb 15 04:39:09 1996 Ulrich Drepper + + * Makefile.in (all): Define to `all-@USE_NLS@'. + (all-yes, all_no): New goals. `all-no' is noop, `all-yes' + is former all. + +Mon Jan 15 21:46:01 1996 Howard Gayle + + * localealias.c (alias_compare): Increment string pointers in loop + of strcasecmp replacement. + +Fri Dec 29 21:16:34 1995 Ulrich Drepper + + * Makefile.in (install-src): Who commented this goal out ? :-) + +Fri Dec 29 15:08:16 1995 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Save `errno'. Failing system calls + should not effect it because a missing catalog is no error. + Reported by Harald Knig . + +Tue Dec 19 22:09:13 1995 Ulrich Drepper + + * Makefile.in (Makefile): Explicitly use $(SHELL) for running + shell scripts. + +Fri Dec 15 17:34:59 1995 Andreas Schwab + + * Makefile.in (install-src): Only install library and header when + we use the own implementation. Don't do it when using the + system's gettext or catgets functions. + + * dcgettext.c (find_msg): Must not swap domain->hash_size here. + +Sat Dec 9 16:24:37 1995 Ulrich Drepper + + * localealias.c, libintl.inst, libgettext.h, hash-string.h, + gettextP.h, finddomain.c, dcgettext.c, cat-compat.c: + Use PARAMS instead of __P. Suggested by Roland McGrath. + +Tue Dec 5 11:39:14 1995 Larry Schwimmer + + * libgettext.h: Use `#if !defined (_LIBINTL_H)' instead of `#if + !_LIBINTL_H' because Solaris defines _LIBINTL_H as empty. + +Mon Dec 4 15:42:07 1995 Ulrich Drepper + + * Makefile.in (install-src): + Install libintl.inst instead of libintl.h.install. + +Sat Dec 2 22:51:38 1995 Marcus Daniels + + * cat-compat.c (textdomain): + Reverse order in which files are tried you load. First + try local file, when this failed absolute path. + +Wed Nov 29 02:03:53 1995 Nelson H. F. Beebe + + * cat-compat.c (bindtextdomain): Add missing { }. + +Sun Nov 26 18:21:41 1995 Ulrich Drepper + + * libintl.inst: Add missing __P definition. Reported by Nelson Beebe. + + * Makefile.in: + Add dummy `all' and `dvi' goals. Reported by Tom Tromey. + +Sat Nov 25 16:12:01 1995 Franc,ois Pinard + + * hash-string.h: Capitalize arguments of macros. + +Sat Nov 25 12:01:36 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Prevent files names longer than 13 + characters. libintl.h.glibc->libintl.glibc, + libintl.h.install->libintl.inst. Reported by Joshua R. Poulson. + +Sat Nov 25 11:31:12 1995 Eric Backus + + * dcgettext.c: Fix bug in preprocessor conditionals. + +Sat Nov 25 02:35:27 1995 Nelson H. F. Beebe + + * libgettext.h: Solaris cc does not understand + #if !SYMBOL1 && !SYMBOL2. Sad but true. + +Thu Nov 23 16:22:14 1995 Ulrich Drepper + + * hash-string.h (hash_string): + Fix for machine with >32 bit `unsigned long's. + + * dcgettext.c (DCGETTEXT): + Fix horrible bug in loop for alternative translation. + +Thu Nov 23 01:45:29 1995 Ulrich Drepper + + * po2tbl.sed.in, linux-msg.sed, xopen-msg.sed: + Some further simplifications in message number generation. + +Mon Nov 20 21:08:43 1995 Ulrich Drepper + + * libintl.h.glibc: Use __const instead of const in prototypes. + + * Makefile.in (install-src): + Install libintl.h.install instead of libintl.h. This + is a stripped-down version. Suggested by Peter Miller. + + * libintl.h.install, libintl.h.glibc: Initial revision. + + * localealias.c (_nl_expand_alias, read_alias_file): + Protect prototypes in type casts by __P. + +Tue Nov 14 16:43:58 1995 Ulrich Drepper + + * hash-string.h: Correct prototype for hash_string. + +Sun Nov 12 12:42:30 1995 Ulrich Drepper + + * hash-string.h (hash_string): Add prototype. + + * gettextP.h: Fix copyright. + (SWAP): Add prototype. + +Wed Nov 8 22:56:33 1995 Ulrich Drepper + + * localealias.c (read_alias_file): Forgot sizeof. + Avoid calling *printf function. This introduces a big overhead. + Patch by Roland McGrath. + +Tue Nov 7 14:21:08 1995 Ulrich Drepper + + * finddomain.c, cat-compat.c: Wrong indentation in #if for stpcpy. + + * finddomain.c (stpcpy): + Define substitution function local. The macro was to flaky. + + * cat-compat.c: Fix typo. + + * xopen-msg.sed, linux-msg.sed: + While bringing message number to right place only accept digits. + + * linux-msg.sed, xopen-msg.sed: Now that the counter does not have + leading 0s we don't need to remove them. Reported by Marcus + Daniels. + + * Makefile.in (../po/cat-id-tbl.o): Use $(top_srdir) in + dependency. Reported by Marcus Daniels. + + * cat-compat.c: (stpcpy) [!_LIBC && !HAVE_STPCPY]: Define replacement. + Generally cleanup using #if instead of #ifndef. + + * Makefile.in: Correct typos in comment. By Franc,ois Pinard. + +Mon Nov 6 00:27:02 1995 Ulrich Drepper + + * Makefile.in (install-src): Don't install libintl.h and libintl.a + if we use an available gettext implementation. + +Sun Nov 5 22:02:08 1995 Ulrich Drepper + + * libgettext.h: Fix typo: HAVE_CATGETTS -> HAVE_CATGETS. Reported + by Franc,ois Pinard. + + * libgettext.h: Use #if instead of #ifdef/#ifndef. + + * finddomain.c: + Comments describing what has to be done should start with FIXME. + +Sun Nov 5 19:38:01 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Split. Use DISTFILES with normal meaning. + DISTFILES.common names the files common to both dist goals. + DISTFILES.gettext are the files only distributed in GNU gettext. + +Sun Nov 5 17:32:54 1995 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Correct searching in derived locales. + This was necessary since a change in _nl_find_msg several weeks + ago. I really don't know this is still not fixed. + +Sun Nov 5 12:43:12 1995 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Test for FILENAME == NULL. This + might mark a special condition. + + * finddomain.c (make_entry_rec): Don't make illegal entry as decided. + + * Makefile.in (dist): Suppress error message when ln failed. + Get files from $(srcdir) explicitly. + + * libgettext.h (gettext_const): Rename to gettext_noop. + +Fri Nov 3 07:36:50 1995 Ulrich Drepper + + * finddomain.c (make_entry_rec): + Protect against wrong locale names by testing mask. + + * libgettext.h (gettext_const): Add macro definition. + Capitalize macro arguments. + +Thu Nov 2 23:15:51 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Test for pointer != NULL before accessing value. + Reported by Tom Tromey. + + * gettext.c (NULL): + Define as (void*)0 instad of 0. Reported by Franc,ois Pinard. + +Mon Oct 30 21:28:52 1995 Ulrich Drepper + + * po2tbl.sed.in: Serious typo bug fixed by Jim Meyering. + +Sat Oct 28 23:20:47 1995 Ulrich Drepper + + * libgettext.h: Disable dcgettext optimization for Solaris 2.3. + + * localealias.c (alias_compare): + Peter Miller reported that tolower in some systems is + even dumber than I thought. Protect call by `isupper'. + +Fri Oct 27 22:22:51 1995 Ulrich Drepper + + * Makefile.in (libdir, includedir): New variables. + (install-src): Install libintl.a and libintl.h in correct dirs. + +Fri Oct 27 22:07:29 1995 Ulrich Drepper + + * Makefile.in (SOURCES): Fix typo: intrl.compat.c -> intl-compat.c. + + * po2tbl.sed.in: Patch for buggy SEDs by Christian von Roques. + + * localealias.c: + Fix typo and superflous test. Reported by Christian von Roques. + +Fri Oct 6 11:52:05 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Correct some remainder from the pre-CEN syntax. Now + we don't have a constant number of successors anymore. + +Wed Sep 27 21:41:13 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Add libintl.h.glibc. + + * Makefile.in (dist-libc): Add goal for packing sources for glibc. + (COMSRCS, COMHDRS): Splitted to separate sources shared with glibc. + + * loadmsgcat.c: Forget to continue #if line. + + * localealias.c: + [_LIBC]: Rename strcasecmp to __strcasecmp to keep ANSI C name + space clean. + + * dcgettext.c, finddomain.c: Better comment to last change. + + * loadmsgcat.c: + [_LIBC]: Rename fstat, open, close, read, mmap, and munmap to + __fstat, __open, __close, __read, __mmap, and __munmap resp + to keep ANSI C name space clean. + + * finddomain.c: + [_LIBC]: Rename stpcpy to __stpcpy to keep ANSI C name space clean. + + * dcgettext.c: + [_LIBC]: Rename getced and stpcpy to __getcwd and __stpcpy resp to + keep ANSI C name space clean. + + * libgettext.h: + Include sys/types.h for those old SysV systems out there. + Reported by Francesco Potorti`. + + * loadmsgcat.c (use_mmap): Define if compiled for glibc. + + * bindtextdom.c: Include all those standard headers + unconditionally if _LIBC is defined. + + * finddomain.c: Fix 2 times defiend -> defined. + + * textdomain.c: Include libintl.h instead of libgettext.h when + compiling for glibc. Include all those standard headers + unconditionally if _LIBC is defined. + + * localealias.c, loadmsgcat.c: Prepare to be compiled in glibc. + + * gettext.c: + Include libintl.h instead of libgettext.h when compiling for glibc. + Get NULL from stddef.h if we compile for glibc. + + * finddomain.c: Include libintl.h instead of libgettext.h when + compiling for glibc. Include all those standard headers + unconditionally if _LIBC is defined. + + * dcgettext.c: Include all those standard headers unconditionally + if _LIBC is defined. + + * dgettext.c: If compiled in glibc include libintl.h instead of + libgettext.h. + (locale.h): Don't rely on HAVE_LOCALE_H when compiling for glibc. + + * dcgettext.c: If compiled in glibc include libintl.h instead of + libgettext.h. + (getcwd): Don't rely on HAVE_GETCWD when compiling for glibc. + + * bindtextdom.c: + If compiled in glibc include libintl.h instead of libgettext.h. + +Mon Sep 25 22:23:06 1995 Ulrich Drepper + + * localealias.c (_nl_expand_alias): Don't call bsearch if NMAP <= 0. + Reported by Marcus Daniels. + + * cat-compat.c (bindtextdomain): + String used in putenv must not be recycled. + Reported by Marcus Daniels. + + * libgettext.h (__USE_GNU_GETTEXT): + Additional symbol to signal that we use GNU gettext + library. + + * cat-compat.c (bindtextdomain): + Fix bug with the strange stpcpy replacement. + Reported by Nelson Beebe. + +Sat Sep 23 08:23:51 1995 Ulrich Drepper + + * cat-compat.c: Include for stpcpy prototype. + + * localealias.c (read_alias_file): + While expand strdup code temporary variable `cp' hided + higher level variable with same name. Rename to `tp'. + + * textdomain.c (textdomain): + Avoid warning by using temporary variable in strdup code. + + * finddomain.c (_nl_find_domain): Remove unused variable `application'. + +Thu Sep 21 15:51:44 1995 Ulrich Drepper + + * localealias.c (alias_compare): + Use strcasecmp() only if available. Else use + implementation in place. + + * intl-compat.c: + Wrapper functions now call *__ functions instead of __*. + + * libgettext.h: Declare prototypes for *__ functions instead for __*. + + * cat-compat.c, loadmsgcat.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + + * bindtextdom.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + Rename to bindtextdomain__ if not used in GNU C Library. + + * dgettext.c: + Rename function to dgettext__ if not used in GNU C Library. + + * gettext.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + Functions now called gettext__ if not used in GNU C Library. + + * dcgettext.c, localealias.c, textdomain.c, finddomain.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + +Sun Sep 17 23:14:49 1995 Ulrich Drepper + + * finddomain.c: Correct some bugs in handling of CEN standard + locale definitions. + +Thu Sep 7 01:49:28 1995 Ulrich Drepper + + * finddomain.c: Implement CEN syntax. + + * gettextP.h (loaded_domain): Extend number of successors to 31. + +Sat Aug 19 19:25:29 1995 Ulrich Drepper + + * Makefile.in (aliaspath): Remove path to X11 locale dir. + + * Makefile.in: Make install-src depend on install. This helps + gettext to install the sources and other packages can use the + install goal. + +Sat Aug 19 15:19:33 1995 Ulrich Drepper + + * Makefile.in (uninstall): Remove stuff installed by install-src. + +Tue Aug 15 13:13:53 1995 Ulrich Drepper + + * VERSION.in: Initial revision. + + * Makefile.in (DISTFILES): + Add VERSION file. This is not necessary for gettext, but + for other packages using this library. + +Tue Aug 15 06:16:44 1995 Ulrich Drepper + + * gettextP.h (_nl_find_domain): + New prototype after changing search strategy. + + * finddomain.c (_nl_find_domain): + We now try only to find a specified catalog. Fall back to other + catalogs listed in the locale list is now done in __dcgettext. + + * dcgettext.c (__dcgettext): + Now we provide message fall back even to different languages. + I.e. if a message is not available in one language all the other + in the locale list a tried. Formerly fall back was only possible + within one language. Implemented by moving one loop from + _nl_find_domain to here. + +Mon Aug 14 23:45:50 1995 Ulrich Drepper + + * Makefile.in (gettextsrcdir): + Directory where source of GNU gettext library are made + available. + (INSTALL, INSTALL_DATA): Programs used for installing sources. + (gettext-src): New. Rule to install GNU gettext sources for use in + gettextize shell script. + +Sun Aug 13 14:40:48 1995 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): + Use mmap for loading only when munmap function is + also available. + + * Makefile.in (install): Depend on `all' goal. + +Wed Aug 9 11:04:33 1995 Ulrich Drepper + + * localealias.c (read_alias_file): + Do not overwrite '\n' when terminating alias value string. + + * localealias.c (read_alias_file): + Handle long lines. Ignore the rest not fitting in + the buffer after the initial `fgets' call. + +Wed Aug 9 00:54:29 1995 Ulrich Drepper + + * gettextP.h (_nl_load_domain): + Add prototype, replacing prototype for _nl_load_msg_cat. + + * finddomain.c (_nl_find_domain): + Remove unneeded variable filename and filename_len. + (expand_alias): Remove prototype because functions does not + exist anymore. + + * localealias.c (read_alias_file): + Change type of fname_len parameter to int. + (xmalloc): Add prototype. + + * loadmsgcat.c: Better prototypes for xmalloc. + +Tue Aug 8 22:30:39 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Allow alias name to be constructed from the four components. + + * Makefile.in (aliaspath): New variable. Set to preliminary value. + (SOURCES): Add localealias.c. + (OBJECTS): Add localealias.o. + + * gettextP.h: Add prototype for _nl_expand_alias. + + * finddomain.c: Aliasing handled in intl/localealias.c. + + * localealias.c: Aliasing for locale names. + + * bindtextdom.c: Better prototypes for xmalloc and xstrdup. + +Mon Aug 7 23:47:42 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): gettext.perl is now found in misc/. + + * cat-compat.c (bindtextdomain): + Correct implementation. dirname parameter was not used. + Reported by Marcus Daniels. + + * gettextP.h (loaded_domain): + New fields `successor' and `decided' for oo, lazy + message handling implementation. + + * dcgettext.c: + Adopt for oo, lazy message handliing. + Now we can inherit translations from less specific locales. + (find_msg): New function. + + * loadmsgcat.c, finddomain.c: + Complete rewrite. Implement oo, lazy message handling :-). + We now have an additional environment variable `LANGUAGE' with + a higher priority than LC_ALL for the LC_MESSAGE locale. + Here we can set a colon separated list of specifications each + of the form `language[_territory[.codeset]][@modifier]'. + +Sat Aug 5 09:55:42 1995 Ulrich Drepper + + * finddomain.c (unistd.h): + Include to get _PC_PATH_MAX defined on system having it. + +Fri Aug 4 22:42:00 1995 Ulrich Drepper + + * finddomain.c (stpcpy): Include prototype. + + * Makefile.in (dist): Remove `copying instead' message. + +Wed Aug 2 18:52:03 1995 Ulrich Drepper + + * Makefile.in (ID, TAGS): Do not use $^. + +Tue Aug 1 20:07:11 1995 Ulrich Drepper + + * Makefile.in (TAGS, ID): Use $^ as command argument. + (TAGS): Give etags -o option t write to current directory, + not $(srcdir). + (ID): Use $(srcdir) instead os $(top_srcdir)/src. + (distclean): Remove ID. + +Sun Jul 30 11:51:46 1995 Ulrich Drepper + + * Makefile.in (gnulocaledir): + New variable, always using share/ for data directory. + (DEFS): Add GNULOCALEDIR, used in finddomain.c. + + * finddomain.c (_nl_default_dirname): + Set to GNULOCALEDIR, because it always has to point + to the directory where GNU gettext Library writes it to. + + * intl-compat.c (textdomain, bindtextdomain): + Undefine macros before function definition. + +Sat Jul 22 01:10:02 1995 Ulrich Drepper + + * libgettext.h (_LIBINTL_H): + Protect definition in case where this file is included as + libgettext.h on Solaris machines. Add comment about this. + +Wed Jul 19 02:36:42 1995 Ulrich Drepper + + * intl-compat.c (textdomain): Correct typo. + +Wed Jul 19 01:51:35 1995 Ulrich Drepper + + * dcgettext.c (dcgettext): Function now called __dcgettext. + + * dgettext.c (dgettext): Now called __dgettext and calls + __dcgettext. + + * gettext.c (gettext): + Function now called __gettext and calls __dgettext. + + * textdomain.c (textdomain): Function now called __textdomain. + + * bindtextdom.c (bindtextdomain): Function now called + __bindtextdomain. + + * intl-compat.c: Initial revision. + + * Makefile.in (SOURCES): Add intl-compat.c. + (OBJECTS): We always compile the GNU gettext library functions. + OBJECTS contains all objects but cat-compat.o, ../po/cat-if-tbl.o, + and intl-compat.o. + (GETTOBJS): Contains now only intl-compat.o. + + * libgettext.h: + Re-include protection matches dualistic character of libgettext.h. + For all functions in GNU gettext library define __ counter part. + + * finddomain.c (strchr): Define as index if not found in C library. + (_nl_find_domain): For relative paths paste / in between. + +Tue Jul 18 16:37:45 1995 Ulrich Drepper + + * loadmsgcat.c, finddomain.c: Add inclusion of sys/types.h. + + * xopen-msg.sed: Fix bug with `msgstr ""' lines. + A little bit better comments. + +Tue Jul 18 01:18:27 1995 Ulrich Drepper + + * Makefile.in: + po-mode.el, makelinks, combine-sh are now found in ../misc. + + * po-mode.el, makelinks, combine-sh, elisp-comp: + Moved to ../misc/. + + * libgettext.h, gettextP.h, gettext.h: Uniform test for __STDC__. + +Sun Jul 16 22:33:02 1995 Ulrich Drepper + + * Makefile.in (INSTALL, INSTALL_DATA): New variables. + (install-data, uninstall): Install/uninstall .elc file. + + * po-mode.el (Installation comment): + Add .pox as possible extension of .po files. + +Sun Jul 16 13:23:27 1995 Ulrich Drepper + + * elisp-comp: Complete new version by Franc,ois: This does not + fail when not compiling in the source directory. + +Sun Jul 16 00:12:17 1995 Ulrich Drepper + + * Makefile.in (../po/cat-id-tbl.o): + Use $(MAKE) instead of make for recursive make. + + * Makefile.in (.el.elc): Use $(SHELL) instead of /bin/sh. + (install-exec): Add missing dummy goal. + (install-data, uninstall): @ in multi-line shell command at + beginning, not in front of echo. Reported by Eric Backus. + +Sat Jul 15 00:21:28 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): + Rename libgettext.perl to gettext.perl to fit in 14 chars + file systems. + + * gettext.perl: + Rename to gettext.perl to fit in 14 chars file systems. + +Thu Jul 13 23:17:20 1995 Ulrich Drepper + + * cat-compat.c: If !STDC_HEADERS try to include malloc.h. + +Thu Jul 13 20:55:02 1995 Ulrich Drepper + + * po2tbl.sed.in: Pretty printing. + + * linux-msg.sed, xopen-msg.sed: + Correct bugs with handling substitute flags in branches. + + * hash-string.h (hash_string): + Old K&R compilers don't under stand `unsigned char'. + + * gettext.h (nls_uint32): + Some old K&R compilers (eg HP) don't understand `unsigned int'. + + * cat-compat.c (msg_to_cat_id): De-ANSI-fy prototypes. + +Thu Jul 13 01:34:33 1995 Ulrich Drepper + + * Makefile.in (ELCFILES): New variable. + (DISTFILES): Add elisp-comp. + Add implicit rule for .el -> .elc compilation. + (install-data): install $ELCFILES + (clean): renamed po-to-tbl and po-to-msg to po2tbl and po2msg resp. + + * elisp-comp: Initial revision + +Wed Jul 12 16:14:52 1995 Ulrich Drepper + + * Makefile.in: + cat-id-tbl.c is now found in po/. This enables us to use an identical + intl/ directory in all packages. + + * dcgettext.c (dcgettext): hashing does not work for table size <= 2. + + * textdomain.c: fix typo (#if def -> #if defined) + +Tue Jul 11 18:44:43 1995 Ulrich Drepper + + * Makefile.in (stamp-cat-id): use top_srcdir to address source files + (DISTFILES,distclean): move tupdate.perl to src/ + + * po-to-tbl.sed.in: + add additional jump to clear change flag to recognize multiline strings + +Tue Jul 11 01:32:50 1995 Ulrich Drepper + + * textdomain.c: Protect inclusion of stdlib.h and string.h. + + * loadmsgcat.c: Protect inclusion of stdlib.h. + + * libgettext.h: Protect inclusion of locale.h. + Allow use in C++ programs. + Define NULL is not happened already. + + * Makefile.in (DISTFILES): ship po-to-tbl.sed.in instead of + po-to-tbl.sed. + (distclean): remove po-to-tbl.sed and tupdate.perl. + + * tupdate.perl.in: Substitute Perl path even in exec line. + Don't include entries without translation from old .po file. + +Tue Jul 4 00:41:51 1995 Ulrich Drepper + + * tupdate.perl.in: use "Updated: " in msgid "". + + * cat-compat.c: Fix typo (LOCALDIR -> LOCALEDIR). + Define getenv if !__STDC__. + + * bindtextdom.c: Protect stdlib.h and string.h inclusion. + Define free if !__STDC__. + + * finddomain.c: Change DEF_MSG_DOM_DIR to LOCALEDIR. + Define free if !__STDC__. + + * cat-compat.c: Change DEF_MSG_DOM_DIR to LOCALEDIR. + +Mon Jul 3 23:56:30 1995 Ulrich Drepper + + * Makefile.in: Use LOCALEDIR instead of DEF_MSG_DOM_DIR. + Remove unneeded $(srcdir) from Makefile.in dependency. + + * makelinks: Add copyright and short description. + + * po-mode.el: Last version for 0.7. + + * tupdate.perl.in: Fix die message. + + * dcgettext.c: Protect include of string.h. + + * gettext.c: Protect include of stdlib.h and further tries to get NULL. + + * finddomain.c: Some corrections in includes. + + * Makefile.in (INCLUDES): Prune list correct path to Makefile.in. + + * po-to-tbl.sed: Adopt for new .po file format. + + * linux-msg.sed, xopen-msg.sed: Adopt for new .po file format. + +Sun Jul 2 23:55:03 1995 Ulrich Drepper + + * tupdate.perl.in: Complete rewrite for new .po file format. + +Sun Jul 2 02:06:50 1995 Ulrich Drepper + + * First official release. This directory contains all the code + needed to internationalize own packages. It provides functions + which allow to use the X/Open catgets function with an interface + like the Uniforum gettext function. For system which does not + have neither of those a complete implementation is provided. diff --git a/glabels1/intl/Makefile.in b/glabels1/intl/Makefile.in new file mode 100644 index 00000000..3f14c13c --- /dev/null +++ b/glabels1/intl/Makefile.in @@ -0,0 +1,216 @@ +# Makefile for directory with message catalog handling in GNU NLS Utilities. +# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +transform = @program_transform_name@ +libdir = $(exec_prefix)/lib +includedir = $(prefix)/include +datadir = $(prefix)/@DATADIRNAME@ +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale +gettextsrcdir = $(datadir)/gettext/intl +aliaspath = $(localedir):. +subdir = intl + +DESTDIR = + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = @MKINSTALLDIRS@ + +l = @l@ + +AR = ar +CC = @CC@ +LIBTOOL = @LIBTOOL@ +RANLIB = @RANLIB@ + +DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \ +-DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) + +HEADERS = $(COMHDRS) libgettext.h loadinfo.h +COMHDRS = gettext.h gettextP.h hash-string.h +SOURCES = $(COMSRCS) intl-compat.c cat-compat.c +COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \ +finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \ +explodename.c +OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \ +finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \ +explodename.$lo +CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo +GETTOBJS = intl-compat.$lo +DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \ +xopen-msg.sed $(HEADERS) $(SOURCES) +DISTFILES.normal = VERSION +DISTFILES.gettext = libintl.glibc intlh.inst.in + +.SUFFIXES: +.SUFFIXES: .c .o .lo +.c.o: + $(COMPILE) $< +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) $< + +INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib + +all: all-@USE_INCLUDED_LIBINTL@ + +all-yes: libintl.$la intlh.inst +all-no: + +libintl.a: $(OBJECTS) + rm -f $@ + $(AR) cru $@ $(OBJECTS) + $(RANLIB) $@ + +libintl.la: $(OBJECTS) + $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \ + -version-info 1:0 -rpath $(libdir) + +../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot + cd ../po && $(MAKE) cat-id-tbl.$lo + +check: all + +# This installation goal is only used in GNU gettext. Packages which +# only use the library should use install instead. + +# We must not install the libintl.h/libintl.a files if we are on a +# system which has the gettext() function in its C library or in a +# separate library or use the catgets interface. A special case is +# where configure found a previously installed GNU gettext library. +# If you want to use the one which comes with this version of the +# package, you have to use `configure --with-included-gettext'. +install: install-exec install-data +install-exec: all + if test "$(PACKAGE)" = "gettext" \ + && test '@INTLOBJS@' = '$(GETTOBJS)'; then \ + if test -r $(MKINSTALLDIRS); then \ + $(MKINSTALLDIRS) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ + else \ + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ + fi; \ + $(INSTALL_DATA) intlh.inst $(DESTDIR)$(includedir)/libintl.h; \ + $(INSTALL_DATA) libintl.a $(DESTDIR)$(libdir)/libintl.a; \ + else \ + : ; \ + fi +install-data: all + if test "$(PACKAGE)" = "gettext"; then \ + if test -r $(MKINSTALLDIRS); then \ + $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ + else \ + $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ + fi; \ + $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \ + dists="$(DISTFILES.common)"; \ + for file in $$dists; do \ + $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: + dists="$(DISTFILES.common)"; \ + for file in $$dists; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done + +info dvi: + +$(OBJECTS): ../config.h libgettext.h +bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h +dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h + +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) + here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES) + +id: ID + +ID: $(HEADERS) $(SOURCES) + here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES) + + +mostlyclean: + rm -f *.a *.o *.lo core core.* + +clean: mostlyclean + +distclean: clean + rm -f Makefile ID TAGS po2msg.sed po2tbl.sed + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + + +# GNU gettext needs not contain the file `VERSION' but contains some +# other files which should not be distributed in other packages. +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: Makefile $(DISTFILES) + if test "$(PACKAGE)" = gettext; then \ + additional="$(DISTFILES.gettext)"; \ + else \ + additional="$(DISTFILES.normal)"; \ + fi; \ + for file in $(DISTFILES.common) $$additional; do \ + ln $(srcdir)/$$file $(distdir) 2> /dev/null \ + || cp -p $(srcdir)/$$file $(distdir); \ + done + +dist-libc: + tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc + +Makefile: Makefile.in ../config.status + cd .. \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +# The dependency for intlh.inst is different in gettext and all other +# packages. Because we cannot you GNU make features we have to solve +# the problem while rewriting Makefile.in. +@GT_YES@intlh.inst: intlh.inst.in ../config.status +@GT_YES@ cd .. \ +@GT_YES@ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \ +@GT_YES@ $(SHELL) ./config.status +@GT_NO@.PHONY: intlh.inst +@GT_NO@intlh.inst: + +# 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/glabels1/intl/VERSION b/glabels1/intl/VERSION new file mode 100644 index 00000000..ee66b061 --- /dev/null +++ b/glabels1/intl/VERSION @@ -0,0 +1 @@ +GNU gettext library from gettext-0.10.35 diff --git a/glabels1/intl/bindtextdom.c b/glabels1/intl/bindtextdom.c new file mode 100644 index 00000000..d9c3f349 --- /dev/null +++ b/glabels1/intl/bindtextdom.c @@ -0,0 +1,203 @@ +/* Implementation of the bindtextdomain(3) function + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif + +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif +#include "gettext.h" +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +/* Contains the default location of the message catalogs. */ +extern const char _nl_default_dirname[]; + +/* List with bindings of specific domains. */ +extern struct binding *_nl_domain_bindings; + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define BINDTEXTDOMAIN __bindtextdomain +# ifndef strdup +# define strdup(str) __strdup (str) +# endif +#else +# define BINDTEXTDOMAIN bindtextdomain__ +#endif + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +char * +BINDTEXTDOMAIN (domainname, dirname) + const char *domainname; + const char *dirname; +{ + struct binding *binding; + + /* Some sanity checks. */ + if (domainname == NULL || domainname[0] == '\0') + return NULL; + + for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) + { + int compare = strcmp (domainname, binding->domainname); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It is not in the list. */ + binding = NULL; + break; + } + } + + if (dirname == NULL) + /* The current binding has be to returned. */ + return binding == NULL ? (char *) _nl_default_dirname : binding->dirname; + + if (binding != NULL) + { + /* The domain is already bound. If the new value and the old + one are equal we simply do nothing. Otherwise replace the + old binding. */ + if (strcmp (dirname, binding->dirname) != 0) + { + char *new_dirname; + + if (strcmp (dirname, _nl_default_dirname) == 0) + new_dirname = (char *) _nl_default_dirname; + else + { +#if defined _LIBC || defined HAVE_STRDUP + new_dirname = strdup (dirname); + if (new_dirname == NULL) + return NULL; +#else + size_t len = strlen (dirname) + 1; + new_dirname = (char *) malloc (len); + if (new_dirname == NULL) + return NULL; + + memcpy (new_dirname, dirname, len); +#endif + } + + if (binding->dirname != _nl_default_dirname) + free (binding->dirname); + + binding->dirname = new_dirname; + } + } + else + { + /* We have to create a new binding. */ +#if !defined _LIBC && !defined HAVE_STRDUP + size_t len; +#endif + struct binding *new_binding = + (struct binding *) malloc (sizeof (*new_binding)); + + if (new_binding == NULL) + return NULL; + +#if defined _LIBC || defined HAVE_STRDUP + new_binding->domainname = strdup (domainname); + if (new_binding->domainname == NULL) + return NULL; +#else + len = strlen (domainname) + 1; + new_binding->domainname = (char *) malloc (len); + if (new_binding->domainname == NULL) + return NULL; + memcpy (new_binding->domainname, domainname, len); +#endif + + if (strcmp (dirname, _nl_default_dirname) == 0) + new_binding->dirname = (char *) _nl_default_dirname; + else + { +#if defined _LIBC || defined HAVE_STRDUP + new_binding->dirname = strdup (dirname); + if (new_binding->dirname == NULL) + return NULL; +#else + len = strlen (dirname) + 1; + new_binding->dirname = (char *) malloc (len); + if (new_binding->dirname == NULL) + return NULL; + memcpy (new_binding->dirname, dirname, len); +#endif + } + + /* Now enqueue it. */ + if (_nl_domain_bindings == NULL + || strcmp (domainname, _nl_domain_bindings->domainname) < 0) + { + new_binding->next = _nl_domain_bindings; + _nl_domain_bindings = new_binding; + } + else + { + binding = _nl_domain_bindings; + while (binding->next != NULL + && strcmp (domainname, binding->next->domainname) > 0) + binding = binding->next; + + new_binding->next = binding->next; + binding->next = new_binding; + } + + binding = new_binding; + } + + return binding->dirname; +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__bindtextdomain, bindtextdomain); +#endif diff --git a/glabels1/intl/cat-compat.c b/glabels1/intl/cat-compat.c new file mode 100644 index 00000000..867d901b --- /dev/null +++ b/glabels1/intl/cat-compat.c @@ -0,0 +1,262 @@ +/* Compatibility code for gettext-using-catgets interface. + Copyright (C) 1995, 1997 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifdef STDC_HEADERS +# include +# include +#else +char *getenv (); +# ifdef HAVE_MALLOC_H +# include +# endif +#endif + +#ifdef HAVE_NL_TYPES_H +# include +#endif + +#include "libgettext.h" + +/* @@ end of prolog @@ */ + +/* XPG3 defines the result of `setlocale (category, NULL)' as: + ``Directs `setlocale()' to query `category' and return the current + setting of `local'.'' + However it does not specify the exact format. And even worse: POSIX + defines this not at all. So we can use this feature only on selected + system (e.g. those using GNU C Library). */ +#ifdef _LIBC +# define HAVE_LOCALE_NULL +#endif + +/* The catalog descriptor. */ +static nl_catd catalog = (nl_catd) -1; + +/* Name of the default catalog. */ +static const char default_catalog_name[] = "messages"; + +/* Name of currently used catalog. */ +static const char *catalog_name = default_catalog_name; + +/* Get ID for given string. If not found return -1. */ +static int msg_to_cat_id PARAMS ((const char *msg)); + +/* Substitution for systems lacking this function in their C library. */ +#if !_LIBC && !HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +#endif + + +/* Set currently used domain/catalog. */ +char * +textdomain (domainname) + const char *domainname; +{ + nl_catd new_catalog; + char *new_name; + size_t new_name_len; + char *lang; + +#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES \ + && defined HAVE_LOCALE_NULL + lang = setlocale (LC_MESSAGES, NULL); +#else + lang = getenv ("LC_ALL"); + if (lang == NULL || lang[0] == '\0') + { + lang = getenv ("LC_MESSAGES"); + if (lang == NULL || lang[0] == '\0') + lang = getenv ("LANG"); + } +#endif + if (lang == NULL || lang[0] == '\0') + lang = "C"; + + /* See whether name of currently used domain is asked. */ + if (domainname == NULL) + return (char *) catalog_name; + + if (domainname[0] == '\0') + domainname = default_catalog_name; + + /* Compute length of added path element. */ + new_name_len = sizeof (LOCALEDIR) - 1 + 1 + strlen (lang) + + sizeof ("/LC_MESSAGES/") - 1 + sizeof (PACKAGE) - 1 + + sizeof (".cat"); + + new_name = (char *) malloc (new_name_len); + if (new_name == NULL) + return NULL; + + strcpy (new_name, PACKAGE); + new_catalog = catopen (new_name, 0); + + if (new_catalog == (nl_catd) -1) + { + /* NLSPATH search didn't work, try absolute path */ + sprintf (new_name, "%s/%s/LC_MESSAGES/%s.cat", LOCALEDIR, lang, + PACKAGE); + new_catalog = catopen (new_name, 0); + + if (new_catalog == (nl_catd) -1) + { + free (new_name); + return (char *) catalog_name; + } + } + + /* Close old catalog. */ + if (catalog != (nl_catd) -1) + catclose (catalog); + if (catalog_name != default_catalog_name) + free ((char *) catalog_name); + + catalog = new_catalog; + catalog_name = new_name; + + return (char *) catalog_name; +} + +char * +bindtextdomain (domainname, dirname) + const char *domainname; + const char *dirname; +{ +#if HAVE_SETENV || HAVE_PUTENV + char *old_val, *new_val, *cp; + size_t new_val_len; + + /* This does not make much sense here but to be compatible do it. */ + if (domainname == NULL) + return NULL; + + /* Compute length of added path element. If we use setenv we don't need + the first byts for NLSPATH=, but why complicate the code for this + peanuts. */ + new_val_len = sizeof ("NLSPATH=") - 1 + strlen (dirname) + + sizeof ("/%L/LC_MESSAGES/%N.cat"); + + old_val = getenv ("NLSPATH"); + if (old_val == NULL || old_val[0] == '\0') + { + old_val = NULL; + new_val_len += 1 + sizeof (LOCALEDIR) - 1 + + sizeof ("/%L/LC_MESSAGES/%N.cat"); + } + else + new_val_len += strlen (old_val); + + new_val = (char *) malloc (new_val_len); + if (new_val == NULL) + return NULL; + +# if HAVE_SETENV + cp = new_val; +# else + cp = stpcpy (new_val, "NLSPATH="); +# endif + + cp = stpcpy (cp, dirname); + cp = stpcpy (cp, "/%L/LC_MESSAGES/%N.cat:"); + + if (old_val == NULL) + { +# if __STDC__ + stpcpy (cp, LOCALEDIR "/%L/LC_MESSAGES/%N.cat"); +# else + + cp = stpcpy (cp, LOCALEDIR); + stpcpy (cp, "/%L/LC_MESSAGES/%N.cat"); +# endif + } + else + stpcpy (cp, old_val); + +# if HAVE_SETENV + setenv ("NLSPATH", new_val, 1); + free (new_val); +# else + putenv (new_val); + /* Do *not* free the environment entry we just entered. It is used + from now on. */ +# endif + +#endif + + return (char *) domainname; +} + +#undef gettext +char * +gettext (msg) + const char *msg; +{ + int msgid; + + if (msg == NULL || catalog == (nl_catd) -1) + return (char *) msg; + + /* Get the message from the catalog. We always use set number 1. + The message ID is computed by the function `msg_to_cat_id' + which works on the table generated by `po-to-tbl'. */ + msgid = msg_to_cat_id (msg); + if (msgid == -1) + return (char *) msg; + + return catgets (catalog, 1, msgid, (char *) msg); +} + +/* Look through the table `_msg_tbl' which has `_msg_tbl_length' entries + for the one equal to msg. If it is found return the ID. In case when + the string is not found return -1. */ +static int +msg_to_cat_id (msg) + const char *msg; +{ + int cnt; + + for (cnt = 0; cnt < _msg_tbl_length; ++cnt) + if (strcmp (msg, _msg_tbl[cnt]._msg) == 0) + return _msg_tbl[cnt]._msg_number; + + return -1; +} + + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif diff --git a/glabels1/intl/dcgettext.c b/glabels1/intl/dcgettext.c new file mode 100644 index 00000000..c4c7a2c7 --- /dev/null +++ b/glabels1/intl/dcgettext.c @@ -0,0 +1,624 @@ +/* Implementation of the dcgettext(3) function. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#ifndef errno +extern int errno; +#endif +#ifndef __set_errno +# define __set_errno(val) errno = (val) +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +char *getenv (); +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +# include +#else +# include +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#include "gettext.h" +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif +#include "hash-string.h" + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# define getcwd __getcwd +# ifndef stpcpy +# define stpcpy __stpcpy +# endif +#else +# if !defined HAVE_GETCWD +char *getwd (); +# define getcwd(buf, max) getwd (buf) +# else +char *getcwd (); +# endif +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +#endif + +/* Amount to increase buffer size by in each try. */ +#define PATH_INCR 32 + +/* The following is from pathmax.h. */ +/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define + PATH_MAX but might cause redefinition warnings when sys/param.h is + later included (as on MORE/BSD 4.3). */ +#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__)) +# include +#endif + +#ifndef _POSIX_PATH_MAX +# define _POSIX_PATH_MAX 255 +#endif + +#if !defined(PATH_MAX) && defined(_PC_PATH_MAX) +# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX)) +#endif + +/* Don't include sys/param.h if it already has been. */ +#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN) +# include +#endif + +#if !defined(PATH_MAX) && defined(MAXPATHLEN) +# define PATH_MAX MAXPATHLEN +#endif + +#ifndef PATH_MAX +# define PATH_MAX _POSIX_PATH_MAX +#endif + +/* XPG3 defines the result of `setlocale (category, NULL)' as: + ``Directs `setlocale()' to query `category' and return the current + setting of `local'.'' + However it does not specify the exact format. And even worse: POSIX + defines this not at all. So we can use this feature only on selected + system (e.g. those using GNU C Library). */ +#ifdef _LIBC +# define HAVE_LOCALE_NULL +#endif + +/* Name of the default domain used for gettext(3) prior any call to + textdomain(3). The default value for this is "messages". */ +const char _nl_default_default_domain[] = "messages"; + +/* Value used as the default domain for gettext(3). */ +const char *_nl_current_default_domain = _nl_default_default_domain; + +/* Contains the default location of the message catalogs. */ +const char _nl_default_dirname[] = GNULOCALEDIR; + +/* List with bindings of specific domains created by bindtextdomain() + calls. */ +struct binding *_nl_domain_bindings; + +/* Prototypes for local functions. */ +static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file, + const char *msgid)) internal_function; +static const char *category_to_name PARAMS ((int category)) internal_function; +static const char *guess_category_value PARAMS ((int category, + const char *categoryname)) + internal_function; + + +/* For those loosing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +/* Nothing has to be done. */ +# define ADD_BLOCK(list, address) /* nothing */ +# define FREE_BLOCKS(list) /* nothing */ +#else +struct block_list +{ + void *address; + struct block_list *next; +}; +# define ADD_BLOCK(list, addr) \ + do { \ + struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ + /* If we cannot get a free block we cannot add the new element to \ + the list. */ \ + if (newp != NULL) { \ + newp->address = (addr); \ + newp->next = (list); \ + (list) = newp; \ + } \ + } while (0) +# define FREE_BLOCKS(list) \ + do { \ + while (list != NULL) { \ + struct block_list *old = list; \ + list = list->next; \ + free (old); \ + } \ + } while (0) +# undef alloca +# define alloca(size) (malloc (size)) +#endif /* have alloca */ + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DCGETTEXT __dcgettext +#else +# define DCGETTEXT dcgettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +char * +DCGETTEXT (domainname, msgid, category) + const char *domainname; + const char *msgid; + int category; +{ +#ifndef HAVE_ALLOCA + struct block_list *block_list = NULL; +#endif + struct loaded_l10nfile *domain; + struct binding *binding; + const char *categoryname; + const char *categoryvalue; + char *dirname, *xdomainname; + char *single_locale; + char *retval; + int saved_errno = errno; + + /* If no real MSGID is given return NULL. */ + if (msgid == NULL) + return NULL; + + /* If DOMAINNAME is NULL, we are interested in the default domain. If + CATEGORY is not LC_MESSAGES this might not make much sense but the + defintion left this undefined. */ + if (domainname == NULL) + domainname = _nl_current_default_domain; + + /* First find matching binding. */ + for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) + { + int compare = strcmp (domainname, binding->domainname); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It is not in the list. */ + binding = NULL; + break; + } + } + + if (binding == NULL) + dirname = (char *) _nl_default_dirname; + else if (binding->dirname[0] == '/') + dirname = binding->dirname; + else + { + /* We have a relative path. Make it absolute now. */ + size_t dirname_len = strlen (binding->dirname) + 1; + size_t path_max; + char *ret; + + path_max = (unsigned) PATH_MAX; + path_max += 2; /* The getcwd docs say to do this. */ + + dirname = (char *) alloca (path_max + dirname_len); + ADD_BLOCK (block_list, dirname); + + __set_errno (0); + while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE) + { + path_max += PATH_INCR; + dirname = (char *) alloca (path_max + dirname_len); + ADD_BLOCK (block_list, dirname); + __set_errno (0); + } + + if (ret == NULL) + { + /* We cannot get the current working directory. Don't signal an + error but simply return the default string. */ + FREE_BLOCKS (block_list); + __set_errno (saved_errno); + return (char *) msgid; + } + + stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname); + } + + /* Now determine the symbolic name of CATEGORY and its value. */ + categoryname = category_to_name (category); + categoryvalue = guess_category_value (category, categoryname); + + xdomainname = (char *) alloca (strlen (categoryname) + + strlen (domainname) + 5); + ADD_BLOCK (block_list, xdomainname); + + stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), + domainname), + ".mo"); + + /* Creating working area. */ + single_locale = (char *) alloca (strlen (categoryvalue) + 1); + ADD_BLOCK (block_list, single_locale); + + + /* Search for the given string. This is a loop because we perhaps + got an ordered list of languages to consider for th translation. */ + while (1) + { + /* Make CATEGORYVALUE point to the next element of the list. */ + while (categoryvalue[0] != '\0' && categoryvalue[0] == ':') + ++categoryvalue; + if (categoryvalue[0] == '\0') + { + /* The whole contents of CATEGORYVALUE has been searched but + no valid entry has been found. We solve this situation + by implicitly appending a "C" entry, i.e. no translation + will take place. */ + single_locale[0] = 'C'; + single_locale[1] = '\0'; + } + else + { + char *cp = single_locale; + while (categoryvalue[0] != '\0' && categoryvalue[0] != ':') + *cp++ = *categoryvalue++; + *cp = '\0'; + } + + /* If the current locale value is C (or POSIX) we don't load a + domain. Return the MSGID. */ + if (strcmp (single_locale, "C") == 0 + || strcmp (single_locale, "POSIX") == 0) + { + FREE_BLOCKS (block_list); + __set_errno (saved_errno); + return (char *) msgid; + } + + + /* Find structure describing the message catalog matching the + DOMAINNAME and CATEGORY. */ + domain = _nl_find_domain (dirname, single_locale, xdomainname); + + if (domain != NULL) + { + retval = find_msg (domain, msgid); + + if (retval == NULL) + { + int cnt; + + for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) + { + retval = find_msg (domain->successor[cnt], msgid); + + if (retval != NULL) + break; + } + } + + if (retval != NULL) + { + FREE_BLOCKS (block_list); + __set_errno (saved_errno); + return retval; + } + } + } + /* NOTREACHED */ +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dcgettext, dcgettext); +#endif + + +static char * +internal_function +find_msg (domain_file, msgid) + struct loaded_l10nfile *domain_file; + const char *msgid; +{ + size_t top, act, bottom; + struct loaded_domain *domain; + + if (domain_file->decided == 0) + _nl_load_domain (domain_file); + + if (domain_file->data == NULL) + return NULL; + + domain = (struct loaded_domain *) domain_file->data; + + /* Locate the MSGID and its translation. */ + if (domain->hash_size > 2 && domain->hash_tab != NULL) + { + /* Use the hashing table. */ + nls_uint32 len = strlen (msgid); + nls_uint32 hash_val = hash_string (msgid); + nls_uint32 idx = hash_val % domain->hash_size; + nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2)); + nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]); + + if (nstr == 0) + /* Hash table entry is empty. */ + return NULL; + + if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len + && strcmp (msgid, + domain->data + W (domain->must_swap, + domain->orig_tab[nstr - 1].offset)) == 0) + return (char *) domain->data + W (domain->must_swap, + domain->trans_tab[nstr - 1].offset); + + while (1) + { + if (idx >= domain->hash_size - incr) + idx -= domain->hash_size - incr; + else + idx += incr; + + nstr = W (domain->must_swap, domain->hash_tab[idx]); + if (nstr == 0) + /* Hash table entry is empty. */ + return NULL; + + if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len + && strcmp (msgid, + domain->data + W (domain->must_swap, + domain->orig_tab[nstr - 1].offset)) + == 0) + return (char *) domain->data + + W (domain->must_swap, domain->trans_tab[nstr - 1].offset); + } + /* NOTREACHED */ + } + + /* Now we try the default method: binary search in the sorted + array of messages. */ + bottom = 0; + top = domain->nstrings; + while (bottom < top) + { + int cmp_val; + + act = (bottom + top) / 2; + cmp_val = strcmp (msgid, domain->data + + W (domain->must_swap, + domain->orig_tab[act].offset)); + if (cmp_val < 0) + top = act; + else if (cmp_val > 0) + bottom = act + 1; + else + break; + } + + /* If an translation is found return this. */ + return bottom >= top ? NULL : (char *) domain->data + + W (domain->must_swap, + domain->trans_tab[act].offset); +} + + +/* Return string representation of locale CATEGORY. */ +static const char * +internal_function +category_to_name (category) + int category; +{ + const char *retval; + + switch (category) + { +#ifdef LC_COLLATE + case LC_COLLATE: + retval = "LC_COLLATE"; + break; +#endif +#ifdef LC_CTYPE + case LC_CTYPE: + retval = "LC_CTYPE"; + break; +#endif +#ifdef LC_MONETARY + case LC_MONETARY: + retval = "LC_MONETARY"; + break; +#endif +#ifdef LC_NUMERIC + case LC_NUMERIC: + retval = "LC_NUMERIC"; + break; +#endif +#ifdef LC_TIME + case LC_TIME: + retval = "LC_TIME"; + break; +#endif +#ifdef LC_MESSAGES + case LC_MESSAGES: + retval = "LC_MESSAGES"; + break; +#endif +#ifdef LC_RESPONSE + case LC_RESPONSE: + retval = "LC_RESPONSE"; + break; +#endif +#ifdef LC_ALL + case LC_ALL: + /* This might not make sense but is perhaps better than any other + value. */ + retval = "LC_ALL"; + break; +#endif + default: + /* If you have a better idea for a default value let me know. */ + retval = "LC_XXX"; + } + + return retval; +} + +/* Guess value of current locale from value of the environment variables. */ +static const char * +internal_function +guess_category_value (category, categoryname) + int category; + const char *categoryname; +{ + const char *retval; + + /* The highest priority value is the `LANGUAGE' environment + variable. This is a GNU extension. */ + retval = getenv ("LANGUAGE"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* `LANGUAGE' is not set. So we have to proceed with the POSIX + methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some + systems this can be done by the `setlocale' function itself. */ +#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL + return setlocale (category, NULL); +#else + /* Setting of LC_ALL overwrites all other. */ + retval = getenv ("LC_ALL"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* Next comes the name of the desired category. */ + retval = getenv (categoryname); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* Last possibility is the LANG environment variable. */ + retval = getenv ("LANG"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* We use C as the default domain. POSIX says this is implementation + defined. */ + return "C"; +#endif +} + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif + + +#ifdef _LIBC +/* If we want to free all resources we have to do some work at + program's end. */ +static void __attribute__ ((unused)) +free_mem (void) +{ + struct binding *runp; + + for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next) + { + free (runp->domainname); + if (runp->dirname != _nl_default_dirname) + /* Yes, this is a pointer comparison. */ + free (runp->dirname); + } + + if (_nl_current_default_domain != _nl_default_default_domain) + /* Yes, again a pointer comparison. */ + free ((char *) _nl_current_default_domain); +} + +text_set_element (__libc_subfreeres, free_mem); +#endif diff --git a/glabels1/intl/dgettext.c b/glabels1/intl/dgettext.c new file mode 100644 index 00000000..0510c2b0 --- /dev/null +++ b/glabels1/intl/dgettext.c @@ -0,0 +1,59 @@ +/* Implementation of the dgettext(3) function + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined HAVE_LOCALE_H || defined _LIBC +# include +#endif + +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DGETTEXT __dgettext +# define DCGETTEXT __dcgettext +#else +# define DGETTEXT dgettext__ +# define DCGETTEXT dcgettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog of the current + LC_MESSAGES locale. */ +char * +DGETTEXT (domainname, msgid) + const char *domainname; + const char *msgid; +{ + return DCGETTEXT (domainname, msgid, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dgettext, dgettext); +#endif diff --git a/glabels1/intl/explodename.c b/glabels1/intl/explodename.c new file mode 100644 index 00000000..8066dc29 --- /dev/null +++ b/glabels1/intl/explodename.c @@ -0,0 +1,188 @@ +/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 1995. + + This program is free software; you can redistribute 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +#endif +#include + +#include "loadinfo.h" + +/* On some strange systems still no definition of NULL is found. Sigh! */ +#ifndef NULL +# if defined __STDC__ && __STDC__ +# define NULL ((void *) 0) +# else +# define NULL 0 +# endif +#endif + +/* @@ end of prolog @@ */ + +int +_nl_explode_name (name, language, modifier, territory, codeset, + normalized_codeset, special, sponsor, revision) + char *name; + const char **language; + const char **modifier; + const char **territory; + const char **codeset; + const char **normalized_codeset; + const char **special; + const char **sponsor; + const char **revision; +{ + enum { undecided, xpg, cen } syntax; + char *cp; + int mask; + + *modifier = NULL; + *territory = NULL; + *codeset = NULL; + *normalized_codeset = NULL; + *special = NULL; + *sponsor = NULL; + *revision = NULL; + + /* Now we determine the single parts of the locale name. First + look for the language. Termination symbols are `_' and `@' if + we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + mask = 0; + syntax = undecided; + *language = cp = name; + while (cp[0] != '\0' && cp[0] != '_' && cp[0] != '@' + && cp[0] != '+' && cp[0] != ',') + ++cp; + + if (*language == cp) + /* This does not make sense: language has to be specified. Use + this entry as it is without exploding. Perhaps it is an alias. */ + cp = strchr (*language, '\0'); + else if (cp[0] == '_') + { + /* Next is the territory. */ + cp[0] = '\0'; + *territory = ++cp; + + while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' + && cp[0] != '+' && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= TERRITORY; + + if (cp[0] == '.') + { + /* Next is the codeset. */ + syntax = xpg; + cp[0] = '\0'; + *codeset = ++cp; + + while (cp[0] != '\0' && cp[0] != '@') + ++cp; + + mask |= XPG_CODESET; + + if (*codeset != cp && (*codeset)[0] != '\0') + { + *normalized_codeset = _nl_normalize_codeset (*codeset, + cp - *codeset); + if (strcmp (*codeset, *normalized_codeset) == 0) + free ((char *) *normalized_codeset); + else + mask |= XPG_NORM_CODESET; + } + } + } + + if (cp[0] == '@' || (syntax != xpg && cp[0] == '+')) + { + /* Next is the modifier. */ + syntax = cp[0] == '@' ? xpg : cen; + cp[0] = '\0'; + *modifier = ++cp; + + while (syntax == cen && cp[0] != '\0' && cp[0] != '+' + && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= XPG_MODIFIER | CEN_AUDIENCE; + } + + if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_')) + { + syntax = cen; + + if (cp[0] == '+') + { + /* Next is special application (CEN syntax). */ + cp[0] = '\0'; + *special = ++cp; + + while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= CEN_SPECIAL; + } + + if (cp[0] == ',') + { + /* Next is sponsor (CEN syntax). */ + cp[0] = '\0'; + *sponsor = ++cp; + + while (cp[0] != '\0' && cp[0] != '_') + ++cp; + + mask |= CEN_SPONSOR; + } + + if (cp[0] == '_') + { + /* Next is revision (CEN syntax). */ + cp[0] = '\0'; + *revision = ++cp; + + mask |= CEN_REVISION; + } + } + + /* For CEN syntax values it might be important to have the + separator character in the file name, not for XPG syntax. */ + if (syntax == xpg) + { + if (*territory != NULL && (*territory)[0] == '\0') + mask &= ~TERRITORY; + + if (*codeset != NULL && (*codeset)[0] == '\0') + mask &= ~XPG_CODESET; + + if (*modifier != NULL && (*modifier)[0] == '\0') + mask &= ~XPG_MODIFIER; + } + + return mask; +} diff --git a/glabels1/intl/finddomain.c b/glabels1/intl/finddomain.c new file mode 100644 index 00000000..81ea29bf --- /dev/null +++ b/glabels1/intl/finddomain.c @@ -0,0 +1,216 @@ +/* Handle list of needed message catalogs + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program is free software; you can redistribute 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#include "gettext.h" +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif + +/* @@ end of prolog @@ */ +/* List of already loaded domains. */ +static struct loaded_l10nfile *_nl_loaded_domains; + + +/* Return a data structure describing the message catalog described by + the DOMAINNAME and CATEGORY parameters with respect to the currently + established bindings. */ +struct loaded_l10nfile * +internal_function +_nl_find_domain (dirname, locale, domainname) + const char *dirname; + char *locale; + const char *domainname; +{ + struct loaded_l10nfile *retval; + const char *language; + const char *modifier; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *special; + const char *sponsor; + const char *revision; + const char *alias_value; + int mask; + + /* LOCALE can consist of up to four recognized parts for the XPG syntax: + + language[_territory[.codeset]][@modifier] + + and six parts for the CEN syntax: + + language[_territory][+audience][+special][,[sponsor][_revision]] + + Beside the first part all of them are allowed to be missing. If + the full specified locale is not found, the less specific one are + looked for. The various parts will be stripped off according to + the following order: + (1) revision + (2) sponsor + (3) special + (4) codeset + (5) normalized codeset + (6) territory + (7) audience/modifier + */ + + /* If we have already tested for this locale entry there has to + be one data set in the list of loaded domains. */ + retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, + strlen (dirname) + 1, 0, locale, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, domainname, 0); + if (retval != NULL) + { + /* We know something about this locale. */ + int cnt; + + if (retval->decided == 0) + _nl_load_domain (retval); + + if (retval->data != NULL) + return retval; + + for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) + { + if (retval->successor[cnt]->decided == 0) + _nl_load_domain (retval->successor[cnt]); + + if (retval->successor[cnt]->data != NULL) + break; + } + return cnt >= 0 ? retval : NULL; + /* NOTREACHED */ + } + + /* See whether the locale value is an alias. If yes its value + *overwrites* the alias name. No test for the original value is + done. */ + alias_value = _nl_expand_alias (locale); + if (alias_value != NULL) + { +#if defined _LIBC || defined HAVE_STRDUP + locale = strdup (alias_value); + if (locale == NULL) + return NULL; +#else + size_t len = strlen (alias_value) + 1; + locale = (char *) malloc (len); + if (locale == NULL) + return NULL; + + memcpy (locale, alias_value, len); +#endif + } + + /* Now we determine the single parts of the locale name. First + look for the language. Termination symbols are `_' and `@' if + we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + mask = _nl_explode_name (locale, &language, &modifier, &territory, + &codeset, &normalized_codeset, &special, + &sponsor, &revision); + + /* Create all possible locale entries which might be interested in + generalization. */ + retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, + strlen (dirname) + 1, mask, language, territory, + codeset, normalized_codeset, modifier, special, + sponsor, revision, domainname, 1); + if (retval == NULL) + /* This means we are out of core. */ + return NULL; + + if (retval->decided == 0) + _nl_load_domain (retval); + if (retval->data == NULL) + { + int cnt; + for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) + { + if (retval->successor[cnt]->decided == 0) + _nl_load_domain (retval->successor[cnt]); + if (retval->successor[cnt]->data != NULL) + break; + } + } + + /* The room for an alias was dynamically allocated. Free it now. */ + if (alias_value != NULL) + free (locale); + + return retval; +} + + +#ifdef _LIBC +static void __attribute__ ((unused)) +free_mem (void) +{ + struct loaded_l10nfile *runp = _nl_loaded_domains; + + while (runp != NULL) + { + struct loaded_l10nfile *here = runp; + if (runp->data != NULL) + _nl_unload_domain ((struct loaded_domain *) runp->data); + runp = runp->next; + free (here); + } +} + +text_set_element (__libc_subfreeres, free_mem); +#endif diff --git a/glabels1/intl/gettext.c b/glabels1/intl/gettext.c new file mode 100644 index 00000000..d929f98d --- /dev/null +++ b/glabels1/intl/gettext.c @@ -0,0 +1,70 @@ +/* Implementation of gettext(3) function. + Copyright (C) 1995, 1997 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef _LIBC +# define __need_NULL +# include +#else +# ifdef STDC_HEADERS +# include /* Just for NULL. */ +# else +# ifdef HAVE_STRING_H +# include +# else +# define NULL ((void *) 0) +# endif +# endif +#endif + +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define GETTEXT __gettext +# define DGETTEXT __dgettext +#else +# define GETTEXT gettext__ +# define DGETTEXT dgettext__ +#endif + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +char * +GETTEXT (msgid) + const char *msgid; +{ + return DGETTEXT (NULL, msgid); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__gettext, gettext); +#endif diff --git a/glabels1/intl/gettext.h b/glabels1/intl/gettext.h new file mode 100644 index 00000000..3cd23d7d --- /dev/null +++ b/glabels1/intl/gettext.h @@ -0,0 +1,105 @@ +/* Internal header for GNU gettext internationalization functions. + Copyright (C) 1995, 1997 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 Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _GETTEXT_H +#define _GETTEXT_H 1 + +#include + +#if HAVE_LIMITS_H || _LIBC +# include +#endif + +/* @@ end of prolog @@ */ + +/* The magic number of the GNU message catalog format. */ +#define _MAGIC 0x950412de +#define _MAGIC_SWAPPED 0xde120495 + +/* Revision number of the currently used .mo (binary) file format. */ +#define MO_REVISION_NUMBER 0 + +/* The following contortions are an attempt to use the C preprocessor + to determine an unsigned integral type that is 32 bits wide. An + alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but + doing that would require that the configure script compile and *run* + the resulting executable. Locally running cross-compiled executables + is usually not possible. */ + +#if __STDC__ +# define UINT_MAX_32_BITS 4294967295U +#else +# define UINT_MAX_32_BITS 0xFFFFFFFF +#endif + +/* If UINT_MAX isn't defined, assume it's a 32-bit type. + This should be valid for all systems GNU cares about because + that doesn't include 16-bit systems, and only modern systems + (that certainly have ) have 64+-bit integral types. */ + +#ifndef UINT_MAX +# define UINT_MAX UINT_MAX_32_BITS +#endif + +#if UINT_MAX == UINT_MAX_32_BITS +typedef unsigned nls_uint32; +#else +# if USHRT_MAX == UINT_MAX_32_BITS +typedef unsigned short nls_uint32; +# else +# if ULONG_MAX == UINT_MAX_32_BITS +typedef unsigned long nls_uint32; +# else + /* The following line is intended to throw an error. Using #error is + not portable enough. */ + "Cannot determine unsigned 32-bit data type." +# endif +# endif +#endif + + +/* Header for binary .mo file format. */ +struct mo_file_header +{ + /* The magic number. */ + nls_uint32 magic; + /* The revision number of the file format. */ + nls_uint32 revision; + /* The number of strings pairs. */ + nls_uint32 nstrings; + /* Offset of table with start offsets of original strings. */ + nls_uint32 orig_tab_offset; + /* Offset of table with start offsets of translation strings. */ + nls_uint32 trans_tab_offset; + /* Size of hashing table. */ + nls_uint32 hash_tab_size; + /* Offset of first hashing entry. */ + nls_uint32 hash_tab_offset; +}; + +struct string_desc +{ + /* Length of addressed string. */ + nls_uint32 length; + /* Offset of string in file. */ + nls_uint32 offset; +}; + +/* @@ begin of epilog @@ */ + +#endif /* gettext.h */ diff --git a/glabels1/intl/gettextP.h b/glabels1/intl/gettextP.h new file mode 100644 index 00000000..00c52031 --- /dev/null +++ b/glabels1/intl/gettextP.h @@ -0,0 +1,89 @@ +/* Header describing internals of gettext library + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program is free software; you can redistribute 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. */ + +#ifndef _GETTEXTP_H +#define _GETTEXTP_H + +#include "loadinfo.h" + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef internal_function +# define internal_function +#endif + +#ifndef W +# define W(flag, data) ((flag) ? SWAP (data) : (data)) +#endif + + +#ifdef _LIBC +# include +# define SWAP(i) bswap_32 (i) +#else +static nls_uint32 SWAP PARAMS ((nls_uint32 i)); + +static inline nls_uint32 +SWAP (i) + nls_uint32 i; +{ + return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24); +} +#endif + + +struct loaded_domain +{ + const char *data; + int use_mmap; + size_t mmap_size; + int must_swap; + nls_uint32 nstrings; + struct string_desc *orig_tab; + struct string_desc *trans_tab; + nls_uint32 hash_size; + nls_uint32 *hash_tab; +}; + +struct binding +{ + struct binding *next; + char *domainname; + char *dirname; +}; + +struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname, + char *__locale, + const char *__domainname)) + internal_function; +void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain)) + internal_function; +void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) + internal_function; + +/* @@ begin of epilog @@ */ + +#endif /* gettextP.h */ diff --git a/glabels1/intl/hash-string.h b/glabels1/intl/hash-string.h new file mode 100644 index 00000000..cacb38e4 --- /dev/null +++ b/glabels1/intl/hash-string.h @@ -0,0 +1,59 @@ +/* Implements a string hashing function. + Copyright (C) 1995, 1997 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 Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +#endif + +/* We assume to have `unsigned long int' value with at least 32 bits. */ +#define HASHWORDBITS 32 + + +/* Defines the so called `hashpjw' function by P.J. Weinberger + [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, + 1986, 1987 Bell Telephone Laboratories, Inc.] */ +static unsigned long hash_string PARAMS ((const char *__str_param)); + +static inline unsigned long +hash_string (str_param) + const char *str_param; +{ + unsigned long int hval, g; + const char *str = str_param; + + /* Compute the hash value for the given string. */ + hval = 0; + while (*str != '\0') + { + hval <<= 4; + hval += (unsigned long) *str++; + g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4)); + if (g != 0) + { + hval ^= g >> (HASHWORDBITS - 8); + hval ^= g; + } + } + return hval; +} diff --git a/glabels1/intl/intl-compat.c b/glabels1/intl/intl-compat.c new file mode 100644 index 00000000..503efa0f --- /dev/null +++ b/glabels1/intl/intl-compat.c @@ -0,0 +1,76 @@ +/* intl-compat.c - Stub functions to call gettext functions from GNU gettext + Library. + Copyright (C) 1995 Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "libgettext.h" + +/* @@ end of prolog @@ */ + + +#undef gettext +#undef dgettext +#undef dcgettext +#undef textdomain +#undef bindtextdomain + + +char * +bindtextdomain (domainname, dirname) + const char *domainname; + const char *dirname; +{ + return bindtextdomain__ (domainname, dirname); +} + + +char * +dcgettext (domainname, msgid, category) + const char *domainname; + const char *msgid; + int category; +{ + return dcgettext__ (domainname, msgid, category); +} + + +char * +dgettext (domainname, msgid) + const char *domainname; + const char *msgid; +{ + return dgettext__ (domainname, msgid); +} + + +char * +gettext (msgid) + const char *msgid; +{ + return gettext__ (msgid); +} + + +char * +textdomain (domainname) + const char *domainname; +{ + return textdomain__ (domainname); +} diff --git a/glabels1/intl/l10nflist.c b/glabels1/intl/l10nflist.c new file mode 100644 index 00000000..9c7dc183 --- /dev/null +++ b/glabels1/intl/l10nflist.c @@ -0,0 +1,411 @@ +/* Handle list of needed message catalogs + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 1995. + + This program is free software; you can redistribute 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + + +#if defined HAVE_STRING_H || defined _LIBC +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#if defined _LIBC || defined HAVE_ARGZ_H +# include +#endif +#include +#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#include "loadinfo.h" + +/* On some strange systems still no definition of NULL is found. Sigh! */ +#ifndef NULL +# if defined __STDC__ && __STDC__ +# define NULL ((void *) 0) +# else +# define NULL 0 +# endif +#endif + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# ifndef stpcpy +# define stpcpy(dest, src) __stpcpy(dest, src) +# endif +#else +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +#endif + +/* Define function which are usually not available. */ + +#if !defined _LIBC && !defined HAVE___ARGZ_COUNT +/* Returns the number of strings in ARGZ. */ +static size_t argz_count__ PARAMS ((const char *argz, size_t len)); + +static size_t +argz_count__ (argz, len) + const char *argz; + size_t len; +{ + size_t count = 0; + while (len > 0) + { + size_t part_len = strlen (argz); + argz += part_len + 1; + len -= part_len + 1; + count++; + } + return count; +} +# undef __argz_count +# define __argz_count(argz, len) argz_count__ (argz, len) +#endif /* !_LIBC && !HAVE___ARGZ_COUNT */ + +#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY +/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's + except the last into the character SEP. */ +static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep)); + +static void +argz_stringify__ (argz, len, sep) + char *argz; + size_t len; + int sep; +{ + while (len > 0) + { + size_t part_len = strlen (argz); + argz += part_len; + len -= part_len + 1; + if (len > 0) + *argz++ = sep; + } +} +# undef __argz_stringify +# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep) +#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */ + +#if !defined _LIBC && !defined HAVE___ARGZ_NEXT +static char *argz_next__ PARAMS ((char *argz, size_t argz_len, + const char *entry)); + +static char * +argz_next__ (argz, argz_len, entry) + char *argz; + size_t argz_len; + const char *entry; +{ + if (entry) + { + if (entry < argz + argz_len) + entry = strchr (entry, '\0') + 1; + + return entry >= argz + argz_len ? NULL : (char *) entry; + } + else + if (argz_len > 0) + return argz; + else + return 0; +} +# undef __argz_next +# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry) +#endif /* !_LIBC && !HAVE___ARGZ_NEXT */ + + +/* Return number of bits set in X. */ +static int pop PARAMS ((int x)); + +static inline int +pop (x) + int x; +{ + /* We assume that no more than 16 bits are used. */ + x = ((x & ~0x5555) >> 1) + (x & 0x5555); + x = ((x & ~0x3333) >> 2) + (x & 0x3333); + x = ((x >> 4) + x) & 0x0f0f; + x = ((x >> 8) + x) & 0xff; + + return x; +} + + +struct loaded_l10nfile * +_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, + territory, codeset, normalized_codeset, modifier, special, + sponsor, revision, filename, do_allocate) + struct loaded_l10nfile **l10nfile_list; + const char *dirlist; + size_t dirlist_len; + int mask; + const char *language; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *modifier; + const char *special; + const char *sponsor; + const char *revision; + const char *filename; + int do_allocate; +{ + char *abs_filename; + struct loaded_l10nfile *last = NULL; + struct loaded_l10nfile *retval; + char *cp; + size_t entries; + int cnt; + + /* Allocate room for the full file name. */ + abs_filename = (char *) malloc (dirlist_len + + strlen (language) + + ((mask & TERRITORY) != 0 + ? strlen (territory) + 1 : 0) + + ((mask & XPG_CODESET) != 0 + ? strlen (codeset) + 1 : 0) + + ((mask & XPG_NORM_CODESET) != 0 + ? strlen (normalized_codeset) + 1 : 0) + + (((mask & XPG_MODIFIER) != 0 + || (mask & CEN_AUDIENCE) != 0) + ? strlen (modifier) + 1 : 0) + + ((mask & CEN_SPECIAL) != 0 + ? strlen (special) + 1 : 0) + + (((mask & CEN_SPONSOR) != 0 + || (mask & CEN_REVISION) != 0) + ? (1 + ((mask & CEN_SPONSOR) != 0 + ? strlen (sponsor) + 1 : 0) + + ((mask & CEN_REVISION) != 0 + ? strlen (revision) + 1 : 0)) : 0) + + 1 + strlen (filename) + 1); + + if (abs_filename == NULL) + return NULL; + + retval = NULL; + last = NULL; + + /* Construct file name. */ + memcpy (abs_filename, dirlist, dirlist_len); + __argz_stringify (abs_filename, dirlist_len, ':'); + cp = abs_filename + (dirlist_len - 1); + *cp++ = '/'; + cp = stpcpy (cp, language); + + if ((mask & TERRITORY) != 0) + { + *cp++ = '_'; + cp = stpcpy (cp, territory); + } + if ((mask & XPG_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, codeset); + } + if ((mask & XPG_NORM_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, normalized_codeset); + } + if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0) + { + /* This component can be part of both syntaces but has different + leading characters. For CEN we use `+', else `@'. */ + *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@'; + cp = stpcpy (cp, modifier); + } + if ((mask & CEN_SPECIAL) != 0) + { + *cp++ = '+'; + cp = stpcpy (cp, special); + } + if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0) + { + *cp++ = ','; + if ((mask & CEN_SPONSOR) != 0) + cp = stpcpy (cp, sponsor); + if ((mask & CEN_REVISION) != 0) + { + *cp++ = '_'; + cp = stpcpy (cp, revision); + } + } + + *cp++ = '/'; + stpcpy (cp, filename); + + /* Look in list of already loaded domains whether it is already + available. */ + last = NULL; + for (retval = *l10nfile_list; retval != NULL; retval = retval->next) + if (retval->filename != NULL) + { + int compare = strcmp (retval->filename, abs_filename); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It's not in the list. */ + retval = NULL; + break; + } + + last = retval; + } + + if (retval != NULL || do_allocate == 0) + { + free (abs_filename); + return retval; + } + + retval = (struct loaded_l10nfile *) + malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len) + * (1 << pop (mask)) + * sizeof (struct loaded_l10nfile *))); + if (retval == NULL) + return NULL; + + retval->filename = abs_filename; + retval->decided = (__argz_count (dirlist, dirlist_len) != 1 + || ((mask & XPG_CODESET) != 0 + && (mask & XPG_NORM_CODESET) != 0)); + retval->data = NULL; + + if (last == NULL) + { + retval->next = *l10nfile_list; + *l10nfile_list = retval; + } + else + { + retval->next = last->next; + last->next = retval; + } + + entries = 0; + /* If the DIRLIST is a real list the RETVAL entry corresponds not to + a real file. So we have to use the DIRLIST separation mechanism + of the inner loop. */ + cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask; + for (; cnt >= 0; --cnt) + if ((cnt & ~mask) == 0 + && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0) + && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) + { + /* Iterate over all elements of the DIRLIST. */ + char *dir = NULL; + + while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir)) + != NULL) + retval->successor[entries++] + = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, + language, territory, codeset, + normalized_codeset, modifier, special, + sponsor, revision, filename, 1); + } + retval->successor[entries] = NULL; + + return retval; +} + +/* Normalize codeset name. There is no standard for the codeset + names. Normalization allows the user to use any of the common + names. */ +const char * +_nl_normalize_codeset (codeset, name_len) + const unsigned char *codeset; + size_t name_len; +{ + int len = 0; + int only_digit = 1; + char *retval; + char *wp; + size_t cnt; + + for (cnt = 0; cnt < name_len; ++cnt) + if (isalnum (codeset[cnt])) + { + ++len; + + if (isalpha (codeset[cnt])) + only_digit = 0; + } + + retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1); + + if (retval != NULL) + { + if (only_digit) + wp = stpcpy (retval, "iso"); + else + wp = retval; + + for (cnt = 0; cnt < name_len; ++cnt) + if (isalpha (codeset[cnt])) + *wp++ = tolower (codeset[cnt]); + else if (isdigit (codeset[cnt])) + *wp++ = codeset[cnt]; + + *wp = '\0'; + } + + return (const char *) retval; +} + + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif diff --git a/glabels1/intl/libgettext.h b/glabels1/intl/libgettext.h new file mode 100644 index 00000000..3a92960a --- /dev/null +++ b/glabels1/intl/libgettext.h @@ -0,0 +1,182 @@ +/* Message catalogs for internationalization. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Because on some systems (e.g. Solaris) we sometimes have to include + the systems libintl.h as well as this file we have more complex + include protection above. But the systems header might perhaps also + define _LIBINTL_H and therefore we have to protect the definition here. */ + +#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H +#ifndef _LIBINTL_H +# define _LIBINTL_H 1 +#endif +#define _LIBGETTEXT_H 1 + +/* We define an additional symbol to signal that we use the GNU + implementation of gettext. */ +#define __USE_GNU_GETTEXT 1 + +#include + +#if HAVE_LOCALE_H +# include +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ || defined __cplusplus +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef NULL +# if !defined __cplusplus || defined __GNUC__ +# define NULL ((void *) 0) +# else +# define NULL (0) +# endif +#endif + +#if !HAVE_LC_MESSAGES +/* This value determines the behaviour of the gettext() and dgettext() + function. But some system does not have this defined. Define it + to a default value. */ +# define LC_MESSAGES (-1) +#endif + + +/* Declarations for gettext-using-catgets interface. Derived from + Jim Meyering's libintl.h. */ +struct _msg_ent +{ + const char *_msg; + int _msg_number; +}; + + +#if HAVE_CATGETS +/* These two variables are defined in the automatically by po-to-tbl.sed + generated file `cat-id-tbl.c'. */ +extern const struct _msg_ent _msg_tbl[]; +extern int _msg_tbl_length; +#endif + + +/* For automatical extraction of messages sometimes no real + translation is needed. Instead the string itself is the result. */ +#define gettext_noop(Str) (Str) + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +extern char *gettext PARAMS ((const char *__msgid)); +extern char *gettext__ PARAMS ((const char *__msgid)); + +/* Look up MSGID in the DOMAINNAME message catalog for the current + LC_MESSAGES locale. */ +extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid)); +extern char *dgettext__ PARAMS ((const char *__domainname, + const char *__msgid)); + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid, + int __category)); +extern char *dcgettext__ PARAMS ((const char *__domainname, + const char *__msgid, int __category)); + + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +extern char *textdomain PARAMS ((const char *__domainname)); +extern char *textdomain__ PARAMS ((const char *__domainname)); + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +extern char *bindtextdomain PARAMS ((const char *__domainname, + const char *__dirname)); +extern char *bindtextdomain__ PARAMS ((const char *__domainname, + const char *__dirname)); + +#if ENABLE_NLS + +/* Solaris 2.3 has the gettext function but dcgettext is missing. + So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4 + has dcgettext. */ +# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT) + +# define gettext(Msgid) \ + dgettext (NULL, Msgid) + +# define dgettext(Domainname, Msgid) \ + dcgettext (Domainname, Msgid, LC_MESSAGES) + +# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7 +/* This global variable is defined in loadmsgcat.c. We need a sign, + whether a new catalog was loaded, which can be associated with all + translations. */ +extern int _nl_msg_cat_cntr; + +# define dcgettext(Domainname, Msgid, Category) \ + (__extension__ \ + ({ \ + char *__result; \ + if (__builtin_constant_p (Msgid)) \ + { \ + static char *__translation__; \ + static int __catalog_counter__; \ + if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \ + { \ + __translation__ = \ + dcgettext__ (Domainname, Msgid, Category); \ + __catalog_counter__ = _nl_msg_cat_cntr; \ + } \ + __result = __translation__; \ + } \ + else \ + __result = dcgettext__ (Domainname, Msgid, Category); \ + __result; \ + })) +# endif +# endif + +#else + +# define gettext(Msgid) (Msgid) +# define dgettext(Domainname, Msgid) (Msgid) +# define dcgettext(Domainname, Msgid, Category) (Msgid) +# define textdomain(Domainname) ((char *) Domainname) +# define bindtextdomain(Domainname, Dirname) ((char *) Dirname) + +#endif + +/* @@ begin of epilog @@ */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/glabels1/intl/linux-msg.sed b/glabels1/intl/linux-msg.sed new file mode 100644 index 00000000..5918e720 --- /dev/null +++ b/glabels1/intl/linux-msg.sed @@ -0,0 +1,100 @@ +# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file +# Copyright (C) 1995 Free Software Foundation, Inc. +# Ulrich Drepper , 1995. +# +# This program is free software; you can redistribute 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. +# +# +# The first directive in the .msg should be the definition of the +# message set number. We use always set number 1. +# +1 { + i\ +$set 1 # Automatically created by po2msg.sed + h + s/.*/0/ + x +} +# +# Mitch's old catalog format does not allow comments. +# +# We copy the original message as a comment into the .msg file. +# +/^msgid/ { + s/msgid[ ]*"// +# +# This does not work now with the new format. +# /"$/! { +# s/\\$// +# s/$/ ... (more lines following)"/ +# } + x +# The following nice solution is by +# Bruno + td +# Increment a decimal number in pattern space. +# First hide trailing `9' digits. + :d + s/9\(_*\)$/_\1/ + td +# Assure at least one digit is available. + s/^\(_*\)$/0\1/ +# Increment the last digit. + s/8\(_*\)$/9\1/ + s/7\(_*\)$/8\1/ + s/6\(_*\)$/7\1/ + s/5\(_*\)$/6\1/ + s/4\(_*\)$/5\1/ + s/3\(_*\)$/4\1/ + s/2\(_*\)$/3\1/ + s/1\(_*\)$/2\1/ + s/0\(_*\)$/1\1/ +# Convert the hidden `9' digits to `0's. + s/_/0/g + x + G + s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p +} +# +# The .msg file contains, other then the .po file, only the translations +# but each given a unique ID. Starting from 1 and incrementing by 1 for +# each message we assign them to the messages. +# It is important that the .po file used to generate the cat-id-tbl.c file +# (with po-to-tbl) is the same as the one used here. (At least the order +# of declarations must not be changed.) +# +/^msgstr/ { + s/msgstr[ ]*"\(.*\)"/# \1/ +# Clear substitution flag. + tb +# Append the next line. + :b + N +# Look whether second part is continuation line. + s/\(.*\n\)"\(.*\)"/\1\2/ +# Yes, then branch. + ta + P + D +# Note that D includes a jump to the start!! +# We found a continuation line. But before printing insert '\'. + :a + s/\(.*\)\(\n.*\)/\1\\\2/ + P +# We cannot use D here. + s/.*\n\(.*\)/\1/ + tb +} +d diff --git a/glabels1/intl/loadinfo.h b/glabels1/intl/loadinfo.h new file mode 100644 index 00000000..f4ebf6d8 --- /dev/null +++ b/glabels1/intl/loadinfo.h @@ -0,0 +1,76 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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. */ + +#ifndef PARAMS +# if __STDC__ +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +/* Encoding of locale name parts. */ +#define CEN_REVISION 1 +#define CEN_SPONSOR 2 +#define CEN_SPECIAL 4 +#define XPG_NORM_CODESET 8 +#define XPG_CODESET 16 +#define TERRITORY 32 +#define CEN_AUDIENCE 64 +#define XPG_MODIFIER 128 + +#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) +#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) + + +struct loaded_l10nfile +{ + const char *filename; + int decided; + + const void *data; + + struct loaded_l10nfile *next; + struct loaded_l10nfile *successor[1]; +}; + + +extern const char *_nl_normalize_codeset PARAMS ((const unsigned char *codeset, + size_t name_len)); + +extern struct loaded_l10nfile * +_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, + const char *dirlist, size_t dirlist_len, int mask, + const char *language, const char *territory, + const char *codeset, + const char *normalized_codeset, + const char *modifier, const char *special, + const char *sponsor, const char *revision, + const char *filename, int do_allocate)); + + +extern const char *_nl_expand_alias PARAMS ((const char *name)); + +extern int _nl_explode_name PARAMS ((char *name, const char **language, + const char **modifier, + const char **territory, + const char **codeset, + const char **normalized_codeset, + const char **special, + const char **sponsor, + const char **revision)); diff --git a/glabels1/intl/loadmsgcat.c b/glabels1/intl/loadmsgcat.c new file mode 100644 index 00000000..515892df --- /dev/null +++ b/glabels1/intl/loadmsgcat.c @@ -0,0 +1,222 @@ +/* Load needed message catalogs. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC +# include +#endif + +#include "gettext.h" +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ISO C functions. This is required by the standard + because some ISO C functions will require linking with this object + file and the name space must not be polluted. */ +# define open __open +# define close __close +# define read __read +# define mmap __mmap +# define munmap __munmap +#endif + +/* We need a sign, whether a new catalog was loaded, which can be associated + with all translations. This is important if the translations are + cached by one of GCC's features. */ +int _nl_msg_cat_cntr = 0; + + +/* Load the message catalogs specified by FILENAME. If it is no valid + message catalog do nothing. */ +void +internal_function +_nl_load_domain (domain_file) + struct loaded_l10nfile *domain_file; +{ + int fd; + size_t size; + struct stat st; + struct mo_file_header *data = (struct mo_file_header *) -1; +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + int use_mmap = 0; +#endif + struct loaded_domain *domain; + + domain_file->decided = 1; + domain_file->data = NULL; + + /* If the record does not represent a valid locale the FILENAME + might be NULL. This can happen when according to the given + specification the locale file name is different for XPG and CEN + syntax. */ + if (domain_file->filename == NULL) + return; + + /* Try to open the addressed file. */ + fd = open (domain_file->filename, O_RDONLY); + if (fd == -1) + return; + + /* We must know about the size of the file. */ + if (fstat (fd, &st) != 0 + || (size = (size_t) st.st_size) != st.st_size + || size < sizeof (struct mo_file_header)) + { + /* Something went wrong. */ + close (fd); + return; + } + +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + /* Now we are ready to load the file. If mmap() is available we try + this first. If not available or it failed we try to load it. */ + data = (struct mo_file_header *) mmap (NULL, size, PROT_READ, + MAP_PRIVATE, fd, 0); + + if (data != (struct mo_file_header *) -1) + { + /* mmap() call was successful. */ + close (fd); + use_mmap = 1; + } +#endif + + /* If the data is not yet available (i.e. mmap'ed) we try to load + it manually. */ + if (data == (struct mo_file_header *) -1) + { + size_t to_read; + char *read_ptr; + + data = (struct mo_file_header *) malloc (size); + if (data == NULL) + return; + + to_read = size; + read_ptr = (char *) data; + do + { + long int nb = (long int) read (fd, read_ptr, to_read); + if (nb == -1) + { + close (fd); + return; + } + + read_ptr += nb; + to_read -= nb; + } + while (to_read > 0); + + close (fd); + } + + /* Using the magic number we can test whether it really is a message + catalog file. */ + if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED) + { + /* The magic number is wrong: not a message catalog file. */ +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + if (use_mmap) + munmap ((caddr_t) data, size); + else +#endif + free (data); + return; + } + + domain_file->data + = (struct loaded_domain *) malloc (sizeof (struct loaded_domain)); + if (domain_file->data == NULL) + return; + + domain = (struct loaded_domain *) domain_file->data; + domain->data = (char *) data; +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + domain->use_mmap = use_mmap; +#endif + domain->mmap_size = size; + domain->must_swap = data->magic != _MAGIC; + + /* Fill in the information about the available tables. */ + switch (W (domain->must_swap, data->revision)) + { + case 0: + domain->nstrings = W (domain->must_swap, data->nstrings); + domain->orig_tab = (struct string_desc *) + ((char *) data + W (domain->must_swap, data->orig_tab_offset)); + domain->trans_tab = (struct string_desc *) + ((char *) data + W (domain->must_swap, data->trans_tab_offset)); + domain->hash_size = W (domain->must_swap, data->hash_tab_size); + domain->hash_tab = (nls_uint32 *) + ((char *) data + W (domain->must_swap, data->hash_tab_offset)); + break; + default: + /* This is an illegal revision. */ +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || defined _LIBC + if (use_mmap) + munmap ((caddr_t) data, size); + else +#endif + free (data); + free (domain); + domain_file->data = NULL; + return; + } + + /* Show that one domain is changed. This might make some cached + translations invalid. */ + ++_nl_msg_cat_cntr; +} + + +#ifdef _LIBC +void +internal_function +_nl_unload_domain (domain) + struct loaded_domain *domain; +{ + if (domain->use_mmap) + munmap ((caddr_t) domain->data, domain->mmap_size); + else + free ((void *) domain->data); + + free (domain); +} +#endif diff --git a/glabels1/intl/localealias.c b/glabels1/intl/localealias.c new file mode 100644 index 00000000..bca555a6 --- /dev/null +++ b/glabels1/intl/localealias.c @@ -0,0 +1,424 @@ +/* Handle aliases for locale names. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program is free software; you can redistribute 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#else +char *getenv (); +# ifdef HAVE_MALLOC_H +# include +# else +void free (); +# endif +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif + +#include "gettext.h" +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# define strcasecmp __strcasecmp + +# define mempcpy __mempcpy +# define HAVE_MEMPCPY 1 + +/* We need locking here since we can be called from different places. */ +# include + +__libc_lock_define_initialized (static, lock); +#endif + + +/* For those loosing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +/* Nothing has to be done. */ +# define ADD_BLOCK(list, address) /* nothing */ +# define FREE_BLOCKS(list) /* nothing */ +#else +struct block_list +{ + void *address; + struct block_list *next; +}; +# define ADD_BLOCK(list, addr) \ + do { \ + struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ + /* If we cannot get a free block we cannot add the new element to \ + the list. */ \ + if (newp != NULL) { \ + newp->address = (addr); \ + newp->next = (list); \ + (list) = newp; \ + } \ + } while (0) +# define FREE_BLOCKS(list) \ + do { \ + while (list != NULL) { \ + struct block_list *old = list; \ + list = list->next; \ + free (old); \ + } \ + } while (0) +# undef alloca +# define alloca(size) (malloc (size)) +#endif /* have alloca */ + + +struct alias_map +{ + const char *alias; + const char *value; +}; + + +static char *string_space = NULL; +static size_t string_space_act = 0; +static size_t string_space_max = 0; +static struct alias_map *map; +static size_t nmap = 0; +static size_t maxmap = 0; + + +/* Prototypes for local functions. */ +static size_t read_alias_file PARAMS ((const char *fname, int fname_len)) + internal_function; +static void extend_alias_table PARAMS ((void)); +static int alias_compare PARAMS ((const struct alias_map *map1, + const struct alias_map *map2)); + + +const char * +_nl_expand_alias (name) + const char *name; +{ + static const char *locale_alias_path = LOCALE_ALIAS_PATH; + struct alias_map *retval; + const char *result = NULL; + size_t added; + +#ifdef _LIBC + __libc_lock_lock (lock); +#endif + + do + { + struct alias_map item; + + item.alias = name; + + if (nmap > 0) + retval = (struct alias_map *) bsearch (&item, map, nmap, + sizeof (struct alias_map), + (int (*) PARAMS ((const void *, + const void *)) + ) alias_compare); + else + retval = NULL; + + /* We really found an alias. Return the value. */ + if (retval != NULL) + { + result = retval->value; + break; + } + + /* Perhaps we can find another alias file. */ + added = 0; + while (added == 0 && locale_alias_path[0] != '\0') + { + const char *start; + + while (locale_alias_path[0] == ':') + ++locale_alias_path; + start = locale_alias_path; + + while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':') + ++locale_alias_path; + + if (start < locale_alias_path) + added = read_alias_file (start, locale_alias_path - start); + } + } + while (added != 0); + +#ifdef _LIBC + __libc_lock_unlock (lock); +#endif + + return result; +} + + +static size_t +internal_function +read_alias_file (fname, fname_len) + const char *fname; + int fname_len; +{ +#ifndef HAVE_ALLOCA + struct block_list *block_list = NULL; +#endif + FILE *fp; + char *full_fname; + size_t added; + static const char aliasfile[] = "/locale.alias"; + + full_fname = (char *) alloca (fname_len + sizeof aliasfile); + ADD_BLOCK (block_list, full_fname); +#ifdef HAVE_MEMPCPY + mempcpy (mempcpy (full_fname, fname, fname_len), + aliasfile, sizeof aliasfile); +#else + memcpy (full_fname, fname, fname_len); + memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile); +#endif + + fp = fopen (full_fname, "r"); + if (fp == NULL) + { + FREE_BLOCKS (block_list); + return 0; + } + + added = 0; + while (!feof (fp)) + { + /* It is a reasonable approach to use a fix buffer here because + a) we are only interested in the first two fields + b) these fields must be usable as file names and so must not + be that long + */ + unsigned char buf[BUFSIZ]; + unsigned char *alias; + unsigned char *value; + unsigned char *cp; + + if (fgets (buf, sizeof buf, fp) == NULL) + /* EOF reached. */ + break; + + /* Possibly not the whole line fits into the buffer. Ignore + the rest of the line. */ + if (strchr (buf, '\n') == NULL) + { + char altbuf[BUFSIZ]; + do + if (fgets (altbuf, sizeof altbuf, fp) == NULL) + /* Make sure the inner loop will be left. The outer loop + will exit at the `feof' test. */ + break; + while (strchr (altbuf, '\n') == NULL); + } + + cp = buf; + /* Ignore leading white space. */ + while (isspace (cp[0])) + ++cp; + + /* A leading '#' signals a comment line. */ + if (cp[0] != '\0' && cp[0] != '#') + { + alias = cp++; + while (cp[0] != '\0' && !isspace (cp[0])) + ++cp; + /* Terminate alias name. */ + if (cp[0] != '\0') + *cp++ = '\0'; + + /* Now look for the beginning of the value. */ + while (isspace (cp[0])) + ++cp; + + if (cp[0] != '\0') + { + size_t alias_len; + size_t value_len; + + value = cp++; + while (cp[0] != '\0' && !isspace (cp[0])) + ++cp; + /* Terminate value. */ + if (cp[0] == '\n') + { + /* This has to be done to make the following test + for the end of line possible. We are looking for + the terminating '\n' which do not overwrite here. */ + *cp++ = '\0'; + *cp = '\n'; + } + else if (cp[0] != '\0') + *cp++ = '\0'; + + if (nmap >= maxmap) + extend_alias_table (); + + alias_len = strlen (alias) + 1; + value_len = strlen (value) + 1; + + if (string_space_act + alias_len + value_len > string_space_max) + { + /* Increase size of memory pool. */ + size_t new_size = (string_space_max + + (alias_len + value_len > 1024 + ? alias_len + value_len : 1024)); + char *new_pool = (char *) realloc (string_space, new_size); + if (new_pool == NULL) + { + FREE_BLOCKS (block_list); + return added; + } + string_space = new_pool; + string_space_max = new_size; + } + + map[nmap].alias = memcpy (&string_space[string_space_act], + alias, alias_len); + string_space_act += alias_len; + + map[nmap].value = memcpy (&string_space[string_space_act], + value, value_len); + string_space_act += value_len; + + ++nmap; + ++added; + } + } + } + + /* Should we test for ferror()? I think we have to silently ignore + errors. --drepper */ + fclose (fp); + + if (added > 0) + qsort (map, nmap, sizeof (struct alias_map), + (int (*) PARAMS ((const void *, const void *))) alias_compare); + + FREE_BLOCKS (block_list); + return added; +} + + +static void +extend_alias_table () +{ + size_t new_size; + struct alias_map *new_map; + + new_size = maxmap == 0 ? 100 : 2 * maxmap; + new_map = (struct alias_map *) realloc (map, (new_size + * sizeof (struct alias_map))); + if (new_map == NULL) + /* Simply don't extend: we don't have any more core. */ + return; + + map = new_map; + maxmap = new_size; +} + + +#ifdef _LIBC +static void __attribute__ ((unused)) +free_mem (void) +{ + if (string_space != NULL) + free (string_space); + if (map != NULL) + free (map); +} +text_set_element (__libc_subfreeres, free_mem); +#endif + + +static int +alias_compare (map1, map2) + const struct alias_map *map1; + const struct alias_map *map2; +{ +#if defined _LIBC || defined HAVE_STRCASECMP + return strcasecmp (map1->alias, map2->alias); +#else + const unsigned char *p1 = (const unsigned char *) map1->alias; + const unsigned char *p2 = (const unsigned char *) map2->alias; + unsigned char c1, c2; + + if (p1 == p2) + return 0; + + do + { + /* I know this seems to be odd but the tolower() function in + some systems libc cannot handle nonalpha characters. */ + c1 = isupper (*p1) ? tolower (*p1) : *p1; + c2 = isupper (*p2) ? tolower (*p2) : *p2; + if (c1 == '\0') + break; + ++p1; + ++p2; + } + while (c1 == c2); + + return c1 - c2; +#endif +} diff --git a/glabels1/intl/po2tbl.sed.in b/glabels1/intl/po2tbl.sed.in new file mode 100644 index 00000000..b3bcca4d --- /dev/null +++ b/glabels1/intl/po2tbl.sed.in @@ -0,0 +1,102 @@ +# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets +# Copyright (C) 1995 Free Software Foundation, Inc. +# Ulrich Drepper , 1995. +# +# This program is free software; you can redistribute 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. +# +1 { + i\ +/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\ +\ +#if HAVE_CONFIG_H\ +# include \ +#endif\ +\ +#include "libgettext.h"\ +\ +const struct _msg_ent _msg_tbl[] = { + h + s/.*/0/ + x +} +# +# Write msgid entries in C array form. +# +/^msgid/ { + s/msgid[ ]*\(".*"\)/ {\1/ + tb +# Append the next line + :b + N +# Look whether second part is continuation line. + s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/ +# Yes, then branch. + ta +# Because we assume that the input file correctly formed the line +# just read cannot be again be a msgid line. So it's safe to ignore +# it. + s/\(.*\)\n.*/\1/ + bc +# We found a continuation line. But before printing insert '\'. + :a + s/\(.*\)\(\n.*\)/\1\\\2/ + P +# We cannot use D here. + s/.*\n\(.*\)/\1/ +# Some buggy seds do not clear the `successful substitution since last ``t''' +# flag on `N', so we do a `t' here to clear it. + tb +# Not reached + :c + x +# The following nice solution is by +# Bruno + td +# Increment a decimal number in pattern space. +# First hide trailing `9' digits. + :d + s/9\(_*\)$/_\1/ + td +# Assure at least one digit is available. + s/^\(_*\)$/0\1/ +# Increment the last digit. + s/8\(_*\)$/9\1/ + s/7\(_*\)$/8\1/ + s/6\(_*\)$/7\1/ + s/5\(_*\)$/6\1/ + s/4\(_*\)$/5\1/ + s/3\(_*\)$/4\1/ + s/2\(_*\)$/3\1/ + s/1\(_*\)$/2\1/ + s/0\(_*\)$/1\1/ +# Convert the hidden `9' digits to `0's. + s/_/0/g + x + G + s/\(.*\)\n\([0-9]*\)/\1, \2},/ + s/\(.*\)"$/\1/ + p +} +# +# Last line. +# +$ { + i\ +};\ + + g + s/0*\(.*\)/int _msg_tbl_length = \1;/p +} +d diff --git a/glabels1/intl/textdomain.c b/glabels1/intl/textdomain.c new file mode 100644 index 00000000..88557460 --- /dev/null +++ b/glabels1/intl/textdomain.c @@ -0,0 +1,108 @@ +/* Implementation of the textdomain(3) function. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program is free software; you can redistribute 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. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +# ifndef memcpy +# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num) +# endif +#endif + +#ifdef _LIBC +# include +#else +# include "libgettext.h" +#endif + +/* @@ end of prolog @@ */ + +/* Name of the default text domain. */ +extern const char _nl_default_default_domain[]; + +/* Default text domain in which entries for gettext(3) are to be found. */ +extern const char *_nl_current_default_domain; + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define TEXTDOMAIN __textdomain +# ifndef strdup +# define strdup(str) __strdup (str) +# endif +#else +# define TEXTDOMAIN textdomain__ +#endif + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +char * +TEXTDOMAIN (domainname) + const char *domainname; +{ + char *old; + + /* A NULL pointer requests the current setting. */ + if (domainname == NULL) + return (char *) _nl_current_default_domain; + + old = (char *) _nl_current_default_domain; + + /* If domain name is the null string set to default domain "messages". */ + if (domainname[0] == '\0' + || strcmp (domainname, _nl_default_default_domain) == 0) + _nl_current_default_domain = _nl_default_default_domain; + else + { + /* If the following malloc fails `_nl_current_default_domain' + will be NULL. This value will be returned and so signals we + are out of core. */ +#if defined _LIBC || defined HAVE_STRDUP + _nl_current_default_domain = strdup (domainname); +#else + size_t len = strlen (domainname) + 1; + char *cp = (char *) malloc (len); + if (cp != NULL) + memcpy (cp, domainname, len); + _nl_current_default_domain = cp; +#endif + } + + if (old != _nl_default_default_domain) + free (old); + + return (char *) _nl_current_default_domain; +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__textdomain, textdomain); +#endif diff --git a/glabels1/intl/xopen-msg.sed b/glabels1/intl/xopen-msg.sed new file mode 100644 index 00000000..b19c0bbd --- /dev/null +++ b/glabels1/intl/xopen-msg.sed @@ -0,0 +1,104 @@ +# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file +# Copyright (C) 1995 Free Software Foundation, Inc. +# Ulrich Drepper , 1995. +# +# This program is free software; you can redistribute 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. +# +# +# The first directive in the .msg should be the definition of the +# message set number. We use always set number 1. +# +1 { + i\ +$set 1 # Automatically created by po2msg.sed + h + s/.*/0/ + x +} +# +# We copy all comments into the .msg file. Perhaps they can help. +# +/^#/ s/^#[ ]*/$ /p +# +# We copy the original message as a comment into the .msg file. +# +/^msgid/ { +# Does not work now +# /"$/! { +# s/\\$// +# s/$/ ... (more lines following)"/ +# } + s/^msgid[ ]*"\(.*\)"$/$ Original Message: \1/ + p +} +# +# The .msg file contains, other then the .po file, only the translations +# but each given a unique ID. Starting from 1 and incrementing by 1 for +# each message we assign them to the messages. +# It is important that the .po file used to generate the cat-id-tbl.c file +# (with po-to-tbl) is the same as the one used here. (At least the order +# of declarations must not be changed.) +# +/^msgstr/ { + s/msgstr[ ]*"\(.*\)"/\1/ + x +# The following nice solution is by +# Bruno + td +# Increment a decimal number in pattern space. +# First hide trailing `9' digits. + :d + s/9\(_*\)$/_\1/ + td +# Assure at least one digit is available. + s/^\(_*\)$/0\1/ +# Increment the last digit. + s/8\(_*\)$/9\1/ + s/7\(_*\)$/8\1/ + s/6\(_*\)$/7\1/ + s/5\(_*\)$/6\1/ + s/4\(_*\)$/5\1/ + s/3\(_*\)$/4\1/ + s/2\(_*\)$/3\1/ + s/1\(_*\)$/2\1/ + s/0\(_*\)$/1\1/ +# Convert the hidden `9' digits to `0's. + s/_/0/g + x +# Bring the line in the format ` ' + G + s/^[^\n]*$/& / + s/\(.*\)\n\([0-9]*\)/\2 \1/ +# Clear flag from last substitution. + tb +# Append the next line. + :b + N +# Look whether second part is a continuation line. + s/\(.*\n\)"\(.*\)"/\1\2/ +# Yes, then branch. + ta + P + D +# Note that `D' includes a jump to the start!! +# We found a continuation line. But before printing insert '\'. + :a + s/\(.*\)\(\n.*\)/\1\\\2/ + P +# We cannot use the sed command `D' here + s/.*\n\(.*\)/\1/ + tb +} +d diff --git a/glabels1/macros/Makefile.am b/glabels1/macros/Makefile.am new file mode 100644 index 00000000..e03dbeed --- /dev/null +++ b/glabels1/macros/Makefile.am @@ -0,0 +1,40 @@ +## Please update this variable if any new macros are created +MACROS= \ + aclocal-include.m4 \ + compiler-flags.m4 \ + curses.m4 \ + gnome-bonobo-check.m4 \ + gnome-fileutils.m4 \ + gnome-gettext.m4 \ + gnome-ghttp-check.m4 \ + gnome-gnorba-check.m4 \ + gnome-guile-checks.m4 \ + gnome-libgtop-check.m4 \ + gnome-objc-checks.m4 \ + gnome-orbit-check.m4 \ + gnome-print-check.m4 \ + gnome-pthread-check.m4 \ + gnome-support.m4 \ + gnome-undelfs.m4 \ + gnome-vfs.m4 \ + gnome-x-checks.m4 \ + gnome-xml-check.m4 \ + gnome.m4 \ + linger.m4 \ + need-declaration.m4 + +EXTRA_DIST=$(MACROS) gnome-common.m4 autogen.sh +MAINTAINERCLEANFILES=macros.dep + +@MAINT@macros.dep: Makefile.am +@MAINT@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@ + +if INSIDE_GNOME_COMMON +gnome_aclocaldir = $(datadir)/aclocal/gnome + +gnome-macros.dep: Makefile.am + @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@ + +gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 autogen.sh + +endif diff --git a/glabels1/macros/Makefile.in b/glabels1/macros/Makefile.in new file mode 100644 index 00000000..cb407c82 --- /dev/null +++ b/glabels1/macros/Makefile.in @@ -0,0 +1,256 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 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@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@ +GNOMEUI_LIBS = @GNOMEUI_LIBS@ +GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@ +GNOME_CANVAS_PIXBUF_CFLAGS = @GNOME_CANVAS_PIXBUF_CFLAGS@ +GNOME_CANVAS_PIXBUF_LIBS = @GNOME_CANVAS_PIXBUF_LIBS@ +GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@ +GNOME_CONFIG = @GNOME_CONFIG@ +GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@ +GNOME_LIBDIR = @GNOME_LIBDIR@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_PRINT_CFLAGS = @GNOME_PRINT_CFLAGS@ +GNOME_PRINT_LIBS = @GNOME_PRINT_LIBS@ +GNOME_XML_CFLAGS = @GNOME_XML_CFLAGS@ +GNOME_XML_LIBS = @GNOME_XML_LIBS@ +GNORBA_CFLAGS = @GNORBA_CFLAGS@ +GNORBA_LIBS = @GNORBA_LIBS@ +GTKXMHTML_LIBS = @GTKXMHTML_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +ORBIT_CFLAGS = @ORBIT_CFLAGS@ +ORBIT_CONFIG = @ORBIT_CONFIG@ +ORBIT_IDL = @ORBIT_IDL@ +ORBIT_LIBS = @ORBIT_LIBS@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PTHREAD_LIB = @PTHREAD_LIB@ +RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XPM_LIBS = @XPM_LIBS@ +ZVT_LIBS = @ZVT_LIBS@ +cflags_set = @cflags_set@ +cxxflags_set = @cxxflags_set@ +l = @l@ + +MACROS = aclocal-include.m4 compiler-flags.m4 curses.m4 gnome-bonobo-check.m4 gnome-fileutils.m4 gnome-gettext.m4 gnome-ghttp-check.m4 gnome-gnorba-check.m4 gnome-guile-checks.m4 gnome-libgtop-check.m4 gnome-objc-checks.m4 gnome-orbit-check.m4 gnome-print-check.m4 gnome-pthread-check.m4 gnome-support.m4 gnome-undelfs.m4 gnome-vfs.m4 gnome-x-checks.m4 gnome-xml-check.m4 gnome.m4 linger.m4 need-declaration.m4 + + +EXTRA_DIST = $(MACROS) gnome-common.m4 autogen.sh +MAINTAINERCLEANFILES = macros.dep + +@INSIDE_GNOME_COMMON_TRUE@gnome_aclocaldir = $(datadir)/aclocal/gnome + +@INSIDE_GNOME_COMMON_TRUE@gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 autogen.sh +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +DATA = $(gnome_aclocal_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: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps macros/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +install-gnome_aclocalDATA: $(gnome_aclocal_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir) + @list='$(gnome_aclocal_DATA)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + else if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + fi; fi; \ + done + +uninstall-gnome_aclocalDATA: + @$(NORMAL_UNINSTALL) + list='$(gnome_aclocal_DATA)'; for p in $$list; do \ + rm -f $(DESTDIR)$(gnome_aclocaldir)/$$p; \ + done +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = macros + +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-gnome_aclocalDATA +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-gnome_aclocalDATA +uninstall: uninstall-am +all-am: Makefile $(DATA) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir) + + +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: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +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: uninstall-gnome_aclocalDATA install-gnome_aclocalDATA 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 + + +macros.dep: Makefile.am + @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@ + +@INSIDE_GNOME_COMMON_TRUE@gnome-macros.dep: Makefile.am +@INSIDE_GNOME_COMMON_TRUE@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@ + +# 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/glabels1/macros/aclocal-include.m4 b/glabels1/macros/aclocal-include.m4 new file mode 100644 index 00000000..abf6533f --- /dev/null +++ b/glabels1/macros/aclocal-include.m4 @@ -0,0 +1,16 @@ +# aclocal-include.m4 +# +# This macro adds the name macrodir to the set of directories +# that `aclocal' searches for macros. + +# serial 1 + +dnl AM_ACLOCAL_INCLUDE(macrodir) +AC_DEFUN([AM_ACLOCAL_INCLUDE], +[ + AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y) + + test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + + for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done +]) diff --git a/glabels1/macros/autogen.sh b/glabels1/macros/autogen.sh new file mode 100644 index 00000000..70273913 --- /dev/null +++ b/glabels1/macros/autogen.sh @@ -0,0 +1,145 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile Gnome." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && { + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile Gnome." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && { + grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \ + (gettext --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`gettext' installed to compile Gnome." + echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && { + grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \ + (gettext --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`gettext' installed to compile Gnome." + echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile Gnome." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + +for coin in `find $srcdir -name configure.in -print` +do + dr=`dirname $coin` + if test -f $dr/NO-AUTO-GEN; then + echo skipping $dr -- flagged as no auto-gen + else + echo processing $dr + macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` + ( cd $dr + aclocalinclude="$ACLOCAL_FLAGS" + for k in $macrodirs; do + if test -d $k; then + aclocalinclude="$aclocalinclude -I $k" + ##else + ## echo "**Warning**: No such directory \`$k'. Ignored." + fi + done + if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then + if grep "sed.*POTFILES" configure.in >/dev/null; then + : do nothing -- we still have an old unmodified configure.in + else + echo "Creating $dr/aclocal.m4 ..." + test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 + echo "Running gettextize... Ignore non-fatal messages." + echo "no" | gettextize --force --copy + echo "Making $dr/aclocal.m4 writable ..." + test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 + fi + fi + if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then + echo "Creating $dr/aclocal.m4 ..." + test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 + echo "Running gettextize... Ignore non-fatal messages." + echo "no" | gettextize --force --copy + echo "Making $dr/aclocal.m4 writable ..." + test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 + fi + if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then + echo "Running libtoolize..." + libtoolize --force --copy + fi + echo "Running aclocal $aclocalinclude ..." + aclocal $aclocalinclude + if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then + echo "Running autoheader..." + autoheader + fi + echo "Running automake --gnu $am_opt ..." + automake --add-missing --gnu $am_opt + echo "Running autoconf ..." + autoconf + ) + fi +done + +conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi diff --git a/glabels1/macros/compiler-flags.m4 b/glabels1/macros/compiler-flags.m4 new file mode 100644 index 00000000..278d5099 --- /dev/null +++ b/glabels1/macros/compiler-flags.m4 @@ -0,0 +1,109 @@ +dnl GNOME_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([GNOME_COMPILE_WARNINGS],[ + AC_ARG_ENABLE(compile-warnings, + [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum) + + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) warnCFLAGS="-Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith" + fi + fi + fi + AC_MSG_RESULT($warnCFLAGS) + + 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) + if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + AC_SUBST(cflags_set) + fi +]) + +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 -Wpointer-arith -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 +]) diff --git a/glabels1/macros/curses.m4 b/glabels1/macros/curses.m4 new file mode 100644 index 00000000..3dd4ffaa --- /dev/null +++ b/glabels1/macros/curses.m4 @@ -0,0 +1,318 @@ +dnl Curses detection: Munged from Midnight Commander's configure.in +dnl +dnl What it does: +dnl ============= +dnl +dnl - Determine which version of curses is installed on your system +dnl and set the -I/-L/-l compiler entries and add a few preprocessor +dnl symbols +dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that +dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in +dnl Makefile.in's +dnl - Modify the following configure variables (these are the only +dnl curses.m4 variables you can access from within configure.in) +dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if +dnl an ncurses.h that's been renamed to curses.h +dnl is found. +dnl CURSES_LIBS - sets -L and -l's appropriately +dnl CFLAGS - if --with-sco, add -D_SVID3 +dnl has_curses - exports result of tests to rest of configure +dnl +dnl Usage: +dnl ====== +dnl 1) Add lines indicated below to acconfig.h +dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in +dnl 3) Instead of #include you should use the following to +dnl properly locate ncurses or curses header file +dnl +dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +dnl #include +dnl #else +dnl #include +dnl #endif +dnl +dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags +dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS +dnl +dnl Notes with automake: +dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from +dnl configure.in +dnl - your Makefile.am can look something like this +dnl ----------------------------------------------- +dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR) +dnl if HAS_CURSES +dnl CURSES_TARGETS=name_of_curses_prog +dnl endif +dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS) +dnl other_programs_SOURCES = blah blah blah +dnl name_of_curses_prog_SOURCES = blah blah blah +dnl other_programs_LDADD = blah +dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS) +dnl ----------------------------------------------- +dnl +dnl +dnl The following lines should be added to acconfig.h: +dnl ================================================== +dnl +dnl /*=== Curses version detection defines ===*/ +dnl /* Found some version of curses that we're going to use */ +dnl #undef HAS_CURSES +dnl +dnl /* Use SunOS SysV curses? */ +dnl #undef USE_SUNOS_CURSES +dnl +dnl /* Use old BSD curses - not used right now */ +dnl #undef USE_BSD_CURSES +dnl +dnl /* Use SystemV curses? */ +dnl #undef USE_SYSV_CURSES +dnl +dnl /* Use Ncurses? */ +dnl #undef USE_NCURSES +dnl +dnl /* If you Curses does not have color define this one */ +dnl #undef NO_COLOR_CURSES +dnl +dnl /* Define if you want to turn on SCO-specific code */ +dnl #undef SCO_FLAVOR +dnl +dnl /* Set to reflect version of ncurses * +dnl * 0 = version 1.* +dnl * 1 = version 1.9.9g +dnl * 2 = version 4.0/4.1 */ +dnl #undef NCURSES_970530 +dnl +dnl /*=== End new stuff for acconfig.h ===*/ +dnl + + +AC_DEFUN(AC_CHECK_CURSES,[ + search_ncurses=true + screen_manager="" + has_curses=false + + CFLAGS=${CFLAGS--O} + + AC_SUBST(CURSES_LIBS) + AC_SUBST(CURSES_INCLUDEDIR) + + AC_ARG_WITH(sco, + [ --with-sco Use this to turn on SCO-specific code],[ + if test x$withval = xyes; then + AC_DEFINE(SCO_FLAVOR) + CFLAGS="$CFLAGS -D_SVID3" + fi + ]) + + AC_ARG_WITH(sunos-curses, + [ --with-sunos-curses Used to force SunOS 4.x curses],[ + if test x$withval = xyes; then + AC_USE_SUNOS_CURSES + fi + ]) + + AC_ARG_WITH(osf1-curses, + [ --with-osf1-curses Used to force OSF/1 curses],[ + if test x$withval = xyes; then + AC_USE_OSF1_CURSES + fi + ]) + + AC_ARG_WITH(vcurses, + [ --with-vcurses[=incdir] Used to force SysV curses], + if test x$withval != xyes; then + CURSES_INCLUDEDIR="-I$withval" + fi + AC_USE_SYSV_CURSES + ) + + AC_ARG_WITH(ncurses, + [ --with-ncurses[=dir] Compile with ncurses/locate base dir], + if test x$withval = xno ; then + search_ncurses=false + elif test x$withval != xyes ; then + CURSES_LIBS="$LIBS -L$withval/lib -lncurses" + CURSES_INCLUDEDIR="-I$withval/include" + search_ncurses=false + screen_manager="ncurses" + AC_DEFINE(USE_NCURSES) + AC_DEFINE(HAS_CURSES) + has_curses=true + fi + ) + + if $search_ncurses + then + AC_SEARCH_NCURSES() + fi + + +]) + + +AC_DEFUN(AC_USE_SUNOS_CURSES, [ + search_ncurses=false + screen_manager="SunOS 4.x /usr/5include curses" + AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses) + AC_DEFINE(USE_SUNOS_CURSES) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_INCLUDEDIR="-I/usr/5include" + CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a" + AC_MSG_RESULT(Please note that some screen refreshs may fail) +]) + +AC_DEFUN(AC_USE_OSF1_CURSES, [ + AC_MSG_RESULT(Using OSF1 curses) + search_ncurses=false + screen_manager="OSF1 curses" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_LIBS="-lcurses" +]) + +AC_DEFUN(AC_USE_SYSV_CURSES, [ + AC_MSG_RESULT(Using SysV curses) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_SYSV_CURSES) + search_ncurses=false + screen_manager="SysV/curses" + CURSES_LIBS="-lcurses" +]) + +dnl AC_ARG_WITH(bsd-curses, +dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy], +dnl search_ncurses=false +dnl screen_manager="Ultrix/cursesX" +dnl if test $system = ULTRIX +dnl then +dnl THIS_CURSES=cursesX +dnl else +dnl THIS_CURSES=curses +dnl fi +dnl +dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap" +dnl AC_DEFINE(HAS_CURSES) +dnl has_curses=true +dnl AC_DEFINE(USE_BSD_CURSES) +dnl AC_MSG_RESULT(Please note that some screen refreshs may fail) +dnl AC_WARN(Use of the bsdcurses extension has some) +dnl AC_WARN(display/input problems.) +dnl AC_WARN(Reconsider using xcurses) +dnl) + + +dnl +dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename +dnl +AC_DEFUN(AC_NCURSES, [ + if $search_ncurses + then + if test -f $1/$2 + then + AC_MSG_RESULT(Found ncurses on $1/$2) + CURSES_LIBS="$3" + CURSES_INCLUDEDIR="$4" + search_ncurses=false + screen_manager=$5 + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + fi + fi +]) + +AC_DEFUN(AC_SEARCH_NCURSES, [ + AC_CHECKING("location of ncurses.h file") + + AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include") + AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses") + AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local") + AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses") + + AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses") + + AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses") + + dnl + dnl We couldn't find ncurses, try SysV curses + dnl + if $search_ncurses + then + AC_EGREP_HEADER(init_color, /usr/include/curses.h, + AC_USE_SYSV_CURSES) + AC_EGREP_CPP(USE_NCURSES,[ +#include +#ifdef __NCURSES_H +#undef USE_NCURSES +USE_NCURSES +#endif +],[ + CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + search_ncurses=false + screen_manager="ncurses installed as curses" +]) + fi + + dnl + dnl Try SunOS 4.x /usr/5{lib,include} ncurses + dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES + dnl should be replaced by a more fine grained selection routine + dnl + if $search_ncurses + then + if test -f /usr/5include/curses.h + then + AC_USE_SUNOS_CURSES + fi + else + # check for ncurses version, to properly ifdef mouse-fix + AC_MSG_CHECKING(for ncurses version) + ncurses_version=unknown +cat > conftest.$ac_ext < +#else +#include +#endif +#undef VERSION +VERSION:NCURSES_VERSION +EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | + egrep "VERSION:" >conftest.out 2>&1; then +changequote(,)dnl + ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'` +changequote([,])dnl + fi + rm -rf conftest* + AC_MSG_RESULT($ncurses_version) + case "$ncurses_version" in +changequote(,)dnl + 4.[01]) +changequote([,])dnl + AC_DEFINE(NCURSES_970530,2) + ;; + 1.9.9g) + AC_DEFINE(NCURSES_970530,1) + ;; + 1*) + AC_DEFINE(NCURSES_970530,0) + ;; + esac + fi +]) + + + + + diff --git a/glabels1/macros/gnome-bonobo-check.m4 b/glabels1/macros/gnome-bonobo-check.m4 new file mode 100644 index 00000000..65e272cf --- /dev/null +++ b/glabels1/macros/gnome-bonobo-check.m4 @@ -0,0 +1,150 @@ +# Configure paths for Bonobo +# Miguel de Icaza, 99-04-12 +# Stolen from Chris Lahey 99-2-5 +# stolen from Manish Singh again +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS +dnl +AC_DEFUN([AM_PATH_BONOBO], +[ +dnl +dnl Get the cflags and libraries from the gnome-config script +dnl +AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)], + bonobo_prefix="$withval", bonobo_prefix="") +AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)], + bonobo_exec_prefix="$withval", bonobo_exec_prefix="") +AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program], + , enable_bonobotest=yes) + + if test x$bonobo_exec_prefix != x ; then + bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config + fi + fi + if test x$bonobo_prefix != x ; then + bonobo_args="$bonobo_args --prefix=$bonobo_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$bonobo_prefix/bin/gnome-config + fi + fi + + AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) + min_bonobo_version=ifelse([$1], ,0.1.0,$1) + AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version) + no_bonobo="" + if test "$GNOME_CONFIG" = "no" ; then + no_bonobo=yes + else + BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo` + BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo` + + bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_bonobotest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $BONOBO_CFLAGS" + LIBS="$LIBS $BONOBO_LIBS" +dnl +dnl Now check if the installed BONOBO is sufficiently new. (Also sanity +dnl checks the results of gnome-config to some extent +dnl + rm -f conf.bonobotest + AC_TRY_RUN([ +#include +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.bonobotest"); + gnome_object_get_type (); + return 0; +} + +],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_bonobo" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GNOME_CONFIG" = "no" ; then + echo "*** The gnome-config script installed by GNOME-LIBS could not be found" + echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GNOME_CONFIG environment variable to the" + echo "*** full path to gnome-config." + else + if test -f conf.bonobotest ; then + : + else + echo "*** Could not run BONOBO test program, checking why..." + CFLAGS="$CFLAGS $BONOBO_CFLAGS" + LIBS="$LIBS $BONOBO_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding BONOBO or finding the wrong" + echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means BONOBO was incorrectly installed" + echo "*** or that you have moved BONOBO since it was installed. In the latter case, you" + echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + BONOBO_CFLAGS="" + BONOBO_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(BONOBO_CFLAGS) + AC_SUBST(BONOBO_LIBS) + rm -f conf.bonobotest +]) + +AC_DEFUN([BONOBO_CHECK], [ + AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)]) +]) + diff --git a/glabels1/macros/gnome-common.m4 b/glabels1/macros/gnome-common.m4 new file mode 100644 index 00000000..b7238297 --- /dev/null +++ b/glabels1/macros/gnome-common.m4 @@ -0,0 +1,14 @@ +# gnome-common.m4 +# +# This only for packages that are not in the GNOME CVS tree. + +dnl GNOME_COMMON_INIT + +AC_DEFUN([GNOME_COMMON_INIT], +[ + GNOME_ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`/gnome + AC_SUBST(GNOME_ACLOCAL_DIR) + + ACLOCAL="$ACLOCAL -I $GNOME_ACLOCAL_DIR" +]) + diff --git a/glabels1/macros/gnome-fileutils.m4 b/glabels1/macros/gnome-fileutils.m4 new file mode 100644 index 00000000..7c11a785 --- /dev/null +++ b/glabels1/macros/gnome-fileutils.m4 @@ -0,0 +1,414 @@ +dnl +dnl GNOME_FILEUTILS_CHECKS +dnl +dnl checks that are needed for the diskusage applet. +dnl + +AC_DEFUN([GNOME_FILEUTILS_CHECKS], +[ +AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \ +mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \ +sys/filsys.h sys/fs_types.h sys/fs/s5param.h) + +AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \ +getcwd getmntinfo gettimeofday isascii lchown \ +listmntent memcpy mkfifo strchr strerror strrchr vprintf) + +dnl Set some defaults when cross-compiling + +if test x$cross_compiling = xyes ; then + case "$host_os" in + linux*) + fu_cv_sys_mounted_getmntent1=yes + fu_cv_sys_stat_statfs2_bsize=yes + ;; + sunos*) + fu_cv_sys_stat_statfs4=yes + ;; + freebsd*) + fu_cv_sys_stat_statfs2_bsize=yes + ;; + osf*) + fu_cv_sys_stat_statfs3_osf1=yes + ;; + esac +fi + +# Determine how to get the list of mounted filesystems. +list_mounted_fs= + +# If the getmntent function is available but not in the standard library, +# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX). +AC_FUNC_GETMNTENT + +# This test must precede the ones for getmntent because Unicos-9 is +# reported to have the getmntent function, but its support is incompatible +# with other getmntent implementations. + +# NOTE: Normally, I wouldn't use a check for system type as I've done for +# `CRAY' below since that goes against the whole autoconf philosophy. But +# I think there is too great a chance that some non-Cray system has a +# function named listmntent to risk the false positive. + +if test -z "$list_mounted_fs"; then +# Cray UNICOS 9 +AC_MSG_CHECKING([for listmntent of Cray/Unicos-9]) +AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent, +[fu_cv_sys_mounted_cray_listmntent=no +AC_EGREP_CPP(yes, +[#ifdef _CRAY +yes +#endif +], [test $ac_cv_func_listmntent = yes \ +&& fu_cv_sys_mounted_cray_listmntent=yes] +) +] +) +AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent) +if test $fu_cv_sys_mounted_cray_listmntent = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_LISTMNTENT) +fi +fi + +if test $ac_cv_func_getmntent = yes; then + +# This system has the getmntent function. +# Determine whether it's the one-argument variant or the two-argument one. + +if test -z "$list_mounted_fs"; then +# 4.3BSD, SunOS, HP-UX, Dynix, Irix +AC_MSG_CHECKING([for one-argument getmntent function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1, +[test $ac_cv_header_mntent_h = yes \ +&& fu_cv_sys_mounted_getmntent1=yes \ +|| fu_cv_sys_mounted_getmntent1=no]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1) +if test $fu_cv_sys_mounted_getmntent1 = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTENT1) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR4 +AC_MSG_CHECKING([for two-argument getmntent function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2, +[AC_EGREP_HEADER(getmntent, sys/mnttab.h, +fu_cv_sys_mounted_getmntent2=yes, +fu_cv_sys_mounted_getmntent2=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2) +if test $fu_cv_sys_mounted_getmntent2 = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTENT2) +fi +fi + +if test -z "$list_mounted_fs"; then +AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) +fi + +fi + +if test -z "$list_mounted_fs"; then +# DEC Alpha running OSF/1. +AC_MSG_CHECKING([for getfsstat function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getsstat, +[AC_TRY_LINK([ +#include +#include +#include ], +[struct statfs *stats; +int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ], +fu_cv_sys_mounted_getsstat=yes, +fu_cv_sys_mounted_getsstat=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getsstat) +if test $fu_cv_sys_mounted_getsstat = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETFSSTAT) +fi +fi + +if test -z "$list_mounted_fs"; then +# AIX. +AC_MSG_CHECKING([for mntctl function and struct vmount]) +AC_CACHE_VAL(fu_cv_sys_mounted_vmount, +[AC_TRY_CPP([#include ], +fu_cv_sys_mounted_vmount=yes, +fu_cv_sys_mounted_vmount=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_vmount) +if test $fu_cv_sys_mounted_vmount = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_VMOUNT) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR3 +AC_MSG_CHECKING([for FIXME existence of three headers]) +AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp, +[AC_TRY_CPP([ +#include +#include +#include ], +fu_cv_sys_mounted_fread_fstyp=yes, +fu_cv_sys_mounted_fread_fstyp=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp) +if test $fu_cv_sys_mounted_fread_fstyp = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_FREAD_FSTYP) +fi +fi + +if test -z "$list_mounted_fs"; then +# 4.4BSD and DEC OSF/1. +AC_MSG_CHECKING([for getmntinfo function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo, +[ +ok= +if test $ac_cv_func_getmntinfo = yes; then +AC_EGREP_HEADER(f_type;, sys/mount.h, +ok=yes) +fi +test -n "$ok" \ +&& fu_cv_sys_mounted_getmntinfo=yes \ +|| fu_cv_sys_mounted_getmntinfo=no +]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo) +if test $fu_cv_sys_mounted_getmntinfo = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNTINFO) +fi +fi + +# FIXME: add a test for netbsd-1.1 here + +if test -z "$list_mounted_fs"; then +# Ultrix +AC_MSG_CHECKING([for getmnt function]) +AC_CACHE_VAL(fu_cv_sys_mounted_getmnt, +[AC_TRY_CPP([ +#include +#include ], +fu_cv_sys_mounted_getmnt=yes, +fu_cv_sys_mounted_getmnt=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_getmnt) +if test $fu_cv_sys_mounted_getmnt = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_GETMNT) +fi +fi + +if test -z "$list_mounted_fs"; then +# SVR2 +AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab]) +AC_CACHE_VAL(fu_cv_sys_mounted_fread, +[AC_TRY_CPP([#include ], +fu_cv_sys_mounted_fread=yes, +fu_cv_sys_mounted_fread=no)]) +AC_MSG_RESULT($fu_cv_sys_mounted_fread) +if test $fu_cv_sys_mounted_fread = yes; then +list_mounted_fs=found +AC_DEFINE(MOUNTED_FREAD) +fi +fi + +if test -z "$list_mounted_fs"; then +AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) +# FIXME -- no need to abort building the whole package +# Can't build mountlist.c or anything that needs its functions +fi + +AC_CHECKING(how to get filesystem space usage) +space=no + +# Perform only the link test since it seems there are no variants of the +# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs) +# because that got a false positive on SCO OSR5. Adding the declaration +# of a `struct statvfs' causes this test to fail (as it should) on such +# systems. That system is reported to work fine with STAT_STATFS4 which +# is what it gets when this test fails. +if test $space = no; then +# SVR4 +AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs, +[AC_TRY_LINK([#include +#include ], +[struct statvfs fsd; statvfs (0, &fsd);], +fu_cv_sys_stat_statvfs=yes, +fu_cv_sys_stat_statvfs=no)]) +if test $fu_cv_sys_stat_statvfs = yes; then +space=yes +AC_DEFINE(STAT_STATVFS) +fi +fi + +if test $space = no; then +# DEC Alpha running OSF/1 +AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1, +[AC_TRY_RUN([ +#include +#include +#include +main () +{ +struct statfs fsd; +fsd.f_fsize = 0; +exit (statfs (".", &fsd, sizeof (struct statfs))); +}], +fu_cv_sys_stat_statfs3_osf1=yes, +fu_cv_sys_stat_statfs3_osf1=no, +fu_cv_sys_stat_statfs3_osf1=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1) +if test $fu_cv_sys_stat_statfs3_osf1 = yes; then +space=yes +AC_DEFINE(STAT_STATFS3_OSF1) +fi +fi + +if test $space = no; then +# AIX +AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl +member (AIX, 4.3BSD)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize, +[AC_TRY_RUN([ +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif +main () +{ +struct statfs fsd; +fsd.f_bsize = 0; +exit (statfs (".", &fsd)); +}], +fu_cv_sys_stat_statfs2_bsize=yes, +fu_cv_sys_stat_statfs2_bsize=no, +fu_cv_sys_stat_statfs2_bsize=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize) +if test $fu_cv_sys_stat_statfs2_bsize = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_BSIZE) +fi +fi + +if test $space = no; then +# SVR3 +AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs4, +[AC_TRY_RUN([#include +#include +main () +{ +struct statfs fsd; +exit (statfs (".", &fsd, sizeof fsd, 0)); +}], +fu_cv_sys_stat_statfs4=yes, +fu_cv_sys_stat_statfs4=no, +fu_cv_sys_stat_statfs4=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs4) +if test $fu_cv_sys_stat_statfs4 = yes; then +space=yes +AC_DEFINE(STAT_STATFS4) +fi +fi + +if test $space = no; then +# 4.4BSD and NetBSD +AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl +member (4.4BSD and NetBSD)]) +AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize, +[AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +main () +{ +struct statfs fsd; +fsd.f_fsize = 0; +exit (statfs (".", &fsd)); +}], +fu_cv_sys_stat_statfs2_fsize=yes, +fu_cv_sys_stat_statfs2_fsize=no, +fu_cv_sys_stat_statfs2_fsize=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize) +if test $fu_cv_sys_stat_statfs2_fsize = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_FSIZE) +fi +fi + +if test $space = no; then +# Ultrix +AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) +AC_CACHE_VAL(fu_cv_sys_stat_fs_data, +[AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_FS_TYPES_H +#include +#endif +main () +{ +struct fs_data fsd; +/* Ultrix's statfs returns 1 for success, +0 for not mounted, -1 for failure. */ +exit (statfs (".", &fsd) != 1); +}], +fu_cv_sys_stat_fs_data=yes, +fu_cv_sys_stat_fs_data=no, +fu_cv_sys_stat_fs_data=no)]) +AC_MSG_RESULT($fu_cv_sys_stat_fs_data) +if test $fu_cv_sys_stat_fs_data = yes; then +space=yes +AC_DEFINE(STAT_STATFS2_FS_DATA) +fi +fi + +if test $space = no; then +# SVR2 +AC_TRY_CPP([#include ], +AC_DEFINE(STAT_READ_FILSYS) space=yes) +fi + +if test -n "$list_mounted_fs" && test $space != no; then +DF_PROG="df" +# LIBOBJS="$LIBOBJS fsusage.o" +# LIBOBJS="$LIBOBJS mountlist.o" +fi + +# Check for SunOS statfs brokenness wrt partitions 2GB and larger. +# If exists and struct statfs has a member named f_spare, +# enable the work-around code in fsusage.c. +AC_MSG_CHECKING([for statfs that truncates block counts]) +AC_CACHE_VAL(fu_cv_sys_truncating_statfs, +[AC_TRY_COMPILE([ +#if !defined(sun) && !defined(__sun) +choke -- this is a workaround for a Sun-specific problem +#endif +#include +#include ], +[struct statfs t; long c = *(t.f_spare);], +fu_cv_sys_truncating_statfs=yes, +fu_cv_sys_truncating_statfs=no, +)]) +if test $fu_cv_sys_truncating_statfs = yes; then +AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS) +fi +AC_MSG_RESULT($fu_cv_sys_truncating_statfs) + +AC_CHECKING(for AFS) +test -d /afs && AC_DEFINE(AFS) +]) diff --git a/glabels1/macros/gnome-gettext.m4 b/glabels1/macros/gnome-gettext.m4 new file mode 100644 index 00000000..1dac989c --- /dev/null +++ b/glabels1/macros/gnome-gettext.m4 @@ -0,0 +1,336 @@ +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. +# +# Modified to never use included libintl. +# Owen Taylor , 12/15/1998 +# +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 5 + +AC_DEFUN(AM_GNOME_WITH_NLS, + [AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + USE_INCLUDED_LIBINTL=no + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + AC_DEFINE(ENABLE_NLS) +# AC_MSG_CHECKING([whether included gettext is requested]) +# AC_ARG_WITH(included-gettext, +# [ --with-included-gettext use the GNU gettext library included here], +# nls_cv_force_use_gnu_gettext=$withval, +# nls_cv_force_use_gnu_gettext=no) +# AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + 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 gettext in libc], gt_cv_func_gettext_libc, + [AC_TRY_LINK([#include ], [return (int) gettext ("")], + gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) + + if test "$gt_cv_func_gettext_libc" != "yes"; then + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CACHE_CHECK([for gettext in libintl], + gt_cv_func_gettext_libintl, + [AC_CHECK_LIB(intl, gettext, + gt_cv_func_gettext_libintl=yes, + gt_cv_func_gettext_libintl=no)], + gt_cv_func_gettext_libintl=no)]) + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + AC_DEFINE(HAVE_GETTEXT) + 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_gettext_libc" != "yes" \ + && test "$gt_cv_func_gettext_libintl" = "yes"; then + INTLLIBS=-lintl + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + fi + ]) + + if test "$CATOBJEXT" = "NONE"; then + AC_MSG_CHECKING([whether catgets can be used]) + AC_ARG_WITH(catgets, + [ --with-catgets use catgets functions if available], + nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) + AC_MSG_RESULT($nls_cv_use_catgets) + + if test "$nls_cv_use_catgets" = "yes"; then + dnl No gettext in C library. Try catgets next. + AC_CHECK_LIB(i, main) + AC_CHECK_FUNC(catgets, + [AC_DEFINE(HAVE_CATGETS) + INTLOBJS="\$(CATOBJS)" + AC_PATH_PROG(GENCAT, gencat, no)dnl +# if test "$GENCAT" != "no"; then +# AC_PATH_PROG(GMSGFMT, gmsgfmt, no) +# if test "$GMSGFMT" = "no"; then +# AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, +# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) +# fi +# AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, +# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) +# USE_INCLUDED_LIBINTL=yes +# CATOBJEXT=.cat +# INSTOBJEXT=.cat +# DATADIRNAME=lib +# INTLDEPS='$(top_builddir)/intl/libintl.a' +# INTLLIBS=$INTLDEPS +# LIBS=`echo $LIBS | sed -e 's/-lintl//'` +# nls_cv_header_intl=intl/libintl.h +# nls_cv_header_libgt=intl/libgettext.h +# fi + ]) + fi + 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) + else + # Unset this variable since we use the non-zero value as a flag. + CATOBJEXT= +# dnl Mark actions used to generate GNU NLS library. +# INTLOBJS="\$(GETTOBJS)" +# AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, +# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) +# 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_SUBST(MSGFMT) +# USE_INCLUDED_LIBINTL=yes +# CATOBJEXT=.gmo +# INSTOBJEXT=.mo +# DATADIRNAME=share +# INTLDEPS='$(top_builddir)/intl/libintl.a' +# INTLLIBS=$INTLDEPS +# LIBS=`echo $LIBS | sed -e 's/-lintl//'` +# nls_cv_header_intl=intl/libintl.h +# nls_cv_header_libgt=intl/libgettext.h + 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 + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + + +# # If this is used in GNU gettext we have to set USE_NLS to `yes' +# # because some of the sources are only built for this goal. +# if test "$PACKAGE" = gettext; then +# USE_NLS=yes +# USE_INCLUDED_LIBINTL=yes +# fi + + 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(USE_INCLUDED_LIBINTL) + 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_GNOME_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])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]) + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + AC_CHECK_FUNCS(stpcpy) + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + AC_DEFINE(HAVE_STPCPY) + fi + + AM_LC_MESSAGES + AM_GNOME_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= + if test "x$LINGUAS" = "x"; then + LINGUAS=$ALL_LINGUAS + fi + for lang in $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 The reference to in the installed file + dnl must be resolved because we cannot expect the users of this + dnl to define HAVE_LOCALE_H. + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + AC_SUBST(INCLUDE_LOCALE_H) + + 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 intl || mkdir intl + 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/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + dnl po2tbl.sed is always needed. + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + dnl In the intl/Makefile.in we have a special dependency which makes + dnl only sense for gettext. We comment this out for non-gettext + dnl packages. + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + AC_SUBST(GT_NO) + AC_SUBST(GT_YES) + + 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 *** For now the libtool support in intl/Makefile is not for real. + l= + AC_SUBST(l) + + 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 + ]) + diff --git a/glabels1/macros/gnome-ghttp-check.m4 b/glabels1/macros/gnome-ghttp-check.m4 new file mode 100644 index 00000000..1fc85783 --- /dev/null +++ b/glabels1/macros/gnome-ghttp-check.m4 @@ -0,0 +1,14 @@ +AC_DEFUN([GNOME_GHTTP_CHECK],[ + AC_REQUIRE([GNOME_INIT_HOOK]) + GHTTP_LIB= + AC_CHECK_FUNC(connect,,[ + AC_CHECK_LIB(socket,connect, + GHTTP_LIB="-lsocket $GHTTP_LIB",,$GHTTP_LIB)]) + AC_CHECK_FUNC(gethostbyname,,[ + AC_CHECK_LIB(nsl,gethostbyname, + GHTTP_LIB="-lnsl $GHTTP_LIB",,$GHTTP_LIB)]) + AC_CHECK_LIB(ghttp, ghttp_request_new, + GHTTP_LIB="-lghttp $GHTTP_LIB",,-L$gnome_prefix $GHTTP_LIB) + AC_SUBST(GHTTP_LIB) + AC_PROVIDE([GNOME_GHTTP_CHECK]) +]) diff --git a/glabels1/macros/gnome-gnorba-check.m4 b/glabels1/macros/gnome-gnorba-check.m4 new file mode 100644 index 00000000..dbac0a6c --- /dev/null +++ b/glabels1/macros/gnome-gnorba-check.m4 @@ -0,0 +1,35 @@ +dnl +dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag) +dnl +dnl if failflag is "failure" it aborts if gnorba is not found. +dnl + +AC_DEFUN([GNOME_GNORBA_HOOK],[ + GNOME_ORBIT_HOOK([],$2) + AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[ + gnome_cv_gnorba_found=no + if test x$gnome_cv_orbit_found = xyes; then + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + if test -n "$GNORBA_LIBS"; then + gnome_cv_gnorba_found=yes + fi + fi + ]) + AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" + GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" + AC_SUBST(GNORBA_CFLAGS) + AC_SUBST(GNORBA_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(gnorba library not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_GNORBA_CHECK], [ + GNOME_GNORBA_HOOK([],failure) +]) diff --git a/glabels1/macros/gnome-guile-checks.m4 b/glabels1/macros/gnome-guile-checks.m4 new file mode 100644 index 00000000..1086d30a --- /dev/null +++ b/glabels1/macros/gnome-guile-checks.m4 @@ -0,0 +1,119 @@ +dnl +dnl GNOME_CHECK_GUILE (failflag) +dnl +dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found. +dnl + +AC_DEFUN([GNOME_CHECK_GUILE], +[ + saved_ldflags="$LDFLAGS" + saved_cppflags="$CPPFLAGS" + LDFLAGS="$LDFLAGS $GNOME_LIBDIR" + + AC_CHECK_LIB(qthreads,qt_null,[ + QTTHREADS_LIB="-lqthreads" + ],[ + AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt") + ],$LIBS) + AC_SUBST(QTTHREADS_LIB) + + AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap") + AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB) + + AC_SUBST(TERMCAP_LIB) + AC_SUBST(READLINE_LIB) + + if test "x$cross_compiling" = "xyes" ; then + name_build_guile="$target_alias-guile-config" + else + name_build_guile="guile-config" + fi + + AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(whether $name_build_guile works) + if test x`$name_build_guile --version >/dev/null 2>&1 || \ + echo no` = xno; then + BUILD_GUILE=no + fi + AC_MSG_RESULT($BUILD_GUILE) + else + + if test "x$cross_compiling" = "xyes" ; then + name_build_guile="$target_alias-build-guile" + else + name_build_guile="build-guile" + fi + + AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(whether $name_build_guile works) + if test x`$name_build_guile --version >/dev/null 2>&1 || \ + echo no` = xno; then + BUILD_GUILE=no + fi + AC_MSG_RESULT($BUILD_GUILE) + fi + fi + + AC_CHECK_LIB(m, sin) + + if test "x$BUILD_GUILE" = "xyes"; then + AC_MSG_CHECKING(for guile libraries) + GUILE_LIBS="`$name_build_guile link`" + AC_MSG_RESULT($GUILE_LIBS) + AC_MSG_CHECKING(for guile headers) + GUILE_INCS="`$name_build_guile compile`" + AC_MSG_RESULT($GUILE_INCS) + else + GUILE_LIBS="$GNOME_LIBDIR" + GUILE_INCS="$GNOME_INCLUDEDIR" + AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS") + AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS") + AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS") + AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl") + AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket") + GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB" + fi + + AC_SUBST(GUILE_LIBS) + AC_SUBST(GUILE_INCS) + + saved_LIBS="$LIBS" + LIBS="$LIBS $GUILE_LIBS" + CPPFLAGS="$saved_cppflags $GUILE_INCS" + + AC_MSG_CHECKING(whether guile works) + AC_TRY_LINK([ + #include + #include + ],[ + gh_eval_str("(newline)"); + scm_boot_guile(0,NULL,NULL,NULL); + ],[ + ac_cv_guile_found=yes + AC_DEFINE(HAVE_GUILE) + ],[ + ac_cv_guile_found=no + ]) + AC_MSG_RESULT($ac_cv_guile_found) + + if test x$ac_cv_guile_found = xno ; then + if test x$1 = xfail ; then + AC_MSG_ERROR(Can not find Guile on this system) + else + AC_MSG_WARN(Can not find Guile on this system) + fi + ac_cv_guile_found=no + GUILE_LIBS= GUILE_INCS= + fi + + LIBS="$saved_LIBS" + LDFLAGS="$saved_ldflags" + CPPFLAGS="$saved_cppflags" + + AC_SUBST(GUILE_LIBS) + AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes) +]) diff --git a/glabels1/macros/gnome-libgtop-check.m4 b/glabels1/macros/gnome-libgtop-check.m4 new file mode 100644 index 00000000..81fbb601 --- /dev/null +++ b/glabels1/macros/gnome-libgtop-check.m4 @@ -0,0 +1,182 @@ +dnl +dnl GNOME_LIBGTOP_TYPES +dnl +dnl some typechecks for libgtop. +dnl + +AC_DEFUN([GNOME_LIBGTOP_TYPES], +[ + AC_CHECK_TYPE(u_int64_t, unsigned long long int) + AC_CHECK_TYPE(int64_t, long long int) +]) + +dnl +dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag) +dnl +dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop +dnl is not found. +dnl + +AC_DEFUN([GNOME_LIBGTOP_HOOK], +[ + AC_REQUIRE([GNOME_LIBGTOP_TYPES]) + + AC_SUBST(LIBGTOP_LIBDIR) + AC_SUBST(LIBGTOP_INCLUDEDIR) + AC_SUBST(LIBGTOP_EXTRA_LIBS) + AC_SUBST(LIBGTOP_LIBS) + AC_SUBST(LIBGTOP_INCS) + AC_SUBST(LIBGTOP_NAMES_LIBS) + AC_SUBST(LIBGTOP_NAMES_INCS) + AC_SUBST(LIBGTOP_GUILE_INCS) + AC_SUBST(LIBGTOP_GUILE_LIBS) + AC_SUBST(LIBGTOP_GUILE_NAMES_INCS) + AC_SUBST(LIBGTOP_GUILE_NAMES_LIBS) + AC_SUBST(LIBGTOP_MAJOR_VERSION) + AC_SUBST(LIBGTOP_MINOR_VERSION) + AC_SUBST(LIBGTOP_MICRO_VERSION) + AC_SUBST(LIBGTOP_VERSION) + AC_SUBST(LIBGTOP_VERSION_CODE) + AC_SUBST(LIBGTOP_SERVER_VERSION) + AC_SUBST(LIBGTOP_INTERFACE_AGE) + AC_SUBST(LIBGTOP_BINARY_AGE) + AC_SUBST(LIBGTOP_BINDIR) + AC_SUBST(LIBGTOP_SERVER) + + dnl Get the cflags and libraries from the libgtop-config script + dnl + AC_ARG_WITH(libgtop, + [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)], + libgtop_config_prefix="$withval", libgtop_config_prefix="") + AC_ARG_WITH(libgtop-exec, + [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)], + libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="") + + if test x$libgtop_config_exec_prefix != x ; then + libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix" + if test x${LIBGTOP_CONFIG+set} != xset ; then + LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config + fi + fi + if test x$libgtop_config_prefix != x ; then + libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix" + if test x${LIBGTOP_CONFIG+set} != xset ; then + LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config + fi + fi + + AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no) + dnl IMPORTANT NOTICE: + dnl If you increase this number here, this means that *ALL* + dnl modules will require the new version, even if they explicitly + dnl give a lower number in their `configure.in' !!! + real_min_libgtop_version=1.0.0 + min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1) + dnl I know, the following code looks really ugly, but if you want + dnl to make changes, please test it with a brain-dead /bin/sh and + dnl with a brain-dead /bin/test (not all shells/tests support the + dnl `<' operator to compare strings, that's why I convert everything + dnl into numbers and test them). + min_libgtop_major=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + min_libgtop_minor=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + min_libgtop_micro=`echo $min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test x$min_libgtop_micro = x && min_libgtop_micro=0 + real_min_libgtop_major=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + real_min_libgtop_minor=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + real_min_libgtop_micro=`echo $real_min_libgtop_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0 + dnl You cannot require a version less then $real_min_libgtop_version, + dnl so you don't need to update each `configure.in' when it's increased. + if test $real_min_libgtop_major -gt $min_libgtop_major ; then + min_libgtop_major=$real_min_libgtop_major + min_libgtop_minor=$real_min_libgtop_minor + min_libgtop_micro=$real_min_libgtop_micro + elif test $real_min_libgtop_major = $min_libgtop_major ; then + if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then + min_libgtop_minor=$real_min_libgtop_minor + min_libgtop_micro=$real_min_libgtop_micro + elif test $real_min_libgtop_minor = $min_libgtop_minor ; then + if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then + min_libgtop_micro=$real_min_libgtop_micro + fi + fi + fi + min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro" + AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version) + no_libgtop="" + if test "$LIBGTOP_CONFIG" = "no" ; then + no_libgtop=yes + else + configfile=`$LIBGTOP_CONFIG --config` + libgtop_major_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + libgtop_minor_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + libgtop_micro_version=`$LIBGTOP_CONFIG --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + test $libgtop_major_version != $min_libgtop_major && no_libgtop=yes + test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes + if test $libgtop_minor_version = $min_libgtop_minor ; then + test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes + fi + . $configfile + fi + if test x$no_libgtop = x ; then + AC_DEFINE(HAVE_LIBGTOP) + AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION") + AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE) + AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION) + AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION) + AC_MSG_RESULT(yes) + dnl Note that an empty true branch is not valid sh syntax. + ifelse([$2], [], :, [$2]) + else + AC_MSG_RESULT(no) + if test "x$3" = "xfail"; then + AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found) + else + AC_MSG_WARN(LibGTop >= $min_libgtop_version not found) + fi + fi + + AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes) +]) + +AC_DEFUN([GNOME_INIT_LIBGTOP],[ + GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2) +]) + +dnl +dnl GNOME_LIBGTOP_DOCU +dnl +dnl checks whether the documentation of LibGTop is installed +dnl + +AC_DEFUN([GNOME_LIBGTOP_DOCU], +[ + AC_REQUIRE([GNOME_LIBGTOP_HOOK]) + + helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop" + + AC_MSG_CHECKING(whether you have the LibGTop Documentation) + + if test -f "$helpdir/C/topic.dat" ; then + have_libgtop_docu=yes + AC_DEFINE(HAVE_LIBGTOP_DOCU) + else + have_libgtop_docu=no + fi + + AC_MSG_RESULT($have_libgtop_docu) + + AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes) +]) + diff --git a/glabels1/macros/gnome-objc-checks.m4 b/glabels1/macros/gnome-objc-checks.m4 new file mode 100644 index 00000000..dc9691cf --- /dev/null +++ b/glabels1/macros/gnome-objc-checks.m4 @@ -0,0 +1,79 @@ +AC_DEFUN([GNOME_CHECK_OBJC], +[ +dnl Look for an ObjC compiler. +dnl FIXME: extend list of possible names of ObjC compilers. + AC_CHECK_PROGS(OBJC, $OBJC egcs, "") + if test "x$OBJC" = "x" ; then + AC_CHECK_PROGS(OBJC, $OBJC egcc, "") + if test "x$OBJC" = "x" ; then + AC_CHECK_PROGS(OBJC, $OBJC gcc, "") + fi + fi + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + + OBJC_LIBS="-lobjc $PTHREAD_LIB" + AC_CHECK_FUNC(sched_yield,,[ + AC_CHECK_LIB(posix4,sched_yield, + OBJC_LIBS="$OBJC_LIBS -lposix4",, $OBJC_LIBS)]) + AC_SUBST(OBJC_LIBS) + + AC_CACHE_CHECK([if Objective C compiler ($OBJC) works], + ac_cv_prog_objc_works, [ + if test -n "$OBJC"; then + cat > conftest.m < +@interface myRandomObj : Object +{ +} +@end +@implementation myRandomObj +@end +int main () { + /* No, you are not seeing double. Remember that square brackets + are the autoconf m4 quotes. */ + id myid = [[myRandomObj alloc]]; + [[myid free]]; + return 0; +} +EOF + + $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1 + result=$? + rm -f conftest* + + if test $result -eq 0; then + ac_cv_prog_objc_works=yes + fi + else + ac_cv_prog_objc_works=no + fi + ]) + + AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes) + dnl Also set the shell variable OBJECTIVE_C to "yes" or "no". + OBJECTIVE_C=$ac_cv_prog_objc_works +]) + +AC_DEFUN([GNOME_INIT_OBJC], +[ + AC_MSG_CHECKING(for an obGnomeConf.sh) + my_gnome_libdir=`$GNOME_CONFIG --libdir` + if test -f $my_gnome_libdir/obGnomeConf.sh; then + . $my_gnome_libdir/obGnomeConf.sh + AC_MSG_RESULT(found $my_gnome_libdir) + ac_cv_have_gnome_objc=yes + else + AC_MSG_RESULT(not found) + AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install) + ac_cv_have_gnome_objc=no + fi + + dnl Add a conditional on whether or not we have gnome-objc + AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes) + HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc + + AC_SUBST(OBGNOME_INCLUDEDIR) + AC_SUBST(OBGNOME_LIBS) + AC_SUBST(OBGTK_LIBS) +]) diff --git a/glabels1/macros/gnome-orbit-check.m4 b/glabels1/macros/gnome-orbit-check.m4 new file mode 100644 index 00000000..54bf33aa --- /dev/null +++ b/glabels1/macros/gnome-orbit-check.m4 @@ -0,0 +1,33 @@ +dnl +dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag) +dnl +dnl if failflag is "failure" it aborts if orbit is not found. +dnl + +AC_DEFUN([GNOME_ORBIT_HOOK],[ + AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no) + AC_PATH_PROG(ORBIT_IDL,orbit-idl,no) + AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[ + if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then + gnome_cv_orbit_found=no + else + gnome_cv_orbit_found=yes + fi + ]) + AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes) + if test x$gnome_cv_orbit_found = xyes; then + $1 + ORBIT_CFLAGS=`orbit-config --cflags client server` + ORBIT_LIBS=`orbit-config --use-service=name --libs client server` + AC_SUBST(ORBIT_CFLAGS) + AC_SUBST(ORBIT_LIBS) + else + if test x$2 = xfailure; then + AC_MSG_ERROR(ORBit not installed or installation problem) + fi + fi +]) + +AC_DEFUN([GNOME_ORBIT_CHECK], [ + GNOME_ORBIT_HOOK([],failure) +]) diff --git a/glabels1/macros/gnome-print-check.m4 b/glabels1/macros/gnome-print-check.m4 new file mode 100644 index 00000000..7d98281d --- /dev/null +++ b/glabels1/macros/gnome-print-check.m4 @@ -0,0 +1,171 @@ +# Configure paths for GNOME-PRINT +# Chris Lahey 99-2-5 +# stolen from Manish Singh again +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS +dnl +AC_DEFUN(AM_PATH_GNOME_PRINT, +[dnl +dnl Get the cflags and libraries from the gnome-config script +dnl +AC_ARG_WITH(gnome-print-prefix,[ --with-gnome-print-prefix=PFX Prefix where GNOME-PRINT is installed (optional)], + gnome_print_prefix="$withval", gnome_print_prefix="") +AC_ARG_WITH(gnome-print-exec-prefix,[ --with-gnome-print-exec-prefix=PFX Exec prefix where GNOME-PRINT is installed (optional)], + gnome_print_exec_prefix="$withval", gnome_print_exec_prefix="") +AC_ARG_ENABLE(gnome-printtest, [ --disable-gnome-printtest Do not try to compile and run a test GNOME-PRINT program], + , enable_gnome_printtest=yes) + + if test x$gnome_print_exec_prefix != x ; then + gnome_print_args="$gnome_print_args --exec-prefix=$gnome_print_exec_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$gnome_print_exec_prefix/bin/gnome-config + fi + fi + if test x$gnome_print_prefix != x ; then + gnome_print_args="$gnome_print_args --prefix=$gnome_print_prefix" + if test x${GNOME_CONFIG+set} != xset ; then + GNOME_CONFIG=$gnome_print_prefix/bin/gnome-config + fi + fi + + AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) + min_gnome_print_version=ifelse([$1], ,0.1.0,$1) + AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_gnome_print_version) + no_gnome_print="" + if test "$GNOME_CONFIG" = "no" ; then + no_gnome_print=yes + else + GNOME_PRINT_CFLAGS=`$GNOME_CONFIG $gnome_printconf_args --cflags print` + GNOME_PRINT_LIBS=`$GNOME_CONFIG $gnome_printconf_args --libs print` + + gnome_print_major_version=`$GNOME_CONFIG $gnome_print_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gnome_print_minor_version=`$GNOME_CONFIG $gnome_print_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gnome_print_micro_version=`$GNOME_CONFIG $gnome_print_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gnome_printtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS" + LIBS="$LIBS $GNOME_PRINT_LIBS" +dnl +dnl Now check if the installed GNOME-PRINT is sufficiently new. (Also sanity +dnl checks the results of gnome-config to some extent +dnl + rm -f conf.gnome_printtest + AC_TRY_RUN([ +#include +#include +#include +#include + +static char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gnome_printtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_gnome_print_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gnome_print_version"); + exit(1); + } + return 0; +#if 0 + if (($gnome_print_major_version > major) || + (($gnome_print_major_version == major) && ($gnome_print_minor_version > minor)) || + (($gnome_print_major_version == major) && ($gnome_print_minor_version == minor) && ($gnome_print_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'gnome-config print --version' returned %d.%d.%d, but the minimum version\n", $gnome_print_major_version, $gnome_print_minor_version, $gnome_print_micro_version); + printf("*** of GNOME-PRINT required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n"); + printf("*** to point to the correct copy of gnome-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +#endif +} + +],, no_gnome_print=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gnome_print" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GNOME_CONFIG" = "no" ; then + echo "*** The gnome-config script installed by GNOME-LIBS could not be found" + echo "*** If GNOME-PRINT was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GNOME_CONFIG environment variable to the" + echo "*** full path to gnome-config." + else + if test -f conf.gnome_printtest ; then + : + else + echo "*** Could not run GNOME-PRINT test program, checking why..." + CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS" + LIBS="$LIBS $GNOME_PRINT_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GNOME-PRINT or finding the wrong" + echo "*** version of GNOME-PRINT. If it is not finding GNOME-PRINT, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GNOME-PRINT was incorrectly installed" + echo "*** or that you have moved GNOME-PRINT since it was installed. In the latter case, you" + echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GNOME_PRINT_CFLAGS="" + GNOME_PRINT_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GNOME_PRINT_CFLAGS) + AC_SUBST(GNOME_PRINT_LIBS) + rm -f conf.gnome_printtest +]) + +AC_DEFUN([GNOME_PRINT_CHECK], [ + AM_PATH_GNOME_PRINT(0.1.0,,[AC_MSG_ERROR(GNOME-PRINT not found)]) +]) diff --git a/glabels1/macros/gnome-pthread-check.m4 b/glabels1/macros/gnome-pthread-check.m4 new file mode 100644 index 00000000..a4eb3b48 --- /dev/null +++ b/glabels1/macros/gnome-pthread-check.m4 @@ -0,0 +1,16 @@ +dnl +dnl And better, use gthreads instead... +dnl + +AC_DEFUN([GNOME_PTHREAD_CHECK],[ + PTHREAD_LIB="" + AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread", + [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads", + [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r", + [AC_CHECK_FUNC(pthread_create)] + )] + )] + ) + AC_SUBST(PTHREAD_LIB) + AC_PROVIDE([GNOME_PTHREAD_CHECK]) +]) diff --git a/glabels1/macros/gnome-support.m4 b/glabels1/macros/gnome-support.m4 new file mode 100644 index 00000000..2c1d0498 --- /dev/null +++ b/glabels1/macros/gnome-support.m4 @@ -0,0 +1,68 @@ +dnl GNOME_SUPPORT_CHECKS +dnl Check for various support functions needed by the standard +dnl Gnome libraries. Sets LIBOBJS, might define some macros. +dnl This should only be used when building the Gnome libs; +dnl Gnome clients should not need this macro. +AC_DEFUN([GNOME_SUPPORT_CHECKS],[ + # we need an `awk' to build `gnomesupport.h' + AC_REQUIRE([AC_PROG_AWK]) + + # this should go away soon + need_gnome_support=yes + + save_LIBOBJS="$LIBOBJS" + LIBOBJS= + + AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o") + + # for `scandir' + AC_HEADER_DIRENT + + # copied from `configure.in' of `libiberty' + vars="program_invocation_short_name program_invocation_name sys_errlist" + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(gnome_cv_var_$v, + [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;], + [eval "gnome_cv_var_$v=yes"], + [eval "gnome_cv_var_$v=no"])]) + if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then + AC_MSG_RESULT(yes) + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + else + AC_MSG_RESULT(no) + fi + done + + AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen) + AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf) + + AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o") + + # to include `error.c' error.c has some HAVE_* checks + AC_CHECK_FUNCS(vprintf doprnt strerror_r) + AM_FUNC_ERROR_AT_LINE + + # This is required if we declare setreuid () and setregid (). + AC_TYPE_UID_T + + # see if we need to declare some functions. Solaris is notorious for + # putting functions into the `libc' but not listing them in the headers + AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h) + GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize) + GCC_NEED_DECLARATION(scandir,[ +#ifdef HAVE_DIRENT_H +#include +#endif +]) + + # Turn our LIBOBJS into libtool objects. This is gross, but it + # requires changes to autoconf before it goes away. + LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'` + AC_SUBST(need_gnome_support) + AC_SUBST(LTLIBOBJS) + + LIBOBJS="$save_LIBOBJS" + AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes) +]) diff --git a/glabels1/macros/gnome-undelfs.m4 b/glabels1/macros/gnome-undelfs.m4 new file mode 100644 index 00000000..c8ea6f4b --- /dev/null +++ b/glabels1/macros/gnome-undelfs.m4 @@ -0,0 +1,20 @@ +dnl GNOME_UNDELFS_CHECKS +dnl Check for ext2fs undel support. +dnl Set shell variable ext2fs_undel to "yes" if we have it, +dnl "no" otherwise. May define USE_EXT2FSLIB for cpp. +dnl Will set EXT2FS_UNDEL_LIBS to required libraries. + +AC_DEFUN([GNOME_UNDELFS_CHECKS], [ + AC_CHECK_HEADERS(ext2fs/ext2fs.h linux/ext2_fs.h) + ext2fs_undel=no + EXT2FS_UNDEL_LIBS= + if test x$ac_cv_header_ext2fs_ext2fs_h = xyes + then + if test x$ac_cv_header_linux_ext2_fs_h = xyes + then + AC_DEFINE(USE_EXT2FSLIB) + ext2fs_undel=yes + EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err" + fi + fi +]) diff --git a/glabels1/macros/gnome-vfs.m4 b/glabels1/macros/gnome-vfs.m4 new file mode 100644 index 00000000..8ca361f2 --- /dev/null +++ b/glabels1/macros/gnome-vfs.m4 @@ -0,0 +1,120 @@ +dnl GNOME_VFS_CHECKS +dnl Check for various functions needed by libvfs. +dnl This has various effects: +dnl Sets GNOME_VFS_LIBS to libraries required +dnl Sets termnet to true or false depending on whether it is required. +dnl If yes, defines USE_TERMNET. +dnl Sets vfs_flags to "pretty" list of vfs implementations we include. +dnl Sets shell variable use_vfs to yes (default, --with-vfs) or +dnl "no" (--without-vfs). +dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv". + +dnl Private define +AC_DEFUN([GNOME_WITH_VFS],[ + dnl FIXME: network checks should probably be in their own macro. + AC_CHECK_LIB(nsl, t_accept) + AC_CHECK_LIB(socket, socket) + + have_socket=no + AC_CHECK_FUNCS(socket, have_socket=yes) + if test $have_socket = no; then + # socket is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, socket, [ + LIBS="$LIBS -l$lib" + have_socket=yes + AC_DEFINE(HAVE_SOCKET) + break]) + done + fi + + have_gethostbyname=no + AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes) + if test $have_gethostbyname = no; then + # gethostbyname is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break]) + done + fi + + vfs_flags="tarfs" + use_net_code=false + if test $have_socket = yes; then + AC_STRUCT_LINGER + AC_CHECK_FUNCS(pmap_set, , [ + AC_CHECK_LIB(rpc, pmap_set, [ + LIBS="-lrpc $LIBS" + AC_DEFINE(HAVE_PMAP_SET) + ])]) + AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport) + dnl add for source routing support setsockopt + AC_CHECK_HEADERS(rpc/pmap_clnt.h) + vfs_flags="$vfs_flags, mcfs, ftpfs, fish" + use_net_code=true + fi + + dnl + dnl Samba support + dnl + smbfs="" + SAMBAFILES="" + AC_ARG_WITH(samba, + [--with-samba Support smb virtual file system],[ + if test "x$withval" != "xno"; then + AC_DEFINE(WITH_SMBFS) + vfs_flags="$vfs_flags, smbfs" + smbfs="smbfs.o" + SAMBAFILES="\$(SAMBAFILES)" + fi + ]) + AC_SUBST(smbfs) + AC_SUBST(SAMBAFILES) + + dnl + dnl The termnet support + dnl + termnet=false + AC_ARG_WITH(termnet, + [--with-termnet If you want a termified net support],[ + if test x$withval = xyes; then + AC_DEFINE(USE_TERMNET) + termnet=true + fi + ]) + + TERMNET="" + AC_DEFINE(USE_VFS) + if $use_net_code; then + AC_DEFINE(USE_NETCODE) + fi + mcserv= + if test $have_socket = yes; then + mcserv="mcserv" + if $termnet; then + TERMNET="-ltermnet" + fi + fi + + AC_SUBST(TERMNET) + AC_SUBST(mcserv) + +dnl FIXME: +dnl GNOME_VFS_LIBS= + +]) + +AC_DEFUN([GNOME_VFS_CHECKS],[ + use_vfs=yes + AC_ARG_WITH(vfs, + [--with-vfs Compile with the VFS code], + use_vfs=$withval + ) + case $use_vfs in + yes) GNOME_WITH_VFS;; + no) use_vfs=no;; + *) use_vfs=no;; + dnl Should we issue a warning? + esac +]) + + diff --git a/glabels1/macros/gnome-x-checks.m4 b/glabels1/macros/gnome-x-checks.m4 new file mode 100644 index 00000000..1e397ef8 --- /dev/null +++ b/glabels1/macros/gnome-x-checks.m4 @@ -0,0 +1,80 @@ +dnl GNOME_X_CHECKS +dnl +dnl Basic X11 related checks for X11. At the end, the following will be +dnl defined/changed: +dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK +dnl CPPFLAGS Will include $X_CFLAGS +dnl GNOME_HAVE_SM `true' or `false' depending on whether session +dnl management is available. It is available if +dnl both -lSM and X11/SM/SMlib.h exist. (Some +dnl Solaris boxes have the library but not the header) +dnl XPM_LIBS -lXpm if Xpm library is present, otherwise "" +dnl +dnl The following configure cache variables are defined (but not used): +dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS} +dnl +AC_DEFUN([GNOME_X_CHECKS], +[ + AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path)) + dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could + dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes" + dnl + dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses + dnl CPPFLAGS, not CFLAGS + CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" + + saved_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS $GTK_LIBS" + + gnome_cv_passdown_x_libs="$GTK_LIBS" + gnome_cv_passdown_X_LIBS="$GTK_LIBS" + gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" + gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" + + LDFLAGS="$saved_ldflags $GTK_LIBS" + +dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow. + USE_DEVGTK=true + +dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x]) +dnl AC_EGREP_CPP(answer_affirmatively, +dnl [#include +dnl #ifdef GTK_HAVE_FEATURES_1_1_0 +dnl answer_affirmatively +dnl #endif +dnl ], dev_gtk=yes, dev_gtk=no) +dnl if test "$dev_gtk" = "yes"; then +dnl USE_DEVGTK=true +dnl fi +dnl AC_MSG_RESULT("$dev_gtk") + + GNOME_HAVE_SM=true + case "$GTK_LIBS" in + *-lSM*) + dnl Already found it. + ;; + *) + dnl Assume that if we have -lSM then we also have -lICE. + AC_CHECK_LIB(SM, SmcSaveYourselfDone, + [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false, + $x_libs -lICE) + ;; + esac + + if test "$GNOME_HAVE_SM" = true; then + AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false) + fi + + if test "$GNOME_HAVE_SM" = true; then + AC_DEFINE(HAVE_LIBSM) + fi + + XPM_LIBS="" + AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs) + AC_SUBST(XPM_LIBS) + + AC_REQUIRE([GNOME_PTHREAD_CHECK]) + LDFLAGS="$saved_ldflags" + + AC_PROVIDE([GNOME_X_CHECKS]) +]) diff --git a/glabels1/macros/gnome-xml-check.m4 b/glabels1/macros/gnome-xml-check.m4 new file mode 100644 index 00000000..1caad100 --- /dev/null +++ b/glabels1/macros/gnome-xml-check.m4 @@ -0,0 +1,32 @@ +dnl +dnl GNOME_XML_HOOK (script-if-xml-found, failflag) +dnl +dnl If failflag is "failure", script aborts due to lack of XML +dnl +dnl Check for availability of the libxml library +dnl the XML parser uses libz if available too +dnl + +AC_DEFUN([GNOME_XML_HOOK],[ + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = no; then + if test x$2 = xfailure; then + AC_MSG_ERROR(Could not find gnome-config) + fi + fi + GNOME_XML_CFLAGS=`$GNOME_CONFIG --cflags xml` + AC_SUBST(GNOME_XML_CFLAGS) + AC_CHECK_LIB(xml, xmlNewDoc, [ + $1 + GNOME_XML_LIB=`$GNOME_CONFIG --libs xml` + ], [ + if test x$2 = xfailure; then + AC_MSG_ERROR(Could not link sample xml program) + fi + ], `$GNOME_CONFIG --libs xml`) + AC_SUBST(GNOME_XML_LIB) +]) + +AC_DEFUN([GNOME_XML_CHECK], [ + GNOME_XML_HOOK([],failure) +]) diff --git a/glabels1/macros/gnome.m4 b/glabels1/macros/gnome.m4 new file mode 100644 index 00000000..a3a9ca74 --- /dev/null +++ b/glabels1/macros/gnome.m4 @@ -0,0 +1,124 @@ +dnl +dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits]) +dnl +dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh +dnl is not found. +dnl + +AC_DEFUN([GNOME_INIT_HOOK],[ + AC_SUBST(GNOME_LIBS) + AC_SUBST(GNOMEUI_LIBS) + AC_SUBST(GNOMEGNORBA_LIBS) + AC_SUBST(GTKXMHTML_LIBS) + AC_SUBST(ZVT_LIBS) + AC_SUBST(GNOME_LIBDIR) + AC_SUBST(GNOME_INCLUDEDIR) + + AC_ARG_WITH(gnome-includes, + [ --with-gnome-includes Specify location of GNOME headers],[ + CFLAGS="$CFLAGS -I$withval" + ]) + + AC_ARG_WITH(gnome-libs, + [ --with-gnome-libs Specify location of GNOME libs],[ + LDFLAGS="$LDFLAGS -L$withval" + gnome_prefix=$withval + ]) + + AC_ARG_WITH(gnome, + [ --with-gnome Specify prefix for GNOME files], + if test x$withval = xyes; then + want_gnome=yes + dnl Note that an empty true branch is not + dnl valid sh syntax. + ifelse([$1], [], :, [$1]) + else + if test "x$withval" = xno; then + want_gnome=no + else + want_gnome=yes + LDFLAGS="$LDFLAGS -L$withval/lib" + CFLAGS="$CFLAGS -I$withval/include" + gnome_prefix=$withval/lib + fi + fi, + want_gnome=yes) + + if test "x$want_gnome" = xyes; then + + AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) + if test "$GNOME_CONFIG" = "no"; then + no_gnome_config="yes" + else + AC_MSG_CHECKING(if $GNOME_CONFIG works) + if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then + AC_MSG_RESULT(yes) + GNOME_GNORBA_HOOK([],$2) + GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" + GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" + GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" + GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" + ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" + GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" + GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" + $1 + else + AC_MSG_RESULT(no) + no_gnome_config="yes" + fi + fi + + if test x$exec_prefix = xNONE; then + if test x$prefix = xNONE; then + gnome_prefix=$ac_default_prefix/lib + else + gnome_prefix=$prefix/lib + fi + else + gnome_prefix=`eval echo \`echo $libdir\`` + fi + + if test "$no_gnome_config" = "yes"; then + AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix) + if test -f $gnome_prefix/gnomeConf.sh; then + AC_MSG_RESULT(found) + echo "loading gnome configuration from" \ + "$gnome_prefix/gnomeConf.sh" + . $gnome_prefix/gnomeConf.sh + $1 + else + AC_MSG_RESULT(not found) + if test x$2 = xfail; then + AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install) + fi + fi + fi + fi + + if test -n "$3"; then + n="$3" + for i in $n; do + AC_MSG_CHECKING(extra library \"$i\") + case $i in + applets) + AC_SUBST(GNOME_APPLETS_LIBS) + GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` + AC_MSG_RESULT($GNOME_APPLETS_LIBS);; + capplet) + AC_SUBST(GNOME_CAPPLET_LIBS) + GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` + AC_MSG_RESULT($GNOME_CAPPLET_LIBS);; + *) + AC_MSG_RESULT(unknown library) + esac + done + fi +]) + +dnl +dnl GNOME_INIT ([additional-inits]) +dnl + +AC_DEFUN([GNOME_INIT],[ + GNOME_INIT_HOOK([],fail,$1) +]) diff --git a/glabels1/macros/linger.m4 b/glabels1/macros/linger.m4 new file mode 100644 index 00000000..dfa7c8ae --- /dev/null +++ b/glabels1/macros/linger.m4 @@ -0,0 +1,28 @@ +dnl +dnl Check for struct linger +dnl +AC_DEFUN(AC_STRUCT_LINGER, [ +av_struct_linger=no +AC_MSG_CHECKING(struct linger is available) +AC_TRY_RUN([ +#include +#include + +struct linger li; + +main () +{ + li.l_onoff = 1; + li.l_linger = 120; + exit (0); +} +],[ +AC_DEFINE(HAVE_STRUCT_LINGER) +av_struct_linger=yes +],[ +av_struct_linger=no +],[ +av_struct_linger=no +]) +AC_MSG_RESULT($av_struct_linger) +]) diff --git a/glabels1/macros/need-declaration.m4 b/glabels1/macros/need-declaration.m4 new file mode 100644 index 00000000..d5b7bc66 --- /dev/null +++ b/glabels1/macros/need-declaration.m4 @@ -0,0 +1,42 @@ +dnl See whether we need a declaration for a function. +dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES]) +AC_DEFUN(GCC_NEED_DECLARATION, +[AC_MSG_CHECKING([whether $1 must be declared]) +AC_CACHE_VAL(gcc_cv_decl_needed_$1, +[AC_TRY_COMPILE([ +#include +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +$2], +[char *(*pfn) = (char *(*)) $1], +eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")]) +if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then + AC_MSG_RESULT(yes) + gcc_need_declarations="$gcc_need_declarations $1" + gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($gcc_tr_decl) +else + AC_MSG_RESULT(no) +fi +])dnl + +dnl Check multiple functions to see whether each needs a declaration. +dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES]) +AC_DEFUN(GCC_NEED_DECLARATIONS, +[for ac_func in $1 +do +GCC_NEED_DECLARATION($ac_func, $2) +done +] +) diff --git a/glabels1/missing b/glabels1/missing new file mode 100755 index 00000000..7789652e --- /dev/null +++ b/glabels1/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/glabels1/mkinstalldirs b/glabels1/mkinstalldirs new file mode 100755 index 00000000..6b3b5fc5 --- /dev/null +++ b/glabels1/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/glabels1/pixmaps/glabels-icon.png b/glabels1/pixmaps/glabels-icon.png new file mode 100644 index 00000000..298ea89e Binary files /dev/null and b/glabels1/pixmaps/glabels-icon.png differ diff --git a/glabels1/pixmaps/glabels-logo.png b/glabels1/pixmaps/glabels-logo.png new file mode 100644 index 00000000..40189b9f Binary files /dev/null and b/glabels1/pixmaps/glabels-logo.png differ diff --git a/glabels1/po/ChangeLog b/glabels1/po/ChangeLog new file mode 100644 index 00000000..e69de29b diff --git a/glabels1/po/Makefile.in.in b/glabels1/po/Makefile.in.in new file mode 100644 index 00000000..cf3aa8cb --- /dev/null +++ b/glabels1/po/Makefile.in.in @@ -0,0 +1,250 @@ +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +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/gettext/po +subdir = po + +DESTDIR = + +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 = cat-id-tbl.c +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ +stamp-cat-id $(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) $(PACKAGE).pot + $(MSGMERGE) $< $(srcdir)/$(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: cat-id-tbl.c $(CATALOGS) +all-no: + +$(srcdir)/$(PACKAGE).pot: $(POTFILES) + $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ + --add-comments --keyword=_ --keyword=N_ \ + --files-from=$(srcdir)/POTFILES.in \ + && test ! -f $(PACKAGE).po \ + || ( rm -f $(srcdir)/$(PACKAGE).pot \ + && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) + +$(srcdir)/cat-id-tbl.c: stamp-cat-id; @: +$(srcdir)/stamp-cat-id: $(PACKAGE).pot + rm -f cat-id-tbl.tmp + sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ + | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp + if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \ + rm cat-id-tbl.tmp; \ + else \ + echo cat-id-tbl.c changed; \ + rm -f $(srcdir)/cat-id-tbl.c; \ + mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \ + fi + cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id + + +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=$(DESTDIR)$(gnulocaledir);; \ + *) destdir=$(DESTDIR)$(localedir);; \ + esac; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + dir=$$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/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + fi; \ + if test -r $$cat.m; then \ + $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + if test -r $(srcdir)/$$cat.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$cat.m \ + $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + true; \ + fi; \ + fi; \ + done + if test "$(PACKAGE)" = "gettext"; 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/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + done + rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in + +check: all + +cat-id-tbl.o: ../intl/libgettext.h + +dvi info tags TAGS ID: + +mostlyclean: + rm -f core core.* *.pox $(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 = ../$(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) $(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 $(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: POTFILES.in + ( if test 'x$(srcdir)' != 'x.'; then \ + posrcprefix='$(top_srcdir)/'; \ + else \ + posrcprefix="../"; \ + fi; \ + rm -f $@-t $@ \ + && (sed -e '/^#/d' -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/glabels1/po/POTFILES.in b/glabels1/po/POTFILES.in new file mode 100644 index 00000000..71ca27f1 --- /dev/null +++ b/glabels1/po/POTFILES.in @@ -0,0 +1,100 @@ +# List of source files containing translatable strings. + +src/glabels.c +src/glabels_batch.c +src/splash.h +src/splash.c +src/mdi.h +src/mdi.c +src/display.c +src/display.h +src/item.c +src/item.h +src/item_text.c +src/item_text.h +src/item_line.c +src/item_line.h +src/item_box.c +src/item_box.h +src/item_ellipse.c +src/item_ellipse.h +src/item_image.c +src/item_image.h +src/item_barcode.c +src/item_barcode.h +src/highlight.c +src/highlight.h +src/prop_size.c +src/prop_size.h +src/prop_position.c +src/prop_position.h +src/prop_line.c +src/prop_line.h +src/prop_fill.c +src/prop_fill.h +src/prop_text.c +src/prop_text.h +src/prop_text_entry.c +src/prop_text_entry.h +src/prop_vector.c +src/prop_vector.h +src/prop_bc.c +src/prop_bc.h +src/prop_bc_style.c +src/prop_bc_style.h +src/prop_bc_data.c +src/prop_bc_data.h +src/propertybox.c +src/propertybox.h +src/label.h +src/label.c +src/template.h +src/template.c +src/text_node.h +src/text_node.c +src/merge_properties.c +src/merge_properties.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/bc.c +src/bc.h +src/bc_postnet.c +src/bc_postnet.h +src/bc_gnubarcode.c +src/bc_gnubarcode.h +src/tools.h +src/tools.c +src/stock.h +src/stock.c +src/menu.h +src/menu.c +src/file.c +src/file.h +src/media_select.c +src/media_select.h +src/rotate_select.c +src/rotate_select.h +src/print.c +src/print.h +src/print_dialog.c +src/print_dialog.h +src/print_copies.c +src/print_copies.h +src/print_merge.c +src/print_merge.h +src/mini_preview.c +src/mini_preview.h +src/edit.c +src/edit.h +src/prefs.h +src/prefs.c +src/util.c +src/util.h +src/hack.c +src/hack.h diff --git a/glabels1/po/cat-id-tbl.c b/glabels1/po/cat-id-tbl.c new file mode 100644 index 00000000..de67494c --- /dev/null +++ b/glabels1/po/cat-id-tbl.c @@ -0,0 +1,173 @@ +/* Automatically generated by po2tbl.sed from glabels.pot. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include "libgettext.h" + +const struct _msg_ent _msg_tbl[] = { + {"", 1}, + {"Revert to saved copy of %s?", 2}, + {"Unknown media type. Using default.", 3}, + {"\ +``%s'' has been modified.\n\ +\n\ +Do you wish to save it?", 4}, + {"Don't save", 5}, + {"Cannot save file", 6}, + {"Save As", 7}, + {"Close / Save label as", 8}, + {"Label no longer valid!", 9}, + {"Must supply file name", 10}, + {"Error writing file", 11}, + {"Delete", 12}, + {"Bring to front", 13}, + {"Send to back", 14}, + {"Edit properties...", 15}, + {"Edit text object properties", 16}, + {"Text", 17}, + {"Appearance", 18}, + {"Text Properties", 19}, + {"Position", 20}, + {"Edit line object properties", 21}, + {"Line", 22}, + {"Position/Size", 23}, + {"Size", 24}, + {"Edit box object properties", 25}, + {"Outline", 26}, + {"Fill", 27}, + {"Edit ellipse object properties", 28}, + {"Edit image object properties", 29}, + {"Image", 30}, + {"Reset image size", 31}, + {"Image format not currently supported", 32}, + {"Edit barcode object properties", 33}, + {"Data", 34}, + {"Barcode data", 35}, + {"General", 36}, + {"Style", 37}, + {"Invalid barcode", 38}, + {"Width:", 39}, + {"Height:", 40}, + {"Maintain current aspect ratio", 41}, + {"X:", 42}, + {"Y:", 43}, + {"points", 44}, + {"Color:", 45}, + {"Font:", 46}, + {"Alignment:", 47}, + {"Key:", 48}, + {"Insert merge field", 49}, + {"Length:", 50}, + {"Angle:", 51}, + {"degrees", 52}, + {"Scale:", 53}, + {"%", 54}, + {"Show text with barcode", 55}, + {"Literal:", 56}, + {"xmlParseFile error", 57}, + {"No document root", 58}, + {"document of the wrong type, glabels Namespace not found", 59}, + {"Bad root node = \"%s\"", 60}, + {"bad node = \"%s\"", 61}, + {"Problem saving xml file.", 62}, + {"No template files found!", 63}, + {"Edit document-merge properties", 64}, + {"Source", 65}, + {"Format:", 66}, + {"Location:", 67}, + {"Fields", 68}, + {"None", 69}, + {"Text with tab separators", 70}, + {"Text with comma separators", 71}, + {"Text with colon separators", 72}, + {"N/A", 73}, + {"Select merge-database source", 74}, + {"Column", 75}, + {"Custom field key", 76}, + {"Sample data", 77}, + {"_New", 78}, + {"Make a new, empty label", 79}, + {"U_nselect All ", 80}, + {"Remove all selections", 81}, + {"Select", 82}, + {"Select, move and modify objects", 83}, + {"Create text object", 84}, + {"Box", 85}, + {"Create box/rectangle object", 86}, + {"Create line object", 87}, + {"Ellipse", 88}, + {"Create ellipse/circle object", 89}, + {"Create image object", 90}, + {"Barcode", 91}, + {"Create barcode object", 92}, + {"Zoom in", 93}, + {"Zoom out", 94}, + {"Zoom 1:1", 95}, + {"Zoom to 1:1", 96}, + {"Merge properties", 97}, + {"Edit merge properties", 98}, + {"_Tools", 99}, + {" New ", 100}, + {"New Label/Card", 101}, + {" Open ", 102}, + {"Open a file", 103}, + {" Save ", 104}, + {"Save current file", 105}, + {" Print ", 106}, + {"Print current file", 107}, + {"\ +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", 108}, + {"Function is not implemented!", 109}, + {"New Label or Card", 110}, + {"Media Type", 111}, + {"Label orientation", 112}, + {"Open", 113}, + {"Open label", 114}, + {"Cannot open file", 115}, + {"Save label as", 116}, + {"Description:", 117}, + {"Page size:", 118}, + {"Label size:", 119}, + {"Layout:", 120}, + {"%d x %d (%d per sheet)", 121}, + {"%s x %s %s", 122}, + {"%.5g x %.5g %s", 123}, + {"Rotate", 124}, + {"Print", 125}, + {"Copies", 126}, + {"Document merge control", 127}, + {"Options", 128}, + {"print outlines (to test printer alignment)", 129}, + {"print in reverse (i.e. a mirror image)", 130}, + {"Print preview", 131}, + {"Sheets:", 132}, + {"Labels", 133}, + {"from:", 134}, + {"to:", 135}, + {"Start on label", 136}, + {"on 1st sheet", 137}, + {"Collate", 138}, + {"Copies:", 139}, + {"Glabels: Preferences", 140}, + {"Display units", 141}, + {"Points", 142}, + {"Inches", 143}, + {"Millimeters", 144}, + {"Default page size", 145}, + {"inches", 146}, + {"mm", 147}, +}; + +int _msg_tbl_length = 147; diff --git a/glabels1/po/de.gmo b/glabels1/po/de.gmo new file mode 100644 index 00000000..85831f56 Binary files /dev/null and b/glabels1/po/de.gmo differ diff --git a/glabels1/po/de.po b/glabels1/po/de.po new file mode 100644 index 00000000..3e55480b --- /dev/null +++ b/glabels1/po/de.po @@ -0,0 +1,720 @@ +# French translation of glabels. +# Copyright (C) 2001 Jim Evins +# Marcus Bauer , 2001. +# +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.2.0\n" +"POT-Creation-Date: 2002-02-22 19:29-0500\n" +"PO-Revision-Date: 2001-10-15 15:31+0200\n" +"Last-Translator: Marcus Bauer \n" +"Language-Team: German <>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/mdi.c:169 +#, c-format +msgid "Revert to saved copy of %s?" +msgstr "Gespeicherte Kopie von %s wiederherstellen?" + +#: src/mdi.c:207 +msgid "Unknown media type. Using default." +msgstr "Unbekannter Medientyp. Nehme daher Standardeinstellung." + +#: src/mdi.c:455 +#, c-format +msgid "" +"``%s'' has been modified.\n" +"\n" +"Do you wish to save it?" +msgstr "" +"``%s'' wurde geändert \n" +"\n" +"Wollen Sie speichern?" + +#: src/mdi.c:459 +msgid "Don't save" +msgstr "Nicht speichern." + +#: src/file.c:288 src/mdi.c:601 +msgid "Cannot save file" +msgstr "Kann Datei nicht speichern" + +#: src/file.c:311 src/mdi.c:623 +msgid "Save As" +msgstr "Speichern unter..." + +#: src/mdi.c:626 +msgid "Close / Save label as" +msgstr "Schließen / Speichern des Etikett als" + +#: src/file.c:352 src/mdi.c:680 +msgid "Label no longer valid!" +msgstr "Etikett nicht mehr gültig!" + +#: src/file.c:362 src/mdi.c:693 +msgid "Must supply file name" +msgstr "Dateinamen angeben" + +#: src/file.c:374 src/mdi.c:705 +msgid "Error writing file" +msgstr "Fehler beim Schreiben der Datei" + +#: src/display.c:1250 src/display.c:1298 +msgid "Delete" +msgstr "Löschen" + +#: src/display.c:1260 src/display.c:1308 +msgid "Bring to front" +msgstr "Ganz nach vorne" + +#: src/display.c:1266 src/display.c:1314 +msgid "Send to back" +msgstr "Ganz nach hinten" + +#: src/display.c:1287 +msgid "Edit properties..." +msgstr "Einstellungen ändern..." + +#: src/item_text.c:450 +msgid "Edit text object properties" +msgstr "Text Objekt bearbeiten" + +#: src/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 +msgid "Text" +msgstr "Text" + +#: 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 +msgid "Appearance" +msgstr "Erscheinungsbild" + +#. ------ Begin Text Properties box ------ +#: src/item_text.c:482 +#, fuzzy +msgid "Text Properties" +msgstr "Text Einstellungen" + +#. ------ Position Frame ------ +#: 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 +msgid "Position" +msgstr "Position" + +#: src/item_line.c:243 +msgid "Edit line object properties" +msgstr "Linienobjekt bearbeiten..." + +#. ------ Begin Line box ------ +#: src/item_line.c:256 src/menu.c:106 +msgid "Line" +msgstr "Linie" + +#: src/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 +#: src/item_line.c:271 +msgid "Position/Size" +msgstr "Position/Breite" + +#. ------ Size Frame ------ +#: src/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 +#: src/item_line.c:285 +msgid "Size" +msgstr "Breite" + +#: src/item_box.c:235 +msgid "Edit box object properties" +msgstr "Rechteck bearbeiten..." + +#. ------ Line box ------ +#: src/item_box.c:248 src/item_ellipse.c:250 +msgid "Outline" +msgstr "Outline" + +#. ------ Fill box ------ +#: src/item_box.c:258 src/item_ellipse.c:260 +msgid "Fill" +msgstr "Füllen" + +#: src/item_ellipse.c:237 +msgid "Edit ellipse object properties" +msgstr "Ellipse bearbeiten..." + +#: src/item_image.c:257 +msgid "Edit image object properties" +msgstr "Bildeinstellungen bearbeiten..." + +#: src/item_image.c:268 src/menu.c:113 +msgid "Image" +msgstr "Bild" + +#. ------ Size Reset Button ------ +#: src/item_image.c:342 +msgid "Reset image size" +msgstr "Reset Bildgröße" + +#: src/item_image.c:389 src/item_image.c:454 +msgid "Image format not currently supported" +msgstr "Bildformat wird zur Zeit nicht unterstützt" + +#: src/item_barcode.c:287 +msgid "Edit barcode object properties" +msgstr "Barcode bearbeiten..." + +#: src/item_barcode.c:297 +msgid "Data" +msgstr "Wert" + +#: src/item_barcode.c:299 +#, fuzzy +msgid "Barcode data" +msgstr "Barcode Wert" + +#. ------ Begin Barcode Properties Frame ------ +#: src/item_barcode.c:320 src/prefs.c:215 +msgid "General" +msgstr "Allgemeine Einstellungen" + +#. ------ Barcode Style Frame ------ +#: src/item_barcode.c:330 +msgid "Style" +msgstr "Stil" + +#: src/item_barcode.c:549 src/item_barcode.c:572 src/print.c:627 +msgid "Invalid barcode" +msgstr "Ungültiger Barcode-Wert" + +#. W Label +#: src/prop_line.c:169 src/prop_size.c:182 +#, fuzzy +msgid "Width:" +msgstr "Länge der Linie" + +#. H label +#: src/prop_size.c:198 +msgid "Height:" +msgstr "Höhe" + +#: src/prop_size.c:222 +#, fuzzy +msgid "Maintain current aspect ratio" +msgstr "Seitenverhältnis beibehalten" + +#. X label +#: src/prop_position.c:173 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/prop_position.c:191 +msgid "Y:" +msgstr "Y:" + +#. Line Width units +#: src/prefs.c:448 src/prefs.c:455 src/prop_line.c:183 +#, fuzzy +msgid "points" +msgstr "Punkt" + +#. Line Color Label +#: src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 +#: src/prop_text.c:234 +#, fuzzy +msgid "Color:" +msgstr "Farbe" + +#. Font label +#: src/prop_text.c:181 +#, fuzzy +msgid "Font:" +msgstr "Font:" + +#. Alignment label +#: src/prop_text.c:248 +#, fuzzy +msgid "Alignment:" +msgstr "Textanordnung:" + +#. Insert merge field label +#: src/prop_bc_data.c:196 src/prop_text_entry.c:180 +msgid "Key:" +msgstr "Key:" + +#: src/prop_text_entry.c:196 +msgid "Insert merge field" +msgstr "Datenfeld einfügen" + +#. Length label +#: src/prop_vector.c:183 +#, fuzzy +msgid "Length:" +msgstr "Länge" + +#. Angle label +#: src/prop_vector.c:207 +#, fuzzy +msgid "Angle:" +msgstr "Winkel" + +#. Angle units label +#: src/prop_vector.c:224 +msgid "degrees" +msgstr "Grad" + +#. Scale Label +#: src/prop_bc.c:168 +#, fuzzy +msgid "Scale:" +msgstr "Skalierung" + +#. % Label +#: src/prop_bc.c:182 +#, c-format +msgid "%" +msgstr "%" + +#: src/prop_bc_style.c:313 +msgid "Show text with barcode" +msgstr "Zeige Text mit Barcode" + +#: src/prop_bc_data.c:176 +msgid "Literal:" +msgstr "Literale:" + +#: src/label.c:173 src/label.c:197 +msgid "xmlParseFile error" +msgstr "Fehler: xmlParseFile error" + +#: src/label.c:228 +msgid "No document root" +msgstr "Kein document root" + +#: src/label.c:239 +msgid "document of the wrong type, glabels Namespace not found" +msgstr "Fehlerhafter Dokument-Typ, glabels Namespace nicht gefunden" + +#: src/label.c:244 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "Fehlerhafter root node = \"%s\"" + +#: src/label.c:291 +#, c-format +msgid "bad node = \"%s\"" +msgstr "fehlerhafter node = \"%s\"" + +#: src/label.c:606 +msgid "Problem saving xml file." +msgstr "Problem beim Speichern der xml-Datei." + +#: src/template.c:224 +msgid "No template files found!" +msgstr "Keine Dateivorlagen gefunden!" + +#: src/merge_properties.c:82 +#, fuzzy +msgid "Edit document-merge properties" +msgstr "Dokumenten Mischerei bearbeiten..." + +#: src/merge_properties.c:131 +msgid "Source" +msgstr "Quelle" + +#: src/merge_properties.c:143 +#, fuzzy +msgid "Format:" +msgstr "Font" + +#: src/merge_properties.c:158 +msgid "Location:" +msgstr "Ort:" + +#: src/merge_properties.c:168 +msgid "Fields" +msgstr "Felder" + +#: src/merge.c:78 +msgid "None" +msgstr "Keine" + +#: src/merge.c:86 +msgid "Text with tab separators" +msgstr "Text mit Tabulatoren als Trennern" + +#: src/merge.c:94 +msgid "Text with comma separators" +msgstr "Text mit Kommata als Separatoren" + +#: src/merge.c:102 +msgid "Text with colon separators" +msgstr "Text mit Doppelpunkten als Separatoren" + +#: src/merge_ui.c:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 +msgid "N/A" +msgstr "Nicht verfügbar" + +#: src/merge_ui_text.c:170 +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" + +#: src/menu.c:50 +msgid "_New" +msgstr "_Neu" + +#: src/menu.c:51 +msgid "Make a new, empty label" +msgstr "Erzeuge neues, leeres Etikett" + +#: src/menu.c:85 +msgid "U_nselect All " +msgstr "A_uswahl aufheben" + +#: src/menu.c:86 +msgid "Remove all selections" +msgstr "Alle Auswahlen aufheben" + +#: src/menu.c:94 +#, fuzzy +msgid "Select" +msgstr "Löschen" + +#: src/menu.c:95 src/menu.c:186 +msgid "Select, move and modify objects" +msgstr "Objekte auswählen, bewegen, ändern" + +#: src/menu.c:100 src/menu.c:191 +msgid "Create text object" +msgstr "Textobjekt erzeugen" + +#: src/menu.c:103 +msgid "Box" +msgstr "Box" + +#: src/menu.c:103 src/menu.c:194 +msgid "Create box/rectangle object" +msgstr "Rechteck-Objekt erzeugen" + +#: src/menu.c:106 src/menu.c:197 +msgid "Create line object" +msgstr "Linienobjekt erzeugen" + +#: src/menu.c:109 +msgid "Ellipse" +msgstr "Ellipse" + +#: src/menu.c:110 src/menu.c:200 +msgid "Create ellipse/circle object" +msgstr "Ellipsenobjekt erzeugen" + +#: src/menu.c:113 src/menu.c:203 +msgid "Create image object" +msgstr "Bildobjekt erzeugen" + +#: src/menu.c:116 +#, fuzzy +msgid "Barcode" +msgstr "Barcode Wert" + +#: src/menu.c:116 src/menu.c:206 +msgid "Create barcode object" +msgstr "Barcodeobjekt erzeugen" + +#: src/menu.c:121 src/menu.c:211 +msgid "Zoom in" +msgstr "vergrößern" + +#: src/menu.c:124 src/menu.c:214 +msgid "Zoom out" +msgstr "verkleinern" + +#: src/menu.c:127 +msgid "Zoom 1:1" +msgstr "Zoom 1:1" + +#: src/menu.c:127 src/menu.c:217 +msgid "Zoom to 1:1" +msgstr "Maßstab auf 1:1 einstellen" + +#: src/menu.c:132 src/menu.c:223 +#, fuzzy +msgid "Merge properties" +msgstr "Einstellungen ändern..." + +#: src/menu.c:133 +#, fuzzy +msgid "Edit merge properties" +msgstr "Bildeinstellungen bearbeiten..." + +#: src/menu.c:157 +msgid "_Tools" +msgstr "_Werkzeuge" + +#: src/menu.c:168 +msgid " New " +msgstr " Neu " + +#: src/menu.c:168 +msgid "New Label/Card" +msgstr "Neues Etikett/Neue Karte" + +#: src/menu.c:170 +msgid " Open " +msgstr " Öffnen " + +#: src/menu.c:170 +msgid "Open a file" +msgstr "Datei öffnen" + +#: src/menu.c:172 +msgid " Save " +msgstr " Speichern " + +#: src/menu.c:172 +msgid "Save current file" +msgstr "Aktuelle Datei speichern" + +#: src/menu.c:175 +msgid " Print " +msgstr " Drucken " + +#: src/menu.c:175 +msgid "Print current file" +msgstr "Aktuelle Datei drucken" + +#: src/menu.c:290 +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/menu.c:326 +msgid "Function is not implemented!" +msgstr "Funktion noch nicht implementiert!" + +#: src/file.c:72 +msgid "New Label or Card" +msgstr "Neues Etikett oder neue Karte" + +#: src/file.c:98 +msgid "Media Type" +msgstr "Medien Typ" + +#: src/file.c:109 +#, fuzzy +msgid "Label orientation" +msgstr "Ausrichtung ändern" + +#: src/file.c:211 +msgid "Open" +msgstr "Öffnen" + +#: src/file.c:213 +msgid "Open label" +msgstr "Öffnen Etikett" + +#: src/file.c:249 +msgid "Cannot open file" +msgstr "Datei kann nicht geöffnet werden" + +#: src/file.c:316 +msgid "Save label as" +msgstr "Datei speichern unter" + +#: src/media_select.c:222 +#, fuzzy +msgid "Description:" +msgstr "Position" + +#: src/media_select.c:227 +msgid "Page size:" +msgstr "Seiten Format:" + +#: src/media_select.c:232 +msgid "Label size:" +msgstr "Etikett Format:" + +#: src/media_select.c:237 +msgid "Layout:" +msgstr "Layout:" + +#: src/media_select.c:353 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d pro Seite)" + +#: src/media_select.c:367 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/media_select.c:372 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/rotate_select.c:169 +msgid "Rotate" +msgstr "Rotieren" + +#: src/print_dialog.c:99 +msgid "Print" +msgstr "Drucken" + +#. ----------- Add simple-copies widget ------------ +#: src/print_dialog.c:104 +msgid "Copies" +msgstr "Kopien" + +#. -------Otherwise add merge control widget ------------ +#: src/print_dialog.c:121 +msgid "Document merge control" +msgstr "Kontrolle der Mischung mit Datenquelle (Serienfunktion)" + +#. ----------- Add custom print options area ------------ +#: src/print_dialog.c:141 +msgid "Options" +msgstr "Optionen" + +#: src/print_dialog.c:152 +msgid "print outlines (to test printer alignment)" +msgstr "Begrenzungen drucken (um Druckausrichtung zu testen)" + +#: src/print_dialog.c:160 +msgid "print in reverse (i.e. a mirror image)" +msgstr "Spiegelbildlich drucken" + +#: src/print_dialog.c:241 src/print_dialog.c:280 +msgid "Print preview" +msgstr "Druckvorschau" + +#: src/print_copies.c:170 +msgid "Sheets:" +msgstr "Seiten:" + +#: src/print_copies.c:187 +msgid "Labels" +msgstr "Labels" + +#: src/print_copies.c:190 +msgid "from:" +msgstr "von:" + +#: src/print_copies.c:198 +msgid "to:" +msgstr "bis:" + +#: src/print_merge.c:170 +msgid "Start on label" +msgstr "Start bei Etikett" + +#: src/print_merge.c:179 +msgid "on 1st sheet" +msgstr "auf erster Seite" + +#: src/print_merge.c:188 +msgid "Collate" +msgstr "Zuordnen" + +#: src/print_merge.c:195 +msgid "Copies:" +msgstr "Kopien:" + +#: src/prefs.c:86 +msgid "Glabels: Preferences" +msgstr "Glabels : Einstellungen" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:220 +msgid "Display units" +msgstr "Anzeige Einheiten" + +#: src/prefs.c:231 +#, fuzzy +msgid "Points" +msgstr "Punkt" + +#: src/prefs.c:237 +msgid "Inches" +msgstr "Inch" + +#: src/prefs.c:244 +msgid "Millimeters" +msgstr "Millimeter" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:249 +msgid "Default page size" +msgstr "Standard Papierformat" + +#: src/prefs.c:450 +msgid "inches" +msgstr "Inch" + +#: src/prefs.c:452 +msgid "mm" +msgstr "mm" + +#~ 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/glabels1/po/fr.gmo b/glabels1/po/fr.gmo new file mode 100644 index 00000000..838ac6e3 Binary files /dev/null and b/glabels1/po/fr.gmo differ diff --git a/glabels1/po/fr.po b/glabels1/po/fr.po new file mode 100644 index 00000000..6ce59212 --- /dev/null +++ b/glabels1/po/fr.po @@ -0,0 +1,2199 @@ +# French translation of glabels. + + + +# Copyright (C) 2001 Jim Evins + + + +# Olivier Berger , 2001. + + + +# + + + +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.2.0\n" +"POT-Creation-Date: 2002-02-22 19:29-0500\n" +"PO-Revision-Date: 2001-10-15 15:31+0200\n" +"Last-Translator: Olivier Berger \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +# src/mdi.c:190 + + + +# src/mdi.c:189 + + + +# src/mdi.c:169 + +# src/mdi.c:169 +#: src/mdi.c:169 +#, c-format +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 +#: 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 +#: src/mdi.c:455 +#, c-format +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/mdi.c:482 + + + +# src/mdi.c:488 + + + +# src/mdi.c:459 + +# src/mdi.c:459 +#: src/mdi.c:459 +msgid "Don't save" +msgstr "Ne pas sauver" + +# 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 +#: 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 +#: 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 +#: 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 +#: src/file.c:352 src/mdi.c:680 +msgid "Label no longer valid!" +msgstr "Etiquette plus valide !" + +# 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:362 src/mdi.c:693 +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:374 src/mdi.c:705 +msgid "Error writing file" +msgstr "Erreur d'écriture du fichier" + +# 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/display.c:1250 src/display.c:1298 +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/display.c:1260 src/display.c:1308 +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/display.c:1266 src/display.c:1314 +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/display.c:1287 +msgid "Edit properties..." +msgstr "Editer les propriétés..." + +# src/item_text.c:432 + + + +# src/item_text.c:432 + + + +# src/item_text.c:450 + +# src/item_text.c:450 +#: src/item_text.c:450 +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/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 +msgid "Text" +msgstr "Texte" + +# 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/item_barcode.c:317 src/item_box.c:245 src/item_ellipse.c:247 +#: src/item_line.c:253 src/item_text.c:479 +msgid "Appearance" +msgstr "Apparence" + +# src/item_text.c:467 + + + +# src/item_text.c:467 + + + +# src/item_text.c:482 + +# src/item_text.c:482 +#. ------ Begin Text Properties box ------ +#: src/item_text.c:482 +msgid "Text Properties" +msgstr "Propriétés du texte" + +# 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/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 +msgid "Position" +msgstr "Position" + +# src/item_line.c:258 + + + +# src/item_line.c:258 + + + +# src/item_line.c:243 + +# src/item_line.c:243 +#: src/item_line.c:243 +msgid "Edit line object properties" +msgstr "Editer les propriétés de l'objet ligne..." + +# 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 +#. ------ Begin Line box ------ +#: src/item_line.c:256 src/menu.c:106 +msgid "Line" +msgstr "Ligne" + +# 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/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 +#: src/item_line.c:271 +msgid "Position/Size" +msgstr "Position/Taille" + +# 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/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 +#: src/item_line.c:285 +msgid "Size" +msgstr "Taille" + +# src/item_box.c:251 + + + +# src/item_box.c:251 + + + +# src/item_box.c:235 + +# src/item_box.c:235 +#: src/item_box.c:235 +msgid "Edit box object properties" +msgstr "Editer les propriétés de l'objet boîte..." + +# 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/item_box.c:248 src/item_ellipse.c:250 +msgid "Outline" +msgstr "Bordure" + +# 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/item_box.c:258 src/item_ellipse.c:260 +msgid "Fill" +msgstr "Remplissage" + +# src/item_ellipse.c:256 + + + +# src/item_ellipse.c:256 + + + +# src/item_ellipse.c:237 + +# src/item_ellipse.c:237 +#: src/item_ellipse.c:237 +msgid "Edit ellipse object properties" +msgstr "Editer les propriétés de l'objet ellipse..." + +# src/item_image.c:272 + + + +# src/item_image.c:272 + + + +# src/item_image.c:257 + +# src/item_image.c:257 +#: src/item_image.c:257 +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/item_image.c:268 src/menu.c:113 +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/item_image.c:342 +msgid "Reset image size" +msgstr "Restaurer la taille d'image" + +# 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 +#: 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:299 + + + +# src/item_barcode.c:299 + + + +# src/item_barcode.c:287 + +# src/item_barcode.c:287 +#: src/item_barcode.c:287 +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/item_barcode.c:297 +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/item_barcode.c:299 +msgid "Barcode data" +msgstr "Données de code-barre" + +# 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 +#. ------ Begin Barcode Properties Frame ------ +#: src/item_barcode.c:320 src/prefs.c:215 +msgid "General" +msgstr "Général" + +# src/item_barcode.c:347 + + + +# src/item_barcode.c:353 + + + +# src/item_barcode.c:330 + +# src/item_barcode.c:330 +#. ------ Barcode Style Frame ------ +#: src/item_barcode.c:330 +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/item_barcode.c:549 src/item_barcode.c:572 src/print.c:627 +msgid "Invalid barcode" +msgstr "Code-barre invalide" + +# 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/prop_line.c:169 src/prop_size.c:182 +msgid "Width:" +msgstr "Largeur :" + +# src/prop_size.c:220 + + + +# src/prop_size.c:198 + +# src/prop_size.c:198 +#. H label +#: src/prop_size.c:198 +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/prop_size.c:222 +msgid "Maintain current aspect ratio" +msgstr "Conserver le rapport d'échelle actuel" + +# src/prop_position.c:192 + + + +# src/prop_position.c:173 + +# src/prop_position.c:173 +#. X label +#: src/prop_position.c:173 +msgid "X:" +msgstr "X :" + +# src/prop_position.c:212 + + + +# src/prop_position.c:191 + +# src/prop_position.c:191 +#. Y label +#: src/prop_position.c:191 +msgid "Y:" +msgstr "Y :" + +# 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 +#. Line Width units +#: src/prefs.c:448 src/prefs.c:455 src/prop_line.c:183 +msgid "points" +msgstr "points" + +# 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 +#. Line Color Label +#: src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 +#: src/prop_text.c:234 +msgid "Color:" +msgstr "Couleur :" + +# src/prop_text.c:214 + + + +# src/prop_text.c:199 + + + +# src/prop_text.c:181 + +# src/prop_text.c:181 +#. Font label +#: src/prop_text.c:181 +msgid "Font:" +msgstr "Police :" + +# src/prop_text.c:277 + + + +# src/prop_text.c:264 + + + +# src/prop_text.c:248 + +# src/prop_text.c:248 +#. Alignment label +#: src/prop_text.c:248 +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/prop_bc_data.c:196 src/prop_text_entry.c:180 +msgid "Key:" +msgstr "Clé :" + +# src/prop_text_entry.c:196 + +# src/prop_text_entry.c:196 +#: src/prop_text_entry.c:196 +msgid "Insert merge field" +msgstr "Insérer champ de fusion" + +# src/prop_vector.c:196 + + + +# src/prop_vector.c:202 + + + +# src/prop_vector.c:183 + +# src/prop_vector.c:183 +#. Length label +#: src/prop_vector.c:183 +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/prop_vector.c:207 +msgid "Angle:" +msgstr "Angle :" + +# src/prop_vector.c:245 + + + +# src/prop_vector.c:224 + +# src/prop_vector.c:224 +#. Angle units label +#: src/prop_vector.c:224 +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/prop_bc.c:168 +msgid "Scale:" +msgstr "Echelle :" + +# src/prop_bc.c:202 + + + +# src/prop_bc.c:182 + +# src/prop_bc.c:182 +#. % Label +#: src/prop_bc.c:182 +#, 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/prop_bc_style.c:313 +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/prop_bc_data.c:176 +msgid "Literal:" +msgstr "Littéral :" + +# 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/label.c:173 src/label.c:197 +msgid "xmlParseFile error" +msgstr "erreur xmlParseFile" + +# src/label.c:243 + + + +# src/label.c:244 + + + +# src/label.c:225 + +# src/label.c:223 +#: src/label.c:228 +msgid "No document root" +msgstr "Pas de racine de document" + +# src/label.c:248 + + + +# src/label.c:249 + + + +# src/label.c:236 + +# src/label.c:234 +#: src/label.c:239 +msgid "document of the wrong type, glabels Namespace not found" +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/label.c:244 +#, 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/label.c:291 +#, 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/label.c:606 +msgid "Problem saving xml file." +msgstr "Problème de sauvegarde du fichier xml." + +# src/template.c:179 + + + +# src/template.c:178 + +# src/template.c:223 +#: src/template.c:224 +msgid "No template files found!" +msgstr "Aucun fichier de patron trouvé !" + +# src/item_box.c:251 + + + +# src/item_box.c:251 + + + +# src/merge_properties.c:82 + +# src/merge_properties.c:82 +#: src/merge_properties.c:82 +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:131 +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:143 +msgid "Format:" +msgstr "Format :" + +# src/merge_properties.c:158 + +# src/merge_properties.c:158 +#: src/merge_properties.c:158 +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:168 +msgid "Fields" +msgstr "Champs" + +# src/merge.c:80 + +# src/merge.c:78 +#: src/merge.c:78 +msgid "None" +msgstr "Aucun" + +# src/merge.c:89 + +# src/merge.c:86 +#: src/merge.c:86 +msgid "Text with tab separators" +msgstr "Texte avec séparateurs de tabulation" + +# src/merge.c:98 + +# src/merge.c:94 +#: src/merge.c:94 +msgid "Text with comma separators" +msgstr "Texte séparé par des virgules" + +# src/merge.c:107 + +# src/merge.c:102 +#: src/merge.c:102 +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:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 +msgid "N/A" +msgstr "Non défini" + +# src/merge_ui_text.c:170 + +# src/merge_ui_text.c:170 +#: src/merge_ui_text.c:170 +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/menu.c:50 + + + +# 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: 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 +#: src/menu.c:133 +msgid "Edit merge properties" +msgstr "Editer les propriétés de fusion" + +# src/menu.c:157 + +# 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 +#: src/menu.c:168 +msgid " New " +msgstr " Nouveau " + +# src/menu.c:138 + + + +# src/menu.c:138 + + + +# src/menu.c:168 + +# 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 +#: src/menu.c:170 +msgid " Open " +msgstr " Ouvrir " + +# src/menu.c:140 + + + +# src/menu.c:140 + + + +# src/menu.c:170 + +# 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 +#: src/menu.c:172 +msgid " Save " +msgstr " Enregistrer " + +# src/menu.c:142 + + + +# src/menu.c:142 + + + +# src/menu.c:172 + +# 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 +#: src/menu.c:175 +msgid " Print " +msgstr " Imprimer " + +# src/menu.c:145 + + + +# src/menu.c:145 + + + +# src/menu.c:175 + +# src/menu.c:175 +#: src/menu.c:175 +msgid "Print current file" +msgstr "Imprimer le fichier en cours" + +# src/menu.c:185 + + + +# src/menu.c:185 + + + +# src/menu.c:290 + +# src/menu.c:290 +#: src/menu.c:290 +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/menu.c:221 + + + +# src/menu.c:221 + + + +# src/menu.c:326 + +# src/menu.c:326 +#: src/menu.c:326 +msgid "Function is not implemented!" +msgstr "Cette fonction n'est pas implémentée !" + +# src/file.c:59 + + + +# src/file.c:59 + + + +# src/file.c:72 + +# src/file.c:72 +#: src/file.c:72 +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:98 +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:109 +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:211 +msgid "Open" +msgstr "Ouvrir" + +# src/file.c:183 + + + +# src/file.c:183 + + + +# src/file.c:213 + +# src/file.c:213 +#: src/file.c:213 +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:249 +msgid "Cannot open file" +msgstr "Impossible d'ouvrir le fichier" + +# src/file.c:278 + + + +# src/file.c:278 + + + +# src/file.c:316 + +# src/file.c:316 +#: src/file.c:316 +msgid "Save label as" +msgstr "Enregistrer l'étiquette sous" + +# src/media_select.c:216 + + + +# src/media_select.c:242 + + + +# src/media_select.c:222 + +# src/media_select.c:222 +#: src/media_select.c:222 +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/media_select.c:227 +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/media_select.c:232 +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/media_select.c:237 +msgid "Layout:" +msgstr "Disposition :" + +# src/media_select.c:515 + + + +# src/media_select.c:481 + +# src/media_select.c:353 +#: src/media_select.c:353 +#, 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/media_select.c:367 +#, 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/media_select.c:372 +#, 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/rotate_select.c:169 +msgid "Rotate" +msgstr "Rotation" + +# src/print.c:149 + + + +# src/print.c:149 + + + +# src/print.c:141 + +# src/print_dialog.c:99 +#: src/print_dialog.c:99 +msgid "Print" +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:104 +msgid "Copies" +msgstr "Copies" + +# src/print.c:164 + +# src/print_dialog.c:121 +#. -------Otherwise add merge control widget ------------ +#: src/print_dialog.c:121 +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:141 +msgid "Options" +msgstr "Options" + +# src/print.c:180 + + + +# src/print.c:180 + + + +# src/print.c:196 + +# src/print_dialog.c:152 +#: src/print_dialog.c:152 +msgid "print outlines (to test printer alignment)" +msgstr "imprimer des bordures (pour tester l'alignement de l'imprimante)" + +# src/print_dialog.c:160 +#: src/print_dialog.c:160 +msgid "print in reverse (i.e. a mirror image)" +msgstr "imprimer à l'envers (i.e. une image miroir)" + +# 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:241 src/print_dialog.c:280 +msgid "Print preview" +msgstr "Aperçu avant impression" + +# src/print_copies.c:193 + + + +# src/print_copies.c:193 + + + +# src/print_copies.c:171 + +# src/print_copies.c:170 +#: src/print_copies.c:170 +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/print_copies.c:187 +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/print_copies.c:190 +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/print_copies.c:198 +msgid "to:" +msgstr "à :" + +# src/print_copies_merge.c:197 + +# src/print_merge.c:170 +#: src/print_merge.c:170 +msgid "Start on label" +msgstr "Commencer par l'étiquette" + +# src/print_copies_merge.c:206 + +# src/print_merge.c:179 +#: src/print_merge.c:179 +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/print_merge.c:188 +msgid "Collate" +msgstr "Assembler" + +# src/print.c:153 + + + +# src/print.c:153 + + + +# src/print_copies_merge.c:173 + +# src/print_merge.c:195 +#: src/print_merge.c:195 +msgid "Copies:" +msgstr "Copies :" + +# src/preferences.c:92 + + + +# src/prefs.c:101 + + + +# src/prefs.c:92 + +# src/prefs.c:86 +#: src/prefs.c:86 +msgid "Glabels: Preferences" +msgstr "Glabels : Préférences" + +# src/prefs.c:248 + + + +# src/prefs.c:226 + +# src/prefs.c:220 +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:220 +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.c:231 +msgid "Points" +msgstr "Points" + +# src/prefs.c:265 + + + +# src/prefs.c:243 + +# src/prefs.c:237 +#: src/prefs.c:237 +msgid "Inches" +msgstr "Pouces" + +# src/prefs.c:271 + + + +# src/prefs.c:250 + +# src/prefs.c:244 +#: src/prefs.c:244 +msgid "Millimeters" +msgstr "Milimètres" + +# src/item_image.c:341 + + + +# src/prefs.c:278 + + + +# src/prefs.c:255 + +# src/prefs.c:249 +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:249 +msgid "Default page size" +msgstr "Taille de page par défaut" + +# src/item_line.c:271 + + + +# src/prefs.c:465 + + + +# src/prefs.c:447 + +# src/prefs.c:450 +#: src/prefs.c:450 +msgid "inches" +msgstr "pouces" + +# src/prefs.c:467 + + + +# src/prefs.c:449 + +# src/prefs.c:452 +#: src/prefs.c:452 +msgid "mm" +msgstr "mm" + +# 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/glabels1/po/glabels.pot b/glabels1/po/glabels.pot new file mode 100644 index 00000000..2ea48532 --- /dev/null +++ b/glabels1/po/glabels.pot @@ -0,0 +1,655 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2002-02-22 19:29-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" + +#: src/mdi.c:169 +#, c-format +msgid "Revert to saved copy of %s?" +msgstr "" + +#: src/mdi.c:207 +msgid "Unknown media type. Using default." +msgstr "" + +#: src/mdi.c:455 +#, c-format +msgid "" +"``%s'' has been modified.\n" +"\n" +"Do you wish to save it?" +msgstr "" + +#: src/mdi.c:459 +msgid "Don't save" +msgstr "" + +#: src/file.c:288 src/mdi.c:601 +msgid "Cannot save file" +msgstr "" + +#: src/file.c:311 src/mdi.c:623 +msgid "Save As" +msgstr "" + +#: src/mdi.c:626 +msgid "Close / Save label as" +msgstr "" + +#: src/file.c:352 src/mdi.c:680 +msgid "Label no longer valid!" +msgstr "" + +#: src/file.c:362 src/mdi.c:693 +msgid "Must supply file name" +msgstr "" + +#: src/file.c:374 src/mdi.c:705 +msgid "Error writing file" +msgstr "" + +#: src/display.c:1250 src/display.c:1298 +msgid "Delete" +msgstr "" + +#: src/display.c:1260 src/display.c:1308 +msgid "Bring to front" +msgstr "" + +#: src/display.c:1266 src/display.c:1314 +msgid "Send to back" +msgstr "" + +#: src/display.c:1287 +msgid "Edit properties..." +msgstr "" + +#: src/item_text.c:450 +msgid "Edit text object properties" +msgstr "" + +#: src/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 +msgid "Text" +msgstr "" + +#: 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 +msgid "Appearance" +msgstr "" + +#. ------ Begin Text Properties box ------ +#: src/item_text.c:482 +msgid "Text Properties" +msgstr "" + +#. ------ Position Frame ------ +#: 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 +msgid "Position" +msgstr "" + +#: src/item_line.c:243 +msgid "Edit line object properties" +msgstr "" + +#. ------ Begin Line box ------ +#: src/item_line.c:256 src/menu.c:106 +msgid "Line" +msgstr "" + +#: src/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 +#: src/item_line.c:271 +msgid "Position/Size" +msgstr "" + +#. ------ Size Frame ------ +#: src/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 +#: src/item_line.c:285 +msgid "Size" +msgstr "" + +#: src/item_box.c:235 +msgid "Edit box object properties" +msgstr "" + +#. ------ Line box ------ +#: src/item_box.c:248 src/item_ellipse.c:250 +msgid "Outline" +msgstr "" + +#. ------ Fill box ------ +#: src/item_box.c:258 src/item_ellipse.c:260 +msgid "Fill" +msgstr "" + +#: src/item_ellipse.c:237 +msgid "Edit ellipse object properties" +msgstr "" + +#: src/item_image.c:257 +msgid "Edit image object properties" +msgstr "" + +#: src/item_image.c:268 src/menu.c:113 +msgid "Image" +msgstr "" + +#. ------ Size Reset Button ------ +#: src/item_image.c:342 +msgid "Reset image size" +msgstr "" + +#: src/item_image.c:389 src/item_image.c:454 +msgid "Image format not currently supported" +msgstr "" + +#: src/item_barcode.c:287 +msgid "Edit barcode object properties" +msgstr "" + +#: src/item_barcode.c:297 +msgid "Data" +msgstr "" + +#: src/item_barcode.c:299 +msgid "Barcode data" +msgstr "" + +#. ------ Begin Barcode Properties Frame ------ +#: src/item_barcode.c:320 src/prefs.c:215 +msgid "General" +msgstr "" + +#. ------ Barcode Style Frame ------ +#: src/item_barcode.c:330 +msgid "Style" +msgstr "" + +#: src/item_barcode.c:549 src/item_barcode.c:572 src/print.c:627 +msgid "Invalid barcode" +msgstr "" + +#. W Label +#: src/prop_line.c:169 src/prop_size.c:182 +msgid "Width:" +msgstr "" + +#. H label +#: src/prop_size.c:198 +msgid "Height:" +msgstr "" + +#: src/prop_size.c:222 +msgid "Maintain current aspect ratio" +msgstr "" + +#. X label +#: src/prop_position.c:173 +msgid "X:" +msgstr "" + +#. Y label +#: src/prop_position.c:191 +msgid "Y:" +msgstr "" + +#. Line Width units +#: src/prefs.c:448 src/prefs.c:455 src/prop_line.c:183 +msgid "points" +msgstr "" + +#. Line Color Label +#: src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 +#: src/prop_text.c:234 +msgid "Color:" +msgstr "" + +#. Font label +#: src/prop_text.c:181 +msgid "Font:" +msgstr "" + +#. Alignment label +#: src/prop_text.c:248 +msgid "Alignment:" +msgstr "" + +#. Insert merge field label +#: src/prop_bc_data.c:196 src/prop_text_entry.c:180 +msgid "Key:" +msgstr "" + +#: src/prop_text_entry.c:196 +msgid "Insert merge field" +msgstr "" + +#. Length label +#: src/prop_vector.c:183 +msgid "Length:" +msgstr "" + +#. Angle label +#: src/prop_vector.c:207 +msgid "Angle:" +msgstr "" + +#. Angle units label +#: src/prop_vector.c:224 +msgid "degrees" +msgstr "" + +#. Scale Label +#: src/prop_bc.c:168 +msgid "Scale:" +msgstr "" + +#. % Label +#: src/prop_bc.c:182 +#, c-format +msgid "%" +msgstr "" + +#: src/prop_bc_style.c:313 +msgid "Show text with barcode" +msgstr "" + +#: src/prop_bc_data.c:176 +msgid "Literal:" +msgstr "" + +#: src/label.c:173 src/label.c:197 +msgid "xmlParseFile error" +msgstr "" + +#: src/label.c:228 +msgid "No document root" +msgstr "" + +#: src/label.c:239 +msgid "document of the wrong type, glabels Namespace not found" +msgstr "" + +#: src/label.c:244 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "" + +#: src/label.c:291 +#, c-format +msgid "bad node = \"%s\"" +msgstr "" + +#: src/label.c:606 +msgid "Problem saving xml file." +msgstr "" + +#: src/template.c:224 +msgid "No template files found!" +msgstr "" + +#: src/merge_properties.c:82 +msgid "Edit document-merge properties" +msgstr "" + +#: src/merge_properties.c:131 +msgid "Source" +msgstr "" + +#: src/merge_properties.c:143 +msgid "Format:" +msgstr "" + +#: src/merge_properties.c:158 +msgid "Location:" +msgstr "" + +#: src/merge_properties.c:168 +msgid "Fields" +msgstr "" + +#: src/merge.c:78 +msgid "None" +msgstr "" + +#: src/merge.c:86 +msgid "Text with tab separators" +msgstr "" + +#: src/merge.c:94 +msgid "Text with comma separators" +msgstr "" + +#: src/merge.c:102 +msgid "Text with colon separators" +msgstr "" + +#: src/merge_ui.c:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 +msgid "N/A" +msgstr "" + +#: src/merge_ui_text.c:170 +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 "" + +#: src/menu.c:50 +msgid "_New" +msgstr "" + +#: src/menu.c:51 +msgid "Make a new, empty label" +msgstr "" + +#: src/menu.c:85 +msgid "U_nselect All " +msgstr "" + +#: src/menu.c:86 +msgid "Remove all selections" +msgstr "" + +#: src/menu.c:94 +msgid "Select" +msgstr "" + +#: src/menu.c:95 src/menu.c:186 +msgid "Select, move and modify objects" +msgstr "" + +#: src/menu.c:100 src/menu.c:191 +msgid "Create text object" +msgstr "" + +#: src/menu.c:103 +msgid "Box" +msgstr "" + +#: src/menu.c:103 src/menu.c:194 +msgid "Create box/rectangle object" +msgstr "" + +#: src/menu.c:106 src/menu.c:197 +msgid "Create line object" +msgstr "" + +#: src/menu.c:109 +msgid "Ellipse" +msgstr "" + +#: src/menu.c:110 src/menu.c:200 +msgid "Create ellipse/circle object" +msgstr "" + +#: src/menu.c:113 src/menu.c:203 +msgid "Create image object" +msgstr "" + +#: src/menu.c:116 +msgid "Barcode" +msgstr "" + +#: src/menu.c:116 src/menu.c:206 +msgid "Create barcode object" +msgstr "" + +#: src/menu.c:121 src/menu.c:211 +msgid "Zoom in" +msgstr "" + +#: src/menu.c:124 src/menu.c:214 +msgid "Zoom out" +msgstr "" + +#: src/menu.c:127 +msgid "Zoom 1:1" +msgstr "" + +#: src/menu.c:127 src/menu.c:217 +msgid "Zoom to 1:1" +msgstr "" + +#: src/menu.c:132 src/menu.c:223 +msgid "Merge properties" +msgstr "" + +#: src/menu.c:133 +msgid "Edit merge properties" +msgstr "" + +#: src/menu.c:157 +msgid "_Tools" +msgstr "" + +#: src/menu.c:168 +msgid " New " +msgstr "" + +#: src/menu.c:168 +msgid "New Label/Card" +msgstr "" + +#: src/menu.c:170 +msgid " Open " +msgstr "" + +#: src/menu.c:170 +msgid "Open a file" +msgstr "" + +#: src/menu.c:172 +msgid " Save " +msgstr "" + +#: src/menu.c:172 +msgid "Save current file" +msgstr "" + +#: src/menu.c:175 +msgid " Print " +msgstr "" + +#: src/menu.c:175 +msgid "Print current file" +msgstr "" + +#: src/menu.c:290 +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/menu.c:326 +msgid "Function is not implemented!" +msgstr "" + +#: src/file.c:72 +msgid "New Label or Card" +msgstr "" + +#: src/file.c:98 +msgid "Media Type" +msgstr "" + +#: src/file.c:109 +msgid "Label orientation" +msgstr "" + +#: src/file.c:211 +msgid "Open" +msgstr "" + +#: src/file.c:213 +msgid "Open label" +msgstr "" + +#: src/file.c:249 +msgid "Cannot open file" +msgstr "" + +#: src/file.c:316 +msgid "Save label as" +msgstr "" + +#: src/media_select.c:222 +msgid "Description:" +msgstr "" + +#: src/media_select.c:227 +msgid "Page size:" +msgstr "" + +#: src/media_select.c:232 +msgid "Label size:" +msgstr "" + +#: src/media_select.c:237 +msgid "Layout:" +msgstr "" + +#: src/media_select.c:353 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "" + +#: src/media_select.c:367 +#, c-format +msgid "%s x %s %s" +msgstr "" + +#: src/media_select.c:372 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "" + +#: src/rotate_select.c:169 +msgid "Rotate" +msgstr "" + +#: src/print_dialog.c:99 +msgid "Print" +msgstr "" + +#. ----------- Add simple-copies widget ------------ +#: src/print_dialog.c:104 +msgid "Copies" +msgstr "" + +#. -------Otherwise add merge control widget ------------ +#: src/print_dialog.c:121 +msgid "Document merge control" +msgstr "" + +#. ----------- Add custom print options area ------------ +#: src/print_dialog.c:141 +msgid "Options" +msgstr "" + +#: src/print_dialog.c:152 +msgid "print outlines (to test printer alignment)" +msgstr "" + +#: src/print_dialog.c:160 +msgid "print in reverse (i.e. a mirror image)" +msgstr "" + +#: src/print_dialog.c:241 src/print_dialog.c:280 +msgid "Print preview" +msgstr "" + +#: src/print_copies.c:170 +msgid "Sheets:" +msgstr "" + +#: src/print_copies.c:187 +msgid "Labels" +msgstr "" + +#: src/print_copies.c:190 +msgid "from:" +msgstr "" + +#: src/print_copies.c:198 +msgid "to:" +msgstr "" + +#: src/print_merge.c:170 +msgid "Start on label" +msgstr "" + +#: src/print_merge.c:179 +msgid "on 1st sheet" +msgstr "" + +#: src/print_merge.c:188 +msgid "Collate" +msgstr "" + +#: src/print_merge.c:195 +msgid "Copies:" +msgstr "" + +#: src/prefs.c:86 +msgid "Glabels: Preferences" +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:220 +msgid "Display units" +msgstr "" + +#: src/prefs.c:231 +msgid "Points" +msgstr "" + +#: src/prefs.c:237 +msgid "Inches" +msgstr "" + +#: src/prefs.c:244 +msgid "Millimeters" +msgstr "" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:249 +msgid "Default page size" +msgstr "" + +#: src/prefs.c:450 +msgid "inches" +msgstr "" + +#: src/prefs.c:452 +msgid "mm" +msgstr "" diff --git a/glabels1/po/ja.gmo b/glabels1/po/ja.gmo new file mode 100644 index 00000000..d61ae589 Binary files /dev/null and b/glabels1/po/ja.gmo differ diff --git a/glabels1/po/ja.po b/glabels1/po/ja.po new file mode 100644 index 00000000..2e722c5f --- /dev/null +++ b/glabels1/po/ja.po @@ -0,0 +1,675 @@ +# glabels ja.po +# Copyright (C) 2001 Free Software Foundation, Inc. +# Takeshi Aihana , 2001, 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.4.1\n" +"POT-Creation-Date: 2002-02-22 19:29-0500\n" +"PO-Revision-Date: 2002-01-15 22:34+0900\n" +"Last-Translator: Takeshi Aihana \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/mdi.c:169 +#, c-format +msgid "Revert to saved copy of %s?" +msgstr "%s のコピーを反転しますか?" + +#: src/mdi.c:207 +msgid "Unknown media type. Using default." +msgstr "" +"メディアの種類が特定できません。デフォルトを使用しã" +"¾ã™ã€‚" + +#: src/mdi.c:455 +#, c-format +msgid "" +"``%s'' has been modified.\n" +"\n" +"Do you wish to save it?" +msgstr "" +"%s は編集されています。\n" +"\n" +"保存しますか?" + +#: src/mdi.c:459 +msgid "Don't save" +msgstr "保存しない" + +#: src/file.c:288 src/mdi.c:601 +msgid "Cannot save file" +msgstr "ファイルを保存することが出来ません" + +#: src/file.c:311 src/mdi.c:623 +msgid "Save As" +msgstr "名前を付けて保存" + +#: src/mdi.c:626 +msgid "Close / Save label as" +msgstr "ラベルに名前を付けて保存して閉じます" + +#: src/file.c:352 src/mdi.c:680 +msgid "Label no longer valid!" +msgstr "ラベルは有効ではありません!" + +#: src/file.c:362 src/mdi.c:693 +msgid "Must supply file name" +msgstr "ファイル名を指定して下さい" + +#: src/file.c:374 src/mdi.c:705 +msgid "Error writing file" +msgstr "ファイルの書き込みでエラー" + +#: src/display.c:1250 src/display.c:1298 +msgid "Delete" +msgstr "削除" + +#: src/display.c:1260 src/display.c:1308 +msgid "Bring to front" +msgstr "前に持って来る" + +#: src/display.c:1266 src/display.c:1314 +msgid "Send to back" +msgstr "後ろにまわす" + +#: src/display.c:1287 +msgid "Edit properties..." +msgstr "プロパティの編集..." + +#: src/item_text.c:450 +msgid "Edit text object properties" +msgstr "テキストの編集" + +#: src/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 +msgid "Text" +msgstr "テキスト" + +#: 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 +msgid "Appearance" +msgstr "外観" + +#. ------ Begin Text Properties box ------ +#: src/item_text.c:482 +msgid "Text Properties" +msgstr "文字プロパティ..." + +#. ------ Position Frame ------ +#: 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 +msgid "Position" +msgstr "位置" + +#: src/item_line.c:243 +msgid "Edit line object properties" +msgstr "直線の編集" + +#. ------ Begin Line box ------ +#: src/item_line.c:256 src/menu.c:106 +msgid "Line" +msgstr "直線" + +#: src/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 +#: src/item_line.c:271 +msgid "Position/Size" +msgstr "位置とサイズ" + +#. ------ Size Frame ------ +#: src/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 +#: src/item_line.c:285 +msgid "Size" +msgstr "サイズ" + +#: src/item_box.c:235 +msgid "Edit box object properties" +msgstr "四角の編集" + +#. ------ Line box ------ +#: src/item_box.c:248 src/item_ellipse.c:250 +msgid "Outline" +msgstr "矩形" + +#. ------ Fill box ------ +#: src/item_box.c:258 src/item_ellipse.c:260 +msgid "Fill" +msgstr "塗りつぶし" + +#: src/item_ellipse.c:237 +msgid "Edit ellipse object properties" +msgstr "楕円の編集" + +#: src/item_image.c:257 +msgid "Edit image object properties" +msgstr "画像の編集" + +#: src/item_image.c:268 src/menu.c:113 +msgid "Image" +msgstr "画像" + +#. ------ Size Reset Button ------ +#: src/item_image.c:342 +msgid "Reset image size" +msgstr "画像サイズのリセット" + +#: src/item_image.c:389 src/item_image.c:454 +msgid "Image format not currently supported" +msgstr "画像フォーマットはサポートしていません" + +#: src/item_barcode.c:287 +msgid "Edit barcode object properties" +msgstr "バーコードの編集" + +#: src/item_barcode.c:297 +msgid "Data" +msgstr "データ" + +#: src/item_barcode.c:299 +msgid "Barcode data" +msgstr "バーコード・データ" + +#. ------ Begin Barcode Properties Frame ------ +#: src/item_barcode.c:320 src/prefs.c:215 +msgid "General" +msgstr "全般" + +#. ------ Barcode Style Frame ------ +#: src/item_barcode.c:330 +msgid "Style" +msgstr "スタイル" + +#: src/item_barcode.c:549 src/item_barcode.c:572 src/print.c:627 +msgid "Invalid barcode" +msgstr "おかしなバーコード" + +#. W Label +#: src/prop_line.c:169 src/prop_size.c:182 +msgid "Width:" +msgstr "幅:" + +#. H label +#: src/prop_size.c:198 +msgid "Height:" +msgstr "高さ:" + +#: src/prop_size.c:222 +msgid "Maintain current aspect ratio" +msgstr "現在のアスペクト比率を維持する" + +#. X label +#: src/prop_position.c:173 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/prop_position.c:191 +msgid "Y:" +msgstr "Y:" + +#. Line Width units +#: src/prefs.c:448 src/prefs.c:455 src/prop_line.c:183 +msgid "points" +msgstr "ポイント" + +#. Line Color Label +#: src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 +#: src/prop_text.c:234 +msgid "Color:" +msgstr "色:" + +#. Font label +#: src/prop_text.c:181 +msgid "Font:" +msgstr "フォント:" + +#. Alignment label +#: src/prop_text.c:248 +msgid "Alignment:" +msgstr "位置:" + +#. Insert merge field label +#: src/prop_bc_data.c:196 src/prop_text_entry.c:180 +msgid "Key:" +msgstr "キー:" + +#: src/prop_text_entry.c:196 +msgid "Insert merge field" +msgstr "結合フィールドの挿入" + +#. Length label +#: src/prop_vector.c:183 +msgid "Length:" +msgstr "長さ:" + +#. Angle label +#: src/prop_vector.c:207 +msgid "Angle:" +msgstr "角度:" + +#. Angle units label +#: src/prop_vector.c:224 +msgid "degrees" +msgstr "度" + +#. Scale Label +#: src/prop_bc.c:168 +msgid "Scale:" +msgstr "寸法:" + +#. % Label +#: src/prop_bc.c:182 +#, c-format +msgid "%" +msgstr "%" + +#: src/prop_bc_style.c:313 +msgid "Show text with barcode" +msgstr "バーコードを付けてテキストを表示する" + +#: src/prop_bc_data.c:176 +msgid "Literal:" +msgstr "リテラル:" + +#: src/label.c:173 src/label.c:197 +msgid "xmlParseFile error" +msgstr "xmlParseFile エラー" + +#: src/label.c:228 +msgid "No document root" +msgstr "root ドキュメントではありません" + +#: src/label.c:239 +msgid "document of the wrong type, glabels Namespace not found" +msgstr "" +"ドキュメントの種類が間違っています。Glabels " +"名前空間が見つかりません。" + +#: src/label.c:244 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "おかしな root のノード = \"%s\"" + +#: src/label.c:291 +#, c-format +msgid "bad node = \"%s\"" +msgstr "おかしなノード = \"%s\"" + +#: src/label.c:606 +msgid "Problem saving xml file." +msgstr "XML ファイルの保存で問題があります" + +#: src/template.c:224 +msgid "No template files found!" +msgstr "テンプレート・ファイルが見つかりません!" + +#: src/merge_properties.c:82 +msgid "Edit document-merge properties" +msgstr "結合ドキュメント・プロパティの編集" + +#: src/merge_properties.c:131 +msgid "Source" +msgstr "ソース" + +#: src/merge_properties.c:143 +msgid "Format:" +msgstr "書式:" + +#: src/merge_properties.c:158 +msgid "Location:" +msgstr "場所:" + +#: src/merge_properties.c:168 +msgid "Fields" +msgstr "フィールド" + +#: src/merge.c:78 +msgid "None" +msgstr "なし" + +#: src/merge.c:86 +msgid "Text with tab separators" +msgstr "タブで区切ったテキスト" + +#: src/merge.c:94 +msgid "Text with comma separators" +msgstr "コンマで区切ったテキスト" + +#: src/merge.c:102 +msgid "Text with colon separators" +msgstr "コロンで区切ったテキスト" + +#: src/merge_ui.c:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 +msgid "N/A" +msgstr "N/A" + +#: src/merge_ui_text.c:170 +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 "サンプルデータ" + +#: src/menu.c:50 +msgid "_New" +msgstr "新規(_N)" + +#: src/menu.c:51 +msgid "Make a new, empty label" +msgstr "新規に空のラベルを作成します" + +#: src/menu.c:85 +msgid "U_nselect All " +msgstr "全て選択解除(_N)" + +#: src/menu.c:86 +msgid "Remove all selections" +msgstr "選択範囲を解除します" + +#: src/menu.c:94 +msgid "Select" +msgstr "選択" + +#: src/menu.c:95 src/menu.c:186 +msgid "Select, move and modify objects" +msgstr "オブジェクトの選択、移動、編集を行います" + +#: src/menu.c:100 src/menu.c:191 +msgid "Create text object" +msgstr "テキスト・オブジェクトを作成します" + +#: src/menu.c:103 +msgid "Box" +msgstr "四角" + +#: src/menu.c:103 src/menu.c:194 +msgid "Create box/rectangle object" +msgstr "四角/三角のオブジェクトを作成します" + +#: src/menu.c:106 src/menu.c:197 +msgid "Create line object" +msgstr "直線オブジェクトを作成します" + +#: src/menu.c:109 +msgid "Ellipse" +msgstr "楕円" + +#: src/menu.c:110 src/menu.c:200 +msgid "Create ellipse/circle object" +msgstr "楕円/円オブジェクトを作成します" + +#: src/menu.c:113 src/menu.c:203 +msgid "Create image object" +msgstr "画像オブジェクトを作成します" + +#: src/menu.c:116 +msgid "Barcode" +msgstr "バーコード" + +#: src/menu.c:116 src/menu.c:206 +msgid "Create barcode object" +msgstr "バーコード・オブジェクトを作成します" + +#: src/menu.c:121 src/menu.c:211 +msgid "Zoom in" +msgstr "拡大" + +#: src/menu.c:124 src/menu.c:214 +msgid "Zoom out" +msgstr "縮小" + +#: src/menu.c:127 +msgid "Zoom 1:1" +msgstr "元のサイズへ" + +#: src/menu.c:127 src/menu.c:217 +msgid "Zoom to 1:1" +msgstr "縦横比 1:1 のサイズにします" + +#: src/menu.c:132 src/menu.c:223 +msgid "Merge properties" +msgstr "結合プロパティ" + +#: src/menu.c:133 +msgid "Edit merge properties" +msgstr "結合プロパティを編集します" + +#: src/menu.c:157 +msgid "_Tools" +msgstr "ツール(_T)" + +#: src/menu.c:168 +msgid " New " +msgstr " 新規 " + +#: src/menu.c:168 +msgid "New Label/Card" +msgstr "新規のラベル/カードを作成します" + +#: src/menu.c:170 +msgid " Open " +msgstr " 開く " + +#: src/menu.c:170 +msgid "Open a file" +msgstr "ファイルを開きます" + +#: src/menu.c:172 +msgid " Save " +msgstr " 保存 " + +#: src/menu.c:172 +msgid "Save current file" +msgstr "このファイルを保存します" + +#: src/menu.c:175 +msgid " Print " +msgstr " 印刷 " + +#: src/menu.c:175 +msgid "Print current file" +msgstr "このファイルを印刷します" + +#: src/menu.c:290 +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/menu.c:326 +msgid "Function is not implemented!" +msgstr "まだこの機能は実装されていません!" + +#: src/file.c:72 +msgid "New Label or Card" +msgstr "新規ラベルまたはカード" + +#: src/file.c:98 +msgid "Media Type" +msgstr "メディアの種類" + +#: src/file.c:109 +msgid "Label orientation" +msgstr "ラベルの向き" + +#: src/file.c:211 +msgid "Open" +msgstr "開く" + +#: src/file.c:213 +msgid "Open label" +msgstr "ラベルを開きます" + +#: src/file.c:249 +msgid "Cannot open file" +msgstr "ファイルが開けません" + +#: src/file.c:316 +msgid "Save label as" +msgstr "ラベルに名前を付けて保存します" + +#: src/media_select.c:222 +msgid "Description:" +msgstr "説明:" + +#: src/media_select.c:227 +msgid "Page size:" +msgstr "用紙のサイズ:" + +#: src/media_select.c:232 +msgid "Label size:" +msgstr "ラベルの大きさ:" + +#: src/media_select.c:237 +msgid "Layout:" +msgstr "レイアウト:" + +#: src/media_select.c:353 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d 個/シート)" + +#: src/media_select.c:367 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/media_select.c:372 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/rotate_select.c:169 +msgid "Rotate" +msgstr "回転させる" + +#: src/print_dialog.c:99 +msgid "Print" +msgstr "印刷" + +#. ----------- Add simple-copies widget ------------ +#: src/print_dialog.c:104 +msgid "Copies" +msgstr "コピー" + +#. -------Otherwise add merge control widget ------------ +#: src/print_dialog.c:121 +msgid "Document merge control" +msgstr "ドキュメントをコントロールにマージする" + +#. ----------- Add custom print options area ------------ +#: src/print_dialog.c:141 +msgid "Options" +msgstr "オプション" + +#: src/print_dialog.c:152 +msgid "print outlines (to test printer alignment)" +msgstr "" +"アウトラインを印刷する (印刷時の配置を確認するため)" + +#: src/print_dialog.c:160 +msgid "print in reverse (i.e. a mirror image)" +msgstr "反転して印刷 (i.e. 画像をミラーしたもの)" + +#: src/print_dialog.c:241 src/print_dialog.c:280 +msgid "Print preview" +msgstr "印刷プレビュー" + +#: src/print_copies.c:170 +msgid "Sheets:" +msgstr "用紙:" + +#: src/print_copies.c:187 +msgid "Labels" +msgstr "ラベル" + +#: src/print_copies.c:190 +msgid "from:" +msgstr "開始:" + +#: src/print_copies.c:198 +msgid "to:" +msgstr "終了:" + +#: src/print_merge.c:170 +msgid "Start on label" +msgstr "ラベルの開始" + +#: src/print_merge.c:179 +msgid "on 1st sheet" +msgstr "(最初のシート)" + +#: src/print_merge.c:188 +msgid "Collate" +msgstr "製本" + +#: src/print_merge.c:195 +msgid "Copies:" +msgstr "コピー:" + +#: src/prefs.c:86 +msgid "Glabels: Preferences" +msgstr "Glabels: 設定" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:220 +msgid "Display units" +msgstr "表示する単位" + +#: src/prefs.c:231 +msgid "Points" +msgstr "ポイント" + +#: src/prefs.c:237 +msgid "Inches" +msgstr "インチ" + +#: src/prefs.c:244 +msgid "Millimeters" +msgstr "ミリ" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:249 +msgid "Default page size" +msgstr "デフォルトの用紙サイズ" + +#: src/prefs.c:450 +msgid "inches" +msgstr "[インチ]" + +#: src/prefs.c:452 +msgid "mm" +msgstr "[ミリ]" diff --git a/glabels1/po/pt_BR.gmo b/glabels1/po/pt_BR.gmo new file mode 100644 index 00000000..e17794f1 Binary files /dev/null and b/glabels1/po/pt_BR.gmo differ diff --git a/glabels1/po/pt_BR.po b/glabels1/po/pt_BR.po new file mode 100644 index 00000000..4d5d73e1 --- /dev/null +++ b/glabels1/po/pt_BR.po @@ -0,0 +1,673 @@ +# Brazilian Portuguese translation of Glabels. +# Copyright (C) 2001 Jim Evins +# Paulo R. Ormenese , 2001. +# +msgid "" +msgstr "" +"Project-Id-Version: glabels 0.4.1\n" +"POT-Creation-Date: 2002-02-22 19:29-0500\n" +"PO-Revision-Date: 2002-01-31 21:20+ZONE\n" +"Last-Translator: Paulo R. Ormenese \n" +"Language-Team: Brazilian portuguese <>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/mdi.c:169 +#, c-format +msgid "Revert to saved copy of %s?" +msgstr "Reverter para a cópia gravada de %s?" + +#: src/mdi.c:207 +msgid "Unknown media type. Using default." +msgstr "Tipo de mídia desconhecido. Usando padrão." + +#: src/mdi.c:455 +#, c-format +msgid "" +"``%s'' has been modified.\n" +"\n" +"Do you wish to save it?" +msgstr "" +"``%s'' foi modificado.\n" +"\n" +"Deseja salvá-lo?" + +#: src/mdi.c:459 +msgid "Don't save" +msgstr "Não salve" + +#: src/file.c:288 src/mdi.c:601 +msgid "Cannot save file" +msgstr "Não posso salvar o arquivo" + +#: src/file.c:311 src/mdi.c:623 +msgid "Save As" +msgstr "Salvar como" + +#: src/mdi.c:626 +msgid "Close / Save label as" +msgstr "Fechar / Salvar etiqueta como" + +#: src/file.c:352 src/mdi.c:680 +msgid "Label no longer valid!" +msgstr "Etiqueta não é mais válida" + +#: src/file.c:362 src/mdi.c:693 +msgid "Must supply file name" +msgstr "Necessário informar nome do arquivo" + +#: src/file.c:374 src/mdi.c:705 +msgid "Error writing file" +msgstr "Erro gravando o arquivo" + +#: src/display.c:1250 src/display.c:1298 +msgid "Delete" +msgstr "Apagar" + +#: src/display.c:1260 src/display.c:1308 +msgid "Bring to front" +msgstr "Trazer para frente" + +#: src/display.c:1266 src/display.c:1314 +msgid "Send to back" +msgstr "Enviar para trás" + +#: src/display.c:1287 +msgid "Edit properties..." +msgstr "Editar propriedades..." + +#: src/item_text.c:450 +msgid "Edit text object properties" +msgstr "Editar propriedades do objeto texto" + +#: src/item_text.c:460 src/item_text.c:464 src/item_text.c:637 src/menu.c:100 +msgid "Text" +msgstr "Texto" + +#: 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 +msgid "Appearance" +msgstr "Aparência" + +#. ------ Begin Text Properties box ------ +#: src/item_text.c:482 +msgid "Text Properties" +msgstr "Propriedades de Texto" + +#. ------ Position Frame ------ +#: 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 +msgid "Position" +msgstr "Posição" + +#: src/item_line.c:243 +msgid "Edit line object properties" +msgstr "Editar propriedades do objeto linha" + +#. ------ Begin Line box ------ +#: src/item_line.c:256 src/menu.c:106 +msgid "Line" +msgstr "Linha" + +#: src/item_box.c:272 src/item_ellipse.c:274 src/item_image.c:315 +#: src/item_line.c:271 +msgid "Position/Size" +msgstr "Posição/Tamanho" + +#. ------ Size Frame ------ +#: src/item_box.c:286 src/item_ellipse.c:288 src/item_image.c:329 +#: src/item_line.c:285 +msgid "Size" +msgstr "Tamanho" + +#: src/item_box.c:235 +msgid "Edit box object properties" +msgstr "Editar propriedades do objeto caixa" + +#. ------ Line box ------ +#: src/item_box.c:248 src/item_ellipse.c:250 +msgid "Outline" +msgstr "Contorno" + +#. ------ Fill box ------ +#: src/item_box.c:258 src/item_ellipse.c:260 +msgid "Fill" +msgstr "Preencher" + +#: src/item_ellipse.c:237 +msgid "Edit ellipse object properties" +msgstr "Editar propriedades do objeto elipse" + +#: src/item_image.c:257 +msgid "Edit image object properties" +msgstr "Editar propriedades do objeto imagem" + +#: src/item_image.c:268 src/menu.c:113 +msgid "Image" +msgstr "Imagem" + +#. ------ Size Reset Button ------ +#: src/item_image.c:342 +msgid "Reset image size" +msgstr "Redefinir tamanho da imagem" + +#: src/item_image.c:389 src/item_image.c:454 +msgid "Image format not currently supported" +msgstr "Formato de imagem não suportado atualmente" + +#: src/item_barcode.c:287 +msgid "Edit barcode object properties" +msgstr "Editar propriedades do objeto código de barras" + +#: src/item_barcode.c:297 +msgid "Data" +msgstr "Dado" + +#: src/item_barcode.c:299 +msgid "Barcode data" +msgstr "Dado do Código de Barras:" + +#. ------ Begin Barcode Properties Frame ------ +#: src/item_barcode.c:320 src/prefs.c:215 +msgid "General" +msgstr "Geral" + +#. ------ Barcode Style Frame ------ +#: src/item_barcode.c:330 +msgid "Style" +msgstr "Estilo" + +#: src/item_barcode.c:549 src/item_barcode.c:572 src/print.c:627 +msgid "Invalid barcode" +msgstr "Código de barras inválido" + +#. W Label +#: src/prop_line.c:169 src/prop_size.c:182 +msgid "Width:" +msgstr "Largura:" + +#. H label +#: src/prop_size.c:198 +msgid "Height:" +msgstr "Altura:" + +#: src/prop_size.c:222 +msgid "Maintain current aspect ratio" +msgstr "Manter taxa de aspecto atual" + +#. X label +#: src/prop_position.c:173 +msgid "X:" +msgstr "X:" + +#. Y label +#: src/prop_position.c:191 +msgid "Y:" +msgstr "Y:" + +#. Line Width units +#: src/prefs.c:448 src/prefs.c:455 src/prop_line.c:183 +msgid "points" +msgstr "pontos" + +#. Line Color Label +#: src/prop_bc.c:188 src/prop_fill.c:166 src/prop_line.c:189 +#: src/prop_text.c:234 +msgid "Color:" +msgstr "Cor:" + +#. Font label +#: src/prop_text.c:181 +msgid "Font:" +msgstr "Fonte:" + +#. Alignment label +#: src/prop_text.c:248 +msgid "Alignment:" +msgstr "Alinhamento:" + +#. Insert merge field label +#: src/prop_bc_data.c:196 src/prop_text_entry.c:180 +msgid "Key:" +msgstr "Chave:" + +#: src/prop_text_entry.c:196 +msgid "Insert merge field" +msgstr "Inserir campo de fusão" + +#. Length label +#: src/prop_vector.c:183 +msgid "Length:" +msgstr "Comprimento:" + +#. Angle label +#: src/prop_vector.c:207 +msgid "Angle:" +msgstr "Ângulo:" + +#. Angle units label +#: src/prop_vector.c:224 +msgid "degrees" +msgstr "graus" + +#. Scale Label +#: src/prop_bc.c:168 +msgid "Scale:" +msgstr "Escala:" + +#. % Label +#: src/prop_bc.c:182 +#, c-format +msgid "%" +msgstr "%" + +#: src/prop_bc_style.c:313 +msgid "Show text with barcode" +msgstr "Exibir texto com código de barras" + +#: src/prop_bc_data.c:176 +msgid "Literal:" +msgstr "Literal:" + +#: src/label.c:173 src/label.c:197 +msgid "xmlParseFile error" +msgstr "erro: xmlParseFile" + +#: src/label.c:228 +#, fuzzy +msgid "No document root" +msgstr "Sem raiz do documento" + +#: src/label.c:239 +msgid "document of the wrong type, glabels Namespace not found" +msgstr "documento de tipo errado, espaço de nome glabels não encontrado" + +#: src/label.c:244 +#, c-format +msgid "Bad root node = \"%s\"" +msgstr "Nó raiz ruim = \"%s\"" + +#: src/label.c:291 +#, c-format +msgid "bad node = \"%s\"" +msgstr "nó ruim = \"%s\"" + +#: src/label.c:606 +msgid "Problem saving xml file." +msgstr "Problema salvando arquivo xml." + +#: src/template.c:224 +msgid "No template files found!" +msgstr "Nenhum arquivo modelo encontrado!" + +#: src/merge_properties.c:82 +msgid "Edit document-merge properties" +msgstr "Editar propriedades de fusão do documento" + +#: src/merge_properties.c:131 +msgid "Source" +msgstr "Fonte" + +#: src/merge_properties.c:143 +msgid "Format:" +msgstr "Formato:" + +#: src/merge_properties.c:158 +msgid "Location:" +msgstr "Localização" + +#: src/merge_properties.c:168 +msgid "Fields" +msgstr "Campos" + +#: src/merge.c:78 +msgid "None" +msgstr "Nenhum" + +#: src/merge.c:86 +msgid "Text with tab separators" +msgstr "Texto separado com tab" + +#: src/merge.c:94 +msgid "Text with comma separators" +msgstr "Texto separado com vírgula" + +#: src/merge.c:102 +msgid "Text with colon separators" +msgstr "Texto separado com dois pontos" + +#: src/merge_ui.c:207 src/merge_ui.c:242 src/merge_ui.c:387 src/merge_ui.c:428 +msgid "N/A" +msgstr "Não definido" + +#: src/merge_ui_text.c:170 +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" + +#: src/menu.c:50 +msgid "_New" +msgstr "_Novo" + +#: src/menu.c:51 +msgid "Make a new, empty label" +msgstr "Criar uma etiqueta nova, vazia" + +#: src/menu.c:85 +msgid "U_nselect All " +msgstr "D_esmarcar Tudo " + +#: src/menu.c:86 +msgid "Remove all selections" +msgstr "Remover todas as seleções" + +#: src/menu.c:94 +msgid "Select" +msgstr "Selecionar" + +#: src/menu.c:95 src/menu.c:186 +msgid "Select, move and modify objects" +msgstr "Selecionar, movimentar e modificar objetos" + +#: src/menu.c:100 src/menu.c:191 +msgid "Create text object" +msgstr "Criar objeto texto" + +#: src/menu.c:103 +msgid "Box" +msgstr "Caixa" + +#: src/menu.c:103 src/menu.c:194 +msgid "Create box/rectangle object" +msgstr "Criar objeto caixa/retângulo" + +#: src/menu.c:106 src/menu.c:197 +msgid "Create line object" +msgstr "Criar objeto linha" + +#: src/menu.c:109 +msgid "Ellipse" +msgstr "Elipse" + +#: src/menu.c:110 src/menu.c:200 +msgid "Create ellipse/circle object" +msgstr "Criar objeto elipse/círculo" + +#: src/menu.c:113 src/menu.c:203 +msgid "Create image object" +msgstr "Criar objeto imagem" + +#: src/menu.c:116 +msgid "Barcode" +msgstr "Código de Barras" + +#: src/menu.c:116 src/menu.c:206 +msgid "Create barcode object" +msgstr "Criar objeto código de barras" + +#: src/menu.c:121 src/menu.c:211 +msgid "Zoom in" +msgstr "Mais Zoom" + +#: src/menu.c:124 src/menu.c:214 +msgid "Zoom out" +msgstr "Menos Zoom" + +#: src/menu.c:127 +msgid "Zoom 1:1" +msgstr "Zoom 1:1" + +#: src/menu.c:127 src/menu.c:217 +msgid "Zoom to 1:1" +msgstr "Zoom para 1:1" + +#: src/menu.c:132 src/menu.c:223 +msgid "Merge properties" +msgstr "Propriedades de Fusão" + +#: src/menu.c:133 +msgid "Edit merge properties" +msgstr "Editar propriedades de fusão" + +#: src/menu.c:157 +msgid "_Tools" +msgstr "_Ferramentas" + +#: src/menu.c:168 +msgid " New " +msgstr " Novo " + +#: src/menu.c:168 +msgid "New Label/Card" +msgstr "Nova Etiqueta/Cartão" + +#: src/menu.c:170 +msgid " Open " +msgstr " Abrir " + +#: src/menu.c:170 +msgid "Open a file" +msgstr "Abrir um arquivo" + +#: src/menu.c:172 +msgid " Save " +msgstr " Salvar " + +#: src/menu.c:172 +msgid "Save current file" +msgstr "Salvar arquivo atual" + +#: src/menu.c:175 +msgid " Print " +msgstr " Imprimir " + +#: src/menu.c:175 +msgid "Print current file" +msgstr "Imprimir arquivo atual" + +#: src/menu.c:290 +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/menu.c:326 +msgid "Function is not implemented!" +msgstr "Função não está implementada!" + +#: src/file.c:72 +msgid "New Label or Card" +msgstr "Nova Etiqueta ou Cartão" + +#: src/file.c:98 +msgid "Media Type" +msgstr "Tipo de mídia" + +#: src/file.c:109 +msgid "Label orientation" +msgstr "Orientação da etiqueta" + +#: src/file.c:211 +msgid "Open" +msgstr "Abrir" + +#: src/file.c:213 +msgid "Open label" +msgstr "Abrir etiqueta" + +#: src/file.c:249 +msgid "Cannot open file" +msgstr "Impossível abrir o arquivo" + +#: src/file.c:316 +msgid "Save label as" +msgstr "Salvar etiqueta como" + +#: src/media_select.c:222 +msgid "Description:" +msgstr "Descrição:" + +#: src/media_select.c:227 +msgid "Page size:" +msgstr "Tamanho da página:" + +#: src/media_select.c:232 +msgid "Label size:" +msgstr "Tamanho da etiqueta:" + +#: src/media_select.c:237 +msgid "Layout:" +msgstr "Disposição:" + +#: src/media_select.c:353 +#, c-format +msgid "%d x %d (%d per sheet)" +msgstr "%d x %d (%d por página)" + +#: src/media_select.c:367 +#, c-format +msgid "%s x %s %s" +msgstr "%s x %s %s" + +#: src/media_select.c:372 +#, c-format +msgid "%.5g x %.5g %s" +msgstr "%.5g x %.5g %s" + +#: src/rotate_select.c:169 +msgid "Rotate" +msgstr "Girar" + +#: src/print_dialog.c:99 +msgid "Print" +msgstr "Imprimir" + +#. ----------- Add simple-copies widget ------------ +#: src/print_dialog.c:104 +msgid "Copies" +msgstr "Cópias" + +#. -------Otherwise add merge control widget ------------ +#: src/print_dialog.c:121 +msgid "Document merge control" +msgstr "Controle de fusão do documento" + +#. ----------- Add custom print options area ------------ +#: src/print_dialog.c:141 +msgid "Options" +msgstr "Opções" + +#: src/print_dialog.c:152 +msgid "print outlines (to test printer alignment)" +msgstr "imprimir contornos (testar alinhamento da impressora)" + +#: src/print_dialog.c:160 +msgid "print in reverse (i.e. a mirror image)" +msgstr "imprimir ao contrário (como uma imagem de espelho)" + +#: src/print_dialog.c:241 src/print_dialog.c:280 +msgid "Print preview" +msgstr "Visualizar impressão" + +#: src/print_copies.c:170 +msgid "Sheets:" +msgstr "Páginas:" + +#: src/print_copies.c:187 +msgid "Labels" +msgstr "Etiquetas" + +#: src/print_copies.c:190 +msgid "from:" +msgstr "de:" + +#: src/print_copies.c:198 +msgid "to:" +msgstr "até:" + +#: src/print_merge.c:170 +msgid "Start on label" +msgstr "Iniciar na etiqueta" + +#: src/print_merge.c:179 +msgid "on 1st sheet" +msgstr "na primeira folha" + +#: src/print_merge.c:188 +#, fuzzy +msgid "Collate" +msgstr "Montar" + +#: src/print_merge.c:195 +msgid "Copies:" +msgstr "Cópias:" + +#: src/prefs.c:86 +msgid "Glabels: Preferences" +msgstr "Glabels: Preferências" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:220 +msgid "Display units" +msgstr "Exibir unidades" + +#: src/prefs.c:231 +msgid "Points" +msgstr "Pontos" + +#: src/prefs.c:237 +msgid "Inches" +msgstr "Polegadas" + +#: src/prefs.c:244 +msgid "Millimeters" +msgstr "Milímetros" + +#. ----- Display Units Frame ------------------------------------ +#: src/prefs.c:249 +msgid "Default page size" +msgstr "Tamanho de página padrão" + +#: src/prefs.c:450 +msgid "inches" +msgstr "poleg." + +#: src/prefs.c:452 +msgid "mm" +msgstr "mm" + +#~ msgid "Function is not yet implemented!" +#~ msgstr "Função ainda não implementada!" diff --git a/glabels1/po/stamp-cat-id b/glabels1/po/stamp-cat-id new file mode 100644 index 00000000..9788f702 --- /dev/null +++ b/glabels1/po/stamp-cat-id @@ -0,0 +1 @@ +timestamp diff --git a/glabels1/src/Makefile.am b/glabels1/src/Makefile.am new file mode 100644 index 00000000..6a3c9c36 --- /dev/null +++ b/glabels1/src/Makefile.am @@ -0,0 +1,176 @@ +LIB_BARCODE_DIR = ../barcode-0.96 + +SUBDIRS = pixmaps + +INCLUDES = \ + -I$(top_srcdir)/intl \ + $(GNOME_INCLUDEDIR) \ + $(GNOME_XML_CFLAGS) \ + $(GNOME_PRINT_CFLAGS) \ + $(GDK_PIXBUF_CFLAGS) \ + $(GNOME_CANVAS_PIXBUF_CFLAGS) \ + -I$(LIB_BARCODE_DIR) + +bin_PROGRAMS = glabels glabels-batch + +glabels_SOURCES = \ + glabels.c \ + splash.h \ + splash.c \ + mdi.h \ + mdi.c \ + display.c \ + display.h \ + item.c \ + item.h \ + item_text.c \ + item_text.h \ + item_line.c \ + item_line.h \ + item_box.c \ + item_box.h \ + item_ellipse.c \ + item_ellipse.h \ + item_image.c \ + item_image.h \ + item_barcode.c \ + item_barcode.h \ + highlight.c \ + highlight.h \ + propertybox.c \ + propertybox.h \ + prop_size.c \ + prop_size.h \ + prop_position.c \ + prop_position.h \ + prop_line.c \ + prop_line.h \ + prop_fill.c \ + prop_fill.h \ + prop_text.c \ + prop_text.h \ + prop_text_entry.c \ + prop_text_entry.h \ + prop_vector.c \ + prop_vector.h \ + prop_bc.c \ + prop_bc.h \ + prop_bc_style.c \ + prop_bc_style.h \ + prop_bc_data.c \ + prop_bc_data.h \ + label.h \ + label.c \ + template.h \ + template.c \ + text_node.h \ + text_node.c \ + merge_properties.h \ + merge_properties.c \ + merge.h \ + merge.c \ + merge_text.h \ + merge_text.c \ + merge_ui.h \ + merge_ui.c \ + merge_ui_text.h \ + merge_ui_text.c \ + bc.c \ + bc.h \ + bc_postnet.c \ + bc_postnet.h \ + bc_gnubarcode.c \ + bc_gnubarcode.h \ + tools.h \ + tools.c \ + stock.h \ + stock.c \ + menu.h \ + menu.c \ + file.c \ + file.h \ + media_select.c \ + media_select.h \ + rotate_select.c \ + rotate_select.h \ + print.c \ + print.h \ + print_dialog.c \ + print_dialog.h \ + print_copies.c \ + print_copies.h \ + print_merge.c \ + print_merge.h \ + mini_preview.c \ + mini_preview.h \ + edit.c \ + edit.h \ + prefs.h \ + prefs.c \ + util.c \ + util.h \ + hack.c \ + hack.h \ + gnome-canvas-hacktext.h \ + debug.h + +glabels_LDADD = \ + $(GNOME_LIBDIR) \ + $(GNOMEUI_LIBS) \ + $(INTLLIBS) \ + $(GNOME_XML_LIBS) \ + $(GNOME_PRINT_LIBS) \ + $(GDK_PIXBUF_LIBS) \ + $(GNOME_CANVAS_PIXBUF_LIBS) \ + -L$(LIB_BARCODE_DIR) -lbarcode + +glabels_batch_SOURCES = \ + glabels_batch.c \ + label.h \ + label.c \ + template.h \ + template.c \ + text_node.h \ + text_node.c \ + merge.h \ + merge.c \ + merge_text.h \ + merge_text.c \ + bc.c \ + bc.h \ + bc_postnet.c \ + bc_postnet.h \ + bc_gnubarcode.c \ + bc_gnubarcode.h \ + print.c \ + print.h \ + util.c \ + util.h \ + hack.c \ + hack.h \ + debug.h + +glabels_batch_LDADD = \ + $(GNOME_LIBDIR) \ + $(GNOMEUI_LIBS) \ + $(INTLLIBS) \ + $(GNOME_XML_LIBS) \ + $(GNOME_PRINT_LIBS) \ + $(GDK_PIXBUF_LIBS) \ + $(GNOME_CANVAS_PIXBUF_LIBS) \ + -L$(LIB_BARCODE_DIR) -lbarcode + +$(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/glabels1/src/Makefile.in b/glabels1/src/Makefile.in new file mode 100644 index 00000000..d7967c06 --- /dev/null +++ b/glabels1/src/Makefile.in @@ -0,0 +1,569 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 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@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@ +GNOMEUI_LIBS = @GNOMEUI_LIBS@ +GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@ +GNOME_CANVAS_PIXBUF_CFLAGS = @GNOME_CANVAS_PIXBUF_CFLAGS@ +GNOME_CANVAS_PIXBUF_LIBS = @GNOME_CANVAS_PIXBUF_LIBS@ +GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@ +GNOME_CONFIG = @GNOME_CONFIG@ +GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@ +GNOME_LIBDIR = @GNOME_LIBDIR@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_PRINT_CFLAGS = @GNOME_PRINT_CFLAGS@ +GNOME_PRINT_LIBS = @GNOME_PRINT_LIBS@ +GNOME_XML_CFLAGS = @GNOME_XML_CFLAGS@ +GNOME_XML_LIBS = @GNOME_XML_LIBS@ +GNORBA_CFLAGS = @GNORBA_CFLAGS@ +GNORBA_LIBS = @GNORBA_LIBS@ +GTKXMHTML_LIBS = @GTKXMHTML_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +ORBIT_CFLAGS = @ORBIT_CFLAGS@ +ORBIT_CONFIG = @ORBIT_CONFIG@ +ORBIT_IDL = @ORBIT_IDL@ +ORBIT_LIBS = @ORBIT_LIBS@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PTHREAD_LIB = @PTHREAD_LIB@ +RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XPM_LIBS = @XPM_LIBS@ +ZVT_LIBS = @ZVT_LIBS@ +cflags_set = @cflags_set@ +cxxflags_set = @cxxflags_set@ +l = @l@ + +LIB_BARCODE_DIR = ../barcode-0.96 + +SUBDIRS = pixmaps + +INCLUDES = -I$(top_srcdir)/intl $(GNOME_INCLUDEDIR) $(GNOME_XML_CFLAGS) $(GNOME_PRINT_CFLAGS) $(GDK_PIXBUF_CFLAGS) $(GNOME_CANVAS_PIXBUF_CFLAGS) -I$(LIB_BARCODE_DIR) + + +bin_PROGRAMS = glabels glabels-batch + +glabels_SOURCES = glabels.c splash.h splash.c mdi.h mdi.c display.c display.h item.c item.h item_text.c item_text.h item_line.c item_line.h item_box.c item_box.h item_ellipse.c item_ellipse.h item_image.c item_image.h item_barcode.c item_barcode.h highlight.c highlight.h propertybox.c propertybox.h prop_size.c prop_size.h prop_position.c prop_position.h prop_line.c prop_line.h prop_fill.c prop_fill.h prop_text.c prop_text.h prop_text_entry.c prop_text_entry.h prop_vector.c prop_vector.h prop_bc.c prop_bc.h prop_bc_style.c prop_bc_style.h prop_bc_data.c prop_bc_data.h label.h label.c template.h template.c text_node.h text_node.c merge_properties.h merge_properties.c merge.h merge.c merge_text.h merge_text.c merge_ui.h merge_ui.c merge_ui_text.h merge_ui_text.c bc.c bc.h bc_postnet.c bc_postnet.h bc_gnubarcode.c bc_gnubarcode.h tools.h tools.c stock.h stock.c menu.h menu.c file.c file.h media_select.c media_select.h rotate_select.c rotate_select.h print.c print.h print_dialog.c print_dialog.h print_copies.c print_copies.h print_merge.c print_merge.h mini_preview.c mini_preview.h edit.c edit.h prefs.h prefs.c util.c util.h hack.c hack.h gnome-canvas-hacktext.h debug.h + + +glabels_LDADD = $(GNOME_LIBDIR) $(GNOMEUI_LIBS) $(INTLLIBS) $(GNOME_XML_LIBS) $(GNOME_PRINT_LIBS) $(GDK_PIXBUF_LIBS) $(GNOME_CANVAS_PIXBUF_LIBS) -L$(LIB_BARCODE_DIR) -lbarcode + + +glabels_batch_SOURCES = glabels_batch.c label.h label.c template.h template.c text_node.h text_node.c merge.h merge.c merge_text.h merge_text.c bc.c bc.h bc_postnet.c bc_postnet.h bc_gnubarcode.c bc_gnubarcode.h print.c print.h util.c util.h hack.c hack.h debug.h + + +glabels_batch_LDADD = $(GNOME_LIBDIR) $(GNOMEUI_LIBS) $(INTLLIBS) $(GNOME_XML_LIBS) $(GNOME_PRINT_LIBS) $(GDK_PIXBUF_LIBS) $(GNOME_CANVAS_PIXBUF_LIBS) -L$(LIB_BARCODE_DIR) -lbarcode + +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 display.o item.o item_text.o \ +item_line.o item_box.o item_ellipse.o item_image.o item_barcode.o \ +highlight.o propertybox.o prop_size.o prop_position.o prop_line.o \ +prop_fill.o prop_text.o prop_text_entry.o prop_vector.o prop_bc.o \ +prop_bc_style.o prop_bc_data.o label.o template.o text_node.o \ +merge_properties.o merge.o merge_text.o merge_ui.o merge_ui_text.o bc.o \ +bc_postnet.o bc_gnubarcode.o tools.o stock.o menu.o file.o \ +media_select.o rotate_select.o print.o print_dialog.o print_copies.o \ +print_merge.o mini_preview.o edit.o prefs.o util.o hack.o +glabels_DEPENDENCIES = +glabels_LDFLAGS = +glabels_batch_OBJECTS = glabels_batch.o label.o template.o text_node.o \ +merge.o merge_text.o bc.o bc_postnet.o bc_gnubarcode.o print.o util.o \ +hack.o +glabels_batch_DEPENDENCIES = +glabels_batch_LDFLAGS = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +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: 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) + +# 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 +bc.o: bc.c ../config.h bc.h bc_postnet.h bc_gnubarcode.h debug.h +bc_barcode.o: bc_barcode.c ../config.h bc.h bc_barcode.h \ + ../barcode-0.96/barcode.h debug.h +bc_gnubarcode.o: bc_gnubarcode.c ../config.h bc.h bc_gnubarcode.h \ + ../barcode-0.96/barcode.h debug.h +bc_postnet.o: bc_postnet.c ../config.h bc.h bc_postnet.h debug.h +display.o: display.c ../config.h display.h label.h merge.h text_node.h \ + template.h bc.h item.h debug.h +edit.o: edit.c ../config.h edit.h display.h label.h merge.h text_node.h \ + template.h bc.h mdi.h +file.o: file.c ../config.h file.h mdi.h display.h label.h merge.h \ + text_node.h template.h bc.h util.h media_select.h \ + rotate_select.h +glabels.o: glabels.c ../config.h splash.h stock.h merge.h merge_ui.h \ + mdi.h display.h label.h text_node.h template.h bc.h debug.h +glabels_batch.o: glabels_batch.c ../config.h merge.h label.h text_node.h \ + template.h bc.h print.h util.h +hack.o: hack.c ../config.h hack.h +highlight.o: highlight.c ../config.h highlight.h item.h label.h merge.h \ + text_node.h template.h bc.h display.h debug.h +item.o: item.c ../config.h item.h label.h merge.h text_node.h template.h \ + bc.h display.h item_text.h item_box.h item_line.h \ + item_ellipse.h item_image.h item_barcode.h debug.h +item_barcode.o: item_barcode.c ../config.h display.h label.h merge.h \ + text_node.h template.h bc.h item_barcode.h highlight.h mdi.h \ + propertybox.h prop_bc_data.h prop_bc.h prop_bc_style.h \ + prop_position.h pixmaps/cursor_barcode.xbm \ + pixmaps/cursor_barcode_mask.xbm gnome-canvas-hacktext.h debug.h +item_box.o: item_box.c ../config.h display.h label.h merge.h text_node.h \ + template.h bc.h item_box.h highlight.h mdi.h propertybox.h \ + prop_line.h prop_fill.h prop_size.h prop_position.h \ + pixmaps/cursor_box.xbm pixmaps/cursor_box_mask.xbm debug.h +item_ellipse.o: item_ellipse.c ../config.h display.h label.h merge.h \ + text_node.h template.h bc.h item_ellipse.h highlight.h mdi.h \ + propertybox.h prop_line.h prop_fill.h prop_size.h \ + prop_position.h pixmaps/cursor_ellipse.xbm \ + pixmaps/cursor_ellipse_mask.xbm debug.h +item_image.o: item_image.c ../config.h display.h label.h merge.h \ + text_node.h template.h bc.h item_image.h highlight.h mdi.h \ + propertybox.h prop_position.h prop_size.h \ + pixmaps/cursor_image.xbm pixmaps/cursor_image_mask.xbm \ + pixmaps/checkerboard.xpm debug.h +item_line.o: item_line.c ../config.h display.h label.h merge.h \ + text_node.h template.h bc.h item_line.h highlight.h mdi.h \ + propertybox.h prop_line.h prop_position.h prop_vector.h \ + pixmaps/cursor_line.xbm pixmaps/cursor_line_mask.xbm debug.h +item_text.o: item_text.c ../config.h display.h label.h merge.h \ + text_node.h template.h bc.h item_text.h highlight.h mdi.h \ + propertybox.h prop_text_entry.h prop_text.h prop_position.h \ + pixmaps/cursor_text.xbm pixmaps/cursor_text_mask.xbm \ + gnome-canvas-hacktext.h hack.h debug.h +junk.o: junk.c ../config.h +label.o: label.c ../config.h label.h merge.h text_node.h template.h bc.h \ + debug.h +mdi.o: mdi.c ../config.h mdi.h display.h label.h merge.h text_node.h \ + template.h bc.h menu.h util.h +media_select.o: media_select.c ../config.h media_select.h template.h \ + mini_preview.h label.h merge.h text_node.h bc.h prefs.h util.h \ + debug.h +menu.o: menu.c ../config.h menu.h stock.h file.h print_dialog.h label.h \ + merge.h text_node.h template.h bc.h edit.h prefs.h tools.h +merge.o: merge.c ../config.h merge.h merge_text.h debug.h +merge_properties.o: merge_properties.c ../config.h mdi.h display.h \ + label.h merge.h text_node.h template.h bc.h merge_ui.h \ + merge_properties.h debug.h +merge_text.o: merge_text.c ../config.h merge_text.h merge.h debug.h +merge_ui.o: merge_ui.c ../config.h merge_ui.h merge.h merge_ui_text.h \ + debug.h +merge_ui_text.o: merge_ui_text.c ../config.h merge_ui_text.h merge.h \ + merge_text.h debug.h +mini_preview.o: mini_preview.c ../config.h mini_preview.h label.h \ + merge.h text_node.h template.h bc.h debug.h +prefs.o: prefs.c ../config.h mdi.h display.h label.h merge.h text_node.h \ + template.h bc.h propertybox.h prefs.h debug.h +print.o: print.c ../config.h print.h label.h merge.h text_node.h \ + template.h bc.h hack.h debug.h +print_copies.o: print_copies.c ../config.h print_copies.h label.h \ + merge.h text_node.h template.h bc.h mini_preview.h debug.h +print_copies_merge.o: print_copies_merge.c ../config.h \ + print_copies_merge.h label.h merge.h text_node.h template.h \ + bc.h pixmaps/collate.xpm pixmaps/nocollate.xpm debug.h +print_dialog.o: print_dialog.c ../config.h print_dialog.h label.h \ + merge.h text_node.h template.h bc.h print.h mdi.h display.h \ + hack.h print_copies.h print_merge.h debug.h +print_merge.o: print_merge.c ../config.h print_merge.h label.h merge.h \ + text_node.h template.h bc.h mini_preview.h pixmaps/collate.xpm \ + pixmaps/nocollate.xpm debug.h +prop_bc.o: prop_bc.c ../config.h prop_bc.h bc.h debug.h +prop_bc_data.o: prop_bc_data.c ../config.h prop_bc_data.h merge.h \ + debug.h +prop_bc_style.o: prop_bc_style.c ../config.h prop_bc_style.h bc.h \ + debug.h +prop_field.o: prop_field.c ../config.h prop_field.h debug.h +prop_fill.o: prop_fill.c ../config.h prop_fill.h label.h merge.h \ + text_node.h template.h bc.h debug.h +prop_line.o: prop_line.c ../config.h prop_line.h label.h merge.h \ + text_node.h template.h bc.h debug.h +prop_position.o: prop_position.c ../config.h prop_position.h label.h \ + merge.h text_node.h template.h bc.h prefs.h debug.h +prop_size.o: prop_size.c ../config.h prop_size.h label.h merge.h \ + text_node.h template.h bc.h prefs.h debug.h +prop_text.o: prop_text.c ../config.h prop_text.h label.h merge.h \ + text_node.h template.h bc.h debug.h +prop_text_entry.o: prop_text_entry.c ../config.h prop_text_entry.h \ + merge.h text_node.h debug.h +prop_vector.o: prop_vector.c ../config.h prop_vector.h label.h merge.h \ + text_node.h template.h bc.h prefs.h debug.h +propertybox.o: propertybox.c ../config.h propertybox.h +rotate_select.o: rotate_select.c ../config.h rotate_select.h template.h \ + debug.h +splash.o: splash.c ../config.h debug.h splash.h +stock.o: stock.c ../config.h stock.h pixmaps/arrow.xpm pixmaps/text.xpm \ + pixmaps/line.xpm pixmaps/box.xpm pixmaps/ellipse.xpm \ + pixmaps/image.xpm pixmaps/barcode.xpm pixmaps/zoomin.xpm \ + pixmaps/zoomout.xpm pixmaps/zoom1to1.xpm pixmaps/merge.xpm +template.o: template.c ../config.h template.h debug.h +text_node.o: text_node.c ../config.h text_node.h merge.h debug.h +tools.o: tools.c ../config.h tools.h mdi.h display.h label.h merge.h \ + text_node.h template.h bc.h merge_properties.h +util.o: util.c ../config.h util.h + +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-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: uninstall-recursive +all-am: Makefile $(PROGRAMS) +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(bindir) + + +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-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 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 + + +$(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/glabels1/src/bc.c b/glabels1/src/bc.c new file mode 100644 index 00000000..9969b784 --- /dev/null +++ b/glabels1/src/bc.c @@ -0,0 +1,201 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc.c: GLabels barcode module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "bc.h" +#include "bc_postnet.h" +#include "bc_gnubarcode.h" + +#include "debug.h" + +/*****************************************************************************/ +/* Call appropriate barcode backend to create barcode in intermediate format.*/ +/*****************************************************************************/ +glBarcode * +gl_barcode (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 (digits); + break; + + default: + /* Use the GNU barcode library backend */ + gbc = gl_barcode_gnubarcode (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: + WARN( "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 { + WARN( "Unknown barcode style text \"%s\"", text ); + return GL_BARCODE_STYLE_POSTNET; + } + +} diff --git a/glabels1/src/bc.h b/glabels1/src/bc.h new file mode 100644 index 00000000..22441f73 --- /dev/null +++ b/glabels1/src/bc.h @@ -0,0 +1,73 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc.h: GLabels barcode module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_H__ +#define __BC_H__ + +#include + +typedef enum { + GL_BARCODE_STYLE_POSTNET, + GL_BARCODE_STYLE_EAN, + GL_BARCODE_STYLE_UPC, + GL_BARCODE_STYLE_ISBN, + GL_BARCODE_STYLE_39, + GL_BARCODE_STYLE_128, + GL_BARCODE_STYLE_128C, + GL_BARCODE_STYLE_128B, + GL_BARCODE_STYLE_I25, + GL_BARCODE_STYLE_128RAW, + GL_BARCODE_STYLE_CBR, + GL_BARCODE_STYLE_MSI, + GL_BARCODE_STYLE_PLS, +} glBarcodeStyle; + +typedef struct { + gdouble x, y, length, width; +} glBarcodeLine; + +typedef struct { + gdouble x, y, fsize; + gchar c; +} glBarcodeChar; + +typedef struct { + gdouble width, height; + GList *lines; /* List of glBarcodeLine */ + GList *chars; /* List of glBarcodeChar */ +} glBarcode; + +#define GL_BARCODE_FONT_FAMILY "Helvetica" +#define GL_BARCODE_FONT_WEIGHT GNOME_FONT_BOOK + +extern glBarcode *gl_barcode (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/glabels1/src/bc_gnubarcode.c b/glabels1/src/bc_gnubarcode.c new file mode 100644 index 00000000..31f71b07 --- /dev/null +++ b/glabels1/src/bc_gnubarcode.c @@ -0,0 +1,239 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc-gnubarcode.c: front-end to GNU-barcode-library module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * Some of this code is borrowed from the postscript renderer (ps.c) + * from the GNU barcode library: + * + * Copyright (C) 1999 Alessaandro Rubini (rubini@gnu.org) + * Copyright (C) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "bc.h" +#include "bc_gnubarcode.h" + +#include "barcode.h" + +#include "debug.h" + +#define SHRINK_AMOUNT 0.15 /* shrink bars to account for ink spreading */ +#define FONT_SCALE 0.95 /* Shrink fonts just a hair */ + +static glBarcode *render_pass1 (struct Barcode_Item *bci, + gboolean text_flag, + gdouble scale); + +/*****************************************************************************/ +/* Generate intermediate representation of barcode. */ +/*****************************************************************************/ +glBarcode * +gl_barcode_gnubarcode (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: + WARN( "Illegal barcode style %d", style ); + flags = BARCODE_ANY; + break; + } + Barcode_Encode (bci, flags); + if (!bci->partial || !bci->textinfo) { + WARN ("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) { + WARN ("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/glabels1/src/bc_gnubarcode.h b/glabels1/src/bc_gnubarcode.h new file mode 100644 index 00000000..263b403a --- /dev/null +++ b/glabels1/src/bc_gnubarcode.h @@ -0,0 +1,32 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_gnubarcode.h: front-end to GNU-barcode-library module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_GNUBARCODE_H__ +#define __BC_GNUBARCODE_H__ + +#include "bc.h" + +extern glBarcode *gl_barcode_gnubarcode (glBarcodeStyle style, + gboolean text_flag, + gdouble scale, + gchar * digits); + +#endif diff --git a/glabels1/src/bc_postnet.c b/glabels1/src/bc_postnet.c new file mode 100644 index 00000000..eaf3197d --- /dev/null +++ b/glabels1/src/bc_postnet.c @@ -0,0 +1,150 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_postnet.c: GLabels POSTNET barcode module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * This module implements the POSTNET barcode specified in the USPS + * publication 25, Mar 2001. + */ + +#include + +#include + +#include "bc.h" +#include "bc_postnet.h" + +#include "debug.h" + +static gchar *symbols[] = { + /* 0 */ "11000", + /* 1 */ "00011", + /* 2 */ "00101", + /* 3 */ "00110", + /* 4 */ "01001", + /* 5 */ "01010", + /* 6 */ "01100", + /* 7 */ "10001", + /* 8 */ "10010", + /* 9 */ "10100", +}; + +static gchar *frame_symbol = "1"; + +#define POSTNET_BAR_WIDTH 1.25 +#define POSTNET_FULLBAR_HEIGHT 9.00 +#define POSTNET_HALFBAR_HEIGHT 3.50 +#define POSTNET_BAR_PITCH 3.25 +#define POSTNET_HORIZ_MARGIN 9.00 +#define POSTNET_VERT_MARGIN 3.00 + +static gchar *postnet_code (gchar * digits); + +/****************************************************************************/ +/* Generate list of rectangles that form the barcode for the given digits. */ +/****************************************************************************/ +glBarcode * +gl_barcode_postnet (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)) { + WARN ("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/glabels1/src/bc_postnet.h b/glabels1/src/bc_postnet.h new file mode 100644 index 00000000..e5035074 --- /dev/null +++ b/glabels1/src/bc_postnet.h @@ -0,0 +1,29 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * bc_postnet.h: GLabels POSTNET barcode module header file + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BC_POSTNET_H__ +#define __BC_POSTNET_H__ + +#include + +glBarcode *gl_barcode_postnet (gchar * digits); + +#endif diff --git a/glabels1/src/debug.h b/glabels1/src/debug.h new file mode 100644 index 00000000..08e3fc99 --- /dev/null +++ b/glabels1/src/debug.h @@ -0,0 +1,70 @@ +/* Macros/functions for debugging gLabels */ +#ifndef __DEBUG_H__ +#define __DEBUG_H__ + +#include "glib.h" + +#ifdef __GNUC__ + +#define DEBUG(args...) { \ + gchar *__string__; \ + __string__ = g_strdup_printf( args ); \ + g_message( "%s:%d (%s): %s\n", \ + __FILE__, __LINE__, __FUNCTION__, __string__ ); \ + g_free( __string__ ); \ + __string__ = NULL; \ + } + +#define WARN(args...) { \ + gchar *__string__; \ + __string__ = g_strdup_printf( args ); \ + g_warning( "%s:%d (%s): %s\n", \ + __FILE__, __LINE__, __FUNCTION__, __string__ ); \ + g_free( __string__ ); \ + __string__ = NULL; \ + } + +#define ERROR(args...) { \ + gchar *__string__; \ + __string__ = g_strdup_printf( args ); \ + g_error( "%s:%d (%s): %s\n", \ + __FILE__, __LINE__, __FUNCTION__, __string__ ); \ + g_free( __string__ ); \ + __string__ = NULL; \ + } + +#else /* !__GNUC__ */ + +static +DEBUG (const gchar * format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args); + va_end (args); +} + +static +WARN (const gchar * format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args); + va_end (args); +} + +static +ERROR (const gchar * format, + ...) +{ + va_list args; + va_start (args, format); + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); + va_end (args); +} + +#endif /* !__GNUC__ */ + +#endif /* __DEBUG_H__ */ diff --git a/glabels1/src/display.c b/glabels1/src/display.c new file mode 100644 index 00000000..55440093 --- /dev/null +++ b/glabels1/src/display.c @@ -0,0 +1,1739 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * display.c: GLabels Display module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include +#include + +#include "display.h" +#include "item.h" + +#include "debug.h" + +/*===========================================*/ +/* 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_display_class_init (glDisplayClass * class); +static void gl_display_init (glDisplay * display); +static void gl_display_destroy (GtkObject * object); + +static void gl_display_construct (glDisplay * display); +static GtkWidget *gl_display_construct_canvas (glDisplay * display); +static void gl_display_construct_selection (glDisplay * display); + +static gdouble get_apropriate_scale (glLabel * label); + +static void draw_rect_bg (glDisplay * display); +static void draw_rounded_rect_bg (glDisplay * display); +static void draw_round_bg (glDisplay * display); +static void draw_cd_bg (glDisplay * display); + +static int canvas_event (GnomeCanvas * canvas, + GdkEvent * event, gpointer data); +static int canvas_event_arrow_mode (GnomeCanvas * canvas, + GdkEvent * event, gpointer data); + +static GnomeCanvasItem *display_item_at (glDisplay * display, + gdouble x, gdouble y); +static gboolean item_selected (glDisplay * display, + GnomeCanvasItem * item); +static gboolean multiple_items_selected (glDisplay * display); + +static int item_event_arrow_mode (GnomeCanvasItem * item, + GdkEvent * event, gpointer data); + +static void popup_selection_menu (glDisplay * display, + GnomeCanvasItem * item, GdkEvent * event); + +static void delete_item_cb (GtkWidget * widget, GnomeCanvasItem * item); +static void raise_item_cb (GtkWidget * widget, GnomeCanvasItem * item); +static void lower_item_cb (GtkWidget * widget, GnomeCanvasItem * item); + +static void move_selected_items (glDisplay * display, gdouble dx, gdouble dy); +static void move_item (GnomeCanvasItem * item, gdouble dx, gdouble dy); + +static void delete_selection_cb (GtkWidget * widget, glDisplay * display); +static void raise_selection_cb (GtkWidget * widget, glDisplay * display); +static void lower_selection_cb (GtkWidget * widget, glDisplay * display); + +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_display_get_type (void) +{ + static guint display_type = 0; + + if (!display_type) { + GtkTypeInfo display_info = { + "glDisplay", + sizeof (glDisplay), + sizeof (glDisplayClass), + (GtkClassInitFunc) gl_display_class_init, + (GtkObjectInitFunc) gl_display_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + display_type = + gtk_type_unique (gtk_vbox_get_type (), &display_info); + } + + return display_type; +} + +static void +gl_display_class_init (glDisplayClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_display_destroy; +} + +static void +gl_display_init (glDisplay * display) +{ + display->label = NULL; +} + +static void +gl_display_destroy (GtkObject * object) +{ + glDisplay *display; + glDisplayClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_DISPLAY (object)); + + display = GL_DISPLAY (object); + class = GL_DISPLAY_CLASS (GTK_OBJECT (display)->klass); + + display->label = NULL; + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_display_new (glLabel * label) +{ + glDisplay *display = gtk_type_new (gl_display_get_type ()); + + display->label = label; + + gl_display_construct (display); + + gl_display_clear_modified (display); + + return GTK_WIDGET (display); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*---------------------------------------------------------------------------*/ +static void +gl_display_construct (glDisplay * display) +{ + GtkWidget *wvbox, *wscroll; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + wvbox = GTK_WIDGET (display); + + display->state = GL_DISPLAY_STATE_ARROW; + display->item_list = NULL; + + gl_display_construct_canvas (display); + 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), display->canvas); + + gl_display_construct_selection (display); + + display->menu = gl_display_new_selection_menu (display); + + display->modified = FALSE; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create canvas w/ a background in the shape of the label/card. */ +/*---------------------------------------------------------------------------*/ +static GtkWidget * +gl_display_construct_canvas (glDisplay * display) +{ + gdouble scale; + glLabel *label = display->label; + GList *p_obj; + glLabelObject *object; + GnomeCanvasItem *item; + + g_return_val_if_fail (GL_IS_DISPLAY (display), NULL); + g_return_val_if_fail (label != NULL, NULL); + +#ifdef AA_CANVAS + gtk_widget_push_visual (gdk_rgb_get_visual ()); + gtk_widget_push_colormap (gdk_rgb_get_cmap ()); + display->canvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + gtk_widget_pop_visual (); +#else + gtk_widget_push_visual (gdk_imlib_get_visual ()); + gtk_widget_push_colormap (gdk_imlib_get_colormap ()); + display->canvas = gnome_canvas_new (); + gtk_widget_pop_colormap (); + gtk_widget_pop_visual (); +#endif + + scale = get_apropriate_scale (label); + + gtk_widget_set_usize (display->canvas, + scale * label->width + 40, + scale * label->height + 40); + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (display->canvas), + scale); + display->scale = scale; + + gnome_canvas_set_scroll_region (GNOME_CANVAS (display->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 (display); + } else { + /* Rounded corners. */ + draw_rounded_rect_bg (display); + } + break; + + case GL_TEMPLATE_STYLE_ROUND: + draw_round_bg (display); + break; + + case GL_TEMPLATE_STYLE_CD: + draw_cd_bg (display); + break; + + default: + WARN ("Unknown template label style"); + break; + } + + gtk_signal_connect (GTK_OBJECT (display->canvas), "event", + GTK_SIGNAL_FUNC (canvas_event), display); + + for (p_obj = label->objects; p_obj != NULL; p_obj = p_obj->next) { + object = (glLabelObject *) p_obj->data; + item = gl_item_new (object, display); + gl_display_add_item (display, item); + } + + return display->canvas; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create selection targets. */ +/*---------------------------------------------------------------------------*/ +static void +gl_display_construct_selection (glDisplay * display) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + + display->have_selection = FALSE; + display->selection_data = NULL; + display->invisible = gtk_invisible_new (); + + display->selected_item_list = NULL; + + if (!clipboard_atom) { + clipboard_atom = gdk_atom_intern ("GLABELS_CLIPBOARD", FALSE); + } + + gtk_selection_add_target (display->invisible, + clipboard_atom, GDK_SELECTION_TYPE_STRING, 1); + + gtk_signal_connect (GTK_OBJECT (display->invisible), + "selection_clear_event", + GTK_SIGNAL_FUNC (selection_clear_cb), display); + + gtk_signal_connect (GTK_OBJECT (display->invisible), "selection_get", + GTK_SIGNAL_FUNC (selection_get_cb), display); + + gtk_signal_connect (GTK_OBJECT (display->invisible), + "selection_received", + GTK_SIGNAL_FUNC (selection_received_cb), display); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Determine an apropriate scale for given label & screen size */ +/*---------------------------------------------------------------------------*/ +static gdouble +get_apropriate_scale (glLabel * label) +{ + gdouble w, h; + gdouble w_screen, h_screen; + gint i; + gdouble k; + + g_return_val_if_fail (label != NULL, 1.0); + + w = label->width; + h = label->height; + 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 (glDisplay * display) +{ + glLabel *label = display->label; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + gdouble margin; + + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail (label != NULL); + + display->n_bg_items = 0; + display->bg_item_list = NULL; + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + + item = gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", 0.0, + "y1", 0.0, + "x2", label->width, + "y2", label->height, + "fill_color", "white", + NULL); + display->n_bg_items++; + display->bg_item_list = g_list_append (display->bg_item_list, item); + + /* Bounding box @ margin */ + margin = label->template->label_margin; + gnome_canvas_item_new (group, + gnome_canvas_rect_get_type (), + "x1", margin, + "y1", margin, + "x2", label->width - margin, + "y2", label->height - margin, + "width_pixels", 1, + "outline_color", "light blue", + NULL); + display->n_bg_items++; + display->bg_item_list = g_list_append (display->bg_item_list, item); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw rounded recangular background. */ +/*---------------------------------------------------------------------------*/ +static void +draw_rounded_rect_bg (glDisplay * display) +{ + glLabel *label = display->label; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + gdouble r, w, h, m; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail (label != NULL); + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + + display->n_bg_items = 0; + display->bg_item_list = NULL; + + r = label->template->label_round; + w = label->width; + h = label->height; + m = label->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); + display->n_bg_items++; + display->bg_item_list = g_list_append (display->bg_item_list, item); + + /* Bounding box @ margin */ + if (label->template->label_margin >= label->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); + display->n_bg_items++; + display->bg_item_list = + g_list_append (display->bg_item_list, item); + } else { + r = label->template->label_round - m; + w = label->width - 2 * label->template->label_margin; + h = label->height - 2 * label->template->label_margin; + + /* 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); + display->n_bg_items++; + display->bg_item_list = + g_list_append (display->bg_item_list, item); + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw round background. */ +/*---------------------------------------------------------------------------*/ +static void +draw_round_bg (glDisplay * display) +{ + glLabel *label = display->label; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + gdouble r, r1; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail (label != NULL); + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + + display->n_bg_items = 0; + display->bg_item_list = NULL; + + r1 = label->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); + display->n_bg_items++; + display->bg_item_list = g_list_append (display->bg_item_list, item); + + /* Bounding box @ margin */ + r = label->template->label_radius - label->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); + display->n_bg_items++; + display->bg_item_list = g_list_append (display->bg_item_list, item); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw CD style background, circular w/ concentric hole. */ +/*---------------------------------------------------------------------------*/ +static void +draw_cd_bg (glDisplay * display) +{ + glLabel *label = display->label; + GnomeCanvasPoints *points; + gint i_coords, i_theta; + gdouble r, r1, r2; + GnomeCanvasItem *item; + GnomeCanvasGroup *group; + + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail (label != NULL); + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + + display->n_bg_items = 0; + display->bg_item_list = NULL; + + r1 = label->template->label_radius; + r2 = label->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); + display->n_bg_items++; + display->bg_item_list = g_list_append (display->bg_item_list, item); + + /* Bounding box @ margin */ + /* outer margin */ + r = label->template->label_radius - label->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); + display->n_bg_items++; + display->bg_item_list = g_list_append (display->bg_item_list, item); + + /* inner margin */ + r = label->template->label_hole + label->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); + display->n_bg_items++; + display->bg_item_list = g_list_append (display->bg_item_list, item); +} + +/*****************************************************************************/ +/* Set arrow mode. */ +/*****************************************************************************/ +void +gl_display_arrow_mode (glDisplay * display) +{ + static GdkCursor *cursor = NULL; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + if (!cursor) { + cursor = gdk_cursor_new (GDK_LEFT_PTR); + } + + gdk_window_set_cursor (display->canvas->window, cursor); + + display->state = GL_DISPLAY_STATE_ARROW; +} + +/*****************************************************************************/ +/* Set create text object mode. */ +/*****************************************************************************/ +void +gl_display_object_create_mode (glDisplay * display, + glLabelObjectType type) +{ + GdkCursor *cursor; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + cursor = gl_item_get_create_cursor (type); + gdk_window_set_cursor (display->canvas->window, cursor); + + display->state = GL_DISPLAY_STATE_OBJECT_CREATE; + display->create_type = type; +} + +/*****************************************************************************/ +/* Add canvas item to list of display items. */ +/*****************************************************************************/ +void +gl_display_add_item (glDisplay * display, + GnomeCanvasItem * item) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + + display->item_list = g_list_prepend (display->item_list, item); +} + +/*****************************************************************************/ +/* Select all items. */ +/*****************************************************************************/ +void +gl_display_select_all (glDisplay * display) +{ + GList *p; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + gl_display_unselect_all (display); + + for (p = display->item_list; p != NULL; p = p->next) { + gl_display_select_item (display, GNOME_CANVAS_ITEM (p->data)); + } +} + +/*****************************************************************************/ +/* Select all items within given rectangular region */ +/*****************************************************************************/ +void +gl_display_select_region (glDisplay * display, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) +{ + GList *p; + GnomeCanvasItem *item; + gdouble i_x1, i_y1, i_x2, i_y2; + + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail ((x1 <= x2) && (y1 <= y2)); + + for (p = display->item_list; p != NULL; p = p->next) { + item = GNOME_CANVAS_ITEM (p->data); + if (!item_selected (display, item)) { + + gl_item_get_bounds (item, &i_x1, &i_y1, &i_x2, &i_y2); + if ((i_x1 >= x1) && (i_x2 <= x2) && (i_y1 >= y1) + && (i_y2 <= y2)) { + gl_display_select_item (display, item); + } + + } + } +} + +/*****************************************************************************/ +/* Remove all selections */ +/*****************************************************************************/ +void +gl_display_unselect_all (glDisplay * display) +{ + GList *p, *p_next; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + for (p = display->selected_item_list; p != NULL; p = p_next) { + p_next = p->next; + gl_display_unselect_item (display, GNOME_CANVAS_ITEM (p->data)); + } +} + +/*****************************************************************************/ +/* Select an item. */ +/*****************************************************************************/ +void +gl_display_select_item (glDisplay * display, + GnomeCanvasItem * item) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + if (!item_selected (display, item)) { + display->selected_item_list = + g_list_prepend (display->selected_item_list, item); + } + gl_item_highlight (item); + gtk_widget_grab_focus (GTK_WIDGET (display->canvas)); +} + +/*****************************************************************************/ +/* Un-select items. */ +/*****************************************************************************/ +void +gl_display_unselect_item (glDisplay * display, + GnomeCanvasItem * item) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + gl_item_unhighlight (item); + + display->selected_item_list = + g_list_remove (display->selected_item_list, item); +} + +/*****************************************************************************/ +/* Has display been modified? */ +/*****************************************************************************/ +gboolean +gl_display_modified (glDisplay * display) +{ + g_return_val_if_fail (GL_IS_DISPLAY (display), FALSE); + + return display->modified; +} + +/*****************************************************************************/ +/* Set to modified state. */ +/*****************************************************************************/ +void +gl_display_set_modified (glDisplay * display) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + + display->modified = TRUE; +} + +/*****************************************************************************/ +/* Reset to un-modified state. */ +/*****************************************************************************/ +void +gl_display_clear_modified (glDisplay * display) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + + display->modified = FALSE; +} + +/*****************************************************************************/ +/* "Cut" selected items and place in clipboard selections. */ +/*****************************************************************************/ +void +gl_display_cut (glDisplay * display) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + + gl_display_copy (display); + delete_selection_cb (GTK_WIDGET (display), display); +} + +/*****************************************************************************/ +/* "Copy" selected items to clipboard selections. */ +/*****************************************************************************/ +void +gl_display_copy (glDisplay * display) +{ + GList *p; + GnomeCanvasItem *item; + glLabelObject *object; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + if (display->selected_item_list) { + + gl_label_free (&display->selection_data); + display->selection_data = + gl_label_new_with_template (display->label-> + template_name, + display->label->rotate_flag); + + for (p = display->selected_item_list; p != NULL; p = p->next) { + + item = GNOME_CANVAS_ITEM (p->data); + object = gl_item_get_object (item); + gl_label_object_new_from_object (display-> + selection_data, + object); + + } + + gtk_selection_owner_set (display->invisible, + clipboard_atom, GDK_CURRENT_TIME); + display->have_selection = TRUE; + + } +} + +/*****************************************************************************/ +/* "Paste" from private clipboard selection. */ +/*****************************************************************************/ +void +gl_display_paste (glDisplay * display) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + + gtk_selection_convert (GTK_WIDGET (display->invisible), + clipboard_atom, GDK_SELECTION_TYPE_STRING, + GDK_CURRENT_TIME); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler. */ +/*---------------------------------------------------------------------------*/ +static int +canvas_event (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + glDisplay *display = GL_DISPLAY (data); + + switch (display->state) { + + case GL_DISPLAY_STATE_ARROW: + return canvas_event_arrow_mode (canvas, event, data); + + case GL_DISPLAY_STATE_OBJECT_CREATE: + return gl_item_create_event_handler (canvas, event, data); + + default: + WARN ("Invalid display state."); /* Should not happen! */ + return FALSE; + + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler (arrow mode) */ +/*---------------------------------------------------------------------------*/ +static int +canvas_event_arrow_mode (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + glDisplay *display = GL_DISPLAY (data); + gdouble x, y, x1, y1, x2, y2; + GnomeCanvasGroup *group; + GdkCursor *cursor; + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + + if (display_item_at (display, x, y) == NULL) { + if (!(event->button.state & GDK_CONTROL_MASK)) { + gl_display_unselect_all (display); + } + + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (display->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 + (display->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", + GNOME_CANVAS_COLOR_A + (0, 0, 255, 128), + NULL); + x0 = x; + y0 = y; + + } + return FALSE; + + default: + return FALSE; + } + + case GDK_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); + gl_display_select_region (display, x1, y1, x2, + y2); + gtk_object_destroy (GTK_OBJECT (item)); + return TRUE; + } + return FALSE; + + 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); + + 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: + if (!dragging) { + switch (event->key.keyval) { + case GDK_Left: + case GDK_KP_Left: + move_selected_items (display, + -1.0 / (display->scale), + 0.0); + break; + case GDK_Up: + case GDK_KP_Up: + move_selected_items (display, 0.0, + -1.0 / (display->scale)); + break; + case GDK_Right: + case GDK_KP_Right: + move_selected_items (display, + 1.0 / (display->scale), + 0.0); + break; + case GDK_Down: + case GDK_KP_Down: + move_selected_items (display, 0.0, + 1.0 / (display->scale)); + break; + case GDK_Delete: + case GDK_KP_Delete: + delete_selection_cb (GTK_WIDGET (canvas), + display); + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, + cursor); + gdk_cursor_destroy (cursor); + break; + default: + return FALSE; + } + } + return TRUE; /* We handled this or we were dragging. */ + + default: + return FALSE; + } + +} + +/*****************************************************************************/ +/* Item event handler. */ +/*****************************************************************************/ +gint +gl_display_item_event_handler (GnomeCanvasItem * item, + GdkEvent * event, + gpointer data) +{ + glDisplay *display = GL_DISPLAY (data); + + switch (display->state) { + + case GL_DISPLAY_STATE_ARROW: + return item_event_arrow_mode (item, event, data); + + default: + return FALSE; + + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Item event handler (arrow mode) */ +/*---------------------------------------------------------------------------*/ +static int +item_event_arrow_mode (GnomeCanvasItem * item, + GdkEvent * event, + gpointer data) +{ + glDisplay *display = GL_DISPLAY (data); + static gdouble x, y; + static gboolean dragging = FALSE; + GdkCursor *cursor; + gdouble item_x, item_y; + gdouble new_x, new_y; + gboolean control_key_pressed; + + item_x = event->button.x; + item_y = event->button.y; + gnome_canvas_item_w2i (item->parent, &item_x, &item_y); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + control_key_pressed = event->button.state & GDK_CONTROL_MASK; + switch (event->button.button) { + case 1: + if (control_key_pressed) { + if (item_selected (display, item)) { + /* Un-selecting an already selected item */ + gl_display_unselect_item (display, + item); + return TRUE; + } else { + /* Add to current selection */ + gl_display_select_item (display, item); + } + } else { + if (!item_selected (display, item)) { + /* No control, key so remove any selections before adding */ + gl_display_unselect_all (display); + /* Add to current selection */ + gl_display_select_item (display, item); + } + } + /* 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_destroy (cursor); + dragging = TRUE; + return TRUE; + + case 3: + if (!item_selected (display, item)) { + if (!control_key_pressed) { + /* No control, key so remove any selections before adding */ + gl_display_unselect_all (display); + } + } + /* Add to current selection */ + gl_display_select_item (display, item); + /* bring up apropriate menu for selection. */ + popup_selection_menu (display, item, event); + return TRUE; + + default: + return FALSE; + } + + case GDK_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: + if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { + /* Dragging mode, move selection */ + new_x = item_x; + new_y = item_y; + move_selected_items (display, (new_x - x), (new_y - y)); + x = new_x; + y = new_y; + return TRUE; + } else { + return FALSE; + } + + case GDK_2BUTTON_PRESS: + switch (event->button.button) { + case 1: + /* Also exit dragging mode on a a double-click, bring up menu */ + gnome_canvas_item_ungrab (item, event->button.time); + dragging = FALSE; + gl_display_select_item (display, item); + gl_item_edit_dialog (item); + return TRUE; + + default: + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_FLEUR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*****************************************************************************/ +/* create menu for multiple selections. */ +/*****************************************************************************/ +GtkWidget * +gl_display_new_selection_menu (glDisplay * display) +{ + GtkWidget *menu, *menuitem; + + g_return_val_if_fail (GL_IS_DISPLAY (display), NULL); + + menu = gtk_menu_new (); + + menuitem = gtk_menu_item_new_with_label (_("Delete")); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + gtk_signal_connect (GTK_OBJECT (menuitem), "activate", + GTK_SIGNAL_FUNC (delete_selection_cb), display); + + menuitem = gtk_menu_item_new (); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Bring to front")); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + gtk_signal_connect (GTK_OBJECT (menuitem), "activate", + GTK_SIGNAL_FUNC (raise_selection_cb), display); + + menuitem = gtk_menu_item_new_with_label (_("Send to back")); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + gtk_signal_connect (GTK_OBJECT (menuitem), "activate", + GTK_SIGNAL_FUNC (lower_selection_cb), display); + + return menu; +} + +/*****************************************************************************/ +/* create menu for given item. */ +/*****************************************************************************/ +GtkWidget * +gl_display_new_item_menu (GnomeCanvasItem * item) +{ + GtkWidget *menu, *menuitem; + + g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), NULL); + + menu = gtk_menu_new (); + + menuitem = gtk_menu_item_new_with_label (_("Edit properties...")); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate", + GTK_SIGNAL_FUNC (gl_item_edit_dialog), + GTK_OBJECT (item)); + + menuitem = gtk_menu_item_new (); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Delete")); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + gtk_signal_connect (GTK_OBJECT (menuitem), "activate", + GTK_SIGNAL_FUNC (delete_item_cb), item); + + menuitem = gtk_menu_item_new (); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label (_("Bring to front")); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + gtk_signal_connect (GTK_OBJECT (menuitem), "activate", + GTK_SIGNAL_FUNC (raise_item_cb), item); + + menuitem = gtk_menu_item_new_with_label (_("Send to back")); + gtk_menu_append (GTK_MENU (menu), menuitem); + gtk_widget_show (menuitem); + gtk_signal_connect (GTK_OBJECT (menuitem), "activate", + GTK_SIGNAL_FUNC (lower_item_cb), item); + + gtk_object_set_data (GTK_OBJECT (item), "object_menu", menu); + + return menu; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. popup menu for given item. */ +/*---------------------------------------------------------------------------*/ +static void +popup_selection_menu (glDisplay * display, + GnomeCanvasItem * item, + GdkEvent * event) +{ + GtkWidget *menu; + + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + if (multiple_items_selected (display)) { + if (display->menu != NULL) { + gtk_menu_popup (GTK_MENU (display->menu), + NULL, NULL, NULL, NULL, + event->button.button, + event->button.time); + } + } else { + + menu = gl_item_get_menu (item); + if (menu != NULL) { + gtk_menu_popup (GTK_MENU (menu), + NULL, NULL, NULL, NULL, + event->button.button, + event->button.time); + } + + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. delete selection callback. */ +/*---------------------------------------------------------------------------*/ +static void +delete_selection_cb (GtkWidget * widget, + glDisplay * display) +{ + GList *p, *p_next; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + for (p = display->selected_item_list; p != NULL; p = p_next) { + p_next = p->next; + delete_item_cb (widget, GNOME_CANVAS_ITEM (p->data)); + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. raise item to front callback. */ +/*---------------------------------------------------------------------------*/ +static void +raise_selection_cb (GtkWidget * widget, + glDisplay * display) +{ + GList *p; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + for (p = display->selected_item_list; p != NULL; p = p->next) { + raise_item_cb (widget, GNOME_CANVAS_ITEM (p->data)); + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. lower item to back callback. */ +/*---------------------------------------------------------------------------*/ +static void +lower_selection_cb (GtkWidget * widget, + glDisplay * display) +{ + GList *p; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + for (p = display->selected_item_list; p != NULL; p = p->next) { + lower_item_cb (widget, GNOME_CANVAS_ITEM (p->data)); + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. delete item callback. */ +/*---------------------------------------------------------------------------*/ +static void +delete_item_cb (GtkWidget * widget, + GnomeCanvasItem * item) +{ + glDisplay *display; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + display = gl_item_get_display (item); + + gl_display_unselect_item (display, item); + display->item_list = g_list_remove (display->item_list, item); + + gl_item_free (&item); + + gl_display_set_modified (display); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. raise item to front callback. */ +/*---------------------------------------------------------------------------*/ +static void +raise_item_cb (GtkWidget * widget, + GnomeCanvasItem * item) +{ + glLabelObject *object; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + object = gl_item_get_object (item); + gl_label_object_raise_to_front (object); + + gnome_canvas_item_raise_to_top (item); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. lower item to back callback. */ +/*---------------------------------------------------------------------------*/ +static void +lower_item_cb (GtkWidget * widget, + GnomeCanvasItem * item) +{ + glLabelObject *object; + glDisplay *display; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + object = gl_item_get_object (item); + display = gl_item_get_display (item); + + gl_label_object_lower_to_back (object); + + /* Send to bottom */ + gnome_canvas_item_lower_to_bottom (item); + + /* now raise it above all items that form the backgound */ + gnome_canvas_item_raise (item, display->n_bg_items); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. move selected items */ +/*---------------------------------------------------------------------------*/ +static void +move_selected_items (glDisplay * display, + gdouble dx, + gdouble dy) +{ + GList *p; + GnomeCanvasItem *item; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + for (p = display->selected_item_list; p != NULL; p = p->next) { + + item = GNOME_CANVAS_ITEM (p->data); + + move_item (item, dx, dy); + gl_item_highlight (item); + + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. move item/object */ +/*---------------------------------------------------------------------------*/ +static void +move_item (GnomeCanvasItem * item, + gdouble dx, + gdouble dy) +{ + glLabelObject *object; + glDisplay *display; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + object = gl_item_get_object (item); + + object->x += dx; + object->y += dy; + + gnome_canvas_item_move (item, dx, dy); + + display = gl_item_get_display (item); + gl_display_set_modified (display); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Return item at (x,y) if it is in our list of managed items. */ +/*---------------------------------------------------------------------------*/ +static GnomeCanvasItem * +display_item_at (glDisplay * display, + gdouble x, + gdouble y) +{ + GnomeCanvasItem *item; + + g_return_val_if_fail (GL_IS_DISPLAY (display), NULL); + + item = gnome_canvas_get_item_at (GNOME_CANVAS (display->canvas), x, y); + + /* No item is at x, y */ + if (item == NULL) + return NULL; + + /* Don't include our background items */ + if (g_list_find (display->bg_item_list, item) != NULL) + return NULL; + + return item; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Is the item in our current selection? */ +/*---------------------------------------------------------------------------*/ +static gboolean +item_selected (glDisplay * display, + GnomeCanvasItem * item) +{ + g_return_val_if_fail (GL_IS_DISPLAY (display), FALSE); + g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), FALSE); + + if (g_list_find (display->selected_item_list, item) == NULL) { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Are there multiple items in our current selection? */ +/*---------------------------------------------------------------------------*/ +static gboolean +multiple_items_selected (glDisplay * display) +{ + g_return_val_if_fail (GL_IS_DISPLAY (display), FALSE); + + if (display->selected_item_list == NULL) + return FALSE; + if (display->selected_item_list->next == NULL) + return FALSE; + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-clear" signal. */ +/*---------------------------------------------------------------------------*/ +static void +selection_clear_cb (GtkWidget * widget, + GdkEventSelection * event, + gpointer data) +{ + glDisplay *display = GL_DISPLAY (data); + + g_return_if_fail (GL_IS_DISPLAY (display)); + + display->have_selection = FALSE; + gl_label_free (&display->selection_data); + display->selection_data = NULL; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-get" signal. */ +/*---------------------------------------------------------------------------*/ +static void +selection_get_cb (GtkWidget * widget, + GtkSelectionData * selection_data, + guint info, + guint time, + gpointer data) +{ + glDisplay *display = GL_DISPLAY (data); + gchar *buffer; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + if (display->have_selection) { + + gl_label_save_xml_buffer (display->selection_data, &buffer); + gtk_selection_data_set (selection_data, + GDK_SELECTION_TYPE_STRING, 8, buffer, + strlen (buffer)); + g_free (buffer); + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Handle "selection-received" signal. (Result of Paste) */ +/*---------------------------------------------------------------------------*/ +static void +selection_received_cb (GtkWidget * widget, + GtkSelectionData * selection_data, + guint time, + gpointer data) +{ + glDisplay *display = GL_DISPLAY (data); + glLabel *label = NULL; + GList *p; + glLabelObject *object, *newobject; + GnomeCanvasItem *item; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + if (selection_data->length < 0) { + return; + } + if (selection_data->type != GDK_SELECTION_TYPE_STRING) { + return; + } + + gl_display_unselect_all (display); + + gl_label_open_xml_buffer (&label, selection_data->data); + for (p = label->objects; p != NULL; p = p->next) { + object = (glLabelObject *) p->data; + newobject = + gl_label_object_new_from_object (display->label, object); + item = gl_item_new (newobject, display); + gl_display_add_item (display, item); + gl_display_select_item (display, item); + } + gl_label_free (&label); + + gl_display_set_modified (display); +} + +/*****************************************************************************/ +/* Zoom in one "notch" */ +/*****************************************************************************/ +void +gl_display_zoom_in (glDisplay * display) +{ + gint i, i_min; + gdouble dist, dist_min; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + /* Find index of current scale (or best match) */ + i_min = 1; /* start with 2nd largest scale */ + dist_min = fabs (scales[1] - display->scale); + for (i = 2; scales[i] != 0.0; i++) { + dist = fabs (scales[i] - display->scale); + if (dist < dist_min) { + i_min = i; + dist_min = dist; + } + } + + /* zoom in one "notch" */ + i = MAX (0, i_min - 1); + gl_display_set_zoom (display, scales[i] / HOME_SCALE); +} + +/*****************************************************************************/ +/* Zoom out one "notch" */ +/*****************************************************************************/ +void +gl_display_zoom_out (glDisplay * display) +{ + gint i, i_min; + gdouble dist, dist_min; + + g_return_if_fail (GL_IS_DISPLAY (display)); + + /* Find index of current scale (or best match) */ + i_min = 0; /* start with largest scale */ + dist_min = fabs (scales[0] - display->scale); + for (i = 1; scales[i] != 0.0; i++) { + dist = fabs (scales[i] - display->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_display_set_zoom (display, scales[i] / HOME_SCALE); + +} + +/*****************************************************************************/ +/* Set current zoom factor to explicit value. */ +/*****************************************************************************/ +void +gl_display_set_zoom (glDisplay * display, + gdouble scale) +{ + g_return_if_fail (GL_IS_DISPLAY (display)); + g_return_if_fail (scale > 0.0); + + display->scale = scale * HOME_SCALE; + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (display->canvas), + scale * HOME_SCALE); +} + +/*****************************************************************************/ +/* Get current zoom factor. */ +/*****************************************************************************/ +gdouble +gl_display_get_zoom (glDisplay * display) +{ + g_return_val_if_fail (GL_IS_DISPLAY (display), 1.0); + + return display->scale / HOME_SCALE; +} diff --git a/glabels1/src/display.h b/glabels1/src/display.h new file mode 100644 index 00000000..704e8aa5 --- /dev/null +++ b/glabels1/src/display.h @@ -0,0 +1,116 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * display.h: GLabels Display module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __DISPLAY_H__ +#define __DISPLAY_H__ + +#include +#include "label.h" + +typedef enum { + GL_DISPLAY_STATE_ARROW, + GL_DISPLAY_STATE_OBJECT_CREATE +} glDisplayState; + +#define GL_TYPE_DISPLAY (gl_display_get_type ()) +#define GL_DISPLAY(obj) (GTK_CHECK_CAST((obj), GL_TYPE_DISPLAY, glDisplay )) +#define GL_DISPLAY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_DISPLAY, glDisplayClass)) +#define GL_IS_DISPLAY(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_DISPLAY)) +#define GL_IS_DISPLAY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_DISPLAY)) + +typedef struct _glDisplay glDisplay; +typedef struct _glDisplayClass glDisplayClass; + +struct _glDisplay { + GtkVBox parent_widget; + + glLabel *label; + + GtkWidget *canvas; + gdouble scale; + gint n_bg_items; + GList *bg_item_list; + + glDisplayState state; + glLabelObjectType create_type; + + gboolean modified; + + GList *item_list; + GList *selected_item_list; + + gint have_selection; + glLabel *selection_data; + GtkWidget *invisible; + + GtkWidget *menu; +}; + +struct _glDisplayClass { + GtkVBoxClass parent_class; +}; + +extern guint gl_display_get_type (void); + +extern GtkWidget *gl_display_new (glLabel * label); + +extern void gl_display_arrow_mode (glDisplay * display); +extern void gl_display_object_create_mode (glDisplay * display, + glLabelObjectType type); + +extern void gl_display_add_item (glDisplay * display, + GnomeCanvasItem * item); + +extern void gl_display_select_all (glDisplay * display); +extern void gl_display_select_region (glDisplay * display, + gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2); +extern void gl_display_unselect_all (glDisplay * display); + +extern void gl_display_select_item (glDisplay * display, + GnomeCanvasItem * item); +extern void gl_display_unselect_item (glDisplay * display, + GnomeCanvasItem * item); + +extern int gl_display_item_event_handler (GnomeCanvasItem * item, + GdkEvent * event, + gpointer data); + +extern GtkWidget *gl_display_new_selection_menu (glDisplay * display); +extern GtkWidget *gl_display_new_item_menu (GnomeCanvasItem * item); + +extern gboolean gl_display_modified (glDisplay * display); +extern void gl_display_set_modified (glDisplay * display); +extern void gl_display_clear_modified (glDisplay * display); + +extern void gl_display_cut (glDisplay * display); +extern void gl_display_copy (glDisplay * display); +extern void gl_display_paste (glDisplay * display); + +extern void gl_display_zoom_in (glDisplay * display); +extern void gl_display_zoom_out (glDisplay * display); +extern void gl_display_set_zoom (glDisplay * display, gdouble scale); +extern gdouble gl_display_get_zoom (glDisplay * display); + +#endif diff --git a/glabels1/src/edit.c b/glabels1/src/edit.c new file mode 100644 index 00000000..88ceaefd --- /dev/null +++ b/glabels1/src/edit.c @@ -0,0 +1,129 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * edit.c: Edit module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "edit.h" + +#include "display.h" +#include "mdi.h" + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*============================================*/ +/* Private function prototypes. */ +/*============================================*/ + +/*****************************************************************************/ +/* "Cut" */ +/*****************************************************************************/ +void +gl_edit_cut_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + glDisplay *display; + + g_return_if_fail (child != NULL); + g_return_if_fail (app != NULL); + + display = gl_mdi_get_display (child); + + gl_display_cut (display); + +} + +/*****************************************************************************/ +/* "Copy" */ +/*****************************************************************************/ +void +gl_edit_copy_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + glDisplay *display; + + g_return_if_fail (child != NULL); + g_return_if_fail (app != NULL); + + display = gl_mdi_get_display (child); + + gl_display_copy (display); + +} + +/*****************************************************************************/ +/* "Paste" */ +/*****************************************************************************/ +void +gl_edit_paste_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + g_return_if_fail (child != NULL); + + display = gl_mdi_get_display (child); + + gl_display_paste (display); +} + +/*****************************************************************************/ +/* "Select ALL" */ +/*****************************************************************************/ +void +gl_edit_select_all_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + g_return_if_fail (child != NULL); + + display = gl_mdi_get_display (child); + + gl_display_select_all (display); +} + +/*****************************************************************************/ +/* "Un-select" */ +/*****************************************************************************/ +void +gl_edit_unselect_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + g_return_if_fail (child != NULL); + + display = gl_mdi_get_display (child); + + gl_display_unselect_all (display); +} diff --git a/glabels1/src/edit.h b/glabels1/src/edit.h new file mode 100644 index 00000000..0a9854b3 --- /dev/null +++ b/glabels1/src/edit.h @@ -0,0 +1,43 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * edit.h: Edit module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __EDIT_H__ +#define __EDIT_H__ + +#include + +extern void gl_edit_add_cb (GtkWidget * widget, gpointer data); + +extern void gl_edit_delete_cb (GtkWidget * widget, gpointer data); + +extern void gl_edit_title_cb (GtkWidget * widget, gpointer data); + +extern void gl_edit_select_all_cb (GtkWidget * widget, gpointer data); + +extern void gl_edit_unselect_cb (GtkWidget * widget, gpointer data); + +extern void gl_edit_cut_cb (GtkWidget * widget, gpointer data); + +extern void gl_edit_copy_cb (GtkWidget * widget, gpointer data); + +extern void gl_edit_paste_cb (GtkWidget * widget, gpointer data); + +#endif /* __EDIT_H__ */ diff --git a/glabels1/src/file.c b/glabels1/src/file.c new file mode 100644 index 00000000..9d3243fd --- /dev/null +++ b/glabels1/src/file.c @@ -0,0 +1,415 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * file.c: FILE menu dialog module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "file.h" +#include "mdi.h" +#include "util.h" +#include "media_select.h" +#include "rotate_select.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 (GnomeDialog * new_dlg); +static void new_template_changed (glMediaSelect * select, + gpointer data); +static void new_ok (GtkWidget * widget, + gpointer data); +static void open_ok (GtkWidget * widget, + GtkFileSelection * fsel); +static void save_as_ok (GtkWidget * widget, + GtkFileSelection * fsel); + +/*****************************************************************************/ +/* "New" menu callback. */ +/*****************************************************************************/ +void +gl_file_new_cb (GtkWidget * widget, + gpointer data) +{ + GtkWidget *new_dlg; + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + + g_return_if_fail (app != NULL); + + new_dlg = gnome_dialog_new (_("New Label or Card"), + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_CANCEL, NULL); + gtk_window_set_transient_for (GTK_WINDOW (new_dlg), GTK_WINDOW (app)); + + create_new_dialog_widgets (GNOME_DIALOG (new_dlg)); + + gnome_dialog_button_connect (GNOME_DIALOG (new_dlg), 0, + GTK_SIGNAL_FUNC (new_ok), new_dlg); + + gnome_dialog_button_connect_object (GNOME_DIALOG (new_dlg), 1, + GTK_SIGNAL_FUNC + (gtk_widget_destroy), + GTK_OBJECT (new_dlg)); + + gtk_widget_show_all (GTK_WIDGET (new_dlg)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create widgets to enter a bond by sn and idate. */ +/*---------------------------------------------------------------------------*/ +static void +create_new_dialog_widgets (GnomeDialog * new_dlg) +{ + GtkWidget *wframe, *wvbox, *template_entry, *rotate_sel; + + wframe = gtk_frame_new (_("Media Type")); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (new_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_media_select_new (); + gtk_container_add (GTK_CONTAINER (wvbox), template_entry); + + wframe = gtk_frame_new (_("Label orientation")); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (new_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_rotate_select_new (); + gtk_box_pack_start (GTK_BOX (wvbox), rotate_sel, FALSE, FALSE, 0); + + gtk_object_set_data (GTK_OBJECT (new_dlg), "template_entry", + template_entry); + gtk_object_set_data (GTK_OBJECT (new_dlg), "rotate_sel", rotate_sel); + + gtk_signal_connect (GTK_OBJECT (template_entry), "changed", + GTK_SIGNAL_FUNC (new_template_changed), rotate_sel); + + if (page_size != NULL) { + gl_media_select_set_page_size (GL_MEDIA_SELECT (template_entry), + page_size); + } + if (sheet_name != NULL) { + gl_media_select_set_name (GL_MEDIA_SELECT (template_entry), + sheet_name); + gl_rotate_select_set_template_name (GL_ROTATE_SELECT + (rotate_sel), sheet_name); + } else { + sheet_name = + gl_media_select_get_name (GL_MEDIA_SELECT (template_entry)); + gl_rotate_select_set_template_name (GL_ROTATE_SELECT + (rotate_sel), sheet_name); + } + gl_rotate_select_set_state (GL_ROTATE_SELECT (rotate_sel), rotate_flag); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. New template changed callback. */ +/*---------------------------------------------------------------------------*/ +static void +new_template_changed (glMediaSelect * select, + gpointer data) +{ + glRotateSelect *rotate_sel = GL_ROTATE_SELECT (data); + gchar *name; + + name = gl_media_select_get_name (GL_MEDIA_SELECT (select)); + + gl_rotate_select_set_template_name (GL_ROTATE_SELECT (rotate_sel), + name); + + g_free (name); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. New "ok" button callback. */ +/*---------------------------------------------------------------------------*/ +static void +new_ok (GtkWidget * widget, + gpointer data) +{ + GnomeDialog *new_dlg = GNOME_DIALOG (data); + GtkWidget *template_entry, *rotate_sel; + + template_entry = + GTK_WIDGET (gtk_object_get_data + (GTK_OBJECT (new_dlg), "template_entry")); + rotate_sel = + GTK_WIDGET (gtk_object_get_data + (GTK_OBJECT (new_dlg), "rotate_sel")); + + if (page_size != NULL) + g_free (page_size); + page_size = + gl_media_select_get_page_size (GL_MEDIA_SELECT (template_entry)); + + if (sheet_name != NULL) + g_free (sheet_name); + sheet_name = + gl_media_select_get_name (GL_MEDIA_SELECT (template_entry)); + + rotate_flag = + gl_rotate_select_get_state (GL_ROTATE_SELECT (rotate_sel)); + + gl_mdi_new_child (sheet_name, rotate_flag); + + gtk_widget_destroy (GTK_WIDGET (new_dlg)); +} + +/*****************************************************************************/ +/* "Open" menu callback. */ +/*****************************************************************************/ +void +gl_file_open_cb (GtkWidget * widget, + gpointer data) +{ + GtkFileSelection *fsel; + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + + 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")); + + gtk_signal_connect (GTK_OBJECT (fsel->ok_button), "clicked", + GTK_SIGNAL_FUNC (open_ok), fsel); + + gtk_signal_connect_object (GTK_OBJECT (fsel->cancel_button), "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), + GTK_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)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Open "O.K." button callback. */ +/*---------------------------------------------------------------------------*/ +static void +open_ok (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gchar *filename; + GtkWidget *dlg; + + 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_mdi_new_child_from_xml_file (filename)) { + + dlg = + gnome_error_dialog_parented (_("Cannot open file"), + GTK_WINDOW (fsel)); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + + gtk_widget_destroy (GTK_WIDGET (fsel)); + + if (open_path != NULL) + g_free (open_path); + open_path = g_dirname (filename); + if (open_path != NULL) + open_path = g_strconcat (open_path, "/", NULL); + + } + } + + g_free (filename); +} + +/*****************************************************************************/ +/* "Save" menu callback. */ +/*****************************************************************************/ +void +gl_file_save_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + gchar *filename; + + g_return_if_fail (child != NULL); + g_return_if_fail (app != NULL); + + filename = gl_mdi_get_filename (child); + if (!filename) { + gl_file_save_as_cb (widget, data); + } else { + if (!gl_mdi_save_child_to_xml_file (child, filename)) { + gnome_error_dialog_parented (_("Cannot save file"), + GTK_WINDOW (app)); + } + } + + g_free (filename); +} + +/*****************************************************************************/ +/* "Save As" menu callback. */ +/*****************************************************************************/ +void +gl_file_save_as_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + GtkFileSelection *fsel; + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + gint id; + + g_return_if_fail (child != NULL); + g_return_if_fail (app != NULL); + + fsel = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save As"))); + id = gl_mdi_get_id (child); + gtk_object_set_data (GTK_OBJECT (fsel), "id", GINT_TO_POINTER (id)); + + gtk_window_set_transient_for (GTK_WINDOW (fsel), GTK_WINDOW (app)); + gtk_window_set_title (GTK_WINDOW (fsel), _("Save label as")); + + gtk_signal_connect (GTK_OBJECT (fsel->ok_button), "clicked", + GTK_SIGNAL_FUNC (save_as_ok), fsel); + + gtk_signal_connect_object (GTK_OBJECT (fsel->cancel_button), "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), + GTK_OBJECT (fsel)); + + /* 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)); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Save As" ok button callback. */ +/*---------------------------------------------------------------------------*/ +static void +save_as_ok (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gchar *raw_filename, *filename; + GtkWidget *dlg; + gint id = + GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (fsel), "id")); + GnomeMDIChild *child = gl_mdi_find_child (id); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + if (child == NULL) { + gtk_widget_destroy (GTK_WIDGET (fsel)); + dlg = gnome_error_dialog (_("Label no longer valid!")); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + return; + } + + /* get the filename */ + raw_filename = g_strdup (gtk_file_selection_get_filename (fsel)); + + if (!raw_filename || (raw_filename[strlen (raw_filename) - 1] == '/')) { + + dlg = gnome_warning_dialog_parented (_("Must supply file name"), + GTK_WINDOW (fsel)); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + + filename = gl_util_add_extension (raw_filename); + + if (!gl_mdi_save_child_to_xml_file (child, filename)) { + + dlg = + gnome_error_dialog_parented (_ + ("Error writing file"), + GTK_WINDOW (fsel)); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + + if (save_path != NULL) + g_free (save_path); + save_path = g_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); +} + +/*****************************************************************************/ +/* "Close" menu callback. */ +/*****************************************************************************/ +void +gl_file_close_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + + gl_mdi_close_child (child); +} + +/*****************************************************************************/ +/* "Exit" menu callback. */ +/*****************************************************************************/ +void +gl_file_exit_cb (GtkWidget * widget, + gpointer data) +{ + gl_mdi_close_all (); +} diff --git a/glabels1/src/file.h b/glabels1/src/file.h new file mode 100644 index 00000000..f5d035ea --- /dev/null +++ b/glabels1/src/file.h @@ -0,0 +1,35 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * file.h: FILE menu dialog module header file + * + * Copyright (C) 2000 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __FILE_H__ +#define __FILE_H__ + +#include + +void gl_file_new_cb (GtkWidget * widget, gpointer data); +void gl_file_open_cb (GtkWidget * widget, gpointer data); +void gl_file_save_cb (GtkWidget * widget, gpointer data); +void gl_file_save_as_cb (GtkWidget * widget, gpointer data); +void gl_file_close_cb (GtkWidget * widget, gpointer data); +void gl_file_exit_cb (GtkWidget * widget, gpointer data); + +#endif /* __FILE_H__ */ diff --git a/glabels1/src/glabels.c b/glabels1/src/glabels.c new file mode 100644 index 00000000..6e68fb9f --- /dev/null +++ b/glabels1/src/glabels.c @@ -0,0 +1,164 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * glabels.c: main program module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "splash.h" +#include "stock.h" +#include "merge.h" +#include "merge_ui.h" +#include "mdi.h" +#include "template.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 + +/*============================================*/ +/* Private globals */ +/*============================================*/ +static struct poptOption options[] = { + {NULL, '\0', 0, NULL, 0, NULL, NULL} +}; + +/*============================================*/ +/* Private function prototypes */ +/*============================================*/ +static void session_die (GnomeClient * client, + gpointer client_data); +static gint save_session (GnomeClient * client, + gint phase, + GnomeSaveStyle save_style, + gint is_shutdown, + GnomeInteractStyle interact_style, + gint is_fast, + gpointer client_data); + + +/*****************************************************************************/ +/* Main */ +/*****************************************************************************/ +int +main (int argc, + char *argv[]) +{ + poptContext pctx; + gchar **args; + GnomeMDI *mdi; + GnomeClient *client; + GSList *p, *file_list = NULL; + gint i, opened; + + bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR); + textdomain (PACKAGE); + + gnome_init_with_popt_table (PACKAGE, VERSION, + argc, argv, options, 0, &pctx); + + /* Splash screen */ + gl_splash (); + + if (!g_file_exists (ICON_PIXMAP)) { + WARN ("Could not find %s", ICON_PIXMAP); + } + gnome_window_icon_set_default_from_file (ICON_PIXMAP); + + /* argument parsing */ + args = (char **) poptGetArgs (pctx); + for (i = 0; args && args[i]; i++) { + file_list = g_slist_append (file_list, args[i]); + } + poptFreeContext (pctx); + + /* session management */ + client = gnome_master_client (); + gtk_signal_connect (GTK_OBJECT (client), "save_yourself", + GTK_SIGNAL_FUNC (save_session), argv[0]); + gtk_signal_connect (GTK_OBJECT (client), "die", + GTK_SIGNAL_FUNC (session_die), NULL); + + gl_stock_init (); + gl_merge_init (); + gl_merge_ui_init (); + gl_template_init (); + + mdi = gl_mdi_init (); + + /* Any files on command line? */ + opened = 0; + for (p = file_list; p; p = p->next) { + if (gl_mdi_new_child_from_xml_file (p->data)) + opened++; + } + g_slist_free (file_list); + + if (!opened) { + gnome_mdi_open_toplevel (mdi); + } + + /* Now start main loop */ + gtk_main (); + + return 0; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Save Session signal callback. */ +/*---------------------------------------------------------------------------*/ +static gint +save_session (GnomeClient * client, + gint phase, + GnomeSaveStyle save_style, + gint is_shutdown, + GnomeInteractStyle interact_style, + gint is_fast, + gpointer client_data) +{ + gchar **argv; + guint argc; + + argv = g_malloc0 (4 * sizeof (gchar *)); + argc = 1; + + argv[0] = client_data; + + gnome_client_set_clone_command (client, argc, argv); + gnome_client_set_restart_command (client, argc, argv); + + return TRUE; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Session Die signal callback. */ +/*---------------------------------------------------------------------------*/ +static void +session_die (GnomeClient * client, + gpointer client_data) +{ + gtk_main_quit (); +} diff --git a/glabels1/src/glabels_batch.c b/glabels1/src/glabels_batch.c new file mode 100644 index 00000000..1659f89f --- /dev/null +++ b/glabels1/src/glabels_batch.c @@ -0,0 +1,148 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * glabels.c: main program module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "merge.h" +#include "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; + GnomePrinter *prn = NULL; + glLabel *label = NULL; + + 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) { + if ( gl_label_open_xml( &label, p->data ) == LABEL_OK ) { + + if ( master == NULL ) { + master = gnome_print_master_new (); + abs_fn = gl_util_make_absolute ( output ); + prn = gnome_printer_new_generic_ps ( abs_fn ); + g_free( abs_fn ); + gnome_print_master_set_printer ( master, prn ); + } + + gl_print_batch( master, label, n_sheets, n_copies, + outline_flag, reverse_flag ); + + gl_label_free( &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/glabels1/src/gnome-canvas-hacktext.h b/glabels1/src/gnome-canvas-hacktext.h new file mode 100644 index 00000000..f36ec1ae --- /dev/null +++ b/glabels1/src/gnome-canvas-hacktext.h @@ -0,0 +1,76 @@ +/* Hacktext item type for GnomeCanvas widget + * + * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is + * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. + * + * Copyright (C) 1998,1999 The Free Software Foundation + * + * Authors: Federico Mena + * Raph Levien + */ + +#ifndef GNOME_CANVAS_HACKTEXT_H +#define GNOME_CANVAS_HACKTEXT_H + +BEGIN_GNOME_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 GNOME_TYPE_CANVAS_HACKTEXT (gnome_canvas_hacktext_get_type ()) +#define GNOME_CANVAS_HACKTEXT(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_HACKTEXT, GnomeCanvasHacktext)) +#define GNOME_CANVAS_HACKTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_HACKTEXT, GnomeCanvasHacktextClass)) +#define GNOME_IS_CANVAS_HACKTEXT(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_HACKTEXT)) +#define GNOME_IS_CANVAS_HACKTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_HACKTEXT)) + +typedef struct _GnomeCanvasHacktext GnomeCanvasHacktext; +typedef struct _GnomeCanvasHacktextPriv GnomeCanvasHacktextPriv; +typedef struct _GnomeCanvasHacktextClass GnomeCanvasHacktextClass; + +#include + +struct _GnomeCanvasHacktext { + 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 */ + + GnomeCanvasHacktextPriv *priv; /* Private data */ +}; + +struct _GnomeCanvasHacktextClass { + GnomeCanvasItemClass parent_class; +}; + + +/* Standard Gtk function */ +GtkType gnome_canvas_hacktext_get_type (void); + + +END_GNOME_DECLS + +#endif diff --git a/glabels1/src/hack.c b/glabels1/src/hack.c new file mode 100644 index 00000000..47db1c8c --- /dev/null +++ b/glabels1/src/hack.c @@ -0,0 +1,145 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * hack.c: various small hacks to deal with I18N + * + * Copyright (C) 2001 Jim Evins . + * + * + * The g_unichar_to_utf8 has been borrowed from gnumeric, which was borrowed + * from glib-1.3: + * g_unichar_to_utf8: Copyright Red Hat, 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 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "hack.h" + +static int g_unichar_to_utf8 (gint c, gchar * outbuf); + +/*****************************************************************************/ +/* Convert text to UTF8. */ +/*****************************************************************************/ +gchar * +gl_hack_text_to_utf8 (gchar * text) +{ + gint len; + GdkWChar *wide_text; + gint enc_status; + gchar *p, *utf8_text; + gint i; + + len = strlen (text); + wide_text = g_new (GdkWChar, len + 1); + enc_status = gdk_mbstowcs (wide_text, text, len); + if (enc_status < 0) { + g_free (wide_text); + return NULL; + } + + p = utf8_text = g_new (gchar, enc_status * 6 + 1); + for (i = 0; i < enc_status; i++) { + p += g_unichar_to_utf8 ((gint) wide_text[i], p); + } + *p = 0; /* terminate */ + + g_free (wide_text); + + return utf8_text; +} + +/*****************************************************************************/ +/* Calculate width of text with given font. */ +/*****************************************************************************/ +double +gl_hack_get_width_string (GnomeFont * font, + gchar * text) +{ + gint len; + GdkWChar *wide_text; + gint enc_status; + gint i; + gdouble w; + + len = strlen (text); + wide_text = g_new (GdkWChar, len + 1); + enc_status = gdk_mbstowcs (wide_text, text, len); + if (enc_status < 0) { + g_free (wide_text); + return 0.0; + } + + w = 0; + for (i = 0; i < enc_status; i++) { + w += gnome_font_get_glyph_width (font, + gnome_font_lookup_default + (font, wide_text[i])); + } + + g_free (wide_text); + + return w; +} + +/*----------------------------------------------------------------------------- + * This is cut & pasted from glib 1.3 + * + * We need it only for iso-8859-1 converter and it will be + * abandoned, if glib 2.0 or any other unicode library will + * be introduced. + *---------------------------------------------------------------------------*/ +static int +g_unichar_to_utf8 (gint c, + gchar * outbuf) +{ + size_t len = 0; + int first; + int i; + + if (c < 0x80) { + first = 0; + len = 1; + } else if (c < 0x800) { + first = 0xc0; + len = 2; + } else if (c < 0x10000) { + first = 0xe0; + len = 3; + } else if (c < 0x200000) { + first = 0xf0; + len = 4; + } else if (c < 0x4000000) { + first = 0xf8; + len = 5; + } else { + first = 0xfc; + len = 6; + } + + if (outbuf) { + for (i = len - 1; i > 0; --i) { + outbuf[i] = (c & 0x3f) | 0x80; + c >>= 6; + } + outbuf[0] = c | first; + } + + return len; +} diff --git a/glabels1/src/hack.h b/glabels1/src/hack.h new file mode 100644 index 00000000..2f0b868d --- /dev/null +++ b/glabels1/src/hack.h @@ -0,0 +1,32 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * hack.h: various small hacks to deal with I18N + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __HACK_H__ +#define __HACK_H__ + +#include + +extern gchar *gl_hack_text_to_utf8 (gchar * text); + +extern double gl_hack_get_width_string (GnomeFont * font, gchar * text); + +#endif /* __HACK_H__ */ diff --git a/glabels1/src/highlight.c b/glabels1/src/highlight.c new file mode 100644 index 00000000..6acc3889 --- /dev/null +++ b/glabels1/src/highlight.c @@ -0,0 +1,1443 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * highlight.c: GLabels Resizable Highlight module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "highlight.h" +#include "item.h" + +#include "math.h" + +#include "debug.h" + +#define MIN_ITEM_SIZE 1.0 + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void highlight_resizable_box (GnomeCanvasItem * item, + glHighlightStyle style); +static void highlight_resizable_line (GnomeCanvasItem * item); +static void highlight_simple (GnomeCanvasItem * item); + +static int tl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); +static int tr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); +static int bl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); +static int br_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); + +static int sl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); +static int sr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); +static int st_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); +static int sb_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); + +static int p1_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); +static int p2_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); + +static int passthrough_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, gpointer data); + +/*****************************************************************************/ +/* Create/Update & Display a resizable highlight for given item. */ +/*****************************************************************************/ +void +gl_highlight (GnomeCanvasItem * item, + glHighlightStyle style) +{ + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + switch (style) { + + case GL_HIGHLIGHT_BOX_RESIZABLE: + case GL_HIGHLIGHT_ELLIPSE_RESIZABLE: + highlight_resizable_box (item, style); + break; + + case GL_HIGHLIGHT_LINE_RESIZABLE: + highlight_resizable_line (item); + break; + + case GL_HIGHLIGHT_SIMPLE: + highlight_simple (item); + break; + + default: + WARN ("Invalid resizable highlight style"); + + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create/Update & Display a resizable box highlight. */ +/*---------------------------------------------------------------------------*/ +static void +highlight_resizable_box (GnomeCanvasItem * item, + glHighlightStyle style) +{ + GnomeCanvasItem *highlight; + 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 */ + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + highlight = gtk_object_get_data (GTK_OBJECT (item), "highlight"); + + gl_item_get_position_size (item, &x, &y, &w, &h); + + if (highlight == NULL) { + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (item->canvas)), + gnome_canvas_group_get_type (), "x", + x, "y", y, NULL); + + switch (style) { + case GL_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", + GNOME_CANVAS_COLOR_A (0, 0, + 255, + 255), + NULL); + break; + case GL_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", + GNOME_CANVAS_COLOR_A (0, 0, + 255, + 255), + NULL); + break; + default: + outline = NULL; + WARN ("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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), NULL); + + gtk_object_set_data (GTK_OBJECT (item), "highlight", highlight); + + gtk_object_set_data (GTK_OBJECT (highlight), "outline", + outline); + + gtk_object_set_data (GTK_OBJECT (highlight), "tl", tl); + gtk_object_set_data (GTK_OBJECT (highlight), "tr", tr); + gtk_object_set_data (GTK_OBJECT (highlight), "bl", bl); + gtk_object_set_data (GTK_OBJECT (highlight), "br", br); + gtk_object_set_data (GTK_OBJECT (highlight), "sl", sl); + gtk_object_set_data (GTK_OBJECT (highlight), "sr", sr); + gtk_object_set_data (GTK_OBJECT (highlight), "st", st); + gtk_object_set_data (GTK_OBJECT (highlight), "sb", sb); + + gtk_signal_connect (GTK_OBJECT (tl), "event", + GTK_SIGNAL_FUNC (tl_resize_event_handler), + item); + gtk_signal_connect (GTK_OBJECT (tr), "event", + GTK_SIGNAL_FUNC (tr_resize_event_handler), + item); + gtk_signal_connect (GTK_OBJECT (bl), "event", + GTK_SIGNAL_FUNC (bl_resize_event_handler), + item); + gtk_signal_connect (GTK_OBJECT (br), "event", + GTK_SIGNAL_FUNC (br_resize_event_handler), + item); + gtk_signal_connect (GTK_OBJECT (sl), "event", + GTK_SIGNAL_FUNC (sl_resize_event_handler), + item); + gtk_signal_connect (GTK_OBJECT (sr), "event", + GTK_SIGNAL_FUNC (sr_resize_event_handler), + item); + gtk_signal_connect (GTK_OBJECT (st), "event", + GTK_SIGNAL_FUNC (st_resize_event_handler), + item); + gtk_signal_connect (GTK_OBJECT (sb), "event", + GTK_SIGNAL_FUNC (sb_resize_event_handler), + item); + + gtk_signal_connect (GTK_OBJECT (outline), "event", + GTK_SIGNAL_FUNC (passthrough_event_handler), + item); + + } else { + + gnome_canvas_item_set (highlight, "x", x, "y", y, NULL); + + outline = + gtk_object_get_data (GTK_OBJECT (highlight), "outline"); + + tl = gtk_object_get_data (GTK_OBJECT (highlight), "tl"); + tr = gtk_object_get_data (GTK_OBJECT (highlight), "tr"); + bl = gtk_object_get_data (GTK_OBJECT (highlight), "bl"); + br = gtk_object_get_data (GTK_OBJECT (highlight), "br"); + sl = gtk_object_get_data (GTK_OBJECT (highlight), "sl"); + sr = gtk_object_get_data (GTK_OBJECT (highlight), "sr"); + st = gtk_object_get_data (GTK_OBJECT (highlight), "st"); + sb = gtk_object_get_data (GTK_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_show (highlight); + + } + + gnome_canvas_item_raise_to_top (highlight); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create/Update & Display a resizable line highlight. */ +/*---------------------------------------------------------------------------*/ +static void +highlight_resizable_line (GnomeCanvasItem * item) +{ + GnomeCanvasItem *highlight; + gdouble x, y, dx, dy; + GnomeCanvasPoints *points; + GnomeCanvasItem *outline; /* Outline around item */ + GnomeCanvasItem *p1, *p2; /* Handles at endpoints */ + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + highlight = gtk_object_get_data (GTK_OBJECT (item), "highlight"); + + gl_item_get_position_size (item, &x, &y, &dx, &dy); + + points = gnome_canvas_points_new (2); + + if (highlight == NULL) { + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (item->canvas)), + gnome_canvas_group_get_type (), "x", + x, "y", y, NULL); + + 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), 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", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (255, 255, 255, + 255), NULL); + + gtk_object_set_data (GTK_OBJECT (item), "highlight", highlight); + + gtk_object_set_data (GTK_OBJECT (highlight), "outline", + outline); + + gtk_object_set_data (GTK_OBJECT (highlight), "p1", p1); + gtk_object_set_data (GTK_OBJECT (highlight), "p2", p2); + + gtk_signal_connect (GTK_OBJECT (outline), "event", + GTK_SIGNAL_FUNC (passthrough_event_handler), + item); + + gtk_signal_connect (GTK_OBJECT (p1), "event", + GTK_SIGNAL_FUNC (p1_resize_event_handler), + item); + gtk_signal_connect (GTK_OBJECT (p2), "event", + GTK_SIGNAL_FUNC (p2_resize_event_handler), + item); + + } else { + + gnome_canvas_item_set (highlight, "x", x, "y", y, NULL); + + outline = + gtk_object_get_data (GTK_OBJECT (highlight), "outline"); + + p1 = gtk_object_get_data (GTK_OBJECT (highlight), "p1"); + p2 = gtk_object_get_data (GTK_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_item_show (highlight); + + } + + gnome_canvas_points_free (points); + + gnome_canvas_item_raise_to_top (highlight); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Create/Update & Display a simple box highlight. */ +/*---------------------------------------------------------------------------*/ +static void +highlight_simple (GnomeCanvasItem * item) +{ + GnomeCanvasItem *highlight; + gdouble x1, y1, x2, y2; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + highlight = gtk_object_get_data (GTK_OBJECT (item), "highlight"); + + gl_item_get_bounds (item, &x1, &y1, &x2, &y2); + + if (highlight == NULL) { + + highlight = + gnome_canvas_item_new (gnome_canvas_root + (GNOME_CANVAS (item->canvas)), + gnome_canvas_rect_get_type (), "x1", + x1 - 0.5, "y1", y1 - 0.5, "x2", + x2 + 0.5, "y2", y2 + 0.5, + "width_pixels", 2, + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (0, 0, 255, + 255), NULL); + + gtk_object_set_data (GTK_OBJECT (item), "highlight", highlight); + + gtk_signal_connect (GTK_OBJECT (highlight), "event", + GTK_SIGNAL_FUNC (passthrough_event_handler), + item); + + } else { + + gnome_canvas_item_set (highlight, + "x1", x1 - 0.5, + "y1", y1 - 0.5, + "x2", x2 + 0.5, + "y2", y2 + 0.5, + "width_pixels", 2, + "outline_color_rgba", + GNOME_CANVAS_COLOR_A (0, 0, 255, 255), + NULL); + + gnome_canvas_item_show (highlight); + + } + + gnome_canvas_item_raise_to_top (highlight); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-left" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +tl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, w, h; + static gdouble x2, y2; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &w, &h); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-right" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +tr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, w, h; + static gdouble x1, y2; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &w, &h); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-left" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +bl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, w, h; + static gdouble x2, y1; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &w, &h); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-right" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +br_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, w, h; + static gdouble x1, y1; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &w, &h); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Left-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sl_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, w, h; + static gdouble x2; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &w, &h); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Right-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sr_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, w, h; + static gdouble x1; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &w, &h); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Top-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +st_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, w, h; + static gdouble y2; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &w, &h); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Bottom-side" Resize event handler. */ +/*---------------------------------------------------------------------------*/ +static int +sb_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, w, h; + static gdouble y1; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &w, &h); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, w, h); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Resize "P1" event handler. */ +/*---------------------------------------------------------------------------*/ +static int +p1_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, dx, dy; + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &dx, &dy); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, dx, dy); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, dx, dy); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Resize "P2" event handler. */ +/*---------------------------------------------------------------------------*/ +static int +p2_resize_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + gdouble x, y, dx, dy; + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glDisplay *display; + GdkCursor *cursor; + + item = GNOME_CANVAS_ITEM (data); + gl_item_get_position_size (item, &x, &y, &dx, &dy); + display = gl_item_get_display (item); + + 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_item_set_position_size (item, x, y, dx, dy); + gl_display_select_item (display, item); + 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_item_set_position_size (item, x, y, dx, dy); + gl_display_select_item (display, item); + return TRUE; + } else { + return FALSE; + } + + case GDK_ENTER_NOTIFY: + cursor = gdk_cursor_new (GDK_CROSSHAIR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + case GDK_LEAVE_NOTIFY: + cursor = gdk_cursor_new (GDK_LEFT_PTR); + gdk_window_set_cursor (display->canvas->window, cursor); + gdk_cursor_destroy (cursor); + return TRUE; + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Passthrough event handler. */ +/*---------------------------------------------------------------------------*/ +static int +passthrough_event_handler (GnomeCanvasItem * handle_item, + GdkEvent * event, + gpointer data) +{ + static GnomeCanvasItem *item; + static glDisplay *display; + + item = GNOME_CANVAS_ITEM (data); + display = gl_item_get_display (item); + return gl_display_item_event_handler (item, event, display); + +} diff --git a/glabels1/src/highlight.h b/glabels1/src/highlight.h new file mode 100644 index 00000000..a0aaa0e0 --- /dev/null +++ b/glabels1/src/highlight.h @@ -0,0 +1,36 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * highlight.h: GLabels Resizable Highlight module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __HIGHLIGHT_H__ +#define __HIGHLIGHT_H__ + +#include + +typedef enum { + GL_HIGHLIGHT_BOX_RESIZABLE, + GL_HIGHLIGHT_ELLIPSE_RESIZABLE, + GL_HIGHLIGHT_LINE_RESIZABLE, + GL_HIGHLIGHT_SIMPLE, +} glHighlightStyle; + +extern void gl_highlight (GnomeCanvasItem * item, glHighlightStyle style); + +#endif diff --git a/glabels1/src/item.c b/glabels1/src/item.c new file mode 100644 index 00000000..e72a354c --- /dev/null +++ b/glabels1/src/item.c @@ -0,0 +1,449 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item.c: GLabels canvas item wrapper module module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "item.h" + +#include "display.h" +#include "item_text.h" +#include "item_box.h" +#include "item_line.h" +#include "item_ellipse.h" +#include "item_image.h" +#include "item_barcode.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +/*****************************************************************************/ +/* Create new canvas item from object. */ +/*****************************************************************************/ +GnomeCanvasItem * +gl_item_new (glLabelObject * object, + glDisplay * display) +{ + GnomeCanvasItem *item; + + g_return_val_if_fail (object != NULL, NULL); + g_return_val_if_fail (GL_IS_DISPLAY (display), NULL); + + switch (object->type) { + case GL_LABEL_OBJECT_TEXT: + item = gl_item_text_new (object, display); + break; + case GL_LABEL_OBJECT_BOX: + item = gl_item_box_new (object, display); + break; + case GL_LABEL_OBJECT_LINE: + item = gl_item_line_new (object, display); + break; + case GL_LABEL_OBJECT_ELLIPSE: + item = gl_item_ellipse_new (object, display); + break; + case GL_LABEL_OBJECT_IMAGE: + item = gl_item_image_new (object, display); + break; + case GL_LABEL_OBJECT_BARCODE: + item = gl_item_barcode_new (object, display); + break; + default: + item = NULL; + WARN ("Invalid label object type."); /* Should not happen! */ + break; + } + + return item; +} + +/*****************************************************************************/ +/* Free a canvas item and all our associated data. */ +/*****************************************************************************/ +void +gl_item_free (GnomeCanvasItem ** item) +{ + glLabelObject *object; + GtkWidget *menu; + GnomeCanvasItem *highlight; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (*item)); + + menu = gtk_object_get_data (GTK_OBJECT (*item), "object_menu"); + object = gtk_object_get_data (GTK_OBJECT (*item), "label_object"); + highlight = gtk_object_get_data (GTK_OBJECT (*item), "highlight"); + + gtk_menu_popdown (GTK_MENU (menu)); + gtk_widget_unref (GTK_WIDGET (menu)); + + gl_label_object_free (&object); + + if (highlight != NULL) { + gtk_object_destroy (GTK_OBJECT (highlight)); + } + + gtk_object_destroy (GTK_OBJECT (*item)); + *item = NULL; +} + +/*****************************************************************************/ +/* Get position and size of object. */ +/*****************************************************************************/ +void +gl_item_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h) +{ + glLabelObject *object; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + switch (object->type) { + case GL_LABEL_OBJECT_TEXT: + gl_item_text_get_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_BOX: + gl_item_box_get_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_LINE: + gl_item_line_get_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_ELLIPSE: + gl_item_ellipse_get_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_IMAGE: + gl_item_image_get_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_BARCODE: + gl_item_barcode_get_position_size (item, x, y, w, h); + break; + default: + WARN ("Invalid label object type."); /* Should not happen! */ + break; + } + +} + +/*****************************************************************************/ +/* Get position and size of object. */ +/*****************************************************************************/ +void +gl_item_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h) +{ + glLabelObject *object; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + switch (object->type) { + case GL_LABEL_OBJECT_TEXT: + gl_item_text_set_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_BOX: + gl_item_box_set_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_LINE: + gl_item_line_set_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_ELLIPSE: + gl_item_ellipse_set_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_IMAGE: + gl_item_image_set_position_size (item, x, y, w, h); + break; + case GL_LABEL_OBJECT_BARCODE: + gl_item_barcode_set_position_size (item, x, y, w, h); + break; + default: + WARN ("Invalid label object type."); /* Should not happen! */ + break; + } + +} + +/*****************************************************************************/ +/* Get object associated with canvas item. */ +/*****************************************************************************/ +glLabelObject * +gl_item_get_object (GnomeCanvasItem * item) +{ + g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), NULL); + + return gtk_object_get_data (GTK_OBJECT (item), "label_object"); +} + +/*****************************************************************************/ +/* Get display associated with canvas item. */ +/*****************************************************************************/ +glDisplay * +gl_item_get_display (GnomeCanvasItem * item) +{ + g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), NULL); + + return gtk_object_get_data (GTK_OBJECT (item), "display"); +} + +/*****************************************************************************/ +/* Get menu associated with canvas item. */ +/*****************************************************************************/ +GtkWidget * +gl_item_get_menu (GnomeCanvasItem * item) +{ + g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), NULL); + + return gtk_object_get_data (GTK_OBJECT (item), "object_menu"); +} + +/*****************************************************************************/ +/* Turn on item highlight. */ +/*****************************************************************************/ +void +gl_item_highlight (GnomeCanvasItem * item) +{ + glLabelObject *object; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + switch (object->type) { + case GL_LABEL_OBJECT_TEXT: + gl_item_text_highlight (item); + break; + case GL_LABEL_OBJECT_BOX: + gl_item_box_highlight (item); + break; + case GL_LABEL_OBJECT_LINE: + gl_item_line_highlight (item); + break; + case GL_LABEL_OBJECT_ELLIPSE: + gl_item_ellipse_highlight (item); + break; + case GL_LABEL_OBJECT_IMAGE: + gl_item_image_highlight (item); + break; + case GL_LABEL_OBJECT_BARCODE: + gl_item_barcode_highlight (item); + break; + default: + WARN ("Invalid label object type."); /* Should not happen! */ + break; + } + +} + +/*****************************************************************************/ +/* Turn off item highlight. */ +/*****************************************************************************/ +void +gl_item_unhighlight (GnomeCanvasItem * item) +{ + GnomeCanvasItem *sel_box; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + if (item != NULL) { + + sel_box = gtk_object_get_data (GTK_OBJECT (item), "highlight"); + gnome_canvas_item_hide (sel_box); + + } +} + +/*****************************************************************************/ +/* Get item bounds using appropriate custom function. */ +/*****************************************************************************/ +void +gl_item_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2) +{ + glLabelObject *object; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + switch (object->type) { + case GL_LABEL_OBJECT_TEXT: + gl_item_text_get_bounds (item, x1, y1, x2, y2); + break; + case GL_LABEL_OBJECT_BOX: + gl_item_box_get_bounds (item, x1, y1, x2, y2); + break; + case GL_LABEL_OBJECT_LINE: + gl_item_line_get_bounds (item, x1, y1, x2, y2); + break; + case GL_LABEL_OBJECT_ELLIPSE: + gl_item_ellipse_get_bounds (item, x1, y1, x2, y2); + break; + case GL_LABEL_OBJECT_IMAGE: + gl_item_image_get_bounds (item, x1, y1, x2, y2); + break; + case GL_LABEL_OBJECT_BARCODE: + gl_item_barcode_get_bounds (item, x1, y1, x2, y2); + break; + default: + WARN ("Invalid label object type."); /* Should not happen! */ + break; + } + +} + +/*****************************************************************************/ +/* launch apropriate edit dialog for item/object */ +/*****************************************************************************/ +void +gl_item_edit_dialog (GnomeCanvasItem * item) +{ + glLabelObject *object; + glDisplay *display; + + g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + + switch (object->type) { + case GL_LABEL_OBJECT_TEXT: + gl_item_text_edit_dialog (item); + break; + case GL_LABEL_OBJECT_BOX: + gl_item_box_edit_dialog (item); + break; + case GL_LABEL_OBJECT_LINE: + gl_item_line_edit_dialog (item); + break; + case GL_LABEL_OBJECT_ELLIPSE: + gl_item_ellipse_edit_dialog (item); + break; + case GL_LABEL_OBJECT_IMAGE: + gl_item_image_edit_dialog (item); + break; + case GL_LABEL_OBJECT_BARCODE: + gl_item_barcode_edit_dialog (item); + break; + default: + WARN ("Invalid label object type."); /* Should not happen! */ + break; + } + + /* Update highlight of item */ + gl_item_highlight (item); +} + +/*****************************************************************************/ +/* Return apropos item create mode cursor for given object type. */ +/*****************************************************************************/ +GdkCursor * +gl_item_get_create_cursor (glLabelObjectType type) +{ + switch (type) { + + case GL_LABEL_OBJECT_TEXT: + return gl_item_text_get_create_cursor (); + + case GL_LABEL_OBJECT_BOX: + return gl_item_box_get_create_cursor (); + + case GL_LABEL_OBJECT_LINE: + return gl_item_line_get_create_cursor (); + + case GL_LABEL_OBJECT_ELLIPSE: + return gl_item_ellipse_get_create_cursor (); + + case GL_LABEL_OBJECT_IMAGE: + return gl_item_image_get_create_cursor (); + + case GL_LABEL_OBJECT_BARCODE: + return gl_item_barcode_get_create_cursor (); + + default: + WARN ("Invalid label object type."); /* Should not happen! */ + return NULL; + + } + +} + +/*****************************************************************************/ +/* Item/object creation canvas event handler. */ +/*****************************************************************************/ +gint +gl_item_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + glDisplay * display) +{ + switch (display->create_type) { + + case GL_LABEL_OBJECT_TEXT: + return gl_item_text_create_event_handler (canvas, event, + display); + + case GL_LABEL_OBJECT_BOX: + return gl_item_box_create_event_handler (canvas, event, + display); + + case GL_LABEL_OBJECT_LINE: + return gl_item_line_create_event_handler (canvas, event, + display); + + case GL_LABEL_OBJECT_ELLIPSE: + return gl_item_ellipse_create_event_handler (canvas, event, + display); + + case GL_LABEL_OBJECT_IMAGE: + return gl_item_image_create_event_handler (canvas, event, + display); + + case GL_LABEL_OBJECT_BARCODE: + return gl_item_barcode_create_event_handler (canvas, event, + display); + + default: + WARN ("Invalid label object type."); /* Should not happen! */ + return FALSE; + + } + +} diff --git a/glabels1/src/item.h b/glabels1/src/item.h new file mode 100644 index 00000000..23b25f9a --- /dev/null +++ b/glabels1/src/item.h @@ -0,0 +1,71 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item.h: GLabels canvas item wrapper module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __ITEM_H__ +#define __ITEM_H__ + +#include + +#include "label.h" +#include "display.h" + +extern GnomeCanvasItem *gl_item_new (glLabelObject * object, + glDisplay * display); + +extern void gl_item_free (GnomeCanvasItem ** item); + +extern void gl_item_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h); + +extern void gl_item_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h); + +extern glLabelObject *gl_item_get_object (GnomeCanvasItem * item); + +extern glDisplay *gl_item_get_display (GnomeCanvasItem * item); + +extern GtkWidget *gl_item_get_menu (GnomeCanvasItem * item); + +extern void gl_item_highlight (GnomeCanvasItem * item); + +extern void gl_item_unhighlight (GnomeCanvasItem * item); + +extern void gl_item_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2); + +extern void gl_item_edit_dialog (GnomeCanvasItem * item); + +extern GdkCursor *gl_item_get_create_cursor (glLabelObjectType type); + +extern gint gl_item_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + glDisplay * display); + +#endif diff --git a/glabels1/src/item_barcode.c b/glabels1/src/item_barcode.c new file mode 100644 index 00000000..e129f33b --- /dev/null +++ b/glabels1/src/item_barcode.c @@ -0,0 +1,656 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_barcode.c: GLabels Barcode Object (canvas item) module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "display.h" +#include "item_barcode.h" +#include "bc.h" + +#include "highlight.h" + +#include "mdi.h" +#include "propertybox.h" +#include "prop_bc_data.h" +#include "prop_bc.h" +#include "prop_bc_style.h" +#include "prop_position.h" + +#include "pixmaps/cursor_barcode.xbm" +#include "pixmaps/cursor_barcode_mask.xbm" + +#ifdef HACKTEXT +#include "gnome-canvas-hacktext.h" +#include +#endif + +#include "debug.h" + +#define Y_FONT_ADJUST (-1.0) /* Adjust font vertical position */ + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +typedef struct { + GnomeCanvasItem *item; + + /* Page 0 widgets */ + GtkWidget *data_entry; + + /* Page 1 widgets */ + GtkWidget *bcprop; + GtkWidget *style; + + /* Page 2 widgets */ + GtkWidget *position; +} PropertyDialogPassback; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void item_barcode_update (GnomeCanvasItem * item); + +static void changed_cb (glPropertyBox * propertybox); +static void apply_cb (glPropertyBox * propertybox, gint page, + PropertyDialogPassback * data); + +static void draw_barcode (GnomeCanvasItem * item, + glBarcodeStyle style, + guint color, + gboolean text_flag, + gdouble scale, + gchar * digits, + gdouble canvas_scale); + +/*****************************************************************************/ +/* Create a barcode object */ +/*****************************************************************************/ +GnomeCanvasItem * +gl_item_barcode_new (glLabelObject * object, + glDisplay * display) +{ + GnomeCanvasGroup *group; + GnomeCanvasItem *item; + gchar *text; + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + item = gnome_canvas_item_new (group, gnome_canvas_group_get_type (), + "x", object->x, "y", object->y, NULL); + + if (object->arg.barcode.text_node->field_flag) { + text = gl_barcode_default_digits (object->arg.barcode.style); + } else { + text = + gl_text_node_expand (object->arg.barcode.text_node, NULL); + } + draw_barcode (item, + object->arg.barcode.style, + object->arg.barcode.color, + object->arg.barcode.text_flag, + object->arg.barcode.scale, text, display->scale); + g_free (text); + + /* Squirrel away pointers to object and display in the canvas item. */ + gtk_object_set_data (GTK_OBJECT (item), "label_object", object); + gtk_object_set_data (GTK_OBJECT (item), "display", display); + gtk_object_set_data (GTK_OBJECT (item), "highlight", NULL); + + gtk_signal_connect (GTK_OBJECT (item), "event", + GTK_SIGNAL_FUNC (gl_display_item_event_handler), + display); + + gl_display_new_item_menu (item); + + gl_display_set_modified (display); + + return item; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update a barcode object */ +/*---------------------------------------------------------------------------*/ +static void +item_barcode_update (GnomeCanvasItem * item) +{ + glLabelObject *object; + glDisplay *display; + GList *item_list, *li; + gdouble affine[6]; + gchar *text; + + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + item_list = gtk_object_get_data (GTK_OBJECT (item), "item_list"); + for (li = item_list; li != NULL; li = li->next) { + gtk_object_destroy (GTK_OBJECT (li->data)); + } + g_list_free (item_list); + gtk_object_set_data (GTK_OBJECT (item), "item_list", NULL); + + if (object->arg.barcode.text_node->field_flag) { + text = gl_barcode_default_digits (object->arg.barcode.style); + } else { + text = + gl_text_node_expand (object->arg.barcode.text_node, NULL); + } + draw_barcode (item, + object->arg.barcode.style, + object->arg.barcode.color, + object->arg.barcode.text_flag, + object->arg.barcode.scale, text, display->scale); + g_free (text); + + art_affine_identity (affine); + gnome_canvas_item_affine_absolute (item, affine); + gnome_canvas_item_set (item, "x", object->x, "y", object->y, NULL); + + gl_display_set_modified (display); +} + +/*****************************************************************************/ +/* Highlight given canvas item. */ +/*****************************************************************************/ +void +gl_item_barcode_highlight (GnomeCanvasItem * item) +{ + gl_highlight (item, GL_HIGHLIGHT_SIMPLE); +} + +/*****************************************************************************/ +/* Get position and size of object. */ +/*****************************************************************************/ +void +gl_item_barcode_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h) +{ + glLabelObject *object; + glBarcode *gbc; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + *x = object->x; + *y = object->y; + + gbc = gtk_object_get_data (GTK_OBJECT (item), "bc"); + *w = gbc->width; + *h = gbc->height; + +} + +/*****************************************************************************/ +/* Get position and size of object. */ +/*****************************************************************************/ +void +gl_item_barcode_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + object->x = x; + object->y = y; + + /* Currently ignore w, h */ + + item_barcode_update (item); +} + +/*****************************************************************************/ +/* Get barcode item bounds. */ +/*****************************************************************************/ +void +gl_item_barcode_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2) +{ + glBarcode *gbc; + glLabelObject *object; + + gbc = gtk_object_get_data (GTK_OBJECT (item), "bc"); + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + if (gbc == NULL) { + gnome_canvas_item_get_bounds (item, x1, y1, x2, y2); + } else { + *x1 = object->x; + *y1 = object->y; + *x2 = *x1 + gbc->width; + *y2 = *y1 + gbc->height; + } +} + +/*****************************************************************************/ +/* Create and run an edit dialog on a barcode object. */ +/*****************************************************************************/ +void +gl_item_barcode_edit_dialog (GnomeCanvasItem * item) +{ + GtkWidget *dialog; + static PropertyDialogPassback *data = NULL; + glLabelObject *object; + glDisplay *display; + GtkWidget *wvbox; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + data->item = item; + + dialog = gl_property_box_new (); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (gl_mdi_get_active_window ())); + gtk_window_set_title (GTK_WINDOW (dialog), + _("Edit barcode object properties")); + gtk_signal_connect (GTK_OBJECT (dialog), "apply", + GTK_SIGNAL_FUNC (apply_cb), data); + + /*---------------------------*/ + /* Data Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), + wvbox, gtk_label_new (_("Data"))); + + data->data_entry = gl_prop_bc_data_new (_("Barcode data"), + object->parent->merge_fields); + gl_prop_bc_data_set_data (GL_PROP_BC_DATA (data->data_entry), + (object->parent->merge_type != GL_MERGE_NONE), + object->arg.barcode.text_node->field_flag, + object->arg.barcode.text_node->data, + object->arg.barcode.text_node->data); + gtk_box_pack_start (GTK_BOX (wvbox), data->data_entry, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->data_entry), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), + wvbox, gtk_label_new (_("Appearance"))); + + /* ------ Begin Barcode Properties Frame ------ */ + data->bcprop = gl_prop_bc_new (_("General")); + gl_prop_bc_set_params (GL_PROP_BC (data->bcprop), + object->arg.barcode.scale, + object->arg.barcode.color); + gtk_box_pack_start (GTK_BOX (wvbox), data->bcprop, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->bcprop), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /* ------ Barcode Style Frame ------ */ + data->style = gl_prop_bc_style_new (_("Style")); + gl_prop_bc_style_set_params (GL_PROP_BC_STYLE (data->style), + object->arg.barcode.style, + object->arg.barcode.text_flag); + gtk_box_pack_start (GTK_BOX (wvbox), data->style, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->style), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*----------------------------*/ + /* Position Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), + wvbox, gtk_label_new (_("Position"))); + + /* ------ Position Frame ------ */ + data->position = gl_prop_position_new (_("Position")); + gl_prop_position_set_params (GL_PROP_POSITION (data->position), + object->x, object->y, + display->label->width, + display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->position, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->position), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*-----------------------------------------------------------------*/ + /* Run dialog, and update state of object if "Applied." */ + /*-----------------------------------------------------------------*/ + gtk_widget_show_all (GTK_WIDGET (dialog)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the dialog has changed. */ +/*---------------------------------------------------------------------------*/ +static void +changed_cb (glPropertyBox * propertybox) +{ + gl_property_box_changed (propertybox); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Apply" callback. */ +/*---------------------------------------------------------------------------*/ +static void +apply_cb (glPropertyBox * propertybox, + gint page, + PropertyDialogPassback * data) +{ + glLabelObject *object; + glDisplay *display; + gboolean flag; + gchar *tmp1, *tmp2; + + object = gtk_object_get_data (GTK_OBJECT (data->item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (data->item), "display"); + + switch (page) { + + case 0: + /* ------- Get updated digit data ------ */ + gl_prop_bc_data_get_data (GL_PROP_BC_DATA (data->data_entry), + &flag, &tmp1, &tmp2); + object->arg.barcode.text_node->field_flag = flag; + if (!flag) { + object->arg.barcode.text_node->data = tmp1; + g_free (tmp2); + } else { + object->arg.barcode.text_node->data = tmp2; + g_free (tmp1); + } + break; + + case 1: + /* ------- Get updated scale/color ------ */ + gl_prop_bc_get_params (GL_PROP_BC (data->bcprop), + &object->arg.barcode.scale, + &object->arg.barcode.color); + /* ------ Get updated style ------ */ + gl_prop_bc_style_get_params (GL_PROP_BC_STYLE (data->style), + &object->arg.barcode.style, + &object->arg.barcode.text_flag); + break; + + case 2: + /* ------ get updated position ------ */ + gl_prop_position_get_position (GL_PROP_POSITION + (data->position), &object->x, + &object->y); + break; + + default: + return; + } + + /* ------ Udate state of object ------ */ + item_barcode_update (data->item); + gl_display_select_item (display, data->item); + +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_item_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 }; + + 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); + } + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler (barcode mode) */ +/*****************************************************************************/ +int +gl_item_barcode_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + glDisplay *display = GL_DISPLAY (data); + gdouble x, y; + glLabelObject *object; + GnomeCanvasItem *item; + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = + gl_label_object_new (display->label, + GL_LABEL_OBJECT_BARCODE); + object->x = x; + object->y = y; + object->arg.barcode.text_node = + gl_text_node_new_from_text ("123456789"); + object->arg.barcode.style = GL_BARCODE_STYLE_POSTNET; + object->arg.barcode.color = + GNOME_CANVAS_COLOR_A (0, 0, 0, 255); + object->arg.barcode.text_flag = TRUE; + object->arg.barcode.scale = 1.0; + item = gl_item_barcode_new (object, display); + gl_display_add_item (display, item); + gl_display_unselect_all (display); + gl_display_select_item (display, item); + gl_display_arrow_mode (display); + return TRUE; + + default: + return FALSE; + } + + default: + return FALSE; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw barcode to canvas item (group). */ +/*---------------------------------------------------------------------------*/ +static void +draw_barcode (GnomeCanvasItem * group, + glBarcodeStyle style, + guint color, + gboolean text_flag, + gdouble scale, + gchar * digits, + gdouble canvas_scale) +{ + glBarcodeLine *line; + glBarcodeChar *bchar; + glBarcode *gbc; + GList *li; + GnomeCanvasItem *item; + GList *item_list = NULL; + GnomeCanvasPoints *points; + gchar *cstring; +#ifdef HACKTEXT + GnomeFont *font; + GnomeGlyphList *glyphlist; + gdouble y_offset; +#else + GdkFont *gdk_font; + GnomeDisplayFont *display_font; +#endif + + gbc = gtk_object_get_data (GTK_OBJECT (group), "bc"); + gl_barcode_free (&gbc); + gbc = gl_barcode (style, text_flag, scale, digits); + if (gbc == NULL) { +#ifdef HACKTEXT + font = gnome_font_new_closest (GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, 10.0); + 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), + gnome_canvas_hacktext_get_type (), + "x", 0.0, + "y", y_offset, + "glyphlist", glyphlist, NULL); +#else + display_font = gnome_get_display_font (GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, + 10.0, canvas_scale); + gdk_font = gnome_display_font_get_gdk_font (display_font); + item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gnome_canvas_text_get_type (), + "x", 0.0, + "y", 0.0, + "text", _("Invalid barcode"), + "font_gdk", gdk_font, + "anchor", GTK_ANCHOR_NW, + "fill_color_rgba", color, NULL); +#endif + item_list = g_list_prepend (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); + item_list = g_list_prepend (item_list, item); + } + gnome_canvas_points_free (points); + + for (li = gbc->chars; li != NULL; li = li->next) { + bchar = (glBarcodeChar *) li->data; + +#ifdef HACKTEXT + font = gnome_font_new_closest (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); +#else + display_font = + gnome_get_display_font (GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, bchar->fsize, + canvas_scale); + gdk_font = + gnome_display_font_get_gdk_font (display_font); + cstring = g_strdup_printf ("%c", bchar->c); + item = + gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gnome_canvas_text_get_type + (), "x", bchar->x, "y", + bchar->y + Y_FONT_ADJUST, + "text", cstring, "font_gdk", + gdk_font, "anchor", + GTK_ANCHOR_NW, + "fill_color_rgba", color, + NULL); + g_free (cstring); +#endif + item_list = g_list_prepend (item_list, item); + + } + + } + + /* attach item list to group, so we can get at these again */ + gtk_object_set_data (GTK_OBJECT (group), "item_list", item_list); + + gtk_object_set_data (GTK_OBJECT (group), "bc", gbc); + +} diff --git a/glabels1/src/item_barcode.h b/glabels1/src/item_barcode.h new file mode 100644 index 00000000..d18d6ba2 --- /dev/null +++ b/glabels1/src/item_barcode.h @@ -0,0 +1,60 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_barcode.h: GLabels Barcode Object (canvas item) module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __ITEM_BARCODE_H__ +#define __ITEM_BARCODE_H__ + +#include + +#include "label.h" + +extern GnomeCanvasItem *gl_item_barcode_new (glLabelObject * object, + glDisplay * display); + +extern void gl_item_barcode_highlight (GnomeCanvasItem * item); + +extern void gl_item_barcode_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h); + +extern void gl_item_barcode_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h); + +extern void gl_item_barcode_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2); + +extern void gl_item_barcode_edit_dialog (GnomeCanvasItem * item); + +extern GdkCursor *gl_item_barcode_get_create_cursor (void); + +extern gint gl_item_barcode_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data); + +#endif diff --git a/glabels1/src/item_box.c b/glabels1/src/item_box.c new file mode 100644 index 00000000..2b110f7c --- /dev/null +++ b/glabels1/src/item_box.c @@ -0,0 +1,489 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_box.c: GLabels Box Object (canvas item) module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "display.h" +#include "item_box.h" + +#include "highlight.h" + +#include "mdi.h" +#include "propertybox.h" +#include "prop_line.h" +#include "prop_fill.h" +#include "prop_size.h" +#include "prop_position.h" + +#include "pixmaps/cursor_box.xbm" +#include "pixmaps/cursor_box_mask.xbm" + +#include "debug.h" + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +typedef struct { + GnomeCanvasItem *item; + gboolean keep_aspect_ratio_flag; + + /* Page 0 widgets */ + GtkWidget *line; + GtkWidget *fill; + + /* Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +} PropertyDialogPassback; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void item_box_update (GnomeCanvasItem * item); + +static void changed_cb (glPropertyBox * propertybox); +static void apply_cb (glPropertyBox * propertybox, + gint page, PropertyDialogPassback * data); + +/*****************************************************************************/ +/* Create a box object */ +/*****************************************************************************/ +GnomeCanvasItem * +gl_item_box_new (glLabelObject * object, + glDisplay * display) +{ + GnomeCanvasGroup *group; + GnomeCanvasItem *item; + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + item = gnome_canvas_item_new (group, gnome_canvas_rect_get_type (), + "x1", object->x, + "y1", object->y, + "x2", object->x + object->arg.box.w, + "y2", object->y + object->arg.box.h, + "width_units", object->arg.box.line_width, + "outline_color_rgba", + object->arg.box.line_color, + "fill_color_rgba", + object->arg.box.fill_color, NULL); + + /* Squirrel away pointers to object and display in the canvas item. */ + gtk_object_set_data (GTK_OBJECT (item), "label_object", object); + gtk_object_set_data (GTK_OBJECT (item), "display", display); + gtk_object_set_data (GTK_OBJECT (item), "highlight", NULL); + + gtk_signal_connect (GTK_OBJECT (item), "event", + GTK_SIGNAL_FUNC (gl_display_item_event_handler), + display); + + gl_display_new_item_menu (item); + + gl_display_set_modified (display); + + return item; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Update a box object */ +/*---------------------------------------------------------------------------*/ +static void +item_box_update (GnomeCanvasItem * item) +{ + glLabelObject *object; + glDisplay *display; + gdouble affine[6]; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + art_affine_identity (affine); + gnome_canvas_item_affine_absolute (item, affine); + gnome_canvas_item_set (item, + "x1", object->x, + "y1", object->y, + "x2", object->x + object->arg.box.w, + "y2", object->y + object->arg.box.h, + "width_units", object->arg.box.line_width, + "outline_color_rgba", object->arg.box.line_color, + "fill_color_rgba", object->arg.box.fill_color, + NULL); + + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + gl_display_set_modified (display); +} + +/*****************************************************************************/ +/* Return a selection canvas item/group for given item */ +/*****************************************************************************/ +void +gl_item_box_highlight (GnomeCanvasItem * item) +{ + gl_highlight (item, GL_HIGHLIGHT_BOX_RESIZABLE); +} + +/*****************************************************************************/ +/* Get position and size of object. */ +/*****************************************************************************/ +void +gl_item_box_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + *x = object->x; + *y = object->y; + + *w = object->arg.box.w; + *h = object->arg.box.h; +} + +/*****************************************************************************/ +/* Get position and size of object. */ +/*****************************************************************************/ +void +gl_item_box_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + object->x = x; + object->y = y; + + object->arg.box.w = w; + object->arg.box.h = h; + + item_box_update (item); +} + +/*****************************************************************************/ +/* Get box item bounds. */ +/*****************************************************************************/ +void +gl_item_box_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2) +{ + gnome_canvas_item_get_bounds (item, x1, y1, x2, y2); +} + +/*****************************************************************************/ +/* Create and run an edit dialog on a box object. */ +/*****************************************************************************/ +void +gl_item_box_edit_dialog (GnomeCanvasItem * item) +{ + GtkWidget *dialog; + static PropertyDialogPassback *data = NULL; + glLabelObject *object; + glDisplay *display; + GtkWidget *wvbox; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + data->item = item; + + dialog = gl_property_box_new (); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (gl_mdi_get_active_window ())); + gtk_window_set_title (GTK_WINDOW (dialog), + _("Edit box object properties")); + gtk_signal_connect (GTK_OBJECT (dialog), "apply", + GTK_SIGNAL_FUNC (apply_cb), data); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Line box ------ */ + data->line = gl_prop_line_new (_("Outline")); + gl_prop_line_set_params (GL_PROP_LINE (data->line), + object->arg.box.line_width, + object->arg.box.line_color); + gtk_box_pack_start (GTK_BOX (wvbox), data->line, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->line), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /* ------ Fill box ------ */ + data->fill = gl_prop_fill_new (_("Fill")); + gl_prop_fill_set_params (GL_PROP_FILL (data->fill), + object->arg.box.fill_color); + gtk_box_pack_start (GTK_BOX (wvbox), data->fill, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->fill), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + data->position = gl_prop_position_new (_("Position")); + gl_prop_position_set_params (GL_PROP_POSITION (data->position), + object->x, object->y, + display->label->width, + display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->position, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->position), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /* ------ Size Frame ------ */ + data->size = gl_prop_size_new (_("Size")); + gl_prop_size_set_params (GL_PROP_SIZE (data->size), + object->arg.box.w, object->arg.box.h, + data->keep_aspect_ratio_flag, + display->label->width, display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->size, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->size), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*-----------------------------------------------------------------*/ + /* Run dialog, and update state of object if "Applied." */ + /*-----------------------------------------------------------------*/ + gtk_widget_show_all (GTK_WIDGET (dialog)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the dialog has changed. */ +/*---------------------------------------------------------------------------*/ +static void +changed_cb (glPropertyBox * propertybox) +{ + gl_property_box_changed (propertybox); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Apply" callback. */ +/*---------------------------------------------------------------------------*/ +static void +apply_cb (glPropertyBox * propertybox, + gint page, + PropertyDialogPassback * data) +{ + glLabelObject *object; + glDisplay *display; + + object = gtk_object_get_data (GTK_OBJECT (data->item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (data->item), "display"); + + switch (page) { + + case 0: + /* ------- Get updated line width & color ------ */ + gl_prop_line_get_params (GL_PROP_LINE (data->line), + &object->arg.box.line_width, + &object->arg.box.line_color); + /* ------- Get updated fill color ------ */ + gl_prop_fill_get_params (GL_PROP_FILL (data->fill), + &object->arg.box.fill_color); + break; + + case 1: + /* ------ get updated position ------ */ + gl_prop_position_get_position (GL_PROP_POSITION + (data->position), &object->x, + &object->y); + + /* ------ get updated size ------ */ + gl_prop_size_get_size (GL_PROP_SIZE (data->size), + &object->arg.box.w, &object->arg.box.h, + &data->keep_aspect_ratio_flag); + break; + + default: + return; + } + + /* ------ Udate state of object ------ */ + item_box_update (data->item); + gl_display_select_item (display, data->item); + +} + +/*****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/*****************************************************************************/ +GdkCursor * +gl_item_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 }; + + 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); + } + + return cursor; +} + +/*****************************************************************************/ +/* Canvas event handler (box mode) */ +/*****************************************************************************/ +int +gl_item_box_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glLabelObject *object; + glDisplay *display = GL_DISPLAY (data); + gdouble x, y; + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (display->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_object_new (display->label, + GL_LABEL_OBJECT_BOX); + object->x = x; + object->y = y; + object->arg.box.w = 0.0; + object->arg.box.h = 0.0; + object->arg.box.line_width = 1.0; + object->arg.box.line_color = + GNOME_CANVAS_COLOR_A (0, 0, 255, 128); + object->arg.box.fill_color = + GNOME_CANVAS_COLOR_A (128, 128, 128, 128); + item = gl_item_box_new (object, display); + 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; + } + object->x = MIN (x, x0); + object->y = MIN (y, y0); + object->arg.box.w = MAX (x, x0) - MIN (x, x0); + object->arg.box.h = MAX (y, y0) - MIN (y, y0); + object->arg.box.line_color = + GNOME_CANVAS_COLOR_A (0, 0, 0, 255); + object->arg.box.fill_color = + GNOME_CANVAS_COLOR_A (0, 255, 0, 255); + item_box_update (item); + gl_display_add_item (display, item); + gl_display_unselect_all (display); + gl_display_select_item (display, item); + gl_display_arrow_mode (display); + 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); + object->x = MIN (x, x0); + object->y = MIN (y, y0); + object->arg.box.w = MAX (x, x0) - MIN (x, x0); + object->arg.box.h = MAX (y, y0) - MIN (y, y0); + item_box_update (item); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels1/src/item_box.h b/glabels1/src/item_box.h new file mode 100644 index 00000000..789fce81 --- /dev/null +++ b/glabels1/src/item_box.h @@ -0,0 +1,60 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_box.h: GLabels Box Object (canvas item) module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __ITEM_BOX_H__ +#define __ITEM_BOX_H__ + +#include + +#include "label.h" + +extern GnomeCanvasItem *gl_item_box_new (glLabelObject * object, + glDisplay * display); + +extern void gl_item_box_highlight (GnomeCanvasItem * item); + +extern void gl_item_box_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h); + +extern void gl_item_box_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h); + +extern void gl_item_box_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2); + +extern void gl_item_box_edit_dialog (GnomeCanvasItem * item); + +extern GdkCursor *gl_item_box_get_create_cursor (void); + +extern gint gl_item_box_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data); + +#endif diff --git a/glabels1/src/item_ellipse.c b/glabels1/src/item_ellipse.c new file mode 100644 index 00000000..9b5aae2d --- /dev/null +++ b/glabels1/src/item_ellipse.c @@ -0,0 +1,493 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_ellipse.c: gLabels Ellipse Object (canvas item) module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "display.h" +#include "item_ellipse.h" + +#include "highlight.h" + +#include "mdi.h" +#include "propertybox.h" +#include "prop_line.h" +#include "prop_fill.h" +#include "prop_size.h" +#include "prop_position.h" + +#include "pixmaps/cursor_ellipse.xbm" +#include "pixmaps/cursor_ellipse_mask.xbm" + +#include "debug.h" + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +typedef struct { + GnomeCanvasItem *item; + gboolean keep_aspect_ratio_flag; + + /* Page 0 widgets */ + GtkWidget *line; + GtkWidget *fill; + + /* Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +} PropertyDialogPassback; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void item_ellipse_update (GnomeCanvasItem * item); + +static void changed_cb (glPropertyBox * propertybox); +static void apply_cb (glPropertyBox * propertybox, + gint page, PropertyDialogPassback * data); + +/****************************************************************************/ +/* Create an ellipse object */ +/****************************************************************************/ +GnomeCanvasItem * +gl_item_ellipse_new (glLabelObject * object, + glDisplay * display) +{ + GnomeCanvasGroup *group; + GnomeCanvasItem *item; + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + item = gnome_canvas_item_new (group, gnome_canvas_ellipse_get_type (), + "x1", object->x, + "y1", object->y, + "x2", object->x + object->arg.ellipse.w, + "y2", object->y + object->arg.ellipse.h, + "width_units", + object->arg.ellipse.line_width, + "outline_color_rgba", + object->arg.ellipse.line_color, + "fill_color_rgba", + object->arg.ellipse.fill_color, NULL); + + /* Squirrel away pointers to object and display in the canvas item. */ + gtk_object_set_data (GTK_OBJECT (item), "label_object", object); + gtk_object_set_data (GTK_OBJECT (item), "display", display); + gtk_object_set_data (GTK_OBJECT (item), "highlight", NULL); + + gtk_signal_connect (GTK_OBJECT (item), "event", + GTK_SIGNAL_FUNC (gl_display_item_event_handler), + display); + + gl_display_new_item_menu (item); + + gl_display_set_modified (display); + + return item; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update a ellipse object */ +/*--------------------------------------------------------------------------*/ +static void +item_ellipse_update (GnomeCanvasItem * item) +{ + glLabelObject *object; + glDisplay *display; + gdouble affine[6]; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + art_affine_identity (affine); + gnome_canvas_item_affine_absolute (item, affine); + gnome_canvas_item_set (item, + "x1", object->x, + "y1", object->y, + "x2", object->x + object->arg.ellipse.w, + "y2", object->y + object->arg.ellipse.h, + "width_units", object->arg.ellipse.line_width, + "outline_color_rgba", + object->arg.ellipse.line_color, + "fill_color_rgba", + object->arg.ellipse.fill_color, NULL); + + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + gl_display_set_modified (display); +} + +/****************************************************************************/ +/* Return a selection canvas item/group for given item */ +/****************************************************************************/ +void +gl_item_ellipse_highlight (GnomeCanvasItem * item) +{ + gl_highlight (item, GL_HIGHLIGHT_ELLIPSE_RESIZABLE); +} + +/****************************************************************************/ +/* Get position and size of object. */ +/****************************************************************************/ +void +gl_item_ellipse_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + *x = object->x; + *y = object->y; + + *w = object->arg.ellipse.w; + *h = object->arg.ellipse.h; +} + +/****************************************************************************/ +/* Get position and size of object. */ +/****************************************************************************/ +void +gl_item_ellipse_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + object->x = x; + object->y = y; + + object->arg.ellipse.w = w; + object->arg.ellipse.h = h; + + item_ellipse_update (item); +} + +/****************************************************************************/ +/* Get ellipse item bounds. */ +/****************************************************************************/ +void +gl_item_ellipse_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2) +{ + gnome_canvas_item_get_bounds (item, x1, y1, x2, y2); +} + +/****************************************************************************/ +/* Create and run an edit dialog on an ellipse object. */ +/****************************************************************************/ +void +gl_item_ellipse_edit_dialog (GnomeCanvasItem * item) +{ + GtkWidget *dialog; + static PropertyDialogPassback *data = NULL; + glLabelObject *object; + glDisplay *display; + GtkWidget *wvbox; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + data->item = item; + + dialog = gl_property_box_new (); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (gl_mdi_get_active_window ())); + gtk_window_set_title (GTK_WINDOW (dialog), + _("Edit ellipse object properties")); + gtk_signal_connect (GTK_OBJECT (dialog), "apply", + GTK_SIGNAL_FUNC (apply_cb), data); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Line box ------ */ + data->line = gl_prop_line_new (_("Outline")); + gl_prop_line_set_params (GL_PROP_LINE (data->line), + object->arg.ellipse.line_width, + object->arg.ellipse.line_color); + gtk_box_pack_start (GTK_BOX (wvbox), data->line, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->line), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /* ------ Fill box ------ */ + data->fill = gl_prop_fill_new (_("Fill")); + gl_prop_fill_set_params (GL_PROP_FILL (data->fill), + object->arg.ellipse.fill_color); + gtk_box_pack_start (GTK_BOX (wvbox), data->fill, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->fill), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + data->position = gl_prop_position_new (_("Position")); + gl_prop_position_set_params (GL_PROP_POSITION (data->position), + object->x, object->y, + display->label->width, + display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->position, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->position), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /* ------ Size Frame ------ */ + data->size = gl_prop_size_new (_("Size")); + gl_prop_size_set_params (GL_PROP_SIZE (data->size), + object->arg.ellipse.w, object->arg.ellipse.h, + data->keep_aspect_ratio_flag, + display->label->width, display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->size, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->size), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*-----------------------------------------------------------------*/ + /* Run dialog, and update state of object if "Applied." */ + /*-----------------------------------------------------------------*/ + gtk_widget_show_all (GTK_WIDGET (dialog)); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the dialog has changed. */ +/*---------------------------------------------------------------------------*/ +static void +changed_cb (glPropertyBox * propertybox) +{ + gl_property_box_changed (propertybox); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Apply" callback. */ +/*---------------------------------------------------------------------------*/ +static void +apply_cb (glPropertyBox * propertybox, + gint page, + PropertyDialogPassback * data) +{ + glLabelObject *object; + glDisplay *display; + + object = gtk_object_get_data (GTK_OBJECT (data->item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (data->item), "display"); + + switch (page) { + + case 0: + /* ------- Get updated line width & color ------ */ + gl_prop_line_get_params (GL_PROP_LINE (data->line), + &object->arg.ellipse.line_width, + &object->arg.ellipse.line_color); + /* ------- Get updated fill color ------ */ + gl_prop_fill_get_params (GL_PROP_FILL (data->fill), + &object->arg.ellipse.fill_color); + break; + + case 1: + /* ------ get updated position ------ */ + gl_prop_position_get_position (GL_PROP_POSITION + (data->position), &object->x, + &object->y); + + /* ------ get updated size ------ */ + gl_prop_size_get_size (GL_PROP_SIZE (data->size), + &object->arg.ellipse.w, + &object->arg.ellipse.h, + &data->keep_aspect_ratio_flag); + break; + + default: + return; + } + + /* ------ Udate state of object ------ */ + item_ellipse_update (data->item); + gl_display_select_item (display, data->item); + +} + +/****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/****************************************************************************/ +GdkCursor * +gl_item_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 }; + + 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); + } + + return cursor; +} + +/****************************************************************************/ +/* Canvas event handler (ellipse mode) */ +/****************************************************************************/ +int +gl_item_ellipse_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glLabelObject *object; + glDisplay *display = GL_DISPLAY (data); + gdouble x, y; + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (display->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_object_new (display->label, + GL_LABEL_OBJECT_ELLIPSE); + object->x = x; + object->y = y; + object->arg.ellipse.w = 0.0; + object->arg.ellipse.h = 0.0; + object->arg.ellipse.line_width = 1.0; + object->arg.ellipse.line_color = + GNOME_CANVAS_COLOR_A (0, 0, 255, 128); + object->arg.ellipse.fill_color = + GNOME_CANVAS_COLOR_A (128, 128, 128, 128); + item = gl_item_ellipse_new (object, display); + 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; + } + object->x = MIN (x, x0); + object->y = MIN (y, y0); + object->arg.ellipse.w = MAX (x, x0) - MIN (x, x0); + object->arg.ellipse.h = MAX (y, y0) - MIN (y, y0); + object->arg.ellipse.line_color = + GNOME_CANVAS_COLOR_A (0, 0, 0, 255); + object->arg.ellipse.fill_color = + GNOME_CANVAS_COLOR_A (0, 255, 0, 255); + item_ellipse_update (item); + gl_display_add_item (display, item); + gl_display_unselect_all (display); + gl_display_select_item (display, item); + gl_display_arrow_mode (display); + 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); + object->x = MIN (x, x0); + object->y = MIN (y, y0); + object->arg.ellipse.w = MAX (x, x0) - MIN (x, x0); + object->arg.ellipse.h = MAX (y, y0) - MIN (y, y0); + item_ellipse_update (item); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels1/src/item_ellipse.h b/glabels1/src/item_ellipse.h new file mode 100644 index 00000000..c4cf54e2 --- /dev/null +++ b/glabels1/src/item_ellipse.h @@ -0,0 +1,60 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_ellipse.h: GLabels Ellipse Object (canvas item) module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __ITEM_ELLIPSE_H__ +#define __ITEM_ELLIPSE_H__ + +#include + +#include "label.h" + +extern GnomeCanvasItem *gl_item_ellipse_new (glLabelObject * object, + glDisplay * display); + +extern void gl_item_ellipse_highlight (GnomeCanvasItem * item); + +extern void gl_item_ellipse_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h); + +extern void gl_item_ellipse_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h); + +extern void gl_item_ellipse_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2); + +extern void gl_item_ellipse_edit_dialog (GnomeCanvasItem * item); + +extern GdkCursor *gl_item_ellipse_get_create_cursor (void); + +extern gint gl_item_ellipse_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data); + +#endif diff --git a/glabels1/src/item_image.c b/glabels1/src/item_image.c new file mode 100644 index 00000000..0dcef76b --- /dev/null +++ b/glabels1/src/item_image.c @@ -0,0 +1,612 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_image.c: GLabels Image Object (canvas item) module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include +#include + +#include "display.h" +#include "item_image.h" + +#include "highlight.h" + +#include "mdi.h" +#include "propertybox.h" +#include "prop_position.h" +#include "prop_size.h" + +#include "pixmaps/cursor_image.xbm" +#include "pixmaps/cursor_image_mask.xbm" + +#include "pixmaps/checkerboard.xpm" + +#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 data types */ +/*===========================================*/ + +typedef struct { + GnomeCanvasItem *item; + gboolean keep_aspect_ratio_flag; + + /* Page 0 widgets */ + GtkWidget *pixmap_entry; + + /* Page 1 widgets */ + GtkWidget *position; + GtkWidget *size; +} PropertyDialogPassback; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/* Save state of image file entry */ +static gchar *image_path = NULL; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void item_image_update (GnomeCanvasItem * item); + +static void changed_cb (glPropertyBox * propertybox); +static void size_reset_cb (glPropertyBox * propertybox); +static void apply_cb (glPropertyBox * propertybox, + gint page, PropertyDialogPassback * data); + +/****************************************************************************/ +/* Create a image object */ +/****************************************************************************/ +GnomeCanvasItem * +gl_item_image_new (glLabelObject * object, + glDisplay * display) +{ + GnomeCanvasGroup *group; + GnomeCanvasItem *item; + + if (object->arg.image.image == NULL) { + object->arg.image.image = + gdk_pixbuf_new_from_xpm_data ((const char **) + checkerboard_xpm); + } + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + item = gnome_canvas_item_new (group, gnome_canvas_pixbuf_get_type (), + "x", object->x, + "y", object->y, + "width_set", TRUE, + "height_set", TRUE, + "width", object->arg.image.w, + "height", object->arg.image.h, + "pixbuf", object->arg.image.image, NULL); + + /* Squirrel away pointers to object and display in the canvas item. */ + gtk_object_set_data (GTK_OBJECT (item), "label_object", object); + gtk_object_set_data (GTK_OBJECT (item), "display", display); + gtk_object_set_data (GTK_OBJECT (item), "highlight", NULL); + + gtk_signal_connect (GTK_OBJECT (item), "event", + GTK_SIGNAL_FUNC (gl_display_item_event_handler), + display); + + gl_display_new_item_menu (item); + + gl_display_set_modified (display); + + return item; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update an image object */ +/*--------------------------------------------------------------------------*/ +static void +item_image_update (GnomeCanvasItem * item) +{ + glLabelObject *object; + glDisplay *display; + gdouble affine[6]; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + if (object->arg.image.image == NULL) { + object->arg.image.image = + gdk_pixbuf_new_from_xpm_data ((const char **) + checkerboard_xpm); + } + + art_affine_identity (affine); + gnome_canvas_item_affine_absolute (item, affine); + gnome_canvas_item_set (item, + "x", object->x, + "y", object->y, + "width_set", TRUE, + "height_set", TRUE, + "width", object->arg.image.w, + "height", object->arg.image.h, + "pixbuf", object->arg.image.image, NULL); + + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + gl_display_set_modified (display); +} + +/****************************************************************************/ +/* Return a selection canvas item/group for given item */ +/****************************************************************************/ +void +gl_item_image_highlight (GnomeCanvasItem * item) +{ + gl_highlight (item, GL_HIGHLIGHT_BOX_RESIZABLE); +} + +/****************************************************************************/ +/* Get position and size of object. */ +/****************************************************************************/ +void +gl_item_image_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + *x = object->x; + *y = object->y; + + *w = object->arg.image.w; + *h = object->arg.image.h; +} + +/****************************************************************************/ +/* Get position and size of object. */ +/****************************************************************************/ +void +gl_item_image_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + object->x = x; + object->y = y; + + object->arg.image.w = w; + object->arg.image.h = h; + + item_image_update (item); +} + +/****************************************************************************/ +/* Get image item bounds. */ +/****************************************************************************/ +void +gl_item_image_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2) +{ + gnome_canvas_item_get_bounds (item, x1, y1, x2, y2); +} + +/****************************************************************************/ +/* Create and run an edit dialog on a image object. */ +/****************************************************************************/ +void +gl_item_image_edit_dialog (GnomeCanvasItem * item) +{ + GtkWidget *dialog; + static PropertyDialogPassback *data = NULL; + GtkWidget *wbutton; + glLabelObject *object; + glDisplay *display; + GtkWidget *wvbox; + gdouble image_w, image_h; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + data->item = item; + + dialog = gl_property_box_new (); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (gl_mdi_get_active_window ())); + gtk_window_set_title (GTK_WINDOW (dialog), + _("Edit image object properties")); + gtk_signal_connect (GTK_OBJECT (dialog), "apply", + GTK_SIGNAL_FUNC (apply_cb), data); + gtk_object_set_data (GTK_OBJECT (dialog), "data", data); + + /*---------------------------*/ + /* Image Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Image"))); + + /* image entry */ + data->pixmap_entry = + gnome_pixmap_entry_new ("image", "Load image", TRUE); + gnome_pixmap_entry_set_preview_size (GNOME_PIXMAP_ENTRY + (data->pixmap_entry), 128, 128); + + /* Set default path for image entry */ + if (object->arg.image.filename != NULL) { + /* Set default path to the directory containing image. */ + if (image_path != NULL) + g_free (image_path); + image_path = g_dirname (object->arg.image.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 (); + } + /* Otherwise, leave it in the last directory that we got an image. */ + gnome_file_entry_set_default_path (GNOME_FILE_ENTRY + (GNOME_PIXMAP_ENTRY + (data->pixmap_entry)->fentry), + image_path); + + if (object->arg.image.filename != NULL) { + gtk_entry_set_text (GTK_ENTRY + (gnome_pixmap_entry_gtk_entry + (GNOME_PIXMAP_ENTRY (data->pixmap_entry))), + object->arg.image.filename); + } + gtk_box_pack_start (GTK_BOX (wvbox), data->pixmap_entry, FALSE, FALSE, + 0); + gtk_signal_connect_object (GTK_OBJECT + (gnome_pixmap_entry_gtk_entry + (GNOME_PIXMAP_ENTRY (data->pixmap_entry))), + "changed", GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + data->position = gl_prop_position_new (_("Position")); + gl_prop_position_set_params (GL_PROP_POSITION (data->position), + object->x, object->y, + display->label->width, + display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->position, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->position), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /* ------ Size Frame ------ */ + data->size = gl_prop_size_new (_("Size")); + image_w = gdk_pixbuf_get_width (object->arg.image.image); + image_h = gdk_pixbuf_get_height (object->arg.image.image); + gl_prop_size_set_params (GL_PROP_SIZE (data->size), + object->arg.image.w, object->arg.image.h, + data->keep_aspect_ratio_flag, + display->label->width, display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->size, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->size), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /* ------ Size Reset Button ------ */ + wbutton = gtk_button_new_with_label (_("Reset image size")); + gtk_box_pack_start (GTK_BOX (wvbox), wbutton, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (wbutton), "clicked", + GTK_SIGNAL_FUNC (size_reset_cb), + GTK_OBJECT (dialog)); + + /*-----------------------------------------------------------------*/ + /* Run dialog, and update state of object if "Applied." */ + /*-----------------------------------------------------------------*/ + gtk_widget_show_all (GTK_WIDGET (dialog)); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the dialog has changed. */ +/*---------------------------------------------------------------------------*/ +static void +changed_cb (glPropertyBox * propertybox) +{ + gl_property_box_changed (propertybox); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Callback to reset size to original image size. */ +/*---------------------------------------------------------------------------*/ +static void +size_reset_cb (glPropertyBox * propertybox) +{ + PropertyDialogPassback *data = NULL; + glDisplay *display; + gchar *filename, *ext; + GdkPixbuf *image; + gdouble image_w, image_h; + + data = gtk_object_get_data (GTK_OBJECT (propertybox), "data"); + + display = gtk_object_get_data (GTK_OBJECT (data->item), "display"); + + filename = + gnome_pixmap_entry_get_filename (GNOME_PIXMAP_ENTRY + (data->pixmap_entry)); + if (filename != NULL) { + ext = strrchr (filename, '.'); + if (g_strcasecmp (ext, ".tga") != 0) { + image = gdk_pixbuf_new_from_file (filename); + } else { + gnome_error_dialog (_ + ("Image format not currently supported")); + return; + } + } else { + return; + } + image_w = gdk_pixbuf_get_width (image); + image_h = gdk_pixbuf_get_height (image); + gdk_pixbuf_unref (image); + + data->keep_aspect_ratio_flag = TRUE; + + gl_prop_size_set_params (GL_PROP_SIZE (data->size), + image_w, image_h, + data->keep_aspect_ratio_flag, + display->label->width, display->label->height); + + gl_property_box_changed (propertybox); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Apply" callback. */ +/*---------------------------------------------------------------------------*/ +static void +apply_cb (glPropertyBox * propertybox, + gint page, + PropertyDialogPassback * data) +{ + glLabelObject *object; + glDisplay *display; + gchar *filename, *ext; + gdouble image_w, image_h; + + object = gtk_object_get_data (GTK_OBJECT (data->item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (data->item), "display"); + + switch (page) { + + case 0: + /* ------ Update image ------ */ + filename = + gnome_pixmap_entry_get_filename (GNOME_PIXMAP_ENTRY + (data->pixmap_entry)); + if (filename != NULL) { + ext = strrchr (filename, '.'); + if (g_strcasecmp (ext, ".tga") != 0) { + + g_free (object->arg.image.filename); + object->arg.image.filename = filename; + gdk_pixbuf_unref (object->arg.image.image); + object->arg.image.image = + gdk_pixbuf_new_from_file (object->arg.image. + filename); + + /* save state of image entry. */ + if (image_path != NULL) + g_free (image_path); + image_path = g_dirname (filename); + if (image_path != NULL) { + image_path = + g_strconcat (image_path, "/", NULL); + } + + } else { + gnome_error_dialog (_ + ("Image format not currently supported")); + } + } + break; + + case 1: + /* ------ get updated position ------ */ + gl_prop_position_get_position (GL_PROP_POSITION + (data->position), &object->x, + &object->y); + + /* ------ get updated size ------ */ + gl_prop_size_get_size (GL_PROP_SIZE (data->size), + &object->arg.image.w, + &object->arg.image.h, + &data->keep_aspect_ratio_flag); + break; + + default: + return; + } + + /* ------ Udate state of object ------ */ + item_image_update (data->item); + gl_display_select_item (display, data->item); + + /* update size controls */ + image_w = gdk_pixbuf_get_width (object->arg.image.image); + image_h = gdk_pixbuf_get_height (object->arg.image.image); + gl_prop_size_set_params (GL_PROP_SIZE (data->size), + object->arg.image.w, object->arg.image.h, + data->keep_aspect_ratio_flag, + display->label->width, display->label->height); +} + +/****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/****************************************************************************/ +GdkCursor * +gl_item_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 }; + + 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); + } + + return cursor; +} + +/****************************************************************************/ +/* Canvas event handler (image mode) */ +/****************************************************************************/ +gint +gl_item_image_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glLabelObject *object; + glDisplay *display = GL_DISPLAY (data); + gdouble x, y; + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (display->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_object_new (display->label, + GL_LABEL_OBJECT_IMAGE); + object->x = x; + object->y = y; + object->arg.image.w = 1.0; + object->arg.image.h = 1.0; + object->arg.image.image = NULL; + object->arg.image.filename = NULL; + item = gl_item_image_new (object, display); + 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 + 24.0; + y = y0 + 24.0; + } + object->x = MIN (x, x0); + object->y = MIN (y, y0); + object->arg.image.w = MAX (x, x0) - MIN (x, x0); + object->arg.image.h = MAX (y, y0) - MIN (y, y0); + item_image_update (item); + gl_display_add_item (display, item); + gl_display_unselect_all (display); + gl_display_select_item (display, item); + gl_display_arrow_mode (display); + 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); + object->x = MIN (x, x0); + object->y = MIN (y, y0); + object->arg.image.w = MAX (x, x0) - MIN (x, x0); + object->arg.image.h = MAX (y, y0) - MIN (y, y0); + item_image_update (item); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels1/src/item_image.h b/glabels1/src/item_image.h new file mode 100644 index 00000000..674a9c0f --- /dev/null +++ b/glabels1/src/item_image.h @@ -0,0 +1,60 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_image.h: GLabels Image Object (canvas item) module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __ITEM_IMAGE_H__ +#define __ITEM_IMAGE_H__ + +#include + +#include "label.h" + +extern GnomeCanvasItem *gl_item_image_new (glLabelObject * object, + glDisplay * display); + +extern void gl_item_image_highlight (GnomeCanvasItem * item); + +extern void gl_item_image_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h); + +extern void gl_item_image_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h); + +extern void gl_item_image_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2); + +extern void gl_item_image_edit_dialog (GnomeCanvasItem * item); + +extern GdkCursor *gl_item_image_get_create_cursor (void); + +extern gint gl_item_image_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data); + +#endif diff --git a/glabels1/src/item_line.c b/glabels1/src/item_line.c new file mode 100644 index 00000000..daf30ec8 --- /dev/null +++ b/glabels1/src/item_line.c @@ -0,0 +1,481 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_line.c: GLabels Line Object (canvas item) module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include + +#include "display.h" +#include "item_line.h" + +#include "highlight.h" + +#include "mdi.h" +#include "propertybox.h" +#include "prop_line.h" +#include "prop_position.h" +#include "prop_vector.h" + +#include "pixmaps/cursor_line.xbm" +#include "pixmaps/cursor_line_mask.xbm" + +#include "debug.h" + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +typedef struct { + GnomeCanvasItem *item; + + /* Page 0 widgets */ + GtkWidget *line; + + /* Page 1 widgets */ + GtkWidget *position; + GtkWidget *vector; +} PropertyDialogPassback; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void item_line_update (GnomeCanvasItem * item); + +static void changed_cb (glPropertyBox * propertybox); +static void apply_cb (glPropertyBox * propertybox, + gint page, PropertyDialogPassback * data); + +/****************************************************************************/ +/* Create a line object */ +/****************************************************************************/ +GnomeCanvasItem * +gl_item_line_new (glLabelObject * object, + glDisplay * display) +{ + GnomeCanvasGroup *group; + GnomeCanvasItem *item; + GnomeCanvasPoints *points; + + points = gnome_canvas_points_new (2); + points->coords[0] = object->x; + points->coords[1] = object->y; + points->coords[2] = object->x + object->arg.line.dx; + points->coords[3] = object->y + object->arg.line.dy; + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + item = gnome_canvas_item_new (group, gnome_canvas_line_get_type (), + "points", points, + "width_units", + object->arg.line.line_width, + "fill_color_rgba", + object->arg.line.line_color, NULL); + + gnome_canvas_points_free (points); + + /* Squirrel away pointers to object and display in the canvas item. */ + gtk_object_set_data (GTK_OBJECT (item), "label_object", object); + gtk_object_set_data (GTK_OBJECT (item), "display", display); + gtk_object_set_data (GTK_OBJECT (item), "highlight", NULL); + + gtk_signal_connect (GTK_OBJECT (item), "event", + GTK_SIGNAL_FUNC (gl_display_item_event_handler), + display); + + gl_display_new_item_menu (item); + + gl_display_set_modified (display); + + return item; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update a line object */ +/*--------------------------------------------------------------------------*/ +static void +item_line_update (GnomeCanvasItem * item) +{ + glLabelObject *object; + glDisplay *display; + GnomeCanvasPoints *points; + gdouble affine[6]; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + points = gnome_canvas_points_new (2); + points->coords[0] = object->x; + points->coords[1] = object->y; + points->coords[2] = object->x + object->arg.line.dx; + points->coords[3] = object->y + object->arg.line.dy; + + art_affine_identity (affine); + gnome_canvas_item_affine_absolute (item, affine); + gnome_canvas_item_set (item, + "points", points, + "width_units", object->arg.line.line_width, + "fill_color_rgba", object->arg.line.line_color, + NULL); + + gnome_canvas_points_free (points); + + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + gl_display_set_modified (display); +} + +/****************************************************************************/ +/* Create a selection canvas item/group for given item */ +/****************************************************************************/ +void +gl_item_line_highlight (GnomeCanvasItem * item) +{ + gl_highlight (item, GL_HIGHLIGHT_LINE_RESIZABLE); +} + +/****************************************************************************/ +/* Get position and size of object. */ +/****************************************************************************/ +void +gl_item_line_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + *x = object->x; + *y = object->y; + + *w = object->arg.line.dx; + *h = object->arg.line.dy; +} + +/****************************************************************************/ +/* Get position and size of object. */ +/****************************************************************************/ +void +gl_item_line_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + object->x = x; + object->y = y; + + object->arg.line.dx = w; + object->arg.line.dy = h; + + item_line_update (item); +} + +/****************************************************************************/ +/* Get line item bounds. */ +/****************************************************************************/ +void +gl_item_line_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2) +{ + gnome_canvas_item_get_bounds (item, x1, y1, x2, y2); +} + +/****************************************************************************/ +/* Create and run an edit dialog on a line object. */ +/****************************************************************************/ +void +gl_item_line_edit_dialog (GnomeCanvasItem * item) +{ + GtkWidget *dialog; + static PropertyDialogPassback *data = NULL; + glLabelObject *object; + glDisplay *display; + GtkWidget *wvbox; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + data->item = item; + + dialog = gl_property_box_new (); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (gl_mdi_get_active_window ())); + gtk_window_set_title (GTK_WINDOW (dialog), + _("Edit line object properties")); + gtk_signal_connect (GTK_OBJECT (dialog), "apply", + GTK_SIGNAL_FUNC (apply_cb), data); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Begin Line box ------ */ + data->line = gl_prop_line_new (_("Line")); + gl_prop_line_set_params (GL_PROP_LINE (data->line), + object->arg.line.line_width, + object->arg.line.line_color); + gtk_box_pack_start (GTK_BOX (wvbox), data->line, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->line), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*----------------------------*/ + /* Position/Size Notebook Tab */ + /*----------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Position/Size"))); + + /* ------ Position Frame ------ */ + data->position = gl_prop_position_new (_("Position")); + gl_prop_position_set_params (GL_PROP_POSITION (data->position), + object->x, object->y, + display->label->width, + display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->position, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->position), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /* ------ Size Frame ------ */ + data->vector = gl_prop_vector_new (_("Size")); + gl_prop_vector_set_params (GL_PROP_VECTOR (data->vector), + object->arg.line.dx, object->arg.line.dy, + display->label->width, + display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->vector, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->vector), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*-----------------------------------------------------------------*/ + /* Run dialog, and update state of object if "Applied." */ + /*-----------------------------------------------------------------*/ + gtk_widget_show_all (GTK_WIDGET (dialog)); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the dialog has changed. */ +/*---------------------------------------------------------------------------*/ +static void +changed_cb (glPropertyBox * propertybox) +{ + gl_property_box_changed (propertybox); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Apply" callback. */ +/*---------------------------------------------------------------------------*/ +static void +apply_cb (glPropertyBox * propertybox, + gint page, + PropertyDialogPassback * data) +{ + glLabelObject *object; + glDisplay *display; + + object = gtk_object_get_data (GTK_OBJECT (data->item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (data->item), "display"); + + switch (page) { + + case 0: + /* ------- Get updated line width & color ------ */ + gl_prop_line_get_params (GL_PROP_LINE (data->line), + &object->arg.line.line_width, + &object->arg.line.line_color); + break; + + case 1: + /* ------ get updated position ------ */ + gl_prop_position_get_position (GL_PROP_POSITION + (data->position), &object->x, + &object->y); + /* ------ get updated size ------ */ + gl_prop_vector_get_params (GL_PROP_VECTOR (data->vector), + &object->arg.line.dx, + &object->arg.line.dy); + break; + + default: + return; + } + + /* ------ Udate state of object ------ */ + item_line_update (data->item); + gl_display_select_item (display, data->item); + +} + +/****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/****************************************************************************/ +GdkCursor * +gl_item_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 }; + + 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); + } + + return cursor; +} + +/****************************************************************************/ +/* Canvas event handler (line mode) */ +/****************************************************************************/ +gint +gl_item_line_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + static gdouble x0, y0; + static gboolean dragging = FALSE; + static GnomeCanvasItem *item; + static glLabelObject *object; + glDisplay *display = GL_DISPLAY (data); + gdouble x, y; + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + dragging = TRUE; + gdk_pointer_grab (GTK_WIDGET (display->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_object_new (display->label, + GL_LABEL_OBJECT_LINE); + object->x = x; + object->y = y; + object->arg.line.dx = 0.0; + object->arg.line.dy = 0.0; + object->arg.line.line_width = 1.0; + object->arg.line.line_color = + GNOME_CANVAS_COLOR_A (0, 0, 255, 128); + item = gl_item_line_new (object, display); + 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; + } + object->x = x0; + object->y = y0; + object->arg.line.dx = (x - x0); + object->arg.line.dy = (y - y0); + object->arg.line.line_color = + GNOME_CANVAS_COLOR (0, 0, 0); + item_line_update (item); + gl_display_add_item (display, item); + gl_display_unselect_all (display); + gl_display_select_item (display, item); + gl_display_arrow_mode (display); + 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); + object->x = x0; + object->y = y0; + object->arg.line.dx = (x - x0); + object->arg.line.dy = (y - y0); + item_line_update (item); + return TRUE; + } else { + return FALSE; + } + + default: + return FALSE; + } + +} diff --git a/glabels1/src/item_line.h b/glabels1/src/item_line.h new file mode 100644 index 00000000..3bb48fe8 --- /dev/null +++ b/glabels1/src/item_line.h @@ -0,0 +1,60 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_line.h: GLabels Line Object (canvas item) module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __ITEM_LINE_H__ +#define __ITEM_LINE_H__ + +#include + +#include "label.h" + +extern GnomeCanvasItem *gl_item_line_new (glLabelObject * object, + glDisplay * display); + +extern void gl_item_line_highlight (GnomeCanvasItem * item); + +extern void gl_item_line_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h); + +extern void gl_item_line_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h); + +extern void gl_item_line_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2); + +extern void gl_item_line_edit_dialog (GnomeCanvasItem * item); + +extern GdkCursor *gl_item_line_get_create_cursor (void); + +extern gint gl_item_line_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data); + +#endif diff --git a/glabels1/src/item_text.c b/glabels1/src/item_text.c new file mode 100644 index 00000000..0a0172af --- /dev/null +++ b/glabels1/src/item_text.c @@ -0,0 +1,780 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_text.c: GLabels Text Object (canvas item) module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "display.h" +#include "item_text.h" + +#include "highlight.h" + +#include "mdi.h" +#include "propertybox.h" +#include "prop_text_entry.h" +#include "prop_text.h" +#include "prop_position.h" + +#include "pixmaps/cursor_text.xbm" +#include "pixmaps/cursor_text_mask.xbm" + +#ifdef HACKTEXT +#include "gnome-canvas-hacktext.h" +#include +#include "hack.h" +#endif + +#include "debug.h" + +#define DEFAULT_FONT_FAMILY "Helvetica" +#define DEFAULT_FONT_SIZE 14.0 +#define DEFAULT_FONT_WEIGHT GNOME_FONT_BOOK +#define DEFAULT_FONT_ITALIC_FLAG FALSE + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +typedef struct { + GnomeCanvasItem *item; + + /* Page 0 widgets */ + GtkWidget *text_entry; + + /* Page 1 widgets */ + GtkWidget *text; + + /* Page 2 widgets */ + GtkWidget *position; +} PropertyDialogPassback; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void item_text_update (GnomeCanvasItem * item); + +static void changed_cb (glPropertyBox * propertybox); +static void apply_cb (glPropertyBox * propertybox, + gint page, PropertyDialogPassback * data); + +#ifdef HACKTEXT +static void draw_hacktext (GnomeCanvasItem * group, + gchar * text, + gchar * font_family, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + gdouble font_size, + guint color, + GtkJustification just, + gdouble scale); + +static void hacktext_get_size (gchar * text, + gchar * font_family, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + gdouble font_size, + gdouble * w, + gdouble * h); +#endif + +/****************************************************************************/ +/* Create a text object */ +/****************************************************************************/ +GnomeCanvasItem * +gl_item_text_new (glLabelObject * object, + glDisplay * display) +{ + GnomeCanvasGroup *group; + GnomeCanvasItem *item; +#ifndef HACKTEXT + GdkFont *gdk_font; + GnomeDisplayFont *display_font; + GtkAnchorType anchor; +#endif + gchar *text; + + text = gl_text_node_lines_expand (object->arg.text.lines, NULL); + +#ifdef HACKTEXT + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + item = gnome_canvas_item_new (group, gnome_canvas_group_get_type (), + "x", object->x, "y", object->y, NULL); + draw_hacktext (item, + text, + object->arg.text.font_family, + object->arg.text.font_weight, + object->arg.text.font_italic_flag, + object->arg.text.font_size, + object->arg.text.color, + object->arg.text.just, display->scale); + +#else + + display_font = gnome_get_display_font (object->arg.text.font_family, + object->arg.text.font_weight, + object->arg.text. + font_italic_flag, + object->arg.text.font_size, + display->scale); + gdk_font = gnome_display_font_get_gdk_font (display_font); + + switch (object->arg.text.just) { + case GTK_JUSTIFY_LEFT: + anchor = GTK_ANCHOR_NW; + break; + case GTK_JUSTIFY_CENTER: + anchor = GTK_ANCHOR_N; + break; + case GTK_JUSTIFY_RIGHT: + anchor = GTK_ANCHOR_NE; + break; + default: + anchor = GTK_ANCHOR_NW; + break; + } + + group = gnome_canvas_root (GNOME_CANVAS (display->canvas)); + item = gnome_canvas_item_new (group, gnome_canvas_text_get_type (), + "x", object->x, + "y", object->y, + "text", g_strdup (text), + "font_gdk", gdk_font, + "justification", object->arg.text.just, + "anchor", anchor, + "fill_color_rgba", object->arg.text.color, + NULL); + +#endif + + /* Squirrel away pointers to object and display in the canvas item. */ + gtk_object_set_data (GTK_OBJECT (item), "label_object", object); + gtk_object_set_data (GTK_OBJECT (item), "display", display); + gtk_object_set_data (GTK_OBJECT (item), "highlight", NULL); + + gtk_signal_connect (GTK_OBJECT (item), "event", + GTK_SIGNAL_FUNC (gl_display_item_event_handler), + display); + + gl_display_new_item_menu (item); + + gl_display_set_modified (display); + + g_free (text); + return item; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Update a text object */ +/*--------------------------------------------------------------------------*/ +static void +item_text_update (GnomeCanvasItem * item) +{ + glLabelObject *object; + glDisplay *display; + gdouble affine[6]; +#ifdef HACKTEXT + GList *item_list, *li; +#else + GdkFont *gdk_font; + GnomeDisplayFont *display_font; + GtkAnchorType anchor; +#endif + gchar *text; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + + text = gl_text_node_lines_expand (object->arg.text.lines, NULL); + +#ifdef HACKTEXT + + item_list = gtk_object_get_data (GTK_OBJECT (item), "item_list"); + for (li = item_list; li != NULL; li = li->next) { + gtk_object_destroy (GTK_OBJECT (li->data)); + } + g_list_free (item_list); + gtk_object_set_data (GTK_OBJECT (item), "item_list", NULL); + + draw_hacktext (item, + text, + object->arg.text.font_family, + object->arg.text.font_weight, + object->arg.text.font_italic_flag, + object->arg.text.font_size, + object->arg.text.color, + object->arg.text.just, display->scale); + + art_affine_identity (affine); + gnome_canvas_item_affine_absolute (item, affine); + gnome_canvas_item_set (item, "x", object->x, "y", object->y, NULL); + +#else + + display_font = gnome_get_display_font (object->arg.text.font_family, + object->arg.text.font_weight, + object->arg.text. + font_italic_flag, + object->arg.text.font_size, + display->scale); + gdk_font = gnome_display_font_get_gdk_font (display_font); + + switch (object->arg.text.just) { + case GTK_JUSTIFY_LEFT: + anchor = GTK_ANCHOR_NW; + break; + case GTK_JUSTIFY_CENTER: + anchor = GTK_ANCHOR_N; + break; + case GTK_JUSTIFY_RIGHT: + anchor = GTK_ANCHOR_NE; + break; + default: + anchor = GTK_ANCHOR_NW; + break; + } + + art_affine_identity (affine); + gnome_canvas_item_affine_absolute (item, affine); + gnome_canvas_item_set (item, + "x", object->x, + "y", object->y, + "text", g_strdup (text), + "font_gdk", gdk_font, + "justification", object->arg.text.just, + "anchor", anchor, + "fill_color_rgba", object->arg.text.color, NULL); + +#endif + + g_free (text); + + gl_display_set_modified (display); +} + +/****************************************************************************/ +/* Highlight item. */ +/****************************************************************************/ +void +gl_item_text_highlight (GnomeCanvasItem * item) +{ + gl_highlight (item, GL_HIGHLIGHT_SIMPLE); +} + +/****************************************************************************/ +/* Get position and size of object. */ +/****************************************************************************/ +void +gl_item_text_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h) +{ + glLabelObject *object; +#ifndef HACKTEXT + GtkArg arg_info; + gdouble x1, y1, x2, y2; +#else + gchar *text; +#endif + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + *x = object->x; + *y = object->y; + +#ifdef HACKTEXT + text = gl_text_node_lines_expand (object->arg.text.lines, NULL); + + hacktext_get_size (text, + object->arg.text.font_family, + object->arg.text.font_weight, + object->arg.text.font_italic_flag, + object->arg.text.font_size, w, h); + + g_free (text); +#else + + gnome_canvas_item_get_bounds (item, &x1, &y1, &x2, &y2); + *h = y2 - y1; + + /* workaround: the above bounding box is too wide, correct the width. */ + arg_info.name = "text_width"; + gtk_object_getv (GTK_OBJECT (item), 1, &arg_info); + *w = GTK_VALUE_DOUBLE (arg_info); + +#endif +} + +/****************************************************************************/ +/* Get position and size of object. */ +/****************************************************************************/ +void +gl_item_text_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h) +{ + glLabelObject *object; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + object->x = x; + object->y = y; + + /* Ignore w,h for now */ + + item_text_update (item); +} + +/****************************************************************************/ +/* Get text item bounds. */ +/****************************************************************************/ +void +gl_item_text_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2) +{ +#ifdef HACKTEXT + + glLabelObject *object; + gdouble w, h, x_offset, y_offset; + gchar *text; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + + text = gl_text_node_lines_expand (object->arg.text.lines, NULL); + + hacktext_get_size (text, + object->arg.text.font_family, + object->arg.text.font_weight, + object->arg.text.font_italic_flag, + object->arg.text.font_size, &w, &h); + + g_free (text); + + switch (object->arg.text.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 = 0.0; + + *x1 = object->x + x_offset; + *y1 = object->y + y_offset; + *x2 = *x1 + w; + *y2 = *y1 + h; + +#else + + GtkArg arg_info; + + gnome_canvas_item_get_bounds (item, x1, y1, x2, y2); + + /* workaround: the above bounding box is too wide, correct the width. */ + arg_info.name = "text_width"; + gtk_object_getv (GTK_OBJECT (item), 1, &arg_info); + *x2 = *x1 + GTK_VALUE_DOUBLE (arg_info); + +#endif + +} + +/****************************************************************************/ +/* Create and run an edit dialog on a text object. */ +/****************************************************************************/ +void +gl_item_text_edit_dialog (GnomeCanvasItem * item) +{ + GtkWidget *dialog; + static PropertyDialogPassback *data = NULL; + glLabelObject *object; + glDisplay *display; + GtkWidget *wvbox; + + object = gtk_object_get_data (GTK_OBJECT (item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (item), "display"); + + /*-----------------------------------------------------------------*/ + /* Build dialog with notebook. */ + /*-----------------------------------------------------------------*/ + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + data->item = item; + + dialog = gl_property_box_new (); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (gl_mdi_get_active_window ())); + gtk_window_set_title (GTK_WINDOW (dialog), + _("Edit text object properties")); + gtk_signal_connect (GTK_OBJECT (dialog), "apply", + GTK_SIGNAL_FUNC (apply_cb), data); + + /*---------------------------*/ + /* Text Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Text"))); + + /* Text entry widget */ + data->text_entry = + gl_prop_text_entry_new (_("Text"), object->parent->merge_fields); + gl_prop_text_entry_set_text (GL_PROP_TEXT_ENTRY (data->text_entry), + (object->parent->merge_type != + GL_MERGE_NONE), object->arg.text.lines); + gtk_box_pack_start (GTK_BOX (wvbox), data->text_entry, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->text_entry), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*---------------------------*/ + /* Appearance Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Appearance"))); + + /* ------ Begin Text Properties box ------ */ + data->text = gl_prop_text_new (_("Text Properties")); + gl_prop_text_set_params (GL_PROP_TEXT (data->text), + object->arg.text.font_family, + object->arg.text.font_size, + object->arg.text.font_weight, + object->arg.text.font_italic_flag, + object->arg.text.color, object->arg.text.just); + gtk_box_pack_start (GTK_BOX (wvbox), data->text, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->text), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*---------------------------*/ + /* Position Notebook Tab */ + /*---------------------------*/ + wvbox = gtk_vbox_new (FALSE, GNOME_PAD); + gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, + gtk_label_new (_("Position"))); + + /* ------ Position Frame ------ */ + data->position = gl_prop_position_new (_("Position")); + gl_prop_position_set_params (GL_PROP_POSITION (data->position), + object->x, object->y, + display->label->width, + display->label->height); + gtk_box_pack_start (GTK_BOX (wvbox), data->position, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (data->position), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (dialog)); + + /*-----------------------------------------------------------------*/ + /* Run dialog, and update state of object if "Applied." */ + /*-----------------------------------------------------------------*/ + gtk_widget_show_all (GTK_WIDGET (dialog)); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the dialog has changed. */ +/*---------------------------------------------------------------------------*/ +static void +changed_cb (glPropertyBox * propertybox) +{ + gl_property_box_changed (propertybox); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. "Apply" callback. */ +/*---------------------------------------------------------------------------*/ +static void +apply_cb (glPropertyBox * propertybox, + gint page, + PropertyDialogPassback * data) +{ + glLabelObject *object; + glDisplay *display; + + object = gtk_object_get_data (GTK_OBJECT (data->item), "label_object"); + display = gtk_object_get_data (GTK_OBJECT (data->item), "display"); + + switch (page) { + + case 0: + /* ------- Get updated text ------ */ + gl_text_node_lines_free (&object->arg.text.lines); + object->arg.text.lines = + gl_prop_text_entry_get_text (GL_PROP_TEXT_ENTRY + (data->text_entry)); + break; + + case 1: + /* ------ Get updated text parameter information ------ */ + gl_prop_text_get_params (GL_PROP_TEXT (data->text), + &object->arg.text.font_family, + &object->arg.text.font_size, + &object->arg.text.font_weight, + &object->arg.text.font_italic_flag, + &object->arg.text.color, + &object->arg.text.just); + break; + + case 2: + /* ------ get updated position ------ */ + gl_prop_position_get_position (GL_PROP_POSITION + (data->position), &object->x, + &object->y); + break; + + default: + return; + } + + /* ------ Udate state of object ------ */ + item_text_update (data->item); + gl_display_select_item (display, data->item); + +} + +/****************************************************************************/ +/* Return apropos cursor for create object mode. */ +/****************************************************************************/ +GdkCursor * +gl_item_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 }; + + 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); + } + + return cursor; +} + +/****************************************************************************/ +/* Canvas event handler (text mode) */ +/****************************************************************************/ +gint +gl_item_text_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + glDisplay *display = GL_DISPLAY (data); + gdouble x, y; + glLabelObject *object; + GnomeCanvasItem *item; + + switch (event->type) { + + case GDK_BUTTON_PRESS: + switch (event->button.button) { + case 1: + gnome_canvas_window_to_world (canvas, + event->button.x, + event->button.y, &x, &y); + object = + gl_label_object_new (display->label, + GL_LABEL_OBJECT_TEXT); + object->x = x; + object->y = y; + object->arg.text.lines = + gl_text_node_lines_new_from_text (_("Text")); + object->arg.text.font_family = + g_strdup (DEFAULT_FONT_FAMILY); + object->arg.text.font_size = DEFAULT_FONT_SIZE; + object->arg.text.font_weight = DEFAULT_FONT_WEIGHT; + object->arg.text.font_italic_flag = + DEFAULT_FONT_ITALIC_FLAG; + object->arg.text.just = GTK_JUSTIFY_LEFT; + object->arg.text.color = GNOME_CANVAS_COLOR (0, 0, 0); + item = gl_item_text_new (object, display); + gl_display_add_item (display, item); + gl_display_unselect_all (display); + gl_display_select_item (display, item); + gl_display_arrow_mode (display); + return TRUE; + + default: + return FALSE; + } + + default: + return FALSE; + } + +} + +#ifdef HACKTEXT +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw hacktext to item (group). */ +/*--------------------------------------------------------------------------*/ +static void +draw_hacktext (GnomeCanvasItem * group, + gchar * text, + gchar * font_family, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + gdouble font_size, + guint color, + GtkJustification just, + gdouble scale) +{ + GnomeFont *font; + GnomeGlyphList *glyphlist; + gdouble x_offset, y_offset; + gint i; + gdouble w; + gchar **line, *utf8_text; + GnomeCanvasItem *item; + GList *item_list = NULL; + + font = gnome_font_new_closest (font_family, + font_weight, + font_italic_flag, font_size); + + line = g_strsplit (text, "\n", -1); + + for (i = 0; line[i] != NULL; i++) { + + utf8_text = gl_hack_text_to_utf8 (line[i]); + + w = gl_hack_get_width_string (font, line[i]); + + glyphlist = gnome_glyphlist_from_text_sized_dumb (font, + color, + 0.0, 0.0, + utf8_text, + strlen + (utf8_text)); + 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); + + item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (group), + gnome_canvas_hacktext_get_type (), + "x", x_offset, + "y", y_offset, + "glyphlist", glyphlist, NULL); + item_list = g_list_prepend (item_list, item); + + g_free (utf8_text); + } + + g_strfreev (line); + + /* attach item list to group, so we can get at these again */ + gtk_object_set_data (GTK_OBJECT (group), "item_list", item_list); +} +#endif + +#ifdef HACKTEXT +/*--------------------------------------------------------------------------*/ +/* PRIVATE. get size of hacktext item. */ +/*--------------------------------------------------------------------------*/ +static void +hacktext_get_size (gchar * text, + gchar * font_family, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + gdouble font_size, + gdouble * w, + gdouble * h) +{ + GnomeFont *font; + gchar **line; + gdouble wline; + gint i; + + *w = 0.0; + *h = 0.0; + + font = gnome_font_new_closest (font_family, + font_weight, + font_italic_flag, font_size); + + line = g_strsplit (text, "\n", -1); + + for (i = 0; line[i] != NULL; i++) { + + wline = gl_hack_get_width_string (font, line[i]); + + if (wline > *w) + *w = wline; + *h += font_size; + + } + + g_strfreev (line); + +} +#endif diff --git a/glabels1/src/item_text.h b/glabels1/src/item_text.h new file mode 100644 index 00000000..091e0628 --- /dev/null +++ b/glabels1/src/item_text.h @@ -0,0 +1,60 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * item_text.h: GLabels Text Object (canvas item) module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __ITEM_TEXT_H__ +#define __ITEM_TEXT_H__ + +#include + +#include "label.h" + +extern GnomeCanvasItem *gl_item_text_new (glLabelObject * object, + glDisplay * display); + +extern void gl_item_text_highlight (GnomeCanvasItem * item); + +extern void gl_item_text_get_position_size (GnomeCanvasItem * item, + gdouble * x, + gdouble * y, + gdouble * w, + gdouble * h); + +extern void gl_item_text_set_position_size (GnomeCanvasItem * item, + gdouble x, + gdouble y, + gdouble w, + gdouble h); + +extern void gl_item_text_get_bounds (GnomeCanvasItem * item, + gdouble * x1, + gdouble * y1, + gdouble * x2, + gdouble * y2); + +extern void gl_item_text_edit_dialog (GnomeCanvasItem * item); + +extern GdkCursor *gl_item_text_get_create_cursor (void); + +extern gint gl_item_text_create_event_handler (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data); + +#endif diff --git a/glabels1/src/label.c b/glabels1/src/label.c new file mode 100644 index 00000000..73d3ab3e --- /dev/null +++ b/glabels1/src/label.c @@ -0,0 +1,1210 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.c: GLabels label module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +/* LibXML */ +#include +#include + +#include "label.h" +#include "template.h" + +#include "debug.h" + +#define NAME_SPACE "http://snaught.com/glabels/0.4/" +#define COMPAT01_NAME_SPACE "http://snaught.com/glabels/0.1/" + +static glLabelStatus xml_doc_to_label (xmlDocPtr doc, glLabel ** label); +static gboolean xml_parse_media_description (xmlNodePtr node, glLabel * label); +static void xml_parse_object(xmlNodePtr node, glLabelObject * object, + gboolean compat01_flag); +static void xml_parse_text_props (xmlNodePtr node, glLabelObject * object); +static void xml_parse_text_props_compat01( xmlNodePtr node, + glLabelObject *object ); +static void xml_parse_box_props (xmlNodePtr node, glLabelObject * object); +static void xml_parse_line_props (xmlNodePtr node, glLabelObject * object); +static void xml_parse_ellipse_props (xmlNodePtr node, glLabelObject * object); +static void xml_parse_image_props (xmlNodePtr node, glLabelObject * object); +static void xml_parse_barcode_props (xmlNodePtr node, glLabelObject * object); +static void xml_parse_merge_properties (xmlNodePtr node, glLabel * label); + +static glLabelStatus xml_label_to_doc (glLabel * label, xmlDocPtr * doc); +static void xml_create_media_description (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_properties (xmlNodePtr root, xmlNsPtr ns, + glLabel * label); + +static const gchar *just_to_text (GtkJustification just); +static GtkJustification text_to_just (const gchar * text); + +static const gchar *weight_to_text (GnomeFontWeight weight); +static GnomeFontWeight text_to_weight (const gchar * text); + +/****************************************************************************/ +/* Create a new label. */ +/****************************************************************************/ +glLabel * +gl_label_new (void) +{ + glLabel *label; + + label = g_new0 (glLabel, 1); + + return label; +} + +/****************************************************************************/ +/* Create a new label. */ +/****************************************************************************/ +glLabel * +gl_label_new_with_template (const gchar * tmplt_name, + gboolean rotate_flag) +{ + glLabel *label; + glTemplate *template; + + label = gl_label_new (); + + label->template_name = g_strdup (tmplt_name); + label->template = template = gl_template_from_name (tmplt_name); + label->rotate_flag = rotate_flag; + + switch (template->style) { + + case GL_TEMPLATE_STYLE_RECT: + if (!rotate_flag) { + label->width = template->label_width; + label->height = template->label_height; + } else { + label->width = template->label_height; + label->height = template->label_width; + } + break; + + case GL_TEMPLATE_STYLE_ROUND: + case GL_TEMPLATE_STYLE_CD: + label->width = label->height = 2.0 * template->label_radius; + break; + + default: + WARN ("Unknown template label style"); + break; + } + + label->objects = NULL; + + return label; +} + +/****************************************************************************/ +/* Free a previously allocated label. */ +/****************************************************************************/ +void +gl_label_free (glLabel ** label) +{ + GList *p, *p_next; + glLabelObject *object; + + if (*label != NULL) { + g_free ((*label)->template_name); + (*label)->template_name = NULL; + + gl_template_free (&(*label)->template); + + for (p = (*label)->objects; p != NULL; p = p_next) { + p_next = p->next; /* NOTE: p will be left dangling */ + object = (glLabelObject *) p->data; + gl_label_object_free (&object); + } + + g_free (*label); + *label = NULL; + } +} + +/****************************************************************************/ +/* Open and read label from xml file. */ +/****************************************************************************/ +glLabelStatus +gl_label_open_xml (glLabel ** label, + const gchar * filename) +{ + xmlDocPtr doc; + glLabelStatus status; + + doc = xmlParseFile (filename); + if (!doc) { + WARN (_("xmlParseFile error")); + *label = NULL; + return LABEL_ERROR_OPEN_XML_PARSE; + } + + status = xml_doc_to_label (doc, label); + + xmlFreeDoc (doc); + + return status; +} + +/****************************************************************************/ +/* Read label from xml buffer. */ +/****************************************************************************/ +glLabelStatus +gl_label_open_xml_buffer (glLabel ** label, + const gchar * buffer) +{ + xmlDocPtr doc; + glLabelStatus status; + + doc = xmlParseDoc ((xmlChar *) buffer); + if (!doc) { + WARN (_("xmlParseFile error")); + *label = NULL; + return LABEL_ERROR_OPEN_XML_PARSE; + } + + status = xml_doc_to_label (doc, label); + + xmlFreeDoc (doc); + + return status; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse xml doc structure and create label. */ +/*--------------------------------------------------------------------------*/ +static glLabelStatus +xml_doc_to_label (xmlDocPtr doc, + glLabel ** label) +{ + xmlNodePtr root, node; + xmlNsPtr ns; + glLabelObject *object; + glLabelStatus status = LABEL_OK; + gboolean compat01_flag = FALSE; + + LIBXML_TEST_VERSION; + + gl_label_free (label); + + root = xmlDocGetRootElement (doc); + if (!root || !root->name) { + WARN (_("No document root")); + return LABEL_ERROR_OPEN_XML_PARSE; + } + ns = xmlSearchNsByHref (doc, root, NAME_SPACE); + if (ns == NULL) { + /* Try compatability mode */ + ns = xmlSearchNsByHref (doc, root, COMPAT01_NAME_SPACE); + if (ns != NULL) compat01_flag = TRUE; + } + if (ns == NULL) { + WARN (_ + ("document of the wrong type, glabels Namespace not found")); + return LABEL_ERROR_OPEN_XML_PARSE; + } + + if (g_strcasecmp (root->name, "Label") != 0) { + WARN (_("Bad root node = \"%s\""), root->name); + return LABEL_ERROR_OPEN_XML_PARSE; + } + + *label = gl_label_new (); + + (*label)->rotate_flag = + !(g_strcasecmp (xmlGetProp (root, "rotate"), "false") == 0); + (*label)->width = g_strtod (xmlGetProp (root, "width"), NULL); + (*label)->height = g_strtod (xmlGetProp (root, "height"), NULL); + + for (node = root->xmlChildrenNode; node != NULL; node = node->next) { + + if (g_strcasecmp (node->name, "Media_Type") == 0) { + if (!xml_parse_media_description (node, *label)) { + status = LABEL_UNKNOWN_MEDIA; + } + } else if (g_strcasecmp (node->name, "Text") == 0) { + object = + gl_label_object_new (*label, GL_LABEL_OBJECT_TEXT); + xml_parse_object (node, object, compat01_flag); + } else if (g_strcasecmp (node->name, "Box") == 0) { + object = + gl_label_object_new (*label, GL_LABEL_OBJECT_BOX); + xml_parse_object (node, object, compat01_flag); + } else if (g_strcasecmp (node->name, "Line") == 0) { + object = + gl_label_object_new (*label, GL_LABEL_OBJECT_LINE); + xml_parse_object (node, object, compat01_flag); + } else if (g_strcasecmp (node->name, "Ellipse") == 0) { + object = + gl_label_object_new (*label, + GL_LABEL_OBJECT_ELLIPSE); + xml_parse_object (node, object, compat01_flag); + } else if (g_strcasecmp (node->name, "Image") == 0) { + object = + gl_label_object_new (*label, GL_LABEL_OBJECT_IMAGE); + xml_parse_object (node, object, compat01_flag); + } else if (g_strcasecmp (node->name, "Barcode") == 0) { + object = + gl_label_object_new (*label, + GL_LABEL_OBJECT_BARCODE); + xml_parse_object (node, object, compat01_flag); + } else if (g_strcasecmp (node->name, "Merge_Properties") == 0) { + xml_parse_merge_properties (node, *label); + } else { + if (!xmlNodeIsText (node)) { + WARN (_("bad node = \"%s\""), node->name); + } + } + } + + return status; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse Media Description node. */ +/*--------------------------------------------------------------------------*/ +static gboolean +xml_parse_media_description (xmlNodePtr node, + glLabel * label) +{ + label->template_name = xmlNodeGetContent (node); + label->template = gl_template_from_name (label->template_name); + if (label->template == NULL) { + WARN ("Undefined template \"%s\"", label->template_name); + /* Get a default */ + label->template = gl_template_from_name (NULL); + return FALSE; + } + return TRUE; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Object Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_object (xmlNodePtr object_node, + glLabelObject * object, + gboolean compat01_flag) +{ + object->x = g_strtod (xmlGetProp (object_node, "x"), NULL); + object->y = g_strtod (xmlGetProp (object_node, "y"), NULL); + + switch (object->type) { + case GL_LABEL_OBJECT_TEXT: + if (compat01_flag) { + xml_parse_text_props_compat01 (object_node, object); + } else { + xml_parse_text_props (object_node, object); + } + break; + case GL_LABEL_OBJECT_BOX: + xml_parse_box_props (object_node, object); + break; + case GL_LABEL_OBJECT_LINE: + xml_parse_line_props (object_node, object); + break; + case GL_LABEL_OBJECT_ELLIPSE: + xml_parse_ellipse_props (object_node, object); + break; + case GL_LABEL_OBJECT_IMAGE: + xml_parse_image_props (object_node, object); + break; + case GL_LABEL_OBJECT_BARCODE: + xml_parse_barcode_props (object_node, object); + break; + default: + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Text Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_text_props (xmlNodePtr object_node, + glLabelObject * object) +{ + xmlNodePtr line_node, text_node; + glTextNode *node_text; + GList *nodes; + + object->arg.text.font_family = xmlGetProp (object_node, "font_family"); + object->arg.text.font_size = + g_strtod (xmlGetProp (object_node, "font_size"), NULL); + object->arg.text.font_weight = + text_to_weight (xmlGetProp (object_node, "font_weight")); + object->arg.text.font_italic_flag = + !(g_strcasecmp (xmlGetProp (object_node, "font_italic"), "false") == + 0); + + object->arg.text.just = + text_to_just (xmlGetProp (object_node, "justify")); + + sscanf (xmlGetProp (object_node, "color"), "%x", + &object->arg.text.color); + + object->arg.text.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 { + WARN ("Unexpected Text Line child: \"%s\"", + text_node->name); + } + + } + object->arg.text.lines = + g_list_append (object->arg.text.lines, nodes); + + } else { + WARN ("Unexpected Text child: \"%s\"", line_node->name); + } + + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML label->Text node (Compatability with 0.1 version) */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_text_props_compat01( xmlNodePtr node, glLabelObject *object ) +{ + gchar *text; + + text = xmlNodeGetContent( node ); + object->arg.text.lines = gl_text_node_lines_new_from_text( text ); + g_free( text ); + + object->arg.text.font_family = xmlGetProp( node, "font_family" ); + object->arg.text.font_size = g_strtod( xmlGetProp( node, "font_size" ), + NULL ); + object->arg.text.font_weight = + text_to_weight( xmlGetProp( node, "font_weight" ) ); + object->arg.text.font_italic_flag = + !( g_strcasecmp( xmlGetProp( node, "font_italic" ), + "false" ) == 0 ); + + object->arg.text.just = text_to_just( xmlGetProp( node, "justify" ) ); + + sscanf( xmlGetProp( node, "color" ), "%x", &object->arg.text.color ); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Box Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_box_props (xmlNodePtr node, + glLabelObject * object) +{ + object->arg.box.w = g_strtod (xmlGetProp (node, "w"), NULL); + object->arg.box.h = g_strtod (xmlGetProp (node, "h"), NULL); + + object->arg.box.line_width = g_strtod (xmlGetProp (node, "line_width"), + NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", + &object->arg.box.line_color); + sscanf (xmlGetProp (node, "fill_color"), "%x", + &object->arg.box.fill_color); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Line Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_line_props (xmlNodePtr node, + glLabelObject * object) +{ + object->arg.line.dx = g_strtod (xmlGetProp (node, "dx"), NULL); + object->arg.line.dy = g_strtod (xmlGetProp (node, "dy"), NULL); + + object->arg.line.line_width = g_strtod (xmlGetProp (node, "line_width"), + NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", + &object->arg.line.line_color); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Ellipse Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_ellipse_props (xmlNodePtr node, + glLabelObject * object) +{ + object->arg.ellipse.w = g_strtod (xmlGetProp (node, "w"), NULL); + object->arg.ellipse.h = g_strtod (xmlGetProp (node, "h"), NULL); + + object->arg.ellipse.line_width = + g_strtod (xmlGetProp (node, "line_width"), NULL); + + sscanf (xmlGetProp (node, "line_color"), "%x", + &object->arg.ellipse.line_color); + sscanf (xmlGetProp (node, "fill_color"), "%x", + &object->arg.ellipse.fill_color); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Image Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_image_props (xmlNodePtr node, + glLabelObject * object) +{ + object->arg.image.w = g_strtod (xmlGetProp (node, "w"), NULL); + object->arg.image.h = g_strtod (xmlGetProp (node, "h"), NULL); + + object->arg.image.filename = xmlGetProp (node, "filename"); + + object->arg.image.image = + gdk_pixbuf_new_from_file (object->arg.image.filename); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Barcode Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_barcode_props (xmlNodePtr node, + glLabelObject * object) +{ + xmlNodePtr child; + + sscanf (xmlGetProp (node, "color"), "%x", &object->arg.barcode.color); + + object->arg.barcode.style = + gl_barcode_text_to_style (xmlGetProp (node, "style")); + + object->arg.barcode.text_flag = + !(g_strcasecmp (xmlGetProp (node, "text"), "false") == 0); + + object->arg.barcode.scale = + g_strtod (xmlGetProp (node, "scale"), NULL); + if (object->arg.barcode.scale == 0.0) { + object->arg.barcode.scale = 0.5; /* Set to a valid value */ + } + + child = node->xmlChildrenNode; + object->arg.barcode.text_node = g_new0 (glTextNode, 1); + if (g_strcasecmp (child->name, "Field") == 0) { + object->arg.barcode.text_node->field_flag = TRUE; + object->arg.barcode.text_node->data = + xmlGetProp (child, "name"); + } else if (xmlNodeIsText (child)) { + object->arg.barcode.text_node->field_flag = FALSE; + object->arg.barcode.text_node->data = + xmlNodeGetContent (child); + } else { + WARN ("Unexpected Barcode child: \"%s\"", child->name); + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML merge properties tag. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_merge_properties (xmlNodePtr node, + glLabel * label) +{ + xmlNodePtr child; + glMergeFieldDefinition *field_def; + + label->merge_type = gl_merge_text_to_type (xmlGetProp (node, "type")); + label->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"); + label->merge_fields = + g_list_append (label->merge_fields, field_def); + } else { + WARN ("Unexpected Merge_Properties child: \"%s\"", + child->name); + } + + } + +} + +/****************************************************************************/ +/* Save label to xml label file. */ +/****************************************************************************/ +glLabelStatus +gl_label_save_xml (glLabel * label, + const gchar * filename) +{ + xmlDocPtr doc; + glLabelStatus status; + gint xml_ret; + + status = xml_label_to_doc (label, &doc); + + xml_ret = xmlSaveFile (filename, doc); + xmlFreeDoc (doc); + if (xml_ret == -1) { + WARN (_("Problem saving xml file.")); + return LABEL_ERROR_SAVE_XML_FILE; + } + + return status; +} + +/****************************************************************************/ +/* Save label to xml buffer. */ +/****************************************************************************/ +glLabelStatus +gl_label_save_xml_buffer (glLabel * label, + gchar ** buffer) +{ + xmlDocPtr doc; + glLabelStatus status; + gint size; + + status = xml_label_to_doc (label, &doc); + + xmlDocDumpMemory (doc, (xmlChar **) buffer, &size); + xmlFreeDoc (doc); + + return status; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Convert label to xml doc structure. */ +/*--------------------------------------------------------------------------*/ +static glLabelStatus +xml_label_to_doc (glLabel * label, + xmlDocPtr * doc) +{ + xmlNsPtr ns; + gchar *string; + GList *p; + glLabelObject *object; + + LIBXML_TEST_VERSION; + + *doc = xmlNewDoc ("1.0"); + (*doc)->xmlRootNode = xmlNewDocNode (*doc, NULL, "Label", NULL); + + ns = xmlNewNs ((*doc)->xmlRootNode, NAME_SPACE, "glabels"); + xmlSetNs ((*doc)->xmlRootNode, ns); + + xmlSetProp ((*doc)->xmlRootNode, "rotate", + label->rotate_flag ? "True" : "False"); + + string = g_strdup_printf ("%g", label->width); + xmlSetProp ((*doc)->xmlRootNode, "width", string); + g_free (string); + + string = g_strdup_printf ("%g", label->height); + xmlSetProp ((*doc)->xmlRootNode, "height", string); + g_free (string); + + xml_create_media_description ((*doc)->xmlRootNode, ns, label); + + for (p = label->objects; p != NULL; p = p->next) { + object = (glLabelObject *) p->data; + xml_create_object ((*doc)->xmlRootNode, ns, object); + } + + if (label->merge_type != GL_MERGE_NONE) { + xml_create_merge_properties ((*doc)->xmlRootNode, ns, label); + } + + return LABEL_OK; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Label->Text Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_media_description (xmlNodePtr root, + xmlNsPtr ns, + glLabel * label) +{ + xmlNodePtr node; + + node = xmlNewTextChild (root, ns, "Media_Type", label->template_name); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML label object Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_object (xmlNodePtr root, + xmlNsPtr ns, + glLabelObject * object) +{ + xmlNodePtr object_node; + gchar *string; + + object_node = xmlNewChild (root, ns, "Object", NULL); + + string = g_strdup_printf ("%g", object->x); + xmlSetProp (object_node, "x", string); + g_free (string); + + string = g_strdup_printf ("%g", object->y); + xmlSetProp (object_node, "y", string); + g_free (string); + + switch (object->type) { + case GL_LABEL_OBJECT_TEXT: + xml_create_text_props (object_node, ns, object); + break; + case GL_LABEL_OBJECT_BOX: + xml_create_box_props (object_node, ns, object); + break; + case GL_LABEL_OBJECT_LINE: + xml_create_line_props (object_node, ns, object); + break; + case GL_LABEL_OBJECT_ELLIPSE: + xml_create_ellipse_props (object_node, ns, object); + break; + case GL_LABEL_OBJECT_IMAGE: + xml_create_image_props (object_node, ns, object); + break; + case GL_LABEL_OBJECT_BARCODE: + xml_create_barcode_props (object_node, ns, object); + break; + default: + WARN ("Unknown label object"); + } +} + +/*--------------------------------------------------------------------------*/ +/* 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; + gchar *string; + GList *p_line, *p_node; + glTextNode *node_text; + + xmlNodeSetName (object_node, "Text"); + + xmlSetProp (object_node, "font_family", object->arg.text.font_family); + + string = g_strdup_printf ("%g", object->arg.text.font_size); + xmlSetProp (object_node, "font_size", string); + g_free (string); + + xmlSetProp (object_node, "font_weight", + weight_to_text (object->arg.text.font_weight)); + + if (object->arg.text.font_italic_flag) { + xmlSetProp (object_node, "font_italic", "True"); + } else { + xmlSetProp (object_node, "font_italic", "False"); + } + + xmlSetProp (object_node, "justify", + just_to_text (object->arg.text.just)); + + string = g_strdup_printf ("0x%08x", object->arg.text.color); + xmlSetProp (object_node, "color", string); + g_free (string); + + for (p_line = object->arg.text.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); + } + + } + + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Box Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_box_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + + xmlNodeSetName (object_node, "Box"); + + string = g_strdup_printf ("%g", object->arg.box.w); + xmlSetProp (object_node, "w", string); + g_free (string); + + string = g_strdup_printf ("%g", object->arg.box.h); + xmlSetProp (object_node, "h", string); + g_free (string); + + string = g_strdup_printf ("%g", object->arg.box.line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", object->arg.box.line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", object->arg.box.fill_color); + xmlSetProp (object_node, "fill_color", string); + g_free (string); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Line Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_line_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + + xmlNodeSetName (object_node, "Line"); + + string = g_strdup_printf ("%g", object->arg.line.dx); + xmlSetProp (object_node, "dx", string); + g_free (string); + + string = g_strdup_printf ("%g", object->arg.line.dy); + xmlSetProp (object_node, "dy", string); + g_free (string); + + string = g_strdup_printf ("%g", object->arg.line.line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", object->arg.line.line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Ellipse Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_ellipse_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + + xmlNodeSetName (object_node, "Ellipse"); + + string = g_strdup_printf ("%g", object->arg.ellipse.w); + xmlSetProp (object_node, "w", string); + g_free (string); + + string = g_strdup_printf ("%g", object->arg.ellipse.h); + xmlSetProp (object_node, "h", string); + g_free (string); + + string = g_strdup_printf ("%g", object->arg.ellipse.line_width); + xmlSetProp (object_node, "line_width", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", object->arg.ellipse.line_color); + xmlSetProp (object_node, "line_color", string); + g_free (string); + + string = g_strdup_printf ("0x%08x", object->arg.ellipse.fill_color); + xmlSetProp (object_node, "fill_color", string); + g_free (string); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Image Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_image_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + gchar *string; + + xmlNodeSetName (object_node, "Image"); + + string = g_strdup_printf ("%g", object->arg.image.w); + xmlSetProp (object_node, "w", string); + g_free (string); + + string = g_strdup_printf ("%g", object->arg.image.h); + xmlSetProp (object_node, "h", string); + g_free (string); + + xmlSetProp (object_node, "filename", object->arg.image.filename); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label->Barcode Node Properties */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_barcode_props (xmlNodePtr object_node, + xmlNsPtr ns, + glLabelObject * object) +{ + xmlNodePtr child; + gchar *string; + + xmlNodeSetName (object_node, "Barcode"); + + string = g_strdup_printf ("0x%08x", object->arg.barcode.color); + xmlSetProp (object_node, "color", string); + g_free (string); + + xmlSetProp (object_node, "style", + gl_barcode_style_to_text (object->arg.barcode.style)); + + if (object->arg.barcode.text_flag) { + xmlSetProp (object_node, "text", "True"); + } else { + xmlSetProp (object_node, "text", "False"); + } + + string = g_strdup_printf ("%g", object->arg.barcode.scale); + xmlSetProp (object_node, "scale", string); + g_free (string); + + if (object->arg.barcode.text_node->field_flag) { + child = xmlNewChild (object_node, ns, "Field", NULL); + xmlSetProp (child, "name", + object->arg.barcode.text_node->data); + } else { + xmlNodeSetContent (object_node, + object->arg.barcode.text_node->data); + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Label Merge Properties Node */ +/*--------------------------------------------------------------------------*/ +static void +xml_create_merge_properties (xmlNodePtr root, + xmlNsPtr ns, + glLabel * label) +{ + xmlNodePtr node, child; + gchar *string; + GList *p; + glMergeFieldDefinition *field_def; + + node = xmlNewChild (root, ns, "Merge_Properties", NULL); + + string = gl_merge_type_to_text (label->merge_type); + xmlSetProp (node, "type", string); + g_free (string); + + xmlSetProp (node, "src", label->merge_src); + + for (p = label->merge_fields; 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); + } + +} + +/****************************************************************************/ +/* Create a new label object of the given type. */ +/****************************************************************************/ +glLabelObject * +gl_label_object_new (glLabel * label, + glLabelObjectType type) +{ + glLabelObject *object; + + object = g_new0 (glLabelObject, 1); + object->parent = label; + object->type = type; + + if (label != NULL) { + label->objects = g_list_append (label->objects, object); + } + + return object; +} + +/****************************************************************************/ +/* Create a new label object from an existing object */ +/****************************************************************************/ +glLabelObject * +gl_label_object_new_from_object (glLabel * label, + glLabelObject * src_object) +{ + glLabelObject *object; + GList *p_line, *nodes, *p_node; + glTextNode *node, *src_node; + + object = g_new0 (glLabelObject, 1); + *object = *src_object; + + /* deep copy */ + switch (object->type) { + + case GL_LABEL_OBJECT_TEXT: + /* deep copy */ + gl_text_node_lines_print (src_object->arg.text.lines); + object->arg.text.lines = NULL; + for (p_line = src_object->arg.text.lines; p_line != NULL; + p_line = p_line->next) { + nodes = NULL; + for (p_node = (GList *) p_line->data; p_node != NULL; + p_node = p_node->next) { + src_node = (glTextNode *) p_node->data; + node = g_new0 (glTextNode, 1); + node->field_flag = src_node->field_flag; + node->data = g_strdup (src_node->data); + nodes = g_list_append (nodes, node); + } + object->arg.text.lines = + g_list_append (object->arg.text.lines, nodes); + } + object->arg.text.font_family = + g_strdup (src_object->arg.text.font_family); + break; + + case GL_LABEL_OBJECT_IMAGE: + object->arg.image.filename + = g_strdup (src_object->arg.image.filename); + object->arg.image.image + = gdk_pixbuf_copy (src_object->arg.image.image); + break; + + case GL_LABEL_OBJECT_BARCODE: + object->arg.barcode.text_node = g_new0 (glTextNode, 1); + object->arg.barcode.text_node->field_flag = + src_object->arg.barcode.text_node->field_flag; + object->arg.barcode.text_node->data = + g_strdup (src_object->arg.barcode.text_node->data); + break; + + default: + break; + + } + + /* set parent */ + object->parent = label; + if (label != NULL) { + label->objects = g_list_append (label->objects, object); + } + + return object; +} + +/****************************************************************************/ +/* Free a previously allocated label object. */ +/****************************************************************************/ +void +gl_label_object_free (glLabelObject ** object) +{ + glLabel *label; + + switch ((*object)->type) { + + case GL_LABEL_OBJECT_TEXT: + gl_text_node_lines_free (&((*object)->arg.text.lines)); + g_free ((*object)->arg.text.font_family); + (*object)->arg.text.font_family = NULL; + break; + + case GL_LABEL_OBJECT_IMAGE: + g_free ((*object)->arg.image.filename); + (*object)->arg.image.filename = NULL; + gdk_pixbuf_unref ((*object)->arg.image.image); + (*object)->arg.image.image = NULL; + break; + + case GL_LABEL_OBJECT_BARCODE: + gl_text_node_free (&((*object)->arg.barcode.text_node)); + break; + + default: + break; + + } + + label = (*object)->parent; + if (label != NULL) { + label->objects = g_list_remove (label->objects, *object); + } + + g_free (*object); + *object = NULL; +} + +/****************************************************************************/ +/* Bring label object to front/top. */ +/****************************************************************************/ +void +gl_label_object_raise_to_front (glLabelObject * object) +{ + glLabel *label; + + label = object->parent; + + /* 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); +} + +/****************************************************************************/ +/* Send label object to rear/bottom. */ +/****************************************************************************/ +void +gl_label_object_lower_to_back (glLabelObject * object) +{ + glLabel *label; + + label = object->parent; + + /* 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); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Utilities to deal with GTK_JUSTIFICATION types */ +/*--------------------------------------------------------------------------*/ +static const gchar * +just_to_text (GtkJustification just) +{ + switch (just) { + case GTK_JUSTIFY_LEFT: + return "Left"; + case GTK_JUSTIFY_CENTER: + return "Center"; + case GTK_JUSTIFY_RIGHT: + return "Right"; + default: + return "?"; + } +} + +static GtkJustification +text_to_just (const gchar * text) +{ + + if (g_strcasecmp (text, "Left") == 0) { + return GTK_JUSTIFY_LEFT; + } else if (g_strcasecmp (text, "Center") == 0) { + return GTK_JUSTIFY_CENTER; + } else if (g_strcasecmp (text, "Right") == 0) { + return GTK_JUSTIFY_RIGHT; + } else { + return GTK_JUSTIFY_LEFT; + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Utilities to deal with GNOME_FONT_WEIGHT types */ +/*--------------------------------------------------------------------------*/ +static const gchar * +weight_to_text (GnomeFontWeight weight) +{ + switch (weight) { + case GNOME_FONT_BOOK: + return "Regular"; + case GNOME_FONT_BOLD: + return "Bold"; + default: + return "?"; + } +} + +static GnomeFontWeight +text_to_weight (const gchar * text) +{ + + if (g_strcasecmp (text, "Regular") == 0) { + return GNOME_FONT_BOOK; + } else if (g_strcasecmp (text, "Bold") == 0) { + return GNOME_FONT_BOLD; + } else { + return GNOME_FONT_BOOK; + } + +} diff --git a/glabels1/src/label.h b/glabels1/src/label.h new file mode 100644 index 00000000..e0ca5f9d --- /dev/null +++ b/glabels1/src/label.h @@ -0,0 +1,151 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * label.h: GLabels label module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __LABEL_H__ +#define __LABEL_H__ + +#include +#include +#include + +#include "merge.h" +#include "text_node.h" +#include "template.h" +#include "bc.h" + +typedef struct { + + gchar *template_name; + glTemplate *template; + gboolean rotate_flag; + + gdouble width, height; + + GList *objects; + + glMergeType merge_type; + gchar *merge_src; + GList *merge_fields; /* Merge Field Definitions */ + +} glLabel; + +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; + +typedef struct { + + glLabel *parent; + + glLabelObjectType type; + gdouble x, y; + + union { + + struct { + GList *lines; /* list of glLabelTextNode lists */ + gchar *font_family; + gdouble font_size; + GnomeFontWeight font_weight; + gboolean font_italic_flag; + GtkJustification just; + guint color; + } text; + + struct { + gdouble w, h; + gdouble line_width; + guint line_color; + guint fill_color; + } box; + + struct { + gdouble dx, dy; + gdouble line_width; + guint line_color; + } line; + + struct { + gdouble w, h; + gdouble line_width; + guint line_color; + guint fill_color; + } ellipse; + + struct { + gchar *filename; + gdouble w, h; + GdkPixbuf *image; + } image; + + struct { + glTextNode *text_node; + glBarcodeStyle style; + guint color; + gboolean text_flag; + gdouble scale; + } barcode; + + } arg; + +} glLabelObject; + +typedef enum { + LABEL_UNKNOWN_MEDIA = 1, + LABEL_OK = 0, + LABEL_ERROR_OPEN_XML_PARSE = -10, + LABEL_ERROR_SAVE_XML_FILE = -20, +} glLabelStatus; + +extern glLabel *gl_label_new (void); +extern glLabel *gl_label_new_with_template (const gchar * tmplt_name, + gboolean rotate_flag); +extern void gl_label_free (glLabel ** label); + +extern glLabelStatus gl_label_open_xml (glLabel ** label, + const gchar * filename); +extern glLabelStatus gl_label_open_xml_buffer (glLabel ** label, + const gchar * buffer); + +extern glLabelStatus gl_label_save_xml (glLabel * label, + const gchar * filename); + +glLabelStatus gl_label_save_xml_buffer (glLabel * label, + gchar ** buffer); + +extern glLabelObject *gl_label_object_new (glLabel * label, + glLabelObjectType type); + +extern glLabelObject *gl_label_object_new_from_object (glLabel * label, + glLabelObject * object); + +extern void gl_label_object_free (glLabelObject ** object); + +extern void gl_label_object_raise_to_front (glLabelObject * object); +extern void gl_label_object_lower_to_back (glLabelObject * object); + +#endif diff --git a/glabels1/src/mdi.c b/glabels1/src/mdi.c new file mode 100644 index 00000000..4a1b17af --- /dev/null +++ b/glabels1/src/mdi.c @@ -0,0 +1,746 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi.c: GLabels MDI module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "mdi.h" +#include "menu.h" +#include "display.h" +#include "label.h" +#include "util.h" + +#define DONT_DISPLAY_EXTENSION + +/*============================================*/ +/* Private types. */ +/*============================================*/ +typedef struct _Document Document; +struct _Document { + glLabel *label; + gchar *filename; + gint id; +}; + +/*============================================*/ +/* Private globals. */ +/*============================================*/ +static GnomeMDI *mdi = NULL; +static gint i_unnamed = 0; +static gint next_id = 0; + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ +static void set_filename (GnomeMDIChild * child, const gchar * filename); + +static gboolean remove_child_handler (GnomeMDI * mdi, GnomeMDIChild * child, + gpointer data); + +static GnomeMDIChild *child_creator (const char *name, glLabel * label, + const char *abs_filename); + +static void child_destroyed (GnomeMDIChild * child, gpointer data); + +static void app_created_handler (GnomeMDI * mdi, GnomeApp * app, gpointer data); + +static GtkWidget *view_creator (GnomeMDIChild * child, gpointer data); + +static gchar *construct_name (GnomeMDIChild * child, const gchar * filename); + +static gboolean close_save (GnomeMDIChild * child); + +static gboolean close_save_as_dialog (GnomeMDIChild * child); + +static void close_save_as_ok_cb (GtkWidget * widget, GtkFileSelection * fsel); + +static void close_save_as_cancel_cb (GtkWidget * widget, GtkFileSelection * fsel); + +static void close_save_as_destroy_cb (GtkWidget * widget, gboolean * destroy_flag); + +/*--------------------------------------------------------------------------*/ +/* Initialize mdi module. */ +/*--------------------------------------------------------------------------*/ +GnomeMDI * +gl_mdi_init (void) +{ + mdi = GNOME_MDI (gnome_mdi_new (PACKAGE, "gLabels")); + + gl_menu_install_menus (mdi); + gl_menu_install_toolbar (mdi); + + gtk_signal_connect (GTK_OBJECT (mdi), "destroy", + GTK_SIGNAL_FUNC (gtk_main_quit), NULL); + + gtk_signal_connect (GTK_OBJECT (mdi), "remove_child", + GTK_SIGNAL_FUNC (remove_child_handler), NULL); + + gtk_signal_connect (GTK_OBJECT (mdi), "app-created", + GTK_SIGNAL_FUNC (app_created_handler), NULL); + + return mdi; +} + +/*--------------------------------------------------------------------------*/ +/* Get active window/app. */ +/*--------------------------------------------------------------------------*/ +GnomeApp * +gl_mdi_get_active_window (void) +{ + return gnome_mdi_get_active_window (mdi); +} + +/*--------------------------------------------------------------------------*/ +/* Create a new view/child with a blank document. */ +/*--------------------------------------------------------------------------*/ +gboolean +gl_mdi_new_child (const gchar * tmplt_name, + gboolean rotate_flag) +{ + gchar *name = NULL; + GnomeMDIChild *child; + + i_unnamed++; + name = g_strdup_printf ("Label%d", i_unnamed); + child = child_creator (name, + gl_label_new_with_template (tmplt_name, + rotate_flag), NULL); + g_free (name); + if (child == NULL) { + return FALSE; + } + + gnome_mdi_add_child (mdi, child); + gnome_mdi_add_view (mdi, child); + + return TRUE; +} + +/*--------------------------------------------------------------------------*/ +/* Create a new view, from xml document. */ +/*--------------------------------------------------------------------------*/ +gboolean +gl_mdi_new_child_from_xml_file (const gchar * filename) +{ + GList *p_child; + GnomeMDIChild *child; + Document *document; + gchar *abs_filename, *name; + glLabel *label = NULL; + glLabelStatus status; + GtkWidget *wdialog; + gchar *msg; + GnomeApp *app; + + abs_filename = gl_util_make_absolute (filename); + + for (p_child = mdi->children; p_child != NULL; p_child = p_child->next) { + child = GNOME_MDI_CHILD (p_child->data); + document = gtk_object_get_user_data (GTK_OBJECT (child)); + if (document->filename != NULL) { + if (strcmp (document->filename, abs_filename) == 0) { + msg = + g_strdup_printf (_ + ("Revert to saved copy of %s?"), + abs_filename); + wdialog = + gnome_message_box_new (msg, + GNOME_MESSAGE_BOX_QUESTION, + GNOME_STOCK_BUTTON_YES, + GNOME_STOCK_BUTTON_NO, + NULL); + g_free (msg); + app = + gnome_mdi_get_app_from_view (GTK_WIDGET + (child->views-> + data)); + gtk_window_set_transient_for (GTK_WINDOW + (wdialog), + GTK_WINDOW (app)); + if (gnome_dialog_run (GNOME_DIALOG (wdialog)) == + 0) { + gnome_mdi_remove_child (mdi, child, + FALSE); + break; + } else { + g_free (abs_filename); + return TRUE; + } + } + } + } + + status = gl_label_open_xml (&label, abs_filename); + if (status < LABEL_OK) { + g_free (abs_filename); + return FALSE; + } + if (status == LABEL_UNKNOWN_MEDIA) { + app = gl_mdi_get_active_window (); + wdialog = + gnome_error_dialog_parented (_ + ("Unknown media type. Using default."), + GTK_WINDOW (app)); + gtk_window_set_modal (GTK_WINDOW (wdialog), TRUE); + } + + name = construct_name (NULL, abs_filename); + child = child_creator (name, label, abs_filename); + g_free (name); + if (child == NULL) { + g_free (abs_filename); + return FALSE; + } + + gnome_mdi_add_child (mdi, child); + gnome_mdi_add_view (mdi, child); + + g_free (abs_filename); + return TRUE; +} + +/*--------------------------------------------------------------------------*/ +/* Save view to xml file. */ +/*--------------------------------------------------------------------------*/ +gboolean +gl_mdi_save_child_to_xml_file (GnomeMDIChild * child, + const gchar * filename) +{ + glDisplay *display; + glLabel *label; + + display = gl_mdi_get_display (child); + label = display->label; + if (gl_label_save_xml (label, filename) == LABEL_OK) { + gl_display_clear_modified (display); + set_filename (child, filename); + return TRUE; + } else { + return FALSE; + } + +} + +/*--------------------------------------------------------------------------*/ +/* Close view. */ +/*--------------------------------------------------------------------------*/ +void +gl_mdi_close_child (GnomeMDIChild * child) +{ + if (child != NULL) { + gnome_mdi_remove_child (mdi, child, FALSE); + } +} + +/*--------------------------------------------------------------------------*/ +/* Close all views, and exit if successful. */ +/*--------------------------------------------------------------------------*/ +void +gl_mdi_close_all (void) +{ + if (gnome_mdi_remove_all (mdi, FALSE)) { + gtk_object_destroy (GTK_OBJECT (mdi)); + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Set filename associated with document. */ +/*--------------------------------------------------------------------------*/ +void +set_filename (GnomeMDIChild * child, + const gchar * filename) +{ + Document *document; + gchar *name; + + document = gtk_object_get_user_data (GTK_OBJECT (child)); + + g_free (document->filename); + document->filename = g_strdup (filename); + + name = construct_name (child, filename); + gnome_mdi_child_set_name (child, name); + g_free (name); +} + +/*--------------------------------------------------------------------------*/ +/* Get filename associated with document. */ +/*--------------------------------------------------------------------------*/ +gchar * +gl_mdi_get_filename (GnomeMDIChild * child) +{ + Document *document; + + document = gtk_object_get_user_data (GTK_OBJECT (child)); + + return g_strdup (document->filename); +} + +/*--------------------------------------------------------------------------*/ +/* Get base filename of document. */ +/*--------------------------------------------------------------------------*/ +gchar * +gl_mdi_get_basename (GnomeMDIChild * child) +{ + Document *document; + + document = gtk_object_get_user_data (GTK_OBJECT (child)); + + if (document->filename != NULL) { + return g_strdup (g_basename (document->filename)); + } else { + return NULL; + } +} + +/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +GList * +gl_mdi_get_displays_in_current_window (void) +{ + GnomeApp *app; + GList *p_child; + GnomeMDIChild *child; + GtkWidget *view; + GList *views = NULL; + + app = gnome_mdi_get_active_window (mdi); + + for (p_child = mdi->children; p_child != NULL; p_child = p_child->next) { + child = GNOME_MDI_CHILD (p_child->data); + view = GTK_WIDGET (child->views->data); + if (gnome_mdi_get_app_from_view (view) == app) { + views = g_list_prepend (views, view); + } + } + + return views; +} + +/*--------------------------------------------------------------------------*/ +/* Get label display associated with document. */ +/*--------------------------------------------------------------------------*/ +glDisplay * +gl_mdi_get_display (GnomeMDIChild * child) +{ + if (child == NULL) + return NULL; + if (child->views == NULL) + return NULL; + return GL_DISPLAY (child->views->data); +} + +/*--------------------------------------------------------------------------*/ +/* Get label associated with document. */ +/*--------------------------------------------------------------------------*/ +glLabel * +gl_mdi_get_label (GnomeMDIChild * child) +{ + glDisplay *display; + + display = gl_mdi_get_display (child); + return display->label; +} + +/*--------------------------------------------------------------------------*/ +/* Get uniq id associated with document. */ +/*--------------------------------------------------------------------------*/ +gint +gl_mdi_get_id (GnomeMDIChild * child) +{ + Document *document; + + document = gtk_object_get_user_data (GTK_OBJECT (child)); + + return document->id; +} + +/*--------------------------------------------------------------------------*/ +/* Find child associated with given id. This allows us to verify that a */ +/* child still exists from a non-modal dialog, e.g. if you close a child */ +/* while you have a print or save as dialog open for that child. */ +/*--------------------------------------------------------------------------*/ +GnomeMDIChild * +gl_mdi_find_child (gint id) +{ + GList *p_child; + GnomeMDIChild *child; + Document *document; + + for (p_child = mdi->children; p_child != NULL; p_child = p_child->next) { + child = GNOME_MDI_CHILD (p_child->data); + document = gtk_object_get_user_data (GTK_OBJECT (child)); + if (document->id == id) { + return child; + } + } + + return NULL; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Create a new child. */ +/*--------------------------------------------------------------------------*/ +static GnomeMDIChild * +child_creator (const char *name, + glLabel * label, + const char *abs_filename) +{ + GnomeMDIGenericChild *child; + Document *document; + + document = g_new0 (Document, 1); + + document->label = label; + document->filename = g_strdup (abs_filename); + document->id = next_id++; + + child = gnome_mdi_generic_child_new (name); + + gtk_object_set_user_data (GTK_OBJECT (child), document); + + gnome_mdi_generic_child_set_view_creator (child, view_creator, NULL); + + gtk_signal_connect (GTK_OBJECT (child), "destroy", + GTK_SIGNAL_FUNC (child_destroyed), document); + + return GNOME_MDI_CHILD (child); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Handle remove child signal. */ +/*--------------------------------------------------------------------------*/ +static gboolean +remove_child_handler (GnomeMDI * mdi, + GnomeMDIChild * child, + gpointer data) +{ + GtkWidget *wdialog; + gchar *msg; + GnomeApp *app = gnome_mdi_get_active_window (mdi); + Document *document; + glDisplay *display; + + display = gl_mdi_get_display (child); + document = gtk_object_get_user_data (GTK_OBJECT (child)); + + if (gl_display_modified (display)) { + msg = + g_strdup_printf (_ + ("``%s'' has been modified.\n\nDo you wish to save it?"), + child->name); + wdialog = + gnome_message_box_new (msg, GNOME_MESSAGE_BOX_WARNING, + "Save", _("Don't save"), + GNOME_STOCK_BUTTON_CANCEL, NULL); + g_free (msg); + gtk_window_set_transient_for (GTK_WINDOW (wdialog), + GTK_WINDOW (app)); + switch (gnome_dialog_run (GNOME_DIALOG (wdialog))) { + + case 0: /* Yes / Save */ + if (document->filename != NULL) { + return close_save (child); + } else { + return close_save_as_dialog (child); + } + + case 1: /* No / Don't save */ + return TRUE; + + default: /* Cancel operation */ + return FALSE; + } + } else { + return TRUE; + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Handle destroy child signal. */ +/*--------------------------------------------------------------------------*/ +static void +child_destroyed (GnomeMDIChild * child, + gpointer data) +{ + Document *document = data; + + gl_label_free (&document->label); + g_free (document->filename); + document->filename = NULL; + + g_free (document); + gtk_object_set_user_data (GTK_OBJECT (child), NULL); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Handle "app-created" signal. */ +/*--------------------------------------------------------------------------*/ +static void +app_created_handler (GnomeMDI * mdi, + GnomeApp * app, + gpointer data) +{ + GtkWidget *status; + + status = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_NEVER); + gnome_app_set_statusbar (app, status); + + gnome_app_install_menu_hints (app, + gnome_mdi_get_menubar_info (mdi-> + active_window)); + + gl_menu_install_tools_toolbar (mdi, app); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. View creator. */ +/*--------------------------------------------------------------------------*/ +static GtkWidget * +view_creator (GnomeMDIChild * child, + gpointer data) +{ + GtkWidget *widget; + Document *document; + + document = gtk_object_get_user_data (GTK_OBJECT (child)); + + widget = gl_display_new (document->label); + gtk_widget_show_all (widget); + + return widget; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct a child name, based on filename. */ +/*--------------------------------------------------------------------------*/ +static gchar * +construct_name (GnomeMDIChild * my_child, + const gchar * filename) +{ + gchar *name, *test_name, *final_name; + gint test_name_length; + GList *p_child; + gint duplicates = 0; + GnomeMDIChild *child; + + name = g_strdup (g_basename (filename)); +#ifdef DONT_DISPLAY_EXTENSION + { + gchar *p_extension = strrchr (name, '.'); + if (p_extension != NULL) + *p_extension = 0; /* wipe out extension */ + } +#endif + test_name = g_strdup_printf ("%s <", name); + test_name_length = strlen (test_name); + + for (p_child = mdi->children; p_child != NULL; p_child = p_child->next) { + child = GNOME_MDI_CHILD (p_child->data); + if (my_child != child) { + if (strcmp (child->name, name) == 0) { + duplicates++; + } + if (strncmp (child->name, test_name, test_name_length) + == 0) { + duplicates++; + } + } + } + g_free (test_name); + + if (duplicates > 0) { + final_name = g_strdup_printf ("%s <%d>", name, duplicates + 1); + } else { + final_name = g_strdup (name); + } + + g_free (name); + return final_name; + +} + +/*=================================================================*/ +/* PRIVATE. Save a document on close. */ +/*=================================================================*/ +static gboolean +close_save (GnomeMDIChild * child) +{ + Document *document = gtk_object_get_user_data (GTK_OBJECT (child)); + GtkWidget *dlg; + GnomeApp *app = gnome_mdi_get_active_window (mdi); + + if (gl_mdi_save_child_to_xml_file (child, document->filename)) { + return TRUE; + } else { + dlg = gnome_error_dialog_parented (_("Cannot save file"), + GTK_WINDOW (app)); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + return FALSE; + } +} + +/*=================================================================*/ +/* PRIVATE. Special modal "Save As" dialog for closing children. */ +/*=================================================================*/ +static gboolean +close_save_as_dialog (GnomeMDIChild * child) +{ + GtkFileSelection *fsel; + GnomeApp *app = gnome_mdi_get_active_window (mdi); + gint id; + gboolean flag = FALSE; + gboolean destroy_flag = FALSE; + + 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 As"))); + gtk_window_set_modal (GTK_WINDOW (fsel), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (fsel), GTK_WINDOW (app)); + gtk_window_set_title (GTK_WINDOW (fsel), _("Close / Save label as")); + + id = gl_mdi_get_id (child); + gtk_object_set_data (GTK_OBJECT (fsel), "id", GINT_TO_POINTER (id)); + gtk_object_set_data (GTK_OBJECT (fsel), "flag", &flag); + + gtk_signal_connect (GTK_OBJECT (fsel->ok_button), "clicked", + GTK_SIGNAL_FUNC (close_save_as_ok_cb), fsel); + + gtk_signal_connect (GTK_OBJECT (fsel->cancel_button), "clicked", + GTK_SIGNAL_FUNC (close_save_as_cancel_cb), fsel); + + gtk_signal_connect (GTK_OBJECT (fsel), "destroy", + GTK_SIGNAL_FUNC (close_save_as_destroy_cb), + &destroy_flag); + + /* 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. */ + gtk_signal_disconnect_by_func (GTK_OBJECT (fsel), + GTK_SIGNAL_FUNC + (close_save_as_destroy_cb), + &destroy_flag); + gtk_widget_destroy (GTK_WIDGET (fsel)); + } + + /* Return flag as set by one of the above callbacks, TRUE = saved */ + return flag; +} + +/*==============================================*/ +/* PRIVATE. "Save As" ok button callback. */ +/*==============================================*/ +static void +close_save_as_ok_cb (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gchar *raw_filename, *filename; + GtkWidget *dlg; + gint id = + GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (fsel), "id")); + GnomeMDIChild *child = gl_mdi_find_child (id); + gboolean *flag = gtk_object_get_data (GTK_OBJECT (fsel), "flag"); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + if (child == NULL) { + dlg = gnome_error_dialog (_("Label no longer valid!")); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + *flag = TRUE; + gtk_widget_hide (GTK_WIDGET (fsel)); + gtk_main_quit (); + return; + } + + /* get the filename */ + raw_filename = g_strdup (gtk_file_selection_get_filename (fsel)); + + if (!raw_filename || (raw_filename[strlen (raw_filename) - 1] == '/')) { + + dlg = gnome_warning_dialog_parented (_("Must supply file name"), + GTK_WINDOW (fsel)); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + + filename = gl_util_add_extension (raw_filename); + + if (!gl_mdi_save_child_to_xml_file (child, filename)) { + + dlg = + gnome_error_dialog_parented (_ + ("Error writing file"), + GTK_WINDOW (fsel)); + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + + } else { + *flag = TRUE; + gtk_widget_hide (GTK_WIDGET (fsel)); + gtk_main_quit (); + } + + g_free (filename); + } + + g_free (raw_filename); +} + +/*==============================================*/ +/* PRIVATE. "Save As" cancel button callback. */ +/*==============================================*/ +static void +close_save_as_cancel_cb (GtkWidget * widget, + GtkFileSelection * fsel) +{ + gboolean *flag = gtk_object_get_data (GTK_OBJECT (fsel), "flag"); + + g_return_if_fail (GTK_IS_FILE_SELECTION (fsel)); + + *flag = FALSE; + gtk_widget_hide (GTK_WIDGET (fsel)); + gtk_main_quit (); +} + +/*==============================================*/ +/* PRIVATE. "Save As" destroy callback. */ +/*==============================================*/ +static void +close_save_as_destroy_cb (GtkWidget * widget, + gboolean * destroy_flag) +{ + *destroy_flag = TRUE; + gtk_main_quit (); +} diff --git a/glabels1/src/mdi.h b/glabels1/src/mdi.h new file mode 100644 index 00000000..faeeedcf --- /dev/null +++ b/glabels1/src/mdi.h @@ -0,0 +1,51 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mdi.h: GLabels MDI module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MDI_H__ +#define __MDI_H__ + +#include +#include + +extern GnomeMDI *gl_mdi_init (void); +extern GnomeApp *gl_mdi_get_active_window (void); + +extern gboolean gl_mdi_new_child (const gchar * tmplt_name, + gboolean rotate_flag); +extern gboolean gl_mdi_new_child_from_xml_file (const gchar * filename); + +extern gboolean gl_mdi_save_child_to_xml_file (GnomeMDIChild * child, + const gchar * filename); + +extern void gl_mdi_close_child (GnomeMDIChild * child); +extern void gl_mdi_close_all (void); + +extern gchar *gl_mdi_get_filename (GnomeMDIChild * child); +extern gchar *gl_mdi_get_basename (GnomeMDIChild * child); + +extern GList *gl_mdi_get_displays_in_current_window (void); +extern glDisplay *gl_mdi_get_display (GnomeMDIChild * child); +extern glLabel *gl_mdi_get_label (GnomeMDIChild * child); + +extern gint gl_mdi_get_id (GnomeMDIChild * child); +extern GnomeMDIChild *gl_mdi_find_child (gint id); + +#endif /* __MDI_H__ */ diff --git a/glabels1/src/media_select.c b/glabels1/src/media_select.c new file mode 100644 index 00000000..6d829466 --- /dev/null +++ b/glabels1/src/media_select.c @@ -0,0 +1,457 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * media_select.c: media selection widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "media_select.h" +#include "template.h" +#include "mini_preview.h" +#include "prefs.h" +#include "util.h" + +#include "debug.h" + +#define MINI_PREVIEW_WIDTH 160 +#define MINI_PREVIEW_HEIGHT 200 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glMediaSelectSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint media_select_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_media_select_class_init (glMediaSelectClass * class); +static void gl_media_select_init (glMediaSelect * media_select); +static void gl_media_select_destroy (GtkObject * object); + +static void gl_media_select_construct (glMediaSelect * 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 (glMediaSelect * media_select, gchar * name); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_media_select_get_type (void) +{ + static guint media_select_type = 0; + + if (!media_select_type) { + GtkTypeInfo media_select_info = { + "glMediaSelect", + sizeof (glMediaSelect), + sizeof (glMediaSelectClass), + (GtkClassInitFunc) gl_media_select_class_init, + (GtkObjectInitFunc) gl_media_select_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + media_select_type = gtk_type_unique (gtk_vbox_get_type (), + &media_select_info); + } + + return media_select_type; +} + +static void +gl_media_select_class_init (glMediaSelectClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_media_select_destroy; + + media_select_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glMediaSelectClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, media_select_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_media_select_init (glMediaSelect * media_select) +{ + 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; +} + +static void +gl_media_select_destroy (GtkObject * object) +{ + glMediaSelect *media_select; + glMediaSelectClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MEDIA_SELECT (object)); + + media_select = GL_MEDIA_SELECT (object); + class = GL_MEDIA_SELECT_CLASS (GTK_OBJECT (media_select)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_media_select_new (void) +{ + glMediaSelect *media_select; + + media_select = gtk_type_new (gl_media_select_get_type ()); + + gl_media_select_construct (media_select); + + return GTK_WIDGET (media_select); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_media_select_construct (glMediaSelect * media_select) +{ + GtkWidget *whbox, *wvbox, *wcombo, *wvbox1, *whbox1; + gchar *name; + GList *template_names, *page_sizes = NULL; + const gchar *page_size; + + 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 */ + wcombo = gtk_combo_new (); + page_sizes = g_list_append (page_sizes, "US-Letter"); + page_sizes = g_list_append (page_sizes, "A4"); + gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), page_sizes); + g_list_free (page_sizes); + media_select->page_size_entry = GTK_COMBO (wcombo)->entry; + gtk_entry_set_editable (GTK_ENTRY (media_select->page_size_entry), + FALSE); + gtk_widget_set_usize (media_select->page_size_entry, 100, 0); + 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 */ + 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_widget_set_usize (media_select->template_entry, 400, 0); + 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 */ + media_select->mini_preview = gl_mini_preview_new ( MINI_PREVIEW_HEIGHT, + MINI_PREVIEW_WIDTH); + gtk_box_pack_start (GTK_BOX (whbox), media_select->mini_preview, + FALSE, FALSE, GNOME_PAD); + + /* 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 */ + 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 */ + name = + gtk_editable_get_chars (GTK_EDITABLE (media_select->template_entry), + 0, -1); + gl_mini_preview_set_label (GL_MINI_PREVIEW (media_select->mini_preview), + name); + details_update (media_select, name); + g_free (name); + + /* Connect signals to controls */ + gtk_signal_connect (GTK_OBJECT (media_select->page_size_entry), + "changed", + GTK_SIGNAL_FUNC (page_size_entry_changed_cb), + media_select); + gtk_signal_connect (GTK_OBJECT (media_select->template_entry), + "changed", + GTK_SIGNAL_FUNC (template_entry_changed_cb), + media_select); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change in selection */ +/*--------------------------------------------------------------------------*/ +static void +page_size_entry_changed_cb (GtkEntry * entry, + gpointer user_data) +{ + glMediaSelect *media_select = GL_MEDIA_SELECT (user_data); + gchar *page_size; + GList *template_names; + + /* Update template selections for new page size */ + page_size = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); + 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); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change in selection */ +/*--------------------------------------------------------------------------*/ +static void +template_entry_changed_cb (GtkEntry * entry, + gpointer user_data) +{ + glMediaSelect *media_select = GL_MEDIA_SELECT (user_data); + gchar *name; + + /* Update mini_preview canvas & details with template */ + name = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); + gl_mini_preview_set_label (GL_MINI_PREVIEW (media_select->mini_preview), + name); + details_update (media_select, name); + g_free (name); + + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (user_data), media_select_signals[CHANGED]); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. update "details" widgets from new template. */ +/*--------------------------------------------------------------------------*/ +static void +details_update (glMediaSelect * media_select, + gchar * name) +{ + glTemplate *template; + gchar *text; + glPrefsUnits units; + const gchar *units_string; + gdouble units_per_point; + + 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 ); +} + +/****************************************************************************/ +/* query selected label template name. */ +/****************************************************************************/ +gchar * +gl_media_select_get_name (glMediaSelect * media_select) +{ + return + gtk_editable_get_chars (GTK_EDITABLE (media_select->template_entry), + 0, -1); +} + +/****************************************************************************/ +/* set selected label template name. */ +/****************************************************************************/ +void +gl_media_select_set_name (glMediaSelect * media_select, + gchar * name) +{ + gint pos; + + gtk_signal_handler_block_by_func (GTK_OBJECT + (media_select->template_entry), + GTK_SIGNAL_FUNC + (template_entry_changed_cb), + media_select); + gtk_editable_delete_text (GTK_EDITABLE (media_select->template_entry), + 0, -1); + gtk_signal_handler_unblock_by_func (GTK_OBJECT + (media_select->template_entry), + GTK_SIGNAL_FUNC + (template_entry_changed_cb), + media_select); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (media_select->template_entry), + name, strlen (name), &pos); +} + +/****************************************************************************/ +/* query selected label template page size. */ +/****************************************************************************/ +gchar * +gl_media_select_get_page_size (glMediaSelect * media_select) +{ + return + gtk_editable_get_chars (GTK_EDITABLE + (media_select->page_size_entry), 0, -1); +} + +/****************************************************************************/ +/* set selected label template page size. */ +/****************************************************************************/ +void +gl_media_select_set_page_size (glMediaSelect * media_select, + gchar * page_size) +{ + gint pos; + + gtk_signal_handler_block_by_func (GTK_OBJECT + (media_select->page_size_entry), + GTK_SIGNAL_FUNC + (page_size_entry_changed_cb), + media_select); + gtk_editable_delete_text (GTK_EDITABLE (media_select->page_size_entry), + 0, -1); + gtk_signal_handler_unblock_by_func (GTK_OBJECT + (media_select->page_size_entry), + GTK_SIGNAL_FUNC + (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); +} diff --git a/glabels1/src/media_select.h b/glabels1/src/media_select.h new file mode 100644 index 00000000..4d4af21c --- /dev/null +++ b/glabels1/src/media_select.h @@ -0,0 +1,76 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * media_select.h: media selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __MEDIA_SELECT_H__ +#define __MEDIA_SELECT_H__ + +#include + +#define GL_TYPE_MEDIA_SELECT (gl_media_select_get_type ()) +#define GL_MEDIA_SELECT(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MEDIA_SELECT, glMediaSelect )) +#define GL_MEDIA_SELECT_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MEDIA_SELECT, glMediaSelectClass)) +#define GL_IS_MEDIA_SELECT(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MEDIA_SELECT)) +#define GL_IS_MEDIA_SELECT_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MEDIA_SELECT)) + +typedef struct _glMediaSelect glMediaSelect; +typedef struct _glMediaSelectClass glMediaSelectClass; + +struct _glMediaSelect { + 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 _glMediaSelectClass { + GtkVBoxClass parent_class; + + void (*changed) (glMediaSelect * media_select, gpointer user_data); +}; + +extern guint gl_media_select_get_type (void); + +extern GtkWidget *gl_media_select_new (void); + +extern gchar *gl_media_select_get_name (glMediaSelect * media_select); + +extern void gl_media_select_set_name (glMediaSelect * media_select, + gchar * name); + +extern gchar *gl_media_select_get_page_size (glMediaSelect * media_select); + +extern void gl_media_select_set_page_size (glMediaSelect * media_select, + gchar * page_size); + +#endif diff --git a/glabels1/src/menu.c b/glabels1/src/menu.c new file mode 100644 index 00000000..f840e319 --- /dev/null +++ b/glabels1/src/menu.c @@ -0,0 +1,328 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * menu.c: Menu module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "menu.h" +#include "stock.h" +#include "file.h" +#include "print_dialog.h" +#include "edit.h" +#include "prefs.h" +#include "tools.h" + +#ifdef PACKAGE_DATA_DIR +#define LOGO_PIXMAP (PACKAGE_DATA_DIR "/pixmaps/glabels/glabels-logo.png") +#else +#define LOGO_PIXMAP gnome_pixmap_file("glabels/glabels-logo.png") +#endif + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ +static void about_cb (GtkWidget * widget, gpointer data); +static void nothing_cb (GtkWidget * widget, gpointer data); + +/*===========================================*/ +/* Menu definitions */ +/*===========================================*/ + +static GnomeUIInfo menu_file[] = { + GNOMEUIINFO_MENU_NEW_ITEM (N_("_New"), + N_("Make a new, empty label"), + gl_file_new_cb, NULL), + + GNOMEUIINFO_MENU_OPEN_ITEM (gl_file_open_cb, NULL), + + GNOMEUIINFO_MENU_SAVE_ITEM (gl_file_save_cb, NULL), + + GNOMEUIINFO_MENU_SAVE_AS_ITEM (gl_file_save_as_cb, NULL), + + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_MENU_PRINT_ITEM (gl_print_dialog_cb, NULL), + + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_CLOSE_ITEM (gl_file_close_cb, NULL), + GNOMEUIINFO_MENU_EXIT_ITEM (gl_file_exit_cb, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo menu_edit[] = { +#ifdef UNDO_REDO + GNOMEUIINFO_MENU_UNDO_ITEM (nothing_cb, NULL), + GNOMEUIINFO_MENU_REDO_ITEM (nothing_cb, NULL), + + GNOMEUIINFO_SEPARATOR, +#endif + + GNOMEUIINFO_MENU_CUT_ITEM (gl_edit_cut_cb, NULL), + GNOMEUIINFO_MENU_COPY_ITEM (gl_edit_copy_cb, NULL), + GNOMEUIINFO_MENU_PASTE_ITEM (gl_edit_paste_cb, NULL), + + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_MENU_SELECT_ALL_ITEM (gl_edit_select_all_cb, NULL), + GNOMEUIINFO_ITEM_NONE (N_("U_nselect All "), + N_("Remove all selections"), + gl_edit_unselect_cb), + + GNOMEUIINFO_END +}; + +static GnomeUIInfo menu_tools[] = { + + GNOMEUIINFO_ITEM_STOCK (N_("Select"), + N_("Select, move and modify objects"), + gl_tools_arrow_cb, GL_STOCK_PIXMAP_ARROW), + + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_ITEM_NONE (N_("Text"), N_("Create text object"), + gl_tools_text_cb), + + GNOMEUIINFO_ITEM_NONE (N_("Box"), N_("Create box/rectangle object"), + gl_tools_box_cb), + + GNOMEUIINFO_ITEM_NONE (N_("Line"), N_("Create line object"), + gl_tools_line_cb), + + GNOMEUIINFO_ITEM_NONE (N_("Ellipse"), + N_("Create ellipse/circle object"), + gl_tools_ellipse_cb), + + GNOMEUIINFO_ITEM_NONE (N_("Image"), N_("Create image object"), + gl_tools_image_cb), + + GNOMEUIINFO_ITEM_NONE (N_("Barcode"), N_("Create barcode object"), + gl_tools_barcode_cb), + + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_ITEM_NONE (N_("Zoom in"), N_("Zoom in"), + gl_tools_zoomin_cb), + + GNOMEUIINFO_ITEM_NONE (N_("Zoom out"), N_("Zoom out"), + gl_tools_zoomout_cb), + + GNOMEUIINFO_ITEM_NONE (N_("Zoom 1:1"), N_("Zoom to 1:1"), + gl_tools_zoom1to1_cb), + + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_ITEM_NONE (N_("Merge properties"), + N_("Edit merge properties"), + gl_tools_merge_properties_cb), + + GNOMEUIINFO_END +}; + +static GnomeUIInfo menu_settings[] = { + GNOMEUIINFO_MENU_PREFERENCES_ITEM (gl_prefs_cb, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo menu_windows[] = { + GNOMEUIINFO_END +}; + +static GnomeUIInfo menu_help[] = { + GNOMEUIINFO_HELP ("glabels"), + GNOMEUIINFO_MENU_ABOUT_ITEM (about_cb, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo menu_main[] = { + GNOMEUIINFO_MENU_FILE_TREE (menu_file), + GNOMEUIINFO_MENU_EDIT_TREE (menu_edit), + GNOMEUIINFO_SUBTREE (N_("_Tools"), menu_tools), + GNOMEUIINFO_MENU_SETTINGS_TREE (menu_settings), + GNOMEUIINFO_MENU_WINDOWS_TREE (menu_windows), + GNOMEUIINFO_MENU_HELP_TREE (menu_help), + GNOMEUIINFO_END +}; + +/*===========================================*/ +/* Toolbar definitions */ +/*===========================================*/ +static GnomeUIInfo toolbar[] = { + GNOMEUIINFO_ITEM_STOCK (N_(" New "), N_("New Label/Card"), + gl_file_new_cb, GNOME_STOCK_PIXMAP_NEW), + GNOMEUIINFO_ITEM_STOCK (N_(" Open "), N_("Open a file"), + gl_file_open_cb, GNOME_STOCK_PIXMAP_OPEN), + GNOMEUIINFO_ITEM_STOCK (N_(" Save "), N_("Save current file"), + gl_file_save_cb, GNOME_STOCK_PIXMAP_SAVE), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_STOCK (N_(" Print "), N_("Print current file"), + gl_print_dialog_cb, GNOME_STOCK_PIXMAP_PRINT), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_END +}; + +/*****************************************************************************/ +/* Drawing tools toolbar definitions */ +/*****************************************************************************/ +static GnomeUIInfo tools_toolbar[] = { + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Select, move and modify objects"), + gl_tools_arrow_cb, GL_STOCK_PIXMAP_ARROW), + + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Create text object"), + gl_tools_text_cb, GL_STOCK_PIXMAP_TEXT), + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Create box/rectangle object"), + gl_tools_box_cb, GL_STOCK_PIXMAP_BOX), + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Create line object"), + gl_tools_line_cb, GL_STOCK_PIXMAP_LINE), + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Create ellipse/circle object"), + gl_tools_ellipse_cb, GL_STOCK_PIXMAP_ELLIPSE), + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Create image object"), + gl_tools_image_cb, GL_STOCK_PIXMAP_IMAGE), + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Create barcode object"), + gl_tools_barcode_cb, GL_STOCK_PIXMAP_BARCODE), + + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Zoom in"), + gl_tools_zoomin_cb, GL_STOCK_PIXMAP_ZOOMIN), + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Zoom out"), + gl_tools_zoomout_cb, GL_STOCK_PIXMAP_ZOOMOUT), + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Zoom to 1:1"), + gl_tools_zoom1to1_cb, + GL_STOCK_PIXMAP_ZOOM1TO1), + + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_ITEM_STOCK (NULL, N_("Merge properties"), + gl_tools_merge_properties_cb, + GL_STOCK_PIXMAP_MERGE), + + GNOMEUIINFO_END +}; + + +/****************************************************************************/ +/* Install menus templates in mdi. */ +/****************************************************************************/ +void +gl_menu_install_menus (GnomeMDI * mdi) +{ + gnome_mdi_set_menubar_template (mdi, menu_main); + gnome_mdi_set_child_list_path (mdi, GNOME_MENU_WINDOWS_PATH); +} + +/****************************************************************************/ +/* Install toolbar in application window. */ +/****************************************************************************/ +void +gl_menu_install_toolbar (GnomeMDI * mdi) +{ + gnome_mdi_set_toolbar_template (mdi, toolbar); +} + +/*****************************************************************************/ +/* Install drawing tools toolbar in application window. */ +/*****************************************************************************/ +void +gl_menu_install_tools_toolbar (GnomeMDI * mdi, + GnomeApp * app) +{ + GtkWidget *toolbar; + + toolbar = gtk_toolbar_new (GTK_ORIENTATION_VERTICAL, + GTK_TOOLBAR_ICONS); + + gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar), tools_toolbar, + NULL, mdi); + gnome_app_add_toolbar (GNOME_APP (app), GTK_TOOLBAR (toolbar), + "ToolsToolbar", GNOME_DOCK_ITEM_BEH_NORMAL, + GNOME_DOCK_LEFT, 1, 1, 0); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE about menu callback. */ +/*--------------------------------------------------------------------------*/ +static void +about_cb (GtkWidget * widget, + gpointer data) +{ + static GtkWidget *dialog = NULL; + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + + if (dialog != NULL) { + g_assert (GTK_WIDGET_REALIZED (dialog)); + gdk_window_show (dialog->window); + gdk_window_raise (dialog->window); + } else { + const gchar *authors[] = { + "Jim Evins ", + NULL + }; + gchar *copy_text = "Copyright 2001 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"); + + dialog = gnome_about_new ("glabels", VERSION, + copy_text, authors, about_text, + LOGO_PIXMAP); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (app)); + + gtk_signal_connect (GTK_OBJECT (dialog), "destroy", + GTK_SIGNAL_FUNC (gtk_widget_destroyed), + &dialog); + + gtk_widget_show (dialog); + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. place-holder callback. */ +/*--------------------------------------------------------------------------*/ +static void +nothing_cb (GtkWidget * widget, + gpointer data) +{ + GtkWidget *dialog; + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + + dialog = gnome_ok_dialog (_("Function is not implemented!")); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (app)); +} diff --git a/glabels1/src/menu.h b/glabels1/src/menu.h new file mode 100644 index 00000000..01e119df --- /dev/null +++ b/glabels1/src/menu.h @@ -0,0 +1,32 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * menu.h: Menu module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MENU_H__ +#define __MENU_H__ + +#include + +extern void gl_menu_install_menus (GnomeMDI * mdi); +extern void gl_menu_install_toolbar (GnomeMDI * mdi); +extern void gl_menu_install_tools_toolbar (GnomeMDI * mdi, GnomeApp * app); + + +#endif diff --git a/glabels1/src/merge.c b/glabels1/src/merge.c new file mode 100644 index 00000000..34965c87 --- /dev/null +++ b/glabels1/src/merge.c @@ -0,0 +1,460 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge.c: document merge module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "merge.h" +#include "merge_text.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ +typedef struct { + gchar *short_text; + gchar *long_text; +} TypeTexts; + +typedef struct { + + glMergeInput * (*open) (glMergeType, GList *, gchar *); + void (*close) (glMergeInput *); + glMergeRecord * (*get_record) (glMergeInput *); + GList * (*get_raw_record) (glMergeInput *); + +} BackendFunctions; + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static TypeTexts type_text[GL_MERGE_N_TYPES]; + +static BackendFunctions func[GL_MERGE_N_TYPES]; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_merge_init (void) +{ + gint i; + + /* 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"); + +} + +/*****************************************************************************/ +/* Lookup type from short text. */ +/*****************************************************************************/ +glMergeType +gl_merge_text_to_type (gchar * text) +{ + glMergeType type; + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + if (g_strcasecmp (text, type_text[type].short_text) == 0) { + return type; + } + } + + return GL_MERGE_NONE; + +} + +/*****************************************************************************/ +/* Lookup short text for given type. */ +/*****************************************************************************/ +gchar * +gl_merge_type_to_text (glMergeType type) +{ + 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; + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + if (g_strcasecmp (text, type_text[type].long_text) == 0) { + return type; + } + } + + return GL_MERGE_NONE; +} + +/*****************************************************************************/ +/* Lookup longer, more descriptive text for given type. */ +/*****************************************************************************/ +gchar * +gl_merge_type_to_long_text (glMergeType type) +{ + 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; + + for (type = 0; type < GL_MERGE_N_TYPES; type++) { + + list = g_list_append (list, gl_merge_type_to_long_text (type)); + + } + + return list; +} + +/*****************************************************************************/ +/* Free list of descriptive texts. */ +/*****************************************************************************/ +void +gl_merge_free_long_texts_list (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; +} + +/*****************************************************************************/ +/* Free list of field definitions. */ +/*****************************************************************************/ +void +gl_merge_free_field_def_list (GList ** list) +{ + GList *p; + glMergeFieldDefinition *field_def; + + 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; + +} + +/*****************************************************************************/ +/* 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; + + 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)); + } + + return keys; +} + +/*****************************************************************************/ +/* Free a list of keys. */ +/*****************************************************************************/ +void +gl_merge_free_key_list (GList ** keys) +{ + GList *p; + + for (p = *keys; p != NULL; p = p->next) { + g_free (p->data); + p->data = NULL; + } + + g_list_free (*keys); + *keys = NULL; +} + +/*****************************************************************************/ +/* Lookup key for given locator. */ +/*****************************************************************************/ +gchar * +gl_merge_find_key (GList * field_defs, + gchar * loc) +{ + GList *p; + glMergeFieldDefinition *field_def; + + for (p = field_defs; p != NULL; p = p->next) { + field_def = (glMergeFieldDefinition *) p->data; + + if (strcmp (loc, field_def->loc) == 0) { + return g_strdup (field_def->key); + } + + } + + return NULL; +} + +/*****************************************************************************/ +/* Open merge source front-end. */ +/*****************************************************************************/ +glMergeInput * +gl_merge_open (glMergeType type, + GList * field_defs, + gchar * src) +{ + return func[type].open (type, field_defs, src); +} + +/*****************************************************************************/ +/* Close merge source front-end. */ +/*****************************************************************************/ +void +gl_merge_close (glMergeInput * input) +{ + if ( input != NULL ) { + func[input->type].close (input); + } +} + +/*****************************************************************************/ +/* Get next record from merge source, NULL if exhausted (front-end). */ +/*****************************************************************************/ +glMergeRecord * +gl_merge_get_record (glMergeInput * input) +{ + 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) +{ + 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; + + 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; +} + +/*****************************************************************************/ +/* Free a merge record (list of fields) */ +/*****************************************************************************/ +void +gl_merge_free_raw_record (GList ** record) +{ + GList *p; + glMergeRawField *field; + + 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; +} + +/*****************************************************************************/ +/* Find key in given record and evaluate. */ +/*****************************************************************************/ +extern gchar * +gl_merge_eval_key (gchar * key, + glMergeRecord * record) +{ + GList *p; + glMergeField *field; + + if ( record != NULL ) { + for (p = record->field_list; p != NULL; p = p->next) { + field = (glMergeField *) p->data; + + if (strcmp (key, field->key) == 0) { + return g_strdup (field->value); + } + + } + } + 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; + + 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); + + return record_list; +} + +/*****************************************************************************/ +/* Free a list of records. */ +/*****************************************************************************/ +void +gl_merge_free_data (GList ** record_list) +{ + GList *p; + glMergeRecord *record; + + 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; +} + +/*****************************************************************************/ +/* Count selected records. */ +/*****************************************************************************/ +gint +gl_merge_count_records (GList *record_list) +{ + GList *p; + glMergeRecord *record; + gint count; + + count = 0; + for ( p=record_list; p!=NULL; p=p->next ) { + record = (glMergeRecord *)p->data; + + if ( record->select_flag ) count ++; + } + return count; +} + diff --git a/glabels1/src/merge.h b/glabels1/src/merge.h new file mode 100644 index 00000000..ce870199 --- /dev/null +++ b/glabels1/src/merge.h @@ -0,0 +1,94 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge.h: document merge module header file + * + * Copyright (C) 2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_H__ +#define __MERGE_H__ + +#include + +typedef enum { + + GL_MERGE_NONE, + GL_MERGE_TEXT_TAB, + GL_MERGE_TEXT_COMMA, + GL_MERGE_TEXT_COLON, + + GL_MERGE_N_TYPES +} glMergeType; + +typedef struct { + glMergeType type; + GList *field_defs; + gpointer handle; +} glMergeInput; + +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; + +extern void + gl_merge_init (void); + +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 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/glabels1/src/merge_properties.c b/glabels1/src/merge_properties.c new file mode 100644 index 00000000..a2fc1c2f --- /dev/null +++ b/glabels1/src/merge_properties.c @@ -0,0 +1,258 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_properties.c: document merge properties dialog module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "mdi.h" +#include "display.h" +#include "merge.h" +#include "merge_ui.h" +#include "merge_properties.h" + +#include "debug.h" + +/*===========================================*/ +/* Private data types */ +/*===========================================*/ + +typedef struct { + GtkWidget *dialog; + + glDisplay *display; + glLabel *label; + gchar *name; + + 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 (GnomeDialog * dialog, + PropertyDialogPassback * data); + +static void type_changed_cb (GtkWidget * widget, PropertyDialogPassback * data); +static void src_changed_cb (GtkWidget * widget, PropertyDialogPassback * data); + +static void ok_cb (GtkWidget * widget, PropertyDialogPassback * data); + +/****************************************************************************/ +/* Launch merge properties dialog. */ +/****************************************************************************/ +void +gl_merge_properties_dialog (glDisplay * display, + gchar * basename) +{ + static PropertyDialogPassback *data = NULL; + GtkWidget *dialog; + + if (data == NULL) { + data = g_new0 (PropertyDialogPassback, 1); + } + + dialog = gnome_dialog_new (_("Edit document-merge properties"), + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_CANCEL, NULL); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (gl_mdi_get_active_window ())); + + data->dialog = dialog; + data->display = display; + data->label = display->label; + data->name = basename; + + data->type_entry = NULL; + data->src_entry = NULL; + data->field_ws = NULL; + + create_merge_dialog_widgets (GNOME_DIALOG (dialog), data); + + gnome_dialog_button_connect (GNOME_DIALOG (dialog), 0, + GTK_SIGNAL_FUNC (ok_cb), data); + + gnome_dialog_button_connect_object (GNOME_DIALOG (dialog), 1, + GTK_SIGNAL_FUNC + (gtk_widget_destroy), + GTK_OBJECT (dialog)); + + gtk_widget_show_all (GTK_WIDGET (dialog)); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Create and add start page to druid. */ +/*--------------------------------------------------------------------------*/ +static void +create_merge_dialog_widgets (GnomeDialog * dialog, + PropertyDialogPassback * data) +{ + GtkWidget *wvbox, *wframe, *whbox, *wtable, *wlabel, *wcombo, *wscroll; + GList *texts; + glMergeType type; + gchar *src; + GList *fields; + + type = data->label->merge_type; + src = data->label->merge_src; + fields = data->label->merge_fields; + + 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); + + gtk_signal_connect (GTK_OBJECT (data->type_entry), "changed", + GTK_SIGNAL_FUNC (type_changed_cb), data); + gtk_signal_connect (GTK_OBJECT (data->src_entry), "changed", + GTK_SIGNAL_FUNC (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. "OK" callback. */ +/*--------------------------------------------------------------------------*/ +static void +ok_cb (GtkWidget * widget, + PropertyDialogPassback * data) +{ + gchar *type_text; + + type_text = gtk_editable_get_chars (GTK_EDITABLE (data->type_entry), + 0, -1); + data->label->merge_type = gl_merge_long_text_to_type (type_text); + g_free (type_text); + + data->label->merge_src = + gl_merge_ui_src_get_value (GL_MERGE_UI_SRC (data->src_entry)); + + gl_merge_free_field_def_list (&data->label->merge_fields); + data->label->merge_fields = + gl_merge_ui_field_ws_get_field_defs (GL_MERGE_UI_FIELD_WS + (data->field_ws)); + + gl_display_set_modified (data->display); + + gtk_widget_destroy (data->dialog); +} diff --git a/glabels1/src/merge_properties.h b/glabels1/src/merge_properties.h new file mode 100644 index 00000000..ba134394 --- /dev/null +++ b/glabels1/src/merge_properties.h @@ -0,0 +1,29 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_properties.h: document merge properties dialog module header file + * + * Copyright (C) 2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_PROPERTIES_H__ +#define __MERGE_PROPERTIES_H__ + +#include + +extern void gl_merge_properties_dialog (glDisplay * display, gchar * basename); + +#endif diff --git a/glabels1/src/merge_text.c b/glabels1/src/merge_text.c new file mode 100644 index 00000000..9cf0a298 --- /dev/null +++ b/glabels1/src/merge_text.c @@ -0,0 +1,272 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_text.c: text-file merge backend module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include + +#include "merge_text.h" + +#include "debug.h" + +#define LINE_BUF_LEN 1024 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ +static GList * split_fields( gchar *line, gchar delim ); +static void free_fields( GList **fields ); + + +/****************************************************************************/ +/* Open merge source. */ +/****************************************************************************/ +glMergeInput * +gl_merge_text_open (glMergeType type, + GList * field_defs, + gchar * src) +{ + FILE *fp; + glMergeInput *input; + + fp = fopen (src, "r"); + if (fp == NULL) { + return NULL; + } + + input = g_new0 (glMergeInput, 1); + input->type = type; + input->field_defs = field_defs; + input->handle = fp; + + return input; +} + +/****************************************************************************/ +/* Close merge source. */ +/****************************************************************************/ +void +gl_merge_text_close (glMergeInput * input) +{ + if (input != NULL) { + + fclose ((FILE *) input->handle); + g_free (input); + + } +} + +/****************************************************************************/ +/* Get next record from merge source, NULL if no records left (i.e EOF) */ +/****************************************************************************/ +glMergeRecord * +gl_merge_text_get_record (glMergeInput * input) +{ + gchar delim, *loc; + GList *fields, *p; + gint i_field; + glMergeRecord *record = NULL; + glMergeField *field; + gchar line[LINE_BUF_LEN]; + + if (input != NULL) { + + switch (input->type) { + case GL_MERGE_TEXT_TAB: + delim = '\t'; + break; + case GL_MERGE_TEXT_COLON: + delim = ':'; + break; + case GL_MERGE_TEXT_COMMA: + delim = ','; + break; + default: + WARN ("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: + WARN ("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, 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/glabels1/src/merge_text.h b/glabels1/src/merge_text.h new file mode 100644 index 00000000..b1dddef7 --- /dev/null +++ b/glabels1/src/merge_text.h @@ -0,0 +1,35 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_text.h: text-file merge backend module header file + * + * Copyright (C) 2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_TEXT_H__ +#define __MERGE_TEXT_H__ + +#include + +#include "merge.h" + +extern glMergeInput *gl_merge_text_open (glMergeType type, GList * field_defs, + gchar * src); +extern void gl_merge_text_close (glMergeInput * input); +extern glMergeRecord *gl_merge_text_get_record (glMergeInput * input); +extern GList *gl_merge_text_get_raw_record (glMergeInput * input); + +#endif diff --git a/glabels1/src/merge_ui.c b/glabels1/src/merge_ui.c new file mode 100644 index 00000000..fb422545 --- /dev/null +++ b/glabels1/src/merge_ui.c @@ -0,0 +1,498 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui.c: document merge user interface module + * + * Copyright (C) 2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "merge_ui.h" + +/* 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_init (glMergeUISrc * src); +static void gl_merge_ui_src_destroy (GtkObject * 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_init (glMergeUIFieldWS * field_ws); +static void gl_merge_ui_field_ws_destroy (GtkObject * object); + +static void field_ws_changed_cb (glMergeUIFieldWS * field_ws); + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_merge_ui_init (void) +{ + gint i; + + /* 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; + +} + +/*****************************************************************************/ +/* Boilerplate Object stuff. */ +/*****************************************************************************/ +guint +gl_merge_ui_src_get_type (void) +{ + static guint merge_ui_src_type = 0; + + if (!merge_ui_src_type) { + GtkTypeInfo merge_ui_src_info = { + "glMergeUISrc", + sizeof (glMergeUISrc), + sizeof (glMergeUISrcClass), + (GtkClassInitFunc) gl_merge_ui_src_class_init, + (GtkObjectInitFunc) gl_merge_ui_src_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + merge_ui_src_type = gtk_type_unique (gtk_vbox_get_type (), + &merge_ui_src_info); + } + + return merge_ui_src_type; +} + +static void +gl_merge_ui_src_class_init (glMergeUISrcClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_merge_ui_src_destroy; + + merge_ui_src_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glMergeUISrcClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, + merge_ui_src_signals, LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_merge_ui_src_init (glMergeUISrc * src) +{ + src->backend_widget = NULL; +} + +static void +gl_merge_ui_src_destroy (GtkObject * object) +{ + glMergeUISrc *src; + glMergeUISrcClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MERGE_UI_SRC (object)); + + src = GL_MERGE_UI_SRC (object); + class = GL_MERGE_UI_SRC_CLASS (GTK_OBJECT (src)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_merge_ui_src_new (void) +{ + glMergeUISrc *src; + + src = gtk_type_new (gl_merge_ui_src_get_type ()); + + 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); + + return GTK_WIDGET (src); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +src_changed_cb (glMergeUISrc * src) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (src), merge_ui_src_signals[CHANGED]); +} + +/*****************************************************************************/ +/* Set type. */ +/*****************************************************************************/ +void +gl_merge_ui_src_set_type (glMergeUISrc * src, + glMergeType type) +{ + + 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) { + gtk_signal_connect_object (GTK_OBJECT + (src->backend_widget), + "changed", + GTK_SIGNAL_FUNC + (src_changed_cb), + GTK_OBJECT (src)); + } + + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (src), + merge_ui_src_signals[CHANGED]); + } + +} + +/*****************************************************************************/ +/* Set src. */ +/*****************************************************************************/ +void +gl_merge_ui_src_set_value (glMergeUISrc * src, + gchar * text) +{ + glMergeType type; + + type = src->type; + + if (type != GL_MERGE_NONE) { + func[type].src_set_value (src->backend_widget, text); + } else { + return; + } + +} + +/*****************************************************************************/ +/* Get src name. */ +/*****************************************************************************/ +gchar * +gl_merge_ui_src_get_value (glMergeUISrc * src) +{ + glMergeType type; + + 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; + + if (!merge_ui_field_ws_type) { + GtkTypeInfo merge_ui_field_ws_info = { + "glMergeUIFieldWS", + sizeof (glMergeUIFieldWS), + sizeof (glMergeUIFieldWSClass), + (GtkClassInitFunc) gl_merge_ui_field_ws_class_init, + (GtkObjectInitFunc) gl_merge_ui_field_ws_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + merge_ui_field_ws_type = gtk_type_unique (gtk_vbox_get_type (), + &merge_ui_field_ws_info); + } + + return merge_ui_field_ws_type; +} + +static void +gl_merge_ui_field_ws_class_init (glMergeUIFieldWSClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_merge_ui_field_ws_destroy; + + merge_ui_field_ws_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glMergeUIFieldWSClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, + merge_ui_field_ws_signals, LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_merge_ui_field_ws_init (glMergeUIFieldWS * field_ws) +{ + field_ws->type = GL_MERGE_NONE; + field_ws->src = NULL; + field_ws->backend_widget = NULL; +} + +static void +gl_merge_ui_field_ws_destroy (GtkObject * object) +{ + glMergeUIFieldWS *field_ws; + glMergeUIFieldWSClass *class; + + 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); + class = GL_MERGE_UI_FIELD_WS_CLASS (GTK_OBJECT (field_ws)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_merge_ui_field_ws_new (void) +{ + glMergeUIFieldWS *field_ws; + + field_ws = gtk_type_new (gl_merge_ui_field_ws_get_type ()); + + 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); + + return GTK_WIDGET (field_ws); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +field_ws_changed_cb (glMergeUIFieldWS * field_ws) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED]); +} + +/*****************************************************************************/ +/* 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) +{ + + 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) { + gtk_signal_connect_object (GTK_OBJECT + (field_ws->backend_widget), + "changed", + GTK_SIGNAL_FUNC + (field_ws_changed_cb), + GTK_OBJECT (field_ws)); + } + + if (GTK_WIDGET_VISIBLE (field_ws)) { + gtk_widget_show_all (field_ws->backend_widget); + } + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED]); + +} + +/*****************************************************************************/ +/* 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; + + 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 */ + gtk_signal_emit (GTK_OBJECT (field_ws), + merge_ui_field_ws_signals[CHANGED]); + + } +} + +/*****************************************************************************/ +/* Get field definitions (associate ids with raw fields). */ +/*****************************************************************************/ +GList * +gl_merge_ui_field_ws_get_field_defs (glMergeUIFieldWS * field_ws) +{ + glMergeType type; + + 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/glabels1/src/merge_ui.h b/glabels1/src/merge_ui.h new file mode 100644 index 00000000..e5a7e719 --- /dev/null +++ b/glabels1/src/merge_ui.h @@ -0,0 +1,106 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui.h: document merge user interface module header file + * + * Copyright (C) 2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_UI_H__ +#define __MERGE_UI_H__ + +#include + +#include "merge.h" + +extern void + gl_merge_ui_init (void); + +/*======================================================*/ +/* Merge source selection widget */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_SRC (gl_merge_ui_src_get_type ()) +#define GL_MERGE_UI_SRC(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_SRC, glMergeUISrc )) +#define GL_MERGE_UI_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_SRC, glMergeUISrcClass)) +#define GL_IS_MERGE_UI_SRC(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_SRC)) +#define GL_IS_MERGE_UI_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_SRC)) + +typedef struct _glMergeUISrc glMergeUISrc; +typedef struct _glMergeUISrcClass glMergeUISrcClass; + +struct _glMergeUISrc { + GtkVBox parent_widget; + + glMergeType type; + GtkWidget *backend_widget; +}; + +struct _glMergeUISrcClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUISrc * src, gpointer user_data); +}; + +extern guint gl_merge_ui_src_get_type (void); +extern GtkWidget *gl_merge_ui_src_new (void); +extern void gl_merge_ui_src_set_type (glMergeUISrc * src, glMergeType type); +extern void gl_merge_ui_src_set_value (glMergeUISrc * src, gchar * text); +extern gchar *gl_merge_ui_src_get_value (glMergeUISrc * src); + +/*======================================================*/ +/* Merge field selection/definition widget. */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_FIELD_WS (gl_merge_ui_field_ws_get_type ()) +#define GL_MERGE_UI_FIELD_WS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_FIELD_WS, glMergeUIFieldWS )) +#define GL_MERGE_UI_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_FIELD_WS, glMergeUIFieldWSClass)) +#define GL_IS_MERGE_UI_FIELD_WS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_FIELD_WS)) +#define GL_IS_MERGE_UI_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_FIELD_WS)) + +typedef struct _glMergeUIFieldWS glMergeUIFieldWS; +typedef struct _glMergeUIFieldWSClass glMergeUIFieldWSClass; + +struct _glMergeUIFieldWS { + GtkVBox parent_widget; + + glMergeType type; + gchar *src; + GtkWidget *backend_widget; +}; + +struct _glMergeUIFieldWSClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUIFieldWS * field_ws, gpointer user_data); +}; + +extern guint gl_merge_ui_field_ws_get_type (void); +extern GtkWidget *gl_merge_ui_field_ws_new (void); +extern void gl_merge_ui_field_ws_set_type_src (glMergeUIFieldWS * field_ws, + glMergeType type, + gchar * src); +extern void gl_merge_ui_field_ws_set_field_defs (glMergeUIFieldWS * field_ws, + GList * field_defs); +extern GList *gl_merge_ui_field_ws_get_field_defs (glMergeUIFieldWS * field_ws); + +#endif diff --git a/glabels1/src/merge_ui_text.c b/glabels1/src/merge_ui_text.c new file mode 100644 index 00000000..5e7954db --- /dev/null +++ b/glabels1/src/merge_ui_text.c @@ -0,0 +1,449 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui_text.c: text-file document merge user interface backend module + * + * Copyright (C) 2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "merge_ui_text.h" +#include "merge_text.h" + +#include "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_init (glMergeUITextSrc * src); +static void gl_merge_ui_text_src_destroy (GtkObject * 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_init (glMergeUITextFieldWS * field_ws); +static void gl_merge_ui_text_field_ws_destroy (GtkObject * 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) { + GtkTypeInfo merge_ui_text_src_info = { + "glMergeUITextSrc", + sizeof (glMergeUITextSrc), + sizeof (glMergeUITextSrcClass), + (GtkClassInitFunc) gl_merge_ui_text_src_class_init, + (GtkObjectInitFunc) gl_merge_ui_text_src_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + merge_ui_text_src_type = gtk_type_unique (gtk_vbox_get_type (), + &merge_ui_text_src_info); + } + + return merge_ui_text_src_type; +} + +static void +gl_merge_ui_text_src_class_init (glMergeUITextSrcClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_merge_ui_text_src_destroy; + + merge_ui_text_src_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glMergeUITextSrcClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, + merge_ui_text_src_signals, LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_merge_ui_text_src_init (glMergeUITextSrc * src) +{ + src->type = GL_MERGE_NONE; + src->entry = NULL; +} + +static void +gl_merge_ui_text_src_destroy (GtkObject * 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); + class = GL_MERGE_UI_TEXT_SRC_CLASS (GTK_OBJECT (src)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_merge_ui_text_src_new (glMergeType type) +{ + glMergeUITextSrc *src; + + src = gtk_type_new (gl_merge_ui_text_src_get_type ()); + + 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)); + gtk_signal_connect_object (GTK_OBJECT (wentry), "changed", + GTK_SIGNAL_FUNC (src_changed_cb), + GTK_OBJECT (src)); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when our backend widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +src_changed_cb (glMergeUITextSrc * src) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (src), merge_ui_text_src_signals[CHANGED]); +} + +/*****************************************************************************/ +/* 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) { + GtkTypeInfo merge_ui_text_field_ws_info = { + "glMergeUITextFieldWS", + sizeof (glMergeUITextFieldWS), + sizeof (glMergeUITextFieldWSClass), + (GtkClassInitFunc) gl_merge_ui_text_field_ws_class_init, + (GtkObjectInitFunc) gl_merge_ui_text_field_ws_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + merge_ui_text_field_ws_type = + gtk_type_unique (gtk_hbox_get_type (), + &merge_ui_text_field_ws_info); + } + + return merge_ui_text_field_ws_type; +} + +static void +gl_merge_ui_text_field_ws_class_init (glMergeUITextFieldWSClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->destroy = gl_merge_ui_text_field_ws_destroy; + + merge_ui_text_field_ws_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glMergeUITextFieldWSClass, + changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, + merge_ui_text_field_ws_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_merge_ui_text_field_ws_init (glMergeUITextFieldWS * field_ws) +{ + field_ws->type = GL_MERGE_NONE; + field_ws->entry_list = NULL; +} + +static void +gl_merge_ui_text_field_ws_destroy (GtkObject * 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); + class = GL_MERGE_UI_TEXT_FIELD_WS_CLASS (GTK_OBJECT (field_ws)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_merge_ui_text_field_ws_new (glMergeType type, + gchar * src) +{ + glMergeUITextFieldWS *field_ws; + + field_ws = gtk_type_new (gl_merge_ui_text_field_ws_get_type ()); + + 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); + + gtk_signal_connect_object (GTK_OBJECT (wentry), "changed", + GTK_SIGNAL_FUNC + (field_ws_changed_cb), + GTK_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 */ + gtk_signal_emit (GTK_OBJECT (field_ws), + merge_ui_text_field_ws_signals[CHANGED]); +} diff --git a/glabels1/src/merge_ui_text.h b/glabels1/src/merge_ui_text.h new file mode 100644 index 00000000..42006f2f --- /dev/null +++ b/glabels1/src/merge_ui_text.h @@ -0,0 +1,101 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * merge_ui_text.h: text-file merge user interface backend header + * + * Copyright (C) 2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __MERGE_UI_TEXT_H__ +#define __MERGE_UI_TEXT_H__ + +#include + +#include "merge.h" + +/*======================================================*/ +/* Merge source selection widget */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_TEXT_SRC (gl_merge_ui_text_src_get_type ()) +#define GL_MERGE_UI_TEXT_SRC(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_TEXT_SRC, glMergeUITextSrc )) +#define GL_MERGE_UI_TEXT_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_TEXT_SRC, glMergeUITextSrcClass)) +#define GL_IS_MERGE_UI_TEXT_SRC(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_TEXT_SRC)) +#define GL_IS_MERGE_UI_TEXT_SRC_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_TEXT_SRC)) + +typedef struct _glMergeUITextSrc glMergeUITextSrc; +typedef struct _glMergeUITextSrcClass glMergeUITextSrcClass; + +struct _glMergeUITextSrc { + GtkVBox parent_widget; + + glMergeType type; + GtkWidget *entry; +}; + +struct _glMergeUITextSrcClass { + GtkVBoxClass parent_class; + + void (*changed) (glMergeUITextSrc * src, gpointer user_data); +}; + +extern guint gl_merge_ui_text_src_get_type (void); +extern GtkWidget *gl_merge_ui_text_src_new (glMergeType type); +extern void gl_merge_ui_text_src_set_value (glMergeUITextSrc * src, + gchar * text); +extern gchar *gl_merge_ui_text_src_get_value (glMergeUITextSrc * src); + +/*======================================================*/ +/* Merge field selection/definition widget. */ +/*======================================================*/ +#define GL_TYPE_MERGE_UI_TEXT_FIELD_WS (gl_merge_ui_text_field_ws_get_type ()) +#define GL_MERGE_UI_TEXT_FIELD_WS(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MERGE_UI_TEXT_FIELD_WS, glMergeUITextFieldWS )) +#define GL_MERGE_UI_TEXT_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_UI_TEXT_FIELD_WS, glMergeUITextFieldWSClass)) +#define GL_IS_MERGE_UI_TEXT_FIELD_WS(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_UI_TEXT_FIELD_WS)) +#define GL_IS_MERGE_UI_TEXT_FIELD_WS_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_UI_TEXT_FIELD_WS)) + +typedef struct _glMergeUITextFieldWS glMergeUITextFieldWS; +typedef struct _glMergeUITextFieldWSClass glMergeUITextFieldWSClass; + +struct _glMergeUITextFieldWS { + GtkHBox parent_widget; + + glMergeType type; + GList *entry_list; +}; + +struct _glMergeUITextFieldWSClass { + GtkHBoxClass parent_class; + + void (*changed) (glMergeUITextFieldWS * field_ws, gpointer user_data); +}; + +extern guint gl_merge_ui_text_field_ws_get_type (void); +extern GtkWidget *gl_merge_ui_text_field_ws_new (glMergeType type, + gchar * src); +extern void gl_merge_ui_text_field_ws_set_field_defs (glMergeUITextFieldWS * field_ws, + GList * field_defs); +extern GList *gl_merge_ui_text_field_ws_get_field_defs (glMergeUITextFieldWS * + field_ws); + +#endif diff --git a/glabels1/src/mini_preview.c b/glabels1/src/mini_preview.c new file mode 100644 index 00000000..9b4f5ef6 --- /dev/null +++ b/glabels1/src/mini_preview.c @@ -0,0 +1,481 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mini_preview.c: mini preview widget module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "mini_preview.h" + +#include "debug.h" + +#define MINI_PREVIEW_MAX_PIXELS 175 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CLICKED, + PRESSED, + LAST_SIGNAL +}; + + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint mini_preview_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_mini_preview_class_init (glMiniPreviewClass * class); +static void gl_mini_preview_init (glMiniPreview * preview); +static void gl_mini_preview_destroy (GtkObject * object); + +static void gl_mini_preview_construct (glMiniPreview * 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_mini_preview_get_type (void) +{ + static guint mini_preview_type = 0; + + if (!mini_preview_type) { + GtkTypeInfo mini_preview_info = { + "glMiniPreview", + sizeof (glMiniPreview), + sizeof (glMiniPreviewClass), + (GtkClassInitFunc) gl_mini_preview_class_init, + (GtkObjectInitFunc) gl_mini_preview_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + mini_preview_type = gtk_type_unique (gtk_hbox_get_type (), + &mini_preview_info); + } + + return mini_preview_type; +} + +static void +gl_mini_preview_class_init (glMiniPreviewClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->destroy = gl_mini_preview_destroy; + + mini_preview_signals[CLICKED] = + gtk_signal_new ("clicked", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glMiniPreviewClass, clicked), + gtk_marshal_NONE__INT, + GTK_TYPE_NONE, 1, GTK_TYPE_INT); + + mini_preview_signals[PRESSED] = + gtk_signal_new ("pressed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glMiniPreviewClass, pressed), + gtk_marshal_NONE__INT_INT, + GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); + + gtk_object_class_add_signals (object_class, mini_preview_signals, + LAST_SIGNAL); + + class->clicked = NULL; + class->pressed = NULL; +} + +static void +gl_mini_preview_init (glMiniPreview * preview) +{ + preview->canvas = NULL; + preview->label_items = NULL; +} + +static void +gl_mini_preview_destroy (GtkObject * object) +{ + glMiniPreview *preview; + glMiniPreviewClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_MINI_PREVIEW (object)); + + preview = GL_MINI_PREVIEW (object); + class = GL_MINI_PREVIEW_CLASS (GTK_OBJECT (preview)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_mini_preview_new (gint height, + gint width) +{ + glMiniPreview *preview; + + preview = gtk_type_new (gl_mini_preview_get_type ()); + + gl_mini_preview_construct (preview, height, width); + + return GTK_WIDGET (preview); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_mini_preview_construct (glMiniPreview * preview, + gint height, + gint width) +{ + GtkWidget *whbox; + GnomeCanvasGroup *group; + + whbox = GTK_WIDGET (preview); + + preview->height = height; + preview->width = width; + + /* create canvas */ + gtk_widget_push_visual (gdk_rgb_get_visual ()); + gtk_widget_push_colormap (gdk_rgb_get_cmap ()); + preview->canvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + gtk_widget_pop_visual (); + gtk_box_pack_start (GTK_BOX (whbox), preview->canvas, TRUE, TRUE, 0); + gtk_widget_set_usize (preview->canvas, width, height); + gnome_canvas_set_scroll_region (GNOME_CANVAS (preview->canvas), + 0.0, 0.0, width, height); + + /* draw an initial paper outline */ + gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (preview->canvas), 1.0); + group = gnome_canvas_root (GNOME_CANVAS (preview->canvas)); + 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 */ + gtk_signal_connect (GTK_OBJECT (preview->canvas), "event", + GTK_SIGNAL_FUNC (canvas_event_cb), preview); + +} + +/****************************************************************************/ +/* Set label for mini-preview to determine geometry. */ +/****************************************************************************/ +void gl_mini_preview_set_label (glMiniPreview * preview, + gchar *name) +{ + glTemplate *template; + const GnomePaper *paper = NULL; + gdouble paper_width, paper_height; + gdouble canvas_scale; + gdouble w, h; + + /* Fetch template */ + template = gl_template_from_name (name); + + /* get paper size and set scale */ + paper = gnome_paper_with_name (template->page_size); + paper_width = gnome_paper_pswidth (paper); + paper_height = gnome_paper_psheight (paper); + w = preview->width - 4; + h = preview->height - 4; + 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 paper outline */ + gnome_canvas_item_set (preview->paper_item, + "x1", 0.0, + "y1", 0.0, + "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 ); + +} + +/*--------------------------------------------------------------------------*/ +/* 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; + + group = gnome_canvas_root (canvas); + + /* draw mini label outlines */ + i = 1; + for (iy = 0; iy < template->ny; 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; + + 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: + WARN ("Unknown label style"); + return list; + break; + } + gtk_object_set_data (GTK_OBJECT (item), "i", + GINT_TO_POINTER (i)); + + list = g_list_append (list, item); + } + } + + return list; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw label outlines and return canvas item list. */ +/*--------------------------------------------------------------------------*/ +static void +mini_outline_list_free (GList ** list) +{ + GnomeCanvasItem *item; + GList *p; + + 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; + + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static gint +canvas_event_cb (GnomeCanvas * canvas, + GdkEvent * event, + gpointer data) +{ + glMiniPreview *preview = GL_MINI_PREVIEW (data); + GnomeCanvasItem *item; + static gboolean dragging = FALSE; + static gint prev_i = 0, first, last; + gint i; + gdouble x, y; + + gnome_canvas_window_to_world (canvas, + event->button.x, event->button.y, + &x, &y); + + switch (event->type) { + + case GDK_BUTTON_PRESS: + 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 (gtk_object_get_data + (GTK_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); + gtk_signal_emit (GTK_OBJECT(preview), + mini_preview_signals[CLICKED], + i); + first = i; + last = i; + gtk_signal_emit (GTK_OBJECT(preview), + mini_preview_signals[PRESSED], + first, last); + prev_i = i; + break; + + default: + break; + } + break; + + case GDK_BUTTON_RELEASE: + 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: + 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 (gtk_object_get_data + (GTK_OBJECT (item), "i")); + if (i == 0) + break; + if (prev_i != i) { + /* Entered into a new item */ + last = i; + gtk_signal_emit (GTK_OBJECT(preview), + mini_preview_signals[PRESSED], + MIN (first, last), + MAX (first, last)); + prev_i = i; + } + } + break; + + default: + break; + } + + return FALSE; + +} + +/****************************************************************************/ +/* Highlight given label outlines. */ +/****************************************************************************/ +void +gl_mini_preview_highlight_range (glMiniPreview * preview, + gint first_label, + gint last_label) +{ + GnomeCanvasItem *item = NULL; + GList *p = NULL; + gint i; + + 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); + } + + } + +} + diff --git a/glabels1/src/mini_preview.h b/glabels1/src/mini_preview.h new file mode 100644 index 00000000..5c08deae --- /dev/null +++ b/glabels1/src/mini_preview.h @@ -0,0 +1,76 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * mini_preview.h: mini-preview widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __MINI_PREVIEW_H__ +#define __MINI_PREVIEW_H__ + +#include +#include "label.h" + +#define GL_TYPE_MINI_PREVIEW (gl_mini_preview_get_type ()) +#define GL_MINI_PREVIEW(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_MINI_PREVIEW, glMiniPreview )) +#define GL_MINI_PREVIEW_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MINI_PREVIEW, glMiniPreviewClass)) +#define GL_IS_MINI_PREVIEW(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_MINI_PREVIEW)) +#define GL_IS_MINI_PREVIEW_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MINI_PREVIEW)) + +typedef struct _glMiniPreview glMiniPreview; +typedef struct _glMiniPreviewClass glMiniPreviewClass; + +struct _glMiniPreview { + GtkHBox parent_widget; + + gint height; + gint width; + + GtkWidget *canvas; + GnomeCanvasItem *paper_item; + + gint labels_per_sheet; + GList *label_items; +}; + +struct _glMiniPreviewClass { + GtkHBoxClass parent_class; + + void (*clicked) (glMiniPreview *preview, + gint index, gpointer user_data); + void (*pressed) (glMiniPreview *preview, + gint index1, gint index2, + gpointer user_data); +}; + +extern guint gl_mini_preview_get_type (void); + +extern GtkWidget *gl_mini_preview_new (gint height, gint width); + +extern void gl_mini_preview_set_label (glMiniPreview * preview, + gchar * name); + +extern void gl_mini_preview_highlight_range (glMiniPreview * preview, + gint first_label, + gint last_label); + +#endif diff --git a/glabels1/src/pixmaps/Makefile.am b/glabels1/src/pixmaps/Makefile.am new file mode 100644 index 00000000..3d197100 --- /dev/null +++ b/glabels1/src/pixmaps/Makefile.am @@ -0,0 +1,32 @@ +EXTRA_DIST = \ + arrow.xpm \ + text.xpm \ + box.xpm \ + line.xpm \ + ellipse.xpm \ + image.xpm \ + barcode.xpm \ + zoomin.xpm \ + zoomout.xpm \ + zoom1to1.xpm \ + merge.xpm \ + 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 \ + cursor_zoomin.xbm \ + cursor_zoomin_mask.xbm \ + cursor_zoomout.xbm \ + cursor_zoomout_mask.xbm + diff --git a/glabels1/src/pixmaps/Makefile.in b/glabels1/src/pixmaps/Makefile.in new file mode 100644 index 00000000..dfc49df0 --- /dev/null +++ b/glabels1/src/pixmaps/Makefile.in @@ -0,0 +1,220 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 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@ +GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@ +GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@ +GNOMEUI_LIBS = @GNOMEUI_LIBS@ +GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@ +GNOME_CANVAS_PIXBUF_CFLAGS = @GNOME_CANVAS_PIXBUF_CFLAGS@ +GNOME_CANVAS_PIXBUF_LIBS = @GNOME_CANVAS_PIXBUF_LIBS@ +GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@ +GNOME_CONFIG = @GNOME_CONFIG@ +GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@ +GNOME_LIBDIR = @GNOME_LIBDIR@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_PRINT_CFLAGS = @GNOME_PRINT_CFLAGS@ +GNOME_PRINT_LIBS = @GNOME_PRINT_LIBS@ +GNOME_XML_CFLAGS = @GNOME_XML_CFLAGS@ +GNOME_XML_LIBS = @GNOME_XML_LIBS@ +GNORBA_CFLAGS = @GNORBA_CFLAGS@ +GNORBA_LIBS = @GNORBA_LIBS@ +GTKXMHTML_LIBS = @GTKXMHTML_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +GTK_LIBS = @GTK_LIBS@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +ORBIT_CFLAGS = @ORBIT_CFLAGS@ +ORBIT_CONFIG = @ORBIT_CONFIG@ +ORBIT_IDL = @ORBIT_IDL@ +ORBIT_LIBS = @ORBIT_LIBS@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PTHREAD_LIB = @PTHREAD_LIB@ +RANLIB = @RANLIB@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XPM_LIBS = @XPM_LIBS@ +ZVT_LIBS = @ZVT_LIBS@ +cflags_set = @cflags_set@ +cxxflags_set = @cxxflags_set@ +l = @l@ + +EXTRA_DIST = arrow.xpm text.xpm box.xpm line.xpm ellipse.xpm image.xpm barcode.xpm zoomin.xpm zoomout.xpm zoom1to1.xpm merge.xpm 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 cursor_zoomin.xbm cursor_zoomin_mask.xbm cursor_zoomout.xbm cursor_zoomout_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: 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/glabels1/src/pixmaps/arrow.xpm b/glabels1/src/pixmaps/arrow.xpm new file mode 100644 index 00000000..60e9e66b --- /dev/null +++ b/glabels1/src/pixmaps/arrow.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char *arrow_xpm[]={ +"24 24 2 1", +". c None", +"# c #000000", +"........................", +"........................", +"........................", +".......#................", +".......##...............", +".......###..............", +".......####.............", +".......#####............", +".......######...........", +".......#######..........", +".......########.........", +".......#####............", +".......##.##............", +".......#...##...........", +"...........##...........", +"............##..........", +"............##..........", +"........................", +"........................", +"........................", +"........................", +"........................", +"........................", +"........................"}; diff --git a/glabels1/src/pixmaps/barcode.xpm b/glabels1/src/pixmaps/barcode.xpm new file mode 100644 index 00000000..9ac15815 --- /dev/null +++ b/glabels1/src/pixmaps/barcode.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char *barcode_xpm[]={ +"24 24 2 1", +". c None", +"# c #000000", +"........................", +"........................", +"........................", +"........................", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"...#.##.##.#.#.#.##.#...", +"........................", +"........................", +"........................", +"........................"}; diff --git a/glabels1/src/pixmaps/box.xpm b/glabels1/src/pixmaps/box.xpm new file mode 100644 index 00000000..b7440681 --- /dev/null +++ b/glabels1/src/pixmaps/box.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static char *box_xpm[]={ +"24 24 3 1", +". c None", +"# c #000000", +"a c #ede5cf", +"........................", +"........................", +"........................", +"........................", +"...##################...", +"...##################...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##################...", +"...##################...", +"........................", +"........................", +"........................", +"........................"}; diff --git a/glabels1/src/pixmaps/checkerboard.xpm b/glabels1/src/pixmaps/checkerboard.xpm new file mode 100644 index 00000000..33ab7b57 --- /dev/null +++ b/glabels1/src/pixmaps/checkerboard.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * checkerboard_xpm[] = { +"24 24 2 1", +" c #CCCCCC", +". c #000000", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. ..", +".. .. .. .. .. .. ", +".. .. .. .. .. .. ", +" .. .. .. .. .. ..", +" .. .. .. .. .. .."}; diff --git a/glabels1/src/pixmaps/collate.xpm b/glabels1/src/pixmaps/collate.xpm new file mode 100644 index 00000000..a781151a --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_barcode.xbm b/glabels1/src/pixmaps/cursor_barcode.xbm new file mode 100644 index 00000000..6e8d1d62 --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_barcode_mask.xbm b/glabels1/src/pixmaps/cursor_barcode_mask.xbm new file mode 100644 index 00000000..52ed3ba2 --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_box.xbm b/glabels1/src/pixmaps/cursor_box.xbm new file mode 100644 index 00000000..48ae4ea2 --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_box_mask.xbm b/glabels1/src/pixmaps/cursor_box_mask.xbm new file mode 100644 index 00000000..b41e0559 --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_ellipse.xbm b/glabels1/src/pixmaps/cursor_ellipse.xbm new file mode 100644 index 00000000..946af9ac --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_ellipse_mask.xbm b/glabels1/src/pixmaps/cursor_ellipse_mask.xbm new file mode 100644 index 00000000..22fb5442 --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_image.xbm b/glabels1/src/pixmaps/cursor_image.xbm new file mode 100644 index 00000000..32308360 --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_image_mask.xbm b/glabels1/src/pixmaps/cursor_image_mask.xbm new file mode 100644 index 00000000..9c79e82e --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_line.xbm b/glabels1/src/pixmaps/cursor_line.xbm new file mode 100644 index 00000000..f5e2636e --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_line_mask.xbm b/glabels1/src/pixmaps/cursor_line_mask.xbm new file mode 100644 index 00000000..a9359d55 --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_text.xbm b/glabels1/src/pixmaps/cursor_text.xbm new file mode 100644 index 00000000..4378c1a6 --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_text_mask.xbm b/glabels1/src/pixmaps/cursor_text_mask.xbm new file mode 100644 index 00000000..543c2b7f --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/cursor_zoomin.xbm b/glabels1/src/pixmaps/cursor_zoomin.xbm new file mode 100644 index 00000000..beb1545e --- /dev/null +++ b/glabels1/src/pixmaps/cursor_zoomin.xbm @@ -0,0 +1,16 @@ +#define cursor_zoomin_width 32 +#define cursor_zoomin_height 32 +#define cursor_zoomin_x_hot 8 +#define cursor_zoomin_y_hot 8 +static unsigned char cursor_zoomin_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, + 0x30, 0x0c, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x88, 0x31, 0x00, 0x00, + 0x84, 0x21, 0x00, 0x00, 0xe4, 0x27, 0x00, 0x00, 0xe4, 0x27, 0x00, 0x00, + 0x84, 0x21, 0x00, 0x00, 0x8c, 0x11, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, + 0x30, 0x0c, 0x00, 0x00, 0xe0, 0x37, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, + 0x00, 0xe0, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1c, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels1/src/pixmaps/cursor_zoomin_mask.xbm b/glabels1/src/pixmaps/cursor_zoomin_mask.xbm new file mode 100644 index 00000000..cada0165 --- /dev/null +++ b/glabels1/src/pixmaps/cursor_zoomin_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_zoomin_mask_width 32 +#define cursor_zoomin_mask_height 32 +#define cursor_zoomin_mask_x_hot 8 +#define cursor_zoomin_mask_y_hot 8 +static unsigned char cursor_zoomin_mask_bits[] = { + 0xc0, 0x03, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, + 0xfc, 0x3f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, + 0xfc, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, + 0xc0, 0xf3, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels1/src/pixmaps/cursor_zoomout.xbm b/glabels1/src/pixmaps/cursor_zoomout.xbm new file mode 100644 index 00000000..c8fac13c --- /dev/null +++ b/glabels1/src/pixmaps/cursor_zoomout.xbm @@ -0,0 +1,16 @@ +#define cursor_zoomout_width 32 +#define cursor_zoomout_height 32 +#define cursor_zoomout_x_hot 8 +#define cursor_zoomout_y_hot 8 +static unsigned char cursor_zoomout_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, + 0x30, 0x0c, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x30, 0x00, 0x00, + 0x04, 0x20, 0x00, 0x00, 0xe4, 0x27, 0x00, 0x00, 0xe4, 0x27, 0x00, 0x00, + 0x04, 0x20, 0x00, 0x00, 0x0c, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, + 0x30, 0x0c, 0x00, 0x00, 0xe0, 0x37, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, + 0x00, 0xe0, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1c, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels1/src/pixmaps/cursor_zoomout_mask.xbm b/glabels1/src/pixmaps/cursor_zoomout_mask.xbm new file mode 100644 index 00000000..aadc97d9 --- /dev/null +++ b/glabels1/src/pixmaps/cursor_zoomout_mask.xbm @@ -0,0 +1,16 @@ +#define cursor_zoomout_mask_width 32 +#define cursor_zoomout_mask_height 32 +#define cursor_zoomout_mask_x_hot 8 +#define cursor_zoomout_mask_y_hot 8 +static unsigned char cursor_zoomout_mask_bits[] = { + 0xc0, 0x03, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, + 0xfc, 0x3f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, + 0xfc, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, + 0xc0, 0xf3, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3e, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/glabels1/src/pixmaps/ellipse.xpm b/glabels1/src/pixmaps/ellipse.xpm new file mode 100644 index 00000000..f186186f --- /dev/null +++ b/glabels1/src/pixmaps/ellipse.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static char *ellipse_xpm[]={ +"24 24 3 1", +". c None", +"# c #000000", +"a c #ede5cf", +"........................", +"........................", +"........................", +".........######.........", +".......##########.......", +"......###aaaaaa###......", +".....##aaaaaaaaa###.....", +"....###aaaaaaaaaaa##....", +"....##aaaaaaaaaaaa##....", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"...##aaaaaaaaaaaaaa##...", +"....##aaaaaaaaaaaa##....", +"....##aaaaaaaaaaa###....", +".....###aaaaaaaaa##.....", +"......###aaaaaa###......", +".......##########.......", +".........######.........", +"........................", +"........................", +"........................"}; diff --git a/glabels1/src/pixmaps/image.xpm b/glabels1/src/pixmaps/image.xpm new file mode 100644 index 00000000..116c20d4 --- /dev/null +++ b/glabels1/src/pixmaps/image.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char *image_xpm[]={ +"24 24 15 1", +". c None", +"# c #000000", +"i c #004000", +"f c #008000", +"e c #00c000", +"d c #00ff00", +"k c #404000", +"a c #58a8ff", +"h c #a0a0a0", +"g c #a8dcff", +"j c #c0ffff", +"l c #ff0000", +"b c #ffff00", +"c c #ffffc0", +"m c #ffffff", +"........................", +"........................", +"..####################..", +"..#aaaaaaaaaaaaaaaaaa#..", +"..#aaaaaaaaaaaabbaaaa#..", +"..#aaaaaa#aaaabbbbaaa#..", +"..#aaaaa#c#aaaabbaaaa#..", +"..#aaaa#ccc#aaaaaadef#..", +"..#aga#cchcc#agagdeei#..", +"..#ga##cchcc##agaeefi#..", +"..#ggg#ccccc#gggggfii#..", +"..#jjj#ccccc#jjjjjjij#..", +"..#####chchc#######k##..", +"..#eee#chchc#eeeeeeke#..", +"..#eee#chccc#eeelelke#..", +"..#ffe#chccc#eleieike#..", +"..#eee#######eeieilei#..", +"..#feeeemeeeeeieeeeie#..", +"..#eeeeemmmmmmmmmeeee#..", +"..#eeeeeeeeeeeeemmeee#..", +"..#eeeeeeeeeeeeeemeee#..", +"..####################..", +"........................", +"........................"}; diff --git a/glabels1/src/pixmaps/line.xpm b/glabels1/src/pixmaps/line.xpm new file mode 100644 index 00000000..37a24c9c --- /dev/null +++ b/glabels1/src/pixmaps/line.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char *line_xpm[]={ +"24 24 2 1", +". c None", +"# c #000000", +"........................", +"........................", +"........................", +"........................", +"...................#....", +"..................##....", +".................##.....", +"................##......", +"...............##.......", +"..............##........", +".............##.........", +"............##..........", +"...........##...........", +"..........##............", +".........##.............", +"........##..............", +".......##...............", +"......##................", +".....##.................", +"....##..................", +"....#...................", +"........................", +"........................", +"........................"}; diff --git a/glabels1/src/pixmaps/merge.xpm b/glabels1/src/pixmaps/merge.xpm new file mode 100644 index 00000000..6fd5f8f2 --- /dev/null +++ b/glabels1/src/pixmaps/merge.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char *merge_xpm[]={ +"24 24 7 1", +". c None", +"# c #000000", +"c c #585858", +"d c #a0a0a0", +"a c #c0c000", +"b c #ffffc0", +"e c #ffffff", +"........................", +"........................", +"....##########..........", +"...##abbbbbbb#c.........", +"..#d#dbbbbbbb#c.........", +".####acdbcbcb#c.........", +".#adadbbbbbbe#c.........", +".#bccbcbcdecb#c.........", +".#bbbbbebebbe#c.........", +".#bcb##############.....", +".#bbb#eeeeeeeeeeee#.....", +".#bcd#e##############...", +".#bbb#e#eeeeeeeeeeee#...", +".#bcb#e#e##############.", +".#bbb#e#e#eeeeeeeeeeee#.", +".#bcb###e#eeeeeeeeeeee#.", +".#bbebb#e#eeeeeeeeeeee#.", +".#bccbb###eeeeeeeeeeee#.", +".#bbbebeb#eeeeeeeeeeee#.", +".#bcbbcce##############.", +".#ebebebebeee#c.........", +".#############c.........", +"..ccccccccccccc.........", +"........................"}; diff --git a/glabels1/src/pixmaps/nocollate.xpm b/glabels1/src/pixmaps/nocollate.xpm new file mode 100644 index 00000000..a67cc13c --- /dev/null +++ b/glabels1/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/glabels1/src/pixmaps/text.xpm b/glabels1/src/pixmaps/text.xpm new file mode 100644 index 00000000..499d7409 --- /dev/null +++ b/glabels1/src/pixmaps/text.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char *text_xpm[]={ +"24 24 2 1", +". c None", +"# c #000000", +"........................", +"........................", +"........................", +"........................", +"........................", +"......###########.......", +"......##..###..##.......", +"......#...###...#.......", +"..........###...........", +"..........###...........", +"..........###...........", +"..........###...........", +"..........###...........", +"..........###...........", +"..........###...........", +"..........###...........", +"..........###...........", +".........#####..........", +"........................", +"........................", +"........................", +"........................", +"........................", +"........................"}; diff --git a/glabels1/src/pixmaps/zoom1to1.xpm b/glabels1/src/pixmaps/zoom1to1.xpm new file mode 100644 index 00000000..956f4029 --- /dev/null +++ b/glabels1/src/pixmaps/zoom1to1.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static char *zoom1to1_xpm[]={ +"24 24 3 1", +". c None", +"# c #000000", +"a c #00ff00", +"........................", +"........................", +"........................", +"........................", +"......###.......###.....", +".....#aa#......#aa#.....", +".....#aa#......#aa#.....", +".....##a#......##a#.....", +"......#a#.......#a#.....", +"......#a#..###..#a#.....", +"......#a#..#a#..#a#.....", +"......#a#..#a#..#a#.....", +"......#a#..###..#a#.....", +"......#a#.......#a#.....", +"......#a#.......#a#.....", +"......#a#.......#a#.....", +"......#a#..###..#a#.....", +"......#a#..#a#..#a#.....", +"......#a#..#a#..#a#.....", +"......###..###..###.....", +"........................", +"........................", +"........................", +"........................"}; diff --git a/glabels1/src/pixmaps/zoomin.xpm b/glabels1/src/pixmaps/zoomin.xpm new file mode 100644 index 00000000..88f8b4d5 --- /dev/null +++ b/glabels1/src/pixmaps/zoomin.xpm @@ -0,0 +1,38 @@ +/* XPM */ +static char *zoomin_xpm[]={ +"24 24 11 1", +". c None", +"# c #000000", +"c c #0058c0", +"e c #00ff00", +"i c #404000", +"g c #58a8ff", +"f c #a8dcff", +"h c #c0c000", +"a c #c0ffff", +"b c #ffffc0", +"d c #ffffff", +"........................", +"........................", +"........................", +".......######...........", +"......##aaaaa##.........", +".....#aaaaaaaa##........", +"....##aab###aaac#.......", +"....#aabd#e#aafa##......", +"...#aaddd#e#faffa#......", +"...#aa####e####ga#......", +"...#ad#eeeeeee#ga#......", +"...#ad####e####ga#......", +"...#aaaff#e#fffga#......", +"...##aaaf#e#fgga#.......", +"....#aaff###ggaa#.......", +".....##afggggaa####.....", +"......##aaaaa##.#hb#....", +"........######..#ihb#...", +"................d#ihb#..", +".................d#ihb#.", +"..................d#ihb.", +"...................d#i..", +"....................d...", +"........................"}; diff --git a/glabels1/src/pixmaps/zoomout.xpm b/glabels1/src/pixmaps/zoomout.xpm new file mode 100644 index 00000000..a1f8e862 --- /dev/null +++ b/glabels1/src/pixmaps/zoomout.xpm @@ -0,0 +1,37 @@ +/* XPM */ +static char *zoomout_xpm[]={ +"24 24 10 1", +". c None", +"# c #000000", +"f c #00ff00", +"h c #404000", +"e c #58a8ff", +"c c #a8dcff", +"g c #c0c000", +"a c #c0ffff", +"b c #ffffc0", +"d c #ffffff", +"........................", +"........................", +"........................", +".......######...........", +"......##aaaaa##.........", +".....#aaaaaaaa##........", +"....##aabbacaaaa#.......", +"....#aabdcacaaca##......", +"...#aadddccccacca#......", +"...#aa#########ea#......", +"...#ad#fffffff#ea#......", +"...#ad#########ea#......", +"...#aaaccccccccea#......", +"...##aaaccccceea#.......", +"....#aaccccceeaa#.......", +".....##aceeeeaa####.....", +"......##aaaaa##.#gb#....", +"........######..#hgb#...", +"................d#hgb#..", +".................d#hgb#.", +"..................d#hgb.", +"...................d#h..", +"....................d...", +"........................"}; diff --git a/glabels1/src/prefs.c b/glabels1/src/prefs.c new file mode 100644 index 00000000..8e76eecb --- /dev/null +++ b/glabels1/src/prefs.c @@ -0,0 +1,470 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs.c: Application preferences module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "mdi.h" +#include "propertybox.h" +#include "prefs.h" + +#include "debug.h" + +/*============================================*/ +/* Private types. */ +/*============================================*/ + +typedef struct { + glPrefsUnits default_units; + gchar *default_page_size; +} Prefs; + +/*============================================*/ +/* Private globals. */ +/*============================================*/ +static GtkWidget *dialog = NULL; + +static Prefs *prefs = NULL; + +static GtkWidget *unit_pts_radio, *unit_inches_radio, *unit_mm_radio; +static GtkWidget *page_size_us_letter_radio, *page_size_a4_radio; + +/*============================================*/ +/* Private function prototypes. */ +/*============================================*/ +static void apply_cb (glPropertyBox * propertybox, gint arg1, gpointer user_data); + +static void prefs_destroy_cb (void); + +static void prefs_changed_cb (void); + +static Prefs *read_prefs (void); + +static void sync_prefs (Prefs * p); + +static void free_prefs (Prefs * p); + +static void add_general_page (GtkWidget * dialog); + +static void set_general_page_from_prefs (Prefs * p); + +static void set_prefs_from_general_page (Prefs * p); + +/****************************************************************************/ +/* Create and display preferences dialog. */ +/****************************************************************************/ +void +gl_prefs_cb (GtkWidget * widget, + gpointer data) +{ + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + + if (prefs == NULL) { + prefs = read_prefs (); + } + + if (dialog == NULL) { + dialog = gl_property_box_new (); + gtk_window_set_title (GTK_WINDOW (dialog), + _("Glabels: Preferences")); + gtk_window_set_transient_for (GTK_WINDOW (dialog), + GTK_WINDOW (app)); + + add_general_page (dialog); + + gtk_signal_connect (GTK_OBJECT (dialog), "destroy", + GTK_SIGNAL_FUNC (prefs_destroy_cb), NULL); + + gtk_signal_connect (GTK_OBJECT (dialog), "delete_event", + GTK_SIGNAL_FUNC (prefs_destroy_cb), NULL); + + gtk_signal_connect (GTK_OBJECT (dialog), "apply", + GTK_SIGNAL_FUNC (apply_cb), NULL); + + gtk_widget_show_all (GTK_WIDGET (dialog)); + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. "Apply" button callback. */ +/*--------------------------------------------------------------------------*/ +static void +apply_cb (glPropertyBox * propertybox, + gint arg1, + gpointer user_data) +{ + set_prefs_from_general_page (prefs); + sync_prefs (prefs); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback to finish cleaning up after tearing down dialog. */ +/*--------------------------------------------------------------------------*/ +static void +prefs_destroy_cb (void) +{ + dialog = NULL; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the dialog has changed. */ +/*--------------------------------------------------------------------------*/ +static void +prefs_changed_cb (void) +{ + gl_property_box_changed (GL_PROPERTY_BOX (dialog)); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Read and set preferences from disk. */ +/*--------------------------------------------------------------------------*/ +static Prefs * +read_prefs (void) +{ + Prefs *p; + gchar *string; + gboolean dflt; + + p = g_new0 (Prefs, 1); + + gnome_config_push_prefix ("/glabels/General/"); + + string = gnome_config_get_string_with_default ("Units=Inches", &dflt); + if (dflt) + gnome_config_set_string ("Units", "Inches"); + if (g_strcasecmp (string, "Points") == 0) { + p->default_units = GL_PREFS_UNITS_PTS; + } else if (g_strcasecmp (string, "Inches") == 0) { + p->default_units = GL_PREFS_UNITS_INCHES; + } else if (g_strcasecmp (string, "Millimeters") == 0) { + p->default_units = GL_PREFS_UNITS_MM; + } + g_free (string); + + p->default_page_size = + gnome_config_get_string_with_default ("Page_size=US-Letter", &dflt); + if (dflt) + gnome_config_set_string ("Page_size", "US-Letter"); + + gnome_config_pop_prefix (); + + return p; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Sync preferences with disk. */ +/*--------------------------------------------------------------------------*/ +static void +sync_prefs (Prefs * p) +{ + gnome_config_push_prefix ("/glabels/General/"); + switch (p->default_units) { + case GL_PREFS_UNITS_PTS: + gnome_config_set_string ("Units", "Points"); + break; + case GL_PREFS_UNITS_INCHES: + gnome_config_set_string ("Units", "Inches"); + break; + case GL_PREFS_UNITS_MM: + gnome_config_set_string ("Units", "Millimeters"); + break; + default: + WARN ("Illegal units"); + break; + } + gnome_config_set_string ("Page_size", p->default_page_size); + gnome_config_pop_prefix (); + gnome_config_sync (); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Free previously allocated preferences structure. */ +/*--------------------------------------------------------------------------*/ +static void +free_prefs (Prefs * p) +{ + g_free (p); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Create and add the general page tab with controls to the dialog.*/ +/*--------------------------------------------------------------------------*/ +static void +add_general_page (GtkWidget * dialog) +{ + GtkWidget *wframe, *wlabel, *wvbox, *wvbox1; + GSList *radio_group = NULL; + + wlabel = gtk_label_new (_("General")); + + wvbox = gtk_vbox_new (FALSE, 0); + + /* ----- Display Units Frame ------------------------------------ */ + wframe = gtk_frame_new (_("Display units")); + gtk_container_set_border_width (GTK_CONTAINER (wframe), 10); + 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); + + radio_group = NULL; + + unit_pts_radio = + gtk_radio_button_new_with_label (radio_group, _("Points")); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (unit_pts_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), unit_pts_radio, FALSE, FALSE, 0); + + unit_inches_radio = + gtk_radio_button_new_with_label (radio_group, _("Inches")); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (unit_inches_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), unit_inches_radio, FALSE, FALSE, + 0); + + unit_mm_radio = + gtk_radio_button_new_with_label (radio_group, _("Millimeters")); + radio_group = gtk_radio_button_group (GTK_RADIO_BUTTON (unit_mm_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), unit_mm_radio, FALSE, FALSE, 0); + + /* ----- Display Units Frame ------------------------------------ */ + wframe = gtk_frame_new (_("Default page size")); + gtk_container_set_border_width (GTK_CONTAINER (wframe), 10); + 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); + + radio_group = NULL; + + page_size_us_letter_radio = + gtk_radio_button_new_with_label (radio_group, "US-Letter"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON + (page_size_us_letter_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), page_size_us_letter_radio, FALSE, + FALSE, 0); + + page_size_a4_radio = + gtk_radio_button_new_with_label (radio_group, "A4"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (page_size_a4_radio)); + gtk_box_pack_start (GTK_BOX (wvbox1), page_size_a4_radio, + FALSE, FALSE, 0); + + gl_property_box_append_page (GL_PROPERTY_BOX (dialog), wvbox, wlabel); + + set_general_page_from_prefs (prefs); + + gtk_signal_connect (GTK_OBJECT (unit_pts_radio), "toggled", + GTK_SIGNAL_FUNC (prefs_changed_cb), NULL); + gtk_signal_connect (GTK_OBJECT (unit_inches_radio), "toggled", + GTK_SIGNAL_FUNC (prefs_changed_cb), NULL); + gtk_signal_connect (GTK_OBJECT (unit_mm_radio), "toggled", + GTK_SIGNAL_FUNC (prefs_changed_cb), NULL); + + gtk_signal_connect (GTK_OBJECT (page_size_us_letter_radio), "toggled", + GTK_SIGNAL_FUNC (prefs_changed_cb), NULL); + gtk_signal_connect (GTK_OBJECT (page_size_a4_radio), "toggled", + GTK_SIGNAL_FUNC (prefs_changed_cb), NULL); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Initialize general tab controls from current prefs. */ +/*--------------------------------------------------------------------------*/ +static void +set_general_page_from_prefs (Prefs * p) +{ + switch (p->default_units) { + case GL_PREFS_UNITS_PTS: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (unit_pts_radio), TRUE); + break; + case GL_PREFS_UNITS_INCHES: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (unit_inches_radio), TRUE); + break; + case GL_PREFS_UNITS_MM: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (unit_mm_radio), + TRUE); + break; + default: + WARN ("Illegal units"); + break; + } + + if (g_strcasecmp (p->default_page_size, "US-Letter") == 0) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (page_size_us_letter_radio), + TRUE); + } else if (g_strcasecmp (p->default_page_size, "A4") == 0) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (page_size_a4_radio), TRUE); + } else { + WARN ("Illegal page size: %s", p->default_page_size); + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Set current preferences based on general controls. */ +/*--------------------------------------------------------------------------*/ +static void +set_prefs_from_general_page (Prefs * p) +{ + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (unit_pts_radio))) { + p->default_units = GL_PREFS_UNITS_PTS; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (unit_inches_radio))) { + p->default_units = GL_PREFS_UNITS_INCHES; + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (unit_mm_radio))) { + p->default_units = GL_PREFS_UNITS_MM; + } + + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (page_size_us_letter_radio))) { + g_free (p->default_page_size); + p->default_page_size = g_strdup ("US-Letter"); + } else + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (page_size_a4_radio))) { + g_free (p->default_page_size); + p->default_page_size = g_strdup ("A4"); + } + +} + +/****************************************************************************/ +/* Get desired units. */ +/****************************************************************************/ +glPrefsUnits +gl_prefs_get_units(void) +{ + return prefs->default_units; +} + +/****************************************************************************/ +/* Get desired units per point. */ +/****************************************************************************/ +gdouble +gl_prefs_get_units_per_point (void) +{ + if (prefs == NULL) { + prefs = read_prefs (); + } + + switch (prefs->default_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: + WARN ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get precision for desired units. */ +/****************************************************************************/ +gint +gl_prefs_get_units_precision (void) +{ + if (prefs == NULL) { + prefs = read_prefs (); + } + + switch (prefs->default_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: + WARN ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get step size for desired units. */ +/****************************************************************************/ +gdouble +gl_prefs_get_units_step_size (void) +{ + if (prefs == NULL) { + prefs = read_prefs (); + } + + switch (prefs->default_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: + WARN ("Illegal units"); /* Should not happen */ + return 1.0; + } +} + +/****************************************************************************/ +/* Get string representing desired units. */ +/****************************************************************************/ +const gchar * +gl_prefs_get_units_string (void) +{ + if (prefs == NULL) { + prefs = read_prefs (); + } + + switch (prefs->default_units) { + case GL_PREFS_UNITS_PTS: + return _("points"); + case GL_PREFS_UNITS_INCHES: + return _("inches"); + case GL_PREFS_UNITS_MM: + return _("mm"); + default: + WARN ("Illegal units"); /* Should not happen */ + return _("points"); + } +} + +/****************************************************************************/ +/* Get default page size. */ +/****************************************************************************/ +const gchar * +gl_prefs_get_page_size (void) +{ + if (prefs == NULL) { + prefs = read_prefs (); + } + + return prefs->default_page_size; +} diff --git a/glabels1/src/prefs.h b/glabels1/src/prefs.h new file mode 100644 index 00000000..a279d58b --- /dev/null +++ b/glabels1/src/prefs.h @@ -0,0 +1,48 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prefs.h: Application preferences module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PREFS_H__ +#define __PREFS_H__ + +#include + +typedef enum { + GL_PREFS_UNITS_PTS, + GL_PREFS_UNITS_INCHES, + GL_PREFS_UNITS_MM, +} glPrefsUnits; + +extern void gl_prefs_cb (GtkWidget * widget, gpointer data); + +extern glPrefsUnits gl_prefs_get_units(void); + +extern gdouble gl_prefs_get_units_per_point (void); + +extern gint gl_prefs_get_units_precision (void); + +extern gdouble gl_prefs_get_units_step_size (void); + +extern const gchar *gl_prefs_get_units_string (void); + +extern const gchar *gl_prefs_get_page_size (void); + +#endif /* __PREFS_H__ */ diff --git a/glabels1/src/print.c b/glabels1/src/print.c new file mode 100644 index 00000000..e9cbb9df --- /dev/null +++ b/glabels1/src/print.c @@ -0,0 +1,863 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.c: Print module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include +#include +#include +#include +#include + +#include "print.h" +#include "label.h" +#include "bc.h" +#include "template.h" +#include "hack.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; + + /* gLabels Template */ + 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, glLabelObject * object, + glMergeRecord * record); +static void draw_box_object (PrintInfo * pi, glLabelObject * object); +static void draw_line_object (PrintInfo * pi, glLabelObject * object); +static void draw_ellipse_object (PrintInfo * pi, glLabelObject * object); +static void draw_image_object (PrintInfo * pi, glLabelObject * object); +static void draw_barcode_object (PrintInfo * pi, glLabelObject * 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; + + 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); +} + +/*****************************************************************************/ +/* 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; + + 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); +} + +/*****************************************************************************/ +/* 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; + + 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); +} + +/*****************************************************************************/ +/* 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; + + if ( label->merge_type == GL_MERGE_NONE ) { + n_per_page = (label->template->nx)*(label->template->ny); + + gl_print_simple (master, label, n_sheets, 1, n_per_page, + outline_flag, reverse_flag); + } else { + record_list = gl_merge_read_data (label->merge_type, + label->merge_fields, + label->merge_src); + + gl_print_merge_collated (master, label, record_list, + n_copies, 1, + outline_flag, reverse_flag); + } +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. new print info structure */ +/*---------------------------------------------------------------------------*/ +static PrintInfo * +print_info_new (GnomePrintMaster * master, + glLabel * label) +{ + const GnomePaper *paper; + PrintInfo *pi = g_new0 (PrintInfo, 1); + glTemplate *template = label->template; + + if (template == NULL) { + WARN ("Undefined template \"%s\"", label->template_name); + return NULL; + } + + pi->pc = gnome_print_master_get_context (master); + + if ((template != NULL) && (template->page_size != NULL)) { + paper = gnome_paper_with_name (template->page_size); + } else { + paper = gnome_paper_with_name (GL_PRINT_DEFAULT_PAPER); + } + gnome_print_master_set_paper (master, paper); + + pi->template = template; + pi->label_rotate_flag = label->rotate_flag; + + return pi; +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. free print info structure */ +/*---------------------------------------------------------------------------*/ +static void +print_info_free (PrintInfo ** pi) +{ + gnome_print_context_close ((*pi)->pc); + + g_free (*pi); + *pi = NULL; +} + +/*---------------------------------------------------------------------------*/ +/* 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; + + ix = i_label % (pi->template->nx); + iy = ((pi->template->ny) - 1) - (i_label / (pi->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 * (pi->template->dx) + pi->template->x0, + iy * (pi->template->dy) + pi->template->y0); + if (!label->rotate_flag) { + art_affine_scale (a, 1.0, -1.0); + a[5] = label->height; + gnome_print_concat (pi->pc, a); + } else { + gnome_print_rotate (pi->pc, 90.0); + gnome_print_scale (pi->pc, 1.0, -1.0); + } + if ( reverse_flag ) { + gnome_print_translate (pi->pc, label->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); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw label. */ +/*---------------------------------------------------------------------------*/ +static void +draw_label (PrintInfo * pi, + glLabel * label, + glMergeRecord * record) +{ + GList *p_obj; + glLabelObject *object; + + for (p_obj = label->objects; p_obj != NULL; p_obj = p_obj->next) { + object = (glLabelObject *) p_obj->data; + + if (object->type == GL_LABEL_OBJECT_TEXT) { + draw_text_object (pi, object, record); + } else if (object->type == GL_LABEL_OBJECT_BOX) { + draw_box_object (pi, object); + } else if (object->type == GL_LABEL_OBJECT_LINE) { + draw_line_object (pi, object); + } else if (object->type == GL_LABEL_OBJECT_ELLIPSE) { + draw_ellipse_object (pi, object); + } else if (object->type == GL_LABEL_OBJECT_IMAGE) { + draw_image_object (pi, object); + } else if (object->type == GL_LABEL_OBJECT_BARCODE) { + draw_barcode_object (pi, object, record); + } + + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw text object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_text_object (PrintInfo * pi, + glLabelObject * object, + glMergeRecord * record) +{ + GnomeFont *font; + gchar **line; + gint i; + gdouble w; + gdouble x_offset, y_offset; + gdouble x, y; + gchar *text, *utf8_text; + + font = gnome_font_new_closest (object->arg.text.font_family, + object->arg.text.font_weight, + object->arg.text.font_italic_flag, + object->arg.text.font_size); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (object->arg.text.color), + GREEN (object->arg.text.color), + BLUE (object->arg.text.color)); + gnome_print_setopacity (pi->pc, ALPHA (object->arg.text.color)); + + text = gl_text_node_lines_expand (object->arg.text.lines, record); + line = g_strsplit (text, "\n", -1); + g_free (text); + + for (i = 0; line[i] != NULL; i++) { + + utf8_text = gl_hack_text_to_utf8 (line[i]); + + w = gl_hack_get_width_string (font, line[i]); + + switch (object->arg.text.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) * object->arg.text.font_size + - gnome_font_get_descender (font); + + x = object->x + x_offset; + y = object->y + 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, utf8_text); + gnome_print_grestore (pi->pc); + + g_free (utf8_text); + } + + g_strfreev (line); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw box object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_box_object (PrintInfo * pi, + glLabelObject * object) +{ + gdouble x, y, w, h; + + x = object->x; + y = object->y; + w = object->arg.box.w; + h = object->arg.box.h; + + /* Paint fill color */ + create_rectangle_path (pi->pc, x, y, w, h); + gnome_print_setrgbcolor (pi->pc, + RED (object->arg.box.fill_color), + GREEN (object->arg.box.fill_color), + BLUE (object->arg.box.fill_color)); + gnome_print_setopacity (pi->pc, ALPHA (object->arg.box.fill_color)); + gnome_print_fill (pi->pc); + + /* Draw outline */ + create_rectangle_path (pi->pc, x, y, w, h); + gnome_print_setrgbcolor (pi->pc, + RED (object->arg.box.line_color), + GREEN (object->arg.box.line_color), + BLUE (object->arg.box.line_color)); + gnome_print_setopacity (pi->pc, ALPHA (object->arg.box.line_color)); + gnome_print_setlinewidth (pi->pc, object->arg.box.line_width); + gnome_print_stroke (pi->pc); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw line object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_line_object (PrintInfo * pi, + glLabelObject * object) +{ + gdouble x, y, dx, dy; + + x = object->x; + y = object->y; + dx = object->arg.line.dx; + dy = object->arg.line.dy; + + gnome_print_moveto (pi->pc, x, y); + gnome_print_lineto (pi->pc, x + dx, y + dy); + gnome_print_setrgbcolor (pi->pc, + RED (object->arg.line.line_color), + GREEN (object->arg.line.line_color), + BLUE (object->arg.line.line_color)); + gnome_print_setopacity (pi->pc, ALPHA (object->arg.line.line_color)); + gnome_print_setlinewidth (pi->pc, object->arg.line.line_width); + gnome_print_stroke (pi->pc); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw ellipse object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_ellipse_object (PrintInfo * pi, + glLabelObject * object) +{ + gdouble x0, y0, rx, ry; + + rx = object->arg.ellipse.w / 2.0; + ry = object->arg.ellipse.h / 2.0; + x0 = object->x + rx; + y0 = object->y + ry; + + /* Paint fill color */ + create_ellipse_path (pi->pc, x0, y0, rx, ry); + gnome_print_setrgbcolor (pi->pc, + RED (object->arg.ellipse.fill_color), + GREEN (object->arg.ellipse.fill_color), + BLUE (object->arg.ellipse.fill_color)); + gnome_print_setopacity (pi->pc, ALPHA (object->arg.ellipse.fill_color)); + gnome_print_fill (pi->pc); + + /* Draw outline */ + create_ellipse_path (pi->pc, x0, y0, rx, ry); + gnome_print_setrgbcolor (pi->pc, + RED (object->arg.ellipse.line_color), + GREEN (object->arg.ellipse.line_color), + BLUE (object->arg.ellipse.line_color)); + gnome_print_setopacity (pi->pc, ALPHA (object->arg.ellipse.line_color)); + gnome_print_setlinewidth (pi->pc, object->arg.ellipse.line_width); + gnome_print_stroke (pi->pc); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw image object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_image_object (PrintInfo * pi, + glLabelObject * object) +{ + gdouble x, y, w, h; + GdkPixbuf *pixbuf; + + x = object->x; + y = object->y; + w = object->arg.image.w; + h = object->arg.image.h; + + pixbuf = object->arg.image.image; + + gnome_print_gsave (pi->pc); + gnome_print_translate (pi->pc, x, y + h); + gnome_print_scale (pi->pc, w, -h); + gnome_print_pixbuf (pi->pc, pixbuf); + gnome_print_grestore (pi->pc); + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw box object. */ +/*---------------------------------------------------------------------------*/ +static void +draw_barcode_object (PrintInfo * pi, + glLabelObject * object, + glMergeRecord * record) +{ + glBarcode *gbc; + glBarcodeLine *line; + glBarcodeChar *bchar; + GList *li; + gdouble x, y, y_offset; + GnomeFont *font; + gchar *text, *cstring; + + x = object->x; + y = object->y; + + text = gl_text_node_expand (object->arg.barcode.text_node, record); + gbc = gl_barcode (object->arg.barcode.style, + object->arg.barcode.text_flag, + object->arg.barcode.scale, text); + g_free (text); + + if (gbc == NULL) { + + font = gnome_font_new_closest (GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, 12.0); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (object->arg.barcode.color), + GREEN (object->arg.barcode.color), + BLUE (object->arg.barcode.color)); + gnome_print_setopacity (pi->pc, + ALPHA (object->arg.barcode.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 (object->arg.barcode. + color), + GREEN (object->arg.barcode. + color), + BLUE (object->arg.barcode. + color)); + gnome_print_setopacity (pi->pc, + ALPHA (object->arg.barcode. + 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_new_closest (GL_BARCODE_FONT_FAMILY, + GL_BARCODE_FONT_WEIGHT, + FALSE, bchar->fsize); + gnome_print_setfont (pi->pc, font); + + gnome_print_setrgbcolor (pi->pc, + RED (object->arg.barcode. + color), + GREEN (object->arg.barcode. + color), + BLUE (object->arg.barcode. + color)); + gnome_print_setopacity (pi->pc, + ALPHA (object->arg.barcode. + 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); + + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Draw outline. */ +/*---------------------------------------------------------------------------*/ +static void +draw_outline (PrintInfo * pi, + glLabel * label) +{ + gdouble w, h, r; + gdouble r1, r2; + + 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 (label->template->style) { + + case GL_TEMPLATE_STYLE_RECT: + w = label->width; + h = label->height; + r = label->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 = label->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 = label->template->label_radius; + r2 = label->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: + WARN ("Unknown template label style"); + break; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Clip to outline. */ +/*---------------------------------------------------------------------------*/ +static void +clip_to_outline (PrintInfo * pi, + glLabel * label) +{ + gdouble w, h, r; + gdouble r1; + + switch (label->template->style) { + + case GL_TEMPLATE_STYLE_RECT: + w = label->width; + h = label->height; + r = label->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 = label->template->label_radius; + create_ellipse_path (pi->pc, r1, r1, r1, r1); + gnome_print_clip (pi->pc); + break; + + default: + WARN ("Unknown template label style"); + break; + } + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. Path creation utilities. */ +/*---------------------------------------------------------------------------*/ +static void +create_rectangle_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble w, + gdouble h) +{ + 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); +} + +static void +create_ellipse_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble rx, + gdouble ry) +{ + gdouble x, y; + gint i_theta; + + 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); +} + +static void +create_rounded_rectangle_path (GnomePrintContext * pc, + gdouble x0, + gdouble y0, + gdouble w, + gdouble h, + gdouble r) +{ + gdouble x, y; + gint i_theta; + + 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); +} diff --git a/glabels1/src/print.h b/glabels1/src/print.h new file mode 100644 index 00000000..25aec93c --- /dev/null +++ b/glabels1/src/print.h @@ -0,0 +1,53 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.h: Print module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PRINT_H__ +#define __PRINT_H__ + +#include +#include +#include +#include "label.h" + +extern void gl_print_simple (GnomePrintMaster * master, glLabel * label, + gint n_sheets, gint first, gint last, + gboolean outline_flag, gboolean reverse_flag); + +extern void gl_print_merge_collated (GnomePrintMaster * master, + glLabel * label, + GList *record_list, + gint n_copies, gint first, + gboolean outline_flag, + gboolean reverse_flag); + +extern void gl_print_merge_uncollated (GnomePrintMaster * master, + glLabel * label, + GList *record_list, + gint n_copies, gint first, + gboolean outline_flag, + gboolean reverse_flag); + +extern void gl_print_batch (GnomePrintMaster * master, glLabel * label, + gint n_sheets, gint n_copies, + gboolean outline_flag, gboolean reverse_flag); + + +#endif diff --git a/glabels1/src/print_copies.c b/glabels1/src/print_copies.c new file mode 100644 index 00000000..4d8d625f --- /dev/null +++ b/glabels1/src/print_copies.c @@ -0,0 +1,387 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print_copies.c: custom print copies widget module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "print_copies.h" +#include "mini_preview.h" + +#include "debug.h" + +#define MINI_PREVIEW_HEIGHT 175 +#define MINI_PREVIEW_WIDTH 150 + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_print_copies_class_init (glPrintCopiesClass * class); +static void gl_print_copies_init (glPrintCopies * copies); +static void gl_print_copies_destroy (GtkObject * object); + +static void gl_print_copies_construct (glPrintCopies * 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 (glMiniPreview *mini_preview, + gint first, gint last, gpointer user_data); + + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ +guint +gl_print_copies_get_type (void) +{ + static guint print_copies_type = 0; + + if (!print_copies_type) { + GtkTypeInfo print_copies_info = { + "glPrintCopies", + sizeof (glPrintCopies), + sizeof (glPrintCopiesClass), + (GtkClassInitFunc) gl_print_copies_class_init, + (GtkObjectInitFunc) gl_print_copies_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + print_copies_type = gtk_type_unique (gtk_hbox_get_type (), + &print_copies_info); + } + + return print_copies_type; +} + +static void +gl_print_copies_class_init (glPrintCopiesClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->destroy = gl_print_copies_destroy; +} + +static void +gl_print_copies_init (glPrintCopies * 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_print_copies_destroy (GtkObject * object) +{ + glPrintCopies *copies; + glPrintCopiesClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PRINT_COPIES (object)); + + copies = GL_PRINT_COPIES (object); + class = GL_PRINT_COPIES_CLASS (GTK_OBJECT (copies)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_print_copies_new (glLabel * label) +{ + glPrintCopies *copies; + + copies = gtk_type_new (gl_print_copies_get_type ()); + + gl_print_copies_construct (copies, label); + + return GTK_WIDGET (copies); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_print_copies_construct (glPrintCopies * copies, + glLabel * label) +{ + GtkWidget *whbox, *wvbox, *whbox1; + GSList *radio_group = NULL; + GtkObject *adjust; + + whbox = GTK_WIDGET (copies); + + copies->labels_per_sheet = label->template->nx * label->template->ny; + + /* mini_preview canvas */ + copies->mini_preview = gl_mini_preview_new (MINI_PREVIEW_HEIGHT, + MINI_PREVIEW_WIDTH); + gl_mini_preview_set_label (GL_MINI_PREVIEW(copies->mini_preview), + label->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_mini_preview_highlight_range (GL_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_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 */ + gtk_signal_connect (GTK_OBJECT (copies->mini_preview), "pressed", + GTK_SIGNAL_FUNC (preview_pressed), copies); + gtk_signal_connect (GTK_OBJECT (copies->sheets_radio), "toggled", + GTK_SIGNAL_FUNC (sheets_radio_cb), copies); + gtk_signal_connect (GTK_OBJECT (copies->first_spin), "changed", + GTK_SIGNAL_FUNC (first_spin_cb), copies); + gtk_signal_connect (GTK_OBJECT (copies->last_spin), "changed", + GTK_SIGNAL_FUNC (last_spin_cb), copies); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Enable/Disable appropriate controls due to radio button toggle.*/ +/*--------------------------------------------------------------------------*/ +static void +sheets_radio_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glPrintCopies *copies = GL_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_mini_preview_highlight_range (GL_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_mini_preview_highlight_range (GL_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) +{ + glPrintCopies *copies = GL_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_mini_preview_highlight_range (GL_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) +{ + glPrintCopies *copies = GL_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_mini_preview_highlight_range (GL_MINI_PREVIEW(copies->mini_preview), + first, last); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static void +preview_pressed (glMiniPreview *mini_preview, + gint first, gint last, gpointer user_data) +{ + glPrintCopies *copies = GL_PRINT_COPIES (user_data); + + gl_print_copies_set_range (copies, 1, first, last); +} + +/****************************************************************************/ +/* query selected range of labels within sheet or number of sheets. */ +/****************************************************************************/ +void +gl_print_copies_get_range (glPrintCopies * 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_print_copies_set_range (glPrintCopies * 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/glabels1/src/print_copies.h b/glabels1/src/print_copies.h new file mode 100644 index 00000000..124c5a22 --- /dev/null +++ b/glabels1/src/print_copies.h @@ -0,0 +1,75 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print_copies.h: custom print copies widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PRINT_COPIES_H__ +#define __PRINT_COPIES_H__ + +#include +#include "label.h" + +#define GL_TYPE_PRINT_COPIES (gl_print_copies_get_type ()) +#define GL_PRINT_COPIES(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PRINT_COPIES, glPrintCopies )) +#define GL_PRINT_COPIES_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PRINT_COPIES, glPrintCopiesClass)) +#define GL_IS_PRINT_COPIES(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PRINT_COPIES)) +#define GL_IS_PRINT_COPIES_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PRINT_COPIES)) + +typedef struct _glPrintCopies glPrintCopies; +typedef struct _glPrintCopiesClass glPrintCopiesClass; + +struct _glPrintCopies { + 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 _glPrintCopiesClass { + GtkHBoxClass parent_class; +}; + +extern guint gl_print_copies_get_type (void); + +extern GtkWidget *gl_print_copies_new (glLabel * label); + +extern void gl_print_copies_get_range (glPrintCopies * copies, + gint * n_sheets, + gint * first_label, + gint * last_label); + +extern void gl_print_copies_set_range (glPrintCopies * copies, + gint n_sheets, + gint first_label, + gint last_label); + +#endif diff --git a/glabels1/src/print_dialog.c b/glabels1/src/print_dialog.c new file mode 100644 index 00000000..97aa0a3c --- /dev/null +++ b/glabels1/src/print_dialog.c @@ -0,0 +1,288 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print.c: Print module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "print_dialog.h" +#include "print.h" +#include "label.h" +#include "bc.h" +#include "template.h" +#include "mdi.h" +#include "hack.h" + +#include "print_copies.h" +#include "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 function prototypes. */ +/*===========================================*/ +static void print_sheets (GtkWidget * dlg, glLabel * label, + gboolean preview_flag, + gint n_sheets, gint first, gint last, + gboolean outline_flag, gboolean reverse_flag); + +static void print_sheets_merge (GtkWidget * dlg, glLabel * label, + GList *record_list, + gboolean preview_flag, + gint n_copies, gint first, + gboolean collate_flag, + gboolean outline_flag, gboolean reverse_flag); + + +/*****************************************************************************/ +/* "Print" menu item callback. */ +/*****************************************************************************/ +void +gl_print_dialog_cb (GtkWidget * widget, gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + GnomeApp *app = gnome_mdi_get_active_window (GNOME_MDI (data)); + GtkWidget *dlg = NULL; + GtkWidget *copies = NULL; + GtkWidget *merge = NULL; + GtkWidget *outline_check = NULL; + GtkWidget *reverse_check = NULL; + GtkWidget *wframe, *wvbox; + glLabel *label; + gint ret; + 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; + GList *record_list = NULL; + gint n_records; + + g_return_if_fail (child != NULL); + g_return_if_fail (app != NULL); + + label = gl_mdi_get_label (child); + + dlg = gnome_print_dialog_new (_("Print"), 0); + + if (label->merge_type == GL_MERGE_NONE) { + + /* ----------- Add simple-copies widget ------------ */ + wframe = gtk_frame_new (_("Copies")); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), wframe, + FALSE, FALSE, 0); + + copies = gl_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_print_copies_set_range (GL_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 (GNOME_DIALOG (dlg)->vbox), wframe, + FALSE, FALSE, 0); + + merge = gl_print_merge_new (label); + gtk_container_set_border_width (GTK_CONTAINER (merge), + GNOME_PAD_SMALL); + gtk_container_add (GTK_CONTAINER (wframe), merge); + + record_list = gl_merge_read_data (label->merge_type, + label->merge_fields, + label->merge_src); + n_records = gl_merge_count_records( record_list ); + gl_print_merge_set_copies (GL_PRINT_MERGE(merge), + n_copies, first, n_records, + collate_flag); + } + gtk_widget_show_all (wframe); + + /* ----------- Add custom print options area ------------ */ + wframe = gtk_frame_new (_("Options")); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->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); + + /* 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); + + gtk_widget_show_all (wframe); + + gtk_signal_connect (GTK_OBJECT (dlg), "destroy", + GTK_SIGNAL_FUNC (gtk_widget_destroyed), &dlg); + + gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (app)); + + /* ----------- Now run the dialog and act ---------------- */ + ret = gnome_dialog_run (GNOME_DIALOG (dlg)); + + switch (ret) { + + case GNOME_PRINT_PRINT: + case GNOME_PRINT_PREVIEW: + outline_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (outline_check)); + reverse_flag = + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (reverse_check)); + + if (label->merge_type == GL_MERGE_NONE) { + + gl_print_copies_get_range (GL_PRINT_COPIES (copies), + &n_sheets, &first, &last); + print_sheets (dlg, label, + (ret == GNOME_PRINT_PREVIEW), + n_sheets, first, last, + outline_flag, reverse_flag); + + } else { + + gl_print_merge_get_copies (GL_PRINT_MERGE (merge), + &n_copies, &first, + &collate_flag); + print_sheets_merge (dlg, label, record_list, + (ret == GNOME_PRINT_PREVIEW), + n_copies, first, + collate_flag, + outline_flag, + reverse_flag); + } + break; + + default: + break; + + } + + if (dlg) gtk_widget_destroy (GTK_WIDGET (dlg)); + + +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. print the sheets */ +/*---------------------------------------------------------------------------*/ +static void +print_sheets (GtkWidget * dlg, + 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_dialog (GNOME_PRINT_DIALOG (dlg)); + gl_print_simple (master, label, n_sheets, first, last, + outline_flag, reverse_flag); + gnome_print_master_close (master); + + if (preview_flag) { + GnomePrintMasterPreview *preview_widget = + gnome_print_master_preview_new (master, _("Print preview")); + gtk_widget_show (GTK_WIDGET (preview_widget)); + } else { + gnome_print_master_print (master); + } + + gtk_object_unref (GTK_OBJECT (master)); +} + +/*---------------------------------------------------------------------------*/ +/* PRIVATE. print the sheets with merge data */ +/*---------------------------------------------------------------------------*/ +static void +print_sheets_merge (GtkWidget * dlg, + 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_dialog (GNOME_PRINT_DIALOG (dlg)); + 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) { + GnomePrintMasterPreview *preview_widget = + gnome_print_master_preview_new (master, _("Print preview")); + gtk_widget_show (GTK_WIDGET (preview_widget)); + } else { + gnome_print_master_print (master); + } + + gtk_object_unref (GTK_OBJECT (master)); +} + diff --git a/glabels1/src/print_dialog.h b/glabels1/src/print_dialog.h new file mode 100644 index 00000000..a55b6e56 --- /dev/null +++ b/glabels1/src/print_dialog.h @@ -0,0 +1,30 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print_dialog.h: Print dialog module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PRINT_DIALOG_H__ +#define __PRINT_DIALOG_H__ + +#include +#include "label.h" + +extern void gl_print_dialog_cb (GtkWidget * widget, gpointer data); + +#endif diff --git a/glabels1/src/print_merge.c b/glabels1/src/print_merge.c new file mode 100644 index 00000000..3ef00338 --- /dev/null +++ b/glabels1/src/print_merge.c @@ -0,0 +1,324 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print_merge.c: print merge widget module + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "print_merge.h" +#include "mini_preview.h" + +#include "pixmaps/collate.xpm" +#include "pixmaps/nocollate.xpm" + +#include "debug.h" + +#define MINI_PREVIEW_HEIGHT 175 +#define MINI_PREVIEW_WIDTH 150 + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_print_merge_class_init (glPrintMergeClass * class); +static void gl_print_merge_init (glPrintMerge * merge); +static void gl_print_merge_destroy (GtkObject * object); + +static void gl_print_merge_construct (glPrintMerge * merge, + glLabel * label); + +static void preview_clicked (glMiniPreview *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_print_merge_get_type (void) +{ + static guint print_merge_type = 0; + + if (!print_merge_type) { + GtkTypeInfo print_merge_info = { + "glPrintMerge", + sizeof (glPrintMerge), + sizeof (glPrintMergeClass), + (GtkClassInitFunc) gl_print_merge_class_init, + (GtkObjectInitFunc) gl_print_merge_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + print_merge_type = gtk_type_unique (gtk_hbox_get_type (), + &print_merge_info); + } + + return print_merge_type; +} + +static void +gl_print_merge_class_init (glPrintMergeClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->destroy = gl_print_merge_destroy; +} + +static void +gl_print_merge_init (glPrintMerge * merge) +{ + merge->mini_preview = NULL; + + merge->copies_spin = NULL; + merge->first_spin = NULL; + merge->collate_image = NULL; + merge->collate_check = NULL; +} + +static void +gl_print_merge_destroy (GtkObject * object) +{ + glPrintMerge *merge; + glPrintMergeClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PRINT_MERGE (object)); + + merge = GL_PRINT_MERGE (object); + class = GL_PRINT_MERGE_CLASS (GTK_OBJECT (merge)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_print_merge_new (glLabel * label) +{ + glPrintMerge *merge; + + merge = gtk_type_new (gl_print_merge_get_type ()); + + gl_print_merge_construct (merge, label); + + return GTK_WIDGET (merge); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_print_merge_construct (glPrintMerge * merge, + glLabel * label) +{ + GtkWidget *whbox, *wvbox, *whbox1; + GtkObject *adjust; + + whbox = GTK_WIDGET (merge); + + merge->labels_per_sheet = label->template->nx * label->template->ny; + + /* mini_preview canvas */ + merge->mini_preview = gl_mini_preview_new (MINI_PREVIEW_HEIGHT, + MINI_PREVIEW_WIDTH); + gl_mini_preview_set_label( GL_MINI_PREVIEW (merge->mini_preview), + label->template->name->data ); + gtk_box_pack_start (GTK_BOX (whbox), merge->mini_preview, + TRUE, TRUE, GNOME_PAD); + gl_mini_preview_highlight_range (GL_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); + merge->collate_image = gnome_pixmap_new_from_xpm_d (nocollate_xpm); + 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 */ + gtk_signal_connect (GTK_OBJECT (merge->mini_preview), "clicked", + GTK_SIGNAL_FUNC (preview_clicked), merge); + gtk_signal_connect (GTK_OBJECT (merge->collate_check), "toggled", + GTK_SIGNAL_FUNC (collate_check_cb), merge); + gtk_signal_connect (GTK_OBJECT (merge->copies_spin), "changed", + GTK_SIGNAL_FUNC (spin_cb), merge); + gtk_signal_connect (GTK_OBJECT (merge->first_spin), "changed", + GTK_SIGNAL_FUNC (spin_cb), merge); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Enable/Disable appropriate controls due to radio button toggle.*/ +/*--------------------------------------------------------------------------*/ +static void +collate_check_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glPrintMerge *merge = GL_PRINT_MERGE (user_data); + + if (gtk_toggle_button_get_active (togglebutton)) { + + gnome_pixmap_load_xpm_d (GNOME_PIXMAP (merge->collate_image), + (char **) collate_xpm); + + } else { + + gnome_pixmap_load_xpm_d (GNOME_PIXMAP (merge->collate_image), + (char **) nocollate_xpm); + + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of first spin button */ +/*--------------------------------------------------------------------------*/ +static void +spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glPrintMerge *merge = GL_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_mini_preview_highlight_range (GL_MINI_PREVIEW(merge->mini_preview), + first, last ); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Canvas event handler, select first and last items. */ +/*--------------------------------------------------------------------------*/ +static void +preview_clicked (glMiniPreview *mini_preview, + gint first, gpointer user_data) +{ + glPrintMerge *merge = GL_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_mini_preview_highlight_range (GL_MINI_PREVIEW (merge->mini_preview), + first, last); + +} + +/****************************************************************************/ +/* query selected range of labels within sheet or number of sheets. */ +/****************************************************************************/ +void +gl_print_merge_get_copies (glPrintMerge * 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_print_merge_set_copies (glPrintMerge * 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_mini_preview_highlight_range (GL_MINI_PREVIEW (merge->mini_preview), + first_label, last_label ); +} diff --git a/glabels1/src/print_merge.h b/glabels1/src/print_merge.h new file mode 100644 index 00000000..a2a6ef89 --- /dev/null +++ b/glabels1/src/print_merge.h @@ -0,0 +1,75 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * print_merge.h: print merge widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PRINT_MERGE_H__ +#define __PRINT_MERGE_H__ + +#include +#include "label.h" + +#define GL_TYPE_PRINT_MERGE (gl_print_merge_get_type ()) +#define GL_PRINT_MERGE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PRINT_MERGE, glPrintMerge )) +#define GL_PRINT_MERGE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PRINT_MERGE, glPrintMergeClass)) +#define GL_IS_PRINT_MERGE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PRINT_MERGE)) +#define GL_IS_PRINT_MERGE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PRINT_MERGE)) + +typedef struct _glPrintMerge glPrintMerge; +typedef struct _glPrintMergeClass glPrintMergeClass; + +struct _glPrintMerge { + 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 _glPrintMergeClass { + GtkHBoxClass parent_class; +}; + +extern guint gl_print_merge_get_type (void); + +extern GtkWidget *gl_print_merge_new (glLabel * label); + +extern void gl_print_merge_get_copies (glPrintMerge * merge, + gint * n_copies, + gint * first_label, + gboolean * collate_flag); + +extern void gl_print_merge_set_copies (glPrintMerge * merge, + gint n_copies, + gint first_label, + gint n_records, + gboolean collate_flag); + +#endif diff --git a/glabels1/src/prop_bc.c b/glabels1/src/prop_bc.c new file mode 100644 index 00000000..0b0e8175 --- /dev/null +++ b/glabels1/src/prop_bc.c @@ -0,0 +1,249 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_bc.c: barcode properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_bc.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 (*glPropBCSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_bc_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_bc_class_init (glPropBCClass * class); +static void gl_prop_bc_init (glPropBC * prop); +static void gl_prop_bc_destroy (GtkObject * object); +static void gl_prop_bc_construct (glPropBC * prop, gchar * label); +static void changed_cb (glPropBC * prop); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_bc_get_type (void) +{ + static guint prop_bc_type = 0; + + if (!prop_bc_type) { + GtkTypeInfo prop_bc_info = { + "glPropBC", + sizeof (glPropBC), + sizeof (glPropBCClass), + (GtkClassInitFunc) gl_prop_bc_class_init, + (GtkObjectInitFunc) gl_prop_bc_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_bc_type = gtk_type_unique (gtk_vbox_get_type (), + &prop_bc_info); + } + + return prop_bc_type; +} + +static void +gl_prop_bc_class_init (glPropBCClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_bc_destroy; + + prop_bc_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropBCClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, prop_bc_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_bc_init (glPropBC * prop) +{ + prop->scale_spin = NULL; + prop->color_picker = NULL; +} + +static void +gl_prop_bc_destroy (GtkObject * object) +{ + glPropBC *prop; + glPropBCClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_BC (object)); + + prop = GL_PROP_BC (object); + class = GL_PROP_BC_CLASS (GTK_OBJECT (prop)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_bc_new (gchar * label) +{ + glPropBC *prop; + + prop = gtk_type_new (gl_prop_bc_get_type ()); + + gl_prop_bc_construct (prop, label); + + return GTK_WIDGET (prop); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_bc_construct (glPropBC * 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); + gtk_signal_connect_object (GTK_OBJECT (prop->scale_spin), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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 (); + gtk_signal_connect_object (GTK_OBJECT (prop->color_picker), "color_set", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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 (glPropBC * prop) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (prop), prop_bc_signals[CHANGED]); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_prop_bc_get_params (glPropBC * prop, + gdouble * scale, + guint * color) +{ + guint8 r, g, b, a; + + /* ------- Get updated scale ------ */ + *scale = + gtk_spin_button_get_value_as_float (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_prop_bc_set_params (glPropBC * 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/glabels1/src/prop_bc.h b/glabels1/src/prop_bc.h new file mode 100644 index 00000000..f009b1fb --- /dev/null +++ b/glabels1/src/prop_bc.h @@ -0,0 +1,67 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_bc.h: barcode properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_BC_H__ +#define __PROP_BC_H__ + +#include +#include "bc.h" + +#define GL_TYPE_PROP_BC (gl_prop_bc_get_type ()) +#define GL_PROP_BC(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_BC, glPropBC )) +#define GL_PROP_BC_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_BC, glPropBCClass)) +#define GL_IS_PROP_BC(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_BC)) +#define GL_IS_PROP_BC_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_BC)) + +typedef struct _glPropBC glPropBC; +typedef struct _glPropBCClass glPropBCClass; + +struct _glPropBC { + GtkVBox parent_widget; + + GtkWidget *scale_spin; + GtkWidget *color_picker; +}; + +struct _glPropBCClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropBC * prop, gpointer user_data); +}; + +extern guint gl_prop_bc_get_type (void); + +extern GtkWidget *gl_prop_bc_new (gchar * label); + +extern void gl_prop_bc_get_params (glPropBC * prop, + gdouble * scale, + guint * color); + +extern void gl_prop_bc_set_params (glPropBC * prop, + gdouble scale, + guint color); + +#endif diff --git a/glabels1/src/prop_bc_data.c b/glabels1/src/prop_bc_data.c new file mode 100644 index 00000000..7464bea4 --- /dev/null +++ b/glabels1/src/prop_bc_data.c @@ -0,0 +1,334 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_bc_data.c: barcode data widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_bc_data.h" +#include "merge.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glPropBCDataSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_bc_data_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_bc_data_class_init (glPropBCDataClass * class); +static void gl_prop_bc_data_init (glPropBCData * bc_data); +static void gl_prop_bc_data_destroy (GtkObject * object); +static void gl_prop_bc_data_construct (glPropBCData * bc_data, + gchar * label, GList * field_defs); + +static void changed_cb (glPropBCData * bc_data); +static void radio_toggled_cb (GtkToggleButton * togglebutton, + glPropBCData * bc_data); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_bc_data_get_type (void) +{ + static guint prop_bc_data_type = 0; + + if (!prop_bc_data_type) { + GtkTypeInfo prop_bc_data_info = { + "glPropBCData", + sizeof (glPropBCData), + sizeof (glPropBCDataClass), + (GtkClassInitFunc) gl_prop_bc_data_class_init, + (GtkObjectInitFunc) gl_prop_bc_data_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_bc_data_type = gtk_type_unique (gtk_vbox_get_type (), + &prop_bc_data_info); + } + + return prop_bc_data_type; +} + +static void +gl_prop_bc_data_class_init (glPropBCDataClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_bc_data_destroy; + + prop_bc_data_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropBCDataClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, + prop_bc_data_signals, LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_bc_data_init (glPropBCData * 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_prop_bc_data_destroy (GtkObject * object) +{ + glPropBCData *bc_data; + glPropBCDataClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_BC_DATA (object)); + + bc_data = GL_PROP_BC_DATA (object); + class = GL_PROP_BC_DATA_CLASS (GTK_OBJECT (bc_data)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_bc_data_new (gchar * label, + GList * field_defs) +{ + glPropBCData *bc_data; + + bc_data = gtk_type_new (gl_prop_bc_data_get_type ()); + + gl_prop_bc_data_construct (bc_data, label, field_defs); + + return GTK_WIDGET (bc_data); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_bc_data_construct (glPropBCData * 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_group (GTK_RADIO_BUTTON (bc_data->literal_radio)); + gtk_signal_connect (GTK_OBJECT (bc_data->literal_radio), "toggled", + GTK_SIGNAL_FUNC (radio_toggled_cb), + GTK_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_usize (bc_data->literal_entry, 200, 0); + gtk_signal_connect_object (GTK_OBJECT (bc_data->literal_entry), + "changed", GTK_SIGNAL_FUNC (changed_cb), + GTK_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:")); + gtk_signal_connect (GTK_OBJECT (bc_data->key_radio), "toggled", + GTK_SIGNAL_FUNC (radio_toggled_cb), + GTK_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_usize (wcombo, 200, 0); + gtk_signal_connect_object (GTK_OBJECT (bc_data->key_entry), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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 (glPropBCData * bc_data) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (bc_data), prop_bc_data_signals[CHANGED]); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback to handle toggling of radio buttons */ +/*--------------------------------------------------------------------------*/ +static void +radio_toggled_cb (GtkToggleButton * togglebutton, + glPropBCData * 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 */ + gtk_signal_emit (GTK_OBJECT (bc_data), prop_bc_data_signals[CHANGED]); +} + +/*--------------------------------------------------------------------------*/ +/* Get widget data. */ +/*--------------------------------------------------------------------------*/ +void +gl_prop_bc_data_get_data (glPropBCData * bc_data, + gboolean * field_flag, + gchar ** data, + gchar ** key) +{ + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (bc_data->literal_radio))) { + *field_flag = FALSE; + *data = + gtk_editable_get_chars (GTK_EDITABLE + (bc_data->literal_entry), 0, -1); + *key = NULL; + } else { + *field_flag = TRUE; + *data = NULL; + *key = + gtk_editable_get_chars (GTK_EDITABLE (bc_data->key_entry), + 0, -1); + } +} + +/*--------------------------------------------------------------------------*/ +/* Set widget data. */ +/*--------------------------------------------------------------------------*/ +void +gl_prop_bc_data_set_data (glPropBCData * bc_data, + gboolean merge_flag, + gboolean field_flag, + gchar * data, + gchar * key) +{ + gint pos; + + gtk_widget_set_sensitive (bc_data->key_radio, merge_flag); + + if (!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); + + gtk_signal_handler_block_by_func (GTK_OBJECT + (bc_data->literal_entry), + GTK_SIGNAL_FUNC (changed_cb), + bc_data); + gtk_editable_delete_text (GTK_EDITABLE (bc_data->literal_entry), + 0, -1); + gtk_signal_handler_unblock_by_func (GTK_OBJECT + (bc_data->literal_entry), + GTK_SIGNAL_FUNC + (changed_cb), bc_data); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (bc_data->literal_entry), + data, strlen (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); + + gtk_signal_handler_block_by_func (GTK_OBJECT + (bc_data->key_entry), + GTK_SIGNAL_FUNC (changed_cb), + bc_data); + gtk_editable_delete_text (GTK_EDITABLE (bc_data->key_entry), 0, + -1); + gtk_signal_handler_unblock_by_func (GTK_OBJECT + (bc_data->key_entry), + GTK_SIGNAL_FUNC + (changed_cb), bc_data); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (bc_data->key_entry), + data, strlen (data), &pos); + } + +} diff --git a/glabels1/src/prop_bc_data.h b/glabels1/src/prop_bc_data.h new file mode 100644 index 00000000..0f59e3db --- /dev/null +++ b/glabels1/src/prop_bc_data.h @@ -0,0 +1,72 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_bc_data.h: barcode data widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_BC_DATA_H__ +#define __PROP_BC_DATA_H__ + +#include + +#define GL_TYPE_PROP_BC_DATA (gl_prop_bc_data_get_type ()) +#define GL_PROP_BC_DATA(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_BC_DATA, glPropBCData )) +#define GL_PROP_BC_DATA_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_BC_DATA, glPropBCDataClass)) +#define GL_IS_PROP_BC_DATA(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_BC_DATA)) +#define GL_IS_PROP_BC_DATA_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_BC_DATA)) + +typedef struct _glPropBCData glPropBCData; +typedef struct _glPropBCDataClass glPropBCDataClass; + +struct _glPropBCData { + GtkVBox parent_widget; + + GtkWidget *literal_radio; + GtkWidget *literal_entry; + + GtkWidget *key_radio; + GtkWidget *key_entry; +}; + +struct _glPropBCDataClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropBCData * bc_data, gpointer user_data); +}; + +extern guint gl_prop_bc_data_get_type (void); + +extern GtkWidget *gl_prop_bc_data_new (gchar * label, GList * field_defs); + +extern void gl_prop_bc_data_get_data (glPropBCData * bc_data, + gboolean * field_flag, + gchar ** data, + gchar ** key); + +extern void gl_prop_bc_data_set_data (glPropBCData * bc_data, + gboolean merge_flag, + gboolean field_flag, + gchar * data, + gchar * key); + +#endif diff --git a/glabels1/src/prop_bc_style.c b/glabels1/src/prop_bc_style.c new file mode 100644 index 00000000..07432efa --- /dev/null +++ b/glabels1/src/prop_bc_style.c @@ -0,0 +1,460 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_bc_style.c: barcode style selection widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_bc_style.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glPropBCStyleSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_bc_style_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_bc_style_class_init (glPropBCStyleClass * class); +static void gl_prop_bc_style_init (glPropBCStyle * prop_style); +static void gl_prop_bc_style_destroy (GtkObject * object); +static void gl_prop_bc_style_construct (glPropBCStyle * prop_style, + gchar * label); +static void changed_cb (glPropBCStyle * prop_style); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_bc_style_get_type (void) +{ + static guint prop_bc_style_type = 0; + + if (!prop_bc_style_type) { + GtkTypeInfo prop_bc_style_info = { + "glPropBCStyle", + sizeof (glPropBCStyle), + sizeof (glPropBCStyleClass), + (GtkClassInitFunc) gl_prop_bc_style_class_init, + (GtkObjectInitFunc) gl_prop_bc_style_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_bc_style_type = gtk_type_unique (gtk_vbox_get_type (), + &prop_bc_style_info); + } + + return prop_bc_style_type; +} + +static void +gl_prop_bc_style_class_init (glPropBCStyleClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_bc_style_destroy; + + prop_bc_style_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropBCStyleClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, prop_bc_style_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_bc_style_init (glPropBCStyle * 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_prop_bc_style_destroy (GtkObject * object) +{ + glPropBCStyle *prop_style; + glPropBCStyleClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_BC_STYLE (object)); + + prop_style = GL_PROP_BC_STYLE (object); + class = GL_PROP_BC_STYLE_CLASS (GTK_OBJECT (prop_style)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_bc_style_new (gchar * label) +{ + glPropBCStyle *prop_style; + + prop_style = gtk_type_new (gl_prop_bc_style_get_type ()); + + gl_prop_bc_style_construct (prop_style, label); + + return GTK_WIDGET (prop_style); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_bc_style_construct (glPropBCStyle * 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_group (GTK_RADIO_BUTTON (prop->postnet_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->postnet_radio, + FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->postnet_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* EAN button */ + prop->ean_radio = gtk_radio_button_new_with_label (radio_group, "EAN"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->ean_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->ean_radio, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->ean_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* UPC button */ + prop->upc_radio = gtk_radio_button_new_with_label (radio_group, "UPC"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->upc_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->upc_radio, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->upc_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* ISBN button */ + prop->isbn_radio = + gtk_radio_button_new_with_label (radio_group, "ISBN"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->isbn_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->isbn_radio, + FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->isbn_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* CODE39 button */ + prop->code39_radio = + gtk_radio_button_new_with_label (radio_group, "Code 39"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->code39_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code39_radio, + FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->code39_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* CODE128 button */ + prop->code128_radio = + gtk_radio_button_new_with_label (radio_group, "Code 128"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->code128_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128_radio, + FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->code128_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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_group (GTK_RADIO_BUTTON (prop->code128b_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128b_radio, + FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->code128b_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* CODE128C button */ + prop->code128c_radio = + gtk_radio_button_new_with_label (radio_group, "Code 128-C"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->code128c_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->code128c_radio, + FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->code128c_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* I25 button */ + prop->i25_radio = + gtk_radio_button_new_with_label (radio_group, "Interleaved 2 of 5"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->i25_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->i25_radio, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->i25_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* CBR button */ + prop->cbr_radio = + gtk_radio_button_new_with_label (radio_group, "Codabar"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->cbr_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->cbr_radio, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->cbr_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* MSI button */ + prop->msi_radio = gtk_radio_button_new_with_label (radio_group, "MSI"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->msi_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->msi_radio, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->msi_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + + /* PLS button */ + prop->pls_radio = + gtk_radio_button_new_with_label (radio_group, "Plessey"); + radio_group = + gtk_radio_button_group (GTK_RADIO_BUTTON (prop->pls_radio)); + gtk_box_pack_start (GTK_BOX (wvbox2), prop->pls_radio, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (prop->pls_radio), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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); + gtk_signal_connect_object (GTK_OBJECT (prop->text_check), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (prop)); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glPropBCStyle * prop_style) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (prop_style), + prop_bc_style_signals[CHANGED]); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_prop_bc_style_get_params (glPropBCStyle * 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_prop_bc_style_set_params (glPropBCStyle * 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/glabels1/src/prop_bc_style.h b/glabels1/src/prop_bc_style.h new file mode 100644 index 00000000..13065e4e --- /dev/null +++ b/glabels1/src/prop_bc_style.h @@ -0,0 +1,79 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_bc_style.h: barcode style selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_BC_STYLE_H__ +#define __PROP_BC_STYLE_H__ + +#include +#include "bc.h" + +#define GL_TYPE_PROP_BC_STYLE (gl_prop_bc_style_get_type ()) +#define GL_PROP_BC_STYLE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_BC_STYLE, glPropBCStyle )) +#define GL_PROP_BC_STYLE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_BC_STYLE, glPropBCStyleClass)) +#define GL_IS_PROP_BC_STYLE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_BC_STYLE)) +#define GL_IS_PROP_BC_STYLE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_BC_STYLE)) + +typedef struct _glPropBCStyle glPropBCStyle; +typedef struct _glPropBCStyleClass glPropBCStyleClass; + +struct _glPropBCStyle { + 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 _glPropBCStyleClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropBCStyle * prop, gpointer user_data); +}; + +extern guint gl_prop_bc_style_get_type (void); + +extern GtkWidget *gl_prop_bc_style_new (gchar * label); + +extern void gl_prop_bc_style_get_params (glPropBCStyle * prop_style, + glBarcodeStyle * style, + gboolean * text_flag); + +extern void gl_prop_bc_style_set_params (glPropBCStyle * prop_style, + glBarcodeStyle style, + gboolean text_flag); + +#endif diff --git a/glabels1/src/prop_fill.c b/glabels1/src/prop_fill.c new file mode 100644 index 00000000..f9f5151c --- /dev/null +++ b/glabels1/src/prop_fill.c @@ -0,0 +1,215 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_fill.c: fill properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_fill.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 (*glPropFillSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_fill_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_fill_class_init (glPropFillClass * class); +static void gl_prop_fill_init (glPropFill * fill); +static void gl_prop_fill_destroy (GtkObject * object); +static void gl_prop_fill_construct (glPropFill * fill, gchar * label); +static void changed_cb (glPropFill * fill); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_fill_get_type (void) +{ + static guint prop_fill_type = 0; + + if (!prop_fill_type) { + GtkTypeInfo prop_fill_info = { + "glPropFill", + sizeof (glPropFill), + sizeof (glPropFillClass), + (GtkClassInitFunc) gl_prop_fill_class_init, + (GtkObjectInitFunc) gl_prop_fill_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_fill_type = + gtk_type_unique (gtk_vbox_get_type (), &prop_fill_info); + } + + return prop_fill_type; +} + +static void +gl_prop_fill_class_init (glPropFillClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_fill_destroy; + + prop_fill_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropFillClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, prop_fill_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_fill_init (glPropFill * fill) +{ + fill->color_picker = NULL; +} + +static void +gl_prop_fill_destroy (GtkObject * object) +{ + glPropFill *fill; + glPropFillClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_FILL (object)); + + fill = GL_PROP_FILL (object); + class = GL_PROP_FILL_CLASS (GTK_OBJECT (fill)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_fill_new (gchar * label) +{ + glPropFill *fill; + + fill = gtk_type_new (gl_prop_fill_get_type ()); + + gl_prop_fill_construct (fill, label); + + return GTK_WIDGET (fill); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_fill_construct (glPropFill * 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 (); + gtk_signal_connect_object (GTK_OBJECT (fill->color_picker), "color_set", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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 (glPropFill * fill) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (fill), prop_fill_signals[CHANGED]); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_prop_fill_get_params (glPropFill * 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_prop_fill_set_params (glPropFill * 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/glabels1/src/prop_fill.h b/glabels1/src/prop_fill.h new file mode 100644 index 00000000..0605e209 --- /dev/null +++ b/glabels1/src/prop_fill.h @@ -0,0 +1,62 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_fill.h: fill properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_FILL_H__ +#define __PROP_FILL_H__ + +#include +#include "label.h" + +#define GL_TYPE_PROP_FILL (gl_prop_fill_get_type ()) +#define GL_PROP_FILL(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_FILL, glPropFill )) +#define GL_PROP_FILL_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_FILL, glPropFillClass)) +#define GL_IS_PROP_FILL(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_FILL)) +#define GL_IS_PROP_FILL_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_FILL)) + +typedef struct _glPropFill glPropFill; +typedef struct _glPropFillClass glPropFillClass; + +struct _glPropFill { + GtkVBox parent_widget; + + GtkWidget *color_picker; +}; + +struct _glPropFillClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropFill * fill, gpointer user_data); +}; + +extern guint gl_prop_fill_get_type (void); + +extern GtkWidget *gl_prop_fill_new (gchar * label); + +extern void gl_prop_fill_get_params (glPropFill * fill, guint * color); + +extern void gl_prop_fill_set_params (glPropFill * fill, guint color); + +#endif diff --git a/glabels1/src/prop_line.c b/glabels1/src/prop_line.c new file mode 100644 index 00000000..a73811e9 --- /dev/null +++ b/glabels1/src/prop_line.c @@ -0,0 +1,244 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_line.c: line properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_line.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 (*glPropLineSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_line_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_line_class_init (glPropLineClass * class); +static void gl_prop_line_init (glPropLine * line); +static void gl_prop_line_destroy (GtkObject * object); +static void gl_prop_line_construct (glPropLine * line, gchar * label); +static void changed_cb (glPropLine * line); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_line_get_type (void) +{ + static guint prop_line_type = 0; + + if (!prop_line_type) { + GtkTypeInfo prop_line_info = { + "glPropLine", + sizeof (glPropLine), + sizeof (glPropLineClass), + (GtkClassInitFunc) gl_prop_line_class_init, + (GtkObjectInitFunc) gl_prop_line_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_line_type = + gtk_type_unique (gtk_vbox_get_type (), &prop_line_info); + } + + return prop_line_type; +} + +static void +gl_prop_line_class_init (glPropLineClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_line_destroy; + + prop_line_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropLineClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, prop_line_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_line_init (glPropLine * line) +{ + line->width_spin = NULL; + line->color_picker = NULL; + line->units_label = NULL; +} + +static void +gl_prop_line_destroy (GtkObject * object) +{ + glPropLine *line; + glPropLineClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_LINE (object)); + + line = GL_PROP_LINE (object); + class = GL_PROP_LINE_CLASS (GTK_OBJECT (line)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_line_new (gchar * label) +{ + glPropLine *line; + + line = gtk_type_new (gl_prop_line_get_type ()); + + gl_prop_line_construct (line, label); + + return GTK_WIDGET (line); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_line_construct (glPropLine * 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); + gtk_signal_connect_object (GTK_OBJECT (line->width_spin), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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 (); + gtk_signal_connect_object (GTK_OBJECT (line->color_picker), "color_set", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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 (glPropLine * line) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (line), prop_line_signals[CHANGED]); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_prop_line_get_params (glPropLine * 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_prop_line_set_params (glPropLine * 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/glabels1/src/prop_line.h b/glabels1/src/prop_line.h new file mode 100644 index 00000000..1350fac0 --- /dev/null +++ b/glabels1/src/prop_line.h @@ -0,0 +1,68 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_line.h: line properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_LINE_H__ +#define __PROP_LINE_H__ + +#include +#include "label.h" + +#define GL_TYPE_PROP_LINE (gl_prop_line_get_type ()) +#define GL_PROP_LINE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_LINE, glPropLine )) +#define GL_PROP_LINE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_LINE, glPropLineClass)) +#define GL_IS_PROP_LINE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_LINE)) +#define GL_IS_PROP_LINE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_LINE)) + +typedef struct _glPropLine glPropLine; +typedef struct _glPropLineClass glPropLineClass; + +struct _glPropLine { + GtkVBox parent_widget; + + GtkWidget *width_spin; + GtkWidget *color_picker; + GtkWidget *units_label; +}; + +struct _glPropLineClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropLine * line, gpointer user_data); +}; + +extern guint gl_prop_line_get_type (void); + +extern GtkWidget *gl_prop_line_new (gchar * label); + +extern void gl_prop_line_get_params (glPropLine * line, + gdouble * width, + guint * color); + +extern void gl_prop_line_set_params (glPropLine * line, + gdouble width, + guint color); + +#endif diff --git a/glabels1/src/prop_position.c b/glabels1/src/prop_position.c new file mode 100644 index 00000000..039afe62 --- /dev/null +++ b/glabels1/src/prop_position.c @@ -0,0 +1,287 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_position.c: position properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_position.h" +#include "prefs.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glPropPositionSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_position_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_position_class_init (glPropPositionClass * class); +static void gl_prop_position_init (glPropPosition * position); +static void gl_prop_position_destroy (GtkObject * object); +static void gl_prop_position_construct (glPropPosition * position, + gchar * label); +static void changed_cb (glPropPosition * position); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_position_get_type (void) +{ + static guint prop_position_type = 0; + + if (!prop_position_type) { + GtkTypeInfo prop_position_info = { + "glPropPosition", + sizeof (glPropPosition), + sizeof (glPropPositionClass), + (GtkClassInitFunc) gl_prop_position_class_init, + (GtkObjectInitFunc) gl_prop_position_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_position_type = gtk_type_unique (gtk_vbox_get_type (), + &prop_position_info); + } + + return prop_position_type; +} + +static void +gl_prop_position_class_init (glPropPositionClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_position_destroy; + + prop_position_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropPositionClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, prop_position_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_position_init (glPropPosition * position) +{ + position->x_spin = NULL; + position->y_spin = NULL; +} + +static void +gl_prop_position_destroy (GtkObject * object) +{ + glPropPosition *position; + glPropPositionClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_POSITION (object)); + + position = GL_PROP_POSITION (object); + class = GL_PROP_POSITION_CLASS (GTK_OBJECT (position)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_position_new (gchar * label) +{ + glPropPosition *position; + + position = gtk_type_new (gl_prop_position_get_type ()); + + gl_prop_position_construct (position, label); + + return GTK_WIDGET (position); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_position_construct (glPropPosition * 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; + + 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 (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); + gtk_signal_connect_object (GTK_OBJECT (position->x_spin), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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); + gtk_signal_connect_object (GTK_OBJECT (position->y_spin), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glPropPosition * position) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (position), prop_position_signals[CHANGED]); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_prop_position_get_position (glPropPosition * position, + gdouble * x, + gdouble * y) +{ + gdouble units_per_point; + + units_per_point = gl_prefs_get_units_per_point (); + + *x = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON + (position->x_spin)); + *y = gtk_spin_button_get_value_as_float (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_prop_position_set_params (glPropPosition * 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); + +} diff --git a/glabels1/src/prop_position.h b/glabels1/src/prop_position.h new file mode 100644 index 00000000..c0637a59 --- /dev/null +++ b/glabels1/src/prop_position.h @@ -0,0 +1,67 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_position.h: position properties widget module header file + * + * Copyright (C) 2000, 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_POSITION_H__ +#define __PROP_POSITION_H__ + +#include +#include "label.h" + +#define GL_TYPE_PROP_POSITION (gl_prop_position_get_type ()) +#define GL_PROP_POSITION(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_POSITION, glPropPosition )) +#define GL_PROP_POSITION_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_POSITION, glPropPositionClass)) +#define GL_IS_PROP_POSITION(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_POSITION)) +#define GL_IS_PROP_POSITION_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_POSITION)) + +typedef struct _glPropPosition glPropPosition; +typedef struct _glPropPositionClass glPropPositionClass; + +struct _glPropPosition { + GtkVBox parent_widget; + + GtkWidget *x_spin; + GtkWidget *y_spin; + GtkWidget *units_label; +}; + +struct _glPropPositionClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropPosition * prop, gpointer user_data); +}; + +extern guint gl_prop_position_get_type (void); + +extern GtkWidget *gl_prop_position_new (gchar * label); + +extern void gl_prop_position_get_position (glPropPosition * position, + gdouble * x, gdouble * y); + +extern void gl_prop_position_set_params (glPropPosition * position, + gdouble x, gdouble y, + gdouble x_max, gdouble y_max); + +#endif diff --git a/glabels1/src/prop_size.c b/glabels1/src/prop_size.c new file mode 100644 index 00000000..1f8d094d --- /dev/null +++ b/glabels1/src/prop_size.c @@ -0,0 +1,459 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_size.c: size properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_size.h" +#include "prefs.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glPropSizeSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_size_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_size_class_init (glPropSizeClass * class); +static void gl_prop_size_init (glPropSize * size); +static void gl_prop_size_destroy (GtkObject * object); +static void gl_prop_size_construct (glPropSize * 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_prop_size_get_type (void) +{ + static guint prop_size_type = 0; + + if (!prop_size_type) { + GtkTypeInfo prop_size_info = { + "glPropSize", + sizeof (glPropSize), + sizeof (glPropSizeClass), + (GtkClassInitFunc) gl_prop_size_class_init, + (GtkObjectInitFunc) gl_prop_size_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_size_type = + gtk_type_unique (gtk_vbox_get_type (), &prop_size_info); + } + + return prop_size_type; +} + +static void +gl_prop_size_class_init (glPropSizeClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_size_destroy; + + prop_size_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropSizeClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, prop_size_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_size_init (glPropSize * 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_prop_size_destroy (GtkObject * object) +{ + glPropSize *size; + glPropSizeClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_SIZE (object)); + + size = GL_PROP_SIZE (object); + class = GL_PROP_SIZE_CLASS (GTK_OBJECT (size)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_size_new (gchar * label) +{ + glPropSize *size; + + size = gtk_type_new (gl_prop_size_get_type ()); + + gl_prop_size_construct (size, label); + + return GTK_WIDGET (size); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_size_construct (glPropSize * 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 */ + gtk_signal_connect (GTK_OBJECT (size->aspect_checkbox), "toggled", + GTK_SIGNAL_FUNC (aspect_toggle_cb), size); + gtk_signal_connect (GTK_OBJECT (size->w_spin), "changed", + GTK_SIGNAL_FUNC (w_spin_cb), size); + gtk_signal_connect (GTK_OBJECT (size->h_spin), "changed", + GTK_SIGNAL_FUNC (h_spin_cb), size); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Maintain aspect ratio checkbox callback. */ +/*--------------------------------------------------------------------------*/ +static void +aspect_toggle_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glPropSize *size = GL_PROP_SIZE (user_data); + GtkAdjustment *w_adjust, *h_adjust; + + if (gtk_toggle_button_get_active (togglebutton)) { + + size->w = + gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON + (size->w_spin)); + size->h = + gtk_spin_button_get_value_as_float (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; + + } + + gtk_signal_handler_block_by_func (GTK_OBJECT (size->w_spin), + GTK_SIGNAL_FUNC (w_spin_cb), + user_data); + gtk_signal_handler_block_by_func (GTK_OBJECT (size->h_spin), + GTK_SIGNAL_FUNC (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)); + gtk_signal_handler_unblock_by_func (GTK_OBJECT (size->w_spin), + GTK_SIGNAL_FUNC (w_spin_cb), + user_data); + gtk_signal_handler_unblock_by_func (GTK_OBJECT (size->h_spin), + GTK_SIGNAL_FUNC (h_spin_cb), + user_data); + + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (size), prop_size_signals[CHANGED]); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. W spin button changed callback. */ +/*--------------------------------------------------------------------------*/ +static void +w_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glPropSize *size = GL_PROP_SIZE (user_data); + GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox); + + size->w = + gtk_spin_button_get_value_as_float (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. */ + gtk_signal_handler_block_by_func (GTK_OBJECT (size->h_spin), + GTK_SIGNAL_FUNC (h_spin_cb), + user_data); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->h_spin), + size->h); + gtk_signal_handler_unblock_by_func (GTK_OBJECT (size->h_spin), + GTK_SIGNAL_FUNC (h_spin_cb), + user_data); + } + + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (size), prop_size_signals[CHANGED]); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. H spin button changed callback. */ +/*--------------------------------------------------------------------------*/ +static void +h_spin_cb (GtkSpinButton * spinbutton, + gpointer user_data) +{ + glPropSize *size = GL_PROP_SIZE (user_data); + GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox); + + size->h = + gtk_spin_button_get_value_as_float (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. */ + gtk_signal_handler_block_by_func (GTK_OBJECT (size->w_spin), + GTK_SIGNAL_FUNC (w_spin_cb), + user_data); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->w_spin), + size->w); + gtk_signal_handler_unblock_by_func (GTK_OBJECT (size->w_spin), + GTK_SIGNAL_FUNC (w_spin_cb), + user_data); + } + + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (size), prop_size_signals[CHANGED]); + +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_prop_size_get_size (glPropSize * 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_as_float (GTK_SPIN_BUTTON + (size->w_spin)); + *h = gtk_spin_button_get_value_as_float (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_prop_size_set_params (glPropSize * 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); + +} diff --git a/glabels1/src/prop_size.h b/glabels1/src/prop_size.h new file mode 100644 index 00000000..550e93f2 --- /dev/null +++ b/glabels1/src/prop_size.h @@ -0,0 +1,75 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_size.h: size properties widget module header file + * + * Copyright (C) 2000, 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_SIZE_H__ +#define __PROP_SIZE_H__ + +#include +#include "label.h" + +#define GL_TYPE_PROP_SIZE (gl_prop_size_get_type ()) +#define GL_PROP_SIZE(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_SIZE, glPropSize )) +#define GL_PROP_SIZE_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_SIZE, glPropSizeClass)) +#define GL_IS_PROP_SIZE(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_SIZE)) +#define GL_IS_PROP_SIZE_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_SIZE)) + +typedef struct _glPropSize glPropSize; +typedef struct _glPropSizeClass glPropSizeClass; + +struct _glPropSize { + 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 _glPropSizeClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropSize * size, gpointer user_data); +}; + +extern guint gl_prop_size_get_type (void); + +extern GtkWidget *gl_prop_size_new (gchar * label); + +extern void gl_prop_size_get_size (glPropSize * size, + gdouble * w, gdouble * h, + gboolean * keep_aspect_ratio_flag); + +extern void gl_prop_size_set_params (glPropSize * size, + gdouble w, gdouble h, + gboolean keep_aspect_ratio_flag, + gdouble w_max, gdouble h_max); + +#endif diff --git a/glabels1/src/prop_text.c b/glabels1/src/prop_text.c new file mode 100644 index 00000000..c7f6a2ad --- /dev/null +++ b/glabels1/src/prop_text.c @@ -0,0 +1,426 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_text.c: text properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_text.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 (*glPropTextSignal) (GtkObject * object, + gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_text_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_text_class_init (glPropTextClass * class); +static void gl_prop_text_init (glPropText * text); +static void gl_prop_text_destroy (GtkObject * object); +static void gl_prop_text_construct (glPropText * text, gchar * label); + +static void changed_cb (glPropText * text); +static void just_toggled_cb (GtkToggleButton * togglebutton, + gpointer user_data); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_text_get_type (void) +{ + static guint prop_text_type = 0; + + if (!prop_text_type) { + GtkTypeInfo prop_text_info = { + "glPropText", + sizeof (glPropText), + sizeof (glPropTextClass), + (GtkClassInitFunc) gl_prop_text_class_init, + (GtkObjectInitFunc) gl_prop_text_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_text_type = + gtk_type_unique (gtk_vbox_get_type (), &prop_text_info); + } + + return prop_text_type; +} + +static void +gl_prop_text_class_init (glPropTextClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_text_destroy; + + prop_text_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropTextClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, prop_text_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_text_init (glPropText * 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_prop_text_destroy (GtkObject * object) +{ + glPropText *text; + glPropTextClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_TEXT (object)); + + text = GL_PROP_TEXT (object); + class = GL_PROP_TEXT_CLASS (GTK_OBJECT (text)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_text_new (gchar * label) +{ + glPropText *text; + + text = gtk_type_new (gl_prop_text_get_type ()); + + gl_prop_text_construct (text, label); + + return GTK_WIDGET (text); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_text_construct (glPropText * 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_usize (wcombo, 200, 0); + gtk_box_pack_start (GTK_BOX (whbox1), wcombo, FALSE, FALSE, 0); + gtk_signal_connect_object (GTK_OBJECT (text->font_family_entry), + "changed", GTK_SIGNAL_FUNC (changed_cb), + GTK_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); + gtk_signal_connect_object (GTK_OBJECT (text->font_size_spin), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (text)); + + /* Font weight/italic button widgets */ + text->font_b_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->font_b_button), + gnome_stock_new_with_icon + (GNOME_STOCK_PIXMAP_TEXT_BOLD)); + gtk_box_pack_start (GTK_BOX (whbox1), text->font_b_button, FALSE, FALSE, + 0); + gtk_signal_connect_object (GTK_OBJECT (text->font_b_button), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (text)); + text->font_i_button = gtk_toggle_button_new (); + gtk_container_add (GTK_CONTAINER (text->font_i_button), + gnome_stock_new_with_icon + (GNOME_STOCK_PIXMAP_TEXT_ITALIC)); + gtk_box_pack_start (GTK_BOX (whbox1), text->font_i_button, FALSE, FALSE, + 0); + gtk_signal_connect_object (GTK_OBJECT (text->font_i_button), "toggled", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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 (); + gtk_signal_connect_object (GTK_OBJECT (text->color_picker), "color_set", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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), + gnome_stock_new_with_icon + (GNOME_STOCK_PIXMAP_ALIGN_LEFT)); + 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), + gnome_stock_new_with_icon + (GNOME_STOCK_PIXMAP_ALIGN_CENTER)); + 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), + gnome_stock_new_with_icon + (GNOME_STOCK_PIXMAP_ALIGN_RIGHT)); + gtk_box_pack_start (GTK_BOX (whbox1), text->right_button, FALSE, FALSE, + 0); + + /* Now connect a callback that makes these toggles mutually exclusive */ + gtk_signal_connect (GTK_OBJECT (text->left_button), "toggled", + GTK_SIGNAL_FUNC (just_toggled_cb), text); + gtk_signal_connect (GTK_OBJECT (text->center_button), "toggled", + GTK_SIGNAL_FUNC (just_toggled_cb), text); + gtk_signal_connect (GTK_OBJECT (text->right_button), "toggled", + GTK_SIGNAL_FUNC (just_toggled_cb), text); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glPropText * text) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (text), prop_text_signals[CHANGED]); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Justify toggle button callback. */ +/*--------------------------------------------------------------------------*/ +static void +just_toggled_cb (GtkToggleButton * togglebutton, + gpointer user_data) +{ + glPropText *text = GL_PROP_TEXT (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 */ + gtk_signal_emit (GTK_OBJECT (text), prop_text_signals[CHANGED]); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_prop_text_get_params (glPropText * 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_as_float (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_prop_text_set_params (glPropText * 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/glabels1/src/prop_text.h b/glabels1/src/prop_text.h new file mode 100644 index 00000000..8d3b02ae --- /dev/null +++ b/glabels1/src/prop_text.h @@ -0,0 +1,81 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_text.h: text properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_TEXT_H__ +#define __PROP_TEXT_H__ + +#include +#include "label.h" + +#define GL_TYPE_PROP_TEXT (gl_prop_text_get_type ()) +#define GL_PROP_TEXT(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_TEXT, glPropText )) +#define GL_PROP_TEXT_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_TEXT, glPropTextClass)) +#define GL_IS_PROP_TEXT(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_TEXT)) +#define GL_IS_PROP_TEXT_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_TEXT)) + +typedef struct _glPropText glPropText; +typedef struct _glPropTextClass glPropTextClass; + +struct _glPropText { + 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 _glPropTextClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropText * text, gpointer user_data); +}; + +extern guint gl_prop_text_get_type (void); + +extern GtkWidget *gl_prop_text_new (gchar * label); + +extern void gl_prop_text_get_params (glPropText * text, + gchar ** font_family, + gdouble * font_size, + GnomeFontWeight * font_weight, + gboolean * font_italic_flag, + guint * color, + GtkJustification * just); + +extern void gl_prop_text_set_params (glPropText * text, + gchar * font_family, + gdouble font_size, + GnomeFontWeight font_weight, + gboolean font_italic_flag, + guint color, + GtkJustification just); + +#endif diff --git a/glabels1/src/prop_text_entry.c b/glabels1/src/prop_text_entry.c new file mode 100644 index 00000000..e82e6d1d --- /dev/null +++ b/glabels1/src/prop_text_entry.c @@ -0,0 +1,286 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_text_entry.c: text entry widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_text_entry.h" +#include "merge.h" +#include "text_node.h" + +#include "debug.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glPropTextEntrySignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_text_entry_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_text_entry_class_init (glPropTextEntryClass * class); +static void gl_prop_text_entry_init (glPropTextEntry * text_entry); +static void gl_prop_text_entry_destroy (GtkObject * object); +static void gl_prop_text_entry_construct (glPropTextEntry * text_entry, + gchar * label, GList * field_defs); + +static void changed_cb (glPropTextEntry * text_entry); +static void insert_cb (glPropTextEntry * text_entry); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_text_entry_get_type (void) +{ + static guint prop_text_entry_type = 0; + + if (!prop_text_entry_type) { + GtkTypeInfo prop_text_entry_info = { + "glPropTextEntry", + sizeof (glPropTextEntry), + sizeof (glPropTextEntryClass), + (GtkClassInitFunc) gl_prop_text_entry_class_init, + (GtkObjectInitFunc) gl_prop_text_entry_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_text_entry_type = gtk_type_unique (gtk_vbox_get_type (), + &prop_text_entry_info); + } + + return prop_text_entry_type; +} + +static void +gl_prop_text_entry_class_init (glPropTextEntryClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_text_entry_destroy; + + prop_text_entry_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropTextEntryClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, + prop_text_entry_signals, LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_text_entry_init (glPropTextEntry * text_entry) +{ + text_entry->text_entry = NULL; + text_entry->key_entry = NULL; + text_entry->insert_button = NULL; +} + +static void +gl_prop_text_entry_destroy (GtkObject * object) +{ + glPropTextEntry *text_entry; + glPropTextEntryClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_TEXT_ENTRY (object)); + + text_entry = GL_PROP_TEXT_ENTRY (object); + class = GL_PROP_TEXT_ENTRY_CLASS (GTK_OBJECT (text_entry)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_text_entry_new (gchar * label, + GList * field_defs) +{ + glPropTextEntry *text_entry; + + text_entry = gtk_type_new (gl_prop_text_entry_get_type ()); + + gl_prop_text_entry_construct (text_entry, label, field_defs); + + return GTK_WIDGET (text_entry); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_text_entry_construct (glPropTextEntry * text_entry, + gchar * label, + GList * field_defs) +{ + GtkWidget *wvbox, *wframe, *wtable, *wlabel, *wcombo; + GList *keys; + + 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_new (NULL, NULL); + gtk_text_set_editable (GTK_TEXT (text_entry->text_entry), TRUE); + gtk_signal_connect_object (GTK_OBJECT (text_entry->text_entry), + "changed", GTK_SIGNAL_FUNC (changed_cb), + GTK_OBJECT (text_entry)); + 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_usize (wcombo, 200, 0); + 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")); + gtk_signal_connect_object (GTK_OBJECT (text_entry->insert_button), + "clicked", GTK_SIGNAL_FUNC (insert_cb), + GTK_OBJECT (text_entry)); + gtk_table_attach_defaults (GTK_TABLE (wtable), + text_entry->insert_button, 2, 3, 1, 2); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +changed_cb (glPropTextEntry * text_entry) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (text_entry), + prop_text_entry_signals[CHANGED]); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Callback for when any control in the widget has changed. */ +/*--------------------------------------------------------------------------*/ +static void +insert_cb (glPropTextEntry * text_entry) +{ + gchar *key, *field; + gint pos; + + key = + gtk_editable_get_chars (GTK_EDITABLE (text_entry->key_entry), 0, + -1); + field = g_strdup_printf ("FIELD{%s}", key); + + pos = gtk_editable_get_position (GTK_EDITABLE (text_entry->text_entry)); + gtk_editable_insert_text (GTK_EDITABLE (text_entry->text_entry), + field, strlen (field), &pos); + + g_free (field); + g_free (key); + +} + +/*--------------------------------------------------------------------------*/ +/* Get widget data. */ +/*--------------------------------------------------------------------------*/ +GList * +gl_prop_text_entry_get_text (glPropTextEntry * text_entry) +{ + gchar *text; + GList *lines; + + text = + gtk_editable_get_chars (GTK_EDITABLE (text_entry->text_entry), 0, + -1); + + lines = gl_text_node_lines_new_from_text (text); + + g_free (text); + return lines; +} + +/*--------------------------------------------------------------------------*/ +/* Set widget data. */ +/*--------------------------------------------------------------------------*/ +void +gl_prop_text_entry_set_text (glPropTextEntry * text_entry, + gboolean merge_flag, + GList * lines) +{ + gint pos; + gchar *text; + + gtk_widget_set_sensitive (text_entry->key_entry, merge_flag); + gtk_widget_set_sensitive (text_entry->insert_button, merge_flag); + + gtk_signal_handler_block_by_func (GTK_OBJECT (text_entry->text_entry), + GTK_SIGNAL_FUNC (changed_cb), + text_entry); + gtk_editable_delete_text (GTK_EDITABLE (text_entry->text_entry), 0, -1); + gtk_signal_handler_unblock_by_func (GTK_OBJECT (text_entry->text_entry), + GTK_SIGNAL_FUNC (changed_cb), + text_entry); + + text = gl_text_node_lines_expand (lines, NULL); + + pos = 0; + gtk_editable_insert_text (GTK_EDITABLE (text_entry->text_entry), + text, strlen (text), &pos); + +} diff --git a/glabels1/src/prop_text_entry.h b/glabels1/src/prop_text_entry.h new file mode 100644 index 00000000..06c5deeb --- /dev/null +++ b/glabels1/src/prop_text_entry.h @@ -0,0 +1,67 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_text_entry.h: text entry widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_TEXT_ENTRY_H__ +#define __PROP_TEXT_ENTRY_H__ + +#include + +#include "merge.h" + +#define GL_TYPE_PROP_TEXT_ENTRY (gl_prop_text_entry_get_type ()) +#define GL_PROP_TEXT_ENTRY(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_TEXT_ENTRY, glPropTextEntry )) +#define GL_PROP_TEXT_ENTRY_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_TEXT_ENTRY, glPropTextEntryClass)) +#define GL_IS_PROP_TEXT_ENTRY(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_TEXT_ENTRY)) +#define GL_IS_PROP_TEXT_ENTRY_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_TEXT_ENTRY)) + +typedef struct _glPropTextEntry glPropTextEntry; +typedef struct _glPropTextEntryClass glPropTextEntryClass; + +struct _glPropTextEntry { + GtkVBox parent_widget; + + GtkWidget *text_entry; + GtkWidget *key_entry; + GtkWidget *insert_button; +}; + +struct _glPropTextEntryClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropTextEntry * text_entry, gpointer user_data); +}; + +extern guint gl_prop_text_entry_get_type (void); + +extern GtkWidget *gl_prop_text_entry_new (gchar * label, GList * field_defs); + +extern GList *gl_prop_text_entry_get_text (glPropTextEntry * text_entry); + +extern void gl_prop_text_entry_set_text (glPropTextEntry * text_entry, + gboolean merge_flag, + GList * lines); + +#endif diff --git a/glabels1/src/prop_vector.c b/glabels1/src/prop_vector.c new file mode 100644 index 00000000..303aefad --- /dev/null +++ b/glabels1/src/prop_vector.c @@ -0,0 +1,305 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_vector.c: vector properties widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "prop_vector.h" +#include "prefs.h" + +#include "debug.h" + +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif + +#define LENGTH(x,y) sqrt( (x)*(x) + (y)*(y) ) +#define ANGLE(x,y) ( (180.0/M_PI)*atan2( -(y), (x) ) ) +#define COMP_X(l,a) ( (l) * cos( (M_PI/180.0)*(a) ) ) +#define COMP_Y(l,a) ( -(l) * sin( (M_PI/180.0)*(a) ) ) + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glPropVectorSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint prop_vector_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_prop_vector_class_init (glPropVectorClass * class); +static void gl_prop_vector_init (glPropVector * vector); +static void gl_prop_vector_destroy (GtkObject * object); +static void gl_prop_vector_construct (glPropVector * vector, gchar * label); +static void changed_cb (glPropVector * vector); + +/*================================================================*/ +/* Boilerplate Object stuff. */ +/*================================================================*/ +guint +gl_prop_vector_get_type (void) +{ + static guint prop_vector_type = 0; + + if (!prop_vector_type) { + GtkTypeInfo prop_vector_info = { + "glPropVector", + sizeof (glPropVector), + sizeof (glPropVectorClass), + (GtkClassInitFunc) gl_prop_vector_class_init, + (GtkObjectInitFunc) gl_prop_vector_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + prop_vector_type = gtk_type_unique (gtk_vbox_get_type (), + &prop_vector_info); + } + + return prop_vector_type; +} + +static void +gl_prop_vector_class_init (glPropVectorClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->destroy = gl_prop_vector_destroy; + + prop_vector_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glPropVectorClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, prop_vector_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_prop_vector_init (glPropVector * vector) +{ + vector->len_spin = NULL; + vector->angle_spin = NULL; +} + +static void +gl_prop_vector_destroy (GtkObject * object) +{ + glPropVector *vector; + glPropVectorClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROP_VECTOR (object)); + + vector = GL_PROP_VECTOR (object); + class = GL_PROP_VECTOR_CLASS (GTK_OBJECT (vector)->klass); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_prop_vector_new (gchar * label) +{ + glPropVector *vector; + + vector = gtk_type_new (gl_prop_vector_get_type ()); + + gl_prop_vector_construct (vector, label); + + return GTK_WIDGET (vector); +} + +/*============================================================*/ +/* Construct composite widget. */ +/*============================================================*/ +static void +gl_prop_vector_construct (glPropVector * 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); + gtk_signal_connect_object (GTK_OBJECT (vector->len_spin), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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); + gtk_signal_connect_object (GTK_OBJECT (vector->angle_spin), "changed", + GTK_SIGNAL_FUNC (changed_cb), + GTK_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 (glPropVector * vector) +{ + /* Emit our "changed" signal */ + gtk_signal_emit (GTK_OBJECT (vector), prop_vector_signals[CHANGED]); +} + +/*====================================================================*/ +/* query values from controls. */ +/*====================================================================*/ +void +gl_prop_vector_get_params (glPropVector * 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_as_float (GTK_SPIN_BUTTON + (vector->len_spin)); + angle = + gtk_spin_button_get_value_as_float (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_prop_vector_set_params (glPropVector * 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/glabels1/src/prop_vector.h b/glabels1/src/prop_vector.h new file mode 100644 index 00000000..e8197ad5 --- /dev/null +++ b/glabels1/src/prop_vector.h @@ -0,0 +1,68 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * prop_vector.h: vector properties widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PROP_VECTOR_H__ +#define __PROP_VECTOR_H__ + +#include +#include "label.h" + +#define GL_TYPE_PROP_VECTOR (gl_prop_vector_get_type ()) +#define GL_PROP_VECTOR(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_PROP_VECTOR, glPropVector )) +#define GL_PROP_VECTOR_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROP_VECTOR, glPropVectorClass)) +#define GL_IS_PROP_VECTOR(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_PROP_VECTOR)) +#define GL_IS_PROP_VECTOR_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROP_VECTOR)) + +typedef struct _glPropVector glPropVector; +typedef struct _glPropVectorClass glPropVectorClass; + +struct _glPropVector { + GtkVBox parent_widget; + + GtkWidget *len_spin; + GtkWidget *len_units_label; + GtkWidget *angle_spin; + GtkWidget *angle_units_label; +}; + +struct _glPropVectorClass { + GtkVBoxClass parent_class; + + void (*changed) (glPropVector * vector, gpointer user_data); +}; + +extern guint gl_prop_vector_get_type (void); + +extern GtkWidget *gl_prop_vector_new (gchar * label); + +extern void gl_prop_vector_get_params (glPropVector * vector, + gdouble * dx, gdouble * dy); + +extern void gl_prop_vector_set_params (glPropVector * vector, + gdouble dx, gdouble dy, + gdouble x_max, gdouble y_max); + +#endif diff --git a/glabels1/src/propertybox.c b/glabels1/src/propertybox.c new file mode 100644 index 00000000..b8fe2946 --- /dev/null +++ b/glabels1/src/propertybox.c @@ -0,0 +1,428 @@ +/* Modified version of gnome-propertybox from gnome-libs-1.4 */ +/* Primarily removed the "help" button and changed the names.*/ +/* -Jim Evins 11/25/2001 */ + +/* gnome-propertybox.c - Property dialog box. + + Copyright (C) 1998 Tom Tromey + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License + as published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + This program is distributed in the hope that 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* Note that the property box is constructed so that we could later + change how the buttons work. For instance, we could put an Apply + button inside each page; this kind of Apply button would only + affect the current page. Please do not change the API in a way + that would violate this goal. */ + +#include + +#include "propertybox.h" +#include +#include +#include +#include +#include + +enum { + APPLY, + LAST_SIGNAL +}; + +typedef void (*glPropertyBoxSignal) (GtkObject * object, + gint arg, + gpointer data); + +static void gl_property_box_class_init (glPropertyBoxClass * klass); +static void gl_property_box_init (glPropertyBox * property_box); +static void gl_property_box_marshal_signal (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, + GtkArg * args); +static void gl_property_box_destroy (GtkObject * object); + +/* + * These four are called from dialog_clicked_cb(), depending + * on which button was clicked. + */ +static void global_apply (glPropertyBox * property_box); +static void apply_and_close (glPropertyBox * property_box); +static void just_close (glPropertyBox * property_box); + +static void dialog_clicked_cb (GnomeDialog * dialog, + gint button, + gpointer data); + +static GnomeDialogClass *parent_class = NULL; + +static gint property_box_signals[LAST_SIGNAL] = { 0 }; + +/** + * gl_property_box_get_type: + * + * Internal routine that returns the GtkType of the + * glPropertyBox widget + */ +guint +gl_property_box_get_type (void) +{ + static guint property_box_type = 0; + + if (!property_box_type) { + GtkTypeInfo property_box_info = { + "glPropertyBox", + sizeof (glPropertyBox), + sizeof (glPropertyBoxClass), + (GtkClassInitFunc) gl_property_box_class_init, + (GtkObjectInitFunc) gl_property_box_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL + }; + + property_box_type = gtk_type_unique (gnome_dialog_get_type (), + &property_box_info); + } + + return property_box_type; +} + +static void +gl_property_box_class_init (glPropertyBoxClass * klass) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + GtkWindowClass *window_class; + + object_class = (GtkObjectClass *) klass; + widget_class = (GtkWidgetClass *) klass; + window_class = (GtkWindowClass *) klass; + + object_class->destroy = gl_property_box_destroy; + + parent_class = gtk_type_class (gnome_dialog_get_type ()); + + property_box_signals[APPLY] = + gtk_signal_new ("apply", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (glPropertyBoxClass, + apply), + gl_property_box_marshal_signal, + GTK_TYPE_NONE, 1, GTK_TYPE_INT); + + gtk_object_class_add_signals (object_class, property_box_signals, + LAST_SIGNAL); + + klass->apply = NULL; +} + +static void +gl_property_box_marshal_signal (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, + GtkArg * args) +{ + glPropertyBoxSignal rfunc; + + rfunc = (glPropertyBoxSignal) func; + (*rfunc) (object, GTK_VALUE_INT (args[0]), func_data); +} + +static void +gl_property_box_init (glPropertyBox * property_box) +{ + GList *button_list; + + property_box->notebook = gtk_notebook_new (); + + if (gnome_preferences_get_property_box_apply ()) { + gnome_dialog_append_buttons (GNOME_DIALOG (property_box), + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_APPLY, + GNOME_STOCK_BUTTON_CLOSE, NULL); + } else { + gnome_dialog_append_buttons (GNOME_DIALOG (property_box), + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_CANCEL, NULL); + } + + gnome_dialog_set_default (GNOME_DIALOG (property_box), 0); + + /* This is sort of unattractive */ + + button_list = GNOME_DIALOG (property_box)->buttons; + + property_box->ok_button = GTK_WIDGET (button_list->data); + button_list = button_list->next; + + if (gnome_preferences_get_property_box_apply ()) { + property_box->apply_button = GTK_WIDGET (button_list->data); + button_list = button_list->next; + gtk_widget_set_sensitive (property_box->apply_button, FALSE); + } else + property_box->apply_button = 0; + + property_box->cancel_button = GTK_WIDGET (button_list->data); + button_list = button_list->next; + + gtk_signal_connect (GTK_OBJECT (property_box), "clicked", + GTK_SIGNAL_FUNC (dialog_clicked_cb), NULL); + + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (property_box)->vbox), + property_box->notebook, TRUE, TRUE, 0); + + gtk_widget_show (property_box->notebook); +} + +static void +gl_property_box_destroy (GtkObject * object) +{ + glPropertyBox *property_box; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_PROPERTY_BOX (object)); + + property_box = GL_PROPERTY_BOX (object); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +/** + * gl_property_box_new: [constructor] + * + * Creates a new glPropertyBox widget. The PropertyBox widget + * is useful for making consistent configuration dialog boxes. + * + * When a setting has been made to a property in the PropertyBox + * your program needs to invoke the gl_property_box_changed to signal + * a change (this will enable the Ok/Apply buttons). + * + * Returns a newly created glPropertyBox widget. + */ +GtkWidget * +gl_property_box_new (void) +{ + return gtk_type_new (gl_property_box_get_type ()); +} + +static void +dialog_clicked_cb (GnomeDialog * dialog, + gint button, + gpointer data) +{ + glPropertyBox *pbox; + GtkWidget *page; + GList *list; + gboolean dirty = FALSE; + + g_return_if_fail (dialog != NULL); + g_return_if_fail (GL_IS_PROPERTY_BOX (dialog)); + + pbox = GL_PROPERTY_BOX (dialog); + + if (GTK_NOTEBOOK (pbox->notebook)->cur_page != NULL) { + + for (list = GTK_NOTEBOOK (pbox->notebook)->children; + list != NULL; list = list->next) { + GtkNotebookPage *page = list->data; + g_assert (page != NULL); + + dirty = + GPOINTER_TO_INT (gtk_object_get_data + (GTK_OBJECT (page->child), + GL_PROPERTY_BOX_DIRTY)); + + if (dirty) + break; + } + } else { + page = NULL; + dirty = FALSE; + } + + /* Choose which style we did */ + if (pbox->apply_button) { + switch (button) { + case 0: + if (dirty) + apply_and_close (GL_PROPERTY_BOX (dialog)); + else + just_close (GL_PROPERTY_BOX (dialog)); + break; + case 1: + global_apply (GL_PROPERTY_BOX (dialog)); + break; + case 2: + just_close (GL_PROPERTY_BOX (dialog)); + break; + default: + g_assert_not_reached (); + } + } else { + switch (button) { + case 0: + if (dirty) + apply_and_close (GL_PROPERTY_BOX (dialog)); + else + just_close (GL_PROPERTY_BOX (dialog)); + break; + case 1: + just_close (GL_PROPERTY_BOX (dialog)); + break; + default: + g_assert_not_reached (); + } + } +} + +static void +set_sensitive (glPropertyBox * property_box, + gint dirty) +{ + if (property_box->apply_button) + gtk_widget_set_sensitive (property_box->apply_button, dirty); +} + +/** + * gl_property_box_changed: + * @property_box: The glPropertyBox that contains the changed data + * + * When a setting has changed, the code needs to invoke this routine + * to make the Ok/Apply buttons sensitive. + */ +void +gl_property_box_changed (glPropertyBox * property_box) +{ + GtkWidget *page; + + g_return_if_fail (property_box != NULL); + g_return_if_fail (GL_IS_PROPERTY_BOX (property_box)); + g_return_if_fail (property_box->notebook); + g_return_if_fail (GTK_NOTEBOOK (property_box->notebook)->cur_page); + + page = GTK_NOTEBOOK (property_box->notebook)->cur_page->child; + g_assert (page != NULL); + + gtk_object_set_data (GTK_OBJECT (page), + GL_PROPERTY_BOX_DIRTY, GINT_TO_POINTER (1)); + + set_sensitive (property_box, 1); +} + +/** + * gl_property_box_set_modified: + * @property_box: The glPropertyBox that contains the changed data + * @state: The state. TRUE means modified, FALSE means unmodified. + * + * This sets the modified flag of the glPropertyBox to the value in @state. + * Affects whether the OK/Apply buttons are sensitive. + */ +void +gl_property_box_set_modified (glPropertyBox * property_box, + gboolean state) +{ + GtkWidget *page; + + g_return_if_fail (property_box != NULL); + g_return_if_fail (GL_IS_PROPERTY_BOX (property_box)); + g_return_if_fail (property_box->notebook); + g_return_if_fail (GTK_NOTEBOOK (property_box->notebook)->cur_page); + + page = GTK_NOTEBOOK (property_box->notebook)->cur_page->child; + g_assert (page != NULL); + + gtk_object_set_data (GTK_OBJECT (page), + GL_PROPERTY_BOX_DIRTY, + GINT_TO_POINTER (state ? 1 : 0)); + + set_sensitive (property_box, state); +} + +static void +global_apply (glPropertyBox * property_box) +{ + GList *list; + gint n; + + g_return_if_fail (GTK_NOTEBOOK (property_box->notebook)->children != + NULL); + + for (list = GTK_NOTEBOOK (property_box->notebook)->children, n = 0; + list != NULL; list = g_list_next (list), n++) { + /* FIXME: there should be a way to report an error + during Apply. That way we could prevent closing + the window if there were a problem. */ + GtkNotebookPage *page = list->data; + if (gtk_object_get_data (GTK_OBJECT (page->child), + GL_PROPERTY_BOX_DIRTY)) { + gtk_signal_emit (GTK_OBJECT (property_box), + property_box_signals[APPLY], n); + gtk_object_set_data (GTK_OBJECT (page->child), + GL_PROPERTY_BOX_DIRTY, + GINT_TO_POINTER (0)); + } + } + + /* Emit an apply signal with a button of -1. This means we + just finished a global apply. Is this a hack? */ + gtk_signal_emit (GTK_OBJECT (property_box), + property_box_signals[APPLY], (gint) - 1); + + /* Doesn't matter which item we use. */ + set_sensitive (property_box, 0); +} + +static void +just_close (glPropertyBox * property_box) +{ + gnome_dialog_close (GNOME_DIALOG (property_box)); +} + +static void +apply_and_close (glPropertyBox * property_box) +{ + global_apply (property_box); + just_close (property_box); +} + +/** + * gl_property_box_append_page: + * @property_box: The property box where we are inserting a new page + * @child: The widget that is being inserted + * @tab_label: The widget used as the label for this confiugration page + * + * Appends a new page to the glPropertyBox. + * + * Returns the assigned index of the page inside the glPropertyBox or + * -1 if one of the arguments is invalid. + */ +gint +gl_property_box_append_page (glPropertyBox * property_box, + GtkWidget * child, + GtkWidget * tab_label) +{ + g_return_val_if_fail (property_box != NULL, -1); + g_return_val_if_fail (GL_IS_PROPERTY_BOX (property_box), -1); + g_return_val_if_fail (child != NULL, -1); + g_return_val_if_fail (GTK_IS_WIDGET (child), -1); + g_return_val_if_fail (tab_label != NULL, -1); + g_return_val_if_fail (GTK_IS_WIDGET (tab_label), -1); + + gtk_notebook_append_page (GTK_NOTEBOOK (property_box->notebook), + child, tab_label); + + return g_list_length (GTK_NOTEBOOK (property_box->notebook)->children) - + 1; +} diff --git a/glabels1/src/propertybox.h b/glabels1/src/propertybox.h new file mode 100644 index 00000000..403ebf08 --- /dev/null +++ b/glabels1/src/propertybox.h @@ -0,0 +1,74 @@ +/* Modified version of gnome-propertybox from gnome-libs-1.4 */ +/* Primarily removed the "help" button and changed the names.*/ +/* -Jim Evins 11/25/2001 */ + +/* gnome-propertybox.h - Property dialog box. + + Copyright (C) 1998 Tom Tromey + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License + as published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + This program is distributed in the hope that 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., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef __PROPERTY_BOX_H__ +#define __PROPERTY_BOX_H__ + +#include +#include + +BEGIN_GNOME_DECLS +#define GL_TYPE_PROPERTY_BOX (gl_property_box_get_type ()) +#define GL_PROPERTY_BOX(obj) (GTK_CHECK_CAST ((obj), GL_TYPE_PROPERTY_BOX, glPropertyBox)) +#define GL_PROPERTY_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PROPERTY_BOX, glPropertyBoxClass)) +#define GL_IS_PROPERTY_BOX(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_PROPERTY_BOX)) +#define GL_IS_PROPERTY_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PROPERTY_BOX)) +/*the flag used on the notebook pages to see if a change happened on a certain page or not*/ +#define GL_PROPERTY_BOX_DIRTY "gl_property_box_dirty" +typedef struct _glPropertyBox glPropertyBox; +typedef struct _glPropertyBoxClass glPropertyBoxClass; + +struct _glPropertyBox { + GnomeDialog dialog; + + GtkWidget *notebook; /* The notebook widget. */ + GtkWidget *ok_button; /* OK button. */ + GtkWidget *apply_button; /* Apply button. */ + GtkWidget *cancel_button; /* Cancel/Close button. */ +}; + +struct _glPropertyBoxClass { + GnomeDialogClass parent_class; + + void (*apply) (glPropertyBox * propertybox, + gint page_num); +}; + +guint gl_property_box_get_type (void); +GtkWidget *gl_property_box_new (void); + +/* + * Call this when the user changes something in the current page of + * the notebook. + */ +void gl_property_box_changed (glPropertyBox * property_box); + +void gl_property_box_set_modified (glPropertyBox * property_box, + gboolean state); + +gint gl_property_box_append_page (glPropertyBox * property_box, + GtkWidget * child, + GtkWidget * tab_label); + +END_GNOME_DECLS +#endif /* __PROPERTY_BOX_H__ */ diff --git a/glabels1/src/rotate_select.c b/glabels1/src/rotate_select.c new file mode 100644 index 00000000..29e0a9ef --- /dev/null +++ b/glabels1/src/rotate_select.c @@ -0,0 +1,348 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * rotate_select.c: label rotate selection widget module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "rotate_select.h" +#include "template.h" + +#include "debug.h" + +#define MINI_PREVIEW_MAX_PIXELS 48 + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +enum { + CHANGED, + LAST_SIGNAL +}; + +typedef void (*glRotateSelectSignal) (GtkObject * object, gpointer data); + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GtkContainerClass *parent_class; + +static gint rotate_select_signals[LAST_SIGNAL] = { 0 }; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static void gl_rotate_select_class_init (glRotateSelectClass * class); +static void gl_rotate_select_init (glRotateSelect * rotate_select); +static void gl_rotate_select_destroy (GtkObject * object); + +static void gl_rotate_select_construct (glRotateSelect * 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_rotate_select_get_type (void) +{ + static guint rotate_select_type = 0; + + if (!rotate_select_type) { + GtkTypeInfo rotate_select_info = { + "glRotateSelect", + sizeof (glRotateSelect), + sizeof (glRotateSelectClass), + (GtkClassInitFunc) gl_rotate_select_class_init, + (GtkObjectInitFunc) gl_rotate_select_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + rotate_select_type = gtk_type_unique (gtk_hbox_get_type (), + &rotate_select_info); + } + + return rotate_select_type; +} + +static void +gl_rotate_select_class_init (glRotateSelectClass * class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass *) class; + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + object_class->destroy = gl_rotate_select_destroy; + + rotate_select_signals[CHANGED] = + gtk_signal_new ("changed", GTK_RUN_LAST, object_class->type, + GTK_SIGNAL_OFFSET (glRotateSelectClass, changed), + gtk_signal_default_marshaller, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, rotate_select_signals, + LAST_SIGNAL); + + class->changed = NULL; +} + +static void +gl_rotate_select_init (glRotateSelect * rotate_select) +{ + rotate_select->rotate_check = NULL; + + rotate_select->canvas = NULL; + + rotate_select->template = NULL; +} + +static void +gl_rotate_select_destroy (GtkObject * object) +{ + glRotateSelect *rotate_select; + glRotateSelectClass *class; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_ROTATE_SELECT (object)); + + rotate_select = GL_ROTATE_SELECT (object); + class = GL_ROTATE_SELECT_CLASS (GTK_OBJECT (rotate_select)->klass); + + gl_template_free (&rotate_select->template); + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + +GtkWidget * +gl_rotate_select_new (void) +{ + glRotateSelect *rotate_select; + + rotate_select = gtk_type_new (gl_rotate_select_get_type ()); + + gl_rotate_select_construct (rotate_select); + + return GTK_WIDGET (rotate_select); +} + +/*--------------------------------------------------------------------------*/ +/* Construct composite widget. */ +/*--------------------------------------------------------------------------*/ +static void +gl_rotate_select_construct (glRotateSelect * 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 */ + gtk_signal_connect (GTK_OBJECT (rotate_select->rotate_check), "toggled", + GTK_SIGNAL_FUNC (entry_changed_cb), rotate_select); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. modify widget due to change of check button */ +/*--------------------------------------------------------------------------*/ +static void +entry_changed_cb (GtkToggleButton * toggle, + gpointer user_data) +{ + glRotateSelect *rotate_select = GL_ROTATE_SELECT (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 */ + gtk_signal_emit (GTK_OBJECT (user_data), + rotate_select_signals[CHANGED]); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Draw a mini-preview canvas. */ +/*--------------------------------------------------------------------------*/ +static GtkWidget * +mini_preview_canvas_new (void) +{ + GtkWidget *wcanvas = NULL; + + /* Create a canvas */ + gtk_widget_push_visual (gdk_rgb_get_visual ()); + gtk_widget_push_colormap (gdk_rgb_get_cmap ()); + wcanvas = gnome_canvas_new_aa (); + gtk_widget_pop_colormap (); + gtk_widget_pop_visual (); + + gtk_widget_set_usize (GTK_WIDGET (wcanvas), + MINI_PREVIEW_MAX_PIXELS + 4, + MINI_PREVIEW_MAX_PIXELS + 4); + + 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 = gtk_object_get_data (GTK_OBJECT (canvas), "label_item"); + + m = MAX (template->label_width, template->label_height); + canvas_scale = (MINI_PREVIEW_MAX_PIXELS) / m; + + /* 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", 1, + "outline_color", "black", + "fill_color", "white", + NULL); + break; + default: + WARN ("Unknown label style"); + break; + } + + gtk_object_set_data (GTK_OBJECT (canvas), "label_item", label_item); + +} + +/****************************************************************************/ +/* query state of widget. */ +/****************************************************************************/ +gboolean +gl_rotate_select_get_state (glRotateSelect * rotate_select) +{ + return + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON + (rotate_select->rotate_check)); +} + +/****************************************************************************/ +/* set state of widget. */ +/****************************************************************************/ +void +gl_rotate_select_set_state (glRotateSelect * rotate_select, + gboolean state) +{ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (rotate_select->rotate_check), state); +} + +/****************************************************************************/ +/* set template for widget. */ +/****************************************************************************/ +void +gl_rotate_select_set_template_name (glRotateSelect * 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/glabels1/src/rotate_select.h b/glabels1/src/rotate_select.h new file mode 100644 index 00000000..7204c83b --- /dev/null +++ b/glabels1/src/rotate_select.h @@ -0,0 +1,70 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * rotate_select.h: label rotate selection widget module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __ROTATE_SELECT_H__ +#define __ROTATE_SELECT_H__ + +#include +#include "template.h" + +#define GL_TYPE_ROTATE_SELECT (gl_rotate_select_get_type ()) +#define GL_ROTATE_SELECT(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_ROTATE_SELECT, glRotateSelect )) +#define GL_ROTATE_SELECT_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_ROTATE_SELECT, glRotateSelectClass)) +#define GL_IS_ROTATE_SELECT(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_ROTATE_SELECT)) +#define GL_IS_ROTATE_SELECT_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_ROTATE_SELECT)) + +typedef struct _glRotateSelect glRotateSelect; +typedef struct _glRotateSelectClass glRotateSelectClass; + +struct _glRotateSelect { + GtkHBox parent_widget; + + GtkWidget *rotate_check; + + GtkWidget *canvas; + + glTemplate *template; +}; + +struct _glRotateSelectClass { + GtkHBoxClass parent_class; + + void (*changed) (glRotateSelect * rotate_select, gpointer user_data); +}; + +extern guint gl_rotate_select_get_type (void); + +extern GtkWidget *gl_rotate_select_new (void); + +extern gboolean gl_rotate_select_get_state (glRotateSelect * rotate_select); + +extern void gl_rotate_select_set_state (glRotateSelect * rotate_select, + gboolean state); + +extern void gl_rotate_select_set_template_name (glRotateSelect * rotate_select, + gchar * name); + +#endif diff --git a/glabels1/src/splash.c b/glabels1/src/splash.c new file mode 100644 index 00000000..92bb9aaa --- /dev/null +++ b/glabels1/src/splash.c @@ -0,0 +1,110 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * splash.c: Splash screen module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include + +#include "debug.h" +#include "splash.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 *wpixmap, *wvbox, *whbox, *wframe1, *wframe2; + gchar *label; + + 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_exists (SPLASH_PIXMAP)) { + WARN ("Could not find %s", SPLASH_PIXMAP); + } + wpixmap = gnome_pixmap_new_from_file (SPLASH_PIXMAP); + if (!wpixmap) { + WARN ("can't find splash pixmap"); + gtk_widget_destroy (splash); + return; + } + + 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), wpixmap, 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/glabels1/src/splash.h b/glabels1/src/splash.h new file mode 100644 index 00000000..25cd5b66 --- /dev/null +++ b/glabels1/src/splash.h @@ -0,0 +1,28 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * splash.c: Splash screen module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __SPLASH_H__ +#define __SPLASH_H__ + +void gl_splash (void); + +#endif diff --git a/glabels1/src/stock.c b/glabels1/src/stock.c new file mode 100644 index 00000000..f3523001 --- /dev/null +++ b/glabels1/src/stock.c @@ -0,0 +1,121 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * stock.h: Stock image module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include "stock.h" +#include "pixmaps/arrow.xpm" +#include "pixmaps/text.xpm" +#include "pixmaps/line.xpm" +#include "pixmaps/box.xpm" +#include "pixmaps/ellipse.xpm" +#include "pixmaps/image.xpm" +#include "pixmaps/barcode.xpm" +#include "pixmaps/zoomin.xpm" +#include "pixmaps/zoomout.xpm" +#include "pixmaps/zoom1to1.xpm" +#include "pixmaps/merge.xpm" + +void +gl_stock_init (void) +{ + static GnomeStockPixmapEntry entries[11]; + + entries[0].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[0].data.width = 24; + entries[0].data.height = 24; + entries[0].data.xpm_data = arrow_xpm; + + entries[1].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[1].data.width = 24; + entries[1].data.height = 24; + entries[1].data.xpm_data = text_xpm; + + entries[2].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[2].data.width = 24; + entries[2].data.height = 24; + entries[2].data.xpm_data = line_xpm; + + entries[3].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[3].data.width = 24; + entries[3].data.height = 24; + entries[3].data.xpm_data = box_xpm; + + entries[4].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[4].data.width = 24; + entries[4].data.height = 24; + entries[4].data.xpm_data = ellipse_xpm; + + entries[5].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[5].data.width = 24; + entries[5].data.height = 24; + entries[5].data.xpm_data = image_xpm; + + entries[6].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[6].data.width = 24; + entries[6].data.height = 24; + entries[6].data.xpm_data = barcode_xpm; + + entries[7].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[7].data.width = 24; + entries[7].data.height = 24; + entries[7].data.xpm_data = zoomin_xpm; + + entries[8].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[8].data.width = 24; + entries[8].data.height = 24; + entries[8].data.xpm_data = zoomout_xpm; + + entries[9].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[9].data.width = 24; + entries[9].data.height = 24; + entries[9].data.xpm_data = zoom1to1_xpm; + + entries[10].data.type = GNOME_STOCK_PIXMAP_TYPE_DATA; + entries[10].data.width = 24; + entries[10].data.height = 24; + entries[10].data.xpm_data = merge_xpm; + + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_ARROW, + GNOME_STOCK_PIXMAP_REGULAR, &entries[0]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_TEXT, + GNOME_STOCK_PIXMAP_REGULAR, &entries[1]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_LINE, + GNOME_STOCK_PIXMAP_REGULAR, &entries[2]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_BOX, + GNOME_STOCK_PIXMAP_REGULAR, &entries[3]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_ELLIPSE, + GNOME_STOCK_PIXMAP_REGULAR, &entries[4]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_IMAGE, + GNOME_STOCK_PIXMAP_REGULAR, &entries[5]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_BARCODE, + GNOME_STOCK_PIXMAP_REGULAR, &entries[6]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_ZOOMIN, + GNOME_STOCK_PIXMAP_REGULAR, &entries[7]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_ZOOMOUT, + GNOME_STOCK_PIXMAP_REGULAR, &entries[8]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_ZOOM1TO1, + GNOME_STOCK_PIXMAP_REGULAR, &entries[9]); + gnome_stock_pixmap_register (GL_STOCK_PIXMAP_MERGE, + GNOME_STOCK_PIXMAP_REGULAR, &entries[10]); + +} diff --git a/glabels1/src/stock.h b/glabels1/src/stock.h new file mode 100644 index 00000000..4b2b20c6 --- /dev/null +++ b/glabels1/src/stock.h @@ -0,0 +1,42 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * stock.h: Stock image module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __STOCK_H__ +#define __STOCK_H__ + +/* Stock names */ + +#define GL_STOCK_PIXMAP_ARROW "GL_stock_arrow" +#define GL_STOCK_PIXMAP_TEXT "GL_stock_text" +#define GL_STOCK_PIXMAP_LINE "GL_stock_line" +#define GL_STOCK_PIXMAP_BOX "GL_stock_box" +#define GL_STOCK_PIXMAP_ELLIPSE "GL_stock_ellipse" +#define GL_STOCK_PIXMAP_IMAGE "GL_stock_image" +#define GL_STOCK_PIXMAP_BARCODE "GL_stock_barcode" +#define GL_STOCK_PIXMAP_ZOOMIN "GL_stock_zoomin" +#define GL_STOCK_PIXMAP_ZOOMOUT "GL_stock_zoomout" +#define GL_STOCK_PIXMAP_ZOOM1TO1 "GL_stock_zoom1to1" +#define GL_STOCK_PIXMAP_MERGE "GL_stock_merge" + +void gl_stock_init (void); + +#endif diff --git a/glabels1/src/template.c b/glabels1/src/template.c new file mode 100644 index 00000000..aae0a896 --- /dev/null +++ b/glabels1/src/template.c @@ -0,0 +1,584 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * template.c: template module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include +#include +#include +#include + + +#include "template.h" + +#include "debug.h" + +#ifdef PACKAGE_DATA_DIR +#define GL_DATA_DIR (PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "glabels") +#else +#define GL_DATA_DIR gnome_datadir_file("glabels") +#endif + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + +static GList *templates = NULL; + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ +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_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_alias (gchar *name, xmlNodePtr root, xmlNsPtr ns); + +/*****************************************************************************/ +/* Initialize module. */ +/*****************************************************************************/ +void +gl_template_init (void) +{ + templates = read_templates (); +} + +/*****************************************************************************/ +/* 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; + + 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); + } + } + } + + return names; +} + +/*****************************************************************************/ +/* Free a list of template names. */ +/*****************************************************************************/ +void +gl_template_free_name_list (GList ** names) +{ + GList *p_name; + + 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; +} + +/*****************************************************************************/ +/* 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; + + 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); + return gl_template_copy(template); + } + } + } + + g_strfreev (split_name); + + return NULL; +} + +/*****************************************************************************/ +/* Copy a template. */ +/*****************************************************************************/ +glTemplate *gl_template_copy (const glTemplate *orig_template) +{ + glTemplate *template; + GList *p; + + 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); + + return template; +} + +/*****************************************************************************/ +/* Free up a template. */ +/*****************************************************************************/ +void gl_template_free (glTemplate **template) +{ + GList *p; + + 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; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Read templates from various files. */ +/*--------------------------------------------------------------------------*/ +static GList * +read_templates (void) +{ + gchar *home_data_dir = get_home_data_dir (); + GList *templates = NULL; + + 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) { + WARN (_("No template files found!")); + } + + return templates; +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. get '~/.glabels' directory path. */ +/*--------------------------------------------------------------------------*/ +static gchar * +get_home_data_dir (void) +{ + gchar *dir = gnome_util_prepend_user_home (".glabels"); + + /* Try to create ~/.glabels directory. If it exists, no problem. */ + mkdir (dir, 0775); + + 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) +{ + DIR *dp; + struct dirent *d_entry; + gchar *filename, *extension; + gchar *full_filename = NULL; + + if (dirname == NULL) + return templates; + + dp = opendir (dirname); + if (dp == NULL) + return templates; + + while ((d_entry = readdir (dp)) != NULL) { + + filename = d_entry->d_name; + extension = strrchr (filename, '.'); + + if (extension != NULL) { + + if (strcasecmp (extension, ".template") == 0) { + + full_filename = + g_concat_dir_and_file (dirname, filename); + templates = + read_templates_from_file (templates, + full_filename); + g_free (full_filename); + + } + + } + + } + + closedir (dp); + + 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; + + doc = xmlParseFile (xml_filename); + if (!doc) { + WARN ("\"%s\" is not a glabels template file (not XML)", + xml_filename); + return templates; + } + + root = xmlDocGetRootElement (doc); + if (!root || !root->name) { + WARN ("\"%s\" is not a glabels template file (no root node)", + xml_filename); + xmlFreeDoc (doc); + return templates; + } + if (g_strcasecmp (root->name, "glabels-templates") != 0) { + WARN ("\"%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 = g_new0 (glTemplate, 1); + gl_template_xml_parse_sheet (template, node); + templates = g_list_append (templates, template); + } else { + if (g_strcasecmp (node->name, "text") != 0) { + WARN ("bad node = \"%s\"", node->name); + } + } + } + + xmlFreeDoc (doc); + + return templates; +} + +/*****************************************************************************/ +/* Parse XML template Node. */ +/*****************************************************************************/ +void +gl_template_xml_parse_sheet (glTemplate * template, + xmlNodePtr sheet_node) +{ + xmlNodePtr node; + + template->name = g_list_append (template->name, + xmlGetProp (sheet_node, "name")); + template->page_size = xmlGetProp (sheet_node, "size"); + 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) { + WARN ("bad node = \"%s\"", node->name); + } + } + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Label Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_label (xmlNodePtr label_node, + glTemplate * template) +{ + xmlNodePtr node; + gchar *style; + + 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 { + WARN ("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; + } + + template->label_margin = + g_strtod (xmlGetProp (label_node, "margin"), NULL); + + 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, "text") != 0) { + WARN ("bad node = \"%s\"", node->name); + } + } + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Label->Layout Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_layout (xmlNodePtr layout_node, + glTemplate * template) +{ + xmlNodePtr node; + + 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) { + WARN ("bad node = \"%s\"", node->name); + } + } + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Parse XML Sheet->Alias Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_parse_alias (xmlNodePtr alias_node, + glTemplate * template) +{ + template->name = g_list_append (template->name, + xmlGetProp (alias_node, "name")); +} + +/****************************************************************************/ +/* Add XML Template Node */ +/****************************************************************************/ +void +gl_template_xml_add_sheet (glTemplate * template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + GList *p; + + 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 ); + } +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Label Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_label (glTemplate *template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + gchar *string; + + node = xmlNewChild(root, ns, "Label", NULL); + string = g_strdup_printf ("%g", template->label_margin); + xmlSetProp (node, "margin", string); + g_free (string); + 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: + WARN ("Unknown label style"); + break; + } + + xml_add_layout (template, node, ns); + +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Label->Layout Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_layout (glTemplate *template, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + gchar *string; + + 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); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Add XML Sheet->Alias Node. */ +/*--------------------------------------------------------------------------*/ +static void +xml_add_alias (gchar *name, + xmlNodePtr root, + xmlNsPtr ns) +{ + xmlNodePtr node; + + node = xmlNewChild (root, ns, "Alias", NULL); + xmlSetProp (node, "name", name); +} + diff --git a/glabels1/src/template.h b/glabels1/src/template.h new file mode 100644 index 00000000..9e72c6bf --- /dev/null +++ b/glabels1/src/template.h @@ -0,0 +1,72 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * template.h: template module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __TEMPLATE_H__ +#define __TEMPLATE_H__ + +#include + +/* LibXML */ +#include +#include + +typedef enum { + GL_TEMPLATE_STYLE_RECT, + GL_TEMPLATE_STYLE_ROUND, + GL_TEMPLATE_STYLE_CD, +} glTemplateStyle; + +typedef struct { + GList *name; + gchar *description; + gchar *page_size; + glTemplateStyle style; + + /* Suggested margin */ + gdouble label_margin; + + /* Simple and rounded rectangles. */ + gdouble label_width, label_height, label_round; + + /* CD/DVD labels */ + gdouble label_radius, label_hole; + + /* Layout */ + gint nx, ny; + gdouble x0, y0, dx, dy; +} glTemplate; + +extern void gl_template_init (void); + +extern GList *gl_template_get_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_copy(const glTemplate *orig_template); +extern void gl_template_free(glTemplate **template); + +extern void gl_template_xml_parse_sheet (glTemplate * template, + xmlNodePtr sheet_node); +extern void gl_template_xml_add_sheet (glTemplate * template, + xmlNodePtr root, xmlNsPtr ns); +#endif diff --git a/glabels1/src/text_node.c b/glabels1/src/text_node.c new file mode 100644 index 00000000..c32ab723 --- /dev/null +++ b/glabels1/src/text_node.c @@ -0,0 +1,225 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * text_node.c: text node module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "text_node.h" + +#include "merge.h" + +#include "debug.h" + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +static glTextNode *extract_text_node (gchar * text, gint * n); + + +/*--------------------------------------------------------------------------*/ +/* Expand single node into representative string. */ +/*--------------------------------------------------------------------------*/ +gchar * +gl_text_node_expand (glTextNode * text_node, + glMergeRecord * record) +{ + gchar *text; + + if (text_node->field_flag) { + text = gl_merge_eval_key (text_node->data, record); + if (text != NULL) { + return text; + } else { + return g_strdup_printf ("FIELD{%s}", text_node->data); + } + } else { + return g_strdup (text_node->data); + } +} + +/*--------------------------------------------------------------------------*/ +/* Create a single text node from given text. */ +/*--------------------------------------------------------------------------*/ +glTextNode * +gl_text_node_new_from_text (gchar * text) +{ + gint n; + + return extract_text_node (text, &n); +} + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Create a single text node from given text. n = characters used */ +/*--------------------------------------------------------------------------*/ +static glTextNode * +extract_text_node (gchar * text, + gint * n) +{ + glTextNode *text_node; + gchar *p; + gint m; + + text_node = g_new0 (glTextNode, 1); + + if (strncmp (text, "FIELD{", strlen ("FIELD{")) == 0) { + /* We are at the beginning of a "FIELD" node */ + text_node->field_flag = TRUE; + *n = strlen ("FIELD{"); + text += *n; + for (p = text, m = 0; *p != 0; p++, m++, (*n)++) { + if (*p == '}') { + (*n)++; + break; + } + } + text_node->data = g_strndup (text, m); + } else { + /* We are at the beginning of a literal node */ + text_node->field_flag = FALSE; + for (p = text, *n = 0; *p != 0; p++, (*n)++) { + if (strncmp (p, "FIELD{", strlen ("FIELD{")) == 0) + break; + if (*p == '\n') + break; + } + text_node->data = g_strndup (text, *n); + } + + return text_node; +} + +/*--------------------------------------------------------------------------*/ +/* Free a single text node. */ +/*--------------------------------------------------------------------------*/ +void +gl_text_node_free (glTextNode ** text_node) +{ + 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); + } + 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; +} + +/*--------------------------------------------------------------------------*/ +/* 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/glabels1/src/text_node.h b/glabels1/src/text_node.h new file mode 100644 index 00000000..97adbf0c --- /dev/null +++ b/glabels1/src/text_node.h @@ -0,0 +1,46 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * text_node.h: text node module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __TEXT_NODE_H__ +#define __TEXT_NODE_H__ + +#include +#include "merge.h" + +typedef struct { + gboolean field_flag; + gchar *data; +} glTextNode; + +extern gchar *gl_text_node_expand (glTextNode * text_node, + glMergeRecord * record); +extern glTextNode *gl_text_node_new_from_text (gchar * text); +extern 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 void gl_text_node_lines_free (GList ** lines); + +/* debug function */ +extern void gl_text_node_lines_print (GList * lines ); + +#endif diff --git a/glabels1/src/tools.c b/glabels1/src/tools.c new file mode 100644 index 00000000..ede7625e --- /dev/null +++ b/glabels1/src/tools.c @@ -0,0 +1,221 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * tools.c: toolbar module + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "tools.h" +#include "mdi.h" +#include "display.h" +#include "merge_properties.h" + +/*===========================================*/ +/* Private types. */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals. */ +/*===========================================*/ + +/*===========================================*/ +/* Private function prototypes. */ +/*===========================================*/ + + + +/*****************************************************************************/ +/* arrow callback. */ +/*****************************************************************************/ +void +gl_tools_arrow_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_arrow_mode (display); + } +} + +/*****************************************************************************/ +/* text callback. */ +/*****************************************************************************/ +void +gl_tools_text_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_object_create_mode (display, GL_LABEL_OBJECT_TEXT); + } +} + +/*****************************************************************************/ +/* box callback. */ +/*****************************************************************************/ +void +gl_tools_box_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_object_create_mode (display, GL_LABEL_OBJECT_BOX); + } +} + +/*****************************************************************************/ +/* line callback. */ +/*****************************************************************************/ +void +gl_tools_line_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_object_create_mode (display, GL_LABEL_OBJECT_LINE); + } +} + +/*****************************************************************************/ +/* ellipse callback. */ +/*****************************************************************************/ +void +gl_tools_ellipse_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_object_create_mode (display, + GL_LABEL_OBJECT_ELLIPSE); + } +} + +/*****************************************************************************/ +/* image callback. */ +/*****************************************************************************/ +void +gl_tools_image_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_object_create_mode (display, GL_LABEL_OBJECT_IMAGE); + } +} + +/*****************************************************************************/ +/* barcode callback. */ +/*****************************************************************************/ +void +gl_tools_barcode_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_object_create_mode (display, + GL_LABEL_OBJECT_BARCODE); + } +} + +/*****************************************************************************/ +/* zoom in callback. */ +/*****************************************************************************/ +void +gl_tools_zoomin_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_zoom_in (display); + } +} + +/*****************************************************************************/ +/* zoom out callback. */ +/*****************************************************************************/ +void +gl_tools_zoomout_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_zoom_out (display); + } +} + +/*****************************************************************************/ +/* zoom 1:1 callback. */ +/*****************************************************************************/ +void +gl_tools_zoom1to1_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_display_set_zoom (display, 1.0); + } +} + +/*****************************************************************************/ +/* edit merge properties callback. */ +/*****************************************************************************/ +void +gl_tools_merge_properties_cb (GtkWidget * widget, + gpointer data) +{ + GnomeMDIChild *child = gnome_mdi_get_active_child (GNOME_MDI (data)); + glDisplay *display; + + display = gl_mdi_get_display (child); + if (display != NULL) { + gl_merge_properties_dialog (display, child->name); + } +} + diff --git a/glabels1/src/tools.h b/glabels1/src/tools.h new file mode 100644 index 00000000..814c4dd4 --- /dev/null +++ b/glabels1/src/tools.h @@ -0,0 +1,39 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * tools.h: toolbar module header file + * + * Copyright (C) 2001-2002 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __TOOLS_H__ +#define __TOOLS_H__ + +#include + +extern void gl_tools_arrow_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_text_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_box_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_line_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_ellipse_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_image_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_barcode_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_zoomin_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_zoomout_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_zoom1to1_cb (GtkWidget * widget, gpointer data); +extern void gl_tools_merge_properties_cb (GtkWidget * widget, gpointer data); + +#endif diff --git a/glabels1/src/util.c b/glabels1/src/util.c new file mode 100644 index 00000000..9e751102 --- /dev/null +++ b/glabels1/src/util.c @@ -0,0 +1,110 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * util.c: various small utility functions + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include +#include +#include + +#include "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); + } +} + diff --git a/glabels1/src/util.h b/glabels1/src/util.h new file mode 100644 index 00000000..b3e188d5 --- /dev/null +++ b/glabels1/src/util.h @@ -0,0 +1,34 @@ +/* + * (GLABELS) Label and Business Card Creation program for GNOME + * + * util.h: various small utility functions + * + * Copyright (C) 2001 Jim Evins . + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __UTIL_H__ +#define __UTIL_H__ + +#include + +gchar *gl_util_add_extension (const gchar * orig_filename); + +gchar *gl_util_make_absolute (const gchar * filename); + +gchar *gl_util_fraction( gdouble x ); + +#endif /* __UTIL_H__ */ diff --git a/glabels1/stamp-h.in b/glabels1/stamp-h.in new file mode 100644 index 00000000..9788f702 --- /dev/null +++ b/glabels1/stamp-h.in @@ -0,0 +1 @@ +timestamp