Skip to content

Commit

Permalink
Added text effect options in tree diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed Nov 20, 2024
1 parent abd6a56 commit 4c4b2a8
Show file tree
Hide file tree
Showing 31 changed files with 590 additions and 266 deletions.
5 changes: 5 additions & 0 deletions locales/Afrikaans.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Belarusian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Chinese Simplified.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Czech.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Dutch.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/English.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/French.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/German.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Hungarian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Icelandic.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Italian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Japanese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Kazakh (Cyrillic).lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Polish.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Portuguese.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Russian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Карта персон
1001=Поиск в геокодерах мест без координат (карты)
1002=Места и Карты
1003=Эффект текста
1004=Простой
1005=Утопленный
1006=Приподнятый
1007=Светящийся
5 changes: 5 additions & 0 deletions locales/Serbian (Latin).lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Spanish.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
5 changes: 5 additions & 0 deletions locales/Ukrainian.lng
Original file line number Diff line number Diff line change
Expand Up @@ -1013,3 +1013,8 @@
1000=Map of persons
1001=Search in geocoders for places without coordinates (maps)
1002=Locations and Maps
1003=Text effect
1004=Simple
1005=Sunken
1006=Raised
1007=Glow
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>??.??.2024 [v2.32.0 &amp; v3.8.0]</b><ul>
<li>Added text effect options in tree diagrams (GKv2 only).
<li>Added an option to disable the search for places without coordinates in geocoders (general maps).
<li>Added the feature to display on maps all subordinate locations and persons of the selected hierarchy of locations.
<li>Added mode for displaying parents' ages in tree diagrams.
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>??.??.2024 [v2.32.0 &amp; v3.8.0]</b><ul>
<li>Добавлены опции эффектов текста в диаграммах деревьев (только GKv2).
<li>Добавлена опция выключения поиска мест без координат в геокодерах (общие карты).
<li>Добавлена возможность выводить на карты все подчиненные места и персоны выбранной иерархии мест.
<li>Добавлен режим отображения возрастов родителей в диаграммах деревьев.
Expand Down
39 changes: 31 additions & 8 deletions projects/GKCore/GKCore/Charts/ChartRenderer.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 @@ -47,6 +47,17 @@ public enum RenderTarget
SVG
}

public enum TextEffect
{
Simple,
Sunken,
Raised,
Glow,

First = Simple,
Last = Glow
}

/// <summary>
///
/// </summary>
Expand All @@ -63,10 +74,15 @@ protected ChartRenderer()

public virtual void SetViewport(int width, int height)
{
// dummy
}

public abstract void SetSmoothing(bool value);
public virtual void SetSmoothing(bool value)
{
}

public virtual void SetTranslucent(float value)
{
}

