Macro recorder screen has now separate CLEAR steps button and by default RECORD btn appends new steps instead of inserting new steps in front (before) of the first item. It is more logical to have separate CLEAR btn to avoid accidentally loosing the whole macro sequence.

This commit is contained in:
mika-n 2020-01-04 22:36:19 +02:00
parent 2476a3482d
commit 29bd7c869c
3 changed files with 19 additions and 1 deletions

View File

@ -39,6 +39,10 @@
<Button x:Name="recordBtn" Content="{lex:Loc RecordText}" Margin="0,10,0,0" Click="RecordBtn_Click" /> <Button x:Name="recordBtn" Content="{lex:Loc RecordText}" Margin="0,10,0,0" Click="RecordBtn_Click" />
<UniformGrid Rows="1" Columns="2" FirstColumn="1" Margin="0,10,0,0">
<Button x:Name="clearStepsBtn" Content="{lex:Loc Clear}" Margin="5,00,0,0" Click="ClearStepsBtn_Click" />
</UniformGrid>
<UniformGrid Rows="1" Margin="0,10,0,0"> <UniformGrid Rows="1" Margin="0,10,0,0">
<Button x:Name="loadPresetBtn" Content="Load Preset" Margin="0,0,5,0" Click="LoadPresetBtn_Click"> <Button x:Name="loadPresetBtn" Content="Load Preset" Margin="0,0,5,0" Click="LoadPresetBtn_Click">
<Button.ContextMenu> <Button.ContextMenu>

View File

@ -136,7 +136,8 @@ namespace DS4WinWPF.DS4Forms
recordBtn.Content = "Stop"; recordBtn.Content = "Stop";
if (recordBoxVM.MacroStepIndex == -1) if (recordBoxVM.MacroStepIndex == -1)
{ {
recordBoxVM.MacroSteps.Clear(); // Don't clear macro steps in RECORD button because nowadays there is a separate CLEAR button. RECORD btn without a selection appends new steps to existing macro sequence
//recordBoxVM.MacroSteps.Clear();
} }
else else
{ {
@ -192,6 +193,15 @@ namespace DS4WinWPF.DS4Forms
recordBoxVM.MacroStepIndex = -1; recordBoxVM.MacroStepIndex = -1;
} }
private void ClearStepsBtn_Click(object sender, RoutedEventArgs e)
{
if (!recordBoxVM.Recording)
{
recordBoxVM.MacroStepIndex = -1;
recordBoxVM.MacroSteps.Clear();
}
}
private void Enable_Controls(bool on) private void Enable_Controls(bool on)
{ {
macroListBox.IsEnabled = on; macroListBox.IsEnabled = on;
@ -201,6 +211,7 @@ namespace DS4WinWPF.DS4Forms
loadPresetBtn.IsEnabled = on; loadPresetBtn.IsEnabled = on;
savePresetBtn.IsEnabled = on; savePresetBtn.IsEnabled = on;
macroModeCombo.IsEnabled = on; macroModeCombo.IsEnabled = on;
clearStepsBtn.IsEnabled = on;
} }
private void ChangeLightbarAction() private void ChangeLightbarAction()

View File

@ -108,6 +108,9 @@ namespace DS4WinWPF.DS4Forms.ViewModels
} }
BindingOperations.EnableCollectionSynchronization(macroSteps, _colLockobj); BindingOperations.EnableCollectionSynchronization(macroSteps, _colLockobj);
// By default RECORD button appends new steps. User must select (click) an existing step to insert new steps in front of the selected step
this.MacroStepIndex = -1;
} }
public void LoadMacro() public void LoadMacro()