Skip to content

Commit

Permalink
Small bugfix; update of history; refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed Jul 8, 2019
1 parent a3ff440 commit 2393724
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 78 deletions.
12 changes: 11 additions & 1 deletion locales/help_enu/gkhHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@

<h1>Change log</h1>

<p><b>20.06.2019 [v2.16.0]</b><ul>
<p><b>08.07.2019 [v2.16.0-rc.2]</b><ul>
<li>(*) Fixed editing dates of events with periods.
<li>(+) Added new diagnostics for data verification: for families without spouses and/or children [Kevin D. Sandal].
<li>(+) Added hotkey for saving files from tree diagrams.
<li>(*) Fixed support for formats with zero IDs of records.
<li>(*) Fixed opening files and OSM geocoder operation.
<li>(*) Cleaning and optimization, improved support for two third-party GEDCOM formats.
<li>(*) Fixed the script of the portable package.
</ul></p>

<p><b>20.06.2019 [v2.16.0-rc.1]</b><ul>
<li>(*) Fixed the work of the "Compare databases" tool.
<li>(*) Fixed external viewing of PDF files (and other not supported by the embedded viewer).
<li>(*) Proofreading of the English manual [Kevin D. Sandal].
Expand Down
12 changes: 11 additions & 1 deletion locales/help_rus/gkhHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@

<h1>История версий</h1>

<p><b>20.06.2019 [v2.16.0]</b><ul>
<p><b>08.07.2019 [v2.16.0-rc.2]</b><ul>
<li>(*) Исправлено редактирование дат событий с периодами.
<li>(+) Добавлена новая диагностика проверки данных: на семьи без супругов и/или детей [Kevin D. Sandal].
<li>(+) Добавлены горячие клавиши сохранения файлов из диаграмм деревьев.
<li>(*) Исправлена поддержка форматов с нулевыми идентификаторами записей.
<li>(*) Исправлено открытие файлов и работа OSM-геокодера.
<li>(*) Чистка и оптимизация, улучшена поддержка двух сторонних форматов GEDCOM.
<li>(*) Исправлен скрипт портируемого пакета установки.
</ul></p>

<p><b>20.06.2019 [v2.16.0-rc.1]</b><ul>
<li>(*) Исправлена работа инструмента «Сравнить базы данных».
<li>(*) Исправлен внешний просмотр файлов PDF (и других, не поддерживаемых встроенным средством просмотра).
<li>(*) Корректура английского мануала [Kevin D. Sandal].
Expand Down
8 changes: 4 additions & 4 deletions projects/GKCore/GDModel/GDMCustomDate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,16 @@ public static GDMDate CreateApproximated(GDMObject owner, GDMDate date, GDMAppro
public static GDMDatePeriod CreatePeriod(GDMObject owner, GDMDate dateFrom, GDMDate dateTo)
{
GDMDatePeriod result = new GDMDatePeriod(owner);
result.DateFrom.Assign(dateFrom);
result.DateTo.Assign(dateTo);
if (dateFrom != null) result.DateFrom.Assign(dateFrom);
if (dateTo != null) result.DateTo.Assign(dateTo);
return result;
}

public static GDMDateRange CreateRange(GDMObject owner, GDMDate dateAfter, GDMDate dateBefore)
{
GDMDateRange result = new GDMDateRange(owner);
result.After.Assign(dateAfter);
result.Before.Assign(dateBefore);
if (dateAfter != null) result.After.Assign(dateAfter);
if (dateBefore != null) result.Before.Assign(dateBefore);
return result;
}
}
Expand Down
34 changes: 9 additions & 25 deletions projects/GKCore/GDModel/GDMIndividualRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,18 @@ public enum GDMSex

