mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 21:56:30 +01:00
various changes to accomodate skip markers (which span the entire range of an ARDOUR::Location) and to add drag-to-create-skip
This commit is contained in:
parent
b6b8b892c2
commit
a95ec7ca5b
9 changed files with 68 additions and 33 deletions
|
|
@ -57,6 +57,7 @@ CANVAS_VARIABLE(canvasvar_LocationCDMarker, "location cd marker")
|
|||
CANVAS_VARIABLE(canvasvar_LocationLoop, "location loop")
|
||||
CANVAS_VARIABLE(canvasvar_LocationMarker, "location marker")
|
||||
CANVAS_VARIABLE(canvasvar_LocationPunch, "location punch")
|
||||
CANVAS_VARIABLE(canvasvar_LocationSkip, "location skip")
|
||||
CANVAS_VARIABLE(canvasvar_LocationRange, "location range")
|
||||
CANVAS_VARIABLE(canvasvar_MarkerBar, "marker bar")
|
||||
CANVAS_VARIABLE(canvasvar_MarkerBarSeparator, "marker bar separator")
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
<Option name="location loop" value="5DA557ff"/>
|
||||
<Option name="location marker" value="B700FFff"/>
|
||||
<Option name="location punch" value="B700FFff"/>
|
||||
<Option name="location skip" value="ff0000ff"/>
|
||||
<Option name="location range" value="E0922Fff"/>
|
||||
<Option name="marker bar" value="575757ff"/>
|
||||
<Option name="marker bar separator" value="ffffff15"/>
|
||||
|
|
|
|||
|
|
@ -584,6 +584,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
uint32_t location_loop_color;
|
||||
uint32_t location_punch_color;
|
||||
uint32_t location_cd_marker_color;
|
||||
uint32_t location_skip_color;
|
||||
|
||||
struct LocationMarkers {
|
||||
Marker* start;
|
||||
|
|
@ -1755,6 +1756,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
|
||||
ArdourCanvas::Rectangle* cd_marker_bar_drag_rect;
|
||||
ArdourCanvas::Rectangle* range_bar_drag_rect;
|
||||
ArdourCanvas::Rectangle* skip_drag_rect;
|
||||
ArdourCanvas::Rectangle* transport_bar_drag_rect;
|
||||
|
||||
#ifdef GTKOSX
|
||||
|
|
@ -1765,8 +1767,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
ArdourCanvas::Rectangle *transport_bar_postroll_rect;
|
||||
ArdourCanvas::Rectangle *transport_loop_range_rect;
|
||||
ArdourCanvas::Rectangle *transport_punch_range_rect;
|
||||
ArdourCanvas::Line *transport_punchin_line;
|
||||
ArdourCanvas::Line *transport_punchout_line;
|
||||
ArdourCanvas::Line *transport_punchin_line;
|
||||
ArdourCanvas::Line *transport_punchout_line;
|
||||
ArdourCanvas::Rectangle *transport_preroll_rect;
|
||||
ArdourCanvas::Rectangle *transport_postroll_rect;
|
||||
|
||||
|
|
|
|||
|
|
@ -200,6 +200,11 @@ Editor::initialize_canvas ()
|
|||
cd_marker_bar_drag_rect->set_outline (false);
|
||||
cd_marker_bar_drag_rect->hide ();
|
||||
|
||||
skip_drag_rect = new ArdourCanvas::Rectangle (skip_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height));
|
||||
CANVAS_DEBUG_NAME (skip_drag_rect, "skip drag");
|
||||
skip_drag_rect->set_outline (false);
|
||||
skip_drag_rect->hide ();
|
||||
|
||||
range_bar_drag_rect = new ArdourCanvas::Rectangle (range_marker_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height));
|
||||
CANVAS_DEBUG_NAME (range_bar_drag_rect, "range drag");
|
||||
range_bar_drag_rect->set_outline (false);
|
||||
|
|
@ -935,6 +940,9 @@ Editor::color_handler()
|
|||
range_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_RangeDragBarRect());
|
||||
range_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RangeDragBarRect());
|
||||
|
||||
skip_drag_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_RangeDragBarRect());
|
||||
skip_drag_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RangeDragBarRect());
|
||||
|
||||
transport_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TransportDragRect());
|
||||
transport_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TransportDragRect());
|
||||
|
||||
|
|
@ -958,6 +966,7 @@ Editor::color_handler()
|
|||
location_cd_marker_color = ARDOUR_UI::config()->get_canvasvar_LocationCDMarker();
|
||||
location_loop_color = ARDOUR_UI::config()->get_canvasvar_LocationLoop();
|
||||
location_punch_color = ARDOUR_UI::config()->get_canvasvar_LocationPunch();
|
||||
location_skip_color = ARDOUR_UI::config()->get_canvasvar_LocationSkip();
|
||||
|
||||
refresh_location_display ();
|
||||
/*
|
||||
|
|
@ -1346,6 +1355,7 @@ Editor::choose_canvas_cursor_on_entry (GdkEventCrossing* /*event*/, ItemType typ
|
|||
case MinsecRulerItem:
|
||||
case BBTRulerItem:
|
||||
case SamplesRulerItem:
|
||||
case SkipBarItem:
|
||||
cursor = _cursors->timebar;
|
||||
break;
|
||||
|
||||
|
|
@ -1360,7 +1370,6 @@ Editor::choose_canvas_cursor_on_entry (GdkEventCrossing* /*event*/, ItemType typ
|
|||
case CdMarkerBarItem:
|
||||
case VideoBarItem:
|
||||
case PunchLoopBarItem:
|
||||
case SkipBarItem:
|
||||
case DropZoneItem:
|
||||
cursor = which_grabber_cursor();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -4473,7 +4473,7 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
|
|||
|
||||
switch (_operation) {
|
||||
case CreateSkipMarker:
|
||||
crect = _editor->range_bar_drag_rect;
|
||||
crect = _editor->skip_drag_rect;
|
||||
break;
|
||||
case CreateRangeMarker:
|
||||
crect = _editor->range_bar_drag_rect;
|
||||
|
|
@ -4557,7 +4557,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
_editor->begin_reversible_command (_("new skip marker"));
|
||||
_editor->session()->locations()->next_available_name(rangename,_("skip"));
|
||||
flags = Location::IsRangeMarker | Location::IsSkip;
|
||||
_editor->range_bar_drag_rect->hide();
|
||||
_editor->skip_drag_rect->hide();
|
||||
} else if (_operation == CreateCDMarker) {
|
||||
_editor->session()->locations()->next_available_name(rangename, _("CD"));
|
||||
_editor->begin_reversible_command (_("new CD marker"));
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ Editor::add_new_location_internal (Location* location)
|
|||
color = location_loop_color;
|
||||
} else if (location->is_auto_punch()) {
|
||||
color = location_punch_color;
|
||||
} else if (location->is_skip()) {
|
||||
color = location_skip_color;
|
||||
} else {
|
||||
color = location_range_color;
|
||||
}
|
||||
|
|
@ -139,6 +141,11 @@ Editor::add_new_location_internal (Location* location)
|
|||
lam->start = new Marker (*this, *marker_group, color, _("start"), Marker::SessionStart, location->start());
|
||||
lam->end = new Marker (*this, *marker_group, color, _("end"), Marker::SessionEnd, location->end());
|
||||
group = marker_group;
|
||||
|
||||
} else if (location->is_skip ()) {
|
||||
/* skip: single marker that spans entire skip area */
|
||||
lam->start = new Marker (*this, *skip_group, color, location->name(), Marker::Skip, location->start(), true, location->end());
|
||||
lam->end = 0;
|
||||
|
||||
} else {
|
||||
// range marker
|
||||
|
|
|
|||
|
|
@ -681,10 +681,13 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
break;
|
||||
|
||||
|
||||
case SkipBarItem:
|
||||
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateSkipMarker), event);
|
||||
return true;
|
||||
break;
|
||||
|
||||
case RangeMarkerBarItem:
|
||||
if (Keyboard::modifier_state_contains (event->button.state, Keyboard::TertiaryModifier)) {
|
||||
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateSkipMarker), event);
|
||||
} else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateRangeMarker), event);
|
||||
} else {
|
||||
_drags->set (new CursorDrag (this, *playhead_cursor, false), event);
|
||||
|
|
@ -710,15 +713,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
return true;
|
||||
break;
|
||||
|
||||
case SkipBarItem:
|
||||
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||
_drags->set (new CursorDrag (this, *playhead_cursor, false), event);
|
||||
} else {
|
||||
// _drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateTransportMarker), event);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1297,9 +1291,9 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
|
|||
case TempoBarItem:
|
||||
case MeterBarItem:
|
||||
case RangeMarkerBarItem:
|
||||
case SkipBarItem:
|
||||
case CdMarkerBarItem:
|
||||
case PunchLoopBarItem:
|
||||
case SkipBarItem:
|
||||
case StreamItem:
|
||||
case TimecodeRulerItem:
|
||||
case SamplesRulerItem:
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ const char * Marker::default_new_marker_prefix = N_("MARKER");
|
|||
static const double name_padding = 10.0;
|
||||
|
||||
Marker::Marker (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba, const string& annotation,
|
||||
Type type, framepos_t frame, bool handle_events)
|
||||
Type type, framepos_t start_pos, bool handle_events, framepos_t end_pos)
|
||||
|
||||
: editor (ed)
|
||||
, _parent (&parent)
|
||||
|
|
@ -71,6 +71,8 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba,
|
|||
, _track_canvas_line (0)
|
||||
, _scene_change_rect (0)
|
||||
, _scene_change_text (0)
|
||||
, frame_position (start_pos)
|
||||
, end_frame (end_pos)
|
||||
, _type (type)
|
||||
, _selected (false)
|
||||
, _shown (false)
|
||||
|
|
@ -81,8 +83,11 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba,
|
|||
, _label_offset (0)
|
||||
, _have_scene_change (false)
|
||||
{
|
||||
frame_position = frame;
|
||||
unit_position = editor.sample_to_pixel (frame);
|
||||
if (end_frame >= 0 && (end_frame < frame_position)) {
|
||||
swap (end_frame, frame_position);
|
||||
}
|
||||
|
||||
unit_position = editor.sample_to_pixel (frame_position);
|
||||
unit_position -= _shift;
|
||||
|
||||
group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple (unit_position, 0));
|
||||
|
|
@ -100,7 +105,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba,
|
|||
|
||||
set_color_rgba (rgba);
|
||||
|
||||
if (type == Mark) {
|
||||
if (type == Mark || type == Skip) {
|
||||
_line_shown = true;
|
||||
}
|
||||
|
||||
|
|
@ -223,6 +228,10 @@ Marker::add_polygon (Type type)
|
|||
*/
|
||||
|
||||
switch (type) {
|
||||
case Skip:
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
|
||||
case Mark:
|
||||
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
|
||||
points->push_back (ArdourCanvas::Duple (6.0, 0.0));
|
||||
|
|
@ -341,7 +350,8 @@ Marker::set_show_line (bool s)
|
|||
void
|
||||
Marker::setup_line ()
|
||||
{
|
||||
if ((Profile->get_trx() && _type == Mark) || (_shown && ((!Profile->get_trx() && _selected) || _line_shown))) {
|
||||
if ((Profile->get_trx() && (_type == Skip || _type == Mark)) ||
|
||||
(_shown && ((!Profile->get_trx() && _selected) || _line_shown))) {
|
||||
|
||||
if (_track_canvas_line == 0) {
|
||||
|
||||
|
|
@ -482,19 +492,28 @@ Marker::setup_name_display ()
|
|||
_name_item->clamp_width (name_width);
|
||||
_name_item->set (_name);
|
||||
|
||||
if (ARDOUR::Profile->get_trx()) {
|
||||
|
||||
if (_type == Skip) {
|
||||
|
||||
/* fully span the extent between frame_position + end_frame */
|
||||
_name_background->set_x0 (_name_item->position().x - _label_offset);
|
||||
_name_background->set_x1 (_name_item->position().x - _label_offset + name_width + scene_change_width);
|
||||
_name_background->set_x1 (_name_background->x0() + editor.sample_to_pixel (end_frame - frame_position));
|
||||
|
||||
} else {
|
||||
if (label_on_left ()) {
|
||||
_name_background->set_x0 (_name_item->position().x - 2);
|
||||
_name_background->set_x1 (_name_item->position().x + name_width + _shift + scene_change_width);
|
||||
if (ARDOUR::Profile->get_trx()) {
|
||||
_name_background->set_x0 (_name_item->position().x - _label_offset);
|
||||
_name_background->set_x1 (_name_item->position().x - _label_offset + name_width + scene_change_width);
|
||||
} else {
|
||||
_name_background->set_x0 (_name_item->position().x - _label_offset + 2);
|
||||
_name_background->set_x1 (_name_item->position().x + name_width + scene_change_width);
|
||||
if (label_on_left ()) {
|
||||
_name_background->set_x0 (_name_item->position().x - 2);
|
||||
_name_background->set_x1 (_name_item->position().x + name_width + _shift + scene_change_width);
|
||||
} else {
|
||||
_name_background->set_x0 (_name_item->position().x - _label_offset + 2);
|
||||
_name_background->set_x1 (_name_item->position().x + name_width + scene_change_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_name_background->set_y0 (0);
|
||||
_name_background->set_y1 (_marker_height + 1.0);
|
||||
|
|
|
|||
|
|
@ -52,12 +52,13 @@ class Marker : public sigc::trackable
|
|||
LoopStart,
|
||||
LoopEnd,
|
||||
PunchIn,
|
||||
PunchOut
|
||||
PunchOut,
|
||||
Skip,
|
||||
};
|
||||
|
||||
|
||||
Marker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Type,
|
||||
framepos_t frame = 0, bool handle_events = true);
|
||||
framepos_t frame = 0, bool handle_events = true, framepos_t end_frame = -1);
|
||||
|
||||
virtual ~Marker ();
|
||||
|
||||
|
|
@ -117,6 +118,7 @@ class Marker : public sigc::trackable
|
|||
std::string _name;
|
||||
double unit_position;
|
||||
framepos_t frame_position;
|
||||
framepos_t end_frame;
|
||||
double _shift;
|
||||
Type _type;
|
||||
int name_height;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue