Skip to content

Commit 79f8cff

Browse files
committed
Compile virtual grids for MM
1 parent a824ab3 commit 79f8cff

8 files changed

Lines changed: 276 additions & 24 deletions

File tree

res/grid-375-dark.svg

Lines changed: 107 additions & 0 deletions
Loading

res/grid-375.svg

Lines changed: 107 additions & 0 deletions
Loading
File renamed without changes.
File renamed without changes.

src/common/core/GridConnection/GridConnection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void GridConnectionManager::deregisterGrid(std::string id, bool deleteGrid)
4747
{
4848
for (Grid* grid : grids)
4949
{
50-
if (grid->getDevice().id == id)
50+
if (grid && grid->getDevice().id == id)
5151
{
5252
disconnect(grid);
5353
grids.erase(grid);

src/virtualgrid/VirtualGridKey.hpp

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
#include "rack.hpp"
22
#include "VirtualGridTheme.hpp"
33

4-
struct VirtualGridKey : rack::app::ParamWidget
4+
#ifdef METAMODULE
5+
typedef rack::widget::OpaqueWidget GridKeyBase;
6+
#else
7+
typedef rack::widget::ParamWidget GridKeyBase;
8+
#endif
9+
10+
11+
struct VirtualGridKey : GridKeyBase
512
{
613
uint8_t* ledAddress;
714
GridTheme* theme;
@@ -147,6 +154,15 @@ struct VirtualGridKey : rack::app::ParamWidget
147154
nvgFill(vg);
148155
}
149156

157+
#ifdef METAMODULE
158+
159+
bool isPushed()
160+
{
161+
return false;
162+
}
163+
164+
#else
165+
150166
rack::engine::ParamQuantity* getSecondaryParamQuantity()
151167
{
152168
if (!module)
@@ -160,6 +176,7 @@ struct VirtualGridKey : rack::app::ParamWidget
160176
(getParamQuantity() && getParamQuantity()->getValue() == PRESSED) ||
161177
(getSecondaryParamQuantity() && getSecondaryParamQuantity()->getValue() == PRESSED);
162178
}
179+
#endif
163180

164181
bool isLocked()
165182
{
@@ -171,6 +188,8 @@ struct VirtualGridKey : rack::app::ParamWidget
171188
_locked = b;
172189
}
173190

191+
#ifndef METAMODULE
192+
174193
void beginPress()
175194
{
176195
if (getSecondaryParamQuantity())
@@ -215,7 +234,7 @@ struct VirtualGridKey : rack::app::ParamWidget
215234
}
216235
}
217236

218-
void onButton(const rack::event::Button& e) override
237+
void onButton(const ButtonEvent& e) override
219238
{
220239
if (e.button == GLFW_MOUSE_BUTTON_LEFT)
221240
{
@@ -262,28 +281,28 @@ struct VirtualGridKey : rack::app::ParamWidget
262281
}
263282
}
264283

265-
void onDragStart(const rack::event::DragStart& e) override
284+
void onDragStart(const DragStartEvent& e) override
266285
{
267286
beginPress();
268287
}
269288

270-
void onDragEnd(const rack::event::DragEnd& e) override
289+
void onDragEnd(const DragEndEvent& e) override
271290
{
272291
if (e.getTarget() == nullptr || e.getTarget()->parent == this->parent)
273292
{
274293
endPress();
275294
}
276295
}
277296

278-
void onDragLeave(const rack::event::DragLeave& e) override
297+
void onDragLeave(const DragLeaveEvent& e) override
279298
{
280299
if (e.origin->parent == this->parent)
281300
{
282301
endPress();
283302
}
284303
}
285304

286-
void onDragEnter(const rack::event::DragEnter& e) override
305+
void onDragEnter(const DragEnterEvent& e) override
287306
{
288307
if (e.origin->parent == this->parent)
289308
{
@@ -296,6 +315,9 @@ struct VirtualGridKey : rack::app::ParamWidget
296315
// override base class to prevent tooltip creation
297316
}
298317

318+
#endif
319+
299320
protected:
300321
bool _locked;
301-
};
322+
};
323+

0 commit comments

Comments
 (0)