actual GUI interaction for cue marker ruler
This commit is contained in:
parent
77d83540b1
commit
b1f73d25bf
@ -405,6 +405,7 @@ Editor::Editor ()
|
||||
, _playhead_cursor (0)
|
||||
, _snapped_cursor (0)
|
||||
, cd_marker_bar_drag_rect (0)
|
||||
, cue_marker_bar_drag_rect (0)
|
||||
, range_bar_drag_rect (0)
|
||||
, transport_bar_drag_rect (0)
|
||||
, transport_bar_range_rect (0)
|
||||
|
@ -595,7 +595,7 @@ public:
|
||||
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, int64_t, int64_t, gint);
|
||||
|
||||
/* editing operations that need to be public */
|
||||
void mouse_add_new_marker (Temporal::timepos_t where, bool is_cd=false);
|
||||
void mouse_add_new_marker (Temporal::timepos_t where, ARDOUR::Location::Flags extra_flags = ARDOUR::Location::Flags (0));
|
||||
void split_regions_at (Temporal::timepos_t const & , RegionSelection&);
|
||||
void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
|
||||
RegionSelection get_regions_from_selection_and_mouse (Temporal::timepos_t const &);
|
||||
@ -2014,6 +2014,7 @@ private:
|
||||
/* transport range select process */
|
||||
|
||||
ArdourCanvas::Rectangle* cd_marker_bar_drag_rect;
|
||||
ArdourCanvas::Rectangle* cue_marker_bar_drag_rect;
|
||||
ArdourCanvas::Rectangle* range_bar_drag_rect;
|
||||
ArdourCanvas::Rectangle* transport_bar_drag_rect;
|
||||
ArdourCanvas::Rectangle* transport_bar_range_rect;
|
||||
|
@ -196,6 +196,11 @@ Editor::initialize_canvas ()
|
||||
cd_marker_bar_drag_rect->set_outline (false);
|
||||
cd_marker_bar_drag_rect->hide ();
|
||||
|
||||
cue_marker_bar_drag_rect = new ArdourCanvas::Rectangle (cue_marker_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height));
|
||||
CANVAS_DEBUG_NAME (cd_marker_bar_drag_rect, "cd marker drag");
|
||||
cue_marker_bar_drag_rect->set_outline (false);
|
||||
cue_marker_bar_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);
|
||||
@ -1451,6 +1456,7 @@ Editor::which_canvas_cursor(ItemType type) const
|
||||
case MarkerBarItem:
|
||||
case RangeMarkerBarItem:
|
||||
case CdMarkerBarItem:
|
||||
case CueMarkerBarItem:
|
||||
case VideoBarItem:
|
||||
case TransportMarkerBarItem:
|
||||
case DropZoneItem:
|
||||
|
@ -1002,7 +1002,6 @@ Editor::canvas_cd_marker_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
|
||||
return typed_event (item, event, CdMarkerBarItem);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Editor::canvas_cue_marker_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
|
||||
{
|
||||
|
@ -6092,7 +6092,7 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
|
||||
case CreateRangeMarker:
|
||||
case CreateTransportMarker:
|
||||
case CreateCDMarker:
|
||||
|
||||
case CreateCueMarker:
|
||||
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::CopyModifier)) {
|
||||
_copy = true;
|
||||
} else {
|
||||
@ -6127,6 +6127,9 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
|
||||
case CreateCDMarker:
|
||||
crect = _editor->cd_marker_bar_drag_rect;
|
||||
break;
|
||||
case CreateCueMarker:
|
||||
crect = _editor->cue_marker_bar_drag_rect;
|
||||
break;
|
||||
default:
|
||||
error << string_compose (_("programming_error: %1"), "Error: unknown range marker op passed to Editor::drag_range_markerbar_op ()") << endmsg;
|
||||
return;
|
||||
@ -6135,7 +6138,7 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
|
||||
|
||||
timepos_t const pf = adjusted_current_time (event);
|
||||
|
||||
if (_operation == CreateSkipMarker || _operation == CreateRangeMarker || _operation == CreateTransportMarker || _operation == CreateCDMarker) {
|
||||
if (_operation == CreateSkipMarker || _operation == CreateRangeMarker || _operation == CreateTransportMarker || _operation == CreateCDMarker || _operation == CreateCueMarker) {
|
||||
timepos_t grab (grab_time());
|
||||
_editor->snap_to (grab);
|
||||
|
||||
@ -6194,6 +6197,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||
case CreateSkipMarker:
|
||||
case CreateRangeMarker:
|
||||
case CreateCDMarker:
|
||||
case CreateCueMarker:
|
||||
{
|
||||
XMLNode &before = _editor->session()->locations()->get_state();
|
||||
if (_operation == CreateSkipMarker) {
|
||||
@ -6206,6 +6210,11 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||
_editor->begin_reversible_command (_("new CD marker"));
|
||||
flags = Location::IsRangeMarker | Location::IsCDMarker;
|
||||
_editor->cd_marker_bar_drag_rect->hide();
|
||||
} else if (_operation == CreateCueMarker) {
|
||||
_editor->session()->locations()->next_available_name(rangename, _("Cue"));
|
||||
_editor->begin_reversible_command (_("new cue marker"));
|
||||
flags = Location::IsRangeMarker | Location::IsCueMarker;
|
||||
_editor->cue_marker_bar_drag_rect->hide();
|
||||
} else {
|
||||
_editor->begin_reversible_command (_("new skip marker"));
|
||||
_editor->session()->locations()->next_available_name(rangename, _("unnamed"));
|
||||
|
@ -1299,7 +1299,8 @@ public:
|
||||
CreateSkipMarker,
|
||||
CreateRangeMarker,
|
||||
CreateTransportMarker,
|
||||
CreateCDMarker
|
||||
CreateCDMarker,
|
||||
CreateCueMarker
|
||||
};
|
||||
|
||||
RangeMarkerBarDrag (Editor *, ArdourCanvas::Item *, Operation);
|
||||
|
@ -722,10 +722,10 @@ Editor::LocationMarkers::setup_lines ()
|
||||
}
|
||||
|
||||
void
|
||||
Editor::mouse_add_new_marker (timepos_t where, bool is_cd)
|
||||
Editor::mouse_add_new_marker (timepos_t where, Location::Flags extra_flags)
|
||||
{
|
||||
string markername;
|
||||
int flags = (is_cd ? Location::IsCDMarker|Location::IsMark : Location::IsMark);
|
||||
Location::Flags flags = Location::Flags (extra_flags|Location::IsMark);
|
||||
|
||||
cerr << "adding new marker @ " << where << endl;
|
||||
|
||||
@ -735,7 +735,7 @@ Editor::mouse_add_new_marker (timepos_t where, bool is_cd)
|
||||
return;
|
||||
}
|
||||
|
||||
Location *location = new Location (*_session, where, where, markername, (Location::Flags) flags);
|
||||
Location *location = new Location (*_session, where, where, markername, flags);
|
||||
begin_reversible_command (_("add marker"));
|
||||
|
||||
XMLNode &before = _session->locations()->get_state();
|
||||
|
@ -857,6 +857,15 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||
return true;
|
||||
break;
|
||||
|
||||
case CueMarkerBarItem:
|
||||
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::CreateCueMarker), event);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
||||
case TransportMarkerBarItem:
|
||||
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||
_drags->set (new CursorDrag (this, *_playhead_cursor, false), event);
|
||||
@ -1632,6 +1641,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||
case RangeMarkerBarItem:
|
||||
case TransportMarkerBarItem:
|
||||
case CdMarkerBarItem:
|
||||
case CueMarkerBarItem:
|
||||
case TempoBarItem:
|
||||
case TempoCurveItem:
|
||||
case MeterBarItem:
|
||||
@ -1740,7 +1750,15 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||
if (!_dragging_playhead) {
|
||||
/* if we get here then a dragged range wasn't done */
|
||||
snap_to_with_modifier (where, event, Temporal::RoundNearest, SnapToGrid_Scaled);
|
||||
mouse_add_new_marker (where, true);
|
||||
mouse_add_new_marker (where, Location::IsCDMarker);
|
||||
}
|
||||
return true;
|
||||
|
||||
case CueMarkerBarItem:
|
||||
if (!_dragging_playhead) {
|
||||
/* if we get here then a dragged range wasn't done */
|
||||
snap_to_with_modifier (where, event, Temporal::RoundNearest, SnapToGrid_Scaled);
|
||||
mouse_add_new_marker (where, Location::IsCueMarker);
|
||||
}
|
||||
return true;
|
||||
case TempoBarItem:
|
||||
|
@ -221,7 +221,7 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t)
|
||||
|
||||
switch (t) {
|
||||
case MarkerBarItem:
|
||||
ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false)));
|
||||
ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags (0))));
|
||||
ruler_items.push_back (MenuElem (_("Clear all locations"), sigc::mem_fun(*this, &Editor::clear_markers)));
|
||||
ruler_items.push_back (MenuElem (_("Clear all xruns"), sigc::mem_fun(*this, &Editor::clear_xrun_markers)));
|
||||
ruler_items.push_back (MenuElem (_("Unhide locations"), sigc::mem_fun(*this, &Editor::unhide_markers)));
|
||||
@ -240,7 +240,12 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t)
|
||||
|
||||
case CdMarkerBarItem:
|
||||
// TODO
|
||||
ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true)));
|
||||
ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCDMarker)));
|
||||
break;
|
||||
|
||||
case CueMarkerBarItem:
|
||||
// TODO
|
||||
ruler_items.push_back (MenuElem (_("New Cue track marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker)));
|
||||
break;
|
||||
|
||||
case TempoBarItem:
|
||||
|
@ -148,6 +148,7 @@ setup_gtk_ardour_enums ()
|
||||
REGISTER_ENUM (MarkerBarItem);
|
||||
REGISTER_ENUM (RangeMarkerBarItem);
|
||||
REGISTER_ENUM (CdMarkerBarItem);
|
||||
REGISTER_ENUM (CueMarkerBarItem);
|
||||
REGISTER_ENUM (VideoBarItem);
|
||||
REGISTER_ENUM (TransportMarkerBarItem);
|
||||
REGISTER_ENUM (SelectionItem);
|
||||
|
@ -374,7 +374,7 @@ public:
|
||||
virtual void toggle_meter_updating() = 0;
|
||||
virtual void split_regions_at (Temporal::timepos_t const &, RegionSelection&) = 0;
|
||||
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;
|
||||
virtual void mouse_add_new_marker (Temporal::timepos_t where, bool is_cd=false) = 0;
|
||||
virtual void mouse_add_new_marker (Temporal::timepos_t where, ARDOUR::Location::Flags extra_flags = ARDOUR::Location::Flags (0)) = 0;
|
||||
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
|
||||
virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0;
|
||||
virtual Temporal::timecnt_t get_nudge_distance (Temporal::timepos_t const & pos, Temporal::timecnt_t& next) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user