main.cpp revision 4e3f339f206fb67cf0f2ad086bdf4ea6430747f4
/*
* Inkscape - an ambitious vector drawing program
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* Davide Puricelli <evo@debian.org>
* Mitsuru Oka <oka326@parkcity.ne.jp>
* Masatake YAMATO <jet@gyve.org>
* F.J.Franklin <F.J.Franklin@sheffield.ac.uk>
* Michael Meeks <michael@helixcode.com>
* Chema Celorio <chema@celorio.com>
* Pawel Palucha
* Bryce Harrington <bryce@bryceharrington.org>
* ... and various people who have worked with various projects
* Jon A. Cruz <jon@oncruz.org>
* Abhishek Sharma
*
* Copyright (C) 1999-2004 authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
// This has to be included prior to anything that includes setjmp.h, it croaks otherwise
#include <png.h>
#include "ui/widget/panel.h" // This has to be the first to include <glib.h> because of Glibmm's dependence on a deprecated feature...
#include "path-prefix.h"
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#include <cstring>
#include <string>
#include <locale.h>
#include <stdlib.h>
#include <popt.h>
#ifndef POPT_TABLEEND
#endif /* Not def: POPT_TABLEEND */
#include <glib-object.h>
#if GTK_CHECK_VERSION(3,0,0)
#include <gtkmm/cssprovider.h>
#endif
#ifdef AND
#endif
#include "macros.h"
#include "file.h"
#include "document.h"
#include "layer-model.h"
#include "selection.h"
#include "sp-object.h"
#include "ui/interface.h"
#include "print.h"
#include "color.h"
#include "sp-item.h"
#include "sp-root.h"
#include "svg/svg-color.h"
#include "svg/stringstream.h"
#include "inkscape.h"
#include "inkscape-version.h"
#include "sp-namedview.h"
#include "sp-guide.h"
#include "debug/log-display-config.h"
#include "helper/action-context.h"
#include "helper/png-write.h"
#include <extension/extension.h>
#ifdef WIN32
#include <windows.h>
#include "registrytool.h"
#endif // WIN32
// Not ideal, but there doesn't appear to be a nicer system in place for
// passing command-line parameters to extensions before initialization...
#ifdef WITH_DBUS
#include "extension/dbus/dbus-init.h"
#endif // WITH_DBUS
#include <glibmm/miscutils.h>
#ifndef HAVE_BIND_TEXTDOMAIN_CODESET
#define bind_textdomain_codeset(p,c)
#endif
#include "main-cmdlineact.h"
#include <errno.h>
#include "verbs.h"
#include <gdk/gdkkeysyms.h>
#include "path-chemistry.h"
#include "sp-text.h"
#include "sp-flowtext.h"
#include "text-editing.h"
enum {
#ifdef WITH_DBUS
#endif // WITH_DBUS
};
static void do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const gchar *id);
static void do_query_all_recurse (SPObject *o);
#ifdef WITH_DBUS
#endif // WITH_DBUS
/**
* Reset variables to default values.
*/
static void resetCommandlineGlobals() {
sp_export_id = NULL;
sp_export_ps = NULL;
sp_export_ps_level = 3;
sp_query_x = FALSE;
sp_query_y = FALSE;
sp_query_id = NULL;
#ifdef WITH_DBUS
sp_dbus_name = NULL;
#endif // WITH_DBUS
}
#ifdef WIN32
#endif
struct poptOption options[] = {
{"version", 'V',
N_("Print the Inkscape version number"),
NULL},
{"without-gui", 'z',
N_("Do not use X server (only process files from console)"),
NULL},
{"with-gui", 'g',
N_("Try to use X server (even if $DISPLAY is not set)"),
NULL},
{"file", 'f',
N_("Open specified document(s) (option string may be excluded)"),
N_("FILENAME")},
{"print", 'p',
N_("Print document(s) to specified output file (use '| program' for pipe)"),
N_("FILENAME")},
{"export-png", 'e',
N_("Export document to a PNG file"),
N_("FILENAME")},
{"export-dpi", 'd',
N_("Resolution for exporting to bitmap and for rasterization of filters in PS/EPS/PDF (default 96)"),
N_("DPI")},
{"export-area", 'a',
N_("Exported area in SVG user units (default is the page; 0,0 is lower-left corner)"),
N_("x0:y0:x1:y1")},
{"export-area-drawing", 'D',
N_("Exported area is the entire drawing (not page)"),
NULL},
{"export-area-page", 'C',
N_("Exported area is the entire page"),
NULL},
{"export-margin", 0,
N_("VALUE")},
{"export-area-snap", 0,
N_("Snap the bitmap export area outwards to the nearest integer values (in SVG user units)"),
NULL},
{"export-width", 'w',
N_("The width of exported bitmap in pixels (overrides export-dpi)"),
N_("WIDTH")},
{"export-height", 'h',
N_("The height of exported bitmap in pixels (overrides export-dpi)"),
N_("HEIGHT")},
{"export-id", 'i',
N_("The ID of the object to export"),
N_("ID")},
{"export-id-only", 'j',
// TRANSLATORS: this means: "Only export the object whose id is given in --export-id".
// See "man inkscape" for details.
N_("Export just the object with export-id, hide all others (only with export-id)"),
NULL},
{"export-use-hints", 't',
N_("Use stored filename and DPI hints when exporting (only with export-id)"),
NULL},
{"export-background", 'b',
N_("Background color of exported bitmap (any SVG-supported color string)"),
N_("COLOR")},
{"export-background-opacity", 'y',
N_("Background opacity of exported bitmap (either 0.0 to 1.0, or 1 to 255)"),
N_("VALUE")},
{"export-plain-svg", 'l',
N_("Export document to plain SVG file (no sodipodi or inkscape namespaces)"),
N_("FILENAME")},
{"export-ps", 'P',
N_("Export document to a PS file"),
N_("FILENAME")},
{"export-eps", 'E',
N_("Export document to an EPS file"),
N_("FILENAME")},
{"export-ps-level", 0,
N_("Choose the PostScript Level used to export. Possible choices are"
" 2 and 3 (the default)"),
N_("PS Level")},
{"export-pdf", 'A',
N_("Export document to a PDF file"),
N_("FILENAME")},
{"export-pdf-version", 0,
// TRANSLATORS: "--export-pdf-version" is an Inkscape command line option; see "inkscape --help"
N_("Export PDF to given version. (hint: make sure to input the exact string found in the PDF export dialog, e.g. \"PDF 1.4\" which is PDF-a conformant)"),
N_("PDF_VERSION")},
{"export-latex", 0,
N_("Export PDF/PS/EPS without text. Besides the PDF/PS/EPS, a LaTeX file is exported, putting the text on top of the PDF/PS/EPS file. Include the result in LaTeX like: \\input{latexfile.tex}"),
NULL},
{"export-emf", 'M',
N_("Export document to an Enhanced Metafile (EMF) File"),
N_("FILENAME")},
{"export-wmf", 'm',
N_("Export document to a Windows Metafile (WMF) File"),
N_("FILENAME")},
{"export-text-to-path", 'T',
N_("Convert text object to paths on export (PS, EPS, PDF, SVG)"),
NULL},
{"export-ignore-filters", 0,
N_("Render filtered objects without filters, instead of rasterizing (PS, EPS, PDF)"),
NULL},
{"query-x", 'X',
// TRANSLATORS: "--query-id" is an Inkscape command line option; see "inkscape --help"
N_("Query the X coordinate of the drawing or, if specified, of the object with --query-id"),
NULL},
{"query-y", 'Y',
// TRANSLATORS: "--query-id" is an Inkscape command line option; see "inkscape --help"
N_("Query the Y coordinate of the drawing or, if specified, of the object with --query-id"),
NULL},
{"query-width", 'W',
// TRANSLATORS: "--query-id" is an Inkscape command line option; see "inkscape --help"
N_("Query the width of the drawing or, if specified, of the object with --query-id"),
NULL},
{"query-height", 'H',
// TRANSLATORS: "--query-id" is an Inkscape command line option; see "inkscape --help"
N_("Query the height of the drawing or, if specified, of the object with --query-id"),
NULL},
{"query-all", 'S',
N_("List id,x,y,w,h for all objects"),
NULL},
{"query-id", 'I',
N_("The ID of the object whose dimensions are queried"),
N_("ID")},
{"extension-directory", 'x',
// TRANSLATORS: this option makes Inkscape print the name (path) of the extension directory
N_("Print out the extension directory and exit"),
NULL},
{"vacuum-defs", 0,
N_("Remove unused definitions from the defs section(s) of the document"),
NULL},
#ifdef WITH_DBUS
{"dbus-listen", 0,
N_("Enter a listening loop for D-Bus messages in console mode"),
NULL},
{"dbus-name", 0,
N_("Specify the D-Bus bus name to listen for messages on (default is org.inkscape)"),
N_("BUS-NAME")},
#endif // WITH_DBUS
{"verb-list", 0,
N_("List the IDs of all the verbs in Inkscape"),
NULL},
{"verb", 0,
N_("Verb to call when Inkscape opens."),
N_("VERB-ID")},
{"select", 0,
N_("Object ID to select when Inkscape opens."),
N_("OBJECT-ID")},
{"shell", 0,
N_("Start Inkscape in interactive shell mode."),
NULL},
};
static bool needToRecodeParams = true;
#ifdef WIN32
/**
* Set up the PATH, INKSCAPE_LOCALEDIR and PYTHONPATH environment
* variables on Windows
* @param exe Inkscape executable directory in UTF-8
*/
{
// Python 2.x needs short paths in PYTHONPATH.
// Otherwise it doesn't work when Inkscape is installed in Unicode directories.
// g_win32_locale_filename_from_utf8 is the GLib wrapper for GetShortPathName.
// Remove this once we move to Python 3.0.
if (path) {
} else {
}
if (pythonpath) {
} else {
}
/*
printf("PATH = %s\n\n", g_getenv("PATH"));
printf("PYTHONPATH = %s\n\n", g_getenv("PYTHONPATH"));
gchar *p = g_find_program_in_path("python");
if (p) {
printf("python in %s\n\n", p);
g_free(p);
} else {
printf("python not found\n\n");
}*/
// prevent "please insert disk" messages. fixes bug #950781
}
#endif
static void set_extensions_env()
{
#ifdef WIN32
#else
#endif
// On some platforms, INKSCAPE_EXTENSIONDIR is not absolute,
// but relative to the directory that contains the Inkscape executable.
// Since we spawn Python chdir'ed into the script's directory,
// we need to obtain the absolute path here.
if (!g_path_is_absolute(extdir)) {
extdir = extdir_new;
}
if (pythonpath) {
extdir, pythonpath);
} else {
}
//printf("PYTHONPATH = %s\n", g_getenv("PYTHONPATH"));
}
/**
* This is the classic main() entry point of the program, though on some
* architectures it might be called by something else.
*/
int
{
#ifdef HAVE_FPSETMASK
/* This is inherited from Sodipodi code, where it was in #ifdef __FreeBSD__. It's probably
safe to remove: the default mask is already 0 in C99, and in current FreeBSD according to
the fenv man page on www.freebsd.org, and in glibc according to (libc)FP Exceptions. */
#endif
#ifdef WIN32
# ifdef ENABLE_NLS
// obtain short path to executable dir and pass it
// to bindtextdomain (it doesn't understand UTF-8)
# endif
// Don't touch the registry (works fine without it) for Inkscape Portable
if (!val) {
rt.setPathInfo();
}
#elif defined(ENABLE_NLS)
# ifdef ENABLE_BINRELOC
# else
# endif
#endif
// the bit below compiles regardless of platform
#ifdef ENABLE_NLS
// Allow the user to override the locale directory by setting
// the environment variable INKSCAPE_LOCALEDIR.
if (inkscape_localedir != NULL) {
}
// common setup
#endif
// Prevents errors like "Unable to wrap GdkPixbuf..." (in nr-filter-image.cpp for example)
#if !defined(WIN32) && !defined(GDK_WINDOWING_QUARTZ)
#else
#endif
for (int i = 1; i < argc; i++) {
#ifdef WITH_DBUS
#endif // WITH_DBUS
)
{
/* main_console handles any exports -- not the gui */
break;
break;
}
}
#ifdef WIN32
{
// If the call fails, we'll need to convert charsets
}
#endif // WIN32
int retcode;
if (use_gui) {
} else {
}
return retcode;
}
{
if ( newFileName )
{
*orig = newFileName;
if ( spare ) {
*spare = newFileName;
}
// g_message("Set a replacement fixup");
}
}
}
{
while ( fl ) {
if ( newFileName ) {
if ( 0 )
{
gtk_dialog_run (GTK_DIALOG (w));
gtk_widget_destroy (w);
}
fn = newFileName;
newFileName = 0;
}
else
if ( 0 )
{
GtkWidget *w = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Error: Unable to convert '%s'", safeFn );
gtk_dialog_run (GTK_DIALOG (w));
gtk_widget_destroy (w);
}
}
return newFl;
}
{
/// \todo fixme: Move these to some centralized location (Lauris)
//sp_object_type_register("sodipodi:namedview", SP_TYPE_NAMEDVIEW);
//sp_object_type_register("sodipodi:guide", SP_TYPE_GUIDE);
// temporarily switch gettext encoding to locale, so that help messages can be output properly
/* Collect own arguments */
// now switch gettext back to UTF-8 (for GUI)
// Now let's see if the file list still holds up
if ( needToRecodeParams )
{
}
// Check the globals for filename-fixup
if ( needToRecodeParams )
{
}
else
{
if ( sp_export_png )
if ( sp_export_svg )
if ( sp_global_printer )
}
#ifdef WITH_DBUS
// Before initializing extensions, we must set the DBus bus name if required
if (sp_dbus_name != NULL) {
}
#endif
// Return the list if wanted, else free it up.
if ( flDest ) {
fl = 0;
} else {
while ( fl ) {
}
}
return 0;
}
namespace Inkscape {
namespace UI {
namespace Tools {
}
}
}
static void
if (INKSCAPE.mapalt()) /* returns the map of the keyboard modifier to map to Alt, zero if no mapping */
{
case GDK_MOTION_NOTIFY:
}
break;
case GDK_BUTTON_PRESS:
}
break;
case GDK_KEY_PRESS:
}
break;
default:
break;
}
}
// MacOS X with X11 has some problem with the default
// xmodmapping. A ~/.xmodmap solution does not work reliably due
// to the way we package our executable in a .app that can launch
// X11 or use an already-running X11. The same problem has been
// of ~/.xmodmap fixes. So we make this a preference.
//
// For some reason, Gdk senses changes in Alt (Mod1) state for
// many message types, but not for keystrokes! So this ugly hack
// tracks what the state of Alt-pressing is, and ensures
// GDK_MOD1_MASK is in the event->key.state as appropriate.
//
case GDK_MOTION_NOTIFY:
break;
case GDK_BUTTON_PRESS:
break;
case GDK_KEY_PRESS:
if (alt_pressed)
else
break;
case GDK_KEY_RELEASE:
if (!altL_pressed && !altR_pressed)
alt_pressed = FALSE;
break;
default:
break;
}
//printf("alt_pressed: %s\n", alt_pressed? "+" : "-");
}
}
static std::vector<Glib::ustring> getDirectorySet(const gchar* userDir, const gchar* const * systemDirs) {
{
}
return listing;
}
int
{
// Add possible icon entry directories
{
}
// Add our icon directory to the search path for icon theme lookups.
#ifdef INKSCAPE_THEMEDIR
#endif
#if GTK_CHECK_VERSION(3,0,0)
// Add style sheet (GTK3)
inkscape_style += "/style.css";
// std::cout << "CSS Stylesheet Inkscape: " << inkscape_style << std::endl;
try {
}
{
std::cerr << "CSSProviderError::load_from_path(): failed to load: " << inkscape_style << "\n (" << ex.what() << ")" << std::endl;
}
Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
// std::cout << "CSS Stylesheet User: " << user_style << std::endl;
try {
}
{}
Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
#endif
// Set default window icon. Obeys the theme.
gtk_window_set_default_icon_name("inkscape");
// Do things that were previously in inkscape_gtk_stock_init().
/// \todo FIXME BROKEN - non-UTF-8 sneaks in here.
while (fl) {
}
}
if (create_new) {
}
main_instance.run();
#ifdef WIN32
//We might not need anything here
//sp_win32_finish(); <-- this is a NOP func
#endif
return 0;
}
/**
* Process file list
*/
{
int retVal = 0;
#ifdef WITH_DBUS
if (!fl) {
// If we've been asked to listen for D-Bus messages, enter a main loop here
// The main loop may be exited by calling "exit" on the D-Bus application interface.
if (sp_dbus_listen) {
}
}
#endif // WITH_DBUS
while (fl) {
try {
}
try {
}
}
g_warning("Specified document %s cannot be opened (does not exist or not a valid SVG file)", filename);
retVal++;
} else {
if (sp_vacuum_defs) {
doc->vacuumDocument();
}
// Execute command-line actions (selections and verbs) using our local models
#ifdef WITH_DBUS
// If we've been asked to listen for D-Bus messages, enter a main loop here
// The main loop may be exited by calling "exit" on the D-Bus application interface.
if (sp_dbus_listen) {
}
#endif // WITH_DBUS
// save under the name given in the command line
Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, filename, false,
}
if (sp_global_printer) {
}
}
if (sp_export_svg) {
if (sp_export_text_to_path) {
doc->ensureUpToDate();
continue;
}
}
}
if(sp_export_id) {
doc->ensureUpToDate();
// "crop" the document to the specified object, cleaning as we go.
if (bbox) {
}
if (sp_export_id_only) {
// If -j then remove all other objects to complete the "crop"
}
}
Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false,
}
if (sp_export_ps) {
}
if (sp_export_eps) {
}
if (sp_export_pdf) {
}
if (sp_export_emf) {
}
if (sp_export_wmf) {
}
if (sp_query_all) {
do_query_all (doc);
} else if (sp_query_width || sp_query_height) {
} else if (sp_query_x || sp_query_y) {
}
delete doc;
}
}
return retVal;
}
/**
* Run the application as an interactive shell, parsing command lines from stdin
* Returns -1 on error.
*/
static int sp_main_shell(char const* command_name)
{
int retval = 0;
const unsigned int buffer_size = 4096;
fprintf(stdout, "Inkscape %s interactive shell mode. Type 'quit' to quit.\n", Inkscape::version_string);
char* linedata = 0;
do {
// Consume rest of line
retval = 0;
}
}
} else {
}
// Time to quit
linedata = 0; // mark for exit
} else if ( len < 1 ) {
// blank string. Do nothing.
} else {
GError* parseError = 0;
if ( ctx ) {
if (sp_process_file_list(fl)) {
retval = -1;
}
} else {
}
} else {
retval = -1;
}
}
}
} // if (linedata...
return retval;
}
{
/* We are started in text mode */
* in a non-Gtk environment. Used in libnrtype's
* FontInstance.cpp and FontFactory.cpp.
*/
g_type_init();
#endif
//setlocale(LC_ALL, "");
#ifdef WITH_DBUS
&& !sp_dbus_listen
#endif // WITH_DBUS
) {
g_print("Nothing to do!\n");
exit(0);
}
if (sp_shell) {
} else {
if (retVal){
exit(1);
}
}
return 0;
}
static void
{
if (id) {
if (o) {
if (!SP_IS_ITEM (o)) {
return;
}
} else {
return;
}
} else {
}
if (o) {
doc->ensureUpToDate();
// visual bbox in document coords for scripting
if (area) {
if (extent) {
} else {
}
} else {
g_print("0");
}
}
}
{
if (o) {
doc->ensureUpToDate();
}
}
static void
{
if (area) {
}
}
while (child) {
}
}
{
bool filename_from_hint = false;
g_warning ("--export-use-hints can only be used with --export-id or --export-area-drawing; ignored.");
}
if (sp_export_id || sp_export_area_drawing) {
if (sp_export_id && sp_export_area_drawing) {
} else if (sp_export_id) {
o_area = o;
} else if (sp_export_area_drawing) {
o_area = o;
}
if (o) {
if (!SP_IS_ITEM (o)) {
return 1;
}
if (sp_export_id_only) {
}
if (sp_export_use_hints) {
// retrieve export filename hint
if (fn_hint) {
if (sp_export_png) {
g_warning ("Using export filename from the command line (--export-png). Filename hint %s is ignored.", fn_hint);
} else {
filename_from_hint = true;
}
} else {
g_warning ("Export filename hint not found for the object.");
}
// retrieve export dpi hints
const gchar *dpi_hint = o->getRepr()->attribute("inkscape:export-xdpi"); // only xdpi, ydpi is always the same now
if (dpi_hint) {
g_warning ("Using bitmap dimensions from the command line (--export-dpi, --export-width, or --export-height). DPI hint %s is ignored.", dpi_hint);
} else {
}
} else {
g_warning ("Export DPI hint not found for the object.");
}
}
// write object bbox to area
doc->ensureUpToDate();
if (areaMaybe) {
} else {
g_warning("Unable to determine a valid bounding box. Nothing exported.");
return 1;
}
} else {
return 1;
}
}
if (sp_export_area) {
/* Try to parse area (given in SVG pixels) */
return 1;
}
/* Export the whole page: note: Inkscape uses 'page' in all menus and dialogs, not 'canvas' */
doc->ensureUpToDate();
}
// set filename and dpi from options, if not yet set from the hints
g_warning ("No export filename given and no filename hint. Nothing exported.");
return 1;
}
}
return 1;
}
}
if (sp_export_area_snap) {
}
// default dpi
if (dpi == 0.0) {
}
unsigned long int width = 0;
unsigned long int height = 0;
if (sp_export_width) {
errno=0;
g_warning("Export width %lu out of range (1 - %lu). Nothing exported.", width, (unsigned long int)PNG_UINT_31_MAX);
return 1;
}
}
if (sp_export_height) {
errno=0;
g_warning("Export height %lu out of range (1 - %lu). Nothing exported.", height, (unsigned long int)PNG_UINT_31_MAX);
return 1;
}
}
if (!sp_export_width) {
width = (unsigned long int) (Inkscape::Util::Quantity::convert(area.width(), "px", "in") * dpi + 0.5);
}
if (!sp_export_height) {
height = (unsigned long int) (Inkscape::Util::Quantity::convert(area.height(), "px", "in") * dpi + 0.5);
}
if (sp_export_background) {
// override the page color
} else {
// read from namedview
}
double opacity = 1.0;
}
}
if (sp_export_background_opacity) {
// override opacity
if (value > 1.0) {
} else {
}
}
}
if (filename_from_hint) {
//Make relative paths go from the document location, if possible:
}
}
}
} else {
}
int retcode = 0;
//check if specified directory exists
retcode = 1;
} else {
g_print("Area %g:%g:%g:%g exported to %lu x %lu pixels (%g dpi)\n", area[Geom::X][0], area[Geom::Y][0], area[Geom::X][1], area[Geom::Y][1], width, height, dpi);
} else {
}
} else {
g_warning("Calculated bitmap dimensions %lu %lu are out of range (1 - %lu). Nothing exported.", width, height, (unsigned long int)PNG_UINT_31_MAX);
}
}
return retcode;
}
/**
*
* \param doc Document to export.
* \param uri URI to export to.
* \param mime MIME type to export as.
*/
{
i++;
}
if (i == o.end())
{
return 1;
}
if (sp_export_id) {
if (o == NULL) {
return 1;
}
} else {
}
if (sp_export_area_page && sp_export_area_drawing) {
g_warning ("You cannot use --export-area-page and --export-area-drawing at the same time; only the former will take effect.");
sp_export_area_drawing = false;
}
if (sp_export_area_drawing) {
}
if (sp_export_area_page) {
if (sp_export_eps) {
g_warning ("EPS cannot have its bounding box extend beyond its content, so if your drawing is smaller than the page, --export-area-page will clip it to drawing.");
}
}
if (sp_export_eps) {
try {
} catch (...) {}
}
}
if (sp_export_text_to_path) {
} else if (sp_export_latex) {
} else {
}
if (sp_export_ignore_filters) {
} else {
if (sp_export_dpi) {
dpi = 96;
}
}
}
float margin = 0.;
if (sp_export_margin) {
}
// handle --export-pdf-version
bool set_export_pdf_version_fail=true;
if(sp_export_pdf_version) {
// combine "PDF " and the given command line
try{
// first, check if the given pdf version is selectable in the ComboBox
set_export_pdf_version_fail=false;
} else {
g_warning("Desired PDF export version \"%s\" not supported! Hint: input one of the versions found in the pdf export dialog e.g. \"1.4\".",
}
} catch (...) {
// can be thrown along the way:
// throw Extension::param_not_exist();
// throw Extension::param_not_enum_param();
}
}
// set default pdf export version to 1.4, also if something went wrong
}
}
g_warning ("No export filename given. Nothing exported.");
return 0;
}
//check if specified directory exists
return 1;
}
g_warning("Only supported PostScript levels are 2 and 3."
" Defaulting to 2.");
sp_export_ps_level = 2;
}
? "PostScript level 3" : "PostScript level 2");
}
try {
} catch(...) {
}
return 0;
}
/**
* Export a document to EMF or WMF
*
* \param doc Document to export.
* \param uri URI to export to.
*/
{
i++;
}
if (i == o.end())
{
return 1;
}
//check if specified directory exists
g_warning("File path \"%s\" includes directory that doesn't exist.\n",
uri);
return 1;
}
return 0;
}
/**
* Export a document to EMF
*
* \param doc Document to export.
* \param uri URI to export to.
*/
{
g_warning("No filename provided for emf export.");
return 0;
}
}
/**
* Export a document to WMF
*
* \param doc Document to export.
* \param uri URI to export to.
*/
{
g_warning("No filename provided for wmf export.");
return 0;
}
}
#ifdef WIN32
{
bool worked = false;
#ifdef REPLACEARGS_DEBUG
MessageBoxA( NULL, "GetCommandLineW() getting called", "GetCommandLineW", MB_OK | MB_ICONINFORMATION );
#endif // REPLACEARGS_DEBUG
wchar_t* line = GetCommandLineW();
if ( line )
{
#ifdef REPLACEARGS_DEBUG
{
if ( utf8Line )
{
{
}
}
}
#endif // REPLACEARGS_DEBUG
int numArgs = 0;
#ifdef REPLACEARGS_ANSI
// test code for trying things on Win95/98/ME
if ( !parsed )
{
#ifdef REPLACEARGS_DEBUG
MessageBoxA( NULL, "Unable to process command-line. Faking it", "CommandLineToArgvW", MB_OK | MB_ICONINFORMATION );
#endif // REPLACEARGS_DEBUG
int pos = 0;
bool inQuotes = false;
bool inWhitespace = true;
{
if ( inQuotes )
{
{
inQuotes = false;
}
}
{
inQuotes = true;
inWhitespace = false;
}
{
if ( !inWhitespace )
{
inWhitespace = true;
}
}
{
inWhitespace = false;
}
else
{
// consume
}
pos++;
}
#ifdef REPLACEARGS_DEBUG
{
char tmp[256];
}
#endif // REPLACEARGS_DEBUG
int i = 0;
{
}
}
#endif // REPLACEARGS_ANSI
if ( parsed )
{
if ( numArgs > 0 )
{
}
{
if ( wildcarded )
{
#ifdef REPLACEARGS_ANSI
#else
#endif // REPLACEARGS_ANSI
if ( last )
{
last[1] = 0;
}
else
{
base[0] = 0;
}
#ifdef REPLACEARGS_ANSI
{
#else
#endif // REPLACEARGS_ANSI
if ( hf != INVALID_HANDLE_VALUE )
{
do
{
#ifdef REPLACEARGS_ANSI
if ( howMany > 0 )
{
}
#else
#endif // REPLACEARGS_ANSI
} while ( found );
}
else
{
}
#ifdef REPLACEARGS_ANSI
}
#endif // REPLACEARGS_ANSI
delete[] base;
}
else
{
}
}
{
int iz = 0;
{
}
}
for ( int i = 0; i < numArgs; i++ )
{
if ( replacement )
{
#ifdef REPLACEARGS_DEBUG
if ( safe2 )
{
{
char tmp[1024];
}
}
#endif // REPLACEARGS_DEBUG
}
else
{
}
}
// Now push our munged params to be the new argv and argc
{
int iz = 0;
{
}
worked = true;
}
}
#ifdef REPLACEARGS_DEBUG
else
{
MessageBoxA( NULL, "Unable to process command-line", "CommandLineToArgvW", MB_OK | MB_ICONINFORMATION );
}
#endif // REPLACEARGS_DEBUG
}
#ifdef REPLACEARGS_DEBUG
else
{
{
MessageBoxA( NULL, "Unable to fetch result from GetCommandLineW()", "GetCommandLineW", MB_OK | MB_ICONINFORMATION );
}
char* line2 = GetCommandLineA();
if ( line2 )
{
{
{
}
}
}
else
{
MessageBoxA( NULL, "Unable to fetch result from GetCommandLineA()", "GetCommandLineA", MB_OK | MB_ICONINFORMATION );
}
}
#endif // REPLACEARGS_DEBUG
return worked;
}
#endif // WIN32
static GSList *
{
gint a;
switch (a) {
case SP_ARG_FILE: {
}
break;
}
case SP_ARG_VERSION: {
exit(0);
break;
}
case SP_ARG_EXTENSIONDIR: {
exit(0);
break;
}
case SP_ARG_VERB_LIST: {
// This really shouldn't go here, we should init the app.
// But, since we're just exiting in this path, there is
// no harm, and this is really a better place to put
// everything else.
exit(0);
break;
}
case SP_ARG_VERB:
case SP_ARG_SELECT: {
// printf("Adding in: %s\n", arg);
}
break;
}
case POPT_ERROR_BADOPT: {
exit(1);
break;
}
default: {
break;
}
}
}
}
}
return fl;
}
/*
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 :