diff --git a/ChangeLog b/ChangeLog index fb694c2c41..5e58e55200 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Jun 12 14:17:54 EDT 1998 Adrian Likins + + *app/file_new_dialog.c + app/file_new_dialog.h: + app/gloal_edit.c: added behaviour so that the + new file size will default to the current cut buffer + if its "fresh" + Thu Jun 11 23:37:06 PDT 1998 Manish Singh * gimp.m4: .m4 file for autoconf gimptool stuff diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 794c6e4af7..1f2b8e57a8 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -19,6 +19,7 @@ #include "appenv.h" #include "actionarea.h" #include "drawable.h" +#include "file_new_dialog.h" #include "floating_sel.h" #include "gdisplay.h" #include "gimage.h" @@ -198,6 +199,10 @@ edit_cut (GImage *gimage, else cropped_cut = NULL; + if(cut) + file_new_reset_current_cut_buffer(); + + /* end the group undo */ undo_push_group_end (gimage); @@ -245,6 +250,10 @@ edit_copy (GImage *gimage, else cropped_copy = NULL; + if(copy) + file_new_reset_current_cut_buffer(); + + if (cropped_copy) { /* Free the old global edit buffer */ diff --git a/app/core/gimpedit.c b/app/core/gimpedit.c index 794c6e4af7..1f2b8e57a8 100644 --- a/app/core/gimpedit.c +++ b/app/core/gimpedit.c @@ -19,6 +19,7 @@ #include "appenv.h" #include "actionarea.h" #include "drawable.h" +#include "file_new_dialog.h" #include "floating_sel.h" #include "gdisplay.h" #include "gimage.h" @@ -198,6 +199,10 @@ edit_cut (GImage *gimage, else cropped_cut = NULL; + if(cut) + file_new_reset_current_cut_buffer(); + + /* end the group undo */ undo_push_group_end (gimage); @@ -245,6 +250,10 @@ edit_copy (GImage *gimage, else cropped_copy = NULL; + if(copy) + file_new_reset_current_cut_buffer(); + + if (cropped_copy) { /* Free the old global edit buffer */ diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c index ebed68b132..02ee883ae1 100644 --- a/app/dialogs/image-new-dialog.c +++ b/app/dialogs/image-new-dialog.c @@ -5,10 +5,13 @@ #include "app_procs.h" #include "commands.h" #include "general.h" +#include "gimage.h" #include "gimage_cmds.h" #include "gimprc.h" +#include "global_edit.h" #include "interface.h" #include "plug_in.h" +#include "tile_manager_pvt.h" typedef struct { GtkWidget *dlg; @@ -49,6 +52,7 @@ static int last_fill_type = BACKGROUND_FILL; static float last_resolution = 72; /* always in DPI */ static float last_unit = 1; static float last_res_unit =1; +static gboolean last_new_image = TRUE; /* these are temps that should be set in gimprc eventually */ /* FIXME */ @@ -57,7 +61,7 @@ static float default_unit =1; static float default_res_unit = 1; static int new_dialog_run; - +extern TileManager *global_buf; static void file_new_ok_callback (GtkWidget *widget, @@ -74,7 +78,7 @@ file_new_ok_callback (GtkWidget *widget, vals->width = atoi (gtk_entry_get_text (GTK_ENTRY (vals->width_entry))); vals->height = atoi (gtk_entry_get_text (GTK_ENTRY (vals->height_entry))); vals->resolution = atof (gtk_entry_get_text (GTK_ENTRY (vals->resolution_entry))); - + last_new_image = TRUE; gtk_widget_destroy (vals->dlg); last_width = vals->width; @@ -84,6 +88,7 @@ file_new_ok_callback (GtkWidget *widget, last_resolution = vals->resolution; last_unit = vals->unit; last_res_unit = vals->res_unit; + switch (vals->fill_type) { @@ -436,8 +441,6 @@ file_new_cmd_callback (GtkWidget *widget, char buffer[32]; float temp; - - if(!new_dialog_run) { last_width = default_width; @@ -483,6 +486,17 @@ file_new_cmd_callback (GtkWidget *widget, if (vals->type == INDEXED) vals->type = RGB; /* no indexed images */ + /* if a cut buffer exist, default to using its size for the new image */ + /* also check to see if a new_image has been opened */ + + printf("last_new_image is: %d \n", last_new_image); + if(global_buf && !last_new_image) + { + vals->width = global_buf->levels[0].width; + vals->height = global_buf->levels[0].height; + printf("foo foo foo\n"); + } + vals->dlg = gtk_dialog_new (); gtk_window_set_wmclass (GTK_WINDOW (vals->dlg), "new_image", "Gimp"); gtk_window_set_title (GTK_WINDOW (vals->dlg), "New Image"); @@ -749,3 +763,10 @@ file_new_cmd_callback (GtkWidget *widget, gtk_widget_show (vals->dlg); } +void file_new_reset_current_cut_buffer() +{ + /* this unction just changes the status of last_image_new + so i can if theres been a cut/copy since the last file new */ + last_new_image = FALSE; + +} diff --git a/app/dialogs/image-new-dialog.h b/app/dialogs/image-new-dialog.h index 33e168153c..d14773d813 100644 --- a/app/dialogs/image-new-dialog.h +++ b/app/dialogs/image-new-dialog.h @@ -7,4 +7,6 @@ void file_new_cmd_callback (GtkWidget *widget, gpointer callback_data, guint callback_action); +void file_new_reset_current_cut_buffer(); + #endif /* __FILE_DIALOG_NEW_H__ */ diff --git a/app/file_new_dialog.c b/app/file_new_dialog.c index ebed68b132..02ee883ae1 100644 --- a/app/file_new_dialog.c +++ b/app/file_new_dialog.c @@ -5,10 +5,13 @@ #include "app_procs.h" #include "commands.h" #include "general.h" +#include "gimage.h" #include "gimage_cmds.h" #include "gimprc.h" +#include "global_edit.h" #include "interface.h" #include "plug_in.h" +#include "tile_manager_pvt.h" typedef struct { GtkWidget *dlg; @@ -49,6 +52,7 @@ static int last_fill_type = BACKGROUND_FILL; static float last_resolution = 72; /* always in DPI */ static float last_unit = 1; static float last_res_unit =1; +static gboolean last_new_image = TRUE; /* these are temps that should be set in gimprc eventually */ /* FIXME */ @@ -57,7 +61,7 @@ static float default_unit =1; static float default_res_unit = 1; static int new_dialog_run; - +extern TileManager *global_buf; static void file_new_ok_callback (GtkWidget *widget, @@ -74,7 +78,7 @@ file_new_ok_callback (GtkWidget *widget, vals->width = atoi (gtk_entry_get_text (GTK_ENTRY (vals->width_entry))); vals->height = atoi (gtk_entry_get_text (GTK_ENTRY (vals->height_entry))); vals->resolution = atof (gtk_entry_get_text (GTK_ENTRY (vals->resolution_entry))); - + last_new_image = TRUE; gtk_widget_destroy (vals->dlg); last_width = vals->width; @@ -84,6 +88,7 @@ file_new_ok_callback (GtkWidget *widget, last_resolution = vals->resolution; last_unit = vals->unit; last_res_unit = vals->res_unit; + switch (vals->fill_type) { @@ -436,8 +441,6 @@ file_new_cmd_callback (GtkWidget *widget, char buffer[32]; float temp; - - if(!new_dialog_run) { last_width = default_width; @@ -483,6 +486,17 @@ file_new_cmd_callback (GtkWidget *widget, if (vals->type == INDEXED) vals->type = RGB; /* no indexed images */ + /* if a cut buffer exist, default to using its size for the new image */ + /* also check to see if a new_image has been opened */ + + printf("last_new_image is: %d \n", last_new_image); + if(global_buf && !last_new_image) + { + vals->width = global_buf->levels[0].width; + vals->height = global_buf->levels[0].height; + printf("foo foo foo\n"); + } + vals->dlg = gtk_dialog_new (); gtk_window_set_wmclass (GTK_WINDOW (vals->dlg), "new_image", "Gimp"); gtk_window_set_title (GTK_WINDOW (vals->dlg), "New Image"); @@ -749,3 +763,10 @@ file_new_cmd_callback (GtkWidget *widget, gtk_widget_show (vals->dlg); } +void file_new_reset_current_cut_buffer() +{ + /* this unction just changes the status of last_image_new + so i can if theres been a cut/copy since the last file new */ + last_new_image = FALSE; + +} diff --git a/app/file_new_dialog.h b/app/file_new_dialog.h index 33e168153c..d14773d813 100644 --- a/app/file_new_dialog.h +++ b/app/file_new_dialog.h @@ -7,4 +7,6 @@ void file_new_cmd_callback (GtkWidget *widget, gpointer callback_data, guint callback_action); +void file_new_reset_current_cut_buffer(); + #endif /* __FILE_DIALOG_NEW_H__ */ diff --git a/app/global_edit.c b/app/global_edit.c index 794c6e4af7..1f2b8e57a8 100644 --- a/app/global_edit.c +++ b/app/global_edit.c @@ -19,6 +19,7 @@ #include "appenv.h" #include "actionarea.h" #include "drawable.h" +#include "file_new_dialog.h" #include "floating_sel.h" #include "gdisplay.h" #include "gimage.h" @@ -198,6 +199,10 @@ edit_cut (GImage *gimage, else cropped_cut = NULL; + if(cut) + file_new_reset_current_cut_buffer(); + + /* end the group undo */ undo_push_group_end (gimage); @@ -245,6 +250,10 @@ edit_copy (GImage *gimage, else cropped_copy = NULL; + if(copy) + file_new_reset_current_cut_buffer(); + + if (cropped_copy) { /* Free the old global edit buffer */ diff --git a/app/gui/file-new-dialog.c b/app/gui/file-new-dialog.c index ebed68b132..02ee883ae1 100644 --- a/app/gui/file-new-dialog.c +++ b/app/gui/file-new-dialog.c @@ -5,10 +5,13 @@ #include "app_procs.h" #include "commands.h" #include "general.h" +#include "gimage.h" #include "gimage_cmds.h" #include "gimprc.h" +#include "global_edit.h" #include "interface.h" #include "plug_in.h" +#include "tile_manager_pvt.h" typedef struct { GtkWidget *dlg; @@ -49,6 +52,7 @@ static int last_fill_type = BACKGROUND_FILL; static float last_resolution = 72; /* always in DPI */ static float last_unit = 1; static float last_res_unit =1; +static gboolean last_new_image = TRUE; /* these are temps that should be set in gimprc eventually */ /* FIXME */ @@ -57,7 +61,7 @@ static float default_unit =1; static float default_res_unit = 1; static int new_dialog_run; - +extern TileManager *global_buf; static void file_new_ok_callback (GtkWidget *widget, @@ -74,7 +78,7 @@ file_new_ok_callback (GtkWidget *widget, vals->width = atoi (gtk_entry_get_text (GTK_ENTRY (vals->width_entry))); vals->height = atoi (gtk_entry_get_text (GTK_ENTRY (vals->height_entry))); vals->resolution = atof (gtk_entry_get_text (GTK_ENTRY (vals->resolution_entry))); - + last_new_image = TRUE; gtk_widget_destroy (vals->dlg); last_width = vals->width; @@ -84,6 +88,7 @@ file_new_ok_callback (GtkWidget *widget, last_resolution = vals->resolution; last_unit = vals->unit; last_res_unit = vals->res_unit; + switch (vals->fill_type) { @@ -436,8 +441,6 @@ file_new_cmd_callback (GtkWidget *widget, char buffer[32]; float temp; - - if(!new_dialog_run) { last_width = default_width; @@ -483,6 +486,17 @@ file_new_cmd_callback (GtkWidget *widget, if (vals->type == INDEXED) vals->type = RGB; /* no indexed images */ + /* if a cut buffer exist, default to using its size for the new image */ + /* also check to see if a new_image has been opened */ + + printf("last_new_image is: %d \n", last_new_image); + if(global_buf && !last_new_image) + { + vals->width = global_buf->levels[0].width; + vals->height = global_buf->levels[0].height; + printf("foo foo foo\n"); + } + vals->dlg = gtk_dialog_new (); gtk_window_set_wmclass (GTK_WINDOW (vals->dlg), "new_image", "Gimp"); gtk_window_set_title (GTK_WINDOW (vals->dlg), "New Image"); @@ -749,3 +763,10 @@ file_new_cmd_callback (GtkWidget *widget, gtk_widget_show (vals->dlg); } +void file_new_reset_current_cut_buffer() +{ + /* this unction just changes the status of last_image_new + so i can if theres been a cut/copy since the last file new */ + last_new_image = FALSE; + +} diff --git a/app/gui/file-new-dialog.h b/app/gui/file-new-dialog.h index 33e168153c..d14773d813 100644 --- a/app/gui/file-new-dialog.h +++ b/app/gui/file-new-dialog.h @@ -7,4 +7,6 @@ void file_new_cmd_callback (GtkWidget *widget, gpointer callback_data, guint callback_action); +void file_new_reset_current_cut_buffer(); + #endif /* __FILE_DIALOG_NEW_H__ */