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) })); }
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; } } }
public void AddRange(object[] items, bool sorted = false) { //Control.Sorted = false; Control.Items.AddRange(GKComboItem.Convert((string[])items)); //Control.Sorted = sorted; }
// 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); } }