diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp
index d0e2e881024dfd89fbc5beb6ddcc2d091609b6b5..34cdecdcae44a063d0a98a8ff89c1704fd7d4e77 100644 (file)
-/** \file
- * Enhanced Metafile Input and Output.
+/** @file
+ * @brief Windows-only Enhanced Metafile input and output.
*/
-/*
- * Authors:
+/* Authors:
* Ulf Erikson <ulferikson@users.sf.net>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2006-2008 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
- */
-/*
+ *
* References:
* - How to Create & Play Enhanced Metafiles in Win32
* http://support.microsoft.com/kb/q145999/
gchar *oldoutput;
unsigned int ret;
- sp_document_ensure_up_to_date(doc);
+ doc->ensureUpToDate();
mod = Inkscape::Extension::get_print(PRINT_EMF_WIN32);
oldconst = mod->get_param_string("destination");
oldoutput = g_strdup(oldconst);
- mod->set_param_string("destination", (gchar *)filename);
+ mod->set_param_string("destination", filename);
/* Start */
context.module = mod;
/* fixme: This has to go into module constructor somehow */
/* Create new arena */
- mod->base = SP_ITEM(sp_document_root(doc));
+ mod->base = SP_ITEM(doc->getRoot());
mod->arena = NRArena::create();
- mod->dkey = sp_item_display_key_new(1);
- mod->root = sp_item_invoke_show(mod->base, mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
+ mod->dkey = SPItem::display_key_new(1);
+ mod->root = mod->base->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY);
/* Print document */
ret = mod->begin(doc);
if (ret) {
+ g_free(oldoutput);
throw Inkscape::Extension::Output::save_failed();
}
- sp_item_invoke_print(mod->base, &context);
+ mod->base->invoke_print(&context);
ret = mod->finish();
/* Release arena */
- sp_item_invoke_hide(mod->base, mod->dkey);
+ mod->base->invoke_hide(mod->dkey);
mod->base = NULL;
- nr_arena_item_unref(mod->root);
mod->root = NULL;
nr_object_unref((NRObject *) mod->arena);
mod->arena = NULL;
void
-EmfWin32::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *uri)
+EmfWin32::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename)
{
Inkscape::Extension::Extension * ext;
@@ -162,10 +162,7 @@ EmfWin32::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *
bool new_val = mod->get_param_bool("textToPath");
ext->set_param_bool("textToPath", new_val);
- gchar * final_name;
- final_name = g_strdup_printf("%s", uri);
- emf_print_document_to_file(doc, final_name);
- g_free(final_name);
+ emf_print_document_to_file(doc, filename);
ext->set_param_bool("textToPath", old_textToPath);
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;
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 {
// std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl;
- SPDocument *doc = sp_document_new_from_mem(d.outsvg->c_str(), d.outsvg->length(), TRUE);
+ SPDocument *doc = SPDocument::createNewDocFromMem(d.outsvg->c_str(), d.outsvg->length(), TRUE);
delete d.outsvg;
delete d.path;
} } } /* namespace Inkscape, Extension, Implementation */
-
#endif /* WIN32 */
-
-
/*
Local Variables:
- mode:cpp
+ mode:c++
c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0))
+ 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 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :