private void WriteCompactFmt(PedigreePerson person) { if (fOptions.PedigreeOptions.IncludeNotes && person.IRec.Notes.Count != 0) { int num = person.IRec.Notes.Count; for (int i = 0; i < num; i++) { GEDCOMNotes note = person.IRec.Notes[i]; fWriter.addParagraph(GKUtils.MergeStrings(note.Notes), fTextFont); } } bool spIndex = person.IRec.SpouseToFamilyLinks.Count > 1; int num2 = person.IRec.SpouseToFamilyLinks.Count; for (int i = 0; i < num2; i++) { GEDCOMFamilyRecord family = person.IRec.SpouseToFamilyLinks[i].Family; if (fBase.Context.IsRecordAccess(family.Restriction)) { GEDCOMPointer sp; string st; string unk; if (person.IRec.Sex == GEDCOMSex.svMale) { sp = family.Wife; st = LangMan.LS(LSID.LSID_WifeSign); unk = LangMan.LS(LSID.LSID_UnkFemale); } else { sp = family.Husband; st = LangMan.LS(LSID.LSID_HusbSign); unk = LangMan.LS(LSID.LSID_UnkMale); } if (spIndex) { st += (i + 1).ToString(); } st += " - "; GEDCOMIndividualRecord irec = sp.Value as GEDCOMIndividualRecord; if (irec != null) { st = st + GKUtils.GetNameString(irec, true, false) + GKUtils.GetPedigreeLifeStr(irec, fOptions.PedigreeOptions.Format) /* + this.idLink(this.FindPerson(irec))*/; } else { st += unk; } fWriter.addParagraph(st, fTextFont); } } }
public override void Modify(object sender, ModifyEventArgs eArgs) { var dataOwner = fDataOwner as IGEDCOMStructWithLists; if (fBaseWin == null || fSheetList == null || dataOwner == null) { return; } GEDCOMNotes notes = eArgs.ItemData as GEDCOMNotes; bool result = false; GEDCOMNoteRecord noteRec; switch (eArgs.Action) { case RecordAction.raAdd: noteRec = fBaseWin.Context.SelectRecord(GEDCOMRecordType.rtNote, null) as GEDCOMNoteRecord; if (noteRec != null) { result = fUndoman.DoOrdinaryOperation(OperationType.otRecordNoteAdd, (GEDCOMObject)dataOwner, noteRec); } break; case RecordAction.raEdit: if (notes != null) { noteRec = notes.Value as GEDCOMNoteRecord; result = BaseController.ModifyNote(fBaseWin, ref noteRec); } break; case RecordAction.raDelete: if (AppHost.StdDialogs.ShowQuestionYN(LangMan.LS(LSID.LSID_DetachNoteQuery))) { result = fUndoman.DoOrdinaryOperation(OperationType.otRecordNoteRemove, (GEDCOMObject)dataOwner, notes); } break; } if (result) { fBaseWin.Context.Modified = true; eArgs.IsChanged = true; } }
private bool ProcessRecordNoteRemove(bool redo) { IGEDCOMStructWithLists swl = fObj as IGEDCOMStructWithLists; GEDCOMNotes notes = fNewVal as GEDCOMNotes; bool result = (swl != null && notes != null); if (result) { if (redo) { swl.Notes.Extract(notes); // bugfix(no delete!) } else { swl.Notes.Add(notes); } } return(result); }
private bool ProcessRecordNoteAdd(bool redo) { IGEDCOMStructWithLists swl = fObj as IGEDCOMStructWithLists; GEDCOMNoteRecord noteRec = fNewVal as GEDCOMNoteRecord; bool result = (swl != null && noteRec != null); if (result) { if (redo) { GEDCOMNotes notes = swl.AddNote(noteRec); fOldVal = notes; } else { GEDCOMNotes notes = fOldVal as GEDCOMNotes; swl.Notes.Delete(notes); } } return(result); }
private void WriteExcessFmt(PedigreePerson person) { fWriter.addParagraph(LangMan.LS(LSID.LSID_Sex) + ": " + GKUtils.SexStr(person.IRec.Sex), fTextFont); string st = GKUtils.GetLifeExpectancyStr(person.IRec); if (st != "?" && st != "") { fWriter.addParagraph(LangMan.LS(LSID.LSID_LifeExpectancy) + ": " + st, fTextFont); } GEDCOMIndividualRecord father, mother; GEDCOMFamilyRecord fam = person.IRec.GetParentsFamily(); if (fam == null) { father = null; mother = null; } else { father = fam.GetHusband(); mother = fam.GetWife(); } if (father != null) { fWriter.addParagraphLink(LangMan.LS(LSID.LSID_Father) + ": " + GKUtils.GetNameString(father, true, false) + " ", fTextFont, idLink(father), fLinkFont); } if (mother != null) { fWriter.addParagraphLink(LangMan.LS(LSID.LSID_Mother) + ": " + GKUtils.GetNameString(mother, true, false) + " ", fTextFont, idLink(mother), fLinkFont); } ExtList <PedigreeEvent> evList = new ExtList <PedigreeEvent>(true); try { int i; if (person.IRec.Events.Count > 0) { fWriter.addParagraph(LangMan.LS(LSID.LSID_Events) + ":", fTextFont); int num = person.IRec.Events.Count; for (i = 0; i < num; i++) { GEDCOMCustomEvent evt = person.IRec.Events[i]; if (!(evt is GEDCOMIndividualAttribute) || fOptions.PedigreeOptions.IncludeAttributes) { evList.Add(new PedigreeEvent(person.IRec, evt)); } } WriteEventList(person, evList); } int num2 = person.IRec.SpouseToFamilyLinks.Count; for (i = 0; i < num2; i++) { GEDCOMFamilyRecord family = person.IRec.SpouseToFamilyLinks[i].Family; if (!fBase.Context.IsRecordAccess(family.Restriction)) { continue; } GEDCOMPointer sp; string unk; if (person.IRec.Sex == GEDCOMSex.svMale) { sp = family.Wife; st = LangMan.LS(LSID.LSID_Wife) + ": "; unk = LangMan.LS(LSID.LSID_UnkFemale); } else { sp = family.Husband; st = LangMan.LS(LSID.LSID_Husband) + ": "; unk = LangMan.LS(LSID.LSID_UnkMale); } GEDCOMIndividualRecord irec = sp.Value as GEDCOMIndividualRecord; string sps; if (irec != null) { sps = st + GKUtils.GetNameString(irec, true, false) + GKUtils.GetPedigreeLifeStr(irec, fOptions.PedigreeOptions.Format) /* + this.idLink(this.FindPerson(irec))*/; } else { sps = st + unk; } fWriter.addParagraph(sps, fTextFont); evList.Clear(); int childrenCount = family.Children.Count; for (int j = 0; j < childrenCount; j++) { irec = (GEDCOMIndividualRecord)family.Children[j].Value; evList.Add(new PedigreeEvent(irec, irec.FindEvent("BIRT"))); } WriteEventList(person, evList); } } finally { evList.Dispose(); } if (fOptions.PedigreeOptions.IncludeNotes && person.IRec.Notes.Count != 0) { fWriter.addParagraph(LangMan.LS(LSID.LSID_RPNotes) + ":", fTextFont); fWriter.beginList(); int notesCount = person.IRec.Notes.Count; for (int i = 0; i < notesCount; i++) { GEDCOMNotes note = person.IRec.Notes[i]; fWriter.addListItem(" " + GKUtils.MergeStrings(note.Notes), fTextFont); } fWriter.endList(); } }
private void ExposePerson(ColumnText mct, GEDCOMIndividualRecord iRec, string iName, float colWidth) { Paragraph pg = new Paragraph(); Chunk chunk = new Chunk(iName, fBoldFont); chunk.SetLocalDestination(iRec.XRef); pg.Add(chunk); chunk = new Chunk(GKUtils.GetPedigreeLifeStr(iRec, PedigreeFormat.Compact), fTextFont); pg.Add(chunk); pg.KeepTogether = true; mct.AddElement(pg); // FIXME IImage image = fBase.Context.GetPrimaryBitmap(iRec, 0, 0, false); if (image != null) { itImage img = TreeChartPDFRenderer.ConvertImage(image); float fitWidth = colWidth * 0.5f; img.ScaleToFit(fitWidth, fitWidth); // FIXME: the moving, if the page height is insufficient for the image height //img.Alignment = Image.TEXTWRAP; img.IndentationLeft = 5f; img.SpacingBefore = 5f; img.SpacingAfter = 5f; //Paragraph imgpar = new Paragraph(new Chunk(img, 0, 0, true)); //imgpar.KeepTogether = true; mct.AddElement(img); } GEDCOMIndividualRecord father, mother; GEDCOMFamilyRecord fam = iRec.GetParentsFamily(); if (fam == null) { father = null; mother = null; } else { father = fam.GetHusband(); mother = fam.GetWife(); } if (father != null) { pg = new Paragraph(); chunk = new Chunk(GKUtils.GetNameString(father, true, false), fLinkFont); chunk.SetLocalGoto(father.XRef); pg.Add(new Chunk(LangMan.LS(LSID.LSID_Father) + ": ", fTextFont)); pg.Add(chunk); mct.AddElement(pg); } if (mother != null) { pg = new Paragraph(); chunk = new Chunk(GKUtils.GetNameString(mother, true, false), fLinkFont); chunk.SetLocalGoto(mother.XRef); pg.Add(new Chunk(LangMan.LS(LSID.LSID_Mother) + ": ", fTextFont)); pg.Add(chunk); mct.AddElement(pg); } if (IncludeEvents && iRec.Events.Count != 0) { int num = iRec.Events.Count; for (int i = 0; i < num; i++) { GEDCOMCustomEvent evt = iRec.Events[i]; if (evt.Name == "BIRT" || evt.Name == "DEAT") { continue; } string evtName = GKUtils.GetEventName(evt); string evtVal = evt.StringValue; string evtDesc = GKUtils.GetEventDesc(evt, false); string tmp = evtName + ": " + evtVal; if (evtVal != "") { tmp += ", "; } tmp += evtDesc; mct.AddElement(new Paragraph(new Chunk(tmp, fTextFont))); } } if (IncludeNotes && iRec.Notes.Count != 0) { int num = iRec.Notes.Count; for (int i = 0; i < num; i++) { GEDCOMNotes note = iRec.Notes[i]; mct.AddElement(new Paragraph(GKUtils.MergeStrings(note.Notes), fTextFont)); } } }
private void ExposePerson(GEDCOMIndividualRecord iRec, string iName) { fWriter.BeginParagraph(TextAlignment.taLeft, 0, 0, 0, true); fWriter.AddParagraphChunkAnchor(iName, fBoldFont, iRec.XRef); fWriter.AddParagraphChunk(GKUtils.GetPedigreeLifeStr(iRec, PedigreeFormat.Compact), fTextFont); fWriter.EndParagraph(); IImage image = fBase.Context.GetPrimaryBitmap(iRec, 0, 0, false); fWriter.AddImage(image); GEDCOMIndividualRecord father, mother; GEDCOMFamilyRecord fam = iRec.GetParentsFamily(); if (fam == null) { father = null; mother = null; } else { father = fam.GetHusband(); mother = fam.GetWife(); } if (father != null) { fWriter.BeginParagraph(TextAlignment.taLeft, 0, 0, 0); fWriter.AddParagraphChunk(LangMan.LS(LSID.LSID_Father) + ": ", fTextFont); fWriter.AddParagraphChunkLink(GKUtils.GetNameString(father, true, false), fLinkFont, father.XRef); fWriter.EndParagraph(); } if (mother != null) { fWriter.BeginParagraph(TextAlignment.taLeft, 0, 0, 0); fWriter.AddParagraphChunk(LangMan.LS(LSID.LSID_Mother) + ": ", fTextFont); fWriter.AddParagraphChunkLink(GKUtils.GetNameString(mother, true, false), fLinkFont, mother.XRef); fWriter.EndParagraph(); } if (IncludeEvents && iRec.Events.Count != 0) { int num = iRec.Events.Count; for (int i = 0; i < num; i++) { GEDCOMCustomEvent evt = iRec.Events[i]; if (evt.Name == "BIRT" || evt.Name == "DEAT") { continue; } string evtName = GKUtils.GetEventName(evt); string evtVal = evt.StringValue; string evtDesc = GKUtils.GetEventDesc(evt, false); string tmp = evtName + ": " + evtVal; if (evtVal != "") { tmp += ", "; } tmp += evtDesc; fWriter.AddParagraph(tmp, fTextFont); } } if (IncludeNotes && iRec.Notes.Count != 0) { int num = iRec.Notes.Count; for (int i = 0; i < num; i++) { GEDCOMNotes note = iRec.Notes[i]; fWriter.AddParagraph(GKUtils.MergeStrings(note.Notes), fTextFont); } } }