Skip to content

Commit

Permalink
Added additional conditions for filtering records by fields: new "con…
Browse files Browse the repository at this point in the history
…tains/not contains" filters without a mask (case-sensitive), old ones renamed to "contains/not contains mask" (fix #606)
  • Loading branch information
Serg-Norseman committed Dec 5, 2024
1 parent 6d4ee11 commit 79b2d78
Show file tree
Hide file tree
Showing 27 changed files with 71 additions and 13 deletions.
2 changes: 2 additions & 0 deletions locales/Afrikaans.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
4 changes: 3 additions & 1 deletion locales/Belarusian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@
985=Location Expert
986=Event dates
987=Add
988=Entry ; entry/item/part of place string
988=Entry
989=Include source pages
990=Navigation
991=Include portraits
Expand All @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Chinese Simplified.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=哀悼边框
1011=使用附加日期
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
4 changes: 3 additions & 1 deletion locales/Czech.lng
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@
985=Location Expert
986=Event dates
987=Add
988=Entry ; entry/item/part of place string
988=Entry
989=Include source pages
990=Navigation
991=Include portraits
Expand All @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Dutch.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/English.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/French.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/German.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Trauerränder
1011=Zusätzliche Daten verwenden
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Hungarian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Gyászjelentés
1011=Használjon további dátumokat
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Icelandic.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Italian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Japanese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Kazakh (Cyrillic).lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
4 changes: 3 additions & 1 deletion locales/Polish.lng
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@
985=Location Expert
986=Event dates
987=Add
988=Entry ; entry/item/part of place string
988=Entry
989=Include source pages
990=Navigation
991=Include portraits
Expand All @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
4 changes: 3 additions & 1 deletion locales/Portuguese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@
985=Location Expert
986=Event dates
987=Add
988=Entry ; entry/item/part of place string
988=Entry
989=Include source pages
990=Navigation
991=Include portraits
Expand All @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Russian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Траурные края
1011=Использовать дополнительные даты
1012=Коорд. курсора
1013=содержит маску
1014=не содержит маску
4 changes: 3 additions & 1 deletion locales/Serbian (Latin).lng
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@
985=Location Expert
986=Event dates
987=Add
988=Entry ; entry/item/part of place string
988=Entry
989=Include source pages
990=Navigation
991=Include portraits
Expand All @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
2 changes: 2 additions & 0 deletions locales/Spanish.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
4 changes: 3 additions & 1 deletion locales/Ukrainian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@
985=Location Expert
986=Event dates
987=Add
988=Entry ; entry/item/part of place string
988=Entry
989=Include source pages
990=Navigation
991=Include portraits
Expand All @@ -1023,3 +1023,5 @@
1010=Mourning edges
1011=Use additional dates
1012=Cursor coordinates
1013=contains mask
1014=not contains mask
1 change: 1 addition & 0 deletions locales/help_enu/gkhHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>Change log</h1>

<p>
<b>14.12.2024 [v2.32.0 &amp; v3.8.0]</b><ul>
<li>Added additional conditions for filtering records by fields: new "contains/not contains" filters without a mask (case-sensitive), old ones renamed to "contains/not contains mask".
<li>Localizations updated: Afrikaans (Steyn van der Walt), Chinese Simplified (Jeff Li, learn1), Dutch (Annelotte), French (Guy Arbus),
German (Christian Bettinger), Hungarian (Kékesi Lajos), Japanese (mtsx68k), Kazakh (karatal), Spanish (Miguel A. Pérez Valdenebro), Turkish (Emre Gecher).
<li>Added a button to the location editing dialog for taking coordinates from the cursor on the map.
Expand Down
1 change: 1 addition & 0 deletions locales/help_rus/gkhHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>История версий</h1>

<p>
<b>14.12.2024 [v2.32.0 &amp; v3.8.0]</b><ul>
<li>Добавлены дополнительные условия фильтрации записей по полям: новые "содержит/не содержит" фильтруют без маски (регистрозавимые), старые переименованы в "содержит/не содержит маску".
<li>Обновлены локализации: африкаанс (Steyn van der Walt), китайская (Jeff Li, learn1), голландская (Annelotte), французская (Guy Arbus),
немецкая (Christian Bettinger), венгерская (Kékesi Lajos), японская (mtsx68k), казахская (karatal), испанская (Miguel A. Pérez Valdenebro), турецкая (Emre Gecher).
<li>Добавлена кнопка в диалог редактирования локаций для взятия координат по курсору на карте.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ public void Reset()

