Implemented file revert

-Yosh
This commit is contained in:
Manish Singh 1999-01-12 01:31:49 +00:00
parent d182f93904
commit 344ffe8e52
24 changed files with 194 additions and 14 deletions

View File

@ -1,3 +1,10 @@
Mon Jan 11 17:30:06 PST 1999 Manish Singh <yosh@gimp.org>
* commands.[ch]
* fileops.[ch]
* gdisplay.[ch]
* menus.c: implemented File->Revert
Mon Jan 11 22:02:10 GMT 1999 Adam D. Moss <adam@gimp.org>
* app/paint_funcs.c:

View File

@ -123,6 +123,14 @@ file_save_as_cmd_callback (GtkWidget *widget,
file_save_as_callback (widget, client_data);
}
void
file_revert_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
file_revert_callback (widget, client_data);
}
void

View File

@ -10,6 +10,7 @@ void file_new_cmd_callback (GtkWidget *widget,
void file_open_cmd_callback (GtkWidget *, gpointer);
void file_save_cmd_callback (GtkWidget *, gpointer);
void file_save_as_cmd_callback (GtkWidget *, gpointer);
void file_revert_cmd_callback (GtkWidget *, gpointer);
void file_pref_cmd_callback (GtkWidget *, gpointer);
void file_close_cmd_callback (GtkWidget *, gpointer);
void file_quit_cmd_callback (GtkWidget *, gpointer);

View File

@ -123,6 +123,14 @@ file_save_as_cmd_callback (GtkWidget *widget,
file_save_as_callback (widget, client_data);
}
void
file_revert_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
file_revert_callback (widget, client_data);
}
void

View File

@ -10,6 +10,7 @@ void file_new_cmd_callback (GtkWidget *widget,
void file_open_cmd_callback (GtkWidget *, gpointer);
void file_save_cmd_callback (GtkWidget *, gpointer);
void file_save_as_cmd_callback (GtkWidget *, gpointer);
void file_revert_cmd_callback (GtkWidget *, gpointer);
void file_pref_cmd_callback (GtkWidget *, gpointer);
void file_close_cmd_callback (GtkWidget *, gpointer);
void file_quit_cmd_callback (GtkWidget *, gpointer);

View File

@ -1886,3 +1886,32 @@ gdisplay_hash (GDisplay *display)
return (gulong) display;
}
void
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
{
char title [MAX_TITLE_BUF];
int instance;
if (gdisp->idle_render.active)
{
printf(_("Deleted idlerendering gdisp %p...\n"), gdisp); fflush(stdout);
printf(_("\tIdlerender stops now!\n")); fflush(stdout);
gtk_idle_remove (gdisp->idle_render.idleid);
gdisp->idle_render.active = FALSE;
printf(_("\tDeletion finished.\n")); fflush(stdout);
}
gimage_delete (gdisp->gimage);
gdisplay_format_title (gimage, title);
instance = gimage->instance_count;
gimage->instance_count++;
gimage->ref_count++;
gdisp->gimage = gimage;
gdisp->instance = instance;
gdisplay_expose_full (gdisp);
gdisplay_flush (gdisp);
}

View File

@ -144,6 +144,7 @@ struct _GDisplay
/* member function declarations */
GDisplay * gdisplay_new (GimpImage *, unsigned int);
void gdisplay_reconnect (GDisplay *, GimpImage *);
void gdisplay_remove_and_delete (GDisplay *);
int gdisplay_mask_value (GDisplay *, int, int);
int gdisplay_mask_bounds (GDisplay *, int *, int *, int *, int *);

View File

@ -1886,3 +1886,32 @@ gdisplay_hash (GDisplay *display)
return (gulong) display;
}
void
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
{
char title [MAX_TITLE_BUF];
int instance;
if (gdisp->idle_render.active)
{
printf(_("Deleted idlerendering gdisp %p...\n"), gdisp); fflush(stdout);
printf(_("\tIdlerender stops now!\n")); fflush(stdout);
gtk_idle_remove (gdisp->idle_render.idleid);
gdisp->idle_render.active = FALSE;
printf(_("\tDeletion finished.\n")); fflush(stdout);
}
gimage_delete (gdisp->gimage);
gdisplay_format_title (gimage, title);
instance = gimage->instance_count;
gimage->instance_count++;
gimage->ref_count++;
gdisp->gimage = gimage;
gdisp->instance = instance;
gdisplay_expose_full (gdisp);
gdisplay_flush (gdisp);
}

