From fcffbecabedd7c6bca1312918c918d57fee3cf8c Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Wed, 5 Mar 2014 15:24:04 -0500 Subject: Added new swatches dialog (bzr r13090.1.16) --- src/widgets/desktop-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/desktop-widget.cpp') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 583dbec85..2eba8bb8c 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -358,7 +358,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) { using Inkscape::UI::Dialogs::SwatchesPanel; - dtw->panels = new SwatchesPanel("/embedded/swatches"); + dtw->panels = new SwatchesPanel("/embedded/swatches", false); dtw->panels->setOrientation(SP_ANCHOR_SOUTH); #if GTK_CHECK_VERSION(3,0,0) -- cgit v1.2.3 From 13c192e2fa564c0a743e13e30b1cf6de9b1a39a6 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Wed, 12 Mar 2014 08:56:04 -0400 Subject: Reverted swatches Removed a toy effect (not ready yet) Fixed a bug with Livarot General cleanup (bzr r13090.1.23) --- src/widgets/desktop-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/desktop-widget.cpp') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 2eba8bb8c..361a54a90 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -358,7 +358,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) { using Inkscape::UI::Dialogs::SwatchesPanel; - dtw->panels = new SwatchesPanel("/embedded/swatches", false); + dtw->panels = new SwatchesPanel("/embedded/swatches" /*false*/); dtw->panels->setOrientation(SP_ANCHOR_SOUTH); #if GTK_CHECK_VERSION(3,0,0) -- cgit v1.2.3 From d48060bf77e53bf96126151f6c47e57b3bff63b1 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Thu, 19 Jun 2014 16:12:27 -0400 Subject: Fix a crash where the canvas does not have a valid main (bzr r13341.1.64) --- src/widgets/desktop-widget.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets/desktop-widget.cpp') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 583dbec85..2c28dfbfa 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1246,6 +1246,9 @@ SPDesktopWidget::shutdown() */ void SPDesktopWidget::requestCanvasUpdate() { + // ^^ also this->desktop != 0 + g_return_if_fail (this->desktop != NULL); + g_return_if_fail (this->desktop->main != NULL); gtk_widget_queue_draw (GTK_WIDGET (SP_CANVAS_ITEM (this->desktop->main)->canvas)); } -- cgit v1.2.3 From 78ff8ee1445ce4b4d72e273358fbef6d0105f426 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Thu, 19 Jun 2014 16:37:29 -0400 Subject: Fix a crash where the canvas does not have a valid main element (bzr r13433) --- src/widgets/desktop-widget.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets/desktop-widget.cpp') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 583dbec85..1b4648286 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1246,6 +1246,9 @@ SPDesktopWidget::shutdown() */ void SPDesktopWidget::requestCanvasUpdate() { + // ^^ also this->desktop != 0 + g_return_if_fail(this->desktop != NULL); + g_return_if_fail(this->desktop->main != NULL); gtk_widget_queue_draw (GTK_WIDGET (SP_CANVAS_ITEM (this->desktop->main)->canvas)); } -- cgit v1.2.3 From 94b7715e1e82202aff812fa429d817e497ea8868 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 24 Aug 2014 14:03:51 +0100 Subject: desktop-widget: GObject boilerplate reduction (bzr r13341.1.173) --- src/widgets/desktop-widget.cpp | 137 ++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 76 deletions(-) (limited to 'src/widgets/desktop-widget.cpp') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 1b4648286..9bc9958c7 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -98,7 +98,6 @@ enum { //--------------------------------------------------------------------- /* SPDesktopWidget */ -static void sp_desktop_widget_class_init (SPDesktopWidgetClass *klass); static void sp_desktop_widget_dispose(GObject *object); static void sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); @@ -128,8 +127,6 @@ static void sp_dtw_zoom_drawing (GtkMenuItem *item, gpointer data); static void sp_dtw_zoom_selection (GtkMenuItem *item, gpointer data); static void sp_dtw_sticky_zoom_toggled (GtkMenuItem *item, gpointer data); -SPViewWidgetClass *dtw_parent_class; - class CMSPrefWatcher { public: CMSPrefWatcher() : @@ -268,31 +265,19 @@ SPDesktopWidget::window_get_pointer() static GTimer *overallTimer = 0; -/** - * Registers SPDesktopWidget class and returns its type number. - */ -GType SPDesktopWidget::getType(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPDesktopWidgetClass), - 0, // base_init - 0, // base_finalize - (GClassInitFunc)sp_desktop_widget_class_init, - 0, // class_finalize - 0, // class_data - sizeof(SPDesktopWidget), - 0, // n_preallocs - (GInstanceInitFunc)SPDesktopWidget::init, - 0 // value_table - }; - type = g_type_register_static(SP_TYPE_VIEW_WIDGET, "SPDesktopWidget", &info, static_cast(0)); - // Begin a timer to watch for the first desktop to appear on-screen - overallTimer = g_timer_new(); - } - return type; -} +struct SPDesktopWidgetPrivate +{ + GtkWidget *tool_toolbox; + GtkWidget *aux_toolbox; + GtkWidget *commands_toolbox; + GtkWidget *snap_toolbox; +}; + +G_DEFINE_TYPE_WITH_CODE(SPDesktopWidget, sp_desktop_widget, SP_TYPE_VIEW_WIDGET, + // Begin a timer to watch for the first desktop to appear on-screen + overallTimer = g_timer_new(); + G_ADD_PRIVATE(SPDesktopWidget); + ); /** * SPDesktopWidget vtable initialization @@ -300,8 +285,6 @@ GType SPDesktopWidget::getType(void) static void sp_desktop_widget_class_init (SPDesktopWidgetClass *klass) { - dtw_parent_class = SP_VIEW_WIDGET_CLASS(g_type_class_peek_parent(klass)); - GObjectClass *object_class = G_OBJECT_CLASS(klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); @@ -329,10 +312,12 @@ static void canvas_tbl_size_allocate(GtkWidget * /*widget*/, /** * Callback for SPDesktopWidget object initialization. */ -void SPDesktopWidget::init( SPDesktopWidget *dtw ) +void sp_desktop_widget_init( SPDesktopWidget *dtw ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + dtw->priv = reinterpret_cast(sp_desktop_widget_get_instance_private(dtw)); + new (&dtw->modified_connection) sigc::connection(); dtw->window = 0; @@ -377,19 +362,19 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) gtk_box_pack_end( GTK_BOX (dtw->vbox), dtw->hbox, TRUE, TRUE, 0 ); gtk_widget_show(dtw->hbox); - dtw->aux_toolbox = ToolboxFactory::createAuxToolbox(); - gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->aux_toolbox, FALSE, TRUE, 0); + dtw->priv->aux_toolbox = ToolboxFactory::createAuxToolbox(); + gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->priv->aux_toolbox, FALSE, TRUE, 0); - dtw->snap_toolbox = ToolboxFactory::createSnapToolbox(); - ToolboxFactory::setOrientation( dtw->snap_toolbox, GTK_ORIENTATION_VERTICAL ); - gtk_box_pack_end( GTK_BOX(dtw->hbox), dtw->snap_toolbox, FALSE, TRUE, 0 ); + dtw->priv->snap_toolbox = ToolboxFactory::createSnapToolbox(); + ToolboxFactory::setOrientation( dtw->priv->snap_toolbox, GTK_ORIENTATION_VERTICAL ); + gtk_box_pack_end( GTK_BOX(dtw->hbox), dtw->priv->snap_toolbox, FALSE, TRUE, 0 ); - dtw->commands_toolbox = ToolboxFactory::createCommandsToolbox(); - gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->commands_toolbox, FALSE, TRUE, 0); + dtw->priv->commands_toolbox = ToolboxFactory::createCommandsToolbox(); + gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->priv->commands_toolbox, FALSE, TRUE, 0); - dtw->tool_toolbox = ToolboxFactory::createToolToolbox(); - ToolboxFactory::setOrientation( dtw->tool_toolbox, GTK_ORIENTATION_VERTICAL ); - gtk_box_pack_start( GTK_BOX(dtw->hbox), dtw->tool_toolbox, FALSE, TRUE, 0 ); + dtw->priv->tool_toolbox = ToolboxFactory::createToolToolbox(); + ToolboxFactory::setOrientation( dtw->priv->tool_toolbox, GTK_ORIENTATION_VERTICAL ); + gtk_box_pack_start( GTK_BOX(dtw->hbox), dtw->priv->tool_toolbox, FALSE, TRUE, 0 ); /* Horizontal ruler */ GtkWidget *eventbox = gtk_event_box_new (); @@ -804,8 +789,8 @@ static void sp_desktop_widget_dispose(GObject *object) dtw->modified_connection.~connection(); - if (G_OBJECT_CLASS (dtw_parent_class)->dispose) { - (* G_OBJECT_CLASS (dtw_parent_class)->dispose) (object); + if (G_OBJECT_CLASS (sp_desktop_widget_parent_class)->dispose) { + G_OBJECT_CLASS (sp_desktop_widget_parent_class)->dispose(object); } } @@ -908,8 +893,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) (allocation->y == widg_allocation.y) && (allocation->width == widg_allocation.width) && (allocation->height == widg_allocation.height)) { - if (GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate) - GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate) + GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate (widget, allocation); return; } @@ -917,8 +902,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) Geom::Rect const area = dtw->desktop->get_display_area(); double zoom = dtw->desktop->current_zoom(); - if (GTK_WIDGET_CLASS(dtw_parent_class)->size_allocate) { - GTK_WIDGET_CLASS(dtw_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS(sp_desktop_widget_parent_class)->size_allocate) { + GTK_WIDGET_CLASS(sp_desktop_widget_parent_class)->size_allocate (widget, allocation); } if (SP_BUTTON_IS_DOWN(dtw->sticky_zoom)) { @@ -936,8 +921,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) dtw->desktop->show_dialogs(); } else { - if (GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate) { - GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate) { + GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate (widget, allocation); } // this->size_allocate (widget, allocation); } @@ -952,8 +937,8 @@ sp_desktop_widget_realize (GtkWidget *widget) SPDesktopWidget *dtw = SP_DESKTOP_WIDGET (widget); - if (GTK_WIDGET_CLASS (dtw_parent_class)->realize) - (* GTK_WIDGET_CLASS (dtw_parent_class)->realize) (widget); + if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->realize) + GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->realize(widget); Geom::Rect d = Geom::Rect::from_xywh(Geom::Point(0,0), (dtw->desktop->doc())->getDimensions()); @@ -998,8 +983,8 @@ sp_desktop_widget_event (GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dt } } - if (GTK_WIDGET_CLASS (dtw_parent_class)->event) { - return (* GTK_WIDGET_CLASS (dtw_parent_class)->event) (widget, event); + if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->event) { + return GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->event(widget, event); } else { // The key press/release events need to be passed to desktop handler explicitly, // because otherwise the event contexts only receive key events when the mouse cursor @@ -1499,29 +1484,29 @@ void SPDesktopWidget::layoutWidgets() } if (!prefs->getBool(pref_root + "commands/state", true)) { - gtk_widget_hide (dtw->commands_toolbox); + gtk_widget_hide (dtw->priv->commands_toolbox); } else { - gtk_widget_show_all (dtw->commands_toolbox); + gtk_widget_show_all (dtw->priv->commands_toolbox); } if (!prefs->getBool(pref_root + "snaptoolbox/state", true)) { - gtk_widget_hide (dtw->snap_toolbox); + gtk_widget_hide (dtw->priv->snap_toolbox); } else { - gtk_widget_show_all (dtw->snap_toolbox); + gtk_widget_show_all (dtw->priv->snap_toolbox); } if (!prefs->getBool(pref_root + "toppanel/state", true)) { - gtk_widget_hide (dtw->aux_toolbox); + gtk_widget_hide (dtw->priv->aux_toolbox); } else { // we cannot just show_all because that will show all tools' panels; // this is a function from toolbox.cpp that shows only the current tool's panel - ToolboxFactory::showAuxToolbox(dtw->aux_toolbox); + ToolboxFactory::showAuxToolbox(dtw->priv->aux_toolbox); } if (!prefs->getBool(pref_root + "toolbox/state", true)) { - gtk_widget_hide (dtw->tool_toolbox); + gtk_widget_hide (dtw->priv->tool_toolbox); } else { - gtk_widget_show_all (dtw->tool_toolbox); + gtk_widget_show_all (dtw->priv->tool_toolbox); } if (!prefs->getBool(pref_root + "statusbar/state", true)) { @@ -1558,7 +1543,7 @@ void SPDesktopWidget::layoutWidgets() void SPDesktopWidget::setToolboxFocusTo (const gchar* label) { - gpointer hb = sp_search_by_data_recursive(aux_toolbox, (gpointer) label); + gpointer hb = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) label); if (hb && GTK_IS_WIDGET(hb)) { gtk_widget_grab_focus(GTK_WIDGET(hb)); @@ -1569,7 +1554,7 @@ void SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value) { GtkAdjustment *a = NULL; - gpointer hb = sp_search_by_data_recursive (aux_toolbox, (gpointer) id); + gpointer hb = sp_search_by_data_recursive (priv->aux_toolbox, (gpointer) id); if (hb && GTK_IS_WIDGET(hb)) { if (GTK_IS_SPIN_BUTTON(hb)) a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(hb)); @@ -1586,7 +1571,7 @@ SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value) void SPDesktopWidget::setToolboxSelectOneValue (gchar const *id, int value) { - gpointer hb = sp_search_by_data_recursive(aux_toolbox, (gpointer) id); + gpointer hb = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) id); if (hb) { ege_select_one_action_set_active(EGE_SELECT_ONE_ACTION(hb), value); } @@ -1597,7 +1582,7 @@ bool SPDesktopWidget::isToolboxButtonActive (const gchar* id) { bool isActive = false; - gpointer thing = sp_search_by_data_recursive(aux_toolbox, (gpointer) id); + gpointer thing = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) id); if ( !thing ) { //g_message( "Unable to locate item for {%s}", id ); } else if ( GTK_IS_TOGGLE_BUTTON(thing) ) { @@ -1618,13 +1603,13 @@ void SPDesktopWidget::setToolboxPosition(Glib::ustring const& id, GtkPositionTyp // Note - later on these won't be individual member variables. GtkWidget* toolbox = 0; if (id == "ToolToolbar") { - toolbox = tool_toolbox; + toolbox = priv->tool_toolbox; } else if (id == "AuxToolbar") { - toolbox = aux_toolbox; + toolbox = priv->aux_toolbox; } else if (id == "CommandsToolbar") { - toolbox = commands_toolbox; + toolbox = priv->commands_toolbox; } else if (id == "SnapToolbar") { - toolbox = snap_toolbox; + toolbox = priv->snap_toolbox; } @@ -1697,10 +1682,10 @@ SPDesktopWidget* SPDesktopWidget::createInstance(SPNamedView *namedview) dtw->layoutWidgets(); std::vector toolboxes; - toolboxes.push_back(dtw->tool_toolbox); - toolboxes.push_back(dtw->aux_toolbox); - toolboxes.push_back(dtw->commands_toolbox); - toolboxes.push_back(dtw->snap_toolbox); + toolboxes.push_back(dtw->priv->tool_toolbox); + toolboxes.push_back(dtw->priv->aux_toolbox); + toolboxes.push_back(dtw->priv->commands_toolbox); + toolboxes.push_back(dtw->priv->snap_toolbox); dtw->panels->setDesktop( dtw->desktop ); @@ -1754,8 +1739,8 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) * * This should solve: https://bugs.launchpad.net/inkscape/+bug/362995 */ - if (GTK_IS_CONTAINER(aux_toolbox)) { - GList *ch = gtk_container_get_children (GTK_CONTAINER(aux_toolbox)); + if (GTK_IS_CONTAINER(priv->aux_toolbox)) { + GList *ch = gtk_container_get_children (GTK_CONTAINER(priv->aux_toolbox)); for (GList *i = ch; i != NULL; i = i->next) { if (GTK_IS_CONTAINER(i->data)) { GList *grch = gtk_container_get_children (GTK_CONTAINER(i->data)); @@ -1781,7 +1766,7 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) gtk_widget_set_tooltip_text(this->vruler_box, gettext(nv->doc_units->name_plural.c_str())); sp_desktop_widget_update_rulers(this); - ToolboxFactory::updateSnapToolbox(this->desktop, 0, this->snap_toolbox); + ToolboxFactory::updateSnapToolbox(this->desktop, 0, priv->snap_toolbox); } } -- cgit v1.2.3 From 0d0958e3b2aff0ed5f3ad7a98b4035213475c7f1 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 7 Sep 2014 13:02:01 -0400 Subject: Update to experimental r13543 (bzr r13090.1.108) --- src/widgets/desktop-widget.cpp | 137 +++++++++++++++++++++++------------------ 1 file changed, 76 insertions(+), 61 deletions(-) (limited to 'src/widgets/desktop-widget.cpp') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 63978a711..fec46b188 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -98,6 +98,7 @@ enum { //--------------------------------------------------------------------- /* SPDesktopWidget */ +static void sp_desktop_widget_class_init (SPDesktopWidgetClass *klass); static void sp_desktop_widget_dispose(GObject *object); static void sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); @@ -127,6 +128,8 @@ static void sp_dtw_zoom_drawing (GtkMenuItem *item, gpointer data); static void sp_dtw_zoom_selection (GtkMenuItem *item, gpointer data); static void sp_dtw_sticky_zoom_toggled (GtkMenuItem *item, gpointer data); +SPViewWidgetClass *dtw_parent_class; + class CMSPrefWatcher { public: CMSPrefWatcher() : @@ -265,19 +268,31 @@ SPDesktopWidget::window_get_pointer() static GTimer *overallTimer = 0; -struct SPDesktopWidgetPrivate -{ - GtkWidget *tool_toolbox; - GtkWidget *aux_toolbox; - GtkWidget *commands_toolbox; - GtkWidget *snap_toolbox; -}; - -G_DEFINE_TYPE_WITH_CODE(SPDesktopWidget, sp_desktop_widget, SP_TYPE_VIEW_WIDGET, - // Begin a timer to watch for the first desktop to appear on-screen - overallTimer = g_timer_new(); - G_ADD_PRIVATE(SPDesktopWidget); - ); +/** + * Registers SPDesktopWidget class and returns its type number. + */ +GType SPDesktopWidget::getType(void) +{ + static GType type = 0; + if (!type) { + GTypeInfo info = { + sizeof(SPDesktopWidgetClass), + 0, // base_init + 0, // base_finalize + (GClassInitFunc)sp_desktop_widget_class_init, + 0, // class_finalize + 0, // class_data + sizeof(SPDesktopWidget), + 0, // n_preallocs + (GInstanceInitFunc)SPDesktopWidget::init, + 0 // value_table + }; + type = g_type_register_static(SP_TYPE_VIEW_WIDGET, "SPDesktopWidget", &info, static_cast(0)); + // Begin a timer to watch for the first desktop to appear on-screen + overallTimer = g_timer_new(); + } + return type; +} /** * SPDesktopWidget vtable initialization @@ -285,6 +300,8 @@ G_DEFINE_TYPE_WITH_CODE(SPDesktopWidget, sp_desktop_widget, SP_TYPE_VIEW_WIDGET, static void sp_desktop_widget_class_init (SPDesktopWidgetClass *klass) { + dtw_parent_class = SP_VIEW_WIDGET_CLASS(g_type_class_peek_parent(klass)); + GObjectClass *object_class = G_OBJECT_CLASS(klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); @@ -312,12 +329,10 @@ static void canvas_tbl_size_allocate(GtkWidget * /*widget*/, /** * Callback for SPDesktopWidget object initialization. */ -void sp_desktop_widget_init( SPDesktopWidget *dtw ) +void SPDesktopWidget::init( SPDesktopWidget *dtw ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - dtw->priv = reinterpret_cast(sp_desktop_widget_get_instance_private(dtw)); - new (&dtw->modified_connection) sigc::connection(); dtw->window = 0; @@ -362,19 +377,19 @@ void sp_desktop_widget_init( SPDesktopWidget *dtw ) gtk_box_pack_end( GTK_BOX (dtw->vbox), dtw->hbox, TRUE, TRUE, 0 ); gtk_widget_show(dtw->hbox); - dtw->priv->aux_toolbox = ToolboxFactory::createAuxToolbox(); - gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->priv->aux_toolbox, FALSE, TRUE, 0); + dtw->aux_toolbox = ToolboxFactory::createAuxToolbox(); + gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->aux_toolbox, FALSE, TRUE, 0); - dtw->priv->snap_toolbox = ToolboxFactory::createSnapToolbox(); - ToolboxFactory::setOrientation( dtw->priv->snap_toolbox, GTK_ORIENTATION_VERTICAL ); - gtk_box_pack_end( GTK_BOX(dtw->hbox), dtw->priv->snap_toolbox, FALSE, TRUE, 0 ); + dtw->snap_toolbox = ToolboxFactory::createSnapToolbox(); + ToolboxFactory::setOrientation( dtw->snap_toolbox, GTK_ORIENTATION_VERTICAL ); + gtk_box_pack_end( GTK_BOX(dtw->hbox), dtw->snap_toolbox, FALSE, TRUE, 0 ); - dtw->priv->commands_toolbox = ToolboxFactory::createCommandsToolbox(); - gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->priv->commands_toolbox, FALSE, TRUE, 0); + dtw->commands_toolbox = ToolboxFactory::createCommandsToolbox(); + gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->commands_toolbox, FALSE, TRUE, 0); - dtw->priv->tool_toolbox = ToolboxFactory::createToolToolbox(); - ToolboxFactory::setOrientation( dtw->priv->tool_toolbox, GTK_ORIENTATION_VERTICAL ); - gtk_box_pack_start( GTK_BOX(dtw->hbox), dtw->priv->tool_toolbox, FALSE, TRUE, 0 ); + dtw->tool_toolbox = ToolboxFactory::createToolToolbox(); + ToolboxFactory::setOrientation( dtw->tool_toolbox, GTK_ORIENTATION_VERTICAL ); + gtk_box_pack_start( GTK_BOX(dtw->hbox), dtw->tool_toolbox, FALSE, TRUE, 0 ); /* Horizontal ruler */ GtkWidget *eventbox = gtk_event_box_new (); @@ -789,8 +804,8 @@ static void sp_desktop_widget_dispose(GObject *object) dtw->modified_connection.~connection(); - if (G_OBJECT_CLASS (sp_desktop_widget_parent_class)->dispose) { - G_OBJECT_CLASS (sp_desktop_widget_parent_class)->dispose(object); + if (G_OBJECT_CLASS (dtw_parent_class)->dispose) { + (* G_OBJECT_CLASS (dtw_parent_class)->dispose) (object); } } @@ -893,8 +908,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) (allocation->y == widg_allocation.y) && (allocation->width == widg_allocation.width) && (allocation->height == widg_allocation.height)) { - if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate) - GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate) + GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate (widget, allocation); return; } @@ -902,8 +917,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) Geom::Rect const area = dtw->desktop->get_display_area(); double zoom = dtw->desktop->current_zoom(); - if (GTK_WIDGET_CLASS(sp_desktop_widget_parent_class)->size_allocate) { - GTK_WIDGET_CLASS(sp_desktop_widget_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS(dtw_parent_class)->size_allocate) { + GTK_WIDGET_CLASS(dtw_parent_class)->size_allocate (widget, allocation); } if (SP_BUTTON_IS_DOWN(dtw->sticky_zoom)) { @@ -921,8 +936,8 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) dtw->desktop->show_dialogs(); } else { - if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate) { - GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->size_allocate (widget, allocation); + if (GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate) { + GTK_WIDGET_CLASS (dtw_parent_class)->size_allocate (widget, allocation); } // this->size_allocate (widget, allocation); } @@ -937,8 +952,8 @@ sp_desktop_widget_realize (GtkWidget *widget) SPDesktopWidget *dtw = SP_DESKTOP_WIDGET (widget); - if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->realize) - GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->realize(widget); + if (GTK_WIDGET_CLASS (dtw_parent_class)->realize) + (* GTK_WIDGET_CLASS (dtw_parent_class)->realize) (widget); Geom::Rect d = Geom::Rect::from_xywh(Geom::Point(0,0), (dtw->desktop->doc())->getDimensions()); @@ -983,8 +998,8 @@ sp_desktop_widget_event (GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dt } } - if (GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->event) { - return GTK_WIDGET_CLASS (sp_desktop_widget_parent_class)->event(widget, event); + if (GTK_WIDGET_CLASS (dtw_parent_class)->event) { + return (* GTK_WIDGET_CLASS (dtw_parent_class)->event) (widget, event); } else { // The key press/release events need to be passed to desktop handler explicitly, // because otherwise the event contexts only receive key events when the mouse cursor @@ -1484,29 +1499,29 @@ void SPDesktopWidget::layoutWidgets() } if (!prefs->getBool(pref_root + "commands/state", true)) { - gtk_widget_hide (dtw->priv->commands_toolbox); + gtk_widget_hide (dtw->commands_toolbox); } else { - gtk_widget_show_all (dtw->priv->commands_toolbox); + gtk_widget_show_all (dtw->commands_toolbox); } if (!prefs->getBool(pref_root + "snaptoolbox/state", true)) { - gtk_widget_hide (dtw->priv->snap_toolbox); + gtk_widget_hide (dtw->snap_toolbox); } else { - gtk_widget_show_all (dtw->priv->snap_toolbox); + gtk_widget_show_all (dtw->snap_toolbox); } if (!prefs->getBool(pref_root + "toppanel/state", true)) { - gtk_widget_hide (dtw->priv->aux_toolbox); + gtk_widget_hide (dtw->aux_toolbox); } else { // we cannot just show_all because that will show all tools' panels; // this is a function from toolbox.cpp that shows only the current tool's panel - ToolboxFactory::showAuxToolbox(dtw->priv->aux_toolbox); + ToolboxFactory::showAuxToolbox(dtw->aux_toolbox); } if (!prefs->getBool(pref_root + "toolbox/state", true)) { - gtk_widget_hide (dtw->priv->tool_toolbox); + gtk_widget_hide (dtw->tool_toolbox); } else { - gtk_widget_show_all (dtw->priv->tool_toolbox); + gtk_widget_show_all (dtw->tool_toolbox); } if (!prefs->getBool(pref_root + "statusbar/state", true)) { @@ -1543,7 +1558,7 @@ void SPDesktopWidget::layoutWidgets() void SPDesktopWidget::setToolboxFocusTo (const gchar* label) { - gpointer hb = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) label); + gpointer hb = sp_search_by_data_recursive(aux_toolbox, (gpointer) label); if (hb && GTK_IS_WIDGET(hb)) { gtk_widget_grab_focus(GTK_WIDGET(hb)); @@ -1554,7 +1569,7 @@ void SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value) { GtkAdjustment *a = NULL; - gpointer hb = sp_search_by_data_recursive (priv->aux_toolbox, (gpointer) id); + gpointer hb = sp_search_by_data_recursive (aux_toolbox, (gpointer) id); if (hb && GTK_IS_WIDGET(hb)) { if (GTK_IS_SPIN_BUTTON(hb)) a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(hb)); @@ -1571,7 +1586,7 @@ SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value) void SPDesktopWidget::setToolboxSelectOneValue (gchar const *id, int value) { - gpointer hb = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) id); + gpointer hb = sp_search_by_data_recursive(aux_toolbox, (gpointer) id); if (hb) { ege_select_one_action_set_active(EGE_SELECT_ONE_ACTION(hb), value); } @@ -1582,7 +1597,7 @@ bool SPDesktopWidget::isToolboxButtonActive (const gchar* id) { bool isActive = false; - gpointer thing = sp_search_by_data_recursive(priv->aux_toolbox, (gpointer) id); + gpointer thing = sp_search_by_data_recursive(aux_toolbox, (gpointer) id); if ( !thing ) { //g_message( "Unable to locate item for {%s}", id ); } else if ( GTK_IS_TOGGLE_BUTTON(thing) ) { @@ -1603,13 +1618,13 @@ void SPDesktopWidget::setToolboxPosition(Glib::ustring const& id, GtkPositionTyp // Note - later on these won't be individual member variables. GtkWidget* toolbox = 0; if (id == "ToolToolbar") { - toolbox = priv->tool_toolbox; + toolbox = tool_toolbox; } else if (id == "AuxToolbar") { - toolbox = priv->aux_toolbox; + toolbox = aux_toolbox; } else if (id == "CommandsToolbar") { - toolbox = priv->commands_toolbox; + toolbox = commands_toolbox; } else if (id == "SnapToolbar") { - toolbox = priv->snap_toolbox; + toolbox = snap_toolbox; } @@ -1682,10 +1697,10 @@ SPDesktopWidget* SPDesktopWidget::createInstance(SPNamedView *namedview) dtw->layoutWidgets(); std::vector toolboxes; - toolboxes.push_back(dtw->priv->tool_toolbox); - toolboxes.push_back(dtw->priv->aux_toolbox); - toolboxes.push_back(dtw->priv->commands_toolbox); - toolboxes.push_back(dtw->priv->snap_toolbox); + toolboxes.push_back(dtw->tool_toolbox); + toolboxes.push_back(dtw->aux_toolbox); + toolboxes.push_back(dtw->commands_toolbox); + toolboxes.push_back(dtw->snap_toolbox); dtw->panels->setDesktop( dtw->desktop ); @@ -1739,8 +1754,8 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) * * This should solve: https://bugs.launchpad.net/inkscape/+bug/362995 */ - if (GTK_IS_CONTAINER(priv->aux_toolbox)) { - GList *ch = gtk_container_get_children (GTK_CONTAINER(priv->aux_toolbox)); + if (GTK_IS_CONTAINER(aux_toolbox)) { + GList *ch = gtk_container_get_children (GTK_CONTAINER(aux_toolbox)); for (GList *i = ch; i != NULL; i = i->next) { if (GTK_IS_CONTAINER(i->data)) { GList *grch = gtk_container_get_children (GTK_CONTAINER(i->data)); @@ -1766,7 +1781,7 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) gtk_widget_set_tooltip_text(this->vruler_box, gettext(nv->doc_units->name_plural.c_str())); sp_desktop_widget_update_rulers(this); - ToolboxFactory::updateSnapToolbox(this->desktop, 0, priv->snap_toolbox); + ToolboxFactory::updateSnapToolbox(this->desktop, 0, this->snap_toolbox); } } -- cgit v1.2.3 From efd39893a4f5e629a9df2d0674222aea1be14199 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 5 Oct 2014 12:38:15 -0400 Subject: Move obvious ui component to ui/ (bzr r13341.1.247) --- src/widgets/desktop-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/desktop-widget.cpp') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index fec46b188..388d22e29 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -46,7 +46,7 @@ #include "util/units.h" #include "ui/widget/unit-tracker.h" #include "inkscape-private.h" -#include "interface.h" +#include "ui/interface.h" #include "macros.h" #include "preferences.h" #include "sp-image.h" -- cgit v1.2.3 From 59c5c3e7575768faa00dd7d9fde9eca6d8815aab Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 5 Oct 2014 14:14:01 -0400 Subject: Move GtkAction subclasses to widgets/ (bzr r13341.1.249) --- src/widgets/desktop-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/desktop-widget.cpp') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 388d22e29..9c8dac7dc 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -38,7 +38,7 @@ #include "display/canvas-arena.h" #include "document.h" #include "ege-color-prof-tracker.h" -#include "ege-select-one-action.h" +#include "widgets/ege-select-one-action.h" #include #include "file.h" #include "helper/action.h" -- cgit v1.2.3