summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/connector-toolbar.cpp67
-rw-r--r--src/widgets/eek-preview.cpp862
-rw-r--r--src/widgets/eek-preview.h31
-rw-r--r--src/widgets/fill-style.cpp2
-rw-r--r--src/widgets/gradient-selector.cpp4
-rw-r--r--src/widgets/icon.cpp2
-rw-r--r--src/widgets/sp-color-notebook.cpp2
-rw-r--r--src/widgets/sp-color-wheel-selector.cpp73
-rw-r--r--src/widgets/sp-color-wheel-selector.h4
-rw-r--r--src/widgets/sp-xmlview-tree.cpp10
-rw-r--r--src/widgets/spinbutton-events.cpp184
-rw-r--r--src/widgets/stroke-style.cpp9
-rw-r--r--src/widgets/toolbox.cpp60
13 files changed, 545 insertions, 765 deletions
diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp
index 87deffc71..7c72f8e0c 100644
--- a/src/widgets/connector-toolbar.cpp
+++ b/src/widgets/connector-toolbar.cpp
@@ -78,13 +78,6 @@ using Inkscape::UI::PrefPusher;
//## Connector ##
//#########################
-static void sp_connector_mode_toggled( GtkToggleAction* act, GObject * /*tbl*/ )
-{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool("/tools/connector/mode",
- gtk_toggle_action_get_active( act ));
-}
-
static void sp_connector_path_set_avoid(void)
{
cc_selection_set_avoid(true);
@@ -303,26 +296,6 @@ static void connector_tb_event_attr_changed(Inkscape::XML::Node *repr,
}
}
-static void sp_connector_new_connection_point(GtkWidget *, GObject *tbl)
-{
- SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- SPConnectorContext* cc = SP_CONNECTOR_CONTEXT(desktop->event_context);
-
- if (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE) {
- cc_create_connection_point(cc);
- }
-}
-
-static void sp_connector_remove_connection_point(GtkWidget *, GObject *tbl)
-{
- SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" ));
- SPConnectorContext* cc = SP_CONNECTOR_CONTEXT(desktop->event_context);
-
- if (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE) {
- cc_remove_connection_point(cc);
- }
-}
-
static Inkscape::XML::NodeEventVector connector_tb_repr_events = {
NULL, /* child_added */
NULL, /* child_removed */
@@ -351,22 +324,6 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions,
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
- // Editing mode toggle button
- {
- InkToggleAction* act = ink_toggle_action_new( "ConnectorEditModeAction",
- _("EditMode"),
- _("Switch between connection point editing and connector drawing mode"),
- INKSCAPE_ICON("connector-edit"),
- Inkscape::ICON_SIZE_DECORATION );
- gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
-
- bool tbuttonstate = prefs->getBool("/tools/connector/mode");
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act), ( tbuttonstate ? TRUE : FALSE ));
- g_object_set_data( holder, "mode", act );
- g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_connector_mode_toggled), holder );
- }
-
-
{
InkAction* inky = ink_action_new( "ConnectorAvoidAction",
_("Avoid"),
@@ -480,30 +437,6 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions,
}
- // New connection point button
- {
- InkAction* inky = ink_action_new( "ConnectorNewConnPointAction",
- _("New connection point"),
- _("Add a new connection point to the currently selected item"),
- INKSCAPE_ICON("connector-new-connpoint"),
- secondarySize );
- g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_new_connection_point), holder );
- gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
- }
-
- // Remove selected connection point button
-
- {
- InkAction* inky = ink_action_new( "ConnectorRemoveConnPointAction",
- _("Remove connection point"),
- _("Remove the currently selected connection point"),
- INKSCAPE_ICON("connector-remove-connpoint"),
- secondarySize );
- g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_remove_connection_point), holder );
- gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
- }
-
-
// Code to watch for changes to the connector-spacing attribute in
// the XML.
Inkscape::XML::Node *repr = desktop->namedview->getRepr();
diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp
index 535a5d101..988aa2453 100644
--- a/src/widgets/eek-preview.cpp
+++ b/src/widgets/eek-preview.cpp
@@ -46,68 +46,79 @@ using std::min;
#define PRIME_BUTTON_MAGIC_NUMBER 1
-#define FOCUS_PROP_ID 1
-
-/* Keep in sycn with last value in eek-preview.h */
+/* Keep in sync with last value in eek-preview.h */
#define PREVIEW_SIZE_LAST PREVIEW_SIZE_HUGE
#define PREVIEW_SIZE_NEXTFREE (PREVIEW_SIZE_HUGE + 1)
#define PREVIEW_MAX_RATIO 500
-static void eek_preview_class_init( EekPreviewClass *klass );
-static void eek_preview_init( EekPreview *preview );
+enum {
+ PROP_0,
+ PROP_FOCUS
+};
+
+typedef struct
+{
+ int scaledW;
+ int scaledH;
+
+ int r;
+ int g;
+ int b;
+
+ gboolean hot;
+ gboolean within;
+ gboolean takesFocus;
+ ViewType view;
+ PreviewSize size;
+ guint ratio;
+ guint linked;
+ guint border;
+ GdkPixbuf *previewPixbuf;
+ GdkPixbuf *scaled;
+} EekPreviewPrivate;
+
+#define EEK_PREVIEW_GET_PRIVATE(preview) \
+ G_TYPE_INSTANCE_GET_PRIVATE(preview, EEK_PREVIEW_TYPE, EekPreviewPrivate)
+
+static void eek_preview_class_init( EekPreviewClass *klass );
+static void eek_preview_init( EekPreview *preview );
static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr);
+G_DEFINE_TYPE(EekPreview, eek_preview, GTK_TYPE_DRAWING_AREA);
+
static GtkWidgetClass* parent_class = 0;
void eek_preview_set_color( EekPreview* preview, int r, int g, int b )
{
- preview->_r = r;
- preview->_g = g;
- preview->_b = b;
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ priv->r = r;
+ priv->g = g;
+ priv->b = b;
gtk_widget_queue_draw(GTK_WIDGET(preview));
}
-void eek_preview_set_pixbuf( EekPreview* preview, GdkPixbuf* pixbuf )
+void
+eek_preview_set_pixbuf(EekPreview *preview,
+ GdkPixbuf *pixbuf)
{
- preview->_previewPixbuf = pixbuf;
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
- gtk_widget_queue_draw(GTK_WIDGET(preview));
-
- if (preview->_scaled) {
- g_object_unref(preview->_scaled);
- preview->_scaled = 0;
- }
- preview->_scaledW = gdk_pixbuf_get_width(preview->_previewPixbuf);
- preview->_scaledH = gdk_pixbuf_get_height(preview->_previewPixbuf);
-}
+ priv->previewPixbuf = pixbuf;
+ gtk_widget_queue_draw(GTK_WIDGET(preview));
-GType eek_preview_get_type(void)
-{
- static GType preview_type = 0;
-
- if (!preview_type) {
- static const GTypeInfo preview_info = {
- sizeof( EekPreviewClass ),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)eek_preview_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof( EekPreview ),
- 0, /* n_preallocs */
- (GInstanceInitFunc)eek_preview_init,
- NULL /* value_table */
- };
-
-
- preview_type = g_type_register_static( GTK_TYPE_DRAWING_AREA, "EekPreview", &preview_info, (GTypeFlags)0 );
+ if (priv->scaled)
+ {
+ g_object_unref(priv->scaled);
+ priv->scaled = NULL;
}
- return preview_type;
+ priv->scaledW = gdk_pixbuf_get_width(priv->previewPixbuf);
+ priv->scaledH = gdk_pixbuf_get_height(priv->previewPixbuf);
}
static gboolean setupDone = FALSE;
@@ -149,9 +160,10 @@ void eek_preview_set_size_mappings( guint count, GtkIconSize const* sizes )
static void eek_preview_size_request( GtkWidget* widget, GtkRequisition* req )
{
- gint width = 0;
- gint height = 0;
- EekPreview* preview = EEK_PREVIEW(widget);
+ gint width = 0;
+ gint height = 0;
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
if ( !setupDone ) {
GtkIconSize sizes[] = {
@@ -164,15 +176,15 @@ static void eek_preview_size_request( GtkWidget* widget, GtkRequisition* req )
eek_preview_set_size_mappings( G_N_ELEMENTS(sizes), sizes );
}
- width = sizeThings[preview->_size].width;
- height = sizeThings[preview->_size].height;
+ width = sizeThings[priv->size].width;
+ height = sizeThings[priv->size].height;
- if ( preview->_view == VIEW_TYPE_LIST ) {
+ if ( priv->view == VIEW_TYPE_LIST ) {
width *= 3;
}
- if ( preview->_ratio != 100 ) {
- width = (width * preview->_ratio) / 100;
+ if ( priv->ratio != 100 ) {
+ width = (width * priv->ratio) / 100;
if ( width < 0 ) {
width = 1;
}
@@ -223,49 +235,54 @@ static gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* /*
}
#endif
-static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr)
+static
+gboolean eek_preview_draw(GtkWidget *widget,
+ cairo_t *cr)
{
- GtkStyle* style = gtk_widget_get_style(widget);
+ GtkStyle *style = gtk_widget_get_style(widget);
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
- EekPreview* preview = EEK_PREVIEW(widget);
GdkColor fg = { 0,
- static_cast<guint16>(preview->_r),
- static_cast<guint16>(preview->_g),
- static_cast<guint16>(preview->_b)};
+ static_cast<guint16>(priv->r),
+ static_cast<guint16>(priv->g),
+ static_cast<guint16>(priv->b)
+ };
gint insetTop = 0, insetBottom = 0;
gint insetLeft = 0, insetRight = 0;
- if (preview->_border == BORDER_SOLID) {
+ if (priv->border == BORDER_SOLID) {
insetTop = 1;
insetLeft = 1;
}
- if (preview->_border == BORDER_SOLID_LAST_ROW) {
+ if (priv->border == BORDER_SOLID_LAST_ROW) {
insetTop = insetBottom = 1;
insetLeft = 1;
}
- if (preview->_border == BORDER_WIDE) {
+ if (priv->border == BORDER_WIDE) {
insetTop = insetBottom = 1;
insetLeft = insetRight = 1;
}
#if GTK_CHECK_VERSION(3,0,0)
- GtkStyleContext *context = gtk_widget_get_style_context(widget);
+ GtkStyleContext *context = gtk_widget_get_style_context(widget);
- gtk_render_frame(context,
- cr,
- 0, 0,
- allocation.width, allocation.height);
+ gtk_render_frame(context,
+ cr,
+ 0, 0,
+ allocation.width, allocation.height);
- gtk_render_background(context,
- cr,
- 0, 0,
- allocation.width, allocation.height);
+ gtk_render_background(context,
+ cr,
+ 0, 0,
+ allocation.width, allocation.height);
#else
- GdkWindow* window = gtk_widget_get_window(widget);
+ GdkWindow* window = gtk_widget_get_window(widget);
gtk_paint_flat_box( style,
window,
@@ -277,227 +294,247 @@ static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr)
0, 0,
allocation.width, allocation.height);
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE );
+ gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE );
#endif
- // Border
- if (preview->_border != BORDER_NONE) {
+ // Border
+ if (priv->border != BORDER_NONE) {
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
cairo_fill(cr);
- }
+ }
- cairo_set_source_rgb(cr, preview->_r/65535.0, preview->_g/65535.0, preview->_b/65535.0 );
+ cairo_set_source_rgb(cr, priv->r/65535.0, priv->g/65535.0, priv->b/65535.0 );
cairo_rectangle(cr, insetLeft, insetTop, allocation.width - (insetLeft + insetRight), allocation.height - (insetTop + insetBottom));
cairo_fill(cr);
- if ( preview->_previewPixbuf ) {
+ if (priv->previewPixbuf )
+ {
GtkDrawingArea *da = &(preview->drawing);
- GdkWindow *da_window = gtk_widget_get_window(GTK_WIDGET(da));
- cairo_t *cr = gdk_cairo_create(da_window);
+ GdkWindow *da_window = gtk_widget_get_window(GTK_WIDGET(da));
+ cairo_t *cr = gdk_cairo_create(da_window);
- gint w = gdk_window_get_width(da_window);
- gint h = gdk_window_get_height(da_window);
+ gint w = gdk_window_get_width(da_window);
+ gint h = gdk_window_get_height(da_window);
- if ((w != preview->_scaledW) || (h != preview->_scaledH)) {
- if (preview->_scaled) {
- g_object_unref(preview->_scaled);
+ if ((w != priv->scaledW) || (h != priv->scaledH)) {
+ if (priv->scaled)
+ {
+ g_object_unref(priv->scaled);
}
- preview->_scaled = gdk_pixbuf_scale_simple(preview->_previewPixbuf, w - (insetLeft + insetRight), h - (insetTop + insetBottom), GDK_INTERP_BILINEAR);
- preview->_scaledW = w - (insetLeft + insetRight);
- preview->_scaledH = h - (insetTop + insetBottom);
+
+ priv->scaled = gdk_pixbuf_scale_simple(priv->previewPixbuf,
+ w - (insetLeft + insetRight),
+ h - (insetTop + insetBottom),
+ GDK_INTERP_BILINEAR);
+
+ priv->scaledW = w - (insetLeft + insetRight);
+ priv->scaledH = h - (insetTop + insetBottom);
}
- GdkPixbuf *pix = (preview->_scaled) ? preview->_scaled : preview->_previewPixbuf;
+ GdkPixbuf *pix = (priv->scaled) ? priv->scaled : priv->previewPixbuf;
// Border
- if (preview->_border != BORDER_NONE) {
+ if (priv->border != BORDER_NONE) {
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
cairo_fill(cr);
}
- gdk_cairo_set_source_pixbuf(cr, pix, insetLeft, insetTop);
- cairo_paint(cr);
- cairo_destroy(cr);
+ gdk_cairo_set_source_pixbuf(cr, pix, insetLeft, insetTop);
+ cairo_paint(cr);
+ cairo_destroy(cr);
}
- if ( preview->_linked ) {
- /* Draw arrow */
- GdkRectangle possible = {insetLeft, insetTop, (allocation.width - (insetLeft + insetRight)), (allocation.height - (insetTop + insetBottom)) };
- GdkRectangle area = {possible.x, possible.y, possible.width / 2, possible.height / 2 };
-
- /* Make it square */
- if ( area.width > area.height )
- area.width = area.height;
- if ( area.height > area.width )
- area.height = area.width;
-
- /* Center it horizontally */
- if ( area.width < possible.width ) {
- int diff = (possible.width - area.width) / 2;
- area.x += diff;
- }
-
+ if (priv->linked)
+ {
+ /* Draw arrow */
+ GdkRectangle possible = {insetLeft,
+ insetTop,
+ (allocation.width - (insetLeft + insetRight)),
+ (allocation.height - (insetTop + insetBottom))
+ };
+
+ GdkRectangle area = {possible.x,
+ possible.y,
+ possible.width / 2,
+ possible.height / 2 };
+
+ /* Make it square */
+ if ( area.width > area.height )
+ area.width = area.height;
+ if ( area.height > area.width )
+ area.height = area.width;
+
+ /* Center it horizontally */
+ if ( area.width < possible.width ) {
+ int diff = (possible.width - area.width) / 2;
+ area.x += diff;
+ }
- if ( preview->_linked & PREVIEW_LINK_IN ) {
+ if (priv->linked & PREVIEW_LINK_IN)
+ {
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_arrow(context,
- cr,
- G_PI, // Down-pointing arrow
- area.x, area.y,
- min(area.width, area.height)
- );
+ gtk_render_arrow(context,
+ cr,
+ G_PI, // Down-pointing arrow
+ area.x, area.y,
+ min(area.width, area.height)
+ );
#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_IN,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_DOWN,
- FALSE,
- area.x, area.y,
- area.width, area.height
- );
+ gtk_paint_arrow( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_IN,
+ NULL, /* clip area. &area, */
+ widget, /* may be NULL */
+ NULL, /* detail */
+ GTK_ARROW_DOWN,
+ FALSE,
+ area.x, area.y,
+ area.width, area.height
+ );
#endif
- }
+ }
- if ( preview->_linked & PREVIEW_LINK_OUT ) {
- GdkRectangle otherArea = {area.x, area.y, area.width, area.height};
- if ( otherArea.height < possible.height ) {
- otherArea.y = possible.y + (possible.height - otherArea.height);
- }
+ if (priv->linked & PREVIEW_LINK_OUT)
+ {
+ GdkRectangle otherArea = {area.x, area.y, area.width, area.height};
+ if ( otherArea.height < possible.height ) {
+ otherArea.y = possible.y + (possible.height - otherArea.height);
+ }
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_arrow(context,
- cr,
- G_PI, // Down-pointing arrow
- otherArea.x, otherArea.y,
- min(otherArea.width, otherArea.height)
- );
+ gtk_render_arrow(context,
+ cr,
+ G_PI, // Down-pointing arrow
+ otherArea.x, otherArea.y,
+ min(otherArea.width, otherArea.height)
+ );
#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_DOWN,
- FALSE,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height
- );
+ gtk_paint_arrow( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ NULL, /* clip area. &area, */
+ widget, /* may be NULL */
+ NULL, /* detail */
+ GTK_ARROW_DOWN,
+ FALSE,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height
+ );
#endif
- }
+ }
- if ( preview->_linked & PREVIEW_LINK_OTHER ) {
- GdkRectangle otherArea = {insetLeft, area.y, area.width, area.height};
- if ( otherArea.height < possible.height ) {
- otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
- }
+ if (priv->linked & PREVIEW_LINK_OTHER)
+ {
+ GdkRectangle otherArea = {insetLeft, area.y, area.width, area.height};
+ if ( otherArea.height < possible.height ) {
+ otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
+ }
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_arrow(context,
- cr,
- 1.5*G_PI, // Left-pointing arrow
- otherArea.x, otherArea.y,
- min(otherArea.width, otherArea.height)
- );
+ gtk_render_arrow(context,
+ cr,
+ 1.5*G_PI, // Left-pointing arrow
+ otherArea.x, otherArea.y,
+ min(otherArea.width, otherArea.height)
+ );
#else
- gtk_paint_arrow( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL, /* clip area. &area, */
- widget, /* may be NULL */
- NULL, /* detail */
- GTK_ARROW_LEFT,
- FALSE,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height
- );
+ gtk_paint_arrow( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ NULL, /* clip area. &area, */
+ widget, /* may be NULL */
+ NULL, /* detail */
+ GTK_ARROW_LEFT,
+ FALSE,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height
+ );
#endif
- }
+ }
- if ( preview->_linked & PREVIEW_FILL ) {
- GdkRectangle otherArea = {possible.x + ((possible.width / 4) - (area.width / 2)),
- area.y,
- area.width, area.height};
- if ( otherArea.height < possible.height ) {
- otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
- }
+ if (priv->linked & PREVIEW_FILL)
+ {
+ GdkRectangle otherArea = {possible.x + ((possible.width / 4) - (area.width / 2)),
+ area.y,
+ area.width, area.height};
+ if ( otherArea.height < possible.height ) {
+ otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
+ }
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_check(context,
- cr,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ gtk_render_check(context,
+ cr,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#else
- gtk_paint_check( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ gtk_paint_check( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ NULL,
+ widget,
+ NULL,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#endif
- }
+ }
- if ( preview->_linked & PREVIEW_STROKE ) {
- GdkRectangle otherArea = {possible.x + (((possible.width * 3) / 4) - (area.width / 2)),
- area.y,
- area.width, area.height};
- if ( otherArea.height < possible.height ) {
- otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
- }
+ if (priv->linked & PREVIEW_STROKE)
+ {
+ GdkRectangle otherArea = {possible.x + (((possible.width * 3) / 4) - (area.width / 2)),
+ area.y,
+ area.width, area.height};
+ if ( otherArea.height < possible.height ) {
+ otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
+ }
#if GTK_CHECK_VERSION(3,0,0)
- gtk_paint_diamond( style,
- cr,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ gtk_paint_diamond( style,
+ cr,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ widget,
+ NULL,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#else
- gtk_paint_diamond( style,
- window,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- NULL,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ gtk_paint_diamond( style,
+ window,
+ gtk_widget_get_state (widget),
+ GTK_SHADOW_ETCHED_OUT,
+ NULL,
+ widget,
+ NULL,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#endif
- }
}
+ }
- if ( gtk_widget_has_focus(widget) ) {
- gtk_widget_get_allocation (widget, &allocation);
+ if ( gtk_widget_has_focus(widget) ) {
+ gtk_widget_get_allocation (widget, &allocation);
#if GTK_CHECK_VERSION(3,0,0)
- gtk_render_focus(context,
- cr,
- 0 + 1, 0 + 1,
- allocation.width - 2, allocation.height - 2 );
+ gtk_render_focus(context,
+ cr,
+ 0 + 1, 0 + 1,
+ allocation.width - 2, allocation.height - 2 );
#else
- gtk_paint_focus( style,
- window,
- GTK_STATE_NORMAL,
- NULL, /* GdkRectangle *area, */
- widget,
- NULL,
- 0 + 1, 0 + 1,
- allocation.width - 2, allocation.height - 2 );
+ gtk_paint_focus( style,
+ window,
+ GTK_STATE_NORMAL,
+ NULL, /* GdkRectangle *area, */
+ widget,
+ NULL,
+ 0 + 1, 0 + 1,
+ allocation.width - 2, allocation.height - 2 );
#endif
- }
+ }
return FALSE;
}
@@ -506,52 +543,48 @@ static gboolean eek_preview_draw(GtkWidget* widget, cairo_t* cr)
static gboolean eek_preview_enter_cb( GtkWidget* widget, GdkEventCrossing* event )
{
if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) {
- EekPreview* preview = EEK_PREVIEW(widget);
- preview->_within = TRUE;
- gtk_widget_set_state( widget, preview->_hot ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT );
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ priv->within = TRUE;
+ gtk_widget_set_state( widget, priv->hot ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT );
}
+
return FALSE;
}
static gboolean eek_preview_leave_cb( GtkWidget* widget, GdkEventCrossing* event )
{
if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) {
- EekPreview* preview = EEK_PREVIEW(widget);
- preview->_within = FALSE;
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ priv->within = FALSE;
gtk_widget_set_state( widget, GTK_STATE_NORMAL );
}
- return FALSE;
-}
-/*
-static gboolean eek_preview_focus_in_event( GtkWidget* widget, GdkEventFocus* event )
-{
- g_message("focus IN");
- gboolean blip = parent_class->focus_in_event ? parent_class->focus_in_event(widget, event) : FALSE;
- return blip;
-}
-
-static gboolean eek_preview_focus_out_event( GtkWidget* widget, GdkEventFocus* event )
-{
- g_message("focus OUT");
- gboolean blip = parent_class->focus_out_event ? parent_class->focus_out_event(widget, event) : FALSE;
- return blip;
+ return FALSE;
}
-*/
static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton* event )
{
- if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) {
- EekPreview* preview = EEK_PREVIEW(widget);
+ if ( gtk_get_event_widget( (GdkEvent*)event ) == widget )
+ {
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
- if ( preview->_takesFocus && !gtk_widget_has_focus(widget) ) {
+ if ( priv->takesFocus && !gtk_widget_has_focus(widget) )
+ {
gtk_widget_grab_focus(widget);
}
if ( event->button == PRIME_BUTTON_MAGIC_NUMBER ||
- event->button == 2 ) {
- preview->_hot = TRUE;
- if ( preview->_within ) {
+ event->button == 2 )
+ {
+ priv->hot = TRUE;
+
+ if ( priv->within )
+ {
gtk_widget_set_state( widget, GTK_STATE_ACTIVE );
}
}
@@ -563,91 +596,76 @@ static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton*
static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton* event )
{
if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) {
- EekPreview* preview = EEK_PREVIEW(widget);
- preview->_hot = FALSE;
+ EekPreview *preview = EEK_PREVIEW(widget);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ priv->hot = FALSE;
gtk_widget_set_state( widget, GTK_STATE_NORMAL );
- if ( preview->_within &&
- (event->button == PRIME_BUTTON_MAGIC_NUMBER || event->button == 2)) {
+
+ if ( priv->within &&
+ (event->button == PRIME_BUTTON_MAGIC_NUMBER ||
+ event->button == 2))
+ {
gboolean isAlt = ( ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) ||
(event->button == 2));
- if ( isAlt ) {
+ if ( isAlt )
+ {
g_signal_emit( widget, eek_preview_signals[ALTCLICKED_SIGNAL], 0, 2 );
- } else {
+ }
+ else
+ {
g_signal_emit( widget, eek_preview_signals[CLICKED_SIGNAL], 0 );
}
}
}
- return FALSE;
-}
-static gboolean eek_preview_key_press_event( GtkWidget* widget, GdkEventKey* event)
-{
- (void)widget;
- (void)event;
- g_message("TICK");
return FALSE;
}
-static gboolean eek_preview_key_release_event( GtkWidget* widget, GdkEventKey* event)
-{
- (void)widget;
- (void)event;
- g_message("tock");
- return FALSE;
-}
-
-static void eek_preview_get_property( GObject *object,
- guint property_id,
- GValue *value,
+static void eek_preview_get_property( GObject *object,
+ guint prop_id,
+ GValue *value,
GParamSpec *pspec)
{
- GObjectClass* gobjClass = G_OBJECT_CLASS(parent_class);
- switch ( property_id ) {
- case FOCUS_PROP_ID:
- {
- EekPreview* preview = EEK_PREVIEW( object );
- g_value_set_boolean( value, preview->_takesFocus );
- }
- break;
+ EekPreview *preview = EEK_PREVIEW( object );
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ switch (prop_id)
+ {
+ case PROP_FOCUS:
+ g_value_set_boolean( value, priv->takesFocus );
+ break;
+
default:
- {
- if ( gobjClass->get_property ) {
- gobjClass->get_property( object, property_id, value, pspec );
- }
- }
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
}
}
-static void eek_preview_set_property( GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+static void
+eek_preview_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GObjectClass* gobjClass = G_OBJECT_CLASS(parent_class);
- switch ( property_id ) {
- case FOCUS_PROP_ID:
- {
- EekPreview* preview = EEK_PREVIEW( object );
- gboolean val = g_value_get_boolean( value );
- if ( val != preview->_takesFocus ) {
- preview->_takesFocus = val;
- }
- }
- break;
+ EekPreview *preview = EEK_PREVIEW( object );
+
+ switch (prop_id)
+ {
+ case PROP_FOCUS:
+ eek_preview_set_focus_on_click(preview, g_value_get_boolean(value));
+ break;
+
default:
- {
- if ( gobjClass->set_property ) {
- gobjClass->set_property( object, property_id, value, pspec );
- }
- }
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
}
}
static gboolean eek_preview_popup_menu( GtkWidget* widget )
{
-/* g_message("Do the popup!"); */
gboolean blip = parent_class->popup_menu ? parent_class->popup_menu(widget) : FALSE;
return blip;
}
@@ -655,21 +673,14 @@ static gboolean eek_preview_popup_menu( GtkWidget* widget )
static void eek_preview_class_init( EekPreviewClass *klass )
{
- GObjectClass* gobjClass = G_OBJECT_CLASS(klass);
- /*GtkObjectClass* objectClass = (GtkObjectClass*)klass;*/
+ GObjectClass* gobjClass = G_OBJECT_CLASS(klass);
GtkWidgetClass* widgetClass = (GtkWidgetClass*)klass;
gobjClass->set_property = eek_preview_set_property;
gobjClass->get_property = eek_preview_get_property;
- /*objectClass->destroy = eek_preview_destroy;*/
-
parent_class = (GtkWidgetClass*)g_type_class_peek_parent( klass );
- /*widgetClass->map = ;*/
- /*widgetClass->unmap = ;*/
- /*widgetClass->realize = ;*/
- /*widgetClass->unrealize = ;*/
#if GTK_CHECK_VERSION(3,0,0)
widgetClass->get_preferred_width = eek_preview_get_preferred_width;
widgetClass->get_preferred_height = eek_preview_get_preferred_height;
@@ -678,49 +689,16 @@ static void eek_preview_class_init( EekPreviewClass *klass )
widgetClass->size_request = eek_preview_size_request;
widgetClass->expose_event = eek_preview_expose_event;
#endif
- /*widgetClass->size_allocate = ;*/
- /*widgetClass->state_changed = ;*/
- /*widgetClass->style_set = ;*/
- /*widgetClass->grab_notify = ;*/
widgetClass->button_press_event = eek_preview_button_press_cb;
widgetClass->button_release_event = eek_preview_button_release_cb;
- /*widgetClass->delete_event = ;*/
- /*widgetClass->destroy_event = ;*/
-/* widgetClass->key_press_event = eek_preview_key_press_event; */
-/* widgetClass->key_release_event = eek_preview_key_release_event; */
widgetClass->enter_notify_event = eek_preview_enter_cb;
widgetClass->leave_notify_event = eek_preview_leave_cb;
- /*widgetClass->configure_event = ;*/
- /*widgetClass->focus_in_event = eek_preview_focus_in_event;*/
- /*widgetClass->focus_out_event = eek_preview_focus_out_event;*/
-
- /* selection */
- /*widgetClass->selection_get = ;*/
- /*widgetClass->selection_received = ;*/
-
-
- /* drag source: */
- /*widgetClass->drag_begin = ;*/
- /*widgetClass->drag_end = ;*/
- /*widgetClass->drag_data_get = ;*/
- /*widgetClass->drag_data_delete = ;*/
-
- /* drag target: */
- /*widgetClass->drag_leave = ;*/
- /*widgetClass->drag_motion = ;*/
- /*widgetClass->drag_drop = ;*/
- /*widgetClass->drag_data_received = ;*/
/* For keybindings: */
widgetClass->popup_menu = eek_preview_popup_menu;
- /*widgetClass->show_help = ;*/
-
- /* Accessibility support: */
- /*widgetClass->get_accessible = ;*/
- /*widgetClass->screen_changed = ;*/
- /*widgetClass->can_activate_accel = ;*/
+ g_type_class_add_private(gobjClass, sizeof(EekPreviewPrivate));
eek_preview_signals[CLICKED_SIGNAL] =
g_signal_new( "clicked",
@@ -741,7 +719,7 @@ static void eek_preview_class_init( EekPreviewClass *klass )
g_object_class_install_property( gobjClass,
- FOCUS_PROP_ID,
+ PROP_FOCUS,
g_param_spec_boolean(
"focus-on-click",
NULL,
@@ -749,57 +727,94 @@ static void eek_preview_class_init( EekPreviewClass *klass )
TRUE,
(GParamFlags)(G_PARAM_READWRITE | G_PARAM_CONSTRUCT)
)
- );
+ );
}
-void eek_preview_set_linked( EekPreview* splat, LinkType link )
+void
+eek_preview_set_linked(EekPreview *preview,
+ LinkType link)
{
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ g_return_if_fail(IS_EEK_PREVIEW(preview));
+
link = (LinkType)(link & PREVIEW_LINK_ALL);
- if ( link != (LinkType)splat->_linked ) {
- splat->_linked = link;
- gtk_widget_queue_draw( GTK_WIDGET(splat) );
+ if (link != (LinkType)priv->linked)
+ {
+ priv->linked = link;
+
+ gtk_widget_queue_draw(GTK_WIDGET(preview));
}
}
-LinkType eek_preview_get_linked( EekPreview* splat )
+LinkType
+eek_preview_get_linked(EekPreview *preview)
{
- return (LinkType)splat->_linked;
+ g_return_val_if_fail(IS_EEK_PREVIEW(preview), PREVIEW_LINK_NONE);
+
+ return (LinkType)EEK_PREVIEW_GET_PRIVATE(preview)->linked;
}
-gboolean eek_preview_get_focus_on_click( EekPreview* preview )
+gboolean
+eek_preview_get_focus_on_click(EekPreview* preview)
{
- return preview->_takesFocus;
+ g_return_val_if_fail(IS_EEK_PREVIEW(preview), FALSE);
+
+ return EEK_PREVIEW_GET_PRIVATE(preview)->takesFocus;
}
-void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_click )
+void
+eek_preview_set_focus_on_click(EekPreview *preview,
+ gboolean focus_on_click)
{
- if ( focus_on_click != preview->_takesFocus ) {
- preview->_takesFocus = focus_on_click;
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ g_return_if_fail(IS_EEK_PREVIEW(preview));
+
+ if (focus_on_click != priv->takesFocus)
+ {
+ priv->takesFocus = focus_on_click;
}
}
-void eek_preview_set_details( EekPreview* preview, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio, guint border )
+void
+eek_preview_set_details(EekPreview *preview,
+ ViewType view,
+ PreviewSize size,
+ guint ratio,
+ guint border)
{
- preview->_prevstyle = prevstyle;
- preview->_view = view;
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
+ g_return_if_fail(IS_EEK_PREVIEW(preview));
+
+ priv->view = view;
- if ( size > PREVIEW_SIZE_LAST ) {
+ if ( size > PREVIEW_SIZE_LAST )
+ {
size = PREVIEW_SIZE_LAST;
}
- preview->_size = size;
- if ( ratio > PREVIEW_MAX_RATIO ) {
+ priv->size = size;
+
+ if ( ratio > PREVIEW_MAX_RATIO )
+ {
ratio = PREVIEW_MAX_RATIO;
}
- preview->_ratio = ratio;
- preview->_border = border;
+
+ priv->ratio = ratio;
+ priv->border = border;
+
gtk_widget_queue_draw(GTK_WIDGET(preview));
}
-static void eek_preview_init( EekPreview *preview )
+static void
+eek_preview_init(EekPreview *preview)
{
- GtkWidget* widg = GTK_WIDGET(preview);
+ GtkWidget *widg = GTK_WIDGET(preview);
+ EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
+
gtk_widget_set_can_focus( widg, TRUE );
gtk_widget_set_receives_default( widg, TRUE );
@@ -813,69 +828,22 @@ static void eek_preview_init( EekPreview *preview )
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK );
-/* gtk_widget_add_events( widg, GDK_ALL_EVENTS_MASK );*/
-
- preview->_r = 0x80;
- preview->_g = 0x80;
- preview->_b = 0xcc;
- preview->_scaledW = 0;
- preview->_scaledH = 0;
-
- preview->_hot = FALSE;
- preview->_within = FALSE;
- preview->_takesFocus = FALSE;
-
- preview->_prevstyle = PREVIEW_STYLE_ICON;
- preview->_view = VIEW_TYPE_LIST;
- preview->_size = PREVIEW_SIZE_SMALL;
- preview->_ratio = 100;
- preview->_border = BORDER_NONE;
- preview->_previewPixbuf = 0;
- preview->_scaled = 0;
-
-/*
- GdkColor color = {0};
- color.red = (255 << 8) | 255;
-
- GdkColor whack = {0};
- whack.green = (255 << 8) | 255;
-
- gtk_widget_modify_bg( widg, GTK_STATE_NORMAL, &color );
- gtk_widget_modify_bg( widg, GTK_STATE_PRELIGHT, &whack );
-*/
-
-/* GTK_STATE_ACTIVE, */
-/* GTK_STATE_PRELIGHT, */
-/* GTK_STATE_SELECTED, */
-/* GTK_STATE_INSENSITIVE */
-
- if ( 0 ) {
- GdkColor color = {0,0,0,0};
-
- color.red = 0xffff;
- color.green = 0;
- color.blue = 0xffff;
-#if !GTK_CHECK_VERSION(3,0,0)
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &color, FALSE, TRUE );
-#endif
- gtk_widget_modify_bg(widg, GTK_STATE_ACTIVE, &color);
-
- color.red = 0;
- color.green = 0xffff;
- color.blue = 0;
-#if !GTK_CHECK_VERSION(3,0,0)
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &color, FALSE, TRUE );
-#endif
- gtk_widget_modify_bg(widg, GTK_STATE_SELECTED, &color);
-
- color.red = 0xffff;
- color.green = 0;
- color.blue = 0;
-#if !GTK_CHECK_VERSION(3,0,0)
- gdk_colormap_alloc_color( gdk_colormap_get_system(), &color, FALSE, TRUE );
-#endif
- gtk_widget_modify_bg( widg, GTK_STATE_PRELIGHT, &color );
- }
+ priv->r = 0x80;
+ priv->g = 0x80;
+ priv->b = 0xcc;
+ priv->scaledW = 0;
+ priv->scaledH = 0;
+
+ priv->hot = FALSE;
+ priv->within = FALSE;
+ priv->takesFocus = FALSE;
+
+ priv->view = VIEW_TYPE_LIST;
+ priv->size = PREVIEW_SIZE_SMALL;
+ priv->ratio = 100;
+ priv->border = BORDER_NONE;
+ priv->previewPixbuf = 0;
+ priv->scaled = 0;
}
diff --git a/src/widgets/eek-preview.h b/src/widgets/eek-preview.h
index 42e89a161..e4c724cc5 100644
--- a/src/widgets/eek-preview.h
+++ b/src/widgets/eek-preview.h
@@ -42,12 +42,11 @@
/**
* @file
- * Generic implementation of a object that can be shown by a preview.
+ * Generic implementation of an object that can be shown by a preview.
*/
G_BEGIN_DECLS
-
#define EEK_PREVIEW_TYPE (eek_preview_get_type())
#define EEK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST( (obj), EEK_PREVIEW_TYPE, EekPreview))
#define EEK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( (klass), EEK_PREVIEW_TYPE, EekPreviewClass))
@@ -90,7 +89,6 @@ typedef enum {
PREVIEW_LINK_ALL = 31
} LinkType;
-
typedef enum {
BORDER_NONE = 0,
BORDER_SOLID,
@@ -101,29 +99,9 @@ typedef enum {
typedef struct _EekPreview EekPreview;
typedef struct _EekPreviewClass EekPreviewClass;
-
struct _EekPreview
{
GtkDrawingArea drawing;
-
- int _r;
- int _g;
- int _b;
- int _scaledW;
- int _scaledH;
-
- gboolean _hot;
- gboolean _within;
- gboolean _takesFocus;
-
- PreviewStyle _prevstyle;
- ViewType _view;
- PreviewSize _size;
- guint _ratio;
- guint _linked;
- guint _border;
- GdkPixbuf* _previewPixbuf;
- GdkPixbuf* _scaled;
};
struct _EekPreviewClass
@@ -133,11 +111,14 @@ struct _EekPreviewClass
void (*clicked) (EekPreview* splat);
};
-
GType eek_preview_get_type(void) G_GNUC_CONST;
GtkWidget* eek_preview_new(void);
-void eek_preview_set_details( EekPreview* splat, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio, guint);
+void eek_preview_set_details(EekPreview *preview,
+ ViewType view,
+ PreviewSize size,
+ guint ratio,
+ guint border);
void eek_preview_set_color( EekPreview* splat, int r, int g, int b );
void eek_preview_set_pixbuf( EekPreview* splat, GdkPixbuf* pixbuf );
diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp
index 32619de1f..d4186cd93 100644
--- a/src/widgets/fill-style.cpp
+++ b/src/widgets/fill-style.cpp
@@ -220,7 +220,7 @@ void FillNStroke::setDesktop(SPDesktop *desktop)
* Listen to this "change in tool" event, in case a subselection tool (such as Gradient or Node) selection
* is changed back to a selection tool - especially needed for selected gradient stops.
*/
-void FillNStroke::eventContextCB(SPDesktop *desktop, SPEventContext *eventcontext)
+void FillNStroke::eventContextCB(SPDesktop * /*desktop*/, SPEventContext * /*eventcontext*/)
{
performUpdate();
}
diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp
index 2c6774fe9..972155ea9 100644
--- a/src/widgets/gradient-selector.cpp
+++ b/src/widgets/gradient-selector.cpp
@@ -487,8 +487,7 @@ SPGradient *SPGradientSelector::getVector()
}
-static void
-sp_gradient_selector_vector_set (SPGradientVectorSelector *gvs, SPGradient *gr, SPGradientSelector *sel)
+static void sp_gradient_selector_vector_set(SPGradientVectorSelector * /*gvs*/, SPGradient *gr, SPGradientSelector *sel)
{
if (!sel->blocked) {
@@ -497,7 +496,6 @@ sp_gradient_selector_vector_set (SPGradientVectorSelector *gvs, SPGradient *gr,
sel->setVector((gr) ? gr->document : 0, gr);
g_signal_emit (G_OBJECT (sel), signals[CHANGED], 0, gr);
sel->blocked = FALSE;
-
}
}
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index ff443504d..7866989b1 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -309,7 +309,7 @@ gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr)
}
#if !GTK_CHECK_VERSION(3,0,0)
-gboolean IconImpl::expose(GtkWidget *widget, GdkEventExpose *event)
+gboolean IconImpl::expose(GtkWidget *widget, GdkEventExpose * /*event*/)
{
gboolean result = TRUE;
diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp
index fa586ce5f..07cafc391 100644
--- a/src/widgets/sp-color-notebook.cpp
+++ b/src/widgets/sp-color-notebook.cpp
@@ -539,7 +539,7 @@ void ColorNotebook::_colorChanged()
_updateRgbaEntry( _color, _alpha );
}
-void ColorNotebook::_picker_clicked(GtkWidget *widget, SPColorNotebook *colorbook)
+void ColorNotebook::_picker_clicked(GtkWidget * /*widget*/, SPColorNotebook * /*colorbook*/)
{
// Set the dropper into a "one click" mode, so it reverts to the previous tool after a click
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp
index 3e91274d2..7c8bb1df7 100644
--- a/src/widgets/sp-color-wheel-selector.cpp
+++ b/src/widgets/sp-color-wheel-selector.cpp
@@ -9,6 +9,7 @@
#include "sp-color-scales.h"
#include "sp-color-icc-selector.h"
#include "../svg/svg-icc-color.h"
+#include "ui/widget/gimpcolorwheel.h"
G_BEGIN_DECLS
@@ -101,46 +102,6 @@ void sp_color_wheel_selector_init (SPColorWheelSelector *cs)
}
}
-static void resizeHSVWheel( GtkHSV *hsv, GtkAllocation *allocation )
-{
- gint diam = std::min(allocation->width, allocation->height);
-
- // drop a little for resizing
- // This magic number stops the dialog expanding in width when resizing height
- diam -= 16;
-
- GtkStyle *style = gtk_widget_get_style( GTK_WIDGET(hsv) );
- if ( style ) {
- gint thick = std::max(style->xthickness, style->ythickness);
- if (thick > 0) {
- diam -= thick * 2;
- }
- }
- gint padding = -1;
- gtk_widget_style_get( GTK_WIDGET(hsv),
- "focus-padding", &padding,
- NULL );
- if (padding > 0) {
- diam -= padding * 2;
- }
-
- diam = std::max(20, diam);
- gint ring = static_cast<gint>( static_cast<gdouble>(diam) / (4.0 * 1.618) );
- gtk_hsv_set_metrics( hsv, diam, ring );
-}
-
-static void handleWheelStyleSet(GtkHSV *hsv, GtkStyle* /*previous*/, gpointer /*userData*/)
-{
- GtkAllocation allocation = {0, 0, 0, 0};
- gtk_widget_get_allocation( GTK_WIDGET(hsv), &allocation );
- resizeHSVWheel( hsv, &allocation );
-}
-
-static void handleWheelAllocation(GtkHSV *hsv, GtkAllocation *allocation, gpointer /*userData*/)
-{
- resizeHSVWheel( hsv, allocation );
-}
-
void ColorWheelSelector::init()
{
gint row = 0;
@@ -160,8 +121,7 @@ void ColorWheelSelector::init()
/* Create components */
row = 0;
- _wheel = gtk_hsv_new();
- gtk_hsv_set_metrics( GTK_HSV(_wheel), 48, 8 );
+ _wheel = gimp_color_wheel_new();
gtk_widget_show( _wheel );
#if GTK_CHECK_VERSION(3,0,0)
@@ -252,13 +212,6 @@ void ColorWheelSelector::init()
g_signal_connect( G_OBJECT(_wheel), "changed",
G_CALLBACK (_wheelChanged), _csel );
-
-
- // GTK does not automatically scale the color wheel, so we have to add that in:
- g_signal_connect( G_OBJECT (_wheel), "size-allocate",
- G_CALLBACK (handleWheelAllocation), _csel );
- g_signal_connect( G_OBJECT (_wheel), "style-set",
- G_CALLBACK (handleWheelStyleSet), _csel );
}
static void sp_color_wheel_selector_dispose(GObject *object)
@@ -299,11 +252,9 @@ void ColorWheelSelector::_colorChanged()
#endif
_updating = TRUE;
{
- gdouble h = 0;
- gdouble s = 0;
- gdouble v = 0;
- gtk_rgb_to_hsv( _color.v.c[0], _color.v.c[1], _color.v.c[2], &h, &s, &v );
- gtk_hsv_set_color( GTK_HSV(_wheel), h, s, v );
+ float hsv[3] = {0,0,0};
+ sp_color_rgb_to_hsv_floatv(hsv, _color.v.c[0], _color.v.c[1], _color.v.c[2]);
+ gimp_color_wheel_set_color( GIMP_COLOR_WHEEL(_wheel), hsv[0], hsv[1], hsv[2] );
}
guint32 start = _color.toRGBA32( 0x00 );
@@ -374,21 +325,19 @@ void ColorWheelSelector::_sliderChanged( SPColorSlider *slider, SPColorWheelSele
wheelSelector->_updateInternals( wheelSelector->_color, ColorScales::getScaled( wheelSelector->_adj ), wheelSelector->_dragging );
}
-void ColorWheelSelector::_wheelChanged( GtkHSV *hsv, SPColorWheelSelector *cs )
+void ColorWheelSelector::_wheelChanged( GimpColorWheel *wheel, SPColorWheelSelector *cs )
{
ColorWheelSelector* wheelSelector = static_cast<ColorWheelSelector*>(SP_COLOR_SELECTOR(cs)->base);
gdouble h = 0;
gdouble s = 0;
gdouble v = 0;
- gtk_hsv_get_color( hsv, &h, &s, &v );
+ gimp_color_wheel_get_color( wheel, &h, &s, &v );
- gdouble r = 0;
- gdouble g = 0;
- gdouble b = 0;
- gtk_hsv_to_rgb(h, s, v, &r, &g, &b);
+ float rgb[3] = {0,0,0};
+ sp_color_hsv_to_rgb_floatv (rgb, h, s, v);
- SPColor color(r, g, b);
+ SPColor color(rgb[0], rgb[1], rgb[2]);
guint32 start = color.toRGBA32( 0x00 );
guint32 mid = color.toRGBA32( 0x7f );
@@ -397,7 +346,7 @@ void ColorWheelSelector::_wheelChanged( GtkHSV *hsv, SPColorWheelSelector *cs )
sp_color_slider_set_colors (SP_COLOR_SLIDER(wheelSelector->_slider), start, mid, end);
preserve_icc(&color, cs);
- wheelSelector->_updateInternals( color, wheelSelector->_alpha, gtk_hsv_is_adjusting( hsv ) );
+ wheelSelector->_updateInternals( color, wheelSelector->_alpha, gimp_color_wheel_is_adjusting(wheel) );
}
diff --git a/src/widgets/sp-color-wheel-selector.h b/src/widgets/sp-color-wheel-selector.h
index 4d8f79976..8e0dc6cea 100644
--- a/src/widgets/sp-color-wheel-selector.h
+++ b/src/widgets/sp-color-wheel-selector.h
@@ -10,7 +10,7 @@
-typedef struct _GtkHSV GtkHSV;
+typedef struct _GimpColorWheel GimpColorWheel;
struct SPColorWheelSelector;
struct SPColorWheelSelectorClass;
@@ -30,7 +30,7 @@ protected:
static void _sliderGrabbed( SPColorSlider *slider, SPColorWheelSelector *cs );
static void _sliderReleased( SPColorSlider *slider, SPColorWheelSelector *cs );
static void _sliderChanged( SPColorSlider *slider, SPColorWheelSelector *cs );
- static void _wheelChanged( GtkHSV *hsv, SPColorWheelSelector *cs );
+ static void _wheelChanged( GimpColorWheel *wheel, SPColorWheelSelector *cs );
static void _fooChanged( GtkWidget foo, SPColorWheelSelector *cs );
diff --git a/src/widgets/sp-xmlview-tree.cpp b/src/widgets/sp-xmlview-tree.cpp
index bc6031c1e..43b7dc289 100644
--- a/src/widgets/sp-xmlview-tree.cpp
+++ b/src/widgets/sp-xmlview-tree.cpp
@@ -35,7 +35,6 @@ static void sp_xmlview_tree_destroy(GtkObject * object);
#endif
static NodeData * node_data_new (SPXMLViewTree * tree, GtkTreeIter * node, GtkTreeRowReference *rowref, Inkscape::XML::Node * repr);
-static void node_data_free (gpointer data);
static GtkTreeRowReference * add_node (SPXMLViewTree * tree, GtkTreeIter * parent, GtkTreeIter * before, Inkscape::XML::Node * repr);
@@ -261,15 +260,6 @@ NodeData *node_data_new(SPXMLViewTree * tree, GtkTreeIter * /*node*/, GtkTreeRow
return data;
}
-void node_data_free(gpointer ptr)
-{
- NodeData *data = static_cast<NodeData *>(ptr);
- sp_repr_remove_listener_by_data (data->repr, data);
- g_assert (data->repr != NULL);
- Inkscape::GC::release(data->repr);
- g_free (data);
-}
-
void element_child_added (Inkscape::XML::Node * /*repr*/, Inkscape::XML::Node * child, Inkscape::XML::Node * ref, gpointer ptr)
{
NodeData *data = static_cast<NodeData *>(ptr);
diff --git a/src/widgets/spinbutton-events.cpp b/src/widgets/spinbutton-events.cpp
index 96d746468..7a481aea8 100644
--- a/src/widgets/spinbutton-events.cpp
+++ b/src/widgets/spinbutton-events.cpp
@@ -3,7 +3,9 @@
*
* Authors:
* bulia byak <bulia@users.sourceforge.net>
+ * Jon A. Cruz <jon@joncruz.org>
*
+ * Copyright (C) 2013 authors
* Copyright (C) 2003 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
@@ -22,122 +24,136 @@
#include "widget-sizes.h"
#include "spinbutton-events.h"
-gboolean
-spinbutton_focus_in (GtkWidget *w, GdkEventKey * /*event*/, gpointer /*data*/)
+gboolean spinbutton_focus_in(GtkWidget *w, GdkEventKey * /*event*/, gpointer /*data*/)
{
- gdouble *ini = static_cast<gdouble *>(g_object_get_data(G_OBJECT(w), "ini"));
- if (ini) g_free (ini); // free the old value if any
+ gdouble *ini = static_cast<gdouble *>(g_object_get_data(G_OBJECT(w), "ini"));
+ if (ini) {
+ g_free(ini); // free the old value if any
+ }
- // retrieve the value
- ini = g_new (gdouble, 1);
- *ini = gtk_spin_button_get_value (GTK_SPIN_BUTTON(w));
+ // retrieve the value
+ ini = g_new(gdouble, 1);
+ *ini = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- // remember it
- g_object_set_data (G_OBJECT (w), "ini", ini);
+ // remember it
+ g_object_set_data(G_OBJECT(w), "ini", ini);
- return FALSE; // I didn't consume the event
+ return FALSE; // I didn't consume the event
}
-void
-spinbutton_undo (GtkWidget *w)
+void spinbutton_undo(GtkWidget *w)
{
- gdouble *ini = static_cast<gdouble *>(g_object_get_data(G_OBJECT (w), "ini"));
- if (ini) {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), *ini);
- }
+ gdouble *ini = static_cast<gdouble *>(g_object_get_data(G_OBJECT(w), "ini"));
+ if (ini) {
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), *ini);
+ }
}
-void
-spinbutton_defocus (GtkWidget *container)
+void spinbutton_defocus(GtkWidget *container)
{
- // defocus spinbuttons by moving focus to the canvas, unless "stay" is on
- gboolean stay = GPOINTER_TO_INT(g_object_get_data(G_OBJECT (container), "stay"));
- if (stay) {
- g_object_set_data (G_OBJECT (container), "stay", GINT_TO_POINTER (FALSE));
- } else {
- GtkWidget *canvas = GTK_WIDGET(g_object_get_data(G_OBJECT (container), "dtw"));
- if (canvas) {
- gtk_widget_grab_focus (GTK_WIDGET(canvas));
- }
- }
+ // defocus spinbuttons by moving focus to the canvas, unless "stay" is on
+ gboolean stay = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(container), "stay"));
+ if (stay) {
+ g_object_set_data(G_OBJECT(container), "stay", GINT_TO_POINTER(FALSE));
+ } else {
+ GtkWidget *canvas = GTK_WIDGET(g_object_get_data(G_OBJECT(container), "dtw"));
+ if (canvas) {
+ gtk_widget_grab_focus(GTK_WIDGET(canvas));
+ }
+ }
}
-gboolean spinbutton_keypress(GtkWidget *w, GdkEventKey *event, gpointer data)
+gboolean spinbutton_keypress(GtkWidget *w, GdkEventKey *event, gpointer /*data*/)
{
- gdouble v;
- gdouble step;
- gdouble page;
+ gboolean result = FALSE; // I didn't consume the event
- switch (get_group0_keyval (event)) {
+ switch (get_group0_keyval(event)) {
case GDK_KEY_Escape: // defocus
- spinbutton_undo(w);
- spinbutton_defocus(w);
- return TRUE; // I consumed the event
- break;
+ spinbutton_undo(w);
+ spinbutton_defocus(w);
+ result = TRUE; // I consumed the event
+ break;
case GDK_KEY_Return: // defocus
case GDK_KEY_KP_Enter:
- spinbutton_defocus(w);
- return TRUE; // I consumed the event
- break;
+ spinbutton_defocus(w);
+ result = TRUE; // I consumed the event
+ break;
case GDK_KEY_Tab:
case GDK_KEY_ISO_Left_Tab:
- // set the flag meaning "do not leave toolbar when changing value"
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- return FALSE; // I didn't consume the event
- break;
+ // set the flag meaning "do not leave toolbar when changing value"
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ result = FALSE; // I didn't consume the event
+ break;
- // The following keys are processed manually because GTK implements them in strange ways
- // (increments start with double step value and seem to grow as you press the key continuously)
+ // The following keys are processed manually because GTK implements them in strange ways
+ // (increments start with double step value and seem to grow as you press the key continuously)
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
- v += step;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
- return TRUE; // I consumed the event
- break;
+ {
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ gdouble v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
+ gdouble step = 0;
+ gdouble page = 0;
+ gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
+ v += step;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
+ result = TRUE; // I consumed the event
+ break;
+ }
case GDK_KEY_Down:
case GDK_KEY_KP_Down:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
- v -= step;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
- return TRUE; // I consumed the event
- break;
+ {
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ gdouble v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
+ gdouble step = 0;
+ gdouble page = 0;
+ gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
+ v -= step;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
+ result = TRUE; // I consumed the event
+ break;
+ }
case GDK_KEY_Page_Up:
case GDK_KEY_KP_Page_Up:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
- v += page;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
- return TRUE; // I consumed the event
- break;
+ {
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ gdouble v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
+ gdouble step = 0;
+ gdouble page = 0;
+ gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
+ v += page;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
+ result = TRUE; // I consumed the event
+ break;
+ }
case GDK_KEY_Page_Down:
case GDK_KEY_KP_Page_Down:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
- gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
- v -= page;
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
- return TRUE; // I consumed the event
- break;
+ {
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ gdouble v = gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
+ gdouble step = 0;
+ gdouble page = 0;
+ gtk_spin_button_get_increments(GTK_SPIN_BUTTON(w), &step, &page);
+ v -= page;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), v);
+ result = TRUE; // I consumed the event
+ break;
+ }
case GDK_KEY_z:
case GDK_KEY_Z:
- g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
- if (event->state & GDK_CONTROL_MASK) {
- spinbutton_undo(w);
- return TRUE; // I consumed the event
- }
- break;
+ g_object_set_data(G_OBJECT(w), "stay", GINT_TO_POINTER(TRUE));
+ if (event->state & GDK_CONTROL_MASK) {
+ spinbutton_undo(w);
+ result = TRUE; // I consumed the event
+ }
+ break;
default:
- return FALSE;
- break;
- }
- return FALSE; // I didn't consume the event
+ result = FALSE;
+ break;
+ }
+
+ return result;
}
/*
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 7912b654a..ede98a48a 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -434,8 +434,7 @@ StrokeStyle::makeRadioButton(Gtk::RadioButton *tb, char const *icon,
* Gets the marker uri string and applies it to all selected
* items in the current desktop.
*/
-void
-StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, SPMarkerLoc const which)
+void StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, SPMarkerLoc const /*which*/)
{
if (spw->update) {
return;
@@ -485,12 +484,10 @@ StrokeStyle::markerSelectCB(MarkerComboBox *marker_combo, StrokeStyle *spw, SPMa
css = 0;
spw->update = false;
-
};
-void
-StrokeStyle::updateMarkerHist(SPMarkerLoc const which) {
-
+void StrokeStyle::updateMarkerHist(SPMarkerLoc const which)
+{
switch (which) {
case SP_MARKER_LOC_START:
startMarkerConn.block();
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index a5e929c7d..3a7eb6b9c 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -527,7 +527,6 @@ static gchar const * ui_descr =
" </toolbar>"
" <toolbar name='ConnectorToolbar'>"
-// " <toolitem action='ConnectorEditModeAction' />"
" <toolitem action='ConnectorAvoidAction' />"
" <toolitem action='ConnectorIgnoreAction' />"
" <toolitem action='ConnectorOrthogonalAction' />"
@@ -537,8 +536,6 @@ static gchar const * ui_descr =
" <toolitem action='ConnectorLengthAction' />"
" <toolitem action='ConnectorDirectedAction' />"
" <toolitem action='ConnectorOverlapAction' />"
-// " <toolitem action='ConnectorNewConnPointAction' />"
-// " <toolitem action='ConnectorRemoveConnPointAction' />"
" </toolbar>"
"</ui>"
@@ -939,36 +936,13 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto
}
-static void handlebox_detached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
-{
- GtkAllocation alloc;
- gtk_widget_get_allocation(widget, &alloc);
- gtk_widget_set_size_request( widget,
- alloc.width,
- alloc.height );
-}
-
-static void handlebox_attached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
-{
- gtk_widget_set_size_request( widget, -1, -1 );
-}
-
static GtkWidget* toolboxNewCommon( GtkWidget* tb, BarId id, GtkPositionType handlePos )
{
g_object_set_data(G_OBJECT(tb), "desktop", NULL);
gtk_widget_set_sensitive(tb, FALSE);
- GtkWidget *hb = 0;
- gboolean forceFloatAllowed = Inkscape::Preferences::get()->getBool("/options/workarounds/floatallowed", false);
- if ( UXManager::getInstance()->isFloatWindowProblem() && !forceFloatAllowed ) {
- hb = gtk_event_box_new(); // A simple, neutral container.
- } else {
- hb = gtk_handle_box_new();
- gtk_handle_box_set_handle_position(GTK_HANDLE_BOX(hb), handlePos);
- gtk_handle_box_set_shadow_type(GTK_HANDLE_BOX(hb), GTK_SHADOW_OUT);
- gtk_handle_box_set_snap_edge(GTK_HANDLE_BOX(hb), GTK_POS_LEFT);
- }
+ GtkWidget *hb = gtk_event_box_new(); // A simple, neutral container.
gtk_container_add(GTK_CONTAINER(hb), tb);
gtk_widget_show(GTK_WIDGET(tb));
@@ -976,11 +950,6 @@ static GtkWidget* toolboxNewCommon( GtkWidget* tb, BarId id, GtkPositionType han
sigc::connection* conn = new sigc::connection;
g_object_set_data(G_OBJECT(hb), "event_context_connection", conn);
- if ( GTK_IS_HANDLE_BOX(hb) ) {
- g_signal_connect(G_OBJECT(hb), "child_detached", G_CALLBACK(handlebox_detached), static_cast<gpointer>(0));
- g_signal_connect(G_OBJECT(hb), "child_attached", G_CALLBACK(handlebox_attached), static_cast<gpointer>(0));
- }
-
gpointer val = GINT_TO_POINTER(id);
g_object_set_data(G_OBJECT(hb), BAR_ID_KEY, val);
@@ -1196,14 +1165,8 @@ static void setupToolboxCommon( GtkWidget *toolbox,
Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize(sizePref);
gtk_toolbar_set_icon_size( GTK_TOOLBAR(toolBar), static_cast<GtkIconSize>(toolboxSize) );
- if (GTK_IS_HANDLE_BOX(toolbox)) {
- // g_message("GRABBING ORIENTATION [%s]", toolbarName);
- GtkPositionType pos = gtk_handle_box_get_handle_position(GTK_HANDLE_BOX(toolbox));
- orientation = ((pos == GTK_POS_LEFT) || (pos == GTK_POS_RIGHT)) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
- } else {
- GtkPositionType pos = static_cast<GtkPositionType>(GPOINTER_TO_INT(g_object_get_data( G_OBJECT(toolbox), HANDLE_POS_MARK )));
- orientation = ((pos == GTK_POS_LEFT) || (pos == GTK_POS_RIGHT)) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
- }
+ GtkPositionType pos = static_cast<GtkPositionType>(GPOINTER_TO_INT(g_object_get_data( G_OBJECT(toolbox), HANDLE_POS_MARK )));
+ orientation = ((pos == GTK_POS_LEFT) || (pos == GTK_POS_RIGHT)) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
gtk_orientable_set_orientation (GTK_ORIENTABLE(toolBar), orientation);
gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolBar), TRUE);
@@ -1229,7 +1192,6 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati
#endif
GtkPositionType pos = (orientation == GTK_ORIENTATION_HORIZONTAL) ? GTK_POS_LEFT : GTK_POS_TOP;
- GtkHandleBox* handleBox = 0;
if (GTK_IS_BIN(toolbox)) {
#if DUMP_DETAILS
@@ -1278,9 +1240,6 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati
if (GTK_IS_TOOLBAR(child2)) {
GtkToolbar* childBar = GTK_TOOLBAR(child2);
gtk_orientable_set_orientation(GTK_ORIENTABLE(childBar), orientation);
- if (GTK_IS_HANDLE_BOX(toolbox)) {
- handleBox = GTK_HANDLE_BOX(toolbox);
- }
} else {
g_message("need to add dynamic switch");
}
@@ -1288,25 +1247,14 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati
g_list_free(children);
} else {
// The call is being made before the toolbox proper has been setup.
- if (GTK_IS_HANDLE_BOX(toolbox)) {
- handleBox = GTK_HANDLE_BOX(toolbox);
- } else {
- g_object_set_data(G_OBJECT(toolbox), HANDLE_POS_MARK, GINT_TO_POINTER(pos));
- }
+ g_object_set_data(G_OBJECT(toolbox), HANDLE_POS_MARK, GINT_TO_POINTER(pos));
}
} else if (GTK_IS_TOOLBAR(child)) {
GtkToolbar* toolbar = GTK_TOOLBAR(child);
gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), orientation );
- if (GTK_IS_HANDLE_BOX(toolbox)) {
- handleBox = GTK_HANDLE_BOX(toolbox);
- }
}
}
}
-
- if (handleBox) {
- gtk_handle_box_set_handle_position(handleBox, pos);
- }
}
void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop)