Skip to content

Commit

Permalink
Added a call to detailed information about sources and persons in the…
Browse files Browse the repository at this point in the history
… lists of citations to sources, children, parents and spouses
  • Loading branch information
Serg-Norseman committed May 30, 2024
1 parent b195e74 commit c2ee43d
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 34 deletions.
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.06.2024 [v2.30.1 &amp; v3.6.1]</b><ul>
<li>Added a call to detailed information about sources and persons in the lists of citations to sources, children, parents and spouses (pop-up menu).
<li>Added display of multimedia and notes on the info-panel for events.
<li>Fixed multiple lines in the Author column of source citation lists (GKv3).
<li>Improved output of portraits from photos with DPI > 100 (GKv3).
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.06.2024 [v2.30.1 &amp; v3.6.1]</b><ul>
<li>Добавлен вызов детальной информации об источниках и персонах в списки ссылок на источники, детей, родителей и супругов (всплывающее меню).
<li>Добавлено отображение мультимедиа и заметок на инфо-панели для событий.
<li>Устранены множественные строки в столбце "Автор" списков ссылок на источники (GKv3).
<li>Улучшен вывод портретов из фотографий с DPI > 100 (GKv3).
Expand Down
6 changes: 3 additions & 3 deletions projects/GKCore/GKCore/Controllers/BaseWinController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public void ShowRecordInfo(GDMRecord record)
try {
IHyperView hyperView = GetHyperViewByType(record.RecordType);
if (hyperView != null) {
GKUtils.GetRecordContent(fContext, record, hyperView.Lines);
GKUtils.GetRecordContent(fContext, record, hyperView.Lines, RecordContentType.Full);
}
} catch (Exception ex) {
Logger.WriteError("BaseWinSDI.ShowRecordInfo()", ex);
Expand Down Expand Up @@ -442,10 +442,10 @@ record = fDelayedTransitionRecord;
}
}

public StringList GetRecordContent(GDMRecord record)
public StringList GetRecordContent(GDMRecord record, RecordContentType contentType)
{
StringList ctx = new StringList();
GKUtils.GetRecordContent(fContext, record, ctx);
GKUtils.GetRecordContent(fContext, record, ctx, contentType);
return ctx;
}

Expand Down
4 changes: 2 additions & 2 deletions projects/GKCore/GKCore/Controllers/RecMergeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void SetRec1(GDMRecord value)
} else {
GetControl<ILabel>("Lab1").Text = fRec1.XRef;
GetControl<ITextBox>("Edit1").Text = GKUtils.GetRecordName(fBase.Context.Tree, fRec1, false);
fView.View1.Lines.Assign(fBase.GetRecordContent(fRec1));
fView.View1.Lines.Assign(fBase.GetRecordContent(fRec1, RecordContentType.Quick));
}
}

Expand All @@ -223,7 +223,7 @@ public void SetRec2(GDMRecord value)
} else {
GetControl<ILabel>("Lab2").Text = fRec2.XRef;
GetControl<ITextBox>("Edit2").Text = GKUtils.GetRecordName(fBase.Context.Tree, fRec2, false);
fView.View2.Lines.Assign(fBase.GetRecordContent(fRec2));
fView.View2.Lines.Assign(fBase.GetRecordContent(fRec2, RecordContentType.Quick));
}
}

Expand Down
7 changes: 4 additions & 3 deletions projects/GKCore/GKCore/Controllers/RecordInfoDlgController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2022 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand All @@ -21,6 +21,7 @@
using GDModel;
using GKCore.Design;
using GKCore.Design.Views;
using GKCore.Interfaces;

namespace GKCore.Controllers
{
Expand Down Expand Up @@ -49,7 +50,7 @@ public RecordInfoDlgController(IRecordInfoDlg view) : base(view)

public override void UpdateView()
{
fView.HyperView.Lines.Assign(fBase.GetRecordContent(fRecord));
fView.HyperView.Lines.Assign(fBase.GetRecordContent(fRecord, RecordContentType.Quick));
}

public void SelectLink(string linkName)
Expand All @@ -67,7 +68,7 @@ public void SelectLink(string linkName)
}
} else {
GDMRecord record = Base.Context.Tree.XRefIndex_Find(linkName);
fView.HyperView.Lines.Assign(fBase.GetRecordContent(record));
fView.HyperView.Lines.Assign(fBase.GetRecordContent(record, RecordContentType.Quick));
}
}

