summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-01-18 09:11:04 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-01-18 09:11:04 +0000
commitf12d6a57fe5cc18be5afd164061578d8e00d75ce (patch)
tree7fd1a501a8a545fbf2326ead48cd041928699c5e /src/ui
parentupdate to trunk (diff)
parentFix missing embeded image condition, kindly caught by suv in bug #1270334 (diff)
downloadinkscape-f12d6a57fe5cc18be5afd164061578d8e00d75ce.tar.gz
inkscape-f12d6a57fe5cc18be5afd164061578d8e00d75ce.zip
update to trunk
(bzr r11950.1.235)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp246
-rw-r--r--src/ui/dialog/filter-effects-dialog.h5
-rw-r--r--src/ui/dialog/new-from-template.cpp7
-rw-r--r--src/ui/dialog/new-from-template.h3
-rw-r--r--src/ui/dialog/symbols.cpp73
-rw-r--r--src/ui/dialog/symbols.h7
-rw-r--r--src/ui/dialog/template-load-tab.cpp17
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp11
-rw-r--r--src/ui/tool/path-manipulator.cpp4
-rw-r--r--src/ui/tools/gradient-tool.cpp10
-rw-r--r--src/ui/tools/text-tool.cpp1
11 files changed, 273 insertions, 111 deletions
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 38e05a1c7..6a3a4c3f1 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -47,6 +47,7 @@
#include "filters/blend.h"
#include "filters/colormatrix.h"
#include "filters/componenttransfer.h"
+#include "filters/componenttransfer-funcnode.h"
#include "filters/composite.h"
#include "filters/convolvematrix.h"
#include "filters/displacementmap.h"
@@ -369,6 +370,36 @@ public:
}
};
+// Used for tableValue in feComponentTransfer
+class EntryAttr : public Gtk::Entry, public AttrWidget
+{
+public:
+ EntryAttr(const SPAttributeEnum a, char* tip_text)
+ : AttrWidget(a)
+ {
+ signal_changed().connect(signal_attr_changed().make_slot());
+ if (tip_text) {
+ set_tooltip_text(tip_text);
+ }
+ }
+
+ // No validity checking is done
+ Glib::ustring get_as_attribute() const
+ {
+ return get_text();
+ }
+
+ void set_from_attribute(SPObject* o)
+ {
+ const gchar* val = attribute_value(o);
+ if(val) {
+ set_text( val );
+ } else {
+ set_text( "" );
+ }
+ }
+};
+
/* Displays/Edits the matrix for feConvolveMatrix or feColorMatrix */
class FilterEffectsDialog::MatrixAttr : public Gtk::Frame, public AttrWidget
{
@@ -746,7 +777,7 @@ public:
_groups[i] = new Gtk::VBox;
b.pack_start(*_groups[i], false, false);
}
- _current_type = 0;
+ //_current_type = 0; If set to 0 then update_and_show() fails to update properly.
}
~Settings()
@@ -766,9 +797,9 @@ public:
for(unsigned i = 0; i < _groups.size(); ++i)
_groups[i]->hide();
}
- if(t >= 0)
- _groups[t]->show_all();
-
+ if(t >= 0) {
+ _groups[t]->show(); // Do not use show_all(), it shows children than should be hidden
+ }
_dialog.set_attrs_locked(true);
for(unsigned i = 0; i < _attrwidgets[_current_type].size(); ++i)
_attrwidgets[_current_type][i]->set_from_attribute(ob);
@@ -800,7 +831,10 @@ public:
// LightSource
LightSourceControl* add_lightsource();
- // CheckBox
+ // Component Transfer Values
+ ComponentTransferValues* add_componenttransfervalues(const Glib::ustring& label, SPFeFuncNode::Channel channel);
+
+ // CheckButton
CheckButtonAttr* add_checkbutton(bool def, const SPAttributeEnum attr, const Glib::ustring& label,
const Glib::ustring& tv, const Glib::ustring& fv, char* tip_text = NULL)
{
@@ -938,6 +972,18 @@ public:
add_attr_widget(combo->get_attrwidget());
return combo->get_attrwidget();
}
+
+ // Entry
+ EntryAttr* add_entry(const SPAttributeEnum attr,
+ const Glib::ustring& label,
+ char* tip_text = NULL)
+ {
+ EntryAttr* entry = new EntryAttr(attr, tip_text);
+ add_widget(entry, label);
+ add_attr_widget(entry);
+ return entry;
+ }
+
private:
void add_attr_widget(AttrWidget* a)
{
@@ -973,6 +1019,154 @@ private:
int _current_type, _max_types;
};
+// Displays sliders and/or tables for feComponentTransfer
+class FilterEffectsDialog::ComponentTransferValues : public Gtk::Frame, public AttrWidget
+{
+public:
+ ComponentTransferValues(FilterEffectsDialog& d, SPFeFuncNode::Channel channel)
+ : AttrWidget(SP_ATTR_INVALID),
+ _dialog(d),
+ _settings(d, _box, sigc::mem_fun(*this, &ComponentTransferValues::set_func_attr), COMPONENTTRANSFER_TYPE_ERROR),
+ _type(ComponentTransferTypeConverter, SP_ATTR_TYPE, false),
+ _channel(channel),
+ _funcNode(NULL)
+ {
+ set_shadow_type(Gtk::SHADOW_IN);
+ add(_box);
+ _box.add(_type);
+ _box.reorder_child(_type, 0);
+ _type.signal_changed().connect(sigc::mem_fun(*this, &ComponentTransferValues::on_type_changed));
+
+ _settings.type(COMPONENTTRANSFER_TYPE_LINEAR);
+ _settings.add_spinscale(1, SP_ATTR_SLOPE, _("Slope"), -10, 10, 0.1, 0.01, 2);
+ _settings.add_spinscale(0, SP_ATTR_INTERCEPT, _("Intercept"), -10, 10, 0.1, 0.01, 2);
+
+ _settings.type(COMPONENTTRANSFER_TYPE_GAMMA);
+ _settings.add_spinscale(1, SP_ATTR_AMPLITUDE, _("Amplitude"), 0, 10, 0.1, 0.01, 2);
+ _settings.add_spinscale(1, SP_ATTR_EXPONENT, _("Exponent"), 0, 10, 0.1, 0.01, 2);
+ _settings.add_spinscale(0, SP_ATTR_OFFSET, _("Offset"), -10, 10, 0.1, 0.01, 2);
+
+ _settings.type(COMPONENTTRANSFER_TYPE_TABLE);
+ _settings.add_entry(SP_ATTR_TABLEVALUES, _("Table"));
+
+ _settings.type(COMPONENTTRANSFER_TYPE_DISCRETE);
+ _settings.add_entry(SP_ATTR_TABLEVALUES, _("Discrete"));
+
+ //_settings.type(COMPONENTTRANSFER_TYPE_IDENTITY);
+ _settings.type(-1); // Force update_and_show() to show/hide windows correctly
+ }
+
+ // FuncNode can be in any order so we must search to find correct one.
+ SPFeFuncNode* find_node(SPFeComponentTransfer* ct)
+ {
+ SPObject* node = ct->children;
+ SPFeFuncNode* funcNode = NULL;
+ bool found = false;
+ for(;node;node=node->next){
+ funcNode = SP_FEFUNCNODE(node);
+ if( funcNode->channel == _channel ) {
+ found = true;
+ break;
+ }
+ }
+ if( !found )
+ funcNode = NULL;
+
+ return funcNode;
+ }
+
+ void set_func_attr(const AttrWidget* input)
+ {
+ _dialog.set_attr( _funcNode, input->get_attribute(), input->get_as_attribute().c_str());
+ }
+
+ // Set new type and update widget visibility
+ virtual void set_from_attribute(SPObject* o)
+ {
+ // See componenttransfer.cpp
+ if(SP_IS_FECOMPONENTTRANSFER(o)) {
+ SPFeComponentTransfer* ct = SP_FECOMPONENTTRANSFER(o);
+
+ _funcNode = find_node(ct);
+ if( _funcNode ) {
+ _type.set_from_attribute( _funcNode );
+ } else {
+ // Create <funcNode>
+ SPFilterPrimitive* prim = _dialog._primitive_list.get_selected();
+ if(prim) {
+ Inkscape::XML::Document *xml_doc = prim->document->getReprDoc();
+ Inkscape::XML::Node *repr = NULL;
+ switch(_channel) {
+ case SPFeFuncNode::R:
+ repr = xml_doc->createElement("svg:feFuncR");
+ break;
+ case SPFeFuncNode::G:
+ repr = xml_doc->createElement("svg:feFuncG");
+ break;
+ case SPFeFuncNode::B:
+ repr = xml_doc->createElement("svg:feFuncB");
+ break;
+ case SPFeFuncNode::A:
+ repr = xml_doc->createElement("svg:feFuncA");
+ break;
+ }
+
+ //XML Tree being used directly here while it shouldn't be.
+ prim->getRepr()->appendChild(repr);
+ Inkscape::GC::release(repr);
+
+ // Now we should find it!
+ _funcNode = find_node(ct);
+ if( _funcNode ) {
+ _funcNode->setAttribute( "type", "identity" );
+ } else {
+ //std::cout << "ERROR ERROR: feFuncX not found!" << std::endl;
+ }
+ }
+ }
+
+ update();
+ }
+ }
+
+private:
+ void on_type_changed()
+ {
+ SPFilterPrimitive* prim = _dialog._primitive_list.get_selected();
+ if(prim) {
+
+ _funcNode->getRepr()->setAttribute( "type", _type.get_as_attribute().c_str() );
+
+ SPFilter* filter = _dialog._filter_modifier.get_selected_filter();
+ filter->requestModified(SP_OBJECT_MODIFIED_FLAG);
+
+ DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("New transfer function type"));
+ update();
+ }
+ }
+
+ void update()
+ {
+ SPFilterPrimitive* prim = _dialog._primitive_list.get_selected();
+ if(prim && _funcNode) {
+ _settings.show_and_update(_type.get_active_data()->id, _funcNode);
+ }
+ }
+
+public:
+ virtual Glib::ustring get_as_attribute() const
+ {
+ return "";
+ }
+
+ FilterEffectsDialog& _dialog;
+ Gtk::VBox _box;
+ Settings _settings;
+ ComboBoxEnum<FilterComponentTransferType> _type;
+ SPFeFuncNode::Channel _channel; // RGBA
+ SPFeFuncNode* _funcNode;
+};
+
// Settings for the three light source objects
class FilterEffectsDialog::LightSourceControl : public AttrWidget
{
@@ -1012,6 +1206,9 @@ public:
_settings.add_spinscale(1, SP_ATTR_SPECULAREXPONENT, _("Specular Exponent"), 1, 100, 1, 1, 0, _("Exponent value controlling the focus for the light source"));
//TODO: here I have used 100 degrees as default value. But spec says that if not specified, no limiting cone is applied. So, there should be a way for the user to set a "no limiting cone" option.
_settings.add_spinscale(100, SP_ATTR_LIMITINGCONEANGLE, _("Cone Angle"), 1, 100, 1, 1, 0, _("This is the angle between the spot light axis (i.e. the axis between the light source and the point to which it is pointing at) and the spot light cone. No light is projected outside this cone."));
+
+ _settings.type(-1); // Force update_and_show() to show/hide windows correctly
+
}
Gtk::VBox& get_box()
@@ -1102,6 +1299,16 @@ private:
bool _locked;
};
+ // ComponentTransferValues
+FilterEffectsDialog::ComponentTransferValues* FilterEffectsDialog::Settings::add_componenttransfervalues(const Glib::ustring& label, SPFeFuncNode::Channel channel)
+ {
+ ComponentTransferValues* ct = new ComponentTransferValues(_dialog, channel);
+ add_widget(ct, label);
+ add_attr_widget(ct);
+ return ct;
+ }
+
+
FilterEffectsDialog::LightSourceControl* FilterEffectsDialog::Settings::add_lightsource()
{
LightSourceControl* ls = new LightSourceControl(_dialog);
@@ -2527,7 +2734,6 @@ FilterEffectsDialog::FilterEffectsDialog()
_sizegroup->set_ignore_hidden();
_add_primitive_type.remove_row(NR_FILTER_TILE);
- _add_primitive_type.remove_row(NR_FILTER_COMPONENTTRANSFER);
// Initialize widget hierarchy
#if WITH_GTKMM_3_0
@@ -2629,15 +2835,10 @@ void FilterEffectsDialog::init_settings_widgets()
colmat->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::update_color_matrix));
_settings->type(NR_FILTER_COMPONENTTRANSFER);
- _settings->add_notimplemented();
- /*
- //TRANSLATORS: for info on "Slope" and "Intercept", see http://id.mind.net/~zona/mmts/functionInstitute/linearFunctions/lsif.html
- _settings->add_combo(COMPONENTTRANSFER_TYPE_IDENTITY, SP_ATTR_TYPE, _("Type"), ComponentTransferTypeConverter);
- _ct_slope = _settings->add_spinscale(1, SP_ATTR_SLOPE, _("Slope"), -10, 10, 0.1, 0.01, 2);
- _ct_intercept = _settings->add_spinscale(0, SP_ATTR_INTERCEPT, _("Intercept"), -10, 10, 0.1, 0.01, 2);
- _ct_amplitude = _settings->add_spinscale(1, SP_ATTR_AMPLITUDE, _("Amplitude"), 0, 10, 0.1, 0.01, 2);
- _ct_exponent = _settings->add_spinscale(1, SP_ATTR_EXPONENT, _("Exponent"), 0, 10, 0.1, 0.01, 2);
- _ct_offset = _settings->add_spinscale(0, SP_ATTR_OFFSET, _("Offset"), -10, 10, 0.1, 0.01, 2);*/
+ _settings->add_componenttransfervalues(_("R:"), SPFeFuncNode::R);
+ _settings->add_componenttransfervalues(_("G:"), SPFeFuncNode::G);
+ _settings->add_componenttransfervalues(_("B:"), SPFeFuncNode::B);
+ _settings->add_componenttransfervalues(_("A:"), SPFeFuncNode::A);
_settings->type(NR_FILTER_COMPOSITE);
_settings->add_combo(COMPOSITE_OVER, SP_ATTR_OPERATOR, _("Operator:"), CompositeOperatorConverter);
@@ -2953,21 +3154,6 @@ void FilterEffectsDialog::update_settings_sensitivity()
_k3->set_sensitive(use_k);
_k4->set_sensitive(use_k);
-// Component transfer not yet implemented
-/*
- if(SP_IS_FECOMPONENTTRANSFER(prim)) {
- SPFeComponentTransfer* ct = SP_FECOMPONENTTRANSFER(prim);
- const bool linear = ct->type == COMPONENTTRANSFER_TYPE_LINEAR;
- const bool gamma = ct->type == COMPONENTTRANSFER_TYPE_GAMMA;
-
- _ct_table->set_sensitive(ct->type == COMPONENTTRANSFER_TYPE_TABLE || ct->type == COMPONENTTRANSFER_TYPE_DISCRETE);
- _ct_slope->set_sensitive(linear);
- _ct_intercept->set_sensitive(linear);
- _ct_amplitude->set_sensitive(gamma);
- _ct_exponent->set_sensitive(gamma);
- _ct_offset->set_sensitive(gamma);
- }
-*/
}
void FilterEffectsDialog::update_color_matrix()
diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h
index a2a2a3c6e..ccf79e60d 100644
--- a/src/ui/dialog/filter-effects-dialog.h
+++ b/src/ui/dialog/filter-effects-dialog.h
@@ -282,6 +282,7 @@ private:
class Settings;
class MatrixAttr;
class ColorMatrixValues;
+ class ComponentTransferValues;
class LightSourceControl;
Settings* _settings;
Settings* _filter_general_settings;
@@ -290,6 +291,9 @@ private:
// Color Matrix
ColorMatrixValues* _color_matrix_values;
+ // Component Transfer
+ ComponentTransferValues* _component_transfer_values;
+
// Convolve Matrix
MatrixAttr* _convolve_matrix;
DualSpinButton* _convolve_order;
@@ -297,7 +301,6 @@ private:
// For controlling setting sensitivity
Gtk::Widget* _k1, *_k2, *_k3, *_k4;
- Gtk::Widget* _ct_table, *_ct_slope, *_ct_intercept, *_ct_amplitude, *_ct_exponent, *_ct_offset;
// To prevent unwanted signals
bool _locked;
diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp
index 177f15195..71d1c22d0 100644
--- a/src/ui/dialog/new-from-template.cpp
+++ b/src/ui/dialog/new-from-template.cpp
@@ -44,10 +44,13 @@ NewFromTemplate::NewFromTemplate()
void NewFromTemplate::_createFromTemplate()
{
_main_widget.createTemplate();
-
- response(0);
+ _onClose();
}
+void NewFromTemplate::_onClose()
+{
+ response(0);
+}
void NewFromTemplate::load_new_from_template()
{
diff --git a/src/ui/dialog/new-from-template.h b/src/ui/dialog/new-from-template.h
index 8ebcb2863..2b40af2a6 100644
--- a/src/ui/dialog/new-from-template.h
+++ b/src/ui/dialog/new-from-template.h
@@ -23,6 +23,8 @@ namespace UI {
class NewFromTemplate : public Gtk::Dialog
{
+
+friend class TemplateLoadTab;
public:
static void load_new_from_template();
@@ -32,6 +34,7 @@ private:
TemplateLoadTab _main_widget;
void _createFromTemplate();
+ void _onClose();
};
}
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index fb353fec1..c33920117 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -38,6 +38,7 @@
#include <gtkmm/liststore.h>
#include <gtkmm/treemodelcolumn.h>
#include <gtkmm/clipboard.h>
+#include <glibmm/stringutils.h>
#include <glibmm/i18n.h>
#include "path-prefix.h"
@@ -73,8 +74,6 @@
namespace Inkscape {
namespace UI {
-static Cache::SvgPreview svg_preview_cache;
-
namespace Dialog {
// See: http://developer.gnome.org/gtkmm/stable/classGtk_1_1TreeModelColumnRecord.html
@@ -276,7 +275,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
instanceConns.push_back(documentReplacedConn);
get_symbols();
- draw_symbols( currentDocument ); /* Defaults to current document */
+ add_symbols( currentDocument ); /* Defaults to current document */
sigc::connection desktopChangeConn =
deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &SymbolsDialog::setTargetDesktop) );
@@ -329,7 +328,7 @@ void SymbolsDialog::rebuild() {
addSymbol->set_sensitive( false );
removeSymbol->set_sensitive( false );
}
- draw_symbols( symbolDocument );
+ add_symbols( symbolDocument );
}
void SymbolsDialog::insertSymbol() {
@@ -540,7 +539,8 @@ void SymbolsDialog::get_symbols() {
gchar *fullname = g_build_filename((*it).c_str(), filename, NULL);
- if ( !Inkscape::IO::file_test( fullname, G_FILE_TEST_IS_DIR ) ) {
+ if ( !Inkscape::IO::file_test( fullname, G_FILE_TEST_IS_DIR )
+ && ( Glib::str_has_suffix(fullname, ".svg") || Glib::str_has_suffix(fullname, ".vss") ) ) {
Glib::ustring fn( filename );
Glib::ustring tag = fn.substr( fn.find_last_of(".") + 1 );
@@ -562,7 +562,7 @@ void SymbolsDialog::get_symbols() {
symbol_doc = SPDocument::createNewDoc( fullname, FALSE );
if( symbol_doc ) {
- gchar *title = symbol_doc->getRoot()->title();
+ const gchar *title = g_dpgettext2(NULL, "Symbol", symbol_doc->getRoot()->title());
if( title == NULL ) {
title = _("Unnamed Symbols");
}
@@ -651,18 +651,18 @@ gchar const* SymbolsDialog::style_from_use( gchar const* id, SPDocument* documen
return style;
}
-void SymbolsDialog::draw_symbols( SPDocument* symbolDocument ) {
+void SymbolsDialog::add_symbols( SPDocument* symbolDocument ) {
GSList* l = symbols_in_doc( symbolDocument );
for( ; l != NULL; l = l->next ) {
SPObject* symbol = SP_OBJECT(l->data);
if (SP_IS_SYMBOL(symbol)) {
- draw_symbol( symbol );
+ add_symbol( symbol );
}
}
}
-void SymbolsDialog::draw_symbol( SPObject* symbol ) {
+void SymbolsDialog::add_symbol( SPObject* symbol ) {
SymbolColumns* columns = getColumns();
@@ -672,12 +672,12 @@ void SymbolsDialog::draw_symbol( SPObject* symbol ) {
title = id;
}
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = create_symbol_image(id, symbol );
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = draw_symbol( symbol );
if( pixbuf ) {
Gtk::ListStore::iterator row = store->append();
(*row)[columns->symbol_id] = Glib::ustring( id );
- (*row)[columns->symbol_title] = Glib::ustring( title );
+ (*row)[columns->symbol_title] = Glib::ustring( g_dpgettext2(NULL, "Symbol", title) );
(*row)[columns->symbol_image] = pixbuf;
}
@@ -694,7 +694,7 @@ void SymbolsDialog::draw_symbol( SPObject* symbol ) {
* the temporary document is rendered.
*/
Glib::RefPtr<Gdk::Pixbuf>
-SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol)
+SymbolsDialog::draw_symbol(SPObject *symbol)
{
// Create a copy repr of the symbol with id="the_symbol"
Inkscape::XML::Document *xml_doc = previewDocument->getReprDoc();
@@ -713,7 +713,8 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol)
if( !style ) {
// If no default style in <symbol>, look in documents.
if( symbol->document == currentDocument ) {
- style = style_from_use( symbol_id, symbol->document );
+ gchar const *id = symbol->getRepr()->attribute("id");
+ style = style_from_use( id, symbol->document );
} else {
style = symbol->document->getReprRoot()->attribute("style");
}
@@ -722,9 +723,7 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol)
if( !style ) style = "fill:#bbbbbb;stroke:#808080";
// This is for display in Symbols dialog only
- if( style ) {
- repr->setAttribute( "style", style );
- }
+ if( style ) repr->setAttribute( "style", style );
// BUG: Symbols don't work if defined outside of <defs>. Causes Inkscape
// crash when trying to read in such a file.
@@ -733,7 +732,7 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol)
Inkscape::GC::release(repr);
// Uncomment this to get the previewDocument documents saved (useful for debugging)
- // FILE *fp = fopen (g_strconcat(symbol_id, ".svg", NULL), "w");
+ // FILE *fp = fopen (g_strconcat(id, ".svg", NULL), "w");
// sp_repr_save_stream(previewDocument->getReprDoc(), fp);
// fclose (fp);
@@ -746,55 +745,31 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol)
previewDocument->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
previewDocument->ensureUpToDate();
- // if( object_temp == NULL || !SP_IS_ITEM(object_temp) ) {
- // //std::cout << " previewDocument broken?" << std::endl;
- // //return 0;
- // }
-
SPItem *item = SP_ITEM(object_temp);
-
unsigned psize = SYMBOL_ICON_SIZES[in_sizes];
- /* Update to renderable state */
- Glib::ustring key = svg_preview_cache.cache_key(previewDocument->getURI(), symbol_id, psize);
- //std::cout << " Key: " << key << std::endl;
-
Glib::RefPtr<Gdk::Pixbuf> pixbuf(NULL);
- GdkPixbuf *pixbuf_gobj = svg_preview_cache.get_preview_from_cache(key);
- if (pixbuf_gobj) {
- g_object_ref(pixbuf_gobj); // the reference in svg_preview_cache will get destroyed when it's freed
- pixbuf = Glib::wrap(pixbuf_gobj);
- }
+ // We could use cache here, but it doesn't really work with the structure
+ // of this user interface and we've already cached the pixbuf in the gtklist
// Find object's bbox in document.
// Note symbols can have own viewport... ignore for now.
//Geom::OptRect dbox = item->geometricBounds();
Geom::OptRect dbox = item->documentVisualBounds();
- if (!dbox) {
- //std::cout << " No dbox" << std::endl;
- return pixbuf;
- }
-
- if (!pixbuf) {
+ if (dbox) {
/* Scale symbols to fit */
double scale = 1.0;
double width = dbox->width();
double height = dbox->height();
- if( width == 0.0 ) {
- width = 1.0;
- }
- if( height == 0.0 ) {
- height = 1.0;
- }
- if( fitSymbol->get_active() ) {
- /* Fit */
- scale = psize/std::max(width,height);
- }
+ if( width == 0.0 ) width = 1.0;
+ if( height == 0.0 ) height = 1.0;
+
+ if( fitSymbol->get_active() )
+ scale = psize / std::max(width, height);
pixbuf = Glib::wrap(render_pixbuf(renderDrawing, scale, *dbox, psize));
- svg_preview_cache.set_preview_in_cache(key, pixbuf->gobj());
}
return pixbuf;
diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h
index 074af6764..8021fb0c1 100644
--- a/src/ui/dialog/symbols.h
+++ b/src/ui/dialog/symbols.h
@@ -79,8 +79,8 @@ private:
void iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time);
void get_symbols();
- void draw_symbols( SPDocument* symbol_document );
- void draw_symbol( SPObject* symbol_document );
+ void add_symbols( SPDocument* symbol_document );
+ void add_symbol( SPObject* symbol_document );
SPDocument* symbols_preview_doc();
GSList* symbols_in_doc_recursive(SPObject *r, GSList *l);
@@ -89,8 +89,7 @@ private:
GSList* use_in_doc( SPDocument* document );
gchar const* style_from_use( gchar const* id, SPDocument* document);
- Glib::RefPtr<Gdk::Pixbuf>
- create_symbol_image(gchar const *symbol_name, SPObject *symbol);
+ Glib::RefPtr<Gdk::Pixbuf> draw_symbol(SPObject *symbol);
/* Keep track of all symbol template documents */
std::map<Glib::ustring, SPDocument*> symbolSets;
diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp
index 057eff337..4f2d51ef7 100644
--- a/src/ui/dialog/template-load-tab.cpp
+++ b/src/ui/dialog/template-load-tab.cpp
@@ -10,6 +10,7 @@
#include "template-widget.h"
#include "template-load-tab.h"
+#include "new-from-template.h"
#include <gtkmm/messagedialog.h>
#include <gtkmm/scrolledwindow.h>
@@ -31,10 +32,8 @@
#include "xml/document.h"
#include "xml/node.h"
-
namespace Inkscape {
namespace UI {
-
TemplateLoadTab::TemplateLoadTab()
: _current_keyword("")
@@ -84,7 +83,9 @@ void TemplateLoadTab::createTemplate()
void TemplateLoadTab::_onRowActivated(const Gtk::TreeModel::Path &, Gtk::TreeViewColumn*)
{
- _info_widget->create();
+ createTemplate();
+ NewFromTemplate* parent = static_cast<NewFromTemplate*> (this->get_toplevel());
+ parent->_onClose();
}
void TemplateLoadTab::_displayTemplateInfo()
@@ -290,26 +291,26 @@ void TemplateLoadTab::_getDataFromNode(Inkscape::XML::Node *dataNode, TemplateDa
{
Inkscape::XML::Node *currentData;
if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_name")) != NULL)
- data.display_name = dgettext("Document template name", currentData->firstChild()->content());
+ data.display_name = _(currentData->firstChild()->content());
if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:author")) != NULL)
data.author = currentData->firstChild()->content();
if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_shortdesc")) != NULL)
- data.short_description = dgettext("Document template short description", currentData->firstChild()->content());
+ data.short_description = _( currentData->firstChild()->content());
if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_long") )!= NULL)
- data.long_description = dgettext("Document template long description", currentData->firstChild()->content());
+ data.long_description = _(currentData->firstChild()->content());
if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:preview")) != NULL)
data.preview_name = currentData->firstChild()->content();
if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:date")) != NULL)
data.creation_date = currentData->firstChild()->content();
if ((currentData = sp_repr_lookup_name(dataNode, "inkscape:_keywords")) != NULL){
- Glib::ustring tplKeywords = currentData->firstChild()->content();
+ Glib::ustring tplKeywords = _(currentData->firstChild()->content());
while (!tplKeywords.empty()){
std::size_t pos = tplKeywords.find_first_of(" ");
if (pos == Glib::ustring::npos)
pos = tplKeywords.size();
- Glib::ustring keyword = dgettext("Document template keyword", tplKeywords.substr(0, pos).data());
+ Glib::ustring keyword = tplKeywords.substr(0, pos).data();
data.keywords.insert(keyword.lowercase());
_keywords.insert(keyword.lowercase());
diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp
index c77d2d795..b7f3ac29b 100644
--- a/src/ui/tool/multi-path-manipulator.cpp
+++ b/src/ui/tool/multi-path-manipulator.cpp
@@ -30,17 +30,6 @@
#include <gdk/gdkkeysyms.h>
-#ifdef USE_GNU_HASHES
-namespace __gnu_cxx {
-template<>
-struct hash<Inkscape::UI::NodeList::iterator> {
- size_t operator()(Inkscape::UI::NodeList::iterator const &n) const {
- return reinterpret_cast<size_t>(n.ptr());
- }
-};
-} // namespace __gnu_cxx
-#endif // USE_GNU_HASHES
-
namespace Inkscape {
namespace UI {
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 8a0568fbd..7bbe39f8d 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -18,7 +18,7 @@
#include <boost/shared_ptr.hpp>
#include <2geom/bezier-curve.h>
#include <2geom/bezier-utils.h>
-#include <2geom/svg-path.h>
+#include <2geom/path-sink.h>
#include <glibmm/i18n.h>
#include "ui/tool/path-manipulator.h"
#include "desktop.h"
@@ -1308,7 +1308,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE)
}
++spi;
}
- builder.finish();
+ builder.flush();
Geom::PathVector pathv = builder.peek() * (_edit_transform * _i2d_transform).inverse();
_spcurve->set_pathvector(pathv);
if (alert_LPE) {
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index e4ab7b424..10f78a8a8 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -339,10 +339,12 @@ sp_gradient_context_add_stops_between_selected_stops (GradientTool *rc)
SPGradient *gradient = getGradient(d->item, d->fill_or_stroke);
SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (gradient, false);
SPStop *this_stop = sp_get_stop_i (vector, d->point_i);
- SPStop *next_stop = this_stop->getNextStop();
- if (this_stop && next_stop) {
- these_stops = g_slist_prepend (these_stops, this_stop);
- next_stops = g_slist_prepend (next_stops, next_stop);
+ if (this_stop) {
+ SPStop *next_stop = this_stop->getNextStop();
+ if (next_stop) {
+ these_stops = g_slist_prepend (these_stops, this_stop);
+ next_stops = g_slist_prepend (next_stops, next_stop);
+ }
}
}
}
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index 2927606a7..c73164c09 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -154,6 +154,7 @@ void TextTool::setup() {
this->indicator = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL);
SP_CTRLRECT(this->indicator)->setRectangle(Geom::Rect(Geom::Point(0, 0), Geom::Point(100, 100)));
SP_CTRLRECT(this->indicator)->setColor(0x0000ff7f, false, 0);
+ SP_CTRLRECT(this->indicator)->setShadow(1, 0xffffff7f);
sp_canvas_item_hide(this->indicator);
this->frame = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL);