delay the showing of the full-size pattern, brush or gradient by 150ms as

Sun Nov  7 18:59:22 GMT 1999  Austin Donnelly  <austin@gimp.org>

	* app/gimpcontextpreview.c: delay the showing of the full-size
	    pattern, brush or gradient by 150ms as the brush and pattern
	    selector dialogs currently do.  Also, only generate a "click"
	    event if the user has clicked quickly, ie, the mouse up event
	    came before the timeout caused the popup to be displayed).

	* app/gimprc.c: default image size now 983x857, in an attempt to
	    flush out problems to do with large images, images with
	    incomplete tiles around the edges, and images with
	    width != height.  Non-square pixels and other resolution stuff
	    will come in at a later stage when we've got the first round
	    of problems fixed.

	* app/gradient.c: don't allow two gradients with the same name -
	    replace the first.  Mainly this stops us having two "Default"
	    gradients if you start up with --no-data.

	* app/interface.c: can now create an indicator panel in the
	    toolbox even if we have --no-data, since we have built-in
	    defaults now.
This commit is contained in:
GMT 1999 Austin Donnelly 1999-11-07 19:03:43 +00:00 committed by Austin Donnelly
parent c64eb45ecb
commit 4d93809fec
10 changed files with 147 additions and 20 deletions

View File

@ -1,3 +1,26 @@
Sun Nov 7 18:59:22 GMT 1999 Austin Donnelly <austin@gimp.org>
* app/gimpcontextpreview.c: delay the showing of the full-size
pattern, brush or gradient by 150ms as the brush and pattern
selector dialogs currently do. Also, only generate a "click"
event if the user has clicked quickly, ie, the mouse up event
came before the timeout caused the popup to be displayed).
* app/gimprc.c: default image size now 983x857, in an attempt to
flush out problems to do with large images, images with
incomplete tiles around the edges, and images with
width != height. Non-square pixels and other resolution stuff
will come in at a later stage when we've got the first round
of problems fixed.
* app/gradient.c: don't allow two gradients with the same name -
replace the first. Mainly this stops us having two "Default"
gradients if you start up with --no-data.
* app/interface.c: can now create an indicator panel in the
toolbox even if we have --no-data, since we have built-in
defaults now.
Sun Nov 7 15:41:07 GMT 1999 Austin Donnelly <austin@gimp.org>
* app/module_db.c: fix button resize behaviour. Closes Bug#3350.

View File

@ -600,7 +600,7 @@ create_toolbox (void)
create_tools (wbox);
create_color_area (wbox);
if (show_indicators && (!no_data) )
if (show_indicators)
create_indicator_area (wbox);
gtk_widget_show (window);
toolbox_set_drag_dest (window);

View File

@ -600,7 +600,7 @@ create_toolbox (void)
create_tools (wbox);
create_color_area (wbox);
if (show_indicators && (!no_data) )
if (show_indicators)
create_indicator_area (wbox);
gtk_widget_show (window);
toolbox_set_drag_dest (window);

View File

