Skip to content

Commit 5fb25c9

Browse files
Merge pull request #1982 from kamomehettapi/fix/settings-menu-performance
improve menu opening performance
2 parents a2036e6 + 212a6f2 commit 5fb25c9

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Source/Dialogs/ThemeSettingsPanel.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,15 @@ class ThemeSettingsPanel : public SettingsDialogPanel
545545
void valueChanged(Value& v) override
546546
{
547547
if (v.refersToSameSourceAs(fontValue)) {
548+
auto previousFontName = Fonts::getCurrentFont().toString();
549+
548550
PlugDataLook::setDefaultFont(fontValue.toString());
549551
SettingsFile::getInstance()->setProperty("default_font", fontValue.getValue());
550-
pd->updateAllEditorsLNF();
552+
553+
bool changed = previousFontName != Fonts::getCurrentFont().toString();
554+
if (changed)
555+
pd->updateAllEditorsLNF();
556+
551557
return;
552558
}
553559

Source/PluginProcessor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,9 @@ pd::Patch::Ptr PluginProcessor::loadPatch(String patchText)
12961296

12971297
void PluginProcessor::setTheme(String themeToUse, bool force)
12981298
{
1299+
if (themeToUse == currentThemeName)
1300+
return;
1301+
12991302
auto oldThemeTree = settingsFile->getTheme(PlugDataLook::currentTheme);
13001303
auto themeTree = settingsFile->getTheme(themeToUse);
13011304
// Check if theme name is valid
@@ -1322,6 +1325,8 @@ void PluginProcessor::setTheme(String themeToUse, bool force)
13221325
if ((propertyState == 1) || (propertyState == 0 ? static_cast<int>(previousIoletGeom) != static_cast<int>(currentIoletGeom) : 0)) {
13231326
PluginEditor::updateIoletGeometryForAllObjects(this);
13241327
}
1328+
1329+
currentThemeName = themeToUse;
13251330
}
13261331

13271332
void PluginProcessor::updateAllEditorsLNF()

Source/PluginProcessor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class PluginProcessor final : public AudioProcessor
150150

151151
AtomicValue<float>* volume;
152152
ValueTree pluginModeTheme;
153+
String currentThemeName;
153154

154155
SettingsFile* settingsFile;
155156

0 commit comments

Comments
 (0)