4eed7dc2008855a157db3239a480f6ee941dea29
[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
29 #include "export_format_selector.h"
30 #include "export_filename_selector.h"
31
32 namespace ARDOUR {
33         class Session;
34 }
35
36
37 class ExportFileNotebook : public Gtk::Notebook
38 {
39   public:
40
41         ExportFileNotebook ();
42
43         void set_session_and_manager (ARDOUR::Session * s, boost::shared_ptr<ARDOUR::ExportProfileManager> manager);
44         void sync_with_manager ();
45
46         Glib::ustring get_nth_format_name (uint32_t n);
47
48         sigc::signal<void> CriticalSelectionChanged;
49
50   private:
51
52         typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr;
53         typedef boost::shared_ptr<ARDOUR::ExportFormatSpecification> FormatPtr;
54         typedef boost::shared_ptr<ARDOUR::ExportFilename> FilenamePtr;
55         class FilePage;
56
57         ManagerPtr        profile_manager;
58         ARDOUR::Session * session;
59
60         void add_new_file_page ();
61         void add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state);
62         void remove_file_page (FilePage * page);
63         void update_remove_file_page_sensitivity ();
64
65         sigc::connection page_change_connection;
66         void handle_page_change (GtkNotebookPage*, uint32_t page);
67
68         Gtk::HBox    new_file_hbox;
69         Gtk::Button  new_file_button;
70         Gtk::VBox    new_file_dummy;
71
72         uint32_t     last_visible_page;
73         uint32_t     page_counter;
74
75         class FilePage : public Gtk::VBox {
76           public:
77                 FilePage (ARDOUR::Session * s, ManagerPtr profile_manager, ExportFileNotebook * parent, uint32_t number,
78                           ARDOUR::ExportProfileManager::FormatStatePtr format_state,
79                           ARDOUR::ExportProfileManager::FilenameStatePtr filename_state);
80
81                 virtual ~FilePage ();
82
83                 Gtk::Widget & get_tab_widget () { return tab_widget; }
84                 void set_remove_sensitive (bool value);
85                 Glib::ustring get_format_name () const;
86
87                 ARDOUR::ExportProfileManager::FormatStatePtr   get_format_state () const { return format_state; }
88                 ARDOUR::ExportProfileManager::FilenameStatePtr get_filename_state () const { return filename_state; }
89
90                 sigc::signal<void> CriticalSelectionChanged;
91
92           private:
93                 void save_format_to_manager (FormatPtr format);
94                 void update_tab_label ();
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
106                 Gtk::Label              filename_label;
107                 Gtk::Alignment          filename_align;
108                 ExportFilenameSelector  filename_selector;
109
110                 Gtk::HBox               tab_widget;
111                 Gtk::Label              tab_label;
112                 Gtk::Alignment          tab_close_alignment;
113                 Gtk::Button             tab_close_button;
114                 uint32_t                tab_number;
115         };
116 };
117
118 #endif