cwIoPresetSelApp.cpp,ui.cfg : Added 'Goto' button to scroll to a fragment.

This commit is contained in:
kevin 2024-05-11 12:11:30 -04:00
parent 145ab83a06
commit 9214b9b9d9
2 changed files with 30 additions and 0 deletions

View File

@ -57,6 +57,7 @@ namespace cw
kStartBtnId, kStartBtnId,
kStopBtnId, kStopBtnId,
kGotoBtnId,
kBegPlayLocNumbId, kBegPlayLocNumbId,
kEndPlayLocNumbId, kEndPlayLocNumbId,
kLockLoctnCheckId, kLockLoctnCheckId,
@ -168,6 +169,8 @@ namespace cw
{ kPanelDivId, kStartBtnId, "startBtnId" }, { kPanelDivId, kStartBtnId, "startBtnId" },
{ kPanelDivId, kStopBtnId, "stopBtnId" }, { kPanelDivId, kStopBtnId, "stopBtnId" },
{ kPanelDivId, kGotoBtnId, "gotoBtnId" },
{ kPanelDivId, kBegPlayLocNumbId, "begLocNumbId" }, { kPanelDivId, kBegPlayLocNumbId, "begLocNumbId" },
{ kPanelDivId, kEndPlayLocNumbId, "endLocNumbId" }, { kPanelDivId, kEndPlayLocNumbId, "endLocNumbId" },
{ kPanelDivId, kLockLoctnCheckId, "locLoctnCheckId" }, { kPanelDivId, kLockLoctnCheckId, "locLoctnCheckId" },
@ -1406,6 +1409,27 @@ namespace cw
return rc; return rc;
} }
rc_t _do_goto( app_t* app, unsigned loc )
{
rc_t rc = kOkRC;
unsigned fragGuiId;
if((fragGuiId = loc_to_gui_id(app->psH,loc)) == kInvalidId )
{
rc = cwLogError(kInvalidArgRC,"The fragment loc '%i' could not be found.");
goto errLabel;
}
if((rc = io::uiSetScrollTop(app->ioH,fragGuiId)) != kOkRC )
{
rc = cwLogError(rc,"Scroll to top failed on fragment GUI id:%i.",fragGuiId);
goto errLabel;
}
errLabel:
return rc;
}
// This function is used to apply the selected (checked) preset immediately. // This function is used to apply the selected (checked) preset immediately.
rc_t _apply_current_preset( app_t* app, unsigned fragId ) rc_t _apply_current_preset( app_t* app, unsigned fragId )
{ {
@ -2276,6 +2300,7 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
// A performance is loaded so enable the UI // A performance is loaded so enable the UI
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kStartBtnId ), true ); io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kStartBtnId ), true );
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kStopBtnId ), true ); io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kStopBtnId ), true );
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kGotoBtnId ), true );
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kLockLoctnCheckId ), true ); io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kLockLoctnCheckId ), true );
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kLiveCheckId ), true ); io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kLiveCheckId ), true );
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kEnaRecordCheckId ), true ); io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kEnaRecordCheckId ), true );
@ -3128,6 +3153,10 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
case kStopBtnId: case kStopBtnId:
_do_stop_play(app); _do_stop_play(app);
break; break;
case kGotoBtnId:
_do_goto(app, app->beg_play_loc);
break;
case kBegPlayLocNumbId: case kBegPlayLocNumbId:
_on_ui_play_loc(app, m.appId, m.value->u.i); _on_ui_play_loc(app, m.appId, m.value->u.i);

View File

@ -41,6 +41,7 @@
row: { row: {
button:{ name: startBtnId, title:"Start", enable: false }, button:{ name: startBtnId, title:"Start", enable: false },
button:{ name: stopBtnId, title:"Stop", enable: false }, button:{ name: stopBtnId, title:"Stop", enable: false },
button:{ name: gotoBtnId, title:"Goto", enable: false },
number:{ name: begLocNumbId, title:"Loc:", min:0, max:100000, step:1, decpl:0, enable: false }, number:{ name: begLocNumbId, title:"Loc:", min:0, max:100000, step:1, decpl:0, enable: false },
number:{ name: endLocNumbId, title:"End:", min:0, max:100000, step:1, decpl:0, enable: false }, number:{ name: endLocNumbId, title:"End:", min:0, max:100000, step:1, decpl:0, enable: false },
check: { name: locLoctnCheckId, title:"Lock loc:", enable: false }, check: { name: locLoctnCheckId, title:"Lock loc:", enable: false },