Browse Source

kcApp.h/cpp : Added TakeSeqBldr related controls.

master
Kevin Larke 9 years ago
parent
commit
a96fd43cab
2 changed files with 220 additions and 20 deletions
  1. 183
    14
      src/kc/kcApp.cpp
  2. 37
    6
      src/kc/kcApp.h

+ 183
- 14
src/kc/kcApp.cpp View File

@@ -48,6 +48,7 @@
48 48
 #include "cmMidiFile.h"
49 49
 #include "cmTimeLine.h"
50 50
 #include "cmScore.h"
51
+#include "cmTakeSeqBldr.h"
51 52
 #include "cmdIf.h"
52 53
 #include "tlCtl.h"
53 54
 #include "kcApp.h"
@@ -58,6 +59,9 @@
58 59
 #include "cmGrPlot.h"
59 60
 #include "cmGrPage.h"
60 61
 #include "cmGrFltk.h"
62
+#include "cmGrFltk.h"
63
+#include "gvHashFunc.h"
64
+#include "cmGrTksbFltk.h"
61 65
 
62 66
 
63 67
 #define TIMER_PERIOD (1.0/20.0)   // 50ms
@@ -648,8 +652,6 @@ void kcApp::_setTextValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp
648 652
     }
649 653
 }
650 654
 
651
-
652
-
653 655
 void kcApp::_createFnameCtl( const cmDspUiHdr_t* m )
654 656
 {
655 657
   int x,y,w=0,h=0;
@@ -1275,6 +1277,125 @@ void kcApp::_setScorValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp
1275 1277
     }
1276 1278
 }
1277 1279
 
1280
+void kcApp::_createTksb(  const cmDspUiHdr_t* m )
1281
+{
1282
+  int x,y,w=0,h=0;
1283
+
1284
+  page_t* pg = _createPage("Bldr");
1285
+
1286
+  ctl_t*  cp = _createCtl(m, kTksbTypeId, x,y,w,h, true );
1287
+
1288
+  w = pg->grp->w();
1289
+  h = pg->grp->h();
1290
+
1291
+  // currently we only support one Take sequence builder control because
1292
+  // we have not yet implmenented a method of providing
1293
+  // timer callbacks to a list of UI controls
1294
+  if( _tlCtl != NULL )
1295
+    cp->u.tksb.tlctl = _tlCtl;
1296
+  else
1297
+  {
1298
+    _tlCtl = new tlCtl(_ctx,this,_menu,this);
1299
+
1300
+    cp->u.tksb.tlctl  = _tlCtl; 
1301
+  }
1302
+
1303
+  Fl_Widget* wdgt = cp->u.tksb.tlctl->initTakeSeqBldrCtlr(x,y,w,h);
1304
+
1305
+  _insertNewCtl(cp,m,wdgt,cp->u.tksb.varIdArray,kTksbVarCnt);
1306
+
1307
+}
1308
+
1309
+void kcApp::_setTksbValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp )
1310
+{
1311
+  unsigned i;
1312
+
1313
+  for(i=0; i<kTksbVarCnt; ++i)
1314
+    if( cp->u.tksb.varIdArray[i] == instVarId )
1315
+    {
1316
+      switch(i)
1317
+      {
1318
+        case kTksbFileArgIdx:
1319
+          break;
1320
+
1321
+        case kTksbPtrArgIdx:
1322
+          if( _tlCtl != NULL )
1323
+            _tlCtl->openTakeSeqBldr(cmDsvPtr(vp));
1324
+          break;
1325
+
1326
+        case kTksbSelArgIdx:
1327
+          // TODO: call cmGrTksbFltk from here to to animate the time cursor
1328
+          //       with a new location
1329
+          break;
1330
+
1331
+        case kTksbRefreshArgIdx:
1332
+          break;
1333
+
1334
+        default:
1335
+          { assert(0); }
1336
+      }
1337
+    }
1338
+}
1339
+
1340
+
1341
+void kcApp::_createTksr(  const cmDspUiHdr_t* m )
1342
+{
1343
+  int x,y,w=0,h=0;
1344
+
1345
+  page_t* pg = _createPage("Rndr");
1346
+
1347
+  ctl_t*  cp = _createCtl(m, kTksrTypeId, x,y,w,h, true );
1348
+
1349
+  w = pg->grp->w();
1350
+  h = pg->grp->h();
1351
+
1352
+  // currently we only support one Take sequence builder control because
1353
+  // we have not yet implmenented a method of providing
1354
+  // timer callbacks to a list of UI controls
1355
+  if( _tlCtl != NULL )
1356
+    cp->u.tksr.tlctl = _tlCtl;
1357
+  else
1358
+  {
1359
+    _tlCtl = new tlCtl(_ctx,this,_menu,this);
1360
+
1361
+    cp->u.tksr.tlctl  = _tlCtl; 
1362
+  }
1363
+
1364
+  Fl_Widget* wdgt = cp->u.tksr.tlctl->initTakeSeqRendCtlr(x,y,w,h);
1365
+
1366
+  _insertNewCtl(cp,m,wdgt,cp->u.tksr.varIdArray,kTksrVarCnt);
1367
+
1368
+}
1369
+
1370
+void kcApp::_setTksrValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp )
1371
+{
1372
+  unsigned i;
1373
+
1374
+  for(i=0; i<kTksrVarCnt; ++i)
1375
+    if( cp->u.tksr.varIdArray[i] == instVarId )
1376
+    {
1377
+      switch(i)
1378
+      {
1379
+        case kTksrPtrArgIdx:
1380
+          if( _tlCtl != NULL )
1381
+            _tlCtl->openTakeSeqRend(cmDsvPtr(vp));
1382
+          break;
1383
+
1384
+        case kTksrRefreshArgIdx:
1385
+          if( _tlCtl != NULL )
1386
+            _tlCtl->refreshTakeSeqRend();
1387
+          break;
1388
+
1389
+        case kTksrSelArgIdx:
1390
+          break;
1391
+
1392
+        default:
1393
+          { assert(0); }
1394
+      }
1395
+    }
1396
+}
1397
+
1398
+
1278 1399
 void kcApp::_newColumn( const cmDspUiHdr_t* m )
