main.cpp,cawUi.cpp,cawUiDecl.h,css/caw.css,html/ui.cfg : Improved layout of var's in proc UI.

This commit is contained in:
kevin 2024-10-13 14:47:53 -04:00
parent 887858a4cf
commit d72e26caaf
6 changed files with 130 additions and 107 deletions

View File

@ -9,7 +9,7 @@
ex_00_rt_sine: {
//dur_limit_secs:5.0,
dur_limit_secs:5.0,
network: {

View File

@ -58,7 +58,7 @@ namespace caw {
rc_t _create_bool_widgets( ui_t* p, unsigned widgetListUuId, const flow::ui_var_t* ui_var, unsigned& uuid_ref )
{
rc_t rc = kOkRC;
if((rc = uiCreateCheck(p->ioH, uuid_ref, widgetListUuId, nullptr, kCheckWidgetId, kInvalidId, nullptr, ui_var->label )) != kOkRC )
if((rc = uiCreateCheck(p->ioH, uuid_ref, widgetListUuId, nullptr, kCheckWidgetId, kInvalidId, nullptr, nullptr )) != kOkRC )
{
rc = cwLogError(rc,"Check box widget create failed on '%s'.",cwStringNullGuard(ui_var->label));
}
@ -70,7 +70,7 @@ namespace caw {
{
rc_t rc;
if((rc = uiCreateNumb( p->ioH, uuid_ref, widgetListUuId, nullptr, appId, kInvalidId, nullptr, ui_var->label, min_val, max_val, step, dec_pl )) != kOkRC )
if((rc = uiCreateNumb( p->ioH, uuid_ref, widgetListUuId, nullptr, appId, kInvalidId, nullptr, nullptr, min_val, max_val, step, dec_pl )) != kOkRC )
{
rc = cwLogError(rc,"Integer widget create failed on '%s'.",cwStringNullGuard(ui_var->label));
goto errLabel;
@ -83,7 +83,7 @@ namespace caw {
rc_t _create_string_widgets( ui_t* p, unsigned widgetListUuId, const flow::ui_var_t* ui_var, unsigned& uuid_ref )
{
rc_t rc = kOkRC;
if((rc = uiCreateStr( p->ioH, uuid_ref, widgetListUuId, nullptr, kStringWidgetId, kInvalidId, nullptr, ui_var->label )) != kOkRC )
if((rc = uiCreateStr( p->ioH, uuid_ref, widgetListUuId, nullptr, kStringWidgetId, kInvalidId, nullptr, nullptr )) != kOkRC )
{
rc = cwLogError(rc,"String widget create failed on '%s'.",cwStringNullGuard(ui_var->label));
goto errLabel;
@ -93,6 +93,21 @@ namespace caw {
return rc;
}
rc_t _create_var_label( ui_t* p, unsigned parentListUuId, const flow::ui_var_t* ui_var, const char* label, unsigned var_idx )
{
rc_t rc;
unsigned uuId;
if((rc = uiCreateStrDisplay( p->ioH, uuId, parentListUuId, nullptr, kInvalidId, kInvalidId, nullptr, label )) != kOkRC )
{
rc = cwLogError(rc,"Label widget create failed on '%s'.",cwStringNullGuard(ui_var->label));
goto errLabel;
}
errLabel:
return rc;
}
rc_t _create_var_ui( ui_t* p, unsigned parentListUuId, const flow::ui_var_t* ui_var, unsigned var_idx )
{
@ -178,11 +193,19 @@ namespace caw {
}
if( widget_uuId != kInvalidId )
{
uiSetBlob(p->ioH,widget_uuId, &ui_var, sizeof(&ui_var));
// if this is a 'init' variable then disable it
if( ui_var->desc_flags & flow::kInitVarDescFl )
uiClearEnable(p->ioH, widget_uuId );
}
errLabel:
if(rc != kOkRC )
rc = cwLogError(rc,"Processor UI creation failed on %s:%i.",cwStringNullGuard(ui_var->label),ui_var->label_sfx_id);
rc = cwLogError(rc,"Variable UI creation failed on %s:%i.",cwStringNullGuard(ui_var->label),ui_var->label_sfx_id);
return rc;
@ -204,8 +227,11 @@ namespace caw {
{
rc_t rc = kOkRC;
unsigned procPanelUuId = kInvalidId;
unsigned chanPanelUuId = kInvalidId;
unsigned chanListUuId = kInvalidId;
unsigned chN = _calc_max_chan_count(ui_proc);
const unsigned label_buf_charN = 127;
char label_buf[ label_buf_charN+1 ];
if((rc = uiCreateFromRsrc( p->ioH, "proc", parentListUuId, proc_idx )) != kOkRC )
{
@ -213,58 +239,86 @@ namespace caw {
}
procPanelUuId = uiFindElementUuId( p->ioH, parentListUuId, kProcPanelId, proc_idx );
chanListUuId = uiFindElementUuId( p->ioH, procPanelUuId, kChanListId, kInvalidId );
chanPanelUuId = uiFindElementUuId( p->ioH, procPanelUuId, kChanPanelId, kInvalidId );
chanListUuId = uiFindElementUuId( p->ioH, chanPanelUuId, kChanListId, kInvalidId );
//printf("proc_idx: %i %i %i : chN:%i\n",proc_idx, parentListUuId, procPanelUuId,chN);
uiSendValue( p->ioH, uiFindElementUuId(p->ioH, procPanelUuId, kProcInstLabelId, kInvalidId), ui_proc->label );
uiSendValue( p->ioH, uiFindElementUuId(p->ioH, procPanelUuId, kProcInstSfxId, kInvalidId), ui_proc->label_sfx_id );
snprintf(label_buf,label_buf_charN,"%s:%i",ui_proc->label,ui_proc->label_sfx_id);
uiSendValue( p->ioH, uiFindElementUuId(p->ioH, procPanelUuId, kProcInstLabelId, kInvalidId), label_buf );
// for each channel
for(unsigned ui_ch_idx=0; ui_ch_idx<chN; ++ui_ch_idx)
// for each channel (add one to the channel count to account for the leading 'label' column)
for(unsigned ui_ch_idx=0; ui_ch_idx<chN+1; ++ui_ch_idx)
{
unsigned chanPanelUuId = kInvalidId;
unsigned varListUuId = kInvalidIdx;
// create a chan. panel
// add a varList to the chanList
if((rc = uiCreateFromRsrc( p->ioH, "chan", chanListUuId, ui_ch_idx )) != kOkRC )
{
goto errLabel;
}
chanPanelUuId = uiFindElementUuId(p->ioH, chanListUuId, kChanPanelId, ui_ch_idx);
varListUuId = uiFindElementUuId(p->ioH, chanPanelUuId, kVarListId, kInvalidIdx );
varListUuId = uiFindElementUuId(p->ioH, chanListUuId, kVarListId, ui_ch_idx );
// for each var
for(unsigned j=0; j<ui_proc->varN; ++j)
{
const flow::ui_var_t* ui_var = ui_proc->varA + j;
// only create controls for certain value types
if( !(ui_var->value_tid & (flow::kBoolTFl | flow::kIntTFl | flow::kUIntTFl | flow::kFloatTFl | flow::kDoubleTFl | flow::kStringTFl )))
continue;
// if this variable has no channelized duplicates and this is the 'any' ch. var
if( ui_var->ch_idx == flow::kAnyChIdx && ui_var->ch_cnt==flow::kAnyChIdx && ui_ch_idx==0 )
if( ui_ch_idx == 0 )
{
if( ui_var->ch_idx == flow::kAnyChIdx )
{
snprintf(label_buf,label_buf_charN,"%s:%i",ui_var->label,ui_var->label_sfx_id);
if((rc = _create_var_label(p,varListUuId, ui_var, label_buf, j)) != kOkRC )
{
goto errLabel;
}
}
}
else
{
// if this is a channelized variable and ui_ch_idx is the var's channel
if( ui_var->ch_idx != flow::kAnyChIdx && ui_var->ch_idx == ui_ch_idx )
// subtract one from ui_ch_idx to account for the leading label column with is associated with ui_ch_idx==0
unsigned uiChIdx = ui_ch_idx - 1;
bool create_fl = false;
// if this is the 'any' ch. var
if( ui_var->ch_idx == flow::kAnyChIdx )
{
}
else
// if this 'any' ch. var has no other channels
if( ui_var->ch_cnt == 0 )
{
//printf("proc_idx:%i %s : %i %i\n",proc_idx,ui_var->label,ui_var->ch_idx,ui_var->ch_cnt);
ui_var = nullptr; // insert a blank var panel
}
create_fl = true; // always create a control or a blank var
// if the current ch. == 0 then create then control ...
if( ui_var->ch_cnt==0 && uiChIdx!=0 )
ui_var = nullptr; // ... otherwise create a blank
}
}
else // otherwise create the var if it is on chan 'uiChIdx'
{
create_fl = ui_var->ch_idx == uiChIdx;
}
if( create_fl )
{
if((rc = _create_var_ui(p, varListUuId, ui_var, j)) != kOkRC )
{
goto errLabel;
}
}
}
}
}
errLabel:
if(rc != kOkRC )
@ -335,8 +389,12 @@ cw::rc_t caw::ui::create( handle_t& hRef,
rc = cwLogError(rc,"UI create failed.");
goto errLabel;
}
hRef.set(p);
}
errLabel:
return rc;
}

View File

@ -23,7 +23,6 @@ namespace caw {
kProcPanelId,
kProcInstLabelId,
kProcInstSfxId,
kChanListId,
kChanPanelId,

View File

@ -13,68 +13,30 @@
.chanPanel {
border: 1px solid Yellow;
/*height: 100px;*/
overflow-x: hidden; /* 'hidden' to remove horz scroll bar */
overflow-y: auto;
}
.chanList {
display: flex;
flex-direction: row;
}
.varList {
display: flex;
flex-direction: column;
overflow-y: hidden;
}
.varPanel {
border: 1px solid Green;
height: 20px;
}
.fragList {
border: 1px solid LightSteelBlue;
width: 1000px;
height: 450px;
}
.fragList label {
width: 50px;
background-color: LightBlue;
}
.fragList .uiNumbDisp {
width: 25px;
}
.fragPanel {
border: 1px solid LightSteelBlue;
padding-bottom: 5px;
padding-top: 5px;
}
.fragPanelRow {
padding-right: 15px;
padding-left: 15px;
justify-content: space-around;
}
.fragPresetCtl {
width: 50px;
}
.fragPresetCtl:nth-of-type(even){
border: 1px solid Yellow;
}
.fragPresetCtl .uiNumber {
border: 1px solid LightSteelBlue;
width: 80%;
}
.fragPresetCtl .uiString {
border: 1px solid LightSteelBlue;
width: 80%;
}
.fragNote {
width: 575px;
}
.uiRow {
padding-bottom: 5px;
padding-top: 5px;
}
.velTunerPanel {
border: 1px solid black;
}

View File

@ -50,21 +50,23 @@
col: {
str_disp: { name: procInstLabel, value:"" },
numb_disp: { name:procInstSfxId, value:0 },
hlist: { name: chanListId, addClassName: chanList }
}
}
}
chan: {
panel: {
name: chanPanelId,
addClassName: chanPanel,
vlist: { name: varListId, addClassName: varList }
panel: { name: chanListId, addClassName: chanList }
}
}
}
}
chan: {
panel: { name: varListId, addClassName: varList }
}
var: {
@ -72,7 +74,7 @@
name: varPanelId,
addClassName: varPanel,
hlist: { name: widgetListId, addClassName: widgetList }
panel: { name: widgetListId, addClassName: widgetList }
}
}

View File

@ -82,12 +82,11 @@ ui::appIdMap_t appIdMapA[] = {
{ kProcListId, kProcPanelId, "procPanelId" },
{ kProcPanelId, kProcInstLabelId, "procInstLabel" },
{ kProcPanelId, kProcInstSfxId, "procInstSfxId" },
{ kProcPanelId, kChanListId, "chanListId" },
{ kProcPanelId, kChanPanelId, "chanPanelId" },
{ kChanPanelId, kChanListId, "chanListId" },
{ kChanListId, kChanPanelId, "chanPanelId" },
{ kChanPanelId, kVarListId, "varListId" },
{ kChanListId, kVarListId, "varListId" },
{ kVarListId, kVarPanelId, "varPanelId" },
{ kVarPanelId, kWidgetListId, "widgetListId" },
@ -810,6 +809,9 @@ errLabel:
if((rc = destroy(app.ioH)) != kOkRC )
rc = cwLogError(rc,"IO destroy failed.");
if((rc = destroy(app.uiH)) != kOkRC )
rc = cwLogError(rc,"UI destroy failed.");
if( app.io_cfg != nullptr )
app.io_cfg->free();