Fixed a problem in the gradient editor that made the gimp crash, when started

with the no-data option and no gradients are load.


--Sven
This commit is contained in:
Sven Neumann 1998-03-17 23:16:40 +00:00
parent 29e9112114
commit f5395e48b1
5 changed files with 66 additions and 8 deletions

View File

@ -1,3 +1,9 @@
Wed Mar 18 00:06:50 MET 1998 Sven Neumann <sven@gimp.org>
* gradient.c: fixed a problem in the gradient editor
when gimp is started with the no-data option and no
gradients are load.
Tue Mar 17 01:38:18 PST 1998 Manish Singh <yosh@gimp.org>
* updated gif, animationplay, animoptimize, and bmp plugins

View File

@ -1311,6 +1311,9 @@ ed_copy_gradient_callback(GtkWidget *widget, gpointer client_data)
{
char *name;
if (curr_gradient == NULL)
return;
name = g_malloc((strlen(curr_gradient->name) + 6) * sizeof(char));
sprintf(name, "%s copy", curr_gradient->name);
@ -1531,6 +1534,8 @@ ed_save_pov_callback(GtkWidget *widget, gpointer client_data)
{
GtkWidget *window;
if (curr_gradient == NULL) return;
window = gtk_file_selection_new("Save as POV-Ray");
gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE);
@ -1767,6 +1772,10 @@ prev_events(GtkWidget *widget, GdkEvent *event)
gint x, y;
GdkEventButton *bevent;
/* ignore events when no gradient is present */
if (curr_gradient == NULL)
return FALSE;
switch (event->type) {
case GDK_EXPOSE:
prev_update(0);
@ -1894,8 +1903,10 @@ prev_update(int recalculate)
guint16 width, height;
guint16 pwidth, pheight;
/* We only update if we can draw to the widget */
/* We only update if we can draw to the widget and a gradient is present */
if (curr_gradient == NULL)
return;
if (!GTK_WIDGET_DRAWABLE(g_editor->preview))
return;
@ -2617,8 +2628,10 @@ control_update(int recalculate)
gint pwidth, pheight;
GtkAdjustment *adjustment;
/* We only update if we can redraw */
/* We only update if we can redraw and a gradient is present */
if (curr_gradient == NULL)
return;
if (!GTK_WIDGET_DRAWABLE(g_editor->control))
return;

View File

@ -1311,6 +1311,9 @@ ed_copy_gradient_callback(GtkWidget *widget, gpointer client_data)
{
char *name;
if (curr_gradient == NULL)
return;
name = g_malloc((strlen(curr_gradient->name) + 6) * sizeof(char));
sprintf(name, "%s copy", curr_gradient->name);
@ -1531,6 +1534,8 @@ ed_save_pov_callback(GtkWidget *widget, gpointer client_data)
{
GtkWidget *window;
if (curr_gradient == NULL) return;
window = gtk_file_selection_new("Save as POV-Ray");
gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE);
@ -1767,6 +1772,10 @@ prev_events(GtkWidget *widget, GdkEvent *event)
gint x, y;
GdkEventButton *bevent;
/* ignore events when no gradient is present */
if (curr_gradient == NULL)
return FALSE;
switch (event->type) {
case GDK_EXPOSE:
prev_update(0);
@ -1894,8 +1903,10 @@ prev_update(int recalculate)
guint16 width, height;
guint16 pwidth, pheight;
/* We only update if we can draw to the widget */
/* We only update if we can draw to the widget and a gradient is present */
if (curr_gradient == NULL)
return;
if (!GTK_WIDGET_DRAWABLE(g_editor->preview))
return;
@ -2617,8 +2628,10 @@ control_update(int recalculate)
gint pwidth, pheight;
GtkAdjustment *adjustment;
/* We only update if we can redraw */
/* We only update if we can redraw and a gradient is present */
if (curr_gradient == NULL)
return;
if (!GTK_WIDGET_DRAWABLE(g_editor->control))
return;

View File

@ -1311,6 +1311,9 @@ ed_copy_gradient_callback(GtkWidget *widget, gpointer client_data)
{
char *name;
if (curr_gradient == NULL)
return;
name = g_malloc((strlen(curr_gradient->name) + 6) * sizeof(char));
sprintf(name, "%s copy", curr_gradient->name);
@ -1531,6 +1534,8 @@ ed_save_pov_callback(GtkWidget *widget, gpointer client_data)
{
GtkWidget *window;
if (curr_gradient == NULL) return;
window = gtk_file_selection_new("Save as POV-Ray");
gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE);
@ -1767,6 +1772,10 @@ prev_events(GtkWidget *widget, GdkEvent *event)
gint x, y;
GdkEventButton *bevent;
/* ignore events when no gradient is present */
if (curr_gradient == NULL)
return FALSE;
switch (event->type) {
case GDK_EXPOSE:
prev_update(0);
@ -1894,8 +1903,10 @@ prev_update(int recalculate)
guint16 width, height;
guint16 pwidth, pheight;
/* We only update if we can draw to the widget */
/* We only update if we can draw to the widget and a gradient is present */
if (curr_gradient == NULL)
return;
if (!GTK_WIDGET_DRAWABLE(g_editor->preview))
return;
@ -2617,8 +2628,10 @@ control_update(int recalculate)
gint pwidth, pheight;
GtkAdjustment *adjustment;
/* We only update if we can redraw */
/* We only update if we can redraw and a gradient is present */
if (curr_gradient == NULL)
return;
if (!GTK_WIDGET_DRAWABLE(g_editor->control))
return;

View File

@ -1311,6 +1311,9 @@ ed_copy_gradient_callback(GtkWidget *widget, gpointer client_data)
{
char *name;
if (curr_gradient == NULL)
return;
name = g_malloc((strlen(curr_gradient->name) + 6) * sizeof(char));
sprintf(name, "%s copy", curr_gradient->name);
@ -1531,6 +1534,8 @@ ed_save_pov_callback(GtkWidget *widget, gpointer client_data)
{
GtkWidget *window;
if (curr_gradient == NULL) return;
window = gtk_file_selection_new("Save as POV-Ray");
gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_MOUSE);
@ -1767,6 +1772,10 @@ prev_events(GtkWidget *widget, GdkEvent *event)
gint x, y;
GdkEventButton *bevent;
/* ignore events when no gradient is present */
if (curr_gradient == NULL)
return FALSE;
switch (event->type) {
case GDK_EXPOSE:
prev_update(0);
@ -1894,8 +1903,10 @@ prev_update(int recalculate)
guint16 width, height;
guint16 pwidth, pheight;
/* We only update if we can draw to the widget */
/* We only update if we can draw to the widget and a gradient is present */
if (curr_gradient == NULL)
return;
if (!GTK_WIDGET_DRAWABLE(g_editor->preview))
return;
@ -2617,8 +2628,10 @@ control_update(int recalculate)
gint pwidth, pheight;
GtkAdjustment *adjustment;
/* We only update if we can redraw */
/* We only update if we can redraw and a gradient is present */
if (curr_gradient == NULL)
return;
if (!GTK_WIDGET_DRAWABLE(g_editor->control))
return;