Skip to content

Commit

Permalink
Fix file parameter offset
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeoliphant committed Nov 25, 2024
1 parent 7ad5cee commit a4cd85d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions StompboxShared/Interface/PluginInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ protected UIElement CreateFileControl(PluginParameter parameter)
{
bool showOpenFolder = !StompboxClient.Instance.InClientMode;

int offset = (showOpenFolder ? 1 : 0);

FileInterface fileInterface = new FileInterface(showOpenFolder ? parameter.FilePath : null, parameter.EnumValues, foregroundColor)
{
HorizontalAlignment = EHorizontalAlignment.Stretch,
Expand All @@ -445,12 +443,12 @@ protected UIElement CreateFileControl(PluginParameter parameter)

fileInterface.SelectionChangedAction = delegate (int index)
{
parameter.Value = index - offset;
parameter.Value = index;

UpdateContentLayout();
};

fileInterface.SetSelectedIndex((int)parameter.Value + offset);
fileInterface.SetSelectedIndex((int)parameter.Value);

parameter.SetValue = delegate (double val)
{
Expand Down Expand Up @@ -1296,7 +1294,7 @@ public void SetSelectedIndex(int index)

if ((index < 0) || (index >= menuItems.Count))
{
button.Text = "---";
button.Text = NoSelectionText;
}
else
{
Expand Down Expand Up @@ -1352,7 +1350,7 @@ public FileInterface(string filePath, IList<string> enumValues, UIColor textColo

SetEnumValues(filePath, enumValues);

button = new TextButton("---")
button = new TextButton(NoSelectionText)
{
TextColor = textColor,
HorizontalAlignment = EHorizontalAlignment.Stretch,
Expand Down

0 comments on commit a4cd85d

Please sign in to comment.