app: add signal GimpToolWidget::snap_offsets() and API to emit it
so widgets can notify their handling tool of snap offsets.
This commit is contained in:
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include "display-types.h"
|
#include "display-types.h"
|
||||||
|
|
||||||
|
#include "core/gimpmarshal.h"
|
||||||
|
|
||||||
#include "gimpcanvasgroup.h"
|
#include "gimpcanvasgroup.h"
|
||||||
#include "gimpcanvashandle.h"
|
#include "gimpcanvashandle.h"
|
||||||
#include "gimpcanvasline.h"
|
#include "gimpcanvasline.h"
|
||||||
@ -43,6 +45,7 @@ enum
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CHANGED,
|
CHANGED,
|
||||||
|
SNAP_OFFSETS,
|
||||||
STATUS,
|
STATUS,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
@ -99,6 +102,19 @@ gimp_tool_widget_class_init (GimpToolWidgetClass *klass)
|
|||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
widget_signals[SNAP_OFFSETS] =
|
||||||
|
g_signal_new ("snap-offsets",
|
||||||
|
G_TYPE_FROM_CLASS (klass),
|
||||||
|
G_SIGNAL_RUN_FIRST,
|
||||||
|
G_STRUCT_OFFSET (GimpToolWidgetClass, snap_offsets),
|
||||||
|
NULL, NULL,
|
||||||
|
gimp_marshal_VOID__INT_INT_INT_INT,
|
||||||
|
G_TYPE_NONE, 4,
|
||||||
|
G_TYPE_INT,
|
||||||
|
G_TYPE_INT,
|
||||||
|
G_TYPE_INT,
|
||||||
|
G_TYPE_INT);
|
||||||
|
|
||||||
widget_signals[STATUS] =
|
widget_signals[STATUS] =
|
||||||
g_signal_new ("status",
|
g_signal_new ("status",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
@ -234,6 +250,19 @@ gimp_tool_widget_get_item (GimpToolWidget *widget)
|
|||||||
return widget->private->item;
|
return widget->private->item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_tool_widget_snap_offsets (GimpToolWidget *widget,
|
||||||
|
gint offset_x,
|
||||||
|
gint offset_y,
|
||||||
|
gint width,
|
||||||
|
gint height)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GIMP_IS_TOOL_WIDGET (widget));
|
||||||
|
|
||||||
|
g_signal_emit (widget, widget_signals[SNAP_OFFSETS], 0,
|
||||||
|
offset_x, offset_y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_tool_widget_status (GimpToolWidget *widget,
|
gimp_tool_widget_status (GimpToolWidget *widget,
|
||||||
const gchar *status)
|
const gchar *status)
|
||||||
|
@ -49,6 +49,11 @@ struct _GimpToolWidgetClass
|
|||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (* changed) (GimpToolWidget *widget);
|
void (* changed) (GimpToolWidget *widget);
|
||||||
|
void (* snap_offsets) (GimpToolWidget *widget,
|
||||||
|
gint offset_x,
|
||||||
|
gint offset_y,
|
||||||
|
gint width,
|
||||||
|
gint height);
|
||||||
void (* status) (GimpToolWidget *widget,
|
void (* status) (GimpToolWidget *widget,
|
||||||
const gchar *status);
|
const gchar *status);
|
||||||
|
|
||||||
@ -96,8 +101,13 @@ GType gimp_tool_widget_get_type (void) G_GNUC_CONST;
|
|||||||
GimpDisplayShell * gimp_tool_widget_get_shell (GimpToolWidget *widget);
|
GimpDisplayShell * gimp_tool_widget_get_shell (GimpToolWidget *widget);
|
||||||
GimpCanvasItem * gimp_tool_widget_get_item (GimpToolWidget *widget);
|
GimpCanvasItem * gimp_tool_widget_get_item (GimpToolWidget *widget);
|
||||||
|
|
||||||
/* for subclasses, to add emit status messages
|
/* for subclasses, to notify the handling tool
|
||||||
*/
|
*/
|
||||||
|
void gimp_tool_widget_snap_offsets (GimpToolWidget *widget,
|
||||||
|
gint offset_x,
|
||||||
|
gint offset_y,
|
||||||
|
gint width,
|
||||||
|
gint height);
|
||||||
void gimp_tool_widget_status (GimpToolWidget *widget,
|
void gimp_tool_widget_status (GimpToolWidget *widget,
|
||||||
const gchar *status);
|
const gchar *status);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user