View Issue Details

IDProjectCategoryView StatusLast Update
0004692ardourbugspublic2020-04-19 20:16
Reportertophatdave Assigned Topaul  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Target Version3.0 
Summary0004692: [PATCH] Track canvas cursors vs. internal mode/mouse mode operations need fixing
Description1 - time stretch in MIDI regions with internal mode "on" is currently disabled. this mode probably works okay (needs testing) and, if so, should be enabled
2 - with internal mode "on", switching to audition, zoom mouse modes results in wrong cursor (editor_mouse.cc::set_canvas_cursor)
3 - automation mouse mode never applies to MIDI regions and cursor over MIDI regions in that mode should reflect that
TagsNo tags attached.

Activities

2012-02-09 17:10

 

patch4692.diff (4,513 bytes)   
Index: gtk2_ardour/mouse_cursors.cc
===================================================================
--- gtk2_ardour/mouse_cursors.cc	(revision 11476)
+++ gtk2_ardour/mouse_cursors.cc	(working copy)
@@ -29,7 +29,7 @@
 
 	{
 		RefPtr<Pixbuf> p (::get_icon ("zoom_in_cursor"));
-		zoom_in = new Cursor (Display::get_default(), p, 5, 5);
+		zoom_in = new Cursor (Display::get_default(), p, 10, 5);
 	}
 
 	{
@@ -49,7 +49,7 @@
 	{
 		RefPtr<Bitmap> source = Bitmap::create (speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
 		RefPtr<Bitmap> mask = Bitmap::create (speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
-		speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
+		speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_width >> 1, speaker_cursor_height >> 1);
 	}
 
 	{
Index: gtk2_ardour/editor_mouse.cc
===================================================================
--- gtk2_ardour/editor_mouse.cc	(revision 11476)
+++ gtk2_ardour/editor_mouse.cc	(working copy)
@@ -238,61 +238,38 @@
 void
 Editor::set_canvas_cursor ()
 {
-	if (_internal_editing) {
+	switch (mouse_mode) {
+	case MouseRange:
+		current_canvas_cursor = _cursors->selector;
+		break;
 
-		switch (mouse_mode) {
-		case MouseDraw:
-			current_canvas_cursor = _cursors->midi_pencil;
-			break;
+	case MouseObject:
+		current_canvas_cursor = which_grabber_cursor();
+		break;
 
-		case MouseObject:
-			current_canvas_cursor = which_grabber_cursor();
-			break;
+	case MouseDraw:
+		current_canvas_cursor = _cursors->midi_pencil;
+		break;
 
-		case MouseTimeFX:
-			current_canvas_cursor = _cursors->midi_resize;
-			break;
+	case MouseGain:
+		current_canvas_cursor = _cursors->cross_hair;
+		break;
 
-		default:
-			return;
+	case MouseZoom:
+		if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
+			current_canvas_cursor = _cursors->zoom_out;
+		} else {
+			current_canvas_cursor = _cursors->zoom_in;
 		}
+		break;
 
-	} else {
+	case MouseTimeFX:
+		current_canvas_cursor = _cursors->time_fx; // just use playhead
+		break;
 
-		switch (mouse_mode) {
-		case MouseRange:
-			current_canvas_cursor = _cursors->selector;
-			break;
-
-		case MouseObject:
-			current_canvas_cursor = which_grabber_cursor();
-			break;
-
-		case MouseDraw:
-			/* shouldn't be possible, but just cover it anyway ... */
-			current_canvas_cursor = _cursors->midi_pencil;
-			break;
-
-		case MouseGain:
-			current_canvas_cursor = _cursors->cross_hair;
-			break;
-
-		case MouseZoom:
-			if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
-				current_canvas_cursor = _cursors->zoom_out;
-			} else {
-				current_canvas_cursor = _cursors->zoom_in;
-			}
-			break;
-
-		case MouseTimeFX:
-			current_canvas_cursor = _cursors->time_fx; // just use playhead
-			break;
-
-		case MouseAudition:
-			current_canvas_cursor = _cursors->speaker;
-			break;
-		}
+	case MouseAudition:
+		current_canvas_cursor = _cursors->speaker;
+		break;
 	}
 
 	switch (_join_object_range_state) {
@@ -574,7 +551,7 @@
 	     (mouse_mode != MouseRange) &&
 	     (mouse_mode != MouseDraw)) ||
 	    ((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3) ||
-	    internal_editing()) {
+	    (internal_editing() && mouse_mode != MouseTimeFX)) {
 
 		return;
 	}
@@ -1151,8 +1128,8 @@
 			/* drag notes if we're in internal edit mode */
 			_drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
 			return true;
-		} else if ((!internal_editing() || dynamic_cast<AudioRegionView*> (clicked_regionview)) && clicked_regionview) {
-			/* do time-FX if we're not in internal edit mode, or we are but we clicked on an audio region */
+		} else if (clicked_regionview) {
+			/* do time-FX  */
 			_drags->set (new TimeFXDrag (this, item, clicked_regionview, selection->regions.by_layer()), event);
 			return true;
 		}
Index: gtk2_ardour/midi_region_view.cc
===================================================================
--- gtk2_ardour/midi_region_view.cc	(revision 11476)
+++ gtk2_ardour/midi_region_view.cc	(working copy)
@@ -333,7 +333,8 @@
 		return trackview.editor().toggle_internal_editing_from_double_click (ev);
 	}
 
-	if (!trackview.editor().internal_editing()) {
+	if (!trackview.editor().internal_editing() || trackview.editor().current_mouse_mode() == MouseTimeFX || trackview.editor().current_mouse_mode() == MouseZoom) {
+		// handle non-draw modes elsewhere
 		return false;
 	}
 
patch4692.diff (4,513 bytes)   

tophatdave

2012-02-09 17:12

reporter   ~0012772

i have done preliminary testing on the attached patch and believe it addresses items 1 and 2 of the ticket.

tophatdave

2012-02-09 17:27

reporter   ~0012773

this patch also includes a move of the zoom hotspot to align with its "crosshairs" and a move of the audition hotspot to be within the body of that cursor.

2012-02-10 16:52

 

patch4692update.diff (5,255 bytes)   
Index: gtk2_ardour/mouse_cursors.cc
===================================================================
--- gtk2_ardour/mouse_cursors.cc	(revision 11476)
+++ gtk2_ardour/mouse_cursors.cc	(working copy)
@@ -29,7 +29,7 @@
 
 	{
 		RefPtr<Pixbuf> p (::get_icon ("zoom_in_cursor"));
-		zoom_in = new Cursor (Display::get_default(), p, 5, 5);
+		zoom_in = new Cursor (Display::get_default(), p, 10, 5);
 	}
 
 	{
@@ -49,7 +49,7 @@
 	{
 		RefPtr<Bitmap> source = Bitmap::create (speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
 		RefPtr<Bitmap> mask = Bitmap::create (speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
-		speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
+		speaker = new Cursor (source, mask, ffg, fbg, speaker_cursor_width >> 1, speaker_cursor_height >> 1);
 	}
 
 	{
Index: gtk2_ardour/editor_mouse.cc
===================================================================
--- gtk2_ardour/editor_mouse.cc	(revision 11476)
+++ gtk2_ardour/editor_mouse.cc	(working copy)
@@ -238,61 +238,38 @@
 void
 Editor::set_canvas_cursor ()
 {
-	if (_internal_editing) {
+	switch (mouse_mode) {
+	case MouseRange:
+		current_canvas_cursor = _cursors->selector;
+		break;
 
-		switch (mouse_mode) {
-		case MouseDraw:
-			current_canvas_cursor = _cursors->midi_pencil;
-			break;
+	case MouseObject:
+		current_canvas_cursor = which_grabber_cursor();
+		break;
 
-		case MouseObject:
-			current_canvas_cursor = which_grabber_cursor();
-			break;
+	case MouseDraw:
+		current_canvas_cursor = _cursors->midi_pencil;
+		break;
 
-		case MouseTimeFX:
-			current_canvas_cursor = _cursors->midi_resize;
-			break;
+	case MouseGain:
+		current_canvas_cursor = _cursors->cross_hair;
+		break;
 
-		default:
-			return;
+	case MouseZoom:
+		if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
+			current_canvas_cursor = _cursors->zoom_out;
+		} else {
+			current_canvas_cursor = _cursors->zoom_in;
 		}
+		break;
 
-	} else {
+	case MouseTimeFX:
+		current_canvas_cursor = _cursors->time_fx; // just use playhead
+		break;
 
-		switch (mouse_mode) {
-		case MouseRange:
-			current_canvas_cursor = _cursors->selector;
-			break;
-
-		case MouseObject:
-			current_canvas_cursor = which_grabber_cursor();
-			break;
-
-		case MouseDraw:
-			/* shouldn't be possible, but just cover it anyway ... */
-			current_canvas_cursor = _cursors->midi_pencil;
-			break;
-
-		case MouseGain:
-			current_canvas_cursor = _cursors->cross_hair;
-			break;
-
-		case MouseZoom:
-			if (Keyboard::the_keyboard().key_is_down (GDK_Control_L)) {
-				current_canvas_cursor = _cursors->zoom_out;
-			} else {
-				current_canvas_cursor = _cursors->zoom_in;
-			}
-			break;
-
-		case MouseTimeFX:
-			current_canvas_cursor = _cursors->time_fx; // just use playhead
-			break;
-
-		case MouseAudition:
-			current_canvas_cursor = _cursors->speaker;
-			break;
-		}
+	case MouseAudition:
+		current_canvas_cursor = _cursors->speaker;
+		break;
 	}
 
 	switch (_join_object_range_state) {
@@ -574,7 +551,7 @@
 	     (mouse_mode != MouseRange) &&
 	     (mouse_mode != MouseDraw)) ||
 	    ((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3) ||
-	    internal_editing()) {
+	    (internal_editing() && mouse_mode != MouseTimeFX)) {
 
 		return;
 	}
@@ -1151,8 +1128,8 @@
 			/* drag notes if we're in internal edit mode */
 			_drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
 			return true;
-		} else if ((!internal_editing() || dynamic_cast<AudioRegionView*> (clicked_regionview)) && clicked_regionview) {
-			/* do time-FX if we're not in internal edit mode, or we are but we clicked on an audio region */
+		} else if (clicked_regionview) {
+			/* do time-FX  */
 			_drags->set (new TimeFXDrag (this, item, clicked_regionview, selection->regions.by_layer()), event);
 			return true;
 		}
Index: gtk2_ardour/midi_region_view.cc
===================================================================
--- gtk2_ardour/midi_region_view.cc	(revision 11476)
+++ gtk2_ardour/midi_region_view.cc	(working copy)
@@ -333,7 +333,10 @@
 		return trackview.editor().toggle_internal_editing_from_double_click (ev);
 	}
 
-	if (!trackview.editor().internal_editing()) {
+	if ((!trackview.editor().internal_editing() && trackview.editor().current_mouse_mode() != MouseGain) ||
+		(trackview.editor().current_mouse_mode() == MouseTimeFX) ||
+		(trackview.editor().current_mouse_mode() == MouseZoom)) {
+		// handle non-draw modes elsewhere
 		return false;
 	}
 
@@ -394,6 +397,13 @@
 		group->grab_focus();
 	}
 
+	// if current operation is non-operational in a midi region, change the cursor to so indicate
+	if (trackview.editor().current_mouse_mode() == MouseGain) {
+		Editor* editor = dynamic_cast<Editor *> (&trackview.editor());
+		pre_enter_cursor = editor->get_canvas_cursor();
+		editor->set_canvas_cursor(editor->cursors()->timebar);
+	}
+
 	return false;
 }
 
@@ -405,6 +415,11 @@
 	trackview.editor().verbose_cursor()->hide ();
 	remove_ghost_note ();
 
+	if (pre_enter_cursor) {
+		Editor* editor = dynamic_cast<Editor *> (&trackview.editor());
+		editor->set_canvas_cursor(pre_enter_cursor);
+	}
+
 	return false;
 }
 
patch4692update.diff (5,255 bytes)   

tophatdave

2012-02-10 16:56

reporter   ~0012779

i have attached an updated patch that supersedes the previous patch and includes handling of the "inactive" gain mode cursor over midi regions. there are still some minor issues with the "inactive" cursor :

- gain mode cursor reappears when cursor over midi region with keyboard gain mode switch

- gain mode cursor reappears over region name mode

- gain mode cursor reappears over notes in midi region with internal mode on

paul

2012-05-29 20:30

administrator   ~0013332

applied rev 12481

system

2020-04-19 20:16

developer   ~0022962

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2012-02-07 19:53 tophatdave New Issue
2012-02-08 12:29 cth103 cost => 0.00
2012-02-08 12:29 cth103 Target Version => 3.0-beta3
2012-02-09 17:10 tophatdave File Added: patch4692.diff
2012-02-09 17:12 tophatdave Note Added: 0012772
2012-02-09 17:27 tophatdave Note Added: 0012773
2012-02-09 20:22 cth103 Summary Track canvas cursors vs. internal mode/mouse mode operations need fixing => [PATCH] Track canvas cursors vs. internal mode/mouse mode operations need fixing
2012-02-10 16:52 tophatdave File Added: patch4692update.diff
2012-02-10 16:56 tophatdave Note Added: 0012779
2012-02-14 17:20 paul Target Version 3.0-beta3 => 3.0 beta4
2012-05-23 15:09 cth103 Target Version 3.0 beta4 => 3.0
2012-05-29 20:30 paul Note Added: 0013332
2012-05-29 20:30 paul Status new => resolved
2012-05-29 20:30 paul Resolution open => fixed
2012-05-29 20:30 paul Assigned To => paul
2020-04-19 20:16 system Note Added: 0022962
2020-04-19 20:16 system Status resolved => closed