2 Copyright (C) 2008 Paul Davis
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 "audio_clock.h"
33 #include <boost/shared_ptr.hpp>
36 #include "ardour/types.h"
37 #include "ardour/session_handle.h"
38 #include "ardour/export_profile_manager.h"
46 using ARDOUR::CDMarkerFormat;
47 using ARDOUR::framecnt_t;
49 /// Timespan Selector base
50 class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
53 typedef std::list<ARDOUR::Location *> LocationList;
54 typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
55 typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
57 typedef std::list<ARDOUR::ExportTimespanPtr> TimespanList;
58 typedef boost::shared_ptr<TimespanList> TimespanListPtr;
59 typedef ARDOUR::ExportProfileManager::TimespanStatePtr TimespanStatePtr;
63 ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
65 virtual ~ExportTimespanSelector ();
67 void sync_with_manager ();
69 sigc::signal<void> CriticalSelectionChanged;
73 ProfileManagerPtr manager;
74 TimespanStatePtr state;
76 virtual void fill_range_list () = 0;
78 void add_range_to_selection (ARDOUR::Location const * loc);
79 void set_time_format_from_state ();
81 void change_time_format ();
83 std::string construct_label (ARDOUR::Location const * location) const;
84 std::string construct_length (ARDOUR::Location const * location) const;
85 std::string bbt_str (framepos_t frames) const;
86 std::string timecode_str (framecnt_t frames) const;
87 std::string ms_str (framecnt_t frames) const;
89 void update_range_name (std::string const & path, std::string const & new_text);
91 void set_selection_state_of_all_timespans (bool);
92 int location_sorter(Gtk::TreeModel::iterator a, Gtk::TreeModel::iterator b);
94 /*** GUI components ***/
96 Gtk::HBox option_hbox;
97 Gtk::Label time_format_label;
101 typedef ARDOUR::ExportProfileManager::TimeFormat TimeFormat;
103 struct TimeFormatCols : public Gtk::TreeModelColumnRecord
106 Gtk::TreeModelColumn<TimeFormat> format;
107 Gtk::TreeModelColumn<std::string> label;
109 TimeFormatCols () { add(format); add(label); }
111 TimeFormatCols time_format_cols;
112 Glib::RefPtr<Gtk::ListStore> time_format_list;
113 Gtk::ComboBox time_format_combo;
117 struct RangeCols : public Gtk::TreeModelColumnRecord
120 Gtk::TreeModelColumn<ARDOUR::Location *> location;
121 Gtk::TreeModelColumn<std::string> label;
122 Gtk::TreeModelColumn<bool> selected;
123 Gtk::TreeModelColumn<std::string> name;
124 Gtk::TreeModelColumn<std::string> length;
126 RangeCols () { add (location); add(label); add(selected); add(name); add(length); }
128 RangeCols range_cols;
130 Glib::RefPtr<Gtk::ListStore> range_list;
131 Gtk::TreeView range_view;
133 Gtk::ScrolledWindow range_scroller;
136 /// Allows selecting multiple timespans
137 class ExportTimespanSelectorMultiple : public ExportTimespanSelector
140 ExportTimespanSelectorMultiple (ARDOUR::Session * session, ProfileManagerPtr manager);
144 virtual void fill_range_list ();
146 void set_selection_from_state ();
147 void update_selection ();
148 void update_timespans ();
151 /// Displays one timespan
152 class ExportTimespanSelectorSingle : public ExportTimespanSelector
155 ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, std::string range_id);
159 virtual void fill_range_list ();
161 std::string range_id;
165 #endif /* __export_timespan_selector_h__ */