View File

@ -144,6 +144,7 @@ struct _GDisplay
/* member function declarations */
GDisplay * gdisplay_new (GimpImage *, unsigned int);
void gdisplay_reconnect (GDisplay *, GimpImage *);
void gdisplay_remove_and_delete (GDisplay *);
int gdisplay_mask_value (GDisplay *, int, int);
int gdisplay_mask_bounds (GDisplay *, int *, int *, int *, int *);

View File

@ -68,6 +68,9 @@ static gint file_overwrite_delete_callback (GtkWidget *w,
GdkEvent *e,
gpointer client_data);
static GimpImage* file_open_image (char *filename,
char *raw_filename);
static void file_open_ok_callback (GtkWidget *w,
gpointer client_data);
static void file_save_ok_callback (GtkWidget *w,
@ -650,6 +653,30 @@ file_save_as_callback (GtkWidget *w,
file_dialog_show (filesave);
}
void
file_revert_callback (GtkWidget *w,
gpointer client_data)
{
GDisplay *gdisplay;
GimpImage *gimage;
char *filename, *raw_filename;
gdisplay = gdisplay_active ();
if (gdisplay->gimage->has_filename == FALSE)
g_message (_("Can't revert. No filename associated with this image"));
else
{
filename = gimage_filename (gdisplay->gimage);
raw_filename = prune_filename (filename);
if ((gimage = file_open_image (filename, raw_filename)) != NULL)
gdisplay_reconnect (gdisplay, gimage);
else
g_message (_("Revert failed."));
}
}
void
file_load_by_extension_callback (GtkWidget *w,
gpointer client_data)
@ -712,16 +739,15 @@ file_save_type_callback (GtkWidget *w,
save_file_proc = proc;
}
int
file_open (char *filename, char* raw_filename)
static GimpImage*
file_open_image (char *filename, char *raw_filename)
{
PlugInProcDef *file_proc;
ProcRecord *proc;
Argument *args;
Argument *return_vals;
GImage *gimage;
int gimage_id;
int return_val;
gboolean status;
int i;
file_proc = load_file_proc;
@ -731,7 +757,7 @@ file_open (char *filename, char* raw_filename)
if (!file_proc)
{
/* WARNING */
return FALSE;
return NULL;
}
proc = &file_proc->db_info;
@ -747,28 +773,41 @@ file_open (char *filename, char* raw_filename)
args[2].value.pdb_pointer = raw_filename;
return_vals = procedural_db_execute (proc->name, args);
return_val = (return_vals[0].value.pdb_int == PDB_SUCCESS);
status = (return_vals[0].value.pdb_int == PDB_SUCCESS);
gimage_id = return_vals[1].value.pdb_int;
procedural_db_destroy_args (return_vals, proc->num_values);
g_free (args);
if ((gimage = gimage_get_ID (gimage_id)) != NULL)
if (status)
return pdb_id_to_image (gimage_id);
else
return NULL;
}
int
file_open (char *filename, char *raw_filename)
{
GimpImage *gimage;
if ((gimage = file_open_image (filename, raw_filename)) != NULL)
{
/* enable & clear all undo steps */
/* enable & clear all undo steps */
gimage_enable_undo (gimage);
/* set the image to clean */
/* set the image to clean */
gimage_clean_all (gimage);
/* display the image */
/* display the image */
gdisplay_new (gimage, 0x0101);
idea_add (filename);
menus_last_opened_add (filename);
return TRUE;
}
return return_val;
return FALSE;
}
int

View File

@ -32,6 +32,8 @@ void file_save_callback (GtkWidget *w,
gpointer client_data);
void file_save_as_callback (GtkWidget *w,
gpointer client_data);
void file_revert_callback (GtkWidget *w,
gpointer client_data);
void file_load_by_extension_callback (GtkWidget *w,
gpointer client_data);
void file_save_by_extension_callback (GtkWidget *w,

View File

@ -1886,3 +1886,32 @@ gdisplay_hash (GDisplay *display)
return (gulong) display;
}
void
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
{
char title [MAX_TITLE_BUF];
int instance;
if (gdisp->idle_render.active)
{
printf(_("Deleted idlerendering gdisp %p...\n"), gdisp); fflush(stdout);
printf(_("\tIdlerender stops now!\n")); fflush(stdout);
gtk_idle_remove (gdisp->idle_render.idleid);
gdisp->idle_render.active = FALSE;
printf(_("\tDeletion finished.\n")); fflush(stdout);
}
gimage_delete (gdisp->gimage);
gdisplay_format_title (gimage, title);
instance = gimage->instance_count;
gimage->instance_count++;
gimage->ref_count++;
gdisp->gimage = gimage;
gdisp->instance = instance;
gdisplay_expose_full (gdisp);
gdisplay_flush (gdisp);
}

View File

@ -144,6 +144,7 @@ struct _GDisplay
/* member function declarations */
GDisplay * gdisplay_new (GimpImage *, unsigned int);
void gdisplay_reconnect (GDisplay *, GimpImage *);
void gdisplay_remove_and_delete (GDisplay *);
int gdisplay_mask_value (GDisplay *, int, int);
int gdisplay_mask_bounds (GDisplay *, int *, int *, int *, int *);

View File

@ -123,6 +123,14 @@ file_save_as_cmd_callback (GtkWidget *widget,
file_save_as_callback (widget, client_data);
}
void
file_revert_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
file_revert_callback (widget, client_data);
}
void

