Example #1
0
        private bool AcceptChanges()
        {
            GEDCOMFileReferenceWithTitle fileRef = fMediaRec.FileReferences[0];

            if (fIsNew)
            {
                GKComboItem    item = (GKComboItem)cmbStoreType.SelectedValue;
                MediaStoreType gst  = (MediaStoreType)item.Tag;

                if ((gst == MediaStoreType.mstArchive || gst == MediaStoreType.mstStorage) && !fBase.Context.CheckBasePath())
                {
                    return(false);
                }

                bool result = fBase.Context.MediaSave(fileRef, txtFile.Text, gst);

                if (!result)
                {
                    return(false);
                }
            }

            fileRef.MediaType = (GEDCOMMediaType)cmbMediaType.SelectedIndex;
            fileRef.Title     = txtName.Text;

            ControlsRefresh();

            CommitChanges();
            fBase.NotifyRecord(fMediaRec, RecordAction.raEdit);

            return(true);
        }
Example #2
0
        public void Test_UIControls()
        {
            GKComboItem comboItem = new GKComboItem("Test", null);

            Assert.IsNotNull(comboItem);
            Assert.AreEqual("Test", comboItem.ToString());

            GKListItem listItem = new GKListItem("Test", null);

            Assert.IsNotNull(listItem);
            Assert.AreEqual("Test", listItem.ToString());

            GKListSubItem listSubItem = new GKListSubItem("Test");

            Assert.IsNotNull(listSubItem);

            MenuItemEx tsMenuItem = new MenuItemEx("Test", null);

            Assert.IsNotNull(tsMenuItem);

            GKTreeNode treeNode = new GKTreeNode("Test", null);

            Assert.IsNotNull(treeNode);

            ModifyEventArgs args = new ModifyEventArgs(RecordAction.raAdd, null);

            Assert.IsNotNull(args);
        }
Example #3
0
        public CommunicationEditDlg()
        {
            InitializeComponent();

            fTempInd = null;

            for (GKCommunicationType ct = GKCommunicationType.ctCall; ct <= GKCommunicationType.ctLast; ct++)
            {
                cmbCorrType.Items.Add(LangMan.LS(GKData.CommunicationNames[(int)ct]));
            }

            fNotesList = new GKSheetList(pageNotes);
            fMediaList = new GKSheetList(pageMultimedia);

            // SetLang()
            btnAccept.Text       = LangMan.LS(LSID.LSID_DlgAccept);
            btnCancel.Text       = LangMan.LS(LSID.LSID_DlgCancel);
            Title                = LangMan.LS(LSID.LSID_WinCommunicationEdit);
            pageNotes.Text       = LangMan.LS(LSID.LSID_RPNotes);
            pageMultimedia.Text  = LangMan.LS(LSID.LSID_RPMultimedia);
            lblTheme.Text        = LangMan.LS(LSID.LSID_Theme);
            lblCorresponder.Text = LangMan.LS(LSID.LSID_Corresponder);
            lblType.Text         = LangMan.LS(LSID.LSID_Type);
            lblDate.Text         = LangMan.LS(LSID.LSID_Date);
            btnPersonAdd.ToolTip = LangMan.LS(LSID.LSID_PersonAttachTip);

            txtDir.Items.Clear();
            txtDir.Items.AddRange(GKComboItem.Convert(new string[] {
                LangMan.LS(LSID.LSID_CD_1),
                LangMan.LS(LSID.LSID_CD_2)
            }));
        }
Example #4
0
        public T GetSelectedTag <T>()
        {
            object          selectedItem = Control.SelectedValue;
            GKComboItem <T> comboItem    = selectedItem as GKComboItem <T>;
            T itemTag = (comboItem != null) ? comboItem.Tag : default(T);

            return(itemTag);
        }
Example #5
0
        public T GetSelectedTag <T>()
        {
            object      selectedItem = Control.SelectedItem;
            GKComboItem comboItem    = (GKComboItem)selectedItem;
            T           itemTag      = (T)comboItem.Tag;

            return(itemTag);
        }
Example #6
0
        private void AcceptLangs()
        {
            GKComboItem <int> item = cmbLanguages.Items[cmbLanguages.SelectedIndex] as GKComboItem <int>;

            if (item != null)
            {
                AppHost.Instance.LoadLanguage((int)item.Tag);
            }
        }
Example #7
0
        private void cbType_SelectedIndexChanged(object sender, EventArgs e)
        {
            GKComboItem item = (GKComboItem)cbType.SelectedItem;

            if (item != null)
            {
                fMode = (StatsMode)item.Tag;
                UpdateCloud();
            }
        }
Example #8
0
        private void btnSelectPlaces_Click(object sender, EventArgs e)
        {
            GEDCOMIndividualRecord ind = null;

            bool condBirth     = false;
            bool condDeath     = false;
            bool condResidence = false;

            if (radTotal.Checked)
            {
                condBirth     = chkBirth.Checked.GetValueOrDefault();
                condDeath     = chkDeath.Checked.GetValueOrDefault();
                condResidence = chkResidence.Checked.GetValueOrDefault();
            }
            else if (radSelected.Checked && (cmbPersons.SelectedIndex >= 0))
            {
                GKComboItem item = (GKComboItem)cmbPersons.Items[cmbPersons.SelectedIndex];
                ind = (item.Tag as GEDCOMIndividualRecord);
            }

            fMapBrowser.ShowLines = (ind != null && chkLinesVisible.Checked.GetValueOrDefault());
            fMapPoints.Clear();

            int num = fPlaces.Count;

            for (int i = 0; i < num; i++)
            {
                MapPlace place = fPlaces[i];
                if (place.Points.Count < 1)
                {
                    continue;
                }

                int num2 = place.PlaceRefs.Count;
                for (int j = 0; j < num2; j++)
                {
                    GEDCOMCustomEvent evt = place.PlaceRefs[j].Event;

                    if ((ind != null && (evt.Parent == ind)) || (condBirth && evt.Name == "BIRT") || (condDeath && evt.Name == "DEAT") || (condResidence && evt.Name == "RESI"))
                    {
                        PlacesLoader.AddPoint(fMapPoints, place.Points[0], place.PlaceRefs[j]);
                    }
                }
            }

            if (ind != null)
            {
                // sort points by date
                fMapPoints.QuickSort(MapPointsCompare);
            }

            PlacesLoader.CopyPoints(fMapBrowser, fMapPoints, ind != null);
        }
Example #9
0
        private static void SetComboCalendar(ComboBox comboBox, GEDCOMCalendar calendar)
        {
            foreach (object item in comboBox.Items)
            {
                GKComboItem comboItem = (GKComboItem)item;

                if ((GEDCOMCalendar)comboItem.Tag == calendar)
                {
                    comboBox.SelectedItem = item;
                    return;
                }
            }

            comboBox.SelectedIndex = 0;
        }
Example #10
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  = "";
                }
            }
        }
Example #11
0
        public void SetSelectedTag <T>(T tagValue)
        {
            var ctl = Control;

            foreach (object item in ctl.Items)
            {
                GKComboItem comboItem = (GKComboItem)item;
                T           itemTag   = (T)comboItem.Tag;

                if (tagValue.Equals(itemTag))
                {
                    ctl.SelectedItem = item;
                    return;
                }
            }
            ctl.SelectedIndex = 0;
        }
Example #12
0
        public void SetSelectedTag <T>(T tagValue, bool allowDefault = true)
        {
            foreach (object item in Control.Items)
            {
                GKComboItem <T> comboItem = item as GKComboItem <T>;

                if (comboItem != null && object.Equals(comboItem.Tag, tagValue))
                {
                    Control.SelectedValue = item;
                    return;
                }
            }

            if (allowDefault)
            {
                Control.SelectedIndex = 0;
            }
        }
Example #13
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            try
            {
                GKComboItem item = lstLanguages.Items[lstLanguages.SelectedIndex] as GKComboItem;
                if (item != null)
                {
                    SelectedLanguage = (int)item.Tag;
                }

                DialogResult = DialogResult.Ok;
            }
            catch (Exception ex)
            {
                Logger.LogWrite("LanguageSelectDlg.btnAccept_Click(): " + ex.Message);
                DialogResult = DialogResult.None;
            }
        }
