kcApp.h/cpp : Added Two-D UI related code.

This commit is contained in:
Kevin Larke 2015-04-09 14:21:25 -07:00
parent 15ed5d63f0
commit dd2f5f4315
2 changed files with 109 additions and 1 deletions

View File

@ -62,6 +62,7 @@
#include "cmGrFltk.h"
#include "gvHashFunc.h"
#include "cmGrTksbFltk.h"
#include "cmGr2dFltk.h"
#define TIMER_PERIOD (1.0/20.0) // 50ms
@ -1395,6 +1396,55 @@ void kcApp::_setTksrValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp
}
}
void kcApp::_createTwod( const cmDspUiHdr_t* m )
{
int x,y,w=0,h=0;
page_t* pg = _createPage("2-D");
ctl_t* cp = _createCtl(m, kTwodTypeId, x,y,w,h, true );
w = pg->grp->w();
h = pg->grp->h();
// currently we only support one Take sequence builder control because
// we have not yet implmenented a method of providing
// timer callbacks to a list of UI controls
if( _tlCtl != NULL )
cp->u.twod.tlctl = _tlCtl;
else
{
_tlCtl = new tlCtl(_ctx,this,_menu,this);
cp->u.twod.tlctl = _tlCtl;
}
Fl_Widget* wdgt = cp->u.twod.tlctl->init2dCtlr(x,y,w,h);
_insertNewCtl(cp,m,wdgt,cp->u.twod.varIdArray,kTwodVarCnt);
}
void kcApp::_setTwodValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp )
{
unsigned i;
for(i=0; i<kTwodVarCnt; ++i)
if( cp->u.twod.varIdArray[i] == instVarId )
{
switch(i)
{
case kTwodXArgIdx:
case kTwodYArgIdx:
case kTwodAngleArgIdx:
case kTwodRadiusArgIdx:
break;
default:
{ assert(0); }
}
}
}
void kcApp::_newColumn( const cmDspUiHdr_t* m )
{
@ -1809,6 +1859,10 @@ void kcApp::_onRecvValue( const cmDspUiHdr_t* m )
_setTksrValue(cp, m->instVarId, &m->value);
break;
case kTwodTypeId:
_setTwodValue(cp, m->instVarId, &m->value);
break;
default:
assert(0);
}
@ -1874,6 +1928,10 @@ void kcApp::_handleUiMsg( const cmDspUiHdr_t* m )
_createTksr(m);
break;
case kTwodDuiId:
_createTwod(m);
break;
case kValueDuiId:
_onRecvValue(m);
break;
@ -2301,6 +2359,40 @@ void kcApp::_ctl_cb(ctl_t* cp)
case kTksrTypeId:
{
}
break;
case kTwodTypeId:
{
cmGr2dFltk* twodCtl = dynamic_cast<cmGr2dFltk*>(cp->wdgtPtr);
unsigned i;
for(i=0; i<kTwodVarCnt; ++i)
{
switch( i )
{
case kTwodXArgIdx:
cmDsvSetDouble(&value,twodCtl->x());
break;
case kTwodYArgIdx:
cmDsvSetDouble(&value,twodCtl->y());
break;
case kTwodAngleArgIdx:
cmDsvSetDouble(&value,twodCtl->angle());
break;
case kTwodRadiusArgIdx:
cmDsvSetDouble(&value,twodCtl->radius());
break;
}
cmAdIfSendMsgToAudioDSP(_aiH,cp->asSubIdx,kUiSelAsId,kValueDuiId,0,cp->instId,cp->u.twod.varIdArray[i],&value);
}
instVarId = cmInvalidId;
}
break;

View File

@ -79,6 +79,7 @@ private:
kScorTypeId,
kTksbTypeId,
kTksrTypeId,
kTwodTypeId,
kSldrMinArgIdx = 0,
kSldrMaxArgIdx = 1,
@ -146,7 +147,13 @@ private:
kTksrPtrArgIdx = 0,
kTksrRefreshArgIdx = 1,
kTksrSelArgIdx = 2,
kTksrVarCnt = 3
kTksrVarCnt = 3,
kTwodXArgIdx = 0,
kTwodYArgIdx = 1,
kTwodRadiusArgIdx = 2,
kTwodAngleArgIdx = 3,
kTwodVarCnt = 4
};
@ -264,6 +271,12 @@ private:
unsigned varIdArray[ kTksrVarCnt ];
} tksr_t;
typedef struct twod_str
{
tlCtl* tlctl;
unsigned varIdArray[ kTwodVarCnt ];
} twod_t;
typedef struct ctl_str
{
@ -287,6 +300,7 @@ private:
scor_t scor;
tksb_t tksb;
tksr_t tksr;
twod_t twod;
} u;
struct ctl_str* linkPtr;
} ctl_t;
@ -385,6 +399,8 @@ private:
void _setTksbValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
void _createTksr( const cmDspUiHdr_t* m );
void _setTksrValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
void _createTwod( const cmDspUiHdr_t* m );
void _setTwodValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
void _newColumn( const cmDspUiHdr_t* m );