summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2019-04-24 17:09:29 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2019-04-24 17:09:29 +0000
commitce6d9290e0d31aa666d5202a1c5ede1b68c74a7f (patch)
tree446b4323cd365e419efb5dd1c1e48422ff0a5bc6
parentRemove missing extensions from POTFILES.in (diff)
downloadinkscape-ce6d9290e0d31aa666d5202a1c5ede1b68c74a7f.tar.gz
inkscape-ce6d9290e0d31aa666d5202a1c5ede1b68c74a7f.zip
Fix commandline page selection page selection and allow to select poppler in cmd
-rw-r--r--src/extension/internal/pdfinput/pdf-input.cpp3
-rw-r--r--src/inkscape-application.cpp17
-rw-r--r--src/inkscape-application.h2
-rw-r--r--src/inkscape.h8
4 files changed, 28 insertions, 2 deletions
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 5e1a91589..3ff599ebf 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -782,6 +782,9 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
#endif
} else {
page_num = INKSCAPE.get_pdf_page();
+#ifdef HAVE_POPPLER_CAIRO
+ is_importvia_poppler = INKSCAPE.get_pdf_poppler();
+#endif
}
SPDocument *doc = nullptr;
diff --git a/src/inkscape-application.cpp b/src/inkscape-application.cpp
index 97233f32b..77734ecd4 100644
--- a/src/inkscape-application.cpp
+++ b/src/inkscape-application.cpp
@@ -66,6 +66,8 @@ InkscapeApplication::InkscapeApplication()
, _active_document(nullptr)
, _active_selection(nullptr)
, _active_view(nullptr)
+ , _pdf_page(0)
+ , _pdf_poppler(false)
{}
// Add document to app.
@@ -484,6 +486,7 @@ ConcreteInkscapeApplication<T>::ConcreteInkscapeApplication()
// Open/Import
this->add_main_option_entry(T::OPTION_TYPE_INT, "pdf-page", '\0', N_("Open: PDF page to import"), N_("PAGE"));
+ this->add_main_option_entry(T::OPTION_TYPE_BOOL, "pdf-poppler", '\0', N_("Use poppler when importing via commandline"), "");
this->add_main_option_entry(T::OPTION_TYPE_STRING, "convert-dpi-method", '\0', N_("Open: Method used to convert pre-0.92 document dpi, if needed: [none|scale-viewbox|scale-document]."), "[...]");
this->add_main_option_entry(T::OPTION_TYPE_BOOL, "no-convert-text-baseline-spacing", 0, N_("Open: Do not fix pre-0.92 document's text baseline spacing on opening."), "");
@@ -803,6 +806,10 @@ void
ConcreteInkscapeApplication<T>::on_open(const Gio::Application::type_vec_files& files, const Glib::ustring& hint)
{
on_startup2();
+ if(_pdf_poppler)
+ INKSCAPE.set_pdf_poppler(_pdf_poppler);
+ if(_pdf_page)
+ INKSCAPE.set_pdf_page(_pdf_page);
for (auto file : files) {
// Open file
@@ -849,6 +856,10 @@ void
ConcreteInkscapeApplication<Gtk::Application>::on_open(const Gio::Application::type_vec_files& files, const Glib::ustring& hint)
{
on_startup2();
+ if(_pdf_poppler)
+ INKSCAPE.set_pdf_poppler(_pdf_poppler);
+ if(_pdf_page)
+ INKSCAPE.set_pdf_page(_pdf_page);
for (auto file : files) {
if (_with_gui) {
@@ -1131,11 +1142,13 @@ ConcreteInkscapeApplication<T>::on_handle_local_options(const Glib::RefPtr<Glib:
// ================= OPEN/IMPORT ===================
+ if (options->contains("pdf-poppler")) {
+ _pdf_poppler = true;
+ }
if (options->contains("pdf-page")) { // Maybe useful for other file types?
int page = 0;
options->lookup_value("pdf-page", page);
- _command_line_actions.push_back(
- std::make_pair("open-page", Glib::Variant<int>::create(page)));
+ _pdf_page = page;
}
if (options->contains("convert-dpi-method")) {
diff --git a/src/inkscape-application.h b/src/inkscape-application.h
index 05fbafb89..d3c909f4a 100644
--- a/src/inkscape-application.h
+++ b/src/inkscape-application.h
@@ -92,6 +92,8 @@ protected:
bool _with_gui;
bool _batch_process; // Temp
bool _use_shell;
+ int _pdf_page;
+ int _pdf_poppler;
InkscapeApplication();
// Documents are owned by the application which is responsible for opening/saving/exporting. WIP
diff --git a/src/inkscape.h b/src/inkscape.h
index fd9a4c38d..840620171 100644
--- a/src/inkscape.h
+++ b/src/inkscape.h
@@ -193,12 +193,19 @@ public:
// may not be reflected by a selection change and thus needs a separate signal
sigc::signal<void> signal_external_change;
+ void set_pdf_poppler(bool p) {
+ _pdf_poppler = p;
+ }
+ bool get_pdf_poppler() {
+ return _pdf_poppler;
+ }
void set_pdf_page(gint page) {
_pdf_page = page;
}
gint get_pdf_page() {
return _pdf_page;
}
+
void add_gtk_css();
void add_icon_theme();
@@ -225,6 +232,7 @@ public:
static bool _crashIsHappening;
bool _use_gui;
gint _pdf_page;
+ bool _pdf_poppler;
};
} // namespace Inkscape