1279 1400
 {
1280 1401
   _incrColW = cmDsvGetUInt(&m->value);
@@ -1680,6 +1801,14 @@ void kcApp::_onRecvValue( const cmDspUiHdr_t* m )
1680 1801
       _setScorValue(cp, m->instVarId, &m->value);
1681 1802
       break;
1682 1803
 
1804
+    case kTksbTypeId:
1805
+      _setTksbValue(cp, m->instVarId, &m->value);
1806
+      break;
1807
+
1808
+    case kTksrTypeId:
1809
+      _setTksrValue(cp, m->instVarId, &m->value);
1810
+      break;
1811
+
1683 1812
     default:
1684 1813
       assert(0);
1685 1814
   }
@@ -1737,6 +1866,14 @@ void kcApp::_handleUiMsg( const cmDspUiHdr_t* m )
1737 1866
       _createScor(m);
1738 1867
       break;
1739 1868
 
1869
+    case kTakeSeqBldrDuiId:
1870
+      _createTksb(m);
1871
+      break;
1872
+
1873
+    case kTakeSeqRendDuiId:
1874
+      _createTksr(m);
1875
+      break;
1876
+
1740 1877
     case kValueDuiId:
1741 1878
       _onRecvValue(m);
1742 1879
       break;
@@ -2135,24 +2272,56 @@ void kcApp::_ctl_cb(ctl_t* cp)
2135 2272
       }
2136 2273
       break;
2137 2274
 
2275
+    case kTksbTypeId:
2276
+      {
2277
+        cmGrTksbFltk* tksbCtl = dynamic_cast<cmGrTksbFltk*>(cp->wdgtPtr);
2278
+        
2279
+        switch( tksbCtl->cbTypeId() )
2280
+        {
2281
+          case cmGrTksbFltk::kSelectTId:
2282
+            {
2283
+              instVarId = cp->u.tksb.varIdArray[ kTksbSelArgIdx ];
2284
+              unsigned selEleIdx = cp->u.tksb.tlctl->tksbSelectedEleIndex();
2285
+              cmDsvSetUInt(&value, selEleIdx );
2286
+            }
2287
+            break;
2288
+
2289
+          case cmGrTksbFltk::kRefreshTId:
2290
+            instVarId = cp->u.tksb.varIdArray[ kTksbRefreshArgIdx ];
2291
+            cmDsvSetInt(&value,0);
2292
+            break;
2293
+
2294
+          default:
2295
+            { assert(0); }
2296
+        }
2297
+        
2298
+
2299
+      }
2300
+      break;
2301
+
2302
+    case kTksrTypeId:
2303
+      {
2304
+      }
2305
+      break;
2138 2306
       
2139 2307
     default:
2140 2308
       {assert(0);}
2141 2309
 
2142 2310
   }
2143 2311
 
