gimp/app/dialogs/file-save-dialog.c

467 lines
12 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
* Copyright (C) 1997 Josh MacDonald
*
* 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "file-dialog-utils.h"
#include "file-save-dialog.h"
#include "menus.h"
app/core/Makefile.am app/core/core-types.h added an "application object" 2001-07-04 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimp.[ch]: added an "application object" called Gimp. Currently, it contains the image list, the clipboard, the data factories, the procedural hashtable and the tool info list. It's the toplevel object of the core object system. Finally, creating a Gimp object will return a standalone gimp core engine instance with no other global states/variables involved. * app/app_procs.[ch]: allocate a "Gimp" instance called "the_gimp" :) Removed stuff which is now done by the "Gimp" object. Merged gimp_init() into app_init() because gimp_init() is taken now. * app/context_manager.[ch]: removed stuff done by "Gimp". * app/batch.[ch] * app/gimage.[ch] * app/xcf/xcf-load.[ch] * app/xcf/xcf.[ch] * app/core/gimpedit.[ch] * app/tools/tool_manager.[ch]: pass around an additional "Gimp" argument. * app/pdb/procedural_db.[ch]: pass a "Gimp" pointer as first parameter to all internal procedures and to all procedural_db_* functions. * app/core/gimpcontext.[ch] * app/core/gimpimage.[ch]: added a "Gimp" pointer to the structs. * app/devices.c * app/errors.c * app/file-open.c * app/file-save.c * app/gimphelp.c * app/gimpunit.c * app/image_new.c * app/main.c * app/nav_window.c * app/plug_in.c * app/base/base.c * app/core/gimpdatafactory.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimptoolinfo.[ch] * app/gui/brush-select.c * app/gui/convert-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/gui.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/test-commands.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimppainttool.h * app/tools/gimptexttool.c * app/tools/gimptransformtool.h * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpcursor.c * app/widgets/gimpdnd.c * app/widgets/gimpimagedock.c: changed accordingly. Cleaned up lots of includes. Many files still access the global "the_gimp" variable exported by app_procs.h. * tools/pdbgen/app.pl * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/procedural_db.pdb: changed accordingly. Don't use "the_gimp" here because all procedures get passed a "Gimp" pointer now. * app/pdb/*: regenerated.
2001-07-05 03:31:35 +08:00
#include "app_procs.h"
#include "docindex.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
typedef struct _OverwriteData OverwriteData;
struct _OverwriteData
{
gchar *full_filename;
gchar *raw_filename;
};
static void file_save_dialog_create (void);
static void file_overwrite (gchar *filename,
gchar *raw_filename);
static void file_overwrite_callback (GtkWidget *widget,
gboolean overwrite,
gpointer data);
static void file_save_ok_callback (GtkWidget *widget,
gpointer data);
static void file_save_type_callback (GtkWidget *widget,
gpointer data);
static GtkWidget *filesave = NULL;
static GtkWidget *save_options = NULL;
static PlugInProcDef *save_file_proc = NULL;
static GimpImage *the_gimage = NULL;
static gboolean set_filename = TRUE;
/* public functions */
void
file_save_dialog_menu_init (void)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
GSList *list;
save_procs = g_slist_reverse (save_procs);
for (list = save_procs; list; list = g_slist_next (list))
{
gchar *help_page;
file_proc = (PlugInProcDef *) list->data;
help_page = g_strconcat ("filters/",
g_basename (file_proc->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = file_proc->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = file_save_type_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, NULL, file_proc);
}
}
void
file_save_dialog_menu_reset (void)
{
save_file_proc = NULL;
}
void
file_save_dialog_show (GimpImage *gimage)
{
const gchar *filename;
if (! gimp_image_active_drawable (gimage))
return;
the_gimage = gimage;
set_filename = TRUE;
filename = gimp_object_get_name (GIMP_OBJECT (the_gimage));
if (! filesave)
file_save_dialog_create ();
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
if (GTK_WIDGET_VISIBLE (filesave))
return;
gtk_window_set_title (GTK_WINDOW (filesave), _("Save Image"));
gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesave),
filename ?
filename :
"." G_DIR_SEPARATOR_S);
switch (gimp_drawable_type (gimp_image_active_drawable (gimage)))
{
case RGB_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_RGB_IMAGE);
break;
case RGBA_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_RGBA_IMAGE);
break;
case GRAY_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_GRAY_IMAGE);
break;
case GRAYA_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_GRAYA_IMAGE);
break;
case INDEXED_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_INDEXED_IMAGE);
break;
case INDEXEDA_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_INDEXEDA_IMAGE);
break;
}
file_dialog_show (filesave);
}
void
file_save_a_copy_dialog_show (GimpImage *gimage)
{
const gchar *filename;
if (! gimp_image_active_drawable (gimage))
return;
the_gimage = gimage;
set_filename = FALSE;
filename = gimp_object_get_name (GIMP_OBJECT (the_gimage));
if (! filesave)
file_save_dialog_create ();
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
if (GTK_WIDGET_VISIBLE (filesave))
return;
gtk_window_set_title (GTK_WINDOW (filesave), _("Save a Copy of the Image"));
gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesave),
filename ?
filename :
"." G_DIR_SEPARATOR_S);
switch (gimp_drawable_type (gimp_image_active_drawable (gimage)))
{
case RGB_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_RGB_IMAGE);
break;
case RGBA_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_RGBA_IMAGE);
break;
case GRAY_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_GRAY_IMAGE);
break;
case GRAYA_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_GRAYA_IMAGE);
break;
case INDEXED_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_INDEXED_IMAGE);
break;
case INDEXEDA_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_INDEXEDA_IMAGE);
break;
}
file_dialog_show (filesave);
}
/* private functions */
static void
file_save_dialog_create (void)
{
filesave = gtk_file_selection_new (_("Save Image"));
gtk_window_set_wmclass (GTK_WINDOW (filesave), "save_image", "Gimp");
gtk_window_set_position (GTK_WINDOW (filesave), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (filesave), 2);
gtk_container_set_border_width
(GTK_CONTAINER (GTK_FILE_SELECTION (filesave)->button_area), 2);
gtk_signal_connect_object
(GTK_OBJECT (GTK_FILE_SELECTION (filesave)->cancel_button), "clicked",
GTK_SIGNAL_FUNC (file_dialog_hide),
GTK_OBJECT (filesave));
gtk_signal_connect (GTK_OBJECT (filesave), "delete_event",
GTK_SIGNAL_FUNC (file_dialog_hide),
NULL);
gtk_signal_connect
(GTK_OBJECT (GTK_FILE_SELECTION (filesave)->ok_button), "clicked",
GTK_SIGNAL_FUNC (file_save_ok_callback),
filesave);
gtk_quit_add_destroy (1, GTK_OBJECT (filesave));
/* Connect the "F1" help key */
gimp_help_connect (filesave,
gimp_standard_help_func,
"save/dialogs/file_save.html");
{
GtkWidget *frame;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *option_menu;
GtkWidget *save_menu;
save_options = gtk_hbox_new (TRUE, 1);
frame = gtk_frame_new (_("Save Options"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_box_pack_start (GTK_BOX (save_options), frame, TRUE, TRUE, 4);
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
label = gtk_label_new (_("Determine File Type:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
option_menu = gtk_option_menu_new ();
gtk_box_pack_start (GTK_BOX (hbox), option_menu, TRUE, TRUE, 0);
gtk_widget_show (option_menu);
save_menu = menus_get_save_factory ()->widget;
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), save_menu);
gtk_widget_show (frame);
/* pack the containing save_options hbox into the save-dialog */
gtk_box_pack_end (GTK_BOX (GTK_FILE_SELECTION (filesave)->main_vbox),
save_options, FALSE, FALSE, 0);
}
gtk_widget_show (save_options);
}
static void
file_save_type_callback (GtkWidget *widget,
gpointer data)
{
PlugInProcDef *proc = (PlugInProcDef *) data;
file_dialog_update_name (proc, filesave);
save_file_proc = proc;
}
static void
file_save_ok_callback (GtkWidget *widget,
gpointer data)
{
GtkFileSelection *fs;
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) 2001-07-24 Michael Natterer <mitch@gimp.org> Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) * configure.in: require glib/gtk+ >= 1.3.7, commented out the gtkxmhtml stuff. From now on, you will need glib, pango, atk and gtk+ HEAD from CVS to hack or use GIMP HEAD. Beware, it crashes randomly :) * app/core/Makefile.am * app/core/gimpmarshal.list: new file plus rules to generate gimpmarshal.[ch] from it. * app/core/* * app/tools/* * app/widgets/* * libgimpwidgets/*: started to use the glib object system. All core/ objects are still gtk objects however. All signals are created using g_signal_new(). There are many gtk+ artefacts left. Finally, we will _not_ use the gtk_signal_foo() wrappers and friends any more. * app/colormaps.c * app/devices.[ch] * app/disp_callbacks.c * app/errorconsole.c * app/file-save.[ch] * app/interface.c * app/module_db.c * app/nav_window.c * app/ops_buttons.c * app/scroll.c * app/user_install.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/brushes-commands.c * app/gui/color-notebook.c * app/gui/colormap-dialog.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradients-commands.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/layer-select.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.[ch] * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimp/gimpui.c * libgimpbase/gimpenv.c: tons and tons of changes like "const gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete and currently disables), lots of s/gtk_signal/g_signal/, removal/replacement of deprecated stuff, s/GtkSignalFunc/GCallback/ and lots of small changes and fixes while I was on it, zillions of warnings left... * modules/Makefile.am: disabled the water color selector temporarily (XInput issues). * plug-ins/Makefile.am * plug-ins/common/.cvsignore * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl: simply excluded all plug-ins which did not build (including Script-Fu). They are trivial to fix.
2001-07-25 05:27:11 +08:00
const gchar *filename;
const gchar *raw_filename;
gchar *dot;
gint x;
struct stat buf;
gint err;
fs = GTK_FILE_SELECTION (data);
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) 2001-07-24 Michael Natterer <mitch@gimp.org> Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning) * configure.in: require glib/gtk+ >= 1.3.7, commented out the gtkxmhtml stuff. From now on, you will need glib, pango, atk and gtk+ HEAD from CVS to hack or use GIMP HEAD. Beware, it crashes randomly :) * app/core/Makefile.am * app/core/gimpmarshal.list: new file plus rules to generate gimpmarshal.[ch] from it. * app/core/* * app/tools/* * app/widgets/* * libgimpwidgets/*: started to use the glib object system. All core/ objects are still gtk objects however. All signals are created using g_signal_new(). There are many gtk+ artefacts left. Finally, we will _not_ use the gtk_signal_foo() wrappers and friends any more. * app/colormaps.c * app/devices.[ch] * app/disp_callbacks.c * app/errorconsole.c * app/file-save.[ch] * app/interface.c * app/module_db.c * app/nav_window.c * app/ops_buttons.c * app/scroll.c * app/user_install.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/brushes-commands.c * app/gui/color-notebook.c * app/gui/colormap-dialog.c * app/gui/dialogs-commands.c * app/gui/dialogs-constructors.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradients-commands.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/layer-select.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/patterns-commands.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.[ch] * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * libgimp/gimpbrushmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimp/gimpui.c * libgimpbase/gimpenv.c: tons and tons of changes like "const gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete and currently disables), lots of s/gtk_signal/g_signal/, removal/replacement of deprecated stuff, s/GtkSignalFunc/GCallback/ and lots of small changes and fixes while I was on it, zillions of warnings left... * modules/Makefile.am: disabled the water color selector temporarily (XInput issues). * plug-ins/Makefile.am * plug-ins/common/.cvsignore * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl: simply excluded all plug-ins which did not build (including Script-Fu). They are trivial to fix.
2001-07-25 05:27:11 +08:00
filename = gtk_file_selection_get_filename (fs);
raw_filename = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
g_assert (filename && raw_filename);
for (dot = strrchr (filename, '.'), x = 0; dot && *(++dot);)
{
if (*dot != 'e' || ++x < 0)
break;
else if (x > 3 && !strcmp (dot + 1, "k"))
{
ProcRecord *proc_rec;
Argument *args;
GimpDrawable *the_drawable;
the_drawable = gimp_image_active_drawable (the_gimage);
if (!the_drawable)
return;
app/core/Makefile.am app/core/core-types.h added an "application object" 2001-07-04 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimp.[ch]: added an "application object" called Gimp. Currently, it contains the image list, the clipboard, the data factories, the procedural hashtable and the tool info list. It's the toplevel object of the core object system. Finally, creating a Gimp object will return a standalone gimp core engine instance with no other global states/variables involved. * app/app_procs.[ch]: allocate a "Gimp" instance called "the_gimp" :) Removed stuff which is now done by the "Gimp" object. Merged gimp_init() into app_init() because gimp_init() is taken now. * app/context_manager.[ch]: removed stuff done by "Gimp". * app/batch.[ch] * app/gimage.[ch] * app/xcf/xcf-load.[ch] * app/xcf/xcf.[ch] * app/core/gimpedit.[ch] * app/tools/tool_manager.[ch]: pass around an additional "Gimp" argument. * app/pdb/procedural_db.[ch]: pass a "Gimp" pointer as first parameter to all internal procedures and to all procedural_db_* functions. * app/core/gimpcontext.[ch] * app/core/gimpimage.[ch]: added a "Gimp" pointer to the structs. * app/devices.c * app/errors.c * app/file-open.c * app/file-save.c * app/gimphelp.c * app/gimpunit.c * app/image_new.c * app/main.c * app/nav_window.c * app/plug_in.c * app/base/base.c * app/core/gimpdatafactory.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimptoolinfo.[ch] * app/gui/brush-select.c * app/gui/convert-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/gui.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/test-commands.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimppainttool.h * app/tools/gimptexttool.c * app/tools/gimptransformtool.h * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpcursor.c * app/widgets/gimpdnd.c * app/widgets/gimpimagedock.c: changed accordingly. Cleaned up lots of includes. Many files still access the global "the_gimp" variable exported by app_procs.h. * tools/pdbgen/app.pl * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/procedural_db.pdb: changed accordingly. Don't use "the_gimp" here because all procedures get passed a "Gimp" pointer now. * app/pdb/*: regenerated.
2001-07-05 03:31:35 +08:00
proc_rec = procedural_db_lookup (the_gimp, "plug_in_the_slimy_egg");
if (!proc_rec)
break;
file_dialog_hide (filesave);
args = g_new (Argument, 3);
Makefile.am configure.in added new directory libgimpbase/ 2001-05-21 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool-1.4.in: added new directory libgimpbase/ * app/Makefile.am: link against the new lib. * app/appenums.h: removed the PDB enums which are in libgimpbase/gimpbasetypes.h now. They are all "Gimp" prefixed. * app/apptypes.h: #include "libgimpbase/gimpbasetypes.h" * app/[lots] * app/core/[of] * app/gui/[files] * app/tools/: changed includes and all PDB types. * app/pdb/*: regenerated. * libgimp/Makefile.am: don't build libgimpi.a uglyness any more. * libgimp/gimpenv.[ch] * libgimp/gimplimits.[hh] * libgimp/gimpparasite.[ch] * libgimp/gimpparasiteio.[ch] * libgimp/gimpprotocol.[ch] * libgimp/gimpsignal.[ch] * libgimp/gimpunit.h * libgimp/gimputils.[ch] * libgimp/gimpwire.[ch]: removed... * libgimpbase/*: ...and added here as new library. * libgimp/gimp.[ch] * libgimp/gimpdrawable.[ch] * libgimp/gimpenums.h * libgimp/gimpimage.[ch] * libgimp/gimptile.c * libgimp/gimptypes.h * libgimp/gimpunit.c: changed accordingly. Added the gimp_*_add_new_parasite to gimp.[ch], gimpdrawable.[ch] and gimpimage.[ch]. * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpsizeentry.c * libgimpwidgets/gimpunitmenu.c * libgimpwidgets/gimpwidgets.c * libgimpwidgets/gimpwidgetstypes.h: changed includes accordingly. * plug-ins/*/Makefile.am * plug-ins/common/mkgen.pl: link against libgimpbase. * tools/pdbgen/Makefile.am: scan libgimpbase/gimpbasetypes.h, so the enums are known to pdbgen... * tools/pdbgen/enumcode.pl: ...but don't write them out to libgimp/gimpenums.h * tools/pdbgen/app.pl: include libgimp/gimpbase.h in all *_cmds.c files. Added GIMP_ to the type names ganerated in app/. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/procedural_db.pdb * tools/pdbgen/pdb/unit.pdb: changed includes.
2001-05-21 21:58:46 +08:00
args[0].arg_type = GIMP_PDB_INT32;
args[0].value.pdb_int = RUN_INTERACTIVE;
Makefile.am configure.in added new directory libgimpbase/ 2001-05-21 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool-1.4.in: added new directory libgimpbase/ * app/Makefile.am: link against the new lib. * app/appenums.h: removed the PDB enums which are in libgimpbase/gimpbasetypes.h now. They are all "Gimp" prefixed. * app/apptypes.h: #include "libgimpbase/gimpbasetypes.h" * app/[lots] * app/core/[of] * app/gui/[files] * app/tools/: changed includes and all PDB types. * app/pdb/*: regenerated. * libgimp/Makefile.am: don't build libgimpi.a uglyness any more. * libgimp/gimpenv.[ch] * libgimp/gimplimits.[hh] * libgimp/gimpparasite.[ch] * libgimp/gimpparasiteio.[ch] * libgimp/gimpprotocol.[ch] * libgimp/gimpsignal.[ch] * libgimp/gimpunit.h * libgimp/gimputils.[ch] * libgimp/gimpwire.[ch]: removed... * libgimpbase/*: ...and added here as new library. * libgimp/gimp.[ch] * libgimp/gimpdrawable.[ch] * libgimp/gimpenums.h * libgimp/gimpimage.[ch] * libgimp/gimptile.c * libgimp/gimptypes.h * libgimp/gimpunit.c: changed accordingly. Added the gimp_*_add_new_parasite to gimp.[ch], gimpdrawable.[ch] and gimpimage.[ch]. * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpsizeentry.c * libgimpwidgets/gimpunitmenu.c * libgimpwidgets/gimpwidgets.c * libgimpwidgets/gimpwidgetstypes.h: changed includes accordingly. * plug-ins/*/Makefile.am * plug-ins/common/mkgen.pl: link against libgimpbase. * tools/pdbgen/Makefile.am: scan libgimpbase/gimpbasetypes.h, so the enums are known to pdbgen... * tools/pdbgen/enumcode.pl: ...but don't write them out to libgimp/gimpenums.h * tools/pdbgen/app.pl: include libgimp/gimpbase.h in all *_cmds.c files. Added GIMP_ to the type names ganerated in app/. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/procedural_db.pdb * tools/pdbgen/pdb/unit.pdb: changed includes.
2001-05-21 21:58:46 +08:00
args[1].arg_type = GIMP_PDB_IMAGE;
args[1].value.pdb_int = gimp_image_get_ID (the_gimage);
Makefile.am configure.in added new directory libgimpbase/ 2001-05-21 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool-1.4.in: added new directory libgimpbase/ * app/Makefile.am: link against the new lib. * app/appenums.h: removed the PDB enums which are in libgimpbase/gimpbasetypes.h now. They are all "Gimp" prefixed. * app/apptypes.h: #include "libgimpbase/gimpbasetypes.h" * app/[lots] * app/core/[of] * app/gui/[files] * app/tools/: changed includes and all PDB types. * app/pdb/*: regenerated. * libgimp/Makefile.am: don't build libgimpi.a uglyness any more. * libgimp/gimpenv.[ch] * libgimp/gimplimits.[hh] * libgimp/gimpparasite.[ch] * libgimp/gimpparasiteio.[ch] * libgimp/gimpprotocol.[ch] * libgimp/gimpsignal.[ch] * libgimp/gimpunit.h * libgimp/gimputils.[ch] * libgimp/gimpwire.[ch]: removed... * libgimpbase/*: ...and added here as new library. * libgimp/gimp.[ch] * libgimp/gimpdrawable.[ch] * libgimp/gimpenums.h * libgimp/gimpimage.[ch] * libgimp/gimptile.c * libgimp/gimptypes.h * libgimp/gimpunit.c: changed accordingly. Added the gimp_*_add_new_parasite to gimp.[ch], gimpdrawable.[ch] and gimpimage.[ch]. * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpsizeentry.c * libgimpwidgets/gimpunitmenu.c * libgimpwidgets/gimpwidgets.c * libgimpwidgets/gimpwidgetstypes.h: changed includes accordingly. * plug-ins/*/Makefile.am * plug-ins/common/mkgen.pl: link against libgimpbase. * tools/pdbgen/Makefile.am: scan libgimpbase/gimpbasetypes.h, so the enums are known to pdbgen... * tools/pdbgen/enumcode.pl: ...but don't write them out to libgimp/gimpenums.h * tools/pdbgen/app.pl: include libgimp/gimpbase.h in all *_cmds.c files. Added GIMP_ to the type names ganerated in app/. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/procedural_db.pdb * tools/pdbgen/pdb/unit.pdb: changed includes.
2001-05-21 21:58:46 +08:00
args[2].arg_type = GIMP_PDB_DRAWABLE;
args[2].value.pdb_int = gimp_drawable_get_ID (the_drawable);
plug_in_run (proc_rec, args, 3, FALSE, TRUE, 0);
g_free (args);
return;
}
}
err = stat (filename, &buf);
if (err == 0)
{
if (buf.st_mode & S_IFDIR)
{
if (filename[strlen (filename) - 1] != G_DIR_SEPARATOR)
{
gchar *s = g_strconcat (filename, G_DIR_SEPARATOR_S, NULL);
gtk_file_selection_set_filename (fs, s);
g_free (s);
}
else
gtk_file_selection_set_filename (fs, filename);
}
else
{
gtk_widget_set_sensitive (GTK_WIDGET (fs), FALSE);
file_overwrite (g_strdup (filename), g_strdup (raw_filename));
}
}
else
{
gtk_widget_set_sensitive (GTK_WIDGET (fs), FALSE);
if (file_save_with_proc (the_gimage,
filename, raw_filename,
save_file_proc,
set_filename))
{
file_dialog_hide (GTK_WIDGET (fs));
}
gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE);
}
}
static void
file_overwrite (gchar *filename,
gchar *raw_filename)
{
OverwriteData *overwrite_data;
GtkWidget *query_box;
gchar *overwrite_text;
overwrite_data = g_new (OverwriteData, 1);
overwrite_data->full_filename = filename;
overwrite_data->raw_filename = raw_filename;
overwrite_text = g_strdup_printf (_("%s exists, overwrite?"), filename);
query_box = gimp_query_boolean_box (_("File Exists!"),
gimp_standard_help_func,
"save/file_exists.html",
FALSE,
overwrite_text,
GTK_STOCK_YES, GTK_STOCK_NO,
NULL, NULL,
file_overwrite_callback,
overwrite_data);
g_free (overwrite_text);
gtk_widget_show (query_box);
}
static void
file_overwrite_callback (GtkWidget *widget,
gboolean overwrite,
gpointer data)
{
OverwriteData *overwrite_data;
overwrite_data = (OverwriteData *) data;
if (overwrite)
{
if (file_save_with_proc (the_gimage,
overwrite_data->full_filename,
overwrite_data->raw_filename,
save_file_proc,
set_filename))
{
file_dialog_hide (GTK_WIDGET (filesave));
}
}
/* always make file save dialog sensitive */
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
g_free (overwrite_data->full_filename);
g_free (overwrite_data->raw_filename);
g_free (overwrite_data);
}