diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-05-14 16:02:50 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-05-14 16:02:50 +0000 |
| commit | 8672bfec38d1838bf17704a4a674f6f713092a62 (patch) | |
| tree | 77a9722108d99a6680be421198537a8da2f92e3e /src | |
| parent | cmake/MSYS2: Install translations for glib (required for help output on console) (diff) | |
| download | inkscape-8672bfec38d1838bf17704a4a674f6f713092a62.tar.gz inkscape-8672bfec38d1838bf17704a4a674f6f713092a62.zip | |
Inkview: new option -f or --fullscreen to lauch Inkview in fullscreen mode
(bzr r15694)
Diffstat (limited to 'src')
| -rw-r--r-- | src/inkview.cpp | 22 | ||||
| -rw-r--r-- | src/svg-view-slideshow.cpp | 15 | ||||
| -rw-r--r-- | src/svg-view-slideshow.h | 21 |
3 files changed, 34 insertions, 24 deletions
diff --git a/src/inkview.cpp b/src/inkview.cpp index 05d8cd1eb..1b19b0e0a 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -56,18 +56,26 @@ class InkviewOptionsGroup : public Glib::OptionGroup { public: - /// List of all input filenames + // list of all input filenames; + // this list contains all arguments that are not recognized as an option (so needs to be checked) Glib::OptionGroup::vecustrings filenames; - /// 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; + bool fullscreen = false; // wether to launch in fullscreen mode + int timer = 0; // time (in seconds) after which the next image of the slideshow is automatically loaded + double scale = 1; // scale factor for images + // (currently only applied to the first image - others are resized to window dimensions) InkviewOptionsGroup() : Glib::OptionGroup(N_("Inkscape Options"), N_("Default program options")) { + // Entry for the "fullscreen" option + Glib::OptionEntry entry_fullscreen; + entry_fullscreen.set_short_name('f'); + entry_fullscreen.set_long_name("fullscreen"); + //entry_fullscreen.set_arg_description(N_("NUM")); + entry_fullscreen.set_description(N_("Launch in fullscreen mode")); + add_entry(entry_fullscreen, fullscreen); + // Entry for the "timer" option Glib::OptionEntry entry_timer; entry_timer.set_short_name('t'); @@ -191,7 +199,7 @@ int main (int argc, char **argv) return 1; /* none of the slides loadable */ } - SPSlideShow ss(valid_files, options.timer, options.scale); + SPSlideShow ss(valid_files, options.fullscreen, options.timer, options.scale); main_instance.run(); return 0; diff --git a/src/svg-view-slideshow.cpp b/src/svg-view-slideshow.cpp index 109b0fcab..8aae185ee 100644 --- a/src/svg-view-slideshow.cpp +++ b/src/svg-view-slideshow.cpp @@ -46,15 +46,15 @@ -SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, int timer, double scale) +SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, bool full_screen, int timer, double scale) : _slides(slides) , _current(0) , _doc(SPDocument::createNewDoc(_slides[0].c_str(), true, false)) + , _fullscreen(full_screen) , _timer(timer) , _scale(scale) , _view(NULL) , _ctrlwin(NULL) - , is_fullscreen(false) { // setup initial document auto default_screen = Gdk::Screen::get_default(); @@ -65,9 +65,12 @@ SPSlideShow::SPSlideShow(std::vector<Glib::ustring> const &slides, int timer, do SP_SVG_VIEW_WIDGET(_view)->setResize( false, _doc->getWidth().value("px"), _doc->getHeight().value("px") ); gtk_widget_show (_view); add(*Glib::wrap(_view)); - + update_title(); show(); + if(_fullscreen) { + fullscreen(); + } // connect signals this->signal_key_press_event().connect(sigc::mem_fun(*this, &SPSlideShow::key_press), false); @@ -280,12 +283,12 @@ bool SPSlideShow::key_press(GdkEventKey* event) goto_last(); break; case GDK_KEY_F11: - if (is_fullscreen) { + if (_fullscreen) { unfullscreen(); - is_fullscreen = false; + _fullscreen = false; } else { fullscreen(); - is_fullscreen = true; + _fullscreen = true; } break; case GDK_KEY_Return: diff --git a/src/svg-view-slideshow.h b/src/svg-view-slideshow.h index cfa0949a4..02159ed6b 100644 --- a/src/svg-view-slideshow.h +++ b/src/svg-view-slideshow.h @@ -37,20 +37,19 @@ class SPSlideShow : public Gtk::ApplicationWindow { public: SPSlideShow(std::vector<Glib::ustring> const &slides, + bool fullscreen, 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; ///< 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; +private: + 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 + bool _fullscreen; // is window fullscreen? (also controls wether to launch in fullscreen mode) + 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 void control_show(); void show_next(); |
