Skip to content

Commit d549c4c

Browse files
committed
Improve info panel a bit
1 parent d82cb3f commit d549c4c

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ endif()
330330
list(APPEND PLUGDATA_COMPILE_DEFINITIONS JUCE_MODAL_LOOPS_PERMITTED=1)
331331

332332
if(CUSTOM_PLUGIN_NAME)
333-
list(APPEND PLUGDATA_COMPILE_DEFINITIONS PROJECT_NAME=${CUSTOM_PLUGIN_NAME} CUSTOM_PLUGIN=1)
333+
list(APPEND PLUGDATA_COMPILE_DEFINITIONS PROJECT_NAME=${CUSTOM_PLUGIN_NAME} COMPANY_NAME=${CUSTOM_COMPANY_NAME} CUSTOM_PLUGIN=1)
334334
set(STANDALONE_NAME ${CUSTOM_PLUGIN_NAME})
335335
set(INSTRUMENT_NAME ${CUSTOM_PLUGIN_NAME})
336336
set(FX_NAME ${CUSTOM_PLUGIN_NAME})

Source/PluginMode.h

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,59 @@ class PluginMode final : public Component
136136
{
137137
class InfoDialog : public Component
138138
{
139+
WidePanelButton revealPatchButton = WidePanelButton(Icons::OpenLink);
140+
139141
public:
140142
InfoDialog()
141143
{
142-
144+
revealPatchButton.setButtonText("View patch");
145+
addAndMakeVisible(revealPatchButton);
146+
revealPatchButton.onClick = [](){
147+
auto projectFolder = ProjectInfo::versionDataDir.getChildFile(JUCE_STRINGIFY(PROJECT_NAME));
148+
auto pdFiles = projectFolder.findChildFiles(File::findFiles, false, "*.pd");
149+
if(pdFiles.size())
150+
{
151+
pdFiles[0].revealToUser();
152+
}
153+
};
143154
}
144155

145156
void paint(Graphics& g) override
146157
{
158+
auto bounds = getLocalBounds();
159+
160+
auto pluginInfo = bounds.removeFromTop(54);
161+
auto pluginName = JUCE_STRINGIFY(PROJECT_NAME);
162+
auto companyName = JUCE_STRINGIFY(COMPANY_NAME);
163+
147164
g.setColour(findColour(PlugDataColour::panelTextColourId));
148-
g.drawText("Made with plugdata", getLocalBounds(), Justification::centred);
165+
g.setFont(Fonts::getBoldFont().withHeight(23.0f));
166+
g.drawText(pluginName, pluginInfo.removeFromTop(42.f), Justification::centred);
167+
168+
g.setFont(Fonts::getDefaultFont().withHeight(17.0f));
169+
g.drawText(String("by ") + companyName, pluginInfo.removeFromTop(18.f), Justification::centred);
170+
171+
// Colors & fonts
172+
auto textColour = findColour(PlugDataColour::objectSelectedOutlineColourId)
173+
.withAlpha(0.3f);
174+
175+
auto madeWithRect = bounds.removeFromTop(84).withSizeKeepingCentre(250, 84);
176+
auto logoRect = madeWithRect.removeFromLeft(68);
177+
g.setColour(textColour);
178+
g.setFont(Fonts::getIconFont().withHeight(42));
179+
g.drawText(Icons::PlugdataIconFilled, logoRect.translated(18, -2), Justification::right);
180+
181+
g.setFont(Fonts::getBoldFont().withHeight(23.0f));
182+
g.drawMultiLineText("made with\n plugdata", madeWithRect.getX() + 35, madeWithRect.getY() + 35, 220);
183+
}
184+
185+
void resized() override
186+
{
187+
revealPatchButton.setBounds(getLocalBounds().reduced(16).removeFromBottom(32));
149188
}
150189
};
151190

152-
auto* dialog = new Dialog(&editor->openedDialog, editor, 220, 160, true);
191+
auto* dialog = new Dialog(&editor->openedDialog, editor, 300, 190, true);
153192
auto* infoDialog = new InfoDialog();
154193
dialog->setViewedComponent(infoDialog);
155194
editor->openedDialog.reset(dialog);

Source/Utility/Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct ProjectInfo {
2424
static bool isStandalone;
2525
static bool isFx;
2626

27-
static inline char const* companyName = "plugdata";
27+
static inline char const* companyName = JUCE_STRINGIFY(COMPANY_NAME);
2828
static inline char const* versionString = PLUGDATA_VERSION;
2929

3030
static AudioDeviceManager* getDeviceManager();

0 commit comments

Comments
 (0)