diff --git a/clean.cmd b/clean.cmd index 17718672f..e8eb06853 100644 --- a/clean.cmd +++ b/clean.cmd @@ -1,3 +1,4 @@ +@echo off del .\bin\* /s /q for /d %%p in (.\bin\*) do rd "%%p" /s /q diff --git a/clean_appdata.cmd b/clean_appdata.cmd index e496e2581..9f6ec483b 100644 --- a/clean_appdata.cmd +++ b/clean_appdata.cmd @@ -1,3 +1,4 @@ +@echo off for /d %%p in (.\appdata\*) do rd "%%p" /s /q del .\appdata\GEDKeeper2.log diff --git a/projects/GKCore/GKCore/Controllers/BaseWinController.cs b/projects/GKCore/GKCore/Controllers/BaseWinController.cs index d0609ea31..3528b4b04 100644 --- a/projects/GKCore/GKCore/Controllers/BaseWinController.cs +++ b/projects/GKCore/GKCore/Controllers/BaseWinController.cs @@ -361,7 +361,7 @@ public void ChangeListItem(IListView sender) ShowRecordInfo(rec); } - public void SelectSummaryLink(string linkName) + public void SelectSummaryLink(IHyperView sender, string linkName) { if (linkName.StartsWith(GKData.INFO_HTTP_PREFIX)) { GKUtils.LoadExtFile(linkName); @@ -385,6 +385,8 @@ public void SelectSummaryLink(string linkName) ApplyFilter(GDMRecordType.rtIndividual, listMan); fView.ShowRecordsTab(GDMRecordType.rtIndividual); } + } else if (linkName.StartsWith(GKData.INFO_HREF_EXPAND_ASSO)) { + GKUtils.ExpandExtInfo(fContext, sender, linkName); } else { SelectRecordByXRef(linkName); } diff --git a/projects/GKCore/GKCore/Controllers/PartialViewController.cs b/projects/GKCore/GKCore/Controllers/PartialViewController.cs index 9b3467633..651ab1a18 100644 --- a/projects/GKCore/GKCore/Controllers/PartialViewController.cs +++ b/projects/GKCore/GKCore/Controllers/PartialViewController.cs @@ -172,7 +172,7 @@ public void ChangeListItem(IListView sender) ShowRecordInfo(rec); } - public void SelectSummaryLink(string linkName) + public void SelectSummaryLink(IHyperView sender, string linkName) { if (linkName.StartsWith(GKData.INFO_HTTP_PREFIX)) { GKUtils.LoadExtFile(linkName); @@ -195,6 +195,8 @@ public void SelectSummaryLink(string linkName) iFilter.SourceRef = rec.XRef; ApplyFilter(GDMRecordType.rtIndividual, listMan); } + } else if (linkName.StartsWith(GKData.INFO_HREF_EXPAND_ASSO)) { + GKUtils.ExpandExtInfo(fBase.Context, sender, linkName); } else { SelectRecordByXRef(linkName); } diff --git a/projects/GKCore/GKCore/Controllers/PersonsFilterDlgController.cs b/projects/GKCore/GKCore/Controllers/PersonsFilterDlgController.cs index 2e502d805..fb989a8af 100644 --- a/projects/GKCore/GKCore/Controllers/PersonsFilterDlgController.cs +++ b/projects/GKCore/GKCore/Controllers/PersonsFilterDlgController.cs @@ -1,6 +1,6 @@ /* * "GEDKeeper", the personal genealogical database editor. - * Copyright (C) 2009-2023 by Sergey V. Zhdanovskih. + * Copyright (C) 2009-2024 by Sergey V. Zhdanovskih. * * This file is part of "GEDKeeper". * @@ -19,6 +19,7 @@ */ using System; +using BSLib; using GDModel; using GKCore.Design; using GKCore.Design.Controls; @@ -42,6 +43,30 @@ public PersonsFilterDlgController(IPersonsFilterDlg view, IRecordsListModel list fListMan = (IndividualListModel)listMan; } + public void RemoveFilter(IComboBox sender) + { + if (sender == null) return; + + GlobalOptions options = GlobalOptions.Instance; + + if (sender == fView.NameCombo) { + GKUtils.RemoveFilter(sender.Text, options.NameFilters); + UpdateFiltersCombo(sender, options.NameFilters); + } + + if (sender == fView.ResidenceCombo) { + GKUtils.RemoveFilter(sender.Text, options.ResidenceFilters); + UpdateFiltersCombo(sender, options.ResidenceFilters); + } + + if (sender == fView.EventValCombo) { + GKUtils.RemoveFilter(sender.Text, options.EventFilters); + UpdateFiltersCombo(sender, options.EventFilters); + } + + sender.Text = "*"; + } + public override bool Accept() { try { @@ -116,25 +141,22 @@ public override bool Accept() } } + private void UpdateFiltersCombo(IComboBox comboBox, StringList filters) + { + comboBox.Clear(); + comboBox.Add("*"); + comboBox.AddStrings(filters); + comboBox.ReadOnly = false; + } + public override void UpdateView() { IndividualListFilter iFilter = (IndividualListFilter)fListMan.Filter; GlobalOptions options = GlobalOptions.Instance; - fView.NameCombo.Clear(); - fView.NameCombo.Add("*"); - fView.NameCombo.AddStrings(options.NameFilters); - fView.NameCombo.ReadOnly = false; - - fView.ResidenceCombo.Clear(); - fView.ResidenceCombo.Add("*"); - fView.ResidenceCombo.AddStrings(options.ResidenceFilters); - fView.ResidenceCombo.ReadOnly = false; - - fView.EventValCombo.Clear(); - fView.EventValCombo.Add("*"); - fView.EventValCombo.AddStrings(options.EventFilters); - fView.EventValCombo.ReadOnly = false; + UpdateFiltersCombo(fView.NameCombo, options.NameFilters); + UpdateFiltersCombo(fView.ResidenceCombo, options.ResidenceFilters); + UpdateFiltersCombo(fView.EventValCombo, options.EventFilters); int lifeSel; if (iFilter.FilterLifeMode != FilterLifeMode.lmTimeLocked) { diff --git a/projects/GKCore/GKCore/Cultures/RussianCulture.cs b/projects/GKCore/GKCore/Cultures/RussianCulture.cs index 8c31fda00..4919738fc 100644 --- a/projects/GKCore/GKCore/Cultures/RussianCulture.cs +++ b/projects/GKCore/GKCore/Cultures/RussianCulture.cs @@ -76,7 +76,7 @@ public override string GetMarriedSurname(string husbSurname) char lastSym = res[res.Length - 1]; var end2 = Morpher.Right(res, 2); - if (!"иа их ых ко".Contains(end2)) { + if (!"иа их ых ко ич".Contains(end2)) { if (CONSONANTS.IndexOf(lastSym) >= 0) { res = res + "а"; } else if (res.EndsWith("кий")) { diff --git a/projects/GKCore/GKCore/GKData.cs b/projects/GKCore/GKCore/GKData.cs index 7b2740b2b..332569e43 100644 --- a/projects/GKCore/GKCore/GKData.cs +++ b/projects/GKCore/GKCore/GKData.cs @@ -80,12 +80,13 @@ public static class GKData public const string INFO_HTTP_PREFIX = "http"; public const string INFO_HREF_VIEW = "view_"; public const string INFO_HREF_FILTER_INDI = "filter_indi_by_"; + public const string INFO_HREF_EXPAND_ASSO = "expand_asso_"; - #if OS_LINUX || OS_FREEBSD +#if OS_LINUX || OS_FREEBSD public const string DEF_FONT = "Noto Sans"; - #else +#else public const string DEF_FONT = "Tahoma"; - #endif +#endif public const string CHECK_MARK = " ✔ "; public const string CROSS_MARK = " ❌ "; diff --git a/projects/GKCore/GKCore/GKUtils.cs b/projects/GKCore/GKCore/GKUtils.cs index a266bcbed..1ee228709 100644 --- a/projects/GKCore/GKCore/GKUtils.cs +++ b/projects/GKCore/GKCore/GKUtils.cs @@ -35,6 +35,7 @@ using GDModel.Providers.GEDCOM; using GKCore.Calendar; using GKCore.Cultures; +using GKCore.Design.Controls; using GKCore.Import; using GKCore.Interfaces; using GKCore.Lists; @@ -178,6 +179,14 @@ public static void SaveFilter(string flt, StringList filters) if (flt != "" && flt != "*" && filters.IndexOf(flt) < 0) filters.Add(flt); } + public static void RemoveFilter(string flt, StringList filters) + { + if (filters == null) return; + + int idx = filters.IndexOf(flt); + if (idx >= 0) filters.Delete(idx); + } + public static StringList GetLocationLinks(GDMTree tree, GDMLocationRecord locRec) { var linksList = new StringList(); @@ -2102,12 +2111,38 @@ private static void ShowLink(GDMTree tree, GDMRecord aSubject, StringList aToLis aToList.Add(" " + prefix + GenRecordLink(tree, aRec, true) + suffix); } - private static void ShowPersonExtInfo(GDMTree tree, GDMIndividualRecord iRec, StringList summary) + public static int FindLinkStr(StringList list, string link) + { + if (list != null) { + for (int i = 0, num = list.Count; i < num; i++) { + if (list[i].Contains(link)) { + return i; + } + } + } + return -1; + } + + public static void ExpandExtInfo(IBaseContext context, IHyperView sender, string linkName) + { + string xref = linkName.Remove(0, GKData.INFO_HREF_EXPAND_ASSO.Length); + var iRec = context.Tree.FindXRef(xref); + if (iRec is GDMIndividualRecord) { + int lineIdx = GKUtils.FindLinkStr(sender.Lines, linkName); + var strList = new StringList(); + GKUtils.ShowPersonExtInfo(context.Tree, iRec, strList, false); + sender.Lines.AddStrings(strList); + sender.Lines.Delete(lineIdx); + } + } + + public static void ShowPersonExtInfo(GDMTree tree, GDMIndividualRecord iRec, StringList summary, bool checkOpt = true) { if (tree == null || iRec == null || summary == null) return; - if (!GlobalOptions.Instance.ShowIndiAssociations) return; + if (checkOpt && !GlobalOptions.Instance.ShowIndiAssociations) return; + bool first = true; summary.Add(""); int num = tree.RecordsCount; for (int i = 0; i < num; i++) { @@ -2117,7 +2152,6 @@ private static void ShowPersonExtInfo(GDMTree tree, GDMIndividualRecord iRec, St GDMIndividualRecord ir = (GDMIndividualRecord)rec; if (!ir.HasAssociations) continue; - bool first = true; for (int k = 0, cnt = ir.Associations.Count; k < cnt; k++) { GDMAssociation asso = ir.Associations[k]; @@ -2126,7 +2160,7 @@ private static void ShowPersonExtInfo(GDMTree tree, GDMIndividualRecord iRec, St summary.Add(LangMan.LS(LSID.Associations) + ":"); first = false; } - summary.Add(" " + HyperLink(ir.XRef, GetNameString(ir, true, false))); + summary.Add(" " + asso.Relation + ", " + HyperLink(ir.XRef, GetNameString(ir, true, false))); } } } @@ -2778,6 +2812,9 @@ public static void ShowPersonInfo(IBaseContext baseContext, GDMIndividualRecord ShowPersonExtInfo(tree, iRec, summary); ShowRFN(iRec, summary); + + summary.Add(""); + summary.Add(HyperLink(GKData.INFO_HREF_EXPAND_ASSO + iRec.XRef, "[ + ] " + LangMan.LS(LSID.Associations))); } } finally { summary.EndUpdate(); diff --git a/projects/GKv2/GEDKeeper2/GKUI/Forms/BaseWinSDI.cs b/projects/GKv2/GEDKeeper2/GKUI/Forms/BaseWinSDI.cs index 497f59912..c2967cba5 100644 --- a/projects/GKv2/GEDKeeper2/GKUI/Forms/BaseWinSDI.cs +++ b/projects/GKv2/GEDKeeper2/GKUI/Forms/BaseWinSDI.cs @@ -348,7 +348,7 @@ private void tabsRecords_SelectedIndexChanged(object sender, EventArgs e) private void mPersonSummaryLink(object sender, string linkName) { - fController.SelectSummaryLink(linkName); + fController.SelectSummaryLink((IHyperView)sender, linkName); } private void miCopyContent_Click(object sender, EventArgs e) diff --git a/projects/GKv2/GEDKeeper2/GKUI/Forms/PartialView.cs b/projects/GKv2/GEDKeeper2/GKUI/Forms/PartialView.cs index acc02e29d..df9a24b5f 100644 --- a/projects/GKv2/GEDKeeper2/GKUI/Forms/PartialView.cs +++ b/projects/GKv2/GEDKeeper2/GKUI/Forms/PartialView.cs @@ -233,7 +233,7 @@ private void List_SelectedIndexChanged(object sender, EventArgs e) private void mPersonSummaryLink(object sender, string linkName) { - fController.SelectSummaryLink(linkName); + fController.SelectSummaryLink((IHyperView)sender, linkName); } private void miCopyContent_Click(object sender, EventArgs e) diff --git a/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonsFilterDlg.Designer.cs b/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonsFilterDlg.Designer.cs index d2b1856b1..4775efc5e 100644 --- a/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonsFilterDlg.Designer.cs +++ b/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonsFilterDlg.Designer.cs @@ -238,6 +238,7 @@ private void InitializeComponent() this.txtName.Sorted = true; this.txtName.TabIndex = 20; this.txtName.Text = "*"; + this.txtName.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cmbFilter_KeyUp); // // rgSex // @@ -301,6 +302,7 @@ private void InitializeComponent() this.cmbResidence.Sorted = true; this.cmbResidence.TabIndex = 22; this.cmbResidence.Text = "*"; + this.cmbResidence.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cmbFilter_KeyUp); // // cmbGroup // @@ -328,6 +330,7 @@ private void InitializeComponent() this.cmbEventVal.Sorted = true; this.cmbEventVal.TabIndex = 24; this.cmbEventVal.Text = "*"; + this.cmbEventVal.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cmbFilter_KeyUp); // // PersonsFilterDlg // diff --git a/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonsFilterDlg.cs b/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonsFilterDlg.cs index 3cd193123..f2620935d 100644 --- a/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonsFilterDlg.cs +++ b/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonsFilterDlg.cs @@ -1,6 +1,6 @@ /* * "GEDKeeper", the personal genealogical database editor. - * Copyright (C) 2009-2023 by Sergey V. Zhdanovskih. + * Copyright (C) 2009-2024 by Sergey V. Zhdanovskih. * * This file is part of "GEDKeeper". * @@ -19,6 +19,7 @@ */ using System; +using System.Windows.Forms; using GKCore.Controllers; using GKCore.Design.Controls; using GKCore.Design.Views; @@ -54,17 +55,17 @@ ICheckBox IPersonsFilterDlg.OnlyPatriarchsCheck IComboBox IPersonsFilterDlg.EventValCombo { - get { return GetControlHandler(cmbEventVal); } + get { return GetControlHandler(cmbEventVal); } } IComboBox IPersonsFilterDlg.ResidenceCombo { - get { return GetControlHandler(cmbResidence); } + get { return GetControlHandler(cmbResidence); } } IComboBox IPersonsFilterDlg.NameCombo { - get { return GetControlHandler(txtName); } + get { return GetControlHandler(txtName); } } void IPersonsFilterDlg.SetLifeRadio(int lifeSel) @@ -136,9 +137,9 @@ public PersonsFilterDlg(IBaseWindow baseWin, IRecordsListModel listMan) : base(b InitializeComponent(); // platform: in Mono tsSpecificFilter has 0 index, somehow - #if MONO +#if MONO tabsFilters.Controls.SetChildIndex(pageSpecificFilter, 1); - #endif +#endif tabsFilters.SelectedIndex = 1; fPersonsFilterDlgController = new PersonsFilterDlgController(this, listMan); @@ -161,5 +162,13 @@ public override void Reset() base.Reset(); fPersonsFilterDlgController.UpdateView(); } + + private void cmbFilter_KeyUp(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Delete && e.Control) { + var combo = GetControlHandler(sender); + fPersonsFilterDlgController.RemoveFilter(combo); + } + } } } diff --git a/projects/GKv3/GEDKeeper3/GKUI/Forms/BaseWinSDI.cs b/projects/GKv3/GEDKeeper3/GKUI/Forms/BaseWinSDI.cs index 1fb7466a9..8c4683e99 100644 --- a/projects/GKv3/GEDKeeper3/GKUI/Forms/BaseWinSDI.cs +++ b/projects/GKv3/GEDKeeper3/GKUI/Forms/BaseWinSDI.cs @@ -437,7 +437,7 @@ private void tabsRecords_SelectedIndexChanged(object sender, EventArgs e) private void mPersonSummaryLink(object sender, string linkName) { - fController.SelectSummaryLink(linkName); + fController.SelectSummaryLink((IHyperView)sender, linkName); } private void miCopyContent_Click(object sender, EventArgs e) diff --git a/projects/GKv3/GEDKeeper3/GKUI/Forms/PartialView.cs b/projects/GKv3/GEDKeeper3/GKUI/Forms/PartialView.cs index c4770682d..035f5cd6d 100644 --- a/projects/GKv3/GEDKeeper3/GKUI/Forms/PartialView.cs +++ b/projects/GKv3/GEDKeeper3/GKUI/Forms/PartialView.cs @@ -253,7 +253,7 @@ private void List_SelectedIndexChanged(object sender, EventArgs e) private void mPersonSummaryLink(object sender, string linkName) { - fController.SelectSummaryLink(linkName); + fController.SelectSummaryLink((IHyperView)sender, linkName); } private void miCopyContent_Click(object sender, EventArgs e) diff --git a/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonsFilterDlg.cs b/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonsFilterDlg.cs index 6a2fd8544..8737acb6d 100644 --- a/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonsFilterDlg.cs +++ b/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonsFilterDlg.cs @@ -1,6 +1,6 @@ /* * "GEDKeeper", the personal genealogical database editor. - * Copyright (C) 2009-2023 by Sergey V. Zhdanovskih. + * Copyright (C) 2009-2024 by Sergey V. Zhdanovskih. * * This file is part of "GEDKeeper". * @@ -102,17 +102,17 @@ ICheckBox IPersonsFilterDlg.OnlyPatriarchsCheck IComboBox IPersonsFilterDlg.EventValCombo { - get { return GetControlHandler(cmbEventVal); } + get { return GetControlHandler(cmbEventVal); } } IComboBox IPersonsFilterDlg.ResidenceCombo { - get { return GetControlHandler(cmbResidence); } + get { return GetControlHandler(cmbResidence); } } IComboBox IPersonsFilterDlg.NameCombo { - get { return GetControlHandler(txtName); } + get { return GetControlHandler(txtName); } } void IPersonsFilterDlg.SetLifeRadio(int lifeSel) @@ -187,10 +187,10 @@ public PersonsFilterDlg() public PersonsFilterDlg(IBaseWindow baseWin, IRecordsListModel listMan) : this() { if (baseWin == null) - throw new ArgumentNullException("baseWin"); + throw new ArgumentNullException(nameof(baseWin)); if (listMan == null) - throw new ArgumentNullException("listMan"); + throw new ArgumentNullException(nameof(listMan)); fBase = baseWin; fListMan = listMan; @@ -224,5 +224,13 @@ private void btnReset_Click(object sender, EventArgs e) fCommonController.UpdateView(); fController.UpdateView(); } + + private void cmbFilter_KeyUp(object sender, KeyEventArgs e) + { + if (e.Key == Keys.Delete && e.Control) { + var combo = GetControlHandler(sender); + fController.RemoveFilter(combo); + } + } } } diff --git a/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonsFilterDlg.xeto b/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonsFilterDlg.xeto index 3ffe58965..961b52ca5 100644 --- a/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonsFilterDlg.xeto +++ b/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonsFilterDlg.xeto @@ -41,17 +41,17 @@ diff --git a/projects/GKvX/GEDKeeperX/GKUI/Forms/BaseWinSDI.xaml.cs b/projects/GKvX/GEDKeeperX/GKUI/Forms/BaseWinSDI.xaml.cs index 766b2eeb6..766ad32c1 100644 --- a/projects/GKvX/GEDKeeperX/GKUI/Forms/BaseWinSDI.xaml.cs +++ b/projects/GKvX/GEDKeeperX/GKUI/Forms/BaseWinSDI.xaml.cs @@ -297,7 +297,7 @@ private void tabsRecords_SelectedIndexChanged(object sender, EventArgs e) private void mPersonSummaryLink(object sender, string linkName) { - fController.SelectSummaryLink(linkName); + fController.SelectSummaryLink((IHyperView)sender, linkName); } private void miCopyContent_Click(object sender, EventArgs e)