Skip to content

Commit

Permalink
Added UnrestrictedExtendedSurnames option, no UI (fix #502)
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed Feb 1, 2025
1 parent c2667eb commit dee93f5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ public override void Done()
private bool IsExtendedWomanSurname()
{
var selectedSex = fView.SexCombo.GetSelectedTag<GDMSex>();
bool result = (GlobalOptions.Instance.WomanSurnameFormat != WomanSurnameFormat.wsfNotExtend) &&
(selectedSex == GDMSex.svFemale);
return result;
return GlobalOptions.Instance.CanExtendedSurname(selectedSex);
}

public void ChangeSex()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ public override bool Accept()

private bool IsExtendedWomanSurname()
{
bool result = (GlobalOptions.Instance.WomanSurnameFormat != WomanSurnameFormat.wsfNotExtend) &&
(fIndividualRecord.Sex == GDMSex.svFemale);
return result;
return GlobalOptions.Instance.CanExtendedSurname(fIndividualRecord.Sex);
}

public override void UpdateView()
Expand Down
20 changes: 18 additions & 2 deletions projects/GKCore/GKCore/Options/GlobalOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ public TreeChartOptions TreeChartOptions
get { return fTreeChartOptions; }
}

public bool UnrestrictedExtendedSurnames { get; set; }

public bool UseExtendedNotes { get; set; }

public bool UseSurnamesInPersonSelectionFilter { get; set; }
Expand Down Expand Up @@ -403,13 +405,15 @@ public void ResetDefaults_Interface()
ShortKinshipForm = false;
SurnameFirstInOrder = true;
SurnameInCapitals = false;
WomanSurnameFormat = WomanSurnameFormat.wsfNotExtend;
SimpleSingleSurnames = false;
UseSurnamesInPersonSelectionFilter = false;
UseBirthDatesInPersonSelectionFilter = false;
ShowIndiAssociations = false;
ShowIndiNamesakes = true;
MatchPatternMethod = MatchPatternMethod.RegEx;

WomanSurnameFormat = WomanSurnameFormat.wsfNotExtend;
SimpleSingleSurnames = false;
UnrestrictedExtendedSurnames = false;
}

public void ResetDefaults_Specials()
Expand Down Expand Up @@ -691,6 +695,14 @@ private void SaveStringList(IniFile ini, StringList list, string section, string

#endregion

#region Features

public bool CanExtendedSurname(GDMSex selectedSex)
{
bool result = (WomanSurnameFormat != WomanSurnameFormat.wsfNotExtend) && (UnrestrictedExtendedSurnames || (selectedSex == GDMSex.svFemale));
return result;
}

#region Record Select Dialog Filters

public StringList GetRSFilters(GDMRecordType rt)
Expand Down Expand Up @@ -737,6 +749,8 @@ private void SaveRSFilters(IniFile ini)

#endregion

#endregion

public void LoadFromFile(IniFile ini)
{
if (ini == null)
Expand Down Expand Up @@ -779,6 +793,7 @@ public void LoadFromFile(IniFile ini)

WomanSurnameFormat = (WomanSurnameFormat)ini.ReadInteger("Common", "WomanSurnameFormat", 0);
SimpleSingleSurnames = ini.ReadBool("Common", "SimpleSingleSurnames", false);
UnrestrictedExtendedSurnames = ini.ReadBool("Common", "UnrestrictedExtendedSurnames", false);

Geocoder = ini.ReadString("Common", "Geocoder", "Google");
GeoSearchCountry = ini.ReadString("Common", "GeoSearchCountry", "");
Expand Down Expand Up @@ -920,6 +935,7 @@ public void SaveToFile(IniFile ini)

ini.WriteInteger("Common", "WomanSurnameFormat", (int)WomanSurnameFormat);
ini.WriteBool("Common", "SimpleSingleSurnames", SimpleSingleSurnames);
ini.WriteBool("Common", "UnrestrictedExtendedSurnames", UnrestrictedExtendedSurnames);

ini.WriteString("Common", "Geocoder", Geocoder);
ini.WriteString("Common", "GeoSearchCountry", GeoSearchCountry);
Expand Down

0 comments on commit dee93f5

Please sign in to comment.