From dd2f5f4315319d623339f7e9424daa7f0ec430d7 Mon Sep 17 00:00:00 2001 From: Kevin Larke Date: Thu, 9 Apr 2015 14:21:25 -0700 Subject: [PATCH] kcApp.h/cpp : Added Two-D UI related code. --- src/kc/kcApp.cpp | 92 ++++++++++++++++++++++++++++++++++++++++++++++++ src/kc/kcApp.h | 18 +++++++++- 2 files changed, 109 insertions(+), 1 deletion(-) diff --git a/src/kc/kcApp.cpp b/src/kc/kcApp.cpp index e1ad79e..e20ea9e 100644 --- a/src/kc/kcApp.cpp +++ b/src/kc/kcApp.cpp @@ -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; iu.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(cp->wdgtPtr); + + unsigned i; + for(i=0; ix()); + 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; diff --git a/src/kc/kcApp.h b/src/kc/kcApp.h index 8bd029c..3f170ca 100644 --- a/src/kc/kcApp.h +++ b/src/kc/kcApp.h @@ -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 );