summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: adcfe29)
raw | patch | inline | side by side (parent: adcfe29)
author | Jon A. Cruz <jon@joncruz.org> | |
Mon, 12 Apr 2010 06:22:27 +0000 (23:22 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Mon, 12 Apr 2010 06:22:27 +0000 (23:22 -0700) |
src/widgets/toolbox.cpp | patch | blob | history |
index f12b2d1cb4609d859927948143984a6f8ef11d2e..bf12310923d010de43c89f1108b6c1b45dcee2b8 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* desktop );
-void setup_snap_toolbox (GtkWidget *toolbox, SPDesktop *desktop);
+static void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop);
-static void setup_tool_toolbox (GtkWidget *toolbox, SPDesktop *desktop);
-static void update_tool_toolbox (SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
+static void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop);
+static void update_tool_toolbox(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
-static void setup_aux_toolbox (GtkWidget *toolbox, SPDesktop *desktop);
-static void update_aux_toolbox (SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
+static void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop);
+static void update_aux_toolbox(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
-static void setup_commands_toolbox (GtkWidget *toolbox, SPDesktop *desktop);
-static void update_commands_toolbox (SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
+static void setup_commands_toolbox(GtkWidget *toolbox, SPDesktop *desktop);
+static void update_commands_toolbox(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
-GtkWidget * sp_toolbox_button_new_from_verb_with_doubleclick( GtkWidget *t, Inkscape::IconSize size, SPButtonType type,
- Inkscape::Verb *verb, Inkscape::Verb *doubleclick_verb,
- Inkscape::UI::View::View *view, GtkTooltips *tt);
+static GtkWidget * sp_toolbox_button_new_from_verb_with_doubleclick( GtkWidget *t, Inkscape::IconSize size, SPButtonType type,
+ Inkscape::Verb *verb, Inkscape::Verb *doubleclick_verb,
+ Inkscape::UI::View::View *view, GtkTooltips *tt);
class VerbAction : public Gtk::Action {
public:
*dropper_opacity_entry ; */
// should be made a private member once this is converted to class
-static void delete_connection(GObject */*obj*/, sigc::connection *connection) {
+static void delete_connection(GObject * /*obj*/, sigc::connection *connection)
+{
connection->disconnect();
delete connection;
}
// ------------------------------------------------------
+/**
+ * A simple mediator class that keeps UI controls matched to the preference values they set.
+ */
class PrefPusher : public Inkscape::Preferences::Observer
{
public:
+ /**
+ * Constructor for a boolean value that syncs to the supplied path.
+ * Initializes the widget to the current preference stored state and registers callbacks
+ * for widget changes and preference changes.
+ *
+ * @param act the widget to synchronize preference with.
+ * @param path the path to the preference the widget is synchronized with.
+ * @param callback function to invoke when changes are pushed.
+ * @param cbData data to be passed on to the callback function.
+ */
PrefPusher( GtkToggleAction *act, Glib::ustring const &path, void (*callback)(GObject*) = 0, GObject *cbData = 0 );
+
+ /**
+ * Destructor that unregisters the preference callback.
+ */
virtual ~PrefPusher();
+ /**
+ * Callback method invoked when the preference setting changes.
+ */
virtual void notify(Inkscape::Preferences::Entry const &new_val);
private:
+ /**
+ * Callback hook invoked when the widget changes.
+ *
+ * @param act the toggle action widget that was changed.
+ * @param self the PrefPusher instance the callback was registered to.
+ */
static void toggleCB( GtkToggleAction *act, PrefPusher *self );
+ /**
+ * Method to handle the widget change.
+ */
void handleToggled();
GtkToggleAction *act;
void (*callback)(GObject*);
GObject *cbData;
- bool hold;
+ bool freeze;
};
PrefPusher::PrefPusher( GtkToggleAction *act, Glib::ustring const &path, void (*callback)(GObject*), GObject *cbData ) :
@@ -707,12 +737,12 @@ PrefPusher::PrefPusher( GtkToggleAction *act, Glib::ustring const &path, void (*
act(act),
callback(callback),
cbData(cbData),
- hold(false)
+ freeze(false)
{
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggleCB), this);
- hold = true;
+ freeze = true;
gtk_toggle_action_set_active( act, Inkscape::Preferences::get()->getBool(observed_path, true) );
- hold = false;
+ freeze = false;
Inkscape::Preferences::get()->addObserver(*this);
}
void PrefPusher::handleToggled()
{
- if (!hold) {
- hold = true;
+ if (!freeze) {
+ freeze = true;
Inkscape::Preferences::get()->setBool(observed_path, gtk_toggle_action_get_active( act ));
if (callback) {
(*callback)(cbData);
}
- hold = false;
+ freeze = false;
}
}
bool newBool = newVal.getBool();
bool oldBool = gtk_toggle_action_get_active(act);
- if (!hold && (newBool != oldBool)) {
+ if (!freeze && (newBool != oldBool)) {
gtk_toggle_action_set_active( act, newBool );
}
}
// ------------------------------------------------------
-GtkWidget *
-sp_toolbox_button_new_from_verb_with_doubleclick(GtkWidget *t, Inkscape::IconSize size, SPButtonType type,
- Inkscape::Verb *verb, Inkscape::Verb *doubleclick_verb,
- Inkscape::UI::View::View *view, GtkTooltips *tt)
+GtkWidget * sp_toolbox_button_new_from_verb_with_doubleclick(GtkWidget *t, Inkscape::IconSize size, SPButtonType type,
+ Inkscape::Verb *verb, Inkscape::Verb *doubleclick_verb,
+ Inkscape::UI::View::View *view, GtkTooltips *tt)
{
SPAction *action = verb->get_action(view);
- if (!action) return NULL;
+ if (!action) {
+ return NULL;
+ }
SPAction *doubleclick_action;
- if (doubleclick_verb)
+ if (doubleclick_verb) {
doubleclick_action = doubleclick_verb->get_action(view);
- else
+ } else {
doubleclick_action = NULL;
+ }
/* fixme: Handle sensitive/unsensitive */
/* fixme: Implement sp_button_new_from_action */
}
}
-static void sp_action_action_set_sensitive (SPAction */*action*/, unsigned int sensitive, void *data)
+static void sp_action_action_set_sensitive(SPAction * /*action*/, unsigned int sensitive, void *data)
{
if ( data ) {
GtkAction* act = GTK_ACTION(data);
@@ -840,7 +872,7 @@ static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::Vi
return act;
}
-Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* desktop )
+static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* desktop )
{
Inkscape::UI::View::View *view = desktop;
gint verbsToUse[] = {
}
-void handlebox_detached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
+static void handlebox_detached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
{
gtk_widget_set_size_request( widget,
widget->allocation.width,
widget->allocation.height );
}
-void handlebox_attached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
+static void handlebox_attached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
{
gtk_widget_set_size_request( widget, -1, -1 );
}
* Will go away during tool refactoring. */
static InkNodeTool *get_node_tool()
{
- if (!SP_ACTIVE_DESKTOP) return NULL;
- SPEventContext *ec = SP_ACTIVE_DESKTOP->event_context;
- if (!INK_IS_NODE_TOOL(ec)) return NULL;
- return static_cast<InkNodeTool*>(ec);
+ InkNodeTool *tool = 0;
+ if (SP_ACTIVE_DESKTOP ) {
+ SPEventContext *ec = SP_ACTIVE_DESKTOP->event_context;
+ if (INK_IS_NODE_TOOL(ec)) {
+ tool = static_cast<InkNodeTool*>(ec);
+ }
+ }
+ return tool;
}
-void
-sp_node_path_edit_add(void)
+static void sp_node_path_edit_add(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_delete(void)
+static void sp_node_path_edit_delete(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_delete_segment(void)
+static void sp_node_path_edit_delete_segment(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_break(void)
+static void sp_node_path_edit_break(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_join(void)
+static void sp_node_path_edit_join(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_join_segment(void)
+static void sp_node_path_edit_join_segment(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_toline(void)
+static void sp_node_path_edit_toline(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_tocurve(void)
+static void sp_node_path_edit_tocurve(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_cusp(void)
+static void sp_node_path_edit_cusp(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_smooth(void)
+static void sp_node_path_edit_smooth(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_symmetrical(void)
+static void sp_node_path_edit_symmetrical(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-void
-sp_node_path_edit_auto(void)
+static void sp_node_path_edit_auto(void)
{
InkNodeTool *nt = get_node_tool();
if (nt) {
}
}
-static void toggle_show_transform_handles (GtkToggleAction *act, gpointer /*data*/) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool show = gtk_toggle_action_get_active( act );
- prefs->setBool("/tools/nodes/show_transform_handles", show);
-}
-
-static void toggle_show_handles (GtkToggleAction *act, gpointer /*data*/) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool show = gtk_toggle_action_get_active( act );
- prefs->setBool("/tools/nodes/show_handles", show);
-}
-
-static void toggle_show_helperpath (GtkToggleAction *act, gpointer /*data*/) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool show = gtk_toggle_action_get_active( act );
- prefs->setBool("/tools/nodes/show_outline", show);
-}
-
-void sp_node_path_edit_nextLPEparam (GtkAction */*act*/, gpointer data) {
+static void sp_node_path_edit_nextLPEparam(GtkAction * /*act*/, gpointer data) {
sp_selection_next_patheffect_param( reinterpret_cast<SPDesktop*>(data) );
}
-void toggle_edit_clip (GtkToggleAction *act, gpointer /*data*/) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool edit = gtk_toggle_action_get_active( act );
- prefs->setBool("/tools/nodes/edit_clipping_paths", edit);
-}
-
-void toggle_edit_mask (GtkToggleAction *act, gpointer /*data*/) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool edit = gtk_toggle_action_get_active( act );
- prefs->setBool("/tools/nodes/edit_masks", edit);
-}
-
/* is called when the node selection is modified */
-static void
-sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tbl)
+static void sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tbl)
{
GtkAction* xact = GTK_ACTION( g_object_get_data( tbl, "nodes_x_action" ) );
GtkAction* yact = GTK_ACTION( g_object_get_data( tbl, "nodes_y_action" ) );
Geom::Coord oldy = sp_units_get_pixels(gtk_adjustment_get_value(xadj), *unit);
Geom::Point mid = nt->_selected_nodes->pointwiseBounds()->midpoint();
- if (oldx != mid[Geom::X])
+ if (oldx != mid[Geom::X]) {
gtk_adjustment_set_value(xadj, sp_pixels_get_units(mid[Geom::X], *unit));
- if (oldy != mid[Geom::Y])
+ }
+ if (oldy != mid[Geom::Y]) {
gtk_adjustment_set_value(yadj, sp_pixels_get_units(mid[Geom::Y], *unit));
+ }
}
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
-static void
-sp_node_path_value_changed(GtkAdjustment *adj, GObject *tbl, Geom::Dim2 d)
+static void sp_node_path_value_changed(GtkAdjustment *adj, GObject *tbl, Geom::Dim2 d)
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
-static void
-sp_node_path_x_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_node_path_x_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_node_path_value_changed(adj, tbl, Geom::X);
}
-static void
-sp_node_path_y_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_node_path_y_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_node_path_value_changed(adj, tbl, Geom::Y);
}
-void
-sp_node_toolbox_sel_changed (Inkscape::Selection *selection, GObject *tbl)
+static void sp_node_toolbox_sel_changed(Inkscape::Selection *selection, GObject *tbl)
{
{
GtkAction* w = GTK_ACTION( g_object_get_data( tbl, "nodes_lpeedit" ) );
}
}
-void
-sp_node_toolbox_sel_modified (Inkscape::Selection *selection, guint /*flags*/, GObject *tbl)
+static void sp_node_toolbox_sel_modified(Inkscape::Selection *selection, guint /*flags*/, GObject *tbl)
{
sp_node_toolbox_sel_changed (selection, tbl);
}
@@ -1366,34 +1356,8 @@ sp_node_toolbox_sel_modified (Inkscape::Selection *selection, guint /*flags*/, G
//## Node Editing Toolbox ##
//################################
-class ShowHandlesObserver
- : public Inkscape::Preferences::Observer
-{
-public:
- ShowHandlesObserver(InkToggleAction *act)
- : Inkscape::Preferences::Observer("/tools/nodes/show_handles")
- , _act(act)
- {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->addObserver(*this);
- }
- ~ShowHandlesObserver() {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->removeObserver(*this);
- }
- virtual void notify(Inkscape::Preferences::Entry const &v) {
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(_act), v.getBool());
- }
- static void destroy(ShowHandlesObserver *s, InkToggleAction *) {
- delete s;
- }
-private:
- InkToggleAction *_act;
-};
-
static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units );
g_object_set_data( holder, "tracker", tracker );
@@ -1531,8 +1495,8 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
"node-transform",
secondarySize );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
- g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_show_transform_handles), desktop );
- gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/nodes/show_transform_handles", false) );
+ PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/nodes/show_transform_handles");
+ g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
}
{
@@ -1542,10 +1506,8 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
INKSCAPE_ICON_SHOW_NODE_HANDLES,
secondarySize );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
- g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_show_handles), desktop );
- gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/nodes/show_handles", true) );
- ShowHandlesObserver *s = new ShowHandlesObserver(act);
- g_object_weak_ref(G_OBJECT(act), (GWeakNotify) ShowHandlesObserver::destroy, (gpointer) s);
+ PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/nodes/show_handles");
+ g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
}
{
@@ -1555,8 +1517,8 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
INKSCAPE_ICON_SHOW_PATH_OUTLINE,
secondarySize );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
- g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_show_helperpath), desktop );
- gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/nodes/show_outline", false) );
+ PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/nodes/show_outline");
+ g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
}
{
@@ -1577,8 +1539,8 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
INKSCAPE_ICON_PATH_CLIP_EDIT,
secondarySize );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
- g_signal_connect_after( G_OBJECT(inky), "toggled", G_CALLBACK(toggle_edit_clip), desktop );
- gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(inky), prefs->getBool("/tools/nodes/edit_clipping_paths") );
+ PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(inky), "/tools/nodes/edit_clipping_paths");
+ g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
}
{
@@ -1588,8 +1550,8 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
INKSCAPE_ICON_PATH_MASK_EDIT,
secondarySize );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
- g_signal_connect_after( G_OBJECT(inky), "toggled", G_CALLBACK(toggle_edit_mask), desktop );
- gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(inky), prefs->getBool("/tools/nodes/edit_masks") );
+ PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(inky), "/tools/nodes/edit_masks");
+ g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
}
/* X coord of selected node(s) */
@@ -1665,7 +1627,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
//## Zoom Toolbox ##
//########################
-static void sp_zoom_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/)
+static void sp_zoom_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/)
{
// no custom GtkAction setup needed
} // end of sp_zoom_toolbox_prep()
@@ -1870,8 +1832,7 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati
}
}
-static void
-setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
+void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
{
gchar const * descr =
"<ui>"
"/toolbox/tools/small");
}
-static void
-update_tool_toolbox( SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget */*toolbox*/ )
+void update_tool_toolbox( SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget * /*toolbox*/ )
{
gchar const *const tname = ( eventcontext
? gtk_type_name(GTK_OBJECT_TYPE(eventcontext))
@@ -1924,8 +1884,7 @@ update_tool_toolbox( SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget
}
}
-static void
-setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
+void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
GtkSizeGroup* grouper = gtk_size_group_new( GTK_SIZE_GROUP_BOTH );
g_object_unref( G_OBJECT(grouper) );
}
-static void
-update_aux_toolbox(SPDesktop */*desktop*/, SPEventContext *eventcontext, GtkWidget *toolbox)
+void update_aux_toolbox(SPDesktop * /*desktop*/, SPEventContext *eventcontext, GtkWidget *toolbox)
{
gchar const *tname = ( eventcontext
? gtk_type_name(GTK_OBJECT_TYPE(eventcontext))
@@ -2026,8 +1984,7 @@ update_aux_toolbox(SPDesktop */*desktop*/, SPEventContext *eventcontext, GtkWidg
}
}
-static void
-setup_commands_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
+void setup_commands_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
{
gchar const * descr =
"<ui>"
"/toolbox/small" );
}
-static void
-update_commands_toolbox(SPDesktop */*desktop*/, SPEventContext */*eventcontext*/, GtkWidget */*toolbox*/)
+void update_commands_toolbox(SPDesktop * /*desktop*/, SPEventContext * /*eventcontext*/, GtkWidget * /*toolbox*/)
{
}
-void toggle_snap_callback (GtkToggleAction *act, gpointer data) { //data points to the toolbox
-
+static void toggle_snap_callback(GtkToggleAction *act, gpointer data) //data points to the toolbox
+{
if (g_object_get_data(G_OBJECT(data), "freeze" )) {
return;
}
return name;
}
-void ToolboxFactory::updateSnapToolbox(SPDesktop *desktop, SPEventContext */*eventcontext*/, GtkWidget *toolbox)
+void ToolboxFactory::updateSnapToolbox(SPDesktop *desktop, SPEventContext * /*eventcontext*/, GtkWidget *toolbox)
{
g_assert(desktop != NULL);
g_assert(toolbox != NULL);
@@ -2578,8 +2534,10 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu
modmade = true;
}
}
- if (modmade) sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- _("Star: Change number of corners"));
+ if (modmade) {
+ sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
+ _("Star: Change number of corners"));
+ }
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
}
@@ -2623,8 +2581,10 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl
}
}
- if (modmade) sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- _("Star: Change spoke ratio"));
+ if (modmade) {
+ sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
+ _("Star: Change spoke ratio"));
+ }
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
}
@@ -2702,8 +2662,10 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg
modmade = true;
}
}
- if (modmade) sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- _("Star: Change rounding"));
+ if (modmade) {
+ sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
+ _("Star: Change rounding"));
+ }
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
}
@@ -2737,15 +2699,17 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl
modmade = true;
}
}
- if (modmade) sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
- _("Star: Change randomization"));
+ if (modmade) {
+ sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_STAR,
+ _("Star: Change randomization"));
+ }
g_object_set_data( dataKludge, "freeze", GINT_TO_POINTER(FALSE) );
}
static void star_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name,
- gchar const */*old_value*/, gchar const */*new_value*/,
+ gchar const * /*old_value*/, gchar const * /*new_value*/,
bool /*is_interactive*/, gpointer data)
{
GtkWidget *tbl = GTK_WIDGET(data);
@@ -2850,7 +2814,7 @@ sp_star_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
}
-static void sp_stb_defaults( GtkWidget */*widget*/, GObject *dataKludge )
+static void sp_stb_defaults( GtkWidget * /*widget*/, GObject *dataKludge )
{
// FIXME: in this and all other _default functions, set some flag telling the value_changed
// callbacks to lump all the changes for all selected objects in one undo step
}
-void
-sp_toolbox_add_label(GtkWidget *tbl, gchar const *title, bool wide)
+// public:
+void sp_toolbox_add_label(GtkWidget *tbl, gchar const *title, bool wide)
{
GtkWidget *boxl = gtk_hbox_new(FALSE, 0);
- if (wide) gtk_widget_set_size_request(boxl, MODE_LABEL_WIDTH, -1);
+ if (wide) {
+ gtk_widget_set_size_request(boxl, MODE_LABEL_WIDTH, -1);
+ }
GtkWidget *l = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(l), title);
gtk_box_pack_end(GTK_BOX(boxl), l, FALSE, FALSE, 0);
}
-static void
-sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *value_name,
- void (*setter)(SPRect *, gdouble))
+static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *value_name,
+ void (*setter)(SPRect *, gdouble))
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
@@ -3110,34 +3075,29 @@ sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *value_name,
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
-static void
-sp_rtb_rx_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_rtb_rx_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_rtb_value_changed(adj, tbl, "rx", sp_rect_set_visible_rx);
}
-static void
-sp_rtb_ry_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_rtb_ry_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_rtb_value_changed(adj, tbl, "ry", sp_rect_set_visible_ry);
}
-static void
-sp_rtb_width_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_rtb_width_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_rtb_value_changed(adj, tbl, "width", sp_rect_set_visible_width);
}
-static void
-sp_rtb_height_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_rtb_height_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_rtb_value_changed(adj, tbl, "height", sp_rect_set_visible_height);
}
-static void
-sp_rtb_defaults( GtkWidget */*widget*/, GObject *obj)
+static void sp_rtb_defaults( GtkWidget * /*widget*/, GObject *obj)
{
GtkAdjustment *adj = 0;
sp_rtb_sensitivize( obj );
}
-static void rect_tb_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar const */*name*/,
- gchar const */*old_value*/, gchar const */*new_value*/,
+static void rect_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);
/**
* \param selection should not be NULL.
*/
-static void
-sp_rect_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
+static void sp_rect_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
{
int n_selected = 0;
Inkscape::XML::Node *repr = NULL;
return angle;
}
-static void
-box3d_set_button_and_adjustment(Persp3D *persp, Proj::Axis axis,
- GtkAdjustment *adj, GtkAction *act, GtkToggleAction *tact) {
+static void box3d_set_button_and_adjustment(Persp3D *persp,
+ Proj::Axis axis,
+ GtkAdjustment *adj,
+ GtkAction *act,
+ GtkToggleAction *tact)
+{
// TODO: Take all selected perspectives into account but don't touch the state button if not all of them
// have the same state (otherwise a call to box3d_vp_z_state_changed() is triggered and the states
// are reset).
}
}
-static void
-box3d_resync_toolbar(Inkscape::XML::Node *persp_repr, GObject *data) {
+static void box3d_resync_toolbar(Inkscape::XML::Node *persp_repr, GObject *data)
+{
if (!persp_repr) {
g_print ("No perspective given to box3d_resync_toolbar().\n");
return;
}
}
-static void box3d_persp_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const */*name*/,
- gchar const */*old_value*/, gchar const */*new_value*/,
- bool /*is_interactive*/, gpointer data)
+static void box3d_persp_tb_event_attr_changed(Inkscape::XML::Node *repr,
+ gchar const * /*name*/,
+ gchar const * /*old_value*/,
+ gchar const * /*new_value*/,
+ bool /*is_interactive*/,
+ gpointer data)
{
GtkWidget *tbl = GTK_WIDGET(data);
*/
// FIXME: This should rather be put into persp3d-reference.cpp or something similar so that it reacts upon each
// Change of the perspective, and not of the current selection (but how to refer to the toolbar then?)
-static void
-box3d_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
+static void box3d_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
{
// Here the following should be done: If all selected boxes have finite VPs in a certain direction,
// disable the angle entry fields for this direction (otherwise entering a value in them should only
}
}
-static void
-box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, Proj::Axis axis)
+static void box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, Proj::Axis axis)
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" );
SPDocument *document = sp_desktop_document(desktop);
@@ -3563,26 +3526,23 @@ box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, Proj::Axis ax
}
-static void
-box3d_angle_x_value_changed(GtkAdjustment *adj, GObject *dataKludge)
+static void box3d_angle_x_value_changed(GtkAdjustment *adj, GObject *dataKludge)
{
box3d_angle_value_changed(adj, dataKludge, Proj::X);
}
-static void
-box3d_angle_y_value_changed(GtkAdjustment *adj, GObject *dataKludge)
+static void box3d_angle_y_value_changed(GtkAdjustment *adj, GObject *dataKludge)
{
box3d_angle_value_changed(adj, dataKludge, Proj::Y);
}
-static void
-box3d_angle_z_value_changed(GtkAdjustment *adj, GObject *dataKludge)
+static void box3d_angle_z_value_changed(GtkAdjustment *adj, GObject *dataKludge)
{
box3d_angle_value_changed(adj, dataKludge, Proj::Z);
}
-static void box3d_vp_state_changed( GtkToggleAction *act, GtkAction */*box3d_angle*/, Proj::Axis axis )
+static void box3d_vp_state_changed( GtkToggleAction *act, GtkAction * /*box3d_angle*/, Proj::Axis axis )
{
// TODO: Take all selected perspectives into account
std::list<Persp3D *> sel_persps = sp_desktop_selection(inkscape_active_desktop())->perspList();
@@ -3751,8 +3711,7 @@ static void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions,
//## Spiral ##
//########################
-static void
-sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustring const &value_name)
+static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustring const &value_name)
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
@@ -3794,26 +3753,22 @@ sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustring const &v
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
-static void
-sp_spl_tb_revolution_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_spl_tb_revolution_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_spl_tb_value_changed(adj, tbl, "revolution");
}
-static void
-sp_spl_tb_expansion_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_spl_tb_expansion_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_spl_tb_value_changed(adj, tbl, "expansion");
}
-static void
-sp_spl_tb_t0_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_spl_tb_t0_value_changed(GtkAdjustment *adj, GObject *tbl)
{
sp_spl_tb_value_changed(adj, tbl, "t0");
}
-static void
-sp_spl_tb_defaults(GtkWidget */*widget*/, GtkObject *obj)
+static void sp_spl_tb_defaults(GtkWidget * /*widget*/, GtkObject *obj)
{
GtkWidget *tbl = GTK_WIDGET(obj);
}
-static void spiral_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const */*name*/,
- gchar const */*old_value*/, gchar const */*new_value*/,
- bool /*is_interactive*/, gpointer data)
+static void spiral_tb_event_attr_changed(Inkscape::XML::Node *repr,
+ gchar const * /*name*/,
+ gchar const * /*old_value*/,
+ gchar const * /*new_value*/,
+ bool /*is_interactive*/,
+ gpointer data)
{
GtkWidget *tbl = GTK_WIDGET(data);
NULL /* order_changed */
};
-static void
-sp_spiral_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
+static void sp_spiral_toolbox_selection_changed(Inkscape::Selection *selection, GObject *tbl)
{
int n_selected = 0;
Inkscape::XML::Node *repr = NULL;
@@ -3993,8 +3950,7 @@ static void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
//########################
/* This is used in generic functions below to share large portions of code between pen and pencil tool */
-static Glib::ustring const
-freehand_tool_name(GObject *dataKludge)
+static Glib::ustring const freehand_tool_name(GObject *dataKludge)
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data(dataKludge, "desktop");
return ( tools_isactive(desktop, TOOLS_FREEHAND_PEN)
@@ -4089,7 +4045,7 @@ static void freehand_change_shape(EgeSelectOneAction* act, GObject *dataKludge)
/**
* \brief Generate the list of freehand advanced shape option entries.
*/
-GList * freehand_shape_dropdown_items_list() {
+static GList * freehand_shape_dropdown_items_list() {
GList *glist = NULL;
glist = g_list_append (glist, _("None"));
return glist;
}
-static void
-freehand_add_advanced_shape_options(GtkActionGroup* mainActions, GObject* holder, bool tool_is_pencil) {
+static void freehand_add_advanced_shape_options(GtkActionGroup* mainActions, GObject* holder, bool tool_is_pencil)
+{
/*advanced shape options */
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -4131,15 +4087,14 @@ freehand_add_advanced_shape_options(GtkActionGroup* mainActions, GObject* holder
}
}
-static void sp_pen_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* mainActions, GObject* holder)
+static void sp_pen_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainActions, GObject* holder)
{
sp_add_freehand_mode_toggle(mainActions, holder, false);
freehand_add_advanced_shape_options(mainActions, holder, false);
}
-static void
-sp_pencil_tb_defaults(GtkWidget */*widget*/, GtkObject *obj)
+static void sp_pencil_tb_defaults(GtkWidget * /*widget*/, GtkObject *obj)
{
GtkWidget *tbl = GTK_WIDGET(obj);
spinbutton_defocus(GTK_OBJECT(tbl));
}
-static void
-sp_pencil_tb_tolerance_value_changed(GtkAdjustment *adj, GObject *tbl)
+static void sp_pencil_tb_tolerance_value_changed(GtkAdjustment *adj, GObject *tbl)
{
// quit if run by the attr_changed listener
if (g_object_get_data( tbl, "freeze" )) {
@@ -4247,13 +4201,13 @@ static void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
//## Tweak ##
//########################
-static void sp_tweak_width_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_tweak_width_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/tweak/width", adj->value * 0.01 );
}
-static void sp_tweak_force_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_tweak_force_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/tweak/force", adj->value * 0.01 );
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt("/tools/tweak/mode", mode);
- GtkAction *doh = GTK_ACTION(g_object_get_data( tbl, "tweak_doh"));
- GtkAction *dos = GTK_ACTION(g_object_get_data( tbl, "tweak_dos"));
- GtkAction *dol = GTK_ACTION(g_object_get_data( tbl, "tweak_dol"));
- GtkAction *doo = GTK_ACTION(g_object_get_data( tbl, "tweak_doo"));
+ static gchar const* names[] = {"tweak_doh", "tweak_dos", "tweak_dol", "tweak_doo", "tweak_channels_label"};
+ bool flag = ((mode == TWEAK_MODE_COLORPAINT) || (mode == TWEAK_MODE_COLORJITTER));
+ for (size_t i = 0; i < G_N_ELEMENTS(names); ++i) {
+ GtkAction *act = GTK_ACTION(g_object_get_data( tbl, names[i] ));
+ if (act) {
+ gtk_action_set_sensitive(act, flag);
+ }
+ }
GtkAction *fid = GTK_ACTION(g_object_get_data( tbl, "tweak_fidelity"));
- GtkAction *dolabel = GTK_ACTION(g_object_get_data( tbl, "tweak_channels_label"));
- if (mode == TWEAK_MODE_COLORPAINT || mode == TWEAK_MODE_COLORJITTER) {
- if (doh) gtk_action_set_sensitive (doh, TRUE);
- if (dos) gtk_action_set_sensitive (dos, TRUE);
- if (dol) gtk_action_set_sensitive (dol, TRUE);
- if (doo) gtk_action_set_sensitive (doo, TRUE);
- if (dolabel) gtk_action_set_sensitive (dolabel, TRUE);
- if (fid) gtk_action_set_sensitive (fid, FALSE);
- } else {
- if (doh) gtk_action_set_sensitive (doh, FALSE);
- if (dos) gtk_action_set_sensitive (dos, FALSE);
- if (dol) gtk_action_set_sensitive (dol, FALSE);
- if (doo) gtk_action_set_sensitive (doo, FALSE);
- if (dolabel) gtk_action_set_sensitive (dolabel, FALSE);
- if (fid) gtk_action_set_sensitive (fid, TRUE);
+ if (fid) {
+ gtk_action_set_sensitive(fid, !flag);
}
}
-static void sp_tweak_fidelity_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_tweak_fidelity_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/tweak/fidelity", adj->value * 0.01 );
}
-static void tweak_toggle_doh (GtkToggleAction *act, gpointer /*data*/) {
+static void tweak_toggle_doh(GtkToggleAction *act, gpointer /*data*/) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/tweak/doh", gtk_toggle_action_get_active(act));
}
-static void tweak_toggle_dos (GtkToggleAction *act, gpointer /*data*/) {
+static void tweak_toggle_dos(GtkToggleAction *act, gpointer /*data*/) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/tweak/dos", gtk_toggle_action_get_active(act));
}
-static void tweak_toggle_dol (GtkToggleAction *act, gpointer /*data*/) {
+static void tweak_toggle_dol(GtkToggleAction *act, gpointer /*data*/) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/tweak/dol", gtk_toggle_action_get_active(act));
}
-static void tweak_toggle_doo (GtkToggleAction *act, gpointer /*data*/) {
+static void tweak_toggle_doo(GtkToggleAction *act, gpointer /*data*/) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/tweak/doo", gtk_toggle_action_get_active(act));
}
@@ -4477,8 +4422,9 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
EgeOutputAction* act = ege_output_action_new( "TweakChannelsLabel", _("Channels:"), "", 0 );
ege_output_action_set_use_markup( act, TRUE );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
- if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+ if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER) {
gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+ }
g_object_set_data( holder, "tweak_channels_label", act);
}
@@ -4493,8 +4439,9 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(tweak_toggle_doh), desktop );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/tweak/doh", true) );
- if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+ if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER) {
gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+ }
g_object_set_data( holder, "tweak_doh", act);
}
{
@@ -4508,8 +4455,9 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(tweak_toggle_dos), desktop );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/tweak/dos", true) );
- if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+ if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER) {
gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+ }
g_object_set_data( holder, "tweak_dos", act );
}
{
@@ -4523,8 +4471,9 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(tweak_toggle_dol), desktop );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/tweak/dol", true) );
- if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+ if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER) {
gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+ }
g_object_set_data( holder, "tweak_dol", act );
}
{
@@ -4538,8 +4487,9 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(tweak_toggle_doo), desktop );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/tweak/doo", true) );
- if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER)
+ if (mode != TWEAK_MODE_COLORPAINT && mode != TWEAK_MODE_COLORJITTER) {
gtk_action_set_sensitive (GTK_ACTION(act), FALSE);
+ }
g_object_set_data( holder, "tweak_doo", act );
}
@@ -4556,8 +4506,9 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
sp_tweak_fidelity_value_changed, 0.01, 0, 100 );
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
- if (mode == TWEAK_MODE_COLORPAINT || mode == TWEAK_MODE_COLORJITTER)
+ if (mode == TWEAK_MODE_COLORPAINT || mode == TWEAK_MODE_COLORJITTER) {
gtk_action_set_sensitive (GTK_ACTION(eact), FALSE);
+ }
g_object_set_data( holder, "tweak_fidelity", eact );
}
@@ -4581,19 +4532,19 @@ static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
//## Spray ##
//########################
-static void sp_spray_width_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_spray_width_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/spray/width", adj->value );
}
-static void sp_spray_mean_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_spray_mean_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/spray/mean", adj->value );
}
-static void sp_spray_standard_deviation_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_spray_standard_deviation_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/spray/standard_deviation", adj->value );
@@ -4605,26 +4556,26 @@ static void sp_spray_pressure_state_changed( GtkToggleAction *act, gpointer /*da
prefs->setBool("/tools/spray/usepressure", gtk_toggle_action_get_active(act));
}
-static void sp_spray_mode_changed( EgeSelectOneAction *act, GObject */*tbl*/ )
+static void sp_spray_mode_changed( EgeSelectOneAction *act, GObject * /*tbl*/ )
{
int mode = ege_select_one_action_get_active( act );
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt("/tools/spray/mode", mode);
}
-static void sp_spray_population_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_spray_population_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/spray/population", adj->value );
}
-static void sp_spray_rotation_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_spray_rotation_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/spray/rotation_variation", adj->value );
}
-static void sp_spray_scale_value_changed( GtkAdjustment *adj, GObject */*tbl*/ )
+static void sp_spray_scale_value_changed( GtkAdjustment *adj, GObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble( "/tools/spray/scale_variation", adj->value );
@@ -4802,11 +4753,12 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
//########################
//## Calligraphy ##
//########################
-static void update_presets_list (GObject *tbl)
+static void update_presets_list(GObject *tbl)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- if (g_object_get_data(tbl, "presets_blocked"))
+ if (g_object_get_data(tbl, "presets_blocked")) {
return;
+ }
EgeSelectOneAction *sel = static_cast<EgeSelectOneAction *>(g_object_get_data(tbl, "profile_selector"));
if (!sel) {
std::vector<Inkscape::Preferences::Entry> preset = prefs->getAllEntries(*i);
for (std::vector<Inkscape::Preferences::Entry>::iterator j = preset.begin(); j != preset.end(); ++j) {
Glib::ustring entry_name = j->getEntryName();
- if (entry_name == "id" || entry_name == "name") continue;
+ if (entry_name == "id" || entry_name == "name") {
+ continue;
+ }
void *widget = g_object_get_data(tbl, entry_name.data());
if (widget) {
update_presets_list (tbl);
}
-static void sp_dcc_save_profile (GtkWidget */*widget*/, GObject *tbl)
+static void sp_dcc_save_profile(GtkWidget * /*widget*/, GObject *tbl)
{
using Inkscape::UI::Dialog::CalligraphicProfileRename;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
SPDesktop *desktop = (SPDesktop *) g_object_get_data(tbl, "desktop" );
- if (! desktop) return;
+ if (! desktop) {
+ return;
+ }
- if (g_object_get_data(tbl, "presets_blocked"))
+ if (g_object_get_data(tbl, "presets_blocked")) {
return;
+ }
CalligraphicProfileRename::show(desktop);
if ( !CalligraphicProfileRename::applied()) {
}
-static void sp_ddc_change_profile(EgeSelectOneAction* act, GObject* tbl) {
-
+static void sp_ddc_change_profile(EgeSelectOneAction* act, GObject* tbl)
+{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint preset_index = ege_select_one_action_get_active( act );
// This is necessary because EgeSelectOneAction spams us with GObject "changed" signal calls
// even when the preset is not changed. It would be good to replace it with something more
// modern. Index 0 means "No preset", so we don't do anything.
- if (preset_index == 0) return;
+ if (preset_index == 0) {
+ return;
+ }
gint save_presets_index = GPOINTER_TO_INT(g_object_get_data(tbl, "save_presets_index"));
return;
}
- if (g_object_get_data(tbl, "presets_blocked"))
+ if (g_object_get_data(tbl, "presets_blocked")) {
return;
+ }
// preset_index is one-based so we subtract 1
std::vector<Glib::ustring> presets = prefs->getAllDirs("/tools/calligraphic/preset");
// Shouldn't this be std::map?
for (std::vector<Inkscape::Preferences::Entry>::iterator i = preset.begin(); i != preset.end(); ++i) {
Glib::ustring entry_name = i->getEntryName();
- if (entry_name == "id" || entry_name == "name") continue;
+ if (entry_name == "id" || entry_name == "name") {
+ continue;
+ }
void *widget = g_object_get_data(tbl, entry_name.data());
if (widget) {
if (GTK_IS_ADJUSTMENT(widget)) {
@@ -5368,10 +5330,11 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v
SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
SPArc *arc = SP_ARC(item);
- if (!strcmp(value_name, "start"))
+ if (!strcmp(value_name, "start")) {
ge->start = (adj->value * M_PI)/ 180;
- else
+ } else {
ge->end = (adj->value * M_PI)/ 180;
+ }
sp_genericellipse_normalize(ge);
((SPObject *)arc)->updateRepr();
@@ -5442,7 +5405,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl )
items != NULL;
items = items->next)
{
- if (SP_IS_ARC((SPItem *) items->data)) {
+ if (SP_IS_ARC((SPItem *) items->data)) {
Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) items->data);
repr->setAttribute("sodipodi:open", NULL);
SP_OBJECT((SPItem *) items->data)->updateRepr();
spinbutton_defocus( GTK_OBJECT(obj) );
}
-static void arc_tb_event_attr_changed(Inkscape::XML::Node *repr, gchar const */*name*/,
- gchar const */*old_value*/, gchar const */*new_value*/,
+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);
@@ -5675,7 +5638,8 @@ static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions,
//## Dropper ##
//########################
-static void toggle_dropper_pick_alpha( GtkToggleAction* act, gpointer tbl ) {
+static void toggle_dropper_pick_alpha( GtkToggleAction* act, gpointer tbl )
+{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt( "/tools/dropper/pick", gtk_toggle_action_get_active( act ) );
GtkAction* set_action = GTK_ACTION( g_object_get_data(G_OBJECT(tbl), "set_action") );
spinbutton_defocus(GTK_OBJECT(tbl));
}
-static void toggle_dropper_set_alpha( GtkToggleAction* act, gpointer tbl ) {
+static void toggle_dropper_set_alpha( GtkToggleAction* act, gpointer tbl )
+{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool( "/tools/dropper/setalpha", gtk_toggle_action_get_active( act ) );
spinbutton_defocus(GTK_OBJECT(tbl));
* TODO: Add queue of last 5 or so colors selected with new swatches so that
* can drag and drop places. Will provide a nice mixing palette.
*/
-static void sp_dropper_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* mainActions, GObject* holder)
+static void sp_dropper_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainActions, GObject* holder)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint pickAlpha = prefs->getInt( "/tools/dropper/pick", 1 );
}
}
-void sp_lpetool_toolbox_sel_modified(Inkscape::Selection *selection, guint /*flags*/, GObject */*tbl*/)
+static void sp_lpetool_toolbox_sel_modified(Inkscape::Selection *selection, guint /*flags*/, GObject * /*tbl*/)
{
SPEventContext *ec = selection->desktop()->event_context;
- if (!SP_IS_LPETOOL_CONTEXT(ec))
- return;
-
- lpetool_update_measuring_items(SP_LPETOOL_CONTEXT(ec));
+ if (SP_IS_LPETOOL_CONTEXT(ec)) {
+ lpetool_update_measuring_items(SP_LPETOOL_CONTEXT(ec));
+ }
}
-void
-sp_lpetool_toolbox_sel_changed(Inkscape::Selection *selection, GObject *tbl)
+static void sp_lpetool_toolbox_sel_changed(Inkscape::Selection *selection, GObject *tbl)
{
using namespace Inkscape::LivePathEffect;
SPEventContext *ec = selection->desktop()->event_context;
- if (!SP_IS_LPETOOL_CONTEXT(ec))
+ if (!SP_IS_LPETOOL_CONTEXT(ec)) {
return;
+ }
SPLPEToolContext *lc = SP_LPETOOL_CONTEXT(ec);
lpetool_delete_measuring_items(lc);
}
}
-static void
-lpetool_toggle_show_bbox (GtkToggleAction *act, gpointer data) {
+static void lpetool_toggle_show_bbox(GtkToggleAction *act, gpointer data) {
SPDesktop *desktop = static_cast<SPDesktop *>(data);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
}
}
-static void
-lpetool_toggle_show_measuring_info (GtkToggleAction *act, GObject *tbl) {
+static void lpetool_toggle_show_measuring_info(GtkToggleAction *act, GObject *tbl)
+{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(tbl, "desktop"));
- if (!tools_isactive(desktop, TOOLS_LPETOOL))
+ if (!tools_isactive(desktop, TOOLS_LPETOOL)) {
return;
+ }
GtkAction *unitact = static_cast<GtkAction*>(g_object_get_data(tbl, "lpetool_units_action"));
SPLPEToolContext *lc = SP_LPETOOL_CONTEXT(desktop->event_context);
}
}
-static void lpetool_unit_changed(GtkAction* /*act*/, GObject* tbl) {
+static void lpetool_unit_changed(GtkAction* /*act*/, GObject* tbl)
+{
UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(tbl, "tracker"));
SPUnit const *unit = tracker->getActiveUnit();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
}
}
-static void
-lpetool_toggle_set_bbox (GtkToggleAction *act, gpointer data) {
+static void lpetool_toggle_set_bbox(GtkToggleAction *act, gpointer data)
+{
SPDesktop *desktop = static_cast<SPDesktop *>(data);
Inkscape::Selection *selection = desktop->selection;
gtk_toggle_action_set_active(act, false);
}
-static void
-sp_line_segment_build_list(GObject *tbl)
+static void sp_line_segment_build_list(GObject *tbl)
{
g_object_set_data(tbl, "line_segment_list_blocked", GINT_TO_POINTER(TRUE));
g_object_set_data(tbl, "line_segment_list_blocked", GINT_TO_POINTER(FALSE));
}
-static void
-sp_lpetool_change_line_segment_type(EgeSelectOneAction* act, GObject* tbl) {
+static void sp_lpetool_change_line_segment_type(EgeSelectOneAction* act, GObject* tbl)
+{
using namespace Inkscape::LivePathEffect;
// quit if run by the attr_changed listener
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
-static void
-lpetool_open_lpe_dialog (GtkToggleAction *act, gpointer data) {
+static void lpetool_open_lpe_dialog(GtkToggleAction *act, gpointer data)
+{
SPDesktop *desktop = static_cast<SPDesktop *>(data);
if (tools_isactive(desktop, TOOLS_LPETOOL)) {
@@ -6198,40 +6162,34 @@ static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
//## Text Toolbox ##
//########################
/*
-static void
-sp_text_letter_changed(GtkAdjustment *adj, GtkWidget *tbl)
+static void sp_text_letter_changed(GtkAdjustment *adj, GtkWidget *tbl)
{
//Call back for letter sizing spinbutton
}
-static void
-sp_text_line_changed(GtkAdjustment *adj, GtkWidget *tbl)
+static void sp_text_line_changed(GtkAdjustment *adj, GtkWidget *tbl)
{
//Call back for line height spinbutton
}
-static void
-sp_text_horiz_kern_changed(GtkAdjustment *adj, GtkWidget *tbl)
+static void sp_text_horiz_kern_changed(GtkAdjustment *adj, GtkWidget *tbl)
{
//Call back for horizontal kerning spinbutton
}
-static void
-sp_text_vert_kern_changed(GtkAdjustment *adj, GtkWidget *tbl)
+static void sp_text_vert_kern_changed(GtkAdjustment *adj, GtkWidget *tbl)
{
//Call back for vertical kerning spinbutton
}
-static void
-sp_text_letter_rotation_changed(GtkAdjustment *adj, GtkWidget *tbl)
+static void sp_text_letter_rotation_changed(GtkAdjustment *adj, GtkWidget *tbl)
{
//Call back for letter rotation spinbutton
}*/
namespace {
-void
-sp_text_toolbox_selection_changed (Inkscape::Selection */*selection*/, GObject *tbl)
+static void sp_text_toolbox_selection_changed(Inkscape::Selection * /*selection*/, GObject *tbl)
{
// quit if run by the _changed callbacks
if (g_object_get_data(G_OBJECT(tbl), "freeze")) {
@@ -6324,25 +6282,19 @@ sp_text_toolbox_selection_changed (Inkscape::Selection */*selection*/, GObject *
g_object_set_data (G_OBJECT (button), "block", gpointer(1));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_object_set_data (G_OBJECT (button), "block", gpointer(0));
- }
- else
- {
+ } else {
if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_START)
{
GtkWidget *button = GTK_WIDGET (g_object_get_data (G_OBJECT (tbl), "text-start"));
g_object_set_data (G_OBJECT (button), "block", gpointer(1));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_object_set_data (G_OBJECT (button), "block", gpointer(0));
- }
- else if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE)
- {
+ } else if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) {
GtkWidget *button = GTK_WIDGET (g_object_get_data (G_OBJECT (tbl), "text-middle"));
g_object_set_data (G_OBJECT (button), "block", gpointer(1));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_object_set_data (G_OBJECT (button), "block", gpointer(0));
- }
- else if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_END)
- {
+ } else if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_END) {
GtkWidget *button = GTK_WIDGET (g_object_get_data (G_OBJECT (tbl), "text-end"));
g_object_set_data (G_OBJECT (button), "block", gpointer(1));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@@ -6387,12 +6339,9 @@ sp_text_toolbox_selection_changed (Inkscape::Selection */*selection*/, GObject *
GtkWidget *button1 = GTK_WIDGET (g_object_get_data (G_OBJECT (tbl), "orientation-vertical"));
g_object_set_data (G_OBJECT (button1), "block", gpointer(1));
- if (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB)
- {
+ if (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
- }
- else
- {
+ } else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button1), TRUE);
}
g_object_set_data (G_OBJECT (button), "block", gpointer(0));
@@ -6404,21 +6353,18 @@ sp_text_toolbox_selection_changed (Inkscape::Selection */*selection*/, GObject *
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
-void
-sp_text_toolbox_selection_modified (Inkscape::Selection *selection, guint /*flags*/, GObject *tbl)
+static void sp_text_toolbox_selection_modified(Inkscape::Selection *selection, guint /*flags*/, GObject *tbl)
{
sp_text_toolbox_selection_changed (selection, tbl);
}
-void
-sp_text_toolbox_subselection_changed (gpointer /*tc*/, GObject *tbl)
+static void sp_text_toolbox_subselection_changed(gpointer /*tc*/, GObject *tbl)
{
sp_text_toolbox_selection_changed (NULL, tbl);
}
-void
-sp_text_toolbox_family_changed (GtkComboBoxEntry *,
- GObject *tbl)
+static void sp_text_toolbox_family_changed(GtkComboBoxEntry *,
+ GObject *tbl)
{
// quit if run by the _changed callbacks
if (g_object_get_data(G_OBJECT(tbl), "freeze")) {
}
// If querying returned nothing, set the default style of the tool (for new texts)
- if (result_fontspec == QUERY_STYLE_NOTHING)
- {
+ if (result_fontspec == QUERY_STYLE_NOTHING) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->mergeStyle("/tools/text/style", css);
sp_text_edit_dialog_default_set_insensitive (); //FIXME: Replace trough a verb
- }
- else
- {
+ } else {
sp_desktop_set_style (desktop, css, true, true);
}
}
-void
-sp_text_toolbox_anchoring_toggled (GtkRadioButton *button,
- gpointer data)
+static void sp_text_toolbox_anchoring_toggled(GtkRadioButton *button,
+ gpointer data)
{
- if (g_object_get_data (G_OBJECT (button), "block")) return;
- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) return;
+ if (g_object_get_data (G_OBJECT (button), "block")) {
+ return;
+ }
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
+ return;
+ }
int prop = GPOINTER_TO_INT(data);
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
Geom::OptRect bbox
= item->getBounds(Geom::identity(), SPItem::GEOMETRIC_BBOX);
- if (!bbox)
+ if (!bbox) {
continue;
+ }
double width = bbox->dimensions()[axis];
// If you want to align within some frame, other than the text's own bbox, calculate
// the left and right (or top and bottom for tb text) slacks of the text inside that
gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
}
-void
-sp_text_toolbox_style_toggled (GtkToggleButton *button,
- gpointer data)
+static void sp_text_toolbox_style_toggled(GtkToggleButton *button,
+ gpointer data)
{
- if (g_object_get_data (G_OBJECT (button), "block")) return;
+ if (g_object_get_data (G_OBJECT (button), "block")) {
+ return;
+ }
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
SPCSSAttr *css = sp_repr_css_attr_new ();
gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
}
-void
-sp_text_toolbox_orientation_toggled (GtkRadioButton *button,
- gpointer data)
+static void sp_text_toolbox_orientation_toggled(GtkRadioButton *button,
+ gpointer data)
{
if (g_object_get_data (G_OBJECT (button), "block")) {
return;
gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
}
-gboolean
-sp_text_toolbox_family_keypress (GtkWidget */*w*/, GdkEventKey *event, GObject *tbl)
+static gboolean sp_text_toolbox_family_keypress(GtkWidget * /*w*/, GdkEventKey *event, GObject *tbl)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (!desktop) return FALSE;
+ if (!desktop) {
+ return FALSE;
+ }
switch (get_group0_keyval (event)) {
case GDK_KP_Enter: // chosen
case GDK_Return:
// unfreeze and update, which will defocus
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
- sp_text_toolbox_family_changed (NULL, tbl);
+ sp_text_toolbox_family_changed (NULL, tbl);
return TRUE; // I consumed the event
break;
- case GDK_Escape:
+ case GDK_Escape:
// defocus
gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
return TRUE; // I consumed the event
@@ -6842,11 +6790,12 @@ sp_text_toolbox_family_keypress (GtkWidget */*w*/, GdkEventKey *event, GObject *
return FALSE;
}
-gboolean
-sp_text_toolbox_family_list_keypress (GtkWidget */*w*/, GdkEventKey *event, GObject */*tbl*/)
+static gboolean sp_text_toolbox_family_list_keypress(GtkWidget * /*w*/, GdkEventKey *event, GObject * /*tbl*/)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (!desktop) return FALSE;
+ if (!desktop) {
+ return FALSE;
+ }
switch (get_group0_keyval (event)) {
case GDK_KP_Enter:
@@ -6867,9 +6816,8 @@ sp_text_toolbox_family_list_keypress (GtkWidget */*w*/, GdkEventKey *event, GObj
}
-void
-sp_text_toolbox_size_changed (GtkComboBox *cbox,
- GObject *tbl)
+static void sp_text_toolbox_size_changed(GtkComboBox *cbox,
+ GObject *tbl)
{
// quit if run by the _changed callbacks
if (g_object_get_data(G_OBJECT(tbl), "freeze")) {
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
-gboolean
-sp_text_toolbox_size_focusout (GtkWidget */*w*/, GdkEventFocus */*event*/, GObject *tbl)
+static gboolean sp_text_toolbox_size_focusout(GtkWidget * /*w*/, GdkEventFocus * /*event*/, GObject *tbl)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (!desktop) return FALSE;
+ if (!desktop) {
+ return FALSE;
+ }
if (!g_object_get_data (tbl, "esc-pressed")) {
g_object_set_data (tbl, "enter-pressed", gpointer(1));
@@ -6951,11 +6900,12 @@ sp_text_toolbox_size_focusout (GtkWidget */*w*/, GdkEventFocus */*event*/, GObje
}
-gboolean
-sp_text_toolbox_size_keypress (GtkWidget */*w*/, GdkEventKey *event, GObject *tbl)
+static gboolean sp_text_toolbox_size_keypress(GtkWidget * /*w*/, GdkEventKey *event, GObject *tbl)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (!desktop) return FALSE;
+ if (!desktop) {
+ return FALSE;
+ }
switch (get_group0_keyval (event)) {
case GDK_Escape: // defocus
@@ -6979,32 +6929,29 @@ sp_text_toolbox_size_keypress (GtkWidget */*w*/, GdkEventKey *event, GObject *tb
// While editing font name in the entry, disable family_changed by freezing, otherwise completion
// does not work!
-gboolean
-sp_text_toolbox_entry_focus_in (GtkWidget *entry,
- GdkEventFocus */*event*/,
- GObject *tbl)
+static gboolean sp_text_toolbox_entry_focus_in(GtkWidget *entry,
+ GdkEventFocus * /*event*/,
+ GObject *tbl)
{
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) );
gtk_entry_select_region (GTK_ENTRY (entry), 0, -1); // select all
return FALSE;
}
-gboolean
-sp_text_toolbox_entry_focus_out (GtkWidget *entry,
- GdkEventFocus */*event*/,
- GObject *tbl)
+static gboolean sp_text_toolbox_entry_focus_out(GtkWidget *entry,
+ GdkEventFocus * /*event*/,
+ GObject *tbl)
{
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
gtk_entry_select_region (GTK_ENTRY (entry), 0, 0); // deselect
return FALSE;
}
-void
-cell_data_func (GtkCellLayout */*cell_layout*/,
- GtkCellRenderer *cell,
- GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gpointer /*data*/)
+static void cell_data_func(GtkCellLayout * /*cell_layout*/,
+ GtkCellRenderer *cell,
+ GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gpointer /*data*/)
{
gchar *family;
gtk_tree_model_get(tree_model, iter, 0, &family, -1);
g_free(family_escaped);
}
-gboolean text_toolbox_completion_match_selected(GtkEntryCompletion */*widget*/,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- GObject *tbl)
+static gboolean text_toolbox_completion_match_selected(GtkEntryCompletion * /*widget*/,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GObject *tbl)
{
// We intercept this signal so as to fire family_changed at once (without it, you'd have to
// press Enter again after choosing a completion)
@@ -7050,8 +6997,8 @@ gboolean text_toolbox_completion_match_selected(GtkEntryCompletion */*widget*/,
}
-static void
-cbe_add_completion (GtkComboBoxEntry *cbe, GObject *tbl){
+static void cbe_add_completion(GtkComboBoxEntry *cbe, GObject *tbl)
+{
GtkEntry *entry;
GtkEntryCompletion *completion;
GtkTreeModel *model;
g_object_unref(completion);
}
-void sp_text_toolbox_family_popnotify(GtkComboBox *widget,
- void */*property*/,
- GObject *tbl)
+static void sp_text_toolbox_family_popnotify(GtkComboBox *widget,
+ void * /*property*/,
+ GObject *tbl)
{
// while the drop-down is open, we disable font family changing, reenabling it only when it closes
}
// update
- sp_text_toolbox_family_changed (NULL, tbl);
+ sp_text_toolbox_family_changed (NULL, tbl);
break;
}
- }
+ }
}
}
// regardless of whether we updated, defocus the widget
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (desktop)
+ if (desktop) {
gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas));
+ }
//g_print("POP: notify: HIDDEN\n");
}
}
-GtkWidget *sp_text_toolbox_new (SPDesktop *desktop)
+GtkWidget *sp_text_toolbox_new(SPDesktop *desktop)
{
GtkToolbar *tbl = GTK_TOOLBAR(gtk_toolbar_new());
GtkIconSize secondarySize = static_cast<GtkIconSize>(ToolboxFactory::prefToSize("/toolbox/secondary", 1));
g_signal_connect (G_OBJECT (font_sel->gobj()), "key-press-event", G_CALLBACK(sp_text_toolbox_family_list_keypress), tbl);
cbe_add_completion(font_sel->gobj(), G_OBJECT(tbl));
-
+
gtk_toolbar_append_widget( tbl, (GtkWidget*) font_sel->gobj(), "", "");
g_object_set_data (G_OBJECT (tbl), "family-entry-combo", font_sel);
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (sp_text_toolbox_family_changed), tbl);
g_signal_connect (G_OBJECT (font_sel->gobj()), "changed", G_CALLBACK (sp_text_toolbox_family_changed), tbl);
- g_signal_connect (G_OBJECT (font_sel->gobj()), "notify::popup-shown",
+ g_signal_connect (G_OBJECT (font_sel->gobj()), "notify::popup-shown",
G_CALLBACK (sp_text_toolbox_family_popnotify), tbl);
g_signal_connect (G_OBJECT (entry), "key-press-event", G_CALLBACK(sp_text_toolbox_family_keypress), tbl);
g_signal_connect (G_OBJECT (entry), "focus-in-event", G_CALLBACK (sp_text_toolbox_entry_focus_in), tbl);
//## Connector ##
//#########################
-static void sp_connector_mode_toggled( GtkToggleAction* act, GtkObject */*tbl*/ )
+static void sp_connector_mode_toggled( GtkToggleAction* act, GtkObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/connector/mode",
@@ -7376,8 +7324,7 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl
Inkscape::Selection * selection = sp_desktop_selection(desktop);
SPDocument *doc = sp_desktop_document(desktop);
- if (!sp_document_get_undo_sensitive(doc))
- {
+ if (!sp_document_get_undo_sensitive(doc)) {
return;
}
@@ -7409,8 +7356,7 @@ static void sp_connector_orthogonal_toggled( GtkToggleAction* act, GObject *tbl
l = l->next;
}
- if (!modmade)
- {
+ if (!modmade) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/connector/orthogonal", is_orthog);
}
Inkscape::Selection * selection = sp_desktop_selection(desktop);
SPDocument *doc = sp_desktop_document(desktop);
- if (!sp_document_get_undo_sensitive(doc))
- {
+ if (!sp_document_get_undo_sensitive(doc)) {
return;
}
l = l->next;
}
- if (!modmade)
- {
+ if (!modmade) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setDouble(Glib::ustring("/tools/connector/curvature"), newValue);
}
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
SPDocument *doc = sp_desktop_document(desktop);
- if (!sp_document_get_undo_sensitive(doc))
- {
+ if (!sp_document_get_undo_sensitive(doc)) {
return;
}
if ( !repr->attribute("inkscape:connector-spacing") &&
( adj->value == defaultConnSpacing )) {
- // Don't need to update the repr if the attribute doesn't
+ // Don't need to update the repr if the attribute doesn't
// exist and it is being set to the default value -- as will
// happen at startup.
return;
static void sp_connector_graph_layout(void)
{
- if (!SP_ACTIVE_DESKTOP) return;
+ if (!SP_ACTIVE_DESKTOP) {
+ return;
+ }
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
// hack for clones, see comment in align-and-distribute.cpp
sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
}
-static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GtkObject */*tbl*/ )
+static void sp_directed_graph_layout_toggled( GtkToggleAction* act, GtkObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/connector/directedlayout",
gtk_toggle_action_get_active( act ));
}
-static void sp_nooverlaps_graph_layout_toggled( GtkToggleAction* act, GtkObject */*tbl*/ )
+static void sp_nooverlaps_graph_layout_toggled( GtkToggleAction* act, GtkObject * /*tbl*/ )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/connector/avoidoverlaplayout",
}
static void connector_tb_event_attr_changed(Inkscape::XML::Node *repr,
- gchar const *name, gchar const */*old_value*/, gchar const */*new_value*/,
+ gchar const *name, gchar const * /*old_value*/, gchar const * /*new_value*/,
bool /*is_interactive*/, gpointer data)
{
GtkWidget *tbl = GTK_WIDGET(data);
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
SPConnectorContext* cc = SP_CONNECTOR_CONTEXT(desktop->event_context);
- if (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE)
+ 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 = (SPDesktop *) g_object_get_data( tbl, "desktop" );
SPConnectorContext* cc = SP_CONNECTOR_CONTEXT(desktop->event_context);
- if (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE)
+ if (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE) {
cc_remove_connection_point(cc);
+ }
}
static Inkscape::XML::NodeEventVector connector_tb_repr_events = {
@@ -7805,13 +7752,13 @@ static void paintbucket_channels_changed(EgeSelectOneAction* act, GObject* /*tbl
flood_channels_set_channels( channels );
}
-static void paintbucket_threshold_changed(GtkAdjustment *adj, GObject */*tbl*/)
+static void paintbucket_threshold_changed(GtkAdjustment *adj, GObject * /*tbl*/)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt("/tools/paintbucket/threshold", (gint)adj->value);
}
-static void paintbucket_autogap_changed(EgeSelectOneAction* act, GObject */*tbl*/)
+static void paintbucket_autogap_changed(EgeSelectOneAction* act, GObject * /*tbl*/)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool("/tools/paintbucket/autogap", ege_select_one_action_get_active( act ));
prefs->setString("/tools/paintbucket/offsetunits", sp_unit_get_abbreviation(unit));
}
-static void paintbucket_defaults (GtkWidget *, GObject *tbl)
+static void paintbucket_defaults(GtkWidget *, GObject *tbl)
{
// FIXME: make defaults settable via Inkscape Options
struct KeyValue {
@@ -7898,8 +7845,9 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
// Create the units menu.
UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE );
Glib::ustring stored_unit = prefs->getString("/tools/paintbucket/offsetunits");
- if (!stored_unit.empty())
+ if (!stored_unit.empty()) {
tracker->setActiveUnit(sp_unit_get_by_abbreviation(stored_unit.data()));
+ }
g_object_set_data( holder, "tracker", tracker );
{
GtkAction* act = tracker->createAction( "PaintbucketUnitsAction", _("Units"), ("") );