@ -77,6 +77,9 @@ static unsigned char scale_pipe_indicator_bits[7][7][3] =
};
/* how long to wait after mouse-down before showing popup */
#define POPUP_DELAY_MS 150
/* size of the gradient popup */
#define GRADIENT_POPUP_WIDTH 128
#define GRADIENT_POPUP_HEIGHT 32
@ -90,10 +93,13 @@ static unsigned char scale_pipe_indicator_bits[7][7][3] =
GDK_LEAVE_NOTIFY_MASK)
/* shared widgets for the popups */
/* XXX: It is pretty dangerous making these variables statics,
* I'd feel safer if they were per-instance and private. -- austin */
static GtkWidget *gcp_popup = NULL;
static GtkWidget *gcp_popup_preview = NULL;
static guint gcp_pipe_timer = 0;
static guint gcp_pipe_index = 0;
static guint gcp_popup_timer = 0;
/* dnd stuff */
static GtkTargetEntry context_preview_target_table[3][1] =
@ -398,7 +404,6 @@ gimp_context_preview_button_press_event (GtkWidget *widget,
gimp_context_preview_popup_open (GIMP_CONTEXT_PREVIEW (widget),
bevent->x, bevent->y);
}
gtk_signal_emit_by_name (GTK_OBJECT (widget), "clicked");
}
return FALSE;
}
@ -407,25 +412,54 @@ static gint
gimp_context_preview_button_release_event (GtkWidget *widget,
GdkEventButton *bevent)
{
if (bevent->button == 1 && GIMP_CONTEXT_PREVIEW (widget)->show_popup)
gboolean fast_click = TRUE;
if (bevent->button == 1)
{
gdk_pointer_ungrab (bevent->time);
gimp_context_preview_popup_close ();
if (GIMP_CONTEXT_PREVIEW (widget)->show_popup)
{
gdk_pointer_ungrab (bevent->time);
/* user clicked quickly if the timeout is still running */
fast_click = gcp_popup_timer;
gimp_context_preview_popup_close ();
}
if (fast_click)
gtk_signal_emit_by_name (GTK_OBJECT (widget), "clicked");
}
return FALSE;
}
static void
gimp_context_preview_popup_open (GimpContextPreview *gcp,
gint x,
gint y)
typedef struct {
GimpContextPreview *gcp;
gint x;
gint y;
} popup_timeout_args_t;
static gboolean
gimp_context_preview_popup_timeout (gpointer data)
{
popup_timeout_args_t *popup_timeout_args = data;
GimpContextPreview *gcp;
gint x, y;
gint x_org, y_org;
gint scr_w, scr_h;
g_return_if_fail (gcp != NULL);
gcp_popup_timer = 0;
g_return_val_if_fail (popup_timeout_args != NULL, FALSE);
gcp = popup_timeout_args->gcp;
x = popup_timeout_args->x;
y = popup_timeout_args->y;
g_return_val_if_fail (gcp != NULL, FALSE);
if (!gcp->data)
return;
return FALSE;
switch (gcp->type)
{
@ -448,7 +482,7 @@ gimp_context_preview_popup_open (GimpContextPreview *gcp,
}
}
else if (gcp->popup_width <= gcp->width && gcp->popup_height <= gcp->height)
return;
return FALSE;
}
break;
case GCP_PATTERN:
@ -457,17 +491,17 @@ gimp_context_preview_popup_open (GimpContextPreview *gcp,
gcp->popup_width = pattern->mask->width;
gcp->popup_height = pattern->mask->height;
if (gcp->popup_width <= gcp->width && gcp->popup_height <= gcp->height)
return;
return FALSE;
}
break;
case GCP_GRADIENT:
gcp->popup_width = GRADIENT_POPUP_WIDTH;
gcp->popup_height = GRADIENT_POPUP_HEIGHT;
if (gcp->popup_width <= gcp->width && gcp->popup_height <= gcp->height)
return;
return FALSE;
break;
default:
return;
return FALSE;
}
/* make sure the popup exists and is not visible */
@ -527,8 +561,29 @@ gimp_context_preview_popup_open (GimpContextPreview *gcp,
break;
}
gtk_widget_queue_draw (gcp_popup_preview);
return FALSE;
}
static void
gimp_context_preview_popup_open (GimpContextPreview *gcp,
gint x,
gint y)
{
static popup_timeout_args_t popup_timeout_args;
g_return_if_fail (gcp_popup_timer == 0);
popup_timeout_args.gcp = gcp;
popup_timeout_args.x = x;
popup_timeout_args.y = y;
gcp_popup_timer = gtk_timeout_add (POPUP_DELAY_MS,
gimp_context_preview_popup_timeout,
&popup_timeout_args);
}
static void
gimp_context_preview_popup_close (void)
{
@ -536,6 +591,10 @@ gimp_context_preview_popup_close (void)
gtk_timeout_remove (gcp_pipe_timer);
gcp_pipe_timer = 0;
if (gcp_popup_timer)
gtk_timeout_remove (gcp_popup_timer);
gcp_popup_timer = 0;
if (gcp_popup != NULL)
gtk_widget_hide (gcp_popup);
}

