mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Update ghost note presence when mouse mode is changed. Fixes #3559.
git-svn-id: svn://localhost/ardour2/branches/3.0@8066 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
8631c44439
commit
03d2864820
4 changed files with 61 additions and 8 deletions
|
|
@ -360,6 +360,8 @@ Editor::set_mouse_mode (MouseMode m, bool force)
|
||||||
/* go there and back to ensure that the toggled handler is called to set up mouse_mode */
|
/* go there and back to ensure that the toggled handler is called to set up mouse_mode */
|
||||||
tact->set_active (false);
|
tact->set_active (false);
|
||||||
tact->set_active (true);
|
tact->set_active (true);
|
||||||
|
|
||||||
|
MouseModeChanged (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -396,6 +398,8 @@ Editor::mouse_mode_toggled (MouseMode m)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_canvas_cursor ();
|
set_canvas_cursor ();
|
||||||
|
|
||||||
|
MouseModeChanged (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2622,7 +2626,7 @@ Editor::set_internal_edit (bool yn)
|
||||||
mouse_select_button.set_image (*(manage (new Image (::get_icon("midi_tool_pencil")))));
|
mouse_select_button.set_image (*(manage (new Image (::get_icon("midi_tool_pencil")))));
|
||||||
mouse_select_button.get_image ()->show ();
|
mouse_select_button.get_image ()->show ();
|
||||||
ARDOUR_UI::instance()->set_tip (mouse_select_button, _("Draw/Edit MIDI Notes"));
|
ARDOUR_UI::instance()->set_tip (mouse_select_button, _("Draw/Edit MIDI Notes"));
|
||||||
set_canvas_cursor ();
|
mouse_mode_toggled (mouse_mode);
|
||||||
|
|
||||||
/* deselect everything to avoid confusion when e.g. we can't now cut a previously selected
|
/* deselect everything to avoid confusion when e.g. we can't now cut a previously selected
|
||||||
region because cut means "cut note" rather than "cut region".
|
region because cut means "cut note" rather than "cut region".
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,8 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||||
, _optimization_iterator (_events.end())
|
, _optimization_iterator (_events.end())
|
||||||
, _list_editor (0)
|
, _list_editor (0)
|
||||||
, no_sound_notes (false)
|
, no_sound_notes (false)
|
||||||
|
, _last_event_x (0)
|
||||||
|
, _last_event_y (0)
|
||||||
, pre_enter_cursor (0)
|
, pre_enter_cursor (0)
|
||||||
{
|
{
|
||||||
_note_group->raise_to_top();
|
_note_group->raise_to_top();
|
||||||
|
|
@ -130,6 +132,8 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||||
, _optimization_iterator (_events.end())
|
, _optimization_iterator (_events.end())
|
||||||
, _list_editor (0)
|
, _list_editor (0)
|
||||||
, no_sound_notes (false)
|
, no_sound_notes (false)
|
||||||
|
, _last_event_x (0)
|
||||||
|
, _last_event_y (0)
|
||||||
{
|
{
|
||||||
_note_group->raise_to_top();
|
_note_group->raise_to_top();
|
||||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||||
|
|
@ -158,6 +162,8 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other)
|
||||||
, _optimization_iterator (_events.end())
|
, _optimization_iterator (_events.end())
|
||||||
, _list_editor (0)
|
, _list_editor (0)
|
||||||
, no_sound_notes (false)
|
, no_sound_notes (false)
|
||||||
|
, _last_event_x (0)
|
||||||
|
, _last_event_y (0)
|
||||||
{
|
{
|
||||||
Gdk::Color c;
|
Gdk::Color c;
|
||||||
int r,g,b,a;
|
int r,g,b,a;
|
||||||
|
|
@ -188,6 +194,8 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<M
|
||||||
, _optimization_iterator (_events.end())
|
, _optimization_iterator (_events.end())
|
||||||
, _list_editor (0)
|
, _list_editor (0)
|
||||||
, no_sound_notes (false)
|
, no_sound_notes (false)
|
||||||
|
, _last_event_x (0)
|
||||||
|
, _last_event_y (0)
|
||||||
{
|
{
|
||||||
Gdk::Color c;
|
Gdk::Color c;
|
||||||
int r,g,b,a;
|
int r,g,b,a;
|
||||||
|
|
@ -259,6 +267,18 @@ MidiRegionView::connect_to_diskstream ()
|
||||||
bool
|
bool
|
||||||
MidiRegionView::canvas_event(GdkEvent* ev)
|
MidiRegionView::canvas_event(GdkEvent* ev)
|
||||||
{
|
{
|
||||||
|
switch (ev->type) {
|
||||||
|
case GDK_ENTER_NOTIFY:
|
||||||
|
case GDK_LEAVE_NOTIFY:
|
||||||
|
_last_event_x = ev->crossing.x;
|
||||||
|
_last_event_y = ev->crossing.y;
|
||||||
|
break;
|
||||||
|
case GDK_MOTION_NOTIFY:
|
||||||
|
_last_event_x = ev->motion.x;
|
||||||
|
_last_event_y = ev->motion.y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!trackview.editor().internal_editing()) {
|
if (!trackview.editor().internal_editing()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -302,17 +322,26 @@ MidiRegionView::canvas_event(GdkEvent* ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiRegionView::remove_ghost_note ()
|
||||||
|
{
|
||||||
|
delete _ghost_note;
|
||||||
|
_ghost_note = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MidiRegionView::enter_notify (GdkEventCrossing* ev)
|
MidiRegionView::enter_notify (GdkEventCrossing* ev)
|
||||||
{
|
{
|
||||||
/* FIXME: do this on switch to note tool, too, if the pointer is already in */
|
trackview.editor().MouseModeChanged.connect (
|
||||||
|
_mouse_mode_connection, invalidator (*this), ui_bind (&MidiRegionView::mouse_mode_changed, this), gui_context ()
|
||||||
|
);
|
||||||
|
|
||||||
Keyboard::magic_widget_grab_focus();
|
Keyboard::magic_widget_grab_focus();
|
||||||
group->grab_focus();
|
group->grab_focus();
|
||||||
|
|
||||||
if (trackview.editor().current_mouse_mode() == MouseRange) {
|
if (trackview.editor().current_mouse_mode() == MouseRange) {
|
||||||
create_ghost_note (ev->x, ev->y);
|
create_ghost_note (ev->x, ev->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -320,12 +349,24 @@ MidiRegionView::enter_notify (GdkEventCrossing* ev)
|
||||||
bool
|
bool
|
||||||
MidiRegionView::leave_notify (GdkEventCrossing*)
|
MidiRegionView::leave_notify (GdkEventCrossing*)
|
||||||
{
|
{
|
||||||
|
_mouse_mode_connection.disconnect ();
|
||||||
|
|
||||||
trackview.editor().hide_verbose_canvas_cursor ();
|
trackview.editor().hide_verbose_canvas_cursor ();
|
||||||
delete _ghost_note;
|
remove_ghost_note ();
|
||||||
_ghost_note = 0;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiRegionView::mouse_mode_changed ()
|
||||||
|
{
|
||||||
|
if (trackview.editor().current_mouse_mode() == MouseRange && trackview.editor().internal_editing()) {
|
||||||
|
create_ghost_note (_last_event_x, _last_event_y);
|
||||||
|
} else {
|
||||||
|
remove_ghost_note ();
|
||||||
|
trackview.editor().hide_verbose_canvas_cursor ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MidiRegionView::button_press (GdkEventButton* ev)
|
MidiRegionView::button_press (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -435,6 +435,13 @@ class MidiRegionView : public RegionView
|
||||||
void connect_to_diskstream ();
|
void connect_to_diskstream ();
|
||||||
void data_recorded (boost::shared_ptr<ARDOUR::MidiBuffer>, boost::weak_ptr<ARDOUR::MidiSource>);
|
void data_recorded (boost::shared_ptr<ARDOUR::MidiBuffer>, boost::weak_ptr<ARDOUR::MidiSource>);
|
||||||
|
|
||||||
|
void remove_ghost_note ();
|
||||||
|
void mouse_mode_changed ();
|
||||||
|
double _last_event_x;
|
||||||
|
double _last_event_y;
|
||||||
|
|
||||||
|
PBD::ScopedConnection _mouse_mode_connection;
|
||||||
|
|
||||||
Gdk::Cursor* pre_enter_cursor;
|
Gdk::Cursor* pre_enter_cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
|
||||||
friend bool forward_key_press (GdkEventKey*);
|
friend bool forward_key_press (GdkEventKey*);
|
||||||
|
|
||||||
PBD::Signal0<void> SnapChanged;
|
PBD::Signal0<void> SnapChanged;
|
||||||
|
PBD::Signal0<void> MouseModeChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __gtk_ardour_public_editor_h__
|
#endif // __gtk_ardour_public_editor_h__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue