Commit 58d780e0 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

connect to GimpTransformOptions' "notify" signal and update grid and path

2003-02-10  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimptransformtool.[ch]: connect to GimpTransformOptions'
	"notify" signal and update grid and path drawing accordingly.

	* app/tools/gimptransformoptions.c: removed the same stuff here.
	Doesn't depend on the tool_manager any more.

	* app/tools/gimpselectionoptions.c
	* app/tools/paint_options.c: don't #include "tool_manager.h"
parent cbcbcaec
2003-02-09 Michael Natterer <mitch@convergence.de>
2003-02-10 Michael Natterer <mitch@gimp.org>
* app/tools/gimptransformtool.[ch]: connect to GimpTransformOptions'
"notify" signal and update grid and path drawing accordingly.
* app/tools/gimptransformoptions.c: removed the same stuff here.
Doesn't depend on the tool_manager any more.
* app/tools/gimpselectionoptions.c
* app/tools/paint_options.c: don't #include "tool_manager.h"
2003-02-09 Michael Natterer <mitch@gimp.org>
 
* app/core/core-enums.[ch]: changed GimpOrientationType from
GIMP_HORIZONTAL to GIMP_ORIENTATION_HORIZONTAL etc.
......
......@@ -40,9 +40,6 @@
#include "widgets/gimpwidgets-constructors.h"
#include "widgets/gtkhwrapbox.h"
#include "paint_options.h"
#include "tool_manager.h"
#include "gimpairbrushtool.h"
#include "gimpblendtool.h"
#include "gimpbucketfilltool.h"
......@@ -55,6 +52,7 @@
#include "gimpsmudgetool.h"
#include "gimpclonetool.h"
#include "gimpconvolvetool.h"
#include "paint_options.h"
#include "libgimp/gimpintl.h"
......
......@@ -38,7 +38,6 @@
#include "gimpfuzzyselecttool.h"
#include "gimpiscissorstool.h"
#include "gimpselectionoptions.h"
#include "tool_manager.h"
#include "libgimp/gimpintl.h"
......
......@@ -36,9 +36,7 @@
#include "gimprotatetool.h"
#include "gimpscaletool.h"
#include "gimptransformtool.h"
#include "gimptransformoptions.h"
#include "tool_manager.h"
#include "libgimp/gimpintl.h"
......@@ -71,7 +69,7 @@ static void gimp_transform_options_get_property (GObject *object,
static void gimp_transform_options_reset (GimpToolOptions *tool_options);
static void gimp_transform_options_notify (GimpTransformOptions *options,
static void gimp_transform_options_grid_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box);
......@@ -327,8 +325,8 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
g_signal_connect (config, "notify",
G_CALLBACK (gimp_transform_options_notify),
g_signal_connect (config, "notify::grid-type",
G_CALLBACK (gimp_transform_options_grid_notify),
table);
gimp_prop_scale_entry_new (config, "grid-size",
......@@ -410,53 +408,11 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
/* private functions */
static void
gimp_transform_options_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box)
gimp_transform_options_grid_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box)
{
GimpToolOptions *tool_options;
GimpTool *active_tool;
GimpTransformTool *transform_tool;
tool_options = GIMP_TOOL_OPTIONS (options);
active_tool = tool_manager_get_active (tool_options->tool_info->gimp);
if (GIMP_IS_TRANSFORM_TOOL (active_tool))
transform_tool = GIMP_TRANSFORM_TOOL (active_tool);
else
transform_tool = NULL;
switch (pspec->param_id)
{
case PROP_GRID_TYPE:
if (transform_tool)
gimp_transform_tool_grid_density_changed (transform_tool);
gtk_widget_set_sensitive (density_box,
options->grid_type !=
GIMP_TRANSFORM_GRID_TYPE_NONE);
break;
case PROP_GRID_SIZE:
if (transform_tool)
gimp_transform_tool_grid_density_changed (transform_tool);
break;
case PROP_SHOW_PATH:
if (transform_tool)
{
#if 0
gimp_transform_tool_show_path_changed (transform_tool, 1); /* pause */
gimp_toggle_button_update (widget, &options->show_path);
gimp_transform_tool_show_path_changed (transform_tool, 0); /* resume */
#endif
}
break;
default:
break;
}
gtk_widget_set_sensitive (density_box,
options->grid_type !=
GIMP_TRANSFORM_GRID_TYPE_NONE);
}
......@@ -129,6 +129,13 @@ static void transform_cancel_callback (GtkWidget *widget,
static void transform_ok_callback (GtkWidget *widget,
GimpTransformTool *tr_tool);
static void gimp_transform_tool_notify_grid (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool);
static void gimp_transform_tool_notify_path (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool);
static GimpDrawToolClass *parent_class = NULL;
......@@ -215,16 +222,19 @@ gimp_transform_tool_init (GimpTransformTool *tr_tool)
gimp_matrix3_identity (tr_tool->transform);
tr_tool->use_grid = TRUE;
tr_tool->use_center = TRUE;
tr_tool->ngx = 0;
tr_tool->ngy = 0;
tr_tool->grid_coords = NULL;
tr_tool->tgrid_coords = NULL;
tr_tool->use_grid = TRUE;
tr_tool->use_center = TRUE;
tr_tool->ngx = 0;
tr_tool->ngy = 0;
tr_tool->grid_coords = NULL;
tr_tool->tgrid_coords = NULL;
tr_tool->notify_connected = FALSE;
tr_tool->show_path = FALSE;
tr_tool->shell_desc = NULL;
tr_tool->progress_text = _("Transforming...");
tr_tool->info_dialog = NULL;
tr_tool->shell_desc = NULL;
tr_tool->progress_text = _("Transforming...");
tr_tool->info_dialog = NULL;
}
static void
......@@ -308,6 +318,27 @@ gimp_transform_tool_button_press (GimpTool *tool,
drawable = gimp_image_active_drawable (gdisp->gimage);
if (! tr_tool->notify_connected)
{
tr_tool->show_path =
GIMP_TRANSFORM_OPTIONS (tool->tool_info->tool_options)->show_path;
g_signal_connect_object (tool->tool_info->tool_options,
"notify::grid-type",
G_CALLBACK (gimp_transform_tool_notify_grid),
tr_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options,
"notify::grid-size",
G_CALLBACK (gimp_transform_tool_notify_grid),
tr_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options,
"notify::show-path",
G_CALLBACK (gimp_transform_tool_notify_path),
tr_tool, 0);
tr_tool->notify_connected = TRUE;
}
if (gdisp != tool->gdisp)
{
/* Initialisation stuff: if the cursor is clicked inside the current
......@@ -714,7 +745,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
FALSE);
}
if (options->show_path)
if (tr_tool->show_path)
{
GimpMatrix3 tmp_matrix;
......@@ -967,33 +998,6 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
}
}
void
gimp_transform_tool_grid_density_changed (GimpTransformTool *tr_tool)
{
if (tr_tool->function == TRANSFORM_CREATING)
return;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
gimp_transform_tool_grid_recalc (tr_tool);
gimp_transform_tool_transform_bounding_box (tr_tool);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
void
gimp_transform_tool_show_path_changed (GimpTransformTool *tr_tool,
gint type /* a truly undescriptive name */)
{
if (tr_tool->function == TRANSFORM_CREATING)
return;
if (type)
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
else
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
static void
gimp_transform_tool_grid_recalc (GimpTransformTool *tr_tool)
{
......@@ -1182,3 +1186,34 @@ transform_ok_callback (GtkWidget *widget,
{
gimp_transform_tool_doit (tr_tool, GIMP_TOOL (tr_tool)->gdisp);
}
static void
gimp_transform_tool_notify_grid (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool)
{
if (tr_tool->function == TRANSFORM_CREATING)
return;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
gimp_transform_tool_grid_recalc (tr_tool);
gimp_transform_tool_transform_bounding_box (tr_tool);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
static void
gimp_transform_tool_notify_path (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool)
{
if (tr_tool->function == TRANSFORM_CREATING)
return;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
tr_tool->show_path = options->show_path;
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
......@@ -89,6 +89,9 @@ struct _GimpTransformTool
*/
gdouble *tgrid_coords; /* transformed grid_coords */
gboolean notify_connected;
gboolean show_path;
/* transform info dialog */
const gchar *shell_desc;
const gchar *progress_text;
......@@ -117,9 +120,5 @@ GType gimp_transform_tool_get_type (void) G_GNUC_CONST;
void gimp_transform_tool_transform_bounding_box (GimpTransformTool *tr_tool);
void gimp_transform_tool_grid_density_changed (GimpTransformTool *tr_tool);
void gimp_transform_tool_show_path_changed (GimpTransformTool *tr_tool,
gint type);
#endif /* __GIMP_TRANSFORM_TOOL_H__ */
......@@ -40,9 +40,6 @@
#include "widgets/gimpwidgets-constructors.h"
#include "widgets/gtkhwrapbox.h"
#include "paint_options.h"
#include "tool_manager.h"
#include "gimpairbrushtool.h"
#include "gimpblendtool.h"
#include "gimpbucketfilltool.h"
......@@ -55,6 +52,7 @@
#include "gimpsmudgetool.h"
#include "gimpclonetool.h"
#include "gimpconvolvetool.h"
#include "paint_options.h"
#include "libgimp/gimpintl.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment