2 Copyright (C) 2000-2009 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __gtk_ardour_editor_regions_h__
20 #define __gtk_ardour_editor_regions_h__
22 #include "editor_component.h"
24 class EditorRegions
: public EditorComponent
27 EditorRegions (Editor
*);
29 void set_session (ARDOUR::Session
*);
31 Gtk::Widget
& widget () {
38 void toggle_show_auto_regions ();
39 void reset_sort_direction (bool);
40 void reset_sort_type (Editing::RegionListSortType
, bool);
41 void set_selected (RegionSelection
&);
42 void selection_mapover (sigc::slot
<void,boost::shared_ptr
<ARDOUR::Region
> >);
43 boost::shared_ptr
<ARDOUR::Region
> get_dragged_region ();
44 boost::shared_ptr
<ARDOUR::Region
> get_single_selection ();
45 Editing::RegionListSortType
sort_type () const {
50 void suspend_redisplay () {
53 void resume_redisplay () {
54 _no_redisplay
= false;
58 void block_change_connection (bool b
) {
59 _change_connection
.block (b
);
62 void unselect_all () {
63 _display
.get_selection()->unselect_all ();
68 struct Columns
: public Gtk::TreeModel::ColumnRecord
{
87 Gtk::TreeModelColumn
<Glib::ustring
> name
;
88 Gtk::TreeModelColumn
<boost::shared_ptr
<ARDOUR::Region
> > region
;
89 Gtk::TreeModelColumn
<Gdk::Color
> color_
;
90 Gtk::TreeModelColumn
<Glib::ustring
> start
;
91 Gtk::TreeModelColumn
<Glib::ustring
> end
;
92 Gtk::TreeModelColumn
<Glib::ustring
> length
;
93 Gtk::TreeModelColumn
<Glib::ustring
> sync
;
94 Gtk::TreeModelColumn
<Glib::ustring
> fadein
;
95 Gtk::TreeModelColumn
<Glib::ustring
> fadeout
;
96 Gtk::TreeModelColumn
<bool> locked
;
97 Gtk::TreeModelColumn
<bool> glued
;
98 Gtk::TreeModelColumn
<bool> muted
;
99 Gtk::TreeModelColumn
<bool> opaque
;
100 Gtk::TreeModelColumn
<Glib::ustring
> used
;
101 Gtk::TreeModelColumn
<Glib::ustring
> path
;
106 void region_changed (boost::shared_ptr
<ARDOUR::Region
>, PBD::PropertyChange
const &);
107 void selection_changed ();
108 sigc::connection _change_connection
;
109 bool set_selected_in_subrow (boost::shared_ptr
<ARDOUR::Region
>, Gtk::TreeModel::Row
const &, int);
110 bool selection_filter (const Glib::RefPtr
<Gtk::TreeModel
>& model
, const Gtk::TreeModel::Path
& path
, bool yn
);
111 void name_edit (const Glib::ustring
&, const Glib::ustring
&);
113 bool key_press (GdkEventKey
*);
114 bool button_press (GdkEventButton
*);
116 void show_context_menu (int button
, int time
);
118 int sorter (Gtk::TreeModel::iterator
, Gtk::TreeModel::iterator
);
120 void add_region (boost::shared_ptr
<ARDOUR::Region
>);
121 void add_regions (std::vector
<boost::shared_ptr
<ARDOUR::Region
> > & );
122 void populate_row (boost::shared_ptr
<ARDOUR::Region
>, Gtk::TreeModel::Row
const &);
123 void update_row (boost::shared_ptr
<ARDOUR::Region
>);
124 bool update_subrows (boost::shared_ptr
<ARDOUR::Region
>, Gtk::TreeModel::Row
const &, int);
125 void update_all_rows ();
126 void update_all_subrows (Gtk::TreeModel::Row
const &, int);
127 void insert_into_tmp_regionlist (boost::shared_ptr
<ARDOUR::Region
>);
129 void drag_data_received (
130 Glib::RefPtr
<Gdk::DragContext
> const &, gint
, gint
, Gtk::SelectionData
const &, guint
, guint
134 Gtk::ScrolledWindow _scroller
;
136 Gtkmm2ext::DnDTreeView
<boost::shared_ptr
<ARDOUR::Region
> > _display
;
137 Glib::RefPtr
<Gtk::TreeStore
> _model
;
138 Glib::RefPtr
<Gtk::Action
> _hide_action
; ///< the action for our Hide menu option
139 Glib::RefPtr
<Gtk::Action
> _show_action
; ///< the action for our Show menu option
140 Glib::RefPtr
<Gtk::ToggleAction
> _toggle_full_action
;
141 Glib::RefPtr
<Gtk::ToggleAction
> _toggle_show_auto_regions_action
;
142 bool _show_automatic_regions
;
143 Editing::RegionListSortType _sort_type
;
145 std::list
<boost::shared_ptr
<ARDOUR::Region
> > tmp_region_list
;
146 PBD::ScopedConnection region_property_connection
;
147 PBD::ScopedConnection check_new_region_connection
;
148 bool ignore_region_list_selection_change
;
149 bool ignore_selected_region_change
;
152 #endif /* __gtk_ardour_editor_regions_h__ */