fixup auto-connection of new MIDI tracks and MIDI tracks with newly-added audio ports
[ardour2.git] / gtk2_ardour / export_timespan_selector.h
blob688971554d134d68442782933b24627539f0b2db
1 /*
2 Copyright (C) 2008 Paul Davis
3 Author: Sakari Bergen
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.
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.
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.
21 #ifndef __export_timespan_selector_h__
22 #define __export_timespan_selector_h__
24 #include "public_editor.h"
25 #include "audio_clock.h"
27 #include <list>
29 #include <gtkmm.h>
30 #include <boost/shared_ptr.hpp>
32 #include "ardour/types.h"
33 #include "ardour/session_handle.h"
34 #include "ardour/export_profile_manager.h"
36 namespace ARDOUR {
37 class Location;
38 class ExportTimespan;
39 class ExportHandler;
42 using ARDOUR::CDMarkerFormat;
44 /// Timespan Selector base
45 class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
47 protected:
48 typedef std::list<ARDOUR::Location *> LocationList;
49 typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
50 typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
52 typedef boost::shared_ptr<ARDOUR::ExportTimespan> TimespanPtr;
53 typedef std::list<TimespanPtr> TimespanList;
54 typedef boost::shared_ptr<TimespanList> TimespanListPtr;
55 typedef ARDOUR::ExportProfileManager::TimespanStatePtr TimespanStatePtr;
57 public:
59 ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
61 virtual ~ExportTimespanSelector ();
63 void sync_with_manager ();
65 sigc::signal<void> CriticalSelectionChanged;
67 protected:
69 ProfileManagerPtr manager;
70 TimespanStatePtr state;
72 virtual void fill_range_list () = 0;
74 void add_range_to_selection (ARDOUR::Location const * loc);
75 void set_time_format_from_state ();
77 void change_time_format ();
79 std::string construct_label (ARDOUR::Location const * location) const;
80 std::string construct_length (ARDOUR::Location const * location) const;
81 std::string bbt_str (framepos_t frames) const;
82 std::string timecode_str (framecnt_t frames) const;
83 std::string ms_str (framecnt_t frames) const;
85 void update_range_name (std::string const & path, std::string const & new_text);
87 /*** GUI components ***/
89 Gtk::HBox option_hbox;
90 Gtk::Label time_format_label;
92 /* Time format */
94 typedef ARDOUR::ExportProfileManager::TimeFormat TimeFormat;
96 struct TimeFormatCols : public Gtk::TreeModelColumnRecord
98 public:
99 Gtk::TreeModelColumn<TimeFormat> format;
100 Gtk::TreeModelColumn<std::string> label;
102 TimeFormatCols () { add(format); add(label); }
104 TimeFormatCols time_format_cols;
105 Glib::RefPtr<Gtk::ListStore> time_format_list;
106 Gtk::ComboBox time_format_combo;
108 /* View */
110 struct RangeCols : public Gtk::TreeModelColumnRecord
112 public:
113 Gtk::TreeModelColumn<ARDOUR::Location *> location;
114 Gtk::TreeModelColumn<std::string> label;
115 Gtk::TreeModelColumn<bool> selected;
116 Gtk::TreeModelColumn<std::string> name;
117 Gtk::TreeModelColumn<std::string> length;
119 RangeCols () { add (location); add(label); add(selected); add(name); add(length); }
121 RangeCols range_cols;
123 Glib::RefPtr<Gtk::ListStore> range_list;
124 Gtk::TreeView range_view;
126 Gtk::ScrolledWindow range_scroller;
129 /// Allows seleting multiple timespans
130 class ExportTimespanSelectorMultiple : public ExportTimespanSelector
132 public:
133 ExportTimespanSelectorMultiple (ARDOUR::Session * session, ProfileManagerPtr manager);
135 private:
137 virtual void fill_range_list ();
139 void set_selection_from_state ();
140 void update_selection ();
141 void update_timespans ();
144 /// Displays one timespan
145 class ExportTimespanSelectorSingle : public ExportTimespanSelector
147 public:
148 ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, std::string range_id);
150 private:
152 virtual void fill_range_list ();
154 std::string range_id;
158 #endif /* __export_timespan_selector_h__ */