Expand Down
12 changes: 7 additions & 5 deletions projects/GKCore/GKCore/GKUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2776,7 +2776,7 @@ private static void ShowRFN(GDMIndividualRecord iRec, StringList summary)
summary.Add(HyperLink(fullURL, string.Format("{0}: {1}", res.Name, fullURL)));
}

public static void ShowSourceInfo(IBaseContext baseContext, GDMSourceRecord sourceRec, StringList summary)
public static void ShowSourceInfo(IBaseContext baseContext, GDMSourceRecord sourceRec, StringList summary, RecordContentType contentType)
{
if (summary == null) return;

Expand Down Expand Up @@ -2812,8 +2812,10 @@ public static void ShowSourceInfo(IBaseContext baseContext, GDMSourceRecord sour

summary.Add("");
summary.Add("");
summary.Add("[ " + HyperLink(GKData.INFO_HREF_FILTER_INDI + sourceRec.XRef, LangMan.LS(LSID.MIFilter)) + " ]");
summary.Add("");
if (contentType == RecordContentType.Full) {
summary.Add("[ " + HyperLink(GKData.INFO_HREF_FILTER_INDI + sourceRec.XRef, LangMan.LS(LSID.MIFilter)) + " ]");
summary.Add("");
}
}
} finally {
summary.EndUpdate();
Expand Down Expand Up @@ -3087,7 +3089,7 @@ public static void ShowLocationInfo(IBaseContext baseContext, GDMLocationRecord
}
}

