Ejemplo n.º 1
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     try {
         GEDCOMRecord rec = BaseController.AddRecord(fController.Base, fController.RecType, fController.Target);
         if (rec != null)
         {
             ResultRecord = rec;
             DialogResult = DialogResult.OK;
         }
     } catch (Exception ex) {
         Logger.LogWrite("RecordSelectDlg.btnCreate_Click(): " + ex.Message);
         ResultRecord = null;
         DialogResult = DialogResult.None;
     }
 }
Ejemplo n.º 2
0
        public static void IsValidRecord(GEDCOMRecord record, int level, string data, bool hasChildren, int childCount)
        {
            Assert.IsNotNull(record);
            Assert.AreEqual(level, record.Level);
            Assert.AreEqual(data, record.Data);

            if (hasChildren)
            {
                Assert.IsTrue(record.HasChildren);
                Assert.AreEqual(childCount, record.ChildRecords.Count);
            }
            else
            {
                Assert.IsFalse(record.HasChildren);
            }
        }
        /// <summary>
        ///   Removes a single record from the Document
        /// </summary>
        /// <param name = "record"></param>
        public void RemoveRecord(GEDCOMRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(typeof(GEDCOMRecord).Name);
            }

            if (_records.Remove(record))
            {
                //clear the assoicated RecordList so it is refreshed next time around
                ClearList(record.TagName);
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 4
0
        public void ShowRecordInfo(GEDCOMRecord record)
        {
            if (record == null)
            {
                return;
            }

            try {
                IHyperView hyperView = GetHyperViewByType(record.RecordType);
                if (hyperView != null)
                {
                    GKUtils.GetRecordContent(fContext, record, hyperView.Lines);
                }
            } catch (Exception ex) {
                Logger.LogWrite("BaseWinSDI.ShowRecordInfo(): " + ex.Message);
            }
        }
Ejemplo n.º 5
0
        private void AcceptChanges()
        {
            if (rbCutNone.Checked)
            {
                fFilter.BranchCut = ChartFilter.BranchCutType.None;
            }
            else
            {
                if (rbCutYears.Checked)
                {
                    fFilter.BranchCut  = ChartFilter.BranchCutType.Years;
                    fFilter.BranchYear = (int)edYear.Value;
                }
                else
                {
                    if (rbCutPersons.Checked)
                    {
                        fFilter.BranchCut     = ChartFilter.BranchCutType.Persons;
                        fFilter.BranchPersons = fTemp;
                    }
                }
            }

            int selectedIndex = cmbSource.SelectedIndex;

            if (selectedIndex >= 0 && selectedIndex < 3)
            {
                fFilter.SourceMode = (FilterGroupMode)cmbSource.SelectedIndex;
                fFilter.SourceRef  = "";
            }
            else
            {
                GKComboItem  item = (GKComboItem)cmbSource.Items[cmbSource.SelectedIndex];
                GEDCOMRecord rec  = item.Tag as GEDCOMRecord;
                if (rec != null)
                {
                    fFilter.SourceMode = FilterGroupMode.Selected;
                    fFilter.SourceRef  = rec.XRef;
                }
                else
                {
                    fFilter.SourceMode = FilterGroupMode.All;
                    fFilter.SourceRef  = "";
                }
            }
        }
Ejemplo n.º 6
0
        private void SetTask(GEDCOMTaskRecord value)
        {
            fTask = value;
            try
            {
                if (fTask == null)
                {
                    txtPriority.SelectedIndex = -1;
                    txtStartDate.Text         = "";
                    txtStopDate.Text          = "";
                    cmbGoalType.SelectedIndex = 0;
                    txtGoal.Text = "";
                }
                else
                {
                    txtPriority.SelectedIndex = (sbyte)fTask.Priority;
                    txtStartDate.Text         = fTask.StartDate.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                    txtStopDate.Text          = fTask.StopDate.GetDisplayString(DateFormat.dfDD_MM_YYYY);

                    var goal = fTask.GetTaskGoal();
                    fTempRec = goal.GoalRec;
                    cmbGoalType.SelectedIndex = (sbyte)goal.GoalType;

                    switch (goal.GoalType)
                    {
                    case GKGoalType.gtIndividual:
                    case GKGoalType.gtFamily:
                    case GKGoalType.gtSource:
                        txtGoal.Text = GKUtils.GetGoalStr(goal.GoalType, fTempRec);
                        break;

                    case GKGoalType.gtOther:
                        txtGoal.Text = fTask.Goal;
                        break;
                    }
                }

                fNotesList.ListModel.DataOwner = fTask;

                cmbGoalType_SelectedIndexChanged(null, null);
            }
            catch (Exception ex)
            {
                Logger.LogWrite("TaskEditDlg.SetTask(): " + ex.Message);
            }
        }
Ejemplo n.º 7
0
        public void SetRec1(GEDCOMRecord value)
        {
            fRec1 = value;
            UpdateMergeButtons();

            if (fRec1 == null)
            {
                Lab1.Text  = @"XXX1";
                Edit1.Text = "";
                fView1.Lines.Clear();
            }
            else
            {
                Lab1.Text  = fRec1.XRef;
                Edit1.Text = GKUtils.GetRecordName(fRec1, false);
                fView1.Lines.Assign(fBase.GetRecordContent(fRec1));
            }
        }
Ejemplo n.º 8
0
        public void SetRec2(GEDCOMRecord value)
        {
            fRec2 = value;
            UpdateMergeButtons();

            if (fRec2 == null)
            {
                Lab2.Text  = @"XXX2";
                Edit2.Text = "";
                fView2.Lines.Clear();
            }
            else
            {
                Lab2.Text  = fRec2.XRef;
                Edit2.Text = GKUtils.GetRecordName(fRec2, false);
                fView2.Lines.Assign(fBase.GetRecordContent(fRec2));
            }
        }
Ejemplo n.º 9
0
        public void CheckChangedRecord(GEDCOMRecord record, bool active)
        {
            int idx = fChangedRecords.IndexOf(record);

            if (active)
            {
                if (idx < 0)
                {
                    fChangedRecords.Add(record);
                }
            }
            else
            {
                if (idx >= 0)
                {
                    fChangedRecords.RemoveAt(idx);
                }
            }
        }
Ejemplo n.º 10
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();
            }
        }
