incomplete merge of master into windows (requires upcoming changes to master to be...
[ardour.git] / gtk2_ardour / export_file_notebook.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_file_notebook_h__
22 #define __export_file_notebook_h__
23
24 #include <sigc++/signal.h>
25 #include <gtkmm.h>
26
27 #include "ardour/export_profile_manager.h"
28 #include "ardour/session_handle.h"
29
30 #include "export_format_selector.h"
31 #include "export_filename_selector.h"
32
33 class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr
34 {
35   public:
36
37         ExportFileNotebook ();
38
39         void set_session_and_manager (ARDOUR::Session * s, boost::shared_ptr<ARDOUR::ExportProfileManager> manager);
40         void sync_with_manager ();
41
42         void update_example_filenames();
43
44         std::string get_nth_format_name (uint32_t n);
45
46         sigc::signal<void> CriticalSelectionChanged;
47
48   private:
49
50         typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr;
51         typedef boost::shared_ptr<ARDOUR::ExportFormatSpecification> FormatPtr;
52         typedef boost::shared_ptr<ARDOUR::ExportFilename> FilenamePtr;
53         class FilePage;
54
55         ManagerPtr        profile_manager;
56
57         void add_new_file_page ();
58         void add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state);
59         void remove_file_page (FilePage * page);
60         void update_remove_file_page_sensitivity ();
61
62         sigc::connection page_change_connection;
63         void handle_page_change (GtkNotebookPage*, uint32_t page);
64
65         Gtk::HBox    new_file_hbox;
66         Gtk::Button  new_file_button;
67         Gtk::VBox    new_file_dummy;
68
69         uint32_t     last_visible_page;
70         uint32_t     page_counter;
71
72         class FilePage : public Gtk::VBox {
73           public:
74                 FilePage (ARDOUR::Session * s, ManagerPtr profile_manager, ExportFileNotebook * parent, uint32_t number,
75                           ARDOUR::ExportProfileManager::FormatStatePtr format_state,
76                           ARDOUR::ExportProfileManager::FilenameStatePtr filename_state);
77
78                 virtual ~FilePage ();
79
80                 Gtk::Widget & get_tab_widget () { return tab_widget; }
81                 void set_remove_sensitive (bool value);
82                 std::string get_format_name () const;
83
84                 void update_example_filename();
85
86                 ARDOUR::ExportProfileManager::FormatStatePtr   get_format_state () const { return format_state; }
87                 ARDOUR::ExportProfileManager::FilenameStatePtr get_filename_state () const { return filename_state; }
88
89                 sigc::signal<void> CriticalSelectionChanged;
90
91           private:
92                 void save_format_to_manager (FormatPtr format);
93                 void update_tab_label ();
94                 void critical_selection_changed ();
95
96                 ARDOUR::ExportProfileManager::FormatStatePtr   format_state;
97                 ARDOUR::ExportProfileManager::FilenameStatePtr filename_state;
98                 ManagerPtr                                     profile_manager;
99
100                 /* GUI components */
101
102                 Gtk::Label              format_label;
103                 Gtk::Alignment          format_align;
104                 ExportFormatSelector    format_selector;
105                 PBD::ScopedConnection   format_connection;
106
107                 Gtk::Label              filename_label;
108                 Gtk::Alignment          filename_align;
109                 ExportFilenameSelector  filename_selector;
110
111                 Gtk::HBox               tab_widget;
112                 Gtk::Label              tab_label;
113                 Gtk::Alignment          tab_close_alignment;
114                 Gtk::Button             tab_close_button;
115                 uint32_t                tab_number;
116         };
117 };
118
119 #endif