Consolidate PinDialog Session/recording checks
[ardour.git] / gtk2_ardour / export_timespan_selector.h
index e2291faf5a26be6a7cb5948c90b63f96125473f3..1f7a5ae9c2c673bff790408581d755fcd40853f1 100644 (file)
 #ifndef __export_timespan_selector_h__
 #define __export_timespan_selector_h__
 
-#include "public_editor.h"
 #include "audio_clock.h"
 
 #include <list>
 
-#include <gtkmm.h>
+#ifdef interface
+#undef interface
+#endif
+
 #include <boost/shared_ptr.hpp>
 
+#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>
+
 #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::samplecnt_t;
 
 /// Timespan Selector base
-class ExportTimespanSelector : public Gtk::VBox {
-  protected:
+class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
+{
+protected:
        typedef std::list<ARDOUR::Location *> LocationList;
        typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
        typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
 
-       typedef boost::shared_ptr<ARDOUR::ExportTimespan> TimespanPtr;
-       typedef std::list<TimespanPtr> TimespanList;
+       typedef std::list<ARDOUR::ExportTimespanPtr> TimespanList;
        typedef boost::shared_ptr<TimespanList> TimespanListPtr;
        typedef ARDOUR::ExportProfileManager::TimespanStatePtr TimespanStatePtr;
 
-  public:
+public:
+
+       ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager, bool multi);
 
-       ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
-       
        virtual ~ExportTimespanSelector ();
 
        void sync_with_manager ();
-       
+       virtual void allow_realtime_export (bool);
+
        sigc::signal<void> CriticalSelectionChanged;
 
-  protected:
+protected:
 
-       ARDOUR::Session * session;
        ProfileManagerPtr manager;
        TimespanStatePtr  state;
+       bool _realtime_available;
 
        virtual void fill_range_list () = 0;
-       
-       void add_range_to_selection (ARDOUR::Location const * loc);
+       virtual void update_timespans () = 0;
+
+       void add_range_to_selection (ARDOUR::Location const * loc, bool rt);
        void set_time_format_from_state ();
-       
+       void toggle_realtime ();
+
        void change_time_format ();
-       
-       Glib::ustring construct_label (ARDOUR::Location const * location) const;
-       Glib::ustring bbt_str (nframes_t frames) const;
-       Glib::ustring smpte_str (nframes_t frames) const;
-       Glib::ustring ms_str (nframes_t frames) const;
 
-       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 (samplepos_t samples) const;
+       std::string timecode_str (samplecnt_t samples) const;
+       std::string ms_str (samplecnt_t samples) const;
+
+       void update_range_name (std::string const & path, std::string const & new_text);
+
+       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;
-       
+
+       Gtk::HBox        option_hbox;
+       Gtk::Label       time_format_label;
+       Gtk::CheckButton realtime_checkbutton;
+
        /* Time format */
-       
+
        typedef ARDOUR::ExportProfileManager::TimeFormat TimeFormat;
-       
+
        struct TimeFormatCols : public Gtk::TreeModelColumnRecord
        {
-         public:
+       public:
                Gtk::TreeModelColumn<TimeFormat>      format;
-               Gtk::TreeModelColumn<Glib::ustring>   label;
-       
+               Gtk::TreeModelColumn<std::string>   label;
+
                TimeFormatCols () { add(format); add(label); }
        };
        TimeFormatCols               time_format_cols;
        Glib::RefPtr<Gtk::ListStore> time_format_list;
        Gtk::ComboBox                time_format_combo;
-       
+
        /* View */
-       
+
        struct RangeCols : public Gtk::TreeModelColumnRecord
        {
-         public:
+       public:
                Gtk::TreeModelColumn<ARDOUR::Location *>  location;
-               Gtk::TreeModelColumn<Glib::ustring>       label;
-               Gtk::TreeModelColumn<bool>                selected;
-               Gtk::TreeModelColumn<Glib::ustring>       name;
-       
-               RangeCols () { add (location); add(label); add(selected); add(name); }
+               Gtk::TreeModelColumn<std::string>       label;
+               Gtk::TreeModelColumn<bool>              selected;
+               Gtk::TreeModelColumn<bool>              realtime;
+               Gtk::TreeModelColumn<std::string>       name;
+               Gtk::TreeModelColumn<std::string>       length;
+
+               RangeCols () { add (location); add(label); add(selected); add(realtime); add(name); add(length); }
        };
        RangeCols                    range_cols;
-       
+
        Glib::RefPtr<Gtk::ListStore> range_list;
        Gtk::TreeView                range_view;
-       
+
        Gtk::ScrolledWindow          range_scroller;
 };
 
-/// Allows seleting multiple timespans
+/// Allows selecting multiple timespans
 class ExportTimespanSelectorMultiple : public ExportTimespanSelector
 {
-  public:
+public:
        ExportTimespanSelectorMultiple (ARDOUR::Session * session, ProfileManagerPtr manager);
 
-  private:
+       void allow_realtime_export (bool);
+
+private:
 
        virtual void fill_range_list ();
 
@@ -142,14 +167,17 @@ class ExportTimespanSelectorMultiple : public ExportTimespanSelector
 /// Displays one timespan
 class ExportTimespanSelectorSingle : public ExportTimespanSelector
 {
-  public:
-       ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, Glib::ustring range_id);
+public:
+       ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, std::string range_id);
+
+       void allow_realtime_export (bool);
 
-  private:
+private:
 
        virtual void fill_range_list ();
-       
-       Glib::ustring range_id;
+       void update_timespans ();
+
+       std::string range_id;
 
 };