Commit 56d10ac4 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/gimpdnd.c remove the remaining defines of GRAD_CHECK_SIZE and include

1999-10-30  Michael Natterer  <mitch@gimp.org>

	* app/gimpdnd.c
	* app/undo_history.c: remove the remaining defines of
	GRAD_CHECK_SIZE and include libgimp/gimplimits.h instead.

	* app/undo_history.c: connect to the image's "rename" signal to
	update the window title.

	* app/disp_callbacks.c
	* app/gdisplay.c
	* app/info_window.[ch]: did the same for the info dialog.
	The info window has to remember the gdisplay to disconnect from
	the image's "rename" signal, so I removed the gdisplay parameter
	from the update functions.
parent b9e86233
1999-10-30 Michael Natterer <mitch@gimp.org>
* app/gimpdnd.c
* app/undo_history.c: remove the remaining defines of
GRAD_CHECK_SIZE and include libgimp/gimplimits.h instead.
* app/undo_history.c: connect to the image's "rename" signal to
update the window title.
* app/disp_callbacks.c
* app/gdisplay.c
* app/info_window.[ch]: did the same for the info dialog.
The info window has to remember the gdisplay to disconnect from
the image's "rename" signal, so I removed the gdisplay parameter
from the update functions.
1999-10-30 Michael Natterer <mitch@gimp.org>
* app/gimpdnd.c: forgot to set "connected" flag after connecting
......
......@@ -343,7 +343,7 @@ gdisplay_delete (GDisplay *gdisp)
/* get rid of signals handled by this display */
gtk_signal_disconnect_by_data (GTK_OBJECT (gdisp->gimage), gdisp);
if (gdisp->scroll_gc)
gdk_gc_destroy (gdisp->scroll_gc);
......@@ -353,8 +353,9 @@ gdisplay_delete (GDisplay *gdisp)
gdisplay_free_area_list (gdisp->idle_render.update_areas);
/* free the gimage */
gimage_delete (gdisp->gimage);
/* remove dialogs before removing the image because they may want to
* disconnect from image signals
*/
/* insure that if a window information dialog exists, it is removed */
if (gdisp->window_info_dialog)
......@@ -364,6 +365,9 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_nav_dialog)
nav_window_free(gdisp->window_nav_dialog);
/* free the gimage */
gimage_delete (gdisp->gimage);
if (gdisp->nav_popup)
nav_popup_free(gdisp->nav_popup);
......@@ -673,8 +677,7 @@ gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
/* update the gdisplay's info dialog */
if (gdisp->window_info_dialog)
info_window_update (gdisp->window_info_dialog,
(void *) gdisp);
info_window_update (gdisp->window_info_dialog);
/* update the gdisplay's qmask buttons */
qmask_buttons_update (gdisp);
......@@ -1054,10 +1057,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
t_y >= active_drawable->height)
{
gtk_label_set (GTK_LABEL (gdisp->cursor_label), "");
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
-1,
-1);
info_window_update_RGB (gdisp->window_info_dialog, -1, -1);
}
else
{
......@@ -1078,10 +1078,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
(double) t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
t_x,
t_y);
info_window_update_RGB (gdisp->window_info_dialog, t_x, t_y);
}
}
......
......@@ -46,7 +46,7 @@ struct _InfoWinData
gchar resolution_str[MAX_BUF];
gchar unit_str[MAX_BUF];
void *gdisp_ptr; /* I'a not happy 'bout this one */
GDisplay *gdisp;
GtkWidget *labelBvalue;
GtkWidget *labelGvalue;
......@@ -70,7 +70,7 @@ static gchar *visual_classes[] =
static void
get_shades (GDisplay *gdisp,
char *buf)
gchar *buf)
{
g_snprintf (buf, MAX_BUF, "Using GdkRgb - we'll get back to you");
#if 0
......@@ -111,6 +111,21 @@ get_shades (GDisplay *gdisp,
#endif
}
static void
info_window_image_rename_callback (GimpImage *gimage,
gpointer data)
{
InfoDialog *id;
gchar *title;
id = (InfoDialog *) data;
title = g_strdup_printf (_("%s: Window Info"),
g_basename (gimage_filename (gimage)));
gtk_window_set_title (GTK_WINDOW (id->shell), title);
g_free (title);
}
static void
info_window_close_callback (GtkWidget *widget,
gpointer data)
......@@ -262,15 +277,12 @@ info_window_image_preview_book (InfoDialog *info_win)
*/
InfoDialog *
info_window_create (void *gdisp_ptr)
info_window_create (GDisplay *gdisp)
{
InfoDialog *info_win;
GDisplay *gdisp;
InfoWinData *iwd;
char * title, * title_buf;
int type;
gdisp = (GDisplay *) gdisp_ptr;
gchar *title, *title_buf;
gint type;
title = g_basename (gimage_filename (gdisp->gimage));
type = gimage_base_type (gdisp->gimage);
......@@ -292,15 +304,16 @@ info_window_create (void *gdisp_ptr)
iwd = g_new (InfoWinData, 1);
info_win->user_data = iwd;
iwd->dimensions_str[0] = '\0';
iwd->resolution_str[0] = '\0';
iwd->unit_str[0] = '\0';
iwd->scale_str[0] = '\0';
iwd->color_type_str[0] = '\0';
iwd->dimensions_str[0] = '\0';
iwd->resolution_str[0] = '\0';
iwd->unit_str[0] = '\0';
iwd->scale_str[0] = '\0';
iwd->color_type_str[0] = '\0';
iwd->visual_class_str[0] = '\0';
iwd->visual_depth_str[0] = '\0';
iwd->shades_str[0] = '\0';
iwd->showingPreview = FALSE;
iwd->shades_str[0] = '\0';
iwd->gdisp = gdisp;
iwd->showingPreview = FALSE;
/* add the information fields */
info_dialog_add_label (info_win, _("Dimensions (w x h):"),
......@@ -328,65 +341,71 @@ info_window_create (void *gdisp_ptr)
iwd->shades_str);
/* update the fields */
info_window_update (info_win, gdisp_ptr);
info_window_update (info_win);
/* Add extra tabs */
/* Add extra tabs */
info_window_image_preview_book (info_win);
/* keep track of image name changes */
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "rename",
GTK_SIGNAL_FUNC (info_window_image_rename_callback),
info_win);
return info_win;
}
void
info_window_update_RGB (InfoDialog *info_win,
void *gdisp_ptr,
gdouble tx,
gdouble ty)
{
GDisplay *gdisp;
InfoWinData *iwd;
char buff[5];
GDisplay *gdisp;
gchar buff[5];
guchar *color;
gint has_alpha;
gint sample_type;
if(!info_win)
if (!info_win)
return;
gdisp = (GDisplay *) gdisp_ptr;
iwd = (InfoWinData *) info_win->user_data;
gdisp = iwd->gdisp;
if(!iwd || iwd->showingPreview == FALSE)
if (!iwd || iwd->showingPreview == FALSE)
return;
/* gimage_active_drawable (gdisp->gimage) */
if (!(color = gimp_image_get_color_at(gdisp->gimage, tx, ty))
if (!(color = gimp_image_get_color_at (gdisp->gimage, tx, ty))
|| (tx < 0.0 && ty < 0.0))
{
g_snprintf(buff,5,"%4s","N/A");
gtk_label_set_text(GTK_LABEL(iwd->labelBvalue),buff);
gtk_label_set_text(GTK_LABEL(iwd->labelGvalue),buff);
gtk_label_set_text(GTK_LABEL(iwd->labelRvalue),buff);
gtk_label_set_text(GTK_LABEL(iwd->labelAvalue),buff);
g_snprintf (buff, sizeof (buff), "%4s", "N/A");
gtk_label_set_text (GTK_LABEL (iwd->labelBvalue), buff);
gtk_label_set_text (GTK_LABEL (iwd->labelGvalue), buff);
gtk_label_set_text (GTK_LABEL (iwd->labelRvalue), buff);
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff);
return;
}
g_snprintf(buff,5,"%4d",(gint)color[BLUE_PIX]);
gtk_label_set_text(GTK_LABEL(iwd->labelBvalue),buff);
g_snprintf(buff,5,"%4d",(gint)color[GREEN_PIX]);
gtk_label_set_text(GTK_LABEL(iwd->labelGvalue),buff);
g_snprintf(buff,5,"%4d",(gint)color[RED_PIX]);
gtk_label_set_text(GTK_LABEL(iwd->labelRvalue),buff);
g_snprintf (buff, sizeof (buff), "%4d", (gint) color[BLUE_PIX]);
gtk_label_set_text (GTK_LABEL (iwd->labelBvalue), buff);
g_snprintf (buff, sizeof (buff), "%4d", (gint) color[GREEN_PIX]);
gtk_label_set_text (GTK_LABEL (iwd->labelGvalue), buff);
g_snprintf (buff, sizeof (buff), "%4d", (gint) color[RED_PIX]);
gtk_label_set_text (GTK_LABEL (iwd->labelRvalue), buff);
sample_type = gimp_image_composite_type (gdisp->gimage);
has_alpha = TYPE_HAS_ALPHA (sample_type);
if(has_alpha)
g_snprintf(buff,5,"%4d",(gint)color[ALPHA_PIX]);
if (has_alpha)
g_snprintf (buff, sizeof (buff), "%4d", (gint) color[ALPHA_PIX]);
else
g_snprintf(buff,5,"%4s","N/A");
g_snprintf (buff, sizeof (buff), "%4s", "N/A");
gtk_label_set_text(GTK_LABEL(iwd->labelAvalue),buff);
gtk_label_set_text (GTK_LABEL (iwd->labelAvalue), buff);
g_free(color);
}
......@@ -394,23 +413,28 @@ info_window_update_RGB (InfoDialog *info_win,
void
info_window_free (InfoDialog *info_win)
{
g_free (info_win->user_data);
InfoWinData *iwd;
iwd = (InfoWinData *) info_win->user_data;
gtk_signal_disconnect_by_data (GTK_OBJECT (iwd->gdisp->gimage), info_win);
g_free (iwd);
info_dialog_free (info_win);
}
void
info_window_update (InfoDialog *info_win,
void *gdisp_ptr)
info_window_update (InfoDialog *info_win)
{
GDisplay *gdisp;
InfoWinData *iwd;
int type;
GDisplay *gdisp;
gint type;
gdouble unit_factor;
gint unit_digits;
gchar format_buf[32];
gdisp = (GDisplay *) gdisp_ptr;
iwd = (InfoWinData *) info_win->user_data;
gdisp = iwd->gdisp;
/* width and height */
unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
......
......@@ -18,14 +18,15 @@
#ifndef __INFO_WINDOW_H__
#define __INFO_WINDOW_H__
#include "gdisplayF.h"
#include "info_dialog.h"
InfoDialog *info_window_create (void *);
void info_window_free (InfoDialog *);
void info_window_update (InfoDialog *, void *);
void info_window_update_RGB (InfoDialog *,
void *,
gdouble,
gdouble);
InfoDialog * info_window_create (GDisplay *gdisp);
void info_window_free (InfoDialog *info_win);
void info_window_update (InfoDialog *info_win);
void info_window_update_RGB (InfoDialog *info_win,
gdouble tx,
gdouble ty);
#endif /* __INFO_WINDOW_H__ */
......@@ -204,10 +204,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
case GDK_LEAVE_NOTIFY:
gdisplay_update_cursor (gdisp, 0, 0);
gtk_label_set_text (GTK_LABEL (gdisp->cursor_label), "");
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
-1,
-1);
info_window_update_RGB (gdisp->window_info_dialog, -1, -1);
case GDK_PROXIMITY_OUT:
gdisp->proximity = FALSE;
......
......@@ -204,10 +204,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
case GDK_LEAVE_NOTIFY:
gdisplay_update_cursor (gdisp, 0, 0);
gtk_label_set_text (GTK_LABEL (gdisp->cursor_label), "");
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
-1,
-1);
info_window_update_RGB (gdisp->window_info_dialog, -1, -1);
case GDK_PROXIMITY_OUT:
gdisp->proximity = FALSE;
......
......@@ -343,7 +343,7 @@ gdisplay_delete (GDisplay *gdisp)
/* get rid of signals handled by this display */
gtk_signal_disconnect_by_data (GTK_OBJECT (gdisp->gimage), gdisp);
if (gdisp->scroll_gc)
gdk_gc_destroy (gdisp->scroll_gc);
......@@ -353,8 +353,9 @@ gdisplay_delete (GDisplay *gdisp)
gdisplay_free_area_list (gdisp->idle_render.update_areas);
/* free the gimage */
gimage_delete (gdisp->gimage);
/* remove dialogs before removing the image because they may want to
* disconnect from image signals
*/
/* insure that if a window information dialog exists, it is removed */
if (gdisp->window_info_dialog)
......@@ -364,6 +365,9 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_nav_dialog)
nav_window_free(gdisp->window_nav_dialog);
/* free the gimage */
gimage_delete (gdisp->gimage);
if (gdisp->nav_popup)
nav_popup_free(gdisp->nav_popup);
......@@ -673,8 +677,7 @@ gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
/* update the gdisplay's info dialog */
if (gdisp->window_info_dialog)
info_window_update (gdisp->window_info_dialog,
(void *) gdisp);
info_window_update (gdisp->window_info_dialog);
/* update the gdisplay's qmask buttons */
qmask_buttons_update (gdisp);
......@@ -1054,10 +1057,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
t_y >= active_drawable->height)
{
gtk_label_set (GTK_LABEL (gdisp->cursor_label), "");
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
-1,
-1);
info_window_update_RGB (gdisp->window_info_dialog, -1, -1);
}
else
{
......@@ -1078,10 +1078,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
(double) t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
t_x,
t_y);
info_window_update_RGB (gdisp->window_info_dialog, t_x, t_y);
}
}
......
......@@ -204,10 +204,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
case GDK_LEAVE_NOTIFY:
gdisplay_update_cursor (gdisp, 0, 0);
gtk_label_set_text (GTK_LABEL (gdisp->cursor_label), "");
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
-1,
-1);
info_window_update_RGB (gdisp->window_info_dialog, -1, -1);
case GDK_PROXIMITY_OUT:
gdisp->proximity = FALSE;
......
......@@ -343,7 +343,7 @@ gdisplay_delete (GDisplay *gdisp)
/* get rid of signals handled by this display */
gtk_signal_disconnect_by_data (GTK_OBJECT (gdisp->gimage), gdisp);
if (gdisp->scroll_gc)
gdk_gc_destroy (gdisp->scroll_gc);
......@@ -353,8 +353,9 @@ gdisplay_delete (GDisplay *gdisp)
gdisplay_free_area_list (gdisp->idle_render.update_areas);
/* free the gimage */
gimage_delete (gdisp->gimage);
/* remove dialogs before removing the image because they may want to
* disconnect from image signals
*/
/* insure that if a window information dialog exists, it is removed */
if (gdisp->window_info_dialog)
......@@ -364,6 +365,9 @@ gdisplay_delete (GDisplay *gdisp)
if (gdisp->window_nav_dialog)
nav_window_free(gdisp->window_nav_dialog);
/* free the gimage */
gimage_delete (gdisp->gimage);
if (gdisp->nav_popup)
nav_popup_free(gdisp->nav_popup);
......@@ -673,8 +677,7 @@ gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
/* update the gdisplay's info dialog */
if (gdisp->window_info_dialog)
info_window_update (gdisp->window_info_dialog,
(void *) gdisp);
info_window_update (gdisp->window_info_dialog);
/* update the gdisplay's qmask buttons */
qmask_buttons_update (gdisp);
......@@ -1054,10 +1057,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
t_y >= active_drawable->height)
{
gtk_label_set (GTK_LABEL (gdisp->cursor_label), "");
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
-1,
-1);
info_window_update_RGB (gdisp->window_info_dialog, -1, -1);
}
else
{
......@@ -1078,10 +1078,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
(double) t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
info_window_update_RGB(gdisp->window_info_dialog,
gdisp,
t_x,
t_y);
info_window_update_RGB (gdisp->window_info_dialog, t_x, t_y);
}
}
......
......@@ -24,6 +24,8 @@
#include "interface.h"
#include "tools.h"
#include "libgimp/gimplimits.h"
#define DRAG_PREVIEW_SIZE 32
#define DRAG_ICON_OFFSET -8
......@@ -238,17 +240,6 @@ static GimpDndDataDef dnd_data_defs[] =
/* drawable dnd functions */
/****************************/
#define GRAD_CHECK_SIZE_SM 4
#define GRAD_CHECK_DARK (1.0 / 3.0)
#define GRAD_CHECK_LIGHT (2.0 / 3.0)
/* Good idea for size to be <= small preview size in LCP dialog.
* that way we get good cache hits.
*/
#define DRAG_IMAGE_SZ 32
void
gimp_dnd_set_drawable_preview_icon (GtkWidget *widget,
GdkDragContext *context,
......@@ -275,9 +266,9 @@ gimp_dnd_set_drawable_preview_icon (GtkWidget *widget,
gimage = gimp_drawable_gimage (drawable);
if (gimage->width > gimage->height)
ratio = (gdouble) DRAG_IMAGE_SZ / (gdouble) gimage->width;
ratio = (gdouble) DRAG_PREVIEW_SIZE / (gdouble) gimage->width;
else
ratio = (gdouble) DRAG_IMAGE_SZ / (gdouble) gimage->height;
ratio = (gdouble) DRAG_PREVIEW_SIZE / (gdouble) gimage->height;
width = (gint) (ratio * gimage->width);
height = (gint) (ratio * gimage->height);
......@@ -378,15 +369,15 @@ gimp_dnd_set_drawable_preview_icon (GtkWidget *widget,
a = 1.0;
}
if ((x / GRAD_CHECK_SIZE_SM) & 1)
if ((x / GIMP_CHECK_SIZE_SM) & 1)
{
c0 = GRAD_CHECK_LIGHT;
c1 = GRAD_CHECK_DARK;
c0 = GIMP_CHECK_LIGHT;
c1 = GIMP_CHECK_DARK;
}
else
{
c0 = GRAD_CHECK_DARK;
c1 = GRAD_CHECK_LIGHT;
c0 = GIMP_CHECK_DARK;
c1 = GIMP_CHECK_LIGHT;
}
*p0++ = (c0 + (r - c0) * a) * 255.0;
......@@ -399,7 +390,7 @@ gimp_dnd_set_drawable_preview_icon (GtkWidget *widget,
}
if ((y / GRAD_CHECK_SIZE_SM) & 1)
if ((y / GIMP_CHECK_SIZE_SM) & 1)
{
gdk_draw_rgb_image (drag_pixmap, gc,
1+offx, y+1+offy,
......@@ -1031,7 +1022,6 @@ gimp_dnd_set_gradient_data (GtkWidget *widget,
gint length)
{
gradient_t *gradient;
GSList *list;
gchar *name;
if ((format != 8) || (length < 1))
......
......@@ -46,7 +46,7 @@ struct _InfoWinData
gchar resolution_str[MAX_BUF];
gchar unit_str[MAX_BUF];
void *gdisp_ptr; /* I'a not happy 'bout this one */
GDisplay *gdisp;
GtkWidget *labelBvalue;
GtkWidget *labelGvalue;
......@@ -70,7 +70,7 @@ static gchar *visual_classes[] =
static void
get_shades (GDisplay *gdisp,
char *buf)
gchar *buf)
{
g_snprintf (buf, MAX_BUF, "Using GdkRgb - we'll get back to you");
#if 0
......@@ -111,6 +111,21 @@ get_shades (GDisplay *gdisp,
#endif
}
static void
info_window_image_rename_callback (GimpImage *gimage,
gpointer data)
{
InfoDialog *id;
gchar *title;
id = (InfoDialog *) data;
title = g_strdup_printf (_("%s: Window Info"),
g_basename (gimage_filename (gimage)));
gtk_window_set_title (GTK_WINDOW (id->shell), title);
g_free (title);
}
static void
info_window_close_callback (GtkWidget *widget,
gpointer data)
......@@ -262,15 +277,12 @@ info_window_image_preview_book (InfoDialog *info_win)
*/
InfoDialog *
info_window_create (void *gdisp_ptr)
info_window_create (GDisplay *gdisp)
{
InfoDialog *info_win;
GDisplay *gdisp;
InfoWinData *iwd;
char * title, * title_buf;
int type;
gdisp = (GDisplay *) gdisp_ptr;
gchar *title, *title_buf;
gint type;
title = g_basename (gimage_filename (gdisp->gimage));
type = gimage_base_type (gdisp->gimage);
......@@ -292,15 +304,16 @@ info_window_create (void *gdisp_ptr)
iwd = g_new (InfoWinData, 1);
info_win->user_data = iwd;
iwd->dimensions_str[0] = '\0';
iwd->resolution_str[0] = '\0';
iwd->unit_str[0] = '\0';
iwd->scale_str[0] = '\0';
iwd->color_type_str[0] = '\0';
iwd->dimensions_str[0] = '\0';
iwd->resolution_str[0] = '\0';
iwd->unit_str[0] = '\0';
iwd->scale_str[0] = '\0';
iwd->color_type_str[0] = '\0';
iwd->visual_class_str[0] = '\0';
iwd->visual_depth_str[0] = '\0';
iwd->shades_str[0] = '\0';
iwd->showingPreview = FALSE;
iwd->shades_str[0] = '\0';
iwd->gdisp = gdisp;
iwd->showingPreview = FALSE;
/* add the information fields */
info_dialog_add_label (info_win, _("Dimensions (w x h):"),
......@@ -328,65 +341,71 @@ info_window_create (void *gdisp_ptr)
iwd->shades_str);
/* update the fields */
info_window_update (info_win, gdisp_ptr);
info_window_update (info_win);
/* Add extra tabs */
/* Add extra tabs */
info_window_image_preview_book (info_win);
/* keep track of image name changes */
gtk_signal_connect (GTK_OBJECT (gdisp->gimage), "rename",
GTK_SIGNAL_FUNC (info_window_image_rename_callback),
info_win);
return info_win;
}
void
info_window_update_RGB (InfoDialog *info_win,
void *gdisp_ptr,
gdouble tx,
gdouble ty)
{
GDisplay *gdisp;
InfoWinData *iwd;
char buff[5];
GDisplay *gdisp;
gchar buff[5];
guchar *color;
gint has_alpha;
gint sample_type;
if(!info_win)
if (!info_win)
return;
gdisp = (GDisplay *) gdisp_ptr;
iwd = (InfoWinData *) info_win->user_data;
gdisp = iwd->gdisp;
if(!iwd || iwd->showingPreview == FALSE)
if (!iwd || iwd->showingPreview == FALSE)
return;
/* gimage_active_drawable (gdisp->gimage) */
if (!(color = gimp_image_get_color_at(gdisp->gimage, tx, ty))
if (!(color = gimp_image_get_color_at (gdisp->gimage, tx, ty))
|| (tx < 0.0 && ty < 0.0))