Example #14
0
        private void AcceptChanges()
        {
            fTempColumns.CopyTo(fOptions.IndividualListColumns);

            if (radSNP.Checked)
            {
                fOptions.DefNameFormat = NameFormat.nfFNP;
            }
            else if (radS_NP.Checked)
            {
                fOptions.DefNameFormat = NameFormat.nfF_NP;
            }
            else if (radS_N_P.Checked)
            {
                fOptions.DefNameFormat = NameFormat.nfF_N_P;
            }

            if (radDMY.Checked)
            {
                fOptions.DefDateFormat = DateFormat.dfDD_MM_YYYY;
            }
            else if (radYMD.Checked)
            {
                fOptions.DefDateFormat = DateFormat.dfYYYY_MM_DD;
            }

            fOptions.PlacesWithAddress = chkPlacesWithAddress.Checked;
            fOptions.ListHighlightUnparentedPersons = chkHighlightUnparented.Checked;
            fOptions.ListHighlightUnmarriedPersons  = chkHighlightUnmarried.Checked;
            fOptions.ShowDatesCalendar         = chkShowDatesCalendar.Checked;
            fOptions.ShowDatesSign             = chkShowDatesSigns.Checked;
            fOptions.Autosave                  = chkAutosave.Checked;
            fOptions.AutosaveInterval          = (int)numASMin.Value;
            fOptions.RemovableMediaWarning     = chkRemovableMediaWarning.Checked;
            fOptions.LoadRecentFiles           = chkLoadRecentFiles.Checked;
            fOptions.EmbeddedMediaPlayer       = chkEmbeddedMediaPlayer.Checked;
            fOptions.AllowMediaStoreReferences = chkAllowMediaDirectRefs.Checked;

            fOptions.ChartOptions.FamilyVisible     = chkSurname.Checked;
            fOptions.ChartOptions.NameVisible       = chkName.Checked;
            fOptions.ChartOptions.PatronymicVisible = chkPatronymic.Checked;
            fOptions.ChartOptions.DiffLines         = chkDiffLines.Checked;
            fOptions.ChartOptions.BirthDateVisible  = chkBirthDate.Checked;
            fOptions.ChartOptions.DeathDateVisible  = chkDeathDate.Checked;
            fOptions.ChartOptions.OnlyYears         = chkOnlyYears.Checked;
            fOptions.ChartOptions.Kinship           = chkKinship.Checked;
            fOptions.ChartOptions.SignsVisible      = chkSignsVisible.Checked;
            fOptions.ChartOptions.ChildlessExclude  = chkChildlessExclude.Checked;
            fOptions.ChartOptions.Decorative        = chkTreeDecorative.Checked;
            fOptions.ChartOptions.PortraitsVisible  = chkPortraitsVisible.Checked;
            fOptions.ChartOptions.DefaultPortraits  = chkDefaultPortraits.Checked;

            fOptions.ChartOptions.MaleColor      = UIHelper.ConvertColor(lblMaleColor.BackColor);
            fOptions.ChartOptions.FemaleColor    = UIHelper.ConvertColor(lblFemaleColor.BackColor);
            fOptions.ChartOptions.UnkSexColor    = UIHelper.ConvertColor(lblUnkSexColor.BackColor);
            fOptions.ChartOptions.UnHusbandColor = UIHelper.ConvertColor(lblUnHusbandColor.BackColor);
            fOptions.ChartOptions.UnWifeColor    = UIHelper.ConvertColor(lblUnWifeColor.BackColor);

            fOptions.Proxy.UseProxy = chkUseProxy.Checked;
            fOptions.Proxy.Server   = txtProxyServer.Text;
            fOptions.Proxy.Port     = txtProxyPort.Text;
            fOptions.Proxy.Login    = txtProxyLogin.Text;
            fOptions.Proxy.Password = txtProxyPass.Text;

            fOptions.PedigreeOptions.IncludeAttributes  = chkAttributes.Checked;
            fOptions.PedigreeOptions.IncludeNotes       = chkNotes.Checked;
            fOptions.PedigreeOptions.IncludeSources     = chkSources.Checked;
            fOptions.PedigreeOptions.IncludeGenerations = chkGenerations.Checked;

            if (radExcess.Checked)
            {
                fOptions.PedigreeOptions.Format = PedigreeFormat.Excess;
            }
            else if (radCompact.Checked)
            {
                fOptions.PedigreeOptions.Format = PedigreeFormat.Compact;
            }

            fOptions.ShowTips = chkShowOnStart.Checked;

            if (radFBNone.Checked)
            {
                fOptions.FileBackup = FileBackup.fbNone;
            }
            else if (radFBOnlyPrev.Checked)
            {
                fOptions.FileBackup = FileBackup.fbOnlyPrev;
            }
            else if (radFBEachRevision.Checked)
            {
                fOptions.FileBackup = FileBackup.fbEachRevision;
            }

            GKComboItem item = cmbLanguages.Items[cmbLanguages.SelectedIndex] as GKComboItem;

            if (item != null)
            {
                AppHost.Instance.LoadLanguage((int)item.Tag);
            }

            ancOptionsControl1.AcceptChanges();

            if (!chkExtendWomanSurnames.Checked)
            {
                fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfNotExtend;
            }
            else
            {
                if (radMaiden_Married.Checked)
                {
                    fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMaiden_Married;
                }
                else if (radMarried_Maiden.Checked)
                {
                    fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMarried_Maiden;
                }
                else if (radMaiden.Checked)
                {
                    fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMaiden;
                }
                else if (radMarried.Checked)
                {
                    fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMarried;
                }
            }

            fOptions.Geocoder = cmbGeocoder.Text;

            DialogResult = DialogResult.OK;
        }
Example #15
0
        public override void AcceptChanges()
        {
            base.AcceptChanges();

            IndividualListFilter iFilter = (IndividualListFilter)fListMan.Filter;

            string fs = txtName.Text.Trim();
            SaveFilter(fs, GlobalOptions.Instance.NameFilters);

            fs = cmbResidence.Text.Trim();
            SaveFilter(fs, GlobalOptions.Instance.ResidenceFilters);

            fs = cmbEventVal.Text.Trim();
            SaveFilter(fs, GlobalOptions.Instance.EventFilters);

            iFilter.PatriarchOnly = chkOnlyPatriarchs.Checked;

            int lifeSel = 0;
            if (rbAll.Checked) lifeSel = 0;
            if (rbOnlyLive.Checked) lifeSel = 1;
            if (rbOnlyDead.Checked) lifeSel = 2;
            if (rbAliveBefore.Checked) lifeSel = 3;

            if (iFilter.FilterLifeMode != FilterLifeMode.lmTimeLocked)
            {
                iFilter.AliveBeforeDate = txtAliveBeforeDate.Text;
                if (lifeSel == 3)
                {
                    try
                    {
                        /*DateTime dt = */
                        DateTime.Parse(txtAliveBeforeDate.Text);
                    }
                    catch
                    {
                        AppHost.StdDialogs.ShowError(LangMan.LS(LSID.LSID_DateInvalid));
                        DialogResult = DialogResult.None;
                    }
                }
                iFilter.FilterLifeMode = (FilterLifeMode)lifeSel;
            }

            int sexSel = 0;
            if (rbSexAll.Checked) sexSel = 0;
            if (rbSexMale.Checked) sexSel = 1;
            if (rbSexFemale.Checked) sexSel = 2;
            iFilter.Sex = (GEDCOMSex)sexSel;

            if (txtName.Text == "") txtName.Text = @"*";
            iFilter.Name = txtName.Text;

            if (cmbResidence.Text == "") cmbResidence.Text = @"*";
            iFilter.Residence = cmbResidence.Text;

            if (cmbEventVal.Text == "") cmbEventVal.Text = @"*";
            iFilter.EventVal = cmbEventVal.Text;

            int selectedIndex = cmbGroup.SelectedIndex;
            if (selectedIndex >= 0 && selectedIndex < 3) {
                iFilter.FilterGroupMode = (FilterGroupMode)cmbGroup.SelectedIndex;
                iFilter.GroupRef = "";
            } else {
                GKComboItem item = (GKComboItem)cmbGroup.Items[cmbGroup.SelectedIndex];
                GEDCOMRecord rec = item.Tag as GEDCOMRecord;
                if (rec != null) {
                    iFilter.FilterGroupMode = FilterGroupMode.Selected;
                    iFilter.GroupRef = rec.XRef;
                } else {
                    iFilter.FilterGroupMode = FilterGroupMode.All;
                    iFilter.GroupRef = "";
                }
            }

            selectedIndex = cmbSource.SelectedIndex;
            if (selectedIndex >= 0 && selectedIndex < 3) {
                iFilter.SourceMode = (FilterGroupMode)cmbSource.SelectedIndex;
                iFilter.SourceRef = "";
            } else {
                GKComboItem item = (GKComboItem)cmbSource.Items[cmbSource.SelectedIndex];
                GEDCOMRecord rec = item.Tag as GEDCOMRecord;
                if (rec != null) {
                    iFilter.SourceMode = FilterGroupMode.Selected;
                    iFilter.SourceRef = rec.XRef;
                } else {
                    iFilter.SourceMode = FilterGroupMode.All;
                    iFilter.SourceRef = "";
                }
            }
        }