public virtual void BeginDrawing()
{
Expand All @@ -76,15 +92,14 @@ public virtual void EndDrawing()
{
}

public abstract void SetTarget(object target);


public static IColor GetColor(int argb)
{
return AppHost.GfxProvider.CreateColor(argb);
}


public abstract void SetTarget(object target);

/// <summary>
/// A separate implementation only for those cases when different classes
/// at the UI and diagram rendering levels are responsible for the image.
Expand Down Expand Up @@ -138,6 +153,11 @@ public int GetTextWidth(string text, IFont font)

public abstract void DrawString(string text, IFont font, IBrush brush, float x, float y);

public virtual void DrawString(string text, IFont font, IBrush brush, float x, float y, TextEffect effect = TextEffect.Simple)
{
DrawString(text, font, brush, x, y);
}

public virtual void DrawAnchor(string text, string anchor, IFont font, IBrush brush, float x, float y)
{
// Not applicable for most areas except exports
Expand All @@ -161,6 +181,11 @@ public abstract void DrawRectangle(IPen pen, IColor fillColor, float x, float y,
public abstract void DrawRoundedRectangle(IPen pen, IColor fillColor, float x, float y,
float width, float height, float radius);

public virtual void DrawCoverGlass(float x, float y, float width, float height, float radius)
{
// dummy
}

public abstract void DrawPath(IPen pen, IBrush brush, IGfxPath path);

public virtual IFont CreateFont(string fontName, float size, bool bold)
Expand All @@ -180,8 +205,6 @@ public IPen CreatePen(int argb, float width = 1.0f)
public abstract IGfxPath CreateCirclePath(float x, float y, float width, float height);
public abstract IGfxPath CreateCircleSegmentPath(int ctX, int ctY, float inRad, float extRad, float wedgeAngle, float ang1, float ang2);

public abstract void SetTranslucent(float value);

public abstract void ScaleTransform(float sx, float sy);
public abstract void TranslateTransform(float dx, float dy);
public abstract void RotateTransform(float angle);
Expand Down
26 changes: 18 additions & 8 deletions projects/GKCore/GKCore/Charts/TreeChartModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,11 @@ private bool IsLineVisible(int x1, int y1, int x2, int y2)
var rangeX = new Range<int>(fVisibleArea.Left, fVisibleArea.Right);
var rangeY = new Range<int>(fVisibleArea.Top, fVisibleArea.Bottom);

return rangeX.IsOverlapped(new Range<int>(x1, x2)) && rangeY.IsOverlapped(new Range<int>(y1, y2));
}

private void DrawLine(int x1, int y1, int x2, int y2, bool isDotted, bool isTracked, bool isMatched)
{
if (x2 < x1) {
int tmp = x1;
x1 = x2;
Expand All @@ -1708,11 +1713,6 @@ private bool IsLineVisible(int x1, int y1, int x2, int y2)
y2 = tmp;
}

return rangeX.IsOverlapped(new Range<int>(x1, x2)) && rangeY.IsOverlapped(new Range<int>(y1, y2));
}

private void DrawLine(int x1, int y1, int x2, int y2, bool isDotted, bool isTracked, bool isMatched)
{
if (!IsLineVisible(x1, y1, x2, y2)) return;

IPen linePen, decorativeLinePen;
Expand Down Expand Up @@ -1765,6 +1765,8 @@ private void DrawLine(int x1, int y1, int x2, int y2, bool isDotted, bool isTrac
}
}

private const float RoundedRectRadius = 6.0f;

private void DrawBorder(IPen xpen, ExtRect rt, bool dead, TreeChartPerson person)
{
IColor bColor = person.GetFillColor(dead);
Expand All @@ -1773,12 +1775,18 @@ private void DrawBorder(IPen xpen, ExtRect rt, bool dead, TreeChartPerson person
}

if (person.Sex == GDMSex.svFemale) {
fRenderer.DrawRoundedRectangle(xpen, bColor, rt.Left, rt.Top, rt.GetWidth(), rt.GetHeight(), 6);
fRenderer.DrawRoundedRectangle(xpen, bColor, rt.Left, rt.Top, rt.GetWidth(), rt.GetHeight(), RoundedRectRadius);
} else {
fRenderer.DrawRectangle(xpen, bColor, rt.Left, rt.Top, rt.GetWidth(), rt.GetHeight());
}
}

private void DrawCoverGlass(ExtRect rt, TreeChartPerson person)
{
float rad = (person.Sex == GDMSex.svFemale) ? RoundedRectRadius : 0.0f;
fRenderer.DrawCoverGlass(rt.Left, rt.Top, rt.GetWidth(), rt.GetHeight(), rad);
}

private static string TruncString(string str, int threshold)
{
if (str.Length > threshold)
Expand Down Expand Up @@ -1851,11 +1859,13 @@ private void DrawPerson(TreeChartPerson person, ChartDrawMode drawMode, bool isS

int rx = prt.Left + (prtWidth - stw) / 2;

fRenderer.DrawString(line, font, fSolidBlack, rx, ry);
fRenderer.DrawString(line, font, fSolidBlack, rx, ry, fOptions.TextEffect);

ry += lh;
}

DrawCoverGlass(brt, person);

if (fOptions.SignsVisible && !person.Signs.IsEmpty()) {
int i = 0;
int dy = (int)(21 * fPicScale);
Expand Down Expand Up @@ -2051,7 +2061,7 @@ private void DrawText(string text, float x, float y, int quad, IBrush brush, boo
break;
}

fRenderer.DrawString(text, fDrawFont, brush, x, y);
fRenderer.DrawString(text, fDrawFont, brush, x, y, fOptions.TextEffect);
}

private void DrawDescendants(TreeChartPerson person, ChartDrawMode drawMode, bool isTracked)
Expand Down
Loading

0 comments on commit 4c4b2a8

Please sign in to comment.