summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2015-05-22 07:02:44 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2015-05-22 07:02:44 +0000
commit35d94a8e1c01cd60e4fcf4c15f46fee38c765fca (patch)
treed8366acd729a6a9d4bdc1001f050a43f30d8b7ad /src/extension
parentUndo changes to CMakeLists.txt in 2geom directory after syncs (diff)
parentminor tweaks to libUEMF and related code (diff)
downloadinkscape-35d94a8e1c01cd60e4fcf4c15f46fee38c765fca.tar.gz
inkscape-35d94a8e1c01cd60e4fcf4c15f46fee38c765fca.zip
Merge from trunk
(bzr r14059.2.15)
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/CMakeLists.txt22
-rw-r--r--src/extension/internal/cairo-render-context.cpp17
-rw-r--r--src/extension/internal/emf-print.cpp8
-rw-r--r--src/extension/internal/filter/color.h2
-rw-r--r--src/extension/internal/text_reassemble.c12
-rw-r--r--src/extension/internal/wmf-inout.cpp6
-rw-r--r--src/extension/internal/wmf-print.cpp4
-rw-r--r--src/extension/param/color.cpp71
-rw-r--r--src/extension/param/color.h9
-rw-r--r--src/extension/param/parameter.cpp7
10 files changed, 83 insertions, 75 deletions
diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt
index d1104f3cc..21e652563 100644
--- a/src/extension/CMakeLists.txt
+++ b/src/extension/CMakeLists.txt
@@ -36,7 +36,6 @@ set(extension_SRC
internal/cairo-render-context.cpp
internal/cairo-renderer.cpp
internal/cairo-renderer-pdf-out.cpp
- internal/cdr-input.cpp
internal/emf-inout.cpp
internal/emf-print.cpp
internal/gdkpixbuf-input.cpp
@@ -54,10 +53,8 @@ set(extension_SRC
internal/svg.cpp
internal/svgz.cpp
internal/text_reassemble.c
- internal/vsd-input.cpp
internal/wmf-inout.cpp
internal/wmf-print.cpp
- internal/wpg-input.cpp
internal/filter/filter-all.cpp
internal/filter/filter-file.cpp
@@ -104,7 +101,6 @@ set(extension_SRC
internal/cairo-render-context.h
internal/cairo-renderer-pdf-out.h
internal/cairo-renderer.h
- internal/cdr-input.h
internal/clear-n_.h
internal/emf-inout.h
internal/emf-print.h
@@ -140,10 +136,8 @@ set(extension_SRC
internal/svg.h
internal/svgz.h
internal/text_reassemble.h
- internal/vsd-input.h
internal/wmf-inout.h
internal/wmf-print.h
- internal/wpg-input.h
)
if(WIN32)
@@ -151,6 +145,20 @@ if(WIN32)
)
endif()
+if(WITH_LIBCDR)
+ list(APPEND extension_SRC
+ internal/cdr-input.cpp
+ internal/cdr-input.h
+ )
+endif()
+
+if(WITH_LIBVISIO)
+ list(APPEND extension_SRC
+ internal/vsd-input.cpp
+ internal/vsd-input.h
+ )
+endif()
+
if(WITH_LIBWPG)
list(APPEND extension_SRC
internal/wpg-input.cpp
@@ -158,7 +166,7 @@ if(WITH_LIBWPG)
)
endif()
-if(ImageMagick_FOUND)
+if(WITH_IMAGE_MAGICK)
list(APPEND extension_SRC
internal/bitmap/adaptiveThreshold.cpp
internal/bitmap/adaptiveThreshold.h
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 27e34dbcf..c3e416184 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -1008,17 +1008,16 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
ps2user = Geom::identity();
pcs2dev = Geom::identity();
- double x = pattern_x(pat);
- double y = pattern_y(pat);
- double width = pattern_width(pat);
- double height = pattern_height(pat);
+ double x = pat->x();
+ double y = pat->y();
+ double width = pat->width();
+ double height = pat->height();
double bbox_width_scaler;
double bbox_height_scaler;
TRACE(("%f x %f pattern\n", width, height));
- if (pbox && pattern_patternUnits(pat) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) {
- //Geom::Affine bbox2user (pbox->x1 - pbox->x0, 0.0, 0.0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
+ if (pbox && pat->patternUnits() == SPPattern::UNITS_OBJECTBOUNDINGBOX) {
bbox_width_scaler = pbox->width();
bbox_height_scaler = pbox->height();
ps2user[4] = x * bbox_width_scaler + pbox->left();
@@ -1031,13 +1030,13 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
}
// apply pattern transformation
- Geom::Affine pattern_transform(pattern_patternTransform(pat));
+ Geom::Affine pattern_transform(pat->getTransform());
ps2user *= pattern_transform;
Geom::Point ori (ps2user[4], ps2user[5]);
// create pattern contents coordinate system
if (pat->viewBox_set) {
- Geom::Rect view_box = *pattern_viewBox(pat);
+ Geom::Rect view_box = *pat->viewbox();
double x, y, w, h;
x = 0;
@@ -1050,7 +1049,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver
pcs2dev[3] = h / view_box.height();
pcs2dev[4] = x - view_box.left() * pcs2dev[0];
pcs2dev[5] = y - view_box.top() * pcs2dev[3];
- } else if (pbox && pattern_patternContentUnits(pat) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) {
+ } else if (pbox && pat->patternContentUnits() == SPPattern::UNITS_OBJECTBOUNDINGBOX) {
pcs2dev[0] = pbox->width();
pcs2dev[3] = pbox->height();
}
diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp
index 7c514d6e7..5b8aae655 100644
--- a/src/extension/internal/emf-print.cpp
+++ b/src/extension/internal/emf-print.cpp
@@ -388,8 +388,8 @@ int PrintEmf::create_brush(SPStyle const *style, PU_COLORREF fcolor)
} else if (SP_IS_PATTERN(SP_STYLE_FILL_SERVER(style))) { // must be paint-server
SPPaintServer *paintserver = style->fill.value.href->getObject();
SPPattern *pat = SP_PATTERN(paintserver);
- double dwidth = pattern_width(pat);
- double dheight = pattern_height(pat);
+ double dwidth = pat->width();
+ double dheight = pat->height();
width = dwidth;
height = dheight;
brush_classify(pat, 0, &pixbuf, &hatchType, &hatchColor, &bkColor);
@@ -573,8 +573,8 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform)
if (SP_IS_PATTERN(SP_STYLE_STROKE_SERVER(style))) { // must be paint-server
SPPaintServer *paintserver = style->stroke.value.href->getObject();
SPPattern *pat = SP_PATTERN(paintserver);
- double dwidth = pattern_width(pat);
- double dheight = pattern_height(pat);
+ double dwidth = pat->width();
+ double dheight = pat->height();
width = dwidth;
height = dheight;
brush_classify(pat, 0, &pixbuf, &hatchType, &hatchColor, &bkColor);
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index c3c26bf8b..b9c76615c 100644
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -258,7 +258,7 @@ public:
"<param name=\"type\" gui-text=\"" N_("Blindness type:") "\" type=\"enum\">\n"
"<_item value=\"0.618 0.32 0.062 0 0 0.163 0.775 0.062 0 0 0.163 0.32 0.516 0 0 0 0 0 1 0 \">" N_("Rod monochromacy (atypical achromatopsia)") "</_item>\n"
"<_item value=\"0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0 0 0 1 0 \">" N_("Cone monochromacy (typical achromatopsia)") "</_item>\n"
- "<_item value=\"0.8 0.2 0 0 0 0.2583 0.74167 0 0 0 0 0.14167 0.85833 0 0 0 0 0 1 0 \">" N_("Geen weak (deuteranomaly)") "</_item>\n"
+ "<_item value=\"0.8 0.2 0 0 0 0.2583 0.74167 0 0 0 0 0.14167 0.85833 0 0 0 0 0 1 0 \">" N_("Green weak (deuteranomaly)") "</_item>\n"
"<_item value=\"0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0 \">" N_("Green blind (deuteranopia)") "</_item>\n"
"<_item value=\"0.8166 0.1833 0 0 0 0.333 0.666 0 0 0 0 0.125 0.875 0 0 0 0 0 1 0 \">" N_("Red weak (protanomaly)") "</_item>\n"
"<_item value=\"0.566 0.43333 0 0 0 0.55833 0.4416 0 0 0 0 0.24167 0.75833 0 0 0 0 0 1 0 \">" N_("Red blind (protanopia)") "</_item>\n"
diff --git a/src/extension/internal/text_reassemble.c b/src/extension/internal/text_reassemble.c
index d3aafef12..fa983b83d 100644
--- a/src/extension/internal/text_reassemble.c
+++ b/src/extension/internal/text_reassemble.c
@@ -67,8 +67,8 @@ Optional compiler switches for development:
File: text_reassemble.c
-Version: 0.0.16
-Date: 25-FEB-2015
+Version: 0.0.17
+Date: 21-MAY-2015
Author: David Mathog, Biology Division, Caltech
email: mathog@caltech.edu
Copyright: 2015 David Mathog and California Institute of Technology (Caltech)
@@ -2204,10 +2204,10 @@ void TR_layout_2_svg(TR_INFO *tri){
sprintf(obuf,"text-decoration:");
/* multiple text decoration styles may be set */
utmp = tsp->decoration & TXTDECOR_TMASK;
- if(utmp & TXTDECOR_UNDER ){ strcat(obuf,"underline"); }
- if(utmp & TXTDECOR_OVER ){ strcat(obuf,"overline"); }
- if(utmp & TXTDECOR_BLINK ){ strcat(obuf,"blink"); }
- if(utmp & TXTDECOR_STRIKE){ strcat(obuf,"line-through");}
+ if(utmp & TXTDECOR_UNDER ){ strcat(obuf," underline"); }
+ if(utmp & TXTDECOR_OVER ){ strcat(obuf," overline"); }
+ if(utmp & TXTDECOR_BLINK ){ strcat(obuf," blink"); }
+ if(utmp & TXTDECOR_STRIKE){ strcat(obuf," line-through");}
if(*obuf){
/* only a single text decoration line type may be set */
switch(tsp->decoration & TXTDECOR_LMASK){
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index f76fa16b4..d17180d91 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -449,7 +449,8 @@ uint32_t Wmf::add_dib_image(PWMF_CALLBACK_DATA d, const char *dib, uint32_t iUsa
char *rgba_px = NULL; // RGBA pixels
const char *px = NULL; // DIB pixels
const U_RGBQUAD *ct = NULL; // DIB color table
- int32_t width, height, colortype, numCt, invert; // if needed these values will be set by wget_DIB_params
+ uint32_t numCt;
+ int32_t width, height, colortype, invert; // if needed these values will be set by wget_DIB_params
if(iUsage == U_DIB_RGB_COLORS){
// next call returns pointers and values, but allocates no memory
dibparams = wget_DIB_params(dib, &px, &ct, &numCt, &width, &height, &colortype, &invert);
@@ -1318,7 +1319,8 @@ void Wmf::common_dib_to_image(PWMF_CALLBACK_DATA d, const char *dib,
char *sub_px = NULL; // RGBA pixels, subarray
const char *px = NULL; // DIB pixels
const U_RGBQUAD *ct = NULL; // color table
- int32_t width, height, colortype, numCt, invert; // if needed these values will be set in wget_DIB_params
+ uint32_t numCt;
+ int32_t width, height, colortype, invert; // if needed these values will be set in wget_DIB_params
if(iUsage == U_DIB_RGB_COLORS){
// next call returns pointers and values, but allocates no memory
dibparams = wget_DIB_params(dib, &px, &ct, &numCt, &width, &height, &colortype, &invert);
diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp
index 127030832..271dec702 100644
--- a/src/extension/internal/wmf-print.cpp
+++ b/src/extension/internal/wmf-print.cpp
@@ -379,8 +379,8 @@ int PrintWmf::create_brush(SPStyle const *style, U_COLORREF *fcolor)
} else if (SP_IS_PATTERN(SP_STYLE_FILL_SERVER(style))) { // must be paint-server
SPPaintServer *paintserver = style->fill.value.href->getObject();
SPPattern *pat = SP_PATTERN(paintserver);
- double dwidth = pattern_width(pat);
- double dheight = pattern_height(pat);
+ double dwidth = pat->width();
+ double dheight = pat->height();
width = dwidth;
height = dheight;
brush_classify(pat, 0, &pixbuf, &hatchType, &hatchColor, &bkColor);
diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp
index b774bac83..3162e8a40 100644
--- a/src/extension/param/color.cpp
+++ b/src/extension/param/color.cpp
@@ -24,41 +24,37 @@
#include "color.h"
#include <color.h>
-#include "widgets/sp-color-selector.h"
-#include "widgets/sp-color-notebook.h"
+#include "ui/widget/color-notebook.h"
#include "preferences.h"
-
namespace Inkscape {
namespace Extension {
-void sp_color_param_changed(SPColorSelector *csel, GObject *cp);
-
-
ParamColor::~ParamColor(void)
{
-
+ _color_changed.disconnect();
}
guint32 ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/ )
{
- _value = in;
+ _color_changed.block(true);
+ _color.setValue(in);
+ _color_changed.block(false);
gchar * prefname = this->pref_name();
std::string value;
string(value);
-
+
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setString(extension_pref_root + prefname, value);
g_free(prefname);
- return _value;
+ return in;
}
-ParamColor::ParamColor(const gchar *name, const gchar *guitext, const gchar *desc, const Parameter::_scope_t scope,
- bool gui_hidden, const gchar *gui_tip, Inkscape::Extension::Extension *ext,
- Inkscape::XML::Node *xml)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(0), _changeSignal(0)
+ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext),
+ _changeSignal(0)
{
const char * defaulthex = NULL;
if (xml->firstChild() != NULL)
@@ -72,51 +68,46 @@ ParamColor::ParamColor(const gchar *name, const gchar *guitext, const gchar *des
if (!paramval.empty())
defaulthex = paramval.data();
- if (defaulthex)
- _value = atoi(defaulthex);
+ if (defaulthex) {
+ _color.setValue(atoi(defaulthex));
+ }
+ _color_changed = _color.signal_changed.connect(sigc::mem_fun(this, &ParamColor::_onColorChanged));
+
}
void ParamColor::string(std::string &string) const
{
char str[16];
- sprintf(str, "%i", _value);
+ snprintf(str, 16, "%i", _color.value());
string += str;
}
Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * changeSignal )
{
- if (_gui_hidden) return NULL;
+ using Inkscape::UI::Widget::ColorNotebook;
+
+ if (_gui_hidden) return NULL;
_changeSignal = new sigc::signal<void>(*changeSignal);
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
- SPColorSelector* spColorSelector = (SPColorSelector*)sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK);
- ColorSelector* colorSelector = spColorSelector->base;
- if (_value < 1) {
- _value = 0xFF000000;
+ if (_color.value() < 1) {
+ _color_changed.block(true);
+ _color.setValue(0xFF000000);
+ _color_changed.block(false);
}
- SPColor *color = new SPColor( _value );
- float alpha = (_value & 0xff) / 255.0F;
- colorSelector->setColorAlpha(*color, alpha);
-
- hbox->pack_start (*Glib::wrap(&spColorSelector->vbox), true, true, 0);
- g_signal_connect(G_OBJECT(spColorSelector), "changed", G_CALLBACK(sp_color_param_changed), (void*)this);
- gtk_widget_show(GTK_WIDGET(spColorSelector));
+ Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, 4));
+ Gtk::Widget *selector = Gtk::manage(new ColorNotebook(_color));
+ hbox->pack_start (*selector, true, true, 0);
+ selector->show();
hbox->show();
-
- return dynamic_cast<Gtk::Widget *>(hbox);
+ return hbox;
}
-void sp_color_param_changed(SPColorSelector *csel, GObject *obj)
+void ParamColor::_onColorChanged()
{
- const SPColor color = csel->base->getColor();
- float alpha = csel->base->getAlpha();
-
- ParamColor* ptr = reinterpret_cast<ParamColor*>(obj);
- ptr->set(color.toRGBA32( alpha ), NULL, NULL);
-
- ptr->_changeSignal->emit();
+ if (_changeSignal)
+ _changeSignal->emit();
}
}; /* namespace Extension */
diff --git a/src/extension/param/color.h b/src/extension/param/color.h
index 9894965a9..ed2e57ceb 100644
--- a/src/extension/param/color.h
+++ b/src/extension/param/color.h
@@ -9,6 +9,7 @@
*/
#include "parameter.h"
+#include "ui/selected-color.h"
class SPDocument;
@@ -25,14 +26,17 @@ namespace Extension {
class ParamColor : public Parameter {
private:
- guint32 _value;
+ void _onColorChanged();
+
+ Inkscape::UI::SelectedColor _color;
+ sigc::connection _color_changed;
public:
ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
virtual ~ParamColor(void);
/** Returns \c _value, with a \i const to protect it. */
- guint32 get( SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/ ) const { return _value; }
+ guint32 get( SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/ ) const { return _color.value(); }
guint32 set (guint32 in, SPDocument * doc, Inkscape::XML::Node * node);
@@ -44,6 +48,7 @@ public:
virtual void string (std::string &string) const;
sigc::signal<void> * _changeSignal;
+
}; // class ParamColor
} // namespace Extension
diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp
index 202b8110f..8c99ee55d 100644
--- a/src/extension/param/parameter.cpp
+++ b/src/extension/param/parameter.cpp
@@ -15,6 +15,10 @@
# include "config.h"
#endif
+#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
+#include <glibmm/threads.h>
+#endif
+
#ifdef linux // does the dollar sign need escaping when passed as string parameter?
# define ESCAPE_DOLLAR_COMMANDLINE
#endif
@@ -26,8 +30,7 @@
#include "document-private.h"
#include "sp-object.h"
#include <color.h>
-#include "widgets/sp-color-selector.h"
-#include "widgets/sp-color-notebook.h"
+#include "ui/widget/color-notebook.h"
#include "parameter.h"
#include "bool.h"