Commit 1058f41d authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

app/airbrush.c app/blend.c app/bucket_fill.c app/clone.c app/convolve.c

1999-07-06  Michael Natterer  <mitschel@cs.tu-berlin.de>

        * app/airbrush.c
        * app/blend.c
        * app/bucket_fill.c
        * app/clone.c
        * app/convolve.c
        * app/dodgeburn.c
        * app/eraser.c
        * app/ink.c
        * app/paintbrush.c
        * app/pencil.c
        * app/smudge.c: get opacity/paint mode from the current context
        (currently always the user context).

        * app/gimage_mask.c: the "stroke" command uses the paintbrush's
        settings if the current context is the user context and we are in
        per-tool paint options mode.

        * app/context_manager.[ch]
        * app/paint_options.h
        * app/preferences_dialog.c
        * app/tool_options.c
        * app/tools.c: moved the global/per-tool paint options switching
        to the context manager. The tool options themselves only contain
        the widgets for them now. This should fix the segfaults happening
        in per-tool mode.
	Removed the disclaimer from the prefs. dlg. as it seems to work
	now. The impl. in the context manager however is still a hack.

        * app/brush_select.c
        * app/brushes_cmds.c
        * tools/pdbgen/pdb/brushes.pdb: same as above.

        * app/lc_dialog.c: minimal code reduction. No functionality changed.
