@@ -107,6 +107,34 @@ CCetoneUI::CCetoneUI()
107107 _createSwitchButton (fBtnGlideState , pPortaMode, 764 , 150 );
108108
109109 _createSwitchButton (fBtnLFOTrigger , pLfo1Trig, 677 , 260 );
110+
111+ /* ImGui instance (popup menus, subwindows, etc.) */
112+ fImGuiInstance = new ImGuiUI (getTopLevelWidget (), this );
113+
114+ /* "About" button (by clicking the plugin logo) */
115+ _createHiddenButton (fBtnAbout , BTN_ABOUT, Size<uint>(118 , 25 ), Point<int >(0 , 0 ));
116+
117+ /* Popup menu button on params which has constant value sets */
118+ _createHiddenButton (fBtnOsc1Waveform , pOsc1Wave, Size<uint>(45 , 10 + 2 ), Point<int >(10 + 48 * 2 , 200 + 2 ));
119+ _createHiddenButton (fBtnOsc2Waveform , pOsc2Wave, Size<uint>(45 , 10 + 2 ), Point<int >(262 + 48 * 2 , 200 + 2 ));
120+ _createHiddenButton (fBtnOsc3Waveform , pOsc3Wave, Size<uint>(45 , 10 + 2 ), Point<int >(514 + 48 * 2 , 200 + 2 ));
121+
122+ _createHiddenButton (fBtnFilterType , pFilterType, Size<uint>(45 , 10 + 2 ), Point<int >(514 , 96 - 4 ));
123+ _createHiddenButton (fBtnFilterMode , pFilterMode, Size<uint>(45 , 10 + 2 ), Point<int >(514 + 48 , 96 - 4 ));
124+
125+ _createHiddenButton (fBtnLfo1Waveform , pLfo1Wave, Size<uint>(45 , 10 + 2 ), Point<int >(534 + 48 , 316 - 4 ));
126+
127+ _createHiddenButton (fBtnArpMode , pArpMode, Size<uint>(45 , 10 + 2 ), Point<int >(767 , 316 - 4 - 2 ));
128+
129+ _createHiddenButton (fBtnMod1Src , pMod1Src, Size<uint>(45 , 10 + 2 ), Point<int >(10 , 426 - 4 - 2 ));
130+ _createHiddenButton (fBtnMod2Src , pMod2Src, Size<uint>(45 , 10 + 2 ), Point<int >(230 , 426 - 4 - 2 ));
131+ _createHiddenButton (fBtnMod3Src , pMod3Src, Size<uint>(45 , 10 + 2 ), Point<int >(450 , 426 - 4 - 2 ));
132+ _createHiddenButton (fBtnMod4Src , pMod4Src, Size<uint>(45 , 10 + 2 ), Point<int >(670 , 426 - 4 - 2 ));
133+
134+ _createHiddenButton (fBtnMod1Dest , pMod1Dest, Size<uint>(45 , 10 + 2 ), Point<int >(10 + 48 , 426 - 4 - 2 ));
135+ _createHiddenButton (fBtnMod2Dest , pMod2Dest, Size<uint>(45 , 10 + 2 ), Point<int >(230 + 48 , 426 - 4 - 2 ));
136+ _createHiddenButton (fBtnMod3Dest , pMod3Dest, Size<uint>(45 , 10 + 2 ), Point<int >(450 + 48 , 426 - 4 - 2 ));
137+ _createHiddenButton (fBtnMod4Dest , pMod4Dest, Size<uint>(45 , 10 + 2 ), Point<int >(670 + 48 , 426 - 4 - 2 ));
110138}
111139
112140void CCetoneUI::parameterChanged (uint32_t index, float value)
@@ -349,14 +377,66 @@ void CCetoneUI::parameterChanged(uint32_t index, float value)
349377
350378void CCetoneUI::imageButtonClicked (ImageButton* button, int )
351379{
352- #if 0
353- switch (button->getId()) {
354- case BTN_PANIC: {
355- panic();
356- break;
357- }
380+ DISTRHO_SAFE_ASSERT_RETURN (fImGuiInstance , )
381+
382+ switch (button->getId ())
383+ {
384+ case BTN_ABOUT:
385+ {
386+ fImGuiInstance ->isAboutWindowOpen = !fImGuiInstance ->isAboutWindowOpen ;
387+ break ;
388+ }
389+ case pOsc1Wave:
390+ {
391+ fImGuiInstance ->menuPos = ImVec2 (fBtnOsc1Waveform ->getAbsolutePos ().getX (), fBtnOsc1Waveform ->getAbsolutePos ().getY () + fBtnOsc1Waveform ->getHeight ());
392+ fImGuiInstance ->requestMenuId = pOsc1Wave;
393+ break ;
394+ }
395+ case pOsc2Wave:
396+ {
397+ fImGuiInstance ->menuPos = ImVec2 (fBtnOsc2Waveform ->getAbsolutePos ().getX (), fBtnOsc2Waveform ->getAbsolutePos ().getY () + fBtnOsc2Waveform ->getHeight ());
398+ fImGuiInstance ->requestMenuId = pOsc2Wave;
399+ break ;
400+ }
401+ case pOsc3Wave:
402+ {
403+ fImGuiInstance ->menuPos = ImVec2 (fBtnOsc3Waveform ->getAbsolutePos ().getX (), fBtnOsc3Waveform ->getAbsolutePos ().getY () + fBtnOsc3Waveform ->getHeight ());
404+ fImGuiInstance ->requestMenuId = pOsc3Wave;
405+ break ;
406+ }
407+ case pFilterType:
408+ {
409+ fImGuiInstance ->menuPos = ImVec2 (fBtnFilterType ->getAbsolutePos ().getX (), fBtnFilterType ->getAbsolutePos ().getY () + fBtnFilterType ->getHeight ());
410+ fImGuiInstance ->requestMenuId = pFilterType;
411+ break ;
412+ }
413+ case pFilterMode:
414+ {
415+ fImGuiInstance ->menuPos = ImVec2 (fBtnFilterMode ->getAbsolutePos ().getX (), fBtnFilterMode ->getAbsolutePos ().getY () + fBtnFilterMode ->getHeight ());
416+ fImGuiInstance ->requestMenuId = pFilterMode;
417+ break ;
418+ }
419+ case pLfo1Wave:
420+ {
421+ fImGuiInstance ->menuPos = ImVec2 (fBtnLfo1Waveform ->getAbsolutePos ().getX (), fBtnLfo1Waveform ->getAbsolutePos ().getY () + fBtnLfo1Waveform ->getHeight ());
422+ fImGuiInstance ->requestMenuId = pLfo1Wave;
423+ break ;
424+ }
425+ // NOTICE: For those buttons below, no need to specify menu position. Let Dear ImGui decide menu's position.
426+ case pArpMode:
427+ case pMod1Src:
428+ case pMod2Src:
429+ case pMod3Src:
430+ case pMod4Src:
431+ case pMod1Dest:
432+ case pMod2Dest:
433+ case pMod3Dest:
434+ case pMod4Dest:
435+ {
436+ fImGuiInstance ->requestMenuId = button->getId ();
437+ break ;
438+ }
358439 }
359- #endif
360440}
361441
362442void CCetoneUI::imageSwitchClicked (ImageSwitch* button, bool down)
@@ -445,13 +525,24 @@ void CCetoneUI::onDisplay()
445525 fNanoText .textBox (514 , 96 , 45 .0f , fLabelBuffer );
446526
447527 // Mode
448- // FIXME : Some filter types does not support setting mode.
528+ // NOTE : Some filter types does not support setting mode.
449529 const auto _filterMode = _pf2i (fKnobFilterMode ->getValue (), FMODE_MAX);
450- std::snprintf (fLabelBuffer , 32 , " %s" , _filterMode2str (_filterMode));
530+ switch (_pf2i (fKnobFilterType ->getValue (), FTYPE_MAX))
531+ {
532+ case FTYPE_DIRTY:
533+ case FTYPE_MOOG2:
534+ case FTYPE_CH12DB:
535+ case FTYPE_8580:
536+ std::snprintf (fLabelBuffer , 32 , " %s" , _filterMode2str (_filterMode));
537+ break ;
538+ default :
539+ std::snprintf (fLabelBuffer , 32 , " Low" );
540+ break ;
541+ }
451542 fNanoText .textBox (514 + 48 , 96 , 45 .0f , fLabelBuffer );
452543
453544 // Cutoff
454- std::snprintf (fLabelBuffer , 32 , " %.1f" , fKnobCutoff ->getValue () * 100 .0f );
545+ std::snprintf (fLabelBuffer , 32 , " %.1f" , fKnobCutoff ->getValue () * 24000 .0f ); // Cutoff frequency range: 0.0 ~ 24000.0 Hz
455546 fNanoText .textBox (514 + 48 * 2 , 96 , 45 .0f , fLabelBuffer );
456547
457548 // Resonance
@@ -571,7 +662,7 @@ void CCetoneUI::onDisplay()
571662
572663 /* LFO */
573664 // Speed
574- std::snprintf (fLabelBuffer , 32 , " %.2f" , fLfoSpeed ->getValue () * 100 .0f );
665+ std::snprintf (fLabelBuffer , 32 , " %.2f" , fLfoSpeed ->getValue () * 50 .0f ); // Speed range: 0.0 ~ 50.0 Hz
575666 fNanoText .textBox (534 , 316 , 45 .0f , fLabelBuffer );
576667
577668 // Waveform
0 commit comments