private void AcceptChanges() { string stat = GKData.MarriageStatus[cmbMarriageStatus.SelectedIndex].StatSign; fFamily.SetTagStringValue("_STAT", stat); fFamily.Restriction = (GEDCOMRestriction)cmbRestriction.SelectedIndex; fFamily.SortChilds(); fLocalUndoman.Commit(); fBase.NotifyRecord(fFamily, RecordAction.raEdit); }
private DescPersonSegment TraverseDescendants(GEDCOMIndividualRecord iRec, int gen) { if (iRec == null) { return(null); } try { fIndividualsCount++; DescPersonSegment resultSegment = new DescPersonSegment(gen); resultSegment.IRec = iRec; fSegments.Add(resultSegment); if (gen < fMaxGenerations) { int numberOfFamilyLinks = iRec.SpouseToFamilyLinks.Count; for (int j = 0; j < numberOfFamilyLinks; j++) { GEDCOMFamilyRecord family = iRec.SpouseToFamilyLinks[j].Family; if (!fBase.Context.IsRecordAccess(family.Restriction)) { continue; } family.SortChilds(); int numberOfChildren = family.Children.Count; for (int i = 0; i < numberOfChildren; i++) { GEDCOMIndividualRecord child = family.Children[i].Value as GEDCOMIndividualRecord; DescPersonSegment childSegment = TraverseDescendants(child, gen + 1); int size = Math.Max(1, childSegment.TotalSubSegments); resultSegment.TotalSubSegments += size; resultSegment.ChildSegments.Add(childSegment); } } } return(resultSegment); } catch { return(null); } }
private void GenStep(PedigreePerson parent, GEDCOMIndividualRecord iRec, int level, int familyOrder) { if (iRec == null) { return; } PedigreePerson res = new PedigreePerson(); res.Parent = parent; res.IRec = iRec; res.Level = level; res.ChildIdx = 0; res.FamilyOrder = familyOrder; fPersonList.Add(res); if (fOptions.PedigreeOptions.IncludeSources) { int num = iRec.SourceCitations.Count; for (int i = 0; i < num; i++) { GEDCOMSourceRecord sourceRec = iRec.SourceCitations[i].Value as GEDCOMSourceRecord; if (sourceRec == null) { continue; } string srcName = GKUtils.MergeStrings(sourceRec.Title); if (srcName == "") { srcName = sourceRec.FiledByEntry; } int j = fSourceList.IndexOf(srcName); if (j < 0) { j = fSourceList.Add(srcName); } res.Sources.Add((j + 1).ToString()); } } if (fKind == PedigreeKind.pkAscend) { if (iRec.ChildToFamilyLinks.Count > 0) { GEDCOMFamilyRecord family = iRec.ChildToFamilyLinks[0].Family; if (fBase.Context.IsRecordAccess(family.Restriction)) { GEDCOMIndividualRecord prnt; prnt = family.GetWife(); GenStep(res, prnt, level + 1, 1); prnt = family.GetHusband(); GenStep(res, prnt, level + 1, 1); } } } else { int num2 = iRec.SpouseToFamilyLinks.Count; for (int j = 0; j < num2; j++) { GEDCOMFamilyRecord family = iRec.SpouseToFamilyLinks[j].Family; if (!fBase.Context.IsRecordAccess(family.Restriction)) { continue; } family.SortChilds(); int num3 = family.Children.Count; for (int i = 0; i < num3; i++) { GEDCOMIndividualRecord child = family.Children[i].Value as GEDCOMIndividualRecord; GenStep(res, child, level + 1, i + 1); } } } }