Esempio n. 1
0
        public override void UpdateView()
        {
            GEDCOMTree tree = fBase.Context.Tree;

            fTemp = fFilter.BranchPersons;

            var values = new StringList();
            int num    = tree.RecordsCount;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = tree[i];
                if (rec.RecordType == GEDCOMRecordType.rtSource)
                {
                    values.AddObject((rec as GEDCOMSourceRecord).FiledByEntry, rec);
                }
            }
            values.Sort();
            fView.SourceCombo.AddItem(LangMan.LS(LSID.LSID_SrcAll), null);
            fView.SourceCombo.AddItem(LangMan.LS(LSID.LSID_SrcNot), null);
            fView.SourceCombo.AddItem(LangMan.LS(LSID.LSID_SrcAny), null);
            fView.SourceCombo.AddStrings(values);

            UpdateControls();
        }
Esempio n. 2
0
        private void TreeFilterDlg_Load(object sender, EventArgs e)
        {
            GEDCOMTree tree = fBase.Context.Tree;

            fTemp = fFilter.BranchPersons;

            //cmbSource.Sorted = true;
            int num = tree.RecordsCount;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = tree[i];
                if (rec is GEDCOMSourceRecord)
                {
                    cmbSource.Items.Add(new GKComboItem((rec as GEDCOMSourceRecord).FiledByEntry, rec));
                }
            }
            //cmbSource.Sorted = false;

            cmbSource.Items.Insert(0, new GKComboItem(LangMan.LS(LSID.LSID_SrcAll)));
            cmbSource.Items.Insert(1, new GKComboItem(LangMan.LS(LSID.LSID_SrcNot)));
            cmbSource.Items.Insert(2, new GKComboItem(LangMan.LS(LSID.LSID_SrcAny)));

            UpdateControls();
        }
Esempio n. 3
0
        public static bool ModifyNote(IBaseWindow baseWin, ref GEDCOMNoteRecord noteRec)
        {
            bool result;

            try {
                baseWin.Context.BeginUpdate();
                GEDCOMTree tree = baseWin.Context.Tree;

                bool exists = noteRec != null;
                if (!exists)
                {
                    noteRec = new GEDCOMNoteRecord(tree, tree, "", "");
                    noteRec.InitNew();
                }

                try {
                    baseWin.Context.LockRecord(noteRec);

                    if (GlobalOptions.Instance.UseExtendedNotes)
                    {
                        using (var dlg = AppHost.Container.Resolve <INoteEditDlgEx>())
                        {
                            dlg.InitDialog(baseWin);

                            dlg.NoteRecord = noteRec;
                            result         = (AppHost.Instance.ShowModalX(dlg, false));
                        }
                    }
                    else
                    {
                        using (var dlg = AppHost.Container.Resolve <INoteEditDlg>())
                        {
                            dlg.InitDialog(baseWin);

                            dlg.NoteRecord = noteRec;
                            result         = (AppHost.Instance.ShowModalX(dlg, false));
                        }
                    }
                } finally {
                    baseWin.Context.UnlockRecord(noteRec);
                }

                if (!exists)
                {
                    if (result)
                    {
                        tree.AddRecord(noteRec);
                    }
                    else
                    {
                        noteRec.Dispose();
                        noteRec = null;
                    }
                }
            } finally {
                baseWin.Context.EndUpdate();
            }

            return(result);
        }
Esempio n. 4
0
        public TreeToolsWin(IBaseWindow baseWin)
        {
            InitializeComponent();

            btnClose.Image = GKResources.iBtnCancel;

            fBase = baseWin;
            fTree = Base.Context.Tree;

            tabsTools.SelectedIndex = 0;

            fSplitList = new List <GEDCOMRecord>();
            fRMSkip    = new StringList();
            fRMMode    = GEDCOMRecordType.rtIndividual;

            MergeCtl.Base      = fBase;
            MergeCtl.MergeMode = fRMMode;

            fPlaces                    = new StringList();
            fPlaces.Sorted             = true;
            fChecksList                = new List <TreeTools.CheckObj>();
            gkLogChart1.OnHintRequest += HintRequestEventHandler;

            PrepareChecksList();
            PreparePatriarchsList();
            PreparePlacesList();

            SetLang();
        }
Esempio n. 5
0
        protected override void CreateObj(GEDCOMTree owner, GEDCOMObject parent)
        {
            base.CreateObj(owner, parent);
            SetName("DATA");

            fEvents = new GEDCOMList <GEDCOMEvent>(this);
        }
