Skip to content

Commit 8abcbb6

Browse files
authored
Add text search on all ComboBoxes (haroohie-club#419)
1 parent 648a326 commit 8abcbb6

17 files changed

+122
-19
lines changed

.github/workflows/merge.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Serial Loops PR
2+
run-name: PR for ${{ github.actor }} - ${{ github.ref_name }}
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'Avalonia'
8+
9+
jobs:
10+
build_test:
11+
if: github.repository == 'haroohie-club'
12+
strategy:
13+
matrix:
14+
platform:
15+
- os: ubuntu-latest
16+
targetFramework: net8.0
17+
container: 'ghcr.io/haroohie-club/chokuretsu-devkitarm:main'
18+
- os: macos-latest
19+
targetFramework: net8.0
20+
container: ''
21+
- os: windows-latest
22+
targetFramework: net8.0-windows
23+
container: ''
24+
runs-on: ${{ matrix.platform.os }}
25+
container: ${{ matrix.platform.container }}
26+
steps:
27+
- name: Check out
28+
uses: actions/checkout@v4
29+
- name: Setup .NET
30+
uses: actions/[email protected]
31+
with:
32+
dotnet-version: '8.0.x'
33+
- name: Build project
34+
run: dotnet build src/SerialLoops/SerialLoops.csproj -f ${{ matrix.platform.targetFramework }}
35+
- name: Run tests
36+
run: dotnet test test/SerialLoops.Tests.Headless/SerialLoops.Tests.Headless.csproj -f ${{ matrix.platform.targetFramework }}
37+
env:
38+
ROM_URI: ${{ secrets.CHOKU_ROM_URI }}

src/SerialLoops.Lib/Items/CharacterItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,4 @@ public class NameplateProperties(string name, SKColor nameColor, SKColor plateCo
151151
public SKColor PlateColor { get; set; } = plateColor;
152152
public SKColor OutlineColor { get; set; } = outlineColor;
153153
public bool HasOutline { get; set; } = hasOutline;
154-
}
154+
}

src/SerialLoops.Lib/Items/GroupSelectionItem.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class GroupSelectionItem : Item
77
{
88
public ScenarioSelection Selection { get; set; }
99
public int Index { get; set; }
10+
public string TextSearch => $"{Index + 1}";
1011

1112
public GroupSelectionItem(ScenarioSelection selection, int index, Project project) : base($"Selection {index + 1}", ItemType.Group_Selection)
1213
{
@@ -17,4 +18,4 @@ public GroupSelectionItem(ScenarioSelection selection, int index, Project projec
1718
public override void Refresh(Project project, ILogger log)
1819
{
1920
}
20-
}
21+
}

src/SerialLoops/App.axaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:mintoolbarthemes="using:MiniToolbar.Avalonia.Themes"
88
xmlns:dialoghost="using:DialogHostAvalonia"
99
RequestedThemeVariant="Default">
10-
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
10+
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
1111
<Application.DataTemplates>
1212
<local:ViewLocator/>
1313
</Application.DataTemplates>
@@ -24,7 +24,7 @@
2424
<NativeMenuItem Header="{x:Static assets:Strings.View__Logs}" Click="Logs_Click"/>
2525
</NativeMenu>
2626
</NativeMenu.Menu>
27-
27+
2828
<Application.Styles>
2929
<FluentTheme />
3030
<dialoghost:DialogHostStyles />
@@ -50,6 +50,9 @@
5050
<Style Selector="TextBlock.link:disabled">
5151
<Setter Property="Foreground" Value="{DynamicResource ResourceKey=DisabledLinkColor}"/>
5252
</Style>
53+
<Style Selector="ComboBox">
54+
<Setter Property="IsTextSearchEnabled" Value="True"/>
55+
</Style>
5356
</Application.Styles>
5457

5558
<Application.Resources>
@@ -70,5 +73,5 @@
7073
</ResourceDictionary.ThemeDictionaries>
7174
</ResourceDictionary>
7275
</Application.Resources>
73-
76+
7477
</Application>

src/SerialLoops/SerialLoops.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<ItemGroup>
5656
<PackageReference Include="Avalonia" Version="11.2.0" />
5757
<PackageReference Include="Avalonia.Controls.TreeDataGrid" Version="11.0.10" />
58-
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.2.0"/>
58+
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.2.0" />
5959
<PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
6060
<PackageReference Include="Avalonia.Labs.Controls" Version="11.2.0" />
6161
<PackageReference Include="Avalonia.Labs.Panels" Version="11.2.0" />

src/SerialLoops/ViewModels/Dialogs/AddScenarioCommandDialogViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ public AddScenarioCommandDialogViewModel()
2222
CreateCommand = ReactiveCommand.Create<AddScenarioCommandDialog>((dialog) => dialog.Close(SelectedVerb));
2323
CancelCommand = ReactiveCommand.Create<AddScenarioCommandDialog>((dialog) => dialog.Close());
2424
}
25-
}
25+
}

