diff options
author | Jesusaves <cpntb1@ymail.com> | 2022-02-22 07:08:17 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2022-02-22 07:08:17 -0300 |
commit | a0c410d5ac8eeeeb4d7295c8f54931fa32664f4d (patch) | |
tree | 1821ec50b19076053286f2f201cad329a6e4f11c | |
parent | 5dc3e3a98f406a2bdd827fe62821066263c9ab1a (diff) | |
download | tools-a0c410d5ac8eeeeb4d7295c8f54931fa32664f4d.tar.gz tools-a0c410d5ac8eeeeb4d7295c8f54931fa32664f4d.tar.bz2 tools-a0c410d5ac8eeeeb4d7295c8f54931fa32664f4d.tar.xz tools-a0c410d5ac8eeeeb4d7295c8f54931fa32664f4d.zip |
Remove saedit
-rw-r--r-- | saedit/COPYING | 340 | ||||
-rw-r--r-- | saedit/Makefile | 33 | ||||
-rwxr-xr-x | saedit/bmake | 28 | ||||
-rw-r--r-- | saedit/common.h | 24 | ||||
-rw-r--r-- | saedit/config.c | 82 | ||||
-rw-r--r-- | saedit/config.h | 51 | ||||
-rw-r--r-- | saedit/grounds/earth.png | bin | 4193 -> 0 bytes | |||
-rw-r--r-- | saedit/grounds/grass.png | bin | 5142 -> 0 bytes | |||
-rw-r--r-- | saedit/grounds/sand.png | bin | 5205 -> 0 bytes | |||
-rw-r--r-- | saedit/grounds/water.png | bin | 7945 -> 0 bytes | |||
-rw-r--r-- | saedit/icon.svg | 654 | ||||
-rw-r--r-- | saedit/interface.c | 124 | ||||
-rw-r--r-- | saedit/interface.ui | 852 | ||||
-rw-r--r-- | saedit/main.c | 609 | ||||
-rw-r--r-- | saedit/main.h | 119 | ||||
-rw-r--r-- | saedit/sae.c | 212 | ||||
-rw-r--r-- | saedit/sae.h | 69 | ||||
-rw-r--r-- | saedit/search.c | 74 | ||||
-rw-r--r-- | saedit/search.h | 26 | ||||
-rw-r--r-- | saedit/template.xml | 6 | ||||
-rwxr-xr-x | saedit/valg | 2 | ||||
-rw-r--r-- | saedit/xml.c | 316 | ||||
-rw-r--r-- | saedit/xml.h | 42 |
23 files changed, 0 insertions, 3663 deletions
diff --git a/saedit/COPYING b/saedit/COPYING deleted file mode 100644 index e8b00c2..0000000 --- a/saedit/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/saedit/Makefile b/saedit/Makefile deleted file mode 100644 index 8d033f3..0000000 --- a/saedit/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -ifndef CFLAGS - CFLAGS = -O2 -pipe -endif - -ifndef LDFLAGS - LDFLAGS = -endif - -ifndef OUTPUT - OUTPUT = saedit -endif - -LDFLAGS += -export-dynamic - -CFLAGS += `pkg-config --cflags gtk+-3.0 gtksourceview-3.0` - -LDFLAGS += `pkg-config --libs gtk+-3.0 gtksourceview-3.0` - -all:main.o search.o config.o xml.o sae.o compile clean -compile: main.o search.o config.o xml.o - gcc ${CFLAGS} -o '${OUTPUT}' main.o search.o config.o xml.o sae.o ${LDFLAGS} -main.o: main.c main.h search.h config.h common.h xml.h - gcc ${CFLAGS}-c -o main.o main.c -search.o: search.c search.h common.h - gcc ${CFLAGS} -c -o search.o search.c -xml.o: xml.c xml.h common.h - gcc ${CFLAGS} -c -o xml.o xml.c -config.o: config.c config.h common.h - gcc ${CFLAGS} -c -o config.o config.c -sae.o: sae.c sae.h common.h - gcc ${CFLAGS} -c -o sae.o sae.c -clean: - rm -rfv *.o *~ diff --git a/saedit/bmake b/saedit/bmake deleted file mode 100755 index a1ecd7f..0000000 --- a/saedit/bmake +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -dir=`pwd` - -export LANG=C - -make clean - -#export CFLAGS="-std=c99 -Wvariadic-macros -Wvla -Wredundant-decls - -export CFLAGS="-std=gnu99 -Wvariadic-macros -Wvla -Wredundant-decls \ --Wpacked-bitfield-compat -Wtrampolines \ --Wsuggest-attribute=noreturn -Wstrict-aliasing=2 \ --fstrict-aliasing -Wunreachable-code -Wabi -Wdisabled-optimization \ --Wvolatile-register-var -Winvalid-pch -Wredundant-decls \ --Wnormalized=nfkc -Wmissing-format-attribute -Wmissing-noreturn \ --Wswitch-default -Waddress \ --Wlogical-op -Wcast-align -Wpointer-arith -Wundef \ --Wmissing-include-dirs -Winit-self -pedantic -Wall -ggdb3 -O2 -pipe \ --Wpacked -Wstrict-overflow=1 -Wunknown-pragmas -Wwrite-strings \ --Wstack-protector -Wshadow -Wunused-macros \ --Wbuiltin-macro-redefined -Wdeprecated \ --Wendif-labels -Wformat=1 -Wimport -Wpsabi \ --Wmissing-field-initializers -Wuninitialized \ --Wignored-qualifiers -Winit-self -Wempty-body -Wclobbered -Wtype-limits \ --Wsign-compare -Wwrite-strings" - -make 2>make.log diff --git a/saedit/common.h b/saedit/common.h deleted file mode 100644 index 21e6526..0000000 --- a/saedit/common.h +++ /dev/null @@ -1,24 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#ifndef COMMON_H -#define COMMON_H - -#include <glib/gi18n.h> - -#define POSTFIX_FOLDER "..." -#define SEPARATOR_SLASH "/" -#define GRID_SIZE 32 -#define SPRITE_WIDTH_DEFAULT 64 -#define SPRITE_HEIGHT_DEFAULT 64 -#define FILE_TEMPLATE "template.xml" - -#endif diff --git a/saedit/config.c b/saedit/config.c deleted file mode 100644 index 67bb63d..0000000 --- a/saedit/config.c +++ /dev/null @@ -1,82 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#include "config.h" - -Options *config_options_new() { - return g_new0(Options, 1); -} - -void config_options_load_from_file(Options *options, - gchar *file, - gchar *data_folder) { - options->sprites = NULL; - - XMLNode *node = xml_parse_file(file); - - if (node != NULL) { - GList *list = node->sub_nodes; - while (TRUE) { - list = g_list_find_custom(list, "option", xml_node_compare_with_name_func); - if (list == NULL) - break; - gchar *name_attr = xml_node_get_attr_value(list->data, "name"); - if (name_attr != NULL) { - if (g_strcmp0(name_attr, "sprites") == 0) - options->sprites = xml_node_get_attr_value(list->data, "value"); - } - list = list->next; - } - } - - if (options->sprites == NULL) options->sprites = (gchar *)OPTION_SPRITES_DEFAULT; - options->sprites = g_strjoin(SEPARATOR_SLASH, data_folder, options->sprites, NULL); -} - -Keys *config_keys_new() { - Keys *keys = g_new0(Keys, 1); - keys->clientdata_folder = (gchar *)KEY_CLIENTDATA_FOLDER_DEFAULT; - keys->show_grid = KEY_SHOW_GRID_DEFAULT; - return keys; -} - -void config_keys_save(Keys *keys) { - GKeyFile *key_file = g_key_file_new(); - g_key_file_set_value(key_file, "General", "ClientdataFolder", - g_strjoin(SEPARATOR_SLASH, - keys->clientdata_folder, - POSTFIX_FOLDER, - NULL)); - g_key_file_set_boolean(key_file, "General", "ShowGrid", keys->show_grid); - - mkdir(KEYS_CONFIG_DIR, S_IRWXU); - int fd = g_creat(KEYS_CONFIG_FILE, S_IREAD | S_IWRITE); - gchar *buf = g_key_file_to_data(key_file, NULL, NULL); - write(fd, buf, strlen(buf)); - close(fd); - - g_key_file_free(key_file); -} - -void config_keys_load(Keys *keys) { - GKeyFile *key_file = g_key_file_new(); - - g_key_file_load_from_file(key_file, - KEYS_CONFIG_FILE, - 0, - NULL); - if (g_key_file_has_key(key_file, "General", "ClientdataFolder", NULL)) - keys->clientdata_folder = g_key_file_get_value(key_file, "General", "ClientdataFolder", NULL); - if (g_key_file_has_key(key_file, "General", "ShowGrid", NULL)) - keys->show_grid = g_key_file_get_boolean(key_file, "General", "ShowGrid", NULL); - - g_key_file_free(key_file); -} diff --git a/saedit/config.h b/saedit/config.h deleted file mode 100644 index ca43eed..0000000 --- a/saedit/config.h +++ /dev/null @@ -1,51 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include <glib.h> -#include <glib/gstdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <string.h> -#include <unistd.h> -#include "common.h" -#include "xml.h" - -#define OPTION_SPRITES_DEFAULT "graphics/sprites/" - -#define KEY_SHOW_GRID_DEFAULT TRUE -#define KEY_CLIENTDATA_FOLDER_DEFAULT "" -#define KEYS_CONFIG_DIR g_strjoin(SEPARATOR_SLASH, g_get_user_config_dir(), "saedit", NULL) -#define KEYS_CONFIG_FILE g_strjoin(SEPARATOR_SLASH, KEYS_CONFIG_DIR, "config.ini", NULL) - -typedef struct { - gchar *sprites; -} Options; - -Options *config_options_new(); -void config_options_load_from_file(Options *options, - gchar *file, - gchar *data_folder); - -typedef struct { - gchar *clientdata_folder; - gboolean show_grid; -} Keys; - -Keys *config_keys_new(); -void config_keys_load(Keys *keys); -void config_keys_save(Keys *keys); - -#endif diff --git a/saedit/grounds/earth.png b/saedit/grounds/earth.png Binary files differdeleted file mode 100644 index 9bdb25a..0000000 --- a/saedit/grounds/earth.png +++ /dev/null diff --git a/saedit/grounds/grass.png b/saedit/grounds/grass.png Binary files differdeleted file mode 100644 index a0f3ab5..0000000 --- a/saedit/grounds/grass.png +++ /dev/null diff --git a/saedit/grounds/sand.png b/saedit/grounds/sand.png Binary files differdeleted file mode 100644 index 31be5db..0000000 --- a/saedit/grounds/sand.png +++ /dev/null diff --git a/saedit/grounds/water.png b/saedit/grounds/water.png Binary files differdeleted file mode 100644 index 20da6b4..0000000 --- a/saedit/grounds/water.png +++ /dev/null diff --git a/saedit/icon.svg b/saedit/icon.svg deleted file mode 100644 index 6a3bf35..0000000 --- a/saedit/icon.svg +++ /dev/null @@ -1,654 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="256" - height="256" - id="svg2" - version="1.1" - inkscape:version="0.48.2 r9819" - sodipodi:docname="icon.svg"> - <defs - id="defs4"> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(0.2400412,0,0,1.0091871,-59.607089,50.7501)" - gradientUnits="userSpaceOnUse" - id="linearGradient2980" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(1.2809327,0,0,1.0091871,-753.11664,-9.2499)" - gradientUnits="userSpaceOnUse" - id="linearGradient2978" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,22.460937,-1381.7662)" - gradientUnits="userSpaceOnUse" - id="radialGradient2976" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientTransform="translate(22.460937,0.5)" - gradientUnits="userSpaceOnUse" - id="linearGradient2974" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient2972" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient2970" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient2968" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient2966" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient2964" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient2962" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient2960" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient2958" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient2956" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient2954" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient2952" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient2950" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient2948" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient2946" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(0.3012701,0,0,1.0091871,209.77505,50.7501)" - gradientUnits="userSpaceOnUse" - id="linearGradient2944" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(0.1680072,0,0,1.0091871,508.68297,50.7501)" - gradientUnits="userSpaceOnUse" - id="linearGradient2942" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(0.2400412,0,0,1.0091871,-59.607089,50.7501)" - gradientUnits="userSpaceOnUse" - id="linearGradient25734" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(1.2809327,0,0,1.0091871,-753.11664,-9.2499)" - gradientUnits="userSpaceOnUse" - id="linearGradient25732" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,22.460937,-1381.7662)" - gradientUnits="userSpaceOnUse" - id="radialGradient25730" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientTransform="translate(22.460937,0.5)" - gradientUnits="userSpaceOnUse" - id="linearGradient25728" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient25726" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient25724" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient25722" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient25720" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient25718" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient25716" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient25714" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient25712" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient25710" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient25708" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient25706" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient25704" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <radialGradient - r="7.1330748" - fy="469.36499" - fx="506.24673" - cy="471.40497" - cx="508.29752" - gradientTransform="matrix(1,0,0,3.9254336,0,-1382.2662)" - gradientUnits="userSpaceOnUse" - id="radialGradient25702" - xlink:href="#linearGradient4850" - inkscape:collect="always" /> - <linearGradient - y2="502.34891" - x2="480.07483" - y1="443.00705" - x1="480.07483" - gradientUnits="userSpaceOnUse" - id="linearGradient25700" - xlink:href="#linearGradient4800" - inkscape:collect="always" /> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(0.3012701,0,0,1.0091871,209.77505,50.7501)" - gradientUnits="userSpaceOnUse" - id="linearGradient25698" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(0.1680072,0,0,1.0091871,508.68297,50.7501)" - gradientUnits="userSpaceOnUse" - id="linearGradient25696" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <linearGradient - y2="445.16745" - x2="726.91016" - y1="388.45044" - x1="726.91016" - gradientTransform="matrix(0.2400412,0,0,1.0091871,-78.389613,-49.2499)" - gradientUnits="userSpaceOnUse" - id="linearGradient24956" - xlink:href="#linearGradient3164" - inkscape:collect="always" /> - <clipPath - id="clipPath24952" - clipPathUnits="userSpaceOnUse"> - <path - sodipodi:nodetypes="ccscc" - id="path24954" - d="M 75.200062,372.5 L 145.76888,400 C 152.63003,400 158.20638,387.68 158.20638,372.5 C 158.20638,357.32 152.63003,345 145.76888,345 L 75.200062,372.5 z" - style="opacity:1;fill:url(#linearGradient24956);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:36, 12;stroke-dashoffset:0;stroke-opacity:1" /> - </clipPath> - <linearGradient - id="linearGradient3164"> - <stop - style="stop-color:#383838;stop-opacity:1" - offset="0" - id="stop3166" /> - <stop - id="stop3172" - offset="0.05754738" - style="stop-color:#3b3b3b;stop-opacity:1" /> - <stop - style="stop-color:#626463;stop-opacity:1" - offset="0.07978155" - id="stop3174" /> - <stop - id="stop3176" - offset="0.12359595" - style="stop-color:#bfbfbf;stop-opacity:1" /> - <stop - style="stop-color:#808080;stop-opacity:1" - offset="0.18899058" - id="stop3178" /> - <stop - id="stop3180" - offset="0.25765494" - style="stop-color:#e0e0e0;stop-opacity:1" /> - <stop - style="stop-color:#ececec;stop-opacity:1" - offset="0.37405738" - id="stop3182" /> - <stop - id="stop3184" - offset="0.52577293" - style="stop-color:#828282;stop-opacity:1" /> - <stop - style="stop-color:#818181;stop-opacity:1" - offset="0.57285708" - id="stop3186" /> - <stop - id="stop3188" - offset="0.67356479" - style="stop-color:#acacac;stop-opacity:1" /> - <stop - style="stop-color:#bcbcbc;stop-opacity:1" - offset="0.73765153" - id="stop3190" /> - <stop - id="stop3192" - offset="0.86451715" - style="stop-color:#505050;stop-opacity:1" /> - <stop - style="stop-color:#333333;stop-opacity:1" - offset="0.90767759" - id="stop3194" /> - <stop - id="stop3196" - offset="0.96260905" - style="stop-color:#7a7a7c;stop-opacity:1" /> - <stop - style="stop-color:#c9c6c1;stop-opacity:1" - offset="1" - id="stop3168" /> - </linearGradient> - <linearGradient - id="linearGradient4800"> - <stop - id="stop4802" - offset="0" - style="stop-color:#383838;stop-opacity:1" /> - <stop - style="stop-color:#3b3b3b;stop-opacity:1" - offset="0.05754738" - id="stop4804" /> - <stop - id="stop4806" - offset="0.07978155" - style="stop-color:#626463;stop-opacity:1" /> - <stop - style="stop-color:#bfbfbf;stop-opacity:1" - offset="0.12359595" - id="stop4808" /> - <stop - id="stop4810" - offset="0.18899058" - style="stop-color:#808080;stop-opacity:1" /> - <stop - style="stop-color:#e0e0e0;stop-opacity:1" - offset="0.25765494" - id="stop4812" /> - <stop - id="stop4814" - offset="0.37405738" - style="stop-color:#ececec;stop-opacity:1" /> - <stop - style="stop-color:#828282;stop-opacity:1" - offset="0.52577293" - id="stop4816" /> - <stop - id="stop4818" - offset="0.57285708" - style="stop-color:#818181;stop-opacity:1" /> - <stop - style="stop-color:#acacac;stop-opacity:1" - offset="0.67356479" - id="stop4820" /> - <stop - id="stop4822" - offset="0.73765153" - style="stop-color:#bcbcbc;stop-opacity:1" /> - <stop - style="stop-color:#505050;stop-opacity:1" - offset="0.86451715" - id="stop4824" /> - <stop - id="stop4826" - offset="0.90767759" - style="stop-color:#333333;stop-opacity:1" /> - <stop - style="stop-color:#7a7a7c;stop-opacity:1" - offset="0.96260905" - id="stop4828" /> - <stop - id="stop4830" - offset="1" - style="stop-color:#c9c6c1;stop-opacity:1" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - id="linearGradient4850"> - <stop - style="stop-color:#ffffff;stop-opacity:1;" - offset="0" - id="stop4852" /> - <stop - style="stop-color:#ffffff;stop-opacity:0;" - offset="1" - id="stop4854" /> - </linearGradient> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="1" - inkscape:cx="-79.999984" - inkscape:cy="276.83172" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:window-width="1680" - inkscape:window-height="1001" - inkscape:window-x="0" - inkscape:window-y="20" - inkscape:window-maximized="1" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(0,-796.36209)"> - <g - transform="translate(0,796.36209)" - style="font-size:40px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Charter" - id="text3080" /> - <g - id="g3107" - transform="matrix(5.7032977,0,0,5.7032977,-463.19349,-3989.5514)" - style="fill:#800000"> - <g - transform="translate(-0.55621842,0.00758253)" - id="text3086" - style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#800000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans"> - <path - inkscape:connector-curvature="0" - id="path3105" - style="fill:#800000;font-family:Sans;-inkscape-font-specification:Sans" - d="m 110.87616,841.71545 0,3.39844 c -1.01564,-0.52081 -2.07033,-0.91144 -3.16406,-1.17187 -1.09377,-0.2604 -2.22658,-0.39061 -3.39844,-0.39063 -1.78386,2e-5 -3.12501,0.27346 -4.02344,0.82031 -0.885421,0.5469 -1.328129,1.36721 -1.328123,2.46094 -6e-6,0.83335 0.319004,1.4909 0.957031,1.97266 0.638012,0.46876 1.920562,0.91798 3.847652,1.34765 l 1.23047,0.27344 c 2.55207,0.54689 4.36197,1.32163 5.42969,2.32422 1.08071,0.98959 1.62108,2.37631 1.62109,4.16016 -1e-5,2.03125 -0.80731,3.63932 -2.42187,4.82422 -1.60158,1.18489 -3.80861,1.77734 -6.62109,1.77734 -1.17189,0 -2.39584,-0.11719 -3.671879,-0.35156 -1.263026,-0.22136 -2.59766,-0.5599 -4.003906,-1.01563 l 0,-3.71094 c 1.328121,0.69011 2.636714,1.21094 3.925781,1.5625 1.289054,0.33855 2.565094,0.50782 3.828124,0.50782 1.6927,0 2.99478,-0.28646 3.90625,-0.85938 0.91144,-0.58593 1.36717,-1.40624 1.36719,-2.46094 -2e-5,-0.97655 -0.33205,-1.72525 -0.9961,-2.24609 -0.65105,-0.52082 -2.08985,-1.02213 -4.3164,-1.50391 l -1.25,-0.29296 c -2.22657,-0.46874 -3.834642,-1.18489 -4.82422,-2.14844 -0.989586,-0.97655 -1.484378,-2.31119 -1.484375,-4.00391 -3e-6,-2.05727 0.729163,-3.64581 2.1875,-4.76562 1.458327,-1.11977 3.528635,-1.67967 6.210935,-1.67969 1.32812,2e-5 2.57811,0.0977 3.75,0.29297 1.17186,0.19533 2.25259,0.4883 3.24219,0.8789" /> - </g> - <g - id="text3090" - style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#800000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans"> - <path - id="path3102" - style="fill:#800000;font-family:Sans;-inkscape-font-specification:Sans" - d="m 97.149544,871.06958 c -2.903657,10e-6 -4.915374,0.33204 -6.035156,0.99609 -1.119799,0.66408 -1.679694,1.79689 -1.679688,3.39844 -6e-6,1.27605 0.41666,2.29167 1.25,3.04688 0.846346,0.74219 1.992178,1.11328 3.4375,1.11328 1.992175,0 3.587225,-0.70312 4.785156,-2.10938 1.210924,-1.41926 1.816394,-3.30077 1.816404,-5.64453 l 0,-0.80078 -3.574216,0 m 7.167966,-1.48437 0,12.48046 -3.59375,0 0,-3.32031 c -0.820326,1.32813 -1.842461,2.3112 -3.066404,2.94922 -1.223971,0.625 -2.721365,0.9375 -4.492187,0.9375 -2.239591,0 -4.023443,-0.625 -5.351563,-1.875 -1.315107,-1.26302 -1.972658,-2.94921 -1.972656,-5.05859 -2e-6,-2.46093 0.820309,-4.3164 2.460938,-5.56641 1.653639,-1.24999 4.114574,-1.87499 7.382812,-1.875 l 5.03906,0 0,-0.35156 c -1e-5,-1.65363 -0.54689,-2.92967 -1.640622,-3.82813 -1.080744,-0.91144 -2.60418,-1.36717 -4.570313,-1.36718 -1.25001,1e-5 -2.467457,0.14975 -3.652344,0.44921 -1.184902,0.2995 -2.324224,0.74872 -3.417968,1.34766 l 0,-3.32031 c 1.315098,-0.50779 2.591139,-0.8854 3.828125,-1.13281 1.23697,-0.2604 2.441395,-0.39061 3.613281,-0.39063 3.164048,2e-5 5.527331,0.82033 7.089841,2.46094 1.56248,1.64064 2.34373,4.12762 2.34375,7.46094" - inkscape:connector-curvature="0" /> - </g> - <g - id="text3094" - style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#800000;fill-opacity:1;stroke:none;font-family:Cantarell;-inkscape-font-specification:Sans" - transform="translate(0,796.36209)"> - <path - id="path3099" - style="fill:#800000;font-family:Sans;-inkscape-font-specification:Sans" - d="m 121.47542,73.044228 0,1.757812 -16.52344,0 c 0.15624,2.473966 0.89843,4.361985 2.22656,5.664063 1.34114,1.289065 3.20312,1.933596 5.58594,1.933593 1.38019,3e-6 2.71483,-0.169268 4.00391,-0.507812 1.30206,-0.338538 2.59112,-0.84635 3.86718,-1.523438 l 0,3.398438 c -1.28908,0.546875 -2.61069,0.963542 -3.96484,1.25 -1.35418,0.286458 -2.72788,0.429687 -4.12109,0.429687 -3.4896,0 -6.25652,-1.015624 -8.30078,-3.046875 -2.03126,-2.031245 -3.04688,-4.778638 -3.04688,-8.242187 0,-3.580715 0.96354,-6.419254 2.89063,-8.515625 1.94009,-2.109354 4.55077,-3.16404 7.83203,-3.164063 2.94269,2.3e-5 5.26691,0.950543 6.97265,2.851563 1.71873,1.888038 2.57811,4.45965 2.57813,7.714844 m -3.59375,-1.054688 c -0.0261,-1.966131 -0.57945,-3.53514 -1.66016,-4.707031 -1.06772,-1.171856 -2.48699,-1.757793 -4.25781,-1.757813 -2.00522,2e-5 -3.61329,0.566425 -4.82422,1.699219 -1.19792,1.132829 -1.88803,2.72788 -2.07031,4.785156 l 12.8125,-0.01953" - inkscape:connector-curvature="0" /> - </g> - </g> - </g> -</svg> diff --git a/saedit/interface.c b/saedit/interface.c deleted file mode 100644 index 0984cbd..0000000 --- a/saedit/interface.c +++ /dev/null @@ -1,124 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -GtkWidget *reload_menu_item = NULL; -GtkWidget *find_dialog = NULL; -GtkWidget *toolbar = NULL; - -void find_menu_item_activate_callback(GtkWidget *menuitem, gpointer user_data) { - gtk_dialog_run(GTK_DIALOG(find_dialog)); -} - -void save_dialog_response_callback(GtkWidget *dialog, gint response_id, gpointer user_data) { - if (response_id == GTK_RESPONSE_ACCEPT) { - gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); - if (filename != NULL) { - save_to_xml_file(filename); - gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(xml_file_chooser_button), filename); - } - } - gtk_widget_destroy(dialog); -} - -void save_dialog_show() { - GtkDialog *dialog = GTK_DIALOG(gtk_file_chooser_dialog_new(_("Save file as..."), GTK_WINDOW(win), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL)); - g_signal_connect(dialog, "response", G_CALLBACK(save_dialog_response_callback), NULL); - gtk_dialog_run(dialog); -} - -void save_menu_item_activate_callback(GtkWidget *menuitem, GtkWidget *fsdialog) { - gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(xml_file_chooser_button)); - if (filename != NULL) - save_to_xml_file(filename); - else - save_dialog_show(); -} - -void xml_file_save_button_callback(GtkWidget *button, gpointer user_data) { - gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(xml_file_chooser_button)); - if (filename != NULL) - save_to_xml_file(filename); -} - -void file_new() { - GtkTextIter start, end; - gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(source_buffer), &start, &end); - gtk_text_buffer_delete(GTK_TEXT_BUFFER(source_buffer), &start, &end); - gchar *temp; - if (g_file_get_contents(FILE_TEMPLATE, &temp, NULL, NULL)) - gtk_text_buffer_set_text(GTK_TEXT_BUFFER(source_buffer), temp, -1); - gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(xml_file_chooser_button), ""); - gtk_widget_set_sensitive(reload_menu_item, FALSE); - - free_current_info(); -} - -void set_up_interface() { - - GtkBuilder *builder = gtk_builder_new(); - gtk_builder_add_from_file(builder, "interface.ui", NULL); - gtk_builder_connect_signals(builder, NULL); - - //Setup main window - win = GTK_WIDGET(gtk_builder_get_object(builder, "win_main")); - - //Setup GtkSourceView - GtkSourceLanguageManager *langman = gtk_source_language_manager_get_default(); - source_buffer = gtk_source_buffer_new_with_language(gtk_source_language_manager_get_language(langman, "xml")); - - source_view = GTK_WIDGET(gtk_builder_get_object(builder, "source_view")); - gtk_text_view_set_buffer(GTK_TEXT_VIEW(source_view), GTK_TEXT_BUFFER(source_buffer)); - search_init(source_view); - - //Setup GtkScrolledWindow - GtkWidget *scrolled_window = NULL; - scrolled_window = GTK_WIDGET(gtk_builder_get_object(builder, "scrolledwindow1")); - gtk_scrolled_window_set_hadjustment(GTK_SCROLLED_WINDOW(scrolled_window), - gtk_text_view_get_hadjustment(GTK_TEXT_VIEW(source_view))); - gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(scrolled_window), - gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(source_view))); - - //Setup GtkDrawingArea - darea = GTK_WIDGET(gtk_builder_get_object(builder, "darea1")); - - //Setup GtkToolbar - toolbar = GTK_WIDGET(gtk_builder_get_object(builder, "toolbar")); - - reload_menu_item = GTK_WIDGET(gtk_builder_get_object(builder, "menuitem6")); - show_grid_menu_item = GTK_WIDGET(gtk_builder_get_object(builder, "menuitem11")); - imageset_preview_menu_item = GTK_WIDGET(gtk_builder_get_object(builder, "menuitem12")); - - data_folder_chooser_button = GTK_WIDGET(gtk_builder_get_object(builder, "datafcbutton")); - xml_file_chooser_button = GTK_WIDGET(gtk_builder_get_object(builder, "xmlfcbutton")); - xml_file_open_button = GTK_WIDGET(gtk_builder_get_object(builder, "xmlfobutton")); - xml_file_save_button = GTK_WIDGET(gtk_builder_get_object(builder, "xmlfsbutton")); - - gen_sae_info->imagesets_combo_box = GTK_WIDGET(gtk_builder_get_object(builder, "imagesetscbox")); - gen_sae_info->actions_combo_box = GTK_WIDGET(gtk_builder_get_object(builder, "actionscbox")); - gen_sae_info->animations_combo_box = GTK_WIDGET(gtk_builder_get_object(builder, "animationscbox")); - - //Setup GtkAboutDialog - about_dialog = GTK_WIDGET(gtk_builder_get_object(builder, "about_dialog")); - - //Setup GtkMessageDialog - parsing_error_dialog = GTK_WIDGET(gtk_builder_get_object(builder, "parsing-error-dialog")); - - //Setup Find dialog - find_dialog = GTK_WIDGET(gtk_builder_get_object(builder, "find_dialog")); - gtk_widget_hide(find_dialog); - - file_new(); - - gtk_widget_show_all(win); - gtk_widget_show_all(source_view); - - g_object_unref(builder); -} diff --git a/saedit/interface.ui b/saedit/interface.ui deleted file mode 100644 index dc83601..0000000 --- a/saedit/interface.ui +++ /dev/null @@ -1,852 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> -<interface> - <requires lib="gtk+" version="3.2"/> - <requires lib="gtksourceview" version="0.0"/> - <object class="GtkAccelGroup" id="accelgroup"/> - <object class="GtkFileChooserDialog" id="fcdialog1"> - <property name="can_focus">False</property> - <property name="border_width">5</property> - <property name="title" translatable="yes">Open file</property> - <property name="type_hint">dialog</property> - <child internal-child="vbox"> - <object class="GtkBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">2</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="button1"> - <property name="label">gtk-open</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button2"> - <property name="label">gtk-cancel</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - </child> - <action-widgets> - <action-widget response="-3">button1</action-widget> - <action-widget response="0">button2</action-widget> - </action-widgets> - </object> - <object class="GtkWindow" id="win_main"> - <property name="width_request">600</property> - <property name="height_request">600</property> - <property name="can_focus">False</property> - <property name="title" translatable="yes">Sprite Animation Editor</property> - <property name="window_position">center</property> - <property name="default_width">600</property> - <property name="default_height">600</property> - <property name="icon">icon.svg</property> - <signal name="destroy" handler="save_config_and_quit" swapped="no"/> - <child> - <object class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkMenuBar" id="menubar1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkMenuItem" id="menuitem1"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_File</property> - <property name="use_underline">True</property> - <child type="submenu"> - <object class="GtkMenu" id="menu1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="accel_group">accelgroup</property> - <child> - <object class="GtkMenuItem" id="menuitem4"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_New</property> - <property name="use_underline">True</property> - <signal name="activate" handler="file_new" swapped="no"/> - <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem5"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Open...</property> - <property name="use_underline">True</property> - <signal name="activate" handler="open_menu_item_activate_callback" object="fcdialog1" swapped="no"/> - <accelerator key="o" signal="activate" modifiers="GDK_CONTROL_MASK"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem6"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Reload</property> - <property name="use_underline">True</property> - <signal name="activate" handler="open_xml_file" swapped="no"/> - <accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/> - </object> - </child> - <child> - <object class="GtkSeparatorMenuItem" id="menuitem15"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem7"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Save</property> - <property name="use_underline">True</property> - <signal name="activate" handler="save_menu_item_activate_callback" swapped="no"/> - <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem8"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Save _as...</property> - <property name="use_underline">True</property> - <signal name="activate" handler="save_dialog_show" swapped="no"/> - <accelerator key="s" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/> - </object> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem2"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Search</property> - <property name="use_underline">True</property> - <child type="submenu"> - <object class="GtkMenu" id="menu2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkMenuItem" id="menuitem9"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Find...</property> - <property name="use_underline">True</property> - <signal name="activate" handler="find_menu_item_activate_callback" swapped="no"/> - <accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem10"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Find _Next</property> - <property name="use_underline">True</property> - <signal name="activate" handler="search_find_next" swapped="no"/> - <accelerator key="f" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/> - </object> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem3"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_View</property> - <property name="use_underline">True</property> - <child type="submenu"> - <object class="GtkMenu" id="menu3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckMenuItem" id="menuitem11"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Show _Grid</property> - <property name="use_underline">True</property> - <signal name="toggled" handler="show_grid_menu_item_toggled_callback" swapped="no"/> - <accelerator key="g" signal="activate" modifiers="GDK_CONTROL_MASK"/> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem12"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Imageset view</property> - <property name="use_underline">True</property> - <signal name="activate" handler="show_imageset_dialog" swapped="no"/> - <accelerator key="i" signal="activate" modifiers="GDK_CONTROL_MASK"/> - </object> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem13"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Help</property> - <property name="use_underline">True</property> - <child type="submenu"> - <object class="GtkMenu" id="menu4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkMenuItem" id="menuitem14"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_About</property> - <property name="use_underline">True</property> - <signal name="activate" handler="show_about_dialog" swapped="no"/> - </object> - </child> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkVBox" id="vbox4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkLabel" id="label2"> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Clientdata folder</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkFileChooserButton" id="datafcbutton"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action">select-folder</property> - <property name="title" translatable="yes">Clientdata folder</property> - <signal name="selection-changed" handler="data_folder_set_callback" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label1"> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">XML source file</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkFileChooserButton" id="xmlfcbutton"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="local_only">False</property> - <property name="dialog">fcdialog1</property> - <property name="title" translatable="yes">Select XML file</property> - <signal name="file-set" handler="open_xml_file" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="xmlfobutton"> - <property name="label">gtk-open</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="open_xml_file" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkButton" id="xmlfsbutton"> - <property name="label">gtk-save</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="xml_file_save_button_callback" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">5</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button3"> - <property name="label" translatable="yes">Parse XML Buffer</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <signal name="clicked" handler="parse_xml_buffer" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">6</property> - </packing> - </child> - <child> - <object class="GtkSeparator" id="separator1"> - <property name="height_request">30</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">7</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Imagesets</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">8</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="imagesetscbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - <signal name="changed" handler="imagesets_combo_box_changed_callback" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">9</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label4"> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Actions</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">10</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="actionscbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - <signal name="changed" handler="actions_combo_box_changed_callback" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">11</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label5"> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Directions</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">12</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="animationscbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - <signal name="changed" handler="animations_combo_box_changed_callback" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">13</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSeparator" id="separator2"> - <property name="width_request">1</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkVPaned" id="vpaned1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <child> - <object class="GtkVBox" id="vbox2"> - <property name="can_focus">False</property> - <child> - <object class="GtkDrawingArea" id="darea1"> - <property name="height_request">120</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <signal name="draw" handler="darea_draw_event" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkToolbar" id="toolbar"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">False</property> - <child> - <object class="GtkToolButton" id="toolbar-to-first"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">First frame</property> - <property name="use_underline">True</property> - <property name="stock_id">gtk-goto-first</property> - <signal name="clicked" handler="toolbar_to_first_clicked_callback" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="toolbar-prev-frame"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Previous frame</property> - <property name="use_underline">True</property> - <property name="stock_id">gtk-go-back</property> - <signal name="clicked" handler="toolbar_prev_frame_clicked_callback" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="toolbar-play"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Continue sequencing</property> - <property name="use_underline">True</property> - <property name="stock_id">gtk-media-play</property> - <signal name="clicked" handler="toolbar_play_clicked_callback" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="toolbar-pause"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Pause sequencing</property> - <property name="use_underline">True</property> - <property name="stock_id">gtk-media-pause</property> - <signal name="clicked" handler="toolbar_pause_clicked_callback" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="toolbar-next-frame"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Next frame</property> - <property name="use_underline">True</property> - <property name="stock_id">gtk-go-forward</property> - <signal name="clicked" handler="toolbar_next_frame_clicked_callback" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="toolbar-to-last"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Last frame</property> - <property name="use_underline">True</property> - <property name="stock_id">gtk-goto-last</property> - <signal name="clicked" handler="toolbar_to_last_clicked_callback" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="homogeneous">True</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="resize">False</property> - <property name="shrink">True</property> - </packing> - </child> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <child> - <object class="GtkSourceView" id="source_view"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="left_margin">2</property> - <property name="right_margin">2</property> - <property name="show_line_numbers">True</property> - <property name="tab_width">4</property> - <property name="auto_indent">True</property> - <property name="highlight_current_line">True</property> - <property name="indent_on_tab">False</property> - </object> - </child> - </object> - <packing> - <property name="resize">True</property> - <property name="shrink">True</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <object class="GtkAboutDialog" id="about_dialog"> - <property name="can_focus">False</property> - <property name="border_width">5</property> - <property name="window_position">center</property> - <property name="icon">icon.svg</property> - <property name="type_hint">dialog</property> - <property name="transient_for">win_main</property> - <property name="program_name">Sprite Animation Editor</property> - <property name="version">⍺0.1.1</property> - <property name="copyright" translatable="yes">Copyleft ↄ Vasily_Makarov 2011-2015</property> - <property name="comments" translatable="yes">A simple tool to edit eAthena-based XML animation files</property> - <property name="authors">Vasily_Makarov <danilka.pro@gmail.com> -Reid Yaro <reidyaro@gmail.com></property> - <property name="logo">icon.svg</property> - <property name="license_type">gpl-2-0</property> - <child internal-child="vbox"> - <object class="GtkBox" id="dialog-vbox3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">2</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="layout_style">end</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - </child> - </object> - <object class="GtkDialog" id="find_dialog"> - <property name="width_request">240</property> - <property name="height_request">80</property> - <property name="can_focus">False</property> - <property name="border_width">5</property> - <property name="title" translatable="yes">Find</property> - <property name="resizable">False</property> - <property name="type_hint">normal</property> - <property name="skip_taskbar_hint">True</property> - <property name="skip_pager_hint">True</property> - <property name="transient_for">win_main</property> - <signal name="response" handler="search_find_dialog_response_callback" object="find_dialog_entry" swapped="no"/> - <child internal-child="vbox"> - <object class="GtkBox" id="dialog-vbox4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">2</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="button4"> - <property name="label">gtk-find</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button5"> - <property name="label">gtk-cancel</property> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="find_dialog_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - </child> - <action-widgets> - <action-widget response="-3">button4</action-widget> - <action-widget response="-6">button5</action-widget> - </action-widgets> - </object> - <object class="GtkListStore" id="liststore1"> - <columns> - <!-- column-name text --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkListStore" id="liststore2"> - <columns> - <!-- column-name text --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkListStore" id="liststore3"> - <columns> - <!-- column-name text --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkMessageDialog" id="parsing-error-dialog"> - <property name="can_focus">False</property> - <property name="border_width">5</property> - <property name="title" translatable="yes">Parsing error</property> - <property name="type_hint">dialog</property> - <property name="skip_taskbar_hint">True</property> - <property name="skip_pager_hint">True</property> - <property name="message_type">error</property> - <property name="buttons">close</property> - <property name="text" translatable="yes"><b>Bad source buffer!</b></property> - <property name="use_markup">True</property> - <signal name="response" handler="gtk_widget_hide" swapped="no"/> - <child internal-child="vbox"> - <object class="GtkBox" id="messagedialog-vbox"> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">14</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="messagedialog-action_area"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - </object> -</interface> diff --git a/saedit/main.c b/saedit/main.c deleted file mode 100644 index d6c147a..0000000 --- a/saedit/main.c +++ /dev/null @@ -1,609 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#include "main.h" -#include "interface.c" - -//Cairo functions - -cairo_surface_t *get_grid_surface(int w, int h) { - cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (w + 2) * GRID_SIZE, (h + 2) * GRID_SIZE); - cairo_t *cr = cairo_create(surface); - int x, y; - - for (x = 0; x < w; x++) - for (y = 0; y < h; y++) { - gdk_cairo_set_source_pixbuf(cr, gen_sae_info->ground, x * GRID_SIZE, y * GRID_SIZE); - cairo_paint(cr); - } - - if (config->show_grid) { - cairo_surface_t *gridsurf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w * GRID_SIZE + 1, h * GRID_SIZE + 1); - cairo_t *scr = cairo_create(gridsurf); - cairo_set_line_width(scr, 1); - cairo_set_source_rgba(scr, 0.5, 0.5, 0.5, 1); - for (x = 0; x < w; x++) - for (y = 0; y < h; y++) { - cairo_rectangle(scr, x*GRID_SIZE+0.5, y*GRID_SIZE+0.5, GRID_SIZE, GRID_SIZE); - cairo_stroke(scr); - } - cairo_set_source_surface(cr, gridsurf, GRID_SIZE, GRID_SIZE); - cairo_paint(cr); - cairo_destroy(scr); - cairo_surface_destroy(gridsurf); - } - - cairo_destroy(cr); - return surface; -} - -gboolean darea_draw_event(GtkWidget *widget, cairo_t *cr, SAEInfo *sae_info) { - - if (sae_info == NULL) - sae_info = gen_sae_info; - - int width = gtk_widget_get_allocated_width(widget), - height = gtk_widget_get_allocated_height(widget); - - int w = 3, h = 3; - - //cairo_t *cr = gdk_cairo_create(gtk_widget_get_parent_window(widget)); - - cairo_surface_t *surface = get_grid_surface(w, h); - cairo_set_source_surface(cr, surface, width/2 - GRID_SIZE * (w + 2) * 0.5, height/2 - GRID_SIZE * (h + 2) * 0.5); - cairo_paint(cr); - - if (player != NULL) { - GdkPixbuf *pbuf = player->sprite->pixbuf; - if (pbuf == NULL) return FALSE; - gdk_cairo_set_source_pixbuf(cr, pbuf, - width/2 - player->imageset->width/2 + player->offsetX + player->sprite->offsetX + player->imageset->offsetX, - height/2 + GRID_SIZE/2 - player->imageset->height + player->offsetY + player->sprite->offsetY + player->imageset->offsetY); - cairo_paint(cr); - } - - GdkPixbuf *pbuf = sae_info->sprite->pixbuf; - if (pbuf == NULL) return FALSE; - gdk_cairo_set_source_pixbuf(cr, pbuf, - width/2 - sae_info->imageset->width/2 + sae_info->offsetX + sae_info->sprite->offsetX + sae_info->imageset->offsetX, - height/2 +GRID_SIZE/2 - sae_info->imageset->height + sae_info->offsetY + sae_info->sprite->offsetY + sae_info->imageset->offsetY); - cairo_paint(cr); - - cairo_surface_destroy(surface); - return FALSE; -} - -//Common functions - -gchar *markup_bold(gchar *str) { - return g_strconcat("<b>", str, "</b>", NULL); -} - -void format_src_string(gchar *src) { - gchar *str = g_strrstr(src, "|"); - if (str == NULL) return; - strncpy(str, "\0", 1); -} - -GtkTextIter *gtk_source_buffer_highlight_line(GtkSourceBuffer *buffer, int line_number) { - GtkTextIter start; - gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(buffer), &start); - gtk_text_iter_set_line(&start, line_number); - gtk_text_buffer_place_cursor(GTK_TEXT_BUFFER(buffer), &start); - return gtk_text_iter_copy(&start); -} - -//File working - -void open_xml_file(GtkButton *button) { - gtk_widget_set_sensitive(xml_file_open_button, TRUE); - gtk_widget_set_sensitive(reload_menu_item, TRUE); - gchar *buf; - size_t len; - g_file_get_contents(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(xml_file_chooser_button)), &buf, &len, NULL); - if (g_utf8_validate(buf, len, NULL)) { - gtk_text_buffer_set_text(GTK_TEXT_BUFFER(source_buffer), buf, len); - gtk_widget_set_sensitive(xml_file_save_button, TRUE); - } else { - gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(xml_file_chooser_button)); - } - - free_current_info(); -} - -void save_to_xml_file(gchar *filename) { - GtkTextIter start, end; - gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(source_buffer), &start); - gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(source_buffer), &end); - g_file_set_contents(filename, gtk_text_buffer_get_text(GTK_TEXT_BUFFER(source_buffer), &start, &end, TRUE), -1, NULL); -} - -//SAEInfo functions (must be ported to sae.c) - -void free_imagesets(SAEInfo *sae_info) { - free_imageset(sae_info); - sae_info->imagesets = NULL; - gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(sae_info->imagesets_combo_box)))); -} - -void free_imageset(SAEInfo *sae_info) { - sae_info->imageset = imageset_new(); - sae_info->ground = sae_info_ground_new(); - gtk_widget_set_sensitive(imageset_preview_menu_item, FALSE); - gtk_widget_set_sensitive(toolbar, FALSE); -} - -void free_actions(SAEInfo *sae_info) { - sae_info->actions = NULL; - if (sae_info->actions_combo_box != NULL) - gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(sae_info->actions_combo_box)))); -} - -void free_animations(SAEInfo *sae_info) { - sae_info->animations = NULL; - - if (sae_info->animations_combo_box != NULL) - gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(sae_info->animations_combo_box)))); - - kill_timeout(sae_info->anim_tag); - sae_info->anim_tag = 0; - sae_info->sprite = frame_new(-1, 0, 0, 0); - set_sprite_by_index(0, sae_info); -} - -void free_lists(SAEInfo *sae_info) { - free_imagesets(sae_info); - free_actions(sae_info); - free_animations(sae_info); -} - -void free_current_info() { - free_lists(gen_sae_info); - player = NULL; -} - -//Callbacks - -void data_folder_set_callback(GtkFileChooserButton *widget, gpointer data) { - config->clientdata_folder = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(data_folder_chooser_button)); - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(xml_file_chooser_button), gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget))); -} - -void show_grid_menu_item_toggled_callback(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { - config->show_grid = gtk_check_menu_item_get_active(checkmenuitem); - gtk_widget_queue_draw(darea); -} - -void parsing_error_warning(SAEInfo *sae_info, const gchar *message) { - free_lists(sae_info); - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(parsing_error_dialog), "%s", message); - gtk_dialog_run(GTK_DIALOG(parsing_error_dialog)); -} - -void actions_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data) { - if (player != NULL) - set_up_action_by_name(gtk_combo_box_text_get_active_text(widget), player); - set_up_action_by_name(gtk_combo_box_text_get_active_text(widget), gen_sae_info); -} - -void animations_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data) { - set_up_animation_by_direction(gen_sae_info, gtk_combo_box_text_get_active_text(widget)); - if (player != NULL) { - set_up_animation_by_direction(player, gtk_combo_box_text_get_active_text(widget)); - show_animation(player); - } - show_animation(gen_sae_info); -} - -void imagesets_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data) { - if (gtk_combo_box_text_get_active_text(widget) != NULL) - set_up_imageset_by_name(gtk_combo_box_text_get_active_text(widget), gen_sae_info); -} - -gboolean frame_image_button_press_event_callback(GtkWidget *widget, GdkEventButton *button, int idx) { - gchar buf[10]; - gint len = g_sprintf(buf, "%d", idx); - gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(source_buffer), buf, len); - return FALSE; -} - -void open_menu_item_activate_callback(GtkMenuItem *menuitem, GtkFileChooserDialog *fcdialog) { - gtk_dialog_run(GTK_DIALOG(fcdialog)); -} - -//>Toolbar callbacks -void toolbar_to_first_clicked_callback(GtkToolButton *toolbutton, gpointer user_data) { - toolbar_pause_clicked_callback(toolbutton, user_data); - gen_sae_info->animation = g_list_first(gen_sae_info->animation); - show_sprite(gen_sae_info); -} - -void toolbar_prev_frame_clicked_callback(GtkToolButton *toolbutton, gpointer user_data) { - toolbar_pause_clicked_callback(toolbutton, user_data); - GList *prev = g_list_previous(gen_sae_info->animation); - if (prev == NULL) - return; - gen_sae_info->animation = prev; - show_sprite(gen_sae_info); -} - -void toolbar_play_clicked_callback(GtkToolButton *toolbutton, gpointer user_data) { - show_animation(gen_sae_info); -} - -void toolbar_pause_clicked_callback(GtkToolButton *toolbutton, gpointer user_data) { - int tag = gen_sae_info->anim_tag; - if (tag > 0) { - kill_timeout(tag); - GList *prev = g_list_previous(gen_sae_info->animation); - if (prev == NULL) - prev = g_list_last(gen_sae_info->animation); - gen_sae_info->animation = prev; - } - gen_sae_info->anim_tag = 0; -} - -void toolbar_next_frame_clicked_callback(GtkToolButton *toolbutton, gpointer user_data) { - toolbar_pause_clicked_callback(toolbutton, user_data); - GList *next = g_list_next(gen_sae_info->animation); - if (next == NULL) - return; - gen_sae_info->animation = next; - show_sprite(gen_sae_info); -} - -void toolbar_to_last_clicked_callback(GtkToolButton *toolbutton, gpointer user_data) { - toolbar_pause_clicked_callback(toolbutton, user_data); - gen_sae_info->animation = g_list_last(gen_sae_info->animation); - show_sprite(gen_sae_info); -} - -//Dialogs - -void show_about_dialog() { - gtk_dialog_run(GTK_DIALOG(about_dialog)); - gtk_widget_hide(about_dialog); -} - -void show_imageset_dialog() { - if (gen_sae_info->imageset->spriteset == NULL) return; - GtkWidget *dialog = gtk_dialog_new(); - GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); - gtk_window_set_title(GTK_WINDOW(dialog), _("Imageset preview")); - gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(win)); - - int w = gen_sae_info->imageset->spriteset_width / gen_sae_info->imageset->width; - int h = gen_sae_info->imageset->spriteset_height / gen_sae_info->imageset->height; - - GtkWidget *hbox = NULL; - GtkWidget *image = NULL; - GtkWidget *event_box = NULL; - - int x, y; - for (y = 0; y < h; y++) { - hbox = gtk_hbox_new(TRUE, 2); - gtk_box_pack_start(GTK_BOX(content_area), hbox, TRUE, TRUE, 2); - for (x = 0; x < w; x++) { - unsigned long int id = w * y + x; - event_box = gtk_event_box_new(); - g_signal_connect(G_OBJECT(event_box), "button-press-event", G_CALLBACK(frame_image_button_press_event_callback), (gpointer)id); - gtk_box_pack_start(GTK_BOX(hbox), event_box, TRUE, TRUE, 0); - - image = gtk_image_new_from_pixbuf(get_sprite_by_index(w * y + x, gen_sae_info)); - gtk_widget_add_events(image, GDK_BUTTON_PRESS_MASK); - gtk_container_add(GTK_CONTAINER(event_box), image); - } - } - gtk_widget_show_all(dialog); -} - -//Main functions - -void set_sprite_by_index(size_t idx, SAEInfo *sae_info) { - sae_info->sprite->pixbuf = get_sprite_by_index(idx, sae_info); - gtk_widget_queue_draw(darea); -} - -void set_up_actions_by_imageset_name(gchar *imageset_name, SAEInfo *sae_info) { - free_actions(sae_info); - free_animations(sae_info); - GList *_actions_list = NULL; - GList *list = sae_info->root->sub_nodes; - XMLNode *node = NULL; - while (TRUE) { - list = g_list_find_custom(list, imageset_name, xml_node_compare_with_action_node_by_imageset_name_func); - if (list == NULL) - break; - if (_actions_list == NULL) { - _actions_list = g_list_alloc(); - sae_info->actions = _actions_list; - _actions_list->data = list->data; - } else - _actions_list = g_list_append(_actions_list, list->data); - node = list->data; - if (sae_info->actions_combo_box != NULL) - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sae_info->actions_combo_box), xml_node_get_attr_value(node, "name")); - list = g_list_next(list); - } - if (sae_info->actions_combo_box != NULL) - gtk_combo_box_set_active(GTK_COMBO_BOX(sae_info->actions_combo_box), 0); -} - -gboolean set_up_imagesets(SAEInfo *sae_info) { - GList *_imagesets_list = NULL; - free_lists(sae_info); - GList *list = sae_info->root->sub_nodes; - XMLNode *node = NULL; - while (TRUE) { - list = g_list_find_custom(list, "imageset", xml_node_compare_with_name_func); - if (list == NULL) - break; - if (_imagesets_list == NULL) { - _imagesets_list = g_list_alloc(); - _imagesets_list->data = list->data; - sae_info->imagesets = _imagesets_list; - } else - _imagesets_list = g_list_append(_imagesets_list, list->data); - node = list->data; - if (sae_info->imagesets_combo_box != NULL) - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sae_info->imagesets_combo_box), xml_node_get_attr_value(node, "name")); - list = g_list_next(list); - } - if (_imagesets_list == NULL) - return FALSE; - if (sae_info->imagesets_combo_box != NULL) - gtk_combo_box_set_active(GTK_COMBO_BOX(sae_info->imagesets_combo_box), 0); - return TRUE; -} - -void show_sprite(SAEInfo *sae_info) { - Frame *sprite = sae_info->animation->data; - gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(source_view), - gtk_source_buffer_highlight_line(source_buffer, sprite->line_number-1), - 0.25, - FALSE, - 0.0, - 0.0); - sae_info->sprite = sprite; - gtk_widget_queue_draw(darea); -} - -void show_animation(SAEInfo *sae_info) { - kill_timeout(sae_info->anim_tag); - if (sae_info->animation == NULL) - return; - - show_sprite(sae_info); - Frame *sprite = sae_info->animation->data; - - GList *next = g_list_next(sae_info->animation); - if (next == NULL) - next = g_list_first(sae_info->animation); - - if (!sprite->delay) - { - free_animations(sae_info); - return; - } - sae_info->animation = next; - sae_info->anim_tag = g_timeout_add(sprite->delay, (GSourceFunc)show_animation, sae_info); -} - -gboolean show_general_animation(SAEInfo *sae_info) { - XMLNode *node = sae_info->animations->data; - if (node == NULL) - return FALSE; - animations_combo_box_changed_callback(NULL, NULL); - return TRUE; -} - -gboolean set_up_action_by_name(const gchar *name, SAEInfo *sae_info) { - free_animations(sae_info); - GList *list = g_list_find_custom(sae_info->actions, - xml_attr_new("name", name), - (GCompareFunc)xml_node_compare_with_attr_func); - if (list == NULL) return FALSE; - list = ((XMLNode *)list->data)->sub_nodes; - gboolean was_direction = FALSE; - while (TRUE) { - list = g_list_find_custom(list, "animation", xml_node_compare_with_name_func); - if (list == NULL) - break; - if (sae_info->animations == NULL) { - sae_info->animations = g_list_alloc(); - sae_info->animations->data = list->data; - } else - sae_info->animations = g_list_append(sae_info->animations, list->data); - XMLNode *node = list->data; - gchar *direction = xml_node_get_attr_value(node, "direction"); - if (direction != NULL) { - if (sae_info->animations_combo_box != NULL) - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sae_info->animations_combo_box), direction); - was_direction = TRUE; - } - list = g_list_next(list); - } - if (sae_info->animations == NULL) - return FALSE; - if (!was_direction) - show_general_animation(sae_info); - else if (sae_info->animations_combo_box != NULL) - gtk_combo_box_set_active(GTK_COMBO_BOX(sae_info->animations_combo_box), 0); - return TRUE; -} - -void set_up_imageset_by_name(const gchar *name, SAEInfo *sae_info) { - free_imageset(sae_info); - free_actions(sae_info); - free_animations(sae_info); - - GList *list = g_list_find_custom(sae_info->imagesets, - xml_attr_new("name", name), - (GCompareFunc)xml_node_compare_with_attr_func); - - if (list == NULL) - return; - - XMLNode *node = list->data; - if (node == NULL) - return; - - sae_info->imageset->node = node; - sae_info->imageset->offsetX = 0; - sae_info->imageset->offsetY = 0; - - gchar *offset_attr = xml_node_get_attr_value(sae_info->imageset->node, "offsetX"); - if (offset_attr != NULL) - sscanf(offset_attr, "%d", &sae_info->imageset->offsetX); - - offset_attr = xml_node_get_attr_value(sae_info->imageset->node, "offsetY"); - if (offset_attr != NULL) - sscanf(offset_attr, "%d", &sae_info->imageset->offsetY); - - gchar *imageset_name = xml_node_get_attr_value(sae_info->imageset->node, "name"); - - gchar *src = xml_node_get_attr_value(sae_info->imageset->node, "src"); - format_src_string(src); - gchar *datapath = config->clientdata_folder; - gchar *path = g_strjoin(SEPARATOR_SLASH, datapath, src, NULL); - - sae_info->imageset->spriteset = gdk_pixbuf_new_from_file(path, NULL); - if (sae_info->imageset->spriteset == NULL) { - parsing_error_warning(sae_info, "Wrong spriteset path!"); - return; - } - - gtk_widget_set_sensitive(imageset_preview_menu_item, TRUE); - gtk_widget_set_sensitive(toolbar, TRUE); - sae_info->imageset->spriteset_width = gdk_pixbuf_get_width(sae_info->imageset->spriteset); - sae_info->imageset->spriteset_height = gdk_pixbuf_get_height(sae_info->imageset->spriteset); - - gchar *width = xml_node_get_attr_value(sae_info->imageset->node, "width"); - sscanf(width, "%d", &sae_info->imageset->width); - gchar *height = xml_node_get_attr_value(sae_info->imageset->node, "height"); - sscanf(height, "%d", &sae_info->imageset->height); - - list = g_list_find_custom(sae_info->root->sub_nodes, "sae", xml_node_compare_with_name_func); - if (list != NULL) { - gchar *ground_attr = xml_node_get_attr_value((XMLNode *)list->data, "ground"); - if (ground_attr != NULL) { - ground_attr = g_strjoin(NULL, DIR_GROUNDS, SEPARATOR_SLASH, ground_attr, ".png", NULL); - GdkPixbuf *pbuf = gdk_pixbuf_new_from_file(ground_attr, NULL); - if(pbuf != NULL) - sae_info->ground = pbuf; - } - gchar *player_attr = xml_node_get_attr_value((XMLNode *)list->data, "player"); - if (player_attr != NULL && player == NULL) { - gchar *text; - gchar *sprites_path = paths->sprites; - gchar *player_file = g_strjoin(NULL, sprites_path, DIR_PLAYERS, player_attr, ".xml", NULL); - if (g_file_get_contents(player_file, &text, NULL, NULL)) { - player = sae_info_new(); - parse_xml_text(text, player); - set_up_imageset_by_name("base", player); - } - } - } - set_up_actions_by_imageset_name(imageset_name, sae_info); - if (sae_info->actions == NULL) - return; - set_sprite_by_index(0, sae_info); -} - -void load_options() { - gchar *datapath = config->clientdata_folder; - gchar *path = g_strjoin(SEPARATOR_SLASH, datapath, "paths.xml", NULL); - config_options_load_from_file(paths, path, datapath); -} - -void parse_xml_text(gchar *text, SAEInfo *sae_info) { - GError *error = NULL; - - free_lists(sae_info); - - XMLNode *_root_node = xml_parse_buffer(text, &error); - sae_info->root = _root_node; - if (_root_node == NULL) { - parsing_error_warning(sae_info, error->message); - g_error_free(error); - return; - } - - GList *list = g_list_find_custom(_root_node->sub_nodes, "include", xml_node_compare_with_name_func); - while (list != NULL) { - XMLNode *node = list->data; - gchar *file_attr = xml_node_get_attr_value(node, "file"); - if (file_attr != NULL) { - file_attr = g_strjoin(NULL, paths->sprites, file_attr, NULL); - gchar *buf; - if (g_file_get_contents(file_attr, &buf, NULL, NULL)) - _root_node->sub_nodes = g_list_concat(_root_node->sub_nodes, xml_parse_buffer(buf, &error)->sub_nodes); - } - GList *next = g_list_next(list); - if (next != NULL) - list = g_list_find_custom(next, "include", xml_node_compare_with_name_func); - else - list = NULL; - } - - sae_info->offsetX = 0; - sae_info->offsetY = 0; - - if (error != NULL) - g_error_free(error); - - if (!set_up_imagesets(sae_info)) { - parsing_error_warning(sae_info, "Bad data!"); - return; - } -} - -void parse_xml_buffer(GtkWidget *button, GtkSourceBuffer *buffer) { - if (buffer == NULL) - buffer = source_buffer; - - player = NULL; - load_options(); - - GtkTextIter beg, end; - gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(buffer), &beg); - gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(buffer), &end); - parse_xml_text(gtk_text_iter_get_text(&beg, &end), gen_sae_info); -} - -void load_config() { - config_keys_load(config); - gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(data_folder_chooser_button), config->clientdata_folder); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_grid_menu_item), config->show_grid); -} - -void save_config_and_quit() { - config_keys_save(config); - gtk_main_quit(); -} - -int main(int argc, char *argv[]) { - - gtk_init(&argc, &argv); - - icon = gdk_pixbuf_new_from_file(FILE_ICON, NULL); - - gen_sae_info = sae_info_new(); - config = config_keys_new(); - paths = config_options_new(); - - set_up_interface(); - load_config(); - - gtk_main(); - - return 0; -} diff --git a/saedit/main.h b/saedit/main.h deleted file mode 100644 index 27367bd..0000000 --- a/saedit/main.h +++ /dev/null @@ -1,119 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#ifndef MAIN_H -#define MAIN_H - -#include <stdlib.h> -#include <gtk/gtk.h> -#include <gtksourceview/gtksourceview.h> -#include <gtksourceview/gtksourcelanguagemanager.h> -#include <cairo.h> -#include <glib/gi18n.h> - -#include "common.h" -#include "xml.h" -#include "config.h" -#include "sae.h" -#include "search.h" - -const int MIN_WIDTH = 600; -const int MIN_HEIGHT = 600; - -const gchar *DIR_GROUNDS = "grounds"; -const gchar *DIR_PLAYERS = "races/"; - -const gchar *FILE_ICON = "icon.svg"; - -const int IMAGESET_PREVIEW_WINDOW_WIDTH = 200; -const int IMAGESET_PREVIEW_WINDOW_HEIGHT = 300; - -GtkWidget *win = NULL; -GtkWidget *darea = NULL; -GtkWidget *data_folder_chooser_button = NULL; -GtkWidget *xml_file_chooser_button = NULL; -GtkWidget *xml_file_open_button = NULL; -GtkWidget *xml_file_save_button = NULL; -GtkWidget *imageset_preview_menu_item = NULL; -GtkWidget *show_grid_menu_item = NULL; -GtkWidget *source_view = NULL; -GtkWidget *about_dialog = NULL; -GtkWidget *parsing_error_dialog = NULL; - -GtkSourceBuffer *source_buffer = NULL; - -SAEInfo *gen_sae_info = NULL; -SAEInfo *player = NULL; - -GdkPixbuf *icon = NULL; - -Options *paths; -Keys *config; - -//Cairo functions -cairo_surface_t *get_grid_surface(int w, int h); -gboolean darea_draw_event(GtkWidget *widget, cairo_t *cr, SAEInfo *sae_info); - -//Common functions -gchar *markup_bold(gchar *str); -void format_src_string(gchar *src); -GtkTextIter *gtk_source_buffer_highlight_line(GtkSourceBuffer *buffer, int line_number); - -//File working -void open_xml_file(GtkButton *button); -void save_to_xml_file(gchar *filename); - -//SAEInfo functions -void free_imagesets(SAEInfo *sae_info); -void free_actions(SAEInfo *sae_info); -void free_animations(SAEInfo *sae_info); -void free_imageset(SAEInfo *sae_info); -void free_lists(SAEInfo *sae_info); - -void free_current_info(); - -//Callbacks -void data_folder_set_callback(GtkFileChooserButton *widget, gpointer data); -void parsing_error_warning(SAEInfo *sae_info, const gchar *message); -void show_grid_menu_item_toggled_callback(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -void actions_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data); -void imagesets_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data); -void animations_combo_box_changed_callback(GtkComboBoxText *widget, gpointer user_data); -void open_menu_item_activate_callback(GtkMenuItem *menuitem, GtkFileChooserDialog *fcdialog); -gboolean frame_image_button_press_event_callback(GtkWidget *widget, GdkEventButton *button, int index); -//>Toolbar callbacks -void toolbar_to_first_clicked_callback(GtkToolButton *toolbutton, gpointer user_data); -void toolbar_prev_frame_clicked_callback(GtkToolButton *toolbutton, gpointer user_data); -void toolbar_play_clicked_callback(GtkToolButton *toolbutton, gpointer user_data); -void toolbar_pause_clicked_callback(GtkToolButton *toolbutton, gpointer user_data); -void toolbar_next_frame_clicked_callback(GtkToolButton *toolbutton, gpointer user_data); -void toolbar_to_last_clicked_callback(GtkToolButton *toolbutton, gpointer user_data); - -//Dialogs -void show_imageset_dialog(); -void show_about_dialog(); - -void set_sprite_by_index(size_t index, SAEInfo *sae_info); -void set_up_actions_by_imageset_name(gchar *imageset_name, SAEInfo *sae_info); -gboolean set_up_imagesets(SAEInfo *sae_info); -gboolean show_general_animation(SAEInfo *sae_info); -gboolean set_up_action_by_name(const gchar *name, SAEInfo *sae_info); -void set_up_imageset_by_name(const gchar* name, SAEInfo *sae_info); -void parse_xml_buffer(GtkWidget *button, GtkSourceBuffer *buffer); -void set_up_interface(); -void load_config(); -void save_config_and_quit(); -void load_options(); -void parse_xml_text(gchar *text, SAEInfo *sae_info); -void show_sprite(SAEInfo *sae_info); -void show_animation(SAEInfo *sae_info); - -#endif diff --git a/saedit/sae.c b/saedit/sae.c deleted file mode 100644 index 70e7c7d..0000000 --- a/saedit/sae.c +++ /dev/null @@ -1,212 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#include "sae.h" - -void kill_timeout(guint tag) { - if (tag > 0) - g_source_remove(tag); -} - -Frame *frame_new(int index1, int offsetX, int offsetY, int delay) { - Frame *res = g_new0(Frame, 1); - res->index = index1; - res->offsetX = offsetX; - res->offsetY = offsetY; - res->delay = delay; - return res; -} - -Imageset *imageset_new() { - Imageset *res = g_new0(Imageset, 1); - res->width = SPRITE_WIDTH_DEFAULT; - res->height = SPRITE_HEIGHT_DEFAULT; - return res; -} - -SAEInfo *sae_info_new() { - SAEInfo *res = g_new0(SAEInfo, 1); - res->ground = sae_info_ground_new(); - res->sprite = frame_new(-1, 0, 0, 0); - res->imageset = imageset_new(); - return res; -} - -GdkPixbuf *sae_info_ground_new() { - GdkPixbuf *ground = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, GRID_SIZE * 3, GRID_SIZE * 3); - gdk_pixbuf_fill(ground, 0x00000000); - return ground; -} - -GdkPixbuf* get_sprite_by_index(int index1, SAEInfo *sae_info) { - if (index1 == -1) { - GdkPixbuf *res = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, - sae_info->imageset->width, - sae_info->imageset->height); - gdk_pixbuf_fill(res, 0x00000000); - return res; - } - - if (index1 >= 0) { - size_t w = sae_info->imageset->spriteset_width/sae_info->imageset->width; - if (sae_info->imageset->spriteset == NULL) return NULL; - - return gdk_pixbuf_new_subpixbuf(sae_info->imageset->spriteset, - index1%w*sae_info->imageset->width, - index1/w*sae_info->imageset->height, - sae_info->imageset->width, - sae_info->imageset->height); - } - - return NULL; -} - -inline void _add_frame(SAEInfo *sae_info, int index1, int offsetX, int offsetY, int delay, int line) { - - Frame *sprite = frame_new(index1, offsetX, offsetY, delay); - sprite->line_number = line; - sprite->pixbuf = get_sprite_by_index(index1, sae_info); - - if (sae_info->animation != NULL) - sae_info->animation = g_list_append(sae_info->animation, sprite); - else { - sae_info->animation = g_list_alloc(); - sae_info->animation->data = sprite; - } -} - -gboolean set_up_animation_by_direction(SAEInfo *sae_info, const gchar *direction) { - if (sae_info->imageset->spriteset == NULL) - return FALSE; - sae_info->animation = NULL; - - GList *list = g_list_find_custom(sae_info->animations, - xml_attr_new("direction", direction), - (GCompareFunc)xml_node_compare_with_attr_func); - if (list == NULL) - return FALSE; - - XMLNode *anode = list->data; - list = anode->sub_nodes; - - while (list != NULL) { - XMLNode *node = list->data; - - //sequence tag attributes - int offsetX = 0, offsetY = 0, - delay = 0, - start = -1, end = -1, - repeat = 1; - gchar *value = NULL; - - gchar *ofX_attr, *ofY_attr; - ofX_attr = xml_node_get_attr_value(node, "offsetX"); - if (ofX_attr != NULL) - sscanf(ofX_attr, "%d", &offsetX); - - ofY_attr = xml_node_get_attr_value(node, "offsetY"); - if (ofY_attr != NULL) - sscanf(ofY_attr, "%d", &offsetY); - - gchar *delay_attr = xml_node_get_attr_value(node, "delay"); - if (delay_attr != NULL) - sscanf(delay_attr, "%d", &delay); - - if (g_str_equal(node->name, "frame")) { - - gchar *index_attr = xml_node_get_attr_value(node, "index"); - if (index_attr != NULL) { - sscanf(index_attr, "%d", &start); - end = start; - } - - } else if (g_str_equal(node->name, "sequence")) { - - gchar *start_attr = xml_node_get_attr_value(node, "start"); - if (start_attr != NULL) - sscanf(start_attr, "%d", &start); - - gchar *end_attr = xml_node_get_attr_value(node, "end"); - if (end_attr != NULL) - sscanf(end_attr, "%d", &end); - - value = xml_node_get_attr_value(node, "value"); - - gchar *repeat_attr = xml_node_get_attr_value(node, "repeat"); - if (repeat_attr != NULL) - sscanf(repeat_attr, "%d", &repeat); - - } else if (g_str_equal(node->name, "pause")) { - - value = (gchar *)"p"; - - gchar *repeat_attr = xml_node_get_attr_value(node, "repeat"); - if (repeat_attr != NULL) - sscanf(repeat_attr, "%d", &repeat); - - } - - if (start >= 0) { //start-end case - - int r = 0, i = 0; - for (r = 1; r <= repeat; r++) { - for (i = start; i <= end; i++) { - _add_frame(sae_info, i, offsetX, offsetY, delay, node->line_number); - } - } - - } else - if (value != NULL) { //value case - - gchar **values = g_strsplit(value, ",", 0); - - int r; - for (r = 0; r < repeat; r++) { //TODO: remove multiparsing - gchar **iter = values; - while (*iter != NULL) { - - if (g_str_equal(*iter, "p")) { //pause - - _add_frame(sae_info, -1, 0, 0, delay, node->line_number); - - } else { - - unsigned f, s; - - if (sscanf(*iter, "%u-%u", &f, &s) == 2) { - - int i; - for (i = f; i <= s; i++) { - _add_frame(sae_info, i, offsetX, offsetY, delay, node->line_number); - } - - } else if (sscanf(*iter, "%u", &f) == 1) { - - _add_frame(sae_info, f, offsetX, offsetY, delay, node->line_number); - - } - - } - iter++; - } - } - - g_strfreev(values); - - } - - list = g_list_next(list); - } - if (sae_info->animation == NULL) - return FALSE; - - return TRUE; -} diff --git a/saedit/sae.h b/saedit/sae.h deleted file mode 100644 index 51f45c1..0000000 --- a/saedit/sae.h +++ /dev/null @@ -1,69 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#ifndef SAE_H -#define SAE_H - -#include <gtk/gtk.h> -#include "common.h" -#include "xml.h" - -void kill_timeout(guint tag); - -typedef struct { - int index; - int offsetX; - int offsetY; - int delay; - int line_number; - GdkPixbuf *pixbuf; - cairo_surface_t *surface; -} Frame; - -Frame *frame_new(int index, int offsetX, int offsetY, int delay); - -typedef struct { - XMLNode *node; - int offsetX; - int offsetY; - int width; - int height; - int spriteset_width; - int spriteset_height; - GdkPixbuf *spriteset; -} Imageset; - -Imageset *imageset_new(); - -typedef struct { - GList *imagesets; - GList *actions; - GList *animations; - GList *animation; - Imageset *imageset; - Frame *sprite; - guint anim_tag; - XMLNode *root; - GtkWidget *imagesets_combo_box; - GtkWidget *actions_combo_box; - GtkWidget *animations_combo_box; - GdkPixbuf *ground; - int offsetX; - int offsetY; -} SAEInfo; - -SAEInfo *sae_info_new(); -GdkPixbuf *sae_info_ground_new(); - -GdkPixbuf* get_sprite_by_index(int index, SAEInfo *sae_info); -gboolean set_up_animation_by_direction(SAEInfo *sae_info, const gchar *direction); - -#endif diff --git a/saedit/search.c b/saedit/search.c deleted file mode 100644 index df2970e..0000000 --- a/saedit/search.c +++ /dev/null @@ -1,74 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#include "search.h" - -GtkWidget *search_text_view = NULL; -gchar *search_last_text = NULL; - -gboolean search_find_text(gchar *text) { - search_last_text = text; - - GtkTextBuffer *text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(search_text_view)); - if (!GTK_IS_TEXT_BUFFER(text_buffer)) - return FALSE; - - gboolean found; - - GtkTextIter m_start, m_end, start; - gtk_text_buffer_get_selection_bounds(text_buffer, NULL, &start); - found = gtk_text_iter_forward_search(&start, text, 4, &m_start, &m_end, NULL); - - if (!found) { - gtk_text_buffer_get_start_iter(text_buffer, &start); - found = gtk_text_iter_forward_search(&start, text, 4, &m_start, &m_end, NULL); - } - - if (found) { - gtk_text_buffer_place_cursor(text_buffer, &m_start); - gtk_text_buffer_move_mark_by_name(text_buffer, "selection_bound", &m_end); - gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW(search_text_view), - gtk_text_buffer_get_insert(text_buffer), - 0.25, - FALSE, - 0.0, - 0.0); - return TRUE; - } else - return FALSE; -} - -gboolean search_find_next() { - if (search_last_text != NULL) - search_find_text(search_last_text); - // here must return some thing -} - -void search_find_dialog_response_callback(GtkWidget *dialog, - gint response_id, - gpointer entry) { - - if (response_id == GTK_RESPONSE_CANCEL || response_id == GTK_RESPONSE_DELETE_EVENT) - gtk_widget_hide(dialog); - else { - - g_return_if_fail(response_id == GTK_RESPONSE_ACCEPT); - g_return_if_fail(GTK_IS_TEXT_VIEW(search_text_view)); - g_return_if_fail(GTK_IS_ENTRY(GTK_ENTRY(entry))); - - search_find_text(g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)))); - - } -} - -void search_init(GtkWidget *text_view) { - search_text_view = text_view; -} diff --git a/saedit/search.h b/saedit/search.h deleted file mode 100644 index faf412e..0000000 --- a/saedit/search.h +++ /dev/null @@ -1,26 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#ifndef SEARCH_H -#define SEARCH_H - -#include <gtk/gtk.h> -#include <gtksourceview/gtksourceview.h> -#include "common.h" - -void search_init(GtkWidget *text_view); -gboolean search_find_text(gchar *text); -gboolean search_find_next(); -void search_find_dialog_response_callback(GtkWidget *dialog, - gint response_id, - gpointer entry); - -#endif diff --git a/saedit/template.xml b/saedit/template.xml deleted file mode 100644 index 3747c31..0000000 --- a/saedit/template.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<!-- Original Author : -Copyright (C) 2012 --> -<sprite> - -</sprite> diff --git a/saedit/valg b/saedit/valg deleted file mode 100755 index 8726b81..0000000 --- a/saedit/valg +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -valgrind --read-var-info=yes --track-origins=yes --malloc-fill=11 --free-fill=55 --show-reachable=yes --leak-check=full --leak-resolution=high --partial-loads-ok=yes --error-limit=no --num-callers=30 "./saedit" 2>./valg.log diff --git a/saedit/xml.c b/saedit/xml.c deleted file mode 100644 index eefc536..0000000 --- a/saedit/xml.c +++ /dev/null @@ -1,316 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ - -#include "xml.h" - -gchar** xml_attr_new(const gchar *name, const gchar *value) { - gchar **attr = g_new0(gchar*, 2); - attr[0] = g_strdup(name); - attr[1] = g_strdup(value); - return attr; -} - -gchar* xml_node_get_attr_value(const XMLNode *node, const gchar *attr_name) { - gchar **attr = node->attributes; - guint i; - for (i = 0; i < g_strv_length(attr); i += 2) - if (g_str_equal(attr[i], attr_name)) - return attr[i + 1]; - return NULL; -} - - -gint xml_node_compare_with_name_func(gconstpointer a, gconstpointer b) { - return g_strcmp0((gchar *)b, ((XMLNode *)a)->name); -} - -gint xml_node_compare_with_action_node_by_imageset_name_func(gconstpointer a, gconstpointer b) { - return g_strcmp0("action", ((XMLNode *)a)->name) || - g_strcmp0((gchar *)b, xml_node_get_attr_value((XMLNode *)a, "imageset")); -} - -gint xml_node_compare_with_attr_func(const XMLNode *node, const gchar **attr) { - return g_strcmp0(attr[1], - xml_node_get_attr_value(node, attr[0])); -} - -static GMarkupParser parser; - -void xml_free (XMLNode *node) { - g_free (node->name); - - g_free (node->text); - - g_strfreev (node->attributes); - - g_list_foreach (node->sub_nodes, (GFunc) xml_free, NULL); - g_list_free (node->sub_nodes); - - g_slice_free (XMLNode, node); -} - -static void _start_root_element_cb ( GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) { - XMLNode **node = (XMLNode **) user_data; - g_assert (node != NULL); - - XMLNode *p = g_slice_new0 (XMLNode); - - - p->name = g_strdup (element_name); - - GArray *attributes = g_array_new (TRUE, TRUE, sizeof (gchar *)); - while (*attribute_names != NULL && *attribute_values != NULL) { - gchar *p2; - p2 = g_strdup (*attribute_names++); - g_array_append_val (attributes, p2); - p2 = g_strdup (*attribute_values++); - g_array_append_val (attributes, p2); - } - - p->attributes = (gchar **) g_array_free (attributes, FALSE); - - g_markup_parse_context_push (context, &parser, p); - *node = p; -} - - -static void _start_element_cb ( GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) { - - XMLNode *node = (XMLNode *) user_data; - - if (node->text) { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, " "); - return; - } - - XMLNode *p = g_slice_new0 (XMLNode); - - node->sub_nodes = g_list_append (node->sub_nodes, p); - g_markup_parse_context_push (context, &parser, p); - - p->name = g_strdup (element_name); - - GArray *attributes = g_array_new (TRUE, TRUE, sizeof (gchar *)); - while (*attribute_names != NULL && *attribute_values != NULL) { - gchar *p2; - p2 = g_strdup (*attribute_names++); - g_array_append_val (attributes, p2); - p2 = g_strdup (*attribute_values++); - g_array_append_val (attributes, p2); - } - - p->attributes = (gchar **)g_array_free (attributes, FALSE); - - gint char_n, line_n; - g_markup_parse_context_get_position(context, &line_n, &char_n); - p->line_number = line_n - (char_n <= 1 ? 1 : 0); -} - -static void _end_element_cb ( GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, - GError **error) { - XMLNode *p = (XMLNode *) g_markup_parse_context_pop (context); - - if (p->text && p->sub_nodes) { - g_warning ("Error"); - } - - if (p->text == NULL && p->sub_nodes == NULL) { - p->text = g_strdup (""); - } -} - -static gboolean _is_space ( const gchar *text, - gsize text_len) { - gsize i = 0; - - for (i = 0; text[i] != '\0' && i < text_len; i++) { - switch (text[i]) { - case '\t': - case ' ': - case '\n': - case '\r': - continue; - default: - return FALSE; - } - } - - return TRUE; -} - -static void _text_cb ( GMarkupParseContext *context, - const gchar *text, - gsize text_len, - gpointer user_data, - GError **error) { - XMLNode *p = (XMLNode *)user_data; - - if (_is_space (text, text_len)) { - return; - } - - if (p->sub_nodes || p->text) { - g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, " "); - return; - } - - p->text = g_strndup (text, text_len); -} - -static GMarkupParser parser = { - _start_element_cb, - _end_element_cb, - _text_cb, - 0, - 0, -}; - -XMLNode *xml_parse_file (const gchar *filename) { - gboolean retval = FALSE; - GError *error = NULL; - FILE *pf = fopen (filename, "r"); - - if (pf == NULL) { - return NULL; - } - - GMarkupParseContext *context; - XMLNode *node; - - static const GMarkupParser root_parser = { - _start_root_element_cb, - _end_element_cb, - _text_cb, - 0, - 0, - }; - - do { - context = g_markup_parse_context_new (&root_parser, 0, &node, 0); - - while (!feof (pf)) { - gchar buf[1024]; - gssize len = 0; - - len = fread (buf, 1, sizeof (buf), pf); - retval = g_markup_parse_context_parse (context, buf, len, &error); - - if (!retval) - break; - } - fclose (pf); - - if (!retval) - break; - - retval = g_markup_parse_context_end_parse (context, &error); - if (!retval) - break; - - g_markup_parse_context_free (context); - - return node; - } while (0); - - g_warning ("Parse %s failed: %s", filename, error->message); - g_error_free (error); - g_markup_parse_context_free (context); - return NULL; -} - -XMLNode *xml_parse_buffer (const gchar *buffer, GError **error) { - gboolean retval; - - GMarkupParseContext *context; - XMLNode *node; - - static const GMarkupParser root_parser = { - _start_root_element_cb, - _end_element_cb, - _text_cb, - 0, - 0, - }; - - context = g_markup_parse_context_new (&root_parser, 0, &node, 0); - - do { - retval = g_markup_parse_context_parse (context, buffer, strlen (buffer), error); - if (!retval) - break; - - retval = g_markup_parse_context_end_parse (context, error); - if (!retval) - break; - g_markup_parse_context_free (context); - return node; - } while (0); - - //g_warning ("Parse buffer failed: %s", (*error)->message); - g_markup_parse_context_free (context); - return NULL; -} - - -static void output_indent (int level, GString *output) { - gint i; - for (i = 0; i < level; i++) { - g_string_append (output, " "); - } -} - -static void xml_output_indent (const XMLNode *node, int level, GString *output) { - gchar **attrs; - - output_indent (level, output); - g_string_append_printf (output, "<%s", node->name); - - attrs = node->attributes; - - while (attrs != NULL && *attrs != NULL) { - g_string_append_printf (output, " %s", *(attrs++)); - g_string_append_printf (output, "=\"%s\"", *(attrs++)); - } - - if (node->sub_nodes != NULL) { - g_string_append (output, ">\n"); - GList *sub_node; - - for (sub_node = node->sub_nodes; sub_node != NULL; sub_node = sub_node->next) { - xml_output_indent (sub_node->data, level + 1, output); - } - output_indent (level, output); - g_string_append_printf (output, "</%s>\n",node->name); - } else if (node->text != NULL) { - gchar *text = g_markup_escape_text (node->text, -1); - g_string_append_printf (output, ">%s</%s>\n", text, node->name); - g_free (text); - } else { - g_string_append (output, "/>\n"); - } -} - -void xml_output (const XMLNode *node, GString *output) { - xml_output_indent (node, 0, output); -} - diff --git a/saedit/xml.h b/saedit/xml.h deleted file mode 100644 index 584c568..0000000 --- a/saedit/xml.h +++ /dev/null @@ -1,42 +0,0 @@ -/*=======================================*\ -| ____ ____ | -| / \ /\ | | -| \____ / \ |____ | -| \ /____\ | | -| \____/prite / \nimation |____ditor | -| | -| Copyleft Vasily_Makarov 2011 | -| | -\*=======================================*/ -#ifndef XML_H -#define XML_H - -#include <stdio.h> -#include <glib.h> -#include "common.h" - -typedef struct { - gchar *name; - gchar *text; - gchar **attributes; - int line_number; - GList *sub_nodes; -} XMLNode; - - -XMLNode *xml_parse_file (const gchar *name); - -XMLNode *xml_parse_buffer (const gchar *buffer, GError **error); - -void xml_free (XMLNode *node); - -void xml_output (const XMLNode *node, - GString *output); - -gchar **xml_attr_new(const gchar *name, const gchar *value); -gchar *xml_node_get_attr_value(const XMLNode *node, const gchar *attr_name); -gint xml_node_compare_with_name_func(gconstpointer a, gconstpointer b); -gint xml_node_compare_with_action_node_by_imageset_name_func(gconstpointer a, gconstpointer b); -gint xml_node_compare_with_attr_func(const XMLNode *node, const gchar **attr); - -#endif |