protected string GetNoteText(GDMNotes ns) { GDMLines noteLines = fTree.GetNoteLines(ns); string result = GMConfig.Instance.ObfuscateEmails ? ObfuscateEmail(noteLines.Text) : noteLines.Text; return(result); }
private static void CheckTagWithLists(GDMTree tree, GEDCOMFormat format, GDMTagWithLists tag) { int num = tag.MultimediaLinks.Count; for (int i = 0; i < num; i++) { GDMMultimediaLink mmLink = tag.MultimediaLinks[i]; if (!mmLink.IsPointer) { TransformMultimediaLink(tree, mmLink); } } num = tag.Notes.Count; for (int i = 0; i < num; i++) { GDMNotes note = tag.Notes[i]; if (!note.IsPointer) { TransformNote(tree, note); } } num = tag.SourceCitations.Count; for (int i = 0; i < num; i++) { GDMSourceCitation sourCit = tag.SourceCitations[i]; if (!sourCit.IsPointer) { TransformSourceCitation(tree, sourCit); } } }
// TODO: refactor private static void CheckRecord_RepairTag(GDMTree tree, GEDCOMFormat format, GDMTagWithLists tag) { for (int i = tag.MultimediaLinks.Count - 1; i >= 0; i--) { GDMMultimediaLink mmLink = tag.MultimediaLinks[i]; if (mmLink.IsPointer && mmLink.Value == null) { tag.MultimediaLinks.DeleteAt(i); } } for (int i = tag.Notes.Count - 1; i >= 0; i--) { GDMNotes note = tag.Notes[i]; if (note.IsPointer && note.Value == null) { tag.Notes.DeleteAt(i); } } for (int i = tag.SourceCitations.Count - 1; i >= 0; i--) { GDMSourceCitation sourCit = tag.SourceCitations[i]; if (sourCit.IsPointer && sourCit.Value == null) { tag.SourceCitations.DeleteAt(i); } } }
private static void CheckRecord(IBaseContext baseContext, GDMTree tree, GDMRecord rec, GEDCOMFormat format, int fileVer) { if (format != GEDCOMFormat.gf_Native) { int num = rec.MultimediaLinks.Count; for (int i = 0; i < num; i++) { GDMMultimediaLink mmLink = rec.MultimediaLinks[i]; if (!mmLink.IsPointer) { TransformMultimediaLink(tree, mmLink); } } num = rec.Notes.Count; for (int i = 0; i < num; i++) { GDMNotes note = rec.Notes[i]; if (!note.IsPointer) { TransformNote(tree, note); } } num = rec.SourceCitations.Count; for (int i = 0; i < num; i++) { GDMSourceCitation sourCit = rec.SourceCitations[i]; if (!sourCit.IsPointer) { TransformSourceCitation(tree, sourCit); } } } switch (rec.RecordType) { case GDMRecordType.rtIndividual: CheckIndividualRecord(baseContext, tree, format, rec as GDMIndividualRecord); break; case GDMRecordType.rtFamily: CheckFamilyRecord(baseContext, tree, format, rec as GDMFamilyRecord); break; case GDMRecordType.rtGroup: CheckGroupRecord(rec as GDMGroupRecord); break; case GDMRecordType.rtSource: CheckSourceRecord(rec as GDMSourceRecord); break; case GDMRecordType.rtMultimedia: CheckMultimediaRecord(rec as GDMMultimediaRecord, format, fileVer); break; } }
public void WriteNotes(HTMLFile f, GDMNotes ns) { if (ns != null) { string noteText = GetNoteText(ns); f.WriteLine("<p>{0}</p>", EscapeHTML(noteText, false)); } }
private void TransformNote(GDMNotes note) { GDMNoteRecord noteRec = fTree.CreateNote(); noteRec.Lines.Assign(note.Lines); note.Clear(); note.XRef = noteRec.XRef; }
private static void TransformNote(GDMTree tree, GDMNotes note) { GDMNoteRecord noteRec = tree.CreateNote(); noteRec.Lines.Assign(note.Lines); note.Clear(); note.Value = noteRec; }
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++) { GDMNotes note = person.IRec.Notes[i]; fWriter.AddParagraph(GKUtils.MergeStrings(note.Lines), fTextFont); } } bool spIndex = person.IRec.SpouseToFamilyLinks.Count > 1; int num2 = person.IRec.SpouseToFamilyLinks.Count; for (int i = 0; i < num2; i++) { GDMFamilyRecord family = person.IRec.SpouseToFamilyLinks[i].Family; if (fBase.Context.IsRecordAccess(family.Restriction)) { GDMIndividualRecord spRec; string st; string unk; if (person.IRec.Sex == GDMSex.svMale) { spRec = family.Wife.Individual; st = LangMan.LS(LSID.LSID_WifeSign); unk = LangMan.LS(LSID.LSID_UnkFemale); } else { spRec = family.Husband.Individual; st = LangMan.LS(LSID.LSID_HusbSign); unk = LangMan.LS(LSID.LSID_UnkMale); } if (spIndex) { st += (i + 1).ToString(); } st += " - "; if (spRec != null) { st = st + GKUtils.GetNameString(spRec, true, false) + GKUtils.GetPedigreeLifeStr(spRec, fOptions.PedigreeOptions.Format) /* + this.idLink(this.FindPerson(irec))*/; } else { st += unk; } fWriter.AddParagraph(st, fTextFont); } } }
private void AddNote(GDMRecord indiRec, string noteText) { var noteRec = fTree.CreateNote(); noteRec.Lines.Text = noteText; var notes = new GDMNotes(); notes.XRef = noteRec.XRef; indiRec.Notes.Add(notes); }
public static GDMNotes AddNote(this IGDMStructWithNotes _struct, GDMNoteRecord noteRec) { GDMNotes note = null; if (noteRec != null) { note = new GDMNotes(); note.XRef = noteRec.XRef; _struct.Notes.Add(note); } return(note); }
public static GDMNotes AddNote(this IGDMStructWithNotes _struct, GDMNoteRecord noteRec) { GDMNotes note = null; if (noteRec != null) { note = new GDMNotes((GDMObject)_struct); note.Value = noteRec; _struct.Notes.Add(note); } return(note); }
public GDMNotes AddNote(GDMNoteRecord noteRec) { GDMNotes note = null; if (noteRec != null) { note = new GDMNotes(this); note.Value = noteRec; fNotes.Add(note); } return(note); }
protected string GetNoteText(GDMNotes ns) { GDMLines noteLines = fTree.GetNoteLines(ns); string result; if (CConfig.Instance.ObfuscateEmails) { result = ObfuscateEmail(noteLines.Text); } else { result = noteLines.Text; } return(result); }
public override void Modify(object sender, ModifyEventArgs eArgs) { var dataOwner = fDataOwner as IGEDCOMStructWithLists; if (fBaseWin == null || fSheetList == null || dataOwner == null) { return; } GDMNotes notes = eArgs.ItemData as GDMNotes; bool result = false; GDMNoteRecord noteRec; switch (eArgs.Action) { case RecordAction.raAdd: noteRec = fBaseWin.Context.SelectRecord(GDMRecordType.rtNote, null) as GDMNoteRecord; if (noteRec != null) { result = fUndoman.DoOrdinaryOperation(OperationType.otRecordNoteAdd, (GDMObject)dataOwner, noteRec); } break; case RecordAction.raEdit: if (notes != null) { noteRec = notes.Value as GDMNoteRecord; result = BaseController.ModifyNote(fBaseWin, ref noteRec); } break; case RecordAction.raDelete: if (AppHost.StdDialogs.ShowQuestionYN(LangMan.LS(LSID.LSID_DetachNoteQuery))) { result = fUndoman.DoOrdinaryOperation(OperationType.otRecordNoteRemove, (GDMObject)dataOwner, notes); } break; } if (result) { fBaseWin.Context.Modified = true; eArgs.IsChanged = true; } }
private static void CheckTagWithNotes(GDMTree tree, GEDCOMFormat format, IGDMStructWithNotes tag) { for (int i = tag.Notes.Count - 1; i >= 0; i--) { GDMNotes note = tag.Notes[i]; if (!note.IsPointer) { TransformNote(tree, note); } else { if (note.Value == null) { tag.Notes.DeleteAt(i); } } } }
private void CheckTagWithNotes(IGDMStructWithNotes tag) { for (int i = tag.Notes.Count - 1; i >= 0; i--) { GDMNotes note = tag.Notes[i]; if (!note.IsPointer) { TransformNote(note); } else { var noteRec = fTree.GetPtrValue <GDMNoteRecord>(note); if (noteRec == null) { tag.Notes.DeleteAt(i); } } } }
private bool ProcessRecordNoteRemove(bool redo) { IGEDCOMStructWithLists swl = fObj as IGEDCOMStructWithLists; GDMNotes notes = fNewVal as GDMNotes; 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 static void CheckPointerWithNotes(GDMTree tree, GEDCOMFormat format, GDMPointerWithNotes ptr) { // TODO: checkit! GDMRecord val = ptr.Value; if (!string.IsNullOrEmpty(ptr.XRef) && val == null) { ptr.Value = null; } int num = ptr.Notes.Count; for (int i = 0; i < num; i++) { GDMNotes note = ptr.Notes[i]; if (!note.IsPointer) { TransformNote(tree, note); } } }
private bool ProcessRecordNoteAdd(bool redo) { IGEDCOMStructWithLists swl = fObj as IGEDCOMStructWithLists; GDMNoteRecord noteRec = fNewVal as GDMNoteRecord; bool result = (swl != null && noteRec != null); if (result) { if (redo) { GDMNotes notes = swl.AddNote(noteRec); fOldVal = notes; } else { GDMNotes notes = fOldVal as GDMNotes; swl.Notes.Delete(notes); } } return(result); }
public static GDMNoteRecord GetPtrValue(this GDMTree tree, GDMNotes ptr) { return(tree.GetPtrValue <GDMNoteRecord>(ptr)); }
public override void Modify(object sender, ModifyEventArgs eArgs) { var dataOwner = fDataOwner as IGDMStructWithNotes; if (fBaseWin == null || fSheetList == null || dataOwner == null) { return; } GDMNotes notes = eArgs.ItemData as GDMNotes; bool result = false; GDMNoteRecord noteRec; switch (eArgs.Action) { case RecordAction.raAdd: noteRec = fBaseWin.Context.SelectRecord(GDMRecordType.rtNote, null) as GDMNoteRecord; if (noteRec != null) { result = fUndoman.DoOrdinaryOperation(OperationType.otRecordNoteAdd, (GDMObject)dataOwner, noteRec); notes = dataOwner.FindNotes(noteRec); } break; case RecordAction.raEdit: if (notes != null) { noteRec = fBaseContext.Tree.GetPtrValue <GDMNoteRecord>(notes); result = BaseController.ModifyNote(fBaseWin, ref noteRec); } break; case RecordAction.raDelete: if (AppHost.StdDialogs.ShowQuestionYN(LangMan.LS(LSID.LSID_DetachNoteQuery))) { result = fUndoman.DoOrdinaryOperation(OperationType.otRecordNoteRemove, (GDMObject)dataOwner, notes); } break; case RecordAction.raMoveUp: case RecordAction.raMoveDown: { int idx = dataOwner.Notes.IndexOf(notes); switch (eArgs.Action) { case RecordAction.raMoveUp: dataOwner.Notes.Exchange(idx - 1, idx); break; case RecordAction.raMoveDown: dataOwner.Notes.Exchange(idx, idx + 1); break; } result = true; } break; } if (result) { if (eArgs.Action == RecordAction.raAdd) { eArgs.ItemData = notes; } fBaseWin.Context.Modified = true; eArgs.IsChanged = true; } }
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); } GDMFamilyRecord fam = person.IRec.GetParentsFamily(); if (fam != null) { GDMIndividualRecord father = fam.Husband.Individual; if (father != null) { fWriter.AddParagraphLink(LangMan.LS(LSID.LSID_Father) + ": " + GKUtils.GetNameString(father, true, false) + " ", fTextFont, idLink(father), fLinkFont); } GDMIndividualRecord mother = fam.Wife.Individual; 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++) { GDMCustomEvent evt = person.IRec.Events[i]; if (!(evt is GDMIndividualAttribute) || 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++) { GDMFamilyRecord family = person.IRec.SpouseToFamilyLinks[i].Family; if (!fBase.Context.IsRecordAccess(family.Restriction)) { continue; } GDMIndividualRecord spRec; string unk; if (person.IRec.Sex == GDMSex.svMale) { spRec = family.Wife.Individual; st = LangMan.LS(LSID.LSID_Wife) + ": "; unk = LangMan.LS(LSID.LSID_UnkFemale); } else { spRec = family.Husband.Individual; st = LangMan.LS(LSID.LSID_Husband) + ": "; unk = LangMan.LS(LSID.LSID_UnkMale); } string sps; if (spRec != null) { sps = st + GKUtils.GetNameString(spRec, true, false) + GKUtils.GetPedigreeLifeStr(spRec, 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++) { GDMIndividualRecord child = family.Children[j].Individual; evList.Add(new PedigreeEvent(child, child.FindEvent(GEDCOMTagType.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++) { GDMNotes note = person.IRec.Notes[i]; fWriter.AddListItem(" " + GKUtils.MergeStrings(note.Lines), fTextFont); } fWriter.EndList(); } }
private void ExposePerson(GDMIndividualRecord 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); GDMIndividualRecord father, mother; GDMFamilyRecord fam = iRec.GetParentsFamily(); if (fam == null) { father = null; mother = null; } else { father = fam.Husband.Individual; mother = fam.Wife.Individual; } 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++) { GDMCustomEvent evt = iRec.Events[i]; var evtType = evt.GetTagType(); if (evtType == GEDCOMTagType.BIRT || evtType == GEDCOMTagType.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++) { GDMNotes note = iRec.Notes[i]; fWriter.AddParagraph(GKUtils.MergeStrings(note.Lines), fTextFont); } } }