Skip to content

Commit 20b5900

Browse files
committed
Make Heavy dialog and other dialogs more consistent in style, added help button to heavy dialog
1 parent 99ee10b commit 20b5900

File tree

12 files changed

+76
-30
lines changed

12 files changed

+76
-30
lines changed

Resources/Fonts/IconFont.ttf

80 Bytes
Binary file not shown.

Source/Constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct Icons {
6363
inline static const String History = "X";
6464
inline static const String Protection = "Y";
6565
inline static const String DevTools = "{";
66+
inline static const String Help = "\\";
6667

6768
inline static const String SavePatch = "Z";
6869
inline static const String ClosePatch = "[";

Source/Dialogs/Deken.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,10 @@ class Deken : public Component
527527
g.setColour(findColour(PlugDataColour::panelBackgroundColourId));
528528
g.fillRoundedRectangle(getLocalBounds().toFloat(), Corners::windowCornerRadius);
529529

530-
auto bounds = getLocalBounds().removeFromTop(40).toFloat();
530+
auto titlebarBounds = getLocalBounds().removeFromTop(40).toFloat();
531531

532532
Path p;
533-
p.addRoundedRectangle(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false);
533+
p.addRoundedRectangle(titlebarBounds.getX(), titlebarBounds.getY(), titlebarBounds.getWidth(), titlebarBounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false);
534534

535535
g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId));
536536
g.fillPath(p);
@@ -550,7 +550,7 @@ class Deken : public Component
550550
Fonts::drawFittedText(g, "Type to search for objects or libraries", 30, 40, getWidth() - 60, 30, findColour(PlugDataColour::panelTextColourId).withAlpha(0.5f), 1, 0.9f, 14);
551551
}
552552

553-
g.setColour(findColour(PlugDataColour::outlineColourId));
553+
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
554554
g.drawLine(0, 40, getWidth(), 40);
555555
g.drawLine(0, 70, getWidth(), 70);
556556
}

Source/Dialogs/ObjectBrowserDialog.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,11 +832,13 @@ class ObjectBrowserDialog : public Component {
832832
g.setColour(findColour(PlugDataColour::panelBackgroundColourId));
833833
g.fillRoundedRectangle(getLocalBounds().reduced(1).toFloat(), Corners::windowCornerRadius);
834834

835-
g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId));
835+
auto titlebarBounds = getLocalBounds().removeFromTop(40);
836+
837+
Path p;
838+
p.addRoundedRectangle(titlebarBounds.getX(), titlebarBounds.getY(), titlebarBounds.getWidth(), titlebarBounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false);
836839

837-
auto toolbarBounds = Rectangle<float>(1, 1, getWidth() - 2, 40);
838-
g.fillRoundedRectangle(toolbarBounds, Corners::windowCornerRadius);
839-
g.fillRect(toolbarBounds.withTrimmedTop(15.0f));
840+
g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId));
841+
g.fillPath(p);
840842

841843
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
842844
g.drawHorizontalLine(40, 0.0f, getWidth());

Source/Dialogs/ObjectReferenceDialog.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ class ObjectReferenceDialog : public Component {
213213
setVisible(false);
214214
};
215215

216-
backButton.setColour(TextButton::buttonColourId, Colours::transparentBlack);
217-
backButton.setColour(TextButton::buttonOnColourId, Colours::transparentBlack);
218216
backButton.getProperties().set("Style", "LargeIcon");
219217

220218
addAndMakeVisible(objectInfoPanel);
@@ -237,11 +235,13 @@ class ObjectReferenceDialog : public Component {
237235
g.setColour(findColour(PlugDataColour::panelBackgroundColourId));
238236
g.fillRoundedRectangle(getLocalBounds().reduced(1).toFloat(), Corners::windowCornerRadius);
239237

240-
g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId));
238+
auto titlebarBounds = getLocalBounds().removeFromTop(40).toFloat();
239+
240+
Path p;
241+
p.addRoundedRectangle(titlebarBounds.getX(), titlebarBounds.getY(), titlebarBounds.getWidth(), titlebarBounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false);
241242

