2008-09-17 12:56:00 +00:00
|
|
|
/*
|
2019-08-02 23:26:43 +02:00
|
|
|
* Copyright (C) 2008-2011 Sakari Bergen <sakari.bergen@beatwaves.net>
|
|
|
|
|
* Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
|
* Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
|
|
|
|
|
* Copyright (C) 2010-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
|
* Copyright (C) 2013-2014 Colin Fletcher <colin.m.fletcher@googlemail.com>
|
|
|
|
|
* Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*/
|
2008-09-17 12:56:00 +00:00
|
|
|
|
|
|
|
|
#ifndef __export_timespan_selector_h__
|
|
|
|
|
#define __export_timespan_selector_h__
|
|
|
|
|
|
2019-07-22 15:47:17 -05:00
|
|
|
#include <ctime>
|
2019-10-15 22:47:57 +02:00
|
|
|
#include <list>
|
2023-02-16 10:59:41 -07:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
#include "audio_clock.h"
|
2008-09-17 12:56:00 +00:00
|
|
|
|
2013-07-11 15:29:28 -04:00
|
|
|
#ifdef interface
|
|
|
|
|
#undef interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-09-17 12:56:00 +00:00
|
|
|
|
2017-07-17 03:48:18 +02:00
|
|
|
#include <gtkmm/box.h>
|
|
|
|
|
#include <gtkmm/checkbutton.h>
|
|
|
|
|
#include <gtkmm/combobox.h>
|
|
|
|
|
#include <gtkmm/label.h>
|
|
|
|
|
#include <gtkmm/liststore.h>
|
|
|
|
|
#include <gtkmm/scrolledwindow.h>
|
|
|
|
|
#include <gtkmm/treemodel.h>
|
|
|
|
|
#include <gtkmm/treestore.h>
|
|
|
|
|
#include <gtkmm/treeview.h>
|
2013-07-11 15:29:28 -04:00
|
|
|
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/export_profile_manager.h"
|
2019-10-15 22:47:57 +02:00
|
|
|
#include "ardour/session_handle.h"
|
|
|
|
|
#include "ardour/types.h"
|
2008-09-17 12:56:00 +00:00
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
|
class Location;
|
|
|
|
|
class ExportTimespan;
|
|
|
|
|
class ExportHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
using ARDOUR::CDMarkerFormat;
|
2017-09-18 12:39:17 -04:00
|
|
|
using ARDOUR::samplecnt_t;
|
2008-09-17 12:56:00 +00:00
|
|
|
|
2008-09-29 17:01:52 +00:00
|
|
|
/// Timespan Selector base
|
2009-12-17 18:24:23 +00:00
|
|
|
class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
|
|
|
|
|
{
|
2017-07-01 21:11:14 +02:00
|
|
|
protected:
|
2019-10-15 22:47:57 +02:00
|
|
|
typedef std::list<ARDOUR::Location*> LocationList;
|
2023-02-16 16:33:28 -07:00
|
|
|
typedef std::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
|
|
|
|
|
typedef std::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
|
2009-03-08 10:56:40 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
typedef std::list<ARDOUR::ExportTimespanPtr> TimespanList;
|
2023-02-16 16:33:28 -07:00
|
|
|
typedef std::shared_ptr<TimespanList> TimespanListPtr;
|
2009-03-08 10:56:40 +00:00
|
|
|
typedef ARDOUR::ExportProfileManager::TimespanStatePtr TimespanStatePtr;
|
|
|
|
|
|
2017-07-01 21:11:14 +02:00
|
|
|
public:
|
2019-10-15 22:47:57 +02:00
|
|
|
ExportTimespanSelector (ARDOUR::Session* session, ProfileManagerPtr manager, bool multi);
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-29 17:01:52 +00:00
|
|
|
virtual ~ExportTimespanSelector ();
|
2008-09-17 12:56:00 +00:00
|
|
|
|
2009-03-08 10:56:40 +00:00
|
|
|
void sync_with_manager ();
|
2016-07-16 02:15:56 +02:00
|
|
|
virtual void allow_realtime_export (bool);
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-17 12:56:00 +00:00
|
|
|
sigc::signal<void> CriticalSelectionChanged;
|
|
|
|
|
|
2017-07-01 21:11:14 +02:00
|
|
|
protected:
|
2009-03-08 10:56:40 +00:00
|
|
|
ProfileManagerPtr manager;
|
|
|
|
|
TimespanStatePtr state;
|
2019-10-15 22:47:57 +02:00
|
|
|
bool _realtime_available;
|
2008-09-29 17:01:52 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
virtual void fill_range_list () = 0;
|
2016-07-16 02:15:56 +02:00
|
|
|
virtual void update_timespans () = 0;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
void add_range_to_selection (ARDOUR::Location const* loc, bool rt);
|
2008-09-29 17:01:52 +00:00
|
|
|
void set_time_format_from_state ();
|
2016-07-16 02:15:56 +02:00
|
|
|
void toggle_realtime ();
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-29 17:01:52 +00:00
|
|
|
void change_time_format ();
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
std::string construct_label (ARDOUR::Location const* location) const;
|
|
|
|
|
std::string construct_length (ARDOUR::Location const* location) const;
|
2017-09-18 12:39:17 -04:00
|
|
|
std::string bbt_str (samplepos_t samples) const;
|
|
|
|
|
std::string timecode_str (samplecnt_t samples) const;
|
|
|
|
|
std::string ms_str (samplecnt_t samples) const;
|
2008-09-17 12:56:00 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
void update_range_name (std::string const& path, std::string const& new_text);
|
2008-09-17 12:56:00 +00:00
|
|
|
|
2011-12-13 00:15:17 +00:00
|
|
|
void set_selection_state_of_all_timespans (bool);
|
2019-10-15 22:47:57 +02:00
|
|
|
int location_sorter (Gtk::TreeModel::iterator a, Gtk::TreeModel::iterator b);
|
2011-12-13 00:15:17 +00:00
|
|
|
|
2008-09-17 12:56:00 +00:00
|
|
|
/*** GUI components ***/
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2016-07-16 02:15:56 +02:00
|
|
|
Gtk::HBox option_hbox;
|
|
|
|
|
Gtk::Label time_format_label;
|
|
|
|
|
Gtk::CheckButton realtime_checkbutton;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-17 12:56:00 +00:00
|
|
|
/* Time format */
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-17 12:56:00 +00:00
|
|
|
typedef ARDOUR::ExportProfileManager::TimeFormat TimeFormat;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
struct TimeFormatCols : public Gtk::TreeModelColumnRecord {
|
2017-07-01 21:11:14 +02:00
|
|
|
public:
|
2019-10-15 22:47:57 +02:00
|
|
|
Gtk::TreeModelColumn<TimeFormat> format;
|
|
|
|
|
Gtk::TreeModelColumn<std::string> label;
|
|
|
|
|
|
|
|
|
|
TimeFormatCols ()
|
|
|
|
|
{
|
|
|
|
|
add (format);
|
|
|
|
|
add (label);
|
|
|
|
|
}
|
2008-09-17 12:56:00 +00:00
|
|
|
};
|
|
|
|
|
TimeFormatCols time_format_cols;
|
|
|
|
|
Glib::RefPtr<Gtk::ListStore> time_format_list;
|
|
|
|
|
Gtk::ComboBox time_format_combo;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-17 12:56:00 +00:00
|
|
|
/* View */
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
struct RangeCols : public Gtk::TreeModelColumnRecord {
|
2017-07-01 21:11:14 +02:00
|
|
|
public:
|
2019-10-15 22:47:57 +02:00
|
|
|
Gtk::TreeModelColumn<ARDOUR::Location*> location;
|
|
|
|
|
Gtk::TreeModelColumn<std::string> label;
|
|
|
|
|
Gtk::TreeModelColumn<bool> selected;
|
|
|
|
|
Gtk::TreeModelColumn<bool> realtime;
|
|
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
|
|
|
|
Gtk::TreeModelColumn<std::string> length;
|
|
|
|
|
Gtk::TreeModelColumn<std::string> date;
|
|
|
|
|
Gtk::TreeModelColumn<time_t> timestamp;
|
2019-08-28 11:27:40 -05:00
|
|
|
Gtk::TreeModelColumn<ARDOUR::samplecnt_t> length_actual;
|
2019-08-28 14:19:26 -05:00
|
|
|
Gtk::TreeModelColumn<ARDOUR::samplecnt_t> start;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
RangeCols ()
|
|
|
|
|
{
|
|
|
|
|
add (location);
|
|
|
|
|
add (label);
|
|
|
|
|
add (selected);
|
|
|
|
|
add (realtime);
|
|
|
|
|
add (name);
|
|
|
|
|
add (length);
|
|
|
|
|
add (date);
|
|
|
|
|
add (timestamp);
|
|
|
|
|
add (length_actual);
|
|
|
|
|
add (start);
|
|
|
|
|
}
|
2008-09-17 12:56:00 +00:00
|
|
|
};
|
2019-10-15 22:47:57 +02:00
|
|
|
RangeCols range_cols;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-17 12:56:00 +00:00
|
|
|
Glib::RefPtr<Gtk::ListStore> range_list;
|
|
|
|
|
Gtk::TreeView range_view;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2019-10-15 22:47:57 +02:00
|
|
|
Gtk::ScrolledWindow range_scroller;
|
2008-09-29 17:01:52 +00:00
|
|
|
};
|
|
|
|
|
|
2013-06-16 18:48:33 +01:00
|
|
|
/// Allows selecting multiple timespans
|
2008-09-29 17:01:52 +00:00
|
|
|
class ExportTimespanSelectorMultiple : public ExportTimespanSelector
|
|
|
|
|
{
|
2017-07-01 21:11:14 +02:00
|
|
|
public:
|
2019-10-15 22:47:57 +02:00
|
|
|
ExportTimespanSelectorMultiple (ARDOUR::Session* session, ProfileManagerPtr manager);
|
2008-09-29 17:01:52 +00:00
|
|
|
|
2016-07-16 02:15:56 +02:00
|
|
|
void allow_realtime_export (bool);
|
|
|
|
|
|
2017-07-01 21:11:14 +02:00
|
|
|
private:
|
2008-09-29 17:01:52 +00:00
|
|
|
virtual void fill_range_list ();
|
|
|
|
|
|
|
|
|
|
void set_selection_from_state ();
|
|
|
|
|
void update_selection ();
|
|
|
|
|
void update_timespans ();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// Displays one timespan
|
|
|
|
|
class ExportTimespanSelectorSingle : public ExportTimespanSelector
|
|
|
|
|
{
|
2017-07-01 21:11:14 +02:00
|
|
|
public:
|
2019-10-15 22:47:57 +02:00
|
|
|
ExportTimespanSelectorSingle (ARDOUR::Session* session, ProfileManagerPtr manager, std::string range_id);
|
2008-09-29 17:01:52 +00:00
|
|
|
|
2016-07-16 02:15:56 +02:00
|
|
|
void allow_realtime_export (bool);
|
|
|
|
|
|
2017-07-01 21:11:14 +02:00
|
|
|
private:
|
2008-09-29 17:01:52 +00:00
|
|
|
virtual void fill_range_list ();
|
2019-10-15 22:47:57 +02:00
|
|
|
void update_timespans ();
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2010-09-14 16:51:02 +00:00
|
|
|
std::string range_id;
|
2008-09-17 12:56:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* __export_timespan_selector_h__ */
|