Example #16
0
 public void AddRange(object[] items, bool sorted = false)
 {
     //Control.Sorted = false;
     Control.Items.AddRange(GKComboItem.Convert((string[])items));
     //Control.Sorted = sorted;
 }
Example #17
0
        // FIXME: GKv3 DevRestriction

        /*private void EditEventDate1_DragOver(object sender, DragEventArgs e)
         * {
         *  e.Effect = e.Data.GetDataPresent(typeof(string)) ? DragDropEffects.Move : DragDropEffects.None;
         * }
         *
         * private void EditEventDate1_DragDrop(object sender, DragEventArgs e)
         * {
         *  try
         *  {
         *      if (e.Data.GetDataPresent(typeof(string)))
         *      {
         *          string txt = e.Data.GetData(typeof(string)) as string;
         *          string[] dt = ((MaskedTextBox)sender).Text.Split('.');
         *          ((MaskedTextBox)sender).Text = dt[0] + '.' + dt[1] + '.' + txt;
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      Logger.LogWrite("EventEditDlg.DragDrop(): " + ex.Message);
         *  }
         * }*/

        private void EditEventType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (fEvent is GEDCOMFamilyEvent)
            {
                txtAttribute.Enabled         = false;
                txtAttribute.BackgroundColor = SystemColors.Control;
            }
            else
            {
                int idx = cmbEventType.SelectedIndex;
                if (idx >= 0)
                {
                    if (GKData.PersonEvents[idx].Kind == PersonEventKind.ekEvent)
                    {
                        txtAttribute.Enabled         = false;
                        txtAttribute.BackgroundColor = SystemColors.Control;
                        txtAttribute.Text            = "";
                    }
                    else
                    {
                        txtAttribute.Enabled         = true;
                        txtAttribute.BackgroundColor = SystemColors.WindowBackground;
                    }
                }
            }

            string evName;
            int    id = cmbEventType.SelectedIndex;

            if (fEvent is GEDCOMFamilyEvent)
            {
                evName = GKData.FamilyEvents[id].Sign;
            }
            else
            {
                evName = GKData.PersonEvents[id].Sign;
            }

            // TODO: It is necessary to provide the registrable list of values for different tag types.
            string[] vals;
            bool     canbeSorted, userInput;

            if (evName == "_BGRO")
            {
                vals        = GKData.BloodGroups.Split('|');
                canbeSorted = false;
                userInput   = false;
            }
            else
            {
                vals        = fBase.Context.ValuesCollection.GetValues(evName);
                canbeSorted = true;
                userInput   = true;
            }

            if (vals != null)
            {
                string tmp = txtAttribute.Text;
                //txtAttribute.Sorted = false;
                if (canbeSorted)
                {
                    // sort
                }

                txtAttribute.Items.Clear();
                txtAttribute.Items.AddRange(GKComboItem.Convert(vals));

                //txtAttribute.Sorted = canbeSorted;
                txtAttribute.Text = tmp;

                txtAttribute.ReadOnly = (!userInput);
            }
        }
