more route + region list navigation/editing changes. not sure we actually want this functionality for the region list
git-svn-id: svn://localhost/ardour2/branches/3.0@7858 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
03fe5aa56d
commit
5f128910e1
|
@ -59,6 +59,8 @@ using Gtkmm2ext::Keyboard;
|
||||||
|
|
||||||
EditorRegions::EditorRegions (Editor* e)
|
EditorRegions::EditorRegions (Editor* e)
|
||||||
: EditorComponent (e)
|
: EditorComponent (e)
|
||||||
|
, old_focus (0)
|
||||||
|
, name_editable (0)
|
||||||
, _menu (0)
|
, _menu (0)
|
||||||
, _show_automatic_regions (true)
|
, _show_automatic_regions (true)
|
||||||
, _sort_type ((Editing::RegionListSortType) 0)
|
, _sort_type ((Editing::RegionListSortType) 0)
|
||||||
|
@ -104,6 +106,7 @@ EditorRegions::EditorRegions (Editor* e)
|
||||||
CellRendererText* region_name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
|
CellRendererText* region_name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
|
||||||
region_name_cell->property_editable() = true;
|
region_name_cell->property_editable() = true;
|
||||||
region_name_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorRegions::name_edit));
|
region_name_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorRegions::name_edit));
|
||||||
|
region_name_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorRegions::name_editing_started));
|
||||||
|
|
||||||
_display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRegions::selection_filter));
|
_display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRegions::selection_filter));
|
||||||
|
|
||||||
|
@ -153,9 +156,16 @@ EditorRegions::EditorRegions (Editor* e)
|
||||||
_scroller.add (_display);
|
_scroller.add (_display);
|
||||||
_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
||||||
|
|
||||||
_display.signal_key_press_event().connect (sigc::mem_fun(*this, &EditorRegions::key_press), false);
|
|
||||||
_display.signal_button_press_event().connect (sigc::mem_fun(*this, &EditorRegions::button_press), false);
|
_display.signal_button_press_event().connect (sigc::mem_fun(*this, &EditorRegions::button_press), false);
|
||||||
_change_connection = _display.get_selection()->signal_changed().connect (sigc::mem_fun(*this, &EditorRegions::selection_changed));
|
_change_connection = _display.get_selection()->signal_changed().connect (sigc::mem_fun(*this, &EditorRegions::selection_changed));
|
||||||
|
|
||||||
|
_scroller.signal_key_press_event().connect (sigc::mem_fun(*this, &EditorRegions::key_press), false);
|
||||||
|
_scroller.signal_focus_in_event().connect (sigc::mem_fun (*this, &EditorRegions::focus_in), false);
|
||||||
|
_scroller.signal_focus_out_event().connect (sigc::mem_fun (*this, &EditorRegions::focus_out));
|
||||||
|
|
||||||
|
_display.signal_enter_notify_event().connect (sigc::mem_fun (*this, &EditorRegions::enter_notify), false);
|
||||||
|
_display.signal_leave_notify_event().connect (sigc::mem_fun (*this, &EditorRegions::leave_notify), false);
|
||||||
|
|
||||||
// _display.signal_popup_menu().connect (sigc::bind (sigc::mem_fun (*this, &Editor::show__display_context_menu), 1, 0));
|
// _display.signal_popup_menu().connect (sigc::bind (sigc::mem_fun (*this, &Editor::show__display_context_menu), 1, 0));
|
||||||
|
|
||||||
//ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions));
|
//ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions));
|
||||||
|
@ -164,6 +174,60 @@ EditorRegions::EditorRegions (Editor* e)
|
||||||
ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::add_region, this, _1), gui_context());
|
ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::add_region, this, _1), gui_context());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
EditorRegions::focus_in (GdkEventFocus*)
|
||||||
|
{
|
||||||
|
Window* win = dynamic_cast<Window*> (_scroller.get_toplevel ());
|
||||||
|
|
||||||
|
if (win) {
|
||||||
|
old_focus = win->get_focus ();
|
||||||
|
} else {
|
||||||
|
old_focus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
name_editable = 0;
|
||||||
|
|
||||||
|
/* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
EditorRegions::focus_out (GdkEventFocus*)
|
||||||
|
{
|
||||||
|
if (old_focus) {
|
||||||
|
old_focus->grab_focus ();
|
||||||
|
old_focus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
name_editable = 0;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
EditorRegions::enter_notify (GdkEventCrossing* ev)
|
||||||
|
{
|
||||||
|
/* arm counter so that ::selection_filter() will deny selecting anything for the
|
||||||
|
next two attempts to change selection status.
|
||||||
|
*/
|
||||||
|
_scroller.grab_focus ();
|
||||||
|
Keyboard::magic_widget_grab_focus ();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
EditorRegions::leave_notify (GdkEventCrossing*)
|
||||||
|
{
|
||||||
|
if (old_focus) {
|
||||||
|
old_focus->grab_focus ();
|
||||||
|
old_focus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
name_editable = 0;
|
||||||
|
Keyboard::magic_widget_drop_focus ();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorRegions::set_session (ARDOUR::Session* s)
|
EditorRegions::set_session (ARDOUR::Session* s)
|
||||||
{
|
{
|
||||||
|
@ -1056,6 +1120,12 @@ EditorRegions::key_press (GdkEventKey* ev)
|
||||||
switch (ev->keyval) {
|
switch (ev->keyval) {
|
||||||
case GDK_Tab:
|
case GDK_Tab:
|
||||||
case GDK_ISO_Left_Tab:
|
case GDK_ISO_Left_Tab:
|
||||||
|
|
||||||
|
if (name_editable) {
|
||||||
|
name_editable->editing_done ();
|
||||||
|
name_editable = 0;
|
||||||
|
}
|
||||||
|
|
||||||
col = _display.get_column (0); // select&focus on name column
|
col = _display.get_column (0); // select&focus on name column
|
||||||
|
|
||||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
||||||
|
@ -1291,9 +1361,17 @@ EditorRegions::selection_filter (const RefPtr<TreeModel>& model, const TreeModel
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EditorRegions::name_editing_started (CellEditable* ce, const Glib::ustring&)
|
||||||
|
{
|
||||||
|
name_editable = ce;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorRegions::name_edit (const std::string& path, const std::string& new_text)
|
EditorRegions::name_edit (const std::string& path, const std::string& new_text)
|
||||||
{
|
{
|
||||||
|
name_editable = 0;
|
||||||
|
|
||||||
boost::shared_ptr<Region> region;
|
boost::shared_ptr<Region> region;
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,10 @@ private:
|
||||||
|
|
||||||
bool set_selected_in_subrow (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
|
bool set_selected_in_subrow (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
|
||||||
bool selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
|
bool selection_filter (const Glib::RefPtr<Gtk::TreeModel>& 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&);
|
void name_edit (const std::string&, const std::string&);
|
||||||
void locked_changed (std::string const &);
|
void locked_changed (std::string const &);
|
||||||
|
@ -133,6 +137,10 @@ private:
|
||||||
|
|
||||||
bool key_press (GdkEventKey *);
|
bool key_press (GdkEventKey *);
|
||||||
bool button_press (GdkEventButton *);
|
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);
|
void show_context_menu (int button, int time);
|
||||||
|
|
||||||
int sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
|
int sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
|
||||||
|
|
|
@ -231,6 +231,8 @@ EditorRoutes::focus_in (GdkEventFocus*)
|
||||||
old_focus = 0;
|
old_focus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name_editable = 0;
|
||||||
|
|
||||||
/* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
|
/* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -243,6 +245,7 @@ EditorRoutes::focus_out (GdkEventFocus*)
|
||||||
old_focus = 0;
|
old_focus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name_editable = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +271,7 @@ EditorRoutes::leave_notify (GdkEventCrossing*)
|
||||||
old_focus = 0;
|
old_focus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name_editable = 0;
|
||||||
Keyboard::magic_widget_drop_focus ();
|
Keyboard::magic_widget_drop_focus ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -884,8 +888,6 @@ EditorRoutes::key_press (GdkEventKey* ev)
|
||||||
boost::shared_ptr<RouteList> rl (new RouteList);
|
boost::shared_ptr<RouteList> rl (new RouteList);
|
||||||
TreePath path;
|
TreePath path;
|
||||||
|
|
||||||
cerr << "our key press\n";
|
|
||||||
|
|
||||||
switch (ev->keyval) {
|
switch (ev->keyval) {
|
||||||
case GDK_Tab:
|
case GDK_Tab:
|
||||||
case GDK_ISO_Left_Tab:
|
case GDK_ISO_Left_Tab:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user