46d9bc3f069486a18dba139b439cb6fe5af44e5f
[ardour.git] / gtk2_ardour / export_format_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_format_selector_h__
22 #define __export_format_selector_h__
23
24 #include "ardour/export_profile_manager.h"
25
26 #include <gtkmm.h>
27 #include <sigc++/signal.h>
28 #include <boost/shared_ptr.hpp>
29
30 namespace ARDOUR {
31         class Session;
32         class ExportFormatSpecification;
33         class ExportProfileManager;
34 }
35
36 ///
37 class ExportFormatSelector : public Gtk::HBox {
38
39   private:
40
41         typedef boost::shared_ptr<ARDOUR::ExportFormatSpecification> FormatPtr;
42         typedef std::list<FormatPtr> FormatList;
43
44   public:
45
46         ExportFormatSelector ();
47         ~ExportFormatSelector ();
48
49         void set_state (ARDOUR::ExportProfileManager::FormatStatePtr state_, ARDOUR::Session * session_);
50         void update_format_list ();
51
52         sigc::signal<void, FormatPtr> FormatEdited;
53         sigc::signal<void, FormatPtr> FormatRemoved;
54         sigc::signal<FormatPtr, FormatPtr> NewFormat;
55
56         /* Compatibility with other elements */
57
58         sigc::signal<void> CriticalSelectionChanged;
59
60   private:
61
62         void select_format (FormatPtr f);
63         void add_new_format ();
64         void remove_format ();
65         int open_edit_dialog (bool new_dialog = false);
66         void update_format_combo ();
67         void update_format_description ();
68
69         ARDOUR::ExportProfileManager::FormatStatePtr state;
70         ARDOUR::Session * session;
71
72         /*** GUI componenets ***/
73
74         struct FormatCols : public Gtk::TreeModelColumnRecord
75         {
76           public:
77                 Gtk::TreeModelColumn<FormatPtr>      format;
78                 Gtk::TreeModelColumn<Glib::ustring>  label;
79
80                 FormatCols () { add (format); add (label); }
81         };
82         FormatCols                   format_cols;
83         Glib::RefPtr<Gtk::ListStore> format_list;
84         Gtk::ComboBox                format_combo;
85
86         Gtk::Button edit_button;
87         Gtk::Button remove_button;
88         Gtk::Button new_button;
89 };
90
91 #endif /* __export_format_selector_h__ */