Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Apr 4, 2022
1 parent 2940b47 commit a869799
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
6 changes: 2 additions & 4 deletions Source/Dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ struct SettingsComponent : public Component
g.fillRoundedRectangle(getLocalBounds().reduced(2).toFloat(), 3.0f);

g.setColour(highlightColour);
g.fillRect(2, 42, getWidth() - 4, 4);
g.fillRect(2, 44, getWidth() - 4, 4);

if (currentPanel > 0)
{
Expand All @@ -483,7 +483,7 @@ struct SettingsComponent : public Component
int toolbarPosition = 2;
for (auto& button : toolbarButtons)
{
button->setBounds(toolbarPosition, 0, 70, toolbarHeight);
button->setBounds(toolbarPosition, 2, 70, toolbarHeight);
toolbarPosition += 70;
}

Expand Down Expand Up @@ -529,8 +529,6 @@ struct SettingsDialog : public Component
addAndMakeVisible(closeButton.get());

settingsComponent.addMouseListener(this, false);



closeButton->onClick = [this]()
{
Expand Down
5 changes: 3 additions & 2 deletions Source/GUIObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ struct RadioComponent : public GUIComponent
if(isVertical) radioButtons[i]->setBounds(0, i * size, size, size);
else radioButtons[i]->setBounds(i * size, 0, size, size);
}

// Fix aspect ratio and
if(isVertical) {
if(getWidth() - Box::doubleMargin != size) {
Expand Down Expand Up @@ -1608,7 +1608,8 @@ struct RadioComponent : public GUIComponent

radioButtons[(int)gui.getValue()]->setToggleState(true, dontSendNotification);

box->updateBounds(false);
resized();
//box->updateBounds(false);
}

OwnedArray<TextButton> radioButtons;
Expand Down
4 changes: 3 additions & 1 deletion Source/Pd/PdInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ extern "C"
namespace pd
{



Instance::Instance(std::string const& symbol)
{
libpd_multi_init();
Expand Down Expand Up @@ -155,7 +157,7 @@ Instance::Instance(std::string const& symbol)
register_gui_triggers(static_cast<t_pdinstance*>(m_instance), this, gui_trigger, panel_trigger, synchronise_trigger);

libpd_set_verbose(0);

setThis();
}

Expand Down
21 changes: 15 additions & 6 deletions Source/Pd/PdPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,17 @@ std::vector<Object> Patch::getObjects(bool onlyGui) noexcept
std::unique_ptr<Object> Patch::createGraphOnParent(int x, int y)
{
t_pd* pdobject = nullptr;
std::atomic<bool> done = false;

instance->enqueueFunction(
[this, x, y, &pdobject]() mutable
[this, x, y, &pdobject, &done]() mutable
{
setCurrent();
pdobject = libpd_creategraphonparent(getPointer(), x, y);
done = true;
});

while (!pdobject)
while (!done)
{
instance->waitForStateUpdate();
}
Expand All @@ -216,14 +219,17 @@ std::unique_ptr<Object> Patch::createGraphOnParent(int x, int y)
std::unique_ptr<Object> Patch::createGraph(const String& name, int size, int x, int y)
{
t_pd* pdobject = nullptr;
std::atomic<bool> done = false;

instance->enqueueFunction(
[this, name, size, x, y, &pdobject]() mutable
[this, name, size, x, y, &pdobject, &done]() mutable
{
setCurrent();
pdobject = libpd_creategraph(getPointer(), name.toRawUTF8(), size, x, y);
done = true;
});

while (!pdobject)
while (!done)
{
instance->waitForStateUpdate();
}
Expand Down Expand Up @@ -304,14 +310,17 @@ std::unique_ptr<Object> Patch::createObject(const String& name, int x, int y, bo
}

t_pd* pdobject = nullptr;
std::atomic<bool> done = false;

instance->enqueueFunction(
[this, argc, argv, undoable, typesymbol, &pdobject]() mutable
[this, argc, argv, undoable, typesymbol, &pdobject, &done]() mutable
{
setCurrent();
pdobject = libpd_createobj(getPointer(), typesymbol, argc, argv.data(), undoable);
done = true;
});

while (!pdobject)
while (!done)
{
instance->waitForStateUpdate();
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Pd/PdPatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ class Patch
{"vsl", "15 128 0 127 0 0 empty empty empty 0 -9 0 10 #171717 #42a2c8 #ffffff 0 1"},
{"bng", "15 250 50 0 empty empty empty 17 7 0 10 #171717 #42a2c8 #ffffff"},
{"nbx", "3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #171717 #42a2c8 #ffffff 0 256"},
{"hradio", "24 1 0 8 empty empty empty 0 -8 0 10 #171717 #42a2c8 #ffffff 0"},
{"vradio", "24 1 0 8 empty empty empty 0 -8 0 10 #171717 #42a2c8 #ffffff 0"},
{"cnv", "15 100 60 empty empty empty 20 12 0 14 #171717 #404040"}
{"hradio", "16 1 0 8 empty empty empty 0 -8 0 10 #171717 #42a2c8 #ffffff 0"},
{"vradio", "16 1 0 8 empty empty empty 0 -8 0 10 #171717 #42a2c8 #ffffff 0"},
{"cnv", "15 100 60 empty empty empty 20 12 0 14 #171717 #ffffff"}
};

friend class Instance;
Expand Down
2 changes: 2 additions & 0 deletions Source/Standalone/PlugDataApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class PlugDataApp : public JUCEApplication
// For opening files with PlugData standalone
void anotherInstanceStarted(const String& commandLine) override
{

auto file = File(commandLine.upToFirstOccurrenceOf(" ", false, false));
if (file.existsAsFile())
{
Expand All @@ -75,6 +76,7 @@ class PlugDataApp : public JUCEApplication
}
}
}

}

virtual PlugDataWindow* createWindow()
Expand Down

0 comments on commit a869799

Please sign in to comment.