242-
auto toolbarBounds = Rectangle<float>(1, 1, getWidth() - 2, 40);
243-
g.fillRoundedRectangle(toolbarBounds, Corners::windowCornerRadius);
244-
g.fillRect(toolbarBounds.withTrimmedTop(15.0f));
243+
g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId));
244+
g.fillPath(p);
245245

246246
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
247247
g.drawHorizontalLine(40, 0.0f, getWidth());

Source/Dialogs/PatchStorage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,11 +664,11 @@ struct PatchStorage : public Component
664664
if (input.getText().isEmpty()) {
665665
Fonts::drawFittedText(g, "Type to search for patches", 30, 40, getWidth() - 60, 30, findColour(PlugDataColour::panelTextColourId).withAlpha(0.5f), 1, 0.9f, 14);
666666
}
667-
g.setColour(findColour(PlugDataColour::outlineColourId));
667+
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
668668
g.drawLine(0, 70, getWidth(), 70);
669669
}
670670

671-
g.setColour(findColour(PlugDataColour::outlineColourId));
671+
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
672672
g.drawLine(0, 40, getWidth(), 40);
673673
}
674674

Source/Dialogs/SettingsDialog.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ class SettingsDialog : public Component {
147147
g.setColour(findColour(PlugDataColour::panelBackgroundColourId));
148148
g.fillRoundedRectangle(getLocalBounds().reduced(1).toFloat(), Corners::windowCornerRadius);
149149

150-
g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId));
150+
auto titlebarBounds = getLocalBounds().removeFromTop(toolbarHeight).toFloat();
151+
152+
Path p;
153+
p.addRoundedRectangle(titlebarBounds.getX(), titlebarBounds.getY(), titlebarBounds.getWidth(), titlebarBounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false);
151154

152-
auto toolbarBounds = Rectangle<float>(1, 1, getWidth() - 2, toolbarHeight);
153-
g.fillRoundedRectangle(toolbarBounds, Corners::windowCornerRadius);
154-
g.fillRect(toolbarBounds.withTrimmedTop(15.0f));
155+
g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId));
156+
g.fillPath(p);
155157

156158
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
157159
g.drawHorizontalLine(toolbarHeight, 0.0f, getWidth());
@@ -168,7 +170,7 @@ class SettingsDialog : public Component {
168170
AudioProcessor* processor;
169171
ComponentBoundsConstrainer constrainer;
170172

171-
static constexpr int toolbarHeight = 42;
173+
static constexpr int toolbarHeight = 40;
172174

173175
static inline std::atomic<int> lastPanel = 0;
174176
int currentPanel;

Source/Heavy/DaisyExporter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class DaisyExporter : public ExporterBase {
3737
exportButton.setVisible(false);
3838
addAndMakeVisible(flashButton);
3939

40+
flashButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelBackgroundColourId));
4041
flashButton.setColour(TextButton::textColourOnId, findColour(TextButton::textColourOffId));
4142

4243
exportTypeValue.addListener(this);

Source/Heavy/ExporterBase.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ struct ExporterBase : public Component
5151
, editor(pluginEditor)
5252
{
5353
addAndMakeVisible(exportButton);
54+
55+
exportButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelBackgroundColourId));
5456
exportButton.setColour(TextButton::textColourOnId, findColour(TextButton::textColourOffId));
5557

5658
Array<PropertiesPanel::Property*> properties;

Source/Heavy/HeavyExportDialog.cpp

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class ExporterSettingsPanel : public Component
7676
{
7777
auto listboxBounds = getLocalBounds().removeFromLeft(listBoxWidth);
7878

79-
g.setColour(findColour(PlugDataColour::outlineColourId));
79+
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
8080
g.drawLine(Line<float>(listboxBounds.getTopRight().toFloat(), listboxBounds.getBottomRight().toFloat()));
8181
}
8282

