refactor methods to add a location/section marker so that there is only one method for this
This commit is contained in:
parent
8ad53bc96c
commit
2d5884ccb1
@ -601,7 +601,6 @@ public:
|
|||||||
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, int64_t, int64_t, gint);
|
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, int64_t, int64_t, gint);
|
||||||
|
|
||||||
/* editing operations that need to be public */
|
/* editing operations that need to be public */
|
||||||
void mouse_add_new_marker (Temporal::timepos_t where, ARDOUR::Location::Flags extra_flags = ARDOUR::Location::Flags (0), int32_t cue_id = 0);
|
|
||||||
void split_regions_at (Temporal::timepos_t const & , RegionSelection&);
|
void split_regions_at (Temporal::timepos_t const & , RegionSelection&);
|
||||||
void split_region_at_points (std::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
|
void split_region_at_points (std::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
|
||||||
RegionSelection get_regions_from_selection_and_mouse (Temporal::timepos_t const &);
|
RegionSelection get_regions_from_selection_and_mouse (Temporal::timepos_t const &);
|
||||||
@ -1620,7 +1619,7 @@ private:
|
|||||||
void set_selection_from_loop ();
|
void set_selection_from_loop ();
|
||||||
void set_selection_from_region ();
|
void set_selection_from_region ();
|
||||||
|
|
||||||
void add_location_mark (Temporal::timepos_t const & where);
|
void add_location_mark_with_flag (Temporal::timepos_t const & where, ARDOUR::Location::Flags flag, int32_t cue_id);
|
||||||
void add_location_from_region ();
|
void add_location_from_region ();
|
||||||
void add_locations_from_region ();
|
void add_locations_from_region ();
|
||||||
void add_location_from_selection ();
|
void add_location_from_selection ();
|
||||||
|
@ -1180,7 +1180,7 @@ Editor::section_rect_event (GdkEvent* ev, Location* loc, ArdourCanvas::Rectangle
|
|||||||
MenuList& items (section_box_menu.items());
|
MenuList& items (section_box_menu.items());
|
||||||
items.clear ();
|
items.clear ();
|
||||||
|
|
||||||
items.push_back (MenuElem (_("New Arrangement Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags(Location::IsMark | Location::IsSection), 0)));
|
items.push_back (MenuElem (_("New Arrangement Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::add_location_mark_with_flag), where, Location::Flags(Location::IsMark | Location::IsSection), 0)));
|
||||||
items.push_back (MenuElem (_("Select Arrangement Section"), sigc::bind (sigc::mem_fun(*_sections, &EditorSections::select), l)));
|
items.push_back (MenuElem (_("Select Arrangement Section"), sigc::bind (sigc::mem_fun(*_sections, &EditorSections::select), l)));
|
||||||
#if 0
|
#if 0
|
||||||
items.push_back (SeparatorElem());
|
items.push_back (SeparatorElem());
|
||||||
|
@ -828,52 +828,6 @@ Editor::LocationMarkers::setup_lines ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Editor::mouse_add_new_marker (timepos_t where, Location::Flags extra_flags, int32_t cue_id)
|
|
||||||
{
|
|
||||||
if (!_session) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string markername;
|
|
||||||
string namebase;
|
|
||||||
Location::Flags flags = Location::Flags (extra_flags|Location::IsMark);
|
|
||||||
|
|
||||||
if (flags & Location::IsCueMarker) {
|
|
||||||
/* XXX i18n needed for cue letter names */
|
|
||||||
markername = string_compose (_("cue %1"), cue_marker_name (cue_id));
|
|
||||||
} else {
|
|
||||||
if (flags & Location::IsSection) {
|
|
||||||
namebase = _("section");
|
|
||||||
} else {
|
|
||||||
namebase = _("mark");
|
|
||||||
}
|
|
||||||
_session->locations()->next_available_name (markername, namebase);
|
|
||||||
|
|
||||||
if (!choose_new_marker_name (markername)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Location *location = new Location (*_session, where, where, markername, flags, cue_id);
|
|
||||||
begin_reversible_command (_("add marker"));
|
|
||||||
|
|
||||||
XMLNode &before = _session->locations()->get_state();
|
|
||||||
_session->locations()->add (location, true);
|
|
||||||
XMLNode &after = _session->locations()->get_state();
|
|
||||||
_session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
|
||||||
|
|
||||||
/* find the marker we just added */
|
|
||||||
|
|
||||||
LocationMarkers *lam = find_location_markers (location);
|
|
||||||
if (lam) {
|
|
||||||
/* make it the selected marker */
|
|
||||||
selection->set (lam->start);
|
|
||||||
}
|
|
||||||
|
|
||||||
commit_reversible_command ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::mouse_add_new_loop (timepos_t where)
|
Editor::mouse_add_new_loop (timepos_t where)
|
||||||
{
|
{
|
||||||
|
@ -1793,14 +1793,14 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||||||
case MarkerBarItem:
|
case MarkerBarItem:
|
||||||
if (!_dragging_playhead) {
|
if (!_dragging_playhead) {
|
||||||
snap_to_with_modifier (where, event, Temporal::RoundNearest, SnapToGrid_Scaled);
|
snap_to_with_modifier (where, event, Temporal::RoundNearest, SnapToGrid_Scaled);
|
||||||
mouse_add_new_marker (where);
|
add_location_mark (where);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case SectionMarkerBarItem:
|
case SectionMarkerBarItem:
|
||||||
if (!_dragging_playhead && Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
if (!_dragging_playhead && Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||||
snap_to_with_modifier (where, event, Temporal::RoundNearest, SnapToGrid_Scaled);
|
snap_to_with_modifier (where, event, Temporal::RoundNearest, SnapToGrid_Scaled);
|
||||||
mouse_add_new_marker (where, Location::IsSection);
|
add_location_mark (where, Location::IsSection);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -2348,21 +2348,36 @@ Editor::add_location_from_selection ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::add_location_mark (timepos_t const & where)
|
Editor::add_location_mark_with_flag (timepos_t const & where, Location::Flags flags, int32_t cue_id)
|
||||||
{
|
{
|
||||||
|
if (!_session) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_session->locations()->mark_at (where, timecnt_t (1))) {
|
if (_session->locations()->mark_at (where, timecnt_t (1))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string markername;
|
string markername;
|
||||||
|
string namebase;
|
||||||
|
|
||||||
select_new_marker = true;
|
select_new_marker = true;
|
||||||
|
|
||||||
_session->locations()->next_available_name(markername,"mark");
|
if (flags & Location::IsCueMarker) {
|
||||||
if (!choose_new_marker_name(markername)) {
|
/* XXX i18n needed for cue letter names */
|
||||||
|
markername = string_compose (_("cue %1"), cue_marker_name (cue_id));
|
||||||
|
} else if (flags & Location::IsSection) {
|
||||||
|
namebase = _("section");
|
||||||
|
} else {
|
||||||
|
namebase = _("mark");
|
||||||
|
}
|
||||||
|
|
||||||
|
_session->locations()->next_available_name(markername, namebase);
|
||||||
|
|
||||||
|
if (!choose_new_marker_name (markername)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location *location = new Location (*_session, where, where, markername, Location::IsMark);
|
Location *location = new Location (*_session, where, where, markername, flags);
|
||||||
begin_reversible_command (_("add marker"));
|
begin_reversible_command (_("add marker"));
|
||||||
|
|
||||||
XMLNode &before = _session->locations()->get_state();
|
XMLNode &before = _session->locations()->get_state();
|
||||||
@ -7249,7 +7264,7 @@ Editor::set_edit_point ()
|
|||||||
|
|
||||||
if (selection->markers.empty()) {
|
if (selection->markers.empty()) {
|
||||||
|
|
||||||
mouse_add_new_marker (where);
|
add_location_mark (where);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bool ignored;
|
bool ignored;
|
||||||
|
@ -286,16 +286,16 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t)
|
|||||||
Gtk::MenuItem& add_menu = ruler_items.back();
|
Gtk::MenuItem& add_menu = ruler_items.back();
|
||||||
Gtk::Menu* a_menu = new Gtk::Menu;
|
Gtk::Menu* a_menu = new Gtk::Menu;
|
||||||
MenuList& add_items = a_menu->items();
|
MenuList& add_items = a_menu->items();
|
||||||
add_items.push_back (MenuElem (_("Location Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags (0), 0)));
|
add_items.push_back (MenuElem (_("Location Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::add_location_mark_with_flag), where, Location::Flags (0), 0)));
|
||||||
add_items.push_back (MenuElem (_("Arrangement Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags(Location::IsMark | Location::IsSection), 0)));
|
add_items.push_back (MenuElem (_("Arrangement Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::add_location_mark_with_flag), where, Location::Flags(Location::IsMark | Location::IsSection), 0)));
|
||||||
add_items.push_back (MenuElem (_("CD Track Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags(Location::IsMark |Location::IsCDMarker), 0)));
|
add_items.push_back (MenuElem (_("CD Track Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::add_location_mark_with_flag), where, Location::Flags(Location::IsMark |Location::IsCDMarker), 0)));
|
||||||
add_items.push_back (MenuElem ("Cue Marker..."));
|
add_items.push_back (MenuElem ("Cue Marker..."));
|
||||||
Gtk::MenuItem& cue_submenu = add_items.back();
|
Gtk::MenuItem& cue_submenu = add_items.back();
|
||||||
Gtk::Menu* cue_menu = new Gtk::Menu;
|
Gtk::Menu* cue_menu = new Gtk::Menu;
|
||||||
MenuList& cue_items = cue_menu->items();
|
MenuList& cue_items = cue_menu->items();
|
||||||
cue_items.push_back (MenuElem (_("Stop All Cues"), sigc::bind (sigc::mem_fun (*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, CueRecord::stop_all)));
|
cue_items.push_back (MenuElem (_("Stop All Cues"), sigc::bind (sigc::mem_fun (*this, &Editor::add_location_mark_with_flag), where, Location::IsCueMarker, CueRecord::stop_all)));
|
||||||
for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) {
|
for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) {
|
||||||
cue_items.push_back (MenuElem (string_compose (_("Cue %1"), cue_marker_name (n)), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, n)));
|
cue_items.push_back (MenuElem (string_compose (_("Cue %1"), cue_marker_name (n)), sigc::bind (sigc::mem_fun(*this, &Editor::add_location_mark_with_flag), where, Location::IsCueMarker, n)));
|
||||||
}
|
}
|
||||||
cue_submenu.set_submenu (*cue_menu);
|
cue_submenu.set_submenu (*cue_menu);
|
||||||
|
|
||||||
|
@ -1036,7 +1036,7 @@ LuaInstance::register_classes (lua_State* L, bool sandbox)
|
|||||||
|
|
||||||
.addRefFunction ("find_location_from_marker", &PublicEditor::find_location_from_marker)
|
.addRefFunction ("find_location_from_marker", &PublicEditor::find_location_from_marker)
|
||||||
.addFunction ("find_marker_from_location_id", &PublicEditor::find_marker_from_location_id)
|
.addFunction ("find_marker_from_location_id", &PublicEditor::find_marker_from_location_id)
|
||||||
.addFunction ("mouse_add_new_marker", &PublicEditor::mouse_add_new_marker)
|
.addFunction ("mouse_add_new_marker", &PublicEditor::add_location_mark)
|
||||||
#if 0
|
#if 0
|
||||||
.addFunction ("get_regions_at", &PublicEditor::get_regions_at)
|
.addFunction ("get_regions_at", &PublicEditor::get_regions_at)
|
||||||
.addFunction ("get_regions_after", &PublicEditor::get_regions_after)
|
.addFunction ("get_regions_after", &PublicEditor::get_regions_after)
|
||||||
|
@ -257,7 +257,10 @@ public:
|
|||||||
virtual void add_bbt_marker_at_playhead_cursor () = 0;
|
virtual void add_bbt_marker_at_playhead_cursor () = 0;
|
||||||
virtual void add_location_from_playhead_cursor () = 0;
|
virtual void add_location_from_playhead_cursor () = 0;
|
||||||
virtual void remove_location_at_playhead_cursor () = 0;
|
virtual void remove_location_at_playhead_cursor () = 0;
|
||||||
virtual void add_location_mark (Temporal::timepos_t const & where) = 0;
|
void add_location_mark (Temporal::timepos_t const & where, ARDOUR::Location::Flags flags = ARDOUR::Location::IsMark, int32_t cue_id = 0) {
|
||||||
|
add_location_mark_with_flag (where, flags, cue_id);
|
||||||
|
}
|
||||||
|
virtual void add_location_mark_with_flag (Temporal::timepos_t const & where, ARDOUR::Location::Flags, int32_t cue_id) = 0;
|
||||||
virtual void update_grid () = 0;
|
virtual void update_grid () = 0;
|
||||||
virtual void remove_tracks () = 0;
|
virtual void remove_tracks () = 0;
|
||||||
virtual void set_loop_range (Temporal::timepos_t const & start, Temporal::timepos_t const & end, std::string cmd) = 0;
|
virtual void set_loop_range (Temporal::timepos_t const & start, Temporal::timepos_t const & end, std::string cmd) = 0;
|
||||||
@ -391,7 +394,6 @@ public:
|
|||||||
virtual void toggle_meter_updating() = 0;
|
virtual void toggle_meter_updating() = 0;
|
||||||
virtual void split_regions_at (Temporal::timepos_t const &, RegionSelection&) = 0;
|
virtual void split_regions_at (Temporal::timepos_t const &, RegionSelection&) = 0;
|
||||||
virtual void split_region_at_points (std::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;
|
virtual void split_region_at_points (std::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;
|
||||||
virtual void mouse_add_new_marker (Temporal::timepos_t where, ARDOUR::Location::Flags extra_flags = ARDOUR::Location::Flags (0), int32_t cue_id = 0) = 0;
|
|
||||||
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
|
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
|
||||||
virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 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;
|
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