Skip to content

Commit

Permalink
Fix plugin removal in non-DAW mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeoliphant committed May 10, 2024
1 parent 1ba6352 commit 2b3d241
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion StompboxHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Program
[STAThread]
static void Main(string[] args)
{
StompboxGame.DAWMode = true;
StompboxGame.DAWMode = false;

StompboxPlugin plugin = new StompboxPlugin();

Expand Down
4 changes: 2 additions & 2 deletions StompboxPlugin/StompboxPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public override void Initialize()
}
else
{
EditorWidth = 540;
EditorHeight = 960;
EditorWidth = 378;
EditorHeight = 672;
}


Expand Down
4 changes: 2 additions & 2 deletions StompboxShared/Interface/MainInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public MainInterface()
};
Children.Add(vStack);

topUIStack = new HorizontalStack { HorizontalAlignment = EHorizontalAlignment.Stretch, DesiredHeight = 400 };
topUIStack = new HorizontalStack { HorizontalAlignment = EHorizontalAlignment.Stretch};
vStack.Children.Add(topUIStack);

programStack = new VerticalStack { HorizontalAlignment = EHorizontalAlignment.Stretch, VerticalAlignment = EVerticalAlignment.Center };
Expand Down Expand Up @@ -433,7 +433,7 @@ void AddAmpPlugin(IAudioPlugin plugin, string slotName)
}
else
{
ampStack.Children.Add(new MiniPluginButton(plugin)
ampStack.Children.Add(new MiniPluginInterface(plugin)
{
ClickAction = delegate { MainInterface.Instance.SetSelectedPlugin(plugin, null); }
});
Expand Down
33 changes: 18 additions & 15 deletions StompboxShared/Interface/PluginInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void SetChain(List<IAudioPlugin> plugins)
}
else
{
pluginStack.Children.Add(new MiniPluginButton(plugin) { ClickAction = delegate { MainInterface.Instance.SetSelectedPlugin(plugin, this); } });
pluginStack.Children.Add(new MiniPluginInterface(plugin) { ClickAction = delegate { MainInterface.Instance.SetSelectedPlugin(plugin, this); } });
}
}
}
Expand Down Expand Up @@ -144,7 +144,7 @@ void AddPlugin()
}
else
{
pluginStack.Children.Add(new MiniPluginButton(newPlugin)
pluginStack.Children.Add(new MiniPluginInterface(newPlugin)
{
ClickAction = delegate
{
Expand Down Expand Up @@ -178,7 +178,7 @@ public PluginFlipList(List<IAudioPlugin> plugins)

foreach (IAudioPlugin plugin in plugins)
{
Children.Add(new MiniPluginButton(plugin)
Children.Add(new MiniPluginInterface(plugin)
{
ClickAction = delegate
{
Expand Down Expand Up @@ -456,20 +456,10 @@ protected UIElement CreateIntControl(PluginParameter parameter)
}
}

public class MiniPluginButton : Button
{
public MiniPluginButton(IAudioPlugin plugin)
{
VerticalAlignment = EVerticalAlignment.Stretch;

MiniPluginInterface pluginInterface = new MiniPluginInterface(plugin);

PressedElement = UnpressedElement = pluginInterface;
}
}

public class MiniPluginInterface : PluginInterfaceBase
{
public Action ClickAction { get; set; }

protected float minWidth = 220;

public MiniPluginInterface(IAudioPlugin plugin)
Expand Down Expand Up @@ -541,6 +531,19 @@ protected override void AddControls(Dock dock)
}
}
}

public override bool HandleTouch(in Touch touch)
{
if (touch.TouchState == ETouchState.Released)
{
if (ClickAction != null)
ClickAction();

return true;
}

return base.HandleTouch(touch);
}
}

public class PluginInterface : PluginInterfaceBase
Expand Down

0 comments on commit 2b3d241

Please sign in to comment.