diff --git a/projects/GKCore/GDModel/GDMDate.cs b/projects/GKCore/GDModel/GDMDate.cs
index 5cc8e1b8c..edb5ec5e9 100644
--- a/projects/GKCore/GDModel/GDMDate.cs
+++ b/projects/GKCore/GDModel/GDMDate.cs
@@ -200,7 +200,7 @@ public override string ParseString(string strValue)
///
/// Internal helper method for parser
///
- internal void SetRawData(GDMApproximated approximated, GDMCalendar calendar,
+ internal void SetRawData(GDMApproximated approximated, GDMCalendar calendar,
short year, bool yearBC, string yearModifier, byte month, byte day)
{
fApproximated = approximated;
@@ -219,8 +219,7 @@ internal void SetRawData(GDMApproximated approximated, GDMCalendar calendar,
public static string[] GetMonthNames(GDMCalendar calendar)
{
string[] monthes;
- switch (calendar)
- {
+ switch (calendar) {
case GDMCalendar.dcGregorian:
case GDMCalendar.dcJulian:
case GDMCalendar.dcRoman:
@@ -267,22 +266,23 @@ private static string CheckGEDCOMMonth(GDMCalendar calendar, string str)
protected override string GetStringValue()
{
- var parts = new List(5);
+ var parts = new string[5];
+ int pIdx = 0;
if (fApproximated != GDMApproximated.daExact) {
- parts.Add(GEDCOMConsts.GEDCOMDateApproximatedArray[(int)fApproximated]);
+ parts[pIdx++] = GEDCOMConsts.GEDCOMDateApproximatedArray[(int)fApproximated];
}
if (fCalendar != GDMCalendar.dcGregorian) {
- parts.Add(GEDCOMConsts.GEDCOMDateEscapeArray[(int)fCalendar]);
+ parts[pIdx++] = GEDCOMConsts.GEDCOMDateEscapeArray[(int)fCalendar];
}
if (fDay > 0) {
- parts.Add(fDay.ToString("D2"));
+ parts[pIdx++] = fDay.ToString("D2");
}
if (fMonth > 0) {
string[] months = GetMonthNames(fCalendar);
- parts.Add(months[fMonth - 1]);
+ parts[pIdx++] = months[fMonth - 1];
}
if (fYear != UNKNOWN_YEAR) {
@@ -295,10 +295,10 @@ protected override string GetStringValue()
yearStr += GEDCOMConsts.YearBC;
}
- parts.Add(yearStr);
+ parts[pIdx++] = yearStr;
}
- return string.Join(" ", parts);
+ return string.Join(" ", parts, 0, pIdx);
}
private static byte GetMonthNumber(GDMCalendar calendar, string strMonth)
@@ -526,7 +526,8 @@ public static UDN GetUDNByFormattedStr(string dateStr, GDMCalendar calendar, boo
public string GetDisplayString(DateFormat format, bool includeBC = false, bool showCalendar = false)
{
- string result = "";
+ var parts = new string[5];
+ int pIdx = 0;
int year = fYear;
int month = fMonth;
@@ -536,44 +537,39 @@ public string GetDisplayString(DateFormat format, bool includeBC = false, bool s
if (year > 0 || month > 0 || day > 0) {
switch (format) {
case DateFormat.dfDD_MM_YYYY:
- result += day > 0 ? ConvertHelper.AdjustNumber(day, 2) + "." : "__.";
- result += month > 0 ? ConvertHelper.AdjustNumber(month, 2) + "." : "__.";
- result += year > 0 ? year.ToString().PadLeft(4, '_') : "____";
+ parts[pIdx++] = day > 0 ? ConvertHelper.AdjustNumber(day, 2) + "." : "__.";
+ parts[pIdx++] = month > 0 ? ConvertHelper.AdjustNumber(month, 2) + "." : "__.";
+ parts[pIdx++] = year > 0 ? year.ToString().PadLeft(4, '_') : "____";
+ if (includeBC && ybc) {
+ parts[pIdx++] = " BC";
+ }
break;
case DateFormat.dfYYYY_MM_DD:
- result += year > 0 ? year.ToString().PadLeft(4, '_') + "." : "____.";
- result += month > 0 ? ConvertHelper.AdjustNumber(month, 2) + "." : "__.";
- result += day > 0 ? ConvertHelper.AdjustNumber(day, 2) : "__";
+ if (includeBC && ybc) {
+ parts[pIdx++] = "BC ";
+ }
+ parts[pIdx++] = year > 0 ? year.ToString().PadLeft(4, '_') + "." : "____.";
+ parts[pIdx++] = month > 0 ? ConvertHelper.AdjustNumber(month, 2) + "." : "__.";
+ parts[pIdx++] = day > 0 ? ConvertHelper.AdjustNumber(day, 2) : "__";
break;
case DateFormat.dfYYYY:
if (year > 0) {
- result = year.ToString().PadLeft(4, '_');
+ if (includeBC && ybc) {
+ parts[pIdx++] = "BC ";
+ }
+ parts[pIdx++] = year.ToString().PadLeft(4, '_');
}
break;
}
}
- if (includeBC && ybc) {
- switch (format) {
- case DateFormat.dfDD_MM_YYYY:
- result = result + " BC";
- break;
- case DateFormat.dfYYYY_MM_DD:
- result = "BC " + result;
- break;
- case DateFormat.dfYYYY:
- result = "BC " + result;
- break;
- }
- }
-
if (showCalendar) {
- result = result + GKUtils.GetCalendarSign(fCalendar);
+ parts[pIdx] = GKUtils.GetCalendarSign(fCalendar);
}
- return result;
+ return string.Concat(parts);
}
public override string GetDisplayStringExt(DateFormat format, bool sign, bool showCalendar, bool shorten = false)
diff --git a/projects/GKCore/GDModel/GDMDatePeriod.cs b/projects/GKCore/GDModel/GDMDatePeriod.cs
index 704903c0f..a96fc3096 100644
--- a/projects/GKCore/GDModel/GDMDatePeriod.cs
+++ b/projects/GKCore/GDModel/GDMDatePeriod.cs
@@ -61,30 +61,40 @@ internal override void TrimExcess()
protected override string GetStringValue()
{
string result;
- if (!fDateFrom.IsEmpty() && !fDateTo.IsEmpty()) {
+
+ bool frEmpty = fDateFrom.IsEmpty();
+ bool toEmpty = fDateTo.IsEmpty();
+
+ if (!frEmpty && !toEmpty) {
result = string.Concat("FROM ", fDateFrom.StringValue, " TO ", fDateTo.StringValue);
- } else if (!fDateFrom.IsEmpty()) {
+ } else if (!frEmpty) {
result = "FROM " + fDateFrom.StringValue;
- } else if (!fDateTo.IsEmpty()) {
+ } else if (!toEmpty) {
result = "TO " + fDateTo.StringValue;
} else {
result = "";
}
+
return result;
}
public override DateTime GetDateTime()
{
DateTime result;
- if (fDateFrom.IsEmpty()) {
+
+ bool frEmpty = fDateFrom.IsEmpty();
+ bool toEmpty = fDateTo.IsEmpty();
+
+ if (frEmpty) {
result = fDateTo.GetDateTime();
- } else if (fDateTo.IsEmpty()) {
+ } else if (toEmpty) {
result = fDateFrom.GetDateTime();
} else if (fDateFrom.GetDateTime() == fDateTo.GetDateTime()) {
result = fDateFrom.GetDateTime();
} else {
result = new DateTime(0);
}
+
return result;
}
@@ -126,12 +136,15 @@ public override UDN GetUDN()
{
UDN result;
- if (fDateFrom.StringValue != "" && fDateTo.StringValue == "") {
+ bool frEmpty = fDateFrom.IsEmpty();
+ bool toEmpty = fDateTo.IsEmpty();
+
+ if (!frEmpty && !toEmpty) {
+ result = UDN.CreateBetween(fDateFrom.GetUDN(), fDateTo.GetUDN(), false);
+ } else if (!frEmpty) {
result = UDN.CreateAfter(fDateFrom.GetUDN());
- } else if (fDateFrom.StringValue == "" && fDateTo.StringValue != "") {
+ } else if (!toEmpty) {
result = UDN.CreateBefore(fDateTo.GetUDN());
- } else if (fDateFrom.StringValue != "" && fDateTo.StringValue != "") {
- result = UDN.CreateBetween(fDateFrom.GetUDN(), fDateTo.GetUDN(), false);
} else {
result = UDN.CreateUnknown();
}
@@ -141,16 +154,21 @@ public override UDN GetUDN()
public override string GetDisplayStringExt(DateFormat format, bool sign, bool showCalendar, bool shorten = false)
{
- string result = "";
+ string result;
- if (fDateFrom.StringValue != "" && fDateTo.StringValue == "") {
+ bool frEmpty = fDateFrom.IsEmpty();
+ bool toEmpty = fDateTo.IsEmpty();
+
+ if (!frEmpty && !toEmpty) {
+ result = fDateFrom.GetDisplayString(format, true, showCalendar) + " - " + fDateTo.GetDisplayString(format, true, showCalendar);
+ } else if (!frEmpty) {
result = fDateFrom.GetDisplayString(format, true, showCalendar);
if (sign) result += " >";
- } else if (fDateFrom.StringValue == "" && fDateTo.StringValue != "") {
+ } else if (!toEmpty) {
result = fDateTo.GetDisplayString(format, true, showCalendar);
if (sign) result = "< " + result;
- } else if (fDateFrom.StringValue != "" && fDateTo.StringValue != "") {
- result = fDateFrom.GetDisplayString(format, true, showCalendar) + " - " + fDateTo.GetDisplayString(format, true, showCalendar);
+ } else {
+ result = "";
}
return result;
diff --git a/projects/GKCore/GDModel/GDMDateRange.cs b/projects/GKCore/GDModel/GDMDateRange.cs
index 40d79022f..c2e6102d5 100644
--- a/projects/GKCore/GDModel/GDMDateRange.cs
+++ b/projects/GKCore/GDModel/GDMDateRange.cs
@@ -61,24 +61,33 @@ internal override void TrimExcess()
protected override string GetStringValue()
{
string result;
- if (!fDateAfter.IsEmpty() && !fDateBefore.IsEmpty()) {
+
+ bool aftEmpty = fDateAfter.IsEmpty();
+ bool befEmpty = fDateBefore.IsEmpty();
+
+ if (!aftEmpty && !befEmpty) {
result = string.Concat(GEDCOMConsts.GEDCOMDateRangeArray[2], " ", fDateAfter.StringValue, " ", GEDCOMConsts.GEDCOMDateRangeArray[3], " ", fDateBefore.StringValue);
- } else if (!fDateAfter.IsEmpty()) {
+ } else if (!aftEmpty) {
result = GEDCOMConsts.GEDCOMDateRangeArray[0] + " " + fDateAfter.StringValue;
- } else if (!fDateBefore.IsEmpty()) {
+ } else if (!befEmpty) {
result = GEDCOMConsts.GEDCOMDateRangeArray[1] + " " + fDateBefore.StringValue;
} else {
result = "";
}
+
return result;
}
public override DateTime GetDateTime()
{
DateTime result;
- if (fDateAfter.IsEmpty()) {
+
+ bool aftEmpty = fDateAfter.IsEmpty();
+ bool befEmpty = fDateBefore.IsEmpty();
+
+ if (aftEmpty) {
result = fDateBefore.GetDateTime();
- } else if (fDateBefore.IsEmpty()) {
+ } else if (befEmpty) {
result = fDateAfter.GetDateTime();
} else {
result = new DateTime(0);
@@ -125,12 +134,15 @@ public override UDN GetUDN()
{
UDN result;
- if (fDateAfter.StringValue == "" && fDateBefore.StringValue != "") {
- result = UDN.CreateBefore(fDateBefore.GetUDN());
- } else if (fDateAfter.StringValue != "" && fDateBefore.StringValue == "") {
- result = UDN.CreateAfter(fDateAfter.GetUDN());
- } else if (fDateAfter.StringValue != "" && fDateBefore.StringValue != "") {
+ bool aftEmpty = fDateAfter.IsEmpty();
+ bool befEmpty = fDateBefore.IsEmpty();
+
+ if (!aftEmpty && !befEmpty) {
result = UDN.CreateBetween(fDateAfter.GetUDN(), fDateBefore.GetUDN(), false);
+ } else if (!aftEmpty) {
+ result = UDN.CreateAfter(fDateAfter.GetUDN());
+ } else if (!befEmpty) {
+ result = UDN.CreateBefore(fDateBefore.GetUDN());
} else {
result = UDN.CreateUnknown();
}
@@ -140,15 +152,12 @@ public override UDN GetUDN()
public override string GetDisplayStringExt(DateFormat format, bool sign, bool showCalendar, bool shorten = false)
{
- string result = "";
+ string result;
- if (fDateAfter.StringValue == "" && fDateBefore.StringValue != "") {
- result = fDateBefore.GetDisplayString(format, true, showCalendar);
- if (sign) result = "< " + result;
- } else if (fDateAfter.StringValue != "" && fDateBefore.StringValue == "") {
- result = fDateAfter.GetDisplayString(format, true, showCalendar);
- if (sign) result += " >";
- } else if (fDateAfter.StringValue != "" && fDateBefore.StringValue != "") {
+ bool aftEmpty = fDateAfter.IsEmpty();
+ bool befEmpty = fDateBefore.IsEmpty();
+
+ if (!aftEmpty && !befEmpty) {
var dateAfter = fDateAfter.GetDisplayString(format, true, showCalendar);
var dateBefore = fDateBefore.GetDisplayString(format, true, showCalendar);
@@ -164,6 +173,14 @@ public override string GetDisplayStringExt(DateFormat format, bool sign, bool sh
} else {
result = dateAfter + " - " + dateBefore;
}
+ } else if (!aftEmpty) {
+ result = fDateAfter.GetDisplayString(format, true, showCalendar);
+ if (sign) result += " >";
+ } else if (!befEmpty) {
+ result = fDateBefore.GetDisplayString(format, true, showCalendar);
+ if (sign) result = "< " + result;
+ } else {
+ result = "";
}
return result;
diff --git a/projects/GKCore/GKCore/AppHost.cs b/projects/GKCore/GKCore/AppHost.cs
index 66d7e3b41..b6cbfc0b4 100644
--- a/projects/GKCore/GKCore/AppHost.cs
+++ b/projects/GKCore/GKCore/AppHost.cs
@@ -104,6 +104,10 @@ protected AppHost()
fTips = new StringList();
}
+ protected virtual void ApplicationExit()
+ {
+ }
+
private void AutosaveTimer_Tick(object sender, EventArgs e)
{
try {
diff --git a/projects/GKCore/GKCore/Controllers/PersonEditDlgController.cs b/projects/GKCore/GKCore/Controllers/PersonEditDlgController.cs
index e317e44c5..230564a20 100644
--- a/projects/GKCore/GKCore/Controllers/PersonEditDlgController.cs
+++ b/projects/GKCore/GKCore/Controllers/PersonEditDlgController.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".
*
@@ -82,6 +82,13 @@ public PersonEditDlgController(T view) : base(view)
}
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing) {
+ }
+ base.Dispose(disposing);
+ }
+
public override void Init(IBaseWindow baseWin)
{
base.Init(baseWin);
diff --git a/projects/GKCore/GKCore/Design/Graphics/IGraphicsProvider.cs b/projects/GKCore/GKCore/Design/Graphics/IGraphicsProvider.cs
index 77951162f..712971489 100644
--- a/projects/GKCore/GKCore/Design/Graphics/IGraphicsProvider.cs
+++ b/projects/GKCore/GKCore/Design/Graphics/IGraphicsProvider.cs
@@ -48,6 +48,8 @@ public interface IGraphicsProvider
IFont CreateFont(string fontName, float size, bool bold);
+ void FreeImage(ref IImage image);
+
IImage LoadImage(Stream stream, int thumbWidth, int thumbHeight, ExtRect cutoutArea, string cachedFile);
///
diff --git a/projects/GKCore/GKCore/GKUtils.cs b/projects/GKCore/GKCore/GKUtils.cs
index 0a22714ff..852ad72b6 100644
--- a/projects/GKCore/GKCore/GKUtils.cs
+++ b/projects/GKCore/GKCore/GKUtils.cs
@@ -203,14 +203,16 @@ public static StringList GetLocationLinks(GDMTree tree, GDMLocationRecord locRec
public static string HyperLink(string xref, string text, int num = 0)
{
- string result = "";
+ string result;
if (!string.IsNullOrEmpty(xref) && string.IsNullOrEmpty(text)) {
text = "???";
}
if (!string.IsNullOrEmpty(xref) && !string.IsNullOrEmpty(text)) {
- result = "[url=" + xref + "]" + text + "[/url]";
+ result = string.Concat("[url=", xref, "]", text, "[/url]");
+ } else {
+ result = "";
}
return result;
@@ -711,10 +713,10 @@ public static string GetAttributeStr(GDMIndividualAttribute iAttr)
if (iAttr.HasPlace) {
place = iAttr.Place.StringValue;
if (place != "") {
- place = " [" + place + "]";
+ place = string.Concat(" [", place, "]");
}
}
- return st + ": " + iAttr.StringValue + place;
+ return string.Concat(st, ": ", iAttr.StringValue, place);
}
public static string GetEventStr(GDMCustomEvent evt)
@@ -724,9 +726,9 @@ public static string GetEventStr(GDMCustomEvent evt)
string attrVal = (IsAttribute(evt) && !string.IsNullOrEmpty(evt.StringValue)) ? string.Format(" `{0}`", evt.StringValue) : string.Empty;
- string result = dt + ": " + st + attrVal + ".";
+ string result = string.Concat(dt, ": ", st, attrVal, ".");
if (evt.HasPlace && evt.Place.StringValue != "") {
- result = result + " " + LangMan.LS(LSID.Place) + ": " + evt.Place.StringValue;
+ result = string.Concat(result, " ", LangMan.LS(LSID.Place), ": ", evt.Place.StringValue);
}
return result;
}
@@ -779,7 +781,7 @@ public static string GetEventCause(GDMCustomEvent evt)
if (result != "") {
result += " ";
}
- result = result + "[" + evt.Agency + "]";
+ result = string.Concat(result, "[", evt.Agency, "]");
}
return result;
@@ -2067,67 +2069,63 @@ private static void ShowLink(GDMTree tree, GDMRecord aSubject, StringList aToLis
private static void ShowPersonExtInfo(GDMTree tree, GDMIndividualRecord iRec, StringList summary)
{
- /*if (tree == null || iRec == null || summary == null) return;
+ if (tree == null || iRec == null || summary == null) return;
+
+ if (!GlobalOptions.Instance.ShowIndiAssociations) return;
summary.Add("");
int num = tree.RecordsCount;
for (int i = 0; i < num; i++) {
- GEDCOMRecord rec = tree[i];
- if (rec.RecordType != GEDCOMRecordType.rtIndividual) continue;
+ GDMRecord rec = tree[i];
+ if (rec.RecordType != GDMRecordType.rtIndividual) continue;
- GEDCOMIndividualRecord ir = (GEDCOMIndividualRecord)rec;
+ GDMIndividualRecord ir = (GDMIndividualRecord)rec;
+ if (!ir.HasAssociations) continue;
bool first = true;
for (int k = 0, cnt = ir.Associations.Count; k < cnt; k++) {
- GEDCOMAssociation asso = ir.Associations[k];
+ GDMAssociation asso = ir.Associations[k];
- if (asso.Individual == iRec) {
+ if (asso.XRef == iRec.XRef) {
if (first) {
summary.Add(LangMan.LS(LSID.Associations) + ":");
first = false;
}
- summary.Add(" " + HyperLink(ir.XRef, ir.GetNameString(true, false), 0));
+ summary.Add(" " + HyperLink(ir.XRef, GetNameString(ir, true, false)));
}
}
- }*/
+ }
}
private static void ShowPersonNamesakes(GDMTree tree, GDMIndividualRecord iRec, StringList summary)
{
- try {
- StringList namesakes = new StringList();
- try {
- string st = GetNameString(iRec, false);
+ if (!GlobalOptions.Instance.ShowIndiNamesakes) return;
- int num3 = tree.RecordsCount;
- for (int i = 0; i < num3; i++) {
- GDMRecord rec = tree[i];
+ try {
+ var namesakes = new List();
+ string st = GetNameString(iRec, false);
- if (rec is GDMIndividualRecord && rec != iRec) {
- GDMIndividualRecord relPerson = (GDMIndividualRecord) rec;
+ int num3 = tree.RecordsCount;
+ for (int i = 0; i < num3; i++) {
+ GDMRecord rec = tree[i];
+ if (rec.RecordType != GDMRecordType.rtIndividual || rec == iRec) continue;
- string unk = GetNameString(relPerson, false);
- if (st == unk) {
- namesakes.AddObject(unk + GetLifeStr(relPerson), relPerson);
- }
- }
+ GDMIndividualRecord relPerson = (GDMIndividualRecord)rec;
+ string unk = GetNameString(relPerson, false);
+ if (st == unk) {
+ namesakes.Add(HyperLink(relPerson.XRef, unk + GetLifeStr(relPerson)));
}
+ }
- if (namesakes.Count > 0) {
- summary.Add("");
- summary.Add(LangMan.LS(LSID.Namesakes) + ":");
-
- int num4 = namesakes.Count;
- for (int i = 0; i < num4; i++) {
- GDMIndividualRecord relPerson = (GDMIndividualRecord)namesakes.GetObject(i);
+ if (namesakes.Count > 0) {
+ summary.Add("");
+ summary.Add(LangMan.LS(LSID.Namesakes) + ":");
- summary.Add(" " + HyperLink(relPerson.XRef, namesakes[i], 0));
- }
+ int num4 = namesakes.Count;
+ for (int i = 0; i < num4; i++) {
+ summary.Add(" " + namesakes[i]);
}
}
- finally {
- namesakes.Dispose();
- }
} catch (Exception ex) {
Logger.WriteError("GKUtils.ShowPersonNamesakes()", ex);
}
@@ -3434,27 +3432,23 @@ public static string GetFamilyString(GDMTree tree, GDMFamilyRecord family, strin
if (family == null)
throw new ArgumentNullException("family");
- string result = "";
+ string husband, wife;
GDMIndividualRecord spouse = tree.GetPtrValue(family.Husband);
if (spouse == null) {
- if (unkHusband == null) unkHusband = "?";
- result += unkHusband;
+ husband = (unkHusband == null) ? "?" : unkHusband;
} else {
- result += GetNameString(spouse, false);
+ husband = GetNameString(spouse, false);
}
- result += " - ";
-
spouse = tree.GetPtrValue(family.Wife);
if (spouse == null) {
- if (unkWife == null) unkWife = "?";
- result += unkWife;
+ wife = (unkWife == null) ? "?" : unkWife;
} else {
- result += GetNameString(spouse, false);
+ wife = GetNameString(spouse, false);
}
- return result;
+ return string.Concat(husband, " - ", wife);
}
public static string GetNickString(GDMIndividualRecord iRec)
@@ -3480,16 +3474,16 @@ public static string GetFmtSurname(GDMSex iSex, GDMPersonalName personalName, st
case WomanSurnameFormat.wsfMaiden_Married:
result = defSurname;
if (marriedSurname.Length > 0) {
- if (result.Length > 0) result += " ";
- result += "(" + marriedSurname + ")";
+ string op = (result.Length > 0) ? " (" : "(";
+ result = string.Concat(result, op, marriedSurname, ")");
}
break;
case WomanSurnameFormat.wsfMarried_Maiden:
result = marriedSurname;
if (defSurname.Length > 0) {
- if (result.Length > 0) result += " ";
- result += "(" + defSurname + ")";
+ string op = (result.Length > 0) ? " (" : "(";
+ result = string.Concat(result, op, defSurname, ")");
}
break;
@@ -3532,14 +3526,14 @@ public static string GetNameString(GDMIndividualRecord iRec, GDMPersonalName np,
surname = GetFmtSurname(iRec.Sex, np, surname);
if (firstSurname) {
- result = surname + " " + firstPart;
+ result = string.Concat(surname, " ", firstPart);
} else {
- result = firstPart + " " + surname;
+ result = string.Concat(firstPart, " ", surname);
}
if (includePieces) {
string nick = np.Nickname;
- if (!string.IsNullOrEmpty(nick)) result = result + " [" + nick + "]";
+ if (!string.IsNullOrEmpty(nick)) result = string.Concat(result, " [", nick, "]");
}
return result.Trim();
diff --git a/projects/GKCore/GKCore/Options/GlobalOptions.cs b/projects/GKCore/GKCore/Options/GlobalOptions.cs
index 32884ecd1..7143b7975 100644
--- a/projects/GKCore/GKCore/Options/GlobalOptions.cs
+++ b/projects/GKCore/GKCore/Options/GlobalOptions.cs
@@ -259,6 +259,10 @@ public StringList ResidenceFilters
public bool ShowDatesSign { get; set; }
+ public bool ShowIndiAssociations { get; set; }
+
+ public bool ShowIndiNamesakes { get; set; }
+
public bool ShowTips { get; set; }
public bool SurnameFirstInOrder { get; set; }
@@ -388,6 +392,9 @@ public void ResetDefaults_Interface()
WomanSurnameFormat = WomanSurnameFormat.wsfNotExtend;
UseSurnamesInPersonSelectionFilter = false;
UseBirthDatesInPersonSelectionFilter = false;
+
+ ShowIndiAssociations = false;
+ ShowIndiNamesakes = true;
}
public void ResetDefaults_Specials()
diff --git a/projects/GKTests/GDModel/Providers/FileFormatTests.cs b/projects/GKTests/GDModel/Providers/FileFormatTests.cs
index 2f047c0ae..c38ed2c72 100644
--- a/projects/GKTests/GDModel/Providers/FileFormatTests.cs
+++ b/projects/GKTests/GDModel/Providers/FileFormatTests.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".
*
@@ -34,6 +34,12 @@ namespace GDModel.Providers
[TestFixture]
public class FileFormatTests
{
+ public FileFormatTests()
+ {
+ // for tests on net6.0 needs instance of AppHost
+ TestUtils.InitUITest();
+ }
+
[Test]
public void Test_NativeFormat()
{
diff --git a/projects/GKTests/GKCore/BaseContextTests.cs b/projects/GKTests/GKCore/BaseContextTests.cs
index 78e2b34ba..1e6b480e6 100644
--- a/projects/GKTests/GKCore/BaseContextTests.cs
+++ b/projects/GKTests/GKCore/BaseContextTests.cs
@@ -353,6 +353,9 @@ public void Test_Culture()
fContext.Tree.Header.Language = GDMLanguageID.German;
Assert.IsInstanceOf(typeof(GermanCulture), fContext.Culture);
+ fContext.Tree.Header.Language = GDMLanguageID.Czech;
+ Assert.IsInstanceOf(typeof(CzechCulture), fContext.Culture);
+
fContext.Tree.Header.Language = GDMLanguageID.Polish;
Assert.IsInstanceOf(typeof(PolishCulture), fContext.Culture);
diff --git a/projects/GKTests/GKCore/ControllerTests.cs b/projects/GKTests/GKCore/ControllerTests.cs
index 55424b7f0..c7443d202 100644
--- a/projects/GKTests/GKCore/ControllerTests.cs
+++ b/projects/GKTests/GKCore/ControllerTests.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".
*
@@ -80,10 +80,20 @@ public void Test_AddressEditDlgController()
view.Country.Text = "sample country";
controller.Accept();
+ controller.UpdateView();
Assert.AreEqual("sample country", addr.AddressCountry);
}
+ private static IBaseWindow GetBaseSubst()
+ {
+ var baseContext = Substitute.For();
+ baseContext.Tree.Returns(new GDMTree());
+ var baseWin = Substitute.For();
+ baseWin.Context.Returns(baseContext);
+ return baseWin;
+ }
+
[Test]
public void Test_AssociationEditDlgController()
{
@@ -100,11 +110,7 @@ public void Test_AssociationEditDlgController()
Assert.IsNotNull(view.Person);
Assert.IsNotNull(view.Relation);
- var baseContext = Substitute.For();
- baseContext.Tree.Returns(new GDMTree());
- var baseWin = Substitute.For();
- baseWin.Context.Returns(baseContext);
- var tree = baseContext.Tree;
+ var baseWin = GetBaseSubst();
var association = new GDMAssociation(); // for xref pointers to work
var controller = new AssociationEditDlgController(view);
@@ -122,18 +128,18 @@ public void Test_AssociationEditDlgController()
// the relation is empty, an exception will be thrown, accept will be false
Assert.IsFalse(controller.Accept());
- var relValue = "test relation";
- var relPerson = tree.CreateIndividual();
-
// substitutes of values
+ var relValue = "test relation";
view.Relation.Text.Returns(relValue);
+ var relPerson = baseWin.Context.Tree.CreateIndividual();
baseWin.Context.SelectPerson(view, null, TargetMode.tmNone, GDMSex.svUnknown).Returns(relPerson);
controller.SetPerson();
Assert.IsTrue(controller.Accept());
+ controller.UpdateView();
Assert.AreEqual(relValue, association.Relation);
- Assert.AreEqual(relPerson, tree.GetPtrValue(association));
+ Assert.AreEqual(relPerson, baseWin.Context.Tree.GetPtrValue(association));
}
[Test]
@@ -154,7 +160,20 @@ public void Test_CircleChartWinController()
public void Test_CommonFilterDlgController()
{
var view = Substitute.For();
- //var controller = new CommonFilterDlgController(view);
+
+ SubstituteControl(view, "btnAccept");
+ SubstituteControl(view, "btnCancel");
+ SubstituteControl(view, "btnReset");
+ SubstituteControl(view, "pageFieldsFilter");
+
+ view.FilterGrid.Returns(Substitute.For());
+
+ var listMan = new NoteListModel(fBaseWin.Context);
+ var controller = new CommonFilterDlgController(view, listMan);
+
+ controller.Accept();
+ controller.UpdateView();
+ controller.Reset();
}
[Test]
@@ -184,6 +203,7 @@ public void Test_CommunicationEditDlgController()
view.Name.Text = "sample theme";
controller.Accept();
+ controller.UpdateView();
Assert.AreEqual("sample theme", comm.CommName);
}
@@ -192,28 +212,141 @@ public void Test_CommunicationEditDlgController()
public void Test_DayTipsDlgController()
{
var view = Substitute.For();
- //var controller = new DayTipsDlgController(view);
+
+ SubstituteControl(view, "btnClose");
+ SubstituteControl(view, "btnNextTip");
+ SubstituteControl(view, "chkShow");
+ SubstituteControl(view, "lblTitle");
+
+ view.TitleLabel.Returns(Substitute.For());
+ view.TipText.Returns(Substitute.For());
+ view.NextButton.Returns(Substitute.For());
+
+ var controller = new DayTipsDlgController(view);
+
+ controller.GetNextTip();
+ controller.UpdateView();
}
[Test]
public void Test_EventEditDlgController()
{
var view = Substitute.For();
- //var controller = new EventEditDlgController(view);
+
+ SubstituteControl(view, "btnAccept");
+ SubstituteControl(view, "btnCancel");
+ SubstituteControl(view, "btnAddress");
+ SubstituteControl(view, "btnPlaceAdd");
+ SubstituteControl(view, "btnPlaceDelete");
+ SubstituteControl(view, "pageCommon");
+ SubstituteControl(view, "pageNotes");
+ SubstituteControl(view, "pageMultimedia");
+ SubstituteControl(view, "pageSources");
+ SubstituteControl(view, "lblEvent");
+ SubstituteControl(view, "lblAttrValue");
+ SubstituteControl(view, "lblPlace");
+ SubstituteControl(view, "lblDate");
+ SubstituteControl(view, "lblCause");
+ SubstituteControl(view, "lblOrg");
+
+ view.EventType.Returns(Substitute.For());
+ view.Date.Returns(Substitute.For());
+ view.Attribute.Returns(Substitute.For());
+ view.Place.Returns(Substitute.For());
+ view.EventName.Returns(Substitute.For());
+ view.Cause.Returns(Substitute.For());
+ view.Agency.Returns(Substitute.For());
+ view.NotesList.Returns(Substitute.For());
+ view.MediaList.Returns(Substitute.For());
+ view.SourcesList.Returns(Substitute.For());
+
+ var controller = new EventEditDlgController(view);
}
[Test]
public void Test_FamilyEditDlgController()
{
var view = Substitute.For();
- //var controller = new FamilyEditDlgController(view);
+ SubstituteControl(view, "btnAccept");
+ SubstituteControl(view, "btnCancel");
+ SubstituteControl(view, "pageChilds");
+ SubstituteControl(view, "pageEvents");
+ SubstituteControl(view, "pageNotes");
+ SubstituteControl(view, "pageMultimedia");
+ SubstituteControl(view, "pageSources");
+ SubstituteControl(view, "GroupBox1");
+ SubstituteControl(view, "lblHusband");
+ SubstituteControl(view, "lblWife");
+ SubstituteControl(view, "lblStatus");
+ SubstituteControl(view, "lblRestriction");
+
+ view.NotesList.Returns(Substitute.For());
+ view.MediaList.Returns(Substitute.For());
+ view.SourcesList.Returns(Substitute.For());
+ view.ChildrenList.Returns(Substitute.For());
+ view.EventsList.Returns(Substitute.For());
+
+ var controller = new FamilyEditDlgController(view);
+
+ var baseWin = GetBaseSubst();
+ controller.Init(baseWin);
+
+ var fam = baseWin.Context.Tree.CreateFamily();
+
+ controller.FamilyRecord = fam;
+ Assert.AreEqual(fam, controller.FamilyRecord);
+
+ var relHusband = baseWin.Context.Tree.CreateIndividual();
+ relHusband.Sex = GDMSex.svMale;
+ baseWin.Context.SelectPerson(view, null, TargetMode.tmSpouse, GDMSex.svMale).Returns(relHusband);
+
+ controller.AddHusband();
+
+ var relWife = baseWin.Context.Tree.CreateIndividual();
+ relWife.Sex = GDMSex.svFemale;
+ baseWin.Context.SelectPerson(view, relHusband, TargetMode.tmSpouse, GDMSex.svFemale).Returns(relWife);
+
+ controller.AddWife();
+
+ controller.UpdateView();
+ controller.Accept();
+
+ Assert.AreEqual(relHusband, baseWin.Context.Tree.GetPtrValue(fam.Husband));
+ Assert.AreEqual(relWife, baseWin.Context.Tree.GetPtrValue(fam.Wife));
+
+ controller.JumpToHusband();
+ controller.JumpToWife();
+
+ //controller.DeleteHusband();
+ //controller.DeleteWife();
}
[Test]
public void Test_FilePropertiesDlgController()
{
var view = Substitute.For();
- //var controller = new FilePropertiesDlgController(view);
+ SubstituteControl(view, "btnAccept");
+ SubstituteControl(view, "btnCancel");
+ SubstituteControl(view, "pageAuthor");
+ SubstituteControl(view, "pageOther");
+ SubstituteControl(view, "lblName");
+ SubstituteControl(view, "lblAddress");
+ SubstituteControl(view, "lblTelephone");
+ SubstituteControl(view, "lblLanguage");
+
+ view.RecordStats.Returns(Substitute.For());
+ view.Language.Returns(Substitute.For());
+ view.Name.Returns(Substitute.For());
+ view.Address.Returns(Substitute.For());
+ view.Tel.Returns(Substitute.For());
+
+ var controller = new FilePropertiesDlgController(view);
+
+ var baseWin = GetBaseSubst();
+ controller.Init(baseWin);
+
+ controller.UpdateView();
+ controller.Accept();
}
[Test]
@@ -249,6 +382,7 @@ public void Test_GroupEditDlgController()
view.Name.Text = "sample group";
controller.Accept();
+ controller.UpdateView();
Assert.AreEqual("sample group", group.GroupName);
@@ -284,6 +418,7 @@ public void Test_LanguageEditDlgController()
// substitutes of values
view.LanguageCombo.GetSelectedTag().Returns(langValue);
+ controller.UpdateView();
Assert.IsTrue(controller.Accept());
Assert.AreEqual(langValue, controller.LanguageID);
}
@@ -334,6 +469,7 @@ public void Test_LocationEditDlgController()
view.Name.Text = "sample location";
controller.Accept();
+ controller.UpdateView();
Assert.AreEqual("sample location", locRec.LocationName);
@@ -453,7 +589,19 @@ public void Test_PortraitSelectDlgController()
public void Test_QuickSearchDlgController()
{
var view = Substitute.For();
- //var controller = new QuickSearchDlgController(view);
+ SubstituteControl(view, "btnPrev");
+ SubstituteControl(view, "btnNext");
+
+ view.SearchPattern.Returns(Substitute.For());
+
+ var baseWin = GetBaseSubst();
+ var controller = new QuickSearchDlgController(view, baseWin);
+
+ controller.UpdateView();
+
+ controller.ChangeText();
+ controller.FindNext();
+ controller.FindPrev();
}
[Test]
@@ -481,14 +629,59 @@ public void Test_RecordSelectDlgController()
public void Test_RelationshipCalculatorDlgController()
{
var view = Substitute.For();
- //var controller = new RelationshipCalculatorDlgController(view);
+
+ SubstituteControl(view, "btnClose");
+ SubstituteControl(view, "btnRec1Select");
+ SubstituteControl(view, "btnRec2Select");
+ SubstituteControl(view, "lblKinship");
+ SubstituteControl(view, "btnSwap");
+
+ var controller = new RelationshipCalculatorDlgController(view);
+
+ var baseWin = GetBaseSubst();
+ controller.Init(baseWin);
+
+ controller.SetRec1(null);
+ controller.SetRec2(null);
+
+ var relRec1 = baseWin.Context.Tree.CreateIndividual();
+ baseWin.Context.SelectRecord(view, GDMRecordType.rtIndividual, null).Returns(relRec1);
+ controller.SelectRec1();
+
+ var relRec2 = baseWin.Context.Tree.CreateIndividual();
+ baseWin.Context.SelectRecord(view, GDMRecordType.rtIndividual, null).Returns(relRec2);
+ controller.SelectRec2();
+
+ controller.UpdateView();
+
+ controller.Swap();
}
[Test]
public void Test_RepositoryEditDlgController()
{
var view = Substitute.For();
- //var controller = new RepositoryEditDlgController(view);
+
+ SubstituteControl(view, "btnAccept");
+ SubstituteControl(view, "btnCancel");
+ SubstituteControl(view, "pageNotes");
+ SubstituteControl(view, "btnAddress");
+ SubstituteControl(view, "lblName");
+
+ view.NotesList.Returns(Substitute.For());
+
+ var controller = new RepositoryEditDlgController(view);
+
+ var baseWin = GetBaseSubst();
+ controller.Init(baseWin);
+
+ var rep = baseWin.Context.Tree.CreateRepository();
+
+ controller.RepositoryRecord = rep;
+ Assert.AreEqual(rep, controller.RepositoryRecord);
+
+ controller.UpdateView();
+ controller.Accept();
}
[Test]
@@ -567,6 +760,8 @@ public void Test_TreeCheckController()
var controller = new TreeCheckController(view);
controller.Init(fBaseWin);
+
+ controller.UpdateView();
}
[Test]
@@ -585,6 +780,8 @@ public void Test_TreeCompareController()
var controller = new TreeCompareController(view);
controller.Init(fBaseWin);
+
+ controller.UpdateView();
}
[Test]
@@ -610,6 +807,8 @@ public void Test_TreeMergeController()
var controller = new TreeMergeController(view);
controller.Init(fBaseWin);
+
+ controller.UpdateView();
}
[Test]
@@ -631,6 +830,8 @@ public void Test_TreeSplitController()
GDMIndividualRecord iRec = fBaseWin.Context.Tree.XRefIndex_Find("I1") as GDMIndividualRecord;
Assert.IsNotNull(iRec);
+ controller.UpdateView();
+
controller.Select(iRec, Tools.TreeTools.TreeWalkMode.twmAll);
// FIXME
@@ -659,6 +860,7 @@ public void Test_UserRefEditDlgController()
view.RefType.Text = "sample text3";
controller.Accept();
+ controller.UpdateView();
Assert.AreEqual("sample text2", userRef.StringValue);
Assert.AreEqual("sample text3", userRef.ReferenceType);
diff --git a/projects/GKTests/GKTests.net.csproj b/projects/GKTests/GKTests.net.csproj
index 2956729b4..6c01dc458 100644
--- a/projects/GKTests/GKTests.net.csproj
+++ b/projects/GKTests/GKTests.net.csproj
@@ -87,6 +87,7 @@
+
diff --git a/projects/GKTests/Stubs/GfxProviderStub.cs b/projects/GKTests/Stubs/GfxProviderStub.cs
index b0dd549f2..63b9ee3d3 100644
--- a/projects/GKTests/Stubs/GfxProviderStub.cs
+++ b/projects/GKTests/Stubs/GfxProviderStub.cs
@@ -32,6 +32,10 @@ public GfxProviderStub()
{
}
+ public void FreeImage(ref IImage image)
+ {
+ }
+
public Stream CheckOrientation(Stream inputStream)
{
return inputStream;
diff --git a/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonEditDlg.cs b/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonEditDlg.cs
index 76a0c82e3..27b109da4 100644
--- a/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonEditDlg.cs
+++ b/projects/GKv2/GEDKeeper2/GKUI/Forms/PersonEditDlg.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".
*
@@ -281,6 +281,14 @@ public PersonEditDlg(IBaseWindow baseWin)
fController.Init(baseWin);
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing) {
+ fController.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
private void cbSex_SelectedIndexChanged(object sender, EventArgs e)
{
fController.ChangeSex();
diff --git a/projects/GKv2/GEDKeeper2/GKUI/Platform/WFAppHost.cs b/projects/GKv2/GEDKeeper2/GKUI/Platform/WFAppHost.cs
index b63211a5c..31c6c6b0a 100644
--- a/projects/GKv2/GEDKeeper2/GKUI/Platform/WFAppHost.cs
+++ b/projects/GKv2/GEDKeeper2/GKUI/Platform/WFAppHost.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".
*
@@ -62,6 +62,7 @@ public WFAppHost()
private void OnApplicationExit(object sender, EventArgs e)
{
+ ApplicationExit();
//AppHost.Instance.SaveLastBases();
}
diff --git a/projects/GKv2/GKComponents/GKUI/Components/HyperView.cs b/projects/GKv2/GKComponents/GKUI/Components/HyperView.cs
index d1de063ea..fd25c62f6 100644
--- a/projects/GKv2/GKComponents/GKUI/Components/HyperView.cs
+++ b/projects/GKv2/GKComponents/GKUI/Components/HyperView.cs
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
- * Copyright (C) 2011-2023 by Sergey V. Zhdanovskih.
+ * Copyright (C) 2011-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
@@ -102,7 +102,7 @@ public HyperView()
fCurrentLink = null;
fHeights = new List();
fLines = new StringList();
- fLines.OnChange += LinesChanged;
+ fLines.OnChange += new NotifyEventHandler(LinesChanged);
fLinkColor = Color.Blue;
fTextSize = ExtSize.Empty;
fStrFormat = new StringFormat(StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap | StringFormatFlags.NoClip);
diff --git a/projects/GKv2/GKComponents/GKUI/Platform/WFGfxProvider.cs b/projects/GKv2/GKComponents/GKUI/Platform/WFGfxProvider.cs
index 5090742bb..dbdf370bc 100644
--- a/projects/GKv2/GKComponents/GKUI/Platform/WFGfxProvider.cs
+++ b/projects/GKv2/GKComponents/GKUI/Platform/WFGfxProvider.cs
@@ -40,6 +40,25 @@ public WFGfxProvider()
{
}
+ public void FreeImage(ref IImage image)
+ {
+ try {
+ if (image == null) return;
+
+ var imgHandler = image as ImageHandler;
+ if (imgHandler == null) return;
+
+ var imgDisposable = imgHandler.Handle as IDisposable;
+ if (imgDisposable == null) return;
+
+ imgDisposable.Dispose();
+
+ image = null;
+ } catch (Exception ex) {
+ Logger.WriteError("WFGfxProvider.FreeImage()", ex);
+ }
+ }
+
private static void NormalizeOrientation(Image image)
{
const int ExifOrientationTagId = 274;
diff --git a/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonEditDlg.cs b/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonEditDlg.cs
index b60a65d6a..b61b377e1 100644
--- a/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonEditDlg.cs
+++ b/projects/GKv3/GEDKeeper3/GKUI/Forms/PersonEditDlg.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".
*
@@ -281,6 +281,14 @@ public PersonEditDlg(IBaseWindow baseWin)
fController.Init(baseWin);
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing) {
+ fController.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
private void cbSex_SelectedIndexChanged(object sender, EventArgs e)
{
fController.ChangeSex();
diff --git a/projects/GKv3/GEDKeeper3/GKUI/Platform/EtoAppHost.cs b/projects/GKv3/GEDKeeper3/GKUI/Platform/EtoAppHost.cs
index 0c608a27d..09507517c 100644
--- a/projects/GKv3/GEDKeeper3/GKUI/Platform/EtoAppHost.cs
+++ b/projects/GKv3/GEDKeeper3/GKUI/Platform/EtoAppHost.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".
*
@@ -143,6 +143,7 @@ private static void InitPlatformStyles()
private void OnApplicationExit(object sender, System.ComponentModel.CancelEventArgs e)
{
+ ApplicationExit();
//AppHost.Instance.SaveLastBases();
}
diff --git a/projects/GKv3/GKComponents/GKUI/Components/HyperView.cs b/projects/GKv3/GKComponents/GKUI/Components/HyperView.cs
index 1671d9e10..1c4892faf 100644
--- a/projects/GKv3/GKComponents/GKUI/Components/HyperView.cs
+++ b/projects/GKv3/GKComponents/GKUI/Components/HyperView.cs
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
- * Copyright (C) 2011-2023 by Sergey V. Zhdanovskih.
+ * Copyright (C) 2011-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
@@ -101,7 +101,7 @@ public HyperView()
fCurrentLink = null;
fHeights = new List();
fLines = new StringList();
- fLines.OnChange += LinesChanged;
+ fLines.OnChange += new NotifyEventHandler(LinesChanged);
fLinkColor = SystemColors.LinkText;
fTextSize = ExtSize.Empty;
fWordWrap = true;
diff --git a/projects/GKv3/GKComponents/GKUI/Platform/EtoGfxProvider.cs b/projects/GKv3/GKComponents/GKUI/Platform/EtoGfxProvider.cs
index 598f08460..5842ac962 100644
--- a/projects/GKv3/GKComponents/GKUI/Platform/EtoGfxProvider.cs
+++ b/projects/GKv3/GKComponents/GKUI/Platform/EtoGfxProvider.cs
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
- * Copyright (C) 2017-2024 by Sergey V. Zhdanovskih.
+ * Copyright (C) 2009-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
@@ -39,6 +39,25 @@ public EtoGfxProvider()
{
}
+ public void FreeImage(ref IImage image)
+ {
+ try {
+ if (image == null) return;
+
+ var imgHandler = image as ImageHandler;
+ if (imgHandler == null) return;
+
+ var imgDisposable = imgHandler.Handle as IDisposable;
+ if (imgDisposable == null) return;
+
+ imgDisposable.Dispose();
+
+ image = null;
+ } catch (Exception ex) {
+ Logger.WriteError("EtoGfxProvider.FreeImage()", ex);
+ }
+ }
+
public Stream CheckOrientation(Stream inputStream)
{
Stream transformStream = ImageProcess.IsNeedOrient(inputStream) ? ImageProcess.AutoOrient(inputStream) : inputStream;
diff --git a/projects/GKvX/GEDKeeperX/GKUI/Components/HyperView.xaml.cs b/projects/GKvX/GEDKeeperX/GKUI/Components/HyperView.xaml.cs
index d9062b05b..091c97800 100644
--- a/projects/GKvX/GEDKeeperX/GKUI/Components/HyperView.xaml.cs
+++ b/projects/GKvX/GEDKeeperX/GKUI/Components/HyperView.xaml.cs
@@ -1,6 +1,6 @@
/*
* "GEDKeeper", the personal genealogical database editor.
- * Copyright (C) 2009-2023 by Sergey V. Zhdanovskih.
+ * Copyright (C) 2011-2024 by Sergey V. Zhdanovskih.
*
* This file is part of "GEDKeeper".
*
@@ -76,7 +76,7 @@ public HyperView()
Padding = 8;
fLines = new StringList();
- fLines.OnChange += LinesChanged;
+ fLines.OnChange += new NotifyEventHandler(LinesChanged);
fLinkColor = Color.Blue;
fWordWrap = true;
diff --git a/projects/GKvX/GEDKeeperX/GKUI/Platform/XFGfxProvider.cs b/projects/GKvX/GEDKeeperX/GKUI/Platform/XFGfxProvider.cs
index 080cce844..024335bc0 100644
--- a/projects/GKvX/GEDKeeperX/GKUI/Platform/XFGfxProvider.cs
+++ b/projects/GKvX/GEDKeeperX/GKUI/Platform/XFGfxProvider.cs
@@ -39,6 +39,37 @@ public XFGfxProvider()
{
}
+ public void FreeImage(ref IImage image)
+ {
+ try {
+ if (image == null) return;
+
+ if (image is SKImageHandler) {
+ var imgHandler = image as SKImageHandler;
+ if (imgHandler == null) return;
+
+ var imgDisposable = imgHandler.Handle.Image as IDisposable;
+ if (imgDisposable == null) return;
+
+ imgDisposable.Dispose();
+ }
+
+ if (image is XFImageHandler) {
+ var imgHandler = image as XFImageHandler;
+ if (imgHandler == null) return;
+
+ var imgDisposable = imgHandler.Handle as IDisposable;
+ if (imgDisposable == null) return;
+
+ imgDisposable.Dispose();
+ }
+
+ image = null;
+ } catch (Exception ex) {
+ Logger.WriteError("XFGfxProvider.FreeImage()", ex);
+ }
+ }
+
public Stream CheckOrientation(Stream inputStream)
{
return inputStream;