cwUi.cpp,cwUiDecl.cpp,ui.cfg,main.cpp : Added log GUI interface.
This commit is contained in:
parent
0347a58d48
commit
1d0b583474
@ -151,8 +151,6 @@ namespace caw {
|
||||
{
|
||||
rc_t rc = kOkRC;
|
||||
unsigned value_type_flag = ui_var->value_tid & flow::kTypeMask;
|
||||
const object_t* cfg = nullptr;
|
||||
const object_t* ui_cfg = nullptr;
|
||||
const char* widget_type_label = nullptr;
|
||||
|
||||
idLabelPair_t typeA[] = {
|
||||
@ -173,15 +171,19 @@ namespace caw {
|
||||
case flow::kStringTFl: widget_type_id_ref = kStringWidgetId; break;
|
||||
}
|
||||
|
||||
/*
|
||||
if( ui_var->ui_cfg == nullptr )
|
||||
{
|
||||
rc = cwLogError(rc,"Error locating 'var' '%s' on proc desc.",cwStringNullGuard(ui_var->label));
|
||||
goto errLabel;
|
||||
}
|
||||
else
|
||||
*/
|
||||
|
||||
if( ui_var->ui_cfg != nullptr )
|
||||
{
|
||||
// get the type of this 'ui' widget
|
||||
if((rc = ui_cfg->getv("type",widget_type_label)) != kOkRC )
|
||||
if((rc = ui_var->ui_cfg->getv("type",widget_type_label)) != kOkRC )
|
||||
{
|
||||
rc = cwLogError(rc,"Error parsing variable 'ui' type cfg.");
|
||||
goto errLabel;
|
||||
|
@ -18,6 +18,8 @@ namespace caw {
|
||||
kPgmLoadBtnId,
|
||||
kPgmPrintBtnId,
|
||||
kRunCheckId,
|
||||
|
||||
kLogId,
|
||||
|
||||
kRootNetPanelId,
|
||||
kNetListId,
|
||||
|
@ -27,6 +27,10 @@
|
||||
name: rootNetPanelId,
|
||||
vlist: { name: netListId, addClassName: netList }
|
||||
}
|
||||
},
|
||||
|
||||
row: {
|
||||
log: { name: logId, title:"Log" }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ ui::appIdMap_t appIdMapA[] = {
|
||||
{ kPanelDivId, kPgmPrintBtnId, "pgmPrintBtnId" },
|
||||
{ kPanelDivId, kRunCheckId, "runCheckId" },
|
||||
|
||||
{ kPanelDivId, kLogId, "logId" },
|
||||
|
||||
{ kPanelDivId, kRootNetPanelId, "rootNetPanelId" },
|
||||
{ kRootNetPanelId, kNetListId, "netListId" },
|
||||
|
||||
@ -418,6 +420,10 @@ rc_t _ui_value_callback(app_t* app, const io::ui_msg_t& m )
|
||||
_on_pgm_run(app,m.value->u.b);
|
||||
break;
|
||||
|
||||
case kLogId:
|
||||
|
||||
break;
|
||||
|
||||
case kButtonWidgetId:
|
||||
_on_variable_value(app,m,m.value->u.b);
|
||||
break;
|
||||
@ -767,6 +773,24 @@ void _test_stub( app_t& app )
|
||||
|
||||
}
|
||||
|
||||
void _log_output_func( void* arg, unsigned level, const char* text )
|
||||
{
|
||||
app_t* app = (app_t*)arg;
|
||||
|
||||
if( app->ioH.isValid() && is_started_flag(app->ioH) )
|
||||
{
|
||||
|
||||
unsigned logUuId = uiFindElementUuId( app->ioH, kLogId);
|
||||
|
||||
uiSetLogLine( app->ioH, logUuId, text );
|
||||
}
|
||||
else
|
||||
{
|
||||
log::defaultOutput(nullptr,level,text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
rc_t rc = kOkRC;
|
||||
@ -774,7 +798,7 @@ int main( int argc, char* argv[] )
|
||||
app_t app = {}; // all zero
|
||||
app.pgm_preset_idx = kInvalidIdx;
|
||||
|
||||
cw::log::createGlobal();
|
||||
cw::log::createGlobal(log::kPrint_LogLevel,_log_output_func,&app);
|
||||
|
||||
unsigned appIdMapN = sizeof(appIdMapA)/sizeof(appIdMapA[0]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user