public sealed class GDMIndividualRecord : GDMRecordWithEvents
{
private string fAncestralFileNumber;
private GDMList<GDMAlias> fAliasses;
private GDMList<GDMAlias> fAliases;
private GDMList<GDMAssociation> fAssociations;
private GDMList<GDMChildToFamilyLink> fChildToFamilyLinks;
private GDMList<GDMPointer> fGroups;
private string fPermanentRecordFileNumber;
private GDMList<GDMPersonalName> fPersonalNames;
private GDMList<GDMSpouseToFamilyLink> fSpouseToFamilyLinks;
private GDMSex fSex;


public GDMList<GDMAlias> Aliases
{
get { return fAliasses; }
}

public string AncestralFileNumber
{
get { return fAncestralFileNumber; }
set { fAncestralFileNumber = value; }
get { return fAliases; }
}

public GDMList<GDMAssociation> Associations
Expand Down Expand Up @@ -109,12 +101,6 @@ public bool Patriarch
}
}

public string PermanentRecordFileNumber
{
get { return fPermanentRecordFileNumber; }
set { fPermanentRecordFileNumber = value; }
}

public GDMList<GDMPersonalName> PersonalNames
{
get { return fPersonalNames; }
Expand All @@ -136,20 +122,18 @@ public GDMIndividualRecord(GDMObject owner) : base(owner)
{
SetName(GEDCOMTagType.INDI);

fAncestralFileNumber = string.Empty;
fAliasses = new GDMList<GDMAlias>(this);
fAliases = new GDMList<GDMAlias>(this);
fAssociations = new GDMList<GDMAssociation>(this);
fChildToFamilyLinks = new GDMList<GDMChildToFamilyLink>(this);
fGroups = new GDMList<GDMPointer>(this);
fPermanentRecordFileNumber = string.Empty;
fPersonalNames = new GDMList<GDMPersonalName>(this);
fSpouseToFamilyLinks = new GDMList<GDMSpouseToFamilyLink>(this);
}

protected override void Dispose(bool disposing)
{
if (disposing) {
fAliasses.Dispose();
fAliases.Dispose();
fAssociations.Dispose();
fChildToFamilyLinks.Dispose();
fGroups.Dispose();
Expand Down Expand Up @@ -204,7 +188,7 @@ public override void Clear()
}
fGroups.Clear();

fAliasses.Clear();
fAliases.Clear();
fAssociations.Clear();
fPersonalNames.Clear();
}
Expand All @@ -213,7 +197,7 @@ public override bool IsEmpty()
{
return base.IsEmpty() && (fSex == GDMSex.svUnknown) && fPersonalNames.Count == 0
&& fChildToFamilyLinks.Count == 0 && fSpouseToFamilyLinks.Count == 0
&& fAssociations.Count == 0 && fAliasses.Count == 0 && fGroups.Count == 0;
&& fAssociations.Count == 0 && fAliases.Count == 0 && fGroups.Count == 0;
}

public int IndexOfGroup(GDMGroupRecord groupRec)
Expand Down Expand Up @@ -354,8 +338,8 @@ public override void MoveTo(GDMRecord targetRecord, bool clearDest)
targetIndi.Associations.Add(obj);
}

while (fAliasses.Count > 0) {
GDMAlias obj = fAliasses.Extract(0);
while (fAliases.Count > 0) {
GDMAlias obj = fAliases.Extract(0);
obj.ResetOwner(targetIndi);
targetIndi.Aliases.Add(obj);
}
Expand All @@ -371,7 +355,7 @@ public override void ReplaceXRefs(GDMXRefReplacer map)
{
base.ReplaceXRefs(map);

fAliasses.ReplaceXRefs(map);
fAliases.ReplaceXRefs(map);
fAssociations.ReplaceXRefs(map);
fChildToFamilyLinks.ReplaceXRefs(map);
fGroups.ReplaceXRefs(map);
Expand Down
18 changes: 1 addition & 17 deletions projects/GKCore/GDModel/GDMRecordWithEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public abstract class GDMRecordWithEvents : GDMRecord, IGEDCOMRecordWithEvents
{
private GDMList<GDMCustomEvent> fEvents;
private GDMRestriction fRestriction;
private GDMList<GDMPointer> fSubmittors;


public GDMList<GDMCustomEvent> Events
Expand All @@ -53,23 +52,16 @@ public GDMRestriction Restriction
set { fRestriction = value; }
}

public GDMList<GDMPointer> Submittors
{
get { return fSubmittors; }
}


protected GDMRecordWithEvents(GDMObject owner) : base(owner)
{
fEvents = new GDMList<GDMCustomEvent>(this);
fSubmittors = new GDMList<GDMPointer>(this);
}

protected override void Dispose(bool disposing)
{
if (disposing) {
fEvents.Dispose();
fSubmittors.Dispose();
}
base.Dispose(disposing);
}
Expand All @@ -80,13 +72,12 @@ public override void Clear()

fEvents.Clear();
fRestriction = GDMRestriction.rnNone;
fSubmittors.Clear();
}

public override bool IsEmpty()
{
// Restrictions are not checked because they are not important if other fields are empty.
return base.IsEmpty() && (fEvents.Count == 0) && (fSubmittors.Count == 0);
return base.IsEmpty() && (fEvents.Count == 0);
}

public override void Assign(GDMTag source)
Expand Down Expand Up @@ -121,19 +112,12 @@ public override void MoveTo(GDMRecord targetRecord, bool clearDest)
}