Esempio n. 6
0
        public TaskGoalRet GetTaskGoal()
        {
            GEDCOMTree   tree    = Owner;
            GEDCOMRecord goalRec = tree.XRefIndex_Find(GEDCOMUtils.CleanXRef(Goal));

            GKGoalType goalType;

            if (goalRec is GEDCOMIndividualRecord)
            {
                goalType = GKGoalType.gtIndividual;
            }
            else if (goalRec is GEDCOMFamilyRecord)
            {
                goalType = GKGoalType.gtFamily;
            }
            else if (goalRec is GEDCOMSourceRecord)
            {
                goalType = GKGoalType.gtSource;
            }
            else
            {
                goalType = GKGoalType.gtOther;
            }

            return(new TaskGoalRet(goalType, goalRec));
        }
Esempio n. 7
0
        protected override void CreateObj(GEDCOMTree owner, GEDCOMObject parent)
        {
            base.CreateObj(owner, parent);
            SetRecordType(GEDCOMRecordType.rtSubmitter);
            SetName("SUBM");

            fLanguages = new GEDCOMList <GEDCOMLanguage>(this);
        }
Esempio n. 8
0
        public void Test_GetGEDCOMFormat()
        {
            GEDCOMTree tree = new GEDCOMTree();

            // Tests of determine GEDCOM-format
            Assert.AreEqual(GEDCOMFormat.gf_Unknown, GEDCOMProvider.GetGEDCOMFormat(tree));
            tree.Header.Source = "GENBOX";
            Assert.AreEqual(GEDCOMFormat.gf_GENBOX, GEDCOMProvider.GetGEDCOMFormat(tree));
        }
Esempio n. 9
0
        private void UpdateTreeMap()
        {
            fDataMap.Model.Clear();
            if (fBase == null)
            {
                fDataMap.Invalidate();
                return;
            }

            GEDCOMTree tree = fBase.Context.Tree;
            List <GEDCOMIndividualRecord> prepared     = new List <GEDCOMIndividualRecord>();
            List <GEDCOMRecord>           groupRecords = new List <GEDCOMRecord>();

            try
            {
                int groupNum = 0;
                int num      = tree.RecordsCount;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMRecord rec = tree[i];

                    if (rec.RecordType == GEDCOMRecordType.rtIndividual)
                    {
                        GEDCOMIndividualRecord iRec = rec as GEDCOMIndividualRecord;
                        if (prepared.IndexOf(iRec) < 0)
                        {
                            groupNum++;
                            groupRecords.Clear();

                            TreeTools.WalkTree(iRec, TreeTools.TreeWalkMode.twmAll, groupRecords);

                            int   groupSize = groupRecords.Count;
                            float quality   = 0.0f;
                            for (int j = 0; j < groupSize; j++)
                            {
                                iRec = (GEDCOMIndividualRecord)groupRecords[j];
                                prepared.Add(iRec);

                                quality += iRec.GetCertaintyAssessment();
                            }
                            quality /= groupSize;

                            string name = groupNum.ToString() + " group (" + groupSize.ToString() + ") " + quality.ToString("0.00");

                            CreateItem(null, name, groupSize, quality);
                        }
                    }
                }
            }
            finally
            {
                groupRecords.Clear();
                //prepared.Dispose();
            }

            fDataMap.UpdateView();
        }
Esempio n. 10
0
        protected Exporter(IBaseWindow baseWin)
        {
            if (baseWin == null)
            {
                throw new ArgumentNullException("baseWin");
            }

            fBase = baseWin;
            fTree = baseWin.Context.Tree;
        }
Esempio n. 11
0
        public static bool ModifyMedia(IBaseWindow baseWin, ref GEDCOMMultimediaRecord mediaRec)
        {
            bool result;

            try {
                baseWin.Context.BeginUpdate();
                GEDCOMTree tree = baseWin.Context.Tree;

                using (var dlg = AppHost.Container.Resolve <IMediaEditDlg>())
                {
                    dlg.InitDialog(baseWin);

                    bool exists = mediaRec != null;
                    if (!exists)
                    {
                        mediaRec = new GEDCOMMultimediaRecord(tree, tree, "", "");
                        mediaRec.FileReferences.Add(new GEDCOMFileReferenceWithTitle(tree, mediaRec, "", ""));
                        mediaRec.InitNew();
                    }

                    try {
                        baseWin.Context.LockRecord(mediaRec);

                        dlg.MediaRec = mediaRec;
                        result       = (AppHost.Instance.ShowModalX(dlg, false));
                    } finally {
                        baseWin.Context.UnlockRecord(mediaRec);
                    }

                    if (!exists)
                    {
                        if (result)
                        {
                            tree.AddRecord(mediaRec);
                        }
                        else
                        {
                            mediaRec.Dispose();
                            mediaRec = null;
                        }
                    }
                }
            } finally {
                baseWin.Context.EndUpdate();
            }

            return(result);
        }
