summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2017-05-05 16:52:19 +0000
committerjabiertxof <info@marker.es>2017-05-05 16:52:19 +0000
commitbec0359a0d5b3f7db96417f003927c282c18a9f4 (patch)
treee45fa17927826da138e233499060e3142de86899 /src/ui/dialog
parentUpdate to trunk (diff)
parentmerge lpeUpdDefaultParams (diff)
downloadinkscape-bec0359a0d5b3f7db96417f003927c282c18a9f4.tar.gz
inkscape-bec0359a0d5b3f7db96417f003927c282c18a9f4.zip
Update to trunk
(bzr r13645.1.174)
Diffstat (limited to 'src/ui/dialog')
-rw-r--r--src/ui/dialog/export.cpp9
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp7
-rw-r--r--src/ui/dialog/inkscape-preferences.h2
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp62
-rw-r--r--src/ui/dialog/livepatheffect-editor.h5
-rw-r--r--src/ui/dialog/symbols.cpp58
6 files changed, 99 insertions, 44 deletions
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index b7207fd50..1bb952de4 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -978,9 +978,7 @@ void Export::onExport ()
SPNamedView *nv = desktop->getNamedView();
SPDocument *doc = desktop->getDocument();
- Geom::Affine rot = doc->getRoot()->c2p;
- doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p;
- doc->ensureUpToDate();
+
bool exportSuccessful = false;
bool hide = hide_export.get_active ();
@@ -1005,7 +1003,6 @@ void Export::onExport ()
if (num < 1) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No items selected."));
- doc->getRoot()->c2p *= doc->getRoot()->rotation;
return;
}
@@ -1097,7 +1094,6 @@ void Export::onExport ()
if (filename.empty()) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("You have to enter a filename."));
sp_ui_error_dialog(_("You have to enter a filename"));
- doc->getRoot()->c2p *= doc->getRoot()->rotation;
return;
}
@@ -1114,7 +1110,6 @@ void Export::onExport ()
if (!((x1 > x0) && (y1 > y0) && (width > 0) && (height > 0))) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The chosen area to be exported is invalid."));
sp_ui_error_dialog(_("The chosen area to be exported is invalid"));
- doc->getRoot()->c2p *= doc->getRoot()->rotation;
return;
}
@@ -1137,7 +1132,6 @@ void Export::onExport ()
g_free(safeDir);
g_free(error);
- doc->getRoot()->c2p *= doc->getRoot()->rotation;
return;
}
@@ -1287,7 +1281,6 @@ void Export::onExport ()
}
}
}
- doc->getRoot()->c2p *= doc->getRoot()->rotation;
} // end of sp_export_export_clicked()
/// Called when Browse button is clicked
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index c5e8a6de6..646439613 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -1310,6 +1310,9 @@ void InkscapePreferences::initPageBehavior()
_steps_zoom.init ( "/options/zoomincrement/value", 101.0, 500.0, 1.0, 1.0, M_SQRT2, true, true);
_page_steps.add_line( false, _("_Zoom in/out by:"), _steps_zoom, _("%"),
_("Zoom tool click, +/- keys, and middle click zoom in and out by this multiplier"), false);
+ _steps_rotate.init ( "/options/rotateincrement/value", 1, 90, 1.0, 5.0, 15, false, false);
+ _page_steps.add_line( false, _("_Rotate canvas by:"), _steps_rotate, _("degrees"),
+ _("Rotate canvas clockwise and counter-clockwise by this amount."), false);
this->AddPage(_page_steps, _("Steps"), iter_behavior, PREFS_PAGE_BEHAVIOR_STEPS);
// Clones options
@@ -1408,6 +1411,10 @@ void InkscapePreferences::initPageRendering()
_rendering_cache_size.init("/options/renderingcache/size", 0.0, 4096.0, 1.0, 32.0, 64.0, true, false);
_page_rendering.add_line( false, _("Rendering _cache size:"), _rendering_cache_size, C_("mebibyte (2^20 bytes) abbreviation","MiB"), _("Set the amount of memory per document which can be used to store rendered parts of the drawing for later reuse; set to zero to disable caching"), false);
+ // rendering tile multiplier
+ _rendering_tile_multiplier.init("/options/rendering/tile-multiplier", 1.0, 64.0, 1.0, 4.0, 1.0, true, false);
+ _page_rendering.add_line( false, _("Rendering tile multiplier:"), _rendering_tile_multiplier, _("requires restart"), _("Set the relative size of tiles used to render the canvas. The larger the value, the bigger the tile size."), false);
+
/* blur quality */
_blur_quality_best.init ( _("Best quality (slowest)"), "/options/blurquality/value",
BLUR_QUALITY_BEST, false, 0);
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 781b5e48e..e6ba4e4b2 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -215,6 +215,7 @@ protected:
UI::Widget::PrefSpinUnit _steps_scale;
UI::Widget::PrefSpinUnit _steps_inset;
UI::Widget::PrefSpinButton _steps_zoom;
+ UI::Widget::PrefSpinButton _steps_rotate;
UI::Widget::PrefRadioButton _t_sel_trans_obj;
UI::Widget::PrefRadioButton _t_sel_trans_outl;
@@ -294,6 +295,7 @@ protected:
UI::Widget::PrefCombo _switcher_style;
UI::Widget::PrefCheckButton _rendering_image_outline;
UI::Widget::PrefSpinButton _rendering_cache_size;
+ UI::Widget::PrefSpinButton _rendering_tile_multiplier;
UI::Widget::PrefSpinButton _filter_multi_threaded;
UI::Widget::PrefCheckButton _trans_scale_stroke;
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index e5becdb5c..bb9b61504 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -19,7 +19,7 @@
#include "livepatheffect-editor.h"
#include "desktop.h"
-
+#include <gtkmm/expander.h>
#include "document.h"
#include "document-undo.h"
#include "helper/action.h"
@@ -47,16 +47,21 @@ namespace Dialog {
/*####################
* Callback functions
*/
+
+
void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data)
{
LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data);
lpeeditor->lpe_list_locked = false;
- lpeeditor->onSelectionChanged(selection, true);
+ lpeeditor->lpe_changed = true;
+ lpeeditor->onSelectionChanged(selection);
}
-static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data)
+void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data)
{
+
LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data);
+ lpeeditor->lpe_list_locked = false;
lpeeditor->onSelectionChanged(selection);
}
@@ -80,6 +85,7 @@ LivePathEffectEditor::LivePathEffectEditor()
: UI::Widget::Panel("", "/dialogs/livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT),
deskTrack(),
lpe_list_locked(false),
+ lpe_changed(true),
effectwidget(NULL),
status_label("", Gtk::ALIGN_CENTER),
effectcontrol_frame(""),
@@ -190,11 +196,22 @@ LivePathEffectEditor::~LivePathEffectEditor()
void
LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
{
- if ( ! effect.upd_params ) {
+ if (!effect.upd_params && !lpe_changed) {
+ lpe_changed = false;
return;
}
+ bool expanderopen = false;
+ Gtk::Widget * defaultswidget = effect.defaultParamSet();
if (effectwidget) {
+ if (defaultswidget) {
+ Gtk::Expander * expander = NULL;
+ std::vector<Gtk::Widget *> childs = dynamic_cast<Gtk::Box *> (effectwidget)->get_children();
+ std::vector<Gtk::Widget *> childs_default = dynamic_cast<Gtk::Box *> (childs[childs.size()-1])->get_children();
+ if ((expander = dynamic_cast<Gtk::Expander *>(childs_default[childs_default.size()-1]))){
+ expanderopen = expander->get_expanded();
+ }
+ }
effectcontrol_vbox.remove(*effectwidget);
delete effectwidget;
effectwidget = NULL;
@@ -204,6 +221,15 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
effectwidget = effect.newWidget();
if (effectwidget) {
+
+ if (defaultswidget) {
+ Gtk::Expander * expander = NULL;
+ std::vector<Gtk::Widget *> childs_default = dynamic_cast<Gtk::Box *> (defaultswidget)->get_children();
+ if ((expander = dynamic_cast<Gtk::Expander *>(childs_default[childs_default.size()-1]))){
+ expander->set_expanded(expanderopen);
+ }
+ dynamic_cast<Gtk::Box *> (effectwidget)->pack_start(*defaultswidget, true, true);
+ }
effectcontrol_vbox.pack_start(*effectwidget, true, true);
}
button_remove.show();
@@ -212,6 +238,8 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
effectcontrol_frame.show();
effectcontrol_vbox.show_all_children();
// fixme: add resizing of dialog
+ effect.upd_params = false;
+ lpe_changed = false;
}
void
@@ -254,16 +282,15 @@ LivePathEffectEditor::set_sensitize_all(bool sensitive)
}
void
-LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_params)
+LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
{
if (lpe_list_locked) {
// this was triggered by selecting a row in the list, so skip reloading
lpe_list_locked = false;
return;
}
-
- effectlist_store->clear();
current_lpeitem = NULL;
+ effectlist_store->clear();
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
@@ -278,9 +305,6 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_para
if ( lpeitem->hasPathEffect() ) {
Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE();
if (lpe) {
- if (upd_params) {
- lpe->upd_params = true;
- }
showParams(*lpe);
lpe_list_locked = true;
selectInList(lpe);
@@ -484,18 +508,12 @@ LivePathEffectEditor::onRemove()
SPItem *item = sel->singleItem();
SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
if ( lpeitem ) {
- if (current_lperef && current_lperef->lpeobject) {
- LivePathEffect::Effect * effect = current_lperef->lpeobject->get_lpe();
- if (effect) {
- effect->upd_params = true;
- }
- }
lpeitem->removeCurrentPathEffect(false);
-
+ current_lperef = NULL;
DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Remove path effect") );
-
- effect_list_reload(lpeitem);
+ lpe_list_locked = false;
+ onSelectionChanged(sel);
}
}
@@ -512,7 +530,7 @@ void LivePathEffectEditor::onUp()
DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Move path effect up") );
-
+
effect_list_reload(lpeitem);
}
}
@@ -529,7 +547,6 @@ void LivePathEffectEditor::onDown()
DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Move path effect down") );
-
effect_list_reload(lpeitem);
}
}
@@ -554,7 +571,7 @@ void LivePathEffectEditor::on_effect_selection_changed()
current_lperef = lperef;
LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe();
if (effect) {
- effect->upd_params = true;
+ lpe_changed = true;
showParams(*effect);
}
}
@@ -563,6 +580,7 @@ void LivePathEffectEditor::on_effect_selection_changed()
void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str )
{
+
Gtk::TreeModel::Children::iterator iter = effectlist_view.get_model()->get_iter(str);
Gtk::TreeModel::Row row = *iter;
diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h
index a7c749ef3..7f6f56fd2 100644
--- a/src/ui/dialog/livepatheffect-editor.h
+++ b/src/ui/dialog/livepatheffect-editor.h
@@ -45,7 +45,7 @@ public:
static LivePathEffectEditor &getInstance() { return *new LivePathEffectEditor(); }
- void onSelectionChanged(Inkscape::Selection *sel, bool upd_params = false);
+ void onSelectionChanged(Inkscape::Selection *sel);
void onSelectionModified(Inkscape::Selection *sel);
virtual void on_effect_selection_changed();
void setDesktop(SPDesktop *desktop);
@@ -96,7 +96,7 @@ private:
};
bool lpe_list_locked;
-
+ bool lpe_changed;
//Inkscape::UI::Widget::ComboBoxEnum<LivePathEffect::EffectType> combo_effecttype;
Gtk::Widget * effectwidget;
@@ -126,6 +126,7 @@ private:
LivePathEffect::LPEObjectReference * current_lperef;
friend void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data);
+ friend void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data);
LivePathEffectEditor(LivePathEffectEditor const &d);
LivePathEffectEditor& operator=(LivePathEffectEditor const &d);
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 740ff4f39..e9a13620b 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -57,7 +57,10 @@
#include <librevenge-stream/librevenge-stream.h>
using librevenge::RVNGFileStream;
+ using librevenge::RVNGString;
using librevenge::RVNGStringVector;
+ using librevenge::RVNGPropertyList;
+ using librevenge::RVNGSVGDrawingGenerator;
#else
#include <libwpd-stream/libwpd-stream.h>
@@ -451,6 +454,31 @@ void SymbolsDialog::iconChanged() {
}
#ifdef WITH_LIBVISIO
+
+#if WITH_LIBVISIO01
+// Extend libvisio's native RVNGSVGDrawingGenerator with support for extracting stencil names (to be used as ID/title)
+class REVENGE_API RVNGSVGDrawingGenerator_WithTitle : public RVNGSVGDrawingGenerator {
+ public:
+ RVNGSVGDrawingGenerator_WithTitle(RVNGStringVector &output, RVNGStringVector &titles, const RVNGString &nmSpace)
+ : RVNGSVGDrawingGenerator(output, nmSpace)
+ , _titles(titles)
+ {}
+
+ void startPage(const RVNGPropertyList &propList)
+ {
+ RVNGSVGDrawingGenerator::startPage(propList);
+ if (propList["draw:name"]) {
+ _titles.append(propList["draw:name"]->getStr());
+ } else {
+ _titles.append("");
+ }
+ }
+
+ private:
+ RVNGStringVector &_titles;
+};
+#endif
+
// Read Visio stencil files
SPDocument* read_vss( gchar* fullname, Glib::ustring name ) {
@@ -472,8 +500,9 @@ SPDocument* read_vss( gchar* fullname, Glib::ustring name ) {
}
RVNGStringVector output;
+ RVNGStringVector titles;
#if WITH_LIBVISIO01
- librevenge::RVNGSVGDrawingGenerator generator(output, "svg");
+ RVNGSVGDrawingGenerator_WithTitle generator(output, titles, "svg");
if (!libvisio::VisioDocument::parseStencils(&input, &generator)) {
#else
@@ -488,7 +517,7 @@ SPDocument* read_vss( gchar* fullname, Glib::ustring name ) {
// prepare a valid title for the symbol file
Glib::ustring title = Glib::Markup::escape_text(name);
- // prepare a valid id prefix for the symbols (unfortunately libvisio doesn't give us a name)
+ // prepare a valid id prefix for symbols libvisio doesn't give us a name for
Glib::RefPtr<Glib::Regex> regex1 = Glib::Regex::create("[^a-zA-Z0-9_-]");
Glib::ustring id = regex1->replace(name, 0, "_", Glib::REGEX_MATCH_PARTIAL);
@@ -505,25 +534,30 @@ SPDocument* read_vss( gchar* fullname, Glib::ustring name ) {
tmpSVGOutput += "</title>\n";
tmpSVGOutput += " <defs>\n";
- // Each "symbol" is in it's own SVG file, we wrap with <symbol> and merge into one file.
+ // Each "symbol" is in its own SVG file, we wrap with <symbol> and merge into one file.
for (unsigned i=0; i<output.size(); ++i) {
std::stringstream ss;
- ss << i;
+ if (titles.size() == output.size() && titles[i] != "") {
+ // TODO: Do we need to check for duplicated titles?
+ ss << regex1->replace(titles[i].cstr(), 0, "_", Glib::REGEX_MATCH_PARTIAL);
+ } else {
+ ss << id << "_" << i;
+ }
+
+ tmpSVGOutput += " <symbol id=\"" + ss.str() + "\">\n";
- tmpSVGOutput += " <symbol id=\"";
- tmpSVGOutput += id;
- tmpSVGOutput += "_";
- tmpSVGOutput += ss.str();
- tmpSVGOutput += "\">\n";
+#if WITH_LIBVISIO01
+ if (titles.size() == output.size() && titles[i] != "") {
+ tmpSVGOutput += " <title>" + Glib::ustring(RVNGString::escapeXML(titles[i].cstr()).cstr()) + "</title>\n";
+ }
+#endif
std::istringstream iss( output[i].cstr() );
std::string line;
while( std::getline( iss, line ) ) {
- // std::cout << line << std::endl;
if( line.find( "svg:svg" ) == std::string::npos ) {
- tmpSVGOutput += line;
- tmpSVGOutput += "\n";
+ tmpSVGOutput += " " + line + "\n";
}
}