mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
Add explicit API to copy Locations
This is in preparation to reduce signals during Location Drag motion (which operates on a copied Location, that causes [static] signal emissions, but the location itself is not in any list).
This commit is contained in:
parent
7b1997ffda
commit
153c7e289d
3 changed files with 12 additions and 6 deletions
|
|
@ -73,7 +73,7 @@ public:
|
||||||
|
|
||||||
Location (Session &);
|
Location (Session &);
|
||||||
Location (Session &, Temporal::timepos_t const &, Temporal::timepos_t const &, const std::string &, Flags bits = Flags(0), int32_t cue_id = 0);
|
Location (Session &, Temporal::timepos_t const &, Temporal::timepos_t const &, const std::string &, Flags bits = Flags(0), int32_t cue_id = 0);
|
||||||
Location (const Location& other);
|
Location (Location const& other, bool no_signal);
|
||||||
Location (Session &, const XMLNode&);
|
Location (Session &, const XMLNode&);
|
||||||
Location* operator= (const Location& other);
|
Location* operator= (const Location& other);
|
||||||
|
|
||||||
|
|
@ -207,6 +207,7 @@ protected:
|
||||||
void resume_signals ();
|
void resume_signals ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Location (Location const&); // no copy c'tor
|
||||||
void set_mark (bool yn);
|
void set_mark (bool yn);
|
||||||
bool set_flag_internal (bool yn, Flags flag);
|
bool set_flag_internal (bool yn, Flags flag);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ Location::Location (Session& s, timepos_t const & start, timepos_t const & end,
|
||||||
set_position_time_domain (_session.time_domain());
|
set_position_time_domain (_session.time_domain());
|
||||||
}
|
}
|
||||||
|
|
||||||
Location::Location (const Location& other)
|
Location::Location (const Location& other, bool no_emit)
|
||||||
: SessionHandleRef (other._session)
|
: SessionHandleRef (other._session)
|
||||||
, _name (other._name)
|
, _name (other._name)
|
||||||
, _start (other._start)
|
, _start (other._start)
|
||||||
|
|
@ -101,8 +101,13 @@ Location::Location (const Location& other)
|
||||||
, _cue (other._cue)
|
, _cue (other._cue)
|
||||||
, _signals_suspended (0)
|
, _signals_suspended (0)
|
||||||
{
|
{
|
||||||
/* copy is not locked even if original was */
|
if (no_emit) {
|
||||||
assert (other._signals_suspended == 0);
|
/* use for temp. copies (e.g. during Drag) */
|
||||||
|
suspend_signals ();
|
||||||
|
} else {
|
||||||
|
/* copy is not locked even if original was */
|
||||||
|
assert (other._signals_suspended == 0);
|
||||||
|
}
|
||||||
|
|
||||||
_locked = false;
|
_locked = false;
|
||||||
|
|
||||||
|
|
@ -1934,7 +1939,7 @@ Locations::cut_copy_section (timepos_t const& start, timepos_t const& end, timep
|
||||||
|
|
||||||
} else if (op == CopyPasteSection) {
|
} else if (op == CopyPasteSection) {
|
||||||
if (i->start() >= start && i->start() < end) {
|
if (i->start() >= start && i->start() < end) {
|
||||||
Location* copy = new Location (*i);
|
Location* copy = new Location (*i, false);
|
||||||
pastebuf.push_back (copy);
|
pastebuf.push_back (copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ LocationImporter::_prepare_move ()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Location const original (session, xml_location);
|
Location const original (session, xml_location);
|
||||||
location = new Location (original); // Updates id
|
location = new Location (original, false); // Updates id
|
||||||
} catch (failed_constructor& err) {
|
} catch (failed_constructor& err) {
|
||||||
throw std::runtime_error (X_("Error in session file!"));
|
throw std::runtime_error (X_("Error in session file!"));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue