From 90962d342614e4b817b17bb833e3418df76ab4cb Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 15 Nov 2018 09:21:55 -0600 Subject: (Source List) Source property signals (gtk2 part) See: https://docs.google.com/document/d/1sI7p9RoRVZtNx2n67RvBa0_16fuZblV_lNkkKN2g93s/edit?usp=sharing --- gtk2_ardour/editor_sources.h | 181 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 gtk2_ardour/editor_sources.h (limited to 'gtk2_ardour/editor_sources.h') diff --git a/gtk2_ardour/editor_sources.h b/gtk2_ardour/editor_sources.h new file mode 100644 index 0000000000..88ef60f316 --- /dev/null +++ b/gtk2_ardour/editor_sources.h @@ -0,0 +1,181 @@ +/* + Copyright (C) 2000-2009 Paul Davis + + 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 __gtk_ardour_editor_sources_h__ +#define __gtk_ardour_editor_sources_h__ + +#include + +#include +#include +#include +#include + +#include "editor_component.h" + +#include "selection.h" + +class EditorSources : public EditorComponent, public ARDOUR::SessionHandlePtr +{ +public: + EditorSources (Editor *); + + void set_session (ARDOUR::Session *); + + void set_selection (Selection *sel) { _selection = sel; } + + Gtk::Widget& widget () { + return _scroller; + } + + void clear (); + + void reset_sort_direction (bool); + void reset_sort_type (Editing::RegionListSortType, bool); + void selection_mapover (sigc::slot >); + + boost::shared_ptr get_dragged_region (); + boost::shared_ptr get_single_selection (); + + Editing::RegionListSortType sort_type () const { + return _sort_type; + } + + void block_change_connection (bool b) { + _change_connection.block (b); + } + + void unselect_all () { + _display.get_selection()->unselect_all (); + } + + void remove_unused_regions (); + + XMLNode& get_state () const; + void set_state (const XMLNode &); + +private: + + struct Columns : public Gtk::TreeModel::ColumnRecord { + Columns () { + add (name); + add (source); + add (color_); + add (natural_pos); + add (path); + add (take_id); + } + + Gtk::TreeModelColumn name; + Gtk::TreeModelColumn > source; + Gtk::TreeModelColumn color_; + Gtk::TreeModelColumn natural_pos; + Gtk::TreeModelColumn path; + Gtk::TreeModelColumn take_id; + }; + + Columns _columns; + + Gtk::TreeModel::RowReference last_row; + + void freeze_tree_model (); + void thaw_tree_model (); + void source_changed (boost::shared_ptr); + void populate_row (Gtk::TreeModel::Row row, boost::shared_ptr source); + void selection_changed (); + + sigc::connection _change_connection; + + bool selection_filter (const Glib::RefPtr& model, const Gtk::TreeModel::Path& path, bool yn); + + Gtk::Widget* old_focus; + Gtk::CellEditable* name_editable; + void name_editing_started (Gtk::CellEditable*, const Glib::ustring&); + + void name_edit (const std::string&, const std::string&); + + 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); + + int sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator); + + void format_position (ARDOUR::samplepos_t pos, char* buf, size_t bufsize, bool onoff = true); + + void add_source (boost::shared_ptr); + void remove_source (boost::shared_ptr); + + void populate_row (boost::shared_ptr, Gtk::TreeModel::Row const &, PBD::PropertyChange const &); + void populate_row_name (boost::shared_ptr region, Gtk::TreeModel::Row const& row); + void populate_row_source (boost::shared_ptr region, Gtk::TreeModel::Row const& row); + + void update_row (boost::shared_ptr); + void update_all_rows (); + + void insert_into_tmp_regionlist (boost::shared_ptr); + + void drag_data_received ( + Glib::RefPtr const &, gint, gint, Gtk::SelectionData const &, guint, guint + ); + + Glib::RefPtr sort_type_action (Editing::RegionListSortType) const; + + Glib::RefPtr hide_action () const; + Glib::RefPtr show_action () const; + Glib::RefPtr remove_unused_regions_action () const; + + Gtk::Menu* _menu; + Gtk::ScrolledWindow _scroller; + Gtk::Frame _frame; + + Gtkmm2ext::DnDTreeView > _display; + + Glib::RefPtr _model; + + bool ignore_region_list_selection_change; + bool ignore_selected_region_change; + + Editing::RegionListSortType _sort_type; + + std::list > tmp_region_list; + + typedef boost::unordered_map, Gtk::TreeModel::RowReference> RegionRowMap; + typedef boost::unordered_map RegionSourceMap; + + RegionRowMap region_row_map; + RegionSourceMap parent_regions_sources_map; + + PBD::ScopedConnection source_property_connection; + + PBD::ScopedConnection source_added_connection; + PBD::ScopedConnection source_removed_connection; + + PBD::ScopedConnection editor_freeze_connection; + PBD::ScopedConnection editor_thaw_connection; + + Selection* _selection; + +}; + +#endif /* __gtk_ardour_editor_regions_h__ */ -- cgit v1.2.3