src/SerialLoops/ViewModels/Editors/ScenarioEditorViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public ScenarioEditorViewModel(ScenarioItem scenario, MainWindowViewModel window
6565
private async void Add()
6666
{
6767
int selectedIndex = Math.Min(_scenario.Scenario.Commands.Count - 1, Commands.IndexOf(SelectedCommand));
68-
ScenarioVerb? newVerb = await new AddScenarioCommandDialog() { DataContext = new AddScenarioCommandDialogViewModel() }.ShowDialog<ScenarioVerb>(_window.Window);
68+
ScenarioVerb? newVerb = await new AddScenarioCommandDialog() { DataContext = new AddScenarioCommandDialogViewModel() }.ShowDialog<ScenarioVerb?>(_window.Window);
6969
if (newVerb is not null)
7070
{
7171
int param = newVerb switch
@@ -147,4 +147,4 @@ public ScenarioCommandEditorViewModel GetScenarioCommandEditor(PrettyScenarioCom
147147
_ => new ScenarioCommandEditorViewModel(command, _window.EditorTabs),
148148
};
149149
}
150-
}
150+
}

src/SerialLoops/ViewModels/Editors/ScriptEditorViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ private void UpdateCommandViewModel()
114114
CommandVerb.SCREEN_FADEIN => new ScreenFadeInScriptCommandEditorViewModel(_selectedCommand, this),
115115
CommandVerb.SCREEN_FADEOUT => new ScreenFadeOutScriptCommandEditorViewModel(_selectedCommand, this),
116116
CommandVerb.SCREEN_FLASH => new ScreenFlashScriptCommandEditorViewModel(_selectedCommand, this),
117+
CommandVerb.SND_PLAY => new SndPlayScriptCommandEditorViewModel(_selectedCommand, this, _window),
117118
CommandVerb.REMOVED => new EmptyScriptCommandEditorViewModel(_selectedCommand, this),
118119
CommandVerb.SND_STOP => new EmptyScriptCommandEditorViewModel(_selectedCommand, this),
119120
CommandVerb.BGM_PLAY => new BgmPlayScriptCommandEditorViewModel(_selectedCommand, this, _window),

src/SerialLoops/Views/Editors/CharacterSpriteEditorView.axaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:vm="using:SerialLoops.ViewModels.Editors"
66
xmlns:i="using:Avalonia.Xaml.Interactivity"
77
xmlns:ia="using:Avalonia.Xaml.Interactions.Core"
8-
xmlns:libitems="using:SerialLoops.Lib.Items"
8+
xmlns:items="using:SerialLoops.Lib.Items"
99
xmlns:assets="using:SerialLoops.Assets"
1010
xmlns:controls="using:SerialLoops.Controls"
1111
xmlns:utility="using:SerialLoops.Utility"
@@ -19,10 +19,15 @@
1919
<TextBlock Text="{x:Static assets:Strings.Character}"/>
2020
<ComboBox ItemsSource="{Binding Characters}" SelectedItem="{Binding Character}">
2121
<ComboBox.ItemTemplate>
22-
<DataTemplate DataType="libitems:CharacterItem">
22+
<DataTemplate DataType="items:CharacterItem">
2323
<TextBlock Text="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}"/>
2424
</DataTemplate>
2525
</ComboBox.ItemTemplate>
26+
<ComboBox.ItemContainerTheme>
27+
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:CharacterItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
28+
<Setter Property="TextSearch.Text" Value="{Binding DisplayName, Converter={x:Static utility:SLConverters.CharacterNameCropConverter}}" />
29+
</ControlTheme>
30+
</ComboBox.ItemContainerTheme>
2631
</ComboBox>
2732
</StackPanel>
2833
<CheckBox IsChecked="{Binding IsLarge}" Content="{x:Static assets:Strings.Is_Large}"/>

src/SerialLoops/Views/Editors/ScenarioCommandEditors/LoadSceneScenarioCommandEditorView.axaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:assets="using:SerialLoops.Assets"
77
xmlns:controls="using:SerialLoops.Controls"
8-
xmlns:litems="using:SerialLoops.Lib.Items"
8+
xmlns:items="using:SerialLoops.Lib.Items"
99
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
1010
x:DataType="vm:LoadSceneScenarioCommandEditorViewModel"
1111
x:Class="SerialLoops.Views.Editors.ScenarioCommandEditors.LoadSceneScenarioCommandEditorView">
@@ -17,10 +17,15 @@
1717
<StackPanel Orientation="Horizontal" Spacing="3" Grid.Row="1" Grid.Column="1" Margin="5">
1818
<ComboBox Grid.Row="1" Grid.Column="1" Margin="5" ItemsSource="{Binding Scripts}" SelectedItem="{Binding Scene}">
1919
<ComboBox.ItemTemplate>
20-
<DataTemplate x:DataType="litems:ScriptItem">
20+
<DataTemplate x:DataType="items:ScriptItem">
2121
<TextBlock Text="{Binding DisplayName}"/>
2222
</DataTemplate>
2323
</ComboBox.ItemTemplate>
24+
<ComboBox.ItemContainerTheme>
25+
<ControlTheme TargetType="ComboBoxItem" x:DataType="items:ScriptItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
26+
<Setter Property="TextSearch.Text" Value="{Binding DisplayName}" />
27+
</ControlTheme>
28+
</ComboBox.ItemContainerTheme>
2429
</ComboBox>
2530
<controls:ItemLink Item="{Binding Scene}" Tabs="{Binding Tabs}"/>
2631
</StackPanel>

0 commit comments

Comments
 (0)