summaryrefslogtreecommitdiffstats
path: root/src/extension/internal
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-08-08 17:27:51 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-08-08 17:27:51 +0000
commit60d3113d1f022a3de7cf04c7979d4751b3fe21f6 (patch)
treeca33e2a9a1af6b5911598fa1c6a1d77087b71dd2 /src/extension/internal
parentMinor cleanups (diff)
parentAdd a constrained snap method that takes multiple constraints. This reduces t... (diff)
downloadinkscape-60d3113d1f022a3de7cf04c7979d4751b3fe21f6.tar.gz
inkscape-60d3113d1f022a3de7cf04c7979d4751b3fe21f6.zip
merge from trunk
(bzr r9508.1.52)
Diffstat (limited to 'src/extension/internal')
-rw-r--r--src/extension/internal/cairo-ps-out.cpp14
-rw-r--r--src/extension/internal/cairo-render-context.cpp10
-rw-r--r--src/extension/internal/cairo-renderer-pdf-out.cpp7
-rw-r--r--src/extension/internal/emf-win32-inout.cpp5
-rw-r--r--src/extension/internal/gdkpixbuf-input.cpp8
-rw-r--r--src/extension/internal/javafx-out.cpp4
-rw-r--r--src/extension/internal/latex-text-renderer.cpp12
7 files changed, 24 insertions, 36 deletions
diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp
index 61760e9d9..16adebac3 100644
--- a/src/extension/internal/cairo-ps-out.cpp
+++ b/src/extension/internal/cairo-ps-out.cpp
@@ -195,12 +195,7 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con
// Create LaTeX file (if requested)
if (new_textToLaTeX) {
- gchar * tex_filename;
- //strip filename of ".ps", do not add ".tex" here.
- gsize n = g_str_has_suffix(filename, ".ps") ? strlen(filename)-3 : strlen(filename);
- tex_filename = g_strndup(filename, n);
- ret = latex_render_document_text_to_file(doc, tex_filename, new_exportId, new_areaDrawing, new_areaPage, false);
- g_free(tex_filename);
+ ret = latex_render_document_text_to_file(doc, filename, new_exportId, new_areaDrawing, new_areaPage, false);
if (!ret)
throw Inkscape::Extension::Output::save_failed();
@@ -283,12 +278,7 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co
// Create LaTeX file (if requested)
if (new_textToLaTeX) {
- gchar * tex_filename;
- //strip filename of ".eps", do not add ".tex" here.
- gsize n = g_str_has_suffix(filename, ".eps") ? strlen(filename)-4 : strlen(filename);
- tex_filename = g_strndup(filename, n);
- ret = latex_render_document_text_to_file(doc, tex_filename, new_exportId, new_areaDrawing, new_areaPage, false);
- g_free(tex_filename);
+ ret = latex_render_document_text_to_file(doc, filename, new_exportId, new_areaDrawing, new_areaPage, false);
if (!ret)
throw Inkscape::Extension::Output::save_failed();
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 8b40f60b4..80152c298 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -1120,11 +1120,11 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
SPLinearGradient *lg=SP_LINEARGRADIENT(paintserver);
- sp_gradient_ensure_vector(SP_GRADIENT(lg)); // when exporting from commandline, vector is not built
+ SP_GRADIENT(lg)->ensureVector(); // when exporting from commandline, vector is not built
Geom::Point p1 (lg->x1.computed, lg->y1.computed);
Geom::Point p2 (lg->x2.computed, lg->y2.computed);
- if (pbox && SP_GRADIENT(lg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
+ if (pbox && SP_GRADIENT(lg)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
// convert to userspace
Geom::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
p1 *= bbox2user;
@@ -1144,12 +1144,12 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
SPRadialGradient *rg=SP_RADIALGRADIENT(paintserver);
- sp_gradient_ensure_vector(SP_GRADIENT(rg)); // when exporting from commandline, vector is not built
+ SP_GRADIENT(rg)->ensureVector(); // when exporting from commandline, vector is not built
Geom::Point c (rg->cx.computed, rg->cy.computed);
Geom::Point f (rg->fx.computed, rg->fy.computed);
double r = rg->r.computed;
- if (pbox && SP_GRADIENT(rg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX)
+ if (pbox && SP_GRADIENT(rg)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX)
apply_bbox2user = true;
// create radial gradient pattern
@@ -1172,7 +1172,7 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain
SPGradient *g = SP_GRADIENT(paintserver);
// set extend type
- SPGradientSpread spread = sp_gradient_get_spread(g);
+ SPGradientSpread spread = g->fetchSpread();
switch (spread) {
case SP_GRADIENT_SPREAD_REPEAT: {
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp
index 808590e04..e8eff20b7 100644
--- a/src/extension/internal/cairo-renderer-pdf-out.cpp
+++ b/src/extension/internal/cairo-renderer-pdf-out.cpp
@@ -213,12 +213,7 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc,
// Create LaTeX file (if requested)
if (new_textToLaTeX) {
- gchar * tex_filename;
- //strip filename of ".pdf", do not add ".tex" here.
- gsize n = g_str_has_suffix(filename, ".pdf") ? strlen(filename)-4 : strlen(filename);
- tex_filename = g_strndup(filename, n);
- ret = latex_render_document_text_to_file(doc, tex_filename, new_exportId, new_exportDrawing, new_exportCanvas, true);
- g_free(tex_filename);
+ ret = latex_render_document_text_to_file(doc, filename, new_exportId, new_exportDrawing, new_exportCanvas, true);
if (!ret)
throw Inkscape::Extension::Output::save_failed();
diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp
index 7ed1a9d66..4cace7db7 100644
--- a/src/extension/internal/emf-win32-inout.cpp
+++ b/src/extension/internal/emf-win32-inout.cpp
@@ -711,7 +711,7 @@ assert_empty_path(PEMF_CALLBACK_DATA d, const char * /*fun*/)
static int CALLBACK
-myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD *lpEMFR, int /*nObj*/, LPARAM lpData)
+myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const *lpEMFR, int /*nObj*/, LPARAM lpData)
{
PEMF_CALLBACK_DATA d;
SVGOStringStream tmp_outsvg;
@@ -2331,7 +2331,8 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
d.pDesc[lstrlen(d.pDesc)] = '#';
}
- EnumEnhMetaFile(NULL, hemf, myEnhMetaFileProc, (LPVOID) &d, NULL);
+ // This ugly reinterpret_cast is to prevent old versions of gcc from whining about a mismatch in the const-ness of the arguments
+ EnumEnhMetaFile(NULL, hemf, reinterpret_cast<ENHMFENUMPROC>(myEnhMetaFileProc), (LPVOID) &d, NULL);
DeleteEnhMetaFile(hemf);
}
else {
diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp
index a1295406c..df7f3481c 100644
--- a/src/extension/internal/gdkpixbuf-input.cpp
+++ b/src/extension/internal/gdkpixbuf-input.cpp
@@ -2,6 +2,7 @@
# include <config.h>
#endif
#include <glib/gprintf.h>
+#include <glibmm/i18n.h>
#include "document-private.h"
#include <dir-util.h>
#include "extension/input.h"
@@ -143,10 +144,10 @@ GdkpixbufInput::init(void)
if (strcmp(extensions[i], "svg.gz") == 0) {
continue;
}
-
+ gchar *caption = g_strdup_printf(_("%s GDK pixbuf Input"), name);
gchar *xmlString = g_strdup_printf(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("%s GDK pixbuf Input") "</name>\n"
+ "<name>%s</name>\n"
"<id>org.inkscape.input.gdkpixbuf.%s</id>\n"
"<param name='link' type='optiongroup' appearance='full' _gui-text='" N_("Link or embed image:") "' >\n"
"<_option value='embed'>" N_("embed") "</_option>\n"
@@ -160,7 +161,7 @@ GdkpixbufInput::init(void)
"<filetypetooltip>%s</filetypetooltip>\n"
"</input>\n"
"</inkscape-extension>",
- name,
+ caption,
extensions[i],
extensions[i],
mimetypes[j],
@@ -171,6 +172,7 @@ GdkpixbufInput::init(void)
Inkscape::Extension::build_from_mem(xmlString, new GdkpixbufInput());
g_free(xmlString);
+ g_free(caption);
}}
g_free(name);
diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp
index a4d348940..c635f7b2d 100644
--- a/src/extension/internal/javafx-out.cpp
+++ b/src/extension/internal/javafx-out.cpp
@@ -386,7 +386,7 @@ bool JavaFXOutput::doStyle(SPStyle *style)
/**
* Fill
*/
- SPIPaint fill = style->fill;
+ SPIPaint const &fill = style->fill;
if (fill.isColor())
{
// see color.h for how to parse SPColor
@@ -423,7 +423,7 @@ bool JavaFXOutput::doStyle(SPStyle *style)
*/
if (style->stroke_opacity.value > 0)
{
- SPIPaint stroke = style->stroke;
+ SPIPaint const &stroke = style->stroke;
out(" stroke: %s\n",
rgba(stroke.value.color, SP_SCALE24_TO_FLOAT(style->stroke_opacity.value)).c_str());
double strokewidth = style->stroke_width.value;
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index bebc21f2f..00448b89e 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -51,7 +51,7 @@ namespace Internal {
/**
* This method is called by the PDF, EPS and PS output extensions.
- * @param filename This should be the filename without extension to which the tex code should be written. Output goes to <filename>.tex.
+ * @param filename This should be the filename without '_tex' extension to which the tex code should be written. Output goes to <filename>_tex, note the underscore instead of period.
*/
bool
latex_render_document_text_to_file( SPDocument *doc, gchar const *filename,
@@ -132,7 +132,7 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) {
_filename = g_path_get_basename(filename);
- gchar *filename_ext = g_strdup_printf("%s.tex", filename);
+ gchar *filename_ext = g_strdup_printf("%s_tex", filename);
Inkscape::IO::dump_fopen_call(filename_ext, "K");
FILE *osf = Inkscape::IO::fopen_utf8name(filename_ext, "w+");
if (!osf) {
@@ -176,12 +176,12 @@ LaTeXTextRenderer::setTargetFile(gchar const *filename) {
static char const preamble[] =
"%% To include the image in your LaTeX document, write\n"
-"%% \\input{<filename>.tex}\n"
+"%% \\input{<filename>.pdf_tex}\n"
"%% instead of\n"
"%% \\includegraphics{<filename>.pdf}\n"
"%% To scale the image, write\n"
-"%% \\def{\\svgwidth}{<desired width>}\n"
-"%% \\input{<filename>.tex}\n"
+"%% \\def\\svgwidth{<desired width>}\n"
+"%% \\input{<filename>.pdf_tex}\n"
"%% instead of\n"
"%% \\includegraphics[width=<desired width>]{<filename>.pdf}\n"
"%%\n"
@@ -190,7 +190,7 @@ static char const preamble[] =
"%% installed) using\n"
"%% \\usepackage{import}\n"
"%% in the preamble, and then including the image with\n"
-"%% \\import{<path to file>}{<filename>.tex}\n"
+"%% \\import{<path to file>}{<filename>.pdf_tex}\n"
"%% Alternatively, one can specify\n"
"%% \\graphicspath{{<path to file>/}}\n"
"%% \n"