2009-07-03 18:42:22 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000-2009 Paul Davis
|
2009-07-03 18:42:22 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
2009-11-12 00:47:05 -05:00
|
|
|
#ifndef __gtk_ardour_editor_regions_h__
|
|
|
|
#define __gtk_ardour_editor_regions_h__
|
2009-07-03 18:42:22 -04:00
|
|
|
|
2011-02-14 16:49:43 -05:00
|
|
|
#include <boost/unordered_map.hpp>
|
2009-07-03 18:42:22 -04:00
|
|
|
|
2017-07-16 21:48:18 -04:00
|
|
|
#include <gtkmm/scrolledwindow.h>
|
|
|
|
#include <gtkmm/treemodel.h>
|
|
|
|
#include <gtkmm/treerowreference.h>
|
|
|
|
#include <gtkmm/treestore.h>
|
|
|
|
|
|
|
|
#include "editor_component.h"
|
|
|
|
|
2010-07-19 17:47:07 -04:00
|
|
|
class EditorRegions : public EditorComponent, public ARDOUR::SessionHandlePtr
|
2009-07-03 18:42:22 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
EditorRegions (Editor *);
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
void set_session (ARDOUR::Session *);
|
2009-07-03 18:42:22 -04:00
|
|
|
|
|
|
|
Gtk::Widget& widget () {
|
|
|
|
return _scroller;
|
|
|
|
}
|
|
|
|
|
|
|
|
void clear ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
void toggle_full ();
|
|
|
|
void toggle_show_auto_regions ();
|
|
|
|
void reset_sort_direction (bool);
|
|
|
|
void reset_sort_type (Editing::RegionListSortType, bool);
|
|
|
|
void set_selected (RegionSelection &);
|
|
|
|
void selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Region> get_dragged_region ();
|
|
|
|
boost::shared_ptr<ARDOUR::Region> get_single_selection ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
Editing::RegionListSortType sort_type () const {
|
|
|
|
return _sort_type;
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
void redisplay ();
|
|
|
|
|
|
|
|
void suspend_redisplay () {
|
|
|
|
_no_redisplay = true;
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
void resume_redisplay () {
|
|
|
|
_no_redisplay = false;
|
|
|
|
redisplay ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void block_change_connection (bool b) {
|
|
|
|
_change_connection.block (b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void unselect_all () {
|
|
|
|
_display.get_selection()->unselect_all ();
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-11-15 13:32:42 -05:00
|
|
|
void remove_unused_regions ();
|
2009-07-03 18:42:22 -04:00
|
|
|
|
2010-09-18 22:18:59 -04:00
|
|
|
XMLNode& get_state () const;
|
|
|
|
void set_state (const XMLNode &);
|
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
private:
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
struct Columns : public Gtk::TreeModel::ColumnRecord {
|
|
|
|
Columns () {
|
|
|
|
add (name);
|
|
|
|
add (region);
|
|
|
|
add (color_);
|
2010-09-20 11:12:44 -04:00
|
|
|
add (position);
|
2009-07-03 18:42:22 -04:00
|
|
|
add (end);
|
|
|
|
add (length);
|
|
|
|
add (sync);
|
|
|
|
add (fadein);
|
|
|
|
add (fadeout);
|
|
|
|
add (locked);
|
|
|
|
add (glued);
|
|
|
|
add (muted);
|
|
|
|
add (opaque);
|
|
|
|
add (used);
|
|
|
|
add (path);
|
2010-06-28 13:25:32 -04:00
|
|
|
add (property_toggles_visible);
|
2009-07-03 18:42:22 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
2009-07-03 18:42:22 -04:00
|
|
|
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
|
|
|
|
Gtk::TreeModelColumn<Gdk::Color> color_;
|
2010-09-20 11:12:44 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> position;
|
2010-09-14 12:51:02 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> end;
|
|
|
|
Gtk::TreeModelColumn<std::string> length;
|
|
|
|
Gtk::TreeModelColumn<std::string> sync;
|
|
|
|
Gtk::TreeModelColumn<std::string> fadein;
|
|
|
|
Gtk::TreeModelColumn<std::string> fadeout;
|
2009-07-03 18:42:22 -04:00
|
|
|
Gtk::TreeModelColumn<bool> locked;
|
|
|
|
Gtk::TreeModelColumn<bool> glued;
|
|
|
|
Gtk::TreeModelColumn<bool> muted;
|
|
|
|
Gtk::TreeModelColumn<bool> opaque;
|
2010-09-14 12:51:02 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> used;
|
|
|
|
Gtk::TreeModelColumn<std::string> path;
|
2010-06-28 13:25:32 -04:00
|
|
|
/** used to indicate whether the locked/glued/muted/opaque should be visible or not */
|
|
|
|
Gtk::TreeModelColumn<bool> property_toggles_visible;
|
2009-07-03 18:42:22 -04:00
|
|
|
};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
Columns _columns;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-09-20 23:02:30 -04:00
|
|
|
Gtk::TreeModel::RowReference last_row;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-02-14 16:49:43 -05:00
|
|
|
void freeze_tree_model ();
|
|
|
|
void thaw_tree_model ();
|
2010-03-30 19:40:28 -04:00
|
|
|
void region_changed (boost::shared_ptr<ARDOUR::Region>, PBD::PropertyChange const &);
|
2009-07-03 18:42:22 -04:00
|
|
|
void selection_changed ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
sigc::connection _change_connection;
|
2011-02-14 16:49:43 -05:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
bool selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
|
2010-09-28 22:01:35 -04:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
Gtk::Widget* old_focus;
|
|
|
|
Gtk::CellEditable* name_editable;
|
|
|
|
void name_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
void name_edit (const std::string&, const std::string&);
|
|
|
|
void locked_changed (std::string const &);
|
|
|
|
void glued_changed (std::string const &);
|
|
|
|
void muted_changed (std::string const &);
|
|
|
|
void opaque_changed (std::string const &);
|
2009-07-03 18:42:22 -04:00
|
|
|
|
|
|
|
bool key_press (GdkEventKey *);
|
|
|
|
bool button_press (GdkEventButton *);
|
2011-02-14 16:49:43 -05:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
bool focus_in (GdkEventFocus*);
|
|
|
|
bool focus_out (GdkEventFocus*);
|
|
|
|
bool enter_notify (GdkEventCrossing*);
|
|
|
|
bool leave_notify (GdkEventCrossing*);
|
2011-02-14 16:49:43 -05:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
void show_context_menu (int button, int time);
|
|
|
|
|
|
|
|
int sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void format_position (ARDOUR::samplepos_t pos, char* buf, size_t bufsize, bool onoff = true);
|
2010-09-20 11:12:44 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
void add_region (boost::shared_ptr<ARDOUR::Region>);
|
2011-02-14 16:49:43 -05:00
|
|
|
|
2016-06-26 14:29:41 -04:00
|
|
|
void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, PBD::PropertyChange const &);
|
2017-07-01 12:42:24 -04:00
|
|
|
void populate_row_used (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used);
|
|
|
|
void populate_row_position (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used);
|
|
|
|
void populate_row_end (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used);
|
|
|
|
void populate_row_sync (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used);
|
|
|
|
void populate_row_fade_in (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used, boost::shared_ptr<ARDOUR::AudioRegion>);
|
|
|
|
void populate_row_fade_out (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used, boost::shared_ptr<ARDOUR::AudioRegion>);
|
|
|
|
void populate_row_locked (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used);
|
|
|
|
void populate_row_muted (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used);
|
|
|
|
void populate_row_glued (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used);
|
|
|
|
void populate_row_opaque (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, uint32_t used);
|
|
|
|
void populate_row_length (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
|
|
|
void populate_row_name (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
|
|
|
void populate_row_source (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
2010-09-20 11:12:44 -04:00
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
void update_row (boost::shared_ptr<ARDOUR::Region>);
|
2009-07-03 18:42:22 -04:00
|
|
|
void update_all_rows ();
|
2011-02-14 16:49:43 -05:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
void insert_into_tmp_regionlist (boost::shared_ptr<ARDOUR::Region>);
|
|
|
|
|
|
|
|
void drag_data_received (
|
|
|
|
Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
|
|
|
|
);
|
|
|
|
|
2010-09-18 22:18:59 -04:00
|
|
|
Glib::RefPtr<Gtk::RadioAction> sort_type_action (Editing::RegionListSortType) const;
|
|
|
|
void set_full (bool);
|
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::Action> hide_action () const;
|
|
|
|
Glib::RefPtr<Gtk::Action> show_action () const;
|
2011-11-15 13:32:42 -05:00
|
|
|
Glib::RefPtr<Gtk::Action> remove_unused_regions_action () const;
|
2010-09-18 22:18:59 -04:00
|
|
|
Glib::RefPtr<Gtk::ToggleAction> toggle_full_action () const;
|
|
|
|
Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action () const;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
Gtk::Menu* _menu;
|
|
|
|
Gtk::ScrolledWindow _scroller;
|
2017-09-18 14:45:56 -04:00
|
|
|
Gtk::Frame _frame;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > _display;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
Glib::RefPtr<Gtk::TreeStore> _model;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
bool _show_automatic_regions;
|
2011-02-14 16:49:43 -05:00
|
|
|
bool ignore_region_list_selection_change;
|
|
|
|
bool ignore_selected_region_change;
|
2009-07-03 18:42:22 -04:00
|
|
|
bool _no_redisplay;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-02-14 16:49:43 -05:00
|
|
|
Editing::RegionListSortType _sort_type;
|
|
|
|
|
2009-07-03 18:42:22 -04:00
|
|
|
std::list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-02-14 16:49:43 -05:00
|
|
|
typedef boost::unordered_map<boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::RowReference> RegionRowMap;
|
|
|
|
typedef boost::unordered_map<std::string, Gtk::TreeModel::RowReference > RegionSourceMap;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-02-14 16:49:43 -05:00
|
|
|
RegionRowMap region_row_map;
|
|
|
|
RegionSourceMap parent_regions_sources_map;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::ScopedConnection region_property_connection;
|
2010-03-30 19:40:28 -04:00
|
|
|
PBD::ScopedConnection check_new_region_connection;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-02-14 16:49:43 -05:00
|
|
|
PBD::ScopedConnection editor_freeze_connection;
|
|
|
|
PBD::ScopedConnection editor_thaw_connection;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
bool expanded;
|
2009-07-03 18:42:22 -04:00
|
|
|
};
|
|
|
|
|
2009-11-12 00:47:05 -05:00
|
|
|
#endif /* __gtk_ardour_editor_regions_h__ */
|