Enable Menu > Quit to work again after startup on macOS
[ardour.git] / gtk2_ardour / add_video_dialog.h
1 /*
2  * Copyright (C) 2013-2017 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 #ifndef __gtk_ardour_add_video_dialog_h__
19 #define __gtk_ardour_add_video_dialog_h__
20
21 #include <string>
22
23 #ifdef interface
24 #undef interface
25 #endif
26
27 #include <gtkmm/box.h>
28 #include <gtkmm/button.h>
29 #include <gtkmm/cellrendererpixbuf.h>
30 #include <gtkmm/checkbutton.h>
31 #include <gtkmm/filechooserwidget.h>
32 #include <gtkmm/image.h>
33 #include <gtkmm/label.h>
34 #include <gtkmm/liststore.h>
35 #include <gtkmm/notebook.h>
36 #include <gtkmm/scale.h>
37 #include <gtkmm/treemodel.h>
38 #include <gtkmm/treeview.h>
39
40 #include "ardour/types.h"
41 #include "ardour/template_utils.h"
42 #include <gtkmm/filechooserwidget.h>
43 #include "ardour_dialog.h"
44
45 enum VtlImportOption {
46  VTL_IMPORT_NONE = 0,
47  VTL_IMPORT_TRANSCODE = 1,
48 };
49
50 class AddVideoDialog : public ArdourDialog
51 {
52 public:
53         AddVideoDialog (ARDOUR::Session*);
54         ~AddVideoDialog ();
55
56         std::string file_name (bool &local_file);
57         VtlImportOption import_option ();
58         bool launch_xjadeo ();
59         bool auto_set_session_fps ();
60
61 private:
62         void on_show ();
63         bool page_switch();
64         void set_action_ok(bool yn);
65         void clear_preview_image();
66
67         /* preview pane related */
68         void request_preview(std::string vpath);
69         void seek_preview();
70
71         Gtk::Image *preview_image;
72         Gtk::HScale seek_slider;
73         Glib::RefPtr<Gdk::Pixbuf> imgbuf;
74         std::string preview_path;
75         Gtk::Label pi_tcin;
76         Gtk::Label pi_tcout;
77         Gtk::Label pi_aspect;
78         Gtk::Label pi_fps;
79
80         /* file chooser related */
81         void file_selection_changed ();
82         void file_activated ();
83         bool on_video_filter (const Gtk::FileFilter::Info& filter_info);
84
85         Gtk::FileChooserWidget chooser;
86
87         Gtk::CheckButton  xjadeo_checkbox;
88         Gtk::CheckButton  set_session_fps_checkbox;
89         Gtk::Notebook notebook;
90         Gtk::Button *ok_button;
91
92         Gtk::VBox server_index_box;
93         Gtk::VBox file_chooser_box;
94         Gtk::HBox browser_container;
95
96         /* Harvid Browser related */
97         class HarvidColumns : public Gtk::TreeModel::ColumnRecord
98         {
99         public:
100                 Gtk::TreeModelColumn<std::string> id;
101                 Gtk::TreeModelColumn<std::string> uri;
102                 Gtk::TreeModelColumn<std::string> filename;
103
104                 HarvidColumns() {
105                         add(id);
106                         add(filename);
107                         add(uri);
108                 }
109         };
110
111         Gtk::CellRendererPixbuf pixBufRenderer;
112
113         void harvid_list_view_selected ();
114         void harvid_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
115         void harvid_request(std::string u);
116         void harvid_load_docroot();
117
118         bool harvid_initialized;
119         Gtk::Label harvid_path;
120         Gtk::Button harvid_reset;
121         HarvidColumns harvid_list_columns;
122         Glib::RefPtr<Gtk::ListStore> harvid_list;
123         Gtk::TreeView harvid_list_view;
124
125         bool show_advanced;
126         bool loaded_docroot;
127 };
128
129 #endif /* __gtk_ardour_add_video_dialog_h__ */