target.Restriction = fRestriction;

while (fSubmittors.Count > 0) {
GDMPointer obj = fSubmittors.Extract(0);
obj.ResetOwner(target);
target.Submittors.Add(obj);
}
}

public override void ReplaceXRefs(GDMXRefReplacer map)
{
base.ReplaceXRefs(map);
fEvents.ReplaceXRefs(map);
fSubmittors.ReplaceXRefs(map);
}

public GDMCustomEvent FindEvent(string eventName)
Expand Down
7 changes: 7 additions & 0 deletions projects/GKCore/GDModel/Providers/GEDCOM/GEDCOMChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,5 +471,12 @@ public static bool CheckGEDCOMFormat(GDMTree tree, IBaseContext baseContext, IPr

return result;
}

public static void ClearGEDCOMFormat(GDMTree tree, IBaseContext baseContext, IProgressController pc)
{
// TODO
// INDI: remove AFN, RFN
// INDI,FAM: remove SUBM
}
}
}
9 changes: 0 additions & 9 deletions projects/GKCore/GDModel/Providers/GEDCOM/GEDCOMProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,6 @@ private static StackTuple AddIndividualRecordTag(GDMObject owner, int tagLevel,
curTag = indiRec.Groups.Add(new GDMPointer(indiRec, tagId, tagValue));
} else if (tagType == GEDCOMTagType.SEX) {
indiRec.Sex = GEDCOMUtils.GetSexVal(tagValue);
} else if (tagType == GEDCOMTagType.AFN) {
indiRec.AncestralFileNumber = tagValue;
} else if (tagType == GEDCOMTagType.RFN) {
indiRec.PermanentRecordFileNumber = tagValue;
} else {
return AddRecordWithEventsTag(owner, tagLevel, tagId, tagValue);
}
Expand All @@ -685,8 +681,6 @@ private static void WriteIndividualRecord(StreamWriter stream, int level, GDMTag

level += 1;
GEDCOMProvider.WriteTagLine(stream, level, GEDCOMTagName.SEX, GEDCOMUtils.GetSexStr(indiRec.Sex), true);
GEDCOMProvider.WriteTagLine(stream, level, GEDCOMTagName.AFN, indiRec.AncestralFileNumber, true);
GEDCOMProvider.WriteTagLine(stream, level, GEDCOMTagName.RFN, indiRec.PermanentRecordFileNumber, true);

WriteList(stream, level, indiRec.PersonalNames, WritePersonalName);
WriteList(stream, level, indiRec.ChildToFamilyLinks, WriteChildToFamilyLink);
Expand Down Expand Up @@ -750,8 +744,6 @@ private static StackTuple AddRecordWithEventsTag(GDMObject owner, int tagLevel,
GEDCOMTagType tagType = (GEDCOMTagType)tagId;
if (tagType == GEDCOMTagType.RESN) {
evtRec.Restriction = GEDCOMUtils.GetRestrictionVal(tagValue);
} else if (tagType == GEDCOMTagType.SUBM) {
curTag = evtRec.Submittors.Add(new GDMPointer(evtRec, tagId, tagValue));
} else {
return AddRecordTag(owner, tagLevel, tagId, tagValue);
}
Expand All @@ -767,7 +759,6 @@ private static void WriteRecordWithEvents(StreamWriter stream, int level, GDMTag

level += 1;
WriteTagLine(stream, level, GEDCOMTagName.RESN, GEDCOMUtils.GetRestrictionStr(recWE.Restriction), true);
WriteList(stream, level, recWE.Submittors, WriteTagEx);
}


Expand Down
8 changes: 0 additions & 8 deletions projects/GKCore/GKCore/Tools/TreeTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -861,10 +861,6 @@ private static void CheckRelations_CheckIndividual(List<GDMRecord> splitList, GD
CheckRelations_CheckTag(splitList, iRec.Events[i]);
}

for (int i = 0, num = iRec.Submittors.Count; i < num; i++) {
CheckRelations_AddRel(splitList, iRec.Submittors[i].Value);
}

for (int i = 0, num = iRec.Associations.Count; i < num; i++) {
CheckRelations_AddRel(splitList, iRec.Associations[i].Value);
}
Expand All @@ -885,10 +881,6 @@ private static void CheckRelations_CheckFamily(List<GDMRecord> splitList, GDMFam
for (int i = 0, num = fRec.Events.Count; i < num; i++) {
CheckRelations_CheckTag(splitList, fRec.Events[i]);
}

for (int i = 0, num = fRec.Submittors.Count; i < num; i++) {
CheckRelations_AddRel(splitList, fRec.Submittors[i].Value);
}
}

private static void CheckRelations_CheckSource(List<GDMRecord> splitList, GDMSourceRecord sRec)
Expand Down
2 changes: 0 additions & 2 deletions projects/GKTests/GDModel/GDMFamilyRecordTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public void Test_Common()
GDMFamilyRecord famRec = tree.CreateFamily();
Assert.IsNotNull(famRec);

Assert.IsNotNull(famRec.Submittors);

famRec.Restriction = GDMRestriction.rnLocked;
Assert.AreEqual(GDMRestriction.rnLocked, famRec.Restriction);

Expand Down
8 changes: 0 additions & 8 deletions projects/GKTests/GDModel/GDMIndividualRecordTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public void Test_Common()
//
Assert.IsNotNull(indiRec.Aliases);
Assert.IsNotNull(indiRec.Associations);
Assert.IsNotNull(indiRec.Submittors);
Assert.IsNotNull(indiRec.UserReferences); // for GEDCOMRecord

Assert.Throws(typeof(ArgumentException), () => {
Expand Down Expand Up @@ -127,12 +126,6 @@ public void Test_Common()
indiRec.Bookmark = false;
Assert.AreEqual(false, indiRec.Bookmark);

indiRec.AncestralFileNumber = "test11";
Assert.AreEqual("test11", indiRec.AncestralFileNumber);

indiRec.PermanentRecordFileNumber = "test22";
Assert.AreEqual("test22", indiRec.PermanentRecordFileNumber);

Assert.Throws(typeof(ArgumentException), () => { indiRec.MoveTo(null, false); });

using (GDMIndividualRecord copyIndi = new GDMIndividualRecord(null)) {
Expand Down Expand Up @@ -209,7 +202,6 @@ public void Test_Common()

indi.AddAssociation("test", ind);
indi.Aliases.Add(new GDMAlias(indi));
indi.Submittors.Add(new GDMPointer(indi));

using (GDMIndividualRecord indi3 = new GDMIndividualRecord(fContext.Tree)) {
indi.MoveTo(indi3, false);
Expand Down
6 changes: 3 additions & 3 deletions projects/GKTests/Resources/test_native.ged
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
2 NOTE ChangeDateNote test
2 DATE 07 NOV 2015
3 TIME 23:46:45.7
1 SUBM @SUB1@
1 AFN 12345
1 RFN 23456
1 RIN 123456
1 NOTE @N1@
1 SOUR Source Citation Sample
2 CONT Source Citation Sample Line 1
2 CONT Source Citation Sample Line 2
2 CONT Source Citation Sample Line 3
1 RESN confidential
1 SUBM @SUB1@
1 SEX M
1 AFN 12345
1 RFN 23456
1 NAME John /Doe/
2 FONE Phonetic
2 ROMN Romanized name
Expand Down

0 comments on commit 2393724

Please sign in to comment.