lpe-toolbar.cpp revision 652485ad88d2a42f827c7e355220efeb3b2e37af
/**
* @file
* LPE aux toolbar
*/
/* Authors:
* MenTaLguY <mental@rydia.net>
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Frank Felfe <innerspace@iname.com>
* John Cliff <simarilius@yahoo.com>
* David Turner <novalis@gnu.org>
* Josh Andler <scislac@scislac.com>
* Jon A. Cruz <jon@joncruz.org>
* Maximilian Albert <maximilian.albert@gmail.com>
* Tavmjong Bah <tavmjong@free.fr>
* Abhishek Sharma
* Kris De Gussem <Kris.DeGussem@gmail.com>
*
* 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 "live_effects/lpe-line_segment.h"
#include "lpe-toolbar.h"
#include "connection-pool.h"
#include "desktop-handles.h"
#include "desktop.h"
#include "document-undo.h"
#include "ege-select-one-action.h"
#include "helper/action-context.h"
#include "ink-action.h"
#include "live_effects/effect.h"
#include "preferences.h"
#include "selection.h"
#include "sp-namedview.h"
#include "tools-switch.h"
#include "ui/tools/lpe-tool.h"
#include "ui/widget/unit-tracker.h"
#include "verbs.h"
using Inkscape::DocumentUndo;
//########################
//## LPETool ##
//########################
// the subtools from which the toolbar is built automatically are listed in lpe-tool-context.h
// this is called when the mode is changed via the toolbar (i.e., one of the subtool buttons is pressed)
{
using namespace Inkscape::LivePathEffect;
if (!SP_IS_LPETOOL_CONTEXT(ec)) {
return;
}
// only take action if run by the attr_changed listener
// in turn, prevent listener from responding
if (success) {
// since the construction was already performed, we set the state back to inactive
mode = 0;
} else {
// switch to the chosen subtool
}
}
}
}
static void sp_lpetool_toolbox_sel_modified(Inkscape::Selection *selection, guint /*flags*/, GObject * /*tbl*/)
{
if (SP_IS_LPETOOL_CONTEXT(ec)) {
}
}
{
using namespace Inkscape::LivePathEffect;
if (!SP_IS_LPETOOL_CONTEXT(ec)) {
return;
}
// activate line segment combo box if a single item with LPELineSegment is selected
} else {
}
} else {
}
}
}
}
{
return;
}
}
}
{
}
}
{
if (bbox) {
// TODO: should we provide a way to store points in prefs?
}
gtk_toggle_action_set_active(act, false);
}
{
EgeSelectOneAction* selector = static_cast<EgeSelectOneAction *>(g_object_get_data(tbl, "lpetool_line_segment_action"));
// TODO: we add the entries of rht combo box manually; later this should be done automatically
{
}
}
{
using namespace Inkscape::LivePathEffect;
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
if (lpeitem) {
lpe->end_type.param_set_value(static_cast<Inkscape::LivePathEffect::EndType>(ege_select_one_action_get_active(act)));
sp_lpe_item_update_patheffect(lpeitem, true, true);
}
}
{
sp_action_perform(Inkscape::Verb::get(SP_VERB_DIALOG_LIVE_PATH_EFFECT)->get_action(Inkscape::ActionContext(desktop)), NULL);
}
gtk_toggle_action_set_active(act, false);
}
static void lpetool_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
{
/** Automatically create a list of LPEs that get added to the toolbar **/
{
// the first toggle button represents the state that no subtool is active (remove this when
// this can be modeled by EgeSelectOneAction or some other action)
0, _("All inactive"),
1, _("No geometric tool is active"),
2, "draw-geometry-inactive",
-1 );
for (int i = 1; i < num_subtools; ++i) { // we start with i = 1 because INVALID_LPE was already added
-1 );
}
EgeSelectOneAction* act = ege_select_one_action_new( "LPEToolModeAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
}
/* Show limiting bounding box */
{
_("Show limiting bounding box"),
_("Show bounding box (used to cut infinite lines)"),
"show-bounding-box",
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool( "/tools/lpetool/show_bbox", true ) );
}
/* Set limiting bounding box to bbox of current selection */
{
_("Get limiting bounding box from selection"),
_("Set limiting bounding box (used to cut infinite lines) to the bounding box of current selection"),
"draw-geometry-set-bounding-box",
}
/* Combo box to choose line segment type */
{
EgeSelectOneAction* act = ege_select_one_action_new ("LPELineSegmentAction", "" , (_("Choose a line segment type")), NULL, GTK_TREE_MODEL(model));
g_signal_connect(G_OBJECT(act), "changed", G_CALLBACK(sp_lpetool_change_line_segment_type), holder);
}
/* Display measuring info for selected items */
{
_("Display measuring info"),
_("Display measuring info for selected items"),
"draw-geometry-show-measuring-info",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(lpetool_toggle_show_measuring_info), holder );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool( "/tools/lpetool/show_measuring_info", true ) );
}
// add the units menu
{
}
/* Open LPE dialog (to adapt parameters numerically) */
{
_("Open LPE dialog"),
_("Open LPE dialog (to adapt parameters numerically)"),
"dialog-geometry",
}
}
static void lpetool_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
{
if (SP_IS_LPETOOL_CONTEXT(ec)) {
// Watch selection
c_selection_modified = sp_desktop_selection(desktop)->connectModified(sigc::bind(sigc::ptr_fun(sp_lpetool_toolbox_sel_modified), holder));
c_selection_changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_lpetool_toolbox_sel_changed), holder));
} else {
if (c_selection_modified)
if (c_selection_changed)
}
}
/*
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 :