toolbox.cpp revision 4bc231baeb2efedbbe3a9c6953edea506839a253
/**
* @file
* Inkscape toolbar definitions and general utility functions.
* Each tool should have its own xxx-toolbar implementation file
*/
/* 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 <gtkmm/actiongroup.h>
#include <gtkmm/toolitem.h>
#include "../desktop.h"
#include "../desktop-style.h"
#include "document-undo.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-output-action.h"
#include "widgets/ege-select-one-action.h"
#include "../graphlayout.h"
#include "../helper/action-context.h"
#include "icon.h"
#include "ink-action.h"
#include "ink-comboboxentry-action.h"
#include "../inkscape.h"
#include "ui/interface.h"
#include "../shortcuts.h"
#include "../sp-namedview.h"
#include "ui/tools-switch.h"
#include "../ui/icon-names.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 "arc-toolbar.h"
#include "box3d-toolbar.h"
#include "calligraphy-toolbar.h"
#include "connector-toolbar.h"
#include "dropper-toolbar.h"
#include "eraser-toolbar.h"
#include "gradient-toolbar.h"
#include "lpe-toolbar.h"
#include "mesh-toolbar.h"
#include "measure-toolbar.h"
#include "node-toolbar.h"
#include "rect-toolbar.h"
#if HAVE_POTRACE
# include "paintbucket-toolbar.h"
#endif
#include "pencil-toolbar.h"
#include "select-toolbar.h"
#include "spray-toolbar.h"
#include "spiral-toolbar.h"
#include "star-toolbar.h"
#include "tweak-toolbar.h"
#include "text-toolbar.h"
#include "zoom-toolbar.h"
#include "toolbox.h"
#include "ui/tools/tool-base.h"
//#define DEBUG_TEXT
using Inkscape::DocumentUndo;
enum BarId {
BAR_TOOL = 0,
};
#define BAR_ID_KEY "BarIdValue"
#define HANDLE_POS_MARK "x-inkscape-pos"
};
return sizeChoices[index];
}
static struct {
} const tools[] = {
{ "/tools/calligraphic", "dyna_draw_tool", SP_VERB_CONTEXT_CALLIGRAPHIC, SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS },
#if HAVE_POTRACE
{ "/tools/paintbucket", "paintbucket_tool", SP_VERB_CONTEXT_PAINTBUCKET, SP_VERB_CONTEXT_PAINTBUCKET_PREFS },
#endif
{ "/tools/connector","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")},
{ "/tools/calligraphic", "calligraphy_toolbox", 0, sp_calligraphy_toolbox_prep,"CalligraphyToolbar",
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},
SP_VERB_INVALID, 0, 0},
#if HAVE_POTRACE
{ "/tools/paintbucket", "paintbucket_toolbox", 0, sp_paintbucket_toolbox_prep, "PaintbucketToolbar",
#endif
};
"<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_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='SprayPopulationAction' />"
" <toolitem action='SprayPressureAction' />"
" <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='MeasurePrecisionAction' />"
" <separator />"
" <toolitem action='MeasureScaleAction' />"
" <separator />"
" <toolitem action='MeasureOffsetAction' />"
" <separator />"
" <toolitem action='measure_units_label' />"
" <toolitem action='MeasureUnitsAction' />"
" <toolitem action='MeasureIgnore1stAndLast' />"
" <toolitem action='MeasureInBettween' />"
" <toolitem action='MeasureOnlyVisible' />"
" <toolitem action='MeasureAllLayers' />"
" <toolitem action='MeasureReverse' />"
" <toolitem action='MeasureToGuides' />"
" <toolitem action='MeasureMarkDimension' />"
" <toolitem action='MeasureToItem' />"
" </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' />"
" <toolitem action='PencilLpeSimplify' />"
" <toolitem action='PencilLpeSimplifyFlatten' />"
" <separator />"
" <toolitem action='PencilResetAction' />"
" <separator />"
" <toolitem action='SetPencilShapeAction'/>"
" </toolbar>"
" <toolbar name='CalligraphyToolbar'>"
" <separator />"
" <toolitem action='SetProfileAction'/>"
" <toolitem action='ProfileEditAction'/>"
" <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>"
#if HAVE_POTRACE
" <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>"
#endif
" <toolbar name='EraserToolbar'>"
" <toolitem action='EraserModeAction' />"
" <separator />"
" <toolitem action='EraserWidthAction' />"
" </toolbar>"
" <toolbar name='TextToolbar'>"
" <toolitem action='TextFontFamilyAction' />"
" <toolitem action='TextFontSizeAction' />"
" <toolitem action='TextFontStyleAction' />"
// " <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='GradientToolbar'>"
" <toolitem action='GradientNewTypeAction' />"
" <toolitem action='GradientNewFillStrokeAction' />"
" <separator />"
" <toolitem action='GradientSelectGradientAction' />"
" <toolitem action='GradientEditLinkAction' />"
" <toolitem action='GradientEditReverseAction' />"
" <toolitem action='GradientSelectRepeatAction' />"
" <separator />"
" <toolitem action='GradientEditStopsAction' />"
" <toolitem action='GradientEditOffsetAction' />"
" <toolitem action='GradientEditAddAction' />"
" <toolitem action='GradientEditDeleteAction' />"
" </toolbar>"
" <toolbar name='MeshToolbar'>"
" <toolitem action='MeshNewTypeAction' />"
" <toolitem action='MeshNewFillStrokeAction' />"
" <toolitem action='MeshRowAction' />"
" <toolitem action='MeshColumnAction' />"
" <separator />"
// " <toolitem action='MeshEditFillAction' />"
// " <toolitem action='MeshEditStrokeAction' />"
// " <toolitem action='MeshShowHandlesAction' />"
" <toolitem action='MeshToggleSidesAction' />"
" <toolitem action='MeshMakeEllipticalAction' />"
" <toolitem action='MeshPickColorsAction' />"
" <separator />"
" <toolitem action='MeshWarningAction' />"
" <toolitem action='MeshSmoothAction' />"
" </toolbar>"
" <toolbar name='DropperToolbar'>"
" <toolitem action='DropperOpacityAction' />"
" <toolitem action='DropperPickAlphaAction' />"
" <toolitem action='DropperSetAlphaAction' />"
" </toolbar>"
" <toolbar name='ConnectorToolbar'>"
" <toolitem action='ConnectorAvoidAction' />"
" <toolitem action='ConnectorIgnoreAction' />"
" <toolitem action='ConnectorOrthogonalAction' />"
" <toolitem action='ConnectorCurvatureAction' />"
" <toolitem action='ConnectorSpacingAction' />"
" <toolitem action='ConnectorGraphAction' />"
" <toolitem action='ConnectorLengthAction' />"
" <toolitem action='ConnectorDirectedAction' />"
" <toolitem action='ConnectorOverlapAction' />"
" </toolbar>"
"</ui>"
;
static void update_commands_toolbox(SPDesktop *desktop, ToolBase *eventcontext, GtkWidget *toolbox);
static GtkToolItem * sp_toolbox_button_item_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(Inkscape::ActionContext(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(g_dpgettext2(NULL, "ContextVerb", 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();
GtkToolItem *button_toolitem = sp_toolbox_button_item_new_from_verb_with_doubleclick( toolbox, toolboxSize,
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;
}
}
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;
}
// ------------------------------------------------------
GtkToolItem * sp_toolbox_button_item_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_KEY_VoidSymbol) {
if ( t ) {
}
} else {
if ( t ) {
}
}
return b_toolitem;
}
{
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,
//SP_VERB_FILE_EXPORT,
};
}
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;
}
{
return hb;
}
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
//####################################
//# Commands Bar
//####################################
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits, Inkscape::UI::Widget::UnitTracker *unit_tracker)
{
#if WITH_GTKMM_3_0
Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(adj, climbRate, digits);
#else
Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits);
#endif
return widget;
}
{
static bool init = false;
if ( !init ) {
init = true;
}
EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, label, tooltip, 0, climb, digits, unit_tracker );
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;
}
{
"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,
{
}
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
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)) {
} else {
g_message("need to add dynamic switch");
}
}
} else {
// The call is being made before the toolbox proper has been setup.
}
} else if (GTK_IS_TOOLBAR(child)) {
}
}
}
}
{
"<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' />"
#if HAVE_POTRACE
" <!-- Fill -->"
" <toolitem action='ToolPaintBucket' />"
#endif
" <toolitem action='ToolGradient' />"
#ifdef WITH_MESH
" <toolitem action='ToolMesh' />"
#endif
" <toolitem action='ToolDropper' />"
" <toolitem action='ToolConnector' />"
#ifdef WITH_LPETOOL
" <toolitem action='ToolLPETool' />"
#endif
" </toolbar>"
"</ui>";
"/ui/ToolToolbar",
}
{
: 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
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
tmp = 0;
}
#if GTK_CHECK_VERSION(3,0,0)
#else
gtk_table_attach( GTK_TABLE(holder), toolBar, 0, 1, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0 );
#endif
Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch( NULL, _(aux_toolboxes[i].swatch_tip) );
#if GTK_CHECK_VERSION(3,0,0)
#else
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, AUX_SPACING );
#endif
}
}
}
}
{
: 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='DialogExport' />"
" <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='DialogDocumentProperties' />"
" <toolitem action='DialogPreferences' />"
" </toolbar>"
"</ui>";
"/ui/CommandsToolbar",
}
void update_commands_toolbox(SPDesktop * /*desktop*/, ToolBase * /*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, ToolBase * /*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
/*
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 :