added some functions. Still does nothing.

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

	* app/gimpcontext.[ch]: added some functions. Still does nothing.

	* app/bezier_select.c
	* app/devices.c
	* app/tools.[ch]: removed global variable active_tool_type
	because it was always equal to active_tool->type.
This commit is contained in:
Michael Natterer 1999-06-19 20:20:59 +00:00 committed by Michael Natterer
parent 01155dd8c7
commit aef2a0331a
16 changed files with 121 additions and 64 deletions

View File

@ -1,3 +1,12 @@
1999-06-19 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/gimpcontext.[ch]: added some functions. Still does nothing.
* app/bezier_select.c
* app/devices.c
* app/tools.[ch]: removed global variable active_tool_type
because it was always equal to active_tool->type.
Thu Jun 17 22:32:00 CST 1999 Seth Burgess <sjburges@gimp.org>
* app/flip_tool.c : Fixed flip tool bug - use FLIP_INFO rather than

View File

@ -2434,7 +2434,8 @@ bezier_insert_in_list (GSList * list,
gboolean
bezier_tool_selected()
{
return(active_tool_type == BEZIER_SELECT &&
return(active_tool &&
active_tool->type == BEZIER_SELECT &&
active_tool->state == ACTIVE);
}
@ -2451,7 +2452,8 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
/* printSel(bsel); */
/* If the tool was being used before clear it */
if (active_tool_type == BEZIER_SELECT &&
if (active_tool &&
active_tool->type == BEZIER_SELECT &&
active_tool->state == ACTIVE)
{
BezierSelect *bezier_sel = (BezierSelect*)active_tool->private;

View File

@ -166,8 +166,8 @@ gimp_context_get_type (void)
GtkTypeInfo context_info =
{
"GimpContext",
sizeof(GimpContext),
sizeof(GimpContextClass),
sizeof (GimpContext),
sizeof (GimpContextClass),
(GtkClassInitFunc) gimp_context_class_init,
(GtkObjectInitFunc) gimp_context_init,
/* reserved_1 */ NULL,
@ -211,14 +211,6 @@ gimp_context_new (gchar *name,
context->display_defined = template->display_defined;
}
if (!parent)
{
context->opacity_defined = TRUE;
context->paint_mode_defined = TRUE;
context->image_defined = TRUE;
context->display_defined = TRUE;
}
return context;
}
@ -275,6 +267,36 @@ gimp_context_get_standard (void)
/* functions manipulating a single context ********************************/
gchar *
gimp_context_get_name (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->name;
}
GimpContext *
gimp_context_get_parent (GimpContext *context)
{
context_return_val_if_fail (context, NULL);
return context->parent;
}
void
gimp_context_set_parent (GimpContext *context,
GimpContext *parent)
{
context_return_if_fail (context);
g_return_if_fail (!parent || GIMP_IS_CONTEXT (parent));
context->parent = parent;
}
/* attribute access functions */
/* FIXME: - this is UGLY code duplication
* - gimp_context_*_defined and _define_* sounds very ugly, too
* TODO: - implement a generic way or alternatively

View File

@ -76,7 +76,6 @@ GimpContext * gimp_context_new (gchar *name,
/* TODO: - gimp_context_set_parent ()
* - gimp_context_get_parent ()
* - gimp_context_find ()
* - gimp_context_get_name ()
*
* probably interacting with the context manager:
* - gimp_context_push () which will call gimp_context_set_parent()
@ -108,6 +107,12 @@ GimpContext * gimp_context_get_standard (void);
* FIXME: this interface may be ok but the implementation is
* ugly code duplication. There needs to be a generic way.
*/
gchar * gimp_context_get_name (GimpContext *context);
GimpContext * gimp_context_get_parent (GimpContext *context);
void gimp_context_set_parent (GimpContext *context,
GimpContext *parent);
gdouble gimp_context_get_opacity (GimpContext *context);
void gimp_context_set_opacity (GimpContext *context,
gdouble opacity);

View File

@ -502,8 +502,8 @@ devices_save_current_info (void)
device_info->device = current_device;
device_info->brush = get_active_brush ();
device_info->pattern = get_active_pattern();
if (active_tool_type >= 0)
device_info->tool = active_tool_type;
if (active_tool)
device_info->tool = active_tool->type;
else
device_info->tool = RECT_SELECT;
palette_get_foreground (&device_info->foreground[0],

View File

@ -166,8 +166,8 @@ gimp_context_get_type (void)
GtkTypeInfo context_info =
{
"GimpContext",
sizeof(GimpContext),
sizeof(GimpContextClass),
sizeof (GimpContext),
sizeof (GimpContextClass),
(GtkClassInitFunc) gimp_context_class_init,
(GtkObjectInitFunc) gimp_context_init,
/* reserved_1 */ NULL,
@ -211,14 +211,6 @@ gimp_context_new (gchar *name,
context->display_defined = template->display_defined;
}
if (!parent)
{
context->opacity_defined = TRUE;
context->paint_mode_defined = TRUE;
context->image_defined = TRUE;
context->display_defined = TRUE;
}
return context;
}
@ -275,6 +267,36 @@ gimp_context_get_standard (void)
/* functions manipulating a single context ********************************/
gchar *
gimp_context_get_name (GimpContext *context)
{
context_check_current (context);
context_return_val_if_fail (context, NULL);
return context->name;
}
GimpContext *
gimp_context_get_parent (GimpContext *context)
{
context_return_val_if_fail (context, NULL);
return context->parent;
}
void
gimp_context_set_parent (GimpContext *context,
GimpContext *parent)
{
context_return_if_fail (context);
g_return_if_fail (!parent || GIMP_IS_CONTEXT (parent));
context->parent = parent;
}
/* attribute access functions */
/* FIXME: - this is UGLY code duplication
* - gimp_context_*_defined and _define_* sounds very ugly, too
* TODO: - implement a generic way or alternatively

View File

@ -76,7 +76,6 @@ GimpContext * gimp_context_new (gchar *name,
/* TODO: - gimp_context_set_parent ()
* - gimp_context_get_parent ()
* - gimp_context_find ()
* - gimp_context_get_name ()
*
* probably interacting with the context manager:
* - gimp_context_push () which will call gimp_context_set_parent()
@ -108,6 +107,12 @@ GimpContext * gimp_context_get_standard (void);
* FIXME: this interface may be ok but the implementation is
* ugly code duplication. There needs to be a generic way.
*/
gchar * gimp_context_get_name (GimpContext *context);
GimpContext * gimp_context_get_parent (GimpContext *context);
void gimp_context_set_parent (GimpContext *context,
GimpContext *parent);
gdouble gimp_context_get_opacity (GimpContext *context);
void gimp_context_set_opacity (GimpContext *context,
gdouble opacity);

View File

@ -502,8 +502,8 @@ devices_save_current_info (void)
device_info->device = current_device;
device_info->brush = get_active_brush ();
device_info->pattern = get_active_pattern();
if (active_tool_type >= 0)
device_info->tool = active_tool_type;
if (active_tool)
device_info->tool = active_tool->type;
else
device_info->tool = RECT_SELECT;
palette_get_foreground (&device_info->foreground[0],

View File

@ -502,8 +502,8 @@ devices_save_current_info (void)
device_info->device = current_device;
device_info->brush = get_active_brush ();
device_info->pattern = get_active_pattern();
if (active_tool_type >= 0)
device_info->tool = active_tool_type;
if (active_tool)
device_info->tool = active_tool->type;
else
device_info->tool = RECT_SELECT;
palette_get_foreground (&device_info->foreground[0],

View File

@ -65,9 +65,8 @@
/* Global Data */
Tool * active_tool = NULL;
Layer * active_tool_layer = NULL;
ToolType active_tool_type = -1;
Tool * active_tool = NULL;
Layer * active_tool_layer = NULL;
/* Local Data */
@ -649,10 +648,8 @@ tools_select (ToolType type)
active_tool->gdisp_ptr = NULL;
active_tool->drawable = NULL;
active_tool->ID = global_tool_ID++;
active_tool_type = active_tool->type;
/* Update the device-information dialog */
/* Update the device-information dialog */
device_status_update (current_device);
}
@ -700,7 +697,6 @@ tools_initialize (ToolType type, GDisplay *gdisp)
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->ID = global_tool_ID++;
active_tool_type = active_tool->type;
}
void
@ -916,9 +912,9 @@ tools_options_reset_callback (GtkWidget *w,
shell = (GtkWidget *) client_data;
if (active_tool_type == -1)
if (! active_tool)
return;
if (tool_info[(int) active_tool_type].tool_options->reset_func)
(* tool_info[(int) active_tool_type].tool_options->reset_func) ();
if (tool_info[(int) active_tool->type].tool_options->reset_func)
(* tool_info[(int) active_tool->type].tool_options->reset_func) ();
}

View File

@ -102,10 +102,9 @@ struct _ToolInfo
/* Global Data Structure */
extern Tool * active_tool;
extern ToolType active_tool_type;
extern Layer * active_tool_layer;
extern ToolInfo tool_info[];
extern Tool * active_tool;
extern Layer * active_tool_layer;
extern ToolInfo tool_info[];
/* Function declarations */

View File

@ -2434,7 +2434,8 @@ bezier_insert_in_list (GSList * list,
gboolean
bezier_tool_selected()
{
return(active_tool_type == BEZIER_SELECT &&
return(active_tool &&
active_tool->type == BEZIER_SELECT &&
active_tool->state == ACTIVE);
}
@ -2451,7 +2452,8 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
/* printSel(bsel); */
/* If the tool was being used before clear it */
if (active_tool_type == BEZIER_SELECT &&
if (active_tool &&
active_tool->type == BEZIER_SELECT &&
active_tool->state == ACTIVE)
{
BezierSelect *bezier_sel = (BezierSelect*)active_tool->private;

View File

@ -65,9 +65,8 @@
/* Global Data */
Tool * active_tool = NULL;
Layer * active_tool_layer = NULL;
ToolType active_tool_type = -1;
Tool * active_tool = NULL;
Layer * active_tool_layer = NULL;
/* Local Data */
@ -649,10 +648,8 @@ tools_select (ToolType type)
active_tool->gdisp_ptr = NULL;
active_tool->drawable = NULL;
active_tool->ID = global_tool_ID++;
active_tool_type = active_tool->type;
/* Update the device-information dialog */
/* Update the device-information dialog */
device_status_update (current_device);
}
@ -700,7 +697,6 @@ tools_initialize (ToolType type, GDisplay *gdisp)
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->ID = global_tool_ID++;
active_tool_type = active_tool->type;
}
void
@ -916,9 +912,9 @@ tools_options_reset_callback (GtkWidget *w,
shell = (GtkWidget *) client_data;
if (active_tool_type == -1)
if (! active_tool)
return;
if (tool_info[(int) active_tool_type].tool_options->reset_func)
(* tool_info[(int) active_tool_type].tool_options->reset_func) ();
if (tool_info[(int) active_tool->type].tool_options->reset_func)
(* tool_info[(int) active_tool->type].tool_options->reset_func) ();
}

View File

@ -102,10 +102,9 @@ struct _ToolInfo
/* Global Data Structure */
extern Tool * active_tool;
extern ToolType active_tool_type;
extern Layer * active_tool_layer;
extern ToolInfo tool_info[];
extern Tool * active_tool;
extern Layer * active_tool_layer;
extern ToolInfo tool_info[];
/* Function declarations */

View File

@ -502,8 +502,8 @@ devices_save_current_info (void)
device_info->device = current_device;
device_info->brush = get_active_brush ();
device_info->pattern = get_active_pattern();
if (active_tool_type >= 0)
device_info->tool = active_tool_type;
if (active_tool)
device_info->tool = active_tool->type;
else
device_info->tool = RECT_SELECT;
palette_get_foreground (&device_info->foreground[0],

View File

@ -502,8 +502,8 @@ devices_save_current_info (void)
device_info->device = current_device;
device_info->brush = get_active_brush ();
device_info->pattern = get_active_pattern();
if (active_tool_type >= 0)
device_info->tool = active_tool_type;
if (active_tool)
device_info->tool = active_tool->type;
else
device_info->tool = RECT_SELECT;
palette_get_foreground (&device_info->foreground[0],