ardour
export_timespan_selector.h
Go to the documentation of this file.
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_timespan_selector_h__
22 #define __export_timespan_selector_h__
23 
24 #include "audio_clock.h"
25 
26 #include <list>
27 
28 #ifdef interface
29 #undef interface
30 #endif
31 
32 #include <gtkmm.h>
33 #include <boost/shared_ptr.hpp>
34 
35 
36 #include "ardour/types.h"
37 #include "ardour/session_handle.h"
39 
40 namespace ARDOUR {
41  class Location;
42  class ExportTimespan;
43  class ExportHandler;
44 }
45 
47 using ARDOUR::framecnt_t;
48 
50 class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
51 {
52  protected:
53  typedef std::list<ARDOUR::Location *> LocationList;
56 
57  typedef std::list<ARDOUR::ExportTimespanPtr> TimespanList;
60 
61  public:
62 
63  ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
64 
65  virtual ~ExportTimespanSelector ();
66 
67  void sync_with_manager ();
68 
69  sigc::signal<void> CriticalSelectionChanged;
70 
71  protected:
72 
73  ProfileManagerPtr manager;
74  TimespanStatePtr state;
75 
76  virtual void fill_range_list () = 0;
77 
78  void add_range_to_selection (ARDOUR::Location const * loc);
80 
81  void change_time_format ();
82 
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;
88 
89  void update_range_name (std::string const & path, std::string const & new_text);
90 
92  int location_sorter(Gtk::TreeModel::iterator a, Gtk::TreeModel::iterator b);
93 
94  /*** GUI components ***/
95 
96  Gtk::HBox option_hbox;
97  Gtk::Label time_format_label;
98 
99  /* Time format */
100 
102 
103  struct TimeFormatCols : public Gtk::TreeModelColumnRecord
104  {
105  public:
106  Gtk::TreeModelColumn<TimeFormat> format;
107  Gtk::TreeModelColumn<std::string> label;
108 
109  TimeFormatCols () { add(format); add(label); }
110  };
112  Glib::RefPtr<Gtk::ListStore> time_format_list;
113  Gtk::ComboBox time_format_combo;
114 
115  /* View */
116 
117  struct RangeCols : public Gtk::TreeModelColumnRecord
118  {
119  public:
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;
125 
126  RangeCols () { add (location); add(label); add(selected); add(name); add(length); }
127  };
129 
130  Glib::RefPtr<Gtk::ListStore> range_list;
131  Gtk::TreeView range_view;
132 
133  Gtk::ScrolledWindow range_scroller;
134 };
135 
138 {
139  public:
141 
142  private:
143 
144  virtual void fill_range_list ();
145 
146  void set_selection_from_state ();
147  void update_selection ();
148  void update_timespans ();
149 };
150 
153 {
154  public:
156 
157  private:
158 
159  virtual void fill_range_list ();
160 
161  std::string range_id;
162 
163 };
164 
165 #endif /* __export_timespan_selector_h__ */
Gtk::ScrolledWindow range_scroller
std::string ms_str(framecnt_t frames) const
Gtk::TreeModelColumn< std::string > length
std::list< ARDOUR::ExportTimespanPtr > TimespanList
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< std::string > name
ARDOUR::ExportProfileManager::TimespanStatePtr TimespanStatePtr
std::string bbt_str(framepos_t frames) const
boost::shared_ptr< ARDOUR::ExportHandler > HandlerPtr
ExportTimespanSelector(ARDOUR::Session *session, ProfileManagerPtr manager)
int64_t framecnt_t
Definition: types.h:76
void update_range_name(std::string const &path, std::string const &new_text)
void add_range_to_selection(ARDOUR::Location const *loc)
Definition: amp.h:29
boost::shared_ptr< ARDOUR::ExportProfileManager > ProfileManagerPtr
std::string construct_label(ARDOUR::Location const *location) const
Glib::RefPtr< Gtk::ListStore > time_format_list
int location_sorter(Gtk::TreeModel::iterator a, Gtk::TreeModel::iterator b)
Allows selecting multiple timespans.
virtual void fill_range_list()=0
ExportTimespanSelectorMultiple(ARDOUR::Session *session, ProfileManagerPtr manager)
std::string timecode_str(framecnt_t frames) const
boost::shared_ptr< TimespanList > TimespanListPtr
ExportTimespanSelectorSingle(ARDOUR::Session *session, ProfileManagerPtr manager, std::string range_id)
Gtk::TreeModelColumn< bool > selected
Timespan Selector base.
ARDOUR::ExportProfileManager::TimeFormat TimeFormat
Glib::RefPtr< Gtk::ListStore > range_list
Gtk::TreeModelColumn< ARDOUR::Location * > location
std::string construct_length(ARDOUR::Location const *location) const
sigc::signal< void > CriticalSelectionChanged
Gtk::TreeModelColumn< TimeFormat > format
int64_t framepos_t
Gtk::TreeModelColumn< std::string > label
CDMarkerFormat
Definition: types.h:468
std::list< ARDOUR::Location * > LocationList