Example #18
0
        private void AcceptChanges()
        {
            fTempColumns.CopyTo(fOptions.IndividualListColumns);

            if (radSNP.Checked)
            {
                fOptions.DefNameFormat = NameFormat.nfFNP;
            }
            else if (radS_NP.Checked)
            {
                fOptions.DefNameFormat = NameFormat.nfF_NP;
            }
            else if (radS_N_P.Checked)
            {
                fOptions.DefNameFormat = NameFormat.nfF_N_P;
            }

            if (radDMY.Checked)
            {
                fOptions.DefDateFormat = DateFormat.dfDD_MM_YYYY;
            }
            else if (radYMD.Checked)
            {
                fOptions.DefDateFormat = DateFormat.dfYYYY_MM_DD;
            }

            fOptions.PlacesWithAddress = chkPlacesWithAddress.Checked.GetValueOrDefault();
            fOptions.ListHighlightUnparentedPersons = chkHighlightUnparented.Checked.GetValueOrDefault();
            fOptions.ListHighlightUnmarriedPersons  = chkHighlightUnmarried.Checked.GetValueOrDefault();
            fOptions.ShowDatesCalendar         = chkShowDatesCalendar.Checked.GetValueOrDefault();
            fOptions.ShowDatesSign             = chkShowDatesSigns.Checked.GetValueOrDefault();
            fOptions.Autosave                  = chkAutosave.Checked.GetValueOrDefault();
            fOptions.AutosaveInterval          = (int)numASMin.Value;
            fOptions.RemovableMediaWarning     = chkRemovableMediaWarning.Checked.GetValueOrDefault();
            fOptions.LoadRecentFiles           = chkLoadRecentFiles.Checked.GetValueOrDefault();
            fOptions.EmbeddedMediaPlayer       = chkEmbeddedMediaPlayer.Checked.GetValueOrDefault();
            fOptions.AllowMediaStoreReferences = chkAllowMediaDirectRefs.Checked.GetValueOrDefault();
            fOptions.AutoCheckUpdates          = chkAutoCheckUpdates.Checked.GetValueOrDefault();

            fOptions.AllowMediaStoreRelativeReferences = chkAllowMediaStoreRelativeReferences.Checked.GetValueOrDefault();
            fOptions.MediaStoreDefault = (int)UIHelper.GetSelectedTag <MediaStoreType>(cmbMediaStoreDefault);
            fOptions.AllowDeleteMediaFileFromStgArc = chkAllowDeleteMediaFileFromStgArc.Checked.GetValueOrDefault();
            fOptions.AllowDeleteMediaFileFromRefs   = chkAllowDeleteMediaFileFromRefs.Checked.GetValueOrDefault();
            fOptions.DeleteMediaFileWithoutConfirm  = chkDeleteMediaFileWithoutConfirm.Checked.GetValueOrDefault();

            fOptions.TreeChartOptions.FamilyVisible      = chkSurname.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.NameVisible        = chkName.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.PatronymicVisible  = chkPatronymic.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.DiffLines          = chkDiffLines.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.BirthDateVisible   = chkBirthDate.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.DeathDateVisible   = chkDeathDate.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.OnlyYears          = chkOnlyYears.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.Kinship            = chkKinship.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.SignsVisible       = chkSignsVisible.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.ChildlessExclude   = chkChildlessExclude.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.Decorative         = chkTreeDecorative.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.PortraitsVisible   = chkPortraitsVisible.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.DefaultPortraits   = chkDefaultPortraits.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.InvertedTree       = chkInvertedTree.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.MarriagesDates     = chkMarriagesDates.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.ShowPlaces         = chkShowPlaces.Checked.GetValueOrDefault();
            fOptions.TreeChartOptions.HideUnknownSpouses = chkHideUnknownSpouses.Checked.GetValueOrDefault();

            fOptions.TreeChartOptions.Margins        = (int)numMargins.Value;
            fOptions.TreeChartOptions.BranchDistance = (int)numBranchDist.Value;
            fOptions.TreeChartOptions.LevelDistance  = (int)numGenDist.Value;
            fOptions.TreeChartOptions.SpouseDistance = (int)numSpouseDist.Value;

            fOptions.TreeChartOptions.MaleColor      = UIHelper.ConvertColor(lblMaleColor.BackgroundColor);
            fOptions.TreeChartOptions.FemaleColor    = UIHelper.ConvertColor(lblFemaleColor.BackgroundColor);
            fOptions.TreeChartOptions.UnkSexColor    = UIHelper.ConvertColor(lblUnkSexColor.BackgroundColor);
            fOptions.TreeChartOptions.UnHusbandColor = UIHelper.ConvertColor(lblUnHusbandColor.BackgroundColor);
            fOptions.TreeChartOptions.UnWifeColor    = UIHelper.ConvertColor(lblUnWifeColor.BackgroundColor);

            fOptions.Proxy.UseProxy = chkUseProxy.Checked.GetValueOrDefault();
            fOptions.Proxy.Server   = txtProxyServer.Text;
            fOptions.Proxy.Port     = txtProxyPort.Text;
            fOptions.Proxy.Login    = txtProxyLogin.Text;
            fOptions.Proxy.Password = txtProxyPass.Text;

            fOptions.PedigreeOptions.IncludeAttributes  = chkAttributes.Checked.GetValueOrDefault();
            fOptions.PedigreeOptions.IncludeNotes       = chkNotes.Checked.GetValueOrDefault();
            fOptions.PedigreeOptions.IncludeSources     = chkSources.Checked.GetValueOrDefault();
            fOptions.PedigreeOptions.IncludeGenerations = chkGenerations.Checked.GetValueOrDefault();

            if (radExcess.Checked)
            {
                fOptions.PedigreeOptions.Format = PedigreeFormat.Excess;
            }
            else if (radCompact.Checked)
            {
                fOptions.PedigreeOptions.Format = PedigreeFormat.Compact;
            }

            fOptions.ShowTips = chkShowOnStart.Checked.GetValueOrDefault();

            if (radFBNone.Checked)
            {
                fOptions.FileBackup = FileBackup.fbNone;
            }
            else if (radFBOnlyPrev.Checked)
            {
                fOptions.FileBackup = FileBackup.fbOnlyPrev;
            }
            else if (radFBEachRevision.Checked)
            {
                fOptions.FileBackup = FileBackup.fbEachRevision;
            }

            GKComboItem <int> item = cmbLanguages.Items[cmbLanguages.SelectedIndex] as GKComboItem <int>;

            if (item != null)
            {
                AppHost.Instance.LoadLanguage((int)item.Tag);
            }

            ancOptionsControl1.AcceptChanges();

            if (!chkExtendWomanSurnames.Checked.GetValueOrDefault())
            {
                fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfNotExtend;
            }
            else
            {
                if (radMaiden_Married.Checked)
                {
                    fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMaiden_Married;
                }
                else if (radMarried_Maiden.Checked)
                {
                    fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMarried_Maiden;
                }
                else if (radMaiden.Checked)
                {
                    fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMaiden;
                }
                else if (radMarried.Checked)
                {
                    fOptions.WomanSurnameFormat = WomanSurnameFormat.wsfMarried;
                }
            }

            fOptions.Geocoder = cmbGeocoder.Text;

            fOptions.AutoSortChildren = chkAutoSortChildren.Checked.GetValueOrDefault();
            fOptions.AutoSortSpouses  = chkAutoSortSpouses.Checked.GetValueOrDefault();
            fOptions.CheckTreeSize    = chkCheckTreeSize.Checked.GetValueOrDefault();
            fOptions.CharsetDetection = chkCharsetDetection.Checked.GetValueOrDefault();

            fOptions.FileBackupEachRevisionMaxCount = (int)numBackupRevisionsMaxCount.Value;
            fOptions.FirstCapitalLetterInNames      = chkFirstCapitalLetterInNames.Checked.GetValueOrDefault();
            fOptions.DialogClosingWarn = chkDialogClosingWarn.Checked.GetValueOrDefault();

            fOptions.TreeChartOptions.DepthLimit = (int)numDefaultDepth.Value;

            DialogResult = DialogResult.Ok;
        }
