Prepare Selection Start/End Marker rendering

This commit is contained in:
Robin Gareus 2023-05-16 20:48:42 +02:00
parent 5f03253de6
commit cfba965db3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 83 additions and 35 deletions

View File

@ -128,6 +128,8 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
* (0,MH) <- (6,MH) * (0,MH) <- (6,MH)
* *
* *
* PunchIn:
* LoopStart:
* SessionStart: * SessionStart:
* RangeStart: * RangeStart:
* *
@ -139,6 +141,8 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
* 0,MH * 0,MH
* *
* *
* PunchOut:
* LoopEnd:
* SessionEnd: * SessionEnd:
* RangeEnd: * RangeEnd:
* *
@ -150,9 +154,9 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
* \12,MH * \12,MH
* *
* *
* PunchIn: * SelectionStart:
* *
* 0,0 ------> marker_height,0 * 0,0 ------> MH,0
* | / * | /
* | / * | /
* | / * | /
@ -162,9 +166,9 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
* 0,MH * 0,MH
* *
* *
* PunchOut * SelectionEnd:
* *
* 0,0 ------> MH,0 * -MH,0 ------> 0,0
* \ | * \ |
* \ | * \ |
* \ | * \ |
@ -172,15 +176,15 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
* \ | * \ |
* \ | * \ |
* \ | * \ |
* MH,MH * 0,MH
* *
* Cue: * Cue:
* ben: put your shape here :) * ben: put your shape here :)
*/ */
switch (type) { switch (_type) {
case Mark: case Mark: /* fallthough */
case RegionCue: case RegionCue: /* fallthough */
case BBTPosition: case BBTPosition:
points = new ArdourCanvas::Points (); points = new ArdourCanvas::Points ();
@ -195,7 +199,7 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
_label_offset = 8.0 * scale; _label_offset = 8.0 * scale;
break; break;
case Tempo: case Tempo: /* fallthough */
case Meter: case Meter:
points = new ArdourCanvas::Points (); points = new ArdourCanvas::Points ();
points->push_back (ArdourCanvas::Duple ( M5, 0.0)); points->push_back (ArdourCanvas::Duple ( M5, 0.0));
@ -209,9 +213,9 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
_label_offset = 12.0 * scale; _label_offset = 12.0 * scale;
break; break;
case PunchIn: case PunchIn: /* fallthough */
case LoopStart: case LoopStart: /* fallthough */
case SessionStart: case SessionStart: /* fallthough */
case RangeStart: case RangeStart:
points = new ArdourCanvas::Points (); points = new ArdourCanvas::Points ();
points->push_back (ArdourCanvas::Duple ( 0.0, 0.0)); points->push_back (ArdourCanvas::Duple ( 0.0, 0.0));
@ -223,9 +227,10 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
_label_offset = 8.0 * scale; _label_offset = 8.0 * scale;
break; break;
case PunchOut:
case LoopEnd: case PunchOut: /* fallthough */
case SessionEnd: case LoopEnd: /* fallthough */
case SessionEnd: /* fallthough */
case RangeEnd: case RangeEnd:
points = new ArdourCanvas::Points (); // leaks points = new ArdourCanvas::Points (); // leaks
points->push_back (ArdourCanvas::Duple ( M6, 0.0)); points->push_back (ArdourCanvas::Duple ( M6, 0.0));
@ -237,7 +242,29 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
_label_offset = 0.0 * scale; _label_offset = 0.0 * scale;
break; break;
case SelectionStart:
points = new ArdourCanvas::Points ();
points->push_back (ArdourCanvas::Duple ( 0.0, 0.0));
points->push_back (ArdourCanvas::Duple (.75 * MH, 0.0));
points->push_back (ArdourCanvas::Duple ( 0.0, .75 * MH));
points->push_back (ArdourCanvas::Duple ( 0.0, 0.0));
_shift = 0;
_label_offset = 0;
break;
case SelectionEnd:
points = new ArdourCanvas::Points ();
points->push_back (ArdourCanvas::Duple (-.75 * MH, 0.0));
points->push_back (ArdourCanvas::Duple ( 0.0, 0.0));
points->push_back (ArdourCanvas::Duple ( 0.0, .75 * MH));
points->push_back (ArdourCanvas::Duple (-.75 * MH, 0.0));
_shift = 0;
_label_offset = 0;
break;
case Cue: case Cue:
// XXX TODO scope offs
float offs = 1.0 * scale; float offs = 1.0 * scale;
points = new ArdourCanvas::Points (); points = new ArdourCanvas::Points ();
@ -250,7 +277,6 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
_shift = MH/2; _shift = MH/2;
_label_offset = 2.0 * scale; _label_offset = 2.0 * scale;
break; break;
} }
_position = pos; _position = pos;
@ -262,13 +288,24 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
group->name = string_compose ("Marker::group for %1", annotation); group->name = string_compose ("Marker::group for %1", annotation);
#endif #endif
if ((type != RegionCue) && (type != Meter) && (type != Tempo)) { switch (_type) {
_name_flag = new ArdourCanvas::Rectangle (group); case RegionCue:
/* fallthrough */
case Meter:
/* fallthrough */
case Tempo:
/* fallthrough */
case SelectionStart:
/* fallthrough */
case SelectionEnd:
_name_flag = 0;
break;
default:
_name_flag = new ArdourCanvas::Rectangle (group);
#ifdef CANVAS_DEBUG #ifdef CANVAS_DEBUG
_name_flag->name = string_compose ("Marker::_name_flag for %1", annotation); _name_flag->name = string_compose ("Marker::_name_flag for %1", annotation);
#endif #endif
} else { break;
_name_flag = 0;
} }
/* adjust to properly locate the tip */ /* adjust to properly locate the tip */
@ -279,20 +316,29 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
_pmark->set (*points); _pmark->set (*points);
if (_type == Cue) { switch (_type) {
_pcue->set_outline(false); case SelectionStart:
_pcue->set_fill(true); /* fallthrough */
_pcue->set_center ( ArdourCanvas::Duple (MH/2, MH/2) ); case SelectionEnd:
_pcue->set_radius ( MH/2 ); _pcue->hide();
_pmark->show();
break;
case Cue:
_pcue->set_outline(false);
_pcue->set_fill(true);
_pcue->set_center ( ArdourCanvas::Duple (MH/2, MH/2) );
_pcue->set_radius ( MH/2 );
_pcue->show(); _pcue->show();
_pmark->hide(); _pmark->hide();
if (_name_flag) { if (_name_flag) {
_name_flag->hide(); _name_flag->hide();
} }
} else { break;
_pcue->hide(); default:
_pmark->show(); _pcue->hide();
_pmark->show();
break;
} }
/* setup name pixbuf sizes */ /* setup name pixbuf sizes */

View File

@ -69,7 +69,9 @@ public:
PunchIn, PunchIn,
PunchOut, PunchOut,
RegionCue, RegionCue,
Cue Cue,
SelectionStart,
SelectionEnd,
}; };