diff --git a/ChangeLog b/ChangeLog index f0ecec5c2b..01628cbb2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2005-08-03 Sven Neumann + + * app/core/core-enums.[ch]: added GIMP_UNDO_FOREGROUND_SELECT. + + * app/tools/Makefile.am + * app/tools/gimpforegroundselecttool-undo.[ch]: added stubs for + undo in the new foreground selection tool. + + * tools/pdbgen/pdb/procedural_db.pdb: include gimpbase.h for + gimp_canonicalize_identifier(). + + * app/pdb/procedural_db_cmds.c: regenerated. + + * app/file/file-utils.c: fixed signedness warning. + 2005-08-03 Sven Neumann * libgimpmath/gimpmd5.c diff --git a/app/core/core-enums.c b/app/core/core-enums.c index cc991c248e..2df5825e2e 100644 --- a/app/core/core-enums.c +++ b/app/core/core-enums.c @@ -793,6 +793,7 @@ gimp_undo_type_get_type (void) { GIMP_UNDO_TRANSFORM, "GIMP_UNDO_TRANSFORM", "transform" }, { GIMP_UNDO_PAINT, "GIMP_UNDO_PAINT", "paint" }, { GIMP_UNDO_INK, "GIMP_UNDO_INK", "ink" }, + { GIMP_UNDO_FOREGROUND_SELECT, "GIMP_UNDO_FOREGROUND_SELECT", "foreground-select" }, { GIMP_UNDO_PARASITE_ATTACH, "GIMP_UNDO_PARASITE_ATTACH", "parasite-attach" }, { GIMP_UNDO_PARASITE_REMOVE, "GIMP_UNDO_PARASITE_REMOVE", "parasite-remove" }, { GIMP_UNDO_CANT, "GIMP_UNDO_CANT", "cant" }, @@ -879,6 +880,7 @@ gimp_undo_type_get_type (void) { GIMP_UNDO_TRANSFORM, N_("Transform"), NULL }, { GIMP_UNDO_PAINT, N_("Paint"), NULL }, { GIMP_UNDO_INK, N_("Ink"), NULL }, + { GIMP_UNDO_FOREGROUND_SELECT, "GIMP_UNDO_FOREGROUND_SELECT", NULL }, { GIMP_UNDO_PARASITE_ATTACH, N_("Attach parasite"), NULL }, { GIMP_UNDO_PARASITE_REMOVE, N_("Remove parasite"), NULL }, { GIMP_UNDO_CANT, N_("EEK: can't undo"), NULL }, diff --git a/app/core/core-enums.h b/app/core/core-enums.h index 2a64f06791..a6b683e97d 100644 --- a/app/core/core-enums.h +++ b/app/core/core-enums.h @@ -422,6 +422,7 @@ typedef enum /*< pdb-skip >*/ GIMP_UNDO_TRANSFORM, /*< desc="Transform" >*/ GIMP_UNDO_PAINT, /*< desc="Paint" >*/ GIMP_UNDO_INK, /*< desc="Ink" >*/ + GIMP_UNDO_FOREGROUND_SELECT, /*< desc="Select foreground >*/ GIMP_UNDO_PARASITE_ATTACH, /*< desc="Attach parasite" >*/ GIMP_UNDO_PARASITE_REMOVE, /*< desc="Remove parasite" >*/ diff --git a/app/file/file-utils.c b/app/file/file-utils.c index 3b354488b9..98c2647f81 100644 --- a/app/file/file-utils.c +++ b/app/file/file-utils.c @@ -491,7 +491,7 @@ file_check_single_magic (const gchar *offset, const gchar *num_operator_ptr; gchar num_operator; gchar num_test; - guchar mem_testval[256]; + gchar mem_testval[256]; /* Check offset */ if (sscanf (offset, "%ld", &offs) != 1) return (0); @@ -606,7 +606,7 @@ file_check_single_magic (const gchar *offset, if (offs + numbytes <= headsize) /* We have it in memory ? */ { - found = (memcmp (mem_testval, file_head+offs, numbytes) == 0); + found = (memcmp (mem_testval, file_head + offs, numbytes) == 0); } else /* Read it from file */ { @@ -615,7 +615,7 @@ file_check_single_magic (const gchar *offset, for (k = 0; found && (k < numbytes); k++) { c = getc (ifp); - found = (c != EOF) && (c == (int)mem_testval[k]); + found = (c != EOF) && (c == (int) mem_testval[k]); } } } diff --git a/app/pdb/procedural_db_cmds.c b/app/pdb/procedural_db_cmds.c index fbb1c16bf1..6a0b6a48c0 100644 --- a/app/pdb/procedural_db_cmds.c +++ b/app/pdb/procedural_db_cmds.c @@ -23,6 +23,8 @@ #include +#include "libgimpbase/gimpbase.h" + #include "pdb-types.h" #include "procedural_db.h" diff --git a/app/tools/Makefile.am b/app/tools/Makefile.am index fd98cce2cb..77ca242b9e 100644 --- a/app/tools/Makefile.am +++ b/app/tools/Makefile.am @@ -72,6 +72,8 @@ libapptools_a_sources = \ gimpforegroundselectoptions.h \ gimpforegroundselecttool.c \ gimpforegroundselecttool.h \ + gimpforegroundselecttool-undo.c \ + gimpforegroundselecttool-undo.h \ gimpfuzzyselecttool.c \ gimpfuzzyselecttool.h \ gimphistogramoptions.c \ diff --git a/app/tools/gimpforegroundselecttool-undo.c b/app/tools/gimpforegroundselecttool-undo.c new file mode 100644 index 0000000000..66edce5b5e --- /dev/null +++ b/app/tools/gimpforegroundselecttool-undo.c @@ -0,0 +1,107 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "tools-types.h" + +#include "base/tile-manager.h" + +#include "core/gimpimage-undo.h" +#include "core/gimpimage.h" +#include "core/gimpundo.h" + +#include "gimptoolcontrol.h" +#include "gimpforegroundselecttool.h" +#include "gimpforegroundselecttool-undo.h" +#include "tool_manager.h" + + +typedef struct +{ + gint tool_ID; +} FgSelectUndo; + + +static gboolean undo_pop_foreground_select (GimpUndo *undo, + GimpUndoMode undo_mode, + GimpUndoAccumulator *accum); +static void undo_free_foreground_select (GimpUndo *undo, + GimpUndoMode undo_mode); + + +gboolean +gimp_foreground_select_tool_push_undo (GimpImage *gimage, + const gchar *undo_desc, + gint tool_ID) +{ + GimpUndo *new; + + if ((new = gimp_image_undo_push (gimage, GIMP_TYPE_UNDO, + sizeof (FgSelectUndo), + sizeof (FgSelectUndo), + GIMP_UNDO_FOREGROUND_SELECT, undo_desc, + FALSE, + undo_pop_foreground_select, + undo_free_foreground_select, + NULL))) + { + FgSelectUndo *undo = new->data; + + undo->tool_ID = tool_ID; + + return TRUE; + } + + return FALSE; +} + +static gboolean +undo_pop_foreground_select (GimpUndo *undo, + GimpUndoMode undo_mode, + GimpUndoAccumulator *accum) +{ + GimpTool *active_tool; + + active_tool = tool_manager_get_active (undo->gimage->gimp); + + if (GIMP_IS_FOREGROUND_SELECT_TOOL (active_tool)) + { + FgSelectUndo *fg_undo = undo->data; + + /* only pop if the active tool is the tool that pushed this undo */ + if (fg_undo->tool_ID == active_tool->ID) + { + + } + } + + return TRUE; +} + +static void +undo_free_foreground_select (GimpUndo *undo, + GimpUndoMode undo_mode) +{ + FgSelectUndo *fg_undo = undo->data; + + + g_free (fg_undo); +} diff --git a/app/tools/gimpforegroundselecttool-undo.h b/app/tools/gimpforegroundselecttool-undo.h new file mode 100644 index 0000000000..f15c4f3959 --- /dev/null +++ b/app/tools/gimpforegroundselecttool-undo.h @@ -0,0 +1,28 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public 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 __GIMP_FOREGROUND_SELECT_TOOL_UNDO_H__ +#define __GIMP_FOREGROUND_SELECT_TOOL_UNDO_H__ + + +gboolean gimp_foreground_select_tool_push_undo (GimpImage *gimage, + const gchar *undo_desc, + gint tool_ID); + + +#endif /* __GIMP_FOREGROUND_SELECT_TOOL_UNDO_H__ */ diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 016b694ba0..1a6961e7c1 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -32,13 +32,13 @@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datadir = @datadir@ +datarootdir = @datarootdir@ libdir = @libdir@ localedir = $(libdir)/locale gnulocaledir = $(datadir)/locale gettextsrcdir = $(datadir)/glib-2.0/gettext/po subdir = po install_sh = @install_sh@ -mkdir_p = @mkdir_p@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs INSTALL = @INSTALL@ diff --git a/tools/pdbgen/pdb/procedural_db.pdb b/tools/pdbgen/pdb/procedural_db.pdb index 59b77e2113..09a88ef3db 100644 --- a/tools/pdbgen/pdb/procedural_db.pdb +++ b/tools/pdbgen/pdb/procedural_db.pdb @@ -388,7 +388,7 @@ CODE ); } -@headers = qw("core/gimp.h" "procedural-db-query.h"); +@headers = qw("libgimpbase/gimpbase.h" "core/gimp.h" "procedural-db-query.h"); @procs = qw(procedural_db_temp_name procedural_db_dump procedural_db_query procedural_db_proc_info