public override void SetLocale()
{
fView.Title = LangMan.LS(LSID.MIFilter);

GKData.CondSigns[6] = LangMan.LS(LSID.CondContains);
GKData.CondSigns[7] = LangMan.LS(LSID.CondNotContains);
GKData.CondSigns[8] = LangMan.LS(LSID.CondContainsMask);
GKData.CondSigns[9] = LangMan.LS(LSID.CondNotContainsMask);

GetControl<IButton>("btnAccept").Text = LangMan.LS(LSID.DlgAccept);
GetControl<IButton>("btnCancel").Text = LangMan.LS(LSID.DlgCancel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ public override void UpdateView()

public override void SetLocale()
{
fView.Title = LangMan.LS(LSID.MIFilter);

GetControl<ITabPage>("pageSpecificFilter").Text = LangMan.LS(LSID.PersonsFilter);
GetControl<IRadioButton>("rbAll").Text = LangMan.LS(LSID.All);
GetControl<IRadioButton>("rbOnlyLive").Text = LangMan.LS(LSID.OnlyAlive);
Expand Down
2 changes: 1 addition & 1 deletion projects/GKCore/GKCore/GKData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ static GKData()
};

CondSigns = new string[] {
"!=", "<", "<=", "==", "=>", ">", "contains", "not contains"
"!=", "<", "<=", "==", "=>", ">", "contains", "not contains", "contains mask", "not contains mask"
};

NameTypes = new LSID[] {
Expand Down
6 changes: 5 additions & 1 deletion projects/GKCore/GKCore/Interfaces/IListFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ public enum DataType

public enum ConditionKind : int
{
ck_NotEq, ck_LT, ck_LET, ck_Eq, ck_GET, ck_GT, ck_Contains, ck_NotContains
ck_NotEq, ck_LT, ck_LET, ck_Eq, ck_GET, ck_GT,
ck_Contains, ck_NotContains,
ck_ContainsMask, ck_NotContainsMask,

ck_Last = ck_NotContainsMask
}


Expand Down
6 changes: 5 additions & 1 deletion projects/GKCore/GKCore/LangMan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,10 @@ public enum LSID
/* 1010 */ MourningEdges,
/* 1011 */ UseAdditionalDates,
/* 1012 */ CursorCoords,
/* 1013 */ CondContainsMask,
/* 1014 */ CondNotContainsMask,

/* 000 */ Last = CursorCoords
/* 000 */ Last = CondNotContainsMask
}


Expand Down Expand Up @@ -2129,6 +2131,8 @@ public static class LangMan
/* 1010 */ "Mourning edges",
/* 1011 */ "Use additional dates",
/* 1012 */ "Cursor coordinates",
/* 1013 */ "contains mask",
/* 1014 */ "not contains mask",
};

private static readonly LangManager fLangMan = new LangManager();
Expand Down
12 changes: 10 additions & 2 deletions projects/GKCore/GKCore/Lists/ListSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,18 @@ protected bool CheckCondition(FilterCondition fcond, object dataval)
break;

case ConditionKind.ck_Contains:
res = GKUtils.MatchesMask(dataval.ToString(), "*" + fcond.Value + "*");
res = dataval.ToString().Contains(fcond.Value.ToString());
break;

case ConditionKind.ck_NotContains:
res = !dataval.ToString().Contains(fcond.Value.ToString());
break;

case ConditionKind.ck_ContainsMask:
res = GKUtils.MatchesMask(dataval.ToString(), "*" + fcond.Value + "*");
break;

case ConditionKind.ck_NotContainsMask:
res = !GKUtils.MatchesMask(dataval.ToString(), "*" + fcond.Value + "*");
break;
}
Expand Down Expand Up @@ -494,7 +502,7 @@ public ConditionKind GetCondByName(string condName)
{
ConditionKind res = ConditionKind.ck_NotEq;

for (ConditionKind pl = ConditionKind.ck_NotEq; pl <= ConditionKind.ck_NotContains; pl++) {
for (ConditionKind pl = ConditionKind.ck_NotEq; pl <= ConditionKind.ck_Last; pl++) {
if (GKData.CondSigns[(int)pl] == condName) {
res = pl;
break;
Expand Down

0 comments on commit 79b2d78

Please sign in to comment.