@@ -145,18 +145,31 @@ HeavyExportDialog::HeavyExportDialog(Dialog* dialog)
145145
: exportingView(new ExportingProgressView())
146146
, exporterPanel(new ExporterSettingsPanel(dynamic_cast<PluginEditor*>(dialog->parentComponent), exportingView.get()))
147147
, installer(new ToolchainInstaller(dynamic_cast<PluginEditor*>(dialog->parentComponent)))
148+
, infoButton(new TextButton(Icons::Help))
148149
{
149-
150150
hasToolchain = Toolchain::dir.exists();
151-
152-
// Create integer versions by removing the dots
153-
// Compare latest version on github to the currently installed version
154-
auto const latestVersion = URL("https://raw.githubusercontent.com/plugdata-team/plugdata-heavy-toolchain/main/VERSION").readEntireTextStream().trim().removeCharacters(".").getIntValue();
151+
155152

156153
// Don't do this relative to toolchain variable, that won't work on Windows
157154
auto const versionFile = ProjectInfo::appDataDir.getChildFile("Toolchain").getChildFile("VERSION");
158155
auto const installedVersion = versionFile.loadFileAsString().trim().removeCharacters(".").getIntValue();
159156

157+
158+
// Create integer versions by removing the dots
159+
// Compare latest version on github to the currently installed version
160+
int latestVersion;
161+
try {
162+
auto compatTable = JSON::parse(URL("https://raw.githubusercontent.com/plugdata-team/plugdata-heavy-toolchain/main/COMPATIBILITY").readEntireTextStream());
163+
// Get latest version
164+
165+
latestVersion = compatTable.getDynamicObject()->getProperty(String(ProjectInfo::versionString).upToFirstOccurrenceOf("-", false, false)).toString().removeCharacters(".").getIntValue();
166+
}
167+
// Network error, JSON error or empty version string somehow
168+
catch (...) {
169+
latestVersion = installedVersion;
170+
return;
171+
}
172+
160173
if (hasToolchain && latestVersion > installedVersion) {
161174
installer->needsUpdate = true;
162175
hasToolchain = false;
@@ -168,6 +181,12 @@ HeavyExportDialog::HeavyExportDialog(Dialog* dialog)
168181

169182
exportingView->setAlwaysOnTop(true);
170183

184+
infoButton->getProperties().set("Style", "LargeIcon");
185+
infoButton->onClick = [](){
186+
URL("https://wasted-audio.github.io/hvcc/docs/01.introduction.html#what-is-heavy").launchInDefaultBrowser();
187+
};
188+
addAndMakeVisible(*infoButton);
189+
171190
installer->toolchainInstalledCallback = [this]() {
172191
hasToolchain = true;
173192
exporterPanel->setVisible(true);
@@ -191,12 +210,29 @@ void HeavyExportDialog::paint(Graphics& g)
191210
{
192211
g.setColour(findColour(PlugDataColour::panelBackgroundColourId));
193212
g.fillRoundedRectangle(getLocalBounds().toFloat(), Corners::windowCornerRadius);
213+
214+
auto titlebarBounds = getLocalBounds().removeFromTop(40);
215+
216+
Path p;
217+
p.addRoundedRectangle(titlebarBounds.getX(), titlebarBounds.getY(), titlebarBounds.getWidth(), titlebarBounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false);
218+
219+
g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId));
220+
g.fillPath(p);
221+
222+
Fonts::drawStyledText(g, "Compiler", Rectangle<float>(0.0f, 4.0f, getWidth(), 32.0f), findColour(PlugDataColour::panelTextColourId), Semibold, 15, Justification::centred);
223+
}
224+
225+
void HeavyExportDialog::paintOverChildren(Graphics& g)
226+
{
227+
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
228+
g.drawHorizontalLine(40, 0.0f, getWidth());
194229
}
195230

196231
void HeavyExportDialog::resized()
197232
{
198-
auto b = getLocalBounds();
233+
auto b = getLocalBounds().withTrimmedTop(40);
199234
exporterPanel->setBounds(b);
200235
installer->setBounds(b);
201236
exportingView->setBounds(b);
237+
infoButton->setBounds(Rectangle<int>(40, 40));
202238
}

0 commit comments

Comments
 (0)