diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-05-14 04:11:55 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-05-14 04:11:55 +0000 |
| commit | 1be23961b14fb409ee1a13fde6de676111587356 (patch) | |
| tree | b96dbfe3a258e24c5ba1bea2251ce5a81b6963e9 /src | |
| parent | Inkview: Add additional information to help output and update option description (diff) | |
| download | inkscape-1be23961b14fb409ee1a13fde6de676111587356.tar.gz inkscape-1be23961b14fb409ee1a13fde6de676111587356.zip | |
Inkview: add option -s or --scale to set a factor by witch to scale the displayed image
Fixed bugs:
- https://launchpad.net/bugs/1550897
(bzr r15690.1.14)
Diffstat (limited to 'src')
| -rw-r--r-- | src/inkview.cpp | 35 | ||||
| -rw-r--r-- | src/svg-view-slideshow.cpp | 7 | ||||
| -rw-r--r-- | src/svg-view-slideshow.h | 16 |
3 files changed, 36 insertions, 22 deletions
diff --git a/src/inkview.cpp b/src/inkview.cpp index f1eb1cfc6..e50c76ab0 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -59,26 +59,37 @@ public: /// List of all input filenames Glib::OptionGroup::vecustrings filenames; - /// Input timer option + /// timer for the slideshow int timer = 0; + + /// scale factor for images (currently only applied to the first image - others are resized to window dimensions) + double scale = 1; InkviewOptionsGroup() : Glib::OptionGroup(N_("Inkscape Options"), N_("Default program options")) { // Entry for the "timer" option - Glib::OptionEntry _entry_timer; - _entry_timer.set_short_name('t'); - _entry_timer.set_long_name("timer"); - _entry_timer.set_arg_description(N_("NUM")); - _entry_timer.set_description(N_("Change image every NUM seconds")); - add_entry(_entry_timer, timer); + Glib::OptionEntry entry_timer; + entry_timer.set_short_name('t'); + entry_timer.set_long_name("timer"); + entry_timer.set_arg_description(N_("NUM")); + entry_timer.set_description(N_("Change image every NUM seconds")); + add_entry(entry_timer, timer); + + // Entry for the "scale" option + Glib::OptionEntry entry_scale; + entry_scale.set_short_name('s'); + entry_scale.set_long_name("scale"); + entry_scale.set_arg_description(N_("NUM")); + entry_scale.set_description(N_("Scale image by factor NUM")); + add_entry(entry_scale, scale); // Entry for the remaining non-option arguments - Glib::OptionEntry _entry_args; - _entry_args.set_long_name(G_OPTION_REMAINING); - _entry_args.set_arg_description(N_("FILES/FOLDERS …")); + Glib::OptionEntry entry_args; + entry_args.set_long_name(G_OPTION_REMAINING); + entry_args.set_arg_description(N_("FILES/FOLDERS …")); - add_entry(_entry_args, filenames); + add_entry(entry_args, filenames); } }; @@ -173,7 +184,7 @@ int main (int argc, char **argv) return 1; /* none of the slides loadable */ } - SPSlideShow ss(valid_files, options.timer); + SPSlideShow ss(valid_files, options.timer, options.scale); main_instance.run(); return 0; diff --git a/src/svg-view-slideshow.cpp b/src/svg-view-slideshow.cpp index a025eed9e..109b0fcab 100644 --- a/src/svg-view-slideshow.cpp +++ b/src/svg-view-slideshow.cpp @@ -46,19 +46,20 @@ -SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, int timer) +SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, int timer, double scale) : _slides(slides) , _current(0) , _doc(SPDocument::createNewDoc(_slides[0].c_str(), true, false)) , _timer(timer) + , _scale(scale) , _view(NULL) , _ctrlwin(NULL) , is_fullscreen(false) { // setup initial document auto default_screen = Gdk::Screen::get_default(); - set_default_size(MIN ((int)_doc->getWidth().value("px"), default_screen->get_width() - 64), - MIN ((int)_doc->getHeight().value("px"), default_screen->get_height() - 64)); + set_default_size(MIN ((int)_doc->getWidth().value("px")*_scale, default_screen->get_width() - 64), + MIN ((int)_doc->getHeight().value("px")*_scale, default_screen->get_height() - 64)); _view = sp_svg_view_widget_new(_doc); SP_SVG_VIEW_WIDGET(_view)->setResize( false, _doc->getWidth().value("px"), _doc->getHeight().value("px") ); diff --git a/src/svg-view-slideshow.h b/src/svg-view-slideshow.h index 3bab8f28f..cfa0949a4 100644 --- a/src/svg-view-slideshow.h +++ b/src/svg-view-slideshow.h @@ -37,15 +37,17 @@ class SPSlideShow : public Gtk::ApplicationWindow { public: SPSlideShow(std::vector<Glib::ustring> const &slides, - int timer); + int timer, + double scale); private: - std::vector<Glib::ustring> _slides; ///< List of filenames for each slide - int _current; ///< Index of the currently displayed slide - SPDocument *_doc; ///< The currently displayed slide - int _timer; - GtkWidget *_view; - Gtk::Window *_ctrlwin; ///< Window containing slideshow control buttons + std::vector<Glib::ustring> _slides; ///< list of filenames for each slide + int _current; ///< index of the currently displayed slide + SPDocument *_doc; ///< parsed SPDocument of the currently displayed slide + int _timer; ///< time after which slides are automatically changed (in seconds) + double _scale; ///< scale factor for images + GtkWidget *_view; ///< the canvas to which the images are drawn + Gtk::Window *_ctrlwin; ///< window containing slideshow control buttons /// Current state of application (full-screen or windowed) bool is_fullscreen; |
