summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorLiam P. White <inkscapebronyat-signgmaildotcom>2014-05-17 02:00:23 +0000
committerLiam P. White <inkscapebronyat-signgmaildotcom>2014-05-17 02:00:23 +0000
commitc418ce3ee56b7b31832fa801996439ce8256e5e7 (patch)
tree8972313381d2e410aedf674d66fef812a455b457 /src/ui
parentCommit patch for "leaned" cap. Thanks Jabiertxof! (diff)
parentFix GTK+ 3 build (diff)
downloadinkscape-c418ce3ee56b7b31832fa801996439ce8256e5e7.tar.gz
inkscape-c418ce3ee56b7b31832fa801996439ce8256e5e7.zip
Update to experimental (r13376)
(bzr r13090.1.79)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp12
-rw-r--r--src/ui/dialog/filedialogimpl-win32.h8
-rw-r--r--src/ui/dialog/tags.cpp6
-rw-r--r--src/ui/dialog/text-edit.cpp8
-rw-r--r--src/ui/tool/node.cpp6
-rw-r--r--src/ui/tool/node.h3
-rw-r--r--src/ui/tools/node-tool.cpp48
-rw-r--r--src/ui/tools/node-tool.h2
-rw-r--r--src/ui/tools/pen-tool.cpp22
-rw-r--r--src/ui/widget/registered-widget.cpp53
-rw-r--r--src/ui/widget/registered-widget.h25
11 files changed, 169 insertions, 24 deletions
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 9d91f5d56..06153a2d8 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -72,13 +72,6 @@ const unsigned long MaxPreviewFileSize = 10240; // kB
#define IDC_SHOW_PREVIEW 1000
-// Windows 2000 version of OPENFILENAMEW
-struct OPENFILENAMEEXW : public OPENFILENAMEW {
- void * pvReserved;
- DWORD dwReserved;
- DWORD FlagsEx;
-};
-
struct Filter
{
gunichar2* name;
@@ -483,7 +476,7 @@ void FileOpenDialogImplWin32::createFilterMenu()
void FileOpenDialogImplWin32::GetOpenFileName_thread()
{
- OPENFILENAMEEXW ofn;
+ OPENFILENAMEW ofn;
g_assert(this != NULL);
g_assert(_mutex != NULL);
@@ -1829,7 +1822,7 @@ void FileSaveDialogImplWin32::addFileType(Glib::ustring name, Glib::ustring patt
void FileSaveDialogImplWin32::GetSaveFileName_thread()
{
- OPENFILENAMEEXW ofn;
+ OPENFILENAMEW ofn;
g_assert(this != NULL);
g_assert(_main_loop != NULL);
@@ -1860,7 +1853,6 @@ void FileSaveDialogImplWin32::GetSaveFileName_thread()
ofn.nFilterIndex = _filter_index;
ofn.lpfnHook = GetSaveFileName_hookproc;
ofn.lCustData = (LPARAM)this;
-
_result = GetSaveFileNameW(&ofn) != 0;
g_assert(ofn.nFilterIndex >= 1 && ofn.nFilterIndex <= _filter_count);
diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h
index 29bcb9a45..c523f041d 100644
--- a/src/ui/dialog/filedialogimpl-win32.h
+++ b/src/ui/dialog/filedialogimpl-win32.h
@@ -13,14 +13,20 @@
# include "config.h"
#endif
+#include <glibmm.h>
+
#ifdef WIN32
#if WITH_GLIBMM_2_32
#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
# include <glibmm/threads.h>
#endif
-
#endif
+
#include "gc-core.h"
+ // define WINVER high enough so we get the correct OPENFILENAMEW size
+#ifndef WINVER
+#define WINVER 0x0500
+#endif
#include <windows.h>
#include "filedialogimpl-gtkmm.h"
diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp
index 1b5dd9400..b2ca1b6da 100644
--- a/src/ui/dialog/tags.cpp
+++ b/src/ui/dialog/tags.cpp
@@ -8,16 +8,22 @@
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+
#ifdef HAVE_CONFIG_H
# 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>
#include <gtkmm/imagemenuitem.h>
#include <gtkmm/separatormenuitem.h>
+#include <glibmm/main.h>
#include <glibmm/i18n.h>
#include "desktop.h"
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index 17c29c69f..c1ebb32e0 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -404,12 +404,12 @@ void TextEdit::setPreviewText (Glib::ustring font_spec, Glib::ustring phrase)
double pt_size = Inkscape::Util::Quantity::convert(sp_style_css_size_units_to_px(sp_font_selector_get_size(fsel), unit), "px", "pt");
// Pango font size is in 1024ths of a point
- // C++11: Glib::ustring size = std::to_string( pt_size * PANGO_SCALE );
+ // C++11: Glib::ustring size = std::to_string( int(pt_size * PANGO_SCALE) );
std::ostringstream size_st;
- size_st << pt_size * PANGO_SCALE;
+ size_st << int(pt_size * PANGO_SCALE); // Markup code expects integers
- Glib::ustring markup = "<span font=\"" + font_spec +
- "\" size=\"" + size_st.str() + "\">" + phrase_escaped + "</span>";
+ Glib::ustring markup = "<span font=\'" + font_spec +
+ "\' size=\'" + size_st.str() + "\'>" + phrase_escaped + "</span>";
preview_label.set_markup(markup.c_str());
}
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index 1434a5c5b..ed0843b65 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -371,7 +371,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event)
std::vector<Inkscape::SnapCandidatePoint> unselected;
//if the snap adjustment is activated and it is not bspline
- if (snap && !_pm().isBSpline()) {
+ if (snap && !_pm().isBSpline(false)) {
ControlPointSelection::Set &nodes = _parent->_selection.allPoints();
for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) {
Node *n = static_cast<Node*>(*i);
@@ -623,7 +623,7 @@ void Node::move(Geom::Point const &new_pos)
Node *n = this;
Node * nextNode = n->nodeToward(n->front());
Node * prevNode = n->nodeToward(n->back());
- nodeWeight = _pm().BSplineHandlePosition(n->front());
+ nodeWeight = fmax(_pm().BSplineHandlePosition(n->front()),_pm().BSplineHandlePosition(n->back()));
if(prevNode){
if(prevNode->isEndNode()){
prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front(),prevNode->front());
@@ -659,7 +659,7 @@ void Node::move(Geom::Point const &new_pos)
if(nextNode->isEndNode()){
nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNodeWeight));
}else{
- nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNode->back()));
+ nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNode->front()));
}
}
}
diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h
index 5971956e1..101af4817 100644
--- a/src/ui/tool/node.h
+++ b/src/ui/tool/node.h
@@ -41,6 +41,7 @@ template <typename> class NodeIterator;
}
}
+/*
#if HAVE_TR1_UNORDERED_SET
namespace std {
namespace tr1 {
@@ -48,6 +49,8 @@ template <typename N> struct hash< Inkscape::UI::NodeIterator<N> >;
}
}
#endif
+#endif
+*/
namespace Inkscape {
namespace UI {
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index 719b67108..72f5159ae 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -23,6 +23,8 @@
#include "message-context.h"
#include "selection.h"
#include "shape-editor.h" // temporary!
+#include "live_effects/effect.h"
+#include "display/curve.h"
#include "sp-clippath.h"
#include "sp-item-group.h"
#include "sp-mask.h"
@@ -167,6 +169,10 @@ NodeTool::~NodeTool() {
this->desktop->remove_temporary_canvasitem(this->flash_tempitem);
}
+ if (this->helperpath_tmpitem) {
+ this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem);
+ }
+
this->_selection_changed_connection.disconnect();
//this->_selection_modified_connection.disconnect();
this->_mouseover_changed_connection.disconnect();
@@ -252,6 +258,7 @@ void NodeTool::setup() {
this->flash_tempitem = NULL;
this->flashed_item = NULL;
this->_last_over = NULL;
+ this->helperpath_tmpitem = NULL;
// read prefs before adding items to selection to prevent momentarily showing the outline
sp_event_context_read(this, "show_handles");
@@ -278,6 +285,41 @@ void NodeTool::setup() {
}
this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive
+ this->update_helperpath();
+}
+
+void NodeTool::update_helperpath(){
+ Inkscape::Selection *selection = sp_desktop_selection (this->desktop);
+ if (this->helperpath_tmpitem) {
+ this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem);
+ this->helperpath_tmpitem = NULL;
+ }
+ if (SP_IS_LPE_ITEM(selection->singleItem())) {
+ Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE();
+ if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) {
+ if (lpe) {
+ SPCurve *c = new SPCurve();
+ SPCurve *cc = new SPCurve();
+ std::vector<Geom::PathVector> cs = lpe->getCanvasIndicators(SP_LPE_ITEM(selection->singleItem()));
+ for (std::vector<Geom::PathVector>::iterator p = cs.begin(); p != cs.end(); ++p) {
+ cc->set_pathvector(*p);
+ c->append(cc, false);
+ cc->reset();
+ }
+ if (!c->is_empty()) {
+ c->transform(selection->singleItem()->i2dt_affine());
+ SPCanvasItem *helperpath = sp_canvas_bpath_new(sp_desktop_tempgroup(this->desktop), c);
+ sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath),
+ 0x0000ff9A, 1.0,
+ SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
+ sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO);
+ this->helperpath_tmpitem = this->desktop->add_temporary_canvasitem(helperpath,0);
+ }
+ c->unref();
+ cc->unref();
+ }
+ }
+ }
}
void NodeTool::set(const Inkscape::Preferences::Entry& value) {
@@ -392,7 +434,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) {
for (std::set<ShapeRecord>::iterator i = shapes.begin(); i != shapes.end(); ++i) {
ShapeRecord const &r = *i;
- if ((SP_IS_SHAPE(r.item) || SP_IS_TEXT(r.item)) &&
+ if ((SP_IS_SHAPE(r.item) || SP_IS_TEXT(r.item) || SP_IS_GROUP(r.item) || SP_IS_OBJECTGROUP(r.item)) &&
this->_shape_editors.find(r.item) == this->_shape_editors.end())
{
ShapeEditor *si = new ShapeEditor(this->desktop);
@@ -416,7 +458,7 @@ bool NodeTool::root_handler(GdkEvent* event) {
Inkscape::Selection *selection = desktop->selection;
static Inkscape::Preferences *prefs = Inkscape::Preferences::get();
-
+
if (this->_multipath->event(this, event)) {
return true;
}
@@ -433,6 +475,7 @@ bool NodeTool::root_handler(GdkEvent* event) {
{
case GDK_MOTION_NOTIFY: {
combine_motion_events(desktop->canvas, event->motion, 0);
+ this->update_helperpath();
SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button),
FALSE, TRUE);
@@ -441,7 +484,6 @@ bool NodeTool::root_handler(GdkEvent* event) {
//ink_node_tool_update_tip(nt, event);
this->update_tip(event);
}
-
// create pathflash outline
if (prefs->getBool("/tools/nodes/pathflash_enabled")) {
if (over_item == this->flashed_item) {
diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h
index 42f89cd1c..9f0c40aa8 100644
--- a/src/ui/tools/node-tool.h
+++ b/src/ui/tools/node-tool.h
@@ -54,6 +54,7 @@ public:
static const std::string prefsPath;
virtual void setup();
+ virtual void update_helperpath();
virtual void set(const Inkscape::Preferences::Entry& val);
virtual bool root_handler(GdkEvent* event);
@@ -66,6 +67,7 @@ private:
SPItem *flashed_item;
Inkscape::Display::TemporaryItem *flash_tempitem;
+ Inkscape::Display::TemporaryItem *helperpath_tmpitem;
Inkscape::UI::Selector* _selector;
Inkscape::UI::PathSharedData* _path_data;
SPCanvasGroup *_transform_handle_group;
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index 9e4df5031..386dc43e9 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -1811,9 +1811,9 @@ void PenTool::_bspline_spiro_build()
void PenTool::_bspline_doEffect(SPCurve * curve)
{
// commenting the function doEffect in src/live_effects/lpe-bspline.cpp
- if(curve->get_segment_count() < 2)
- return;
Geom::PathVector const original_pathv = curve->get_pathvector();
+ if (curve->get_segment_count() < 1)
+ return;
curve->reset();
for(Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) {
@@ -1890,9 +1890,25 @@ void PenTool::_bspline_doEffect(SPCurve * curve)
++curve_it1;
++curve_it2;
}
+ SPCurve *out = new SPCurve();
+ out->moveto(curve_it1->initialPoint());
+ out->lineto(curve_it1->finalPoint());
+ cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
+ if (cubic) {
+ SBasisOut = out->first_segment()->toSBasis();
+ nextPointAt1 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[1], *out->first_segment()));
+ nextPointAt2 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[2], *out->first_segment()));
+ nextPointAt3 = out->first_segment()->finalPoint();
+ } else {
+ nextPointAt1 = out->first_segment()->initialPoint();
+ nextPointAt2 = out->first_segment()->finalPoint();
+ nextPointAt3 = out->first_segment()->finalPoint();
+ }
+ out->reset();
+ delete out;
SPCurve *curveHelper = new SPCurve();
curveHelper->moveto(node);
- Geom::Point startNode(0,0);
+ Geom::Point startNode = path_it->begin()->initialPoint();
if (path_it->closed()) {
SPCurve * start = new SPCurve();
start->moveto(path_it->begin()->initialPoint());
diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp
index 92cb3f03d..83da1a6d6 100644
--- a/src/ui/widget/registered-widget.cpp
+++ b/src/ui/widget/registered-widget.cpp
@@ -99,6 +99,59 @@ RegisteredCheckButton::on_toggled()
_wr->setUpdating (false);
}
+/*#########################################
+ * Registered TOGGLEBUTTON
+ */
+
+RegisteredToggleButton::~RegisteredToggleButton()
+{
+ _toggled_connection.disconnect();
+}
+
+RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *active_str, char const *inactive_str)
+ : RegisteredWidget<Gtk::ToggleButton>(label)
+ , _active_str(active_str)
+ , _inactive_str(inactive_str)
+{
+ init_parent(key, wr, repr_in, doc_in);
+ setProgrammatically = false;
+ set_tooltip_text (tip);
+ set_alignment (right? 1.0 : 0.0, 0.5);
+ _toggled_connection = signal_toggled().connect (sigc::mem_fun (*this, &RegisteredToggleButton::on_toggled));
+}
+
+void
+RegisteredToggleButton::setActive (bool b)
+{
+ setProgrammatically = true;
+ set_active (b);
+ //The slave button is greyed out if the master button is untoggled
+ for (std::list<Gtk::Widget*>::const_iterator i = _slavewidgets.begin(); i != _slavewidgets.end(); ++i) {
+ (*i)->set_sensitive(b);
+ }
+ setProgrammatically = false;
+}
+
+void
+RegisteredToggleButton::on_toggled()
+{
+ if (setProgrammatically) {
+ setProgrammatically = false;
+ return;
+ }
+
+ if (_wr->isUpdating())
+ return;
+ _wr->setUpdating (true);
+
+ write_to_xml(get_active() ? _active_str : _inactive_str);
+ //The slave button is greyed out if the master button is untoggled
+ for (std::list<Gtk::Widget*>::const_iterator i = _slavewidgets.begin(); i != _slavewidgets.end(); ++i) {
+ (*i)->set_sensitive(get_active());
+ }
+
+ _wr->setUpdating (false);
+}
/*#########################################
* Registered UNITMENU
diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h
index d64c09c16..d8c0e6602 100644
--- a/src/ui/widget/registered-widget.h
+++ b/src/ui/widget/registered-widget.h
@@ -163,6 +163,31 @@ protected:
void on_toggled();
};
+class RegisteredToggleButton : public RegisteredWidget<Gtk::ToggleButton> {
+public:
+ virtual ~RegisteredToggleButton();
+ RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *active_str = "true", char const *inactive_str = "false");
+
+ void setActive (bool);
+
+ std::list<Gtk::Widget*> _slavewidgets;
+
+ // a slave button is only sensitive when the master button is active
+ // i.e. a slave button is greyed-out when the master button is not checked
+
+ void setSlaveWidgets(std::list<Gtk::Widget*> btns) {
+ _slavewidgets = btns;
+ }
+
+ bool setProgrammatically; // true if the value was set by setActive, not changed by the user;
+ // if a callback checks it, it must reset it back to false
+
+protected:
+ char const *_active_str, *_inactive_str;
+ sigc::connection _toggled_connection;
+ void on_toggled();
+};
+
class RegisteredUnitMenu : public RegisteredWidget<Labelled> {
public:
~RegisteredUnitMenu();