Skip to content

Commit

Permalink
Fix more TODOs, fix messbox bug
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Feb 21, 2025
1 parent b6ead6a commit d1dec3c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 25 deletions.
4 changes: 0 additions & 4 deletions Source/Canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,6 @@ int Canvas::getOverlays() const
if (locked.getValue() || commandLocked.getValue()) {
overlayState = overlaysTree.getProperty("lock");
}
if (presentationMode.getValue()) { // TODO: this no longer exists?
overlayState = overlaysTree.getProperty("run");
}
if (altModeEnabled) {
overlayState = overlaysTree.getProperty("alt");
}
Expand Down Expand Up @@ -1538,7 +1535,6 @@ void Canvas::mouseUp(MouseEvent const& e)
for (auto* object : objects)
object->originalBounds = Rectangle<int>(0, 0, 0, 0);

// TODO: this is a hack, find a better solution
if (connectingWithDrag) {
for (auto* obj : objects) {
for (auto const& iolet : obj->iolets) {
Expand Down
16 changes: 9 additions & 7 deletions Source/Objects/ArrayObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class GraphicalArray final : public Component

for (auto* value : SmallArray<Value*> { &name, &size, &drawMode, &saveContents, &range }) {
// TODO: implement undo/redo for these values!
// how does pd even do this? since it's not a gobj?
value->addListener(this);
}

Expand Down Expand Up @@ -347,8 +348,7 @@ class GraphicalArray final : public Component
void paint(Graphics& g) override
{
if (error) {
// TODO: error colour
Fonts::drawText(g, "array " + getUnexpandedName() + " is invalid", 0, 0, getWidth(), getHeight(), object->getLookAndFeel().findColour(PlugDataColour::canvasTextColourId), 15, Justification::centred);
Fonts::drawText(g, "array " + getUnexpandedName() + " is invalid", 0, 0, getWidth(), getHeight(), Colours::red, 15, Justification::centred);
error = false;
} else if (visible) {
paintGraph(g);
Expand Down Expand Up @@ -1289,13 +1289,15 @@ class ArrayObject final : public ObjectBase {
SmallArray<void*> arrays;

if (auto* x = c->gl_list) {
arrays.add(x);

while ((x = x->g_next)) {
// TODO: check if it's actually an array...
// in pd, you could put another object into the graph, we don't support this
auto* arraySym = pd->generateSymbol("array");
if(x->g_pd->c_name == arraySym) {
arrays.add(x);
}
while ((x = x->g_next)) {
if(x->g_pd->c_name == arraySym) {
arrays.add(x);
}
}
}

return arrays;
Expand Down
4 changes: 3 additions & 1 deletion Source/Objects/LuaObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,9 @@ class LuaTextObject final : public TextBase {
return;

if (getValue<bool>(object->locked)) {
// TODO: open text editor!
if (auto obj = ptr.get<t_pd>()) {
pd->sendDirectMessage(obj.get(), "menu-open", {});
}
}
}

Expand Down
14 changes: 5 additions & 9 deletions Source/Objects/MessboxObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class MessboxObject final : public ObjectBase
editor.getProperties().set("NoBackground", true);
editor.getProperties().set("NoOutline", true);
editor.setColour(ScrollBar::thumbColourId, cnv->editor->getLookAndFeel().findColour(PlugDataColour::scrollbarThumbColourId));
editor.onFocusLost = [this](){
needsRepaint = true;
repaint();
};

editor.setAlwaysOnTop(true);
editor.setMultiLine(true);
Expand Down Expand Up @@ -166,7 +170,7 @@ class MessboxObject final : public ObjectBase

void hideEditor() override
{
editor.setReadOnly(true);
cnv->grabKeyboardFocus();
repaint();
}

Expand All @@ -175,14 +179,6 @@ class MessboxObject final : public ObjectBase
return !editor.isReadOnly() && editor.hasKeyboardFocus(false);
}

void mouseDown(MouseEvent const& e) override
{
if (!e.mods.isLeftButtonDown())
return;

showEditor(); // TODO: Do we even need to?
}

void textEditorReturnKeyPressed(TextEditor& ed) override
{
if (auto messObj = ptr.get<t_fake_messbox>()) {
Expand Down
3 changes: 0 additions & 3 deletions Source/Objects/ObjectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ class ObjectBase : public Component

virtual ObjectLabel* getLabel(int idx = 0);

// Should return current object text if applicable
// Currently only used to subsitute arguments in tooltips
// TODO: does that even work?
virtual String getText();

virtual bool canEdgeOverrideAspectRatio() { return false; }
Expand Down
1 change: 1 addition & 0 deletions Source/Sidebar/SearchPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class SearchPanel final : public Component
input.onTextChange = [this] {
patchTree.setFilterString(input.getText());
};


input.addKeyListener(this);
patchTree.addKeyListener(this);
Expand Down
2 changes: 1 addition & 1 deletion Tests/HelpfileFuzzTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ class HelpFileFuzzTest : public PlugDataUnitTest
}
}

//static constexpr bool recursive = false; TODO: implement this
//static constexpr bool recursive = false;
};

0 comments on commit d1dec3c

Please sign in to comment.