summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2015-12-07 10:00:35 +0000
committer~suv <suv-sf@users.sourceforge.net>2015-12-07 10:00:35 +0000
commit457c41675d69c7463c3590ad9b8e43bcae20e611 (patch)
tree43d1f8d4e350a3070944bbd7bb4ad265c1b6ed02 /src/widgets
parentmerge from trunk (r14473) (diff)
parentRemove leftover assert. (diff)
downloadinkscape-457c41675d69c7463c3590ad9b8e43bcae20e611.tar.gz
inkscape-457c41675d69c7463c3590ad9b8e43bcae20e611.zip
merge from trunk (r14506)
(bzr r14425.1.4)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/CMakeLists.txt11
-rw-r--r--src/widgets/Makefile_insert10
-rw-r--r--src/widgets/fill-style.cpp6
-rw-r--r--src/widgets/mesh-toolbar.cpp5
-rw-r--r--src/widgets/pencil-toolbar.cpp2
-rw-r--r--src/widgets/spray-toolbar.cpp2
-rw-r--r--src/widgets/text-toolbar.cpp179
-rw-r--r--src/widgets/toolbox.cpp17
8 files changed, 206 insertions, 26 deletions
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index a3e9e14d0..c38bde5cf 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -11,7 +11,6 @@ set(widgets_SRC
measure-toolbar.cpp
mesh-toolbar.cpp
node-toolbar.cpp
- paintbucket-toolbar.cpp
pencil-toolbar.cpp
rect-toolbar.cpp
spiral-toolbar.cpp
@@ -67,7 +66,6 @@ set(widgets_SRC
measure-toolbar.h
mesh-toolbar.h
node-toolbar.h
- paintbucket-toolbar.h
pencil-toolbar.h
rect-toolbar.h
spiral-toolbar.h
@@ -114,3 +112,12 @@ set(widgets_SRC
# add_inkscape_lib(widgets_LIB "${widgets_SRC}")
add_inkscape_source("${widgets_SRC}")
+
+set ( widgets_paintbucket_SRC
+ paintbucket-toolbar.cpp
+ paintbucket-toolbar.h
+)
+
+if ("${HAVE_POTRACE}")
+ add_inkscape_source("${widgets_paintbucket_SRC}")
+endif()
diff --git a/src/widgets/Makefile_insert b/src/widgets/Makefile_insert
index f66be66ed..6913f4a58 100644
--- a/src/widgets/Makefile_insert
+++ b/src/widgets/Makefile_insert
@@ -58,8 +58,6 @@ ink_common_sources += \
widgets/node-toolbar.h \
widgets/paint-selector.cpp \
widgets/paint-selector.h \
- widgets/paintbucket-toolbar.cpp \
- widgets/paintbucket-toolbar.h \
widgets/pencil-toolbar.cpp \
widgets/pencil-toolbar.h \
widgets/rect-toolbar.cpp \
@@ -109,5 +107,13 @@ ink_common_sources += \
widgets/zoom-toolbar.h \
widgets/widget-sizes.h
+if HAVE_POTRACE
+
+ink_common_sources += \
+ widgets/paintbucket-toolbar.cpp \
+ widgets/paintbucket-toolbar.h
+
+endif
+
widgets/button.$(OBJEXT): helper/sp-marshal.h
widgets/menu.$(OBJEXT): helper/sp-marshal.h
diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp
index a57c891e5..a96776894 100644
--- a/src/widgets/fill-style.cpp
+++ b/src/widgets/fill-style.cpp
@@ -68,7 +68,7 @@ namespace Inkscape {
class FillNStroke : public Gtk::VBox
{
public:
- FillNStroke( FillOrStroke kind );
+ FillNStroke( FillOrStroke k );
~FillNStroke();
void setFillrule( SPPaintSelector::FillRule mode );
@@ -125,9 +125,9 @@ Gtk::Widget *Inkscape::Widgets::createStyleWidget( FillOrStroke kind )
return filler;
}
-FillNStroke::FillNStroke( FillOrStroke kind ) :
+FillNStroke::FillNStroke( FillOrStroke k ) :
Gtk::VBox(),
- kind(kind),
+ kind(k),
desktop(0),
psel(0),
lastDrag(0),
diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp
index 4e0b6d68b..9937b23ed 100644
--- a/src/widgets/mesh-toolbar.cpp
+++ b/src/widgets/mesh-toolbar.cpp
@@ -292,6 +292,9 @@ static void ms_col_changed(GtkAdjustment *adj, GObject * /*tbl*/ )
blocked = FALSE;
}
+/**
+ * Sets mesh type: Coons, Bicubic
+ */
static void ms_type_changed(EgeSelectOneAction *act, GtkWidget *widget)
{
// std::cout << "ms_type_changed" << std::endl;
@@ -311,7 +314,7 @@ static void ms_type_changed(EgeSelectOneAction *act, GtkWidget *widget)
gradient->type_set = true;
gradient->updateRepr();
- DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH,
_("Set mesh type"));
}
}
diff --git a/src/widgets/pencil-toolbar.cpp b/src/widgets/pencil-toolbar.cpp
index 17c1d341d..aed80a66f 100644
--- a/src/widgets/pencil-toolbar.cpp
+++ b/src/widgets/pencil-toolbar.cpp
@@ -34,7 +34,6 @@
#include "pencil-toolbar.h"
#include "desktop.h"
-#include "document-undo.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
#include "widgets/ink-action.h"
@@ -57,7 +56,6 @@
#include "util/glib-list-iterators.h"
using Inkscape::UI::UXManager;
-using Inkscape::DocumentUndo;
using Inkscape::UI::ToolboxFactory;
using Inkscape::UI::PrefPusher;
diff --git a/src/widgets/spray-toolbar.cpp b/src/widgets/spray-toolbar.cpp
index 1774ba418..30e9c6418 100644
--- a/src/widgets/spray-toolbar.cpp
+++ b/src/widgets/spray-toolbar.cpp
@@ -34,7 +34,6 @@
#include "spray-toolbar.h"
#include "desktop.h"
#include "inkscape.h"
-#include "document-undo.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
#include "widgets/ink-action.h"
@@ -47,7 +46,6 @@
#include <glibmm/i18n.h>
-using Inkscape::DocumentUndo;
using Inkscape::UI::ToolboxFactory;
using Inkscape::UI::PrefPusher;
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index c49fbccaa..c6cc7dc45 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -737,7 +737,7 @@ static void sp_text_rotation_value_changed( GtkAdjustment *adj, GObject *tbl )
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
-static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject *tbl )
+static void sp_writing_mode_changed( EgeSelectOneAction *act, GObject *tbl )
{
// quit if run by the _changed callbacks
if (g_object_get_data(G_OBJECT(tbl), "freeze")) {
@@ -752,13 +752,73 @@ static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject *
{
case 0:
{
- sp_repr_css_set_property (css, "writing-mode", "lr");
+ sp_repr_css_set_property (css, "writing-mode", "lr-tb");
break;
}
case 1:
{
- sp_repr_css_set_property (css, "writing-mode", "tb");
+ sp_repr_css_set_property (css, "writing-mode", "tb-rl");
+ break;
+ }
+
+ case 2:
+ {
+ sp_repr_css_set_property (css, "writing-mode", "vertical-lr");
+ break;
+ }
+}
+
+ SPStyle query(SP_ACTIVE_DOCUMENT);
+ int result_numbers =
+ sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
+
+ // If querying returned nothing, update default style.
+ if (result_numbers == QUERY_STYLE_NOTHING)
+ {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->mergeStyle("/tools/text/style", css);
+ }
+
+ sp_desktop_set_style (SP_ACTIVE_DESKTOP, css, true, true);
+ if(result_numbers != QUERY_STYLE_NOTHING)
+ {
+ DocumentUndo::done(SP_ACTIVE_DESKTOP->getDocument(), SP_VERB_CONTEXT_TEXT,
+ _("Text: Change writing mode"));
+ }
+ sp_repr_css_attr_unref (css);
+
+ g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
+}
+
+static void sp_text_orientation_changed( EgeSelectOneAction *act, GObject *tbl )
+{
+ // quit if run by the _changed callbacks
+ if (g_object_get_data(G_OBJECT(tbl), "freeze")) {
+ return;
+ }
+ g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) );
+
+ int mode = ege_select_one_action_get_active( act );
+
+ SPCSSAttr *css = sp_repr_css_attr_new ();
+ switch (mode)
+ {
+ case 0:
+ {
+ sp_repr_css_set_property (css, "text-orientation", "auto");
+ break;
+ }
+
+ case 1:
+ {
+ sp_repr_css_set_property (css, "text-orientation", "upright");
+ break;
+ }
+
+ case 2:
+ {
+ sp_repr_css_set_property (css, "text-orientation", "sideways");
break;
}
}
@@ -893,13 +953,17 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
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);
+ int result_wmode = sp_desktop_query_style (SP_ACTIVE_DESKTOP, &query, QUERY_STYLE_PROPERTY_WRITINGMODES);
/*
* If no text in selection (querying returned nothing), read the style from
* the /tools/text preferencess (default style for new texts). Return if
* tool bar already set to these preferences.
*/
- if (result_family == QUERY_STYLE_NOTHING || result_style == QUERY_STYLE_NOTHING || result_numbers == QUERY_STYLE_NOTHING) {
+ if (result_family == QUERY_STYLE_NOTHING ||
+ result_style == QUERY_STYLE_NOTHING ||
+ result_numbers == QUERY_STYLE_NOTHING ||
+ result_wmode == QUERY_STYLE_NOTHING ) {
// There are no texts in selection, read from preferences.
query.readFromPrefs("/tools/text");
#ifdef DEBUG_TEXT
@@ -1047,13 +1111,42 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
gtk_adjustment_set_value( letterSpacingAdjustment, letterSpacing );
+ // Writing mode
+ int activeButton2 = 0;
+ if (query.writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB) activeButton2 = 0;
+ if (query.writing_mode.computed == SP_CSS_WRITING_MODE_TB_RL) activeButton2 = 1;
+ if (query.writing_mode.computed == SP_CSS_WRITING_MODE_TB_LR) activeButton2 = 2;
+
+ EgeSelectOneAction* writingModeAction =
+ EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextWritingModeAction" ) );
+ ege_select_one_action_set_active( writingModeAction, activeButton2 );
+
// Orientation
- int activeButton2 = (query.writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB ? 0 : 1);
+ int activeButton3 = 0;
+ if (query.text_orientation.computed == SP_CSS_TEXT_ORIENTATION_MIXED ) activeButton3 = 0;
+ if (query.text_orientation.computed == SP_CSS_TEXT_ORIENTATION_UPRIGHT ) activeButton3 = 1;
+ if (query.text_orientation.computed == SP_CSS_TEXT_ORIENTATION_SIDEWAYS) activeButton3 = 2;
EgeSelectOneAction* textOrientationAction =
EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextOrientationAction" ) );
- ege_select_one_action_set_active( textOrientationAction, activeButton2 );
+ ege_select_one_action_set_active( textOrientationAction, activeButton3 );
+
+ // Disable text orientation for horizontal text.. See above for why this nonsense
+ model = GTK_LIST_STORE( ege_select_one_action_get_model( textOrientationAction ) );
+ path = gtk_tree_path_new_from_string("0");
+ gtk_tree_model_get_iter( GTK_TREE_MODEL (model), &iter, path );
+ gtk_list_store_set( model, &iter, /* column */ 3, activeButton2 != 0, -1 );
+
+ path = gtk_tree_path_new_from_string("1");
+ gtk_tree_model_get_iter( GTK_TREE_MODEL (model), &iter, path );
+ gtk_list_store_set( model, &iter, /* column */ 3, activeButton2 != 0, -1 );
+
+ path = gtk_tree_path_new_from_string("2");
+ gtk_tree_model_get_iter( GTK_TREE_MODEL (model), &iter, path );
+ gtk_list_store_set( model, &iter, /* column */ 3, activeButton2 != 0, -1 );
+
+ ege_select_one_action_update_sensitive( textOrientationAction );
}
@@ -1387,7 +1480,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_text_align_mode_changed), holder );
}
- /* Orientation (Left to Right, Top to Bottom */
+ /* Writing mode (Horizontal, Vertical-LR, Vertical-RL) */
{
GtkListStore* model = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
@@ -1402,14 +1495,73 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
gtk_list_store_append( model, &iter );
gtk_list_store_set( model, &iter,
- 0, _("Vertical"),
- 1, _("Vertical text"),
+ 0, _("Vertical — RL"),
+ 1, _("Vertical text — lines: right to left"),
2, INKSCAPE_ICON("format-text-direction-vertical"),
-1 );
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Vertical — LR"),
+ 1, _("Vertical text — lines: left to right"), // Mongolian!
+ 2, INKSCAPE_ICON("format-text-direction-vertical-lr"),
+ -1 );
+
+ EgeSelectOneAction* act = ege_select_one_action_new( "TextWritingModeAction", // Name
+ _("Writing mode"), // Label
+ _("Block progression"), // Tooltip
+ NULL, // Icon name
+ GTK_TREE_MODEL(model) ); // Model
+
+ g_object_set( act, "short_label", "NotUsed", NULL );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
+ g_object_set_data( holder, "TextWritingModeAction", 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_icon_size( act, secondarySize );
+ ege_select_one_action_set_tooltip_column( act, 1 );
+
+ gint mode = prefs->getInt("/tools/text/writing_mode", 0);
+ ege_select_one_action_set_active( act, mode );
+ g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_writing_mode_changed), holder );
+ }
+
+ /* Text (glyph) orientation (Auto (mixed), Upright, Sideways) */
+ {
+ GtkListStore* model = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN );
+
+ GtkTreeIter iter;
+
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Auto"),
+ 1, _("Auto glyph orientation"),
+ 2, INKSCAPE_ICON("text-orientation-auto"),
+ 3, true,
+ -1 );
+
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Upright"),
+ 1, _("Upright glyph orientation"),
+ 2, INKSCAPE_ICON("text-orientation-upright"),
+ 3, true,
+ -1 );
+
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Sideways"),
+ 1, _("Sideways glyph orientation"),
+ 2, INKSCAPE_ICON("text-orientation-sideways"),
+ 3, true,
+ -1 );
+
EgeSelectOneAction* act = ege_select_one_action_new( "TextOrientationAction", // Name
- _("Orientation"), // Label
- _("Text orientation"), // Tooltip
+ _("Text orientation"), // Label
+ _("Text (glyph) orientation in vertical text."), // Tooltip
NULL, // Icon name
GTK_TREE_MODEL(model) ); // Model
@@ -1423,10 +1575,11 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
ege_select_one_action_set_icon_column( act, 2 );
ege_select_one_action_set_icon_size( act, secondarySize );
ege_select_one_action_set_tooltip_column( act, 1 );
+ ege_select_one_action_set_sensitive_column( act, 3 );
- gint mode = prefs->getInt("/tools/text/orientation", 0);
+ gint mode = prefs->getInt("/tools/text/text_orientation", 0);
ege_select_one_action_set_active( act, mode );
- g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_text_orientation_mode_changed), holder );
+ g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_text_orientation_changed), holder );
}
/* Line height */
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 3e79e038a..c3f301c52 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -79,7 +79,11 @@
#include "measure-toolbar.h"
#include "node-toolbar.h"
#include "rect-toolbar.h"
-#include "paintbucket-toolbar.h"
+
+#if HAVE_POTRACE
+# include "paintbucket-toolbar.h"
+#endif
+
#include "pencil-toolbar.h"
#include "select-toolbar.h"
#include "spray-toolbar.h"
@@ -151,7 +155,9 @@ static struct {
{ "/tools/calligraphic", "dyna_draw_tool", SP_VERB_CONTEXT_CALLIGRAPHIC, SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS },
{ "/tools/lpetool", "lpetool_tool", SP_VERB_CONTEXT_LPETOOL, SP_VERB_CONTEXT_LPETOOL_PREFS },
{ "/tools/eraser", "eraser_tool", SP_VERB_CONTEXT_ERASER, SP_VERB_CONTEXT_ERASER_PREFS },
+#if HAVE_POTRACE
{ "/tools/paintbucket", "paintbucket_tool", SP_VERB_CONTEXT_PAINTBUCKET, SP_VERB_CONTEXT_PAINTBUCKET_PREFS },
+#endif
{ "/tools/text", "text_tool", SP_VERB_CONTEXT_TEXT, SP_VERB_CONTEXT_TEXT_PREFS },
{ "/tools/connector","connector_tool", SP_VERB_CONTEXT_CONNECTOR, SP_VERB_CONTEXT_CONNECTOR_PREFS },
{ "/tools/gradient", "gradient_tool", SP_VERB_CONTEXT_GRADIENT, SP_VERB_CONTEXT_GRADIENT_PREFS },
@@ -212,8 +218,10 @@ static struct {
SP_VERB_INVALID, 0, 0},
{ "/tools/mesh", "mesh_toolbox", 0, sp_mesh_toolbox_prep, "MeshToolbar",
SP_VERB_INVALID, 0, 0},
+#if HAVE_POTRACE
{ "/tools/paintbucket", "paintbucket_toolbox", 0, sp_paintbucket_toolbox_prep, "PaintbucketToolbar",
SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "/tools/paintbucket", N_("Style of Paint Bucket fill objects")},
+#endif
{ NULL, NULL, NULL, NULL, NULL, SP_VERB_INVALID, NULL, NULL }
};
@@ -469,6 +477,7 @@ static gchar const * ui_descr =
" <separator />"
" </toolbar>"
+#if HAVE_POTRACE
" <toolbar name='PaintbucketToolbar'>"
" <toolitem action='ChannelsAction' />"
" <separator />"
@@ -481,6 +490,7 @@ static gchar const * ui_descr =
" <separator />"
" <toolitem action='PaintbucketResetAction' />"
" </toolbar>"
+#endif
" <toolbar name='EraserToolbar'>"
" <toolitem action='EraserModeAction' />"
@@ -507,6 +517,8 @@ static gchar const * ui_descr =
" <toolitem action='TextDyAction' />"
" <toolitem action='TextRotationAction' />"
" <separator />"
+ " <toolitem action='TextWritingModeAction' />"
+ " <separator />"
" <toolitem action='TextOrientationAction' />"
" </toolbar>"
@@ -1323,8 +1335,11 @@ void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
" <toolitem action='ToolSpray' />"
" <toolitem action='ToolEraser' />"
+#if HAVE_POTRACE
" <!-- Fill -->"
" <toolitem action='ToolPaintBucket' />"
+#endif
+
" <toolitem action='ToolGradient' />"
#ifdef WITH_MESH
" <toolitem action='ToolMesh' />"