Skip to content

Commit e88f379

Browse files
committed
use the refresh() method to force an update to setPath()
1 parent 698270f commit e88f379

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Source/Components/PropertiesPanel.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ class PropertiesPanel : public Component {
973973
draggableNumber->setText(property.toString(), dontSendNotification);
974974
draggableNumber->setFont(draggableNumber->getFont().withHeight(14.5f));
975975
draggableNumber->setEditableOnClick(true);
976-
976+
977977
if (minimum != 0.0f)
978978
draggableNumber->setMinimum(minimum);
979979
if (maximum != 0.0f)
@@ -985,7 +985,7 @@ class PropertiesPanel : public Component {
985985
draggableNumber->onValueChange = [this](double const newValue){
986986
property = std::clamp(newValue, min, max);
987987
};
988-
988+
989989
draggableNumber->onReturnKey = [this](double const newValue) {
990990
property = std::clamp(newValue, min, max);
991991
};
@@ -1026,7 +1026,7 @@ class PropertiesPanel : public Component {
10261026

10271027
label->addMouseListener(this, true);
10281028
}
1029-
1029+
10301030
void valueChanged(Value& v) override
10311031
{
10321032
if constexpr (std::is_arithmetic_v<T>) {
@@ -1146,7 +1146,7 @@ class PropertiesPanel : public Component {
11461146
false, true, "", "", getTopLevelComponent());
11471147
};
11481148
}
1149-
1149+
11501150
void setPath(String path)
11511151
{
11521152
property = path;
@@ -1166,7 +1166,7 @@ class PropertiesPanel : public Component {
11661166
void paint(Graphics& g) override
11671167
{
11681168
PropertiesPanelProperty::paint(g);
1169-
1169+
11701170
g.setColour(findColour(PlugDataColour::panelTextColourId).withAlpha(0.8f));
11711171
g.setFont(Fonts::getDefaultFont().withHeight(14));
11721172
g.drawText(label, 90, 2, getWidth() - 120, getHeight() - 4, Justification::centredLeft);
@@ -1176,6 +1176,11 @@ class PropertiesPanel : public Component {
11761176
{
11771177
browseButton.setBounds(getLocalBounds().removeFromRight(getHeight()));
11781178
}
1179+
1180+
void refresh() override
1181+
{
1182+
setPath(property.toString());
1183+
}
11791184
};
11801185

11811186

Source/Heavy/WASMExporter.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ class WASMExporter : public ExporterBase {
99

1010
Value emsdkPathValue;
1111

12+
PropertiesPanelProperty* emsdkPathProperty;
13+
1214
WASMExporter(PluginEditor* editor, ExportingProgressView* exportingView)
1315
: ExporterBase(editor, exportingView)
1416
{
1517
PropertiesArray properties;
16-
properties.add(new PropertiesPanel::DirectoryPathComponent("EMSDK path", emsdkPathValue));
18+
emsdkPathProperty = new PropertiesPanel::DirectoryPathComponent("EMSDK path", emsdkPathValue);
19+
properties.add(emsdkPathProperty);
1720

1821
for (auto* property : properties) {
1922
property->setPreferredHeight(28);
@@ -56,6 +59,8 @@ class WASMExporter : public ExporterBase {
5659
} else {
5760
exportButton.setEnabled(false);
5861
}
62+
63+
emsdkPathProperty->refresh();
5964
}
6065

6166
bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override

0 commit comments

Comments
 (0)