View File

@ -138,8 +138,9 @@ int confirm_on_close = TRUE;
int save_session_info = TRUE;
int save_device_status = FALSE;
int always_restore_session = FALSE;
int default_width = 256;
int default_height = 256;
int default_width = 983;
int default_height = 857;
/* temporary default size increase to stress test stuff. -- austin 7/11/99 */
int default_type = RGB;
double default_xresolution = 72.0;
double default_yresolution = 72.0;

View File

@ -5980,6 +5980,7 @@ grad_insert_in_gradients_list (gradient_t *grad)
n = 0;
tmp = gradients_list;
g = NULL;
while (tmp)
{
@ -5992,6 +5993,16 @@ grad_insert_in_gradients_list (gradient_t *grad)
tmp = g_slist_next (tmp);
}
/* is there a gradient with this name already? */
if (g && strcmp (grad->name, g->name) == 0)
{
gradients_list = g_slist_remove (gradients_list, g);
grad_free_gradient (g);
num_gradients--;
/* force refresh in case anyone had the gradient selected */
gimp_context_refresh_gradients ();
}
num_gradients++;
gradients_list = g_slist_insert (gradients_list, grad, n);

View File

@ -5980,6 +5980,7 @@ grad_insert_in_gradients_list (gradient_t *grad)
n = 0;
tmp = gradients_list;
g = NULL;
while (tmp)
{
@ -5992,6 +5993,16 @@ grad_insert_in_gradients_list (gradient_t *grad)
tmp = g_slist_next (tmp);
}
/* is there a gradient with this name already? */
if (g && strcmp (grad->name, g->name) == 0)
{
gradients_list = g_slist_remove (gradients_list, g);
grad_free_gradient (g);
num_gradients--;
/* force refresh in case anyone had the gradient selected */
gimp_context_refresh_gradients ();
}
num_gradients++;
gradients_list = g_slist_insert (gradients_list, grad, n);

View File

@ -5980,6 +5980,7 @@ grad_insert_in_gradients_list (gradient_t *grad)
n = 0;
tmp = gradients_list;
g = NULL;
while (tmp)
{
@ -5992,6 +5993,16 @@ grad_insert_in_gradients_list (gradient_t *grad)
tmp = g_slist_next (tmp);
}
/* is there a gradient with this name already? */
if (g && strcmp (grad->name, g->name) == 0)
{
gradients_list = g_slist_remove (gradients_list, g);
grad_free_gradient (g);
num_gradients--;
/* force refresh in case anyone had the gradient selected */
gimp_context_refresh_gradients ();
}
num_gradients++;
gradients_list = g_slist_insert (gradients_list, grad, n);

View File

@ -600,7 +600,7 @@ create_toolbox (void)
create_tools (wbox);
create_color_area (wbox);
if (show_indicators && (!no_data) )
if (show_indicators)
create_indicator_area (wbox);
gtk_widget_show (window);
toolbox_set_drag_dest (window);

View File

@ -5980,6 +5980,7 @@ grad_insert_in_gradients_list (gradient_t *grad)
n = 0;
tmp = gradients_list;
g = NULL;
while (tmp)
{
@ -5992,6 +5993,16 @@ grad_insert_in_gradients_list (gradient_t *grad)
tmp = g_slist_next (tmp);
}
/* is there a gradient with this name already? */
if (g && strcmp (grad->name, g->name) == 0)
{
gradients_list = g_slist_remove (gradients_list, g);
grad_free_gradient (g);
num_gradients--;
/* force refresh in case anyone had the gradient selected */
gimp_context_refresh_gradients ();
}
num_gradients++;
gradients_list = g_slist_insert (gradients_list, grad, n);