cwPresetSel.cpp : Prevent track_loc() from going backwards to a previous 'loc'.

This commit is contained in:
kevin 2022-10-15 09:24:53 -04:00
parent 84a3c3ceff
commit 137e0994d3
2 changed files with 7 additions and 2 deletions

View File

@ -910,8 +910,12 @@ bool cw::preset_sel::track_loc( handle_t h, unsigned loc, const cw::preset_sel::
// if 'f' is valid but different from 'last_ts_frag' // if 'f' is valid but different from 'last_ts_frag'
if( f != nullptr && f != p->last_ts_frag ) if( f != nullptr && f != p->last_ts_frag )
{ {
p->last_ts_frag = f; // don't allow the selected fragment to go backwards
frag_changed_fl = true; if( p->last_ts_frag == nullptr || (p->last_ts_frag != nullptr && p->last_ts_frag->endLoc < f->endLoc) )
{
p->last_ts_frag = f;
frag_changed_fl = true;
}
} }
frag_Ref = p->last_ts_frag; frag_Ref = p->last_ts_frag;

View File

@ -115,6 +115,7 @@ namespace cw
void track_timestamp_reset( handle_t h ); void track_timestamp_reset( handle_t h );
bool track_timestamp( handle_t h, const time::spec_t& ts, const cw::preset_sel::frag_t*& frag_Ref ); bool track_timestamp( handle_t h, const time::spec_t& ts, const cw::preset_sel::frag_t*& frag_Ref );
// Same as track_timestamp_???() but tracks the score 'loc' instead of timestamp.
void track_loc_reset( handle_t h ); void track_loc_reset( handle_t h );
bool track_loc( handle_t h, unsigned loc, const cw::preset_sel::frag_t*& frag_Ref ); bool track_loc( handle_t h, unsigned loc, const cw::preset_sel::frag_t*& frag_Ref );