summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-03-15 21:57:03 +0000
committerJabiertxof <jtx@jtx.marker.es>2016-03-15 21:57:03 +0000
commit6bd1c2a30b66e15fe055b22bd47dadb771f7fae2 (patch)
tree1b991cc2736f84fb069666802d485bd29cff6394 /src/ui/dialog
parentUpdate to limit options to radius = 0, radious > 0 or both (diff)
parentfix-bug-1557192. paint-order crash with multiple items (diff)
downloadinkscape-6bd1c2a30b66e15fe055b22bd47dadb771f7fae2.tar.gz
inkscape-6bd1c2a30b66e15fe055b22bd47dadb771f7fae2.zip
Update to trunk
(bzr r13645.1.119)
Diffstat (limited to 'src/ui/dialog')
-rw-r--r--src/ui/dialog/Makefile_insert12
-rw-r--r--src/ui/dialog/align-and-distribute.cpp128
-rw-r--r--src/ui/dialog/align-and-distribute.h13
-rw-r--r--src/ui/dialog/clonetiler.cpp34
-rw-r--r--src/ui/dialog/clonetiler.h4
-rw-r--r--src/ui/dialog/dialog-manager.cpp14
-rw-r--r--src/ui/dialog/document-properties.cpp126
-rw-r--r--src/ui/dialog/document-properties.h1
-rw-r--r--src/ui/dialog/export.cpp13
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp21
-rw-r--r--src/ui/dialog/filter-effects-dialog.h8
-rw-r--r--src/ui/dialog/find.cpp16
-rw-r--r--src/ui/dialog/font-substitution.cpp2
-rw-r--r--src/ui/dialog/glyphs.cpp4
-rw-r--r--src/ui/dialog/grid-arrange-tab.cpp8
-rw-r--r--src/ui/dialog/guides.cpp29
-rw-r--r--src/ui/dialog/guides.h1
-rw-r--r--src/ui/dialog/icon-preview.cpp2
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp24
-rw-r--r--src/ui/dialog/inkscape-preferences.h9
-rw-r--r--src/ui/dialog/knot-properties.cpp213
-rw-r--r--src/ui/dialog/knot-properties.h97
-rw-r--r--src/ui/dialog/layers.cpp12
-rw-r--r--src/ui/dialog/new-from-template.cpp18
-rw-r--r--src/ui/dialog/new-from-template.h6
-rw-r--r--src/ui/dialog/objects.cpp16
-rw-r--r--src/ui/dialog/pixelartdialog.cpp2
-rw-r--r--src/ui/dialog/polar-arrange-tab.cpp4
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp6
-rw-r--r--src/ui/dialog/swatches.cpp38
-rw-r--r--src/ui/dialog/tags.cpp8
-rw-r--r--src/ui/dialog/template-load-tab.cpp38
-rw-r--r--src/ui/dialog/template-load-tab.h4
-rw-r--r--src/ui/dialog/template-widget.cpp26
-rw-r--r--src/ui/dialog/template-widget.h1
-rw-r--r--src/ui/dialog/text-edit.cpp24
-rw-r--r--src/ui/dialog/transformation.cpp12
37 files changed, 794 insertions, 200 deletions
diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert
index cbdae1cb0..71628973e 100644
--- a/src/ui/dialog/Makefile_insert
+++ b/src/ui/dialog/Makefile_insert
@@ -61,6 +61,8 @@ ink_common_sources += \
ui/dialog/inkscape-preferences.h \
ui/dialog/input.cpp \
ui/dialog/input.h \
+ ui/dialog/knot-properties.cpp \
+ ui/dialog/knot-properties.h \
ui/dialog/layer-properties.cpp \
ui/dialog/layer-properties.h \
ui/dialog/layers.cpp \
@@ -106,8 +108,6 @@ ink_common_sources += \
ui/dialog/text-edit.h \
ui/dialog/tile.cpp \
ui/dialog/tile.h \
- ui/dialog/tracedialog.cpp \
- ui/dialog/tracedialog.h \
ui/dialog/pixelartdialog.cpp \
ui/dialog/pixelartdialog.h \
ui/dialog/transformation.cpp \
@@ -123,3 +123,11 @@ ink_common_sources += \
ui/dialog/lpe-fillet-chamfer-properties.cpp \
ui/dialog/lpe-fillet-chamfer-properties.h \
$(inkboard_dialogs)
+
+if HAVE_POTRACE
+
+ink_common_sources += \
+ ui/dialog/tracedialog.cpp \
+ ui/dialog/tracedialog.h
+
+endif
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 882427912..8f87932b8 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -42,7 +42,7 @@
#include "ui/icon-names.h"
#include "ui/tools/node-tool.h"
#include "ui/tool/multi-path-manipulator.h"
-#include "util/glib-list-iterators.h"
+#include "ui/tool/control-point-selection.h"
#include "verbs.h"
#include "widgets/icon.h"
#include "sp-root.h"
@@ -89,6 +89,42 @@ Action::Action(const Glib::ustring &id,
}
+void ActionAlign::do_node_action(Inkscape::UI::Tools::NodeTool *nt, int verb)
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ int prev_pref = prefs->getInt("/dialogs/align/align-nodes-to");
+ switch(verb){
+ case SP_VERB_ALIGN_HORIZONTAL_LEFT:
+ prefs->setInt("/dialogs/align/align-nodes-to", MIN_NODE );
+ nt->_multipath->alignNodes(Geom::Y);
+ break;
+ case SP_VERB_ALIGN_HORIZONTAL_CENTER:
+ nt->_multipath->alignNodes(Geom::Y);
+ break;
+ case SP_VERB_ALIGN_HORIZONTAL_RIGHT:
+ prefs->setInt("/dialogs/align/align-nodes-to", MAX_NODE );
+ nt->_multipath->alignNodes(Geom::Y);
+ break;
+ case SP_VERB_ALIGN_VERTICAL_TOP:
+ prefs->setInt("/dialogs/align/align-nodes-to", MAX_NODE );
+ nt->_multipath->alignNodes(Geom::X);
+ break;
+ case SP_VERB_ALIGN_VERTICAL_CENTER:
+ nt->_multipath->alignNodes(Geom::X);
+ break;
+ case SP_VERB_ALIGN_VERTICAL_BOTTOM:
+ prefs->setInt("/dialogs/align/align-nodes-to", MIN_NODE );
+ nt->_multipath->alignNodes(Geom::X);
+ break;
+ case SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER:
+ nt->_multipath->alignNodes(Geom::X);
+ nt->_multipath->alignNodes(Geom::Y);
+ break;
+ default:return;
+ }
+ prefs->setInt("/dialogs/align/align-nodes-to", prev_pref );
+}
+
void ActionAlign::do_action(SPDesktop *desktop, int index)
{
Inkscape::Selection *selection = desktop->getSelection();
@@ -188,6 +224,14 @@ ActionAlign::Coeffs const ActionAlign::_allCoeffs[11] = {
void ActionAlign::do_verb_action(SPDesktop *desktop, int verb)
{
+ Inkscape::UI::Tools::ToolBase *event_context = desktop->getEventContext();
+ if (INK_IS_NODE_TOOL(event_context)) {
+ Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(event_context);
+ if(!nt->_selected_nodes->empty()){
+ do_node_action(nt, verb);
+ return;
+ }
+ }
do_action(desktop, verb_to_coeff(verb));
}
@@ -535,7 +579,7 @@ private :
if (length_a != length_b) return (length_a > length_b);
}
// Last criteria: Sort according to the z-coordinate
- return (a->isSiblingOf(b));
+ return sp_item_repr_compare_position(a,b)<0;
}
virtual void on_button_click()
@@ -742,7 +786,6 @@ private :
if (!selection) return;
std::vector<SPItem*> selected(selection->itemList());
- if (selected.empty()) return;
//Check 2 or more selected objects
if (selected.size() < 2) return;
@@ -795,7 +838,51 @@ private :
_("Distribute text baselines"));
}
- } else {
+ } else { //align
+ Geom::Point ref_point;
+ SPItem *focus = NULL;
+ Geom::OptRect b = Geom::OptRect();
+
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
+ switch (AlignTarget(prefs->getInt("/dialogs/align/align-to", 6)))
+ {
+ case LAST:
+ focus = SP_ITEM(*selected.begin());
+ break;
+ case FIRST:
+ focus = SP_ITEM(*--(selected.end()));
+ break;
+ case BIGGEST:
+ focus = selection->largestItem(Selection::AREA);
+ break;
+ case SMALLEST:
+ focus = selection->smallestItem(Selection::AREA);
+ break;
+ case PAGE:
+ b = desktop->getDocument()->preferredBounds();
+ break;
+ case DRAWING:
+ b = desktop->getDocument()->getRoot()->desktopPreferredBounds();
+ break;
+ case SELECTION:
+ b = selection->preferredBounds();
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ };
+
+ if(focus) {
+ if (SP_IS_TEXT (focus) || SP_IS_FLOWTEXT (focus)) {
+ ref_point = *(te_get_layout(focus)->baselineAnchorPoint())*(focus->i2dt_affine());
+ } else {
+ ref_point = focus->desktopPreferredBounds()->min();
+ }
+ } else {
+ ref_point = b->min();
+ }
+
for (std::vector<SPItem*>::iterator it(selected.begin());
it != selected.end();
++it)
@@ -807,7 +894,7 @@ private :
if (pt) {
Geom::Point base = *pt * (item)->i2dt_affine();
Geom::Point t(0.0, 0.0);
- t[_orientation] = b_min[_orientation] - base[_orientation];
+ t[_orientation] = ref_point[_orientation] - base[_orientation];
sp_item_move_rel(item, Geom::Translate(t));
changed = true;
}
@@ -829,6 +916,9 @@ static void on_tool_changed(AlignAndDistribute *daad)
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop && desktop->getEventContext())
daad->setMode(tools_active(desktop) == TOOLS_NODES);
+ else
+ daad->setMode(false);
+
}
static void on_selection_changed(AlignAndDistribute *daad)
@@ -863,6 +953,7 @@ AlignAndDistribute::AlignAndDistribute()
_nodesTable(1, 4, true),
#endif
_anchorLabel(_("Relative to: ")),
+ _anchorLabelNode(_("Relative to: ")),
_selgrpLabel(_("_Treat selection as group: "), 1)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -1001,9 +1092,20 @@ AlignAndDistribute::AlignAndDistribute()
_combo.set_active(prefs->getInt("/dialogs/align/align-to", 6));
_combo.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_ref_change));
+ _comboNode.append(_("Last selected"));
+ _comboNode.append(_("First selected"));
+ _comboNode.append(_("Middle of selection"));
+ _comboNode.append(_("Min value"));
+ _comboNode.append(_("Max value"));
+ _comboNode.set_active(prefs->getInt("/dialogs/align/align-nodes-to", 2));
+ _comboNode.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_node_ref_change));
+
_anchorBox.pack_end(_combo, false, false);
_anchorBox.pack_end(_anchorLabel, false, false);
+ _anchorBoxNode.pack_end(_comboNode, false, false);
+ _anchorBoxNode.pack_end(_anchorLabelNode, false, false);
+
_selgrpLabel.set_mnemonic_widget(_selgrp);
_selgrpBox.pack_end(_selgrp, false, false);
_selgrpBox.pack_end(_selgrpLabel, false, false);
@@ -1021,11 +1123,15 @@ AlignAndDistribute::AlignAndDistribute()
_alignBox.pack_start(_selgrpBox);
_alignBox.pack_start(_alignTableBox);
+ _alignBoxNode.pack_start(_anchorBoxNode, false, false);
+ _alignBoxNode.pack_start(_nodesTableBox);
+
+
_alignFrame.add(_alignBox);
_distributeFrame.add(_distributeTableBox);
_rearrangeFrame.add(_rearrangeTableBox);
_removeOverlapFrame.add(_removeOverlapTableBox);
- _nodesFrame.add(_nodesTableBox);
+ _nodesFrame.add(_alignBoxNode);
Gtk::Box *contents = _getContents();
contents->set_spacing(4);
@@ -1036,7 +1142,7 @@ AlignAndDistribute::AlignAndDistribute()
contents->pack_start(_distributeFrame, true, true);
contents->pack_start(_rearrangeFrame, true, true);
contents->pack_start(_removeOverlapFrame, true, true);
- contents->pack_start(_nodesFrame, true, true);
+ contents->pack_start(_nodesFrame, true, false);
//Connect to the global tool change signal
_toolChangeConn = INKSCAPE.signal_eventcontext_set.connect(sigc::hide<0>(sigc::bind(sigc::ptr_fun(&on_tool_changed), this)));
@@ -1082,6 +1188,13 @@ void AlignAndDistribute::on_ref_change(){
//Make blink the master
}
+void AlignAndDistribute::on_node_ref_change(){
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setInt("/dialogs/align/align-nodes-to", _comboNode.get_active_row_number());
+
+ //Make blink the master
+}
+
void AlignAndDistribute::on_selgrp_toggled(){
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setInt("/dialogs/align/sel-as-groups", _selgrp.get_active());
@@ -1107,6 +1220,7 @@ void AlignAndDistribute::setMode(bool nodeEdit)
((_rearrangeFrame).*(mSel))();
((_removeOverlapFrame).*(mSel))();
((_nodesFrame).*(mNode))();
+ _getContents()->queue_resize();
}
void AlignAndDistribute::addAlignButton(const Glib::ustring &id, const Glib::ustring tiptext,
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index eecc30ff8..f8cc61af2 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -18,6 +18,7 @@
#include <list>
#include "ui/widget/panel.h"
#include "ui/widget/frame.h"
+
#include <gtkmm/frame.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/label.h>
@@ -35,6 +36,9 @@ class SPItem;
namespace Inkscape {
namespace UI {
+namespace Tools{
+class NodeTool;
+}
namespace Dialog {
class Action;
@@ -68,6 +72,7 @@ public:
protected:
void on_ref_change();
+ void on_node_ref_change();
void on_selgrp_toggled();
void addDistributeButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col, bool onInterSpace,
@@ -114,15 +119,19 @@ protected:
Gtk::HBox _anchorBox;
Gtk::HBox _selgrpBox;
Gtk::VBox _alignBox;
+ Gtk::VBox _alignBoxNode;
Gtk::HBox _alignTableBox;
Gtk::HBox _distributeTableBox;
Gtk::HBox _rearrangeTableBox;
Gtk::HBox _removeOverlapTableBox;
Gtk::HBox _nodesTableBox;
Gtk::Label _anchorLabel;
+ Gtk::Label _anchorLabelNode;
Gtk::Label _selgrpLabel;
Gtk::CheckButton _selgrp;
Gtk::ComboBoxText _combo;
+ Gtk::HBox _anchorBoxNode;
+ Gtk::ComboBoxText _comboNode;
SPDesktop *_desktop;
DesktopTracker _deskTrack;
@@ -149,6 +158,8 @@ bool operator< (const BBoxSort &a, const BBoxSort &b);
class Action {
public :
+ enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION };
+ enum AlignTargetNode { LAST_NODE=0, FIRST_NODE, MID_NODE, MIN_NODE, MAX_NODE };
Action(const Glib::ustring &id,
const Glib::ustring &tiptext,
guint row, guint column,
@@ -183,7 +194,6 @@ public :
double sx0, sx1, sy0, sy1;
int verb_id;
};
- enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION };
ActionAlign(const Glib::ustring &id,
const Glib::ustring &tiptext,
guint row, guint column,
@@ -213,6 +223,7 @@ private :
}
static void do_action(SPDesktop *desktop, int index);
+ static void do_node_action(Inkscape::UI::Tools::NodeTool *nt, int index);
guint _index;
AlignAndDistribute &_dialog;
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index f84a2ffd6..fbd050f8e 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -85,7 +85,7 @@ CloneTiler::CloneTiler () :
{
Gtk::Box *contents = _getContents();
contents->set_spacing(0);
-
+
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -101,7 +101,7 @@ CloneTiler::CloneTiler () :
contents->pack_start (*Gtk::manage(Glib::wrap(mainbox)), true, true, 0);
- GtkWidget *nb = gtk_notebook_new ();
+ nb = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (mainbox), nb, FALSE, FALSE, 0);
@@ -662,7 +662,7 @@ CloneTiler::CloneTiler () :
gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
guint32 rgba = 0x000000ff | sp_svg_read_color (prefs->getString(prefs_path + "initial_color").data(), 0x000000ff);
- color_picker = new Inkscape::UI::Widget::ColorPicker (*new Glib::ustring(_("Initial color of tiled clones")), *new Glib::ustring(_("Initial color for clones (works only if the original has unset fill or stroke)")), rgba, false);
+ color_picker = new Inkscape::UI::Widget::ColorPicker (*new Glib::ustring(_("Initial color of tiled clones")), *new Glib::ustring(_("Initial color for clones (works only if the original has unset fill or stroke or on spray tool in copy mode)")), rgba, false);
color_changed_connection = color_picker->connectChanged (sigc::ptr_fun(on_picker_color_changed));
gtk_box_pack_start (GTK_BOX (hb), reinterpret_cast<GtkWidget*>(color_picker->gobj()), FALSE, FALSE, 0);
@@ -776,8 +776,6 @@ CloneTiler::CloneTiler () :
// Trace
{
GtkWidget *vb = clonetiler_new_tab (nb, _("_Trace"));
-
-
{
#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
@@ -787,11 +785,11 @@ CloneTiler::CloneTiler () :
#endif
gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);
- GtkWidget *b = gtk_check_button_new_with_label (_("Trace the drawing under the tiles"));
+ b = gtk_check_button_new_with_label (_("Trace the drawing under the clones/sprayed items"));
g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE));
bool old = prefs->getBool(prefs_path + "dotrace");
gtk_toggle_button_set_active ((GtkToggleButton *) b, old);
- gtk_widget_set_tooltip_text (b, _("For each clone, pick a value from the drawing in that clone's location and apply it to the clone"));
+ gtk_widget_set_tooltip_text (b, _("For each clone/sprayed item, pick a value from the drawing in its location and apply it"));
gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(b), "toggled",
@@ -1001,6 +999,18 @@ CloneTiler::CloneTiler () :
}
}
+ {
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
+ gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
+#else
+ GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
+#endif
+ gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0);
+ GtkWidget *l = gtk_label_new(_(""));
+ gtk_label_set_markup (GTK_LABEL(l), _("Apply to tiled clones:"));
+ gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
+ }
// Rows/columns, width/height
{
#if GTK_CHECK_VERSION(3,0,0)
@@ -1289,7 +1299,6 @@ CloneTiler::CloneTiler () :
}
gtk_widget_show_all (mainbox);
-
}
show_all();
@@ -2479,7 +2488,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
// Trace tab
if (dotrace) {
- Geom::Rect bbox_t = transform_rect (bbox_original, t);
+ Geom::Rect bbox_t = transform_rect (bbox_original, t*Geom::Scale(1.0/scale_units));
guint32 rgba = clonetiler_trace_pick (bbox_t);
float r = SP_RGBA32_R_F(rgba);
@@ -3005,6 +3014,13 @@ void CloneTiler::clonetiler_do_pick_toggled(GtkToggleButton *tb, GtkWidget *dlg)
}
}
+void CloneTiler::show_page_trace()
+{
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),6);
+ gtk_toggle_button_set_active ((GtkToggleButton *) b, false);
+}
+
+
}
}
}
diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h
index e5f5638b2..a8f1df0a0 100644
--- a/src/ui/dialog/clonetiler.h
+++ b/src/ui/dialog/clonetiler.h
@@ -31,7 +31,7 @@ public:
virtual ~CloneTiler();
static CloneTiler &getInstance() { return *new CloneTiler(); }
-
+ void show_page_trace();
protected:
GtkWidget * clonetiler_new_tab(GtkWidget *nb, const gchar *label);
@@ -113,6 +113,8 @@ private:
CloneTiler& operator=(CloneTiler const &d);
GtkWidget *dlg;
+ GtkWidget *nb;
+ GtkWidget *b;
SPDesktop *desktop;
DesktopTracker deskTrack;
Inkscape::UI::Widget::ColorPicker *color_picker;
diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp
index 7b1b36908..49853277c 100644
--- a/src/ui/dialog/dialog-manager.cpp
+++ b/src/ui/dialog/dialog-manager.cpp
@@ -34,7 +34,11 @@
#include "ui/dialog/messages.h"
#include "ui/dialog/symbols.h"
#include "ui/dialog/tile.h"
-#include "ui/dialog/tracedialog.h"
+
+#if HAVE_POTRACE
+# include "ui/dialog/tracedialog.h"
+#endif
+
#include "ui/dialog/pixelartdialog.h"
#include "ui/dialog/transformation.h"
#include "ui/dialog/undo-history.h"
@@ -124,7 +128,11 @@ DialogManager::DialogManager() {
registerFactory("Swatches", &create<SwatchesPanel, FloatingBehavior>);
registerFactory("TileDialog", &create<ArrangeDialog, FloatingBehavior>);
registerFactory("Symbols", &create<SymbolsDialog, FloatingBehavior>);
+
+#if HAVE_POTRACE
registerFactory("Trace", &create<TraceDialog, FloatingBehavior>);
+#endif
+
registerFactory("PixelArt", &create<PixelArtDialog, FloatingBehavior>);
registerFactory("Transformation", &create<Transformation, FloatingBehavior>);
registerFactory("UndoHistory", &create<UndoHistory, FloatingBehavior>);
@@ -159,7 +167,11 @@ DialogManager::DialogManager() {
registerFactory("Swatches", &create<SwatchesPanel, DockBehavior>);
registerFactory("TileDialog", &create<ArrangeDialog, DockBehavior>);
registerFactory("Symbols", &create<SymbolsDialog, DockBehavior>);
+
+#if HAVE_POTRACE
registerFactory("Trace", &create<TraceDialog, DockBehavior>);
+#endif
+
registerFactory("PixelArt", &create<PixelArtDialog, DockBehavior>);
registerFactory("Transformation", &create<Transformation, DockBehavior>);
registerFactory("UndoHistory", &create<UndoHistory, DockBehavior>);
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index b04e8ecc1..c2c5c5005 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -116,10 +116,11 @@ DocumentProperties::DocumentProperties()
_page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))),
//---------------------------------------------------------------
_rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "shape-rendering", _wr, false, NULL, NULL, NULL, "crispEdges"),
+ _rcb_checkerboard(_("Checkerboard background"), _("If set, use checkerboard for background, otherwise use background color at full opacity."), "inkscape:pagecheckerboard", _wr, false),
_rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false),
_rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false),
_rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false),
- _rcp_bg(_("Back_ground color:"), _("Background color"), _("Color of the page background. Note: transparency setting ignored while editing but used when exporting to bitmap."), "pagecolor", "inkscape:pageopacity", _wr),
+ _rcp_bg(_("Back_ground color:"), _("Background color"), _("Color of the page background. Note: transparency setting ignored while editing if 'Checkerboard background' unset (but used when exporting to bitmap)."), "pagecolor", "inkscape:pageopacity", _wr),
_rcp_bord(_("Border _color:"), _("Page border color"), _("Color of the page border"), "bordercolor", "borderopacity", _wr),
_rum_deflt(_("Display _units:"), "inkscape:document-units", _wr),
_page_sizer(_wr),
@@ -327,10 +328,19 @@ void DocumentProperties::build_page()
Gtk::Label* label_gen = Gtk::manage (new Gtk::Label);
label_gen->set_markup (_("<b>General</b>"));
+
Gtk::Label *label_for = Gtk::manage (new Gtk::Label);
label_for->set_markup (_("<b>Page Size</b>"));
+
+ Gtk::Label* label_bkg = Gtk::manage (new Gtk::Label);
+ label_bkg->set_markup (_("<b>Background</b>"));
+
+ Gtk::Label* label_bdr = Gtk::manage (new Gtk::Label);
+ label_bdr->set_markup (_("<b>Border</b>"));
+
Gtk::Label* label_dsp = Gtk::manage (new Gtk::Label);
label_dsp->set_markup (_("<b>Display</b>"));
+
_page_sizer.init();
Gtk::Widget *const widget_array[] =
@@ -343,13 +353,16 @@ void DocumentProperties::build_page()
label_for, 0,
0, &_page_sizer,
0, 0,
- label_dsp, 0,
+ label_bkg, 0,
+ 0, &_rcb_checkerboard,
+ _rcp_bg._label, &_rcp_bg,
+ label_bdr, 0,
0, &_rcb_canb,
0, &_rcb_bord,
0, &_rcb_shad,
- 0, &_rcb_antialias,
- _rcp_bg._label, &_rcp_bg,
_rcp_bord._label, &_rcp_bord,
+ label_dsp, 0,
+ 0, &_rcb_antialias,
};
std::list<Gtk::Widget*> _slaveList;
@@ -435,13 +448,13 @@ void DocumentProperties::populate_available_profiles(){
*/
static void sanitizeName( Glib::ustring& str )
{
- if (str.size() > 1) {
+ if (str.size() > 0) {
char val = str.at(0);
if (((val < 'A') || (val > 'Z'))
&& ((val < 'a') || (val > 'z'))
&& (val != '_')
&& (val != ':')) {
- str.replace(0, 1, "-");
+ str.insert(0, "_");
}
for (Glib::ustring::size_type i = 1; i < str.size(); i++) {
char val = str.at(i);
@@ -479,7 +492,13 @@ void DocumentProperties::linkSelectedProfile()
std::vector<std::pair<Glib::ustring, Glib::ustring> > pairs = ColorProfile::getProfileFilesWithNames();
Glib::ustring file = pairs[row].first;
Glib::ustring name = pairs[row].second;
-
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
+ for (std::set<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ SPObject* obj = *it;
+ Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
+ if (!strcmp(prof->href, file.c_str()))
+ return;
+ }
Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *cprofRepr = xml_doc->createElement("svg:color-profile");
gchar* tmp = g_strdup(name.c_str());
@@ -487,6 +506,8 @@ void DocumentProperties::linkSelectedProfile()
sanitizeName(nameStr);
cprofRepr->setAttribute("name", nameStr.c_str());
cprofRepr->setAttribute("xlink:href", (gchar*) file.c_str());
+ cprofRepr->setAttribute("id", (gchar*) file.c_str());
+
// Checks whether there is a defs element. Creates it when needed
Inkscape::XML::Node *defsRepr = sp_repr_lookup_name(xml_doc, "svg:defs");
@@ -511,17 +532,16 @@ void DocumentProperties::linkSelectedProfile()
void DocumentProperties::populate_linked_profiles_box()
{
_LinkedProfilesListStore->clear();
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
- if (current) {
- _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
+ if (! current.empty()) {
+ _emb_profiles_observer.set((*(current.begin()))->parent);
}
- while ( current ) {
- SPObject* obj = SP_OBJECT(current->data);
+ for (std::set<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ SPObject* obj = *it;
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
Gtk::TreeModel::Row row = *(_LinkedProfilesListStore->append());
row[_LinkedProfilesListColumns.nameColumn] = prof->name;
// row[_LinkedProfilesListColumns.previewColumn] = "Color Preview";
- current = g_slist_next(current);
}
}
@@ -594,19 +614,15 @@ void DocumentProperties::removeSelectedProfile(){
return;
}
}
-
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
- while ( current ) {
- SPObject* obj = SP_OBJECT(current->data);
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
+ for (std::set<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ SPObject* obj = *it;
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
if (!name.compare(prof->name)){
-
- //XML Tree being used directly here while it shouldn't be.
- sp_repr_unparent(obj->getRepr());
+ prof->deleteObject(true, false);
DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile"));
break; // removing the color profile likely invalidates part of the traversed list, stop traversing here.
}
- current = g_slist_next(current);
}
populate_linked_profiles_box();
@@ -722,9 +738,9 @@ void DocumentProperties::build_cms()
_LinkedProfilesList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::linked_profiles_list_button_release));
cms_create_popup_menu(_LinkedProfilesList, sigc::mem_fun(*this, &DocumentProperties::removeSelectedProfile));
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "defs" );
- if (current) {
- _emb_profiles_observer.set(SP_OBJECT(current->data)->parent);
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "defs" );
+ if (!current.empty()) {
+ _emb_profiles_observer.set((*(current.begin()))->parent);
}
_emb_profiles_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_linked_profiles_box));
onColorProfileSelectRow();
@@ -959,9 +975,9 @@ void DocumentProperties::build_scripting()
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
//TODO: review this observers code:
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
- if (current) {
- _scripts_observer.set(SP_OBJECT(current->data)->parent);
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
+ if (! current.empty()) {
+ _scripts_observer.set((*(current.begin()))->parent);
}
_scripts_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_script_lists));
onEmbeddedScriptSelectRow();
@@ -1174,9 +1190,9 @@ void DocumentProperties::removeExternalScript(){
}
}
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
- while ( current ) {
- SPObject* obj = reinterpret_cast<SPObject *>(current->data);
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
+ for (std::set<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ SPObject* obj = *it;
if (obj) {
SPScript* script = dynamic_cast<SPScript *>(obj);
if (script && (name == script->xlinkhref)) {
@@ -1191,7 +1207,6 @@ void DocumentProperties::removeExternalScript(){
}
}
}
- current = g_slist_next(current);
}
populate_script_lists();
@@ -1253,9 +1268,9 @@ void DocumentProperties::changeEmbeddedScript(){
}
bool voidscript=true;
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
- while ( current ) {
- SPObject* obj = SP_OBJECT(current->data);
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
+ for (std::set<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ SPObject* obj = *it;
if (id == obj->getId()){
int count=0;
@@ -1279,7 +1294,6 @@ void DocumentProperties::changeEmbeddedScript(){
}
}
}
- current = g_slist_next(current);
}
if (voidscript)
@@ -1299,9 +1313,9 @@ void DocumentProperties::editEmbeddedScript(){
}
Inkscape::XML::Document *xml_doc = SP_ACTIVE_DOCUMENT->getReprDoc();
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
- while ( current ) {
- SPObject* obj = SP_OBJECT(current->data);
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
+ for (std::set<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ SPObject* obj = *it;
if (id == obj->getId()){
//XML Tree being used directly here while it shouldn't be.
@@ -1317,21 +1331,20 @@ void DocumentProperties::editEmbeddedScript(){
DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_EMBEDDED_SCRIPT, _("Edit embedded script"));
}
}
- current = g_slist_next(current);
}
}
void DocumentProperties::populate_script_lists(){
_ExternalScriptsListStore->clear();
_EmbeddedScriptsListStore->clear();
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
- if (current) {
- SPObject *obj = reinterpret_cast<SPObject *>(current->data);
+ std::set<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
+ if (!current.empty()) {
+ SPObject *obj = *(current.begin());
g_assert(obj != NULL);
_scripts_observer.set(obj->parent);
}
- while ( current ) {
- SPObject* obj = reinterpret_cast<SPObject *>(current->data);
+ for (std::set<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ SPObject* obj = *it;
SPScript* script = dynamic_cast<SPScript *>(obj);
g_assert(script != NULL);
if (script->xlinkhref)
@@ -1344,8 +1357,6 @@ void DocumentProperties::populate_script_lists(){
Gtk::TreeModel::Row row = *(_EmbeddedScriptsListStore->append());
row[_EmbeddedScriptsListColumns.idColumn] = obj->getId();
}
-
- current = g_slist_next(current);
}
}
@@ -1364,12 +1375,11 @@ void DocumentProperties::update_gridspage()
//add tabs
bool grids_present = false;
- for (GSList const * l = nv->grids; l != NULL; l = l->next) {
- Inkscape::CanvasGrid * grid = (Inkscape::CanvasGrid*) l->data;
- if (!grid->repr->attribute("id")) continue; // update_gridspage is called again when "id" is added
- Glib::ustring name(grid->repr->attribute("id"));
+ for(std::vector<Inkscape::CanvasGrid *>::const_iterator it = nv->grids.begin(); it != nv->grids.end(); ++it) {
+ if (!(*it)->repr->attribute("id")) continue; // update_gridspage is called again when "id" is added
+ Glib::ustring name((*it)->repr->attribute("id"));
const char *icon = NULL;
- switch (grid->getGridType()) {
+ switch ((*it)->getGridType()) {
case GRID_RECTANGULAR:
icon = "grid-rectangular";
break;
@@ -1379,7 +1389,7 @@ void DocumentProperties::update_gridspage()
default:
break;
}
- _grids_notebook.append_page(*grid->newWidget(), _createPageTabLabel(name, icon));
+ _grids_notebook.append_page(*(*it)->newWidget(), _createPageTabLabel(name, icon));
grids_present = true;
}
_grids_notebook.show_all();
@@ -1441,6 +1451,7 @@ void DocumentProperties::update()
set_sensitive (true);
//-----------------------------------------------------------page page
+ _rcb_checkerboard.setActive (nv->pagecheckerboard);
_rcp_bg.setRgba32 (nv->pagecolor);
_rcb_canb.setActive (nv->showborder);
_rcb_bord.setActive (nv->borderlayer == SP_BORDER_LAYER_TOP);
@@ -1639,14 +1650,9 @@ void DocumentProperties::onRemoveGrid()
SPDesktop *dt = getDesktop();
SPNamedView *nv = dt->getNamedView();
Inkscape::CanvasGrid * found_grid = NULL;
- int i = 0;
- for (GSList const * l = nv->grids; l != NULL; l = l->next, i++) { // not a very nice fix, but works.
- Inkscape::CanvasGrid * grid = (Inkscape::CanvasGrid*) l->data;
- if (pagenum == i) {
- found_grid = grid;
- break; // break out of for-loop
- }
- }
+ if( pagenum < (gint)nv->grids.size())
+ found_grid = nv->grids[pagenum];
+
if (found_grid) {
// delete the grid that corresponds with the selected tab
// when the grid is deleted from SVG, the SPNamedview handler automatically deletes the object, so found_grid becomes an invalid pointer!
diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h
index b1f90b4b7..7340b67f5 100644
--- a/src/ui/dialog/document-properties.h
+++ b/src/ui/dialog/document-properties.h
@@ -118,6 +118,7 @@ protected:
UI::Widget::Registry _wr;
//---------------------------------------------------------------
UI::Widget::RegisteredCheckButton _rcb_antialias;
+ UI::Widget::RegisteredCheckButton _rcb_checkerboard;
UI::Widget::RegisteredCheckButton _rcb_canb;
UI::Widget::RegisteredCheckButton _rcb_bord;
UI::Widget::RegisteredCheckButton _rcb_shad;
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 1edfdfe80..2fb5f9e3b 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -474,7 +474,14 @@ void Export::set_default_filename () {
doc_export_name = filename_entry.get_text();
}
+ else if ( SP_ACTIVE_DOCUMENT )
+ {
+ Glib::ustring filename = create_filepath_from_id (_("bitmap"), filename_entry.get_text());
+ filename_entry.set_text(filename);
+ filename_entry.set_position(filename.length());
+ doc_export_name = filename_entry.get_text();
+ }
}
#if WITH_GTKMM_3_0
@@ -814,7 +821,7 @@ void Export::onAreaToggled ()
if (filename.empty()) {
const gchar * id = "object";
const std::vector<XML::Node*> reprlst = SP_ACTIVE_DESKTOP->getSelection()->reprList();
- for(std::vector<XML::Node*>::const_iterator i=reprlst.begin(); reprlst.end() != i; i++) {
+ for(std::vector<XML::Node*>::const_iterator i=reprlst.begin(); reprlst.end() != i; ++i) {
Inkscape::XML::Node * repr = *i;
if (repr->attribute("id")) {
id = repr->attribute("id");
@@ -1023,7 +1030,7 @@ void Export::onExport ()
gint export_count = 0;
std::vector<SPItem*> itemlist=desktop->getSelection()->itemList();
- for(std::vector<SPItem*>::const_iterator i = itemlist.begin();i!=itemlist.end() && !interrupted ;i++){
+ for(std::vector<SPItem*>::const_iterator i = itemlist.begin();i!=itemlist.end() && !interrupted ;++i){
SPItem *item = *i;
prog_dlg->set_data("current", GINT_TO_POINTER(n));
@@ -1232,7 +1239,7 @@ void Export::onExport ()
DocumentUndo::setUndoSensitive(doc, false);
reprlst = desktop->getSelection()->reprList();
- for(std::vector<Inkscape::XML::Node*>::const_iterator i=reprlst.begin(); reprlst.end() != i; i++) {
+ for(std::vector<Inkscape::XML::Node*>::const_iterator i=reprlst.begin(); reprlst.end() != i; ++i) {
Inkscape::XML::Node * repr = *i;
const gchar * temp_string;
Glib::ustring dir = Glib::path_get_dirname(filename.c_str());
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 1ff9e4a1b..7e9d8481a 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1474,7 +1474,7 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel)
std::set<SPObject*> used;
std::vector<SPItem*> itemlist=sel->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) {
+ for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) {
SPObject *obj = *i;
SPStyle *style = obj->style;
if (!style || !SP_IS_ITEM(obj)) {
@@ -1555,7 +1555,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri
filter = 0;
std::vector<SPItem*> itemlist=sel->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) {
+ for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) {
SPItem * item = *i;
SPStyle *style = item->style;
g_assert(style != NULL);
@@ -1589,13 +1589,14 @@ void FilterEffectsDialog::FilterModifier::update_filters()
{
SPDesktop* desktop = _dialog.getDesktop();
SPDocument* document = desktop->getDocument();
- const GSList* filters = document->getResourceList("filter");
+
+ std::set<SPObject *> filters = document->getResourceList( "filter" );
_model->clear();
- for(const GSList *l = filters; l; l = l->next) {
+ for (std::set<SPObject *>::const_iterator it = filters.begin(); it != filters.end(); ++it) {
Gtk::TreeModel::Row row = *_model->append();
- SPFilter* f = SP_FILTER(l->data);
+ SPFilter* f = SP_FILTER(*it);
row[_columns.filter] = f;
const gchar* lbl = f->label();
const gchar* id = f->getId();
@@ -1669,7 +1670,7 @@ void FilterEffectsDialog::FilterModifier::remove_filter()
// Delete all references to this filter
std::vector<SPItem*> x,y;
std::vector<SPItem*> all = get_all_items(x, _desktop->currentRoot(), _desktop, false, false, true, y);
- for(std::vector<SPItem*>::const_iterator i=all.begin(); all.end() != i; i++) {
+ for(std::vector<SPItem*>::const_iterator i=all.begin(); all.end() != i; ++i) {
if (!SP_IS_ITEM(*i)) {
continue;
}
@@ -2756,8 +2757,6 @@ FilterEffectsDialog::FilterEffectsDialog()
_sizegroup = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
_sizegroup->set_ignore_hidden();
- _add_primitive_type.remove_row(NR_FILTER_TILE);
-
// Initialize widget hierarchy
#if WITH_GTKMM_3_0
Gtk::Paned* hpaned = Gtk::manage(new Gtk::Paned);
@@ -2900,7 +2899,7 @@ void FilterEffectsDialog::init_settings_widgets()
_settings->add_spinscale(1, SP_PROP_FLOOD_OPACITY, _("Opacity:"), 0, 1, 0.1, 0.01, 2);
_settings->type(NR_FILTER_GAUSSIANBLUR);
- _settings->add_dualspinscale(SP_ATTR_STDDEVIATION, _("Standard Deviation:"), 0.01, 100, 1, 0.01, 1, _("The standard deviation for the blur operation."));
+ _settings->add_dualspinscale(SP_ATTR_STDDEVIATION, _("Standard Deviation:"), 0.01, 100, 1, 0.01, 2, _("The standard deviation for the blur operation."));
_settings->type(NR_FILTER_MERGE);
_settings->add_no_params();
@@ -2925,7 +2924,7 @@ void FilterEffectsDialog::init_settings_widgets()
_settings->add_lightsource();
_settings->type(NR_FILTER_TILE);
- _settings->add_notimplemented();
+ _settings->add_no_params();
_settings->type(NR_FILTER_TURBULENCE);
// _settings->add_checkbutton(false, SP_ATTR_STITCHTILES, _("Stitch Tiles"), "stitch", "noStitch");
@@ -3017,7 +3016,7 @@ void FilterEffectsDialog::update_primitive_infobox()
break;
case(NR_FILTER_TILE):
_infobox_icon.set_from_icon_name("feTile-icon", Gtk::ICON_SIZE_DIALOG);
- _infobox_desc.set_markup(_("The <b>feTile</b> filter primitive tiles a region with its input graphic"));
+ _infobox_desc.set_markup(_("The <b>feTile</b> filter primitive tiles a region with an input graphic. The source tile is defined by the filter primitive subregion of the input."));
break;
case(NR_FILTER_TURBULENCE):
_infobox_icon.set_from_icon_name("feTurbulence-icon", Gtk::ICON_SIZE_DIALOG);
diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h
index a067cd70c..283abb5b0 100644
--- a/src/ui/dialog/filter-effects-dialog.h
+++ b/src/ui/dialog/filter-effects-dialog.h
@@ -127,7 +127,11 @@ private:
Gtk::Button _add;
Glib::RefPtr<Gtk::Menu> _menu;
sigc::signal<void> _signal_filter_changed;
+#if __cplusplus <= 199711L
std::auto_ptr<Inkscape::XML::SignalObserver> _observer;
+#else
+ std::unique_ptr<Inkscape::XML::SignalObserver> _observer;
+#endif
};
class PrimitiveColumns : public Gtk::TreeModel::ColumnRecord
@@ -243,7 +247,11 @@ private:
sigc::connection _scroll_connection;
int _autoscroll_y;
int _autoscroll_x;
+#if __cplusplus <= 199711L
std::auto_ptr<Inkscape::XML::SignalObserver> _observer;
+#else
+ std::unique_ptr<Inkscape::XML::SignalObserver> _observer;
+#endif
int _input_type_width;
int _input_type_height;
};
diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp
index a8ac42a1b..0f368c5ac 100644
--- a/src/ui/dialog/find.cpp
+++ b/src/ui/dialog/find.cpp
@@ -561,7 +561,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b
std::vector<SPItem*> out;
if (check_searchin_text.get_active()) {
- for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) {
+ for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
g_assert(item != NULL);
@@ -584,7 +584,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b
bool attrvalue = check_attributevalue.get_active();
if (ids) {
- for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) {
+ for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
if (item_id_match(item, text, exact, casematch)) {
@@ -600,7 +600,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b
if (style) {
- for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) {
+ for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
g_assert(item != NULL);
@@ -617,7 +617,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b
if (attrname) {
- for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) {
+ for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
g_assert(item != NULL);
@@ -634,7 +634,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b
if (attrvalue) {
- for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) {
+ for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
g_assert(item != NULL);
@@ -651,7 +651,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b
if (font) {
- for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) {
+ for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
g_assert(item != NULL);
@@ -718,7 +718,7 @@ bool Find::item_type_match (SPItem *item)
std::vector<SPItem*> Find::filter_types (std::vector<SPItem*> &l)
{
std::vector<SPItem*> n;
- for(std::vector<SPItem*>::const_reverse_iterator i=l.rbegin(); l.rend() != i; i++) {
+ for(std::vector<SPItem*>::const_reverse_iterator i=l.rbegin(); l.rend() != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
g_assert(item != NULL);
@@ -762,7 +762,7 @@ std::vector<SPItem*> &Find::all_items (SPObject *r, std::vector<SPItem*> &l, boo
std::vector<SPItem*> &Find::all_selection_items (Inkscape::Selection *s, std::vector<SPItem*> &l, SPObject *ancestor, bool hidden, bool locked)
{
std::vector<SPItem*> itemlist=s->itemList();
- for(std::vector<SPItem*>::const_reverse_iterator i=itemlist.rbegin(); itemlist.rend() != i; i++) {
+ for(std::vector<SPItem*>::const_reverse_iterator i=itemlist.rbegin(); itemlist.rend() != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
g_assert(item != NULL);
diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp
index 19506c6a3..f219f3db6 100644
--- a/src/ui/dialog/font-substitution.cpp
+++ b/src/ui/dialog/font-substitution.cpp
@@ -154,7 +154,7 @@ std::vector<SPItem*> FontSubstitution::getFontReplacedItems(SPDocument* doc, Gli
std::map<SPItem *, Glib::ustring> mapFontStyles;
allList = get_all_items(x, doc->getRoot(), desktop, false, false, true, y);
- for(std::vector<SPItem*>::const_iterator i = allList.begin();i!=allList.end();i++){
+ for(std::vector<SPItem*>::const_iterator i = allList.begin();i!=allList.end();++i){
SPItem *item = *i;
SPStyle *style = item->style;
Glib::ustring family = "";
diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp
index 7ca277ea2..56b001291 100644
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
@@ -579,7 +579,7 @@ void GlyphsPanel::insertText()
{
SPItem *textItem = 0;
std::vector<SPItem*> itemlist=targetDesktop->selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) {
+ for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) {
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) {
textItem = *i;
break;
@@ -689,7 +689,7 @@ void GlyphsPanel::calcCanInsert()
{
int items = 0;
std::vector<SPItem*> itemlist=targetDesktop->selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) {
+ for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) {
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) {
++items;
}
diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp
index 086cbe45f..639e463ea 100644
--- a/src/ui/dialog/grid-arrange-tab.cpp
+++ b/src/ui/dialog/grid-arrange-tab.cpp
@@ -164,7 +164,7 @@ void GridArrangeTab::arrange()
Inkscape::Selection *selection = desktop->getSelection();
const std::vector<SPItem*> items = selection ? selection->itemList() : std::vector<SPItem*>();
- for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();i++){
+ for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end(); ++i){
SPItem *item = *i;
Geom::OptRect b = item->documentVisualBounds();
if (!b) {
@@ -202,7 +202,7 @@ void GridArrangeTab::arrange()
cnt=0;
const std::vector<SPItem*> sizes(sorted);
- for (std::vector<SPItem*>::const_iterator i = sizes.begin();i!=sizes.end();i++) {
+ for (std::vector<SPItem*>::const_iterator i = sizes.begin();i!=sizes.end(); ++i) {
SPItem *item = *i;
Geom::OptRect b = item->documentVisualBounds();
if (b) {
@@ -301,11 +301,11 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
cnt=0;
std::vector<SPItem*>::iterator it = sorted.begin();
- for (row_cnt=0; ((it != sorted.end()) && (row_cnt<NoOfRows)); row_cnt++) {
+ for (row_cnt=0; ((it != sorted.end()) && (row_cnt<NoOfRows)); ++row_cnt) {
GSList *current_row = NULL;
col_cnt = 0;
- for(;it!=sorted.end()&&col_cnt<NoOfCols;it++) {
+ for(;it!=sorted.end()&&col_cnt<NoOfCols;++it) {
current_row = g_slist_append (current_row, *it);
col_cnt++;
}
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index af8e2cc31..556d77a28 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -44,6 +44,7 @@ namespace Dialogs {
GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *desktop)
: _desktop(desktop), _guide(guide),
+ _locked_toggle(_("Lo_cked"), _("Lock the movement of guides")),
_relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")),
_spin_button_x(C_("Guides", "_X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu),
_spin_button_y(C_("Guides", "_Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu),
@@ -97,9 +98,12 @@ void GuidelinePropertiesDialog::_onOK()
} else if ( deg_angle == 0. || deg_angle == 180. || deg_angle == -180.) {
normal = Geom::Point(0.,1.);
} else {
- double rad_angle = Geom::deg_to_rad( deg_angle );
+ double rad_angle = Geom::rad_from_deg( deg_angle );
normal = Geom::rot90(Geom::Point::polar(rad_angle, 1.0));
}
+ //To allow reposition from dialog
+ _guide->set_locked(false, true);
+
_guide->set_normal(normal, true);
double const points_x = _spin_button_x.getValue("px");
@@ -113,6 +117,11 @@ void GuidelinePropertiesDialog::_onOK()
const gchar* name = g_strdup( _label_entry.getEntry()->get_text().c_str() );
_guide->set_label(name, true);
+
+ const bool locked = _locked_toggle.get_active();
+
+ _guide->set_locked(locked, true);
+
g_free((gpointer) name);
#if WITH_GTKMM_3_0
@@ -269,6 +278,12 @@ void GuidelinePropertiesDialog::_setup() {
_relative_toggle.set_valign(Gtk::ALIGN_FILL);
_relative_toggle.set_hexpand();
_layout_table.attach(_relative_toggle, 1, 7, 2, 1);
+
+ // locked radio button
+ _locked_toggle.set_halign(Gtk::ALIGN_FILL);
+ _locked_toggle.set_valign(Gtk::ALIGN_FILL);
+ _locked_toggle.set_hexpand();
+ _layout_table.attach(_locked_toggle, 1, 8, 2, 1);
#else
_layout_table.attach(_spin_angle,
1, 3, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
@@ -276,11 +291,21 @@ void GuidelinePropertiesDialog::_setup() {
// mode radio button
_layout_table.attach(_relative_toggle,
1, 3, 7, 8, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
+
+ // locked radio button
+ _layout_table.attach(_locked_toggle,
+ 1, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
#endif
_relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));
_relative_toggle.set_active(_relative_toggle_status);
+ bool global_guides_lock = _desktop->namedview->lockguides;
+ if(global_guides_lock){
+ _locked_toggle.set_sensitive(false);
+ }
+ _locked_toggle.set_active(_guide->getLocked());
+
// don't know what this exactly does, but it results in that the dialog closes when entering a value and pressing enter (see LP bug 484187)
g_signal_connect_swapped(G_OBJECT(_spin_button_x.getWidget()->gobj()), "activate",
G_CALLBACK(gtk_window_activate_default), gobj());
@@ -301,7 +326,7 @@ void GuidelinePropertiesDialog::_setup() {
} else if (_guide->isHorizontal()) {
_oldangle = 0;
} else {
- _oldangle = Geom::rad_to_deg( std::atan2( - _guide->getNormal()[Geom::X], _guide->getNormal()[Geom::Y] ) );
+ _oldangle = Geom::deg_from_rad( std::atan2( - _guide->getNormal()[Geom::X], _guide->getNormal()[Geom::Y] ) );
}
{
diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h
index 4ff7b4fde..5dce0d6ed 100644
--- a/src/ui/dialog/guides.h
+++ b/src/ui/dialog/guides.h
@@ -79,6 +79,7 @@ private:
Gtk::Label _label_name;
Gtk::Label _label_descr;
+ Inkscape::UI::Widget::CheckButton _locked_toggle;
Inkscape::UI::Widget::CheckButton _relative_toggle;
static bool _relative_toggle_status; // remember the status of the _relative_toggle_status button across instances
Inkscape::UI::Widget::UnitMenu _unit_menu;
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 77f120e1a..83656a1f2 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -363,7 +363,7 @@ void IconPreviewPanel::refreshPreview()
//g_message("found a selection to play with");
std::vector<SPItem*> const items = sel->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();!target && i!=items.end();i++){
+ for(std::vector<SPItem*>::const_iterator i=items.begin();!target && i!=items.end();++i){
SPItem* item = *i;
gchar const *id = item->getId();
if ( id ) {
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 49864ccbb..b20f71a6a 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -206,6 +206,15 @@ void InkscapePreferences::AddDotSizeSpinbutton(DialogPage &p, Glib::ustring cons
false );
}
+void InkscapePreferences::AddBaseSimplifySpinbutton(DialogPage &p, Glib::ustring const &prefs_path, double def_value)
+{
+ PrefSpinButton* sb = Gtk::manage( new PrefSpinButton);
+ sb->init ( prefs_path + "/base-simplify", 0.0, 100.0, 1.0, 10.0, def_value, false, false);
+ p.add_line( false, _("Base simplify:"), *sb, _("on dinamic LPE simplify"),
+ _("Base simplify of dinamic LPE based simplify"),
+ false );
+}
+
static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatch *swatch)
{
@@ -425,6 +434,7 @@ void InkscapePreferences::initPageTools()
this->AddSelcueCheckbox(_page_pencil, "/tools/freehand/pencil", true);
this->AddNewObjectsStyle(_page_pencil, "/tools/freehand/pencil");
this->AddDotSizeSpinbutton(_page_pencil, "/tools/freehand/pencil", 3.0);
+ this->AddBaseSimplifySpinbutton(_page_pencil, "/tools/freehand/pencil", 25.0);
_page_pencil.add_group_header( _("Sketch mode"));
_page_pencil.add_line( true, "", _pencil_average_all_sketches, "",
_("If on, the sketch result will be the normal average of all sketches made, instead of averaging the old result with the new sketch"));
@@ -478,10 +488,12 @@ void InkscapePreferences::initPageTools()
this->AddPage(_page_eraser, _("Eraser"), iter_tools, PREFS_PAGE_TOOLS_ERASER);
this->AddNewObjectsStyle(_page_eraser, "/tools/eraser");
+#if HAVE_POTRACE
//Paint Bucket
this->AddPage(_page_paintbucket, _("Paint Bucket"), iter_tools, PREFS_PAGE_TOOLS_PAINTBUCKET);
this->AddSelcueCheckbox(_page_paintbucket, "/tools/paintbucket", false);
this->AddNewObjectsStyle(_page_paintbucket, "/tools/paintbucket");
+#endif
//Gradient
this->AddPage(_page_gradient, _("Gradient"), iter_tools, PREFS_PAGE_TOOLS_GRADIENT);
@@ -601,7 +613,7 @@ void InkscapePreferences::initPageUI()
_("Set the language for menus and number formats"), false);
{
- Glib::ustring sizeLabels[] = {_("Large"), _("Small"), _("Smaller")};
+ Glib::ustring sizeLabels[] = {C_("Icon size", "Large"), C_("Icon size", "Small"), C_("Icon size", "Smaller")};
int sizeValues[] = {0, 1, 2};
_misc_small_tools.init( "/toolbox/tools/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 );
@@ -686,7 +698,7 @@ void InkscapePreferences::initPageUI()
_win_ontop_agressive.init ( _("Aggressive"), "/options/transientpolicy/value", 2, false, &_win_ontop_none);
{
- Glib::ustring defaultSizeLabels[] = {_("Small"), _("Large"), _("Maximized")};
+ Glib::ustring defaultSizeLabels[] = {C_("Window size", "Small"), C_("Window size", "Large"), C_("Window size", "Maximized")};
int defaultSizeValues[] = {0, 1, 2};
_win_default_size.init( "/options/defaultwindowsize/value", defaultSizeLabels, defaultSizeValues, G_N_ELEMENTS(defaultSizeLabels), 1 );
@@ -1250,11 +1262,9 @@ void InkscapePreferences::initPageBehavior()
_scroll_auto_thres.init ( "/options/autoscrolldistance/value", -600.0, 600.0, 1.0, 1.0, -10.0, true, false);
_page_scrolling.add_line( true, _("_Threshold:"), _scroll_auto_thres, _("pixels"),
_("How far (in screen pixels) you need to be from the canvas edge to trigger autoscroll; positive is outside the canvas, negative is within the canvas"), false);
-/*
- _scroll_space.init ( _("Left mouse button pans when Space is pressed"), "/options/spacepans/value", false);
- _page_scrolling.add_line( false, "", _scroll_space, "",
- _("When on, pressing and holding Space and dragging with left mouse button pans canvas (as in Adobe Illustrator); when off, Space temporarily switches to Selector tool (default)"));
-*/
+ _scroll_space.init ( _("Mouse move pans when Space is pressed"), "/options/spacebarpans/value", true);
+ _page_scrolling.add_line( true, "", _scroll_space, "",
+ _("When on, pressing and holding Space and dragging pans canvas"));
_wheel_zoom.init ( _("Mouse wheel zooms by default"), "/options/wheelzooms/value", false);
_page_scrolling.add_line( false, "", _wheel_zoom, "",
_("When on, mouse wheel zooms without Ctrl and scrolls canvas with Ctrl; when off, it zooms with Ctrl and scrolls without Ctrl"));
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 7e0184c55..d1abcfc58 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -15,6 +15,10 @@
#ifndef INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H
#define INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <iostream>
#include <vector>
#include "ui/widget/preferences-widget.h"
@@ -56,7 +60,11 @@ enum {
PREFS_PAGE_TOOLS_TEXT,
PREFS_PAGE_TOOLS_SPRAY,
PREFS_PAGE_TOOLS_ERASER,
+
+#if HAVE_POTRACE
PREFS_PAGE_TOOLS_PAINTBUCKET,
+#endif
+
PREFS_PAGE_TOOLS_GRADIENT,
PREFS_PAGE_TOOLS_DROPPER,
PREFS_PAGE_TOOLS_CONNECTOR,
@@ -494,6 +502,7 @@ protected:
static void AddConvertGuidesCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
static void AddFirstAndLastCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value);
static void AddDotSizeSpinbutton(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, double def_value);
+ static void AddBaseSimplifySpinbutton(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, double def_value);
static void AddNewObjectsStyle(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = NULL);
void on_pagelist_selection_changed();
diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp
new file mode 100644
index 000000000..9c23c33e1
--- /dev/null
+++ b/src/ui/dialog/knot-properties.cpp
@@ -0,0 +1,213 @@
+/**
+ * @file
+ * Dialog for renaming layers.
+ */
+/* Author:
+ * Bryce W. Harrington <bryce@bryceharrington.com>
+ * Andrius R. <knutux@gmail.com>
+ * Abhishek Sharma
+ *
+ * Copyright (C) 2004 Bryce Harrington
+ * Copyright (C) 2006 Andrius R.
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include "ui/dialog/knot-properties.h"
+#include <boost/lexical_cast.hpp>
+#include <gtkmm/stock.h>
+#include <glibmm/main.h>
+#include <glibmm/i18n.h>
+#include "inkscape.h"
+#include "util/units.h"
+#include "desktop.h"
+#include "document.h"
+#include "document-undo.h"
+#include "layer-manager.h"
+#include "message-stack.h"
+
+#include "sp-object.h"
+#include "sp-item.h"
+#include "verbs.h"
+#include "selection.h"
+#include "selection-chemistry.h"
+#include "ui/icon-names.h"
+#include "ui/widget/imagetoggler.h"
+
+//#include "event-context.h"
+
+namespace Inkscape {
+namespace UI {
+namespace Dialogs {
+
+KnotPropertiesDialog::KnotPropertiesDialog()
+: _desktop(NULL), _knotpoint(NULL), _position_visible(false)
+{
+ Gtk::Box *mainVBox = get_vbox();
+
+ _layout_table.set_spacings(4);
+ _layout_table.resize (2, 2);
+ _unit_name = "";
+ // Layer name widgets
+ _knot_x_entry.set_activates_default(true);
+ _knot_x_entry.set_digits(4);
+ _knot_x_entry.set_increments(1,1);
+ _knot_x_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE);
+ _knot_x_label.set_label(_("Position X:"));
+ _knot_x_label.set_alignment(1.0, 0.5);
+
+ _knot_y_entry.set_activates_default(true);
+ _knot_y_entry.set_digits(4);
+ _knot_y_entry.set_increments(1,1);
+ _knot_y_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE);
+ _knot_y_label.set_label(_("Position Y:"));
+ _knot_y_label.set_alignment(1.0, 0.5);
+
+ _layout_table.attach(_knot_x_label,
+ 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
+ _layout_table.attach(_knot_x_entry,
+ 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
+
+ _layout_table.attach(_knot_y_label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
+ _layout_table.attach(_knot_y_entry, 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
+
+ mainVBox->pack_start(_layout_table, true, true, 4);
+
+ // Buttons
+ _close_button.set_use_stock(true);
+ _close_button.set_label(Gtk::Stock::CANCEL.id);
+ _close_button.set_can_default();
+
+ _apply_button.set_use_underline(true);
+ _apply_button.set_can_default();
+
+ _close_button.signal_clicked()
+ .connect(sigc::mem_fun(*this, &KnotPropertiesDialog::_close));
+ _apply_button.signal_clicked()
+ .connect(sigc::mem_fun(*this, &KnotPropertiesDialog::_apply));
+
+ signal_delete_event().connect(
+ sigc::bind_return(
+ sigc::hide(sigc::mem_fun(*this, &KnotPropertiesDialog::_close)),
+ true
+ )
+ );
+ add_action_widget(_close_button, Gtk::RESPONSE_CLOSE);
+ add_action_widget(_apply_button, Gtk::RESPONSE_APPLY);
+
+ _apply_button.grab_default();
+
+ show_all_children();
+
+ set_focus(_knot_y_entry);
+}
+
+KnotPropertiesDialog::~KnotPropertiesDialog() {
+
+ _setDesktop(NULL);
+}
+
+void KnotPropertiesDialog::showDialog(SPDesktop *desktop, const SPKnot *pt, Glib::ustring const unit_name)
+{
+ KnotPropertiesDialog *dialog = new KnotPropertiesDialog();
+ dialog->_setDesktop(desktop);
+ dialog->_setKnotPoint(pt->position(), unit_name);
+ dialog->_setPt(pt);
+
+ dialog->set_title(_("Modify Knot Position"));
+ dialog->_apply_button.set_label(_("_Move"));
+
+ dialog->set_modal(true);
+ desktop->setWindowTransient (dialog->gobj());
+ dialog->property_destroy_with_parent() = true;
+
+ dialog->show();
+ dialog->present();
+}
+
+void
+KnotPropertiesDialog::_apply()
+{
+ double d_x = Inkscape::Util::Quantity::convert(_knot_x_entry.get_value(), _unit_name, "px");
+ double d_y = Inkscape::Util::Quantity::convert(_knot_y_entry.get_value(), _unit_name, "px");
+ _knotpoint->moveto(Geom::Point(d_x, d_y));
+ _knotpoint->moved_signal.emit(_knotpoint, _knotpoint->position(), 0);
+ _close();
+}
+
+void
+KnotPropertiesDialog::_close()
+{
+ _setDesktop(NULL);
+ destroy_();
+ Glib::signal_idle().connect(
+ sigc::bind_return(
+ sigc::bind(sigc::ptr_fun(&::operator delete), this),
+ false
+ )
+ );
+}
+
+bool KnotPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/)
+{
+
+ /*switch (get_group0_keyval(event)) {
+ case GDK_KEY_Return:
+ case GDK_KEY_KP_Enter: {
+ _apply();
+ return true;
+ }
+ break;
+ }*/
+ return false;
+}
+
+void KnotPropertiesDialog::_handleButtonEvent(GdkEventButton* event)
+{
+ if ( (event->type == GDK_2BUTTON_PRESS) && (event->button == 1) ) {
+ _apply();
+ }
+}
+
+void KnotPropertiesDialog::_setKnotPoint(Geom::Point knotpoint, Glib::ustring const unit_name)
+{
+ _unit_name = unit_name;
+ _knot_x_entry.set_value( Inkscape::Util::Quantity::convert(knotpoint.x(), "px", _unit_name));
+ _knot_y_entry.set_value( Inkscape::Util::Quantity::convert(knotpoint.y(), "px", _unit_name));
+ _knot_x_label.set_label(g_strdup_printf(_("Position X (%s):"), _unit_name.c_str()));
+ _knot_y_label.set_label(g_strdup_printf(_("Position Y (%s):"), _unit_name.c_str()));
+}
+
+void KnotPropertiesDialog::_setPt(const SPKnot *pt)
+{
+ _knotpoint = const_cast<SPKnot *>(pt);
+}
+
+void KnotPropertiesDialog::_setDesktop(SPDesktop *desktop) {
+ if (desktop) {
+ Inkscape::GC::anchor (desktop);
+ }
+ if (_desktop) {
+ Inkscape::GC::release (_desktop);
+ }
+ _desktop = desktop;
+}
+
+} // namespace
+} // namespace
+} // namespace
+
+
+/*
+ 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 :
diff --git a/src/ui/dialog/knot-properties.h b/src/ui/dialog/knot-properties.h
new file mode 100644
index 000000000..fd87df03d
--- /dev/null
+++ b/src/ui/dialog/knot-properties.h
@@ -0,0 +1,97 @@
+/** @file
+ * @brief
+ */
+/* Author:
+ * Bryce W. Harrington <bryce@bryceharrington.com>
+ *
+ * Copyright (C) 2004 Bryce Harrington
+ *
+ * Released under GNU GPL. Read the file 'COPYING' for more information
+ */
+
+#ifndef INKSCAPE_DIALOG_KNOT_PROPERTIES_H
+#define INKSCAPE_DIALOG_KNOT_PROPERTIES_H
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gtkmm.h>
+#include <2geom/point.h>
+#include "knot.h"
+#include "ui/tools/measure-tool.h"
+
+class SPDesktop;
+
+namespace Inkscape {
+namespace UI {
+namespace Dialogs {
+
+
+class KnotPropertiesDialog : public Gtk::Dialog {
+ public:
+ KnotPropertiesDialog();
+ virtual ~KnotPropertiesDialog();
+
+ Glib::ustring getName() const { return "LayerPropertiesDialog"; }
+
+ static void showDialog(SPDesktop *desktop, const SPKnot *pt, Glib::ustring const unit_name);
+
+protected:
+
+ SPDesktop *_desktop;
+ SPKnot *_knotpoint;
+
+ Gtk::Label _knot_x_label;
+ Gtk::SpinButton _knot_x_entry;
+ Gtk::Label _knot_y_label;
+ Gtk::SpinButton _knot_y_entry;
+ Gtk::Table _layout_table;
+ bool _position_visible;
+
+ Gtk::Button _close_button;
+ Gtk::Button _apply_button;
+ Glib::ustring _unit_name;
+
+ sigc::connection _destroy_connection;
+
+ static KnotPropertiesDialog &_instance() {
+ static KnotPropertiesDialog instance;
+ return instance;
+ }
+
+ void _setDesktop(SPDesktop *desktop);
+ void _setPt(const SPKnot *pt);
+
+ void _apply();
+ void _close();
+
+ void _setKnotPoint(Geom::Point knotpoint, Glib::ustring const unit_name);
+ void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row);
+
+ bool _handleKeyEvent(GdkEventKey *event);
+ void _handleButtonEvent(GdkEventButton* event);
+ friend class Inkscape::UI::Tools::MeasureTool;
+
+private:
+ KnotPropertiesDialog(KnotPropertiesDialog const &); // no copy
+ KnotPropertiesDialog &operator=(KnotPropertiesDialog const &); // no assign
+};
+
+} // namespace
+} // namespace
+} // namespace
+
+
+#endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_H
+
+/*
+ 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 :
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index 3f5e80f8d..1c022ecad 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -715,11 +715,11 @@ void LayersPanel::_doTreeMove( )
{
if (_dnd_source && _dnd_source->getRepr() ) {
if(!_dnd_target){
- _dnd_source->doWriteTransform(_dnd_source->getRepr(), _dnd_source->document->getRoot()->i2doc_affine().inverse() * _dnd_source->i2doc_affine());
+ _dnd_source->doWriteTransform(_dnd_source->getRepr(), _dnd_source->i2doc_affine() * _dnd_source->document->getRoot()->i2doc_affine().inverse());
}else{
SPItem* parent = _dnd_into ? _dnd_target : dynamic_cast<SPItem*>(_dnd_target->parent);
if(parent){
- Geom::Affine move = parent->i2doc_affine().inverse() * _dnd_source->i2doc_affine();
+ Geom::Affine move = _dnd_source->i2doc_affine() * parent->i2doc_affine().inverse();
_dnd_source->doWriteTransform(_dnd_source->getRepr(), move);
}
}
@@ -1040,14 +1040,6 @@ void LayersPanel::setDesktop( SPDesktop* desktop )
_layersChanged();
}
}
-/*
- GSList const *layers = _desktop->doc()->getResourceList( "layer" );
- g_message( "layers list starts at %p", layers );
- for ( GSList const *iter=layers ; iter ; iter = iter->next ) {
- SPObject *layer=static_cast<SPObject *>(iter->data);
- g_message(" {%s} [%s]", layer->id, layer->label() );
- }
-*/
deskTrack.setBase(desktop);
}
diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp
index e30b148bb..74ec7111e 100644
--- a/src/ui/dialog/new-from-template.cpp
+++ b/src/ui/dialog/new-from-template.cpp
@@ -29,10 +29,12 @@ NewFromTemplate::NewFromTemplate()
set_title(_("New From Template"));
resize(400, 400);
+ _main_widget = new TemplateLoadTab(this);
+
#if WITH_GTKMM_3_0
- get_content_area()->pack_start(_main_widget);
+ get_content_area()->pack_start(*_main_widget);
#else
- get_vbox()->pack_start(_main_widget);
+ get_vbox()->pack_start(*_main_widget);
#endif
Gtk::Alignment *align;
@@ -49,14 +51,24 @@ NewFromTemplate::NewFromTemplate()
_create_template_button.signal_clicked().connect(
sigc::mem_fun(*this, &NewFromTemplate::_createFromTemplate));
+ _create_template_button.set_sensitive(false);
show_all();
}
+NewFromTemplate::~NewFromTemplate()
+{
+ delete _main_widget;
+}
+
+void NewFromTemplate::setCreateButtonSensitive(bool value)
+{
+ _create_template_button.set_sensitive(value);
+}
void NewFromTemplate::_createFromTemplate()
{
- _main_widget.createTemplate();
+ _main_widget->createTemplate();
_onClose();
}
diff --git a/src/ui/dialog/new-from-template.h b/src/ui/dialog/new-from-template.h
index 2b40af2a6..c0b65affb 100644
--- a/src/ui/dialog/new-from-template.h
+++ b/src/ui/dialog/new-from-template.h
@@ -27,11 +27,13 @@ class NewFromTemplate : public Gtk::Dialog
friend class TemplateLoadTab;
public:
static void load_new_from_template();
-
+ void setCreateButtonSensitive(bool value);
+ virtual ~NewFromTemplate();
+
private:
NewFromTemplate();
Gtk::Button _create_template_button;
- TemplateLoadTab _main_widget;
+ TemplateLoadTab* _main_widget;
void _createFromTemplate();
void _onClose();
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp
index 835ecf35b..891048beb 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -479,7 +479,7 @@ void ObjectsPanel::_objectsSelected( Selection *sel ) {
_tree.get_selection()->unselect_all();
SPItem *item = NULL;
std::vector<SPItem*> const items = sel->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end();i++){
+ for(std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end(); ++i){
item = *i;
if (setOpacity)
{
@@ -1583,6 +1583,10 @@ void ObjectsPanel::_blurChangedIter(const Gtk::TreeIter& iter, double blur)
}
if (radius != 0) {
+ // The modify function expects radius to be in display pixels.
+ Geom::Affine i2d (item->i2dt_affine());
+ double expansion = i2d.descrim();
+ radius *= expansion;
SPFilter *filter = modify_filter_gaussian_blur_from_item(_document, item, radius);
sp_style_set_property_url(item, "filter", filter, false);
} else if (item->style->filter.set && item->style->getFilter()) {
@@ -1614,11 +1618,11 @@ ObjectsPanel::ObjectsPanel() :
_pending(0),
_toggleEvent(0),
_defer_target(),
- _visibleHeader(_("V")),
- _lockHeader(_("L")),
- _typeHeader(_("T")),
- _clipmaskHeader(_("CM")),
- _highlightHeader(_("HL")),
+ _visibleHeader(C_("Visibility", "V")),
+ _lockHeader(C_("Lock", "L")),
+ _typeHeader(C_("Type", "T")),
+ _clipmaskHeader(C_("Clip and mask", "CM")),
+ _highlightHeader(C_("Highlight", "HL")),
_nameHeader(_("Label")),
_composite_vbox(false, 0),
_opacity_vbox(false, 0),
diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp
index 760391df6..f557ff0fc 100644
--- a/src/ui/dialog/pixelartdialog.cpp
+++ b/src/ui/dialog/pixelartdialog.cpp
@@ -373,7 +373,7 @@ void PixelArtDialogImpl::vectorize()
}
std::vector<SPItem*> const items = desktop->selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end();i++){
+ for(std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end();++i){
if ( !SP_IS_IMAGE(*i) )
continue;
diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp
index af1386e27..5ec1285c1 100644
--- a/src/ui/dialog/polar-arrange-tab.cpp
+++ b/src/ui/dialog/polar-arrange-tab.cpp
@@ -304,7 +304,7 @@ void PolarArrangeTab::arrange()
bool arrangeOnFirstEllipse = arrangeOnEllipse && arrangeOnFirstCircleRadio.get_active();
int count = 0;
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++)
+ for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i)
{
if(arrangeOnEllipse)
{
@@ -373,7 +373,7 @@ void PolarArrangeTab::arrange()
Geom::Point realCenter = Geom::Point(cx, cy) * transformation;
int i = 0;
- for(std::vector<SPItem*>::const_iterator it=tmp.begin();it!=tmp.end();it++)
+ for(std::vector<SPItem*>::const_iterator it=tmp.begin();it!=tmp.end(); ++it)
{
SPItem *item = *it;
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 12b423602..46e045c14 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -266,12 +266,12 @@ void SvgFontsDialog::update_fonts()
{
SPDesktop* desktop = this->getDesktop();
SPDocument* document = desktop->getDocument();
- const GSList* fonts = document->getResourceList("font");
+ std::set<SPObject *> fonts = document->getResourceList( "fonts" );
_model->clear();
- for(const GSList *l = fonts; l; l = l->next) {
+ for (std::set<SPObject *>::const_iterator it = fonts.begin(); it != fonts.end(); ++it) {
Gtk::TreeModel::Row row = *_model->append();
- SPFont* f = SP_FONT(l->data);
+ SPFont* f = SP_FONT(*it);
row[_columns.spfont] = f;
row[_columns.svgfont] = new SvgFont(f);
const gchar* lbl = f->label();
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 72677c07e..924ebe03d 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -171,9 +171,9 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ )
SPDocument *doc = desktop ? desktop->doc() : 0;
if (doc) {
std::string targetName(bounceTarget->def.descr);
- const GSList *gradients = doc->getResourceList("gradient");
- for (const GSList *item = gradients; item; item = item->next) {
- SPGradient* grad = SP_GRADIENT(item->data);
+ std::set<SPObject *> gradients = doc->getResourceList("gradient");
+ for (std::set<SPObject *>::const_iterator item = gradients.begin(); item != gradients.end(); ++item) {
+ SPGradient* grad = SP_GRADIENT(*item);
if ( targetName == grad->getId() ) {
editGradientImpl( desktop, grad );
break;
@@ -192,10 +192,10 @@ void SwatchesPanelHook::convertGradient( GtkMenuItem * /*menuitem*/, gpointer us
gint index = GPOINTER_TO_INT(userData);
if ( doc && (index >= 0) && (static_cast<guint>(index) < popupItems.size()) ) {
Glib::ustring targetName = popupItems[index];
+ std::set<SPObject *> gradients = doc->getResourceList("gradient");
+ for (std::set<SPObject *>::const_iterator item = gradients.begin(); item != gradients.end(); ++item) {
+ SPGradient* grad = SP_GRADIENT(*item);
- const GSList *gradients = doc->getResourceList("gradient");
- for (const GSList *item = gradients; item; item = item->next) {
- SPGradient* grad = SP_GRADIENT(item->data);
if ( targetName == grad->getId() ) {
grad->setSwatch();
DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT,
@@ -326,10 +326,10 @@ gboolean colorItemHandleButtonPress( GtkWidget* widget, GdkEventButton* event, g
SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt);
if ( dtw && dtw->desktop ) {
// Pick up all gradients with vectors
- const GSList *gradients = (dtw->desktop->doc())->getResourceList("gradient");
+ std::set<SPObject *> gradients = (dtw->desktop->doc())->getResourceList("gradient");
gint index = 0;
- for (const GSList *curr = gradients; curr; curr = curr->next) {
- SPGradient* grad = SP_GRADIENT(curr->data);
+ for (std::set<SPObject *>::const_iterator item = gradients.begin(); item != gradients.end(); ++item) {
+ SPGradient* grad = SP_GRADIENT(*item);
if ( grad->hasStops() && !grad->isSwatch() ) {
//gl = g_slist_prepend(gl, curr->data);
processed = true;
@@ -393,10 +393,10 @@ static bool parseNum( char*& str, int& val ) {
}
-void _loadPaletteFile( gchar const *filename, gboolean user/*=FALSE*/ )
+void _loadPaletteFile( gchar const *filename, gchar const *path, gboolean user/*=FALSE*/ )
{
char block[1024];
- FILE *f = Inkscape::IO::fopen_utf8name( filename, "r" );
+ FILE *f = Inkscape::IO::fopen_utf8name(path, "r" );
if ( f ) {
char* result = fgets( block, sizeof(block), f );
if ( result ) {
@@ -405,6 +405,7 @@ void _loadPaletteFile( gchar const *filename, gboolean user/*=FALSE*/ )
bool hasErr = false;
SwatchPage *onceMore = new SwatchPage();
+ onceMore->_name = filename;
do {
result = fgets( block, sizeof(block), f );
@@ -521,7 +522,7 @@ compare_swatch_names(SwatchPage const *a, SwatchPage const *b) {
static void loadEmUp()
{
static bool beenHere = false;
- gboolean userPalete = true;
+ gboolean userPalette = true;
if ( !beenHere ) {
beenHere = true;
@@ -549,7 +550,7 @@ static void loadEmUp()
if ( !g_str_has_suffix(lower, "~") ) {
gchar* full = g_build_filename(dirname, filename, NULL);
if ( !Inkscape::IO::file_test( full, G_FILE_TEST_IS_DIR ) ) {
- _loadPaletteFile(full, userPalete);
+ _loadPaletteFile(filename, full, userPalette);
}
g_free(full);
}
@@ -563,7 +564,7 @@ static void loadEmUp()
// toss the dirname
g_free(dirname);
sources.pop_front();
- userPalete = false;
+ userPalette = false;
}
}
@@ -923,12 +924,11 @@ static void recalcSwatchContents(SPDocument* doc,
std::map<ColorItem*, SPGradient*> &gradMappings)
{
std::vector<SPGradient*> newList;
-
- const GSList *gradients = doc->getResourceList("gradient");
- for (const GSList *item = gradients; item; item = item->next) {
- SPGradient* grad = SP_GRADIENT(item->data);
+ std::set<SPObject *> gradients = doc->getResourceList("gradient");
+ for (std::set<SPObject *>::const_iterator item = gradients.begin(); item != gradients.end(); ++item) {
+ SPGradient* grad = SP_GRADIENT(*item);
if ( grad->isSwatch() ) {
- newList.push_back(SP_GRADIENT(item->data));
+ newList.push_back(SP_GRADIENT(*item));
}
}
diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp
index f36e3f18d..cbb2fb953 100644
--- a/src/ui/dialog/tags.cpp
+++ b/src/ui/dialog/tags.cpp
@@ -13,10 +13,6 @@
# include <config.h>
#endif
-#if WITH_GLIBMM_2_32
-# include <glibmm/threads.h>
-#endif
-
#include "tags.h"
#include <gtkmm/widget.h>
#include <gtkmm/icontheme.h>
@@ -353,7 +349,7 @@ void TagsPanel::_objectsSelected( Selection *sel ) {
_selectedConnection.block();
_tree.get_selection()->unselect_all();
std::vector<SPObject*> tmp=sel->list();
- for(std::vector<SPObject*>::const_iterator i=tmp.begin();i!=tmp.end();i++)
+ for(std::vector<SPObject*>::const_iterator i=tmp.begin();i!=tmp.end();++i)
{
SPObject *obj = *i;
_store->foreach(sigc::bind<SPObject *>( sigc::mem_fun(*this, &TagsPanel::_checkForSelected), obj));
@@ -651,7 +647,7 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event)
if (SP_IS_TAG(obj)) {
bool wasadded = false;
std::vector<SPItem*> items=_desktop->selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){
+ for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
SPObject *newobj = *i;
bool addchild = true;
for ( SPObject *child = obj->children; child != NULL; child = child->next) {
diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp
index fca1f7b30..7eb04ff79 100644
--- a/src/ui/dialog/template-load-tab.cpp
+++ b/src/ui/dialog/template-load-tab.cpp
@@ -35,10 +35,11 @@
namespace Inkscape {
namespace UI {
-TemplateLoadTab::TemplateLoadTab()
+TemplateLoadTab::TemplateLoadTab(NewFromTemplate* parent)
: _current_keyword("")
, _keywords_combo(true)
, _current_search_type(ALL)
+ , _parent_widget(parent)
{
set_border_width(10);
@@ -94,7 +95,8 @@ void TemplateLoadTab::_displayTemplateInfo()
if (templateSelectionRef->get_selected()) {
_current_template = (*templateSelectionRef->get_selected())[_columns.textValue];
- _info_widget->display(_tdata[_current_template]);
+ _info_widget->display(_tdata[_current_template]);
+ _parent_widget->setCreateButtonSensitive(true);
}
}
@@ -148,11 +150,10 @@ void TemplateLoadTab::_keywordSelected()
void TemplateLoadTab::_refreshTemplatesList()
{
- _tlist_store->clear();
-
+ _tlist_store->clear();
+
switch (_current_search_type){
case ALL :{
-
for (std::map<Glib::ustring, TemplateData>::iterator it = _tdata.begin() ; it != _tdata.end() ; ++it) {
Gtk::TreeModel::iterator iter = _tlist_store->append();
Gtk::TreeModel::Row row = *iter;
@@ -160,7 +161,7 @@ void TemplateLoadTab::_refreshTemplatesList()
}
break;
}
-
+
case LIST_KEYWORD: {
for (std::map<Glib::ustring, TemplateData>::iterator it = _tdata.begin() ; it != _tdata.end() ; ++it) {
if (it->second.keywords.count(_current_keyword.lowercase()) != 0){
@@ -171,10 +172,10 @@ void TemplateLoadTab::_refreshTemplatesList()
}
break;
}
-
+
case USER_SPECIFIED : {
for (std::map<Glib::ustring, TemplateData>::iterator it = _tdata.begin() ; it != _tdata.end() ; ++it) {
- if (it->second.keywords.count(_current_keyword.lowercase()) != 0 ||
+ if (it->second.keywords.count(_current_keyword.lowercase()) != 0 ||
it->second.display_name.lowercase().find(_current_keyword.lowercase()) != Glib::ustring::npos ||
it->second.author.lowercase().find(_current_keyword.lowercase()) != Glib::ustring::npos ||
it->second.short_description.lowercase().find(_current_keyword.lowercase()) != Glib::ustring::npos ||
@@ -188,6 +189,27 @@ void TemplateLoadTab::_refreshTemplatesList()
break;
}
}
+
+ // reselect item
+ Gtk::TreeIter* item_to_select = NULL;
+ for (Gtk::TreeModel::Children::iterator it = _tlist_store->children().begin(); it != _tlist_store->children().end(); ++it) {
+ Gtk::TreeModel::Row row = *it;
+ if (_current_template == row[_columns.textValue]) {
+ item_to_select = new Gtk::TreeIter(it);
+ break;
+ }
+ }
+ if (_tlist_store->children().size() == 1) {
+ item_to_select = new Gtk::TreeIter(_tlist_store->children().begin());
+ }
+ if (item_to_select) {
+ _tlist_view.get_selection()->select(*item_to_select);
+ delete item_to_select;
+ } else {
+ _current_template = "";
+ _info_widget->clear();
+ _parent_widget->setCreateButtonSensitive(false);
+ }
}
diff --git a/src/ui/dialog/template-load-tab.h b/src/ui/dialog/template-load-tab.h
index 920ae6ca2..d11c4c77f 100644
--- a/src/ui/dialog/template-load-tab.h
+++ b/src/ui/dialog/template-load-tab.h
@@ -28,6 +28,7 @@ namespace Inkscape {
namespace UI {
class TemplateWidget;
+class NewFromTemplate;
class TemplateLoadTab : public Gtk::HBox
{
@@ -47,7 +48,7 @@ public:
Inkscape::Extension::Effect *tpl_effect;
};
- TemplateLoadTab();
+ TemplateLoadTab(NewFromTemplate* parent);
virtual ~TemplateLoadTab();
virtual void createTemplate();
@@ -95,6 +96,7 @@ private:
};
SearchType _current_search_type;
+ NewFromTemplate* _parent_widget;
void _getDataFromNode(Inkscape::XML::Node *, TemplateData &);
void _getProceduralTemplates();
diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp
index eff75b311..0d110d853 100644
--- a/src/ui/dialog/template-widget.cpp
+++ b/src/ui/dialog/template-widget.cpp
@@ -56,6 +56,7 @@ TemplateWidget::TemplateWidget()
_more_info_button.signal_clicked().connect(
sigc::mem_fun(*this, &TemplateWidget::_displayTemplateDetails));
+ _more_info_button.set_sensitive(false);
}
@@ -85,14 +86,12 @@ void TemplateWidget::create()
void TemplateWidget::display(TemplateLoadTab::TemplateData data)
{
+ clear();
_current_template = data;
_template_name_label.set_text(_current_template.display_name);
_short_description_label.set_text(_current_template.short_description);
-
- _preview_render.hide();
- _preview_image.hide();
-
+
std::string imagePath = Glib::build_filename(Glib::path_get_dirname(_current_template.path), _current_template.preview_name);
if (data.preview_name != ""){
_preview_image.set(imagePath);
@@ -103,17 +102,26 @@ void TemplateWidget::display(TemplateLoadTab::TemplateData data)
_preview_render.showImage(gPath);
_preview_render.show();
}
-
- if (_effect_prefs != NULL){
- remove (*_effect_prefs);
- _effect_prefs = NULL;
- }
+
if (data.is_procedural){
_effect_prefs = data.tpl_effect->get_imp()->prefs_effect(data.tpl_effect, SP_ACTIVE_DESKTOP, NULL, NULL);
pack_start(*_effect_prefs);
}
+ _more_info_button.set_sensitive(true);
}
+void TemplateWidget::clear()
+{
+ _template_name_label.set_text("");
+ _short_description_label.set_text("");
+ _preview_render.hide();
+ _preview_image.hide();
+ if (_effect_prefs != NULL){
+ remove (*_effect_prefs);
+ _effect_prefs = NULL;
+ }
+ _more_info_button.set_sensitive(false);
+}
void TemplateWidget::_displayTemplateDetails()
{
diff --git a/src/ui/dialog/template-widget.h b/src/ui/dialog/template-widget.h
index bb35d26a0..13488089c 100644
--- a/src/ui/dialog/template-widget.h
+++ b/src/ui/dialog/template-widget.h
@@ -28,6 +28,7 @@ public:
TemplateWidget ();
void create();
void display(TemplateLoadTab::TemplateData);
+ void clear();
private:
TemplateLoadTab::TemplateData _current_template;
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index 7575cc854..c01da8864 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -127,8 +127,8 @@ TextEdit::TextEdit()
gtk_combo_box_text_append_text((GtkComboBoxText *) spacing_combo, spacings[i]);
}
- gtk_widget_set_tooltip_text (px, _("Spacing between lines (percent of font size)"));
- gtk_widget_set_tooltip_text (spacing_combo, _("Spacing between lines (percent of font size)"));
+ gtk_widget_set_tooltip_text (px, _("Spacing between baselines (percent of font size)"));
+ gtk_widget_set_tooltip_text (spacing_combo, _("Spacing between baselines (percent of font size)"));
layout_hbox.pack_start(*Gtk::manage(Glib::wrap(spacing_combo)), false, false);
layout_frame.set_padding(4,4,4,4);
layout_frame.add(layout_hbox);
@@ -175,6 +175,19 @@ TextEdit::TextEdit()
gtk_text_view_set_wrap_mode ((GtkTextView *) text_view, GTK_WRAP_WORD);
#ifdef WITH_GTKSPELL
+#ifdef WITH_GTKMM_3_0
+/*
+ TODO: Use computed xml:lang attribute of relevant element, if present, to specify the
+ language (either as 2nd arg of gtkspell_new_attach, or with explicit
+ gtkspell_set_language call in; see advanced.c example in gtkspell docs).
+ onReadSelection looks like a suitable place.
+*/
+ GtkSpellChecker * speller = gtk_spell_checker_new();
+
+ if (! gtk_spell_checker_attach(speller, GTK_TEXT_VIEW(text_view))) {
+ g_print("gtkspell error:\n");
+ }
+#else
GError *error = NULL;
/*
@@ -188,6 +201,7 @@ TextEdit::TextEdit()
g_error_free(error);
}
#endif
+#endif
gtk_widget_set_size_request (text_view, -1, 64);
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), TRUE);
@@ -430,7 +444,7 @@ SPItem *TextEdit::getSelectedTextItem (void)
return NULL;
std::vector<SPItem*> tmp=SP_ACTIVE_DESKTOP->getSelection()->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++)
+ for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i)
{
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i))
return *i;
@@ -448,7 +462,7 @@ unsigned TextEdit::getSelectedTextCount (void)
unsigned int items = 0;
std::vector<SPItem*> tmp=SP_ACTIVE_DESKTOP->getSelection()->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++)
+ for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i)
{
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i))
++items;
@@ -558,7 +572,7 @@ void TextEdit::onApply()
SPCSSAttr *css = fillTextStyle ();
sp_desktop_set_style(desktop, css, true);
- for(std::vector<SPItem*>::const_iterator i=item_list.begin();i!=item_list.end();i++){
+ for(std::vector<SPItem*>::const_iterator i=item_list.begin();i!=item_list.end();++i){
// apply style to the reprs of all text objects in the selection
if (SP_IS_TEXT (*i)) {
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 498ad7822..b7638e8c1 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -35,7 +35,6 @@
#include "sp-item-transform.h"
#include "macros.h"
#include "sp-item.h"
-#include "util/glib-list-iterators.h"
#include "ui/icon-names.h"
#include "widgets/icon.h"
@@ -812,7 +811,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection)
bool preserve = prefs->getBool("/options/preservetransform/value", false);
if (prefs->getBool("/dialogs/transformation/applyseparately")) {
std::vector<SPItem*> tmp=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++){
+ for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i){
SPItem *item = *i;
Geom::OptRect bbox_pref = item->desktopPreferredBounds();
Geom::OptRect bbox_geom = item->desktopGeometricBounds();
@@ -876,7 +875,7 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection)
if (prefs->getBool("/dialogs/transformation/applyseparately")) {
std::vector<SPItem*> tmp=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++){
+ for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i){
SPItem *item = *i;
sp_item_rotate_rel(item, Geom::Rotate (angle*M_PI/180.0));
}
@@ -896,7 +895,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection)
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/dialogs/transformation/applyseparately")) {
std::vector<SPItem*> items=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();i++){
+ for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();++i){
SPItem *item = *i;
if (!_units_skew.isAbsolute()) { // percentage
@@ -998,7 +997,7 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection)
if (_check_replace_matrix.get_active()) {
std::vector<SPItem*> tmp=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++){
+ for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i){
SPItem *item = *i;
item->set_item_transform(displayed);
item->updateRepr();
@@ -1170,6 +1169,9 @@ void Transformation::onReplaceMatrixToggled()
void Transformation::onScaleProportionalToggled()
{
onScaleXValueChanged();
+ if (_scalar_scale_vertical.setProgrammatically) {
+ _scalar_scale_vertical.setProgrammatically = false;
+ }
}