2008-09-17 08:56:00 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2008 Paul Davis
|
|
|
|
Author: Sakari Bergen
|
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __export_timespan_selector_h__
|
|
|
|
#define __export_timespan_selector_h__
|
|
|
|
|
|
|
|
#include "audio_clock.h"
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
#include <gtkmm.h>
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/types.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
#include "ardour/session_handle.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/export_profile_manager.h"
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Location;
|
|
|
|
class ExportTimespan;
|
|
|
|
class ExportHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
using ARDOUR::CDMarkerFormat;
|
2012-05-24 02:09:29 -04:00
|
|
|
using ARDOUR::framecnt_t;
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2008-09-29 13:01:52 -04:00
|
|
|
/// Timespan Selector base
|
2009-12-17 13:24:23 -05:00
|
|
|
class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
|
|
|
|
{
|
2009-03-08 06:56:40 -04:00
|
|
|
protected:
|
|
|
|
typedef std::list<ARDOUR::Location *> LocationList;
|
|
|
|
typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
|
|
|
|
typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
|
|
|
|
|
2011-06-11 10:14:24 -04:00
|
|
|
typedef std::list<ARDOUR::ExportTimespanPtr> TimespanList;
|
2009-03-08 06:56:40 -04:00
|
|
|
typedef boost::shared_ptr<TimespanList> TimespanListPtr;
|
|
|
|
typedef ARDOUR::ExportProfileManager::TimespanStatePtr TimespanStatePtr;
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
public:
|
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-29 13:01:52 -04:00
|
|
|
virtual ~ExportTimespanSelector ();
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
void sync_with_manager ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
sigc::signal<void> CriticalSelectionChanged;
|
|
|
|
|
2008-09-29 13:01:52 -04:00
|
|
|
protected:
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
ProfileManagerPtr manager;
|
|
|
|
TimespanStatePtr state;
|
2008-09-29 13:01:52 -04:00
|
|
|
|
|
|
|
virtual void fill_range_list () = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-29 13:01:52 -04:00
|
|
|
void add_range_to_selection (ARDOUR::Location const * loc);
|
|
|
|
void set_time_format_from_state ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-29 13:01:52 -04:00
|
|
|
void change_time_format ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string construct_label (ARDOUR::Location const * location) const;
|
2010-11-04 16:37:46 -04:00
|
|
|
std::string construct_length (ARDOUR::Location const * location) const;
|
|
|
|
std::string bbt_str (framepos_t frames) const;
|
|
|
|
std::string timecode_str (framecnt_t frames) const;
|
|
|
|
std::string ms_str (framecnt_t frames) const;
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
void update_range_name (std::string const & path, std::string const & new_text);
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2011-12-12 19:15:17 -05:00
|
|
|
void set_selection_state_of_all_timespans (bool);
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/*** GUI components ***/
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::HBox option_hbox;
|
|
|
|
Gtk::Label time_format_label;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Time format */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
typedef ARDOUR::ExportProfileManager::TimeFormat TimeFormat;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
struct TimeFormatCols : public Gtk::TreeModelColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Gtk::TreeModelColumn<TimeFormat> format;
|
2010-09-14 12:51:02 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> label;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
TimeFormatCols () { add(format); add(label); }
|
|
|
|
};
|
|
|
|
TimeFormatCols time_format_cols;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> time_format_list;
|
|
|
|
Gtk::ComboBox time_format_combo;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* View */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
struct RangeCols : public Gtk::TreeModelColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Gtk::TreeModelColumn<ARDOUR::Location *> location;
|
2010-09-14 12:51:02 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> label;
|
2010-11-04 16:37:46 -04:00
|
|
|
Gtk::TreeModelColumn<bool> selected;
|
2010-09-14 12:51:02 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
2010-11-04 16:37:46 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> length;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-11-04 16:37:46 -04:00
|
|
|
RangeCols () { add (location); add(label); add(selected); add(name); add(length); }
|
2008-09-17 08:56:00 -04:00
|
|
|
};
|
|
|
|
RangeCols range_cols;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Glib::RefPtr<Gtk::ListStore> range_list;
|
|
|
|
Gtk::TreeView range_view;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::ScrolledWindow range_scroller;
|
2008-09-29 13:01:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Allows seleting multiple timespans
|
|
|
|
class ExportTimespanSelectorMultiple : public ExportTimespanSelector
|
|
|
|
{
|
|
|
|
public:
|
2009-03-08 06:56:40 -04:00
|
|
|
ExportTimespanSelectorMultiple (ARDOUR::Session * session, ProfileManagerPtr manager);
|
2008-09-29 13:01:52 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
virtual void fill_range_list ();
|
|
|
|
|
|
|
|
void set_selection_from_state ();
|
|
|
|
void update_selection ();
|
|
|
|
void update_timespans ();
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Displays one timespan
|
|
|
|
class ExportTimespanSelectorSingle : public ExportTimespanSelector
|
|
|
|
{
|
|
|
|
public:
|
2010-09-14 12:51:02 -04:00
|
|
|
ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, std::string range_id);
|
2008-09-29 13:01:52 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
virtual void fill_range_list ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string range_id;
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __export_timespan_selector_h__ */
|