Browse Source

Added cmDspUi2 two-dimensional drag UI control.

master
Kevin Larke 9 years ago
parent
commit
2c1be3cf84
3 changed files with 23 additions and 0 deletions
  1. 1
    0
      cmMsgProtocol.h
  2. 1
    0
      dsp/cmDspClass.h
  3. 21
    0
      dsp/cmDspUi.c

+ 1
- 0
cmMsgProtocol.h View File

23
     kScoreDuiId,       // ui<--eng create a score control
23
     kScoreDuiId,       // ui<--eng create a score control
24
     kTakeSeqBldrDuiId, // ui<--eng create a take sequence builder
24
     kTakeSeqBldrDuiId, // ui<--eng create a take sequence builder
25
     kTakeSeqRendDuiId, // ui<--eng create a take sequence renderer
25
     kTakeSeqRendDuiId, // ui<--eng create a take sequence renderer
26
+    kTwodDuiId,        // ui<--eng create a 2d control
26
     kNumberDuiId,      // ui<--eng create a number box
27
     kNumberDuiId,      // ui<--eng create a number box
27
     kTextDuiId,        // ui<--eng create a text entry control
28
     kTextDuiId,        // ui<--eng create a text entry control
28
     kFnameDuiId,       // ui<--eng create a file/directory picker control
29
     kFnameDuiId,       // ui<--eng create a file/directory picker control

+ 1
- 0
dsp/cmDspClass.h View File

405
   cmDspRC_t  cmDspUiScoreCreate(       cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId,  unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarIdx, unsigned evtIdxVarIdx, unsigned dynLvlVarIdx, unsigned valTypeVarIdx, unsigned valueVarIdx );
405
   cmDspRC_t  cmDspUiScoreCreate(       cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId,  unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarIdx, unsigned evtIdxVarIdx, unsigned dynLvlVarIdx, unsigned valTypeVarIdx, unsigned valueVarIdx );
406
   cmDspRC_t  cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId );
406
   cmDspRC_t  cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId );
407
   cmDspRC_t  cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId,      unsigned refreshVarId, unsigned selVarId  );
407
   cmDspRC_t  cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId,      unsigned refreshVarId, unsigned selVarId  );
408
+  cmDspRC_t  cmDspUi2dCreate(          cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned xVarId,        unsigned yVarId,       unsigned radiusVarId, unsigned angleVarId);
408
 
409
 
409
   cmDspRC_t  cmDspUiNewColumn(        cmDspCtx_t* ctx, unsigned colW );
410
   cmDspRC_t  cmDspUiNewColumn(        cmDspCtx_t* ctx, unsigned colW );
410
   cmDspRC_t  cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );
411
   cmDspRC_t  cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );

+ 21
- 0
dsp/cmDspUi.c View File

457
   return rc;
457
   return rc;
458
 }
458
 }
459
 
459
 
460
+cmDspRC_t  cmDspUi2dCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned xVarId, unsigned yVarId, unsigned radiusVarId, unsigned angleVarId)
461
+{
462
+  cmDspRC_t    rc;
463
+  unsigned     arr[] = { xVarId, yVarId, radiusVarId, angleVarId  };
464
+  cmDspValue_t v;
465
+  unsigned     vn    = sizeof(arr)/sizeof(arr[0]);
466
+  cmDsvSetUIntMtx(&v,arr,vn,1);
467
+
468
+  // tell the UI to create a sequence render  control
469
+  if((rc = _cmDspUiMsg( ctx, kUiSelAsId, kTwodDuiId, 0, inst, cmInvalidId, &v )) != kOkDspRC )
470
+    return cmDspInstErr(ctx,inst,kUiEleCreateFailDspRC,"2-d UI element create failed.");
471
+
472
+  // Setting kUiDsvFl will cause variable values to be sent to the UI whenever they change.
473
+  cmDspInstVarSetFlags( ctx, inst, xVarId,      kUiDsvFl );
474
+  cmDspInstVarSetFlags( ctx, inst, yVarId,      kUiDsvFl );
475
+  cmDspInstVarSetFlags( ctx, inst, radiusVarId, kUiDsvFl );
476
+  cmDspInstVarSetFlags( ctx, inst, angleVarId,  kUiDsvFl );
477
+
478
+  return rc;
479
+}
480
+
460
 
481
 
461
 cmDspRC_t  cmDspUiNewColumn(    cmDspCtx_t* ctx, unsigned colW )
482
 cmDspRC_t  cmDspUiNewColumn(    cmDspCtx_t* ctx, unsigned colW )
462
 {
483
 {

Loading…
Cancel
Save