Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 4cd45a9

Browse files
committed
v1.6.17 release
• Added province filtering • Added hex value tooltip on color in the prov table • Removed shown provinces indication from color picker page • Added to the prov table page an indication of the current number of provinces displayed • Changed province table icon
1 parent 0fcb0cf commit 4cd45a9

File tree

11 files changed

+75
-23
lines changed

11 files changed

+75
-23
lines changed

EU4-PCP.Packaging/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Identity
1111
Name="57163AlexSSB.EU4-PCP"
1212
Publisher="CN=23CA18F3-0DFA-4F77-B8D7-9EF595185D27"
13-
Version="1.6.16.0" />
13+
Version="1.6.17.0" />
1414

1515
<Properties>
1616
<DisplayName>EU4-PCP</DisplayName>

EU4-PCP/Models/PCP_Data.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public static class PCP_Data
5151
public static string ModDupliProvinceCount;
5252
public static string ModIllegalProvinceCount;
5353
public static string ModMaxProvinces;
54-
public static string ProvincesShown;
5554
public static double ProvTableIndex = 0;
5655
public static Color ColorPickerPickedColor;
5756
public static TableProvince ChosenProv;

EU4-PCP/Models/PCP_Implementations.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,8 +1397,6 @@ public static bool AddProv(Province newProv)
13971397

13981398
if (Storage.RetrieveBool(General.UpdateMaxProv) && !WriteDefMap(ModMaxProvinces))
13991399
return false;
1400-
1401-
ProvincesShown = Provinces.Values.Count(prov => prov && prov.Show).ToString();
14021400
}
14031401

14041402
if (!WriteProvinces())

EU4-PCP/Models/PCP_Logic.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ public static void UpdateProperties()
227227
{
228228
prov.Show = !prov.IsRNW() || (ShowRnw && !string.IsNullOrEmpty(prov.Name.ToString()));
229229
}
230-
ProvincesShown = Provinces.Values.Count(prov => prov && prov.Show).ToString();
231230

232231
DupliPrep();
233232
}

EU4-PCP/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EU4-PCP/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<value>EU4 Province Color Picker</value>
122122
</data>
123123
<data name="AppVersion" xml:space="preserve">
124-
<value>1.6.16</value>
124+
<value>1.6.17</value>
125125
</data>
126126
<data name="AutoLoad" xml:space="preserve">
127127
<value>Auto-Load</value>

EU4-PCP/Views/ColorPickerPage.xaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,6 @@
359359
Text=""
360360
ToolTip="{x:Static properties:Resources.ColorPickerIllegalDesc}" />
361361
</Grid>
362-
<Separator />
363-
<StackPanel Orientation="Horizontal">
364-
<TextBlock Margin="4" Text="Provinces in table:" />
365-
<TextBlock
366-
x:Name="ProvShownBlock"
367-
Margin="4"
368-
VerticalAlignment="Bottom"
369-
FontFamily="Consolas"
370-
Text="" />
371-
</StackPanel>
372362
<Separator Margin="0,10,0,0" />
373363
<TextBlock
374364
x:Name="BookmarkBlock"

EU4-PCP/Views/ColorPickerPage.xaml.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ private void InitializeData()
6767
IllegalProvCountGrid.Visibility = Visibility.Collapsed;
6868
DupliCountGrid.Visibility = Visibility.Collapsed;
6969

70-
ProvShownBlock.Text = ProvincesShown;
71-
7270
NoBooks();
7371
BookmarkComboBox.ItemsSource = BookmarkList;
7472
BookmarkComboBox.SelectedIndex = SelectedBookmarkIndex;
@@ -167,7 +165,6 @@ private async void EnactChange(CriticalScope scope)
167165
case CriticalScope.Mod:
168166
ChosenProv = null;
169167
ChangeMod();
170-
ProvincesShown = Provinces.Values.Count(prov => prov && prov.Show).ToString();
171168
UpdatePicker();
172169
break;
173170
case CriticalScope.Bookmark:

