index dad4f11f6a3a61dfea4dd6df13e219374ce81c4c..9801c9f48876c056fe53b0370b611d9275d45c09 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
#include "sp-namedview.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "sp-namedview.h"
#include "desktop.h"
#include "desktop-handles.h"
-#include "nodepath.h"
#include "xml/repr.h"
#include "xml/node-event-vector.h"
#include <glibmm/i18n.h>
#include "xml/repr.h"
#include "xml/node-event-vector.h"
#include <glibmm/i18n.h>
#include "gradient-toolbar.h"
#include "connector-context.h"
#include "gradient-toolbar.h"
#include "connector-context.h"
+#include "node-context.h"
+#include "shape-editor.h"
#include "sp-rect.h"
#include "sp-rect.h"
+#include "box3d.h"
+#include "box3d-context.h"
#include "sp-star.h"
#include "sp-spiral.h"
#include "sp-ellipse.h"
#include "sp-star.h"
#include "sp-spiral.h"
#include "sp-ellipse.h"
typedef void (*UpdateFunction)(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
typedef void (*UpdateFunction)(SPDesktop *desktop, SPEventContext *eventcontext, GtkWidget *toolbox);
static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
+static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_zoom_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_zoom_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
+static void sp_3dbox_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_pen_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_pen_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
} const tools[] = {
{ "SPSelectContext", "select_tool", SP_VERB_CONTEXT_SELECT, SP_VERB_CONTEXT_SELECT_PREFS},
{ "SPNodeContext", "node_tool", SP_VERB_CONTEXT_NODE, SP_VERB_CONTEXT_NODE_PREFS },
} const tools[] = {
{ "SPSelectContext", "select_tool", SP_VERB_CONTEXT_SELECT, SP_VERB_CONTEXT_SELECT_PREFS},
{ "SPNodeContext", "node_tool", SP_VERB_CONTEXT_NODE, SP_VERB_CONTEXT_NODE_PREFS },
+ { "SPTweakContext", "tweak_tool", SP_VERB_CONTEXT_TWEAK, SP_VERB_CONTEXT_TWEAK_PREFS },
{ "SPZoomContext", "zoom_tool", SP_VERB_CONTEXT_ZOOM, SP_VERB_CONTEXT_ZOOM_PREFS },
{ "SPRectContext", "rect_tool", SP_VERB_CONTEXT_RECT, SP_VERB_CONTEXT_RECT_PREFS },
{ "SPZoomContext", "zoom_tool", SP_VERB_CONTEXT_ZOOM, SP_VERB_CONTEXT_ZOOM_PREFS },
{ "SPRectContext", "rect_tool", SP_VERB_CONTEXT_RECT, SP_VERB_CONTEXT_RECT_PREFS },
+// { "SP3DBoxContext", "3dbox_tool", SP_VERB_CONTEXT_3DBOX, SP_VERB_CONTEXT_3DBOX_PREFS },
{ "SPArcContext", "arc_tool", SP_VERB_CONTEXT_ARC, SP_VERB_CONTEXT_ARC_PREFS },
{ "SPStarContext", "star_tool", SP_VERB_CONTEXT_STAR, SP_VERB_CONTEXT_STAR_PREFS },
{ "SPSpiralContext", "spiral_tool", SP_VERB_CONTEXT_SPIRAL, SP_VERB_CONTEXT_SPIRAL_PREFS },
{ "SPArcContext", "arc_tool", SP_VERB_CONTEXT_ARC, SP_VERB_CONTEXT_ARC_PREFS },
{ "SPStarContext", "star_tool", SP_VERB_CONTEXT_STAR, SP_VERB_CONTEXT_STAR_PREFS },
{ "SPSpiralContext", "spiral_tool", SP_VERB_CONTEXT_SPIRAL, SP_VERB_CONTEXT_SPIRAL_PREFS },
SP_VERB_INVALID, 0, 0},
{ "SPNodeContext", "node_toolbox", 0, sp_node_toolbox_prep, "NodeToolbar",
SP_VERB_INVALID, 0, 0},
SP_VERB_INVALID, 0, 0},
{ "SPNodeContext", "node_toolbox", 0, sp_node_toolbox_prep, "NodeToolbar",
SP_VERB_INVALID, 0, 0},
+ { "SPTweakContext", "tweak_toolbox", 0, sp_tweak_toolbox_prep, "TweakToolbar",
+ SP_VERB_INVALID, 0, 0},
{ "SPZoomContext", "zoom_toolbox", 0, sp_zoom_toolbox_prep, "ZoomToolbar",
SP_VERB_INVALID, 0, 0},
{ "SPStarContext", "star_toolbox", 0, sp_star_toolbox_prep, "StarToolbar",
SP_VERB_CONTEXT_STAR_PREFS, "tools.shapes.star", _("Style of new stars")},
{ "SPRectContext", "rect_toolbox", 0, sp_rect_toolbox_prep, "RectToolbar",
SP_VERB_CONTEXT_RECT_PREFS, "tools.shapes.rect", _("Style of new rectangles")},
{ "SPZoomContext", "zoom_toolbox", 0, sp_zoom_toolbox_prep, "ZoomToolbar",
SP_VERB_INVALID, 0, 0},
{ "SPStarContext", "star_toolbox", 0, sp_star_toolbox_prep, "StarToolbar",
SP_VERB_CONTEXT_STAR_PREFS, "tools.shapes.star", _("Style of new stars")},
{ "SPRectContext", "rect_toolbox", 0, sp_rect_toolbox_prep, "RectToolbar",
SP_VERB_CONTEXT_RECT_PREFS, "tools.shapes.rect", _("Style of new rectangles")},
+ { "SP3DBoxContext", "3dbox_toolbox", 0, sp_3dbox_toolbox_prep, "3DBoxToolbar",
+ SP_VERB_CONTEXT_3DBOX_PREFS, "tools.shapes.3dbox", _("Style of new 3D boxes")},
{ "SPArcContext", "arc_toolbox", 0, sp_arc_toolbox_prep, "ArcToolbar",
SP_VERB_CONTEXT_ARC_PREFS, "tools.shapes.arc", _("Style of new ellipses")},
{ "SPSpiralContext", "spiral_toolbox", 0, sp_spiral_toolbox_prep, "SpiralToolbar",
{ "SPArcContext", "arc_toolbox", 0, sp_arc_toolbox_prep, "ArcToolbar",
SP_VERB_CONTEXT_ARC_PREFS, "tools.shapes.arc", _("Style of new ellipses")},
{ "SPSpiralContext", "spiral_toolbox", 0, sp_spiral_toolbox_prep, "SpiralToolbar",
" <toolitem action='NodesShowHandlesAction' />"
" </toolbar>"
" <toolitem action='NodesShowHandlesAction' />"
" </toolbar>"
+ " <toolbar name='TweakToolbar'>"
+ " <toolitem action='TweakWidthAction' />"
+ " <toolitem action='TweakForceAction' />"
+ " <separator />"
+ " <toolitem action='TweakModeAction' />"
+ " <separator />"
+ " <toolitem action='TweakFidelityAction' />"
+ " <toolitem action='TweakPressureAction' />"
+ " </toolbar>"
+
" <toolbar name='ZoomToolbar'>"
" <toolitem action='ZoomIn' />"
" <toolitem action='ZoomOut' />"
" <toolbar name='ZoomToolbar'>"
" <toolitem action='ZoomIn' />"
" <toolitem action='ZoomOut' />"
" <toolitem action='RectResetAction' />"
" </toolbar>"
" <toolitem action='RectResetAction' />"
" </toolbar>"
+ " <toolbar name='3DBoxToolbar'>"
+ " <toolitem action='3DBoxVPXAction' />"
+ " <toolitem action='3DBoxVPYAction' />"
+ " <toolitem action='3DBoxVPZAction' />"
+ " <separator />"
+ " </toolbar>"
+
" <toolbar name='SpiralToolbar'>"
" <toolitem action='SpiralStateAction' />"
" <toolitem action='SpiralRevolutionAction' />"
" <toolbar name='SpiralToolbar'>"
" <toolitem action='SpiralStateAction' />"
" <toolitem action='SpiralRevolutionAction' />"
" <toolitem action='OffsetAction' />"
" <toolitem action='PaintbucketUnitsAction' />"
" <separator />"
" <toolitem action='OffsetAction' />"
" <toolitem action='PaintbucketUnitsAction' />"
" <separator />"
+ " <toolitem action='AutoGapAction' />"
+ " <separator />"
" <toolitem action='PaintbucketResetAction' />"
" </toolbar>"
" <toolitem action='PaintbucketResetAction' />"
" </toolbar>"
//# node editing callbacks
//####################################
//# node editing callbacks
//####################################
+/**
+ * FIXME: Returns current shape_editor in context. // later eliminate this function at all!
+ */
+static ShapeEditor *get_current_shape_editor()
+{
+ if (!SP_ACTIVE_DESKTOP) {
+ return NULL;
+ }
+
+ SPEventContext *event_context = (SP_ACTIVE_DESKTOP)->event_context;
+
+ if (!SP_IS_NODE_CONTEXT(event_context)) {
+ return NULL;
+ }
+
+ return SP_NODE_CONTEXT(event_context)->shape_editor;
+}
+
+
void
sp_node_path_edit_add(void)
{
void
sp_node_path_edit_add(void)
{
- sp_node_selected_add_node();
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->add_node();
}
void
sp_node_path_edit_delete(void)
{
}
void
sp_node_path_edit_delete(void)
{
- sp_node_selected_delete();
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->delete_nodes();
}
void
sp_node_path_edit_delete_segment(void)
{
}
void
sp_node_path_edit_delete_segment(void)
{
- sp_node_selected_delete_segment();
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->delete_segment();
}
void
sp_node_path_edit_break(void)
{
}
void
sp_node_path_edit_break(void)
{
- sp_node_selected_break();
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->break_at_nodes();
}
void
sp_node_path_edit_join(void)
{
}
void
sp_node_path_edit_join(void)
{
- sp_node_selected_join();
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->join_nodes();
}
void
sp_node_path_edit_join_segment(void)
{
}
void
sp_node_path_edit_join_segment(void)
{
- sp_node_selected_join_segment();
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->join_segments();
}
void
sp_node_path_edit_toline(void)
{
}
void
sp_node_path_edit_toline(void)
{
- sp_node_selected_set_line_type(NR_LINETO);
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->set_type_of_segments(NR_LINETO);
}
void
sp_node_path_edit_tocurve(void)
{
}
void
sp_node_path_edit_tocurve(void)
{
- sp_node_selected_set_line_type(NR_CURVETO);
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->set_type_of_segments(NR_CURVETO);
}
void
sp_node_path_edit_cusp(void)
{
}
void
sp_node_path_edit_cusp(void)
{
- sp_node_selected_set_type(Inkscape::NodePath::NODE_CUSP);
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->set_node_type(Inkscape::NodePath::NODE_CUSP);
}
void
sp_node_path_edit_smooth(void)
{
}
void
sp_node_path_edit_smooth(void)
{
- sp_node_selected_set_type(Inkscape::NodePath::NODE_SMOOTH);
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->set_node_type(Inkscape::NodePath::NODE_SMOOTH);
}
void
sp_node_path_edit_symmetrical(void)
{
}
void
sp_node_path_edit_symmetrical(void)
{
- sp_node_selected_set_type(Inkscape::NodePath::NODE_SYMM);
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->set_node_type(Inkscape::NodePath::NODE_SYMM);
}
static void toggle_show_handles (GtkToggleAction *act, gpointer data) {
bool show = gtk_toggle_action_get_active( act );
prefs_set_int_attribute ("tools.nodes", "show_handles", show ? 1 : 0);
}
static void toggle_show_handles (GtkToggleAction *act, gpointer data) {
bool show = gtk_toggle_action_get_active( act );
prefs_set_int_attribute ("tools.nodes", "show_handles", show ? 1 : 0);
- sp_nodepath_show_handles(show);
+ ShapeEditor *shape_editor = get_current_shape_editor();
+ if (shape_editor) shape_editor->show_handles(show);
}
//################################
}
//################################
@@ -2055,6 +2116,74 @@ static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder );
}
g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder );
}
+//########################
+//## 3D Box ##
+//########################
+
+static void sp_3dbox_toggle_vp_changed( GtkToggleAction *act, gpointer data )
+{
+ SPDocument *document = sp_desktop_document (inkscape_active_desktop ());
+ Box3D::Axis axis = (Box3D::Axis) GPOINTER_TO_INT(data);
+
+ if (document->current_perspective) {
+ document->current_perspective->toggle_boxes (axis);
+ }
+
+}
+
+static void sp_3dbox_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
+{
+ SPDocument *document = sp_desktop_document (desktop);
+ bool toggled = false;
+ /* toggle VP in X direction */
+ {
+ InkToggleAction* act = ink_toggle_action_new( "3DBoxVPXAction",
+ _("Toggle VP in X direction"),
+ _("Toggle VP in X direction between 'finite' and 'infinite' (=parallel)"),
+ "toggle_vp_x",
+ Inkscape::ICON_SIZE_DECORATION );
+ gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+ if (document->current_perspective) {
+ toggled = !document->current_perspective->get_vanishing_point(Box3D::X)->is_finite();
+ }
+ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), toggled );
+ /* we connect the signal after setting the state to avoid switching the state again */
+ g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_3dbox_toggle_vp_changed), GINT_TO_POINTER(Box3D::X));
+ }
+
+ /* toggle VP in Y direction */
+ {
+ InkToggleAction* act = ink_toggle_action_new( "3DBoxVPYAction",
+ _("Toggle VP in Y direction"),
+ _("Toggle VP in Y direction between 'finite' and 'infinite' (=parallel)"),
+ "toggle_vp_y",
+ Inkscape::ICON_SIZE_DECORATION );
+ gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+ if (document->current_perspective) {
+ toggled = !document->current_perspective->get_vanishing_point(Box3D::Y)->is_finite();
+ }
+ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), toggled );
+ /* we connect the signal after setting the state to avoid switching the state again */
+ g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_3dbox_toggle_vp_changed), GINT_TO_POINTER(Box3D::Y));
+ }
+
+ /* toggle VP in Z direction */
+ {
+ InkToggleAction* act = ink_toggle_action_new( "3DBoxVPZAction",
+ _("Toggle VP in Z direction"),
+ _("Toggle VP in Z direction between 'finite' and 'infinite' (=parallel)"),
+ "toggle_vp_z",
+ Inkscape::ICON_SIZE_DECORATION );
+ gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+ if (document->current_perspective) {
+ toggled = !document->current_perspective->get_vanishing_point(Box3D::Z)->is_finite();
+ }
+ /* we connect the signal after setting the state to avoid switching the state again */
+ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), toggled );
+ g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_3dbox_toggle_vp_changed), GINT_TO_POINTER(Box3D::Z));
+ }
+}
+
//########################
//## Spiral ##
//########################
//########################
//## Spiral ##
//########################
@@ -2303,6 +2432,148 @@ static void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
// Put stuff here
}
// Put stuff here
}
+//########################
+//## Tweak ##
+//########################
+
+static void sp_tweak_width_value_changed( GtkAdjustment *adj, GObject *tbl )
+{
+ prefs_set_double_attribute( "tools.tweak", "width", adj->value * 0.01 );
+}
+
+static void sp_tweak_force_value_changed( GtkAdjustment *adj, GObject *tbl )
+{
+ prefs_set_double_attribute( "tools.tweak", "force", adj->value * 0.01 );
+}
+
+static void sp_tweak_pressure_state_changed( GtkToggleAction *act, gpointer data )
+{
+ prefs_set_int_attribute( "tools.tweak", "usepressure", gtk_toggle_action_get_active( act ) ? 1 : 0);
+}
+
+static void sp_tweak_mode_changed( EgeSelectOneAction *act, GObject *tbl )
+{
+ prefs_set_int_attribute("tools.tweak", "mode", ege_select_one_action_get_active( act ));
+}
+
+static void sp_tweak_fidelity_value_changed( GtkAdjustment *adj, GObject *tbl )
+{
+ prefs_set_double_attribute( "tools.tweak", "fidelity", adj->value * 0.01 );
+}
+
+
+static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
+{
+ {
+ /* Width */
+ gchar const* labels[] = {_("(pinch tweak)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad tweak)")};
+ gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100};
+ EgeAdjustmentAction *eact = create_adjustment_action( "TweakWidthAction",
+ _("Width:"), _("The width of the tweak area (relative to the visible canvas area)"),
+ "tools.tweak", "width", 15,
+ GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-tweak",
+ 1, 100, 1.0, 10.0,
+ labels, values, G_N_ELEMENTS(labels),
+ sp_tweak_width_value_changed, 0.01, 0, 100 );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+ gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+ }
+
+
+ {
+ /* Force */
+ gchar const* labels[] = {_("(minimum force)"), 0, 0, _("(default)"), 0, 0, 0, _("(maximum force)")};
+ gdouble values[] = {1, 5, 10, 20, 30, 50, 70, 100};
+ EgeAdjustmentAction *eact = create_adjustment_action( "TweakForceAction",
+ _("Force:"), _("The force of the tweak action"),
+ "tools.tweak", "force", 20,
+ GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "tweak-force",
+ 1, 100, 1.0, 10.0,
+ labels, values, G_N_ELEMENTS(labels),
+ sp_tweak_force_value_changed, 0.01, 0, 100 );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+ gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+ }
+
+ /* Mode */
+ {
+ GtkListStore* model = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
+
+ GtkTreeIter iter;
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Push mode"),
+ 1, _("Switch to Push mode"),
+ 2, "tweak_push_mode",
+ -1 );
+
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Melt mode"),
+ 1, _("Switch to Melt mode"),
+ 2, "tweak_suck_mode",
+ -1 );
+
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Blow mode"),
+ 1, _("Switch to Blow mode"),
+ 2, "tweak_blow_mode",
+ -1 );
+
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Roughen mode"),
+ 1, _("Switch to Roughen mode"),
+ 2, "tweak_roughen_mode",
+ -1 );
+
+ EgeSelectOneAction* act = ege_select_one_action_new( "TweakModeAction", _(""), _(""), NULL, GTK_TREE_MODEL(model) );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
+ g_object_set_data( holder, "mode_action", act );
+
+ ege_select_one_action_set_appearance( act, "full" );
+ ege_select_one_action_set_radio_action_type( act, INK_RADIO_ACTION_TYPE );
+ g_object_set( G_OBJECT(act), "icon-property", "iconId", NULL );
+ ege_select_one_action_set_icon_column( act, 2 );
+ ege_select_one_action_set_tooltip_column( act, 1 );
+
+ gint mode = prefs_get_int_attribute("tools.tweak", "mode", 0);
+ ege_select_one_action_set_active( act, mode );
+ g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_tweak_mode_changed), holder );
+
+ g_object_set_data( G_OBJECT(holder), "tweak_tool_mode", act);
+ }
+
+ { /* Fidelity */
+ gchar const* labels[] = {_("(rough, simplified)"), 0, 0, _("(default)"), 0, 0, _("(fine, but many nodes)")};
+ gdouble values[] = {10, 25, 35, 50, 60, 80, 100};
+ EgeAdjustmentAction *eact = create_adjustment_action( "TweakFidelityAction",
+ _("Fidelity:"), _("Low fidelity simplifies paths; high fidelity preserves path features but may generate a lot of new nodes"),
+ "tools.tweak", "fidelity", 50,
+ GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "tweak-fidelity",
+ 1, 100, 1.0, 10.0,
+ labels, values, G_N_ELEMENTS(labels),
+ sp_tweak_fidelity_value_changed, 0.01, 0, 100 );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+ gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+ }
+
+
+ /* Use Pressure button */
+ {
+ InkToggleAction* act = ink_toggle_action_new( "TweakPressureAction",
+ _("Pressure"),
+ _("Use the pressure of the input device to alter the width of the area"),
+ "use_pressure",
+ Inkscape::ICON_SIZE_DECORATION );
+ gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+ g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_tweak_pressure_state_changed), NULL);
+ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.tweak", "usepressure", 1 ) );
+ }
+
+}
+
//########################
//## Calligraphy ##
//########################
//## Calligraphy ##
@@ -2562,7 +2833,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
{
GtkAction* act = gtk_action_new( "CalligraphyResetAction",
_("Defaults"),
{
GtkAction* act = gtk_action_new( "CalligraphyResetAction",
_("Defaults"),
- _("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
+ _("Reset all parameters to defaults"),
GTK_STOCK_CLEAR );
g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(sp_ddc_defaults), holder );
gtk_action_group_add_action( mainActions, act );
GTK_STOCK_CLEAR );
g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(sp_ddc_defaults), holder );
gtk_action_group_add_action( mainActions, act );
void
sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl)
{
void
sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl)
{
-
SPStyle *query =
SPStyle *query =
- sp_style_new ();
+ sp_style_new (SP_ACTIVE_DOCUMENT);
int result_family =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
int result_family =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY);
@@ -3175,6 +3445,8 @@ sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl)
g_object_set_data (G_OBJECT (button), "block", gpointer(0));
g_object_set_data (G_OBJECT (button1), "block", gpointer(0));
}
g_object_set_data (G_OBJECT (button), "block", gpointer(0));
g_object_set_data (G_OBJECT (button1), "block", gpointer(0));
}
+
+ sp_style_unref(query);
}
void
}
void
gtk_entry_set_text (GTK_ENTRY (entry), family);
SPStyle *query =
gtk_entry_set_text (GTK_ENTRY (entry), family);
SPStyle *query =
- sp_style_new ();
+ sp_style_new (SP_ACTIVE_DOCUMENT);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
sp_desktop_set_style (desktop, css, true, true);
}
sp_desktop_set_style (desktop, css, true, true);
}
+ sp_style_unref(query);
+
sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
_("Text: Change font family"));
sp_repr_css_attr_unref (css);
sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
_("Text: Change font family"));
sp_repr_css_attr_unref (css);
}
SPStyle *query =
}
SPStyle *query =
- sp_style_new ();
+ sp_style_new (SP_ACTIVE_DOCUMENT);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
}
sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
}
+ sp_style_unref(query);
+
sp_desktop_set_style (desktop, css, true, true);
sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
_("Text: Change alignment"));
sp_desktop_set_style (desktop, css, true, true);
sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
_("Text: Change alignment"));
}
SPStyle *query =
}
SPStyle *query =
- sp_style_new ();
+ sp_style_new (SP_ACTIVE_DOCUMENT);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
}
sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
}
+ sp_style_unref(query);
+
sp_desktop_set_style (desktop, css, true, true);
sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
_("Text: Change font style"));
sp_desktop_set_style (desktop, css, true, true);
sp_document_done (sp_desktop_document (SP_ACTIVE_DESKTOP), SP_VERB_CONTEXT_TEXT,
_("Text: Change font style"));
}
SPStyle *query =
}
SPStyle *query =
- sp_style_new ();
+ sp_style_new (SP_ACTIVE_DOCUMENT);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
free (text);
SPStyle *query =
free (text);
SPStyle *query =
- sp_style_new ();
+ sp_style_new (SP_ACTIVE_DOCUMENT);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
int result_numbers =
sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
}
sp_repr_css_change (inkscape_get_repr (INKSCAPE, "tools.text"), css, "style");
}
+ sp_style_unref(query);
+
sp_desktop_set_style (desktop, css, true, true);
sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE,
_("Text: Change font size"));
sp_desktop_set_style (desktop, css, true, true);
sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:size", SP_VERB_NONE,
_("Text: Change font size"));
prefs_set_int_attribute("tools.paintbucket", "threshold", (gint)adj->value);
}
prefs_set_int_attribute("tools.paintbucket", "threshold", (gint)adj->value);
}
+static void paintbucket_autogap_changed(EgeSelectOneAction* act, GObject *tbl)
+{
+ prefs_set_int_attribute("tools.paintbucket", "autogap", ege_select_one_action_get_active( act ));
+}
+
static void paintbucket_offset_changed(GtkAdjustment *adj, GObject *tbl)
{
UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
static void paintbucket_offset_changed(GtkAdjustment *adj, GObject *tbl)
{
UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" ));
EgeSelectOneAction* channels_action = EGE_SELECT_ONE_ACTION( g_object_get_data( dataKludge, "channels_action" ) );
ege_select_one_action_set_active( channels_action, FLOOD_CHANNELS_RGB );
EgeSelectOneAction* channels_action = EGE_SELECT_ONE_ACTION( g_object_get_data( dataKludge, "channels_action" ) );
ege_select_one_action_set_active( channels_action, FLOOD_CHANNELS_RGB );
+ EgeSelectOneAction* autogap_action = EGE_SELECT_ONE_ACTION( g_object_get_data( dataKludge, "autogap_action" ) );
+ ege_select_one_action_set_active( autogap_action, 0 );
}
static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
}
static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
@@ -4379,6 +4666,28 @@ static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
}
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
}
+ /* Auto Gap */
+ {
+ GtkListStore* model = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_INT );
+
+ GList* items = 0;
+ gint count = 0;
+ for ( items = flood_autogap_dropdown_items_list(); items ; items = g_list_next(items) )
+ {
+ GtkTreeIter iter;
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter, 0, reinterpret_cast<gchar*>(items->data), 1, count, -1 );
+ count++;
+ }
+ g_list_free( items );
+ items = 0;
+ EgeSelectOneAction* act2 = ege_select_one_action_new( "AutoGapAction", _("Fill gaps:"), _(""), NULL, GTK_TREE_MODEL(model) );
+ ege_select_one_action_set_active( act2, prefs_get_int_attribute("tools.paintbucket", "autogap", 0) );
+ g_signal_connect( G_OBJECT(act2), "changed", G_CALLBACK(paintbucket_autogap_changed), holder );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(act2) );
+ g_object_set_data( holder, "autogap_action", act2 );
+ }
+
/* Reset */
{
GtkAction* act = gtk_action_new( "PaintbucketResetAction",
/* Reset */
{
GtkAction* act = gtk_action_new( "PaintbucketResetAction",