Skip to content

Commit

Permalink
Added preset delete button
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeoliphant committed Jul 16, 2024
1 parent 672ad28 commit 5f0215d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dependencies/stompbox
16 changes: 16 additions & 0 deletions StompboxShared/Interface/DAWInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ public DAWInterface()
DoSavePresetAs();
}
});
programHStack2.Children.Add(new TextButton("Delete")
{
ClickAction = delegate
{
if (currentProgramInterface.SelectedIndex != -1)
{
Layout.Current.ShowConfirmationPopup("Are you sure you want to\ndelete this preset?",
delegate
{
StompboxClient.Instance.SendCommand("DeletePreset " + currentProgramInterface.SelectedIndexValue);

StompboxClient.Instance.UpdateProgram();
});
}
}
});

HorizontalStack programHStack3 = new HorizontalStack() { ChildSpacing = 10, HorizontalAlignment = EHorizontalAlignment.Center }; ;
programStack.Children.Add(programHStack3);
Expand Down
16 changes: 16 additions & 0 deletions StompboxShared/Interface/MobileInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ public MobileInterface()
{
ClickAction = DoSavePresetAs
});
programHStack2.Children.Add(new TextButton("Delete")
{
ClickAction = delegate
{
if (currentProgramInterface.SelectedIndex != -1)
{
Layout.Current.ShowConfirmationPopup("Are you sure you want to\ndelete this preset?",
delegate
{
StompboxClient.Instance.SendCommand("DeletePreset " + currentProgramInterface.SelectedIndexValue);

StompboxClient.Instance.UpdateProgram();
});
}
}
});

HorizontalStack programHStack3 = new HorizontalStack() { ChildSpacing = 10, HorizontalAlignment = EHorizontalAlignment.Center }; ;
programStack.Children.Add(programHStack3);
Expand Down
7 changes: 5 additions & 2 deletions StompboxShared/StompboxClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ void ConnectCallback(bool result)

public void UpdatePresets()
{
#if !STOMPBOXREMOTE
#if STOMPBOXREMOTE
Instance.SendCommand("List Presets");
#else
SetPresetNames(new List<String>(processorWrapper.GetPresets().Trim().Split(' ')));

SuppressCommandUpdates = true;
Expand All @@ -240,9 +242,10 @@ public void UpdatePresets()

public void UpdateProgram()
{
UpdatePresets();

if (!InClientMode)
{
UpdatePresets();
UpdateUI();
}
else
Expand Down

0 comments on commit 5f0215d

Please sign in to comment.