Ardour  9.0-pre0-582-g084a23a80d
export_timespan_selector.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2011 Sakari Bergen <sakari.bergen@beatwaves.net>
3  * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
5  * Copyright (C) 2010-2011 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2013-2014 Colin Fletcher <colin.m.fletcher@googlemail.com>
7  * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #pragma once
25 
26 #include <ctime>
27 #include <list>
28 #include <memory>
29 
30 #include "audio_clock.h"
31 
32 #ifdef interface
33 #undef interface
34 #endif
35 
36 
37 #include <gtkmm/box.h>
38 #include <gtkmm/checkbutton.h>
39 #include <gtkmm/combobox.h>
40 #include <gtkmm/label.h>
41 #include <gtkmm/liststore.h>
42 #include <gtkmm/scrolledwindow.h>
43 #include <gtkmm/treemodel.h>
44 #include <gtkmm/treestore.h>
45 #include <gtkmm/treeview.h>
46 
48 #include "ardour/session_handle.h"
49 #include "ardour/types.h"
50 
51 namespace ARDOUR {
52  class Location;
53  class ExportTimespan;
54  class ExportHandler;
55 }
56 
59 
62 {
63 protected:
64  typedef std::list<ARDOUR::Location*> LocationList;
65  typedef std::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
66  typedef std::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
67 
68  typedef std::list<ARDOUR::ExportTimespanPtr> TimespanList;
69  typedef std::shared_ptr<TimespanList> TimespanListPtr;
71 
72 public:
74 
76 
78  virtual void allow_realtime_export (bool);
79 
80  sigc::signal<void> CriticalSelectionChanged;
81 
82 protected:
86 
87  virtual void fill_range_list () = 0;
88  virtual void update_timespans () = 0;
89 
90  void add_range_to_selection (ARDOUR::Location const* loc, bool rt);
92  void toggle_realtime ();
93 
95 
96  std::string construct_label (ARDOUR::Location const* location) const;
97  std::string construct_length (ARDOUR::Location const* location) const;
98  std::string bbt_str (samplepos_t samples) const;
99  std::string timecode_str (samplecnt_t samples) const;
100  std::string ms_str (samplecnt_t samples) const;
101 
102  void update_range_name (std::string const& path, std::string const& new_text);
103 
106 
107  /*** GUI components ***/
108 
112 
113  /* Time format */
114 
116 
118  public:
121 
123  {
124  add (format);
125  add (label);
126  }
127  };
129  Glib::RefPtr<Gtk::ListStore> time_format_list;
131 
132  /* View */
133 
135  public:
146 
148  {
149  add (location);
150  add (label);
151  add (selected);
152  add (realtime);
153  add (name);
154  add (length);
155  add (date);
156  add (timestamp);
157  add (length_actual);
158  add (start);
159  }
160  };
162 
163  Glib::RefPtr<Gtk::ListStore> range_list;
165 
167 };
168 
171 {
172 public:
174 
176 
177 private:
178  virtual void fill_range_list ();
179 
183 };
184 
187 {
188 public:
190 
192 
193 private:
194  virtual void fill_range_list ();
196 
197  std::string range_id;
198 };
199 
std::shared_ptr< TimespanState > TimespanStatePtr
virtual ARDOUR::Session * session() const
Allows selecting multiple timespans.
ExportTimespanSelectorMultiple(ARDOUR::Session *session, ProfileManagerPtr manager)
ExportTimespanSelectorSingle(ARDOUR::Session *session, ProfileManagerPtr manager, std::string range_id)
virtual void fill_range_list()
Timespan Selector base.
ARDOUR::ExportProfileManager::TimespanStatePtr TimespanStatePtr
std::shared_ptr< TimespanList > TimespanListPtr
ARDOUR::ExportProfileManager::TimeFormat TimeFormat
virtual ~ExportTimespanSelector()
std::string construct_length(ARDOUR::Location const *location) const
std::list< ARDOUR::Location * > LocationList
std::shared_ptr< ARDOUR::ExportProfileManager > ProfileManagerPtr
std::string timecode_str(samplecnt_t samples) const
std::string construct_label(ARDOUR::Location const *location) const
std::string bbt_str(samplepos_t samples) const
virtual void fill_range_list()=0
void set_selection_state_of_all_timespans(bool)
ExportTimespanSelector(ARDOUR::Session *session, ProfileManagerPtr manager, bool multi)
Glib::RefPtr< Gtk::ListStore > time_format_list
std::shared_ptr< ARDOUR::ExportHandler > HandlerPtr
std::list< ARDOUR::ExportTimespanPtr > TimespanList
Gtk::ScrolledWindow range_scroller
virtual void allow_realtime_export(bool)
Glib::RefPtr< Gtk::ListStore > range_list
virtual void update_timespans()=0
void update_range_name(std::string const &path, std::string const &new_text)
std::string ms_str(samplecnt_t samples) const
void add_range_to_selection(ARDOUR::Location const *loc, bool rt)
sigc::signal< void > CriticalSelectionChanged
int location_sorter(Gtk::TreeModel::iterator a, Gtk::TreeModel::iterator b)
void add(TreeModelColumnBase &column)
void path(Glib::ustring &path, Glib::ustring &path_reversed)
Compute a widget's path of the form "GtkWindow.MyLabel".
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t
Gtk::TreeModelColumn< ARDOUR::samplecnt_t > length_actual
Gtk::TreeModelColumn< ARDOUR::samplecnt_t > start
Gtk::TreeModelColumn< std::string > name
Gtk::TreeModelColumn< ARDOUR::Location * > location
Gtk::TreeModelColumn< bool > selected
Gtk::TreeModelColumn< bool > realtime
Gtk::TreeModelColumn< std::string > date
Gtk::TreeModelColumn< std::string > length
Gtk::TreeModelColumn< time_t > timestamp
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< TimeFormat > format
Gtk::TreeModelColumn< std::string > label