Added cmd_drawing_tools.c.

Fixed some errors with double memory free (from 'menuitems' and from 'commands').
Added the four main commands for the editor of sprites (close_editor, make_unique_editor, split_editor).
This commit is contained in:
David Capello 2007-09-27 18:02:23 +00:00
parent e17df80151
commit a68a9e2e56
49 changed files with 1500 additions and 1758 deletions

View File

@ -1,5 +1,30 @@
2007-09-27 David A. Capello <dacap@users.sourceforge.net>
* src/commands/cmd_drawing_tools.c: Added. All change of
drawing-tool is in this file.
* jinete/src/jaccel.c (jaccel_new_copy): Added to fix an error of
double freed (from 'menuitems' and from 'commands').
* src/commands/commands.c (command_reset_keys): Added to fix a
error of duplicate accelerators..
* src/commands/cmd_sprite_editor.c: Added with the four main
commands for the editor of sprites: close_editor,
make_unique_editor, split_editor_horizontally,
split_editor_vertically.
2007-09-26 David A. Capello <dacap@users.sourceforge.net>
* src/commands/cmd_preview.c: Added.
* src/dialogs/viewspr.c: Removed.
* src/commands/cmd_advanced_mode.c (command_execute_advanced_mode):
Added a warning message.
* src/core/app.c (app_switch): Removed.
* src/commands/cmd_open_file.c (command_execute_open_file):
Added (based on openspr.lua).

View File

@ -3,7 +3,6 @@ High priority work
- add support for PNG files.
- ver por el nuevo load_font de Allegro.
- borrar src/core/config.c
- search for XXX (XXXX is supposed to be high priority);
- complete palette operations, and palette editor (it needs a slider
or something to move between palette changes);
@ -41,8 +40,6 @@ High priority work
- drawing tools:
+ real-spray;
+ Animator Pro like: oval, petal, rpoly, star, poly, spiral;
- Add suppport to load old .ase files:
+ I don't think so, nobody tell me "I need load an old .ase file!!!"
Wish-list
---------

View File

@ -37,6 +37,7 @@
JI_BEGIN_DECLS
JAccel jaccel_new(void);
JAccel jaccel_new_copy(JAccel accel);
void jaccel_free(JAccel accel);
void jaccel_add_key(JAccel accel, int shifts, int ascii, int scancode);

View File

@ -61,6 +61,24 @@ JAccel jaccel_new(void)
return accel;
}
JAccel jaccel_new_copy(JAccel accel)
{
KeyCombo *key;
JAccel copy;
JLink link;
copy = jaccel_new();
if (!copy)
return NULL;
JI_LIST_FOR_EACH(accel->key_list, link) {
key = (KeyCombo *)link->data;
jaccel_add_key(copy, key->shifts, key->ascii, key->scancode);
}
return copy;
}
void jaccel_free(JAccel accel)
{
JLink link;

View File

@ -208,10 +208,20 @@ void jmenuitem_set_submenu(JWidget widget, JWidget widget_menu)
menuitem->submenu = widget_menu;
}
/**
* Changes the keyboard shortcuts (accelerators) for the specified
* widget (a menu-item).
*
* @warning The specified @a accel will be freed automatically when
* the menu-item'll receive JM_DESTROY message.
*/
void jmenuitem_set_accel(JWidget widget, JAccel accel)
{
MenuItem *menuitem = MITEM (widget);
if (menuitem->accel)
jaccel_free(menuitem->accel);
menuitem->accel = accel;
}

View File