Ejemplo n.º 11
0
        public void ReindexBase(IBaseWindow baseWin)
        {
            if (baseWin == null)
            {
                return;
            }

            try
            {
                lock (fLock)
                {
                    using (WritableDatabase database = new WritableDatabase(GetXDBFolder(), Xapian.Xapian.DB_CREATE_OR_OPEN))
                        using (TermGenerator indexer = new TermGenerator())
                            using (Stem stemmer = new Stem("russian"))
                            {
                                indexer.SetStemmer(stemmer);

                                IProgressController progress = AppHost.Progress;
                                progress.ProgressInit(fPlugin.LangMan.LS(TLS.LSID_SearchIndexRefreshing), baseWin.Context.Tree.RecordsCount);
                                int num = baseWin.Context.Tree.RecordsCount;
                                for (int i = 0; i < num; i++)
                                {
                                    GEDCOMRecord record = baseWin.Context.Tree[i];
                                    if (IsIndexedRecord(record))
                                    {
                                        ReindexRecord(baseWin, database, indexer, record);
                                    }

                                    progress.ProgressStep();
                                }
                                progress.ProgressDone();

                                SetDBLastChange(baseWin, database);
                            }
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("SearchManager.ReindexBase(): " + ex.Message);
            }
        }
Ejemplo n.º 12
0
        public override bool Accept()
        {
            try {
                fFilter.BranchCut = (ChartFilter.BranchCutType)fView.GetCutModeRadio();
                if (fFilter.BranchCut == ChartFilter.BranchCutType.Years)
                {
                    fFilter.BranchYear = (int)fView.YearNum.Value;
                }
                else if (fFilter.BranchCut == ChartFilter.BranchCutType.Persons)
                {
                    fFilter.BranchPersons = fTemp;
                }

                int selectedIndex = fView.SourceCombo.SelectedIndex;
                if (selectedIndex >= 0 && selectedIndex < 3)
                {
                    fFilter.SourceMode = (FilterGroupMode)fView.SourceCombo.SelectedIndex;
                    fFilter.SourceRef  = "";
                }
                else
                {
                    GEDCOMRecord rec = fView.SourceCombo.SelectedTag as GEDCOMRecord;
                    if (rec != null)
                    {
                        fFilter.SourceMode = FilterGroupMode.Selected;
                        fFilter.SourceRef  = rec.XRef;
                    }
                    else
                    {
                        fFilter.SourceMode = FilterGroupMode.All;
                        fFilter.SourceRef  = "";
                    }
                }

                return(true);
            } catch (Exception ex) {
                Logger.LogWrite("TreeFilterDlgController.Accept(): " + ex.Message);
                return(false);
            }
        }
Ejemplo n.º 13
0
        public override void UpdateView()
        {
            if (fTask == null)
            {
                fView.Priority.SelectedIndex = -1;
                fView.StartDate.Text         = "";
                fView.StopDate.Text          = "";
                fView.GoalType.SelectedIndex = 0;
                fView.Goal.Text = "";
            }
            else
            {
                fView.Priority.SelectedIndex = (sbyte)fTask.Priority;
                fView.StartDate.Text         = fTask.StartDate.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.StopDate.Text          = fTask.StopDate.GetDisplayString(DateFormat.dfDD_MM_YYYY);

                var goal = fTask.GetTaskGoal();
                fTempRec = goal.GoalRec;
                fView.GoalType.SelectedIndex = (sbyte)goal.GoalType;

                switch (goal.GoalType)
                {
                case GKGoalType.gtIndividual:
                case GKGoalType.gtFamily:
                case GKGoalType.gtSource:
                    fView.Goal.Text = GKUtils.GetGoalStr(goal.GoalType, fTempRec);
                    break;

                case GKGoalType.gtOther:
                    fView.Goal.Text = fTask.Goal;
                    break;
                }
            }

            fView.NotesList.ListModel.DataOwner = fTask;

            ChangeGoalType();
        }
Ejemplo n.º 14
0
        private void UpdateSplitLists()
        {
            //ListSelected.BeginUpdate();
            ListSelected.Items.Clear();
            //ListSkipped.BeginUpdate();
            ListSkipped.Items.Clear();
            try
            {
                int cnt = 0;

                int num = fTree.RecordsCount;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMRecord rec = fTree[i];
                    if (rec is GEDCOMIndividualRecord)
                    {
                        cnt++;
                        GEDCOMIndividualRecord iRec = rec as GEDCOMIndividualRecord;
                        string st = iRec.XRef + " / " + GKUtils.GetNameString(iRec, true, false);

                        if (fSplitList.IndexOf(iRec) < 0)
                        {
                            ListSkipped.Items.Add(st);
                        }
                        else
                        {
                            ListSelected.Items.Add(st);
                        }
                    }
                }
                Title = fSplitList.Count.ToString() + @" / " + cnt.ToString();
            }
            finally
            {
                //ListSelected.EndUpdate();
                //ListSkipped.EndUpdate();
            }
        }