Esempio n. 12
0
        public static bool ModifyLocation(IBaseWindow baseWin, ref GEDCOMLocationRecord locRec)
        {
            bool result;

            try {
                baseWin.Context.BeginUpdate();
                GEDCOMTree tree = baseWin.Context.Tree;

                using (var dlg = AppHost.Container.Resolve <ILocationEditDlg>())
                {
                    dlg.InitDialog(baseWin);

                    bool exists = locRec != null;
                    if (!exists)
                    {
                        locRec = new GEDCOMLocationRecord(tree, tree, "", "");
                        locRec.InitNew();
                    }

                    try {
                        baseWin.Context.LockRecord(locRec);

                        dlg.LocationRecord = locRec;
                        result             = AppHost.Instance.ShowModalX(dlg, false);
                    } finally {
                        baseWin.Context.UnlockRecord(locRec);
                    }

                    if (!exists)
                    {
                        if (result)
                        {
                            tree.AddRecord(locRec);
                        }
                        else
                        {
                            locRec.Dispose();
                            locRec = null;
                        }
                    }
                }
            } finally {
                baseWin.Context.EndUpdate();
            }

            return(result);
        }
Esempio n. 13
0
        public MapsViewerWin(IBaseWindow baseWin)
        {
            InitializeComponent();

            fMapBrowser    = new GKMapBrowser();
            Panel1.Content = fMapBrowser;

            fBase            = baseWin;
            fTree            = baseWin.Context.Tree;
            fSelectedPersons = baseWin.GetContentList(GEDCOMRecordType.rtIndividual);

            fMapPoints       = new ExtList <GeoPoint>(true);
            fPlaces          = new ExtList <MapPlace>(true);
            fBaseRoot        = new GKTreeNode(LangMan.LS(LSID.LSID_RPLocations), null);
            radTotal.Checked = true;

            SetLang();
        }
Esempio n. 14
0
        public static bool ModifyResearch(IBaseWindow baseWin, ref GEDCOMResearchRecord researchRec)
        {
            bool result;

            try {
                baseWin.Context.BeginUpdate();
                GEDCOMTree tree = baseWin.Context.Tree;

                using (var dlg = AppHost.Container.Resolve <IResearchEditDlg>(baseWin)) {
                    bool exists = researchRec != null;
                    if (!exists)
                    {
                        researchRec = new GEDCOMResearchRecord(tree, tree, "", "");
                        researchRec.InitNew();
                    }

                    try {
                        baseWin.Context.LockRecord(researchRec);

                        dlg.Research = researchRec;
                        result       = AppHost.Instance.ShowModalX(dlg, false);
                    } finally {
                        baseWin.Context.UnlockRecord(researchRec);
                    }

                    if (!exists)
                    {
                        if (result)
                        {
                            tree.AddRecord(researchRec);
                        }
                        else
                        {
                            researchRec.Dispose();
                            researchRec = null;
                        }
                    }
                }
            } finally {
                baseWin.Context.EndUpdate();
            }

            return(result);
        }
Esempio n. 15
0
        private void RecordMerge(GEDCOMRecord targetRec, GEDCOMRecord sourceRec)
        {
            if (targetRec == null)
            {
                throw new ArgumentNullException("targetRec");
            }

            if (sourceRec == null)
            {
                throw new ArgumentNullException("sourceRec");
            }

            var repMap = new XRefReplacer();

            try
            {
                repMap.AddXRef(sourceRec, sourceRec.XRef, targetRec.XRef);

                GEDCOMTree tree = fBase.Context.Tree;
                int        num  = tree.RecordsCount;
                for (int i = 0; i < num; i++)
                {
                    tree[i].ReplaceXRefs(repMap);
                }

                sourceRec.MoveTo(targetRec, false);
                BaseController.DeleteRecord(fBase, sourceRec, false);

                if (targetRec.RecordType == GEDCOMRecordType.rtIndividual && fBookmark)
                {
                    ((GEDCOMIndividualRecord)targetRec).Bookmark = true;
                }

                fBase.NotifyRecord(targetRec, RecordAction.raEdit);
                fBase.RefreshLists(false);
            }
            finally
            {
                repMap.Dispose();
            }
        }
