2018-11-15 10:21:55 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2018-2019 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2018-11-15 10:21:55 -05:00
|
|
|
#ifndef __gtk_ardour_editor_sources_h__
|
|
|
|
#define __gtk_ardour_editor_sources_h__
|
|
|
|
|
|
|
|
#include <boost/unordered_map.hpp>
|
|
|
|
|
|
|
|
#include <gtkmm/scrolledwindow.h>
|
|
|
|
#include <gtkmm/treemodel.h>
|
|
|
|
#include <gtkmm/treerowreference.h>
|
|
|
|
#include <gtkmm/treestore.h>
|
|
|
|
|
|
|
|
#include "editor_component.h"
|
|
|
|
|
|
|
|
#include "selection.h"
|
|
|
|
|
|
|
|
class EditorSources : public EditorComponent, public ARDOUR::SessionHandlePtr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EditorSources (Editor *);
|
|
|
|
|
|
|
|
void set_session (ARDOUR::Session *);
|
|
|
|
|
|
|
|
Gtk::Widget& widget () {
|
|
|
|
return _scroller;
|
|
|
|
}
|
|
|
|
|
|
|
|
void clear ();
|
2020-02-25 09:42:01 -05:00
|
|
|
|
2019-05-31 14:36:46 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Region> get_dragged_region ();
|
|
|
|
boost::shared_ptr<ARDOUR::Region> get_single_selection ();
|
2018-11-15 10:21:55 -05:00
|
|
|
|
|
|
|
void unselect_all () {
|
|
|
|
_display.get_selection()->unselect_all ();
|
|
|
|
}
|
|
|
|
|
2020-02-25 10:16:20 -05:00
|
|
|
/* user actions */
|
2019-05-31 14:36:46 -04:00
|
|
|
void remove_selected_sources ();
|
|
|
|
void recover_selected_sources();
|
|
|
|
|
2018-11-15 10:21:55 -05:00
|
|
|
XMLNode& get_state () const;
|
|
|
|
void set_state (const XMLNode &);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
struct Columns : public Gtk::TreeModel::ColumnRecord {
|
|
|
|
Columns () {
|
|
|
|
add (name);
|
2020-07-13 17:07:59 -04:00
|
|
|
add (channels);
|
2020-07-14 08:58:12 -04:00
|
|
|
add (captd_for);
|
2019-08-01 16:27:21 -04:00
|
|
|
add (tags);
|
2018-11-15 10:24:37 -05:00
|
|
|
add (take_id);
|
2018-11-15 10:21:55 -05:00
|
|
|
add (natural_pos);
|
|
|
|
add (path);
|
2018-11-15 10:24:37 -05:00
|
|
|
add (color_);
|
2019-05-31 14:36:46 -04:00
|
|
|
add (region);
|
2018-11-15 10:24:37 -05:00
|
|
|
add (natural_s);
|
2021-02-14 10:20:36 -05:00
|
|
|
add (captd_xruns);
|
2018-11-15 10:21:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
2020-07-13 17:07:59 -04:00
|
|
|
Gtk::TreeModelColumn<int> channels;
|
2020-07-14 08:58:12 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> captd_for;
|
2019-08-01 16:27:21 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> tags;
|
2019-05-31 14:36:46 -04:00
|
|
|
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
|
2018-11-15 10:21:55 -05:00
|
|
|
Gtk::TreeModelColumn<Gdk::Color> color_;
|
|
|
|
Gtk::TreeModelColumn<std::string> natural_pos;
|
|
|
|
Gtk::TreeModelColumn<std::string> path;
|
|
|
|
Gtk::TreeModelColumn<std::string> take_id;
|
2020-10-19 14:37:54 -04:00
|
|
|
Gtk::TreeModelColumn<Temporal::timepos_t> natural_s;
|
2021-02-14 10:20:36 -05:00
|
|
|
Gtk::TreeModelColumn<size_t> captd_xruns;
|
2018-11-15 10:21:55 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
Columns _columns;
|
|
|
|
|
|
|
|
Gtk::TreeModel::RowReference last_row;
|
|
|
|
|
|
|
|
void freeze_tree_model ();
|
|
|
|
void thaw_tree_model ();
|
2021-05-07 16:45:28 -04:00
|
|
|
void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const&);
|
2019-05-31 14:36:46 -04:00
|
|
|
void populate_row (Gtk::TreeModel::Row row, boost::shared_ptr<ARDOUR::Region> region);
|
2018-11-15 10:21:55 -05:00
|
|
|
void selection_changed ();
|
|
|
|
|
|
|
|
sigc::connection _change_connection;
|
|
|
|
|
2021-05-07 17:15:47 -04:00
|
|
|
int _sort_col_id;
|
|
|
|
Gtk::SortType _sort_type;
|
|
|
|
|
2018-11-15 10:21:55 -05:00
|
|
|
Gtk::Widget* old_focus;
|
|
|
|
|
2019-08-01 16:27:21 -04:00
|
|
|
Gtk::CellEditable* tags_editable;
|
|
|
|
void tag_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
|
|
|
void tag_edit (const std::string&, const std::string&);
|
|
|
|
|
2020-07-14 09:26:42 -04:00
|
|
|
Gtk::CellEditable* name_editable;
|
|
|
|
void name_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
|
|
|
void name_edit (const std::string&, const std::string&);
|
|
|
|
|
2018-11-15 10:21:55 -05:00
|
|
|
bool key_press (GdkEventKey *);
|
|
|
|
bool button_press (GdkEventButton *);
|
|
|
|
|
|
|
|
bool focus_in (GdkEventFocus*);
|
|
|
|
bool focus_out (GdkEventFocus*);
|
|
|
|
bool enter_notify (GdkEventCrossing*);
|
|
|
|
bool leave_notify (GdkEventCrossing*);
|
|
|
|
|
|
|
|
void show_context_menu (int button, int time);
|
|
|
|
|
2020-10-19 14:37:54 -04:00
|
|
|
void format_position (Temporal::timepos_t const & pos, char* buf, size_t bufsize, bool onoff = true);
|
2018-11-15 10:21:55 -05:00
|
|
|
|
2019-05-31 14:36:46 -04:00
|
|
|
void add_source (boost::shared_ptr<ARDOUR::Region>);
|
2019-07-30 14:43:14 -04:00
|
|
|
void remove_source (boost::shared_ptr<ARDOUR::Source>);
|
2020-02-25 09:36:53 -05:00
|
|
|
void remove_weak_region (boost::weak_ptr<ARDOUR::Region>);
|
2019-12-25 12:00:57 -05:00
|
|
|
void remove_weak_source (boost::weak_ptr<ARDOUR::Source>);
|
2018-11-15 10:21:55 -05:00
|
|
|
|
2018-10-18 19:51:45 -04:00
|
|
|
void clock_format_changed ();
|
2018-11-15 10:21:55 -05:00
|
|
|
|
2019-05-31 14:36:46 -04:00
|
|
|
void redisplay ();
|
|
|
|
|
2018-11-15 10:21:55 -05:00
|
|
|
void drag_data_received (
|
|
|
|
Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
|
|
|
|
);
|
|
|
|
|
|
|
|
Gtk::ScrolledWindow _scroller;
|
|
|
|
|
2019-05-31 14:36:46 -04:00
|
|
|
Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > _display;
|
2018-11-15 10:21:55 -05:00
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::TreeStore> _model;
|
|
|
|
|
2020-07-13 15:31:41 -04:00
|
|
|
PBD::ScopedConnection source_property_connection;
|
2019-07-30 14:43:14 -04:00
|
|
|
PBD::ScopedConnection add_source_connection;
|
|
|
|
PBD::ScopedConnection remove_source_connection;
|
2020-02-25 09:36:53 -05:00
|
|
|
PBD::ScopedConnectionList remove_region_connections;
|
2018-11-15 10:21:55 -05:00
|
|
|
|
|
|
|
PBD::ScopedConnection editor_freeze_connection;
|
|
|
|
PBD::ScopedConnection editor_thaw_connection;
|
|
|
|
};
|
|
|
|
|
2020-02-25 09:42:01 -05:00
|
|
|
#endif
|