MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / DrawDisplayModuleControls

Method DrawDisplayModuleControls

Source/Push2Control.cpp:830–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

828}
829
830void Push2Control::DrawDisplayModuleControls()
831{
832 if (mDisplayModule != nullptr && mDisplayModule->IsDeleted())
833 {
834 SetDisplayModule(nullptr, false);
835 return;
836 }
837
838 ofSetColor(255, 255, 255);
839 if (mDisplayModule != nullptr)
840 {
841 ofPushMatrix();
842 ofPushStyle();
843
844 //nvgFontSize(mVG, 16);
845 //nvgText(mVG, 10, 10, mDisplayModule->Name(), nullptr);
846 float x;
847 float y;
848 mDisplayModule->GetPosition(x, y, true);
849 mDisplayModule->SetPosition(5 - kColumnSpacing * mModuleViewOffsetSmoothed, 15);
850 float titleBarHeight;
851 float highlight;
852 mDisplayModule->DrawFrame(kColumnSpacing * MAX(1, MAX(mSliderControls.size(), mButtonControls.size())) - 14, 80, false, titleBarHeight, highlight);
853 mDisplayModule->SetPosition(x, y);
854
855 ofSetColor(IDrawableModule::GetColor(mDisplayModule->GetModuleCategory()));
856 ofNoFill();
857
858 nvgFontSize(sVG, 16);
859 bool screenDrawingHandled = mDisplayModule->DrawToPush2Screen();
860 if (!screenDrawingHandled)
861 {
862 DrawControls(mButtonControls, false, 60);
863 DrawControls(mSliderControls, true, 20);
864 }
865
866 int topRowLedColors[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
867 for (int i = 0; i < mButtonControls.size(); ++i)
868 {
869 if (i - mModuleViewOffset >= 0 && i - mModuleViewOffset < 8)
870 topRowLedColors[i - mModuleViewOffset] = GetPadColorForType(mButtonControls[i]->GetModuleParent()->GetModuleCategory(), true);
871 }
872 for (int i = 0; i < 8; ++i)
873 SetLed(kMidiMessage_Control, i + kAboveScreenButtonRow, topRowLedColors[i]);
874
875 ofPopMatrix();
876 ofPopStyle();
877
878 ofPushStyle();
879 ofSetLineWidth(.5f);
880 int length = MAX((int)mButtonControls.size(), (int)mSliderControls.size());
881 if (length > 8)
882 {
883 ofRectangle bar(ableton::Push2DisplayBitmap::kWidth * kPixelRatio - 100, 3, 80, 10);
884 ofNoFill();
885 ofSetColor(100, 100, 100);
886 ofRect(bar);
887 ofFill();

Callers

nothing calls this directly

Calls 15

ofSetColorFunction · 0.85
ofPushMatrixFunction · 0.85
ofPushStyleFunction · 0.85
ofNoFillFunction · 0.85
nvgFontSizeFunction · 0.85
ofPopMatrixFunction · 0.85
ofPopStyleFunction · 0.85
ofSetLineWidthFunction · 0.85
ofRectFunction · 0.85
ofFillFunction · 0.85
IsDeletedMethod · 0.80
DrawFrameMethod · 0.80

Tested by

no test coverage detected