Example #19
0
        private void UpdateSpecific()
        {
            IndividualListFilter iFilter = (IndividualListFilter)fListMan.Filter;
            GlobalOptions        options = GlobalOptions.Instance;

            txtName.Items.Clear();
            txtName.Items.AddRange(GKComboItem.Convert(options.NameFilters.ToArray()));
            txtName.Items.Insert(0, new GKComboItem("*"));

            cmbResidence.Items.Clear();
            cmbResidence.Items.AddRange(GKComboItem.Convert(options.ResidenceFilters.ToArray()));
            cmbResidence.Items.Insert(0, new GKComboItem("*"));

            cmbEventVal.Items.Clear();
            cmbEventVal.Items.AddRange(GKComboItem.Convert(options.EventFilters.ToArray()));
            cmbEventVal.Items.Insert(0, new GKComboItem("*"));

            int lifeSel;

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

            switch (lifeSel)
            {
            case 0:
                rbAll.Checked = true;
                break;

            case 1:
                rbOnlyLive.Checked = true;
                break;

            case 2:
                rbOnlyDead.Checked = true;
                break;

            case 3:
                rbAliveBefore.Checked = true;
                break;
            }

            int sexSel = (int)iFilter.Sex;

            switch (sexSel)
            {
            case 0:
                rbSexAll.Checked = true;
                break;

            case 1:
                rbSexMale.Checked = true;
                break;

            case 2:
                rbSexFemale.Checked = true;
                break;
            }

            txtName.Text              = iFilter.Name;
            cmbResidence.Text         = iFilter.Residence;
            cmbEventVal.Text          = iFilter.EventVal;
            chkOnlyPatriarchs.Checked = iFilter.PatriarchOnly;

            GEDCOMTree tree = Base.Context.Tree;

            cmbGroup.Items.Clear();
            //cmbGroup.Sorted = true;
            int num = tree.RecordsCount;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = tree[i];
                if (rec is GEDCOMGroupRecord)
                {
                    cmbGroup.Items.Add(new GKComboItem((rec as GEDCOMGroupRecord).GroupName, rec));
                }
            }
            //cmbGroup.Sorted = false;
            cmbGroup.Items.Insert(0, new GKComboItem(LangMan.LS(LSID.LSID_SrcAll), null));
            cmbGroup.Items.Insert(1, new GKComboItem(LangMan.LS(LSID.LSID_SrcNot), null));
            cmbGroup.Items.Insert(2, new GKComboItem(LangMan.LS(LSID.LSID_SrcAny), null));
            if (iFilter.FilterGroupMode != FilterGroupMode.Selected)
            {
                cmbGroup.SelectedIndex = (int)iFilter.FilterGroupMode;
            }
            else
            {
                GEDCOMGroupRecord groupRec = tree.XRefIndex_Find(iFilter.GroupRef) as GEDCOMGroupRecord;
                if (groupRec != null)
                {
                    cmbGroup.Text = groupRec.GroupName;
                }
            }

            cmbSource.Items.Clear();
            //cmbSource.Sorted = true;
            for (int i = 0; i < tree.RecordsCount; 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), null));
            cmbSource.Items.Insert(1, new GKComboItem(LangMan.LS(LSID.LSID_SrcNot), null));
            cmbSource.Items.Insert(2, new GKComboItem(LangMan.LS(LSID.LSID_SrcAny), null));
            if (iFilter.SourceMode != FilterGroupMode.Selected)
            {
                cmbSource.SelectedIndex = (int)iFilter.SourceMode;
            }
            else
            {
                GEDCOMSourceRecord sourceRec = tree.XRefIndex_Find(iFilter.SourceRef) as GEDCOMSourceRecord;
                if (sourceRec != null)
                {
                    cmbSource.Text = sourceRec.FiledByEntry;
                }
            }
        }