Browse Source

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

master
Kevin Larke 9 years ago
parent
commit
dd2f5f4315
2 changed files with 109 additions and 1 deletions
  1. 92
    0
      src/kc/kcApp.cpp
  2. 17
    1
      src/kc/kcApp.h

+ 92
- 0
src/kc/kcApp.cpp View File

@@ -62,6 +62,7 @@
62 62
 #include "cmGrFltk.h"
63 63
 #include "gvHashFunc.h"
64 64
 #include "cmGrTksbFltk.h"
65
+#include "cmGr2dFltk.h"
65 66
 
66 67
 
67 68
 #define TIMER_PERIOD (1.0/20.0)   // 50ms
@@ -1395,6 +1396,55 @@ void kcApp::_setTksrValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp
1395 1396
     }
1396 1397
 }
1397 1398
 
1399
+void kcApp::_createTwod(  const cmDspUiHdr_t* m )
1400
+{
1401
+  int x,y,w=0,h=0;
1402
+
1403
+  page_t* pg = _createPage("2-D");
1404
+
1405
+  ctl_t*  cp = _createCtl(m, kTwodTypeId, x,y,w,h, true );
1406
+
1407
+  w = pg->grp->w();
1408
+  h = pg->grp->h();
1409
+
1410
+  // currently we only support one Take sequence builder control because
1411
+  // we have not yet implmenented a method of providing
1412
+  // timer callbacks to a list of UI controls
1413
+  if( _tlCtl != NULL )
1414
+    cp->u.twod.tlctl = _tlCtl;
1415
+  else
1416
+  {
1417
+    _tlCtl = new tlCtl(_ctx,this,_menu,this);
1418
+
1419
+    cp->u.twod.tlctl  = _tlCtl; 
1420
+  }
1421
+
1422
+  Fl_Widget* wdgt = cp->u.twod.tlctl->init2dCtlr(x,y,w,h);
1423
+
1424
+  _insertNewCtl(cp,m,wdgt,cp->u.twod.varIdArray,kTwodVarCnt);
1425
+
1426
+}
1427
+
1428
+void kcApp::_setTwodValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp )
1429
+{
1430
+  unsigned i;
1431
+
1432
+  for(i=0; i<kTwodVarCnt; ++i)
1433
+    if( cp->u.twod.varIdArray[i] == instVarId )
1434
+    {
1435
+      switch(i)
1436
+      {
1437
+        case kTwodXArgIdx:
1438
+        case kTwodYArgIdx:
1439
+        case kTwodAngleArgIdx:
1440
+        case kTwodRadiusArgIdx:
1441
+          break;
1442
+
1443
+        default:
1444
+          { assert(0); }
1445
+      }
1446
+    }
1447
+}
1398 1448
 
1399 1449
 void kcApp::_newColumn( const cmDspUiHdr_t* m )
1400 1450
 {
@@ -1809,6 +1859,10 @@ void kcApp::_onRecvValue( const cmDspUiHdr_t* m )
1809 1859
       _setTksrValue(cp, m->instVarId, &m->value);
1810 1860
       break;
1811 1861
 
1862
+    case kTwodTypeId:
1863
+      _setTwodValue(cp, m->instVarId, &m->value);
1864
+      break;
1865
+
1812 1866
     default:
1813 1867
       assert(0);
1814 1868
   }
@@ -1874,6 +1928,10 @@ void kcApp::_handleUiMsg( const cmDspUiHdr_t* m )
1874 1928
       _createTksr(m);
1875 1929
       break;
1876 1930
 
1931
+    case kTwodDuiId:
1932
+      _createTwod(m);
1933
+      break;
1934
+
1877 1935
     case kValueDuiId:
1878 1936
       _onRecvValue(m);
1879 1937
       break;
@@ -2301,6 +2359,40 @@ void kcApp::_ctl_cb(ctl_t* cp)
2301 2359
 
2302 2360
     case kTksrTypeId:
2303 2361
       {
2362
+        
2363
+      }
2364
+      break;
2365
+
2366
+    case kTwodTypeId:
2367
+      {
2368
+        cmGr2dFltk* twodCtl = dynamic_cast<cmGr2dFltk*>(cp->wdgtPtr);
2369
+
2370
+        unsigned i;
2371
+        for(i=0; i<kTwodVarCnt; ++i)
2372
+        {
2373
+          switch( i )
2374
+          {
2375
+            case kTwodXArgIdx:
2376
+              cmDsvSetDouble(&value,twodCtl->x());
2377
+              break;
2378
+
2379
+            case kTwodYArgIdx:
2380
+              cmDsvSetDouble(&value,twodCtl->y());
2381
+              break;
2382
+
2383
+            case kTwodAngleArgIdx:
2384
+              cmDsvSetDouble(&value,twodCtl->angle());
2385
+              break;
2386
+
2387
+            case kTwodRadiusArgIdx:
2388
+              cmDsvSetDouble(&value,twodCtl->radius());
2389
+              break;
2390
+          }
2391
+
2392
+          cmAdIfSendMsgToAudioDSP(_aiH,cp->asSubIdx,kUiSelAsId,kValueDuiId,0,cp->instId,cp->u.twod.varIdArray[i],&value);
2393
+        }
2394
+
2395
+        instVarId = cmInvalidId;
2304 2396
       }
2305 2397
       break;
2306 2398
       

+ 17
- 1
src/kc/kcApp.h View File

@@ -79,6 +79,7 @@ private:
79 79
     kScorTypeId,
80 80
     kTksbTypeId,
81 81
     kTksrTypeId,
82
+    kTwodTypeId,
82 83
 
83 84
     kSldrMinArgIdx = 0,
84 85
     kSldrMaxArgIdx = 1,
@@ -146,7 +147,13 @@ private:
146 147
     kTksrPtrArgIdx     = 0,
147 148
     kTksrRefreshArgIdx = 1,
148 149
     kTksrSelArgIdx     = 2,
149
-    kTksrVarCnt        = 3
150
+    kTksrVarCnt        = 3,
151
+
152
+    kTwodXArgIdx       = 0,
153
+    kTwodYArgIdx       = 1,
154
+    kTwodRadiusArgIdx  = 2,
155
+    kTwodAngleArgIdx   = 3,
156
+    kTwodVarCnt        = 4
150 157
 
151 158
   }; 
152 159
 
@@ -264,6 +271,12 @@ private:
264 271
     unsigned   varIdArray[ kTksrVarCnt ];
265 272
   } tksr_t;
266 273
 
274
+  typedef struct twod_str
275
+  {
276
+    tlCtl* tlctl;
277
+    unsigned varIdArray[ kTwodVarCnt ];
278
+  } twod_t;
279
+
267 280
 
268 281
   typedef struct ctl_str
269 282
   {
@@ -287,6 +300,7 @@ private:
287 300
       scor_t     scor;
288 301
       tksb_t     tksb;
289 302
       tksr_t     tksr;
303
+      twod_t     twod;
290 304
     } u;
291 305
     struct ctl_str* linkPtr;
292 306
   } ctl_t;
@@ -385,6 +399,8 @@ private:
385 399
   void          _setTksbValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
386 400
   void          _createTksr(  const cmDspUiHdr_t* m );
387 401
   void          _setTksrValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
402
+  void          _createTwod(  const cmDspUiHdr_t* m );
403
+  void          _setTwodValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
388 404
 
389 405
 
390 406
   void          _newColumn( const cmDspUiHdr_t* m );

Loading…
Cancel
Save