Skip to content

Commit

Permalink
Added display of multimedia and notes on the info-panel for events (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed May 29, 2024
1 parent de5073a commit b195e74
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 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 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).
</ul>
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>Устранены множественные строки в столбце "Автор" списков ссылок на источники (GKv3).
<li>Улучшен вывод портретов из фотографий с DPI > 100 (GKv3).
</ul>
Expand Down
31 changes: 17 additions & 14 deletions projects/GKCore/GKCore/GKUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2270,23 +2270,23 @@ public static StringList SearchPortraits(GDMTree tree, GDMMultimediaRecord mmRec
return result;
}

private static void RecListMediaRefresh(IBaseContext baseContext, GDMRecord record, StringList summary)
private static void RecListMediaRefresh(IBaseContext baseContext, IGDMStructWithMultimediaLinks structWML, StringList summary, string indent = "")
{
if (record == null || summary == null) return;
if (structWML == null || summary == null) return;

try {
if (record.HasMultimediaLinks) {
if (structWML.HasMultimediaLinks) {
summary.Add("");
summary.Add(LangMan.LS(LSID.RPMultimedia) + " (" + record.MultimediaLinks.Count.ToString() + "):");
summary.Add(indent + LangMan.LS(LSID.RPMultimedia) + " (" + structWML.MultimediaLinks.Count.ToString() + "):");

int num = record.MultimediaLinks.Count;
int num = structWML.MultimediaLinks.Count;
for (int i = 0; i < num; i++) {
GDMMultimediaLink mmLink = record.MultimediaLinks[i];
GDMMultimediaLink mmLink = structWML.MultimediaLinks[i];
GDMMultimediaRecord mmRec = baseContext.Tree.GetPtrValue<GDMMultimediaRecord>(mmLink);
if (mmRec == null || mmRec.FileReferences.Count == 0) continue;

string st = mmRec.FileReferences[0].Title;
summary.Add(" " + HyperLink(mmRec.XRef, st) + " (" +
summary.Add(indent + " " + HyperLink(mmRec.XRef, st) + " (" +
HyperLink(GKData.INFO_HREF_VIEW + mmRec.XRef, LangMan.LS(LSID.MediaView)) + ")");
}
}
Expand All @@ -2295,25 +2295,25 @@ private static void RecListMediaRefresh(IBaseContext baseContext, GDMRecord reco
}
}

private static void RecListNotesRefresh(IBaseContext baseContext, GDMRecord record, StringList summary)
private static void RecListNotesRefresh(IBaseContext baseContext, IGDMStructWithNotes structWN, StringList summary, string indent = "")
{
if (record == null || summary == null) return;
if (structWN == null || summary == null) return;

try {
if (record.HasNotes) {
if (structWN.HasNotes) {
summary.Add("");
summary.Add(LangMan.LS(LSID.RPNotes) + " (" + record.Notes.Count.ToString() + "):");
summary.Add(indent + LangMan.LS(LSID.RPNotes) + " (" + structWN.Notes.Count.ToString() + "):");

int num = record.Notes.Count;
int num = structWN.Notes.Count;
for (int i = 0; i < num; i++) {
if (i > 0) {
summary.Add("");
}

GDMLines noteLines = baseContext.Tree.GetNoteLines(record.Notes[i]);
GDMLines noteLines = baseContext.Tree.GetNoteLines(structWN.Notes[i]);
int num2 = noteLines.Count;
for (int k = 0; k < num2; k++) {
summary.Add(noteLines[k]);
summary.Add(indent + noteLines[k]);
}
}
}
Expand Down Expand Up @@ -2408,7 +2408,10 @@ private static void RecListIndividualEventsRefresh(IBaseContext baseContext, GDM
if (evt.HasAddress) {
ShowAddressSummary(evt.Address, summary);
}

RecListSourcesRefresh(baseContext, evt, summary, " ");
RecListNotesRefresh(baseContext, evt, summary, " ");
RecListMediaRefresh(baseContext, evt, summary, " ");
}
}
} catch (Exception ex) {
Expand Down

0 comments on commit b195e74

Please sign in to comment.