toolbox.cpp revision 5cacbbec22b42a0480f396eb94bcfb5f746ac68a
/**
* @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>
* 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 <cstring>
#include <string>
#include <iostream>
#include <sstream>
#include "../box3d-context.h"
#include "../box3d.h"
#include "../conn-avoid-ref.h"
#include "../connection-pool.h"
#include "../connector-context.h"
#include "../desktop.h"
#include "../desktop-handles.h"
#include "../desktop-style.h"
#include "../dialogs/dialog-events.h"
#include "../dialogs/text-edit.h"
#include "../document-private.h"
#include "../ege-adjustment-action.h"
#include "../ege-output-action.h"
#include "../ege-select-one-action.h"
#include "../flood-context.h"
#include "gradient-toolbar.h"
#include "../graphlayout.h"
#include "../helper/unit-menu.h"
#include "../helper/unit-tracker.h"
#include "icon.h"
#include "../ink-action.h"
#include "../ink-comboboxentry-action.h"
#include "../inkscape.h"
#include "../interface.h"
#include "../libnrtype/font-instance.h"
#include "../libnrtype/font-lister.h"
#include "../live_effects/effect.h"
#include "../live_effects/lpe-angle_bisector.h"
#include "../live_effects/lpe-line_segment.h"
#include "../lpe-tool-context.h"
#include "../mod360.h"
#include "../pen-context.h"
#include "../preferences.h"
#include "../selection-chemistry.h"
#include "../selection.h"
#include "select-toolbar.h"
#include "../shape-editor.h"
#include "../shortcuts.h"
#include "../sp-clippath.h"
#include "../sp-ellipse.h"
#include "../sp-flowtext.h"
#include "../sp-mask.h"
#include "../sp-namedview.h"
#include "../sp-rect.h"
#include "../sp-spiral.h"
#include "../sp-star.h"
#include "../sp-text.h"
#include "../style.h"
#include "../svg/css-ostringstream.h"
#include "../text-context.h"
#include "../text-editing.h"
#include "../tools-switch.h"
#include "../tweak-context.h"
#include "../spray-context.h"
#include "../ui/dialog/calligraphic-profile-rename.h"
#include "../ui/icon-names.h"
#include "../ui/tool/control-point-selection.h"
#include "../ui/tool/node-tool.h"
#include "../ui/tool/multi-path-manipulator.h"
#include "../ui/widget/style-swatch.h"
#include "../verbs.h"
#include "../widgets/spinbutton-events.h"
#include "ui/widget/spinbutton.h"
#include "../widgets/spw-utilities.h"
#include "../widgets/widget-sizes.h"
#include "../xml/attribute-record.h"
#include "../xml/node-event-vector.h"
#include "ui/uxmanager.h"
#include "toolbox.h"
//#define DEBUG_TEXT
using Inkscape::UnitTracker;
using Inkscape::DocumentUndo;
typedef void (*UpdateFunction)(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
enum BarId {
BAR_TOOL = 0,
};
#define BAR_ID_KEY "BarIdValue"
#define HANDLE_POS_MARK "x-inkscape-pos"
static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_measure_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_CONTEXT_PENCIL_PREFS, "/tools/freehand/pencil", N_("Style of new paths created by Pencil")},
SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "/tools/calligraphic", N_("Style of new calligraphic strokes")},
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'>"
" <separator />"
" <toolitem action='NodeInsertAction'>"
" <menu action='NodeInsertActionMenu'>"
" <menuitem action='NodeInsertActionMinX' />"
" <menuitem action='NodeInsertActionMaxX' />"
" <menuitem action='NodeInsertActionMinY' />"
" <menuitem action='NodeInsertActionMaxY' />"
" </menu>"
" </toolitem>"
" <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' />"
" <toolitem action='NodeAutoAction' />"
" <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='EditNextPathEffectParameter' />"
" <separator />"
" <toolitem action='NodesShowTransformHandlesAction' />"
" <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='SprayToolbar'>"
" <toolitem action='SprayModeAction' />"
" <separator />"
" <toolitem action='SprayWidthAction' />"
" <toolitem action='SprayPressureAction' />"
" <toolitem action='SprayPopulationAction' />"
" <separator />"
" <toolitem action='SprayRotationAction' />"
" <toolitem action='SprayScaleAction' />"
" <separator />"
" <toolitem action='SprayStandard_deviationAction' />"
" <toolitem action='SprayMeanAction' />"
" </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='MeasureToolbar'>"
" <toolitem action='MeasureFontSizeAction' />"
" <separator />"
" <toolitem action='measure_units_label' />"
" <toolitem action='MeasureUnitsAction' />"
" </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='EraserModeAction' />"
" <separator />"
" <toolitem action='EraserWidthAction' />"
" </toolbar>"
" <toolbar name='TextToolbar'>"
" <toolitem action='TextFontFamilyAction' />"
" <toolitem action='TextFontSizeAction' />"
" <toolitem action='TextBoldAction' />"
" <toolitem action='TextItalicAction' />"
" <separator />"
" <toolitem action='TextAlignAction' />"
" <separator />"
" <toolitem action='TextSuperscriptAction' />"
" <toolitem action='TextSubscriptAction' />"
" <separator />"
" <toolitem action='TextLineHeightAction' />"
" <toolitem action='TextLetterSpacingAction' />"
" <toolitem action='TextWordSpacingAction' />"
" <toolitem action='TextDxAction' />"
" <toolitem action='TextDyAction' />"
" <toolitem action='TextRotationAction' />"
" <separator />"
" <toolitem action='TextOrientationAction' />"
" </toolbar>"
" <toolbar name='LPEToolToolbar'>"
" <toolitem action='LPEToolModeAction' />"
" <separator />"
" <toolitem action='LPEShowBBoxAction' />"
" <toolitem action='LPEBBoxFromSelectionAction' />"
" <separator />"
" <toolitem action='LPELineSegmentAction' />"
" <separator />"
" <toolitem action='LPEMeasuringAction' />"
" <toolitem action='LPEToolUnitsAction' />"
" <separator />"
" <toolitem action='LPEOpenLPEDialogAction' />"
" </toolbar>"
" <toolbar name='DropperToolbar'>"
" <toolitem action='DropperOpacityAction' />"
" <toolitem action='DropperPickAlphaAction' />"
" <toolitem action='DropperSetAlphaAction' />"
" </toolbar>"
" <toolbar name='ConnectorToolbar'>"
// " <toolitem action='ConnectorEditModeAction' />"
" <toolitem action='ConnectorAvoidAction' />"
" <toolitem action='ConnectorIgnoreAction' />"
" <toolitem action='ConnectorOrthogonalAction' />"
" <toolitem action='ConnectorCurvatureAction' />"
" <toolitem action='ConnectorSpacingAction' />"
" <toolitem action='ConnectorGraphAction' />"
" <toolitem action='ConnectorLengthAction' />"
" <toolitem action='ConnectorDirectedAction' />"
" <toolitem action='ConnectorOverlapAction' />"
// " <toolitem action='ConnectorNewConnPointAction' />"
// " <toolitem action='ConnectorRemoveConnPointAction' />"
" </toolbar>"
"</ui>"
;
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);
static 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);
virtual ~VerbAction();
virtual void set_active(bool active = true);
protected:
virtual void on_activate();
private:
bool active;
};
Glib::RefPtr<VerbAction> VerbAction::create(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view)
{
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) :
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 );
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;
}
{
Inkscape::XML::Node* oldrepr = reinterpret_cast<Inkscape::XML::Node *>( g_object_get_data( tbl, "repr" ) );
if (oldrepr) { // remove old listener
oldrepr = 0;
}
}
// ------------------------------------------------------
/**
* A simple mediator class that keeps UI controls matched to the preference values they set.
*/
{
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.
*/
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.
*/
/**
* Method to handle the widget change.
*/
void handleToggled();
bool freeze;
};
PrefPusher::PrefPusher( GtkToggleAction *act, Glib::ustring const &path, void (*callback)(GObject*), GObject *cbData ) :
freeze(false)
{
freeze = true;
freeze = false;
}
PrefPusher::~PrefPusher()
{
}
{
if (self) {
self->handleToggled();
}
}
void PrefPusher::handleToggled()
{
if (!freeze) {
freeze = true;
if (callback) {
}
freeze = false;
}
}
{
}
}
{
delete watcher;
}
// ------------------------------------------------------
GtkWidget * sp_toolbox_button_new_from_verb_with_doubleclick(GtkWidget *t, Inkscape::IconSize size, SPButtonType type,
{
if (!action) {
return NULL;
}
if (doubleclick_verb) {
} else {
}
/* fixme: Handle sensitive/unsensitive */
/* fixme: Implement sp_button_new_from_action */
gtk_widget_show(b);
if (shortcut != GDK_VoidSymbol) {
if ( t ) {
}
} else {
if ( t ) {
}
}
return b;
}
{
if ( targetAction ) {
}
}
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 );
// FIXME: memory leak: this is not unrefed anywhere
g_object_set_data_full(G_OBJECT(inky), "SPAction", (void*) targetAction, (GDestroyNotify) &g_object_unref);
GTK_ACTION(inky)));
return act;
}
{
{
}
}
{
gint verbsToUse[] = {
// disabled until we have icons for them:
//find
//SP_VERB_EDIT_TILE,
//SP_VERB_EDIT_UNTILE,
};
}
if ( !mainActions ) {
if (desktop)
{
}
}
if ( verb ) {
}
}
}
Glib::RefPtr<VerbAction> va = VerbAction::create(Inkscape::Verb::get(tools[i].verb), Inkscape::Verb::get(tools[i].doubleclick_verb), view);
if ( va ) {
if ( i == 0 ) {
va->set_active(true);
}
}
}
}
return mainActions;
}
static void handlebox_detached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
{
}
static void handlebox_attached(GtkHandleBox* /*handlebox*/, GtkWidget* widget, gpointer /*userData*/)
{
}
{
gboolean forceFloatAllowed = Inkscape::Preferences::get()->getBool("/options/workarounds/floatallowed", false);
} else {
hb = gtk_handle_box_new();
}
if ( GTK_IS_HANDLE_BOX(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
//####################################
{
}
{
}
{
Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits);
return widget;
}
{
static bool init = false;
if ( !init ) {
init = true;
}
if (us) {
}
EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, label, tooltip, 0, climb, digits );
if ( shortLabel ) {
}
}
if ( focusTarget ) {
}
}
if ( dataKludge ) {
// Rather lame, but it's the only place where we need to get the entry name
// but we don't have an Entry
}
// 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
//####################################
/** Temporary hack: Returns the node tool in the active desktop.
* Will go away during tool refactoring. */
static InkNodeTool *get_node_tool()
{
InkNodeTool *tool = 0;
if (SP_ACTIVE_DESKTOP ) {
if (INK_IS_NODE_TOOL(ec)) {
}
}
return tool;
}
static void sp_node_path_edit_add(void)
{
if (nt) {
}
}
static void sp_node_path_edit_add_min_x(void)
{
if (nt) {
}
}
static void sp_node_path_edit_add_max_x(void)
{
if (nt) {
}
}
static void sp_node_path_edit_add_min_y(void)
{
if (nt) {
}
}
static void sp_node_path_edit_add_max_y(void)
{
if (nt) {
}
}
static void sp_node_path_edit_delete(void)
{
if (nt) {
}
}
static void sp_node_path_edit_delete_segment(void)
{
if (nt) {
}
}
static void sp_node_path_edit_break(void)
{
if (nt) {
}
}
static void sp_node_path_edit_join(void)
{
if (nt) {
}
}
static void sp_node_path_edit_join_segment(void)
{
if (nt) {
}
}
static void sp_node_path_edit_toline(void)
{
if (nt) {
}
}
static void sp_node_path_edit_tocurve(void)
{
if (nt) {
}
}
static void sp_node_path_edit_cusp(void)
{
if (nt) {
}
}
static void sp_node_path_edit_smooth(void)
{
if (nt) {
}
}
static void sp_node_path_edit_symmetrical(void)
{
if (nt) {
}
}
static void sp_node_path_edit_auto(void)
{
if (nt) {
}
}
}
/* is called when the node selection is modified */
{
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
if (!tracker) {
return;
}
// no path selected
} else {
}
}
}
}
{
if (!tracker) {
return;
}
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
}
}
{
}
{
}
{
{
} else {
}
} else {
}
}
}
static void sp_node_toolbox_sel_modified(Inkscape::Selection *selection, guint /*flags*/, GObject *tbl)
{
}
//################################
//## Node Editing Toolbox ##
//################################
{
{
_("Insert node"),
_("Insert new nodes into selected segments"),
INKSCAPE_ICON("node-add"),
// also create dummy menu action:
gtk_action_group_add_action( mainActions, gtk_action_new("NodeInsertActionMenu", NULL, NULL, NULL) );
}
{
_("Insert node at min X"),
_("Insert new nodes at min X into selected segments"),
INKSCAPE_ICON("node_insert_min_x"),
}
{
_("Insert node at max X"),
_("Insert new nodes at max X into selected segments"),
INKSCAPE_ICON("node_insert_max_x"),
}
{
_("Insert node at min Y"),
_("Insert new nodes at min Y into selected segments"),
INKSCAPE_ICON("node_insert_min_y"),
}
{
_("Insert node at max Y"),
_("Insert new nodes at max Y into selected segments"),
INKSCAPE_ICON("node_insert_max_y"),
}
{
_("Delete node"),
_("Delete selected nodes"),
INKSCAPE_ICON("node-delete"),
}
{
_("Join nodes"),
_("Join selected nodes"),
INKSCAPE_ICON("node-join"),
}
{
_("Break nodes"),
_("Break path at selected nodes"),
INKSCAPE_ICON("node-break"),
}
{
_("Join with segment"),
_("Join selected endnodes with a new segment"),
INKSCAPE_ICON("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"),
INKSCAPE_ICON("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"),
INKSCAPE_ICON("node-type-cusp"),
}
{
_("Node Smooth"),
_("Make selected nodes smooth"),
INKSCAPE_ICON("node-type-smooth"),
}
{
_("Node Symmetric"),
_("Make selected nodes symmetric"),
INKSCAPE_ICON("node-type-symmetric"),
}
{
_("Node Auto"),
_("Make selected nodes auto-smooth"),
INKSCAPE_ICON("node-type-auto-smooth"),
}
{
_("Node Line"),
_("Make selected segments lines"),
INKSCAPE_ICON("node-segment-line"),
}
{
_("Node Curve"),
_("Make selected segments curves"),
INKSCAPE_ICON("node-segment-curve"),
}
{
_("Show Transform Handles"),
_("Show transformation handles for selected nodes"),
"node-transform",
}
{
_("Show Handles"),
_("Show Bezier handles of selected nodes"),
INKSCAPE_ICON("show-node-handles"),
}
{
_("Show Outline"),
_("Show path outline (without path effects)"),
INKSCAPE_ICON("show-path-outline"),
}
{
INKSCAPE_ICON("path-effect-parameter-next"),
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_node_path_edit_nextLPEparam), desktop );
}
{
_("Edit clipping paths"),
_("Show clipping path(s) of selected object(s)"),
INKSCAPE_ICON("path-clip-edit"),
}
{
_("Edit masks"),
_("Show mask(s) of selected object(s)"),
INKSCAPE_ICON("path-mask-edit"),
}
/* X coord of selected node(s) */
{
EgeAdjustmentAction* eact = 0;
_("X coordinate:"), _("X:"), _("X coordinate of selected node(s)"),
}
/* Y coord of selected node(s) */
{
EgeAdjustmentAction* eact = 0;
_("Y coordinate:"), _("Y:"), _("Y coordinate of selected node(s)"),
}
// 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()
static void
{
}
}
{
}
static void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObject* holder)
{
EgeAdjustmentAction *eact = 0;
/* Font Size */
{
_("Font Size"), _("Font Size:"),
_("The font size to be used in the measurement labels"),
10, 36, 1.0, 4.0,
0, 0, 0,
}
// units label
{
EgeOutputAction* act = ege_output_action_new( "measure_units_label", _("Units:"), _("The units to be used for the measurements"), 0 );
}
// units menu
{
GtkAction* act = tracker->createAction( "MeasureUnitsAction", _("Units:"), _("The units to be used for the measurements") );
g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(measure_unit_changed), (GObject*)holder );
}
} // end of sp_measure_toolbox_prep()
{
"event_context_connection"));
SetupFunction setup_func = 0;
switch (id) {
case BAR_TOOL:
break;
case BAR_AUX:
break;
case BAR_COMMANDS:
break;
case BAR_SNAP:
break;
default:
g_warning("Unexpected toolbox id encountered.");
}
if (old_desktop) {
}
}
} else {
}
} // end of sp_toolbox_set_desktop()
gchar const* toolbarName,
{
}
if (GTK_IS_HANDLE_BOX(toolbox)) {
// g_message("GRABBING ORIENTATION [%s]", toolbarName);
orientation = ((pos == GTK_POS_LEFT) || (pos == GTK_POS_RIGHT)) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
} else {
GtkPositionType pos = static_cast<GtkPositionType>(GPOINTER_TO_INT(g_object_get_data( G_OBJECT(toolbox), HANDLE_POS_MARK )));
orientation = ((pos == GTK_POS_LEFT) || (pos == GTK_POS_RIGHT)) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
}
if ( child ) {
}
}
#define noDUMP_DETAILS 1
{
#if DUMP_DETAILS
#endif
GtkHandleBox* handleBox = 0;
if (GTK_IS_BIN(toolbox)) {
#if DUMP_DETAILS
g_message(" is a BIN");
#endif // DUMP_DETAILS
if (child) {
#if DUMP_DETAILS
#endif // DUMP_DETAILS
if (GTK_IS_BOX(child)) {
#if DUMP_DETAILS
g_message(" is a BOX");
#endif // DUMP_DETAILS
if (children) {
#if DUMP_DETAILS
#endif // DUMP_DETAILS
if (GTK_IS_CONTAINER(child2)) {
if (children2) {
#if DUMP_DETAILS
#endif // DUMP_DETAILS
if (GTK_IS_TOOLBAR(child3)) {
}
}
}
}
if (GTK_IS_TOOLBAR(child2)) {
if (GTK_IS_HANDLE_BOX(toolbox)) {
}
} else {
g_message("need to add dynamic switch");
}
}
} else {
// The call is being made before the toolbox proper has been setup.
if (GTK_IS_HANDLE_BOX(toolbox)) {
} else {
}
}
} else if (GTK_IS_TOOLBAR(child)) {
if (GTK_IS_HANDLE_BOX(toolbox)) {
}
}
}
}
if (handleBox) {
}
}
{
"<ui>"
" <toolbar name='ToolToolbar'>"
" <!-- Basics -->"
" <toolitem action='ToolSelector' />"
" <toolitem action='ToolNode' />"
" <toolitem action='ToolTweak' />"
" <toolitem action='ToolZoom' />"
" <toolitem action='ToolMeasure' />"
" <!-- Shapes -->"
" <toolitem action='ToolRect' />"
" <toolitem action='Tool3DBox' />"
" <toolitem action='ToolArc' />"
" <toolitem action='ToolStar' />"
" <toolitem action='ToolSpiral' />"
" <!-- Paths -->"
" <toolitem action='ToolPencil' />"
" <toolitem action='ToolPen' />"
" <toolitem action='ToolCalligraphic' />"
" <!-- Text -->"
" <toolitem action='ToolText' />"
" <!-- Paint large areas -->"
" <toolitem action='ToolSpray' />"
" <toolitem action='ToolEraser' />"
" <!-- Fill -->"
" <toolitem action='ToolPaintBucket' />"
" <toolitem action='ToolGradient' />"
" <toolitem action='ToolDropper' />"
" <toolitem action='ToolConnector' />"
// " <toolitem action='ToolLPETool' />"
" </toolbar>"
"</ui>";
"/ui/ToolToolbar",
}
void update_tool_toolbox( SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget * /*toolbox*/ )
{
: NULL );
Glib::RefPtr<Gtk::Action> act = mainActions->get_action( Inkscape::Verb::get(tools[i].verb)->get_id() );
if ( act ) {
if ( verbAct ) {
}
}
}
}
{
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 );
}
}
}
}
{
: 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 {
}
}
}
{
"<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='DialogLayers' />"
" <toolitem action='DialogXMLEditor' />"
" <toolitem action='DialogAlignDistribute' />"
" <separator />"
" <toolitem action='DialogPreferences' />"
" <toolitem action='DialogDocumentProperties' />"
" </toolbar>"
"</ui>";
"/ui/CommandsToolbar",
}
void update_commands_toolbox(SPDesktop * /*desktop*/, SPEventContext * /*eventcontext*/, GtkWidget * /*toolbox*/)
{
}
{
return;
}
g_warning("No desktop or namedview specified (in toggle_snap_callback)!");
return;
}
g_warning("This namedview doesn't have a xml representation attached!");
return;
}
bool v = false;
SPAttributeEnum attr = (SPAttributeEnum) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(act), "SP_ATTR_INKSCAPE"));
switch (attr) {
dt->toggleSnapGlobal();
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
default:
g_warning("toggle_snap_callback has been called with an ID for which no action has been defined");
break;
}
// The snapping preferences are stored in the document, and therefore toggling makes the document dirty
}
{
"<ui>"
" <toolbar name='SnapToolbar'>"
" <toolitem action='ToggleSnapGlobal' />"
" <separator />"
" <toolitem action='ToggleSnapFromBBoxCorner' />"
" <toolitem action='ToggleSnapToBBoxPath' />"
" <toolitem action='ToggleSnapToBBoxNode' />"
" <toolitem action='ToggleSnapToFromBBoxEdgeMidpoints' />"
" <toolitem action='ToggleSnapToFromBBoxCenters' />"
" <separator />"
" <toolitem action='ToggleSnapFromNode' />"
" <toolitem action='ToggleSnapToItemPath' />"
" <toolitem action='ToggleSnapToPathIntersections' />"
" <toolitem action='ToggleSnapToItemNode' />"
" <toolitem action='ToggleSnapToSmoothNodes' />"
" <toolitem action='ToggleSnapToFromLineMidpoints' />"
" <separator />"
" <toolitem action='ToggleSnapFromOthers' />"
" <toolitem action='ToggleSnapToFromObjectCenters' />"
" <toolitem action='ToggleSnapToFromRotationCenter' />"
" <toolitem action='ToggleSnapToFromTextBaseline' />"
" <separator />"
" <toolitem action='ToggleSnapToPageBorder' />"
" <toolitem action='ToggleSnapToGrids' />"
" <toolitem action='ToggleSnapToGuides' />"
//" <toolitem action='ToggleSnapToGridGuideIntersections' />"
" </toolbar>"
"</ui>";
{
// TODO: This is a cludge. On the one hand we have verbs+actions,
// on the other we have all these explicit callbacks specified here.
// We should really unify these (should save some lines of code as well).
// For example, this action could be based on the verb(+action) + PrefsPusher.
}
{
}
{
_("Bounding box edges"), _("Snap to edges of a bounding box"),
}
{
_("Bounding box corners"), _("Snap bounding box corners"),
}
{
_("BBox Edge Midpoints"), _("Snap midpoints of bounding box edges"),
}
{
_("BBox Centers"), _("Snapping centers of bounding boxes"),
}
{
_("Nodes"), _("Snap nodes, paths, and handles"), INKSCAPE_ICON("snap"), secondarySize, SP_ATTR_INKSCAPE_SNAP_NODE);
}
{
}
{
_("Path intersections"), _("Snap to path intersections"),
}
{
_("To nodes"), _("Snap cusp nodes, incl. rectangle corners"), INKSCAPE_ICON("snap-nodes-cusp"), secondarySize,
}
{
_("Smooth nodes"), _("Snap smooth nodes, incl. quadrant points of ellipses"), INKSCAPE_ICON("snap-nodes-smooth"),
}
{
_("Line Midpoints"), _("Snap midpoints of line segments"),
}
{
_("Others"), _("Snap other points (centers, guide origins, gradient handles, etc.)"), INKSCAPE_ICON("snap"), secondarySize, SP_ATTR_INKSCAPE_SNAP_OTHERS);
}
{
_("Object Centers"), _("Snap centers of objects"),
}
{
_("Rotation Centers"), _("Snap an item's rotation center"),
}
{
_("Text baseline"), _("Snap text anchors and baselines"),
}
{
}
{
}
{
}
"/ui/SnapToolbar",
}
{
switch(id) {
case BAR_TOOL:
name = "ToolToolbar";
break;
case BAR_AUX:
name = "AuxToolbar";
break;
case BAR_COMMANDS:
name = "CommandsToolbar";
break;
case BAR_SNAP:
name = "SnapToolbar";
break;
}
return name;
}
void ToolboxFactory::updateSnapToolbox(SPDesktop *desktop, SPEventContext * /*eventcontext*/, GtkWidget *toolbox)
{
g_warning("Namedview cannot be retrieved (in updateSnapToolbox)!");
return;
}
if (!act1) {
return; // The snap actions haven't been defined yet (might be the case during startup)
}
// The ..._set_active calls below will toggle the buttons, but this shouldn't lead to
// changes in our document because we're only updating the UI;
// Setting the "freeze" parameter to true will block the code in toggle_snap_callback()
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act3->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(SNAPTARGET_BBOX_EDGE));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act4->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(SNAPTARGET_BBOX_CORNER));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act4b->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(SNAPTARGET_BBOX_EDGE_MIDPOINT));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act4c->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(SNAPTARGET_BBOX_MIDPOINT));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act6->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_PATH));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act6b->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_PATH_INTERSECTION));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act7->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_NODE_CUSP));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act8->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_NODE_SMOOTH));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act9->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_LINE_MIDPOINT));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act10b->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_OBJECT_MIDPOINT));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act11->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_ROTATION_CENTER));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act11b->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_TEXT_BASELINE));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act12->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_PAGE_BORDER));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act14->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_GRID));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act15->gobj()), nv->snap_manager.snapprefs.isSnapButtonEnabled(Inkscape::SNAPTARGET_GUIDE));
}
{
if (!shown_toolbox) {
return;
}
}
{
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;
if (SP_IS_STAR(item)) {
double arg1 = 0.5;
item->updateRepr();
modmade = true;
}
}
if (modmade) {
_("Star: Change number of corners"));
}
}
{
}
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
if (SP_IS_STAR(item)) {
} else {
}
item->updateRepr();
modmade = true;
}
}
if (modmade) {
_("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 ) {
}
if (SP_IS_STAR(item)) {
item->updateRepr();
modmade = true;
}
}
if (modmade) {
}
}
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
if (SP_IS_STAR(item)) {
item->updateRepr();
modmade = true;
}
}
if (modmade) {
_("Star: Change rounding"));
}
}
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
if (SP_IS_STAR(item)) {
item->updateRepr();
modmade = true;
}
}
if (modmade) {
_("Star: Change randomization"));
}
}
{
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
GtkAdjustment *adj = 0;
double randomized = 0.0;
double rounded = 0.0;
EgeSelectOneAction* flat_action = EGE_SELECT_ONE_ACTION( g_object_get_data( G_OBJECT(tbl), "flat_action" ) );
} else {
}
} else {
}
int sides = 0;
}
}
{
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
/**
* \param selection Should not be NULL.
*/
static void
{
int n_selected = 0;
{
if (SP_IS_STAR(item)) {
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" ) );
}
// public:
{
if (wide) {
}
if ( GTK_IS_TOOLBAR(tbl) ) {
} else {
}
}
{
{
}
{
EgeAdjustmentAction* eact = 0;
/* Flatsided checkbox */
{
0, _("Polygon"),
1, _("Regular polygon (with one handle) instead of a star"),
-1 );
0, _("Star"),
1, _("Star instead of a regular polygon (with one handle)"),
-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"),
"/tools/shapes/star/proportion", 0.5,
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"),
"/tools/shapes/star/randomized", 0.0,
-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 {
}
}
{
prefs->setDouble(Glib::ustring("/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"));
}
}
{
}
{
}
{
}
{
}
{
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.
*/
{
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"),
}
/* H */
{
_("Height"), _("H:"), _("Height of rectangle"),
}
/* rx */
{
_("Horizontal radius"), _("Rx:"), _("Horizontal radius of rounded corners"),
}
/* ry */
{
_("Vertical radius"), _("Ry:"), _("Vertical radius of rounded corners"),
}
// add the units menu
{
}
/* Reset */
{
_("Not rounded"),
_("Make corners sharp"),
INKSCAPE_ICON("rectangle-make-corners-sharp"),
}
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;
}
{
// 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 != Geom::infinity()) { // FIXME: We should catch this error earlier (don't show the spinbutton at all)
}
} else {
}
}
{
if (!persp_repr) {
g_print ("No perspective given to box3d_resync_toolbar().\n");
return;
}
GtkAdjustment *adj = 0;
GtkToggleAction *tact = 0;
if (!persp) {
// Hmm, is it an error if this happens?
return;
}
{
}
{
}
{
}
}
gchar const * /*name*/,
gchar const * /*old_value*/,
gchar const * /*new_value*/,
bool /*is_interactive*/,
{
// quit if run by the attr_changed or selection changed listener
return;
}
// set freeze so that it can be caught in box3d_angle_z_value_changed() (to avoid calling
// SPDocumentUndo::maybeDone() 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?)
{
// 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) {
}
}
}
{
// quit if run by the attr_changed or selection changed listener
return;
}
// in turn, prevent listener from responding
if (sel_persps.empty()) {
// this can happen when the document is created; we silently ignore it
return;
}
persp->updateRepr();
// TODO: use the correct axis here, too
DocumentUndo::maybeDone(document, "perspangle", SP_VERB_CONTEXT_3DBOX, _("3D Box: Change perspective (angle of infinite axis)"));
}
{
}
{
}
{
}
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"),
"/tools/shapes/3dbox/box3d_angle_x", 30,
-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)"),
INKSCAPE_ICON("perspective-parallel"),
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->getBool("/tools/shapes/3dbox/vp_x_state", true) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/shapes/3dbox/vp_x_state", true) );
}
/* Angle Y */
{
_("Angle in Y direction"), _("Angle Y:"),
// Translators: PL is short for 'perspective line'
_("Angle of PLs in Y direction"),
"/tools/shapes/3dbox/box3d_angle_y", 30,
-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)"),
INKSCAPE_ICON("perspective-parallel"),
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->getBool("/tools/shapes/3dbox/vp_y_state", true) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/shapes/3dbox/vp_y_state", true) );
}
/* Angle Z */
{
_("Angle in Z direction"), _("Angle Z:"),
// Translators: PL is short for 'perspective line'
_("Angle of PLs in Z direction"),
"/tools/shapes/3dbox/box3d_angle_z", 30,
-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)"),
INKSCAPE_ICON("perspective-parallel"),
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->getBool("/tools/shapes/3dbox/vp_z_state", true) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/shapes/3dbox/vp_z_state", true) );
}
sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), (GObject *)holder))
);
}
//########################
//## Spiral ##
//########################
static void sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, Glib::ustring const &value_name)
{
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
{
if (SP_IS_SPIRAL(item)) {
item->updateRepr();
modmade = true;
}
}
if (modmade) {
_("Change spiral"));
}
}
{
}
{
}
{
}
{
// fixme: make settable
}
gchar const * /*name*/,
gchar const * /*old_value*/,
gchar const * /*new_value*/,
bool /*is_interactive*/,
{
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
double revolution = 3.0;
double expansion = 1.0;
double t0 = 0.0;
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
{
int n_selected = 0;
{
if (SP_IS_SPIRAL(item)) {
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"),
"/tools/shapes/spiral/revolution", 3.0,
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 */
{
}
{
// 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->getInt(( tool_is_pencil ? "/tools/freehand/pencil/freehand-mode" : "/tools/freehand/pen/freehand-mode" ), 0);
{
0, _("Bezier"),
1, _("Create regular Bezier path"),
-1 );
0, _("Spiro"),
1, _("Create Spiro path"),
-1 );
if (!tool_is_pencil) {
0, _("Zigzag"),
1, _("Create a sequence of straight line segments"),
-1 );
0, _("Paraxial"),
1, _("Create a sequence of paraxial line segments"),
-1 );
}
"FreehandModeActionPencil" :
"FreehandModeActionPen",
}
}
}
}
/**
* Generate the list of freehand advanced shape option entries.
*/
static GList * freehand_shape_dropdown_items_list() {
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->getInt(( tool_is_pencil ? "/tools/freehand/pencil/shape" : "/tools/freehand/pen/shape" ), 0) );
}
}
static void sp_pen_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainActions, GObject* holder)
{
}
{
// fixme: make settable
}
{
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
}
/*
class PencilToleranceObserver : public Inkscape::Preferences::Observer {
public:
PencilToleranceObserver(Glib::ustring const &path, GObject *x) : Observer(path), _obj(x)
{
g_object_set_data(_obj, "prefobserver", this);
}
virtual ~PencilToleranceObserver() {
if (g_object_get_data(_obj, "prefobserver") == this) {
g_object_set_data(_obj, "prefobserver", NULL);
}
}
virtual void notify(Inkscape::Preferences::Entry const &val) {
GObject* tbl = _obj;
if (g_object_get_data( tbl, "freeze" )) {
return;
}
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) );
GtkAdjustment * adj = (GtkAdjustment*)g_object_get_data(tbl, "tolerance");
double v = val.getDouble(adj->value);
gtk_adjustment_set_value(adj, v);
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
private:
GObject *_obj;
};
*/
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"),
3.0,
1, 100.0, 0.5, 1.0,
1, 2);
}
/* advanced shape options */
/* Reset */
{
_("Defaults"),
_("Reset pencil parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
}
}
//########################
//## Tweak ##
//########################
{
}
{
}
{
}
{
static gchar const* names[] = {"tweak_doh", "tweak_dos", "tweak_dol", "tweak_doo", "tweak_channels_label"};
if (act) {
}
}
if (fid) {
}
}
{
}
}
}
}
}
{
{
/* 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, 10.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, 10.0,
}
/* Mode */
{
0, _("Move mode"),
1, _("Move objects in any direction"),
-1 );
1, _("Move objects towards cursor; with Shift from cursor"),
-1 );
0, _("Move jitter mode"),
1, _("Move objects in random directions"),
-1 );
0, _("Scale mode"),
1, _("Shrink objects, with Shift enlarge"),
-1 );
0, _("Rotate mode"),
1, _("Rotate objects, with Shift counterclockwise"),
-1 );
1, _("Duplicate objects, with Shift delete"),
-1 );
0, _("Push mode"),
1, _("Push parts of paths in any direction"),
-1 );
1, _("Shrink (inset) parts of paths; with Shift grow (outset)"),
-1 );
1, _("Attract parts of paths towards cursor; with Shift from cursor"),
-1 );
0, _("Roughen mode"),
1, _("Roughen parts of paths"),
-1 );
0, _("Color paint mode"),
1, _("Paint the tool's color upon selected objects"),
-1 );
0, _("Color jitter mode"),
1, _("Jitter the colors of selected objects"),
-1 );
0, _("Blur mode"),
1, _("Blur selected objects more; with Shift, blur less"),
-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
}
}
{
_("Saturation"),
_("In color mode, act on objects' saturation"),
NULL,
//TRANSLATORS: "S" here stands for Saturation
}
}
{
_("Lightness"),
_("In color mode, act on objects' lightness"),
NULL,
//TRANSLATORS: "L" here stands for Lightness
}
}
{
_("Opacity"),
_("In color mode, act on objects' opacity"),
NULL,
//TRANSLATORS: "O" here stands for Opacity
}
}
{ /* 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"),
INKSCAPE_ICON("draw-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->getBool("/tools/tweak/usepressure", true) );
}
}
//########################
//## Spray ##
//########################
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
{
/* Width */
gchar const* labels[] = {_("(narrow spray)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad spray)")};
_("Width"), _("Width:"), _("The width of the spray area (relative to the visible canvas area)"),
1, 100, 1.0, 10.0,
sp_spray_width_value_changed, 1, 0 );
}
{
/* Mean */
_("Focus"), _("Focus:"), _("0 to spray a spot; increase to enlarge the ring radius"),
0, 100, 1.0, 10.0,
sp_spray_mean_value_changed, 1, 0 );
}
{
/* Standard_deviation */
gchar const* labels[] = {_("(minimum scatter)"), 0, 0, 0, 0, 0, _("(default)"), _("(maximum scatter)")};
C_("Spray tool", "Scatter"), C_("Spray tool", "Scatter:"), _("Increase to scatter sprayed objects"),
"/tools/spray/standard_deviation", 70,
1, 100, 1.0, 10.0,
}
/* Mode */
{
0, _("Spray with copies"),
1, _("Spray copies of the initial selection"),
-1 );
0, _("Spray with clones"),
1, _("Spray clones of the initial selection"),
-1 );
0, _("Spray single path"),
1, _("Spray objects in a single path"),
-1 );
EgeSelectOneAction* act = ege_select_one_action_new( "SprayModeAction", _("Mode"), (""), NULL, GTK_TREE_MODEL(model) );
}
{ /* Population */
gchar const* labels[] = {_("(low population)"), 0, 0, 0, _("(default)"), 0, _("(high population)")};
_("Amount"), _("Amount:"),
_("Adjusts the number of items sprayed per click"),
"/tools/spray/population", 70,
1, 100, 1.0, 10.0,
sp_spray_population_value_changed, 1, 0 );
}
/* Use Pressure button */
{
_("Pressure"),
_("Use the pressure of the input device to alter the amount of sprayed objects"),
"use_pressure",
}
{ /* Rotation */
_("Rotation"), _("Rotation:"),
// xgettext:no-c-format
_("Variation of the rotation of the sprayed objects; 0% for the same rotation than the original object"),
"/tools/spray/rotation_variation", 0,
0, 100, 1.0, 10.0,
sp_spray_rotation_value_changed, 1, 0 );
}
{ /* Scale */
// xgettext:no-c-format
_("Variation in the scale of the sprayed objects; 0% for the same scale than the original object"),
"/tools/spray/scale_variation", 0,
0, 100, 1.0, 10.0,
sp_spray_scale_value_changed, 1, 0 );
}
}
//########################
//## Calligraphy ##
//########################
{
return;
}
EgeSelectOneAction *sel = static_cast<EgeSelectOneAction *>(g_object_get_data(tbl, "profile_selector"));
if (!sel) {
// WTF!? This will cause a segfault if ever reached
//ege_select_one_action_set_active(sel, 0);
return;
}
int ege_index = 1;
for (std::vector<Glib::ustring>::iterator i = presets.begin(); i != presets.end(); ++i, ++ege_index) {
bool match = true;
for (std::vector<Inkscape::Preferences::Entry>::iterator j = preset.begin(); j != preset.end(); ++j) {
continue;
}
if (widget) {
if (GTK_IS_ADJUSTMENT(widget)) {
double v = j->getDouble();
//std::cout << "compared adj " << attr_name << gtk_adjustment_get_value(adj) << " to " << v << "\n";
match = false;
break;
}
} else if (GTK_IS_TOGGLE_ACTION(widget)) {
bool v = j->getBool();
//std::cout << "compared toggle " << attr_name << gtk_toggle_action_get_active(toggle) << " to " << v << "\n";
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
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
// TODO merge into PrefPusher
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"));
{
}
// iterate over all presets to populate the list
int ii=1;
}
{
}
}
{
if (! desktop) {
return;
}
return;
}
if ( !CalligraphicProfileRename::applied()) {
// dialog cancelled
return;
}
if (profile_name.empty()) {
// empty name entered
return;
}
// If there's a preset with the given name, find it and set save_path appropriately
int new_index = -1;
int temp_index = 0;
for (std::vector<Glib::ustring>::iterator i = presets.begin(); i != presets.end(); ++i, ++temp_index) {
save_path = *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)) {
//std::cout << "wrote adj " << widget_name << ": " << v << "\n";
} else if (GTK_IS_TOGGLE_ACTION(widget)) {
//std::cout << "wrote tog " << widget_name << ": " << v << "\n";
} else {
}
} else {
}
}
}
{
// 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 == save_presets_index) {
// this is the Save command
return;
}
return;
}
// preset_index is one-based so we subtract 1
if (!preset_path.empty()) {
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
// Shouldn't this be std::map?
for (std::vector<Inkscape::Preferences::Entry>::iterator i = preset.begin(); i != preset.end(); ++i) {
continue;
}
if (widget) {
if (GTK_IS_ADJUSTMENT(widget)) {
//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)"),
"/tools/calligraphic/width", 15,
1, 100, 1.0, 10.0,
sp_ddc_width_value_changed, 1, 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)"),
"/tools/calligraphic/thinning", 10,
-100, 100, 1, 10.0,
sp_ddc_velthin_value_changed, 1, 0);
}
{
/* 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)"),
"/tools/calligraphic/angle", 30,
-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, 100 = fixed angle)"),
"/tools/calligraphic/flatness", 90,
0.0, 100, 1.0, 10.0,
sp_ddc_flatness_value_changed, 1, 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)"),
"/tools/calligraphic/cap_rounding", 0.0,
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"),
"/tools/calligraphic/tremor", 0.0,
0.0, 100, 1, 10.0,
sp_ddc_tremor_value_changed, 1, 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"),
"/tools/calligraphic/wiggle", 0.0,
0.0, 100, 1, 10.0,
sp_ddc_wiggle_value_changed, 1, 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"),
"/tools/calligraphic/mass", 2.0,
0.0, 100, 1, 10.0,
sp_ddc_mass_value_changed, 1, 0);
}
/* Trace Background button */
{
_("Trace Background"),
_("Trace the lightness of the background by the width of the pen (white - minimum width, black - maximum width)"),
INKSCAPE_ICON("draw-trace-background"),
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/tracebackground", update_presets_list, holder);
}
/* Use Pressure button */
{
_("Pressure"),
_("Use the pressure of the input device to alter the width of the pen"),
INKSCAPE_ICON("draw-use-pressure"),
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/usepressure", update_presets_list, holder);
}
/* Use Tilt button */
{
_("Tilt"),
_("Use the tilt of the input device to alter the angle of the pen's nib"),
INKSCAPE_ICON("draw-use-tilt"),
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/usetilt", update_presets_list, holder);
gtk_action_set_sensitive( GTK_ACTION(calligraphy_angle), !prefs->getBool("/tools/calligraphic/usetilt", true) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/calligraphic/usetilt", true) );
}
/*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) {
}
}
{
}
{
}
{
}
// 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 ) {
{
item->updateRepr();
modmade = true;
}
}
} else {
{
item->updateRepr();
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)"),
-1 );
0, _("Open Arc"),
1, _("Switch to arc (unclosed shape)"),
-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"),
INKSCAPE_ICON("draw-ellipse-whole"),
}
// 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 {
}
}
}
{
}
/**
* 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->getBool( "/tools/dropper/setalpha", true) );
// 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)
{
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);
}
}
{
}
gtk_toggle_action_set_active(act, false);
}
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, "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
{
g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(lpetool_unit_changed), (GObject*)holder );
}
/* Open LPE dialog (to adapt parameters numerically) */
{
_("Open LPE dialog"),
_("Open LPE dialog (to adapt parameters numerically)"),
"dialog-geometry",
}
//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)
{
{
0, _("Delete"),
1, _("Delete objects touched by the eraser"),
-1 );
0, _("Cut"),
1, _("Cut out from objects"),
-1 );
EgeSelectOneAction* act = ege_select_one_action_new( "EraserModeAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
/// @todo Convert to boolean?
}
{
/* 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)"),
1, 100, 1.0, 10.0,
sp_erc_width_value_changed, 1, 0);
}
}
//########################
//## Text Toolbox ##
//########################
// Functions for debugging:
#ifdef DEBUG_TEXT
<< " Style set? " << style_set
<< " FontSpec set? " << fontspec_set
<< " FontSpec: "
}
"NORMAL", "BOLD", "LIGHTER", "BOLDER", "Out of range"};
// Missing book = 380
}
}
#endif
// Format family drop-down menu.
gpointer /*data*/)
{
if (show_sample) {
} else {
}
// This doesn't work for two reasons... it set both selected and not selected backgrounds
// to white.. which means that white foreground text is invisible. It also only effects
// the text region, leaving the padding untouched.
// g_object_set (G_OBJECT (cell), "cell-background", "white", "cell-background-set", true, NULL);
}
// Font family
//
// In most cases we should just be able to set the new family name
// but there may be cases where a font family doesn't follow the
// standard naming pattern. To handle those cases, we do a song and
// dance to use Pango to find the best match. To do that we start
// with the old "fontSpec" (which is the returned string from
// pango_font_description_to_string() with the size unset). This
// has the form "[family-list] [style-options]" where the
// family-list is a comma separated list of font-family names
// (optionally terminated by a comma). An example would be
// "DejaVu Sans, Sans Bold". Only a "fontSpec" containing a
// single font-family will work with Pango's best match routine.
// If we can't obtain a good "fontSpec", we then resort to blindly
// changing the font-family.
{
#ifdef DEBUG_TEXT
#endif
// quit if run by the _changed callbacks
return;
}
#ifdef DEBUG_TEXT
#endif
// First try to get the old font spec from the stored value
int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
Glib::ustring fontSpec = query->text->font_specification.set ? query->text->font_specification.value : "";
#ifdef DEBUG_TEXT
#endif
// If that didn't work, try to get font spec from style
// Must query all to fill font-family, font-style, font-weight, font-specification
// Construct a new font specification if it does not yet exist
if( fontFromStyle ) {
fontFromStyle->Unref();
}
#ifdef DEBUG_TEXT
sp_print_font( query );
#endif
}
// And if that didn't work use default. DO WE REALLY WANT TO DO THIS?
// Construct a new font specification if it does not yet exist
if ( fontFromStyle ) {
fontFromStyle->Unref();
}
#ifdef DEBUG_TEXT
sp_print_font( query );
#endif
}
// Now we have a font specification, replace family.
if (!fontSpec.empty()) newFontSpec = font_factory::Default()->ReplaceFontSpecificationFamily(fontSpec, family);
#ifdef DEBUG_TEXT
std::cout << " New FontSpec from ReplaceFontSpecificationFamily :" << newFontSpec << ":" << std::endl;
#endif
if (fontSpec != newFontSpec) {
if (font) {
// Set all the these just in case they were altered when finding the best
// match for the new family and old style... Unnecessary?
gchar c[256];
} else {
}
}
} else {
// Either old font does not exist on system or ReplaceFontSpecificationFamily() failed.
// Blindly fall back to setting the family to text in the font-family chooser.
#ifdef DEBUG_TEXT
#endif
}
// If querying returned nothing, update default style.
if (result_fontspec == QUERY_STYLE_NOTHING)
{
sp_text_edit_dialog_default_set_insensitive (); //FIXME: Replace through a verb
}
else
{
}
// Save for undo
if (result_fontspec != QUERY_STYLE_NOTHING) {
_("Text: Change font family"));
}
// unfreeze
// focus to canvas
#ifdef DEBUG_TEXT
#endif
}
// Font size
{
// quit if run by the _changed callbacks
return;
}
return;
}
// Set css font size.
// Apply font size to selected objects.
// If no selected objects, set default.
int result_numbers =
if (result_numbers == QUERY_STYLE_NOTHING)
{
} else {
// Save for undo
_("Text: Change font size"));
}
}
{
// quit if run by the _changed callbacks
return;
}
// Called by Bold or Italics button?
// First query font-specification, this is the most complete font face description.
int result_fontspec = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION);
// font_specification will not be set unless defined explicitely on a tspan.
// This should be fixed!
Glib::ustring fontSpec = query->text->font_specification.set ? query->text->font_specification.value : "";
// Construct a new font specification if it does not yet exist
// Must query font-family, font-style, font-weight, to find correct font face.
if ( fontFromStyle ) {
fontFromStyle->Unref();
}
}
// Now that we have the old face, find the new face.
switch (prop)
{
case 0:
{
// Bold
if (!fontSpec.empty()) newFontSpec = font_factory::Default()->FontSpecificationSetBold(fontSpec, active);
// Set weight using new font if found.
if (font) {
gchar c[256];
}
nochange = false;
} else {
// Blindly set weight.
}
break;
}
case 1:
{
if (!fontSpec.empty()) newFontSpec = font_factory::Default()->FontSpecificationSetItalic(fontSpec, active);
if ( active ) {
} else {
}
} else {
}
nochange = false;
} else {
// Blindly set style.
}
break;
}
}
if (!newFontSpec.empty()) {
}
// If querying returned nothing, update default style.
if (result_fontspec == QUERY_STYLE_NOTHING)
{
}
// Do we need to update other CSS values?
if (result_fontspec != QUERY_STYLE_NOTHING) {
_("Text: Change font style"));
}
}
// Handles both Superscripts and Subscripts
{
// quit if run by the _changed callbacks
return;
}
// Called by Superscript or Subscript button?
#ifdef DEBUG_TEXT
#endif
// Query baseline
int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_BASELINES);
bool setSuper = false;
bool setSub = false;
// If not set or mixed, turn on superscript or subscript
if( prop == 0 ) {
setSuper = true;
} else {
setSub = true;
}
} else {
// Superscript
// Subscript
}
// Set css properties
// Openoffice 2.3 and Adobe use 58%, Microsoft Word 2002 uses 65%, LaTex about 70%.
// 58% looks too small to me, especially if a superscript is placed on a superscript.
// If you make a change here, consider making a change to baseline-shift amount
// in style.cpp.
} else {
}
if( setSuper ) {
} else if( setSub ) {
} else {
}
// Apply css to selected objects.
// Save for undo
if(result_baseline != QUERY_STYLE_NOTHING) {
_("Text: Change superscript or subscript"));
}
}
{
// quit if run by the _changed callbacks
return;
}
// move the x of all texts to preserve the same bbox
// below, variable names suggest horizontal move, but we check the writing direction
// and move in the corresponding axis
} else {
}
if (!bbox)
continue;
// 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
// frame (currently unused)
double left_slack = 0;
double right_slack = 0;
double move = 0;
switch (mode) {
case 0:
move = -left_slack;
break;
case 1:
break;
case 2:
break;
}
} else if (old_align == SP_CSS_TEXT_ALIGN_CENTER) {
switch (mode) {
case 0:
break;
case 1:
break;
case 2:
break;
}
switch (mode) {
case 0:
break;
case 1:
break;
case 2:
move = right_slack;
break;
}
}
} else {
}
item->updateRepr();
}
}
switch (mode)
{
case 0:
{
break;
}
case 1:
{
break;
}
case 2:
{
break;
}
case 3:
{
break;
}
}
int result_numbers =
// If querying returned nothing, update default style.
if (result_numbers == QUERY_STYLE_NOTHING)
{
}
if (result_numbers != QUERY_STYLE_NOTHING)
{
_("Text: Change alignment"));
}
}
{
// quit if run by the _changed callbacks
return;
}
// At the moment this handles only numerical values (i.e. no percent).
// Set css line height.
// Apply line-height to selected objects.
// Until deprecated sodipodi:linespacing purged:
bool modmade = false;
SP_OBJECT(items->data)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL));
modmade = true;
}
}
// Save for undo
if(modmade) {
_("Text: Change line-height"));
}
// If no selected objects, set default.
int result_numbers =
if (result_numbers == QUERY_STYLE_NOTHING)
{
}
}
{
// quit if run by the _changed callbacks
return;
}
// At the moment this handles only numerical values (i.e. no em unit).
// Set css word-spacing
// Apply word-spacing to selected objects.
// If no selected objects, set default.
int result_numbers =
if (result_numbers == QUERY_STYLE_NOTHING)
{
} else {
// Save for undo
_("Text: Change word-spacing"));
}
}
{
// quit if run by the _changed callbacks
return;
}
// At the moment this handles only numerical values (i.e. no em unit).
// Set css letter-spacing
// Apply letter-spacing to selected objects.
// If no selected objects, set default.
int result_numbers =
if (result_numbers == QUERY_STYLE_NOTHING)
{
}
else
{
// Save for undo
_("Text: Change letter-spacing"));
}
}
{
// quit if run by the _changed callbacks
return;
}
bool modmade = false;
if( tc ) {
unsigned char_index = -1;
text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index );
if( attributes ) {
modmade = true;
}
}
}
if(modmade) {
// Save for undo
_("Text: Change dx (kern)"));
}
}
{
// quit if run by the _changed callbacks
return;
}
bool modmade = false;
if( tc ) {
unsigned char_index = -1;
text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index );
if( attributes ) {
modmade = true;
}
}
}
if(modmade) {
// Save for undo
_("Text: Change dy"));
}
}
{
// quit if run by the _changed callbacks
return;
}
bool modmade = false;
if( tc ) {
unsigned char_index = -1;
text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index );
if( attributes ) {
sp_te_adjust_rotation( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_deg );
modmade = true;
}
}
}
// Save for undo
if(modmade) {
_("Text: Change rotate"));
}
}
{
// quit if run by the _changed callbacks
return;
}
switch (mode)
{
case 0:
{
break;
}
case 1:
{
break;
}
}
int result_numbers =
// If querying returned nothing, update default style.
if (result_numbers == QUERY_STYLE_NOTHING)
{
}
{
_("Text: Change orientation"));
}
}
/*
* This function sets up the text-tool tool-controls, setting the entry boxes
* etc. to the values from the current selection or the default if no selection.
* It is called whenever a text selection is changed, including stepping cursor
* through text, or setting focus to text.
*/
{
#ifdef DEBUG_TEXT
static int count = 0;
++count;
{
}
#endif
// quit if run by the _changed callbacks
#ifdef DEBUG_TEXT
#endif
return;
}
// Only flowed text can be justified, only normal text can be kerned...
// Find out if we have flowed text now so we can use it several places
// const gchar* id = reinterpret_cast<SPItem *>(items->data)->getId();
// std::cout << " " << id << std::endl;
isFlow = true;
// std::cout << " Found flowed text" << std::endl;
break;
}
}
/*
* Query from current selection:
* Font family (font-family)
* Style (font-weight, font-style, font-stretch, font-variant, font-align)
* Numbers (font-size, letter-spacing, word-spacing, line-height, text-anchor, writing-mode)
* Font specification (Inkscape private attribute)
*/
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);
int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_BASELINES);
// Used later:
/*
* If no text in selection (querying returned nothing), read the style from
* tool bar already set to these preferences.
*/
if (result_family == QUERY_STYLE_NOTHING || result_style == QUERY_STYLE_NOTHING || result_numbers == QUERY_STYLE_NOTHING) {
// There are no texts in selection, read from preferences.
#ifdef DEBUG_TEXT
sp_print_font( query );
#endif
// Do not reset the toolbar style from prefs if we already did it last time
#ifdef DEBUG_TEXT
#endif
return;
}
} else {
}
// If we have valid query data for text (font-family, font-specification) set toolbar accordingly.
{
// Font family
}
// Size (average of text selected)
// Weight (Bold)
// Note: in the enumeration, normal and lighter come at the end so we must explicitly test for them.
InkToggleAction* textItalicAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextItalicAction" ) );
// Superscript
InkToggleAction* textSuperscriptAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextSuperscriptAction" ) );
// Subscript
InkToggleAction* textSubscriptAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextSubscriptAction" ) );
// Alignment
EgeSelectOneAction* textAlignAction = EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextAlignAction" ) );
// Note: SVG 1.1 doesn't include text-align, SVG 1.2 Tiny doesn't include text-align="justify"
// text-align="justify" was a draft SVG 1.2 item (along with flowed text).
// Only flowed text can be left and right justified at the same time.
// Disable button if we don't have flowed text.
// The GtkTreeModel class doesn't have a set function so we can't
// simply add an ege_select_one_action_set_sensitive method!
// We must set values directly with the GtkListStore and then
// ask that the GtkAction update the sensitive parameters.
// ege_select_one_action_set_sensitive( textAlignAction, 3, isFlow );
int activeButton = 0;
{
activeButton = 3;
} else {
}
// Line height (spacing)
double height;
} else {
} else {
}
}
// Word spacing
double wordSpacing;
// Letter spacing
double letterSpacing;
else letterSpacing = query->letter_spacing.computed; // Assume no units (change in desktop-style.cpp)
// Orientation
} // if( query->text )
#ifdef DEBUG_TEXT
#endif
// Kerning (xshift), yshift, rotation. NB: These are not CSS attributes.
if( tc ) {
unsigned char_index = -1;
text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index );
if( attributes ) {
// Dx
// Dy
// Rotation
/* SVG value is between 0 and 360 but we're using -180 to 180 in widget */
#ifdef DEBUG_TEXT
#endif
}
}
}
{
}
#ifdef DEBUG_TEXT
#endif
}
static void sp_text_toolbox_selection_modified(Inkscape::Selection *selection, guint /*flags*/, GObject *tbl)
{
}
void
{
}
// Define all the "widgets" in the toolbar.
{
// Is this used?
/* Font family */
{
// Font list
_("Font Family"),
_("Select Font Family (Alt-X to access)"),
NULL,
-1, // Entry width
50, // Extra list width
// Change style of drop-down from menu to list
"style \"dropdown-as-list-style\"\n"
"{\n"
" GtkComboBox::appears-as-list = 1\n"
"}\n"
"widget \"*.TextFontFamilyAction_combobox\" style \"dropdown-as-list-style\"");
}
/* Font size */
{
// List of font sizes for drop-down menu
"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 ) {
}
_("Font Size"),
_("Font size (px)"),
NULL,
4 ); // Width in characters
}
/* Style - Bold */
{
_("Toggle Bold"), // Label
_("Toggle bold or normal weight"), // Tooltip
GTK_STOCK_BOLD, // Icon (inkId)
secondarySize ); // Icon size
}
{
GTK_STOCK_ITALIC, // Icon (inkId)
secondarySize ); // Icon size
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/text/italic", false) );
}
/* Style - Superscript */
{
_("Toggle Superscript"), // Label
_("Toggle superscript"), // Tooltip
"text_superscript", // Icon (inkId)
secondarySize ); // Icon size
}
/* Style - Subscript */
{
_("Toggle Subscript"), // Label
_("Toggle subscript"), // Tooltip
"text_subscript", // Icon (inkId)
secondarySize ); // Icon size
}
/* Alignment */
{
GtkListStore* model = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN );
0, _("Align left"),
1, _("Align left"),
3, true,
-1 );
0, _("Align center"),
1, _("Align center"),
3, true,
-1 );
0, _("Align right"),
1, _("Align right"),
3, true,
-1 );
0, _("Justify"),
1, _("Justify (only flowed text)"),
3, false,
-1 );
_("Alignment"), // Label
_("Text alignment"), // Tooltip
NULL, // StockID
}
/* Orientation (Left to Right, Top to Bottom */
{
0, _("Horizontal"),
1, _("Horizontal text"),
-1 );
0, _("Vertical"),
1, _("Vertical text"),
-1 );
_("Orientation"), // Label
_("Text orientation"), // Tooltip
NULL, // StockID
g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_text_orientation_mode_changed), holder );
}
/* Line height */
{
// Drop down menu
gchar const* labels[] = {_("Smaller spacing"), 0, 0, 0, 0, C_("Text tool", "Normal"), 0, 0, 0, 0, 0, _("Larger spacing")};
"TextLineHeightAction", /* name */
_("Line Height"), /* label */
_("Line:"), /* short label */
_("Spacing between lines (times font size)"), /* tooltip */
"/tools/text/lineheight", /* preferences path */
0.0, /* default */
NULL, /* unit selector */
holder, /* dataKludge */
FALSE, /* set alt-x keyboard shortcut? */
NULL, /* altx_mark */
sp_text_lineheight_value_changed, /* callback */
0.1, /* step (used?) */
2, /* digits to show */
1.0 /* factor (multiplies default) */
);
}
/* Word spacing */
{
// Drop down menu
gchar const* labels[] = {_("Negative spacing"), 0, 0, 0, C_("Text tool", "Normal"), 0, 0, 0, 0, 0, 0, 0, _("Positive spacing")};
"TextWordSpacingAction", /* name */
_("Word spacing"), /* label */
_("Word:"), /* short label */
_("Spacing between words (px)"), /* tooltip */
"/tools/text/wordspacing", /* preferences path */
0.0, /* default */
NULL, /* unit selector */
holder, /* dataKludge */
FALSE, /* set alt-x keyboard shortcut? */
NULL, /* altx_mark */
sp_text_wordspacing_value_changed, /* callback */
0.1, /* step (used?) */
2, /* digits to show */
1.0 /* factor (multiplies default) */
);
}
/* Letter spacing */
{
// Drop down menu
gchar const* labels[] = {_("Negative spacing"), 0, 0, 0, C_("Text tool", "Normal"), 0, 0, 0, 0, 0, 0, 0, _("Positive spacing")};
"TextLetterSpacingAction", /* name */
_("Letter spacing"), /* label */
_("Letter:"), /* short label */
_("Spacing between letters (px)"), /* tooltip */
"/tools/text/letterspacing", /* preferences path */
0.0, /* default */
NULL, /* unit selector */
holder, /* dataKludge */
FALSE, /* set alt-x keyboard shortcut? */
NULL, /* altx_mark */
sp_text_letterspacing_value_changed, /* callback */
0.1, /* step (used?) */
2, /* digits to show */
1.0 /* factor (multiplies default) */
);
}
/* Character kerning (horizontal shift) */
{
// Drop down menu
"TextDxAction", /* name */
_("Kerning"), /* label */
_("Kern:"), /* short label */
_("Horizontal kerning (px)"), /* tooltip */
0.0, /* default */
NULL, /* unit selector */
holder, /* dataKludge */
FALSE, /* set alt-x keyboard shortcut? */
NULL, /* altx_mark */
sp_text_dx_value_changed, /* callback */
0.1, /* step (used?) */
2, /* digits to show */
1.0 /* factor (multiplies default) */
);
}
/* Character vertical shift */
{
// Drop down menu
"TextDyAction", /* name */
_("Vertical Shift"), /* label */
_("Vert:"), /* short label */
_("Vertical shift (px)"), /* tooltip */
0.0, /* default */
NULL, /* unit selector */
holder, /* dataKludge */
FALSE, /* set alt-x keyboard shortcut? */
NULL, /* altx_mark */
sp_text_dy_value_changed, /* callback */
0.1, /* step (used?) */
2, /* digits to show */
1.0 /* factor (multiplies default) */
);
}
/* Character rotation */
{
// Drop down menu
"TextRotationAction", /* name */
_("Letter rotation"), /* label */
_("Rot:"), /* short label */
_("Character rotation (degrees)"),/* tooltip */
0.0, /* default */
NULL, /* unit selector */
holder, /* dataKludge */
FALSE, /* set alt-x keyboard shortcut? */
NULL, /* altx_mark */
sp_text_rotation_value_changed, /* callback */
0.1, /* step (used?) */
2, /* digits to show */
1.0 /* factor (multiplies default) */
);
}
// Is this necessary to call? Shouldn't hurt.
// Watch selection
Inkscape::ConnectionPool* pool = Inkscape::ConnectionPool::new_connection_pool ("ISTextToolboxGTK");
}
//#########################
//## 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);
}
{
return;
}
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
bool modmade = false;
while (l) {
if (cc_item_is_connector(item)) {
modmade = true;
}
l = l->next;
}
if (!modmade) {
} else {
}
}
{
return;
}
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
bool modmade = false;
while (l) {
if (cc_item_is_connector(item)) {
modmade = true;
}
l = l->next;
}
if (!modmade) {
}
else {
_("Change connector curvature"));
}
}
{
return;
}
// 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;
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
avoid_item_move(&m, item);
modmade = true;
}
if (items) {
}
if(modmade) {
_("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->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
}
{
}
{
}
{
}
{
}
}
{
}
}
{
}
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
{
if (SP_IS_PATH(item))
{
}
}
static void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder )
{
// Editing mode toggle button
{
_("EditMode"),
_("Switch between connection point editing and connector drawing mode"),
INKSCAPE_ICON("connector-edit"),
}
{
_("Avoid"),
_("Make connectors avoid selected objects"),
INKSCAPE_ICON("connector-avoid"),
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_path_set_avoid), holder );
}
{
_("Ignore"),
_("Make connectors ignore selected objects"),
INKSCAPE_ICON("connector-ignore"),
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_path_set_ignore), holder );
}
// Orthogonal connectors toggle button
{
_("Orthogonal"),
_("Make connector orthogonal or polyline"),
INKSCAPE_ICON("connector-orthogonal"),
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_connector_orthogonal_toggled), holder );
}
EgeAdjustmentAction* eact = 0;
// Curvature spinbox
_("Connector Curvature"), _("Curvature:"),
_("The amount of connectors curvature"),
0, 100, 1.0, 10.0,
0, 0, 0,
connector_curvature_changed, 1, 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"),
INKSCAPE_ICON("distribute-graph"),
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"),
INKSCAPE_ICON("distribute-graph-directed"),
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_directed_graph_layout_toggled), holder );
sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_connector_toolbox_selection_changed), (GObject *)holder));
}
// Avoid overlaps toggle button
{
_("Remove overlaps"),
_("Do not allow overlapping shapes"),
INKSCAPE_ICON("distribute-remove-overlaps"),
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_nooverlaps_graph_layout_toggled), holder );
}
// New connection point button
{
_("New connection point"),
_("Add a new connection point to the currently selected item"),
INKSCAPE_ICON("connector-new-connpoint"),
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_new_connection_point), holder );
}
// Remove selected connection point button
{
_("Remove connection point"),
_("Remove the currently selected connection point"),
INKSCAPE_ICON("connector-remove-connpoint"),
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_remove_connection_point), holder );
}
// Code to watch for changes to the connector-spacing attribute in
// the XML.
if (repr) {
}
} // end of sp_connector_toolbox_prep()
//#########################
//## Paintbucket ##
//#########################
{
}
{
}
{
}
{
// Don't adjust the offset value because we're saving the
// unit and it'll be correctly handled on load.
}
{
// 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) );
}
// 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, 10.0,
0, 0, 0,
paintbucket_threshold_changed, 1, 0 );
}
// Create the units menu.
if (!stored_unit.empty()) {
}
{
}
// Offset spinbox
{
"OffsetAction",
_("The amount to grow (positive) or shrink (negative) the created fill path"),
"inkscape:paintbucket-offset", -1e4, 1e4, 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) );
}
/* 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:fileencoding=utf-8:textwidth=99 :