Ejemplo n.º 15
0
        private StringList GetNotes()
        {
            StringList notes;

            if (!IsPointer)
            {
                notes = GetTagStrings(this);
            }
            else
            {
                GEDCOMRecord notesRecord = Value;
                if (notesRecord is GEDCOMNoteRecord)
                {
                    notes = ((notesRecord as GEDCOMNoteRecord).Note);
                }
                else
                {
                    notes = new StringList();
                }
            }

            return(notes);
        }
Ejemplo n.º 16
0
        private void CollectData()
        {
            int num = fBase.Context.Tree.RecordsCount;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = fBase.Context.Tree[i];
                if (rec.RecordType != GEDCOMRecordType.rtIndividual)
                {
                    continue;
                }

                GEDCOMIndividualRecord iRec = (GEDCOMIndividualRecord)rec;

                int num2 = iRec.Events.Count;
                for (int k = 0; k < num2; k++)
                {
                    GEDCOMCustomEvent ev = iRec.Events[k];

                    if (ev.Name == "BIRT" || ev.Name == "DEAT")
                    {
                        int year = ev.GetChronologicalYear();
                        if (year != 0)
                        {
                            if (fYearMin > year)
                            {
                                fYearMin = year;
                            }
                            if (fYearMax < year)
                            {
                                fYearMax = year;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
        public void Test_GetRecordName()
        {
            GEDCOMRecord rec = fContext.Tree.XRefIndex_Find("I1");

            Assert.AreEqual("Ivanov Ivan Ivanovich", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("F1");
            Assert.AreEqual("Ivanov Ivan Ivanovich - Ivanova Maria Petrovna", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("G1");
            Assert.AreEqual("GroupTest", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("L1");
            Assert.AreEqual("Test Location", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("R1");
            Assert.AreEqual("Test repository", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("RS1");
            Assert.AreEqual("Test research", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("S1");
            Assert.AreEqual("Test source", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("N1");
            Assert.AreEqual("Test note", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("TK1");
            Assert.AreEqual("Test task", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("O1");
            Assert.AreEqual("Test multimedia", GKUtils.GetRecordName(rec, false));

            rec = fContext.Tree.XRefIndex_Find("CM1");
            Assert.AreEqual("Test communication", GKUtils.GetRecordName(rec, false));
        }
Ejemplo n.º 18
0
        private void CheckGroups()
        {
            IProgressController progress = AppHost.Progress;

            gkLogChart1.Clear();
            tvGroups.DataStore = null;

            progress.ProgressInit(LangMan.LS(LSID.LSID_CheckFamiliesConnection), fTree.RecordsCount);
            List <GEDCOMIndividualRecord> prepared     = new List <GEDCOMIndividualRecord>();
            List <GEDCOMRecord>           groupRecords = new List <GEDCOMRecord>();

            try
            {
                var rootItem = new TreeItem();

                int groupNum = 0;

                int num = fTree.RecordsCount;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMRecord rec = fTree[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 cnt = groupRecords.Count;

                            TreeItem groupItem = new TreeItem();
                            groupItem.Text = groupNum.ToString() + " " + LangMan.LS(LSID.LSID_Group).ToLower() + " (" + cnt.ToString() + ")";
                            rootItem.Children.Add(groupItem);

                            for (int j = 0; j < cnt; j++)
                            {
                                iRec = (GEDCOMIndividualRecord)groupRecords[j];
                                prepared.Add(iRec);

                                string pn = GKUtils.GetNameString(iRec, true, false);
                                if (iRec.Patriarch)
                                {
                                    pn = "(*) " + pn;
                                }

                                groupItem.Children.Add(new GKTreeNode(pn, iRec));
                            }
                            groupItem.Expanded = true;

                            gkLogChart1.AddFragment(cnt);
                        }
                    }

                    progress.ProgressStep();
                }

                tvGroups.DataStore = rootItem;
                tvGroups.RefreshData();
            }
            finally
            {
                groupRecords.Clear();
                //prepared.Dispose();
                progress.ProgressDone();
            }
        }
Ejemplo n.º 19
0
        private void SearchDuplicates()
        {
            MergeCtl.Base      = fBase;
            MergeCtl.MergeMode = fRMMode;

            MergeCtl.SetRec1(null);
            MergeCtl.SetRec2(null);

            MatchParams mParams;

            //mParams.IndistinctNameMatching = chkIndistinctMatching.Checked;
            mParams.NamesIndistinctThreshold = (float)(edNameAccuracy.Value / 100.0f);
            mParams.DatesCheck       = chkBirthYear.Checked.GetValueOrDefault();
            mParams.YearsInaccuracy  = (int)edYearInaccuracy.Value;
            mParams.CheckEventPlaces = false;

            bool res = false;

            btnSkip.Enabled = false;

            try
            {
                ProgressBar1.MinValue = 0;
                ProgressBar1.MaxValue = fTree.RecordsCount;
                ProgressBar1.Value    = fRMIndex;

                int recNum = fTree.RecordsCount;
                for (int i = fRMIndex; i < recNum; i++)
                {
                    fRMIndex            = i;
                    ProgressBar1.Value += 1; //Increment(1);

                    GEDCOMRecord iRec = fTree[i];
                    if (iRec.RecordType != fRMMode)
                    {
                        continue;
                    }

                    for (int j = i + 1; j < recNum; j++)
                    {
                        GEDCOMRecord kRec = fTree[j];
                        if (kRec.RecordType != fRMMode)
                        {
                            continue;
                        }

                        if (iRec == kRec)
                        {
                            continue;
                        }
                        if (fRMSkip.IndexOf(iRec.XRef + "-" + kRec.XRef) >= 0)
                        {
                            continue;
                        }

                        res = iRec.IsMatch(kRec, mParams) >= 100.0f;

                        if (res && fRMMode == GEDCOMRecordType.rtIndividual)
                        {
                            res = CheckPersonsEx((GEDCOMIndividualRecord)iRec, (GEDCOMIndividualRecord)kRec);
                        }

                        if (res)
                        {
                            MergeCtl.SetRec1(iRec);
                            MergeCtl.SetRec2(kRec);
                            break;
                        }
                    }

                    if (res)
                    {
                        break;
                    }
                }
            }
            finally
            {
                btnSkip.Enabled = true;
            }
        }
Ejemplo n.º 20
0
        public override void Fetch(GEDCOMRecord aRec)
        {
            fRec = (aRec as GEDCOMIndividualRecord);
            if (fRec == null)
            {
                return;
            }

            buf_fullname    = GKUtils.GetNameString(fRec, true, false);
            buf_bd          = null;
            buf_dd          = null;
            buf_residence   = "";
            buf_religion    = "";
            buf_nationality = "";
            buf_education   = "";
            buf_occupation  = "";
            buf_caste       = "";
            buf_mili        = "";
            buf_mili_ind    = "";
            buf_mili_dis    = "";
            buf_mili_rank   = "";
            buf_title       = "";

            GlobalOptions gOptions = GlobalOptions.Instance;

            int num = fRec.Events.Count;

            for (int i = 0; i < num; i++)
            {
                GEDCOMCustomEvent ev = fRec.Events[i];

                if (ev.Name == "BIRT" && buf_bd == null)
                {
                    buf_bd = ev;
                }
                else if (ev.Name == "DEAT" && buf_dd == null)
                {
                    buf_dd = ev;
                }
                else if (ev.Name == "RESI" && buf_residence == "")
                {
                    buf_residence = GKUtils.GetPlaceStr(ev, gOptions.PlacesWithAddress);
                }
                else if (ev.Name == "RELI" && buf_religion == "")
                {
                    buf_religion = ev.StringValue;
                }
                else if (ev.Name == "NATI" && buf_nationality == "")
                {
                    buf_nationality = ev.StringValue;
                }
                else if (ev.Name == "EDUC" && buf_education == "")
                {
                    buf_education = ev.StringValue;
                }
                else if (ev.Name == "OCCU" && buf_occupation == "")
                {
                    buf_occupation = ev.StringValue;
                }
                else if (ev.Name == "CAST" && buf_caste == "")
                {
                    buf_caste = ev.StringValue;
                }
                else if (ev.Name == "_MILI" && buf_mili == "")
                {
                    buf_mili = ev.StringValue;
                }
                else if (ev.Name == "_MILI_IND" && buf_mili_ind == "")
                {
                    buf_mili_ind = ev.StringValue;
                }
                else if (ev.Name == "_MILI_DIS" && buf_mili_dis == "")
                {
                    buf_mili_dis = ev.StringValue;
                }
                else if (ev.Name == "_MILI_RANK" && buf_mili_rank == "")
                {
                    buf_mili_rank = ev.StringValue;
                }
                else if (ev.Name == "TITL" && buf_title == "")
                {
                    buf_title = ev.StringValue;
                }
            }
        }
Ejemplo n.º 21
0
 private static bool ChildSelectorHandler(GEDCOMRecord record)
 {
     GEDCOMIndividualRecord iRec = record as GEDCOMIndividualRecord;
     return (iRec != null && iRec.ChildToFamilyLinks.Count == 0);
 }
        public override bool Accept()
        {
            try {
                IndividualListFilter iFilter = (IndividualListFilter)fListMan.Filter;

                SaveFilter(fView.NameCombo.Text, GlobalOptions.Instance.NameFilters);
                SaveFilter(fView.ResidenceCombo.Text, GlobalOptions.Instance.ResidenceFilters);
                SaveFilter(fView.EventValCombo.Text, GlobalOptions.Instance.EventFilters);

                iFilter.PatriarchOnly = fView.OnlyPatriarchsCheck.Checked;

                int lifeSel = fView.GetLifeRadio();
                if (iFilter.FilterLifeMode != FilterLifeMode.lmTimeLocked)
                {
                    iFilter.AliveBeforeDate = fView.AliveBeforeDate.Text;
                    iFilter.FilterLifeMode  = (FilterLifeMode)lifeSel;
                    if (iFilter.FilterLifeMode == FilterLifeMode.lmAliveBefore)
                    {
                        try {
                            /*DateTime dt = */
                            DateTime.Parse(fView.AliveBeforeDate.Text);
                        } catch {
                            AppHost.StdDialogs.ShowError(LangMan.LS(LSID.LSID_DateInvalid));
                            return(false);
                        }
                    }
                }

                iFilter.Sex = (GEDCOMSex)fView.GetSexRadio();

                if (fView.NameCombo.Text == "")
                {
                    fView.NameCombo.Text = @"*";
                }
                iFilter.Name = fView.NameCombo.Text;

                if (fView.ResidenceCombo.Text == "")
                {
                    fView.ResidenceCombo.Text = @"*";
                }
                iFilter.Residence = fView.ResidenceCombo.Text;

                if (fView.EventValCombo.Text == "")
                {
                    fView.EventValCombo.Text = @"*";
                }
                iFilter.EventVal = fView.EventValCombo.Text;

                int selectedIndex = fView.GroupCombo.SelectedIndex;
                if (selectedIndex >= 0 && selectedIndex < 3)
                {
                    iFilter.FilterGroupMode = (FilterGroupMode)fView.GroupCombo.SelectedIndex;
                    iFilter.GroupRef        = "";
                }
                else
                {
                    GEDCOMRecord rec = fView.GroupCombo.SelectedTag as GEDCOMRecord;
                    if (rec != null)
                    {
                        iFilter.FilterGroupMode = FilterGroupMode.Selected;
                        iFilter.GroupRef        = rec.XRef;
                    }
                    else
                    {
                        iFilter.FilterGroupMode = FilterGroupMode.All;
                        iFilter.GroupRef        = "";
                    }
                }

                selectedIndex = fView.SourceCombo.SelectedIndex;
                if (selectedIndex >= 0 && selectedIndex < 3)
                {
                    iFilter.SourceMode = (FilterGroupMode)fView.SourceCombo.SelectedIndex;
                    iFilter.SourceRef  = "";
                }
                else
                {
                    GEDCOMRecord rec = fView.SourceCombo.SelectedTag as GEDCOMRecord;
                    if (rec != null)
                    {
                        iFilter.SourceMode = FilterGroupMode.Selected;
                        iFilter.SourceRef  = rec.XRef;
                    }
                    else
                    {
                        iFilter.SourceMode = FilterGroupMode.All;
                        iFilter.SourceRef  = "";
                    }
                }

                return(true);
            } catch (Exception ex) {
                Logger.LogWrite("PersonsFilterDlgController.Accept(): " + ex.Message);
                return(false);
            }
        }
        public override void UpdateView()
        {
            IndividualListFilter iFilter = (IndividualListFilter)fListMan.Filter;
            GlobalOptions        options = GlobalOptions.Instance;

            fView.NameCombo.Clear();
            fView.NameCombo.Add("*");
            fView.NameCombo.AddStrings(options.NameFilters);

            fView.ResidenceCombo.Clear();
            fView.ResidenceCombo.Add("*");
            fView.ResidenceCombo.AddStrings(options.ResidenceFilters);

            fView.EventValCombo.Clear();
            fView.EventValCombo.AddStrings(options.EventFilters);

            int lifeSel;

            if (iFilter.FilterLifeMode != FilterLifeMode.lmTimeLocked)
            {
                lifeSel = (int)iFilter.FilterLifeMode;
                fView.SetLifeEnabled(true);
                fView.AliveBeforeDate.Text = iFilter.AliveBeforeDate;
            }
            else
            {
                lifeSel = -1;
                fView.SetLifeEnabled(false);
                fView.AliveBeforeDate.Text = "";
            }

            fView.SetLifeRadio(lifeSel);
            fView.SetSexRadio((int)iFilter.Sex);

            fView.NameCombo.Text              = iFilter.Name;
            fView.ResidenceCombo.Text         = iFilter.Residence;
            fView.EventValCombo.Text          = iFilter.EventVal;
            fView.OnlyPatriarchsCheck.Checked = iFilter.PatriarchOnly;

            GEDCOMTree tree = Base.Context.Tree;

            var values = new StringList();

            fView.GroupCombo.Clear();
            int num = tree.RecordsCount;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = tree[i];
                if (rec is GEDCOMGroupRecord)
                {
                    values.AddObject((rec as GEDCOMGroupRecord).GroupName, rec);
                }
            }
            values.Sort();
            fView.GroupCombo.AddItem(LangMan.LS(LSID.LSID_SrcAll), null);
            fView.GroupCombo.AddItem(LangMan.LS(LSID.LSID_SrcNot), null);
            fView.GroupCombo.AddItem(LangMan.LS(LSID.LSID_SrcAny), null);
            fView.GroupCombo.AddStrings(values);
            if (iFilter.FilterGroupMode != FilterGroupMode.Selected)
            {
                fView.GroupCombo.SelectedIndex = (int)iFilter.FilterGroupMode;
            }
            else
            {
                GEDCOMGroupRecord groupRec = tree.XRefIndex_Find(iFilter.GroupRef) as GEDCOMGroupRecord;
                if (groupRec != null)
                {
                    fView.GroupCombo.Text = groupRec.GroupName;
                }
            }

            values = new StringList();
            fView.SourceCombo.Clear();
            for (int i = 0; i < tree.RecordsCount; i++)
            {
                GEDCOMRecord rec = tree[i];
                if (rec is GEDCOMSourceRecord)
                {
                    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);
            if (iFilter.SourceMode != FilterGroupMode.Selected)
            {
                fView.SourceCombo.SelectedIndex = (int)iFilter.SourceMode;
            }
            else
            {
                GEDCOMSourceRecord sourceRec = tree.XRefIndex_Find(iFilter.SourceRef) as GEDCOMSourceRecord;
                if (sourceRec != null)
                {
                    fView.SourceCombo.Text = sourceRec.FiledByEntry;
                }
            }
        }
Ejemplo n.º 24
0
        private void PlacesLoad()
        {
            try
            {
                IProgressController progress = AppHost.Progress;

                fMapBrowser.InitMap();

                //cmbPersons.BeginUpdate();
                //tvPlaces.BeginUpdate();
                tvPlaces.DataStore = null;
                progress.ProgressInit(LangMan.LS(LSID.LSID_LoadingLocations), fTree.RecordsCount);
                try
                {
                    fPlaces.Clear();
                    cmbPersons.Items.Clear();
                    //cmbPersons.Sorted = false;
                    cmbPersons.Items.Add(new GKComboItem(LangMan.LS(LSID.LSID_NotSelected), null));

                    int num = fTree.RecordsCount;
                    for (int i = 0; i < num; i++)
                    {
                        GEDCOMRecord rec = fTree[i];
                        bool         res = rec is GEDCOMIndividualRecord && IsSelected(rec);

                        if (res)
                        {
                            GEDCOMIndividualRecord ind = rec as GEDCOMIndividualRecord;
                            int pCnt = 0;

                            int num2 = ind.Events.Count;
                            for (int j = 0; j < num2; j++)
                            {
                                GEDCOMCustomEvent ev = ind.Events[j];
                                if (ev.Place.StringValue != "")
                                {
                                    AddPlace(ev.Place, ev);
                                    pCnt++;
                                }
                            }

                            if (pCnt > 0)
                            {
                                cmbPersons.Items.Add(new GKComboItem(GKUtils.GetNameString(ind, true, false) + " [" + pCnt.ToString() + "]", ind));
                            }
                        }

                        progress.ProgressStep();
                    }

                    fBaseRoot.Expanded = true; //ExpandAll();
                    //cmbPersons.Sorted = true;

                    btnSelectPlaces.Enabled = true;
                }
                finally
                {
                    progress.ProgressDone();
                    //tvPlaces.EndUpdate();
                    //cmbPersons.EndUpdate();
                    tvPlaces.DataStore = fBaseRoot;
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("MapsViewerWin.PlacesLoad(): " + ex.Message);
            }
        }
Ejemplo n.º 25
0
        private bool IsSelected(GEDCOMRecord iRec)
        {
            bool res = (fSelectedPersons == null || (fSelectedPersons.IndexOf(iRec) >= 0));

            return(res);
        }
Ejemplo n.º 26
0
 public ValItem(GEDCOMRecord record)
 {
     Record      = record;
     ColumnValue = null;
 }
Ejemplo n.º 27
0
 public override void Fetch(GEDCOMRecord aRec)
 {
     fRec = (aRec as GEDCOMFamilyRecord);
 }
Ejemplo n.º 28
0
 public override void Fetch(GEDCOMRecord aRec)
 {
     fRec = (aRec as GEDCOMLocationRecord);
 }
Ejemplo n.º 29
0
 public abstract void Fetch(GEDCOMRecord aRec);
Ejemplo n.º 30
0
 public override void Fetch(GEDCOMRecord aRec)
 {
     fRec = (aRec as GEDCOMResearchRecord);
 }