vtl: video-monitor letterbox & orig-zoom to menu
authorRobin Gareus <robin@gareus.org>
Wed, 3 Apr 2013 22:51:03 +0000 (00:51 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 3 Apr 2013 23:05:49 +0000 (01:05 +0200)
gtk2_ardour/ardour.menus.in
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/video_monitor.cc
gtk2_ardour/video_timeline.cc

index f101a9dc4fcf6c2552eef86efc7ceae91504cbaa..cc9883066dee9eace3d4d7a41717671719803228 100644 (file)
         <menuitem action="toggle-vmon-frame"/>
         <menuitem action="toggle-vmon-osdbg"/>
         <menuitem action="toggle-vmon-fullscreen"/>
+        <menuitem action="toggle-vmon-letterbox"/>
+        <menuitem action="zoom-vmon-100"/>
 #endif
       </menu>
       <menu action="ScrollMenu">
index c287a259eaa5bc29012d6de4d10bf0e532a20a0d..676b4f18302452872a7e52d7bf38d2b0b71b7689 100644 (file)
@@ -933,6 +933,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Glib::RefPtr<Gtk::ToggleAction> xjadeo_frame_action;
        Glib::RefPtr<Gtk::ToggleAction> xjadeo_osdbg_action;
        Glib::RefPtr<Gtk::ToggleAction> xjadeo_fullscreen_action;
+       Glib::RefPtr<Gtk::ToggleAction> xjadeo_letterbox_action;
+       Glib::RefPtr<Gtk::Action> xjadeo_zoom_100;
        void set_xjadeo_proc ();
        void toggle_xjadeo_proc (int state=-1);
        void set_xjadeo_sensitive (bool onoff);
index 8c81a6122e83df2c2d6d3d0d1ac5e384d34abab3..fb6cd7df810d4844a037f351e97f82d9572f29f2 100644 (file)
@@ -555,6 +555,8 @@ Editor::register_actions ()
        xjadeo_frame_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-frame"), _("Framenumber"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 3)));
        xjadeo_osdbg_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-osdbg"), _("Timecode Background"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 4)));
        xjadeo_fullscreen_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-fullscreen"), _("Fullscreen"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 5)));
+       xjadeo_letterbox_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (editor_actions, X_("toggle-vmon-letterbox"), _("Letterbox"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 6)));
+       xjadeo_zoom_100 = reg_sens (editor_actions, "zoom-vmon-100", _("Original Size"), sigc::bind (sigc::mem_fun (*this, &Editor::set_xjadeo_viewoption), (int) 7));
 
 #endif
 
@@ -581,6 +583,9 @@ Editor::register_actions ()
        xjadeo_osdbg_action->set_sensitive (false);
        xjadeo_fullscreen_action->set_active (false);
        xjadeo_fullscreen_action->set_sensitive (false);
+       xjadeo_letterbox_action->set_active (false);
+       xjadeo_letterbox_action->set_sensitive (false);
+       xjadeo_zoom_100->set_sensitive (false);
 #endif
        if (Profile->get_sae()) {
                ruler_bbt_action->set_active (true);
@@ -800,6 +805,8 @@ Editor::toggle_xjadeo_proc (int state)
        xjadeo_frame_action->set_sensitive(onoff);
        xjadeo_osdbg_action->set_sensitive(onoff);
        xjadeo_fullscreen_action->set_sensitive(onoff);
+       xjadeo_letterbox_action->set_sensitive(onoff);
+       xjadeo_zoom_100->set_sensitive(onoff);
 }
 
 void
@@ -832,6 +839,11 @@ Editor::toggle_xjadeo_viewoption (int what, int state)
                case 5:
                        action = xjadeo_fullscreen_action;
                        break;
+               case 6:
+                       action = xjadeo_letterbox_action;
+                       break;
+               case 7:
+                       return;
                default:
                        return;
        }
@@ -869,6 +881,12 @@ Editor::set_xjadeo_viewoption (int what)
                case 5:
                        action = xjadeo_fullscreen_action;
                        break;
+               case 6:
+                       action = xjadeo_letterbox_action;
+                       break;
+               case 7:
+                       ARDOUR_UI::instance()->video_timeline->control_video_monitor(what, 0);
+                       return;
                default:
                        return;
        }
index fabe4201dd61dd6d5f5227bb047227c9ebcbcc6d..5bc6bb67771439c59c7f42dd03bdd50b9540953e 100644 (file)
@@ -118,7 +118,7 @@ VideoMonitor::open (std::string filename)
        manually_seeked_frame = 0;
        osdmode = 10; // 1: frameno, 2: timecode, 8: box
        sync_by_manual_seek = false;
-       starting = 7;
+       starting = 15;
        process->write_to_stdin("load " + filename + "\n");
        process->write_to_stdin("set fps -1\n");
        process->write_to_stdin("window resize 100%\n");
@@ -132,7 +132,7 @@ VideoMonitor::open (std::string filename)
                process->write_to_stdin(it->first + " " + it->second + "\n");
        }
        if (!state_connection.connected()) {
-               starting = 7;
+               starting = 15;
                querystate();
                state_clk_divide = 0;
                /* TODO once every two second or so -- state_clk_divide hack below */
@@ -197,6 +197,13 @@ VideoMonitor::send_cmd (int what, int param)
                        if (param) process->write_to_stdin("window zoom on\n");
                        else process->write_to_stdin("window zoom off\n");
                        break;
+               case 6:
+                       if (param) process->write_to_stdin("window letterbox on\n");
+                       else process->write_to_stdin("window letterbox off\n");
+                       break;
+               case 7:
+                       process->write_to_stdin("window resize 100%");
+                       break;
                default:
                        break;
        }
@@ -280,6 +287,11 @@ VideoMonitor::parse_output (std::string d, size_t s)
                                                }
                                                xjadeo_settings["window zoom"] = value;
                                        } else if(key ==  "letterbox") {
+                                               if (starting || xjadeo_settings["window letterbox"] != value) {
+                                                       starting &= ~8;
+                                                       if (atoi(value.c_str())) { UiState("xjadeo-window-letterbox-on"); }
+                                                       else { UiState("xjadeo-window-letterbox-off"); }
+                                               }
                                                xjadeo_settings["window letterbox"] = value;
                                        } else if(key ==  "osdmode") {
                                                if (starting || xjadeo_settings["osd mode"] != value) {
index d68df6bc2f00162c518b826a72d5159cf244d50f..9cd9d35315790f7dc48526d0d2cabac6da40da8b 100644 (file)
@@ -601,6 +601,10 @@ VideoTimeLine::gui_update(std::string const & t) {
                editor->toggle_xjadeo_viewoption(5, 1);
        } else if (t == "xjadeo-window-fullscreen-off") {
                editor->toggle_xjadeo_viewoption(5, 0);
+       } else if (t == "xjadeo-window-letterbox-on") {
+               editor->toggle_xjadeo_viewoption(6, 1);
+       } else if (t == "xjadeo-window-letterbox-off") {
+               editor->toggle_xjadeo_viewoption(6, 0);
        }
 }