public static void GetRecordContent(IBaseContext baseContext, GDMRecord record, StringList ctx)
public static void GetRecordContent(IBaseContext baseContext, GDMRecord record, StringList ctx, RecordContentType contentType)
{
if (record != null && ctx != null) {
try {
Expand All @@ -3109,7 +3111,7 @@ public static void GetRecordContent(IBaseContext baseContext, GDMRecord record,
break;

case GDMRecordType.rtSource:
GKUtils.ShowSourceInfo(baseContext, record as GDMSourceRecord, ctx);
GKUtils.ShowSourceInfo(baseContext, record as GDMSourceRecord, ctx, contentType);
break;

case GDMRecordType.rtRepository:
Expand Down
7 changes: 5 additions & 2 deletions projects/GKCore/GKCore/Interfaces/IBaseWindow.cs
Original file line number Diff line number Diff line change
@@ -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".
*
Expand All @@ -25,6 +25,9 @@

namespace GKCore.Interfaces
{
public enum RecordContentType { Full, Quick }


public interface IBaseWindow : IWorkWindow
{
IBaseContext Context { get; }
Expand Down Expand Up @@ -54,7 +57,7 @@ public interface IBaseWindow : IWorkWindow

void ApplyFilter(GDMRecordType recType = GDMRecordType.rtNone);
List<GDMRecord> GetContentList(GDMRecordType recType);
StringList GetRecordContent(GDMRecord record);
StringList GetRecordContent(GDMRecord record, RecordContentType contentType);
IRecordsListModel GetRecordsListManByType(GDMRecordType recType);
GDMIndividualRecord GetSelectedPerson();
GDMRecordType GetSelectedRecordType();
Expand Down
10 changes: 8 additions & 2 deletions projects/GKCore/GKCore/Lists/AssociationsListModel.cs
Original file line number Diff line number Diff line change
@@ -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".
*
Expand Down Expand Up @@ -42,13 +42,19 @@ public AssociationsListModel(IView owner, IBaseWindow baseWin, ChangeTracker und
AllowedActions = EnumSet<RecordAction>.Create(
RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete,
RecordAction.raJump,
RecordAction.raCopy, RecordAction.raPaste);
RecordAction.raCopy, RecordAction.raPaste, RecordAction.raDetails);

fListColumns.AddColumn(LSID.Relation, 300, false);
fListColumns.AddColumn(LSID.Person, 200, false);
fListColumns.ResetDefaults();
}

protected override GDMRecord GetReferenceRecord(object itemData)
{
var ast = itemData as GDMAssociation;
return (ast == null) ? null : fBaseContext.Tree.GetPtrValue<GDMIndividualRecord>(ast);
}

public override void Fetch(GDMAssociation aRec)
{
base.Fetch(aRec);
Expand Down
10 changes: 8 additions & 2 deletions projects/GKCore/GKCore/Lists/ChildrenListModel.cs
Original file line number Diff line number Diff line change
@@ -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".
*
Expand Down Expand Up @@ -37,14 +37,20 @@ public abstract class ChildrenListModel : SheetModel<GDMChildLink>
protected ChildrenListModel(IView owner, IBaseWindow baseWin, ChangeTracker undoman) : base(owner, baseWin, undoman)
{
AllowedActions = EnumSet<RecordAction>.Create(
RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete, RecordAction.raJump);
RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete, RecordAction.raJump, RecordAction.raDetails);

fListColumns.AddColumn(LSID.NumberSym, 25, false);
fListColumns.AddColumn(LSID.Name, 300, false);
fListColumns.AddColumn(LSID.BirthDate, 100, false);
fListColumns.ResetDefaults();
}

protected override GDMRecord GetReferenceRecord(object itemData)
{
var child = itemData as GDMIndividualLink;
return (child == null) ? null : fBaseContext.Tree.GetPtrValue(child);
}

public override void Fetch(GDMChildLink aRec)
{
base.Fetch(aRec);
Expand Down
18 changes: 15 additions & 3 deletions projects/GKCore/GKCore/Lists/IndividualListModel.cs
Original file line number Diff line number Diff line change
@@ -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".
*
Expand Down Expand Up @@ -904,14 +904,20 @@ public IndiParentsListModel(IView owner, IBaseWindow baseWin, ChangeTracker undo
{
AllowedActions = EnumSet<RecordAction>.Create(
RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete,
RecordAction.raMoveDown, RecordAction.raMoveUp);
RecordAction.raMoveDown, RecordAction.raMoveUp, RecordAction.raDetails);

fListColumns.AddColumn(LSID.NumberSym, 25, false);
fListColumns.AddColumn(LSID.Name, 350, false);
fListColumns.AddColumn(LSID.Type, 100, false);
fListColumns.ResetDefaults();
}

protected override GDMRecord GetReferenceRecord(object itemData)
{
var parents = itemData as GDMChildToFamilyLink;
return (parents == null) ? null : fBaseContext.Tree.GetPtrValue(parents);
}

public override void Fetch(GDMChildToFamilyLink aRec)
{
base.Fetch(aRec);
Expand Down Expand Up @@ -1017,14 +1023,20 @@ public IndiSpousesListModel(IView owner, IBaseWindow baseWin, ChangeTracker undo
{
AllowedActions = EnumSet<RecordAction>.Create(
RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete,
RecordAction.raJump, RecordAction.raMoveUp, RecordAction.raMoveDown);
RecordAction.raJump, RecordAction.raMoveUp, RecordAction.raMoveDown, RecordAction.raDetails);

fListColumns.AddColumn(LSID.NumberSym, 25, false);
fListColumns.AddColumn(LSID.Spouse, 300, false);
fListColumns.AddColumn(LSID.MarriageDate, 100, false);
fListColumns.ResetDefaults();
}

protected override GDMRecord GetReferenceRecord(object itemData)
{
var famRec = itemData as GDMSpouseToFamilyLink;
return (famRec == null) ? null : fBaseContext.Tree.GetPtrValue(famRec);
}

public override void Fetch(GDMSpouseToFamilyLink aRec)
{
base.Fetch(aRec);
Expand Down
13 changes: 13 additions & 0 deletions projects/GKCore/GKCore/Lists/SheetModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Threading.Tasks;
using BSLib;
using GDModel;
using GKCore.Controllers;
using GKCore.Design;
using GKCore.Design.Controls;
using GKCore.Interfaces;
Expand Down Expand Up @@ -113,6 +114,8 @@ public interface ISheetModel : IListSource
ISheetList SheetList { get; set; }

Task Modify(object sender, ModifyEventArgs eArgs);

void ShowDetails(object itemData);
}


Expand Down Expand Up @@ -189,5 +192,15 @@ protected void UpdateStructList(GDMList<T> structList)
public virtual async Task Modify(object sender, ModifyEventArgs eArgs)
{
}

protected virtual GDMRecord GetReferenceRecord(object itemData)
{
return null;
}

public void ShowDetails(object itemData)
{
BaseController.ViewRecordInfo(fOwner, fBaseWin, GetReferenceRecord(itemData));
}
}
}
8 changes: 7 additions & 1 deletion projects/GKCore/GKCore/Lists/SourceCitationsListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SourceCitationsListModel(IView owner, IBaseWindow baseWin, ChangeTracker
AllowedActions = EnumSet<RecordAction>.Create(
RecordAction.raAdd, RecordAction.raEdit, RecordAction.raDelete,
RecordAction.raMoveUp, RecordAction.raMoveDown,
RecordAction.raCopy, RecordAction.raPaste);
RecordAction.raCopy, RecordAction.raPaste, RecordAction.raDetails);

fListColumns.AddColumn(LSID.NumberSym, 25, false);
fListColumns.AddColumn(LSID.Title, 260, false);
Expand All @@ -49,6 +49,12 @@ public SourceCitationsListModel(IView owner, IBaseWindow baseWin, ChangeTracker
fListColumns.ResetDefaults();
}

protected override GDMRecord GetReferenceRecord(object itemData)
{
var srcCit = itemData as GDMSourceCitation;
return (srcCit == null) ? null : fBaseContext.Tree.GetPtrValue<GDMSourceRecord>(srcCit);
}

public override void Fetch(GDMSourceCitation aRec)
{
base.Fetch(aRec);
Expand Down
3 changes: 2 additions & 1 deletion projects/GKCore/GKCore/Types/RecordAction.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2017 by Sergey V. Zhdanovskih.
* Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
Expand Down Expand Up @@ -34,5 +34,6 @@ public enum RecordAction
raCopy,
raCut,
raPaste,
raDetails,
}
}
7 changes: 4 additions & 3 deletions projects/GKTests/GKCore/GKUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using BSLib;
using GDModel;
using GDModel.Providers.GEDCOM;
using GKCore.Interfaces;
using GKCore.Options;
using GKCore.Types;
using GKTests;
Expand Down Expand Up @@ -582,9 +583,9 @@ public void Test_ShowXInfo()
GKUtils.ShowPersonInfo(fContext, indRec, summary);

summary.Clear();
GKUtils.ShowSourceInfo(null, null, null);
GKUtils.ShowSourceInfo(null, null, null, RecordContentType.Quick);
GDMSourceRecord srcRec = fContext.Tree.XRefIndex_Find("S1") as GDMSourceRecord;
GKUtils.ShowSourceInfo(fContext, srcRec, summary);
GKUtils.ShowSourceInfo(fContext, srcRec, summary, RecordContentType.Quick);

summary.Clear();
GKUtils.ShowRepositoryInfo(null, null, null);
Expand Down Expand Up @@ -657,7 +658,7 @@ public void Test_GetRegionalDate()
[Test]
public void Test_GetRecordContent()
{
GKUtils.GetRecordContent(null, null, null);
GKUtils.GetRecordContent(null, null, null, RecordContentType.Quick);
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion projects/GKTests/Stubs/BaseWindowStub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void Show() { }
public void ShowMedia(GDMMultimediaRecord mediaRec, bool modal) { }

public List<GDMRecord> GetContentList(GDMRecordType recType) { return null; }
public StringList GetRecordContent(GDMRecord record) { return null; }
public StringList GetRecordContent(GDMRecord record, RecordContentType contentType) { return null; }
public string GetRecordName(GDMRecord record, bool signed) { return string.Empty; }
public IRecordsListModel GetRecordsListManByType(GDMRecordType recType) { return null; }
public GDMIndividualRecord GetSelectedPerson() { return null; }
Expand Down
4 changes: 2 additions & 2 deletions projects/GKv2/GEDKeeper2/GKUI/Forms/BaseWinSDI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,9 @@ public void SelectRecordByXRef(string xref, bool delayedTransition = false)
fController.SelectRecordByXRef(xref, delayedTransition);
}

public StringList GetRecordContent(GDMRecord record)
public StringList GetRecordContent(GDMRecord record, RecordContentType contentType)
{
return fController.GetRecordContent(record);
return fController.GetRecordContent(record, contentType);
}

public bool RecordIsFiltered(GDMRecord record)
Expand Down
Loading

0 comments on commit c2ee43d

Please sign in to comment.