From 7572ee2641532716d219a9a11f03e87511ed0bab Mon Sep 17 00:00:00 2001 From: John Smith Date: Tue, 8 May 2012 14:21:59 +0900 Subject: Fix for 986446 : Refactor toolbox into tool specific files (bzr r11346) --- src/widgets/arc-toolbar.cpp | 436 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 436 insertions(+) create mode 100644 src/widgets/arc-toolbar.cpp (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp new file mode 100644 index 000000000..e59a20d30 --- /dev/null +++ b/src/widgets/arc-toolbar.cpp @@ -0,0 +1,436 @@ +/** + * @file + * Arc aux toolbar + */ +/* Authors: + * MenTaLguY + * Lauris Kaplinski + * bulia byak + * Frank Felfe + * John Cliff + * David Turner + * Josh Andler + * Jon A. Cruz + * Maximilian Albert + * Tavmjong Bah + * Abhishek Sharma + * Kris De Gussem + * + * Copyright (C) 2004 David Turner + * Copyright (C) 2003 MenTaLguY + * Copyright (C) 1999-2011 authors + * Copyright (C) 2001-2002 Ximian, Inc. + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "toolbox.h" +#include "arc-toolbar.h" + +#include "../desktop.h" +#include "../desktop-handles.h" +#include "document-undo.h" +#include "../verbs.h" +#include "../inkscape.h" +#include "../selection-chemistry.h" +#include "../selection.h" + +#include "../ege-adjustment-action.h" +#include "../ege-output-action.h" +#include "../ege-select-one-action.h" +#include "../ink-action.h" +#include "../ink-comboboxentry-action.h" + +#include "../widgets/button.h" +#include "../widgets/spinbutton-events.h" +#include "ui/widget/spinbutton.h" +#include "../widgets/spw-utilities.h" +#include "../widgets/widget-sizes.h" +#include "../xml/node-event-vector.h" +#include "../xml/repr.h" +#include "ui/uxmanager.h" +#include "../ui/icon-names.h" +#include "../helper/unit-menu.h" +#include "../helper/units.h" +#include "../helper/unit-tracker.h" +#include "../pen-context.h" +#include "../sp-ellipse.h" +#include "../mod360.h" + +using Inkscape::UnitTracker; +using Inkscape::UI::UXManager; +using Inkscape::DocumentUndo; +using Inkscape::UI::ToolboxFactory; +using Inkscape::UI::PrefPusher; + +//######################## +//## Circle / Arc ## +//######################## + +static void sp_arctb_sensitivize( GObject *tbl, double v1, double v2 ) +{ + GtkAction *ocb = GTK_ACTION( g_object_get_data( tbl, "open_action" ) ); + GtkAction *make_whole = GTK_ACTION( g_object_get_data( tbl, "make_whole" ) ); + + if (v1 == 0 && v2 == 0) { + if (g_object_get_data( tbl, "single" )) { // only for a single selected ellipse (for now) + gtk_action_set_sensitive( ocb, FALSE ); + gtk_action_set_sensitive( make_whole, FALSE ); + } + } else { + gtk_action_set_sensitive( ocb, TRUE ); + gtk_action_set_sensitive( make_whole, TRUE ); + } +} + +static void +sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *value_name, gchar const *other_name) +{ + SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); + + if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble(Glib::ustring("/tools/shapes/arc/") + value_name, gtk_adjustment_get_value(adj)); + } + + // quit if run by the attr_changed listener + if (g_object_get_data( tbl, "freeze" )) { + return; + } + + // in turn, prevent listener from responding + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) ); + + gchar* namespaced_name = g_strconcat("sodipodi:", value_name, NULL); + + bool modmade = false; + for (GSList const *items = sp_desktop_selection(desktop)->itemList(); + items != NULL; + items = items->next) + { + SPItem *item = SP_ITEM(items->data); + + if (SP_IS_ARC(item) && SP_IS_GENERICELLIPSE(item)) { + + SPGenericEllipse *ge = SP_GENERICELLIPSE(item); + SPArc *arc = SP_ARC(item); + + if (!strcmp(value_name, "start")) { + ge->start = (gtk_adjustment_get_value(adj) * M_PI)/ 180; + } else { + ge->end = (gtk_adjustment_get_value(adj) * M_PI)/ 180; + } + + sp_genericellipse_normalize(ge); + ((SPObject *)arc)->updateRepr(); + ((SPObject *)arc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + + modmade = true; + } + } + + g_free(namespaced_name); + + GtkAdjustment *other = GTK_ADJUSTMENT( g_object_get_data( tbl, other_name ) ); + + sp_arctb_sensitivize( tbl, gtk_adjustment_get_value(adj), gtk_adjustment_get_value(other) ); + + if (modmade) { + DocumentUndo::maybeDone(sp_desktop_document(desktop), value_name, SP_VERB_CONTEXT_ARC, + _("Arc: Change start/end")); + } + + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); +} + + +static void sp_arctb_start_value_changed(GtkAdjustment *adj, GObject *tbl) +{ + sp_arctb_startend_value_changed(adj, tbl, "start", "end"); +} + +static void sp_arctb_end_value_changed(GtkAdjustment *adj, GObject *tbl) +{ + sp_arctb_startend_value_changed(adj, tbl, "end", "start"); +} + + +static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) +{ + SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); + if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/tools/shapes/arc/open", ege_select_one_action_get_active(act) != 0); + } + + // quit if run by the attr_changed listener + if (g_object_get_data( tbl, "freeze" )) { + return; + } + + // in turn, prevent listener from responding + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) ); + + bool modmade = false; + + if ( ege_select_one_action_get_active(act) != 0 ) { + for (GSList const *items = sp_desktop_selection(desktop)->itemList(); + items != NULL; + items = items->next) + { + SPItem *item = reinterpret_cast(items->data); + if (SP_IS_ARC(item)) { + Inkscape::XML::Node *repr = item->getRepr(); + repr->setAttribute("sodipodi:open", "true"); + item->updateRepr(); + modmade = true; + } + } + } else { + for (GSList const *items = sp_desktop_selection(desktop)->itemList(); + items != NULL; + items = items->next) + { + SPItem *item = reinterpret_cast(items->data); + if (SP_IS_ARC(item)) { + Inkscape::XML::Node *repr = item->getRepr(); + repr->setAttribute("sodipodi:open", NULL); + item->updateRepr(); + modmade = true; + } + } + } + + if (modmade) { + DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, + _("Arc: Change open/closed")); + } + + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); +} + +static void sp_arctb_defaults(GtkWidget *, GObject *obj) +{ + GtkAdjustment *adj; + adj = GTK_ADJUSTMENT( g_object_get_data(obj, "start") ); + gtk_adjustment_set_value(adj, 0.0); + gtk_adjustment_value_changed(adj); + + adj = GTK_ADJUSTMENT( g_object_get_data(obj, "end") ); + gtk_adjustment_set_value(adj, 0.0); + gtk_adjustment_value_changed(adj); + + spinbutton_defocus(GTK_WIDGET(obj)); +} + +static void arc_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const * /*name*/, + gchar const * /*old_value*/, gchar const * /*new_value*/, + bool /*is_interactive*/, gpointer data) +{ + GObject *tbl = G_OBJECT(data); + + // quit if run by the _changed callbacks + if (g_object_get_data( tbl, "freeze" )) { + return; + } + + // in turn, prevent callbacks from responding + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) ); + + gdouble start = 0.; + gdouble end = 0.; + sp_repr_get_double(repr, "sodipodi:start", &start); + sp_repr_get_double(repr, "sodipodi:end", &end); + + GtkAdjustment *adj1,*adj2; + adj1 = GTK_ADJUSTMENT( g_object_get_data( tbl, "start" ) ); + gtk_adjustment_set_value(adj1, mod360((start * 180)/M_PI)); + adj2 = GTK_ADJUSTMENT( g_object_get_data( tbl, "end" ) ); + gtk_adjustment_set_value(adj2, mod360((end * 180)/M_PI)); + + sp_arctb_sensitivize( tbl, gtk_adjustment_get_value(adj1), gtk_adjustment_get_value(adj2) ); + + char const *openstr = NULL; + openstr = repr->attribute("sodipodi:open"); + EgeSelectOneAction *ocb = EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "open_action" ) ); + + if (openstr) { + ege_select_one_action_set_active( ocb, 1 ); + } else { + ege_select_one_action_set_active( ocb, 0 ); + } + + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); +} + +static Inkscape::XML::NodeEventVector arc_tb_repr_events = { + NULL, /* child_added */ + NULL, /* child_removed */ + arc_tb_event_attr_changed, + NULL, /* content_changed */ + NULL /* order_changed */ +}; + + +static void sp_arc_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl) +{ + int n_selected = 0; + Inkscape::XML::Node *repr = NULL; + + purge_repr_listener( tbl, tbl ); + + for (GSList const *items = selection->itemList(); + items != NULL; + items = items->next) + { + SPItem *item = reinterpret_cast(items->data); + if (SP_IS_ARC(item)) { + n_selected++; + repr = item->getRepr(); + } + } + + EgeOutputAction* act = EGE_OUTPUT_ACTION( g_object_get_data( tbl, "mode_action" ) ); + + g_object_set_data( tbl, "single", GINT_TO_POINTER(FALSE) ); + if (n_selected == 0) { + g_object_set( G_OBJECT(act), "label", _("New:"), NULL ); + } else if (n_selected == 1) { + g_object_set_data( tbl, "single", GINT_TO_POINTER(TRUE) ); + g_object_set( G_OBJECT(act), "label", _("Change:"), NULL ); + + if (repr) { + g_object_set_data( tbl, "repr", repr ); + Inkscape::GC::anchor(repr); + sp_repr_add_listener(repr, &arc_tb_repr_events, tbl); + sp_repr_synthesize_events(repr, &arc_tb_repr_events, tbl); + } + } else { + // FIXME: implement averaging of all parameters for multiple selected + //gtk_label_set_markup(GTK_LABEL(l), _("Average:")); + g_object_set( G_OBJECT(act), "label", _("Change:"), NULL ); + sp_arctb_sensitivize( tbl, 1, 0 ); + } +} + + +void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + EgeAdjustmentAction* eact = 0; + Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1); + + + { + EgeOutputAction* act = ege_output_action_new( "ArcStateAction", _("New:"), "", 0 ); + ege_output_action_set_use_markup( act, TRUE ); + gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); + g_object_set_data( holder, "mode_action", act ); + } + + /* Start */ + { + eact = create_adjustment_action( "ArcStartAction", + _("Start"), _("Start:"), + _("The angle (in degrees) from the horizontal to the arc's start point"), + "/tools/shapes/arc/start", 0.0, + GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, TRUE, "altx-arc", + -360.0, 360.0, 1.0, 10.0, + 0, 0, 0, + sp_arctb_start_value_changed); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + } + + /* End */ + { + eact = create_adjustment_action( "ArcEndAction", + _("End"), _("End:"), + _("The angle (in degrees) from the horizontal to the arc's end point"), + "/tools/shapes/arc/end", 0.0, + GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, FALSE, NULL, + -360.0, 360.0, 1.0, 10.0, + 0, 0, 0, + sp_arctb_end_value_changed); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + } + + /* Segments / Pie checkbox */ + { + GtkListStore* model = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); + + GtkTreeIter iter; + gtk_list_store_append( model, &iter ); + gtk_list_store_set( model, &iter, + 0, _("Closed arc"), + 1, _("Switch to segment (closed shape with two radii)"), + 2, INKSCAPE_ICON("draw-ellipse-segment"), + -1 ); + + gtk_list_store_append( model, &iter ); + gtk_list_store_set( model, &iter, + 0, _("Open Arc"), + 1, _("Switch to arc (unclosed shape)"), + 2, INKSCAPE_ICON("draw-ellipse-arc"), + -1 ); + + EgeSelectOneAction* act = ege_select_one_action_new( "ArcOpenAction", (""), (""), NULL, GTK_TREE_MODEL(model) ); + gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); + g_object_set_data( holder, "open_action", act ); + + ege_select_one_action_set_appearance( act, "full" ); + ege_select_one_action_set_radio_action_type( act, INK_RADIO_ACTION_TYPE ); + g_object_set( G_OBJECT(act), "icon-property", "iconId", NULL ); + ege_select_one_action_set_icon_column( act, 2 ); + ege_select_one_action_set_icon_size( act, secondarySize ); + ege_select_one_action_set_tooltip_column( act, 1 ); + + bool isClosed = !prefs->getBool("/tools/shapes/arc/open", false); + ege_select_one_action_set_active( act, isClosed ? 0 : 1 ); + g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_arctb_open_state_changed), holder ); + } + + /* Make Whole */ + { + InkAction* inky = ink_action_new( "ArcResetAction", + _("Make whole"), + _("Make the shape a whole ellipse, not arc or segment"), + INKSCAPE_ICON("draw-ellipse-whole"), + secondarySize ); + g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_arctb_defaults), holder ); + gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); + gtk_action_set_sensitive( GTK_ACTION(inky), TRUE ); + g_object_set_data( holder, "make_whole", inky ); + } + + g_object_set_data( G_OBJECT(holder), "single", GINT_TO_POINTER(TRUE) ); + // sensitivize make whole and open checkbox + { + GtkAdjustment *adj1 = GTK_ADJUSTMENT( g_object_get_data( holder, "start" ) ); + GtkAdjustment *adj2 = GTK_ADJUSTMENT( g_object_get_data( holder, "end" ) ); + sp_arctb_sensitivize( holder, gtk_adjustment_get_value(adj1), gtk_adjustment_get_value(adj2) ); + } + + + sigc::connection *connection = new sigc::connection( + sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_arc_toolbox_selection_changed), (GObject *)holder)) + ); + g_signal_connect( holder, "destroy", G_CALLBACK(delete_connection), connection ); + g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder ); +} + + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3 From 97507bc4eae716f9e4476c7d036096e3459970ef Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 28 May 2012 10:33:28 +0100 Subject: Build with GDK_DISABLE_DEPRECATED for Gtk+ 2 Fixed bugs: - https://launchpad.net/bugs/943207 (bzr r11431) --- src/widgets/arc-toolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index e59a20d30..a421ef481 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -28,6 +28,7 @@ # include "config.h" #endif +#include "ui/widget/spinbutton.h" #include "toolbox.h" #include "arc-toolbar.h" @@ -47,7 +48,6 @@ #include "../widgets/button.h" #include "../widgets/spinbutton-events.h" -#include "ui/widget/spinbutton.h" #include "../widgets/spw-utilities.h" #include "../widgets/widget-sizes.h" #include "../xml/node-event-vector.h" -- cgit v1.2.3 From aa042e930bc5cce596829086ce84f2c3c7c885ad Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 17 Jun 2012 00:08:03 -0700 Subject: Removed outdated classes. Pruned header to not introduce extraneous includes. (bzr r11502) --- src/widgets/arc-toolbar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index a421ef481..84434c88b 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -28,6 +28,8 @@ # include "config.h" #endif +#include + #include "ui/widget/spinbutton.h" #include "toolbox.h" #include "arc-toolbar.h" -- cgit v1.2.3 From 5da5121b9afaa8b2d1f0308dffc7d1e1b225b142 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 11 Nov 2012 12:46:25 +0000 Subject: Replace remaining C-style pointer casts for src/widgets (bzr r11868) --- src/widgets/arc-toolbar.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index 84434c88b..e96e4c097 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -92,7 +92,7 @@ static void sp_arctb_sensitivize( GObject *tbl, double v1, double v2 ) static void sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *value_name, gchar const *other_name) { - SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); + SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -128,8 +128,8 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v } sp_genericellipse_normalize(ge); - ((SPObject *)arc)->updateRepr(); - ((SPObject *)arc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + (SP_OBJECT(arc))->updateRepr(); + (SP_OBJECT(arc))->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); modmade = true; } @@ -163,7 +163,7 @@ static void sp_arctb_end_value_changed(GtkAdjustment *adj, GObject *tbl) static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) { - SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); + SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool("/tools/shapes/arc/open", ege_select_one_action_get_active(act) != 0); @@ -419,7 +419,7 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec sigc::connection *connection = new sigc::connection( - sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_arc_toolbox_selection_changed), (GObject *)holder)) + sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_arc_toolbox_selection_changed), G_OBJECT(holder))) ); g_signal_connect( holder, "destroy", G_CALLBACK(delete_connection), connection ); g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder ); -- cgit v1.2.3 From 0cdd007ebf8dcfbd39c1d36ab53f43617eb692df Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 25 Mar 2013 17:42:31 +0000 Subject: Workaround usage of deprecated glib symbols in 3rd party libraries Fixed bugs: - https://launchpad.net/bugs/1122774 (bzr r12243) --- src/widgets/arc-toolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index e96e4c097..809050ad9 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -28,9 +28,9 @@ # include "config.h" #endif +#include "ui/widget/spinbutton.h" #include -#include "ui/widget/spinbutton.h" #include "toolbox.h" #include "arc-toolbar.h" -- cgit v1.2.3 From 64bc8cf145b55d33469ef1b84e18ca8df580eda8 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 16 Jul 2013 20:42:12 -0400 Subject: Removed unused unit includes. (bzr r12380.1.10) --- src/widgets/arc-toolbar.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index 809050ad9..e3f3a8c79 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -56,14 +56,10 @@ #include "../xml/repr.h" #include "ui/uxmanager.h" #include "../ui/icon-names.h" -#include "../helper/unit-menu.h" -#include "../helper/units.h" -#include "../helper/unit-tracker.h" #include "../pen-context.h" #include "../sp-ellipse.h" #include "../mod360.h" -using Inkscape::UnitTracker; using Inkscape::UI::UXManager; using Inkscape::DocumentUndo; using Inkscape::UI::ToolboxFactory; -- cgit v1.2.3 From ef3bfa7e8bb2996c4042314accc34f6a72f072e1 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Fri, 19 Jul 2013 14:19:03 -0400 Subject: Removed "helper/unit-menu.h" from "widgest/toolbar.*" and associated files. (bzr r12380.1.30) --- src/widgets/arc-toolbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index e3f3a8c79..42f696bec 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -337,7 +337,7 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec _("Start"), _("Start:"), _("The angle (in degrees) from the horizontal to the arc's start point"), "/tools/shapes/arc/start", 0.0, - GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, TRUE, "altx-arc", + GTK_WIDGET(desktop->canvas), holder, TRUE, "altx-arc", -360.0, 360.0, 1.0, 10.0, 0, 0, 0, sp_arctb_start_value_changed); @@ -350,7 +350,7 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec _("End"), _("End:"), _("The angle (in degrees) from the horizontal to the arc's end point"), "/tools/shapes/arc/end", 0.0, - GTK_WIDGET(desktop->canvas), NULL/*us*/, holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, -360.0, 360.0, 1.0, 10.0, 0, 0, 0, sp_arctb_end_value_changed); -- cgit v1.2.3 From 2ed673e7554d0fd8b775978a0ef80c9aa529f7de Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Fri, 27 Sep 2013 01:45:12 +0200 Subject: Further refactored SPEllipse. (bzr r12601) --- src/widgets/arc-toolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index 42f696bec..c31c61e32 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -123,7 +123,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v ge->end = (gtk_adjustment_get_value(adj) * M_PI)/ 180; } - sp_genericellipse_normalize(ge); + ge->normalize(); (SP_OBJECT(arc))->updateRepr(); (SP_OBJECT(arc))->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); -- cgit v1.2.3 From f5d74fe46345673252807be3b6812bbb0469e457 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 8 Oct 2013 12:22:49 +0200 Subject: Seamlessly switch between SVG circle, ellipse, and path (arc) elements while using the Circle, Ellipse, and Arc tool. (bzr r12670) --- src/widgets/arc-toolbar.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index c31c61e32..5569780e7 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -112,10 +112,9 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v { SPItem *item = SP_ITEM(items->data); - if (SP_IS_ARC(item) && SP_IS_GENERICELLIPSE(item)) { + if (SP_IS_GENERICELLIPSE(item)) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); - SPArc *arc = SP_ARC(item); if (!strcmp(value_name, "start")) { ge->start = (gtk_adjustment_get_value(adj) * M_PI)/ 180; @@ -124,8 +123,8 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v } ge->normalize(); - (SP_OBJECT(arc))->updateRepr(); - (SP_OBJECT(arc))->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + (SP_OBJECT(ge))->updateRepr(); + (SP_OBJECT(ge))->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); modmade = true; } @@ -181,7 +180,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) items = items->next) { SPItem *item = reinterpret_cast(items->data); - if (SP_IS_ARC(item)) { + if (SP_IS_GENERICELLIPSE(item)) { Inkscape::XML::Node *repr = item->getRepr(); repr->setAttribute("sodipodi:open", "true"); item->updateRepr(); @@ -194,7 +193,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) items = items->next) { SPItem *item = reinterpret_cast(items->data); - if (SP_IS_ARC(item)) { + if (SP_IS_GENERICELLIPSE(item)) { Inkscape::XML::Node *repr = item->getRepr(); repr->setAttribute("sodipodi:open", NULL); item->updateRepr(); @@ -286,7 +285,7 @@ static void sp_arc_toolbox_selection_changed(Inkscape::Selection *selection, GOb items = items->next) { SPItem *item = reinterpret_cast(items->data); - if (SP_IS_ARC(item)) { + if (SP_IS_GENERICELLIPSE(item)) { n_selected++; repr = item->getRepr(); } -- cgit v1.2.3 From c04e30df241a3ee039077425bab9b9c37abe2854 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 9 Nov 2013 23:36:13 +0100 Subject: Moved and renamed some tool-related files. (bzr r12785) --- src/widgets/arc-toolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index 5569780e7..69b540762 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -56,7 +56,7 @@ #include "../xml/repr.h" #include "ui/uxmanager.h" #include "../ui/icon-names.h" -#include "../pen-context.h" +#include "ui/tools/pen-tool.h" #include "../sp-ellipse.h" #include "../mod360.h" -- cgit v1.2.3 From 7825ad6d1ac979689ac79d6497079aec36c6ae4b Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sun, 2 Mar 2014 23:58:28 +0100 Subject: Fixed includes for tools. (bzr r13097) --- src/widgets/arc-toolbar.cpp | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'src/widgets/arc-toolbar.cpp') diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index 69b540762..ca6810c81 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -28,37 +28,27 @@ # include "config.h" #endif -#include "ui/widget/spinbutton.h" #include -#include "toolbox.h" #include "arc-toolbar.h" - -#include "../desktop.h" -#include "../desktop-handles.h" +#include "desktop-handles.h" +#include "desktop.h" #include "document-undo.h" -#include "../verbs.h" -#include "../inkscape.h" -#include "../selection-chemistry.h" -#include "../selection.h" - -#include "../ege-adjustment-action.h" -#include "../ege-output-action.h" -#include "../ege-select-one-action.h" -#include "../ink-action.h" -#include "../ink-comboboxentry-action.h" - -#include "../widgets/button.h" -#include "../widgets/spinbutton-events.h" -#include "../widgets/spw-utilities.h" -#include "../widgets/widget-sizes.h" -#include "../xml/node-event-vector.h" -#include "../xml/repr.h" +#include "ege-adjustment-action.h" +#include "ege-output-action.h" +#include "ege-select-one-action.h" +#include "ink-action.h" +#include "mod360.h" +#include "preferences.h" +#include "selection.h" +#include "sp-ellipse.h" +#include "toolbox.h" +#include "ui/icon-names.h" #include "ui/uxmanager.h" -#include "../ui/icon-names.h" -#include "ui/tools/pen-tool.h" -#include "../sp-ellipse.h" -#include "../mod360.h" +#include "verbs.h" +#include "widgets/spinbutton-events.h" +#include "xml/node-event-vector.h" +#include "xml/repr.h" using Inkscape::UI::UXManager; using Inkscape::DocumentUndo; -- cgit v1.2.3