X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_timespan_selector.h;h=12166709911688721999564836dc900eb2aea847;hb=2d47183dc962bddd2084676b59e9f2c4a0abe33b;hp=757b2caad222f9797cb860091791873f8815c792;hpb=b5a57cc78c92b1d887b7e8de040d8663a9ba187e;p=ardour.git diff --git a/gtk2_ardour/export_timespan_selector.h b/gtk2_ardour/export_timespan_selector.h index 757b2caad2..1216670991 100644 --- a/gtk2_ardour/export_timespan_selector.h +++ b/gtk2_ardour/export_timespan_selector.h @@ -21,111 +21,144 @@ #ifndef __export_timespan_selector_h__ #define __export_timespan_selector_h__ -#include "public_editor.h" #include "audio_clock.h" #include +#ifdef interface +#undef interface +#endif + #include #include -#include -#include + +#include "ardour/types.h" +#include "ardour/session_handle.h" +#include "ardour/export_profile_manager.h" namespace ARDOUR { class Location; class ExportTimespan; class ExportHandler; - class Session; } using ARDOUR::CDMarkerFormat; +using ARDOUR::framecnt_t; -/// -class ExportTimespanSelector : public Gtk::VBox { - private: - +/// Timespan Selector base +class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr +{ + protected: typedef std::list LocationList; typedef boost::shared_ptr HandlerPtr; + typedef boost::shared_ptr ProfileManagerPtr; - typedef boost::shared_ptr TimespanPtr; - typedef std::list TimespanList; + typedef std::list TimespanList; typedef boost::shared_ptr TimespanListPtr; + typedef ARDOUR::ExportProfileManager::TimespanStatePtr TimespanStatePtr; public: - ExportTimespanSelector (); - ~ExportTimespanSelector (); + ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager); + + virtual ~ExportTimespanSelector (); + + void sync_with_manager (); - void set_state (ARDOUR::ExportProfileManager::TimespanStatePtr const state_, ARDOUR::Session * session_); - - void select_one_range (Glib::ustring id); - - /* Compatibility with other elements */ - sigc::signal CriticalSelectionChanged; - private: + protected: - void fill_range_list (); - void set_selection_from_state (); + ProfileManagerPtr manager; + TimespanStatePtr state; + + virtual void fill_range_list () = 0; + + void add_range_to_selection (ARDOUR::Location const * loc); + void set_time_format_from_state (); - void update_selection (); - void update_timespans (); - void change_time_format (); - - Glib::ustring construct_label (ARDOUR::Location const * location); - - Glib::ustring bbt_str (nframes_t frames); - Glib::ustring smpte_str (nframes_t frames); - Glib::ustring ms_str (nframes_t frames); - void update_range_name (Glib::ustring const & path, Glib::ustring const & new_text); + std::string construct_label (ARDOUR::Location const * location) const; + 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; + + void update_range_name (std::string const & path, std::string const & new_text); - ARDOUR::Session * session; - - ARDOUR::ExportProfileManager::TimespanStatePtr state; + void set_selection_state_of_all_timespans (bool); + int location_sorter(Gtk::TreeModel::iterator a, Gtk::TreeModel::iterator b); /*** GUI components ***/ - + Gtk::HBox option_hbox; Gtk::Label time_format_label; - + /* Time format */ - + typedef ARDOUR::ExportProfileManager::TimeFormat TimeFormat; - + struct TimeFormatCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn format; - Gtk::TreeModelColumn label; - + Gtk::TreeModelColumn label; + TimeFormatCols () { add(format); add(label); } }; TimeFormatCols time_format_cols; Glib::RefPtr time_format_list; Gtk::ComboBox time_format_combo; - + /* View */ - + struct RangeCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn location; - Gtk::TreeModelColumn label; - Gtk::TreeModelColumn selected; - Gtk::TreeModelColumn name; - - RangeCols () { add (location); add(label); add(selected); add(name); } + Gtk::TreeModelColumn label; + Gtk::TreeModelColumn selected; + Gtk::TreeModelColumn name; + Gtk::TreeModelColumn length; + + RangeCols () { add (location); add(label); add(selected); add(name); add(length); } }; RangeCols range_cols; - + Glib::RefPtr range_list; Gtk::TreeView range_view; - + Gtk::ScrolledWindow range_scroller; +}; + +/// Allows selecting multiple timespans +class ExportTimespanSelectorMultiple : public ExportTimespanSelector +{ + public: + ExportTimespanSelectorMultiple (ARDOUR::Session * session, ProfileManagerPtr manager); + + 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: + ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, std::string range_id); + + private: + + virtual void fill_range_list (); + + std::string range_id; };