latex-pstricks.cpp revision 77eda576f455eeb23c7b92510f38bc60738473ab
#define __SP_LATEX_C__
/*
* LaTeX Printing
*
* Author:
* Michael Forbes <miforbes@mbhs.edu>
*
* Copyright (C) 2004 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <signal.h>
#include <errno.h>
#include "libnr/nr-matrix.h"
#include "libnr/nr-matrix-ops.h"
#include "libnr/nr-matrix-scale-ops.h"
#include "libnr/nr-matrix-translate-ops.h"
#include "libnr/nr-scale-translate-ops.h"
#include "libnr/nr-translate-scale-ops.h"
#include <libnr/nr-matrix-fns.h>
#include "helper/geom-curves.h"
#include "sp-item.h"
#include "style.h"
#include "latex-pstricks.h"
#include <unit-constants.h>
namespace Inkscape {
namespace Extension {
namespace Internal {
{
}
PrintLatex::~PrintLatex (void)
{
/* restore default signal handling for SIGPIPE */
#endif
return;
}
unsigned int
{
return TRUE;
}
unsigned int
{
int res;
gsize bytesWritten = 0;
/* TODO: Replace the below fprintf's with something that does the right thing whether in
* gui or batch mode (e.g. --print=blah). Consider throwing an exception: currently one of
* the callers (sp_print_document_to_file, "ret = mod->begin(doc)") wrongly ignores the
* return code.
*/
if (!osf) {
return 0;
}
}
if (_stream) {
/* fixme: this is kinda icky */
#endif
}
/* flush this to test output stream as early as possible */
/*g_print("caught error in sp_module_print_plain_begin\n");*/
g_strerror(errno));
}
g_print("Printing failed\n");
/* fixme: should use pclose() for pipes */
return 0;
}
// width and height in pt
if (res >= 0) {
os << "%%Please note this file requires PSTricks extensions\n";
os << "\\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}\n";
// from now on we can output px, but they will be treated as pt
}
}
unsigned int
{
int res;
if (!_stream) return 0;
/* Flush stream to be sure. */
return 0;
}
unsigned int
{
if(m_tr_stack.size()){
}else
return 1;
}
unsigned int
{
m_tr_stack.pop();
return 1;
}
const char * comment)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
}
unsigned int
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
float rgb[3];
os << "\\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]\n{\n";
os << "}\n}\n";
}
return 0;
}
unsigned int
PrintLatex::stroke (Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, const NR::Matrix *transform, const SPStyle *style,
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
float rgb[3];
if (style->stroke_dasharray_set &&
int i;
os << ",linestyle=dashed,dash=";
if ((i)) {
os << " ";
}
}
}
os <<"]\n{\n";
os << "}\n}\n";
}
return 0;
}
// FIXME: why is 'transform' argument not used?
void
PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const NR::Matrix * /*transform*/)
{
return;
// NR::Matrix tf=*transform; // why was this here?
Geom::PathVector pathv = pathv_in * to_2geom(tf_stack); // generates new path, which is a bit slow, but this doesn't have to be performance optimized
os << "\\newpath\n";
}
os << "\\closepath\n";
}
}
}
void
{
using Geom::X;
using Geom::Y;
if( is_straight_curve(c) )
{
}
}
else {
//this case handles sbasis as well as all other curve types
}
}
}
bool
{
}
#include "clear-n_.h"
void
PrintLatex::init (void)
{
/* SVG in */
"<param name=\"destination\" type=\"string\"></param>\n"
"<param name=\"textToPath\" type=\"boolean\">true</param>\n"
"<print/>\n"
"</inkscape-extension>", new PrintLatex());
return;
}
} /* namespace Internal */
} /* namespace Extension */
} /* namespace Inkscape */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :