Skip to content

Commit

Permalink
Add text search on all ComboBoxes (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonko0493 authored Nov 26, 2024
1 parent 648a326 commit 8abcbb6
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 19 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Serial Loops PR
run-name: PR for ${{ github.actor }} - ${{ github.ref_name }}
on:
push:
branches:
- 'main'
- 'Avalonia'

jobs:
build_test:
if: github.repository == 'haroohie-club'
strategy:
matrix:
platform:
- os: ubuntu-latest
targetFramework: net8.0
container: 'ghcr.io/haroohie-club/chokuretsu-devkitarm:main'
- os: macos-latest
targetFramework: net8.0
container: ''
- os: windows-latest
targetFramework: net8.0-windows
container: ''
runs-on: ${{ matrix.platform.os }}
container: ${{ matrix.platform.container }}
steps:
- name: Check out
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: '8.0.x'
- name: Build project
run: dotnet build src/SerialLoops/SerialLoops.csproj -f ${{ matrix.platform.targetFramework }}
- name: Run tests
run: dotnet test test/SerialLoops.Tests.Headless/SerialLoops.Tests.Headless.csproj -f ${{ matrix.platform.targetFramework }}
env:
ROM_URI: ${{ secrets.CHOKU_ROM_URI }}
2 changes: 1 addition & 1 deletion src/SerialLoops.Lib/Items/CharacterItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ public class NameplateProperties(string name, SKColor nameColor, SKColor plateCo
public SKColor PlateColor { get; set; } = plateColor;
public SKColor OutlineColor { get; set; } = outlineColor;
public bool HasOutline { get; set; } = hasOutline;
}
}
3 changes: 2 additions & 1 deletion src/SerialLoops.Lib/Items/GroupSelectionItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class GroupSelectionItem : Item
{
public ScenarioSelection Selection { get; set; }
public int Index { get; set; }
public string TextSearch => $"{Index + 1}";

public GroupSelectionItem(ScenarioSelection selection, int index, Project project) : base($"Selection {index + 1}", ItemType.Group_Selection)
{
Expand All @@ -17,4 +18,4 @@ public GroupSelectionItem(ScenarioSelection selection, int index, Project projec
public override void Refresh(Project project, ILogger log)
{
}
}
}
9 changes: 6 additions & 3 deletions src/SerialLoops/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:mintoolbarthemes="using:MiniToolbar.Avalonia.Themes"
xmlns:dialoghost="using:DialogHostAvalonia"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>
Expand All @@ -24,7 +24,7 @@
<NativeMenuItem Header="{x:Static assets:Strings.View__Logs}" Click="Logs_Click"/>
</NativeMenu>
</NativeMenu.Menu>

<Application.Styles>
<FluentTheme />
<dialoghost:DialogHostStyles />
Expand All @@ -50,6 +50,9 @@
<Style Selector="TextBlock.link:disabled">
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=DisabledLinkColor}"/>
</Style>
<Style Selector="ComboBox">
<Setter Property="IsTextSearchEnabled" Value="True"/>
</Style>
</Application.Styles>

<Application.Resources>
Expand All @@ -70,5 +73,5 @@
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Application.Resources>

</Application>
2 changes: 1 addition & 1 deletion src/SerialLoops/SerialLoops.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.2.0" />
<PackageReference Include="Avalonia.Controls.TreeDataGrid" Version="11.0.10" />
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.2.0"/>
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.2.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
<PackageReference Include="Avalonia.Labs.Controls" Version="11.2.0" />
<PackageReference Include="Avalonia.Labs.Panels" Version="11.2.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public AddScenarioCommandDialogViewModel()
CreateCommand = ReactiveCommand.Create<AddScenarioCommandDialog>((dialog) => dialog.Close(SelectedVerb));
CancelCommand = ReactiveCommand.Create<AddScenarioCommandDialog>((dialog) => dialog.Close());
}
}
}
4 changes: 2 additions & 2 deletions src/SerialLoops/ViewModels/Editors/ScenarioEditorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public ScenarioEditorViewModel(ScenarioItem scenario, MainWindowViewModel window
private async void Add()
{
int selectedIndex = Math.Min(_scenario.Scenario.Commands.Count - 1, Commands.IndexOf(SelectedCommand));
ScenarioVerb? newVerb = await new AddScenarioCommandDialog() { DataContext = new AddScenarioCommandDialogViewModel() }.ShowDialog<ScenarioVerb>(_window.Window);
ScenarioVerb? newVerb = await new AddScenarioCommandDialog() { DataContext = new AddScenarioCommandDialogViewModel() }.ShowDialog<ScenarioVerb?>(_window.Window);
if (newVerb is not null)
{
int param = newVerb switch
Expand Down Expand Up @@ -147,4 +147,4 @@ public ScenarioCommandEditorViewModel GetScenarioCommandEditor(PrettyScenarioCom
_ => new ScenarioCommandEditorViewModel(command, _window.EditorTabs),
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ private void UpdateCommandViewModel()
CommandVerb.SCREEN_FADEIN => new ScreenFadeInScriptCommandEditorViewModel(_selectedCommand, this),
CommandVerb.SCREEN_FADEOUT => new ScreenFadeOutScriptCommandEditorViewModel(_selectedCommand, this),
CommandVerb.SCREEN_FLASH => new ScreenFlashScriptCommandEditorViewModel(_selectedCommand, this),
CommandVerb.SND_PLAY => new SndPlayScriptCommandEditorViewModel(_selectedCommand, this, _window),
CommandVerb.REMOVED => new EmptyScriptCommandEditorViewModel(_selectedCommand, this),
CommandVerb.SND_STOP => new EmptyScriptCommandEditorViewModel(_selectedCommand, this),
CommandVerb.BGM_PLAY => new BgmPlayScriptCommandEditorViewModel(_selectedCommand, this, _window),
Expand Down
9 changes: 7 additions & 2 deletions src/SerialLoops/Views/Editors/CharacterSpriteEditorView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:vm="using:SerialLoops.ViewModels.Editors"
xmlns:i="using:Avalonia.Xaml.Interactivity"
xmlns:ia="using:Avalonia.Xaml.Interactions.Core"
xmlns:libitems="using:SerialLoops.Lib.Items"
xmlns:items="using:SerialLoops.Lib.Items"
xmlns:assets="using:SerialLoops.Assets"
xmlns:controls="using:SerialLoops.Controls"
xmlns:utility="using:SerialLoops.Utility"
Expand All @@ -19,10 +19,15 @@
<TextBlock Text="{x:Static assets:Strings.Character}"/>
<ComboBox ItemsSource="{Binding Characters}" SelectedItem="{Binding Character}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="libitems:CharacterItem">
<DataTemplate DataType="items:CharacterItem">
<TextBlock Text="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:CharacterItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
</StackPanel>
<CheckBox IsChecked="{Binding IsLarge}" Content="{x:Static assets:Strings.Is_Large}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:assets="using:SerialLoops.Assets"
xmlns:controls="using:SerialLoops.Controls"
xmlns:litems="using:SerialLoops.Lib.Items"
xmlns:items="using:SerialLoops.Lib.Items"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="vm:LoadSceneScenarioCommandEditorViewModel"
x:Class="SerialLoops.Views.Editors.ScenarioCommandEditors.LoadSceneScenarioCommandEditorView">
Expand All @@ -17,10 +17,15 @@
<StackPanel Orientation="Horizontal" Spacing="3" Grid.Row="1" Grid.Column="1" Margin="5">
<ComboBox Grid.Row="1" Grid.Column="1" Margin="5" ItemsSource="{Binding Scripts}" SelectedItem="{Binding Scene}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="litems:ScriptItem">
<DataTemplate x:DataType="items:ScriptItem">
<TextBlock Text="{Binding DisplayName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:ScriptItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<controls:ItemLink Item="{Binding Scene}" Tabs="{Binding Tabs}"/>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:assets="using:SerialLoops.Assets"
xmlns:controls="using:SerialLoops.Controls"
xmlns:litems="using:SerialLoops.Lib.Items"
xmlns:items="using:SerialLoops.Lib.Items"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="vm:PuzzlePhaseScenarioCommandEditorViewModel"
x:Class="SerialLoops.Views.Editors.ScenarioCommandEditors.PuzzlePhaseScenarioCommandEditorView">
Expand All @@ -14,13 +14,18 @@
<TextBlock Grid.Row="0" Grid.Column="0" Margin="5" Text="{x:Static assets:Strings.Command}"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding SelectedScenarioCommand.Verb}"/>
<TextBlock Grid.Row="1" Grid.Column="0" Margin="5" Text="{x:Static assets:Strings.Puzzle}"/>
<StackPanel Orientation="Horizontal" Spacing="3" Grid.Row="1" Grid.Column="1" Margin="5">
<ComboBox Grid.Row="1" Grid.Column="1" Margin="5" ItemsSource="{Binding Puzzles}" SelectedItem="{Binding Puzzle}">
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Spacing="3" Margin="5">
<ComboBox Margin="5" ItemsSource="{Binding Puzzles}" SelectedItem="{Binding Puzzle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="litems:PuzzleItem">
<DataTemplate x:DataType="items:PuzzleItem">
<TextBlock Text="{Binding DisplayName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:PuzzleItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<controls:ItemLink Item="{Binding Puzzle}" Tabs="{Binding Tabs}"/>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:assets="using:SerialLoops.Assets"
xmlns:controls="using:SerialLoops.Controls"
xmlns:litems="using:SerialLoops.Lib.Items"
xmlns:items="using:SerialLoops.Lib.Items"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="vm:RouteSelectScenarioCommandEditorViewModel"
x:Class="SerialLoops.Views.Editors.ScenarioCommandEditors.RouteSelectScenarioCommandEditorView">
Expand All @@ -17,10 +17,15 @@
<StackPanel Orientation="Horizontal" Spacing="3" Grid.Row="1" Grid.Column="1" Margin="5">
<ComboBox ItemsSource="{Binding GroupSelections}" SelectedItem="{Binding GroupSelection}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="litems:GroupSelectionItem">
<DataTemplate x:DataType="items:GroupSelectionItem">
<TextBlock Text="{Binding DisplayName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:GroupSelectionItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding TextSearch}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<controls:ItemLink Item="{Binding GroupSelection}" Tabs="{Binding Tabs}"/>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<TextBlock Text="{Binding DisplayName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:BackgroundMusicItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding BgmName}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<controls:ItemLink Item="{Binding Music}" Tabs="{Binding Tabs}"/>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<TextBlock Text="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:CharacterItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<TextBox Name="DialogueTextBox" AcceptsReturn="True" Width="400" Height="100" Text="{Binding DialogueLine}"/>
</StackPanel>
Expand Down Expand Up @@ -52,6 +57,11 @@
<TextBlock Text="{Binding DisplayName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:VoicedLineItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<controls:ItemLink Tabs="{Binding Tabs}" Item="{Binding VoicedLine}"/>
</StackPanel>
Expand All @@ -63,6 +73,11 @@
<TextBlock Text="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:CharacterItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>

<TextBlock Grid.Column="0" Grid.Row="7" Text="{x:Static assets:Strings.Text_Speed}" Margin="0,12,0,0"/>
Expand All @@ -72,6 +87,11 @@
<TextBlock Text="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:CharacterItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>

<TextBlock Grid.Column="0" Grid.Row="8" Text="{x:Static assets:Strings.Text_Entrance_Effect}" Margin="0,12,0,0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<TextBlock Text="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:CharacterItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<TextBox Name="DialogueTextBox" AcceptsReturn="True" Width="400" Height="100" Text="{Binding DialogueLine}"/>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<TextBlock Text="{Binding DisplayName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:SfxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<controls:ItemLink Item="{Binding SelectedSfx}" Tabs="{Binding Tabs}"/>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<TextBlock Text="{Binding DisplayName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerTheme>
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:VoicedLineItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="TextSearch.Text" Value="{Binding DisplayName}" />
</ControlTheme>
</ComboBox.ItemContainerTheme>
</ComboBox>
<controls:ItemLink Item="{Binding Vce}" Tabs="{Binding Tabs}"/>
</StackPanel>
Expand Down

0 comments on commit 8abcbb6

Please sign in to comment.