From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8cf52127b..db908f640 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1228,8 +1228,8 @@ static int sp_process_file_list(GSList *fl) std::vector items; SPRoot *root = doc->getRoot(); doc->ensureUpToDate(); - for ( SPObject *iter = root->firstChild(); iter ; iter = iter->getNext()) { - SPItem* item = (SPItem*) iter; + for (auto& iter: root->_children) { + SPItem* item = (SPItem*) &iter; if (! (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item) || SP_IS_GROUP(item))) { continue; } -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index db908f640..7ab27dcb2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1483,10 +1483,8 @@ do_query_all_recurse (SPObject *o) } } - SPObject *child = o->children; - while (child) { - do_query_all_recurse (child); - child = child->next; + for(auto& child: o->_children) { + do_query_all_recurse (&child); } } -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 7ab27dcb2..c01c4ee46 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1228,7 +1228,7 @@ static int sp_process_file_list(GSList *fl) std::vector items; SPRoot *root = doc->getRoot(); doc->ensureUpToDate(); - for (auto& iter: root->_children) { + for (auto& iter: root->children) { SPItem* item = (SPItem*) &iter; if (! (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item) || SP_IS_GROUP(item))) { continue; @@ -1483,7 +1483,7 @@ do_query_all_recurse (SPObject *o) } } - for(auto& child: o->_children) { + for(auto& child: o->children) { do_query_all_recurse (&child); } } -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/main.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8cf52127b..7678ca241 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,9 +38,6 @@ #include #endif #include -#include -#include -#include #include #ifndef POPT_TABLEEND @@ -48,9 +45,6 @@ #endif /* Not def: POPT_TABLEEND */ #include -#include -#include -#include #if GTK_CHECK_VERSION(3,0,0) #include @@ -63,16 +57,13 @@ #undef 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.h" @@ -93,10 +84,8 @@ #include "helper/action-context.h" #include "helper/png-write.h" -#include "helper/geom.h" #include -#include #include #include #include @@ -114,8 +103,6 @@ #endif // WITH_DBUS #include -#include -#include #include @@ -129,8 +116,6 @@ #include #include "verbs.h" -#include - #include "path-chemistry.h" #include "sp-text.h" #include "sp-flowtext.h" -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 7678ca241..8cf52127b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,6 +38,9 @@ #include #endif #include +#include +#include +#include #include #ifndef POPT_TABLEEND @@ -45,6 +48,9 @@ #endif /* Not def: POPT_TABLEEND */ #include +#include +#include +#include #if GTK_CHECK_VERSION(3,0,0) #include @@ -57,13 +63,16 @@ #undef 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.h" @@ -84,8 +93,10 @@ #include "helper/action-context.h" #include "helper/png-write.h" +#include "helper/geom.h" #include +#include #include #include #include @@ -103,6 +114,8 @@ #endif // WITH_DBUS #include +#include +#include #include @@ -116,6 +129,8 @@ #include #include "verbs.h" +#include + #include "path-chemistry.h" #include "sp-text.h" #include "sp-flowtext.h" -- cgit v1.2.3 From 49a7927ecf31ace696e9e5770e8d6543c356db7a Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 19:15:34 +0100 Subject: Finish removing GTK+ 2 fallbacks (bzr r15023.2.8) --- src/main.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8cf52127b..3c0244e8b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,10 +52,8 @@ #include #include -#if GTK_CHECK_VERSION(3,0,0) #include #include -#endif #include "inkgc/gc-core.h" @@ -1056,8 +1054,6 @@ sp_main_gui(int argc, char const **argv) #endif g_free(usericondir); - -#if GTK_CHECK_VERSION(3,0,0) // Add style sheet (GTK3) Glib::RefPtr screen = Gdk::Screen::get_default(); @@ -1114,7 +1110,6 @@ sp_main_gui(int argc, char const **argv) Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } -#endif gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL); Inkscape::Debug::log_display_config(); -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/main.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8cf52127b..cd93f2ed3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,9 +38,6 @@ #include #endif #include -#include -#include -#include #include #ifndef POPT_TABLEEND @@ -48,9 +45,6 @@ #endif /* Not def: POPT_TABLEEND */ #include -#include -#include -#include #if GTK_CHECK_VERSION(3,0,0) #include @@ -63,16 +57,13 @@ #undef 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.h" @@ -93,10 +84,8 @@ #include "helper/action-context.h" #include "helper/png-write.h" -#include "helper/geom.h" #include -#include #include #include #include @@ -114,9 +103,8 @@ #endif // WITH_DBUS #include -#include #include - +#include #include #ifndef HAVE_BIND_TEXTDOMAIN_CODESET @@ -129,8 +117,6 @@ #include #include "verbs.h" -#include - #include "path-chemistry.h" #include "sp-text.h" #include "sp-flowtext.h" -- cgit v1.2.3 From 5198e76ee434bd68985181d26900d71c1675cc63 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 9 Aug 2016 12:32:55 +0100 Subject: Move some main functions to Application class (bzr r15048) --- src/main.cpp | 104 +++++------------------------------------------------------ 1 file changed, 8 insertions(+), 96 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 28bdf8359..28ae6992f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,7 +46,6 @@ #include -#include #include #include "inkgc/gc-core.h" @@ -101,9 +100,12 @@ #endif // WITH_DBUS #include +#include +#include #include #include #include +#include #ifndef HAVE_BIND_TEXTDOMAIN_CODESET #define bind_textdomain_codeset(p,c) @@ -851,8 +853,8 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) // temporarily switch gettext encoding to locale, so that help messages can be output properly - gchar const *charset; - g_get_charset(&charset); + std::string charset; + Glib::get_charset(charset); bind_textdomain_codeset(GETTEXT_PACKAGE, charset); @@ -998,16 +1000,6 @@ snooper(GdkEvent *event, gpointer /*data*/) { gtk_main_do_event (event); } -static std::vector getDirectorySet(const gchar* userDir, const gchar* const * systemDirs) { - std::vector listing; - listing.push_back(userDir); - for ( const char* const* cur = systemDirs; *cur; cur++ ) - { - listing.push_back(*cur); - } - return listing; -} - int sp_main_gui(int argc, char const **argv) { @@ -1017,103 +1009,23 @@ sp_main_gui(int argc, char const **argv) int retVal = sp_common_main( argc, argv, &fl ); g_return_val_if_fail(retVal == 0, 1); - // Add possible icon entry directories - std::vector dataDirs = getDirectorySet( g_get_user_data_dir(), - g_get_system_data_dirs() ); - for (std::vector::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) - { - std::vector listing; - listing.push_back(*it); - listing.push_back("inkscape"); - listing.push_back("icons"); - Glib::ustring dir = Glib::build_filename(listing); - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), dir.c_str()); - } - - // Add our icon directory to the search path for icon theme lookups. - gchar *usericondir = Inkscape::Application::profile_path("icons"); - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), usericondir); - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), INKSCAPE_PIXMAPDIR); -#ifdef INKSCAPE_THEMEDIR - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), INKSCAPE_THEMEDIR); - gtk_icon_theme_rescan_if_needed (gtk_icon_theme_get_default()); -#endif - g_free(usericondir); - - // Add style sheet (GTK3) - Glib::RefPtr screen = Gdk::Screen::get_default(); - - Glib::ustring inkscape_style = INKSCAPE_UIDIR; - inkscape_style += "/style.css"; - // std::cout << "CSS Stylesheet Inkscape: " << inkscape_style << std::endl; - - if (g_file_test (inkscape_style.c_str(), G_FILE_TEST_EXISTS)) { - Glib::RefPtr provider = Gtk::CssProvider::create(); - - // From 3.16, throws an error which we must catch. - try { - provider->load_from_path (inkscape_style); - } -#if GTK_CHECK_VERSION(3,16,0) - // Gtk::CssProviderError not defined until 3.16. - catch (const Gtk::CssProviderError& ex) - { - std::cerr << "CSSProviderError::load_from_path(): failed to load: " << inkscape_style - << "\n (" << ex.what() << ")" << std::endl; - } -#else - catch (...) - {} -#endif - - Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } else { - std::cerr << "sp_main_gui: Cannot find default style file:\n (" << inkscape_style - << ")" << std::endl; - } - - Glib::ustring user_style = Inkscape::Application::profile_path("ui/style.css"); - // std::cout << "CSS Stylesheet User: " << user_style << std::endl; - - if (g_file_test (user_style.c_str(), G_FILE_TEST_EXISTS)) { - Glib::RefPtr provider2 = Gtk::CssProvider::create(); - - // From 3.16, throws an error which we must catch. - try { - provider2->load_from_path (user_style); - } -#if GTK_CHECK_VERSION(3,16,0) - // Gtk::CssProviderError not defined until 3.16. - catch (const Gtk::CssProviderError& ex) - { - std::cerr << "CSSProviderError::load_from_path(): failed to load: " << user_style - << "\n (" << ex.what() << ")" << std::endl; - } -#else - catch (...) - {} -#endif - - Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } - gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL); Inkscape::Debug::log_display_config(); // Set default window icon. Obeys the theme. - gtk_window_set_default_icon_name("inkscape"); + Gtk::Window::set_default_icon_name("inkscape"); // Do things that were previously in inkscape_gtk_stock_init(). sp_icon_get_phys_size(GTK_ICON_SIZE_MENU); Inkscape::UI::Widget::Panel::prep(); - gboolean create_new = TRUE; + bool create_new = true; /// \todo FIXME BROKEN - non-UTF-8 sneaks in here. Inkscape::Application::create(argv[0], true); while (fl) { if (sp_file_open((gchar *)fl->data,NULL)) { - create_new=FALSE; + create_new=false; } fl = g_slist_remove(fl, fl->data); } -- cgit v1.2.3 From 57f595dad1c2b8eb1862ae8396613b33a4ed8854 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Thu, 18 Aug 2016 23:35:06 +0200 Subject: Fix compilation error (https://inkscape.org/en/paste/9901/) (bzr r15071) --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 28ae6992f..004d96191 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -856,7 +856,7 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) std::string charset; Glib::get_charset(charset); - bind_textdomain_codeset(GETTEXT_PACKAGE, charset); + bind_textdomain_codeset(GETTEXT_PACKAGE, charset.c_str()); poptContext ctx = poptGetContext(NULL, argc, argv, options, 0); poptSetOtherOptionHelp(ctx, _("[OPTIONS...] [FILE...]\n\nAvailable options:")); -- cgit v1.2.3 From 6efece51f99980b824b199bbeb6452f03e6736c6 Mon Sep 17 00:00:00 2001 From: Dmitry Zhulanov Date: Tue, 27 Sep 2016 00:23:14 +0700 Subject: add x-verbs support (bzr r15136.1.1) --- src/main.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 004d96191..d9f11ed8b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -112,6 +112,7 @@ #endif #include "main-cmdlineact.h" +#include "main-cmdlinexact.h" #include "widgets/icon.h" #include @@ -127,6 +128,7 @@ enum { SP_ARG_NOGUI, SP_ARG_GUI, SP_ARG_FILE, + SP_ARG_XVERBS, SP_ARG_PRINT, SP_ARG_EXPORT_PNG, SP_ARG_EXPORT_DPI, @@ -227,6 +229,9 @@ static gchar *sp_export_png_utf8 = NULL; static gchar *sp_export_svg_utf8 = NULL; static gchar *sp_global_printer_utf8 = NULL; +static gchar *sp_xverbs_yaml_utf8 = NULL; +static gchar *sp_xverbs_yaml = NULL; + /** * Reset variables to default values. @@ -301,6 +306,11 @@ struct poptOption options[] = { N_("Open specified document(s) (option string may be excluded)"), N_("FILENAME")}, + {"xverbs", 'B', + POPT_ARG_STRING, &sp_xverbs_yaml, SP_ARG_XVERBS, + N_("xverbs command"), + N_("XVERBS_FILENAME")}, + {"print", 'p', POPT_ARG_STRING, &sp_global_printer, SP_ARG_PRINT, N_("Print document(s) to specified output file (use '| program' for pipe)"), @@ -881,6 +891,7 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) fixupSingleFilename( &sp_export_png, &sp_export_png_utf8 ); fixupSingleFilename( &sp_export_svg, &sp_export_svg_utf8 ); fixupSingleFilename( &sp_global_printer, &sp_global_printer_utf8 ); + fixupSingleFilename( &sp_xverbs_yaml, &sp_xverbs_yaml_utf8 ); } else { @@ -890,6 +901,9 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) sp_export_svg_utf8 = g_strdup( sp_export_svg ); if ( sp_global_printer ) sp_global_printer_utf8 = g_strdup( sp_global_printer ); + if ( sp_xverbs_yaml ) + sp_xverbs_yaml_utf8 = g_strdup( sp_xverbs_yaml ); + } #ifdef WITH_DBUS @@ -2131,6 +2145,14 @@ sp_process_args(poptContext ctx) } break; } + case SP_ARG_XVERBS: { + gchar const *fn = poptGetOptArg(ctx); + if (fn != NULL) { + sp_xverbs_yaml = g_strdup(fn); + Inkscape::CmdLineXAction::createActionsFromYAML((const char *)sp_xverbs_yaml); + } + break; + } case SP_ARG_VERSION: { printf("Inkscape %s (%s)\n", Inkscape::version_string, __DATE__); exit(0); -- cgit v1.2.3 From 81364db0bc98b01319dc5ecb835a4e37b906bad2 Mon Sep 17 00:00:00 2001 From: Dmitry Zhulanov Date: Sat, 1 Oct 2016 13:05:10 +0700 Subject: disable xverb feature if WITH_YAML defined (bzr r15136.1.9) --- src/main.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index d9f11ed8b..5b7dcc5ef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -229,8 +229,10 @@ static gchar *sp_export_png_utf8 = NULL; static gchar *sp_export_svg_utf8 = NULL; static gchar *sp_global_printer_utf8 = NULL; +#ifdef WITH_YAML static gchar *sp_xverbs_yaml_utf8 = NULL; static gchar *sp_xverbs_yaml = NULL; +#endif // WITH_YAML /** @@ -305,12 +307,12 @@ struct poptOption options[] = { POPT_ARG_STRING, NULL, SP_ARG_FILE, N_("Open specified document(s) (option string may be excluded)"), N_("FILENAME")}, - - {"xverbs", 'B', +#ifdef WITH_YAML + {"xverbs", 0, POPT_ARG_STRING, &sp_xverbs_yaml, SP_ARG_XVERBS, N_("xverbs command"), N_("XVERBS_FILENAME")}, - +#endif // WITH_YAML {"print", 'p', POPT_ARG_STRING, &sp_global_printer, SP_ARG_PRINT, N_("Print document(s) to specified output file (use '| program' for pipe)"), @@ -891,7 +893,9 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) fixupSingleFilename( &sp_export_png, &sp_export_png_utf8 ); fixupSingleFilename( &sp_export_svg, &sp_export_svg_utf8 ); fixupSingleFilename( &sp_global_printer, &sp_global_printer_utf8 ); +#ifdef WITH_YAML fixupSingleFilename( &sp_xverbs_yaml, &sp_xverbs_yaml_utf8 ); +#endif // WITH_YAML } else { @@ -901,9 +905,10 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) sp_export_svg_utf8 = g_strdup( sp_export_svg ); if ( sp_global_printer ) sp_global_printer_utf8 = g_strdup( sp_global_printer ); +#ifdef WITH_YAML if ( sp_xverbs_yaml ) sp_xverbs_yaml_utf8 = g_strdup( sp_xverbs_yaml ); - +#endif // WITH_YAML } #ifdef WITH_DBUS @@ -2145,6 +2150,7 @@ sp_process_args(poptContext ctx) } break; } +#ifdef WITH_YAML case SP_ARG_XVERBS: { gchar const *fn = poptGetOptArg(ctx); if (fn != NULL) { @@ -2153,6 +2159,7 @@ sp_process_args(poptContext ctx) } break; } +#endif // WITH_YAML case SP_ARG_VERSION: { printf("Inkscape %s (%s)\n", Inkscape::version_string, __DATE__); exit(0); -- cgit v1.2.3 From f9a55c6269f20bfe98e1eeb0dd07f5bb3036b7ab Mon Sep 17 00:00:00 2001 From: Dmitry Zhulanov Date: Mon, 3 Oct 2016 22:19:23 +0700 Subject: beautify idents (bzr r15136.1.14) --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 5b7dcc5ef..0d5f35797 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -308,7 +308,7 @@ struct poptOption options[] = { N_("Open specified document(s) (option string may be excluded)"), N_("FILENAME")}, #ifdef WITH_YAML - {"xverbs", 0, + {"xverbs", 0, POPT_ARG_STRING, &sp_xverbs_yaml, SP_ARG_XVERBS, N_("xverbs command"), N_("XVERBS_FILENAME")}, -- cgit v1.2.3 From 68c305f169dfe9a273e29dd2aa587f0d59071483 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sun, 6 Nov 2016 16:33:01 +0100 Subject: further cppification Fixed bugs: - https://launchpad.net/bugs/1306662 (bzr r15218) --- src/main.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 0d5f35797..95764aea9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -119,6 +119,7 @@ #include "verbs.h" #include "path-chemistry.h" +#include "object-set.h" #include "sp-text.h" #include "sp-flowtext.h" #include "text-editing.h" @@ -1161,16 +1162,13 @@ static int sp_process_file_list(GSList *fl) // "crop" the document to the specified object, cleaning as we go. SPObject *obj = doc->getObjectById(sp_export_id); - Geom::OptRect const bbox(SP_ITEM(obj)->visualBounds()); - - if (bbox) { - doc->fitToRect(*bbox, false); - } - if (sp_export_id_only) { // If -j then remove all other objects to complete the "crop" doc->getRoot()->cropToObject(obj); } + Inkscape::ObjectSet s(doc); + s.set(obj); + s.fitCanvas(false); } Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false, -- cgit v1.2.3 From 7f1268617b2cdcff5f54dce879213160e478a48e Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Mon, 7 Nov 2016 20:23:12 +0000 Subject: Remove embedded build date, to allow reproducible building. Reproducible Builds is a ongoing project which aims at having "packages" "build" (as in, every build step, be it code compilation, doc generation, etc) be bit-by-bit reproducible regardless of the build environment. With this commit inkscape can be built reproducibly. See https://reproducible-builds.org for more info about the project. (bzr r15222.1.1) --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 95764aea9..fb627a020 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2159,7 +2159,7 @@ sp_process_args(poptContext ctx) } #endif // WITH_YAML case SP_ARG_VERSION: { - printf("Inkscape %s (%s)\n", Inkscape::version_string, __DATE__); + printf("Inkscape %s\n", Inkscape::version_string); exit(0); break; } -- cgit v1.2.3 From 2118ac50fd5fff4306c8882ad230cc4c09c83c60 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Wed, 18 Jan 2017 21:31:12 +0100 Subject: Fix usage information for "--export-pdf-version" (bzr r15422) --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index fb627a020..605c1207e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -420,7 +420,7 @@ struct poptOption options[] = { {"export-pdf-version", 0, POPT_ARG_STRING, &sp_export_pdf_version, SP_ARG_EXPORT_PDF_VERSION, // 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_("Export PDF to given version. (hint: make sure to input a version found in the PDF export dialog, e.g. \"1.4\" which is PDF-a conformant)"), N_("PDF_VERSION")}, {"export-latex", 0, -- cgit v1.2.3 From 6947ff531840b67cafd4c7931e6b7bb9ceaf7d70 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sun, 5 Feb 2017 20:24:08 +0100 Subject: forward-port from 0.92.x the line height conversion from <.92 to >=.92 Code written by su_v in python as an extension, ported to c++ by Mc, some fixes added by bryce. http://bazaar.launchpad.net/~inkscape.dev/inkscape/0.92.x/revision/15338 http://bazaar.launchpad.net/~inkscape.dev/inkscape/0.92.x/revision/15339 http://bazaar.launchpad.net/~inkscape.dev/inkscape/0.92.x/revision/15350 http://bazaar.launchpad.net/~inkscape.dev/inkscape/0.92.x/revision/15351 Option to disable it is called --no-convert-text-baseline-spacing The terminology "convert" is chosen as a jargon word to be used for all such legacy file conversions. The "--no-XXX" naming style is adopted from the convention used by other software such as GIMP. (bzr r15481) --- src/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 605c1207e..47cf43456 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -166,6 +166,7 @@ enum { SP_ARG_SHELL, SP_ARG_VERSION, SP_ARG_VACUUM_DEFS, + SP_ARG_NO_CONVERT_TEXT_BASELINE_SPACING, #ifdef WITH_DBUS SP_ARG_DBUS_LISTEN, SP_ARG_DBUS_NAME, @@ -235,7 +236,6 @@ static gchar *sp_xverbs_yaml_utf8 = NULL; static gchar *sp_xverbs_yaml = NULL; #endif // WITH_YAML - /** * Reset variables to default values. */ @@ -274,6 +274,7 @@ static void resetCommandlineGlobals() { sp_query_all = FALSE; sp_query_id = NULL; sp_vacuum_defs = FALSE; + sp_no_convert_text_baseline_spacing = FALSE; #ifdef WITH_DBUS sp_dbus_listen = FALSE; sp_dbus_name = NULL; @@ -525,6 +526,11 @@ struct poptOption options[] = { N_("Start Inkscape in interactive shell mode."), NULL}, + {"no-convert-text-baseline-spacing", 0, + POPT_ARG_NONE, &sp_no_convert_text_baseline_spacing, SP_ARG_NO_CONVERT_TEXT_BASELINE_SPACING, + N_("Do not fix legacy (pre-0.92) files' text baseline spacing on opening."), + NULL}, + POPT_AUTOHELP POPT_TABLEEND }; @@ -1636,7 +1642,6 @@ static int sp_do_export_png(SPDocument *doc) return retcode; } - /** * Perform a PDF/PS/EPS export * -- cgit v1.2.3 From 860d326a9ac03c2b1e0a3f45c3ed3d35f94c3d54 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 18 Feb 2017 14:21:07 +0100 Subject: Disable GTK3 "client side decorations" on Windows by setting "GTK_CSD=0" They are not used by Inkscape and prevent native theming to be used for window borders and titles. See also https://bugzilla.gnome.org/show_bug.cgi?id=778791 (bzr r15531) --- src/main.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 47cf43456..8be9e2e44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -691,18 +691,22 @@ main(int argc, char **argv) RegistryTool rt; rt.setPathInfo(); } -#elif defined(ENABLE_NLS) -# ifdef ENABLE_BINRELOC + + // disable "client side decorations" as they prevent window borders and titlebars to be drawn with native theming + // see also https://bugzilla.gnome.org/show_bug.cgi?id=778791 + g_setenv("GTK_CSD", "0", FALSE); +#endif + +#ifdef ENABLE_NLS +# ifndef WIN32 +# ifdef ENABLE_BINRELOC bindtextdomain(GETTEXT_PACKAGE, BR_LOCALEDIR("")); -# else +# else bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); // needed by Python/Gettext g_setenv("PACKAGE_LOCALE_DIR", PACKAGE_LOCALE_DIR, TRUE); +# endif # 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. char const *inkscape_localedir = g_getenv("INKSCAPE_LOCALEDIR"); -- cgit v1.2.3 From 1ef85df8c34fc3582edf3edeb623abc010e58d6c Mon Sep 17 00:00:00 2001 From: shlomif-gmail Date: Fri, 21 Apr 2017 22:10:22 +0200 Subject: [Bug #1572242] Add --export-inkscape-svg=FILENAME command line option to export as inkscape-style SVG. Fixed bugs: - https://launchpad.net/bugs/1572242 (bzr r15628) --- src/main.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8be9e2e44..f23f9a9f7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -146,6 +146,7 @@ enum { SP_ARG_EXPORT_BACKGROUND, SP_ARG_EXPORT_BACKGROUND_OPACITY, SP_ARG_EXPORT_SVG, + SP_ARG_EXPORT_INKSCAPE_SVG, SP_ARG_EXPORT_PS, SP_ARG_EXPORT_EPS, SP_ARG_EXPORT_PS_LEVEL, @@ -205,6 +206,7 @@ static gboolean sp_export_area_snap = FALSE; static gboolean sp_export_use_hints = FALSE; static gboolean sp_export_id_only = FALSE; static gchar *sp_export_svg = NULL; +static gchar *sp_export_inkscape_svg = NULL; static gchar *sp_export_ps = NULL; static gchar *sp_export_eps = NULL; static gint sp_export_ps_level = 3; @@ -229,6 +231,7 @@ static gchar *sp_dbus_name = NULL; #endif // WITH_DBUS static gchar *sp_export_png_utf8 = NULL; static gchar *sp_export_svg_utf8 = NULL; +static gchar *sp_export_inkscape_svg_utf8 = NULL; static gchar *sp_global_printer_utf8 = NULL; #ifdef WITH_YAML @@ -257,6 +260,7 @@ static void resetCommandlineGlobals() { sp_export_use_hints = FALSE; sp_export_id_only = FALSE; sp_export_svg = NULL; + sp_export_inkscape_svg = NULL; sp_export_ps = NULL; sp_export_eps = NULL; sp_export_ps_level = 3; @@ -282,6 +286,7 @@ static void resetCommandlineGlobals() { sp_export_png_utf8 = NULL; sp_export_svg_utf8 = NULL; + sp_export_inkscape_svg_utf8 = NULL; sp_global_printer_utf8 = NULL; } @@ -392,6 +397,10 @@ struct poptOption options[] = { N_("Background opacity of exported bitmap (either 0.0 to 1.0, or 1 to 255)"), N_("VALUE")}, + {"export-inkscape-svg", 0, + POPT_ARG_STRING, &sp_export_inkscape_svg, SP_ARG_EXPORT_INKSCAPE_SVG, + N_("Export document to an inkscape SVG file (similar to save as.)"), + N_("FILENAME")}, {"export-plain-svg", 'l', POPT_ARG_STRING, &sp_export_svg, SP_ARG_EXPORT_SVG, N_("Export document to plain SVG file (no sodipodi or inkscape namespaces)"), @@ -903,6 +912,7 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) { fixupSingleFilename( &sp_export_png, &sp_export_png_utf8 ); fixupSingleFilename( &sp_export_svg, &sp_export_svg_utf8 ); + fixupSingleFilename( &sp_export_inkscape_svg, &sp_export_inkscape_svg_utf8 ); fixupSingleFilename( &sp_global_printer, &sp_global_printer_utf8 ); #ifdef WITH_YAML fixupSingleFilename( &sp_xverbs_yaml, &sp_xverbs_yaml_utf8 ); @@ -914,6 +924,8 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) sp_export_png_utf8 = g_strdup( sp_export_png ); if ( sp_export_svg ) sp_export_svg_utf8 = g_strdup( sp_export_svg ); + if ( sp_export_inkscape_svg ) + sp_export_inkscape_svg_utf8 = g_strdup( sp_export_inkscape_svg ); if ( sp_global_printer ) sp_global_printer_utf8 = g_strdup( sp_global_printer ); #ifdef WITH_YAML @@ -1135,20 +1147,21 @@ static int sp_process_file_list(GSList *fl) } #endif // WITH_DBUS - if (!sp_export_svg && (sp_vacuum_defs || has_performed_actions)) { + if (!sp_export_svg && !sp_export_inkscape_svg && (sp_vacuum_defs || has_performed_actions)) { // save under the name given in the command line Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, filename, false, false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); } + if (sp_global_printer) { sp_print_document_to_file(doc, sp_global_printer); } if (sp_export_png || (sp_export_id && sp_export_use_hints)) { retVal |= sp_do_export_png(doc); } - if (sp_export_svg) { + if (sp_export_svg || sp_export_inkscape_svg) { if (sp_export_text_to_path) { - std::vector items; + std::vector items; SPRoot *root = doc->getRoot(); doc->ensureUpToDate(); for (auto& iter: root->children) { @@ -1180,9 +1193,15 @@ static int sp_process_file_list(GSList *fl) s.set(obj); s.fitCanvas(false); } - - Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false, - false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY); + if (sp_export_svg) { + Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false, + false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY); + } + if (sp_export_inkscape_svg) { + // Export as inkscape SVG. + Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, sp_export_inkscape_svg, false, + false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); + } } if (sp_export_ps) { retVal |= do_export_ps_pdf(doc, sp_export_ps, "image/x-postscript"); -- cgit v1.2.3 From 983830727db80ba8e6b1eb6c5663b1f9ab9c866d Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 7 May 2017 18:31:04 +0200 Subject: Minor refactor: check setlocale() occurences and make sure we do not setlocale() without resetting it to the initial default) - inkview.cpp : This occurence in fact does *not* seem to be needed anymore (despite what the comment says) - main.cpp : The (commented out) occurence is unnecessary as it is called as part of gtk_init_check() (bzr r15674) --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index f23f9a9f7..3a7050f9b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1325,7 +1325,6 @@ int sp_main_console(int argc, char const **argv) char **argv2 = const_cast(argv); gtk_init_check( &argc, &argv2 ); - //setlocale(LC_ALL, ""); GSList *fl = NULL; int retVal = sp_common_main( argc, argv, &fl ); -- cgit v1.2.3 From 0d59c73ce3f5b569df6037436654c24f19c5e537 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 7 May 2017 21:11:29 +0200 Subject: Use glib to get the installation prefix on Windows (bzr r15675.1.1) --- src/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 3a7050f9b..c4fcb6589 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -680,19 +680,19 @@ main(int argc, char **argv) #endif #ifdef WIN32 - gchar *exedir = g_strdup(win32_getExePath().data()); - _win32_set_inkscape_env(exedir); + gchar *datadir = g_win32_get_package_installation_directory_of_module(NULL); + _win32_set_inkscape_env(datadir); # ifdef ENABLE_NLS // obtain short path to executable dir and pass it // to bindtextdomain (it doesn't understand UTF-8) - gchar *shortexedir = g_win32_locale_filename_from_utf8(exedir); - gchar *localepath = g_build_filename(shortexedir, PACKAGE_LOCALE_DIR, NULL); + gchar *shortdatadir = g_win32_locale_filename_from_utf8(datadir); + gchar *localepath = g_build_filename(shortdatadir, PACKAGE_LOCALE_DIR, NULL); bindtextdomain(GETTEXT_PACKAGE, localepath); - g_free(shortexedir); + g_free(shortdatadir); g_free(localepath); # endif - g_free(exedir); + g_free(datadir); // Don't touch the registry (works fine without it) for Inkscape Portable gchar const *val = g_getenv("INKSCAPE_PORTABLE_PROFILE_DIR"); -- cgit v1.2.3 From 6e0b1cc358cadb3bfefceb39acf613ac7450b978 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 7 May 2017 22:50:07 +0200 Subject: Move gettext initialization into separate function so it can be re-used (will come in handy in inkview) (bzr r15675.1.2) --- src/main.cpp | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index c4fcb6589..02562383a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,6 +80,7 @@ #include "debug/log-display-config.h" #include "helper/action-context.h" +#include "helper/gettext.h" #include "helper/png-write.h" #include @@ -679,19 +680,13 @@ main(int argc, char **argv) fpsetmask(fpgetmask() & ~(FP_X_DZ | FP_X_INV)); #endif +#ifdef ENABLE_NLS + Inkscape::initialize_gettext(); +#endif + #ifdef WIN32 gchar *datadir = g_win32_get_package_installation_directory_of_module(NULL); _win32_set_inkscape_env(datadir); - -# ifdef ENABLE_NLS - // obtain short path to executable dir and pass it - // to bindtextdomain (it doesn't understand UTF-8) - gchar *shortdatadir = g_win32_locale_filename_from_utf8(datadir); - gchar *localepath = g_build_filename(shortdatadir, PACKAGE_LOCALE_DIR, NULL); - bindtextdomain(GETTEXT_PACKAGE, localepath); - g_free(shortdatadir); - g_free(localepath); -# endif g_free(datadir); // Don't touch the registry (works fine without it) for Inkscape Portable @@ -705,29 +700,6 @@ main(int argc, char **argv) // see also https://bugzilla.gnome.org/show_bug.cgi?id=778791 g_setenv("GTK_CSD", "0", FALSE); #endif - -#ifdef ENABLE_NLS -# ifndef WIN32 -# ifdef ENABLE_BINRELOC - bindtextdomain(GETTEXT_PACKAGE, BR_LOCALEDIR("")); -# else - bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); - // needed by Python/Gettext - g_setenv("PACKAGE_LOCALE_DIR", PACKAGE_LOCALE_DIR, TRUE); -# endif -# endif - // Allow the user to override the locale directory by setting - // the environment variable INKSCAPE_LOCALEDIR. - char const *inkscape_localedir = g_getenv("INKSCAPE_LOCALEDIR"); - if (inkscape_localedir != NULL) { - bindtextdomain(GETTEXT_PACKAGE, inkscape_localedir); - } - - // common setup - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); - textdomain(GETTEXT_PACKAGE); -#endif - set_extensions_env(); // Prevents errors like "Unable to wrap GdkPixbuf..." (in nr-filter-image.cpp for example) -- cgit v1.2.3 From c91214d837562c6244053dfeaf99aa2d8b8deded Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 8 May 2017 00:11:49 +0200 Subject: Move functions for switching gettext charset to helper/gettext.h (bzr r15675.1.3) --- src/main.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 02562383a..b2817fa97 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -857,10 +857,7 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) // temporarily switch gettext encoding to locale, so that help messages can be output properly - std::string charset; - Glib::get_charset(charset); - - bind_textdomain_codeset(GETTEXT_PACKAGE, charset.c_str()); + Inkscape::bind_textdomain_codeset_console(); poptContext ctx = poptGetContext(NULL, argc, argv, options, 0); poptSetOtherOptionHelp(ctx, _("[OPTIONS...] [FILE...]\n\nAvailable options:")); @@ -871,7 +868,7 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) poptFreeContext(ctx); // now switch gettext back to UTF-8 (for GUI) - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + Inkscape::bind_textdomain_codeset_utf8(); // Now let's see if the file list still holds up if ( needToRecodeParams ) -- cgit v1.2.3 From f5ab987943d3d54291dfe9369b7cb9855ddb7d8f Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 8 May 2017 00:14:37 +0200 Subject: Properly handle ENABLE_NLS define (bzr r15675.1.4) --- src/main.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index b2817fa97..4c63402fb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,8 +80,10 @@ #include "debug/log-display-config.h" #include "helper/action-context.h" -#include "helper/gettext.h" #include "helper/png-write.h" +#ifdef ENABLE_NLS +#include "helper/gettext.h" +#endif #include #include @@ -108,10 +110,6 @@ #include #include -#ifndef HAVE_BIND_TEXTDOMAIN_CODESET -#define bind_textdomain_codeset(p,c) -#endif - #include "main-cmdlineact.h" #include "main-cmdlinexact.h" #include "widgets/icon.h" @@ -851,13 +849,10 @@ static GSList *fixupFilenameEncoding( GSList* fl ) static int sp_common_main( int argc, char const **argv, GSList **flDest ) { - /// \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); - - +#ifdef ENABLE_NLS // temporarily switch gettext encoding to locale, so that help messages can be output properly Inkscape::bind_textdomain_codeset_console(); +#endif poptContext ctx = poptGetContext(NULL, argc, argv, options, 0); poptSetOtherOptionHelp(ctx, _("[OPTIONS...] [FILE...]\n\nAvailable options:")); @@ -866,9 +861,11 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) /* Collect own arguments */ GSList *fl = sp_process_args(ctx); poptFreeContext(ctx); - + +#ifdef ENABLE_NLS // now switch gettext back to UTF-8 (for GUI) Inkscape::bind_textdomain_codeset_utf8(); +#endif // Now let's see if the file list still holds up if ( needToRecodeParams ) -- cgit v1.2.3 From 9a1906ee1091744357b32e0159b6019dc6476544 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Mon, 5 Jun 2017 00:58:45 +0200 Subject: Porting the pre-92 file update message from 0.92.x to trunk: New dialog when opening pre-0.92 files (with 90 dpi). I implemented it mostly based on mizmo's UI proposal (thanks!), with additional inputs from su_v with a few bugfixes from jabiertxof Also adds a commandline option --convert-dpi-method=[none|scale-viewbox|scale-document] to be able to batch convert files. Fixed bugs: - https://launchpad.net/bugs/1659229 (bzr r15703.1.26) --- src/main.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 4c63402fb..7a786234e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,7 @@ * ... and various people who have worked with various projects * Jon A. Cruz * Abhishek Sharma + * Marc Jeanmougin * * Copyright (C) 1999-2004 authors * Copyright (C) 2001-2002 Ximian, Inc. @@ -167,6 +168,7 @@ enum { SP_ARG_VERSION, SP_ARG_VACUUM_DEFS, SP_ARG_NO_CONVERT_TEXT_BASELINE_SPACING, + SP_ARG_CONVERT_DPI_METHOD, #ifdef WITH_DBUS SP_ARG_DBUS_LISTEN, SP_ARG_DBUS_NAME, @@ -278,6 +280,7 @@ static void resetCommandlineGlobals() { sp_query_id = NULL; sp_vacuum_defs = FALSE; sp_no_convert_text_baseline_spacing = FALSE; + sp_file_convert_dpi_method_commandline = -1; #ifdef WITH_DBUS sp_dbus_listen = FALSE; sp_dbus_name = NULL; @@ -539,6 +542,11 @@ struct poptOption options[] = { N_("Do not fix legacy (pre-0.92) files' text baseline spacing on opening."), NULL}, + {"convert-dpi-method", 0, + POPT_ARG_STRING, NULL, SP_ARG_CONVERT_DPI_METHOD, + N_("Method used to convert pre-.92 document dpi, if needed."), + "[none|scale-viewbox|scale-document]"}, + POPT_AUTOHELP POPT_TABLEEND }; @@ -2180,6 +2188,21 @@ sp_process_args(poptContext ctx) } break; } + case SP_ARG_CONVERT_DPI_METHOD: { + gchar const *arg = poptGetOptArg(ctx); + if (arg != NULL) { + if (!strcmp(arg,"none")) { + sp_file_convert_dpi_method_commandline = FILE_DPI_UNCHANGED; + } else if (!strcmp(arg,"scale-viewbox")) { + sp_file_convert_dpi_method_commandline = FILE_DPI_VIEWBOX_SCALED; + } else if (!strcmp(arg,"scale-document")) { + sp_file_convert_dpi_method_commandline = FILE_DPI_DOCUMENT_SCALED; + } else { + g_warning("Invalid update option"); + } + } + break; + } case POPT_ERROR_BADOPT: { g_warning ("Invalid option %s", poptBadOption(ctx, 0)); exit(1); -- cgit v1.2.3