EU4-PCP/Views/ProvTablePage.xaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
67
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
78
xmlns:properties="clr-namespace:EU4_PCP.Properties"
89
d:DesignHeight="450"
910
d:DesignWidth="800"
11+
DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
1012
Style="{DynamicResource MahApps.Styles.Page}"
1113
mc:Ignorable="d">
1214
<Page.Resources>
@@ -18,14 +20,39 @@
1820
<Grid>
1921
<Grid.RowDefinitions>
2022
<RowDefinition Height="48" />
23+
<RowDefinition Height="Auto" />
2124
<RowDefinition Height="*" />
2225
</Grid.RowDefinitions>
2326
<TextBlock
2427
x:Name="PageTitle"
2528
Margin="{StaticResource MediumLeftMargin}"
29+
HorizontalAlignment="Left"
2630
Style="{StaticResource PageTitleStyle}"
2731
Text="{x:Static properties:Resources.ProvTablePageTitle}" />
28-
<Grid Grid.Row="1">
32+
<Grid Grid.Row="1" Margin="8">
33+
<Grid.ColumnDefinitions>
34+
<ColumnDefinition MinWidth="80" />
35+
<ColumnDefinition Width="6*" />
36+
</Grid.ColumnDefinitions>
37+
<StackPanel
38+
HorizontalAlignment="Center"
39+
VerticalAlignment="Center"
40+
Orientation="Horizontal">
41+
<TextBlock Text="{Binding ElementName=ProvTable, Path=Items.Count}" />
42+
<TextBlock Text=" Provinces" />
43+
</StackPanel>
44+
<TextBox
45+
x:Name="ProvTableFilterBox"
46+
Grid.Column="1"
47+
MinWidth="100"
48+
Margin="20,0"
49+
Padding="4,6,4,4"
50+
mah:TextBoxHelper.ClearTextButton="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Text.Length}"
51+
mah:TextBoxHelper.Watermark="Filter"
52+
Text="{Binding FilterText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
53+
</Grid>
54+
<Separator Grid.Row="1" VerticalAlignment="Bottom" />
55+
<Grid Grid.Row="2">
2956
<Grid
3057
x:Name="MarkerGrid"
3158
Width="12"
@@ -81,6 +108,7 @@
81108
<Setter Property="Text" Value="{Binding IsColorLegal}" />
82109
<Setter Property="TextAlignment" Value="Center" />
83110
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
111+
<Setter Property="ToolTip" Value="{Binding Color}" />
84112
</Style>
85113
</DataGridTextColumn.ElementStyle>
86114
</DataGridTextColumn>

EU4-PCP/Views/ProvTablePage.xaml.cs

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using EU4_PCP.Contracts.Views;
22
using EU4_PCP.Models;
33
using EU4_PCP.Services;
4+
using System;
45
using System.ComponentModel;
56
using System.Linq;
67
using System.Runtime.CompilerServices;
78
using System.Threading;
89
using System.Windows;
910
using System.Windows.Controls;
1011
using System.Windows.Controls.Primitives;
12+
using System.Windows.Data;
1113
using System.Windows.Input;
14+
using System.Windows.Media;
1215
using System.Windows.Shapes;
1316
using static EU4_PCP.PCP_Const;
1417
using static EU4_PCP.PCP_Data;
@@ -18,10 +21,27 @@ namespace EU4_PCP.Views
1821
{
1922
public partial class ProvTablePage : Page, INotifyPropertyChanged, INavigationAware
2023
{
24+
private string filterText = "";
25+
public string FilterText
26+
{
27+
get => filterText;
28+
set => Set(ref filterText, value);
29+
}
30+
2131
public ProvTablePage()
2232
{
2333
InitializeComponent();
2434
DataContext = this;
35+
36+
PropertyChanged += ProvTablePage_PropertyChanged;
37+
}
38+
39+
private void ProvTablePage_PropertyChanged(object sender, PropertyChangedEventArgs e)
40+
{
41+
if (e.PropertyName == nameof(FilterText))
42+
{
43+
FilterProvs();
44+
}
2545
}
2646

2747
public void OnNavigatedTo(object parameter)
@@ -35,13 +55,34 @@ where prov && prov.Show
3555
orderby prov.Index
3656
select new TableProvince(prov);
3757

38-
ProvincesShown = ProvTable.Items.Count.ToString();
58+
FilterProvs();
3959

4060
PaintMarkers();
4161

4262
ProvTable.SelectedIndex = SelectedGridRow;
4363
}
4464

65+
private void FilterProvs()
66+
{
67+
var collectionView = CollectionViewSource.GetDefaultView(ProvTable.ItemsSource);
68+
69+
collectionView.Filter = new(NameFilter(FilterText.ToLower()));
70+
71+
ProvTableFilterBox.Background = ProvTable.Items.Count == 0 ? new SolidColorBrush(Colors.Crimson) : null;
72+
}
73+
74+
private static Predicate<object> NameFilter(string filter) => p =>
75+
{
76+
if (p is not TableProvince prov)
77+
return false;
78+
79+
return prov.province.Name.Definition?.ToLower().Contains(filter) is true
80+
|| prov.province.Name.AltDefin?.ToLower().Contains(filter) is true
81+
|| prov.province.Name.Localisation?.ToLower().Contains(filter) is true
82+
|| prov.province.Name.Dynamic?.ToLower().Contains(filter) is true
83+
|| prov.Index.ToString().Contains(filter);
84+
};
85+
4586
public void OnNavigatedFrom()
4687
{
4788
}

0 commit comments

Comments
 (0)