View File

@ -10,6 +10,7 @@ void file_new_cmd_callback (GtkWidget *widget,
void file_open_cmd_callback (GtkWidget *, gpointer);
void file_save_cmd_callback (GtkWidget *, gpointer);
void file_save_as_cmd_callback (GtkWidget *, gpointer);
void file_revert_cmd_callback (GtkWidget *, gpointer);
void file_pref_cmd_callback (GtkWidget *, gpointer);
void file_close_cmd_callback (GtkWidget *, gpointer);
void file_quit_cmd_callback (GtkWidget *, gpointer);

View File

@ -123,6 +123,14 @@ file_save_as_cmd_callback (GtkWidget *widget,
file_save_as_callback (widget, client_data);
}
void
file_revert_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
file_revert_callback (widget, client_data);
}
void

View File

@ -10,6 +10,7 @@ void file_new_cmd_callback (GtkWidget *widget,
void file_open_cmd_callback (GtkWidget *, gpointer);
void file_save_cmd_callback (GtkWidget *, gpointer);
void file_save_as_cmd_callback (GtkWidget *, gpointer);
void file_revert_cmd_callback (GtkWidget *, gpointer);
void file_pref_cmd_callback (GtkWidget *, gpointer);
void file_close_cmd_callback (GtkWidget *, gpointer);
void file_quit_cmd_callback (GtkWidget *, gpointer);

View File

@ -76,6 +76,7 @@ static const GtkItemFactoryEntry image_entries[] =
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
{ N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
{ N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 },
{ N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 },
{ N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" },

View File

@ -76,6 +76,7 @@ static const GtkItemFactoryEntry image_entries[] =
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
{ N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
{ N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 },
{ N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 },
{ N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" },

View File

@ -76,6 +76,7 @@ static const GtkItemFactoryEntry image_entries[] =
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
{ N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
{ N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 },
{ N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 },
{ N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" },

View File

@ -76,6 +76,7 @@ static const GtkItemFactoryEntry image_entries[] =
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
{ N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
{ N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 },
{ N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 },
{ N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" },

View File

@ -91,7 +91,9 @@ for i in $autogen_dirs; do
aclocal $ACLOCAL_FLAGS
# optionally feature autoheader
(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader
if grep AM_CONFIG_HEADER configure.in >/dev/null ; then
(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader
fi
automake --add-missing $am_opt
autoconf

View File

@ -51,7 +51,7 @@ dnl Why the heck isn't there already a macro for this?
AC_ARG_WITH(gnu-make, [ --with-gnu-make assume 'make' understands gnu extensions],
,
if $MAKE -v 2>/dev/null | grep 'GNU Make' >/dev/null; then
if $ac_make -v 2>/dev/null | grep 'GNU Make' >/dev/null; then
with_gnu_make=yes
fi)

View File

@ -1,5 +1,5 @@
AC_INIT(gcg.c)
AM_INIT_AUTOMAKE(gcg, 0.1)
AM_INIT_AUTOMAKE(gcg, 0.1, no-define)
AM_MAINTAINER_MODE