mirror of https://github.com/GNOME/gimp.git
added a "BG Color Fill" radio button. Toggling FG/BG with <shift> works in
1999-04-24 Michael Natterer <mitschel@cs.tu-berlin.de> * app/bucket_fill.c: added a "BG Color Fill" radio button. Toggling FG/BG with <shift> works in both color fill modes now. * app/brush_select.c: session management sets the size of the dialog again (depending on the current paint options mode because bad things happen if the brush preview's size is reduced beyond it's minimum).
This commit is contained in:
parent
b8c19394dc
commit
f2546516fe
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
1999-04-24 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/bucket_fill.c: added a "BG Color Fill" radio button.
|
||||
Toggling FG/BG with <shift> works in both color fill modes now.
|
||||
|
||||
* app/brush_select.c: session management sets the size of the
|
||||
dialog again (depending on the current paint options mode because
|
||||
bad things happen if the brush preview's size is reduced beyond
|
||||
it's minimum).
|
||||
|
||||
Thu Apr 22 22:14:02 PDT 1999 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
|
||||
|
|
|
@ -121,8 +121,9 @@ brush_select_new (gchar *title,
|
|||
GtkWidget *option_menu;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *slider;
|
||||
GimpBrushP active = NULL;
|
||||
GtkWidget *button2;
|
||||
|
||||
GimpBrushP active = NULL;
|
||||
gint gotinitbrush = FALSE;
|
||||
|
||||
static ActionAreaItem action_items[] =
|
||||
|
@ -148,19 +149,23 @@ brush_select_new (gchar *title,
|
|||
if(!title)
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (bsp->shell), _("Brush Selection"));
|
||||
|
||||
/* set dialog's size later because weird thing will happen if the
|
||||
* size was not saved in the current paint options mode
|
||||
*/
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info,
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (bsp->shell), title);
|
||||
if(init_name && strlen(init_name))
|
||||
active = gimp_brush_list_get_brush(brush_list, init_name);
|
||||
if(active)
|
||||
if (init_name && strlen (init_name))
|
||||
active = gimp_brush_list_get_brush (brush_list, init_name);
|
||||
if (active)
|
||||
gotinitbrush = TRUE;
|
||||
}
|
||||
|
||||
gtk_window_set_policy(GTK_WINDOW(bsp->shell), FALSE, TRUE, TRUE);
|
||||
gtk_window_set_policy (GTK_WINDOW (bsp->shell), FALSE, TRUE, FALSE);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (bsp->shell)->vbox), vbox);
|
||||
|
@ -353,15 +358,13 @@ brush_select_new (gchar *title,
|
|||
gtk_widget_show (bsp->options_box);
|
||||
gtk_widget_show (hbox);
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (bsp->shell);
|
||||
|
||||
/* calculate the scrollbar */
|
||||
if(no_data)
|
||||
brushes_init(FALSE);
|
||||
if (no_data)
|
||||
brushes_init (FALSE);
|
||||
/* This is done by size_allocate anyway, which is much better */
|
||||
preview_calc_scrollbar (bsp);
|
||||
|
||||
|
||||
/* render the brushes into the newly created image structure */
|
||||
display_brushes (bsp);
|
||||
|
||||
|
@ -379,9 +382,25 @@ brush_select_new (gchar *title,
|
|||
(GtkSignalFunc) brush_removed_callback,
|
||||
bsp);
|
||||
|
||||
/* if we are in per-toop paint options mode, hide the paint options */
|
||||
/* Check if it's possible to set the dialog's size before ... */
|
||||
if ((bsp->shell->allocation.width <= brush_select_session_info.width) &&
|
||||
(bsp->shell->allocation.height <= brush_select_session_info.height))
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info,
|
||||
TRUE);
|
||||
|
||||
/* if we are in per-tool paint options mode, hide the paint options */
|
||||
brush_select_show_paint_options (bsp, global_paint_options);
|
||||
|
||||
/* ... and after it has (eventually) changed it's size.
|
||||
* This is necessary because the brush preview follows the size of
|
||||
* the dialog and will cause ugly SIGFPE's when it's size is reduced
|
||||
* beyond it's minimum.
|
||||
*/
|
||||
if ((bsp->shell->allocation.width <= brush_select_session_info.width) &&
|
||||
(bsp->shell->allocation.height <= brush_select_session_info.height))
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info,
|
||||
TRUE);
|
||||
|
||||
/* add a toggle button which switches from global to per-tool
|
||||
* paint options mode
|
||||
*
|
||||
|
@ -409,12 +428,12 @@ brush_select_new (gchar *title,
|
|||
gtk_widget_show (sep);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/* update the active selection */
|
||||
if(!active)
|
||||
if (!active)
|
||||
active = get_active_brush ();
|
||||
|
||||
if(title)
|
||||
if (title)
|
||||
{
|
||||
bsp->brush = active;
|
||||
}
|
||||
|
@ -437,19 +456,23 @@ brush_select_new (gchar *title,
|
|||
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
|
||||
active));
|
||||
|
||||
if(gotinitbrush && init_spacing >= 0)
|
||||
if (gotinitbrush && init_spacing >= 0)
|
||||
{
|
||||
/* Use passed spacing instead of brushes default */
|
||||
bsp->spacing_data->value = init_spacing;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (bsp->spacing_data), "value_changed");
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (bsp->spacing_data),
|
||||
"value_changed");
|
||||
}
|
||||
bsp->redraw = old_value;
|
||||
if (GIMP_IS_BRUSH_GENERATED(active))
|
||||
if (GIMP_IS_BRUSH_GENERATED (active))
|
||||
gtk_widget_set_sensitive (bsp->edit_button, 1);
|
||||
else
|
||||
gtk_widget_set_sensitive (bsp->edit_button, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Finally, show the dialog */
|
||||
gtk_widget_show (bsp->shell);
|
||||
|
||||
return bsp;
|
||||
}
|
||||
|
||||
|
@ -484,8 +507,7 @@ brush_select_free (BrushSelectP bsp)
|
|||
g_free (bsp->callback_name);
|
||||
|
||||
/* remove from active list */
|
||||
|
||||
brush_active_dialogs = g_slist_remove(brush_active_dialogs,bsp);
|
||||
brush_active_dialogs = g_slist_remove (brush_active_dialogs, bsp);
|
||||
|
||||
g_free (bsp);
|
||||
}
|
||||
|
@ -915,17 +937,14 @@ preview_calc_scrollbar (BrushSelectP bsp)
|
|||
int num_rows;
|
||||
int page_size;
|
||||
int max;
|
||||
int offs;
|
||||
|
||||
offs = bsp->scroll_offset;
|
||||
bsp->scroll_offset = 0;
|
||||
num_rows = (gimp_brush_list_length(brush_list) + (bsp->NUM_BRUSH_COLUMNS) - 1)
|
||||
/ (bsp->NUM_BRUSH_COLUMNS);
|
||||
max = num_rows * bsp->cell_width;
|
||||
if (!num_rows) num_rows = 1;
|
||||
page_size = bsp->preview->allocation.height;
|
||||
page_size = ((page_size < max) ? page_size : max);
|
||||
|
||||
bsp->scroll_offset = offs;
|
||||
bsp->sbar_data->value = bsp->scroll_offset;
|
||||
bsp->sbar_data->upper = max;
|
||||
bsp->sbar_data->page_size = ((page_size < max) ? page_size : max);
|
||||
|
@ -1016,7 +1035,6 @@ brush_select_events (GtkWidget *widget,
|
|||
/* Get the brush and display the popup brush preview */
|
||||
if ((brush = gimp_brush_list_get_brush_by_index (brush_list, index)))
|
||||
{
|
||||
|
||||
gdk_pointer_grab (bsp->preview->window, FALSE,
|
||||
(GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON1_MOTION_MASK |
|
||||
|
@ -1173,19 +1191,17 @@ brush_select_refresh_callback (GtkWidget *w,
|
|||
/* re-init the brush list */
|
||||
brushes_init (FALSE);
|
||||
|
||||
/* update the active selection */
|
||||
active = get_active_brush ();
|
||||
if (active)
|
||||
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
|
||||
active));
|
||||
|
||||
/* recalculate scrollbar extents */
|
||||
preview_calc_scrollbar (bsp);
|
||||
|
||||
/* render the brushes into the newly created image structure */
|
||||
display_brushes (bsp);
|
||||
|
||||
|
||||
/* update the active selection */
|
||||
active = get_active_brush ();
|
||||
if (active)
|
||||
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
|
||||
active));
|
||||
|
||||
/* update the display */
|
||||
if (bsp->redraw)
|
||||
|
@ -1208,14 +1224,14 @@ preview_scroll_update (GtkAdjustment *adjustment,
|
|||
bsp->scroll_offset = adjustment->value;
|
||||
display_brushes (bsp);
|
||||
|
||||
if(bsp->brush)
|
||||
active = bsp->brush;
|
||||
else
|
||||
if (brush_select_dialog == bsp)
|
||||
active = get_active_brush ();
|
||||
else
|
||||
active = bsp->brush;
|
||||
|
||||
if (active)
|
||||
{
|
||||
index = gimp_brush_list_get_brush_index(brush_list, active);
|
||||
index = gimp_brush_list_get_brush_index (brush_list, active);
|
||||
if (index < 0)
|
||||
return;
|
||||
row = index / bsp->NUM_BRUSH_COLUMNS;
|
||||
|
|
|
@ -60,7 +60,7 @@ struct _BucketOptions
|
|||
|
||||
BucketFillMode fill_mode;
|
||||
BucketFillMode fill_mode_d;
|
||||
GtkWidget *fill_mode_w[2]; /* 2 radio buttons */
|
||||
GtkWidget *fill_mode_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -104,10 +104,7 @@ bucket_options_reset (void)
|
|||
options->sample_merged_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
|
||||
options->threshold_d);
|
||||
gtk_toggle_button_set_active (((options->fill_mode_d == FG_BUCKET_FILL) ?
|
||||
GTK_TOGGLE_BUTTON (options->fill_mode_w[0]) :
|
||||
GTK_TOGGLE_BUTTON (options->fill_mode_w[1])),
|
||||
TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
|
||||
}
|
||||
|
||||
static BucketOptions *
|
||||
|
@ -125,9 +122,10 @@ bucket_options_new (void)
|
|||
GtkWidget *radio_button;
|
||||
|
||||
int i;
|
||||
char *button_names[2] =
|
||||
char *button_names[3] =
|
||||
{
|
||||
N_("Color Fill"),
|
||||
N_("FG Color Fill"),
|
||||
N_("BG Color Fill"),
|
||||
N_("Pattern Fill")
|
||||
};
|
||||
|
||||
|
@ -183,14 +181,14 @@ bucket_options_new (void)
|
|||
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
||||
|
||||
/* the radio buttons */
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
radio_button =
|
||||
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
||||
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
||||
(GtkSignalFunc) bucket_fill_mode_callback,
|
||||
(gpointer) ((long) (i == 1 ? PATTERN_BUCKET_FILL : FG_BUCKET_FILL))); /* kludgy */
|
||||
(gpointer) i);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (radio_button);
|
||||
|
||||
|
@ -254,9 +252,12 @@ bucket_fill_button_release (Tool *tool,
|
|||
{
|
||||
fill_mode = bucket_options->fill_mode;
|
||||
|
||||
/* If the mode is color filling, and shift mask is down, fill with background */
|
||||
if (bevent->state & GDK_SHIFT_MASK && fill_mode == FG_BUCKET_FILL)
|
||||
fill_mode = BG_BUCKET_FILL;
|
||||
/* If the mode is color filling, and shift mask is down,
|
||||
* toggle FG/BG fill mode
|
||||
*/
|
||||
if ((bevent->state & GDK_SHIFT_MASK) && (fill_mode != PATTERN_BUCKET_FILL))
|
||||
fill_mode =
|
||||
(fill_mode == BG_BUCKET_FILL) ? FG_BUCKET_FILL : BG_BUCKET_FILL;
|
||||
|
||||
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
|
@ -401,7 +402,7 @@ bucket_fill (GimpImage *gimage,
|
|||
pat_buf = pattern->mask;
|
||||
}
|
||||
|
||||
gimp_add_busy_cursors();
|
||||
gimp_add_busy_cursors ();
|
||||
|
||||
bytes = drawable_bytes (drawable);
|
||||
has_alpha = drawable_has_alpha (drawable);
|
||||
|
@ -428,7 +429,7 @@ bucket_fill (GimpImage *gimage,
|
|||
x2 = BOUNDS (x2, off_x, (off_x + drawable_width (drawable)));
|
||||
y2 = BOUNDS (y2, off_y, (off_y + drawable_height (drawable)));
|
||||
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)),
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE (mask)),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
/* translate mask bounds to drawable coords */
|
||||
|
@ -438,7 +439,7 @@ bucket_fill (GimpImage *gimage,
|
|||
y2 -= off_y;
|
||||
}
|
||||
else
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)),
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE (mask)),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
/* if the gimage doesn't have an alpha channel,
|
||||
|
@ -477,7 +478,7 @@ bucket_fill (GimpImage *gimage,
|
|||
if (new_buf)
|
||||
temp_buf_free (pat_buf);
|
||||
|
||||
gimp_remove_busy_cursors(NULL);
|
||||
gimp_remove_busy_cursors (NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -485,9 +486,9 @@ static void
|
|||
bucket_fill_line_color (unsigned char *buf,
|
||||
unsigned char *mask,
|
||||
unsigned char *col,
|
||||
int has_alpha,
|
||||
int bytes,
|
||||
int width)
|
||||
int has_alpha,
|
||||
int bytes,
|
||||
int width)
|
||||
{
|
||||
int alpha, b;
|
||||
|
||||
|
|
|
@ -121,8 +121,9 @@ brush_select_new (gchar *title,
|
|||
GtkWidget *option_menu;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *slider;
|
||||
GimpBrushP active = NULL;
|
||||
GtkWidget *button2;
|
||||
|
||||
GimpBrushP active = NULL;
|
||||
gint gotinitbrush = FALSE;
|
||||
|
||||
static ActionAreaItem action_items[] =
|
||||
|
@ -148,19 +149,23 @@ brush_select_new (gchar *title,
|
|||
if(!title)
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (bsp->shell), _("Brush Selection"));
|
||||
|
||||
/* set dialog's size later because weird thing will happen if the
|
||||
* size was not saved in the current paint options mode
|
||||
*/
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info,
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (bsp->shell), title);
|
||||
if(init_name && strlen(init_name))
|
||||
active = gimp_brush_list_get_brush(brush_list, init_name);
|
||||
if(active)
|
||||
if (init_name && strlen (init_name))
|
||||
active = gimp_brush_list_get_brush (brush_list, init_name);
|
||||
if (active)
|
||||
gotinitbrush = TRUE;
|
||||
}
|
||||
|
||||
gtk_window_set_policy(GTK_WINDOW(bsp->shell), FALSE, TRUE, TRUE);
|
||||
gtk_window_set_policy (GTK_WINDOW (bsp->shell), FALSE, TRUE, FALSE);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (bsp->shell)->vbox), vbox);
|
||||
|
@ -353,15 +358,13 @@ brush_select_new (gchar *title,
|
|||
gtk_widget_show (bsp->options_box);
|
||||
gtk_widget_show (hbox);
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (bsp->shell);
|
||||
|
||||
/* calculate the scrollbar */
|
||||
if(no_data)
|
||||
brushes_init(FALSE);
|
||||
if (no_data)
|
||||
brushes_init (FALSE);
|
||||
/* This is done by size_allocate anyway, which is much better */
|
||||
preview_calc_scrollbar (bsp);
|
||||
|
||||
|
||||
/* render the brushes into the newly created image structure */
|
||||
display_brushes (bsp);
|
||||
|
||||
|
@ -379,9 +382,25 @@ brush_select_new (gchar *title,
|
|||
(GtkSignalFunc) brush_removed_callback,
|
||||
bsp);
|
||||
|
||||
/* if we are in per-toop paint options mode, hide the paint options */
|
||||
/* Check if it's possible to set the dialog's size before ... */
|
||||
if ((bsp->shell->allocation.width <= brush_select_session_info.width) &&
|
||||
(bsp->shell->allocation.height <= brush_select_session_info.height))
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info,
|
||||
TRUE);
|
||||
|
||||
/* if we are in per-tool paint options mode, hide the paint options */
|
||||
brush_select_show_paint_options (bsp, global_paint_options);
|
||||
|
||||
/* ... and after it has (eventually) changed it's size.
|
||||
* This is necessary because the brush preview follows the size of
|
||||
* the dialog and will cause ugly SIGFPE's when it's size is reduced
|
||||
* beyond it's minimum.
|
||||
*/
|
||||
if ((bsp->shell->allocation.width <= brush_select_session_info.width) &&
|
||||
(bsp->shell->allocation.height <= brush_select_session_info.height))
|
||||
session_set_window_geometry (bsp->shell, &brush_select_session_info,
|
||||
TRUE);
|
||||
|
||||
/* add a toggle button which switches from global to per-tool
|
||||
* paint options mode
|
||||
*
|
||||
|
@ -409,12 +428,12 @@ brush_select_new (gchar *title,
|
|||
gtk_widget_show (sep);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/* update the active selection */
|
||||
if(!active)
|
||||
if (!active)
|
||||
active = get_active_brush ();
|
||||
|
||||
if(title)
|
||||
if (title)
|
||||
{
|
||||
bsp->brush = active;
|
||||
}
|
||||
|
@ -437,19 +456,23 @@ brush_select_new (gchar *title,
|
|||
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
|
||||
active));
|
||||
|
||||
if(gotinitbrush && init_spacing >= 0)
|
||||
if (gotinitbrush && init_spacing >= 0)
|
||||
{
|
||||
/* Use passed spacing instead of brushes default */
|
||||
bsp->spacing_data->value = init_spacing;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (bsp->spacing_data), "value_changed");
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (bsp->spacing_data),
|
||||
"value_changed");
|
||||
}
|
||||
bsp->redraw = old_value;
|
||||
if (GIMP_IS_BRUSH_GENERATED(active))
|
||||
if (GIMP_IS_BRUSH_GENERATED (active))
|
||||
gtk_widget_set_sensitive (bsp->edit_button, 1);
|
||||
else
|
||||
gtk_widget_set_sensitive (bsp->edit_button, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Finally, show the dialog */
|
||||
gtk_widget_show (bsp->shell);
|
||||
|
||||
return bsp;
|
||||
}
|
||||
|
||||
|
@ -484,8 +507,7 @@ brush_select_free (BrushSelectP bsp)
|
|||
g_free (bsp->callback_name);
|
||||
|
||||
/* remove from active list */
|
||||
|
||||
brush_active_dialogs = g_slist_remove(brush_active_dialogs,bsp);
|
||||
brush_active_dialogs = g_slist_remove (brush_active_dialogs, bsp);
|
||||
|
||||
g_free (bsp);
|
||||
}
|
||||
|
@ -915,17 +937,14 @@ preview_calc_scrollbar (BrushSelectP bsp)
|
|||
int num_rows;
|
||||
int page_size;
|
||||
int max;
|
||||
int offs;
|
||||
|
||||
offs = bsp->scroll_offset;
|
||||
bsp->scroll_offset = 0;
|
||||
num_rows = (gimp_brush_list_length(brush_list) + (bsp->NUM_BRUSH_COLUMNS) - 1)
|
||||
/ (bsp->NUM_BRUSH_COLUMNS);
|
||||
max = num_rows * bsp->cell_width;
|
||||
if (!num_rows) num_rows = 1;
|
||||
page_size = bsp->preview->allocation.height;
|
||||
page_size = ((page_size < max) ? page_size : max);
|
||||
|
||||
bsp->scroll_offset = offs;
|
||||
bsp->sbar_data->value = bsp->scroll_offset;
|
||||
bsp->sbar_data->upper = max;
|
||||
bsp->sbar_data->page_size = ((page_size < max) ? page_size : max);
|
||||
|
@ -1016,7 +1035,6 @@ brush_select_events (GtkWidget *widget,
|
|||
/* Get the brush and display the popup brush preview */
|
||||
if ((brush = gimp_brush_list_get_brush_by_index (brush_list, index)))
|
||||
{
|
||||
|
||||
gdk_pointer_grab (bsp->preview->window, FALSE,
|
||||
(GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON1_MOTION_MASK |
|
||||
|
@ -1173,19 +1191,17 @@ brush_select_refresh_callback (GtkWidget *w,
|
|||
/* re-init the brush list */
|
||||
brushes_init (FALSE);
|
||||
|
||||
/* update the active selection */
|
||||
active = get_active_brush ();
|
||||
if (active)
|
||||
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
|
||||
active));
|
||||
|
||||
/* recalculate scrollbar extents */
|
||||
preview_calc_scrollbar (bsp);
|
||||
|
||||
/* render the brushes into the newly created image structure */
|
||||
display_brushes (bsp);
|
||||
|
||||
|
||||
/* update the active selection */
|
||||
active = get_active_brush ();
|
||||
if (active)
|
||||
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
|
||||
active));
|
||||
|
||||
/* update the display */
|
||||
if (bsp->redraw)
|
||||
|
@ -1208,14 +1224,14 @@ preview_scroll_update (GtkAdjustment *adjustment,
|
|||
bsp->scroll_offset = adjustment->value;
|
||||
display_brushes (bsp);
|
||||
|
||||
if(bsp->brush)
|
||||
active = bsp->brush;
|
||||
else
|
||||
if (brush_select_dialog == bsp)
|
||||
active = get_active_brush ();
|
||||
else
|
||||
active = bsp->brush;
|
||||
|
||||
if (active)
|
||||
{
|
||||
index = gimp_brush_list_get_brush_index(brush_list, active);
|
||||
index = gimp_brush_list_get_brush_index (brush_list, active);
|
||||
if (index < 0)
|
||||
return;
|
||||
row = index / bsp->NUM_BRUSH_COLUMNS;
|
||||
|
|
|
@ -60,7 +60,7 @@ struct _BucketOptions
|
|||
|
||||
BucketFillMode fill_mode;
|
||||
BucketFillMode fill_mode_d;
|
||||
GtkWidget *fill_mode_w[2]; /* 2 radio buttons */
|
||||
GtkWidget *fill_mode_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -104,10 +104,7 @@ bucket_options_reset (void)
|
|||
options->sample_merged_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
|
||||
options->threshold_d);
|
||||
gtk_toggle_button_set_active (((options->fill_mode_d == FG_BUCKET_FILL) ?
|
||||
GTK_TOGGLE_BUTTON (options->fill_mode_w[0]) :
|
||||
GTK_TOGGLE_BUTTON (options->fill_mode_w[1])),
|
||||
TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
|
||||
}
|
||||
|
||||
static BucketOptions *
|
||||
|
@ -125,9 +122,10 @@ bucket_options_new (void)
|
|||
GtkWidget *radio_button;
|
||||
|
||||
int i;
|
||||
char *button_names[2] =
|
||||
char *button_names[3] =
|
||||
{
|
||||
N_("Color Fill"),
|
||||
N_("FG Color Fill"),
|
||||
N_("BG Color Fill"),
|
||||
N_("Pattern Fill")
|
||||
};
|
||||
|
||||
|
@ -183,14 +181,14 @@ bucket_options_new (void)
|
|||
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
||||
|
||||
/* the radio buttons */
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
radio_button =
|
||||
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
||||
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
||||
(GtkSignalFunc) bucket_fill_mode_callback,
|
||||
(gpointer) ((long) (i == 1 ? PATTERN_BUCKET_FILL : FG_BUCKET_FILL))); /* kludgy */
|
||||
(gpointer) i);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (radio_button);
|
||||
|
||||
|
@ -254,9 +252,12 @@ bucket_fill_button_release (Tool *tool,
|
|||
{
|
||||
fill_mode = bucket_options->fill_mode;
|
||||
|
||||
/* If the mode is color filling, and shift mask is down, fill with background */
|
||||
if (bevent->state & GDK_SHIFT_MASK && fill_mode == FG_BUCKET_FILL)
|
||||
fill_mode = BG_BUCKET_FILL;
|
||||
/* If the mode is color filling, and shift mask is down,
|
||||
* toggle FG/BG fill mode
|
||||
*/
|
||||
if ((bevent->state & GDK_SHIFT_MASK) && (fill_mode != PATTERN_BUCKET_FILL))
|
||||
fill_mode =
|
||||
(fill_mode == BG_BUCKET_FILL) ? FG_BUCKET_FILL : BG_BUCKET_FILL;
|
||||
|
||||
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
|
@ -401,7 +402,7 @@ bucket_fill (GimpImage *gimage,
|
|||
pat_buf = pattern->mask;
|
||||
}
|
||||
|
||||
gimp_add_busy_cursors();
|
||||
gimp_add_busy_cursors ();
|
||||
|
||||
bytes = drawable_bytes (drawable);
|
||||
has_alpha = drawable_has_alpha (drawable);
|
||||
|
@ -428,7 +429,7 @@ bucket_fill (GimpImage *gimage,
|
|||
x2 = BOUNDS (x2, off_x, (off_x + drawable_width (drawable)));
|
||||
y2 = BOUNDS (y2, off_y, (off_y + drawable_height (drawable)));
|
||||
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)),
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE (mask)),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
/* translate mask bounds to drawable coords */
|
||||
|
@ -438,7 +439,7 @@ bucket_fill (GimpImage *gimage,
|
|||
y2 -= off_y;
|
||||
}
|
||||
else
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)),
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE (mask)),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
/* if the gimage doesn't have an alpha channel,
|
||||
|
@ -477,7 +478,7 @@ bucket_fill (GimpImage *gimage,
|
|||
if (new_buf)
|
||||
temp_buf_free (pat_buf);
|
||||
|
||||
gimp_remove_busy_cursors(NULL);
|
||||
gimp_remove_busy_cursors (NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -485,9 +486,9 @@ static void
|
|||
bucket_fill_line_color (unsigned char *buf,
|
||||
unsigned char *mask,
|
||||
unsigned char *col,
|
||||
int has_alpha,
|
||||
int bytes,
|
||||
int width)
|
||||
int has_alpha,
|
||||
int bytes,
|
||||
int width)
|
||||
{
|
||||
int alpha, b;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ struct _BucketOptions
|
|||
|
||||
BucketFillMode fill_mode;
|
||||
BucketFillMode fill_mode_d;
|
||||
GtkWidget *fill_mode_w[2]; /* 2 radio buttons */
|
||||
GtkWidget *fill_mode_w[3]; /* 3 radio buttons */
|
||||
};
|
||||
|
||||
|
||||
|
@ -104,10 +104,7 @@ bucket_options_reset (void)
|
|||
options->sample_merged_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->threshold_w),
|
||||
options->threshold_d);
|
||||
gtk_toggle_button_set_active (((options->fill_mode_d == FG_BUCKET_FILL) ?
|
||||
GTK_TOGGLE_BUTTON (options->fill_mode_w[0]) :
|
||||
GTK_TOGGLE_BUTTON (options->fill_mode_w[1])),
|
||||
TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->fill_mode_w[options->fill_mode_d]), TRUE);
|
||||
}
|
||||
|
||||
static BucketOptions *
|
||||
|
@ -125,9 +122,10 @@ bucket_options_new (void)
|
|||
GtkWidget *radio_button;
|
||||
|
||||
int i;
|
||||
char *button_names[2] =
|
||||
char *button_names[3] =
|
||||
{
|
||||
N_("Color Fill"),
|
||||
N_("FG Color Fill"),
|
||||
N_("BG Color Fill"),
|
||||
N_("Pattern Fill")
|
||||
};
|
||||
|
||||
|
@ -183,14 +181,14 @@ bucket_options_new (void)
|
|||
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
||||
|
||||
/* the radio buttons */
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
radio_button =
|
||||
gtk_radio_button_new_with_label (group, gettext(button_names[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
||||
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
||||
(GtkSignalFunc) bucket_fill_mode_callback,
|
||||
(gpointer) ((long) (i == 1 ? PATTERN_BUCKET_FILL : FG_BUCKET_FILL))); /* kludgy */
|
||||
(gpointer) i);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (radio_button);
|
||||
|
||||
|
@ -254,9 +252,12 @@ bucket_fill_button_release (Tool *tool,
|
|||
{
|
||||
fill_mode = bucket_options->fill_mode;
|
||||
|
||||
/* If the mode is color filling, and shift mask is down, fill with background */
|
||||
if (bevent->state & GDK_SHIFT_MASK && fill_mode == FG_BUCKET_FILL)
|
||||
fill_mode = BG_BUCKET_FILL;
|
||||
/* If the mode is color filling, and shift mask is down,
|
||||
* toggle FG/BG fill mode
|
||||
*/
|
||||
if ((bevent->state & GDK_SHIFT_MASK) && (fill_mode != PATTERN_BUCKET_FILL))
|
||||
fill_mode =
|
||||
(fill_mode == BG_BUCKET_FILL) ? FG_BUCKET_FILL : BG_BUCKET_FILL;
|
||||
|
||||
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
|
||||
&nreturn_vals,
|
||||
|
@ -401,7 +402,7 @@ bucket_fill (GimpImage *gimage,
|
|||
pat_buf = pattern->mask;
|
||||
}
|
||||
|
||||
gimp_add_busy_cursors();
|
||||
gimp_add_busy_cursors ();
|
||||
|
||||
bytes = drawable_bytes (drawable);
|
||||
has_alpha = drawable_has_alpha (drawable);
|
||||
|
@ -428,7 +429,7 @@ bucket_fill (GimpImage *gimage,
|
|||
x2 = BOUNDS (x2, off_x, (off_x + drawable_width (drawable)));
|
||||
y2 = BOUNDS (y2, off_y, (off_y + drawable_height (drawable)));
|
||||
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)),
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE (mask)),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
/* translate mask bounds to drawable coords */
|
||||
|
@ -438,7 +439,7 @@ bucket_fill (GimpImage *gimage,
|
|||
y2 -= off_y;
|
||||
}
|
||||
else
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)),
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE (mask)),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
/* if the gimage doesn't have an alpha channel,
|
||||
|
@ -477,7 +478,7 @@ bucket_fill (GimpImage *gimage,
|
|||
if (new_buf)
|
||||
temp_buf_free (pat_buf);
|
||||
|
||||
gimp_remove_busy_cursors(NULL);
|
||||
gimp_remove_busy_cursors (NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -485,9 +486,9 @@ static void
|
|||
bucket_fill_line_color (unsigned char *buf,
|
||||
unsigned char *mask,
|
||||
unsigned char *col,
|
||||
int has_alpha,
|
||||
int bytes,
|
||||
int width)
|
||||
int has_alpha,
|
||||
int bytes,
|
||||
int width)
|
||||
{
|
||||
int alpha, b;
|
||||
|
||||
|
|
Loading…
Reference in New Issue