Take away the Remove option from the region list, and add Show to re-show hidden regions.

git-svn-id: svn://localhost/ardour2/branches/3.0@6814 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-03-31 01:11:48 +00:00
parent f7a9434034
commit d1624f9ed2
6 changed files with 38 additions and 54 deletions

View File

@ -491,7 +491,7 @@
<popup name='RegionListMenu'>
<menuitem action='rlAudition'/>
<menuitem action='rlHide'/>
<menuitem action='rlRemove'/>
<menuitem action='rlShow'/>
<separator/>
<menuitem action='rlShowAll'/>
<menuitem action='rlShowAuto'/>

View File

@ -5008,9 +5008,9 @@ Editor::hide_a_region (boost::shared_ptr<Region> r)
}
void
Editor::remove_a_region (boost::shared_ptr<Region> r)
Editor::show_a_region (boost::shared_ptr<Region> r)
{
// _session->remove_region_from_region_list (r);
r->set_hidden (false);
}
void
@ -5025,6 +5025,12 @@ Editor::hide_region_from_region_list ()
_regions->selection_mapover (sigc::mem_fun (*this, &Editor::hide_a_region));
}
void
Editor::show_region_in_region_list ()
{
_regions->selection_mapover (sigc::mem_fun (*this, &Editor::show_a_region));
}
void
Editor::start_step_editing ()
{

View File

@ -217,7 +217,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
void show_a_region (boost::shared_ptr<ARDOUR::Region>);
#ifdef USE_RUBBERBAND
std::vector<std::string> rb_opt_strings;
@ -1098,6 +1098,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void audition_region_from_region_list ();
void hide_region_from_region_list ();
void show_region_in_region_list ();
void align (ARDOUR::RegionPoint);
void align_relative (ARDOUR::RegionPoint);

View File

@ -775,7 +775,7 @@ Editor::register_actions ()
ActionManager::region_list_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (rl_actions, X_("rlHide"), _("Hide"), sigc::mem_fun(*this, &Editor::hide_region_from_region_list));
ActionManager::region_list_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (rl_actions, X_("rlRemove"), _("Remove"), sigc::mem_fun (*_regions, &EditorRegions::remove_region));
act = ActionManager::register_action (rl_actions, X_("rlShow"), _("Show"), sigc::mem_fun(*this, &Editor::show_region_in_region_list));
ActionManager::region_list_selection_sensitive_actions.push_back (act);
ActionManager::register_toggle_action (rl_actions, X_("rlShowAll"), _("Show All"), sigc::mem_fun(*_regions, &EditorRegions::toggle_full));
ActionManager::register_toggle_action (rl_actions, X_("rlShowAuto"), _("Show Automatic Regions"), sigc::mem_fun (*_regions, &EditorRegions::toggle_show_auto_regions));

View File

@ -121,9 +121,7 @@ EditorRegions::EditorRegions (Editor* e)
_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
_display.signal_key_press_event().connect (sigc::mem_fun(*this, &EditorRegions::key_press));
_display.signal_key_release_event().connect (sigc::mem_fun(*this, &EditorRegions::key_release));
_display.signal_button_press_event().connect (sigc::mem_fun(*this, &EditorRegions::button_press), false);
_display.signal_button_release_event().connect (sigc::mem_fun(*this, &EditorRegions::button_release));
_change_connection = _display.get_selection()->signal_changed().connect (sigc::mem_fun(*this, &EditorRegions::selection_changed));
// _display.signal_popup_menu().connect (sigc::bind (sigc::mem_fun (*this, &Editor::show__display_context_menu), 1, 0));
@ -843,6 +841,9 @@ EditorRegions::build_menu ()
Glib::RefPtr<Action> act;
_hide_action = ActionManager::get_action (X_("RegionList"), X_("rlHide"));
_show_action = ActionManager::get_action (X_("RegionList"), X_("rlShow"));
act = ActionManager::get_action (X_("RegionList"), X_("rlShowAll"));
if (act) {
_toggle_full_action = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
@ -884,6 +885,27 @@ EditorRegions::show_context_menu (int button, int time)
ActionManager::set_sensitive (ActionManager::region_list_selection_sensitive_actions, false);
}
/* Enable the "Show" option if any selected regions are hidden, and vice versa for "Hide" */
bool have_shown = false;
bool have_hidden = false;
TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
TreeIter t = _model->get_iter (*i);
boost::shared_ptr<Region> r = (*t)[_columns.region];
if (r) {
if (r->hidden ()) {
have_hidden = true;
} else {
have_shown = true;
}
}
}
_hide_action->set_sensitive (have_shown);
_show_action->set_sensitive (have_hidden);
_menu->popup (button, time);
}
@ -893,20 +915,6 @@ EditorRegions::key_press (GdkEventKey* /*ev*/)
return false;
}
bool
EditorRegions::key_release (GdkEventKey* ev)
{
switch (ev->keyval) {
case GDK_Delete:
remove_region ();
return true;
break;
default:
break;
}
return false;
}
bool
EditorRegions::button_press (GdkEventButton *ev)
@ -940,30 +948,6 @@ EditorRegions::button_press (GdkEventButton *ev)
return false;
}
bool
EditorRegions::button_release (GdkEventButton *ev)
{
TreeIter iter;
TreeModel::Path path;
TreeViewColumn* column;
int cellx;
int celly;
boost::shared_ptr<Region> region;
if (_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
if ((iter = _model->get_iter (path))) {
region = (*iter)[_columns.region];
}
}
if (region && Keyboard::is_delete_event (ev)) {
// _session->remove_region_from_region_list (region);
return true;
}
return false;
}
int
EditorRegions::sorter (TreeModel::iterator a, TreeModel::iterator b)
{
@ -1101,12 +1085,6 @@ EditorRegions::selection_mapover (sigc::slot<void,boost::shared_ptr<Region> > sl
}
void
EditorRegions::remove_region ()
{
selection_mapover (sigc::mem_fun (*_editor, &Editor::remove_a_region));
}
void
EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context,
int x, int y,

View File

@ -39,7 +39,6 @@ public:
void reset_sort_direction (bool);
void reset_sort_type (Editing::RegionListSortType, bool);
void set_selected (RegionSelection &);
void remove_region ();
void selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
boost::shared_ptr<ARDOUR::Region> get_dragged_region ();
boost::shared_ptr<ARDOUR::Region> get_single_selection ();
@ -112,9 +111,7 @@ private:
void name_edit (const Glib::ustring&, const Glib::ustring&);
bool key_press (GdkEventKey *);
bool key_release (GdkEventKey *);
bool button_press (GdkEventButton *);
bool button_release (GdkEventButton *);
void build_menu ();
void show_context_menu (int button, int time);
@ -138,6 +135,8 @@ private:
Gtk::Frame _frame;
Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > _display;
Glib::RefPtr<Gtk::TreeStore> _model;
Glib::RefPtr<Gtk::Action> _hide_action; ///< the action for our Hide menu option
Glib::RefPtr<Gtk::Action> _show_action; ///< the action for our Show menu option
Glib::RefPtr<Gtk::ToggleAction> _toggle_full_action;
Glib::RefPtr<Gtk::ToggleAction> _toggle_show_auto_regions_action;
bool _show_automatic_regions;