Skip to content

Commit d20ac02

Browse files
Merge pull request #1968 from alcomposer/larger-new-open
Larger new open
2 parents ed51845 + d0899ed commit d20ac02

File tree

10 files changed

+242
-132
lines changed

10 files changed

+242
-132
lines changed

Resources/Fonts/IconFont.ttf

128 Bytes
Binary file not shown.

Source/Components/BouncingViewport.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class BouncingViewportAttachment : public MouseListener
2222
public:
2323
void mouseWheelMove(MouseEvent const& e, MouseWheelDetails const& wheel) override
2424
{
25+
if (!isBounceable)
26+
return;
27+
2528
// Protect against receiving the same even twice
2629
if (e.eventTime == lastScrollTime)
2730
return;
@@ -60,6 +63,11 @@ class BouncingViewportAttachment : public MouseListener
6063
update();
6164
}
6265

66+
void setBounce(bool shouldBounce)
67+
{
68+
isBounceable = shouldBounce;
69+
}
70+
6371
private:
6472
static int rescaleMouseWheelDistance(float distance) noexcept
6573
{
@@ -109,6 +117,7 @@ class BouncingViewportAttachment : public MouseListener
109117
bool wasSmooth = false;
110118
Point<float> offset = { 0, 0 };
111119
Time lastScrollTime;
120+
bool isBounceable = true;
112121
};
113122

114123
class BouncingViewport : public Viewport {
@@ -118,6 +127,12 @@ class BouncingViewport : public Viewport {
118127
{
119128
}
120129

130+
void setBounce(bool shouldBounce)
131+
{
132+
bouncer.setBounce(shouldBounce);
133+
}
134+
121135
private:
122136
BouncingViewportAttachment bouncer;
137+
123138
};

Source/Components/WelcomePanel.h

Lines changed: 213 additions & 126 deletions
Large diffs are not rendered by default.

Source/Constants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ struct Icons {
116116
inline static String const AlignVCentre = "9";
117117
inline static String const AlignVDistribute = "*";
118118

119+
inline static String const Home = CharPointer_UTF8("\x1F");
120+
119121
// ================== OBJECT ICONS ==================
120122

121123
// generic

Source/Dialogs/MainMenu.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "PluginEditor.h"
1010
#include "Utility/Autosave.h"
11+
#include "Components/WelcomePanel.h"
1112

1213
class MainMenu : public PopupMenu {
1314

@@ -44,8 +45,11 @@ class MainMenu : public PopupMenu {
4445
auto isActive = menuItems[2]->isActive = recentlyOpenedTree.getNumChildren() > 0;
4546
if (isActive) {
4647
recentlyOpened->addSeparator();
47-
recentlyOpened->addItem("Clear recently opened", [recentlyOpenedTree]() mutable {
48+
recentlyOpened->addItem("Clear recently opened", [recentlyOpenedTree, editor]() mutable {
4849
recentlyOpenedTree.removeAllChildren(nullptr);
50+
// Make sure to clear the recent items in the current welcome panel
51+
if (editor->welcomePanel)
52+
editor->welcomePanel->triggerAsyncUpdate();
4953
SettingsFile::getInstance()->reloadSettings();
5054
});
5155
}

Source/NVGSurface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void NVGSurface::initialise()
152152
nvgCreateFontMem(nvg, "Inter-Bold", (unsigned char*)BinaryData::InterBold_ttf, BinaryData::InterBold_ttfSize, 0);
153153
nvgCreateFontMem(nvg, "Inter-SemiBold", (unsigned char*)BinaryData::InterSemiBold_ttf, BinaryData::InterSemiBold_ttfSize, 0);
154154
nvgCreateFontMem(nvg, "Inter-Tabular", (unsigned char*)BinaryData::InterTabular_ttf, BinaryData::InterTabular_ttfSize, 0);
155-
nvgCreateFontMem(nvg, "icon_font-Regular", (unsigned char*)BinaryData::IconFont_ttf, BinaryData::IconFont_ttfSize, 0);
155+
nvgCreateFontMem(nvg, "plugdata_icon_font", (unsigned char*)BinaryData::IconFont_ttf, BinaryData::IconFont_ttfSize, 0);
156156

157157
invalidateAll();
158158
}

Source/Objects/NumboxTildeObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class NumboxTildeObject final : public ObjectBase
257257

258258
auto icon = mode ? Icons::ThinDown : Icons::Sine;
259259
auto iconBounds = Rectangle<int>(7, 3, getHeight(), getHeight());
260-
nvgFontFace(nvg, "icon_font-Regular");
260+
nvgFontFace(nvg, "plugdata_icon_font");
261261
nvgFontSize(nvg, 12.0f);
262262
nvgFillColor(nvg, convertColour(cnv->editor->getLookAndFeel().findColour(PlugDataColour::dataColourId)));
263263
nvgTextAlign(nvg, NVG_ALIGN_TOP | NVG_ALIGN_LEFT);

Source/PluginEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ PluginEditor::PluginEditor(PluginProcessor& p)
153153
, tabComponent(this)
154154
, pluginMode(nullptr)
155155
, touchSelectionHelper(std::make_unique<TouchSelectionHelper>(this))
156-
, recentlyOpenedPanelSelector(Icons::History, "Recent")
156+
, recentlyOpenedPanelSelector(Icons::Home, "Home")
157157
, libraryPanelSelector(Icons::ItemGrid, "Library")
158158
{
159159
keyboardLayout = OSUtils::getKeyboardLayout();

Source/Utility/Fonts.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ struct Fonts {
7070
fontHeight = bounds.getHeight() / 1.2f;
7171

7272
auto justification = centred ? Justification::centred : Justification::centredLeft;
73-
g.setFont(Fonts::getIconFont().withHeight(fontHeight));
73+
auto font = Fonts::getIconFont().withHeight(fontHeight);
74+
g.setFont(font);
7475
g.setColour(colour);
7576
g.drawText(icon, bounds, justification, false);
7677
}

Source/Utility/NanoVGGraphicsContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,10 @@ void NanoVGGraphicsContext::setFont(juce::Font const& f)
367367
{
368368
font = f;
369369
auto typefaceName = font.getTypefacePtr()->getName();
370+
370371
if (typefaceName.contains(" "))
371372
typefaceName = typefaceName.replace(" ", "-");
372-
else
373+
else if (font.getTypefaceStyle().isNotEmpty())
373374
typefaceName += "-" + font.getTypefaceStyle();
374375

375376
if (!loadedFonts.count(typefaceName)) {

0 commit comments

Comments
 (0)