cwPresetSel.h : Updated comments. Fixed bug in delete_fragment().

This commit is contained in:
kevin 2022-01-22 09:43:52 -05:00
parent f57ac5ef3e
commit 8e1f7af04c
2 changed files with 16 additions and 15 deletions

View File

@ -637,29 +637,27 @@ cw::rc_t cw::preset_sel::create_fragment( handle_t h, unsigned end_loc, time::sp
cw::rc_t cw::preset_sel::delete_fragment( handle_t h, unsigned fragId )
{
preset_sel_t* p = _handleToPtr(h);
frag_t* f0 = nullptr;
frag_t* f1 = p->fragL;
frag_t* f = p->fragL;
for(; f1!=nullptr; f1=f1->link)
{
if( f1->fragId == fragId )
for(; f!=nullptr; f=f->link)
if( f->fragId == fragId )
{
if( f0 == nullptr )
p->fragL = f1->link;
if( f->prev == nullptr )
p->fragL = f->link;
else
f0->link = f1->link;
f->prev->link = f->link;
if( f->link != nullptr )
f->link->prev = f->prev;
// release the fragment
mem::release(f1->presetA);
mem::release(f1);
mem::release(f->presetA);
mem::release(f);
return kOkRC;
}
f0 = f1;
}
return kOkRC;
return cwLogError(kInvalidArgRC,"The fragment '%i' could not be found to delete.",fragId);
}
bool cw::preset_sel::is_fragment_loc( handle_t h, unsigned loc )

View File

@ -84,8 +84,11 @@ namespace cw
rc_t delete_fragment( handle_t h, unsigned fragId );
bool is_fragment_loc( handle_t h, unsigned loc );
// Return the fragment id of the 'selected' fragment.
unsigned ui_select_fragment_id( handle_t h );
// Set the 'select_flag' on this fragment and remove it from all others.
void ui_select_fragment( handle_t h, unsigned fragId, bool selectFl );