use ActionManager namespace, rather than ActionMap objects, and remove all per-contex...
[ardour.git] / gtk2_ardour / export_filename_selector.h
1 /*
2     Copyright (C) 2008 Paul Davis
3     Author: Sakari Bergen
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __export_filename_selector_h__
22 #define __export_filename_selector_h__
23
24 #include <gtkmm/box.h>
25 #include <gtkmm/button.h>
26 #include <gtkmm/checkbutton.h>
27 #include <gtkmm/combobox.h>
28 #include <gtkmm/comboboxtext.h>
29 #include <gtkmm/entry.h>
30 #include <gtkmm/label.h>
31 #include <gtkmm/liststore.h>
32 #include <gtkmm/sizegroup.h>
33 #include <gtkmm/spinbutton.h>
34 #include <gtkmm/treemodel.h>
35
36 #include "ardour/export_profile_manager.h"
37 #include "ardour/export_filename.h"
38 #include "ardour/session_handle.h"
39
40 class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
41 {
42 public:
43         typedef boost::shared_ptr<ARDOUR::ExportFilename> FilenamePtr;
44
45         ExportFilenameSelector ();
46         ~ExportFilenameSelector ();
47
48         void set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_);
49         void set_example_filename (std::string filename);
50         void require_timespan (bool);
51
52         /* Compatibility with other elements */
53
54         sigc::signal<void> CriticalSelectionChanged;
55
56 private:
57
58         void load_state ();
59
60         void update_label ();
61         void update_folder ();
62         void check_folder ();
63
64         void change_date_format ();
65         void change_time_format ();
66
67         void change_session_selection ();
68         void change_timespan_selection ();
69         void change_revision_selection ();
70         void change_revision_value ();
71
72         void open_browse_dialog ();
73         void open_folder ();
74
75         boost::shared_ptr<ARDOUR::ExportFilename> filename;
76
77         Glib::RefPtr<Gtk::SizeGroup> label_sizegroup;
78
79         Gtk::Label        include_label;
80
81         Gtk::HBox         include_hbox;
82
83         Gtk::Label        label_label;
84         Gtk::Entry        label_entry;
85
86         Gtk::ComboBoxText session_snap_name;
87         Gtk::CheckButton  timespan_checkbox;
88
89         Gtk::CheckButton  revision_checkbox;
90         Gtk::SpinButton   revision_spinbutton;
91
92         Gtk::HBox         path_hbox;
93
94         Gtk::Label        path_label;
95         Gtk::Entry        path_entry;
96         Gtk::Button       browse_button;
97         Gtk::Button       open_button;
98         Gtk::Label        example_filename_label;
99
100         /* Date combo */
101
102         typedef ARDOUR::ExportFilename::DateFormat DateFormat;
103
104         struct DateFormatCols : public Gtk::TreeModelColumnRecord
105         {
106         public:
107                 Gtk::TreeModelColumn<DateFormat>     format;
108                 Gtk::TreeModelColumn<std::string>  label;
109
110                 DateFormatCols () { add(format); add(label); }
111         };
112         DateFormatCols               date_format_cols;
113         Glib::RefPtr<Gtk::ListStore> date_format_list;
114         Gtk::ComboBox                date_format_combo;
115
116         /* Time combo */
117
118         typedef ARDOUR::ExportFilename::TimeFormat TimeFormat;
119
120         struct TimeFormatCols : public Gtk::TreeModelColumnRecord
121         {
122         public:
123                 Gtk::TreeModelColumn<TimeFormat>     format;
124                 Gtk::TreeModelColumn<std::string>  label;
125
126                 TimeFormatCols () { add(format); add(label); }
127         };
128         TimeFormatCols               time_format_cols;
129         Glib::RefPtr<Gtk::ListStore> time_format_list;
130         Gtk::ComboBox                time_format_combo;
131
132         /* timespan logic */
133         void update_timespan_sensitivity ();
134         bool _require_timespan;
135 };
136
137 #endif /* __export_filename_selector_h__ */