@ -29,7 +29,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include <allegro.h>
#include "jinete/intern.h"
@ -272,7 +271,7 @@ void jmouse_draw_cursor()
void jmouse_hide()
{
assert(mouse_scares >= 0);
ASSERT(mouse_scares >= 0);
if (ji_screen == screen)
scare_mouse();
mouse_scares++;
@ -280,7 +279,7 @@ void jmouse_hide()
void jmouse_show()
{
assert(mouse_scares > 0);
ASSERT(mouse_scares > 0);
mouse_scares--;
if (ji_screen == screen)
unscare_mouse();
@ -288,13 +287,13 @@ void jmouse_show()
bool jmouse_is_hidden()
{
assert(mouse_scares >= 0);
ASSERT(mouse_scares >= 0);
return mouse_scares > 0;
}
bool jmouse_is_shown()
{
assert(mouse_scares >= 0);
ASSERT(mouse_scares >= 0);
return mouse_scares == 0;
}

View File

@ -38,6 +38,9 @@
# include <stdio.h>
#endif
#include <allegro.h>
#ifdef ALLEGRO_WINDOWS
#include <winalleg.h>
#endif
#include "jinete.h"
#include "jinete/intern.h"
@ -1238,6 +1241,9 @@ void jwidget_hard_capture_mouse(JWidget widget)
{
if (!jmanager_get_capture()) {
jmanager_set_capture(widget);
#ifdef ALLEGRO_WINDOWS
SetCapture(win_get_window());
#endif
if (jmanager_get_capture() == widget)
widget->flags |= JI_HARDCAPTURE;
@ -1248,6 +1254,9 @@ void jwidget_release_mouse(JWidget widget)
{
if (jmanager_get_capture() == widget) {
jmanager_free_capture();
#ifdef ALLEGRO_WINDOWS
ReleaseCapture();
#endif
widget->flags &= ~JI_HARDCAPTURE;
}

View File

@ -9,11 +9,8 @@ ASE_SOURCES = \
src/commands/cmd_about.c \
src/commands/cmd_advanced_mode.c \
src/commands/cmd_auto_crop_sprite.c \
src/commands/cmd_brush_tool.c \
src/commands/cmd_change_image_type.c \
src/commands/cmd_clear.c \
src/commands/cmd_close_all_files.c \
src/commands/cmd_close_editor.c \
src/commands/cmd_close_file.c \
src/commands/cmd_color_curve.c \
src/commands/cmd_configure_screen.c \
@ -28,28 +25,24 @@ ASE_SOURCES = \
src/commands/cmd_cut.c \
src/commands/cmd_deselect_mask.c \
src/commands/cmd_despeckle.c \
src/commands/cmd_dots_tool.c \
src/commands/cmd_draw_text.c \
src/commands/cmd_drawing_tools.c \
src/commands/cmd_duplicate_layer.c \
src/commands/cmd_duplicate_sprite.c \
src/commands/cmd_ellipse_tool.c \
src/commands/cmd_sprite_editor.c \
src/commands/cmd_exit.c \
src/commands/cmd_film_editor.c \
src/commands/cmd_flatten_layers.c \
src/commands/cmd_flip_horizontal.c \
src/commands/cmd_flip_vertical.c \
src/commands/cmd_floodfill_tool.c \
src/commands/cmd_frame_properties.c \
src/commands/cmd_invert_color.c \
src/commands/cmd_invert_mask.c \
src/commands/cmd_layer_properties.c \
src/commands/cmd_line_tool.c \
src/commands/cmd_link_frame.c \
src/commands/cmd_load_mask.c \
src/commands/cmd_load_session.c \
src/commands/cmd_make_unique_editor.c \
src/commands/cmd_mapgen.c \
src/commands/cmd_marker_tool.c \
src/commands/cmd_mask_all.c \
src/commands/cmd_mask_by_color.c \
src/commands/cmd_mask_repository.c \
@ -63,15 +56,11 @@ ASE_SOURCES = \
src/commands/cmd_options.c \
src/commands/cmd_palette_editor.c \
src/commands/cmd_paste.c \
src/commands/cmd_pencil_tool.c \
src/commands/cmd_play_flic.c \
src/commands/cmd_preview_fit_to_screen.c \
src/commands/cmd_preview_normal.c \
src/commands/cmd_preview_tiled.c \
src/commands/cmd_preview.c \
src/commands/cmd_quick_copy.c \
src/commands/cmd_quick_move.c \
src/commands/cmd_record_screen.c \
src/commands/cmd_rectangle_tool.c \
src/commands/cmd_redo.c \
src/commands/cmd_refresh.c \
src/commands/cmd_remove_frame.c \
@ -85,9 +74,6 @@ ASE_SOURCES = \
src/commands/cmd_save_session.c \
src/commands/cmd_screen_shot.c \
src/commands/cmd_select_file.c \
src/commands/cmd_split_editor_horizontally.c \
src/commands/cmd_split_editor_vertically.c \
src/commands/cmd_spray_tool.c \
src/commands/cmd_sprite_properties.c \
src/commands/cmd_tips.c \
src/commands/cmd_undo.c \
@ -100,7 +86,6 @@ ASE_SOURCES = \
src/core/dirs.c \
src/core/modules.c \
src/core/shutdown.c \
src/dialogs/about.c \
src/dialogs/canvasze.c \
src/dialogs/colsel.c \
src/dialogs/dfrlen.c \
@ -126,7 +111,6 @@ ASE_SOURCES = \
src/dialogs/tips.c \
src/dialogs/toolconf.c \
src/dialogs/vectmap.c \
src/dialogs/viewspr.c \
src/effect/colcurve.c \
src/effect/convmatr.c \
src/effect/effect.c \
@ -148,7 +132,6 @@ ASE_SOURCES = \
src/intl/intl.c \
src/intl/msgids.c \
src/main.c \
src/modules/chkmthds.c \
src/modules/color.c \
src/modules/editors.c \
src/modules/gfx.c \

276
misc/dist.sh Normal file
View File

@ -0,0 +1,276 @@
#! /bin/sh
dir="`pwd`"
version=0.6
distdir=ase-$version
freetype_files="jinete/freetype/ChangeLog \
jinete/freetype/descrip.mms \
jinete/freetype/INSTALL \
jinete/freetype/README \
jinete/freetype/README.UNX \
jinete/freetype/docs/* \
jinete/freetype/include/*.h \
jinete/freetype/include/freetype/*.h \
jinete/freetype/include/freetype/cache/*.h \
jinete/freetype/include/freetype/config/*.h \
jinete/freetype/include/freetype/internal/*.h \
jinete/freetype/src/autohint/*.[ch] \
jinete/freetype/src/autohint/*.py \
jinete/freetype/src/autohint/*.txt \
jinete/freetype/src/base/*.[ch] \
jinete/freetype/src/cache/*.[ch] \
jinete/freetype/src/cff/*.[ch] \
jinete/freetype/src/cid/*.[ch] \
jinete/freetype/src/pcf/*.[ch] \
jinete/freetype/src/psaux/*.[ch] \
jinete/freetype/src/pshinter/*.[ch] \
jinete/freetype/src/psnames/*.[ch] \
jinete/freetype/src/raster/*.[ch] \
jinete/freetype/src/sfnt/*.[ch] \
jinete/freetype/src/smooth/*.[ch] \
jinete/freetype/src/truetype/*.[ch] \
jinete/freetype/src/type1/*.[ch] \
jinete/freetype/src/winfonts/*.[ch]"
jinete_files="jinete/*.txt \
jinete/makefile.dj \
jinete/makefile.gcc \
jinete/makefile.lnx \
jinete/makefile.lst \
jinete/makefile.mgw \
jinete/docs/*.html \
jinete/docs/*.info \
jinete/docs/*.texi \
jinete/docs/*.txt \
jinete/examples/*.[ch] \
jinete/examples/*.jid \
jinete/examples/*.pcx \
jinete/examples/*.ttf \
jinete/examples/*.txt \
jinete/include/*.h \
jinete/include/jinete/*.h \
jinete/lib/*.txt \
jinete/lib/djgpp/*.txt \
jinete/lib/mingw32/*.txt \
jinete/lib/unix/*.txt \
jinete/obj/*.txt \
jinete/obj/djgpp/*.txt \
jinete/obj/mingw32/*.txt \
jinete/obj/unix/*.txt \
jinete/src/*.c \
jinete/src/themes/*.c \
jinete/src/themes/Makefile.icons \
jinete/src/themes/stand/*.pcx \
$freetype_files"
gfli_files="third_party/gfli/*.[ch] \
third_party/gfli/README \
third_party/gfli/TODO"
lua_files="third_party/lua/COPYRIGHT \
third_party/lua/HISTORY \
third_party/lua/README \
third_party/lua/doc/idx.html \
third_party/lua/doc/index.html \
third_party/lua/doc/manual.html \
third_party/lua/include/*.h \
third_party/lua/src/*.[ch] \
third_party/lua/src/lib/*.[ch] \
third_party/lua/src/lib/README"
libart_files="third_party/libart_lgpl/AUTHORS \
third_party/libart_lgpl/ChangeLog \
third_party/libart_lgpl/COPYING \
third_party/libart_lgpl/INSTALL \
third_party/libart_lgpl/NEWS \
third_party/libart_lgpl/README \
third_party/libart_lgpl/*.[ch]"
ase_files="all.h \
config.h \
ChangeLog \
COPYING \
fix.bat \
fix.sh \
makefile.cfg \
makefile.dj \
makefile.gcc \
makefile.lnx \
makefile.lst \
makefile.mgw \
*.txt \
data/aseicon.* \
data/convmatr.def \
data/defgui-en.xml \
data/defgui-es.xml \
data/fonts/*.pcx \
data/jids/*.jid \
data/palettes/*.col \
data/po/*.po \
data/scripts/*.lua \
data/scripts/examples/*.lua \
data/session/*.txt \
data/tips/*.pcx \
data/tips/tips.en \
data/tips/tips.es \
docs/*.html \
docs/*.info \
docs/*.pdf \
docs/*.texi \
docs/*.txt \
docs/files/*.txt \
docs/licenses/*.txt \
obj/*.txt \
obj/djgpp/*.txt \
obj/mingw32/*.txt \
obj/unix/*.txt \
src/*.[ch] \
src/*.rc \
src/commands/*.[ch] \
src/console/*.[ch] \
src/core/*.[ch] \
src/dialogs/*.[ch] \
src/dialogs/effect/*.[ch] \
src/effect/*.[ch] \
src/file/*.[ch] \
src/file/gif/*.[ch] \
src/intl/*.[ch] \
src/modules/*.[ch] \
src/raster/*.[ch] \
src/raster/examples/*.c \
src/raster/x86/*.s \
src/script/*.[ch] \
src/script/bindings.py \
src/util/*.[ch] \
src/widgets/*.[ch] \
src/widgets/editor/*.[ch] \
src/widgets/editor/*.txt \
third_party/*.txt"
######################################################################
# Source Distribution
# if [ ! -f $distdir.tar.gz ] ; then
if [ ! -f $distdir.zip ] ; then
cd "$dir/.."
mkdir "$dir/$distdir"
cp --parents \
$jinete_files \
$gfli_files \
$lua_files \
$libart_files \
$ase_files \
"$dir/$distdir"
cd "$dir"
# tar vczf $distdir.tar.gz $distdir
# tar vcjf $distdir.tar.bz2 $distdir
zip -r -9 $distdir.zip $distdir
rm -fr $distdir
fi
exit
######################################################################
# Files for binary distributions
function def_common_files ()
{
txt_files=" \
$1/*.txt \
$1/COPYING \
$1/data/convmatr.def \
$1/data/fonts/*.txt \
$1/data/jids/*.jid \
$1/data/menus.en \
$1/data/menus.es \
$1/data/po/es.po \
$1/data/scripts/*.lua \
$1/data/scripts/examples/*.lua \
$1/data/session/*.txt \
$1/data/tips/*.en \
$1/data/tips/*.es \
$1/docs/*.html \
$1/docs/*.info \
$1/docs/*.texi \
$1/docs/*.txt \
$1/docs/files/*.txt \
$1/docs/licenses/*.txt"
bin_files=" \
$1/data/aseicon.* \
$1/data/fonts/*.pcx \
$1/data/fonts/*.ttf \
$1/data/palettes/*.col \
$1/data/tips/*.pcx \
$1/docs/*.pdf"
}
######################################################################
# Unix Distribution
# if [ ! -f $distdir-unix.tar.gz ] ; then
# cd $dir/..
# rm ase
# make -f makefile.lnx CONFIGURED=1 HAVE_LIBJPEG=1
# strip ase
# def_common_files .
# mkdir $dir/$distdir-unix
# cp -r --parents $txt_files $bin_files ase $dir/$distdir-unix
# cd $dir
# tar vczf $distdir-unix.tar.gz $distdir-unix
# rm -fr $distdir-unix
# fi
######################################################################
# DOS Distribution
# if [ ! -f $distdir-dos.zip ] ; then
# cd $dir/..
# rm ase.exe
# djgpp make -f makefile.dj CONFIGURED=1 HAVE_LIBJPEG=1
# djgpp strip ase.exe
# def_common_files .
# mkdir $dir/$distdir-dos
# cp -r --parents $txt_files $bin_files ase.exe cwsdpmi.doc cwsdpmi.exe $dir/$distdir-dos
# cd $dir
# def_common_files $distdir-dos
# zip -l -9 $distdir-dos.zip $txt_files
# zip -9 $distdir-dos.zip $bin_files \
# $distdir-dos/ase.exe \
# $distdir-dos/cwsdpmi.*
# rm -fr $distdir-dos
# fi
######################################################################
# Win32 Distribution
if [ ! -f $distdir-win32.zip ] ; then
cd "$dir/.."
rm ase
mingw32 make -f makefile.mgw CONFIGURED=1 HAVE_LIBJPEG=1
mingw32 strip ase.exe
def_common_files .
mkdir "$dir/$distdir-win32"
cp -r --parents $txt_files $bin_files ase.exe "$dir/$distdir-win32"
cp alleg42.dll "$dir/$distdir-win32"
cd "$dir"
def_common_files $distdir-win32
zip -l -9 $distdir-win32.zip $txt_files
zip -9 $distdir-win32.zip $bin_files \
$distdir-win32/ase.exe \
$distdir-win32/alleg42.dll
rm -fr $distdir-win32
fi

7
misc/etags.sh Normal file
View File

@ -0,0 +1,7 @@
#! /bin/sh
find data/scripts jinete src third_party \
\( -name '*.[ch]' -o \
-name '*.lua' \) -print | \
sed -e "/_old/D" | \
etags -

43
misc/gendeps.sh Normal file
View File

@ -0,0 +1,43 @@
#! /bin/sh
# Jinete dependencies
GCC="gcc -MM"
CFLAGS="-Iinclude -Ifreetype/include"
cd jinete
$GCC $CFLAGS src/*.c \
| sed -e 's/^\([a-z_\-]*\.o\)/obj\/mingw32\/\1/' > makefile.dep
cd ..
# ASE dependencies
CFLAGS="-I. \
-Isrc -Ijinete/include -Ilibase \
-Ithird_party/lua/include \
-Ithird_party/gfli \
-Ithird_party/intl \
-Ithird_party/libpng \
-Ithird_party/zlib \
-Ijinete/freetype/include \
-Ithird_party"
rm -f makefile.dep
$GCC $CFLAGS jinete/src/*.c \
src/*.c \
src/commands/*.c \
src/console/*.c \
src/core/*.c \
src/dialogs/*.c \
src/dialogs/effect/*.c \
src/effect/*.c \
src/file/*.c \
src/intl/*.c \
src/modules/*.c \
src/raster/*.c \
src/script/bindings.c src/script/script.c \
src/util/*.c \
src/widgets/*.c \
src/widgets/editor/*.c \
| sed -e 's/^\([a-z_\-]*\.o\)/obj\/mingw32\/\1/' >> makefile.dep

View File

@ -20,14 +20,54 @@
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "commands/commands.h"
#include "core/app.h"
#include "core/cfg.h"
#endif
static bool advanced_mode = FALSE;
void command_execute_advanced_mode(const char *argument)
{
app_switch(app_get_tool_bar());
app_switch(app_get_menu_bar());
app_switch(app_get_status_bar());
app_switch(app_get_color_bar());
advanced_mode = !advanced_mode;
if (advanced_mode) {
jwidget_hide(app_get_tool_bar());
jwidget_hide(app_get_menu_bar());
jwidget_hide(app_get_status_bar());
jwidget_hide(app_get_color_bar());
}
else {
jwidget_show(app_get_tool_bar());
jwidget_show(app_get_menu_bar());
jwidget_show(app_get_status_bar());
jwidget_show(app_get_color_bar());
}
jwindow_remap(app_get_top_window());
jwidget_dirty(app_get_top_window());
if (advanced_mode &&
get_config_bool("AdvancedMode", "Warning", TRUE)) {
Command *cmd_advanced_mode = command_get_by_name(CMD_ADVANCED_MODE);
char warning[1024];
char key[1024];
char buf[1024];
strcpy(warning, _("You are going to enter in \"Advanced Mode\"."
"<<You can back pressing the \"%s\" key."));
jaccel_to_string(cmd_advanced_mode->accel, key);
sprintf(buf, warning, key);
if (jalert("%s<<%s||%s||%s",
_("Warning - Important"),
buf,
_("&Don't show it again"), _("&Continue")) == 1) {
set_config_bool("AdvancedMode", "Warning", FALSE);
}
}
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_brush_tool(const char *argument)
{
}

View File

@ -28,6 +28,28 @@
#endif
bool command_enabled_close_all_file(const char *argument)
{
return !jlist_empty(get_sprite_list());
}
void command_execute_close_all_files(const char *argument)
{
Sprite *sprite = get_first_sprite();
Sprite *clipboard = get_clipboard_sprite();
while (sprite) {
sprite = current_sprite;
/* check if this sprite is modified */
if (sprite_is_modified(sprite) &&
(!clipboard || sprite->gfxobj.id != clipboard->gfxobj.id)) {
command_execute_close_file();
break;
}
sprite = get_next_sprite(sprite);
}
/* close the window */
jwindow_close(app_get_top_window(), 0);
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_close_editor(const char *argument)
{
}

View File

@ -30,23 +30,52 @@
#endif
static bool close_current_sprite(void);
/* ======================== */
/* close_file */
/* ======================== */
bool command_enabled_close_file(const char *argument)
{
return current_sprite != NULL;
}
void command_execute_close_file(const char *argument)
{
close_current_sprite();
}
/* ======================== */
/* close_all_files */
/* ======================== */
bool command_enabled_close_all_files(const char *argument)
{
return !jlist_empty(get_sprite_list());
}
void command_execute_close_all_files(const char *argument)
{
while (close_current_sprite())
;
}
/**
* Closes the current sprite, asking to the user if to save it if it's
* modified.
*/
static bool close_current_sprite(void)
{
Sprite *sprite = current_sprite;
/* see if the sprite has changes */
while (sprite_is_modified(sprite)) {
/* ask what want to do the user with the changes in the sprite */
int ret = jalert("%s<<%s<<%s||%s",
_("Warning"),
_("Saving changes in:"),
int ret = jalert("%s<<%s<<%s||%s||%s||%s",
_("Warning"), _("Saving changes in:"),
get_filename(sprite->filename),
_("&Save||&Discard||&Cancel"));
_("&Save"), _("&Discard"), _("&Cancel"));
if (ret == 1) {
/* "save": save the changes */
@ -54,7 +83,7 @@ void command_execute_close_file(const char *argument)
}
else if (ret != 2) {
/* "cancel" or "ESC" */
return; /* we back doing nothing */
return FALSE; /* we back doing nothing */
}
else {
/* "discard" */
@ -65,4 +94,5 @@ void command_execute_close_file(const char *argument)
/* closes the sprite */
sprite_unmount(sprite);
sprite_free(sprite);
return TRUE;
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_dots_tool(const char *argument)
{
}

View File

@ -0,0 +1,101 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
/* ======================== */
/* brush_tool */
/* ======================== */
void command_execute_brush_tool(const char *argument)
{
}
/* ======================== */
/* dots_tool */
/* ======================== */
void command_execute_dots_tool(const char *argument)
{
}
/* ======================== */
/* ellipse_tool */
/* ======================== */
void command_execute_ellipse_tool(const char *argument)
{
}
/* ======================== */
/* floodfill_tool */
/* ======================== */
void command_execute_floodfill_tool(const char *argument)
{
}
/* ======================== */
/* line_tool */
/* ======================== */
void command_execute_line_tool(const char *argument)
{
}
/* ======================== */
/* marker_tool */
/* ======================== */
void command_execute_marker_tool(const char *argument)
{
}
/* ======================== */
/* pencil_tool */
/* ======================== */
void command_execute_pencil_tool(const char *argument)
{
}
/* ======================== */
/* rectangle_tool */
/* ======================== */
void command_execute_rectangle_tool(const char *argument)
{
}
/* ======================== */
/* spray_tool */
/* ======================== */
void command_execute_spray_tool(const char *argument)
{
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_ellipse_tool(const char *argument)
{
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_floodfill_tool(const char *argument)
{
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_line_tool(const char *argument)
{
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_make_unique_editor(const char *argument)
{
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_marker_tool(const char *argument)
{
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_pencil_tool(const char *argument)
{
}

View File

@ -1,216 +1,257 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2001-2005, 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include <allegro.h>
#include "jinete.h"
#include "core/app.h"
#include "core/core.h"
#include "dialogs/viewspr.h"
#include "modules/editors.h"
#include "modules/gfx.h"
#include "modules/gui.h"
#include "modules/render.h"
#include "raster/raster.h"
#include "widgets/editor.h"
#include "widgets/statebar.h"
#endif
void preview_sprite(int flags)
{
JWidget widget = current_editor;
if (is_interactive() && widget && editor_get_sprite(widget)) {
Editor *editor = editor_data (widget);
Sprite *sprite = editor_get_sprite (widget);
JWidget view = jwidget_get_view (widget);
int old_mouse_x, old_mouse_y;
int scroll_x, scroll_y;
int u, v, x, y, w, h;
int shiftx, shifty;
Image *image;
BITMAP *bmp;
int redraw;
JRect vp;
int bg_color, index_bg_color = -1;
jmanager_free_mouse();
vp = jview_get_viewport_position(view);
jview_get_scroll(view, &scroll_x, &scroll_y);
old_mouse_x = jmouse_x(0);
old_mouse_y = jmouse_y(0);
bmp = create_bitmap (sprite->w, sprite->h);
if (bmp) {
/* print a informative text */
status_bar_set_text(app_get_status_bar(), 1, _("Rendering..."));
jwidget_flush_redraw(app_get_status_bar());
jmanager_dispatch_messages();
jmouse_set_cursor(JI_CURSOR_NULL);
jmouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
/* render the sprite in the bitmap */
image = render_sprite(sprite, 0, 0, sprite->w, sprite->h,
sprite->frpos, 0);
if (image) {
image_to_allegro(image, bmp, 0, 0);
image_free(image);
}
if (!(flags & PREVIEW_TILED))
bg_color = palette_color[index_bg_color=0];
else
bg_color = makecol(128, 128, 128);
shiftx = - scroll_x + vp->x1 + editor->offset_x;
shifty = - scroll_y + vp->y1 + editor->offset_y;
w = sprite->w << editor->zoom;
h = sprite->h << editor->zoom;
redraw = TRUE;
do {
/* update scroll */
if (jmouse_poll()) {
shiftx += jmouse_x(0) - JI_SCREEN_W/2;
shifty += jmouse_y(0) - JI_SCREEN_H/2;
jmouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
jmouse_poll();
redraw = TRUE;
}
if (redraw) {
redraw = FALSE;
/* fit on screen */
if (flags & PREVIEW_FIT_ON_SCREEN) {
double sx, sy, scale, outw, outh;
sx = (double)JI_SCREEN_W / (double)bmp->w;
sy = (double)JI_SCREEN_H / (double)bmp->h;
scale = MIN (sx, sy);
outw = (double)bmp->w * (double)scale;
outh = (double)bmp->h * (double)scale;
stretch_blit(bmp, ji_screen, 0, 0, bmp->w, bmp->h, 0, 0, outw, outh);
rectfill_exclude(ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1,
0, 0, outw-1, outh-1, bg_color);
}
/* draw in normal size */
else {
if (!(flags & PREVIEW_TILED)) {
x = shiftx;
y = shifty;
}
else {
x = SGN(shiftx) * (ABS(shiftx)%w);
y = SGN(shifty) * (ABS(shifty)%h);
}
if (!(flags & PREVIEW_TILED)) {
/* rectfill_exclude(ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1, */
/* x, y, x+w-1, y+h-1, bg_color); */
clear_to_color(ji_screen, bg_color);
}
if (!editor->zoom) {
/* in the center */
if (!(flags & PREVIEW_TILED))
draw_sprite(ji_screen, bmp, x, y);
/* tiled */
else
for (v=y-h; v<JI_SCREEN_H+h; v+=h)
for (u=x-w; u<JI_SCREEN_W+w; u+=w)
blit(bmp, ji_screen, 0, 0, u, v, w, h);
}
else {
/* in the center */
if (!(flags & PREVIEW_TILED))
masked_stretch_blit(bmp, ji_screen, 0, 0, bmp->w, bmp->h, x, y, w, h);
/* tiled */
else
for (v=y-h; v<JI_SCREEN_H+h; v+=h)
for (u=x-w; u<JI_SCREEN_W+w; u+=w)
stretch_blit(bmp, ji_screen, 0, 0, bmp->w, bmp->h, u, v, w, h);
}
}
}
gui_feedback();
if (keypressed()) {
int c = readkey()>>8;
/* change frame */
if (editor_keys_toset_frpos(widget, c)) {
/* redraw */
redraw = TRUE;
/* render the sprite in the bitmap */
image = render_sprite(sprite, 0, 0, sprite->w, sprite->h,
sprite->frpos, 0);
if (image) {
image_to_allegro(image, bmp, 0, 0);
image_free(image);
}
}
/* change background color */
else if (c == KEY_PLUS_PAD) {
if (index_bg_color < 255) {
bg_color = palette_color[++index_bg_color];
redraw = TRUE;
}
}
else if (c == KEY_MINUS_PAD) {
if (index_bg_color > 0) {
bg_color = palette_color[--index_bg_color];
redraw = TRUE;
}
}
else
break;
}
} while (!jmouse_b(0));
destroy_bitmap(bmp);
}
do {
jmouse_poll();
gui_feedback();
} while (jmouse_b(0));
clear_keybuf();
jmouse_set_position(old_mouse_x, old_mouse_y);
jmouse_set_cursor(JI_CURSOR_NORMAL);
jmanager_refresh_screen();
jrect_free(vp);
}
}
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "modules/sprites.h"
#include <allegro.h>
#include "jinete.h"
#include "core/app.h"
#include "modules/editors.h"
#include "modules/gfx.h"
#include "modules/gui.h"
#include "modules/render.h"
#include "raster/image.h"
#include "raster/sprite.h"
#include "widgets/editor.h"
#include "widgets/statebar.h"
#endif
#define PREVIEW_TILED 1
#define PREVIEW_FIT_ON_SCREEN 2
static void preview_sprite(int flags);
bool command_enabled_preview(const char *argument)
{
return current_sprite != NULL;
}
/* ======================== */
/* preview_fit_to_screen */
/* ======================== */
void command_execute_preview_fit_to_screen(const char *argument)
{
preview_sprite(PREVIEW_FIT_ON_SCREEN);
}
/* ======================== */
/* preview_normal */
/* ======================== */
void command_execute_preview_normal(const char *argument)
{
preview_sprite(0);
}
/* ======================== */
/* preview_tiled */
/* ======================== */
void command_execute_preview_tiled(const char *argument)
{
preview_sprite(PREVIEW_TILED);
}
/**
* Shows the sprite using the complete screen.
*/
static void preview_sprite(int flags)
{
JWidget widget = current_editor;
if (widget && editor_get_sprite(widget)) {
Editor *editor = editor_data (widget);
Sprite *sprite = editor_get_sprite (widget);
JWidget view = jwidget_get_view (widget);
int old_mouse_x, old_mouse_y;
int scroll_x, scroll_y;
int u, v, x, y, w, h;
int shiftx, shifty;
Image *image;
BITMAP *bmp;
int redraw;
JRect vp;
int bg_color, index_bg_color = -1;
jmanager_free_mouse();
vp = jview_get_viewport_position(view);
jview_get_scroll(view, &scroll_x, &scroll_y);
old_mouse_x = jmouse_x(0);
old_mouse_y = jmouse_y(0);
bmp = create_bitmap (sprite->w, sprite->h);
if (bmp) {
/* print a informative text */
status_bar_set_text(app_get_status_bar(), 1, _("Rendering..."));
jwidget_flush_redraw(app_get_status_bar());
jmanager_dispatch_messages();
jmouse_set_cursor(JI_CURSOR_NULL);
jmouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
/* render the sprite in the bitmap */
image = render_sprite(sprite, 0, 0, sprite->w, sprite->h,
sprite->frpos, 0);
if (image) {
image_to_allegro(image, bmp, 0, 0);
image_free(image);
}
if (!(flags & PREVIEW_TILED))
bg_color = palette_color[index_bg_color=0];
else
bg_color = makecol(128, 128, 128);
shiftx = - scroll_x + vp->x1 + editor->offset_x;
shifty = - scroll_y + vp->y1 + editor->offset_y;
w = sprite->w << editor->zoom;
h = sprite->h << editor->zoom;
redraw = TRUE;
do {
/* update scroll */
if (jmouse_poll()) {
shiftx += jmouse_x(0) - JI_SCREEN_W/2;
shifty += jmouse_y(0) - JI_SCREEN_H/2;
jmouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
jmouse_poll();
redraw = TRUE;
}
if (redraw) {
redraw = FALSE;
/* fit on screen */
if (flags & PREVIEW_FIT_ON_SCREEN) {
double sx, sy, scale, outw, outh;
sx = (double)JI_SCREEN_W / (double)bmp->w;
sy = (double)JI_SCREEN_H / (double)bmp->h;
scale = MIN (sx, sy);
outw = (double)bmp->w * (double)scale;
outh = (double)bmp->h * (double)scale;
stretch_blit(bmp, ji_screen, 0, 0, bmp->w, bmp->h, 0, 0, outw, outh);
rectfill_exclude(ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1,
0, 0, outw-1, outh-1, bg_color);
}
/* draw in normal size */
else {
if (!(flags & PREVIEW_TILED)) {
x = shiftx;
y = shifty;
}
else {
x = SGN(shiftx) * (ABS(shiftx)%w);
y = SGN(shifty) * (ABS(shifty)%h);
}
if (!(flags & PREVIEW_TILED)) {
/* rectfill_exclude(ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1, */
/* x, y, x+w-1, y+h-1, bg_color); */
clear_to_color(ji_screen, bg_color);
}
if (!editor->zoom) {
/* in the center */
if (!(flags & PREVIEW_TILED))
draw_sprite(ji_screen, bmp, x, y);
/* tiled */
else
for (v=y-h; v<JI_SCREEN_H+h; v+=h)
for (u=x-w; u<JI_SCREEN_W+w; u+=w)
blit(bmp, ji_screen, 0, 0, u, v, w, h);
}
else {
/* in the center */
if (!(flags & PREVIEW_TILED))
masked_stretch_blit(bmp, ji_screen, 0, 0, bmp->w, bmp->h, x, y, w, h);
/* tiled */
else
for (v=y-h; v<JI_SCREEN_H+h; v+=h)
for (u=x-w; u<JI_SCREEN_W+w; u+=w)
stretch_blit(bmp, ji_screen, 0, 0, bmp->w, bmp->h, u, v, w, h);
}
}
}
gui_feedback();
if (keypressed()) {
int c = readkey()>>8;
/* change frame */
if (editor_keys_toset_frpos(widget, c)) {
/* redraw */
redraw = TRUE;
/* render the sprite in the bitmap */
image = render_sprite(sprite, 0, 0, sprite->w, sprite->h,
sprite->frpos, 0);
if (image) {
image_to_allegro(image, bmp, 0, 0);
image_free(image);
}
}
/* change background color */
else if (c == KEY_PLUS_PAD) {
if (index_bg_color < 255) {
bg_color = palette_color[++index_bg_color];
redraw = TRUE;
}
}
else if (c == KEY_MINUS_PAD) {
if (index_bg_color > 0) {
bg_color = palette_color[--index_bg_color];
redraw = TRUE;
}
}
else
break;
}
} while (!jmouse_b(0));
destroy_bitmap(bmp);
}
do {
jmouse_poll();
gui_feedback();
} while (jmouse_b(0));
clear_keybuf();
jmouse_set_position(old_mouse_x, old_mouse_y);
jmouse_set_cursor(JI_CURSOR_NORMAL);
jmanager_refresh_screen();
jrect_free(vp);
}
}

View File

@ -1,36 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "dialogs/viewspr.h"
#include "modules/sprites.h"
#endif
bool command_enabled_preview_fit_to_screen(const char *argument)
{
return current_sprite != NULL;
}
void command_execute_preview_fit_to_screen(const char *argument)
{
preview_sprite(PREVIEW_FIT_ON_SCREEN);
}

View File

@ -1,46 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "dialogs/viewspr.h"
#include "modules/sprites.h"
#endif
bool command_enabled_preview(const char *argument)
{
return current_sprite != NULL;
}
void command_execute_preview_fit_to_screen(const char *argument)
{
preview_sprite(PREVIEW_FIT_ON_SCREEN);
}
void command_execute_preview_normal(const char *argument)
{
preview_sprite(0);
}
void command_execute_preview_tiled(const char *argument)
{
preview_sprite(PREVIEW_TILED);
}

View File

@ -1,36 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "dialogs/viewspr.h"
#include "modules/sprites.h"
#endif
bool command_enabled_preview_tiled(const char *argument)
{
return current_sprite != NULL;
}
void command_execute_preview_tiled(const char *argument)
{
preview_sprite(PREVIEW_TILED);
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_rectangle_tool(const char *argument)
{
}

View File

@ -20,6 +20,9 @@
#ifndef USE_PRECOMPILED_HEADER
#include <allegro/debug.h>
#include <allegro/unicode.h>
#include "jinete.h"
#include "core/app.h"
@ -28,6 +31,41 @@
#endif
bool command_enabled_select_file(const char *argument)
{
if (argument) {
int sprite_id = ustrtol(argument, NULL, 10);
GfxObj *gfxobj = gfxobj_find(sprite_id);
return
gfxobj && gfxobj->type == GFXOBJ_SPRITE;
}
else
return TRUE;
}
bool command_selected_select_file(const char *argument)
{
if (argument) {
int sprite_id = ustrtol(argument, NULL, 10);
GfxObj *gfxobj = gfxobj_find(sprite_id);
return
gfxobj && gfxobj->type == GFXOBJ_SPRITE &&
current_sprite == (Sprite *)gfxobj;
}
else
return current_sprite == NULL;
}
void command_execute_select_file(const char *argument)
{
if (argument) {
int sprite_id = ustrtol(argument, NULL, 10);
GfxObj *gfxobj = gfxobj_find(sprite_id);
ASSERT(gfxobj != NULL);
sprite_show((Sprite *)gfxobj);
}
else {
sprite_show(NULL);
}
}

View File

@ -30,4 +30,9 @@
void command_execute_split_editor_horizontally(const char *argument)
{
"Make &Unique" = always "make_unique_editor(current_editor)" <Ctrl+1> ;
----
"Split &Vertically" = always "split_editor(current_editor, JI_VERTICAL)" <Ctrl+2> ;
"Split &Horizontally" = always "split_editor(current_editor, JI_HORIZONTAL)" <Ctrl+3> ;
----
}

View File

@ -1,33 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#endif
void command_execute_spray_tool(const char *argument)
{
}

View File

@ -20,14 +20,26 @@
#ifndef USE_PRECOMPILED_HEADER
#include "jinete.h"
#include "core/app.h"
#include "modules/sprites.h"
#include "raster/sprite.h"
#include "modules/editors.h"
#endif
void command_execute_close_editor(const char *argument)
{
close_editor(current_editor);
}
void command_execute_make_unique_editor(const char *argument)
{
make_unique_editor(current_editor);
}
void command_execute_split_editor_horizontally(const char *argument)
{
split_editor(current_editor, JI_HORIZONTAL);
}
void command_execute_split_editor_vertically(const char *argument)
{
split_editor(current_editor, JI_VERTICAL);
}

View File

@ -32,8 +32,8 @@
#define CMD0(name) { #name, NULL, NULL, command_execute_##name, NULL }
#define CMD1(name) { #name, command_enabled_##name, NULL, command_execute_##name, NULL }
/* #define CMD2(name) { #name, NULL, NULL, NULL, NULL } */
/* #define CMD3(name) { #name, NULL, NULL, NULL, NULL } */
#define CMD2(name,name2) { #name, command_enabled_##name2, NULL, command_execute_##name, NULL }
#define CMD3(name) { #name, command_enabled_##name, command_selected_##name, command_execute_##name, NULL }
/* #define CMD4(name) { #name, NULL, NULL, NULL, NULL } */
void command_execute_about(const char *argument);
@ -42,6 +42,7 @@ void command_execute_auto_crop_sprite(const char *argument);
void command_execute_brush_tool(const char *argument);
void command_execute_change_image_type(const char *argument);
void command_execute_clear(const char *argument);
bool command_enabled_close_all_files(const char *argument);
void command_execute_close_all_files(const char *argument);
void command_execute_close_editor(const char *argument);
bool command_enabled_close_file(const char *argument);
@ -97,11 +98,9 @@ void command_execute_palette_editor(const char *argument);
void command_execute_paste(const char *argument);
void command_execute_pencil_tool(const char *argument);
void command_execute_play_flic(const char *argument);
bool command_enabled_preview_fit_to_screen(const char *argument);
bool command_enabled_preview(const char *argument);
void command_execute_preview_fit_to_screen(const char *argument);
bool command_enabled_preview_normal(const char *argument);
void command_execute_preview_normal(const char *argument);
bool command_enabled_preview_tiled(const char *argument);
void command_execute_preview_tiled(const char *argument);
void command_execute_quick_copy(const char *argument);
void command_execute_quick_move(const char *argument);
@ -119,6 +118,8 @@ void command_execute_save_file_as(const char *argument);
void command_execute_save_mask(const char *argument);
void command_execute_save_session(const char *argument);
void command_execute_screen_shot(const char *argument);
bool command_enabled_select_file(const char *argument);
bool command_selected_select_file(const char *argument);
void command_execute_select_file(const char *argument);
void command_execute_split_editor_horizontally(const char *argument);
void command_execute_split_editor_vertically(const char *argument);
@ -133,7 +134,7 @@ static Command commands[] = {
{ CMD_SAVE_FILE, NULL, NULL, NULL, NULL },
{ CMD_SAVE_FILE_AS, NULL, NULL, NULL, NULL },
CMD1(close_file),
{ CMD_CLOSE_ALL_FILES, NULL, NULL, NULL, NULL },
CMD1(close_all_files),
{ CMD_SCREEN_SHOT, NULL, NULL, NULL, NULL },
{ CMD_RECORD_SCREEN, NULL, NULL, NULL, NULL },
{ CMD_LOAD_SESSION, NULL, NULL, NULL, NULL },
@ -155,13 +156,13 @@ static Command commands[] = {
{ CMD_REFRESH, NULL, NULL, NULL, NULL },
{ CMD_CONFIGURE_SCREEN, NULL, NULL, NULL, NULL },
CMD0(advanced_mode),
{ CMD_MAKE_UNIQUE_EDITOR, NULL, NULL, NULL, NULL },
{ CMD_SPLIT_EDITOR_VERTICALLY, NULL, NULL, NULL, NULL },
{ CMD_SPLIT_EDITOR_HORIZONTALLY, NULL, NULL, NULL, NULL },
{ CMD_CLOSE_EDITOR, NULL, NULL, NULL, NULL },
CMD1(preview_tiled),
CMD1(preview_normal),
CMD1(preview_fit_to_screen),
CMD0(make_unique_editor),
CMD0(split_editor_vertically),
CMD0(split_editor_horizontally),
CMD0(close_editor),
CMD2(preview_tiled,preview),
CMD2(preview_normal,preview),
CMD2(preview_fit_to_screen,preview),
{ CMD_SPRITE_PROPERTIES, NULL, NULL, NULL, NULL },
{ CMD_DUPLICATE_SPRITE, NULL, NULL, NULL, NULL },
{ CMD_CHANGE_IMAGE_TYPE, NULL, NULL, NULL, NULL },
@ -212,6 +213,7 @@ static Command commands[] = {
CMD0(tips),
{ CMD_CUSTOMIZE, NULL, NULL, NULL, NULL },
{ CMD_OPTIONS, NULL, NULL, NULL, NULL },
CMD3(select_file),
{ NULL, NULL, NULL, NULL, NULL }
};
@ -288,3 +290,15 @@ void command_add_key(Command *command, const char *string)
usprintf(buf, "<%s>", string);
jaccel_add_keys_from_string(command->accel, buf);
}
void command_reset_keys()
{
Command *cmd;
for (cmd=commands; cmd->name; cmd++) {
if (cmd->accel) {
jaccel_free(cmd->accel);
cmd->accel = NULL;
}
}
}

View File

@ -127,5 +127,6 @@ void command_execute(Command *command, const char *argument);
bool command_is_key_pressed(Command *command, JMessage msg);
void command_add_key(Command *command, const char *string);
void command_reset_keys();
#endif /* COMMANDS_COMMANDS_H */

View File

@ -217,12 +217,6 @@ void app_loop(void)
jwidget_add_child(box_tool_bar, tool_bar);
jwidget_add_child(box_status_bar, status_bar);
/* layout */
if (!get_config_bool("Layout", "MenuBar", TRUE)) jwidget_hide(menu_bar);
if (!get_config_bool("Layout", "StatusBar", TRUE)) jwidget_hide(status_bar);
if (!get_config_bool("Layout", "ColorBar", TRUE)) jwidget_hide(color_bar);
if (!get_config_bool("Layout", "ToolBar", TRUE)) jwidget_hide(tool_bar);
/* prepare the window */
jwindow_remap(top_window);
@ -318,12 +312,6 @@ void app_loop(void)
if (is_rec_screen())
rec_screen_off();
/* save layout */
set_config_bool("Layout", "MenuBar", !(menu_bar->flags & JI_HIDDEN));
set_config_bool("Layout", "StatusBar", !(status_bar->flags & JI_HIDDEN));
set_config_bool("Layout", "ColorBar", !(color_bar->flags & JI_HIDDEN));
set_config_bool("Layout", "ToolBar", !(tool_bar->flags & JI_HIDDEN));
/* remove the root-menu from the menu-bar (because the rootmenu
module should destroy it) */
jmenubar_set_menu(menu_bar, NULL);
@ -417,7 +405,7 @@ void app_realloc_sprite_list(void)
usprintf(buf, "%d", clipboard->gfxobj.id);
menuitem = menuitem_new(_("Clipboard"), cmd_select_file,
clipboard ? buf: NULL);
clipboard ? buf: "0");
/* if (!clipboard) */
/* jwidget_disable(menuitem); */
@ -532,25 +520,6 @@ JWidget app_get_status_bar(void) { return status_bar; }
JWidget app_get_color_bar(void) { return color_bar; }
JWidget app_get_tool_bar(void) { return tool_bar; }
void app_switch(JWidget widget)
{
JWidget parent = jwidget_get_parent(widget);
if (jwidget_is_visible(widget)) {
jwidget_hide(widget);
if (parent)
jwidget_hide(parent);
}
else {
jwidget_show(widget);
if (parent)
jwidget_show(parent);
}
jwindow_remap(top_window);
jwidget_dirty(top_window);
}
void app_default_status_bar_message(void)
{
status_bar_set_text(app_get_status_bar(), 250,

View File

@ -38,8 +38,6 @@ JWidget app_get_status_bar(void);
JWidget app_get_color_bar(void);
JWidget app_get_tool_bar(void);
void app_switch(JWidget widget);
void app_default_status_bar_message(void);
#endif /* CORE_APP_H */

View File

@ -1,5 +1,5 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2001-2005 David A. Capello
* Copyright (C) 2001-2005, 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -66,13 +66,16 @@ void ase_config_exit(void)
bool get_config_bool(const char *section, const char *name, bool value)
{
return (ustrcmp(get_config_string(section, name, value ? "TRUE": "FALSE"),
"TRUE") == 0) ? TRUE: FALSE;
const char *got = get_config_string(section, name, value ? "yes": "no");
return (got &&
(ustricmp(got, "yes") == 0 ||
ustricmp(got, "true") == 0 ||
ustricmp(got, "1") == 0)) ? TRUE: FALSE;
}
void set_config_bool(const char *section, const char *name, bool value)
{
set_config_string(section, name, value ? "TRUE": "FALSE");
set_config_string(section, name, value ? "yes": "no");
}
void get_config_rect(const char *section, const char *name, JRect rect)

View File

@ -23,7 +23,6 @@
#include "core/core.h"
#include "core/modules.h"
#include "effect/effect.h"
#include "modules/chkmthds.h"
#include "modules/color.h"
#include "modules/editors.h"
#include "modules/gfx.h"
@ -65,7 +64,6 @@ static Module module[] =
DEF_MODULE(render, REQUIRE_INTERFACE),
DEF_MODULE(gui, REQUIRE_INTERFACE),
DEF_MODULE(recent, REQUIRE_INTERFACE),
DEF_MODULE(check_methods, REQUIRE_INTERFACE),
DEF_MODULE(rootmenu, REQUIRE_INTERFACE),
DEF_MODULE(editors, REQUIRE_INTERFACE),
};

View File

@ -35,34 +35,34 @@
/* show the language selection dialog */
void dialogs_select_language(bool force)
{
bool select_language = get_config_bool ("Options", "SelectLanguage", TRUE);
bool select_language = get_config_bool("Options", "SelectLanguage", TRUE);
if (force || select_language) {
JWidget window = jwindow_new ("Select Language");
JWidget box = jbox_new (JI_HORIZONTAL + JI_HOMOGENEOUS);
JWidget button_en = jbutton_new ("English");
JWidget button_es = jbutton_new ("Español");
JWidget window = jwindow_new("Select Language");
JWidget box = jbox_new(JI_HORIZONTAL + JI_HOMOGENEOUS);
JWidget button_en = jbutton_new("English");
JWidget button_es = jbutton_new("Español");
JWidget killer;
jwidget_add_child (window, box);
jwidget_add_child (box, button_en);
jwidget_add_child (box, button_es);
jwidget_add_child(window, box);
jwidget_add_child(box, button_en);
jwidget_add_child(box, button_es);
jwindow_open_fg (window);
killer = jwindow_get_killer (window);
jwindow_open_fg(window);
killer = jwindow_get_killer(window);
/* en */
if (killer == button_en) {
intl_set_lang ("en");
set_config_bool ("Options", "SelectLanguage", FALSE);
intl_set_lang("en");
set_config_bool("Options", "SelectLanguage", FALSE);
}
/* es */
else if (killer == button_es) {
intl_set_lang ("es");
set_config_bool ("Options", "SelectLanguage", FALSE);
intl_set_lang("es");
set_config_bool("Options", "SelectLanguage", FALSE);
}
jwidget_free (window);
jwidget_free(window);
}
}

View File

@ -1,28 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2001-2005, 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DIALOGS_VIEWSPR_H
#define DIALOGS_VIEWSPR_H
#define PREVIEW_TILED 1
#define PREVIEW_FIT_ON_SCREEN 2
void preview_sprite(int flags);
#endif /* DIALOGS_VIEWSPR_H */

View File

@ -1,344 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2001-2005, 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#ifndef USE_PRECOMPILED_HEADER
#include "jinete/widget.h"
#include "core/app.h"
#include "dialogs/filmedit.h"
#include "modules/chkmthds.h"
#include "modules/sprites.h"
#include "modules/tools.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "raster/undo.h"
#include "util/hash.h"
#include "util/misc.h"
#include "util/recscr.h"
#endif
static HashTable *table;
static bool method_always (JWidget menuitem);
static bool method_has_sprite (JWidget menuitem);
static bool method_has_layer (JWidget menuitem);
static bool method_has_layerimage (JWidget menuitem);
static bool method_has_image (JWidget menuitem);
static bool method_can_undo (JWidget menuitem);
static bool method_can_redo (JWidget menuitem);
static bool method_has_path (JWidget menuitem);
static bool method_has_mask (JWidget menuitem);
static bool method_has_imagemask (JWidget menuitem);
static bool method_has_clipboard (JWidget menuitem);
static bool method_menu_bar (JWidget menuitem);
static bool method_status_bar (JWidget menuitem);
static bool method_color_bar (JWidget menuitem);
static bool method_tool_bar (JWidget menuitem);
static bool method_tool_marker (JWidget menuitem);
static bool method_tool_dots (JWidget menuitem);
static bool method_tool_pencil (JWidget menuitem);
static bool method_tool_brush (JWidget menuitem);
static bool method_tool_floodfill (JWidget menuitem);
static bool method_tool_spray (JWidget menuitem);
static bool method_tool_line (JWidget menuitem);
static bool method_tool_rectangle (JWidget menuitem);
static bool method_tool_ellipse (JWidget menuitem);
static bool method_is_rec (JWidget menuitem);
static bool method_is_movingframe (JWidget menuitem);
int init_module_check_methods (void)
{
table = hash_new (16);
hash_insert (table, "always", method_always);
hash_insert (table, "has_sprite", method_has_sprite);
hash_insert (table, "has_layer", method_has_layer);
hash_insert (table, "has_layerimage", method_has_layerimage);
hash_insert (table, "has_image", method_has_image);
hash_insert (table, "can_undo", method_can_undo);
hash_insert (table, "can_redo", method_can_redo);
hash_insert (table, "has_path", method_has_path);
hash_insert (table, "has_mask", method_has_mask);
hash_insert (table, "has_imagemask", method_has_imagemask);
hash_insert (table, "has_clipboard", method_has_clipboard);
hash_insert (table, "menu_bar", method_menu_bar);
hash_insert (table, "status_bar", method_status_bar);
hash_insert (table, "color_bar", method_color_bar);
hash_insert (table, "tool_bar", method_tool_bar);
hash_insert (table, "tool_marker", method_tool_marker);
hash_insert (table, "tool_dots", method_tool_dots);
hash_insert (table, "tool_pencil", method_tool_pencil);
hash_insert (table, "tool_brush", method_tool_brush);
hash_insert (table, "tool_floodfill", method_tool_floodfill);
hash_insert (table, "tool_spray", method_tool_spray);
hash_insert (table, "tool_line", method_tool_line);
hash_insert (table, "tool_rectangle", method_tool_rectangle);
hash_insert (table, "tool_ellipse", method_tool_ellipse);
hash_insert (table, "is_rec", method_is_rec);
hash_insert (table, "is_movingframe", method_is_movingframe);
return 0;
}
void exit_module_check_methods(void)
{
hash_free(table, NULL);
}
CheckMethod get_check_method(const char *name)
{
return (CheckMethod)hash_lookup(table, name);
}
static bool method_always(JWidget menuitem)
{
return TRUE;
}
static bool method_has_sprite(JWidget menuitem)
{
return (current_sprite) ? TRUE: FALSE;
}
static bool method_has_layer(JWidget menuitem)
{
return (current_sprite &&
current_sprite->layer) ? TRUE: FALSE;
}
static bool method_has_layerimage(JWidget menuitem)
{
return (current_sprite &&
current_sprite->layer &&
layer_is_image(current_sprite->layer));
}
static bool method_has_image(JWidget menuitem)
{
if ((!current_sprite) ||
(!current_sprite->layer) ||
(!current_sprite->layer->readable) ||
(!current_sprite->layer->writeable))
return FALSE;
else
return GetImage () ? TRUE: FALSE;
}
static bool method_can_undo(JWidget menuitem)
{
return current_sprite && undo_can_undo(current_sprite->undo);
}
static bool method_can_redo(JWidget menuitem)
{
return current_sprite && undo_can_redo(current_sprite->undo);
}
static bool method_has_path(JWidget menuitem)
{
if (!current_sprite)
return FALSE;
else
return (current_sprite->path) ? TRUE: FALSE;
}
static bool method_has_mask(JWidget menuitem)
{
if (!current_sprite)
return FALSE;
else
return (current_sprite->mask &&
current_sprite->mask->bitmap) ? TRUE: FALSE;
}
static bool method_has_imagemask(JWidget menuitem)
{
if ((!current_sprite) ||
(!current_sprite->layer) ||
(!current_sprite->layer->readable) ||
(!current_sprite->layer->writeable) ||
(!current_sprite->mask) ||
(!current_sprite->mask->bitmap))
return FALSE;
else
return GetImage() ? TRUE: FALSE;
}
static bool method_has_clipboard(JWidget menuitem)
{
Sprite *sprite = current_sprite;
Sprite *clipboard = get_clipboard_sprite();
return (sprite &&
clipboard &&
(clipboard != sprite));
}
static bool method_menu_bar(JWidget menuitem)
{
if (jwidget_is_visible(app_get_menu_bar()))
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_status_bar(JWidget menuitem)
{
if (jwidget_is_visible(app_get_status_bar()))
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_color_bar(JWidget menuitem)
{
if (jwidget_is_visible(app_get_color_bar()))
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_tool_bar(JWidget menuitem)
{
if (jwidget_is_visible(app_get_tool_bar()))
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_tool_marker(JWidget menuitem)
{
if (current_tool == &ase_tool_marker)
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_tool_dots(JWidget menuitem)
{
if (current_tool == &ase_tool_dots)
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_tool_pencil(JWidget menuitem)
{
if (current_tool == &ase_tool_pencil)
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_tool_brush(JWidget menuitem)
{
if (current_tool == &ase_tool_brush)
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_tool_floodfill (JWidget menuitem)
{
if (current_tool == &ase_tool_floodfill)
jwidget_select (menuitem);
else
jwidget_deselect (menuitem);
return TRUE;
}
static bool method_tool_spray (JWidget menuitem)
{
if (current_tool == &ase_tool_spray)
jwidget_select (menuitem);
else
jwidget_deselect (menuitem);
return TRUE;
}
static bool method_tool_line (JWidget menuitem)
{
if (current_tool == &ase_tool_line)
jwidget_select (menuitem);
else
jwidget_deselect (menuitem);
return TRUE;
}
static bool method_tool_rectangle (JWidget menuitem)
{
if (current_tool == &ase_tool_rectangle)
jwidget_select (menuitem);
else
jwidget_deselect (menuitem);
return TRUE;
}
static bool method_tool_ellipse(JWidget menuitem)
{
if (current_tool == &ase_tool_ellipse)
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_is_rec(JWidget menuitem)
{
if (is_rec_screen())
jwidget_select(menuitem);
else
jwidget_deselect(menuitem);
return TRUE;
}
static bool method_is_movingframe(JWidget menuitem)
{
return is_movingframe ();
}

View File

@ -1,31 +0,0 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2001-2005 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MODULES_CHKMTHDS_H
#define MODULES_CHKMTHDS_H
#include "jinete/base.h"
typedef bool (*CheckMethod) (JWidget menuitem);
int init_module_check_methods (void);
void exit_module_check_methods (void);
CheckMethod get_check_method (const char *name);
#endif /* MODULES_CHKMTHDS_H */

View File

@ -31,7 +31,6 @@
#include "core/core.h"
#include "core/dirs.h"
#include "intl/intl.h"
#include "modules/chkmthds.h"
#include "modules/rootmenu.h"
#include "util/filetoks.h"
#include "widgets/menuitem.h"
@ -45,7 +44,6 @@ static JWidget recent_list_menuitem;
static JWidget layer_popup_menuitem;
static JWidget frame_popup_menuitem;
static JWidget filters_popup_menuitem;
/* static JWidget accel_menuitem[ACCEL_MAX]; */
static JWidget convert_xmlelem_to_menu(JXmlElem elem);
static JWidget convert_xmlelem_to_menuitem(JXmlElem elem);
@ -66,6 +64,7 @@ void exit_module_rootmenu(void)
frame_popup_menuitem = 0;
filters_popup_menuitem = 0;
command_reset_keys();
jwidget_free(root_menu);
}
@ -80,8 +79,10 @@ int load_root_menu(void)
jmenubar_set_menu(app_get_menu_bar(), NULL);
/* destroy `root-menu' if it exists */
if (root_menu)
if (root_menu) {
command_reset_keys();
jwidget_free(root_menu);
}
/* create a new empty-menu */
root_menu = NULL;
@ -209,19 +210,6 @@ JWidget get_recent_list_menuitem(void) { return recent_list_menuitem; }
JWidget get_layer_popup_menuitem(void) { return layer_popup_menuitem; }
JWidget get_frame_popup_menuitem(void) { return frame_popup_menuitem; }
/* int check_for_accel(int accel_type, JMessage msg) */
/* { */
/* if (accel_menuitem[accel_type]) { */
/* JAccel accel = jmenuitem_get_accel(accel_menuitem[accel_type]); */
/* if (accel) */
/* return jaccel_check(accel, */
/* msg->any.shifts, */
/* msg->key.ascii, */
/* msg->key.scancode); */
/* } */
/* return FALSE; */
/* } */
void show_fx_popup_menu(void)
{
if (is_interactive() &&
@ -328,7 +316,7 @@ static void apply_shortcut_to_menuitems_with_command(JWidget menu, Command *comm
if (jwidget_get_type(menuitem) == JI_MENUITEM) {
if (menuitem_get_command(menuitem) == command) {
jmenuitem_set_accel(menuitem, command->accel);
jmenuitem_set_accel(menuitem, jaccel_new_copy(command->accel));
}
submenu = jmenuitem_get_submenu(menuitem);

View File

@ -1,5 +1,5 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2001-2005 David A. Capello
* Copyright (C) 2001-2005, 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,9 +37,9 @@ enum {
/* struct GfxObjProperty; */
typedef struct GfxObj GfxObj;
struct GfxObj
typedef struct GfxObj GfxObj;
struct GfxObj
{
int type;
unsigned int id;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* ase -- allegro-sprite-editor: the ultimate sprites factory
* Copyright (C) 2001-2005 David A. Capello
* Copyright (C) 2001-2005, 2007 David A. Capello
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -46,45 +46,45 @@ struct Undo
int size_limit; /* limit for undo stream size */
};
Undo *undo_new (struct Sprite *sprite);
void undo_free (Undo *undo);
Undo *undo_new(struct Sprite *sprite);
void undo_free(Undo *undo);
void undo_enable (Undo *undo);
void undo_disable (Undo *undo);
void undo_enable(Undo *undo);
void undo_disable(Undo *undo);
bool undo_is_enabled (Undo *undo);
bool undo_is_disabled (Undo *undo);
bool undo_is_enabled(Undo *undo);
bool undo_is_disabled(Undo *undo);
bool undo_can_undo (Undo *undo);
bool undo_can_redo (Undo *undo);
bool undo_can_undo(Undo *undo);
bool undo_can_redo(Undo *undo);
void undo_undo (Undo *undo);
void undo_redo (Undo *undo);
void undo_undo(Undo *undo);
void undo_redo(Undo *undo);
void undo_open (Undo *undo);
void undo_close (Undo *undo);
void undo_data (Undo *undo, GfxObj *gfxobj, void *data, int size);
void undo_image (Undo *undo, struct Image *image, int x, int y, int w, int h);
void undo_flip (Undo *undo, struct Image *image, int x1, int y1, int x2, int y2, int horz);
void undo_dirty (Undo *undo, struct Dirty *dirty);
void undo_add_image (Undo *undo, struct Stock *stock, struct Image *image);
void undo_remove_image (Undo *undo, struct Stock *stock, struct Image *image);
void undo_replace_image (Undo *undo, struct Stock *stock, int index);
void undo_add_frame (Undo *undo, struct Layer *layer, struct Frame *frame);
void undo_remove_frame (Undo *undo, struct Layer *layer, struct Frame *frame);
void undo_add_layer (Undo *undo, struct Layer *set, struct Layer *layer);
void undo_remove_layer (Undo *undo, struct Layer *layer);
void undo_move_layer (Undo *undo, struct Layer *layer);
void undo_set_layer (Undo *undo, struct Sprite *sprite);
void undo_set_mask (Undo *undo, struct Sprite *sprite);
void undo_open(Undo *undo);
void undo_close(Undo *undo);
void undo_data(Undo *undo, GfxObj *gfxobj, void *data, int size);
void undo_image(Undo *undo, struct Image *image, int x, int y, int w, int h);
void undo_flip(Undo *undo, struct Image *image, int x1, int y1, int x2, int y2, int horz);
void undo_dirty(Undo *undo, struct Dirty *dirty);
void undo_add_image(Undo *undo, struct Stock *stock, struct Image *image);
void undo_remove_image(Undo *undo, struct Stock *stock, struct Image *image);
void undo_replace_image(Undo *undo, struct Stock *stock, int index);
void undo_add_frame(Undo *undo, struct Layer *layer, struct Frame *frame);
void undo_remove_frame(Undo *undo, struct Layer *layer, struct Frame *frame);
void undo_add_layer(Undo *undo, struct Layer *set, struct Layer *layer);
void undo_remove_layer(Undo *undo, struct Layer *layer);
void undo_move_layer(Undo *undo, struct Layer *layer);
void undo_set_layer(Undo *undo, struct Sprite *sprite);
void undo_set_mask(Undo *undo, struct Sprite *sprite);
#define undo_int(undo, gfxobj, value_address) \
undo_data ((undo), (gfxobj), (void *)(value_address), sizeof (int))
undo_data((undo), (gfxobj), (void *)(value_address), sizeof(int))
#define undo_double(undo, gfxobj, value_address) \
undo_data ((undo), (gfxobj), (void *)(value_address), sizeof (double))
undo_data((undo), (gfxobj), (void *)(value_address), sizeof(double))
#define undo_string(undo, gfxobj, string) \
undo_data ((undo), (gfxobj), (void *)(string), strlen (string)+1)
undo_data((undo), (gfxobj), (void *)(string), strlen(string)+1)
#endif /* RASTER_UNDO_H */

View File

@ -731,7 +731,6 @@ static int bind_jwidget_hook_signal (lua_State *L)
#include "dialogs/tips.h"
#include "dialogs/toolconf.h"
#include "dialogs/vectmap.h"
#include "dialogs/viewspr.h"
#include "file/file.h"
#include "intl/intl.h"
#include "modules/rootmenu.h"

View File

@ -31,7 +31,6 @@
#include "commands/commands.h"
#include "core/core.h"
#include "modules/chkmthds.h"
#include "modules/gui.h"
#include "script/script.h"