From: cilix42 Date: Mon, 18 Aug 2008 00:35:27 +0000 (+0000) Subject: Build LPETool subtools automatically from a list of effects X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f9f9fad45aab40b03f2855bfe5395c3741f3ed69;p=inkscape.git Build LPETool subtools automatically from a list of effects --- diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 3bc463bd2..c3c07fa80 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -14,10 +14,11 @@ * David Turner * Josh Andler * Jon A. Cruz +* Maximilian Albert * * Copyright (C) 2004 David Turner * Copyright (C) 2003 MenTaLguY -* Copyright (C) 1999-2006 authors +* Copyright (C) 1999-2008 authors * Copyright (C) 2001-2002 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -4885,25 +4886,31 @@ sp_lpetool_toolbox_sel_changed(Inkscape::Selection *selection, GObject *tbl) } } } + +static Inkscape::LivePathEffect::EffectType lpesubtools[] = { + Inkscape::LivePathEffect::ANGLE_BISECTOR, + Inkscape::LivePathEffect::CIRCLE_3PTS, + Inkscape::LivePathEffect::PERP_BISECTOR +}; + static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder) { + /** Automatically create a list of LPEs that get added to the toolbar **/ { 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, _("Angle bisector"), - 1, _("Angle bisector"), - 2, "delete_object", - -1 ); + Inkscape::LivePathEffect::EffectType type; + for (int i = 0; i < 3; ++i) { + type = lpesubtools[i]; gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, - 0, _("Circle through 3 points"), - 1, _("Circle through 3 points"), - 2, "difference", + 0, Inkscape::LivePathEffect::LPETypeConverter.get_label(type).c_str(), + 1, Inkscape::LivePathEffect::LPETypeConverter.get_label(type).c_str(), + 2, Inkscape::LivePathEffect::LPETypeConverter.get_key(type).c_str(), -1 ); + } EgeSelectOneAction* act = ege_select_one_action_new( "LPEToolModeAction", (""), (""), NULL, GTK_TREE_MODEL(model) ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) );