From 20b59000629f0ee5eb3969ef6776a15fd7320123 Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Wed, 4 Oct 2023 04:04:06 +0200 Subject: [PATCH] Make Heavy dialog and other dialogs more consistent in style, added help button to heavy dialog --- Resources/Fonts/IconFont.ttf | Bin 57992 -> 58072 bytes Source/Constants.h | 1 + Source/Dialogs/Deken.h | 6 +-- Source/Dialogs/ObjectBrowserDialog.h | 10 +++-- Source/Dialogs/ObjectReferenceDialog.h | 12 +++--- Source/Dialogs/PatchStorage.h | 4 +- Source/Dialogs/SettingsDialog.h | 12 +++--- Source/Heavy/DaisyExporter.h | 1 + Source/Heavy/ExporterBase.h | 2 + Source/Heavy/HeavyExportDialog.cpp | 50 +++++++++++++++++++++---- Source/Heavy/HeavyExportDialog.h | 4 +- Source/Heavy/Toolchain.h | 4 +- 12 files changed, 76 insertions(+), 30 deletions(-) diff --git a/Resources/Fonts/IconFont.ttf b/Resources/Fonts/IconFont.ttf index 2e2419cde7f98216e8e99eb30c3c18de2a46b039..1340e38b8a3b9b97670a93aedff9fc797fd75833 100644 GIT binary patch delta 1097 zcmX|AZA@EL7=F*a{U8YCW4A4|UB7?=j*Yf-rQ@rFOvbRK`+#m#2JK3rAcY3XRw`?e zZBW_f2p0@nmSt*8)TlpbRelh+ATxw4hA_hX(G=y!qGs`*NYrpWt{NXVf0t5i*Fa{)?s;_T0KiGDi2iRG{s>E`(RNI>6dLIB`4eU;j!}~06P7c7@ z!`fZvC7&D=#0UUq7ROoLjv+6@;7+g;#ePb6-$>W}lXFintpeDbb-Ns$${*tz9E;(l zce`C72gk@V;ARvS^4%VvpWoOl!TuruS=%?@bWH!!A;KHXW9i~quJ22#nik|NSY}exYq2zFQ!1z7(Qb$JB?;s<8#&xj$UBPMsf2t#f zHFPE_=dLGH*XbtoIWp6KqcXMyr&?$oaT^s!9uemV;Vd33@v|hr0zXC(WMU!Tx5#>BY-;8KPe%BXIj)cxf-e z@JpJ+j{rOgLVw5!hx(`;zLmcsNEI{*9tc5LE4(IL%bCcD<)-8|<-V8un@A<{iWbCn z@w`MTX_Lec<{#XWiln{L85t!Tlh@}NAfm{G)(2BlZ|v2r)>c%D6PHGiz2s34${ ztHP=$g>8lVMe*X!;-y22B}9p~#9Fd&c<}J@k(p4by>zy8Rc%w>SMO++v=!Q~${NaI zI#aozJZO0JSn9Fyij>OZm9Z*c)k-y0eWrT4hN$t?rMz~xzM_8TMBRx`8+Z+iCm+3@ zYBHHdO&eyl`9;&NW%<<1>6>Tf&vrJqH!rp{wT!lGSUJ`@>$vsTbN=)Ft*lnBjb-!M z3SYe8ZcA(1x?sAn+kUUZ;4nC6IwdY!SGZf$9d$4C_)SQOSeU*i#>3u;6P0~SO!tM*Nb1lp*@(%GmJ(V-ewlFuyI}ujy zh%iJ#G2(aUMt{JoD9T6 zSkvl{>hwlbgO2LZSE`!QSXA6}|;eniNu1u59qbS~gR2Lalo4-Ko^jiE1GDhmRpAia# WUo?RaoVfb1y|vb!#Qz`Au;w4{207LM delta 1065 zcmYjQeN0nV6hHSpTAGCnaO($9N-5<-K|Y;)tQ2IlR4hfMMLugwDLjwLP0y1$Ec#j|?#fjNWGux=bRZdTM* zd~Rwz*jYJ$Xxp4-?l&)2ja#Owy@&Nj3XYc7L|Nakwpw>=X|{gbJ=C#WU1PjN(1, 1, getWidth() - 2, 40); - g.fillRoundedRectangle(toolbarBounds, Corners::windowCornerRadius); - g.fillRect(toolbarBounds.withTrimmedTop(15.0f)); + g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId)); + g.fillPath(p); g.setColour(findColour(PlugDataColour::toolbarOutlineColourId)); g.drawHorizontalLine(40, 0.0f, getWidth()); diff --git a/Source/Dialogs/ObjectReferenceDialog.h b/Source/Dialogs/ObjectReferenceDialog.h index 56a44161f..4cc474ab1 100644 --- a/Source/Dialogs/ObjectReferenceDialog.h +++ b/Source/Dialogs/ObjectReferenceDialog.h @@ -213,8 +213,6 @@ class ObjectReferenceDialog : public Component { setVisible(false); }; - backButton.setColour(TextButton::buttonColourId, Colours::transparentBlack); - backButton.setColour(TextButton::buttonOnColourId, Colours::transparentBlack); backButton.getProperties().set("Style", "LargeIcon"); addAndMakeVisible(objectInfoPanel); @@ -237,11 +235,13 @@ class ObjectReferenceDialog : public Component { g.setColour(findColour(PlugDataColour::panelBackgroundColourId)); g.fillRoundedRectangle(getLocalBounds().reduced(1).toFloat(), Corners::windowCornerRadius); - g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId)); + auto titlebarBounds = getLocalBounds().removeFromTop(40).toFloat(); + + Path p; + p.addRoundedRectangle(titlebarBounds.getX(), titlebarBounds.getY(), titlebarBounds.getWidth(), titlebarBounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false); - auto toolbarBounds = Rectangle(1, 1, getWidth() - 2, 40); - g.fillRoundedRectangle(toolbarBounds, Corners::windowCornerRadius); - g.fillRect(toolbarBounds.withTrimmedTop(15.0f)); + g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId)); + g.fillPath(p); g.setColour(findColour(PlugDataColour::toolbarOutlineColourId)); g.drawHorizontalLine(40, 0.0f, getWidth()); diff --git a/Source/Dialogs/PatchStorage.h b/Source/Dialogs/PatchStorage.h index a6a25be90..dd454cd95 100644 --- a/Source/Dialogs/PatchStorage.h +++ b/Source/Dialogs/PatchStorage.h @@ -664,11 +664,11 @@ struct PatchStorage : public Component if (input.getText().isEmpty()) { Fonts::drawFittedText(g, "Type to search for patches", 30, 40, getWidth() - 60, 30, findColour(PlugDataColour::panelTextColourId).withAlpha(0.5f), 1, 0.9f, 14); } - g.setColour(findColour(PlugDataColour::outlineColourId)); + g.setColour(findColour(PlugDataColour::toolbarOutlineColourId)); g.drawLine(0, 70, getWidth(), 70); } - g.setColour(findColour(PlugDataColour::outlineColourId)); + g.setColour(findColour(PlugDataColour::toolbarOutlineColourId)); g.drawLine(0, 40, getWidth(), 40); } diff --git a/Source/Dialogs/SettingsDialog.h b/Source/Dialogs/SettingsDialog.h index a8cf2c66d..37b17177c 100644 --- a/Source/Dialogs/SettingsDialog.h +++ b/Source/Dialogs/SettingsDialog.h @@ -147,11 +147,13 @@ class SettingsDialog : public Component { g.setColour(findColour(PlugDataColour::panelBackgroundColourId)); g.fillRoundedRectangle(getLocalBounds().reduced(1).toFloat(), Corners::windowCornerRadius); - g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId)); + auto titlebarBounds = getLocalBounds().removeFromTop(toolbarHeight).toFloat(); + + Path p; + p.addRoundedRectangle(titlebarBounds.getX(), titlebarBounds.getY(), titlebarBounds.getWidth(), titlebarBounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false); - auto toolbarBounds = Rectangle(1, 1, getWidth() - 2, toolbarHeight); - g.fillRoundedRectangle(toolbarBounds, Corners::windowCornerRadius); - g.fillRect(toolbarBounds.withTrimmedTop(15.0f)); + g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId)); + g.fillPath(p); g.setColour(findColour(PlugDataColour::toolbarOutlineColourId)); g.drawHorizontalLine(toolbarHeight, 0.0f, getWidth()); @@ -168,7 +170,7 @@ class SettingsDialog : public Component { AudioProcessor* processor; ComponentBoundsConstrainer constrainer; - static constexpr int toolbarHeight = 42; + static constexpr int toolbarHeight = 40; static inline std::atomic lastPanel = 0; int currentPanel; diff --git a/Source/Heavy/DaisyExporter.h b/Source/Heavy/DaisyExporter.h index e325a36cc..789f6a77e 100644 --- a/Source/Heavy/DaisyExporter.h +++ b/Source/Heavy/DaisyExporter.h @@ -37,6 +37,7 @@ class DaisyExporter : public ExporterBase { exportButton.setVisible(false); addAndMakeVisible(flashButton); + flashButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelBackgroundColourId)); flashButton.setColour(TextButton::textColourOnId, findColour(TextButton::textColourOffId)); exportTypeValue.addListener(this); diff --git a/Source/Heavy/ExporterBase.h b/Source/Heavy/ExporterBase.h index dc10dd8eb..218686e72 100644 --- a/Source/Heavy/ExporterBase.h +++ b/Source/Heavy/ExporterBase.h @@ -51,6 +51,8 @@ struct ExporterBase : public Component , editor(pluginEditor) { addAndMakeVisible(exportButton); + + exportButton.setColour(TextButton::buttonColourId, findColour(PlugDataColour::panelBackgroundColourId)); exportButton.setColour(TextButton::textColourOnId, findColour(TextButton::textColourOffId)); Array properties; diff --git a/Source/Heavy/HeavyExportDialog.cpp b/Source/Heavy/HeavyExportDialog.cpp index a43ab5202..23f70de7a 100644 --- a/Source/Heavy/HeavyExportDialog.cpp +++ b/Source/Heavy/HeavyExportDialog.cpp @@ -76,7 +76,7 @@ class ExporterSettingsPanel : public Component { auto listboxBounds = getLocalBounds().removeFromLeft(listBoxWidth); - g.setColour(findColour(PlugDataColour::outlineColourId)); + g.setColour(findColour(PlugDataColour::toolbarOutlineColourId)); g.drawLine(Line(listboxBounds.getTopRight().toFloat(), listboxBounds.getBottomRight().toFloat())); } @@ -145,18 +145,31 @@ HeavyExportDialog::HeavyExportDialog(Dialog* dialog) : exportingView(new ExportingProgressView()) , exporterPanel(new ExporterSettingsPanel(dynamic_cast(dialog->parentComponent), exportingView.get())) , installer(new ToolchainInstaller(dynamic_cast(dialog->parentComponent))) + , infoButton(new TextButton(Icons::Help)) { - hasToolchain = Toolchain::dir.exists(); - - // Create integer versions by removing the dots - // Compare latest version on github to the currently installed version - auto const latestVersion = URL("https://raw.githubusercontent.com/plugdata-team/plugdata-heavy-toolchain/main/VERSION").readEntireTextStream().trim().removeCharacters(".").getIntValue(); + // Don't do this relative to toolchain variable, that won't work on Windows auto const versionFile = ProjectInfo::appDataDir.getChildFile("Toolchain").getChildFile("VERSION"); auto const installedVersion = versionFile.loadFileAsString().trim().removeCharacters(".").getIntValue(); + + // Create integer versions by removing the dots + // Compare latest version on github to the currently installed version + int latestVersion; + try { + auto compatTable = JSON::parse(URL("https://raw.githubusercontent.com/plugdata-team/plugdata-heavy-toolchain/main/COMPATIBILITY").readEntireTextStream()); + // Get latest version + + latestVersion = compatTable.getDynamicObject()->getProperty(String(ProjectInfo::versionString).upToFirstOccurrenceOf("-", false, false)).toString().removeCharacters(".").getIntValue(); + } + // Network error, JSON error or empty version string somehow + catch (...) { + latestVersion = installedVersion; + return; + } + if (hasToolchain && latestVersion > installedVersion) { installer->needsUpdate = true; hasToolchain = false; @@ -168,6 +181,12 @@ HeavyExportDialog::HeavyExportDialog(Dialog* dialog) exportingView->setAlwaysOnTop(true); + infoButton->getProperties().set("Style", "LargeIcon"); + infoButton->onClick = [](){ + URL("https://wasted-audio.github.io/hvcc/docs/01.introduction.html#what-is-heavy").launchInDefaultBrowser(); + }; + addAndMakeVisible(*infoButton); + installer->toolchainInstalledCallback = [this]() { hasToolchain = true; exporterPanel->setVisible(true); @@ -191,12 +210,29 @@ void HeavyExportDialog::paint(Graphics& g) { g.setColour(findColour(PlugDataColour::panelBackgroundColourId)); g.fillRoundedRectangle(getLocalBounds().toFloat(), Corners::windowCornerRadius); + + auto titlebarBounds = getLocalBounds().removeFromTop(40); + + Path p; + p.addRoundedRectangle(titlebarBounds.getX(), titlebarBounds.getY(), titlebarBounds.getWidth(), titlebarBounds.getHeight(), Corners::largeCornerRadius, Corners::largeCornerRadius, true, true, false, false); + + g.setColour(findColour(PlugDataColour::toolbarBackgroundColourId)); + g.fillPath(p); + + Fonts::drawStyledText(g, "Compiler", Rectangle(0.0f, 4.0f, getWidth(), 32.0f), findColour(PlugDataColour::panelTextColourId), Semibold, 15, Justification::centred); +} + +void HeavyExportDialog::paintOverChildren(Graphics& g) +{ + g.setColour(findColour(PlugDataColour::toolbarOutlineColourId)); + g.drawHorizontalLine(40, 0.0f, getWidth()); } void HeavyExportDialog::resized() { - auto b = getLocalBounds(); + auto b = getLocalBounds().withTrimmedTop(40); exporterPanel->setBounds(b); installer->setBounds(b); exportingView->setBounds(b); + infoButton->setBounds(Rectangle(40, 40)); } diff --git a/Source/Heavy/HeavyExportDialog.h b/Source/Heavy/HeavyExportDialog.h index e20fe69c6..30bf0edd1 100644 --- a/Source/Heavy/HeavyExportDialog.h +++ b/Source/Heavy/HeavyExportDialog.h @@ -15,13 +15,15 @@ class HeavyExportDialog : public Component { std::unique_ptr exportingView; std::unique_ptr installer; std::unique_ptr exporterPanel; - + std::unique_ptr infoButton; + public: explicit HeavyExportDialog(Dialog* dialog); ~HeavyExportDialog() override; void paint(Graphics& g) override; + void paintOverChildren(Graphics& g) override; void resized() override; }; diff --git a/Source/Heavy/Toolchain.h b/Source/Heavy/Toolchain.h index e6909d8e4..9efa0e2ae 100644 --- a/Source/Heavy/Toolchain.h +++ b/Source/Heavy/Toolchain.h @@ -215,8 +215,8 @@ struct ToolchainInstaller : public Component float downloadBarBgHeight = 11.0f; float downloadBarHeight = downloadBarBgHeight - 3.0f; - auto downloadBarBg = Rectangle(90.0f, 300.0f - (downloadBarBgHeight * 0.5), width, downloadBarBgHeight); - auto downloadBar = Rectangle(91.5f, 300.0f - (downloadBarHeight * 0.5), progress, downloadBarHeight); + auto downloadBarBg = Rectangle(90.0f, 250.0f - (downloadBarBgHeight * 0.5), width, downloadBarBgHeight); + auto downloadBar = Rectangle(91.5f, 250.0f - (downloadBarHeight * 0.5), progress, downloadBarHeight); g.setColour(findColour(PlugDataColour::panelTextColourId)); PlugDataLook::fillSmoothedRectangle(g, downloadBarBg, Corners::defaultCornerRadius);