provide a new EditingContext/Editor method to set the cursor appropriately for section selections
This commit is contained in:
@@ -362,6 +362,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider,
|
||||
*/
|
||||
Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
|
||||
virtual Editing::MouseMode effective_mouse_mode () const { return mouse_mode; }
|
||||
virtual void use_appropriate_mouse_mode_for_sections () {}
|
||||
|
||||
/** @return Whether the current mouse mode is an "internal" editing mode. */
|
||||
virtual bool internal_editing() const = 0;
|
||||
|
||||
@@ -572,6 +572,7 @@ private:
|
||||
void on_samples_per_pixel_changed ();
|
||||
|
||||
Editing::MouseMode effective_mouse_mode () const;
|
||||
void use_appropriate_mouse_mode_for_sections ();
|
||||
|
||||
Editing::MarkerClickBehavior marker_click_behavior;
|
||||
|
||||
|
||||
@@ -2355,6 +2355,47 @@ Editor::effective_mouse_mode () const
|
||||
return mouse_mode;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::use_appropriate_mouse_mode_for_sections ()
|
||||
{
|
||||
Glib::RefPtr<ToggleAction> tact;
|
||||
|
||||
switch (current_mouse_mode ()) {
|
||||
case Editing::MouseRange:
|
||||
/* OK, no need to change mouse mode */
|
||||
break;
|
||||
case Editing::MouseObject:
|
||||
/* "object-range" mode is not a distinct mouse mode, so
|
||||
we cannot use get_mouse_mode_action() here
|
||||
*/
|
||||
tact = ActionManager::get_toggle_action (X_("Editor"), "set-mouse-mode-object-range");
|
||||
if (!tact) {
|
||||
/* missing action */
|
||||
fatal << X_("programming error: missing mouse-mode-object-range action") << endmsg;
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
}
|
||||
if (tact->get_active()) {
|
||||
/* smart mode; OK, leave things as they are */
|
||||
break;
|
||||
}
|
||||
/*fallthrough*/
|
||||
default:
|
||||
/* switch to range mode */
|
||||
Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_static (get_mouse_mode_action (Editing::MouseRange));
|
||||
if (!ract) {
|
||||
/* missing action */
|
||||
fatal << X_("programming error: missing mouse-mode-range action") << endmsg;
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
}
|
||||
if (ract) {
|
||||
ract->set_active (true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::remove_midi_note (ArdourCanvas::Item* item, GdkEvent *)
|
||||
{
|
||||
|
||||
@@ -274,47 +274,12 @@ EditorSections::selection_changed ()
|
||||
return;
|
||||
}
|
||||
Gtk::TreeModel::Row row = *_model->get_iter (*rows.begin ());
|
||||
Glib::RefPtr<ToggleAction> tact;
|
||||
timepos_t start = row[_columns.start];
|
||||
timepos_t end = row[_columns.end];
|
||||
|
||||
_selection_change.block ();
|
||||
|
||||
switch (PublicEditor::instance ().current_mouse_mode ()) {
|
||||
case Editing::MouseRange:
|
||||
/* OK */
|
||||
break;
|
||||
case Editing::MouseObject:
|
||||
/* "object-range" mode is not a distinct mouse mode, so
|
||||
we cannot use get_mouse_mode_action() here
|
||||
*/
|
||||
std::cerr << "A\n";
|
||||
tact = ActionManager::get_toggle_action (X_("Editor"), "set-mouse-mode-object-range");
|
||||
if (!tact) {
|
||||
/* missing action */
|
||||
fatal << X_("programming error: missing mouse-mode-object-range action") << endmsg;
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
}
|
||||
if (tact->get_active()) {
|
||||
/* smart mode; OK */
|
||||
break;
|
||||
}
|
||||
/*fallthrough*/
|
||||
default:
|
||||
std::cerr << "B\n";
|
||||
Glib::RefPtr<RadioAction> ract = ActionManager::get_radio_action (X_("Editor"), X_("set-mouse-mode-range"));
|
||||
if (!ract) {
|
||||
/* missing action */
|
||||
fatal << X_("programming error: missing mouse-mode-range action") << endmsg;
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
}
|
||||
if (ract) {
|
||||
ract->set_active (true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
editing_context.use_appropriate_mouse_mode_for_sections ();
|
||||
|
||||
Selection& s (editing_context.get_selection ());
|
||||
s.clear ();
|
||||
|
||||
Reference in New Issue
Block a user