Esempio n. 16
0
        protected override void InternalGenerate()
        {
            IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000);
            IColor clrBlue  = AppHost.GfxProvider.CreateColor(0x0000FF);

            fTitleFont = fWriter.CreateFont("", 22f, true, false, clrBlack);
            fChapFont  = fWriter.CreateFont("", 16f, true, false, clrBlack);
            fTextFont  = fWriter.CreateFont("", 10f, false, false, clrBlack);

            fWriter.AddParagraph(fTitle, fTitleFont, TextAlignment.taLeft);

            var surnames = new StringList();

            surnames.Sorted         = true;
            surnames.DuplicateSolve = DuplicateSolve.Ignore;

            GEDCOMTree   tree   = fBase.Context.Tree;
            var          enumer = tree.GetEnumerator(GEDCOMRecordType.rtIndividual);
            GEDCOMRecord record;

            while (enumer.MoveNext(out record))
            {
                var    iRec      = record as GEDCOMIndividualRecord;
                var    nameParts = GKUtils.GetNameParts(iRec, false);
                string surname   = fBase.Context.Culture.NormalizeSurname(nameParts.Surname, iRec.Sex == GEDCOMSex.svFemale);
                surnames.Add(surname);
            }

            fWriter.AddParagraph(SRLangMan.LS(RLS.LSID_Surnames), fChapFont, TextAlignment.taLeft);
            fWriter.BeginList();
            for (int i = 0; i < surnames.Count; i++)
            {
                string item = surnames[i];
                string primaryKey = "", alternateKey = "";
                string translit = BaseMorpher.Transliterate(TranslitScheme.ts_Russian, TranslitScheme.ts_GOST, item);
                DoubleMetaphone.doubleMetaphone(translit, ref primaryKey, ref alternateKey);
                fWriter.AddListItem(" " + item + "\t" + translit + "\t" + primaryKey + "\t" + alternateKey, fTextFont);
            }
            fWriter.EndList();
        }
Esempio n. 17
0
        public static bool ModifySourceCitation(IBaseWindow baseWin, ChangeTracker undoman, IGEDCOMStructWithLists _struct, ref GEDCOMSourceCitation cit)
        {
            bool result;

            try {
                baseWin.Context.BeginUpdate();
                GEDCOMTree tree = baseWin.Context.Tree;

                using (var dlg = AppHost.Container.Resolve <ISourceCitEditDlg>())
                {
                    dlg.InitDialog(baseWin);

                    bool exists = cit != null;
                    if (!exists)
                    {
                        cit = new GEDCOMSourceCitation(tree, _struct as GEDCOMObject, "", "");
                    }

                    dlg.SourceCitation = cit;
                    result             = AppHost.Instance.ShowModalX(dlg, false);

                    if (!exists)
                    {
                        if (result)
                        {
                            //_struct.SourceCitations.Add(cit);
                            result = undoman.DoOrdinaryOperation(OperationType.otRecordSourceCitAdd, (GEDCOMObject)_struct, cit);
                        }
                        else
                        {
                            cit.Dispose();
                        }
                    }
                }
            } finally {
                baseWin.Context.EndUpdate();
            }

            return(result);
        }
Esempio n. 18
0
 public GEDCOMSubmitterRecord(GEDCOMTree owner, GEDCOMObject parent, string tagName, string tagValue) : base(owner, parent, tagName, tagValue)
 {
 }
Esempio n. 19
0
 public override void ResetOwner(GEDCOMTree newOwner)
 {
     base.ResetOwner(newOwner);
     fLanguages.ResetOwner(newOwner);
 }
Esempio n. 20
0
 public new static GEDCOMTag Create(GEDCOMTree owner, GEDCOMObject parent, string tagName, string tagValue)
 {
     return(new GEDCOMCutoutPosition(owner, parent, tagName, tagValue));
 }
Esempio n. 21
0
 public GEDCOMCutoutPosition(GEDCOMTree owner, GEDCOMObject parent, string tagName, string tagValue) : base(owner, parent, tagName, tagValue)
 {
 }
Esempio n. 22
0
 public GEDCOMSpouseSealing(GEDCOMTree owner, GEDCOMObject parent, string tagName, string tagValue) : base(owner, parent, tagName, tagValue)
 {
 }