2144
-  if( cmAdIfSendMsgToAudioDSP( 
2145
-      _aiH, 
2146
-      cp->asSubIdx, 
2147
-      cp->mstrFl ? kUiMstrSelAsId : kUiSelAsId,
2148
-      kValueDuiId,
2149
-      0,
2150
-      cp->instId,
2151
-      instVarId,
2152
-      &value) != kOkAiRC)
2153
-  {
2154
-    cmErrMsg(&_ctx->err,kEngFailKmRC,"An attempt to send a UI message to the audio DSP interface failed.");
2155
-  }
2312
+  if( instVarId != cmInvalidId )
2313
+    if( cmAdIfSendMsgToAudioDSP( 
2314
+        _aiH, 
2315
+        cp->asSubIdx, 
2316
+        cp->mstrFl ? kUiMstrSelAsId : kUiSelAsId,
2317
+        kValueDuiId,
2318
+        0,
2319
+        cp->instId,
2320
+        instVarId,
2321
+        &value) != kOkAiRC)
2322
+    {
2323
+      cmErrMsg(&_ctx->err,kEngFailKmRC,"An attempt to send a UI message to the audio DSP interface failed.");
2324
+    }
2156 2325
 
2157 2326
 }
2158 2327
 

+ 37
- 6
src/kc/kcApp.h View File

@@ -48,17 +48,17 @@ public:
48 48
   virtual void tlCtlNewScoreFile(    tlCtl* tlCtl, const cmChar_t* fn );
49 49
 
50 50
 
51
-  void print( const char* fmt, ... );
51
+  void print(  const char* fmt, ... );
52 52
   void vprint( const char* fmt, va_list vl );
53 53
 
54 54
 
55 55
 private:
56 56
   enum
57 57
   {
58
-    kMenuH = 30,
58
+    kMenuH   = 30,
59 59
     kStatusH = 30,
60
-    kIndH = 25,
61
-    kIndW = 25,
60
+    kIndH    = 25,
61
+    kIndW    = 25,
62 62
     
63 63
     kSsPhaseMax = 20
64 64
   };
@@ -77,6 +77,8 @@ private:
77 77
     kMetrTypeId,
78 78
     kTmlnTypeId,
79 79
     kScorTypeId,
80
+    kTksbTypeId,
81
+    kTksrTypeId,
80 82
 
81 83
     kSldrMinArgIdx = 0,
82 84
     kSldrMaxArgIdx = 1,
@@ -133,7 +135,18 @@ private:
133 135
     kScorDynArgIdx     = 7,
134 136
     kScorValTypeArgIdx = 8,
135 137
     kScorValueArgIdx   = 9,
136
-    kScorVarCnt        = 10
138
+    kScorVarCnt        = 10,
139
+   
140
+    kTksbFileArgIdx    = 0,
141
+    kTksbPtrArgIdx     = 1,
142
+    kTksbSelArgIdx     = 2,
143
+    kTksbRefreshArgIdx = 3,
144
+    kTksbVarCnt        = 4,
145
+
146
+    kTksrPtrArgIdx     = 0,
147
+    kTksrRefreshArgIdx = 1,
148
+    kTksrSelArgIdx     = 2,
149
+    kTksrVarCnt        = 3
137 150
 
138 151
   }; 
139 152
 
@@ -239,6 +252,18 @@ private:
239 252
     unsigned   varIdArray[ kScorVarCnt ];
240 253
   } scor_t;
241 254
 
255
+  typedef struct tksb_str
256
+  {
257
+    tlCtl*     tlctl;
258
+    unsigned   varIdArray[ kTksbVarCnt ];
259
+  } tksb_t;
260
+
261
+  typedef struct tksr_str
262
+  {
263
+    tlCtl*     tlctl;
264
+    unsigned   varIdArray[ kTksrVarCnt ];
265
+  } tksr_t;
266
+
242 267
 
243 268
   typedef struct ctl_str
244 269
   {
@@ -260,6 +285,8 @@ private:
260 285
       metr_t     metr;
261 286
       tmln_t     tmln;
262 287
       scor_t     scor;
288
+      tksb_t     tksb;
289
+      tksr_t     tksr;
263 290
     } u;
264 291
     struct ctl_str* linkPtr;
265 292
   } ctl_t;
@@ -288,7 +315,6 @@ private:
288 315
     
289 316
   } ss_t;
290 317
 
291
-
292 318
   cmCtx_t*         _ctx;
293 319
   cmPrH_t          _prH;
294 320
   cmAiH_t          _aiH;
@@ -355,6 +381,11 @@ private:
355 381
   void          _setTmlnValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
356 382
   void          _createScor(  const cmDspUiHdr_t* m );
357 383
   void          _setScorValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
384
+  void          _createTksb(  const cmDspUiHdr_t* m );
385
+  void          _setTksbValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
386
+  void          _createTksr(  const cmDspUiHdr_t* m );
387
+  void          _setTksrValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp );
388
+
358 389
 
359 390
   void          _newColumn( const cmDspUiHdr_t* m );
360 391
 

Loading…
Cancel
Save