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
@ -73,7 +73,7 @@ public:
|
||||
|
||||
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 (const Location& other);
|
||||
Location (Location const& other, bool no_signal);
|
||||
Location (Session &, const XMLNode&);
|
||||
Location* operator= (const Location& other);
|
||||
|
||||
@ -207,6 +207,7 @@ protected:
|
||||
void resume_signals ();
|
||||
|
||||
private:
|
||||
Location (Location const&); // no copy c'tor
|
||||
void set_mark (bool yn);
|
||||
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());
|
||||
}
|
||||
|
||||
Location::Location (const Location& other)
|
||||
Location::Location (const Location& other, bool no_emit)
|
||||
: SessionHandleRef (other._session)
|
||||
, _name (other._name)
|
||||
, _start (other._start)
|
||||
@ -101,8 +101,13 @@ Location::Location (const Location& other)
|
||||
, _cue (other._cue)
|
||||
, _signals_suspended (0)
|
||||
{
|
||||
/* copy is not locked even if original was */
|
||||
assert (other._signals_suspended == 0);
|
||||
if (no_emit) {
|
||||
/* 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;
|
||||
|
||||
@ -1934,7 +1939,7 @@ Locations::cut_copy_section (timepos_t const& start, timepos_t const& end, timep
|
||||
|
||||
} else if (op == CopyPasteSection) {
|
||||
if (i->start() >= start && i->start() < end) {
|
||||
Location* copy = new Location (*i);
|
||||
Location* copy = new Location (*i, false);
|
||||
pastebuf.push_back (copy);
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ LocationImporter::_prepare_move ()
|
||||
{
|
||||
try {
|
||||
Location const original (session, xml_location);
|
||||
location = new Location (original); // Updates id
|
||||
location = new Location (original, false); // Updates id
|
||||
} catch (failed_constructor& err) {
|
||||
throw std::runtime_error (X_("Error in session file!"));
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user