pax_global_header00006660000000000000000000000064132274371610014520gustar00rootroot0000000000000052 comment=bcc7fbd231700c5ba59a96a1b005e6efd49457de pegsolitaire-0.1.1/000077500000000000000000000000001322743716100142065ustar00rootroot00000000000000pegsolitaire-0.1.1/.gitignore000066400000000000000000000016451322743716100162040ustar00rootroot00000000000000# http://www.gnu.org/software/automake Makefile.in /ar-lib /mdate-sh /py-compile /test-driver /ylwrap # http://www.gnu.org/software/autoconf /autom4te.cache /autoscan.log /autoscan-*.log /aclocal.m4 /compile /config.guess /config.h.in /config.sub /configure /configure.scan /depcomp /install-sh /missing /stamp-h1 # https://www.gnu.org/software/libtool/ /ltmain.sh # http://www.gnu.org/software/texinfo /texinfo.tex # http://www.gnu.org/software/m4/ m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 autom4te.cache # Objects, generated Makefiles, other *.o Makefile config.h config.log config.rpath config.status m4/ .deps *~ pegsolitaire.desktop # Gettext files ABOUT-NLS po/Makefile.in.in po/Makevars.template po/POTFILES po/Rules-quot po/boldquot.sed po/*.gmo po/en@boldquot.header po/en@quot.header po/insert-header.sin po/quot.sed po/remove-potcdate.sed po/remove-potcdate.sin po/stamp-po pegsolitaire-0.1.1/.indent.pro000066400000000000000000000001041322743716100162620ustar00rootroot00000000000000--no-tabs --braces-on-if-line --cuddle-else --comment-indentation 0 pegsolitaire-0.1.1/AUTHORS000066400000000000000000000001251322743716100152540ustar00rootroot00000000000000Ben Asselstine Juhani Numminen pegsolitaire-0.1.1/CHANGELOG000066400000000000000000000014251322743716100154220ustar00rootroot00000000000000Version 0.1.1 (2018-01-16) ========================== * Added CHANGELOG. Version 0.1.0 (2018-01-08) ========================== * Removed usage of deprecated libgnome, libgnomeui and libglade. * Updated gridframe and preimage libraries. New dependency librsvg2. * Enabled new compiler warnings. New dependency autoconf-archive. * Added .desktop, .appdata.xml and manpage. Version 0.0.4 (2008-05-01) ========================== * Updated translation files. * Added German translation. (2007-01-05) ============ * Regenerate files to work with Anjuta version 2.2.0. * src/callbacks.c (on_helpAboutMenuItemActivate): don't just show the pegSolitaireAboutDialog, but run it also so that the `close' button works on the dialog. (2007-01-01) ============ * Initial version. pegsolitaire-0.1.1/COPYING000066400000000000000000000432541322743716100152510ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. pegsolitaire-0.1.1/Makefile.am000066400000000000000000000033561322743716100162510ustar00rootroot00000000000000AM_CPPFLAGS = -DLOCALEDIR='"$(localedir)"' -DPKGDATADIR='"$(pkgdatadir)"' AM_CFLAGS = -Wall -Wextra -Wpedantic -Wmissing-prototypes -Wstrict-prototypes \ -Wunused-macros -Wshadow -Wdouble-promotion AM_LDFLAGS = -Wl,--as-needed bin_PROGRAMS = pegsolitaire # $(AM_CPPFLAGS) need to be explicitly added here. pegsolitaire_CPPFLAGS = $(AM_CPPFLAGS) $(GTK_CFLAGS) pegsolitaire_LDADD = $(GTK_LIBS) pegsolitaire_SOURCES = \ src/callbacks.c \ src/callbacks.h \ src/game.c \ src/game.h \ src/gridframe.c \ src/gridframe.h \ src/i18n.h \ src/main.c \ src/preimage.c \ src/preimage.h \ src/share.h # Files in dist_something_DATA will be installed to $(somethingdir). dist_pkgdata_DATA = data/hole.svg data/peg.svg data/pegsolitaire.glade dist_man_MANS = data/pegsolitaire.6 svgicondir = $(datarootdir)/icons/hicolor/scalable/apps dist_svgicon_DATA = data/pegsolitaire.svg helpdir = $(datarootdir)/gnome/help/pegsolitaire/C dist_help_DATA = help/legal.xml help/pegsolitaire.xml EXTRA_DIST = AUTHORS CHANGELOG COPYING README # Rules for metadata translation using gettext. EXTRA_DIST += \ data/pegsolitaire.desktop.in \ data/com.github.jnumm.pegsolitaire.appdata.xml.in CLEANFILES = \ pegsolitaire.desktop \ com.github.jnumm.pegsolitaire.appdata.xml desktopdir = $(datarootdir)/applications desktop_DATA = pegsolitaire.desktop appdatadir = $(datarootdir)/metainfo appdata_DATA = com.github.jnumm.pegsolitaire.appdata.xml pegsolitaire.desktop: data/pegsolitaire.desktop.in $(MSGFMT) -v -c --statistics --desktop --template $< -d $(top_srcdir)/po -o $@ com.github.jnumm.pegsolitaire.appdata.xml: data/com.github.jnumm.pegsolitaire.appdata.xml.in $(MSGFMT) -v -c --statistics --xml --template $< -d $(top_srcdir)/po -o $@ SUBDIRS = po pegsolitaire-0.1.1/README000066400000000000000000000002201322743716100150600ustar00rootroot00000000000000Peg Solitaire is an educational game similar to Hi-Q. The object is to jump pegs until a single peg is left in the centre of the game board. pegsolitaire-0.1.1/autogen.sh000077500000000000000000000000671322743716100162120ustar00rootroot00000000000000#!/bin/sh autoreconf --verbose --install --force -Wall pegsolitaire-0.1.1/configure.ac000066400000000000000000000007651322743716100165040ustar00rootroot00000000000000AC_INIT([pegsolitaire], [0.1.1]) AM_INIT_AUTOMAKE([foreign subdir-objects -Wall]) AM_MAINTAINER_MODE([enable]) AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_HEADERS([config.h]) AC_PROG_CC dnl Add here the compilation flags that might cause an error on some compilers. AX_APPEND_COMPILE_FLAGS([-Wmissing-variable-declarations]) AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.19]) PKG_CHECK_MODULES([GTK], [gtk+-2.0 gmodule-2.0 librsvg-2.0]) AC_CONFIG_FILES([Makefile po/Makefile.in]) AC_OUTPUT pegsolitaire-0.1.1/data/000077500000000000000000000000001322743716100151175ustar00rootroot00000000000000pegsolitaire-0.1.1/data/com.github.jnumm.pegsolitaire.appdata.xml.in000066400000000000000000000023031322743716100255270ustar00rootroot00000000000000 com.github.jnumm.pegsolitaire FSFAP GPL-2.0+ Peg Solitaire Play an educational puzzle game similar to Hi-Q

Peg Solitaire is a board game for one player involving movement of pegs on a board with holes. The game fills the entire board with pegs except for the central hole. The objective is, making valid moves, to empty the entire board except for a solitary peg in the central hole.

pegsolitaire.desktop https://raw.githubusercontent.com/jnumm/pegsolitaire/screenshots/pegsolitaire-default.png https://github.com/jnumm/pegsolitaire juhaninumminen0@gmail.com pegsolitaire pegsolitaire
pegsolitaire-0.1.1/data/hole.svg000066400000000000000000000167321322743716100166000ustar00rootroot00000000000000 image/svg+xml Media Record Lapo Calamandrei media player record music sound video pegsolitaire-0.1.1/data/peg.svg000066400000000000000000000237401322743716100164210ustar00rootroot00000000000000 image/svg+xml Media Record Lapo Calamandrei media player record music sound video pegsolitaire-0.1.1/data/pegsolitaire.6000066400000000000000000000022171322743716100176770ustar00rootroot00000000000000.TH PEGSOLITAIRE 6 "2018-01-08" "pegsolitaire 0.1.1" "User Commands" .\" Please adjust this date whenever revising the manpage. . .SH NAME pegsolitaire \- puzzle game for one player . .SH SYNOPSIS .B pegsolitaire .RI [ option ...] . .SH DESCRIPTION .B pegsolitaire is an educational puzzle game. .PP The goal of the game is to remove pegs from the board leaving a single peg in the centre hole. Pegs are removed from the board by making jumps. You can jump over a peg with another peg horizontally or vertically, but not diagonally. .PP When you jump over a peg, it is removed from the board. Multiple jumps with one peg are allowed. . .SS "Help Options:" .TP \fB\-h\fR, \fB\-\-help\fR Show help options .TP \fB\-\-help\-all\fR Show all help options .TP \fB\-\-help\-gtk\fR Show GTK+ Options .SS "Application Options:" .TP \fB\-x\fR, \fB\-\-x\fR=\fIX\fR X location of window .TP \fB\-y\fR, \fB\-\-y\fR=\fIY\fR Y location of window .TP \fB\-\-display\fR=\fIDISPLAY\fR X display to use . .SH AUTHOR pegsolitaire was written by Ben Asselstine. .PP This manual page was originally written by Barry deFreese for the Debian and Ubuntu distributions. pegsolitaire-0.1.1/data/pegsolitaire.desktop.in000066400000000000000000000004151322743716100216060ustar00rootroot00000000000000[Desktop Entry] Type=Application Name=Peg Solitaire Comment=Play an educational puzzle game similar to Hi-Q Icon=pegsolitaire Exec=pegsolitaire Terminal=false Categories=Game;LogicGame; Keywords=solitaire;peg;brainvita;solo;noble;puzzle;logic;board; StartupNotify=true pegsolitaire-0.1.1/data/pegsolitaire.glade000066400000000000000000000347371322743716100206220ustar00rootroot00000000000000 True False gtk-help True False gtk-refresh True False Peg Solitaire pegsolitaire GTK_WIN_POS_CENTER 500 500 True False vertical True False True False _Game True True False _Restart True True False stockRefreshImage False True False True False _English Board True True False True False Beginner True True False Intermediate True True False Advanced True True False E_uropean Board True True False True False Beginner True True False Intermediate True True False Advanced True True False gtk-quit True False True True True False _Help True True False Contents True False stockHelpImage False gtk-about True False True True False True 0 True False True False False False 8 0 True False False False 8 end 1 False True end 2 Peg Solitaire pegsolitaire False 5 True normal Peg Solitaire © 2007-2008 Ben Asselstine © 2017-2018 Juhani Numminen This software is dedicated to Mothers everywhere. Ben Asselstine Juhani Numminen translator-credits pegsolitaire https://github.com/jnumm/pegsolitaire pegsolitaire-0.1.1/data/pegsolitaire.old.png000066400000000000000000000030251322743716100210710ustar00rootroot00000000000000PNG  IHDR00` PLTE'4&=-A1I7 O=&VB%bB$[G*bG(fF'iG#fJ$mK'jM'pN)lO/hR/nQ1oR+sP+qS-wS/tW6xZ3|X3Y/}]1\2^4`5b7a6co>R}PK%bz`|3jyfzFEZ~Nf}?)Tl{uGh|p{tBPvCHn}q}9KCǟvDB8s~v~yFTY/xS;FM0̣yGy|=F2͂~}4?ˆQƦ|J|EKJɃCAUɌ[ËCʭIND̑EOGΖXHϓIКSKў{O}^Vѥ~WWΤyyYZԨvUaϭwcпQ\ӱsdѮueҳuYfӶpghոrmiƖWooqrkřksʛ[tĝguʜivw̞jxΟfyҢb{܀ԣcׂ֥eلچۍۇ܎܏ސߒۓܙݛޜߝޠ袮`tRNS@fbKGDH pHYs  tIME IDATHՔk`ǟG lF)ez IdeEB)RX/JP!RBBJC RJ M#"Þ7|ܚ6l?~4Mϑ6ak`YHH^V `OyM{x=DbtK>Ԉ-LB>]̫-pm{2=0Qi@Q_MP5ɘzh)"ZJ:Huځ'< I{~|nȿ'Ψl?f";)Й鸹Ń395+J3!㙘ޙ@v&joI,) ʷTx[dbs:[vXj?LLMBv$tmG?hb {ª)|=|)B]}쏾ǻ'{>O:WRz<<#Y/Knki7x"4msRR~IENDB`pegsolitaire-0.1.1/data/pegsolitaire.svg000077700000000000000000000000001322743716100216162peg.svgustar00rootroot00000000000000pegsolitaire-0.1.1/help/000077500000000000000000000000001322743716100151365ustar00rootroot00000000000000pegsolitaire-0.1.1/help/legal.xml000066400000000000000000000071301322743716100167450ustar00rootroot00000000000000 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License (GFDL), 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 can find a copy of the GFDL at this link or in the file COPYING-DOCS distributed with this manual. This manual is part of a collection of GNOME manuals distributed under the GFDL. If you want to distribute this manual separately from the collection, you can do so by adding a copy of the license to the manual, as described in section 6 of the license. 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 the members of the GNOME Documentation Project are made aware of those trademarks, then the names are in capital letters or initial capital letters. DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT ARE PROVIDED UNDER THE TERMS OF THE GNU FREE DOCUMENTATION LICENSE WITH THE FURTHER UNDERSTANDING THAT: DOCUMENT IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS FREE OF DEFECTS MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY, ACCURACY, AND PERFORMANCE OF THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS WITH YOU. SHOULD ANY DOCUMENT OR MODIFIED VERSION PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL WRITER, AUTHOR OR ANY CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER; AND UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE AUTHOR, INITIAL WRITER, ANY CONTRIBUTOR, OR ANY DISTRIBUTOR OF THE DOCUMENT OR MODIFIED VERSION OF THE DOCUMENT, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER DAMAGES OR LOSSES ARISING OUT OF OR RELATING TO USE OF THE DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. pegsolitaire-0.1.1/help/pegsolitaire.xml000066400000000000000000000063461322743716100203600ustar00rootroot00000000000000 Peg Solitaire"> ]>
Peg Solitaire Manual &manrevision; 2007 Ben Asselstine Ben Asselstine &legal; Ben Asselstine Peg Solitaire Development Team
benasselstine@gmail.com
This manual describes version &appversion; of &app;. Feedback Information To report a bug or make a suggestion regarding this application or this documentation, see the GNOME Feedback Page.
Peg Solitaire pegsolitaire Introduction Peg Solitaire is a board game for one player involving movement of pegs on a board with holes. The first evidence of peg solitaire can be traced back to the court of Louis XIV, and the specific date of 1697. It was made popular in more recent history by the board game marketed as Hi-Q. Objective The goal of the game is to remove pegs from the board leaving a single peg in the centre hole. Pegs are removed from the board by making "jumps". You can jump over a peg with another peg horizontally or vertically (not diagonally!). When you jump over a peg, it is removed from the board. Multiple jumps with one peg are allowed. Getting Started You can start &app; from the Applications menu by choosing Games Peg Solitaire .
pegsolitaire-0.1.1/po/000077500000000000000000000000001322743716100146245ustar00rootroot00000000000000pegsolitaire-0.1.1/po/LINGUAS000066400000000000000000000000631322743716100156500ustar00rootroot00000000000000# please keep this list sorted alphabetically # de pegsolitaire-0.1.1/po/Makevars000066400000000000000000000040331322743716100163200ustar00rootroot00000000000000# Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. # The first --keyword disables all default keywords, because we don't want the # value for Icon in the desktop file to be translated. XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword --keyword=_ --keyword=N_ \ --keyword=Name --keyword=GenericName --keyword=Comment --keyword=Keywords # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Ben Asselstine # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = https://github.com/jnumm/pegsolitaire/issues # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = pegsolitaire-0.1.1/po/POTFILES.in000066400000000000000000000003061322743716100164000ustar00rootroot00000000000000# List of source files containing translatable strings. data/pegsolitaire.desktop.in data/com.github.jnumm.pegsolitaire.appdata.xml.in data/pegsolitaire.glade src/game.c src/main.c src/callbacks.c pegsolitaire-0.1.1/po/de.po000066400000000000000000000105361322743716100155610ustar00rootroot00000000000000# German translation for Pegsolitaire. # Copyright (C) 2008 Ben Asselstine # This file is distributed under the same license as the Pegsolitaire package. # Mario Blättermann , 2008. # msgid "" msgstr "" "Project-Id-Version: pegsolitaire 0.0.4\n" "Report-Msgid-Bugs-To: https://github.com/jnumm/pegsolitaire/issues\n" "POT-Creation-Date: 2018-01-08 15:59+0200\n" "PO-Revision-Date: 2008-05-01 14:44+0200\n" "Last-Translator: Mario Blättermann \n" "Language-Team: German\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: data/pegsolitaire.desktop.in:4 #: data/com.github.jnumm.pegsolitaire.appdata.xml.in:8 #: data/pegsolitaire.glade:19 data/pegsolitaire.glade:255 #: data/pegsolitaire.glade:261 msgid "Peg Solitaire" msgstr "Peg Solitaire" #: data/pegsolitaire.desktop.in:5 #: data/com.github.jnumm.pegsolitaire.appdata.xml.in:9 msgid "Play an educational puzzle game similar to Hi-Q" msgstr "Spiele ein lehrreiches Knobelspiel ähnlich wie Hi-Q" #: data/pegsolitaire.desktop.in:10 msgid "solitaire;peg;brainvita;solo;noble;puzzle;logic;board;" msgstr "" #: data/com.github.jnumm.pegsolitaire.appdata.xml.in:12 msgid "" "Peg Solitaire is a board game for one player involving movement of pegs on a " "board with holes. The game fills the entire board with pegs except for the " "central hole. The objective is, making valid moves, to empty the entire " "board except for a solitary peg in the central hole." msgstr "" #: data/pegsolitaire.glade:40 msgid "_Game" msgstr "_Spiel" #: data/pegsolitaire.glade:48 msgid "_Restart" msgstr "_Neu starten" #: data/pegsolitaire.glade:68 msgid "_English Board" msgstr "_Englisches Brett" #: data/pegsolitaire.glade:78 data/pegsolitaire.glade:119 msgid "Beginner" msgstr "Anfänger" #: data/pegsolitaire.glade:87 data/pegsolitaire.glade:128 msgid "Intermediate" msgstr "Fortgeschritten" #: data/pegsolitaire.glade:96 data/pegsolitaire.glade:137 msgid "Advanced" msgstr "Profi" #: data/pegsolitaire.glade:109 msgid "E_uropean Board" msgstr "E_uropäisches Brett" #: data/pegsolitaire.glade:171 msgid "_Help" msgstr "_Hilfe" #: data/pegsolitaire.glade:179 msgid "Contents" msgstr "Inhalt" #: data/pegsolitaire.glade:262 msgid "" "© 2007-2008 Ben Asselstine\n" "© 2017-2018 Juhani Numminen" msgstr "" #: data/pegsolitaire.glade:264 msgid "" "This software is dedicated\n" " to Mothers everywhere." msgstr "" "Diese Software ist den\n" " Müttern der Welt gewidmet." #. TRANSLATORS: Replace this string with your names, one name per line. #: data/pegsolitaire.glade:268 msgid "translator-credits" msgstr "Deutsch: Mario Blättermann " #: src/game.c:365 msgid "GENIUS!" msgstr "GENIAL!" #: src/game.c:366 msgid "OUTSTANDING!" msgstr "Außergewöhnlich!" #: src/game.c:367 msgid "Sensational!" msgstr "Sensationell!" #: src/game.c:368 msgid "Excellent!" msgstr "Exzellent!" #: src/game.c:369 msgid "Very Good!" msgstr "Sehr gut!" #: src/game.c:370 msgid "Not Bad!" msgstr "Nicht schlecht!" #: src/game.c:371 msgid "Better Luck Next Time!" msgstr "Viel Glück beim nächsten Mal!" #. TRANSLATORS: This is the number of moves the player has made. #: src/main.c:95 #, c-format msgid "Moves: %d" msgstr "Züge: %d" #: src/main.c:103 msgid "X location of window" msgstr "X Fensterposition" #: src/main.c:104 msgid "X" msgstr "X" #: src/main.c:105 msgid "Y location of window" msgstr "Y Fensterposition" #: src/main.c:106 msgid "Y" msgstr "Y" #: src/main.c:123 #, c-format msgid "" "Could not find the image:\n" "%s\n" "\n" "Please check that Peg Solitaire is installed correctly." msgstr "" "Konnte Bilddatei nicht finden:\n" "%s\n" "\n" "Bitte überprüfen Sie die korrekte Installation von Peg Solitaire." #: src/callbacks.c:131 #, fuzzy msgid "" "The theme for this game failed to render.\n" "\n" "Please check that Peg Solitaire is installed correctly." msgstr "" "Konnte Bilddatei nicht finden:\n" "%s\n" "\n" "Bitte überprüfen Sie die korrekte Installation von Peg Solitaire." #: src/callbacks.c:210 #, c-format msgid "Cannot show help: %s" msgstr "" #: src/callbacks.c:368 #, c-format msgid "The \"%s\" cursor is not available" msgstr "" #: src/callbacks.c:375 src/callbacks.c:383 #, c-format msgid "The \"%s\" or \"%s\" cursor is not available" msgstr "" pegsolitaire-0.1.1/src/000077500000000000000000000000001322743716100147755ustar00rootroot00000000000000pegsolitaire-0.1.1/src/callbacks.c000066400000000000000000000312771322743716100170720ustar00rootroot00000000000000/* * Copyright (C) 2007-2008 Ben Asselstine * Copyright (C) 2017-2018 Juhani Numminen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "callbacks.h" #include // for exit() #include #include "config.h" #include "game.h" #include "gridframe.h" #include "i18n.h" #include "preimage.h" #include "share.h" void update_statusbar (int moves); static GdkCursor *hand_closed_cursor = NULL; static GdkCursor *hand_open_cursor = NULL; static GdkCursor *default_cursor = NULL; enum { CURSOR_NONE = 0, CURSOR_OPEN, CURSOR_CLOSED }; static void set_cursor (int cursor) { static int prev_cursor = -1; if ((cursor == CURSOR_NONE) && (prev_cursor != CURSOR_NONE)) gdk_window_set_cursor (gtk_widget_get_window (pegSolitaireWindow), default_cursor); if ((cursor == CURSOR_OPEN) && (prev_cursor != CURSOR_OPEN)) gdk_window_set_cursor (gtk_widget_get_window (pegSolitaireWindow), hand_open_cursor); if ((cursor == CURSOR_CLOSED) && (prev_cursor != CURSOR_CLOSED)) gdk_window_set_cursor (gtk_widget_get_window (pegSolitaireWindow), hand_closed_cursor); prev_cursor = cursor; } static void board_draw (void) { GtkWidget *w; static GdkGC *backgc = NULL; GdkColor *bg_color; GtkStyle *style; GtkAllocation allocation; w = boardDrawingArea; if (board_pixmap) g_object_unref (board_pixmap); gtk_widget_get_allocation (w, &allocation); board_pixmap = gdk_pixmap_new (gtk_widget_get_window (w), allocation.width, allocation.height, -1); if (!backgc) backgc = gdk_gc_new (gtk_widget_get_window (w)); style = gtk_widget_get_style (w); bg_color = gdk_color_copy (&style->bg[GTK_STATE_NORMAL]); gdk_gc_set_foreground (backgc, bg_color); gdk_gc_set_fill (backgc, GDK_SOLID); gdk_color_free (bg_color); gdk_draw_rectangle (board_pixmap, backgc, TRUE, 0, 0, allocation.width, allocation.height); clear_buffer = clear_game = 0; gtk_widget_queue_draw (w); } // redraw the board and pegs static gboolean redraw_all (void) { board_draw (); game_draw (pegSolitaireWindow, board_pixmap, tile_size, 1); return 0; } // redraw everything in a thread gboolean resize_all (void) { if (tile_size != prior_tile_size) { if (peg_pixbuf != NULL) g_object_unref (peg_pixbuf); peg_pixbuf = NULL; if (hole_pixbuf != NULL) g_object_unref (hole_pixbuf); hole_pixbuf = NULL; if (peg_preimage) { peg_pixbuf = games_preimage_render (peg_preimage, tile_size / 1.666, tile_size / 1.666); } if (hole_preimage) { hole_pixbuf = games_preimage_render (hole_preimage, tile_size / 1.666, tile_size / 1.666); } if (peg_pixbuf == NULL || hole_pixbuf == NULL) { GtkWidget *dialog; dialog = gtk_message_dialog_new (GTK_WINDOW (pegSolitaireWindow), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("The theme for this game failed " "to render.\n\nPlease check that " "Peg Solitaire is installed " "correctly.")); gtk_dialog_run (GTK_DIALOG (dialog)); exit (1); } prior_tile_size = tile_size; } if (redraw_all_idle_id) g_source_remove (redraw_all_idle_id); redraw_all_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 1, (GSourceFunc) redraw_all, NULL, NULL); resize_all_idle_id = 0; return 0; } static void update_tile_size (void) { if (width < height) tile_size = width / game_board_size; else tile_size = height / game_board_size; } // the size has changed, show the resize in a thread. static void recalculate_size (void) { update_tile_size (); if (clear_buffer || clear_game || tile_size != prior_tile_size) { if (resize_all_idle_id) g_source_remove (resize_all_idle_id); resize_all_idle_id = g_idle_add ((GSourceFunc) resize_all, NULL); clear_buffer = 1; } } static void initiate_new_game (int board_type, int board_size) { game_board_type = board_type; game_board_size = board_size; update_tile_size (); clear_game = 1; game_new (); gtk_label_set_text (statusMessageLabel, ""); update_statusbar (game_moves); games_grid_frame_set (GAMES_GRID_FRAME (gameframe), board_size, board_size); recalculate_size (); } // Following functions are gtk callbacks and all their parameters are required. #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" void on_helpAboutMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { gtk_dialog_run (GTK_DIALOG (pegSolitaireAboutDialog)); gtk_widget_hide (GTK_WIDGET (pegSolitaireAboutDialog)); } void on_helpContentsMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { GError *err = NULL; /* TODO: gtk3: change to gtk_show_uri_on_window */ gtk_show_uri (gtk_widget_get_screen (pegSolitaireWindow), "ghelp:pegsolitaire", gtk_get_current_event_time (), &err); if (err != NULL) { g_warning (_("Cannot show help: %s"), err->message); g_error_free (err); } } void on_gameRestartMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { initiate_new_game (game_board_type, game_board_size); } void on_pegSolitaireWindow_destroy (GObject * object, gpointer user_data) { gtk_main_quit (); } void on_gameQuitMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { gtk_main_quit (); } gboolean on_pegSolitaireWindow_configure_event (GtkWidget * widget, GdkEventConfigure * ev, gpointer user_data) { return FALSE; } gboolean on_boardDrawingArea_motion_notify_event (GtkWidget * widget, GdkEventMotion * event, gpointer user_data) { int i = event->x / tile_size; int j = event->y / tile_size; int icon_size = tile_size / 1.666; if (button_down == 1) { // before we draw the peg, let's expose the board again. gdk_draw_pixmap (gtk_widget_get_window (widget), gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], board_pixmap, 0, 0, 0, 0, tile_size * game_board_size, tile_size * game_board_size); gdk_draw_pixbuf (gtk_widget_get_window (widget), gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], peg_pixbuf, 0, 0, event->x - (icon_size / 2), event->y - (icon_size / 2), icon_size, icon_size, GDK_RGB_DITHER_NORMAL, 0, 0); } else { // switch up the pointer when we're over a peg and what-not. if (game_is_peg_at (i, j) == TRUE) { if ((int) event->x % tile_size < (tile_size / 2) + (icon_size / 2) && (int) event->x % tile_size > (tile_size / 2) - (icon_size / 2) && (int) event->y % tile_size < (tile_size / 2) + (icon_size / 2) && (int) event->y % tile_size > (tile_size / 2) - (icon_size / 2)) set_cursor (CURSOR_OPEN); else set_cursor (CURSOR_NONE); } else set_cursor (CURSOR_NONE); } return FALSE; } gboolean on_boardDrawingArea_button_press_event (GtkWidget * widget, GdkEventButton * event, gpointer user_data) { if ((event->button == 1) && (button_down == 0)) { int i, j; if (is_game_end () == 1) return FALSE; i = event->x / tile_size; j = event->y / tile_size; if (game_is_peg_at (i, j) == FALSE) return FALSE; set_cursor (CURSOR_CLOSED); button_down = 1; game_toggle_cell (i, j); game_draw (pegSolitaireWindow, board_pixmap, tile_size, 0); piece_x = i; piece_y = j; GdkRectangle update; update.x = i * tile_size; update.y = j * tile_size; update.width = tile_size; update.height = tile_size; gtk_widget_draw (widget, &update); } return FALSE; } gboolean on_boardDrawingArea_button_release_event (GtkWidget * widget, GdkEventButton * event, gpointer user_data) { if (event->button == 1) { if (button_down == 1) { int i, j; button_down = 0; set_cursor (CURSOR_NONE); i = event->x / tile_size; j = event->y / tile_size; if (game_move (piece_x, piece_y, i, j) == FALSE) { //put the peg back where we started. game_toggle_cell (piece_x, piece_y); game_draw (pegSolitaireWindow, board_pixmap, tile_size, 0); return FALSE; } game_draw (pegSolitaireWindow, board_pixmap, tile_size, 0); update_statusbar (game_moves); if (is_game_end ()) { gtk_label_set_text (statusMessageLabel, game_cheese ()); } else set_cursor (CURSOR_OPEN); } } return FALSE; } gboolean on_boardDrawingArea_expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { if (clear_game) return FALSE; gdk_draw_pixmap (gtk_widget_get_window (widget), gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], board_pixmap, event->area.x, event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); return FALSE; } gboolean on_boardDrawingArea_configure_event (GtkWidget * widget, GdkEventConfigure * event, gpointer user_data) { GdkDisplay *display = gtk_widget_get_display (widget); if (!default_cursor) default_cursor = gdk_cursor_new_from_name (display, "default"); if (!default_cursor) g_warning (_("The \"%s\" cursor is not available"), "default"); if (!hand_closed_cursor) hand_closed_cursor = gdk_cursor_new_from_name (display, "grabbing"); if (!hand_closed_cursor) hand_closed_cursor = gdk_cursor_new_from_name (display, "closedhand"); if (!hand_closed_cursor) g_warning (_("The \"%s\" or \"%s\" cursor is not available"), "grabbing", "closedhand"); if (!hand_open_cursor) hand_open_cursor = gdk_cursor_new_from_name (display, "grab"); if (!hand_open_cursor) hand_open_cursor = gdk_cursor_new_from_name (display, "openhand"); if (!hand_open_cursor) g_warning (_("The \"%s\" or \"%s\" cursor is not available"), "grab", "openhand"); width = event->width; height = event->height; recalculate_size (); return FALSE; } void on_gameEnglishBeginnerMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { initiate_new_game (BOARD_ENGLISH, 7); } void on_gameEnglishIntermediateMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { initiate_new_game (BOARD_ENGLISH, 11); } void on_gameEnglishAdvancedMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { initiate_new_game (BOARD_ENGLISH, 15); } void on_gameEuropeanBeginnerMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { initiate_new_game (BOARD_EUROPEAN, 7); } void on_gameEuropeanIntermediateMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { initiate_new_game (BOARD_EUROPEAN, 11); } void on_gameEuropeanAdvancedMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data) { initiate_new_game (BOARD_EUROPEAN, 15); } #pragma GCC diagnostic pop pegsolitaire-0.1.1/src/callbacks.h000066400000000000000000000057121322743716100170720ustar00rootroot00000000000000/* * Copyright (C) 2007-2008 Ben Asselstine * Copyright (C) 2017-2018 Juhani Numminen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef PEGSOLITAIRE_CALLBACKS_H #define PEGSOLITAIRE_CALLBACKS_H #include gboolean resize_all (void); void on_helpAboutMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); void on_helpContentsMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); void on_gameRestartMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); void on_pegSolitaireWindow_destroy (GObject * object, gpointer user_data); void on_gameQuitMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); gboolean on_pegSolitaireWindow_configure_event (GtkWidget * widget, GdkEventConfigure * event, gpointer user_data); gboolean on_boardDrawingArea_motion_notify_event (GtkWidget * widget, GdkEventMotion * event, gpointer user_data); gboolean on_boardDrawingArea_button_press_event (GtkWidget * widget, GdkEventButton * event, gpointer user_data); gboolean on_boardDrawingArea_button_release_event (GtkWidget * widget, GdkEventButton * event, gpointer user_data); gboolean on_boardDrawingArea_expose_event (GtkWidget * widget, GdkEventExpose * event, gpointer user_data); void on_gameEnglishBeginnerMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); void on_gameEnglishIntermediateMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); void on_gameEnglishAdvancedMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); void on_gameEuropeanBeginnerMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); void on_gameEuropeanIntermediateMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); void on_gameEuropeanAdvancedMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); gboolean on_boardDrawingArea_configure_event (GtkWidget * widget, GdkEventConfigure * event, gpointer user_data); void on_helpAboutMenuItem_activate (GtkMenuItem * menuitem, gpointer user_data); #endif // PEGSOLITAIRE_CALLBACKS_H pegsolitaire-0.1.1/src/game.c000066400000000000000000000250501322743716100160540ustar00rootroot00000000000000/* * Copyright (C) 2007-2008 Ben Asselstine * Copyright (C) 2017-2018 Juhani Numminen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "game.h" #include #include #include #include "i18n.h" #include "share.h" #define DEFAULT_GAME_BOARD_SIZE 7 #define DEFAULT_GAME_BOARD_TYPE BOARD_ENGLISH static gchar **game_board; // 7x7, 1 means there's a peg, 0 means no peg. static gchar **game_board_mask; // 7x7, 1 means it's part of the cross, 0 means not. static gchar **game_board_dirty; // 7x7, 1 means the cell needs to be redrawn, 0 means not. // Globals that are exposed through game.h gint game_moves; gint game_board_size = DEFAULT_GAME_BOARD_SIZE; game_board_enum game_board_type = DEFAULT_GAME_BOARD_TYPE; // End of globals that are exposed through game.h static int create_game_board_mask (void) { int i, j; int n = game_board_size; int m = n / 2; // length of one side of the cross assert (n % 2 == 1); assert (m % 2 == 1); // for those keeping score, this means n=3,7,11,15,19... is valid. // allocate the game board mask game_board_mask = realloc (game_board_mask, game_board_size * sizeof (gchar *)); if (game_board_mask == NULL) return -1; memset (game_board_mask, 0, game_board_size * sizeof (gchar *)); for (i = 0; i < game_board_size; i++) { game_board_mask[i] = realloc (game_board_mask[i], game_board_size * sizeof (gchar)); if (game_board_mask[i] == NULL) return -1; memset (game_board_mask[i], 0, game_board_size * sizeof (gchar)); } if (game_board_type == BOARD_ENGLISH) { // fill the centre row of the cross for (i = n / 2 - m / 2; i < n - (n / 2 - m / 2); i++) { for (j = 0; j < game_board_size; j++) { game_board_mask[i][j] = 1; } } // fill the centre column of the cross for (i = 0; i < game_board_size; i++) { for (j = n / 2 - m / 2; j < n - (n / 2 - m / 2); j++) { game_board_mask[i][j] = 1; } } } else if (game_board_type == BOARD_EUROPEAN) { game_board_type = BOARD_ENGLISH; create_game_board_mask (); game_board_type = BOARD_EUROPEAN; for (i = n / 2 - m / 1.666; i < n - (n / 2 - m / 1.666); i++) { for (j = n / 2 - m / 1.666; j < n - (n / 2 - m / 1.666); j++) { game_board_mask[i][j] = 1; } } } return 0; } static int game_init (void) { int i; // setup the shape of the game board create_game_board_mask (); // allocate the game board dirty map game_board_dirty = realloc (game_board_dirty, game_board_size * sizeof (gchar *)); if (game_board_dirty == NULL) return -1; memset (game_board_dirty, 0, game_board_size * sizeof (gchar *)); for (i = 0; i < game_board_size; i++) { game_board_dirty[i] = realloc (game_board_dirty[i], game_board_size * sizeof (gchar)); if (game_board_dirty[i] == NULL) return -1; memset (game_board_dirty[i], 0, game_board_size * sizeof (gchar)); } // allocate the game board game_board = realloc (game_board, game_board_size * sizeof (gchar *)); if (game_board == NULL) return -1; memset (game_board, 0, game_board_size * sizeof (gchar *)); for (i = 0; i < game_board_size; i++) { game_board[i] = realloc (game_board[i], game_board_size * sizeof (gchar)); if (game_board[i] == NULL) return -1; memset (game_board[i], 0, game_board_size * sizeof (gchar)); } return 0; } static int game_clear (void) { int i, j; int size = game_board_size; for (i = 0; i < size; i++) { for (j = 0; j < size; j++) { if (game_board_mask[i][j] == 0) continue; if (game_board[i][j] == 0) { game_board[i][j] = 1; game_board_dirty[i][j] = 1; } } } if (game_board[size / 2][size / 2] == 1) { game_board[size / 2][size / 2] = 0; game_board_dirty[size / 2][size / 2] = 1; } game_moves = 0; return 0; } int game_count_pegs_on_board (void) { int i, j, pegs_left = 0; // find the number of pegs on the board for (i = 0; i < game_board_size; i++) { for (j = 0; j < game_board_size; j++) { if (game_board[i][j]) pegs_left++; } } return pegs_left; } int game_new (void) { int err; err = game_init (); if (!err) err = game_clear (); return err; } int is_game_end (void) { int i, j, k; // are there any two pegs adjacent in a row? for (i = 0; i < game_board_size; i++) { for (j = 0; j < game_board_size - 1; j++) { if (game_board[i][j] && game_board[i][j + 1]) { // great, but is the entire row filled with pegs? for (k = 0; k < game_board_size; k++) { if (game_board_mask[i][k] == 1) if (game_board[i][k] == 0) return 0; // nope, the game is still on. } } } } // are there any two pegs adjacent in a column? for (i = 0; i < game_board_size - 1; i++) { for (j = 0; j < game_board_size; j++) { if (game_board[i][j] && game_board[i + 1][j]) { // great, but is the entire row filled with pegs? for (k = 0; k < game_board_size; k++) { if (game_board_mask[k][j] == 1) if (game_board[k][j] == 0) return 0; // nope, the game is still on. } } } } // no pegs adjacent. no more moves means it's game over. return 1; } void game_toggle_cell (int i, int j) { if (i < 0 || j < 0 || i >= game_board_size || j >= game_board_size) return; if (game_board_mask[i][j]) { game_board[i][j] = !game_board[i][j]; game_board_dirty[i][j] = 1; } } gboolean game_is_peg_at (int i, int j) { if (i < 0 || j < 0 || i >= game_board_size || j >= game_board_size) return FALSE; if (game_board_mask[i][j] == 0) return FALSE; return game_board[i][j]; } static gboolean game_is_valid_move (int src_x, int src_y, int dst_x, int dst_y) { int delta_x, delta_y; if (src_x < 0 || src_y < 0 || dst_x < 0 || dst_y < 0) return FALSE; if (src_x >= game_board_size || src_y >= game_board_size) return FALSE; if (dst_x >= game_board_size || dst_y >= game_board_size) return FALSE; if (game_board_mask[src_x][src_y] == 0 || game_board_mask[dst_x][dst_y] == 0) return FALSE; // well the peg has to be out of the source pos'n already if (game_is_peg_at (src_x, src_y) == TRUE) return FALSE; // and there can't be a peg at the destination either. if (game_is_peg_at (dst_x, dst_y) == TRUE) return FALSE; //is it 2 away with a peg in the middle with a peg in it? delta_x = src_x - dst_x; delta_y = src_y - dst_y; if (delta_x == 0 && (delta_y == -2 || delta_y == 2)) return game_is_peg_at (dst_x, dst_y + (delta_y / 2)); else if (delta_y == 0 && (delta_x == -2 || delta_x == 2)) return game_is_peg_at (dst_x + (delta_x / 2), dst_y); return FALSE; } // move peg from src to dst, taking intermediate peg out. // presumes that peg from src is already removed gboolean game_move (int src_x, int src_y, int dst_x, int dst_y) { if (game_is_valid_move (src_x, src_y, dst_x, dst_y) == TRUE) { int delta_x = src_x - dst_x; int delta_y = src_y - dst_y; // okay, the peg has been taken out of src_x,src_y and is in the air. // it is placed on dst_x,dst_y, and it's a valid move. // this means that the dst_x,dst_y doesn't have a peg in it. // it also means the one tile we jumped over does have a peg in it. // take the jumped peg out. if (delta_x == 0) game_toggle_cell (dst_x, dst_y + (delta_y / 2)); else game_toggle_cell (dst_x + (delta_x / 2), dst_y); // put the source peg into the destination spot. game_toggle_cell (dst_x, dst_y); game_moves++; return TRUE; } return FALSE; } int game_draw (GtkWidget * widget, GdkPixmap * pixmap, gint tile_size, int force) { int i, j; for (i = 0; i < game_board_size; i++) { for (j = 0; j < game_board_size; j++) { if ((game_board_dirty[i][j] == 1) || (force)) { game_draw_cell (widget, pixmap, tile_size, i, j); game_board_dirty[i][j] = 0; } } } gtk_widget_queue_draw (widget); return 0; } int game_draw_cell (GtkWidget * widget, GdkPixmap * pixmap, gint tile_size, gint x, gint y) { GdkPixbuf *p; static GdkGC *backgc = NULL; GdkColor *bg_color; GtkStyle *style; if (x < 0 || y < 0) return -1; if (x >= game_board_size || y >= game_board_size) return -1; if (game_board_mask[x][y] == 0) return 1; if (game_board[x][y]) p = peg_pixbuf; else p = hole_pixbuf; if (!backgc) backgc = gdk_gc_new (gtk_widget_get_window (widget)); style = gtk_widget_get_style (widget); bg_color = gdk_color_copy (&style->bg[GTK_STATE_NORMAL]); gdk_gc_set_foreground (backgc, bg_color); gdk_gc_set_fill (backgc, GDK_SOLID); gdk_color_free (bg_color); gdk_draw_rectangle (pixmap, backgc, TRUE, (x * tile_size), (y * tile_size), tile_size, tile_size); int icon_size = tile_size / 1.666; gdk_draw_pixbuf (pixmap, backgc, p, 0, 0, (x * tile_size) + (tile_size / 2) - (icon_size / 2), (y * tile_size) + (tile_size / 2) - (icon_size / 2), icon_size, icon_size, GDK_RGB_DITHER_NORMAL, 0, 0); GdkRectangle update; update.x = x * tile_size; update.y = y * tile_size; update.width = tile_size; update.height = tile_size; gtk_widget_draw (widget, &update); return 0; } gchar * game_cheese (void) { int i = 6; int pegs_left = game_count_pegs_on_board (); static gchar *cheese[] = { N_("GENIUS!"), N_("OUTSTANDING!"), N_("Sensational!"), N_("Excellent!"), N_("Very Good!"), N_("Not Bad!"), N_("Better Luck Next Time!"), }; if (pegs_left > 6) i = 6; else if (pegs_left > 1) i = pegs_left; else if (pegs_left == 1) { if (game_board[game_board_size / 2][game_board_size / 2] == 1) i = 1; else i = 0; } return gettext (cheese[i]); } pegsolitaire-0.1.1/src/game.h000066400000000000000000000030071322743716100160570ustar00rootroot00000000000000/* * Copyright (C) 2007-2008 Ben Asselstine * Copyright (C) 2017-2018 Juhani Numminen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef PEGSOLITAIRE_GAME_H #define PEGSOLITAIRE_GAME_H #include typedef enum { BOARD_ENGLISH, BOARD_EUROPEAN } game_board_enum; extern gint game_moves; extern game_board_enum game_board_type; extern gint game_board_size; int game_new (void); int is_game_end (void); int game_draw (GtkWidget *widget, GdkPixmap *pixmap, gint tile_size, int force); int game_draw_cell (GtkWidget *widget, GdkPixmap *pixmap, gint tile_size, gint x, gint y); void game_toggle_cell (int i, int j); gboolean game_is_peg_at (int i, int j); gboolean game_move (int src_x, int src_y, int dst_x, int dst_y); int game_count_pegs_on_board (void); gchar *game_cheese (void); #endif // PEGSOLITAIRE_GAME_H pegsolitaire-0.1.1/src/gridframe.c000066400000000000000000000174771322743716100171210ustar00rootroot00000000000000/* games-gridframe.c: Create a container that guarantees that the internal * allocated space is a fixed multiple of an integer. * * Copyright 2004 by Callum McKenzie * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ /* A lot of this was written by following the sorce for GtkFrame and * GtkAspectFrame. */ #include #include "gridframe.h" enum { PROP_0, PROP_X_PADDING, PROP_Y_PADDING, PROP_WIDTH, PROP_HEIGHT, PROP_X_ALIGN, PROP_Y_ALIGN }; G_DEFINE_TYPE (GamesGridFrame, games_grid_frame,GTK_TYPE_BIN) struct GamesGridFramePrivate { gint xmult; gint ymult; gint xpadding; gint ypadding; gfloat xalign; gfloat yalign; GtkAllocation old_allocation; }; void games_grid_frame_set (GamesGridFrame * frame, gint newxmult, gint newymult) { if (newxmult > 0) frame->priv->xmult = newxmult; if (newymult > 0) frame->priv->ymult = newymult; gtk_widget_queue_resize (GTK_WIDGET (frame)); } void games_grid_frame_set_padding (GamesGridFrame * frame, gint newxpadding, gint newypadding) { if (newxpadding >= 0) frame->priv->xpadding = newxpadding; if (newypadding >= 0) frame->priv->ypadding = newypadding; gtk_widget_queue_resize (GTK_WIDGET (frame)); } void games_grid_frame_set_alignment (GamesGridFrame * frame, gfloat xalign, gfloat yalign) { if (xalign < 0.0f) xalign = 0.0f; else if (xalign > 1.0f) xalign = 1.0f; if (yalign < 0.0f) yalign = 0.0f; else if (yalign > 1.0f) yalign = 1.0f; frame->priv->xalign = xalign; frame->priv->yalign = yalign; gtk_widget_queue_resize (GTK_WIDGET (frame)); } static void games_grid_frame_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GamesGridFrame *frame = GAMES_GRID_FRAME (object); switch (prop_id) { case PROP_X_PADDING: games_grid_frame_set_padding (frame, g_value_get_int (value), -1); break; case PROP_Y_PADDING: games_grid_frame_set_padding (frame, -1, g_value_get_int (value)); break; case PROP_X_ALIGN: games_grid_frame_set_alignment (frame, g_value_get_float (value), frame->priv->yalign); break; case PROP_Y_ALIGN: games_grid_frame_set_alignment (frame, frame->priv->xalign, g_value_get_float (value)); break; case PROP_WIDTH: games_grid_frame_set (frame, g_value_get_int (value), -1); break; case PROP_HEIGHT: games_grid_frame_set (frame, -1, g_value_get_int (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void games_grid_frame_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GamesGridFrame *frame = GAMES_GRID_FRAME (object); switch (prop_id) { case PROP_X_PADDING: g_value_set_int (value, frame->priv->xpadding); break; case PROP_Y_PADDING: g_value_set_int (value, frame->priv->ypadding); break; case PROP_X_ALIGN: g_value_set_float (value, frame->priv->xalign); break; case PROP_Y_ALIGN: g_value_set_float (value, frame->priv->yalign); break; case PROP_WIDTH: g_value_set_int (value, frame->priv->xmult); break; case PROP_HEIGHT: g_value_set_int (value, frame->priv->ymult); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void games_grid_frame_size_allocate (GtkWidget * widget, GtkAllocation * allocation) { GamesGridFrame *frame = GAMES_GRID_FRAME (widget); GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget)); GtkAllocation child_allocation; gint xsize, ysize, size; gtk_widget_set_allocation (widget, allocation); xsize = MAX (1, (allocation->width - frame->priv->xpadding) / frame->priv->xmult); ysize = MAX (1, (allocation->height - frame->priv->ypadding) / frame->priv->ymult); size = MIN (xsize, ysize); child_allocation.width = size * frame->priv->xmult + frame->priv->xpadding; child_allocation.height = size * frame->priv->ymult + frame->priv->ypadding; child_allocation.x = (allocation->width - child_allocation.width) * frame->priv->xalign + allocation->x; child_allocation.y = (allocation->height - child_allocation.height) * frame->priv->yalign + allocation->y; if (gtk_widget_get_mapped (widget) && (child_allocation.x != frame->priv->old_allocation.x || child_allocation.y != frame->priv->old_allocation.y || child_allocation.width != frame->priv->old_allocation.width || child_allocation.height != frame->priv->old_allocation.height)) gdk_window_invalidate_rect (gtk_widget_get_window (widget), allocation, FALSE); if (child && gtk_widget_get_visible (child)) gtk_widget_size_allocate (child, &child_allocation); frame->priv->old_allocation = child_allocation; } static void games_grid_frame_class_init (GamesGridFrameClass * class) { GObjectClass *object_class; GtkWidgetClass *widget_class; object_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); object_class->set_property = games_grid_frame_set_property; object_class->get_property = games_grid_frame_get_property; widget_class->size_allocate = games_grid_frame_size_allocate; g_type_class_add_private (object_class, sizeof (GamesGridFramePrivate)); g_object_class_install_property (object_class, PROP_X_PADDING, g_param_spec_int ("x_padding", "X Padding", "X Padding", 0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_Y_PADDING, g_param_spec_int ("y_padding", "Y Padding", "Y Padding", 0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_WIDTH, g_param_spec_int ("width_multiple", "Width Multiple", "Width Multiple", 1, G_MAXINT, 1, G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_HEIGHT, g_param_spec_int ("height_multiple", "Height Multiple", "Height Multiple", 1, G_MAXINT, 1, G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_X_ALIGN, g_param_spec_float ("xalign", "X Alignment", "X Alignment", 0.0f, 1.0f, 0.5f, G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_Y_ALIGN, g_param_spec_float ("yalign", "Y Alignment", "Y Alignment", 0.0f, 1.0f, 0.5f, G_PARAM_READWRITE | G_PARAM_WRITABLE)); } static void games_grid_frame_init (GamesGridFrame * frame) { frame->priv = G_TYPE_INSTANCE_GET_PRIVATE (frame, GAMES_TYPE_GRID_FRAME, GamesGridFramePrivate); frame->priv->xmult = 1; frame->priv->ymult = 1; frame->priv->xalign = 0.5f; frame->priv->yalign = 0.5f; } GtkWidget * games_grid_frame_new (gint width, gint height) { GamesGridFrame *frame; frame = g_object_new (GAMES_TYPE_GRID_FRAME, NULL); frame->priv->xmult = MAX (width, 1); frame->priv->ymult = MAX (height, 1); return GTK_WIDGET (frame); } /* EOF */ pegsolitaire-0.1.1/src/gridframe.h000066400000000000000000000047731322743716100171210ustar00rootroot00000000000000/* games-gridframe.h: Create a container that guarantees that the internal * allocated space is a fixed multiple of an integer. * * Copyright 2004 by Callum McKenzie * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ #ifndef GAMES_GRID_FRAME_H #define GAMES_GRID_FRAME_H #include G_BEGIN_DECLS #define GAMES_TYPE_GRID_FRAME (games_grid_frame_get_type ()) #define GAMES_GRID_FRAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GRID_FRAME, GamesGridFrame)) #define GAMES_GRID_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GRID_FRAME, GamesGridFrameClass)) #define GAMES_IS_GRID_FRAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GRID_FRAME)) #define GAMES_IS_GRID_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GRID_FRAME)) #define GAMES_GRID_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GRID_FRAME)) typedef struct GamesGridFramePrivate GamesGridFramePrivate; typedef struct { GtkBin bin; /*< private >*/ GamesGridFramePrivate *priv; } GamesGridFrame; typedef struct { GtkBinClass parent; } GamesGridFrameClass; GType games_grid_frame_get_type (void); GtkWidget *games_grid_frame_new (gint width, gint height); void games_grid_frame_set (GamesGridFrame * frame, gint width, gint height); void games_grid_frame_set_padding (GamesGridFrame * frame, gint xpadding, gint ypadding); void games_grid_frame_set_alignment (GamesGridFrame * frame, gfloat xalign, gfloat yalign); G_END_DECLS #endif /* GAMES_GRID_FRAME_H */ /* EOF */ pegsolitaire-0.1.1/src/i18n.h000066400000000000000000000020601322743716100157230ustar00rootroot00000000000000/* i18n.h: Gettext convenience macros. * Copyright (C) 2018 Juhani Numminen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef PEGSOLITAIRE_I18N_H #define PEGSOLITAIRE_I18N_H #include "config.h" #ifdef ENABLE_NLS #include #else #define gettext(String) (String) #endif #define _(String) gettext(String) #define N_(String) (String) #endif // PEGSOLITAIRE_I18N_H pegsolitaire-0.1.1/src/main.c000066400000000000000000000144411322743716100160710ustar00rootroot00000000000000/* * Copyright (C) 2007-2008 Ben Asselstine * Copyright (C) 2017-2018 Juhani Numminen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include // for exit() #include #include "callbacks.h" #include "config.h" #include "game.h" #include "gridframe.h" #include "i18n.h" #include "preimage.h" #include "share.h" // Exposed through share.h GtkWidget *pegSolitaireWindow; GtkAboutDialog *pegSolitaireAboutDialog; GtkWidget *gameframe; GtkWidget *boardDrawingArea; GtkLabel *statusMessageLabel; GdkPixmap *board_pixmap; gint tile_size, prior_tile_size; gint width, height; guint redraw_all_idle_id = 0; guint resize_all_idle_id = 0; gboolean clear_game = 1; gboolean clear_buffer = 1; gint piece_x; gint piece_y; gint button_down; GamesPreimage *peg_preimage; GamesPreimage *hole_preimage; GdkPixbuf *peg_pixbuf; GdkPixbuf *hole_pixbuf; // End of globals exposed through share.h static GtkLabel *statusMovesLabel; static gint session_xpos = 0; static gint session_ypos = 0; static void create_boardDrawingArea (void) { gameframe = games_grid_frame_new (7, 7); games_grid_frame_set_padding (GAMES_GRID_FRAME (gameframe), 10, 10); gtk_widget_set_size_request (GTK_WIDGET (gameframe), 250, 250); boardDrawingArea = gtk_drawing_area_new (); gtk_widget_set_name (GTK_WIDGET (boardDrawingArea), "boardDrawingArea"); gtk_widget_set_double_buffered (boardDrawingArea, 0); gtk_container_add (GTK_CONTAINER (gameframe), boardDrawingArea); gtk_widget_set_events (boardDrawingArea, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK); g_signal_connect (G_OBJECT (boardDrawingArea), "expose_event", G_CALLBACK (on_boardDrawingArea_expose_event), NULL); g_signal_connect (G_OBJECT (boardDrawingArea), "configure_event", G_CALLBACK (on_boardDrawingArea_configure_event), NULL); g_signal_connect (G_OBJECT (boardDrawingArea), "button_press_event", G_CALLBACK (on_boardDrawingArea_button_press_event), NULL); g_signal_connect (G_OBJECT (boardDrawingArea), "button_release_event", G_CALLBACK (on_boardDrawingArea_button_release_event), NULL); g_signal_connect (G_OBJECT (boardDrawingArea), "motion_notify_event", G_CALLBACK (on_boardDrawingArea_motion_notify_event), NULL); } void update_statusbar (int moves) { // TRANSLATORS: This is the number of moves the player has made. gchar *str = g_strdup_printf (_("Moves: %d"), moves); gtk_label_set_text (statusMovesLabel, str); g_free (str); } /* Session Options */ static const GOptionEntry options[] = { {"x", 'x', 0, G_OPTION_ARG_INT, &session_xpos, N_("X location of window"), N_("X")}, {"y", 'y', 0, G_OPTION_ARG_INT, &session_ypos, N_("Y location of window"), N_("Y")}, {NULL} }; static GamesPreimage * load_image (char *filename) { char *fname; GamesPreimage *preimage; fname = g_build_filename (PKGDATADIR, filename, NULL); if (g_file_test (fname, G_FILE_TEST_EXISTS)) { preimage = games_preimage_new_from_file (fname, NULL); } else { GtkWidget *dialog; dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not find the image:\n" "%s\n\n" "Please check that Peg Solitaire is installed correctly."), fname); gtk_dialog_run (GTK_DIALOG (dialog)); exit (1); } g_free (fname); return preimage; } int main (int argc, char *argv[]) { GOptionContext *context; GError *error = NULL; setlocale (LC_ALL, ""); #ifdef ENABLE_NLS bindtextdomain (PACKAGE, LOCALEDIR); bind_textdomain_codeset (PACKAGE, "UTF-8"); textdomain (PACKAGE); #endif context = g_option_context_new (""); g_option_context_add_main_entries (context, options, PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (!g_option_context_parse (context, &argc, &argv, &error)) { fputs (error->message, stderr); exit (1); } gtk_init (&argc, &argv); // TODO: gtk3: change to gtk_builder_new_from_file (filename) GtkBuilder *builder = gtk_builder_new (); if (!gtk_builder_add_from_file (builder, PKGDATADIR "/pegsolitaire.glade", &error)) { fputs (error->message, stderr); exit (1); } gtk_builder_connect_signals (builder, NULL); pegSolitaireWindow = GTK_WIDGET (gtk_builder_get_object (builder, "pegSolitaireWindow")); pegSolitaireAboutDialog = GTK_ABOUT_DIALOG (gtk_builder_get_object (builder, "pegSolitaireAboutDialog")); gtk_about_dialog_set_version (pegSolitaireAboutDialog, VERSION); statusMessageLabel = GTK_LABEL (gtk_builder_get_object (builder, "statusMessageLabel")); statusMovesLabel = GTK_LABEL (gtk_builder_get_object (builder, "statusMovesLabel")); update_statusbar (0); peg_preimage = load_image ("peg.svg"); hole_preimage = load_image ("hole.svg"); create_boardDrawingArea (); GtkBox *vbox = GTK_BOX (gtk_builder_get_object(builder, "pegSolitaireVBox")); gtk_box_pack_start (vbox, gameframe, TRUE, TRUE, 0); game_new (); if (session_xpos > 0 && session_ypos > 0) gtk_window_move (GTK_WINDOW (pegSolitaireWindow), session_xpos, session_ypos); gtk_widget_show_all (pegSolitaireWindow); if (resize_all_idle_id) g_source_remove (resize_all_idle_id); resize_all_idle_id = g_idle_add ((GSourceFunc) resize_all, NULL); gtk_main (); return 0; } pegsolitaire-0.1.1/src/preimage.c000066400000000000000000000316661322743716100167460ustar00rootroot00000000000000/* Copyright © 2004 Richard Hoelscher Copyright © 2007 Christian Persch 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 library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, see . */ /* Authors: Richard Hoelscher */ /* Cache raster and vector images and render them to a specific size. */ #include #include #include /* For gdkcairo */ #include #include #include "preimage.h" struct _GamesPreimage { GObject parent; gint width; gint height; RsvgHandle *rsvg_handle; cairo_font_options_t *font_options; /* raster pixbuf data */ GdkPixbuf *pixbuf; guint scalable : 1; }; G_DEFINE_TYPE (GamesPreimage, games_preimage, G_TYPE_OBJECT) static void games_preimage_init (GamesPreimage * preimage) { preimage->scalable = FALSE; preimage->width = 0; preimage->height = 0; } static void games_preimage_finalize (GObject * object) { GamesPreimage *preimage = GAMES_PREIMAGE (object); if (preimage->rsvg_handle != NULL) { g_object_unref (preimage->rsvg_handle); } if (preimage->font_options) { cairo_font_options_destroy (preimage->font_options); } if (preimage->pixbuf != NULL) { g_object_unref (preimage->pixbuf); } G_OBJECT_CLASS (games_preimage_parent_class)->finalize (object); } static void games_preimage_class_init (GamesPreimageClass * klass) { GObjectClass *oclass = G_OBJECT_CLASS (klass); oclass->finalize = games_preimage_finalize; } /** * games_preimage_render: * @preimage: the image to render * @width: the desired width * @height: the desired height * * Creates a #GdkPixbuf from @preimage's image at the specified * @width and @height. * * Returns: (transfer full): the new #GdkPixbuf **/ GdkPixbuf * games_preimage_render (GamesPreimage * preimage, gint width, gint height) { GdkPixbuf *pixbuf; g_return_val_if_fail (width > 0 && height > 0, NULL); g_return_val_if_fail (preimage != NULL, NULL); if (preimage->scalable) { /* Render vector image */ pixbuf = games_preimage_render_sub (preimage, NULL, width, height, 0.0, 0.0, ((double) width) / ((double) preimage->width), ((double) height) / ((double) preimage->height)); } else { /* Render raster image */ pixbuf = gdk_pixbuf_scale_simple (preimage->pixbuf, width, height, GDK_INTERP_BILINEAR); } return pixbuf; } /** * games_preimage_render_cairo: * @preimage: * @cr: * @width: the desired width * @height: the desired height * * Renders from @preimage's image at the specified * @width and @height to @cr. **/ void games_preimage_render_cairo (GamesPreimage * preimage, cairo_t *cr, gint width, gint height) { g_return_if_fail (width > 0 && height > 0); g_return_if_fail (preimage != NULL); if (preimage->scalable) { /* Render vector image */ games_preimage_render_cairo_sub (preimage, cr, NULL, width, height, 0.0, 0.0, ((double) width) / ((double) preimage->width), ((double) height) / ((double) preimage->height)); } else { GdkPixbuf *pixbuf; /* FIXMEchpe: we don't really need this fallback anymore */ /* Render raster image */ pixbuf = gdk_pixbuf_scale_simple (preimage->pixbuf, width, height, GDK_INTERP_BILINEAR); cairo_save (cr); gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); cairo_paint (cr); cairo_restore (cr); g_object_unref (pixbuf); } } /* This routine is copied from librsvg: Copyright © 2005 Dom Lachowicz Copyright © 2005 Caleb Moore Copyright © 2005 Red Hat, Inc. */ static void cairo_pixels_to_pixbuf (guint8 * pixels, int rowstride, int height) { int row; /* un-premultiply data */ for (row = 0; row < height; row++) { guint8 *row_data = (pixels + (row * rowstride)); int i; for (i = 0; i < rowstride; i += 4) { guint8 *b = &row_data[i]; guint32 pixel; guint8 alpha; memcpy (&pixel, b, sizeof (guint32)); alpha = (pixel & 0xff000000) >> 24; if (alpha == 0) { b[0] = b[1] = b[2] = b[3] = 0; } else { b[0] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha; b[1] = (((pixel & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha; b[2] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha; b[3] = alpha; } } } } /** * games_preimage_render_cairo_sub: * @preimage: * @cr: * @node: a SVG node ID (starting with "#"), or %NULL * @width: the width of the clip region * @height: the height of the clip region * @xoffset: the x offset of the clip region * @yoffset: the y offset of the clip region * @xzoom: the x zoom factor * @yzoom: the y zoom factor * * Creates a #GdkPixbuf with the dimensions @width by @height, * and renders the subimage of @preimage specified by @node to it, * transformed by @xzoom, @yzoom and offset by @xoffset and @yoffset, * clipped to @width and @height. * If @node is NULL, the whole image is rendered into tha clip region. * * Returns: %TRUE, of %FALSE if there was an error or @preimage * isn't a scalable SVG image **/ void games_preimage_render_cairo_sub (GamesPreimage * preimage, cairo_t *cr, const char *node, int width, int height, double xoffset, double yoffset, double xzoom, double yzoom) { cairo_matrix_t matrix; if (!preimage->scalable) return; if (preimage->font_options) { cairo_set_antialias (cr, cairo_font_options_get_antialias (preimage->font_options)); cairo_set_font_options (cr, preimage->font_options); } cairo_matrix_init_identity (&matrix); cairo_matrix_scale (&matrix, xzoom, yzoom); cairo_matrix_translate (&matrix, xoffset, yoffset); cairo_set_matrix (cr, &matrix); rsvg_handle_render_cairo_sub (preimage->rsvg_handle, cr, node); } /** * games_preimage_render_sub: * @preimage: * @node: a SVG node ID (starting with "#"), or %NULL * @width: the width of the clip region * @height: the height of the clip region * @xoffset: the x offset of the clip region * @yoffset: the y offset of the clip region * @xzoom: the x zoom factor * @yzoom: the y zoom factor * * Creates a #GdkPixbuf with the dimensions @width by @height, * and renders the subimage of @preimage specified by @node to it, * transformed by @xzoom, @yzoom and offset by @xoffset and @yoffset, * clipped to @width and @height. * If @node is NULL, the whole image is rendered into tha clip region. * * Returns: (transfer full) (allow-none): a new #GdkPixbuf, or %NULL if there was an error or @preimage * isn't a scalable SVG image */ GdkPixbuf * games_preimage_render_sub (GamesPreimage * preimage, const char *node, int width, int height, double xoffset, double yoffset, double xzoom, double yzoom) { int rowstride; guint8 *data; cairo_surface_t *surface; cairo_t *cr; if (!preimage->scalable) return NULL; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE (1, 6, 0) rowstride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width); #else rowstride = width * 4; #endif data = g_try_malloc0 (rowstride * height); if (!data) return NULL; surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32, width, height, rowstride); cr = cairo_create (surface); games_preimage_render_cairo_sub (preimage, cr, node, width, height, xoffset, yoffset, xzoom, yzoom); cairo_destroy (cr); cairo_surface_destroy (surface); cairo_pixels_to_pixbuf (data, rowstride, height); return gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, TRUE, 8, width, height, rowstride, (GdkPixbufDestroyNotify) g_free, data); } /** * games_preimage_new_from_file: * @filename: * @error: a location for a #GError * * Creates a new #GamesPreimage from the image in @filename. * * Returns: (allow-none): a new #GamesPreimage, or %NULL if there was an error */ GamesPreimage * games_preimage_new_from_file (const gchar * filename, GError ** error) { GamesPreimage *preimage; GdkPixbuf *pixbuf; g_return_val_if_fail (filename != NULL, NULL); preimage = g_object_new (GAMES_TYPE_PREIMAGE, NULL); preimage->rsvg_handle = rsvg_handle_new_from_file (filename, NULL); if (preimage->rsvg_handle) { RsvgDimensionData data; preimage->scalable = TRUE; rsvg_handle_get_dimensions (preimage->rsvg_handle, &data); if (data.width == 0 || data.height == 0) { g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, "Image has zero extent"); g_object_unref (preimage); return NULL; } preimage->width = data.width; preimage->height = data.height; return preimage; } /* Not an SVG */ preimage->scalable = FALSE; pixbuf = gdk_pixbuf_new_from_file (filename, error); if (!pixbuf) { g_object_unref (preimage); return NULL; } preimage->pixbuf = pixbuf; preimage->width = gdk_pixbuf_get_width (pixbuf); preimage->height = gdk_pixbuf_get_height (pixbuf); return preimage; } /** * games_preimage_set_font_options: * @preimage: a #GamesPreimage * @font_options: the font options * * Turns on antialising of @preimage, if it contains an SVG image. */ void games_preimage_set_font_options (GamesPreimage * preimage, const cairo_font_options_t * font_options) { g_return_if_fail (GAMES_IS_PREIMAGE (preimage)); if (preimage->font_options) { cairo_font_options_destroy (preimage->font_options); } if (font_options) { preimage->font_options = cairo_font_options_copy (font_options); } else { preimage->font_options = NULL; } } /** * games_preimage_is_scalable: * @preimage: * * Returns: %TRUE iff @preimage contains an SVG image */ gboolean games_preimage_is_scalable (GamesPreimage * preimage) { g_return_val_if_fail (GAMES_IS_PREIMAGE (preimage), FALSE); return preimage->scalable; } /** * games_preimage_get_width: * @preimage: * * Returns: the natural width of the image in @preimage */ gint games_preimage_get_width (GamesPreimage * preimage) { g_return_val_if_fail (GAMES_IS_PREIMAGE (preimage), 0); return preimage->width; } /** * games_preimage_get_height: * @preimage: * * Returns: the natural height of the image in @preimage */ gint games_preimage_get_height (GamesPreimage * preimage) { g_return_val_if_fail (GAMES_IS_PREIMAGE (preimage), 0); return preimage->height; } /** * games_preimage_render_unscaled_pixbuf: * @preimage: * * Renders @preimage onto a new #GdkPixbuf at its natural size * * Returns: (transfer full) (allow-none): a reference to a #GdkPixbuf possibly owned by @images which * you must not modify; or %NULL if there was an error */ GdkPixbuf * games_preimage_render_unscaled_pixbuf (GamesPreimage * preimage) { GdkPixbuf *unscaled_pixbuf; g_return_val_if_fail (GAMES_IS_PREIMAGE (preimage), NULL); if ((unscaled_pixbuf = preimage->pixbuf)) { g_object_ref (unscaled_pixbuf); } else { unscaled_pixbuf = games_preimage_render (preimage, preimage->width, preimage->height); } return unscaled_pixbuf; } pegsolitaire-0.1.1/src/preimage.h000066400000000000000000000067741322743716100167550ustar00rootroot00000000000000/* Copyright © 2004 Richard Hoelscher 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 library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, see . */ /* Authors: Richard Hoelscher */ /* Cache raster and vector images and render them to a specific size. */ #ifndef GAMES_PREIMAGE_H #define GAMES_PREIMAGE_H #include #include #include G_BEGIN_DECLS #define GAMES_TYPE_PREIMAGE (games_preimage_get_type ()) #define GAMES_PREIMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GAMES_TYPE_PREIMAGE, GamesPreimage)) #define GAMES_PREIMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PREIMAGE, GamesPreimageClass)) #define GAMES_IS_PREIMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREIMAGE)) #define GAMES_IS_PREIMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREIMAGE)) #define GAMES_GET_PREIMAGE_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREIMAGE, GamesPreimageClass)) typedef struct _GamesPreimage GamesPreimage; typedef struct { GObjectClass parent_class; } GamesPreimageClass; GType games_preimage_get_type (void); GamesPreimage *games_preimage_new (void); GamesPreimage *games_preimage_new_from_file (const gchar * filename, GError ** error); void games_preimage_set_font_options (GamesPreimage * preimage, const cairo_font_options_t *font_options); GdkPixbuf *games_preimage_render (GamesPreimage * preimage, gint width, gint height); void games_preimage_render_cairo (GamesPreimage * preimage, cairo_t *cr, gint width, gint height); GdkPixbuf *games_preimage_render_sub (GamesPreimage * preimage, const char *node, int width, int height, double xoffset, double yoffset, double xzoom, double yzoom); void games_preimage_render_cairo_sub (GamesPreimage * preimage, cairo_t *cr, const char *node, int width, int height, double xoffset, double yoffset, double xzoom, double yzoom); gboolean games_preimage_is_scalable (GamesPreimage * preimage); gint games_preimage_get_width (GamesPreimage * preimage); gint games_preimage_get_height (GamesPreimage * preimage); GdkPixbuf *games_preimage_render_unscaled_pixbuf (GamesPreimage * preimage); G_END_DECLS #endif /* GAMES_PREIMAGE_H */ pegsolitaire-0.1.1/src/share.h000066400000000000000000000030671322743716100162560ustar00rootroot00000000000000/* share.h: Global variables of pegsolitaire. * Copyright (C) 2018 Juhani Numminen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef PEGSOLITAIRE_SHARE_H #define PEGSOLITAIRE_SHARE_H #include #include "preimage.h" // defined in main.c extern GtkWidget *pegSolitaireWindow; extern GtkAboutDialog *pegSolitaireAboutDialog; extern GtkWidget *gameframe; extern GtkWidget *boardDrawingArea; extern GtkLabel *statusMessageLabel; extern GdkPixmap *board_pixmap; extern gint tile_size, prior_tile_size; extern gint width, height; extern guint redraw_all_idle_id; extern guint resize_all_idle_id; extern gboolean clear_game; extern gboolean clear_buffer; extern gint piece_x; extern gint piece_y; extern gint button_down; extern GamesPreimage *peg_preimage; extern GamesPreimage *hole_preimage; extern GdkPixbuf *peg_pixbuf; extern GdkPixbuf *hole_pixbuf; #endif // PEGSOLITAIRE_SHARE_H