toolbox.cpp revision 72c33248c0b7e5b1d9a63b205947d98e379d1775
/** \file
* Controls bars for some of Inkscape's tools
* (for some tools, they are in their own files)
*/
/*
*
* 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>
*
* Copyright (C) 2004 David Turner
* Copyright (C) 2003 MenTaLguY
* Copyright (C) 1999-2008 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 <cstring>
#include <string>
#include <gtkmm.h>
#include <iostream>
#include <sstream>
#include "widgets/widget-sizes.h"
#include "widgets/spw-utilities.h"
#include "widgets/spinbutton-events.h"
#include "dialogs/text-edit.h"
#include "dialogs/dialog-events.h"
#include "ui/widget/style-swatch.h"
#include "prefs-utils.h"
#include "verbs.h"
#include "sp-namedview.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "xml/node-event-vector.h"
#include "xml/attribute-record.h"
#include "helper/unit-menu.h"
#include "live_effects/effect.h"
#include "inkscape.h"
#include "conn-avoid-ref.h"
#include "select-toolbar.h"
#include "gradient-toolbar.h"
#include "connector-context.h"
#include "node-context.h"
#include "pen-context.h"
#include "lpe-tool-context.h"
#include "shape-editor.h"
#include "tweak-context.h"
#include "sp-rect.h"
#include "box3d.h"
#include "box3d-context.h"
#include "sp-star.h"
#include "sp-spiral.h"
#include "sp-ellipse.h"
#include "sp-text.h"
#include "sp-flowtext.h"
#include "sp-clippath.h"
#include "sp-mask.h"
#include "style.h"
#include "tools-switch.h"
#include "selection.h"
#include "selection-chemistry.h"
#include "document-private.h"
#include "desktop-style.h"
#include "../libnrtype/font-lister.h"
#include "../libnrtype/font-instance.h"
#include "../connection-pool.h"
#include "../prefs-utils.h"
#include "../inkscape-stock.h"
#include "icon.h"
#include "graphlayout/graphlayout.h"
#include "interface.h"
#include "shortcuts.h"
#include "mod360.h"
#include "toolbox.h"
#include "flood-context.h"
#include "ink-action.h"
#include "ege-adjustment-action.h"
#include "ege-output-action.h"
#include "ege-select-one-action.h"
#include "helper/unit-tracker.h"
#include "live_effects/lpe-angle_bisector.h"
#include "svg/css-ostringstream.h"
#include "widgets/calligraphic-profile-rename.h"
using Inkscape::UnitTracker;
typedef void (*UpdateFunction)(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_dropper_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_connector_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
};
return sizeChoices[index];
}
static struct {
} const tools[] = {
{ "SPDynaDrawContext", "dyna_draw_tool", SP_VERB_CONTEXT_CALLIGRAPHIC, SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS },
{ "SPFloodContext", "paintbucket_tool", SP_VERB_CONTEXT_PAINTBUCKET, SP_VERB_CONTEXT_PAINTBUCKET_PREFS },
{ "SPConnectorContext","connector_tool", SP_VERB_CONTEXT_CONNECTOR, SP_VERB_CONTEXT_CONNECTOR_PREFS },
};
static struct {
gchar const *swatch_tool;
gchar const *swatch_tip;
} const aux_toolboxes[] = {
SP_VERB_INVALID, 0, 0},
SP_VERB_INVALID, 0, 0},
SP_VERB_INVALID, 0, 0},
SP_VERB_INVALID, 0, 0},
SP_VERB_INVALID, 0, 0},
SP_VERB_INVALID, 0, 0},
SP_VERB_INVALID, 0, 0},
};
#define TOOLBAR_SLIDER_HINT "full"
"<ui>"
" <toolbar name='SelectToolbar'>"
" <toolitem action='EditSelectAll' />"
" <toolitem action='EditSelectAllInAllLayers' />"
" <toolitem action='EditDeselect' />"
" <separator />"
" <toolitem action='ObjectRotate90CCW' />"
" <toolitem action='ObjectRotate90' />"
" <toolitem action='ObjectFlipHorizontally' />"
" <toolitem action='ObjectFlipVertically' />"
" <separator />"
" <toolitem action='SelectionToBack' />"
" <toolitem action='SelectionLower' />"
" <toolitem action='SelectionRaise' />"
" <toolitem action='SelectionToFront' />"
" <separator />"
" <toolitem action='XAction' />"
" <toolitem action='YAction' />"
" <toolitem action='WidthAction' />"
" <toolitem action='LockAction' />"
" <toolitem action='HeightAction' />"
" <toolitem action='UnitsAction' />"
" <separator />"
" <toolitem action='transform_affect_label' />"
" <toolitem action='transform_stroke' />"
" <toolitem action='transform_corners' />"
" <toolitem action='transform_gradient' />"
" <toolitem action='transform_pattern' />"
" </toolbar>"
" <toolbar name='NodeToolbar'>"
" <toolitem action='NodeInsertAction' />"
" <toolitem action='NodeDeleteAction' />"
" <separator />"
" <toolitem action='NodeJoinAction' />"
" <toolitem action='NodeBreakAction' />"
" <separator />"
" <toolitem action='NodeJoinSegmentAction' />"
" <toolitem action='NodeDeleteSegmentAction' />"
" <separator />"
" <toolitem action='NodeCuspAction' />"
" <toolitem action='NodeSmoothAction' />"
" <toolitem action='NodeSymmetricAction' />"
" <separator />"
" <toolitem action='NodeLineAction' />"
" <toolitem action='NodeCurveAction' />"
" <separator />"
" <toolitem action='ObjectToPath' />"
" <toolitem action='StrokeToPath' />"
" <separator />"
" <toolitem action='NodeXAction' />"
" <toolitem action='NodeYAction' />"
" <toolitem action='NodeUnitsAction' />"
" <separator />"
" <toolitem action='ObjectEditClipPathAction' />"
" <toolitem action='ObjectEditMaskPathAction' />"
" <toolitem action='EditNextLPEParameterAction' />"
" <separator />"
" <toolitem action='NodesShowHandlesAction' />"
" <toolitem action='NodesShowHelperpath' />"
" </toolbar>"
" <toolbar name='TweakToolbar'>"
" <toolitem action='TweakWidthAction' />"
" <separator />"
" <toolitem action='TweakForceAction' />"
" <toolitem action='TweakPressureAction' />"
" <separator />"
" <toolitem action='TweakModeAction' />"
" <separator />"
" <toolitem action='TweakFidelityAction' />"
" <separator />"
" <toolitem action='TweakChannelsLabel' />"
" <toolitem action='TweakDoH' />"
" <toolitem action='TweakDoS' />"
" <toolitem action='TweakDoL' />"
" <toolitem action='TweakDoO' />"
" </toolbar>"
" <toolbar name='ZoomToolbar'>"
" <toolitem action='ZoomIn' />"
" <toolitem action='ZoomOut' />"
" <separator />"
" <toolitem action='Zoom1:0' />"
" <toolitem action='Zoom1:2' />"
" <toolitem action='Zoom2:1' />"
" <separator />"
" <toolitem action='ZoomSelection' />"
" <toolitem action='ZoomDrawing' />"
" <toolitem action='ZoomPage' />"
" <toolitem action='ZoomPageWidth' />"
" <separator />"
" <toolitem action='ZoomPrev' />"
" <toolitem action='ZoomNext' />"
" </toolbar>"
" <toolbar name='StarToolbar'>"
" <separator />"
" <toolitem action='StarStateAction' />"
" <separator />"
" <toolitem action='FlatAction' />"
" <separator />"
" <toolitem action='MagnitudeAction' />"
" <toolitem action='SpokeAction' />"
" <toolitem action='RoundednessAction' />"
" <toolitem action='RandomizationAction' />"
" <separator />"
" <toolitem action='StarResetAction' />"
" </toolbar>"
" <toolbar name='RectToolbar'>"
" <toolitem action='RectStateAction' />"
" <toolitem action='RectWidthAction' />"
" <toolitem action='RectHeightAction' />"
" <toolitem action='RadiusXAction' />"
" <toolitem action='RadiusYAction' />"
" <toolitem action='RectUnitsAction' />"
" <separator />"
" <toolitem action='RectResetAction' />"
" </toolbar>"
" <toolbar name='3DBoxToolbar'>"
" <toolitem action='3DBoxAngleXAction' />"
" <toolitem action='3DBoxVPXStateAction' />"
" <separator />"
" <toolitem action='3DBoxAngleYAction' />"
" <toolitem action='3DBoxVPYStateAction' />"
" <separator />"
" <toolitem action='3DBoxAngleZAction' />"
" <toolitem action='3DBoxVPZStateAction' />"
" </toolbar>"
" <toolbar name='SpiralToolbar'>"
" <toolitem action='SpiralStateAction' />"
" <toolitem action='SpiralRevolutionAction' />"
" <toolitem action='SpiralExpansionAction' />"
" <toolitem action='SpiralT0Action' />"
" <separator />"
" <toolitem action='SpiralResetAction' />"
" </toolbar>"
" <toolbar name='PenToolbar'>"
" <toolitem action='FreehandModeActionPen' />"
" <separator />"
" <toolitem action='SetPenShapeAction'/>"
" </toolbar>"
" <toolbar name='PencilToolbar'>"
" <toolitem action='FreehandModeActionPencil' />"
" <separator />"
" <toolitem action='PencilToleranceAction' />"
" <separator />"
" <toolitem action='PencilResetAction' />"
" <separator />"
" <toolitem action='SetPencilShapeAction'/>"
" </toolbar>"
" <toolbar name='CalligraphyToolbar'>"
" <separator />"
" <toolitem action='SetProfileAction'/>"
" <separator />"
" <toolitem action='CalligraphyWidthAction' />"
" <toolitem action='PressureAction' />"
" <toolitem action='TraceAction' />"
" <toolitem action='ThinningAction' />"
" <separator />"
" <toolitem action='AngleAction' />"
" <toolitem action='TiltAction' />"
" <toolitem action='FixationAction' />"
" <separator />"
" <toolitem action='CapRoundingAction' />"
" <separator />"
" <toolitem action='TremorAction' />"
" <toolitem action='WiggleAction' />"
" <toolitem action='MassAction' />"
" <separator />"
" </toolbar>"
" <toolbar name='ArcToolbar'>"
" <toolitem action='ArcStateAction' />"
" <separator />"
" <toolitem action='ArcStartAction' />"
" <toolitem action='ArcEndAction' />"
" <separator />"
" <toolitem action='ArcOpenAction' />"
" <separator />"
" <toolitem action='ArcResetAction' />"
" <separator />"
" </toolbar>"
" <toolbar name='PaintbucketToolbar'>"
" <toolitem action='ChannelsAction' />"
" <separator />"
" <toolitem action='ThresholdAction' />"
" <separator />"
" <toolitem action='OffsetAction' />"
" <toolitem action='PaintbucketUnitsAction' />"
" <separator />"
" <toolitem action='AutoGapAction' />"
" <separator />"
" <toolitem action='PaintbucketResetAction' />"
" </toolbar>"
" <toolbar name='EraserToolbar'>"
" <toolitem action='EraserWidthAction' />"
" <separator />"
" <toolitem action='EraserModeAction' />"
" </toolbar>"
" <toolbar name='LPEToolToolbar'>"
" <toolitem action='LPEToolModeAction' />"
" <separator />"
" <toolitem action='LPEShowBBoxAction' />"
" </toolbar>"
" <toolbar name='DropperToolbar'>"
" <toolitem action='DropperOpacityAction' />"
" <toolitem action='DropperPickAlphaAction' />"
" <toolitem action='DropperSetAlphaAction' />"
" </toolbar>"
" <toolbar name='ConnectorToolbar'>"
" <toolitem action='ConnectorAvoidAction' />"
" <toolitem action='ConnectorIgnoreAction' />"
" <toolitem action='ConnectorSpacingAction' />"
" <toolitem action='ConnectorGraphAction' />"
" <toolitem action='ConnectorLengthAction' />"
" <toolitem action='ConnectorDirectedAction' />"
" <toolitem action='ConnectorOverlapAction' />"
" </toolbar>"
"</ui>"
;
static void toolbox_set_desktop (GtkWidget *toolbox, SPDesktop *desktop, SetupFunction setup_func, UpdateFunction update_func, sigc::connection*);
static void update_tool_toolbox (SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
static void update_aux_toolbox (SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
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,
public:
static Glib::RefPtr<VerbAction> create(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view, GtkTooltips *tooltips);
virtual ~VerbAction();
virtual void set_active(bool active = true);
protected:
virtual void on_activate();
private:
bool active;
VerbAction(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view, GtkTooltips *tooltips);
};
Glib::RefPtr<VerbAction> VerbAction::create(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view, GtkTooltips *tooltips)
{
if ( action ) {
//SPAction* action2 = verb2 ? verb2->get_action(view) : 0;
}
return result;
}
VerbAction::VerbAction(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view, GtkTooltips *tooltips) :
Gtk::Action(Glib::ustring(verb->get_id()), Gtk::StockID(verb->get_image()), Glib::ustring(_(verb->get_name())), Glib::ustring(_(verb->get_tip()))),
active(false)
{
}
VerbAction::~VerbAction()
{
}
{
// First call in to get the icon rendered if present in SVG
Gtk::Widget *widget = sp_icon_get_icon( property_stock_id().get_value().get_string(), Inkscape::ICON_SIZE_MENU );
delete widget;
widget = 0;
// g_message("create_menu_item_vfunc() = %p for '%s'", widg, verb->get_id());
return widg;
}
{
// Gtk::Widget* widg = Gtk::Action::create_tool_item_vfunc();
verb,
view,
tooltips );
if ( active ) {
}
// g_message("create_tool_item_vfunc() = %p for '%s'", holder, verb->get_id());
return holder;
}
{
// g_message("connect_proxy_vfunc(%p) for '%s'", proxy, verb->get_id());
}
{
// g_message("disconnect_proxy_vfunc(%p) for '%s'", proxy, verb->get_id());
}
{
if (ti) {
// *should* have one child that is the SPButton
}
}
}
}
void VerbAction::on_activate()
{
if ( verb ) {
if ( action ) {
sp_action_perform(action, 0);
}
}
}
/* Global text entry widgets necessary for update */
/* GtkWidget *dropper_rgb_entry,
*dropper_opacity_entry ; */
// should be made a private member once this is converted to class
connection->disconnect();
delete connection;
}
{
(void)obj;
Inkscape::XML::Node* oldrepr = reinterpret_cast<Inkscape::XML::Node *>( g_object_get_data( tbl, "repr" ) );
if (oldrepr) { // remove old listener
oldrepr = 0;
}
}
sp_toolbox_button_new_from_verb_with_doubleclick(GtkWidget *t, Inkscape::IconSize size, SPButtonType type,
{
if (doubleclick_verb)
else
/* fixme: Handle sensitive/unsensitive */
/* fixme: Implement sp_button_new_from_action */
gtk_widget_show(b);
if (shortcut) {
if ( t ) {
}
} else {
if ( t ) {
}
}
return b;
}
{
if ( targetAction ) {
}
}
static void sp_action_action_set_sensitive (SPAction */*action*/, unsigned int sensitive, void *data)
{
if ( data ) {
}
}
static SPActionEventVector action_event_vector = {
{NULL},
NULL,
NULL,
NULL,
};
static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, Inkscape::IconSize size )
{
InkAction* inky = ink_action_new( verb->get_id(), _(verb->get_name()), verb->get_tip(), verb->get_image(), size );
SPAction*rebound = dynamic_cast<SPAction *>( nr_object_ref( dynamic_cast<NRObject *>(targetAction) ) );
nr_active_object_add_listener( (NRActiveObject *)rebound, (NRObjectEventVector *)&action_event_vector, sizeof(SPActionEventVector), inky );
return act;
}
{
gint verbsToUse[] = {
// disabled until we have icons for them:
//find
//SP_VERB_EDIT_TILE,
//SP_VERB_EDIT_UNTILE,
};
}
if ( !mainActions ) {
}
if ( verb ) {
}
}
}
Glib::RefPtr<VerbAction> va = VerbAction::create(Inkscape::Verb::get(tools[i].verb), Inkscape::Verb::get(tools[i].doubleclick_verb), view, tt);
if ( va ) {
if ( i == 0 ) {
va->set_active(true);
}
}
}
}
return mainActions;
}
{
}
{
}
{
g_signal_connect(G_OBJECT(hb), "child_detached", G_CALLBACK(handlebox_detached), static_cast<gpointer>(0));
g_signal_connect(G_OBJECT(hb), "child_attached", G_CALLBACK(handlebox_attached), static_cast<gpointer>(0));
return hb;
}
{
g_signal_connect(G_OBJECT(hb), "child_detached", G_CALLBACK(handlebox_detached), static_cast<gpointer>(0));
g_signal_connect(G_OBJECT(hb), "child_attached", G_CALLBACK(handlebox_attached), static_cast<gpointer>(0));
return hb;
}
//####################################
//# Commands Bar
//####################################
{
g_signal_connect(G_OBJECT(hb), "child_detached", G_CALLBACK(handlebox_detached), static_cast<gpointer>(0));
g_signal_connect(G_OBJECT(hb), "child_attached", G_CALLBACK(handlebox_attached), static_cast<gpointer>(0));
return hb;
}
{
GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( prefs_get_double_attribute(path, data, def) * factor,
if (us) {
}
EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, label, tooltip, 0, climb, digits );
if ( shortLabel ) {
}
}
if ( focusTarget ) {
}
}
if ( dataKludge ) {
}
// Using a cast just to make sure we pass in the right kind of function pointer
g_object_set( G_OBJECT(act), "tool-post", static_cast<EgeWidgetFixup>(sp_set_font_size_smaller), NULL );
return act;
}
//####################################
//# node editing callbacks
//####################################
/**
* FIXME: Returns current shape_editor in context. // later eliminate this function at all!
*/
static ShapeEditor *get_current_shape_editor()
{
if (!SP_ACTIVE_DESKTOP) {
return NULL;
}
if (!SP_IS_NODE_CONTEXT(event_context)) {
return NULL;
}
}
void
sp_node_path_edit_add(void)
{
}
void
sp_node_path_edit_delete(void)
{
}
void
{
}
void
sp_node_path_edit_break(void)
{
}
void
sp_node_path_edit_join(void)
{
}
void
{
}
void
sp_node_path_edit_toline(void)
{
}
void
{
}
void
sp_node_path_edit_cusp(void)
{
}
void
sp_node_path_edit_smooth(void)
{
}
void
{
}
}
}
}
}
}
/* is called when the node selection is modified */
static void
{
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
int n_selected = 0;
if (nodepath) {
}
if (n_selected == 0) {
} else {
if (n_selected == 1) {
}
} else {
/* Note: Currently x and y will always have a value, even if the coordinates of the
selected nodes don't coincide (in this case we use the coordinates of the center
of the bounding box). So the entries are never set to zero. */
// FIXME: Maybe we should clear the entry if several nodes are selected
// instead of providing a kind of average value
}
}
}
} else {
// no shape-editor or nodepath yet (when we just switched to the tool); coord entries must be inactive
}
}
static void
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
}
}
}
}
static void
{
}
static void
{
}
void
{
{
} else {
}
} else {
}
}
{
} else {
}
}
{
} else {
}
}
}
void
{
}
//################################
//## Node Editing Toolbox ##
//################################
{
{
_("Insert node"),
_("Insert new nodes into selected segments"),
"node_insert",
}
{
_("Delete node"),
_("Delete selected nodes"),
"node_delete",
}
{
_("Join endnodes"),
_("Join selected endnodes"),
"node_join",
}
{
_("Break nodes"),
_("Break path at selected nodes"),
"node_break",
}
{
_("Join with segment"),
_("Join selected endnodes with a new segment"),
"node_join_segment",
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_join_segment), 0 );
}
{
_("Delete segment"),
_("Delete segment between two non-endpoint nodes"),
"node_delete_segment",
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_delete_segment), 0 );
}
{
_("Node Cusp"),
_("Make selected nodes corner"),
"node_cusp",
}
{
_("Node Smooth"),
_("Make selected nodes smooth"),
"node_smooth",
}
{
_("Node Symmetric"),
_("Make selected nodes symmetric"),
"node_symmetric",
}
{
_("Node Line"),
_("Make selected segments lines"),
"node_line",
}
{
_("Node Curve"),
_("Make selected segments curves"),
"node_curve",
}
{
_("Show Handles"),
_("Show the Bezier handles of selected nodes"),
"nodes_show_handles",
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.nodes", "show_handles", 1 ) );
}
{
_("Show Outline"),
_("Show the outline of the path"),
"nodes_show_helperpath",
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.nodes", "show_helperpath", 0 ) );
}
{
_("Next path effect parameter"),
_("Show next path effect parameter for editing"),
"edit_next_parameter",
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_nextLPEparam), desktop );
}
{
_("Edit clipping path"),
_("Edit the clipping path of the object"),
"nodeedit-clippath",
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_clippath), desktop );
}
{
_("Edit mask path"),
_("Edit the mask of the object"),
"nodeedit-mask",
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_maskpath), desktop );
}
/* X coord of selected node(s) */
{
EgeAdjustmentAction* eact = 0;
_("X coordinate:"), _("X:"), _("X coordinate of selected node(s)"),
"tools.nodes", "Xcoord", 0,
}
/* Y coord of selected node(s) */
{
EgeAdjustmentAction* eact = 0;
_("Y coordinate:"), _("Y:"), _("Y coordinate of selected node(s)"),
"tools.nodes", "Ycoord", 0,
}
// add the units menu
{
}
//watch selection
} // end of sp_node_toolbox_prep()
//########################
//## Zoom Toolbox ##
//########################
static void sp_zoom_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/)
{
// no custom GtkAction setup needed
} // end of sp_zoom_toolbox_prep()
void
{
"event_context_connection")));
}
void
{
"event_context_connection")));
}
void
{
"event_context_connection")));
}
static void
toolbox_set_desktop(GtkWidget *toolbox, SPDesktop *desktop, SetupFunction setup_func, UpdateFunction update_func, sigc::connection *conn)
{
if (old_desktop) {
}
}
if (desktop) {
} else {
}
} // end of toolbox_set_desktop()
static void
{
"<ui>"
" <toolbar name='ToolToolbar'>"
" <toolitem action='ToolSelector' />"
" <toolitem action='ToolNode' />"
" <toolitem action='ToolTweak' />"
" <toolitem action='ToolZoom' />"
" <toolitem action='ToolRect' />"
" <toolitem action='Tool3DBox' />"
" <toolitem action='ToolArc' />"
" <toolitem action='ToolStar' />"
" <toolitem action='ToolSpiral' />"
" <toolitem action='ToolPencil' />"
" <toolitem action='ToolPen' />"
" <toolitem action='ToolCalligraphic' />"
" <toolitem action='ToolEraser' />"
" <toolitem action='ToolLPETool' />"
" <toolitem action='ToolPaintBucket' />"
" <toolitem action='ToolText' />"
" <toolitem action='ToolConnector' />"
" <toolitem action='ToolGradient' />"
" <toolitem action='ToolDropper' />"
" </toolbar>"
"</ui>";
}
if ( child ) {
}
// Inkscape::IconSize toolboxSize = prefToSize("toolbox.tools", "small");
}
static void
{
: NULL );
Glib::RefPtr<Gtk::Action> act = mainActions->get_action( Inkscape::Verb::get(tools[i].verb)->get_id() );
if ( act ) {
if ( verbAct ) {
}
}
}
}
static void
{
for (int i = 0 ; aux_toolboxes[i].type_name ; i++ ) {
if ( aux_toolboxes[i].prep_func ) {
// converted to GtkActions and UIManager
} else {
GtkWidget *sub_toolbox = 0;
else {
}
}
}
// Second pass to create toolbars *after* all GtkActions are created
for (int i = 0 ; aux_toolboxes[i].type_name ; i++ ) {
if ( aux_toolboxes[i].prep_func ) {
// converted to GtkActions and UIManager
tmp = 0;
}
gtk_table_attach( GTK_TABLE(holder), toolBar, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0 );
Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch( NULL, _(aux_toolboxes[i].swatch_tip) );
gtk_table_attach( GTK_TABLE(holder), swatch_, 1, 2, 0, 1, (GtkAttachOptions)(GTK_SHRINK | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), AUX_BETWEEN_BUTTON_GROUPS, 0 );
}
}
}
}
static void
{
: NULL );
for (int i = 0 ; aux_toolboxes[i].type_name ; i++ ) {
GtkWidget *sub_toolbox = GTK_WIDGET(g_object_get_data(G_OBJECT(toolbox), aux_toolboxes[i].data_name));
} else {
}
}
}
static void
{
"<ui>"
" <toolbar name='CommandsToolbar'>"
" <toolitem action='FileNew' />"
" <toolitem action='FileOpen' />"
" <toolitem action='FileSave' />"
" <toolitem action='FilePrint' />"
" <separator />"
" <toolitem action='FileImport' />"
" <toolitem action='FileExport' />"
" <separator />"
" <toolitem action='EditUndo' />"
" <toolitem action='EditRedo' />"
" <separator />"
" <toolitem action='EditCopy' />"
" <toolitem action='EditCut' />"
" <toolitem action='EditPaste' />"
" <separator />"
" <toolitem action='ZoomSelection' />"
" <toolitem action='ZoomDrawing' />"
" <toolitem action='ZoomPage' />"
" <separator />"
" <toolitem action='EditDuplicate' />"
" <toolitem action='EditClone' />"
" <toolitem action='EditUnlinkClone' />"
" <separator />"
" <toolitem action='SelectionGroup' />"
" <toolitem action='SelectionUnGroup' />"
" <separator />"
" <toolitem action='DialogFillStroke' />"
" <toolitem action='DialogText' />"
" <toolitem action='DialogXMLEditor' />"
" <toolitem action='DialogAlignDistribute' />"
" <separator />"
" <toolitem action='DialogPreferences' />"
" <toolitem action='DialogDocumentProperties' />"
" </toolbar>"
"</ui>";
}
if ( child ) {
}
}
static void
update_commands_toolbox(SPDesktop */*desktop*/, SPEventContext */*eventcontext*/, GtkWidget */*toolbox*/)
{
}
{
if (!shown_toolbox) {
return;
}
}
static GtkWidget *
{
return tbl;
}
#define MODE_LABEL_WIDTH 70
//########################
//## Star ##
//########################
{
// do not remember prefs if this call is initiated by an undo change, because undoing object
// creation sets bogus values to its attributes before it is deleted
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
modmade = true;
}
}
_("Star: Change number of corners"));
}
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
} else {
}
modmade = true;
}
}
_("Star: Change spoke ratio"));
}
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
if ( prop_action ) {
}
modmade = true;
}
}
if (modmade) {
}
}
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
modmade = true;
}
}
_("Star: Change rounding"));
}
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
modmade = true;
}
}
_("Star: Change randomization"));
}
{
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
GtkAdjustment *adj = 0;
EgeSelectOneAction* flat_action = EGE_SELECT_ONE_ACTION( g_object_get_data( G_OBJECT(tbl), "flat_action" ) );
} else {
}
} else {
}
}
}
{
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
/**
* \param selection Should not be NULL.
*/
static void
{
int n_selected = 0;
{
n_selected++;
}
}
if (n_selected == 0) {
} else if (n_selected == 1) {
if (repr) {
}
} else {
// FIXME: implement averaging of all parameters for multiple selected stars
//gtk_label_set_markup(GTK_LABEL(l), _("<b>Average:</b>"));
//gtk_label_set_markup(GTK_LABEL(l), _("<b>Change:</b>"));
}
}
{
// 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
GtkAdjustment *adj = 0;
// fixme: make settable in prefs!
gdouble randomized = 0;
EgeSelectOneAction* flat_action = EGE_SELECT_ONE_ACTION( g_object_get_data( dataKludge, "flat_action" ) );
}
void
{
if ( GTK_IS_TOOLBAR(tbl) ) {
} else {
}
}
{
{
}
{
EgeAdjustmentAction* eact = 0;
/* Flatsided checkbox */
{
0, _("Polygon"),
1, _("Regular polygon (with one handle) instead of a star"),
2, "star_flat",
-1 );
0, _("Star"),
1, _("Star instead of a regular polygon (with one handle)"),
2, "star_angled",
-1 );
EgeSelectOneAction* act = ege_select_one_action_new( "FlatAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_stb_sides_flat_state_changed), holder);
}
/* Magnitude */
{
gchar const* labels[] = {_("triangle/tri-star"), _("square/quad-star"), _("pentagon/five-pointed star"), _("hexagon/six-pointed star"), 0, 0, 0, 0, 0};
_("Corners"), _("Corners:"), _("Number of corners of a polygon or star"),
3, 1024, 1, 5,
1.0, 0 );
}
/* Spoke ratio */
{
gchar const* labels[] = {_("thin-ray star"), 0, _("pentagram"), _("hexagram"), _("heptagram"), _("octagram"), _("regular polygon")};
_("Spoke ratio"), _("Spoke ratio:"),
// TRANSLATORS: Tip radius of a star is the distance from the center to the farthest handle.
// Base radius is the same for the closest handle.
_("Base radius to tip radius ratio"),
0.01, 1.0, 0.01, 0.1,
}
if ( !isFlatSided ) {
} else {
}
/* Roundedness */
{
gchar const* labels[] = {_("stretched"), _("twisted"), _("slightly pinched"), _("NOT rounded"), _("slightly rounded"), _("visibly rounded"), _("well rounded"), _("amply rounded"), 0, _("stretched"), _("blown up")};
_("Rounded"), _("Rounded:"), _("How much rounded are the corners (0 for sharp)"),
-10.0, 10.0, 0.01, 0.1,
}
/* Randomization */
{
gchar const* labels[] = {_("NOT randomized"), _("slightly irregular"), _("visibly randomized"), _("strongly randomized"), _("blown up")};
_("Randomized"), _("Randomized:"), _("Scatter randomly the corners and angles"),
-10.0, 10.0, 0.001, 0.01,
}
}
{
/* Reset */
{
_("Defaults"),
_("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
}
}
sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_star_toolbox_selection_changed), (GObject *)holder))
);
}
//########################
//## Rect ##
//########################
{
if (adj1->value == 0 && adj2->value == 0 && g_object_get_data(tbl, "single")) { // only for a single selected rect (for now)
} else {
}
}
static void
{
prefs_set_double_attribute("tools.shapes.rect", value_name, sp_units_get_pixels(adj->value, *unit));
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
} else {
}
modmade = true;
}
}
if (modmade) {
_("Change rectangle"));
}
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
{
GtkAdjustment *adj = 0;
// this is necessary if the previous value was 0, but we still need to run the callback to change all selected objects
}
{
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
{
}
{
}
{
}
{
}
}
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
/**
* \param selection should not be NULL.
*/
static void
{
int n_selected = 0;
}
n_selected++;
}
}
if (n_selected == 0) {
} else if (n_selected == 1) {
if (repr) {
}
} else {
// FIXME: implement averaging of all parameters for multiple selected
//gtk_label_set_markup(GTK_LABEL(l), _("<b>Average:</b>"));
}
}
{
EgeAdjustmentAction* eact = 0;
{
}
//tracker->addUnit( SP_UNIT_PERCENT, 0 );
/* W */
{
_("Width"), _("W:"), _("Width of rectangle"),
"tools.shapes.rect", "width", 0,
}
/* H */
{
_("Height"), _("H:"), _("Height of rectangle"),
"tools.shapes.rect", "height", 0,
}
/* rx */
{
_("Horizontal radius"), _("Rx:"), _("Horizontal radius of rounded corners"),
"tools.shapes.rect", "rx", 0,
}
/* ry */
{
_("Vertical radius"), _("Ry:"), _("Vertical radius of rounded corners"),
"tools.shapes.rect", "ry", 0,
}
// add the units menu
{
}
/* Reset */
{
_("Not rounded"),
_("Make corners sharp"),
"squared_corner",
}
sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_rect_toolbox_selection_changed), (GObject *)holder))
);
}
//########################
//## 3D Box ##
//########################
// normalize angle so that it lies in the interval [0,360]
static double box3d_normalize_angle (double a) {
if (angle < 0) {
angle += 360.0;
}
return angle;
}
static void
// 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).
if (is_infinite) {
if (angle != NR_HUGE) { // FIXME: We should catch this error earlier (don't show the spinbutton at all)
}
} else {
}
}
static void
if (!persp_repr) {
g_print ("No perspective given to box3d_resync_toolbar().\n");
return;
}
GtkAdjustment *adj = 0;
GtkToggleAction *tact = 0;
{
}
{
}
{
}
}
{
// quit if run by the attr_changed listener
// note: it used to work without the differently called freeze_ attributes (here and in
// box3d_angle_value_changed()) but I now it doesn't so I'm leaving them in for now
return;
}
// set freeze so that it can be caught in box3d_angle_z_value_changed() (to avoid calling
// sp_document_maybe_done() when the document is undo insensitive)
// TODO: Only update the appropriate part of the toolbar
// if (!strcmp(name, "inkscape:vp_z")) {
// }
}
{
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
/**
* \param selection Should not be NULL.
*/
// 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
{
// 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
// update the perspectives with infinite VPs and leave the other ones untouched).
// FIXME: Also deal with multiple selected boxes
if (persp_repr) {
}
}
}
static void
{
// quit if run by the attr_changed listener
// note: it used to work without the differently called freeze_ attributes (here and in
// box3d_persp_tb_event_attr_changed()) but I now it doesn't so I'm leaving them in for now
return;
}
// in turn, prevent listener from responding
//Persp3D *persp = document->current_persp3d;
if (sel_persps.empty()) {
// this can happen when the document is created; we silently ignore it
return;
}
// TODO: use the correct axis here, too
sp_document_maybe_done(document, "perspangle", SP_VERB_CONTEXT_3DBOX, _("3D Box: Change perspective (angle of infinite axis)"));
}
static void
{
}
static void
{
}
static void
{
}
static void box3d_vp_state_changed( GtkToggleAction *act, GtkAction */*box3d_angle*/, Proj::Axis axis )
{
// TODO: Take all selected perspectives into account
if (sel_persps.empty()) {
// this can happen when the document is created; we silently ignore it
return;
}
}
{
}
{
}
{
}
{
EgeAdjustmentAction* eact = 0;
/* Angle X */
{
_("Angle in X direction"), _("Angle X:"),
// Translators: PL is short for 'perspective line'
_("Angle of PLs in X direction"),
-360.0, 360.0, 1.0, 10.0,
}
} else {
}
/* VP X state */
{
// Translators: VP is short for 'vanishing point'
_("State of VP in X direction"),
_("Toggle VP in X direction between 'finite' and 'infinite' (=parallel)"),
"toggle_vp_x",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_x_state_changed), box3d_angle_x );
gtk_action_set_sensitive( GTK_ACTION(box3d_angle_x), !prefs_get_int_attribute( "tools.shapes.3dbox", "vp_x_state", 1 ) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.shapes.3dbox", "vp_x_state", 1 ) );
}
/* Angle Y */
{
_("Angle in Y direction"), _("Angle Y:"),
// Translators: PL is short for 'perspective line'
_("Angle of PLs in Y direction"),
-360.0, 360.0, 1.0, 10.0,
}
} else {
}
/* VP Y state */
{
// Translators: VP is short for 'vanishing point'
_("State of VP in Y direction"),
_("Toggle VP in Y direction between 'finite' and 'infinite' (=parallel)"),
"toggle_vp_y",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_y_state_changed), box3d_angle_y );
gtk_action_set_sensitive( GTK_ACTION(box3d_angle_y), !prefs_get_int_attribute( "tools.shapes.3dbox", "vp_y_state", 1 ) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.shapes.3dbox", "vp_y_state", 1 ) );
}
/* Angle Z */
{
_("Angle in Z direction"), _("Angle Z:"),
// Translators: PL is short for 'perspective line'
_("Angle of PLs in Z direction"),
-360.0, 360.0, 1.0, 10.0,
}
} else {
}
/* VP Z state */
{
// Translators: VP is short for 'vanishing point'
_("State of VP in Z direction"),
_("Toggle VP in Z direction between 'finite' and 'infinite' (=parallel)"),
"toggle_vp_z",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_z_state_changed), box3d_angle_z );
gtk_action_set_sensitive( GTK_ACTION(box3d_angle_z), !prefs_get_int_attribute( "tools.shapes.3dbox", "vp_z_state", 1 ) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.shapes.3dbox", "vp_z_state", 1 ) );
}
sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), (GObject *)holder))
);
}
//########################
//## Spiral ##
//########################
static void
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
{
modmade = true;
}
}
if (modmade) {
_("Change spiral"));
}
}
static void
{
}
static void
{
}
static void
{
}
static void
{
// fixme: make settable
}
{
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
static void
{
int n_selected = 0;
{
n_selected++;
}
}
if (n_selected == 0) {
} else if (n_selected == 1) {
if (repr) {
}
} else {
// FIXME: implement averaging of all parameters for multiple selected
//gtk_label_set_markup(GTK_LABEL(l), _("<b>Average:</b>"));
}
}
static void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
EgeAdjustmentAction* eact = 0;
{
}
/* Revolution */
{
_("Number of turns"), _("Turns:"), _("Number of revolutions"),
0.01, 1024.0, 0.1, 1.0,
}
/* Expansion */
{
gchar const* labels[] = {_("circle"), _("edge is much denser"), _("edge is denser"), _("even"), _("center is denser"), _("center is much denser"), 0};
0.0, 1000.0, 0.01, 1.0,
}
/* T0 */
{
_("Inner radius"), _("Inner radius:"), _("Radius of the innermost revolution (relative to the spiral size)"),
0.0, 0.999, 0.01, 1.0,
}
/* Reset */
{
_("Defaults"),
_("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
}
sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_spiral_toolbox_selection_changed), (GObject *)holder))
);
}
//########################
//########################
/* This is used in generic functions below to share large portions of code between pen and pencil tool */
static char const *
{
? "tools.freehand.pen"
: "tools.freehand.pencil" );
}
{
// in pen tool we have more options than in pencil tool; if one of them was chosen, we do any
// preparatory work here
}
}
static void sp_add_freehand_mode_toggle(GtkActionGroup* mainActions, GObject* holder, bool tool_is_pencil)
{
/* Freehand mode toggle buttons */
{
guint freehandMode = prefs_get_int_attribute(tool_is_pencil ? "tools.freehand.pencil" : "tools.freehand.pen", "freehand-mode", 0);
{
0, _("Bezier"),
1, _("Create regular Bezier path"),
2, "bezier_mode",
-1 );
0, _("Spiro"),
1, _("Create Spiro path"),
2, "spiro_splines_mode",
-1 );
if (!tool_is_pencil) {
0, _("Zigzag"),
1, _("Create a sequence of straight line segments"),
2, "polylines_mode",
-1 );
0, _("Paraxial"),
1, _("Create a sequence of paraxial line segments"),
2, "paraxial_lines_mode",
-1 );
}
"FreehandModeActionPencil" :
"FreehandModeActionPen",
}
}
}
}
/**
* \brief Generate the list of freehand advanced shape option entries.
*/
return glist;
}
static void
freehand_add_advanced_shape_options(GtkActionGroup* mainActions, GObject* holder, bool tool_is_pencil) {
/*advanced shape options */
{
{
count++;
}
g_list_free( items );
items = 0;
ege_select_one_action_set_active( act1, prefs_get_int_attribute(tool_is_pencil ? "tools.freehand.pencil" : "tools.freehand.pen", "shape", 0) );
}
}
static void sp_pen_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* mainActions, GObject* holder)
{
}
static void
{
// fixme: make settable
}
static void
{
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
prefs_set_double_attribute("tools.freehand.pencil",
}
static void
const gchar */*key*/,
const gchar */*oldval*/,
const gchar */*newval*/,
bool /*is_interactive*/,
void * data)
{
return;
}
"tolerance");
double v = prefs_get_double_attribute("tools.freehand.pencil",
}
{
NULL,
NULL,
NULL,
NULL,
};
static void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
EgeAdjustmentAction* eact = 0;
/* Tolerance */
{
gchar const* labels[] = {_("(many nodes, rough)"), _("(default)"), 0, 0, 0, 0, _("(few nodes, smooth)")};
_("Smoothing:"), _("Smoothing: "),
_("How much smoothing (simplifying) is applied to the line"),
"tools.freehand.pencil", "tolerance",
3.0,
1, 100.0, 0.5, 0,
1, 2);
"tools.freehand.pencil");
}
/* advanced shape options */
/* Reset */
{
_("Defaults"),
_("Reset pencil parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
}
}
//########################
//## Tweak ##
//########################
{
}
{
}
{
prefs_set_int_attribute( "tools.tweak", "usepressure", gtk_toggle_action_get_active( act ) ? 1 : 0);
}
{
} else {
}
}
{
}
}
}
}
}
{
{
/* Width */
gchar const* labels[] = {_("(pinch tweak)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad tweak)")};
_("Width"), _("Width:"), _("The width of the tweak area (relative to the visible canvas area)"),
1, 100, 1.0, 0.0,
}
{
/* Force */
gchar const* labels[] = {_("(minimum force)"), 0, 0, _("(default)"), 0, 0, 0, _("(maximum force)")};
_("Force"), _("Force:"), _("The force of the tweak action"),
1, 100, 1.0, 0.0,
}
/* Mode */
{
0, _("Push mode"),
1, _("Push parts of paths in any direction"),
2, "tweak_push_mode",
-1 );
0, _("Shrink mode"),
1, _("Shrink (inset) parts of paths"),
2, "tweak_shrink_mode",
-1 );
0, _("Grow mode"),
1, _("Grow (outset) parts of paths"),
2, "tweak_grow_mode",
-1 );
0, _("Attract mode"),
1, _("Attract parts of paths towards cursor"),
2, "tweak_attract_mode",
-1 );
0, _("Repel mode"),
1, _("Repel parts of paths from cursor"),
2, "tweak_repel_mode",
-1 );
0, _("Roughen mode"),
1, _("Roughen parts of paths"),
2, "tweak_roughen_mode",
-1 );
0, _("Color paint mode"),
1, _("Paint the tool's color upon selected objects"),
2, "tweak_colorpaint_mode",
-1 );
0, _("Color jitter mode"),
1, _("Jitter the colors of selected objects"),
2, "tweak_colorjitter_mode",
-1 );
EgeSelectOneAction* act = ege_select_one_action_new( "TweakModeAction", _("Mode"), (""), NULL, GTK_TREE_MODEL(model) );
}
{
}
{
_("Hue"),
_("In color mode, act on objects' hue"),
NULL,
//TRANSLATORS: "H" here stands for hue
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "doh", 1 ) );
}
{
_("Saturation"),
_("In color mode, act on objects' saturation"),
NULL,
//TRANSLATORS: "S" here stands for Saturation
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "dos", 1 ) );
}
{
_("Lightness"),
_("In color mode, act on objects' lightness"),
NULL,
//TRANSLATORS: "L" here stands for Lightness
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "dol", 1 ) );
}
{
_("Opacity"),
_("In color mode, act on objects' opacity"),
NULL,
//TRANSLATORS: "O" here stands for Opacity
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "doo", 1 ) );
}
{ /* Fidelity */
gchar const* labels[] = {_("(rough, simplified)"), 0, 0, _("(default)"), 0, 0, _("(fine, but many nodes)")};
_("Fidelity"), _("Fidelity:"),
_("Low fidelity simplifies paths; high fidelity preserves path features but may generate a lot of new nodes"),
1, 100, 1.0, 10.0,
}
/* Use Pressure button */
{
_("Pressure"),
_("Use the pressure of the input device to alter the force of tweak action"),
"use_pressure",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_tweak_pressure_state_changed), NULL);
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "usepressure", 1 ) );
}
}
//########################
//## Calligraphy ##
//########################
{
return;
EgeSelectOneAction *sel = static_cast<EgeSelectOneAction *>(g_object_get_data(tbl, "profile_selector"));
if (!sel) {
return;
}
for (int i = 1; i <= total_prefs; i++) {
bool match = true;
for ( Inkscape::Util::List<Inkscape::XML::AttributeRecord const> iter = preset_repr->attributeList();
iter;
++iter ) {
continue;
if (widget) {
if (GTK_IS_ADJUSTMENT(widget)) {
double v = prefs_get_double_attribute(preset_path, attr_name, 0); // fixme: no min/max checks here, add?
//std::cout << "compared adj " << attr_name << gtk_adjustment_get_value(adj) << " to " << v << "\n";
match = false;
break;
}
} else if (GTK_IS_TOGGLE_ACTION(widget)) {
//std::cout << "compared toggle " << attr_name << gtk_toggle_action_get_active(toggle) << " to " << v << "\n";
if (gtk_toggle_action_get_active(toggle) != v) {
match = false;
break;
}
}
}
}
if (match) {
// newly added item is at the same index as the
// save command, so we need to change twice for it to take effect
return;
}
}
// no match found
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
prefs_set_int_attribute( "tools.calligraphic", "usepressure", gtk_toggle_action_get_active( act ) ? 1 : 0);
}
{
prefs_set_int_attribute( "tools.calligraphic", "tracebackground", gtk_toggle_action_get_active( act ) ? 1 : 0);
}
{
prefs_set_int_attribute( "tools.calligraphic", "usetilt", gtk_toggle_action_get_active( act ) ? 1 : 0 );
if (calligraphy_angle )
}
static gchar const *const widget_names[] = {
"width",
"mass",
"wiggle",
"angle",
"thinning",
"tremor",
"flatness",
"cap_rounding",
"usepressure",
"tracebackground",
"usetilt"
};
{
EgeSelectOneAction* selector = static_cast<EgeSelectOneAction *>(g_object_get_data(tbl, "profile_selector"));
{
}
//TODO: switch back to prefs API
int ii=1;
while (child_repr) {
}
{
}
}
{
if (! desktop) return;
return;
// dialog cancelled
return;
}
// empty name entered
return;
}
int new_index = -1;
for (int i = 1; i <= total_prefs; i++) {
// we already have preset with this name, replace its values
new_index = i;
break;
}
}
if (new_index == -1) {
// no preset with this name, create
}
for (unsigned i = 0; i < G_N_ELEMENTS(widget_names); ++i) {
if (widget) {
if (GTK_IS_ADJUSTMENT(widget)) {
double v = gtk_adjustment_get_value(adj);
//std::cout << "wrote adj " << widget_name << ": " << v << "\n";
} else if (GTK_IS_TOGGLE_ACTION(widget)) {
int v = gtk_toggle_action_get_active(toggle);
//std::cout << "wrote tog " << widget_name << ": " << v << "\n";
} else {
}
} else {
}
}
}
if (preset_index == save_presets_index) {
// this is the Save command
return;
}
return;
if (preset_path) {
g_object_set_data(tbl, "presets_blocked", GINT_TO_POINTER(TRUE)); //temporarily block the selector so no one will updadte it while we're reading it
for ( Inkscape::Util::List<Inkscape::XML::AttributeRecord const> iter = preset_repr->attributeList();
iter;
++iter ) {
continue;
if (widget) {
if (GTK_IS_ADJUSTMENT(widget)) {
double v = prefs_get_double_attribute(preset_path, attr_name, 0); // fixme: no min/max checks here, add?
//std::cout << "set adj " << attr_name << " to " << v << "\n";
} else if (GTK_IS_TOGGLE_ACTION(widget)) {
//std::cout << "set toggle " << attr_name << " to " << v << "\n";
} else {
}
} else {
}
}
}
}
static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
{
{
/* Width */
gchar const* labels[] = {_("(hairline)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad stroke)")};
_("Pen Width"), _("Width:"),
_("The width of the calligraphic pen (relative to the visible canvas area)"),
1, 100, 1.0, 0.0,
}
{
/* Thinning */
gchar const* labels[] = {_("(speed blows up stroke)"), 0, 0, _("(slight widening)"), _("(constant width)"), _("(slight thinning, default)"), 0, 0, _("(speed deflates stroke)")};
_("Stroke Thinning"), _("Thinning:"),
_("How much velocity thins the stroke (> 0 makes fast strokes thinner, < 0 makes them broader, 0 makes width independent of velocity)"),
-100, 100, 1, 0.1,
}
{
/* Angle */
gchar const* labels[] = {_("(left edge up)"), 0, 0, _("(horizontal)"), _("(default)"), 0, _("(right edge up)")};
_("Pen Angle"), _("Angle:"),
_("The angle of the pen's nib (in degrees; 0 = horizontal; has no effect if fixation = 0)"),
-90.0, 90.0, 1.0, 10.0,
sp_ddc_angle_value_changed, 1, 0 );
}
{
/* Fixation */
gchar const* labels[] = {_("(perpendicular to stroke, \"brush\")"), 0, 0, 0, _("(almost fixed, default)"), _("(fixed by Angle, \"pen\")")};
_("Fixation"), _("Fixation:"),
_("Angle behavior (0 = nib always perpendicular to stroke direction, 1 = fixed angle)"),
0.0, 100, 1.0, 10.0,
}
{
/* Cap Rounding */
gchar const* labels[] = {_("(blunt caps, default)"), _("(slightly bulging)"), 0, 0, _("(approximately round)"), _("(long protruding caps)")};
// TRANSLATORS: "cap" means "end" (both start and finish) here
_("Cap rounding"), _("Caps:"),
_("Increase to make caps at the ends of strokes protrude more (0 = no caps, 1 = round caps)"),
0.0, 5.0, 0.01, 0.1,
}
{
/* Tremor */
gchar const* labels[] = {_("(smooth line)"), _("(slight tremor)"), _("(noticeable tremor)"), 0, 0, _("(maximum tremor)")};
_("Stroke Tremor"), _("Tremor:"),
_("Increase to make strokes rugged and trembling"),
0.0, 100, 1, 0.0,
}
{
/* Wiggle */
gchar const* labels[] = {_("(no wiggle)"), _("(slight deviation)"), 0, 0, _("(wild waves and curls)")};
_("Pen Wiggle"), _("Wiggle:"),
_("Increase to make the pen waver and wiggle"),
0.0, 100, 1, 0.0,
}
{
/* Mass */
gchar const* labels[] = {_("(no inertia)"), _("(slight smoothing, default)"), _("(noticeable lagging)"), 0, 0, _("(maximum inertia)")};
_("Pen Mass"), _("Mass:"),
_("Increase to make the pen drag behind, as if slowed by inertia"),
0.0, 100, 1, 0.0,
}
/* Trace Background button */
{
_("Trace Background"),
_("Trace the lightness of the background by the width of the pen (white - minimum width, black - maximum width)"),
"trace_background",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_ddc_trace_background_changed), holder);
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.calligraphic", "tracebackground", 0 ) );
}
/* Use Pressure button */
{
_("Pressure"),
_("Use the pressure of the input device to alter the width of the pen"),
"use_pressure",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_ddc_pressure_state_changed), holder);
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.calligraphic", "usepressure", 1 ) );
}
/* Use Tilt button */
{
_("Tilt"),
_("Use the tilt of the input device to alter the angle of the pen's nib"),
"use_tilt",
gtk_action_set_sensitive( GTK_ACTION(calligraphy_angle), !prefs_get_int_attribute( "tools.calligraphic", "usetilt", 1 ) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.calligraphic", "usetilt", 1 ) );
}
/*calligraphic profile */
{
EgeSelectOneAction* act1 = ege_select_one_action_new ("SetProfileAction", "" , (_("Choose a preset")), NULL, GTK_TREE_MODEL(model));
}
}
}
//########################
//## Circle / Arc ##
//########################
{
}
} else {
}
}
static void
sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *value_name, gchar const *other_name)
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
{
else
modmade = true;
}
}
if (modmade) {
}
}
{
}
{
}
{
if ( ege_select_one_action_get_active( act ) != 0 ) {
} else {
}
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
if ( ege_select_one_action_get_active(act) != 0 ) {
{
modmade = true;
}
}
} else {
{
modmade = true;
}
}
}
if (modmade) {
}
}
{
}
{
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
if (openstr) {
} else {
}
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
{
int n_selected = 0;
{
n_selected++;
}
}
if (n_selected == 0) {
} else if (n_selected == 1) {
if (repr) {
}
} else {
// FIXME: implement averaging of all parameters for multiple selected
//gtk_label_set_markup(GTK_LABEL(l), _("<b>Average:</b>"));
}
}
{
EgeAdjustmentAction* eact = 0;
{
}
/* Start */
{
_("Start"), _("Start:"),
_("The angle (in degrees) from the horizontal to the arc's start point"),
-360.0, 360.0, 1.0, 10.0,
0, 0, 0,
}
/* End */
{
_("End"), _("End:"),
_("The angle (in degrees) from the horizontal to the arc's end point"),
-360.0, 360.0, 1.0, 10.0,
0, 0, 0,
}
/* Segments / Pie checkbox */
{
0, _("Closed arc"),
1, _("Switch to segment (closed shape with two radii)"),
2, "circle_closed_arc",
-1 );
0, _("Open Arc"),
1, _("Switch to arc (unclosed shape)"),
2, "circle_open_arc",
-1 );
EgeSelectOneAction* act = ege_select_one_action_new( "ArcOpenAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_arctb_open_state_changed), holder );
}
/* Make Whole */
{
_("Make whole"),
_("Make the shape a whole ellipse, not arc or segment"),
"reset_circle",
}
// sensitivize make whole and open checkbox
{
}
sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_arc_toolbox_selection_changed), (GObject *)holder))
);
}
// toggle button callbacks and updaters
//########################
//## Dropper ##
//########################
if ( set_action ) {
if ( gtk_toggle_action_get_active( act ) ) {
} else {
}
}
}
prefs_set_int_attribute( "tools.dropper", "setalpha", gtk_toggle_action_get_active( act ) ? 1 : 0 );
}
/**
* Dropper auxiliary toolbar construction and setup.
*
* TODO: Would like to add swatch of current color.
* 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)
{
{
}
{
_("Pick opacity"),
_("Pick both the color and the alpha (transparency) under cursor; otherwise, pick only the visible color premultiplied by alpha"),
NULL,
}
{
_("Assign opacity"),
_("If alpha was picked, assign it to selection as fill or stroke transparency"),
NULL,
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.dropper", "setalpha", 1 ) );
// make sure it's disabled if we're not picking alpha
}
}
//########################
//## 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)
{
g_print ("sp_lpetool_mode_changed()\n");
using namespace Inkscape::LivePathEffect;
if (!SP_IS_LPETOOL_CONTEXT(ec)) {
g_print ("event context is not a LPEToolContext!\n");
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
{
g_print ("sp_lpetool_test_value_changed()\n");
using namespace Inkscape::LivePathEffect;
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
if (!lpeab) {
g_print ("no LPE!\n");
} else {
g_print ("LPE found. Adjusting left length\n");
sp_lpe_item_update_patheffect(lpeitem, true, true);
}
}
void
{
using namespace Inkscape::LivePathEffect;
g_print ("sp_lpetool_toolbox_sel_changed()");
{
g_print (" - item found\n");
} else {
}
} else {
g_print (" - unsetting item\n");
}
}
g_print ("\n");
}
static void
}
}
static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, 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, _("all_inactive"),
-1 );
for (int i = 1; i < num_subtools; ++i) { // we start with i = 1 because INVALID_LPE was already added
type = lpesubtools[i];
-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)"),
"lpetool_show_bbox",
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.lpetool", "show_bbox", 1 ) );
}
/* Test action */
/**
{
EgeAdjustmentAction* eact = 0;
gchar const* labels[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500};
eact = create_adjustment_action( "TestLPEAction",
_("Test value"), _("Test value:"), _("Test for interactive control widgets ..."),
"tools.lpetool", "testvalue", 0,
GTK_WIDGET(desktop->canvas), NULL us, holder, TRUE, "altx-lpetool",
-1e6, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
labels, values, G_N_ELEMENTS(labels),
sp_lpetool_test_value_changed );
//tracker->addAdjustment( ege_adjustment_action_get_adjustment(eact) );
g_object_set_data( holder, "lpetool_test_action", eact );
gtk_action_set_sensitive( GTK_ACTION(eact), FALSE );
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
}
**/
//watch selection
}
//########################
//## Eraser ##
//########################
{
}
// only take action if run by the attr_changed listener
// in turn, prevent listener from responding
if ( eraserMode != 0 ) {
} else {
}
// TODO finish implementation
}
}
static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
{
/* Width */
gchar const* labels[] = {_("(hairline)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad stroke)")};
_("Pen Width"), _("Width:"),
_("The width of the eraser pen (relative to the visible canvas area)"),
"tools.eraser", "width", 15,
1, 100, 1.0, 0.0,
}
{
0, _("Delete"),
1, _("Delete objects touched by the eraser"),
2, "delete_object",
-1 );
0, _("Cut"),
1, _("Cut out from objects"),
2, "difference",
-1 );
EgeSelectOneAction* act = ege_select_one_action_new( "EraserModeAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
}
}
//########################
//## Text Toolbox ##
//########################
/*
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)
{
//Call back for line height spinbutton
}
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)
{
//Call back for vertical kerning spinbutton
}
static void
sp_text_letter_rotation_changed(GtkAdjustment *adj, GtkWidget *tbl)
{
//Call back for letter rotation spinbutton
}*/
namespace {
bool popdown_visible = false;
bool popdown_hasfocus = false;
void
{
// int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
int result_family =
int result_style =
int result_numbers =
// If querying returned nothing, read the style from the text tool prefs (default style for new texts)
if (result_family == QUERY_STYLE_NOTHING || result_style == QUERY_STYLE_NOTHING || result_numbers == QUERY_STYLE_NOTHING) {
// there are no texts in selection, read from prefs
if (repr) {
// do not reset the toolbar style from prefs if we already did it last time
return;
}
} else {
return;
}
} else {
}
{
if (result_family == QUERY_STYLE_MULTIPLE_DIFFERENT) {
// Get the font that corresponds
if (font) {
}
try {
} catch (...) {
return;
}
GtkTreeSelection *tselection = GTK_TREE_SELECTION (g_object_get_data (G_OBJECT(tbl), "family-tree-selection"));
}
//Size
{
}
//Anchor
{
}
else
{
{
}
{
}
{
}
}
//Style
{
{
}
}
{
{
}
}
//Orientation
//locking both buttons, changing one affect all group (both)
{
}
else
{
}
}
}
void
{
}
void
{
}
void
{
GtkTreeModel *model = 0;
char *family = 0;
return;
}
{
return;
}
int result_fontspec =
//font_instance * fontFromStyle = font_factory::Default()->FaceFromStyle(query);
// First try to get the font spec from the stored value
Glib::ustring fontSpec = query->text->font_specification.set ? query->text->font_specification.value : "";
// Construct a new font specification if it does not yet exist
fontFromStyle->Unref();
}
Glib::ustring newFontSpec = font_factory::Default()->ReplaceFontSpecificationFamily(fontSpec, family);
if (font) {
// Set all the these just in case they were altered when finding the best
// match for the new family and old style...
gchar c[256];
}
}
}
// If querying returned nothing, set the default style of the tool (for new texts)
if (result_fontspec == QUERY_STYLE_NOTHING)
{
sp_text_edit_dialog_default_set_insensitive (); //FIXME: Replace trough a verb
}
else
{
}
_("Text: Change font family"));
}
/* This is where execution comes when the contents of the font family box have been completed
by the press of the return key */
void
{
// Try to match that to a known font. If not, then leave current font alone and remain focused on text box
try {
GtkTreeSelection *selection = GTK_TREE_SELECTION (g_object_get_data (G_OBJECT(tbl), "family-tree-selection"));
} catch (...) {
{
}
}
}
void
{
switch (prop)
{
case 0:
{
break;
}
case 1:
{
break;
}
case 2:
{
break;
}
case 3:
{
break;
}
}
int result_numbers =
// If querying returned nothing, read the style from the text tool prefs (default style for new texts)
if (result_numbers == QUERY_STYLE_NOTHING)
{
}
_("Text: Change alignment"));
}
void
{
int result_fontspec =
//int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
//int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE);
//int result_numbers = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
Glib::ustring fontSpec = query->text->font_specification.set ? query->text->font_specification.value : "";
// Construct a new font specification if it does not yet exist
fontFromStyle->Unref();
}
switch (prop)
{
case 0:
{
}
if (fontSpec != newFontSpec) {
// Don't even set the bold if the font didn't exist on the system
}
break;
}
case 1:
{
}
if (fontSpec != newFontSpec) {
// Don't even set the italic if the font didn't exist on the system
}
break;
}
}
if (!newFontSpec.empty()) {
}
// If querying returned nothing, read the style from the text tool prefs (default style for new texts)
if (result_fontspec == QUERY_STYLE_NOTHING)
{
}
_("Text: Change font style"));
}
void
{
return;
}
switch (prop)
{
case 0:
{
break;
}
case 1:
{
break;
}
}
int result_numbers =
// If querying returned nothing, read the style from the text tool prefs (default style for new texts)
if (result_numbers == QUERY_STYLE_NOTHING)
{
}
_("Text: Change orientation"));
}
{
switch (get_group0_keyval (event)) {
case GDK_Escape: // defocus
return TRUE; // I consumed the event
break;
}
return FALSE;
}
{
switch (get_group0_keyval (event)) {
case GDK_KP_Enter:
case GDK_Return:
case GDK_Escape: // defocus
gtk_widget_hide (w);
popdown_visible = false;
return TRUE; // I consumed the event
break;
case GDK_w:
case GDK_W:
gtk_widget_hide (w);
popdown_visible = false;
return TRUE; // I consumed the event
}
break;
}
return FALSE;
}
void
{
// If this is not from selecting a size in the list (in which case get_active will give the
// process this event. This fixes GTK's stupid insistence on sending an activate change every
// time any character gets typed or deleted, which made this control nearly unusable in 0.45.
return;
{
if (text) {
value = -1;
}
}
}
if (value <= 0) {
return; // could not parse value
}
int result_numbers =
// If querying returned nothing, read the style from the text tool prefs (default style for new texts)
if (result_numbers == QUERY_STYLE_NOTHING)
{
}
_("Text: Change font size"));
}
{
}
return FALSE; // I consumed the event
}
{
switch (get_group0_keyval (event)) {
case GDK_Escape: // defocus
return TRUE; // I consumed the event
break;
case GDK_Return: // defocus
case GDK_KP_Enter:
return TRUE; // I consumed the event
break;
}
return FALSE;
}
void
{
int x, y;
if (!popdown_visible)
{
//sp_transientize (popdown);
popdown_visible = true;
}
else
{
popdown_visible = false;
}
}
GdkEventFocus */*event*/,
GObject */*tbl*/)
{
return FALSE;
}
GdkEventFocus */*event*/,
GObject */*tbl*/)
{
if (popdown_hasfocus) {
popdown_hasfocus = false;
popdown_visible = false;
return TRUE;
}
return FALSE;
}
GdkEventFocus */*event*/,
GObject */*tbl*/)
{
popdown_hasfocus = true;
return TRUE;
}
void
gpointer /*data*/)
{
static char const *const sample = _("AaBbCcIiPpQq12369$\342\202\254\302\242?.;/()");
}
if (completion) {
}
}
{
////////////Family
//Window
//Entry
//Button
//Popdown
gtk_tree_view_column_set_cell_data_func (column, cell, GtkTreeCellDataFunc (cell_data_func), NULL, NULL);
//gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), TRUE);
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (sp_text_toolbox_family_entry_activate), tbl);
g_signal_connect (G_OBJECT (entry), "focus-in-event", G_CALLBACK (sp_text_toolbox_entry_focus_in), tbl);
g_signal_connect (G_OBJECT (entry), "key-press-event", G_CALLBACK(sp_text_toolbox_family_keypress), tbl);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (sp_text_toolbox_text_popdown_clicked), tbl);
g_signal_connect (G_OBJECT (window), "focus-out-event", G_CALLBACK (sp_text_toolbox_popdown_focus_out), tbl);
g_signal_connect (G_OBJECT (window), "focus-in-event", G_CALLBACK (sp_text_toolbox_popdown_focus_in), tbl);
g_signal_connect (G_OBJECT (window), "key-press-event", G_CALLBACK(sp_text_toolbox_family_list_keypress), tbl);
g_signal_connect (G_OBJECT (tselection), "changed", G_CALLBACK (sp_text_toolbox_family_changed), tbl);
gtk_tooltips_set_tip (tooltips, box, _("This font is currently not installed on your system. Inkscape will use the default font instead."), "");
////////////Size
"4", "6", "8", "9", "10", "11", "12", "13", "14",
"16", "18", "20", "22", "24", "28",
"32", "36", "40", "48", "56", "64", "72", "144"
};
for (unsigned int i = 0; i < G_N_ELEMENTS(sizes); ++i) {
}
gtk_signal_connect(GTK_OBJECT(gtk_bin_get_child(GTK_BIN(cbox))), "key-press-event", GTK_SIGNAL_FUNC(sp_text_toolbox_size_keypress), tbl);
gtk_signal_connect(GTK_OBJECT(gtk_bin_get_child(GTK_BIN(cbox))), "focus-out-event", GTK_SIGNAL_FUNC(sp_text_toolbox_size_focusout), tbl);
////////////Text anchor
// left
gtk_container_add (GTK_CONTAINER (rbutton), gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_LEFT, secondarySize));
g_signal_connect (G_OBJECT (rbutton), "toggled", G_CALLBACK (sp_text_toolbox_anchoring_toggled), gpointer(0));
// center
gtk_container_add (GTK_CONTAINER (rbutton), gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_CENTER, secondarySize));
g_signal_connect (G_OBJECT (rbutton), "toggled", G_CALLBACK (sp_text_toolbox_anchoring_toggled), gpointer (1));
// right
gtk_container_add (GTK_CONTAINER (rbutton), gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_RIGHT, secondarySize));
g_signal_connect (G_OBJECT (rbutton), "toggled", G_CALLBACK (sp_text_toolbox_anchoring_toggled), gpointer(2));
// fill
gtk_container_add (GTK_CONTAINER (rbutton), gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_FILL, secondarySize));
g_signal_connect (G_OBJECT (rbutton), "toggled", G_CALLBACK (sp_text_toolbox_anchoring_toggled), gpointer(3));
//spacer
////////////Text style
// bold
rbutton = gtk_toggle_button_new ();
gtk_container_add (GTK_CONTAINER (rbutton), gtk_image_new_from_stock (GTK_STOCK_BOLD, secondarySize));
g_signal_connect (G_OBJECT (rbutton), "toggled", G_CALLBACK (sp_text_toolbox_style_toggled), gpointer(0));
// italic
rbutton = gtk_toggle_button_new ();
gtk_container_add (GTK_CONTAINER (rbutton), gtk_image_new_from_stock (GTK_STOCK_ITALIC, secondarySize));
g_signal_connect (G_OBJECT (rbutton), "toggled", G_CALLBACK (sp_text_toolbox_style_toggled), gpointer (1));
//spacer
////////////Text orientation
// horizontal
g_signal_connect (G_OBJECT (rbutton), "toggled", G_CALLBACK (sp_text_toolbox_orientation_toggled), gpointer(0));
// vertical
g_signal_connect (G_OBJECT (rbutton), "toggled", G_CALLBACK (sp_text_toolbox_orientation_toggled), gpointer (1));
//watch selection
return GTK_WIDGET(tbl);
} // end of sp_text_toolbox_new()
}//<unnamed> namespace
//#########################
//## Connector ##
//#########################
static void sp_connector_path_set_avoid(void)
{
cc_selection_set_avoid(true);
}
static void sp_connector_path_set_ignore(void)
{
cc_selection_set_avoid(false);
}
{
// quit if run by the _changed callbacks
return;
}
{
return;
}
return;
}
return;
}
// in turn, prevent callbacks from responding
avoid_item_move(&m, item);
}
if (items) {
}
_("Change connector spacing"));
}
static void sp_connector_graph_layout(void)
{
if (!SP_ACTIVE_DESKTOP) return;
// hack for clones, see comment in align-and-distribute.cpp
int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
}
{
if ( gtk_toggle_action_get_active( act ) ) {
"true");
} else {
"false");
}
}
{
if ( gtk_toggle_action_get_active( act ) ) {
"true");
} else {
"false");
}
}
{
}
{
return;
}
return;
}
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder )
{
{
_("Avoid"),
_("Make connectors avoid selected objects"),
"connector_avoid",
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_path_set_avoid), holder );
}
{
_("Ignore"),
_("Make connectors ignore selected objects"),
"connector_ignore",
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_path_set_ignore), holder );
}
EgeAdjustmentAction* eact = 0;
// Spacing spinbox
_("Connector Spacing"), _("Spacing:"),
_("The amount of space left around objects by auto-routing connectors"),
0, 100, 1.0, 10.0,
0, 0, 0,
connector_spacing_changed, 1, 0 );
// Graph (connector network) layout
{
_("Graph"),
_("Nicely arrange selected connector network"),
"graph_layout",
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_graph_layout), holder );
}
// Default connector length spinbox
_("Connector Length"), _("Length:"),
_("Ideal length for connectors when layout is applied"),
10, 1000, 10.0, 100.0,
0, 0, 0,
connector_length_changed, 1, 0 );
// Directed edges toggle button
{
_("Downwards"),
_("Make connectors with end-markers (arrows) point downwards"),
"directed_graph",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_directed_graph_layout_toggled), holder );
}
// Avoid overlaps toggle button
{
_("Remove overlaps"),
_("Do not allow overlapping shapes"),
"remove_overlaps",
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_nooverlaps_graph_layout_toggled), holder );
}
// Code to watch for changes to the connector-spacing attribute in
// the XML.
if (repr) {
}
} // end of sp_connector_toolbox_prep()
//#########################
//## Paintbucket ##
//#########################
{
}
{
}
{
}
{
prefs_set_double_attribute("tools.paintbucket", "offset", (gdouble)sp_units_get_pixels(adj->value, *unit));
}
{
// FIXME: make defaults settable via Inkscape Options
struct KeyValue {
char const *key;
double value;
} const key_values[] = {
{"threshold", 15},
{"offset", 0.0}
};
for (unsigned i = 0; i < G_N_ELEMENTS(key_values); ++i) {
if ( adj ) {
}
}
EgeSelectOneAction* channels_action = EGE_SELECT_ONE_ACTION( g_object_get_data (tbl, "channels_action" ) );
EgeSelectOneAction* autogap_action = EGE_SELECT_ONE_ACTION( g_object_get_data (tbl, "autogap_action" ) );
}
static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
EgeAdjustmentAction* eact = 0;
{
{
count++;
}
g_list_free( items );
items = 0;
EgeSelectOneAction* act1 = ege_select_one_action_new( "ChannelsAction", _("Fill by"), (""), NULL, GTK_TREE_MODEL(model) );
ege_select_one_action_set_active( act1, prefs_get_int_attribute("tools.paintbucket", "channels", 0) );
}
// Spacing spinbox
{
"ThresholdAction",
_("Fill Threshold"), _("Threshold:"),
_("The maximum allowed difference between the clicked pixel and the neighboring pixels to be counted in the fill"),
"inkscape:paintbucket-threshold", 0, 100.0, 1.0, 0.0,
0, 0, 0,
paintbucket_threshold_changed, 1, 0 );
}
// Create the units menu.
if (stored_unit)
{
}
// Offset spinbox
{
"OffsetAction",
_("The amount to grow (positive) or shrink (negative) the created fill path"),
"inkscape:paintbucket-offset", -1e6, 1e6, 0.1, 0.5,
0, 0, 0,
}
/* Auto Gap */
{
{
count++;
}
g_list_free( items );
items = 0;
EgeSelectOneAction* act2 = ege_select_one_action_new( "AutoGapAction", _("Close gaps"), (""), NULL, GTK_TREE_MODEL(model) );
ege_select_one_action_set_active( act2, prefs_get_int_attribute("tools.paintbucket", "autogap", 0) );
}
/* Reset */
{
_("Defaults"),
_("Reset paint bucket parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
}
}
/*
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:encoding=utf-8:textwidth=99 :