parent ac28d6b9
1999-07-06 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/airbrush.c
* app/blend.c
* app/bucket_fill.c
* app/clone.c
* app/convolve.c
* app/dodgeburn.c
* app/eraser.c
* app/ink.c
* app/paintbrush.c
* app/pencil.c
* app/smudge.c: get opacity/paint mode from the current context
(currently always the user context).
* app/gimage_mask.c: the "stroke" command uses the paintbrush's
settings if the current context is the user context and we are in
per-tool paint options mode.
* app/context_manager.[ch]
* app/paint_options.h
* app/preferences_dialog.c
* app/tool_options.c
* app/tools.c: moved the global/per-tool paint options switching
to the context manager. The tool options themselves only contain
the widgets for them now. This should fix the segfaults happening
in per-tool mode.
Removed the disclaimer from the prefs. dlg. as it seems to work
now. The impl. in the context manager however is still a hack.
* app/brush_select.c
* app/brushes_cmds.c
* tools/pdbgen/pdb/brushes.pdb: same as above.
* app/lc_dialog.c: minimal code reduction. No functionality changed.
Mon Jul 5 22:51:37 BST 1999 Austin Donnelly <austin@gimp.org>
* TODO: Removed zoom indicator in titlebar, since we already have
......
......@@ -266,9 +266,9 @@ airbrush_time_out (gpointer client_data)
static void
airbrush_motion (PaintCore *paint_core,
airbrush_motion (PaintCore *paint_core,
GimpDrawable *drawable,
double pressure)
double pressure)
{
gint opacity;
GImage *gimage;
......@@ -300,16 +300,16 @@ airbrush_motion (PaintCore *paint_core,
/* paste the newly painted area to the image */
paint_core_paste_canvas (paint_core, drawable,
opacity,
(int) (PAINT_OPTIONS_GET_OPACITY (airbrush_options) * 255),
PAINT_OPTIONS_GET_PAINT_MODE (airbrush_options),
(gint) (gimp_context_get_opacity (NULL) * 255),
gimp_context_get_paint_mode (NULL),
SOFT, CONSTANT);
}
static void *
airbrush_non_gui_paint_func (PaintCore *paint_core,
airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
int state)
{
airbrush_motion (paint_core, drawable, non_gui_pressure);
......
......@@ -562,23 +562,24 @@ blend_button_release (Tool *tool,
/* we can't do callbacks easily with the PDB, so this UI/backend
* separation (though good) is ignored for the moment */
#ifdef BLEND_UI_CALLS_VIA_PDB
return_vals = procedural_db_run_proc ("gimp_blend",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
PDB_INT32, (gint32) blend_options->blend_mode,
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
PDB_INT32, (gint32) blend_options->gradient_type,
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
PDB_FLOAT, (gdouble) blend_options->offset,
PDB_INT32, (gint32) blend_options->repeat,
PDB_INT32, (gint32) blend_options->supersample,
PDB_INT32, (gint32) blend_options->max_depth,
PDB_FLOAT, (gdouble) blend_options->threshold,
PDB_FLOAT, (gdouble) blend_tool->startx,
PDB_FLOAT, (gdouble) blend_tool->starty,
PDB_FLOAT, (gdouble) blend_tool->endx,
PDB_FLOAT, (gdouble) blend_tool->endy,
PDB_END);
return_vals =
procedural_db_run_proc ("gimp_blend",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
PDB_INT32, (gint32) blend_options->blend_mode,
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
PDB_INT32, (gint32) blend_options->gradient_type,
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
PDB_FLOAT, (gdouble) blend_options->offset,
PDB_INT32, (gint32) blend_options->repeat,
PDB_INT32, (gint32) blend_options->supersample,
PDB_INT32, (gint32) blend_options->max_depth,
PDB_FLOAT, (gdouble) blend_options->threshold,
PDB_FLOAT, (gdouble) blend_tool->startx,
PDB_FLOAT, (gdouble) blend_tool->starty,
PDB_FLOAT, (gdouble) blend_tool->endx,
PDB_FLOAT, (gdouble) blend_tool->endy,
PDB_END);
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
gdisplays_flush ();
......@@ -594,9 +595,9 @@ blend_button_release (Tool *tool,
blend (gimage,
gimage_active_drawable (gimage),
blend_options->blend_mode,
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
gimp_context_get_paint_mode (NULL),
blend_options->gradient_type,
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
gimp_context_get_opacity (NULL) * 100,
blend_options->offset,
blend_options->repeat,
blend_options->supersample,
......
......@@ -19,8 +19,10 @@
#include "appenv.h"
#include "actionarea.h"
#include "gimpbrushlist.h"
#include "gimpcontext.h"
#include "gimplist.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "brush_edit.h"
#include "brush_select.h"
#include "colormaps.h"
......@@ -161,6 +163,7 @@ brush_select_new (gchar *title,
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)
......@@ -415,14 +418,16 @@ brush_select_new (gchar *title,
bsp->redraw = FALSE;
if (!gotinitbrush)
{
bsp->opacity_value = paint_options_get_opacity ();
GimpContext *context = gimp_context_get_user ();
bsp->opacity_value = gimp_context_get_opacity (context);
bsp->paint_mode = gimp_context_get_paint_mode (context);
bsp->spacing_value = gimp_brush_get_spacing (active);
bsp->paint_mode = paint_options_get_paint_mode ();
}
else
{
bsp->opacity_value = init_opacity;
bsp->paint_mode = init_mode;
bsp->paint_mode = init_mode;
}
brush_select_select (bsp, gimp_brush_list_get_brush_index (brush_list,
active));
......@@ -1309,7 +1314,10 @@ paint_mode_menu_callback (GtkWidget *w,
BrushSelectP bsp = (BrushSelectP) gtk_object_get_user_data (GTK_OBJECT (w));
if (bsp == brush_select_dialog)
paint_options_set_paint_mode ((int) client_data);
{
gimp_context_set_paint_mode (gimp_context_get_user (),
(int) client_data);
}
else
{
bsp->paint_mode = (int) client_data;
......@@ -1324,8 +1332,11 @@ opacity_scale_update (GtkAdjustment *adjustment,
{
BrushSelectP bsp = (BrushSelectP) data;
if(bsp == brush_select_dialog)
paint_options_set_opacity (adjustment->value / 100.0);
if (bsp == brush_select_dialog)
{
gimp_context_set_opacity (gimp_context_get_user (),
adjustment->value / 100.0);
}
else
{
bsp->opacity_value = (adjustment->value / 100.0);
......
......@@ -24,9 +24,9 @@
#include "gimpbrush.h"
#include "gimpbrushlistP.h"
#include "gimpcontext.h"
#include "gimplist.h"
#include "paint_funcs.h"
#include "paint_options.h"
static ProcRecord brushes_refresh_proc;
static ProcRecord brushes_get_brush_proc;
......@@ -204,7 +204,7 @@ brushes_get_opacity_invoker (Argument *args)
Argument *return_args;
return_args = procedural_db_return_args (&brushes_get_opacity_proc, TRUE);
return_args[1].value.pdb_float = paint_options_get_opacity () * 100.0;
return_args[1].value.pdb_float = gimp_context_get_opacity (NULL) * 100.0;
return return_args;
}
......@@ -245,7 +245,7 @@ brushes_set_opacity_invoker (Argument *args)
success = FALSE;
if (success)
paint_options_set_opacity (opacity / 100.0);
gimp_context_set_opacity (NULL, opacity / 100.0);
return procedural_db_return_args (&brushes_set_opacity_proc, success);
}
......@@ -358,7 +358,7 @@ brushes_get_paint_mode_invoker (Argument *args)
Argument *return_args;
return_args = procedural_db_return_args (&brushes_get_paint_mode_proc, TRUE);
return_args[1].value.pdb_int = paint_options_get_paint_mode ();
return_args[1].value.pdb_int = gimp_context_get_paint_mode (NULL);
return return_args;
}
......@@ -399,7 +399,7 @@ brushes_set_paint_mode_invoker (Argument *args)
success = FALSE;
if (success)
paint_options_set_paint_mode (paint_mode);
gimp_context_set_paint_mode (NULL, paint_mode);
return procedural_db_return_args (&brushes_set_paint_mode_proc, success);
}
......
......@@ -174,6 +174,7 @@ bucket_options_new (void)
return options;
}
/* bucket fill action functions */
static void
bucket_fill_button_press (Tool *tool,
......@@ -203,7 +204,6 @@ bucket_fill_button_press (Tool *tool,
tool->state = ACTIVE;
}
static void
bucket_fill_button_release (Tool *tool,
GdkEventButton *bevent,
......@@ -223,17 +223,18 @@ bucket_fill_button_release (Tool *tool,
/* if the 3rd button isn't pressed, fill the selected region */
if (! (bevent->state & GDK_BUTTON3_MASK))
{
return_vals = procedural_db_run_proc ("gimp_bucket_fill",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
PDB_INT32, (gint32) bucket_options->fill_mode,
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (bucket_options),
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (bucket_options) * 100,
PDB_FLOAT, (gdouble) bucket_options->threshold,
PDB_INT32, (gint32) bucket_options->sample_merged,
PDB_FLOAT, (gdouble) bucket_tool->target_x,
PDB_FLOAT, (gdouble) bucket_tool->target_y,
PDB_END);
return_vals =
procedural_db_run_proc ("gimp_bucket_fill",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gdisp->gimage)),
PDB_INT32, (gint32) bucket_options->fill_mode,
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
PDB_FLOAT, (gdouble) bucket_options->threshold,
PDB_INT32, (gint32) bucket_options->sample_merged,
PDB_FLOAT, (gdouble) bucket_tool->target_x,
PDB_FLOAT, (gdouble) bucket_tool->target_y,
PDB_END);
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
gdisplays_flush ();
......
......@@ -589,8 +589,8 @@ clone_motion (PaintCore *paint_core,
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (PAINT_OPTIONS_GET_OPACITY (clone_options) * 255),
PAINT_OPTIONS_GET_PAINT_MODE (clone_options),
(int) (gimp_context_get_opacity (NULL) * 255),
gimp_context_get_paint_mode (NULL),
SOFT, CONSTANT);
}
......
......@@ -20,8 +20,12 @@
#include "appenv.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "tools.h"
static GimpContext * global_user_context;
static void
context_manager_display_changed (GimpContext *context,
GDisplay *display,
......@@ -48,12 +52,10 @@ context_manager_init (void)
GimpContext *context;
gint i;
/* Implicitly create the standard context
*/
/* Implicitly create the standard context */
context = gimp_context_get_standard ();
/* To be loaded from disk later
*/
/* TODO: load from disk */
context = gimp_context_new ("Default", NULL, NULL);
gimp_context_set_default (context);
......@@ -64,10 +66,19 @@ context_manager_init (void)
gimp_context_set_user (context);
gimp_context_set_current (context);
global_user_context = gimp_context_new ("Don't use :)", NULL, context);
gtk_signal_connect (GTK_OBJECT (context), "display_changed",
GTK_SIGNAL_FUNC (context_manager_display_changed),
NULL);
gtk_signal_connect (GTK_OBJECT (image_context), "remove",
GTK_SIGNAL_FUNC (context_manager_image_removed),
context);
/* Initialize the tools' contexts */
for (i = 0; i < num_tools; i++)
{
switch (tool_info->tool_id)
switch (tool_info[i].tool_id)
{
case BUCKET_FILL:
case BLEND:
......@@ -81,7 +92,7 @@ context_manager_init (void)
case DODGEBURN:
case SMUDGE:
tool_info[i].tool_context =
gimp_context_new (tool_info[i].private_tip, NULL, NULL);
gimp_context_new (tool_info[i].private_tip, NULL, context);
break;
default:
......@@ -89,13 +100,6 @@ context_manager_init (void)
break;
}
}
gtk_signal_connect (GTK_OBJECT (context), "display_changed",
GTK_SIGNAL_FUNC (context_manager_display_changed),
NULL);
gtk_signal_connect (GTK_OBJECT (image_context), "remove",
GTK_SIGNAL_FUNC (context_manager_image_removed),
context);
}
void
......@@ -116,8 +120,77 @@ context_manager_free (void)
gimp_context_set_user (NULL);
gimp_context_set_current (NULL);
/* Save to disk before destroying later
*/
/* TODO: Save to disk before destroying */
gtk_object_unref (GTK_OBJECT (gimp_context_get_default ()));
gimp_context_set_default (NULL);
}
void
context_manager_set_global_paint_options (gboolean global)
{
GimpContext* context;
paint_options_set_global (global);
if (global)
{
if (active_tool &&
(context = tool_info[active_tool->type].tool_context))
{
gimp_context_define_opacity (context, TRUE);
gimp_context_define_paint_mode (context, TRUE);
}
gimp_context_set_opacity (gimp_context_get_user (),
gimp_context_get_opacity (global_user_context));
gimp_context_set_paint_mode (gimp_context_get_user (),
gimp_context_get_paint_mode (global_user_context));
gimp_context_define_opacity (global_user_context, FALSE);
gimp_context_define_paint_mode (global_user_context, FALSE);
}
else
{
gimp_context_define_opacity (global_user_context, TRUE);
gimp_context_define_paint_mode (global_user_context, TRUE);
if (active_tool &&
(context = tool_info[active_tool->type].tool_context))
{
gimp_context_set_opacity (gimp_context_get_user (),
gimp_context_get_opacity (context));
gimp_context_set_paint_mode (gimp_context_get_user (),
gimp_context_get_paint_mode (context));
gimp_context_define_opacity (context, FALSE);
gimp_context_define_paint_mode (context, FALSE);
}
}
}
void
context_manager_set_tool (ToolType tool_type)
{
GimpContext* context;
if (! global_paint_options)
{
if (active_tool &&
(context = tool_info[active_tool->type].tool_context))
{
gimp_context_define_opacity (context, TRUE);
gimp_context_define_paint_mode (context, TRUE);
}
if ((context = tool_info[tool_type].tool_context))
{
gimp_context_set_opacity (gimp_context_get_user (),
gimp_context_get_opacity (context));
gimp_context_set_paint_mode (gimp_context_get_user (),
gimp_context_get_paint_mode (context));
gimp_context_define_opacity (context, FALSE);
gimp_context_define_paint_mode (context, FALSE);
}
}
}
......@@ -19,8 +19,12 @@
#define __CONTEXT_MANAGER_H__
#include "gimpcontext.h"
#include "toolsF.h"
void context_manager_init (void);
void context_manager_free (void);
void context_manager_set_global_paint_options (gboolean global);
void context_manager_set_tool (ToolType tool_type);
#endif /* __CONTEXT_MANAGER_H__ */
......@@ -348,8 +348,8 @@ convolve_motion (PaintCore *paint_core,
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_replace_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (PAINT_OPTIONS_GET_OPACITY (convolve_options) * 255),
SOFT, INCREMENTAL);
(int) (gimp_context_get_opacity (NULL) * 255),
SOFT, INCREMENTAL);
}
static void
......
......@@ -562,23 +562,24 @@ blend_button_release (Tool *tool,
/* we can't do callbacks easily with the PDB, so this UI/backend
* separation (though good) is ignored for the moment */
#ifdef BLEND_UI_CALLS_VIA_PDB
return_vals = procedural_db_run_proc ("gimp_blend",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
PDB_INT32, (gint32) blend_options->blend_mode,
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
PDB_INT32, (gint32) blend_options->gradient_type,
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
PDB_FLOAT, (gdouble) blend_options->offset,
PDB_INT32, (gint32) blend_options->repeat,
PDB_INT32, (gint32) blend_options->supersample,
PDB_INT32, (gint32) blend_options->max_depth,
PDB_FLOAT, (gdouble) blend_options->threshold,
PDB_FLOAT, (gdouble) blend_tool->startx,
PDB_FLOAT, (gdouble) blend_tool->starty,
PDB_FLOAT, (gdouble) blend_tool->endx,
PDB_FLOAT, (gdouble) blend_tool->endy,
PDB_END);
return_vals =
procedural_db_run_proc ("gimp_blend",
&nreturn_vals,
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
PDB_INT32, (gint32) blend_options->blend_mode,
PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL),
PDB_INT32, (gint32) blend_options->gradient_type,
PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100,
PDB_FLOAT, (gdouble) blend_options->offset,
PDB_INT32, (gint32) blend_options->repeat,
PDB_INT32, (gint32) blend_options->supersample,
PDB_INT32, (gint32) blend_options->max_depth,
PDB_FLOAT, (gdouble) blend_options->threshold,
PDB_FLOAT, (gdouble) blend_tool->startx,
PDB_FLOAT, (gdouble) blend_tool->starty,
PDB_FLOAT, (gdouble) blend_tool->endx,
PDB_FLOAT, (gdouble) blend_tool->endy,
PDB_END);
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
gdisplays_flush ();
......@@ -594,9 +595,9 @@ blend_button_release (Tool *tool,
blend (gimage,
gimage_active_drawable (gimage),
blend_options->blend_mode,
PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
gimp_context_get_paint_mode (NULL),
blend_options->gradient_type,
PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
gimp_context_get_opacity (NULL) * 100,
blend_options->offset,
blend_options->repeat,
blend_options->supersample,
......
......@@ -24,6 +24,7 @@
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimprc.h"
#include "interface.h"
#include "layer.h"
#include "paint_core.h"
......@@ -618,8 +619,9 @@ gimage_mask_stroke_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
{
GImage *gimage;
TempBuf * area;
GImage *gimage;
TempBuf *area;
GimpContext *context;
unsigned char col[MAX_CHANNELS];
if (! (gimage = drawable_gimage (drawable)))
......@@ -638,10 +640,17 @@ gimage_mask_stroke_paint_func (PaintCore *paint_core,
color_pixels (temp_buf_data (area), col,
area->width * area->height, area->bytes);
if (gimp_context_get_current () == gimp_context_get_user () &&
! global_paint_options)
context = tool_info[PAINTBRUSH].tool_context;
else
context = gimp_context_get_current ();
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (paint_options_get_opacity () * 255),
paint_options_get_paint_mode (), SOFT, CONSTANT);
(int) (gimp_context_get_opacity (context) * 255),
gimp_context_get_paint_mode (context),
SOFT, CONSTANT);
return NULL;
}
......@@ -27,10 +27,6 @@
#include "libgimp/gimpintl.h"
/* the global paint options */
static double global_opacity = 1.0;
static int global_paint_mode = 0;
/* a list of all PaintOptions */
static GSList *paint_options_list = NULL;
......@@ -94,10 +90,20 @@ void
tool_options_opacity_adjustment_update (GtkWidget *widget,
gpointer data)
{
double *val;
gimp_context_set_opacity (GIMP_CONTEXT (data),
GTK_ADJUSTMENT (widget)->value / 100);
}
val = (double *) data;
*val = GTK_ADJUSTMENT (widget)->value / 100;
static void
tool_options_paint_mode_update (GtkWidget *widget,
gpointer data)
{
GimpContext *context;
context = (GimpContext *) gtk_object_get_user_data (GTK_OBJECT (widget));
gimp_context_set_paint_mode (GIMP_CONTEXT (context),
(long) data);
}
void
......@@ -124,18 +130,6 @@ tool_options_unitmenu_update (GtkWidget *widget,
}
}
static void
tool_options_paint_mode_update (GtkWidget *widget,
gpointer data)
{
PaintOptions *options;
options = (PaintOptions *) gtk_object_get_user_data (GTK_OBJECT (widget));
if (options)
options->paint_mode = (long) data;
}
static void
tool_options_radio_buttons_update (GtkWidget *widget,
gpointer data)
......@@ -206,7 +200,7 @@ tool_options_new (gchar *title)
GtkWidget *label;
options = (ToolOptions *) g_malloc (sizeof (ToolOptions));
options = g_new (ToolOptions, 1);
tool_options_init (options, title, NULL);
label = gtk_label_new (_("This tool has no options."));
......@@ -233,20 +227,20 @@ selection_options_init (SelectionOptions *options,
/* initialize the tool options structure */
tool_options_init ((ToolOptions *) options,
((tool_type == RECT_SELECT) ?
N_("Rectangular Select Options") :
_("Rectangular Select Options") :
((tool_type == ELLIPSE_SELECT) ?
N_("Elliptical Selection Options") :
_("Elliptical Selection Options") :
((tool_type == FREE_SELECT) ?
N_("Free-hand Selection Options") :
_("Free-hand Selection Options") :
((tool_type == FUZZY_SELECT) ?
N_("Fuzzy Selection Options") :
_("Fuzzy Selection Options") :
((tool_type == BEZIER_SELECT) ?
N_("Bezier Selection Options") :
_("Bezier Selection Options") :
((tool_type == ISCISSORS) ?
N_("Intelligent Scissors Options") :
_("Intelligent Scissors Options") :
((tool_type == BY_COLOR_SELECT) ?
N_("By-Color Select Options") :
N_("ERROR: Unknown Selection Type")))))))),
_("By-Color Select Options") :
_("ERROR: Unknown Selection Type")))))))),
reset_func);
/* the main vbox */
......@@ -480,7 +474,7 @@ selection_options_new (ToolType tool_type,
{
SelectionOptions *options;
options = (SelectionOptions *) g_malloc (sizeof (SelectionOptions));
options = g_new (SelectionOptions, 1);
selection_options_init (options, tool_type, reset_func);
return options;
......@@ -550,37 +544,36 @@ paint_options_init (PaintOptions *options,
GtkWidget *menu;
GtkWidget *separator;
GimpContext *tool_context = tool_info[tool_type].tool_context;
/* initialize the tool options structure */
tool_options_init ((ToolOptions *) options,
((tool_type == BUCKET_FILL) ?
N_("Bucket Fill Options") :
_("Bucket Fill Options") :
((tool_type == BLEND) ?
N_("Blend Options") :
_("Blend Options") :
((tool_type == PENCIL) ?
N_("Pencil Options") :
_("Pencil Options") :
((tool_type == PAINTBRUSH) ?
N_("Paintbrush Options") :
_("Paintbrush Options") :
((tool_type == ERASER) ?
N_("Erazer Options") :
_("Erazer Options") :
((tool_type == AIRBRUSH) ?
N_("Airbrush Options") :
_("Airbrush Options") :
((tool_type == CLONE) ?
N_("Clone Tool Options") :
_("Clone Tool Options") :
((tool_type == CONVOLVE) ?
N_("Convolver Options") :
_("Convolver Options") :
((tool_type == INK) ?
N_("Ink Options") :
((tool_type == DODGEBURN) ?
N_("Dodge or Burn Options") :
((tool_type == SMUDGE) ?
N_("Smudge Options") :
N_("ERROR: Unknown Paint Type")))))))))))),
_("Ink Options") :
((tool_type == DODGEBURN) ?
_("Dodge or Burn Options") :
((tool_type == SMUDGE) ?
_("Smudge Options") :
_("ERROR: Unknown Paint Type")))))))))))),
reset_func);
/* initialize the paint options structure */
options->opacity = options->opacity_d = 1.0;
options->paint_mode = options->paint_mode_d = 0;
options->global = NULL;
options->opacity_w = NULL;
options->paint_mode_w = NULL;
......@@ -604,10 +597,11 @@ paint_options_init (PaintOptions *options,
gtk_widget_show (label);