public PhonologicalFeatureChooserDlg() { // // Required for Windows Form Designer support // InitializeComponent(); AccessibleName = GetType().Name; m_valuesCombo = new FwComboBox(); m_valuesCombo.DropDownStyle = ComboBoxStyle.DropDownList; m_valuesCombo.AdjustStringHeight = false; m_valuesCombo.BackColor = SystemColors.Window; m_valuesCombo.Padding = new Padding(0, 1, 0, 0); m_valuesCombo.SelectedIndexChanged += m_valuesCombo_SelectedIndexChanged; Resize += PhonologicalFeatureChooserDlg_Resize; }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> public ReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider) : base(new UserControl(), cache, obj, flid) { m_persistProvider = persistenceProvider; m_combo = new FwComboBox(); m_combo.WritingSystemFactory = cache.WritingSystemFactory; m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.Font = new System.Drawing.Font( cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.DefaultFontName, 10); if (!Application.RenderWithVisualStyles) m_combo.HasBorder = false; m_combo.Dock = DockStyle.Left; m_combo.Width = 200; Control.Height = m_combo.Height; // Combo has sensible default height, UserControl does not. Control.Controls.Add(m_combo); m_combo.SelectedIndexChanged += SelectionChanged; }
public FeatureConstraintChooserDlg() { // // Required for Windows Form Designer support // InitializeComponent(); m_valuesCombo = new FwComboBox(); m_valuesCombo.DropDownStyle = ComboBoxStyle.DropDownList; m_valuesCombo.AdjustStringHeight = false; m_valuesCombo.Padding = new Padding(0, 1, 0, 0); m_valuesCombo.BackColor = SystemColors.Window; m_valuesCombo.SelectedIndexChanged += new EventHandler(m_valuesCombo_SelectedIndexChanged); if (FwApp.App != null) // Will be null when running tests { m_helpProvider = new System.Windows.Forms.HelpProvider(); m_helpProvider.HelpNamespace = FwApp.App.HelpFile; m_helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0)); m_helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (m_mainPOSPopupTreeManager != null) { m_mainPOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_mainPOSPopupTreeManager_AfterSelect); m_mainPOSPopupTreeManager.Dispose(); } m_mainPOSPopupTreeManager = null; if (m_secPOSPopupTreeManager != null) { m_secPOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_secPOSPopupTreeManager_AfterSelect); m_secPOSPopupTreeManager.Dispose(); } if (components != null) { components.Dispose(); } } m_parentForm = null; m_mediator = null; m_secPOSPopupTreeManager = null; m_lAfxType = null; m_fwcbAffixTypes = null; m_lSLots = null; m_fwcbSlots = null; m_tcSecondaryPOS = null; m_ctrlAssistant = null; base.Dispose(disposing); }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> public ReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider, Mediator mediator) : base(new UserControl(), cache, obj, flid) { m_mediator = mediator; m_persistProvider = persistenceProvider; m_combo = new FwComboBox(); m_combo.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.Font = new System.Drawing.Font( cache.LangProject.DefaultVernacularWritingSystemFont, 10); if (!Application.RenderWithVisualStyles) m_combo.HasBorder = false; m_combo.Dock = DockStyle.Left; m_combo.Width = 200; Control.Height = m_combo.Height; // Combo has sensible default height, UserControl does not. Control.Controls.Add(m_combo); m_combo.SelectedIndexChanged += new EventHandler(SelectionChanged); // Load the special strings from the string table if possible. If not, use the // default (English) values. if (mediator != null && mediator.HasStringTable) { StringTbl = mediator.StringTbl; if (StringTbl != null) { m_sNullItemLabel = StringTbl.GetString("NullItemLabel", "DetailControls/ReferenceComboBox"); } } if (m_sNullItemLabel == null || m_sNullItemLabel == "" || m_sNullItemLabel == "*NullItemLabel*") { m_sNullItemLabel = DetailControlsStrings.ksNullLabel; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:FindComboItem"/> class. /// </summary> /// <param name="tssName">Name of the TSS.</param> /// <param name="fsi">The fsi.</param> /// <param name="ws">The ws.</param> /// <param name="combo">The combo.</param> /// <param name="bv">The bv.</param> /// ------------------------------------------------------------------------------------ public FindComboItem(ITsString tssName, FilterSortItem fsi, int ws, FwComboBox combo, BrowseViewer bv) : base(tssName, null, fsi) { m_ws = ws; m_combo = combo; m_bv = bv; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:RestrictComboItem"/> class. /// </summary> /// <param name="tssName">Name of the TSS.</param> /// <param name="fsi">The fsi.</param> /// <param name="ws">The ws.</param> /// <param name="combo">The combo.</param> /// ------------------------------------------------------------------------------------ public RestrictComboItem(ITsString tssName, FilterSortItem fsi, int ws, FwComboBox combo) : base(tssName, null, fsi) { m_combo = combo; m_ws = ws; }
protected virtual void FillComboBox() { m_combo = new FwComboBox(); m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.WritingSystemFactory = m_cache.WritingSystemFactory; m_combo.WritingSystemCode = m_ws; m_combo.StyleSheet = m_stylesheet; List<HvoLabelItem> al = GetLabeledList(); // if the possibilities list IsSorted (misnomer: needs to be sorted), do that now. if (al.Count > 1) // could be zero if list non-existant, if 1 don't need to sort either! { if (m_cache.ServiceLocator.GetInstance<ICmPossibilityListRepository>().GetObject(m_hvoList).IsSorted) al.Sort(); } // now add list to combo box in that order. for (int i = 0; i < al.Count; ++i) { HvoLabelItem hli = al[i]; m_combo.Items.Add(new HvoTssComboItem(hli.Hvo, hli.TssLabel)); } // Don't allow <Not Sure> for MorphType selection. See FWR-1632. if (m_hvoList != m_cache.LangProject.LexDbOA.MorphTypesOA.Hvo) m_combo.Items.Add(new HvoTssComboItem(0, m_cache.TsStrFactory.MakeString(XMLViewsStrings.ksNotSure, m_cache.WritingSystemFactory.UserWs))); m_combo.SelectedIndexChanged += new EventHandler(m_combo_SelectedIndexChanged); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (IsDisposed) return; if (disposing) { if (m_mainPOSPopupTreeManager != null) { m_mainPOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_mainPOSPopupTreeManager_AfterSelect); m_mainPOSPopupTreeManager.Dispose(); } m_mainPOSPopupTreeManager = null; if (m_secPOSPopupTreeManager != null) { m_secPOSPopupTreeManager.AfterSelect -= new TreeViewEventHandler(m_secPOSPopupTreeManager_AfterSelect); m_secPOSPopupTreeManager.Dispose(); } if(components != null) { components.Dispose(); } } m_parentForm = null; m_mediator = null; m_secPOSPopupTreeManager = null; m_lAfxType = null; m_fwcbAffixTypes = null; m_lSLots = null; m_fwcbSlots = null; m_tcSecondaryPOS = null; m_ctrlAssistant = null; base.Dispose( disposing ); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MSAGroupBox)); this.m_groupBox = new System.Windows.Forms.GroupBox(); this.m_lAfxType = new System.Windows.Forms.Label(); this.m_fwcbAffixTypes = new SIL.FieldWorks.Common.Widgets.FwComboBox(); this.m_lMainCat = new System.Windows.Forms.Label(); this.m_tcMainPOS = new SIL.FieldWorks.Common.Widgets.TreeCombo(); this.m_lSLots = new System.Windows.Forms.Label(); this.m_fwcbSlots = new SIL.FieldWorks.Common.Widgets.FwComboBox(); this.m_tcSecondaryPOS = new SIL.FieldWorks.Common.Widgets.TreeCombo(); this.m_groupBox.SuspendLayout(); this.SuspendLayout(); // // m_groupBox // this.m_groupBox.Controls.Add(this.m_lAfxType); this.m_groupBox.Controls.Add(this.m_fwcbAffixTypes); this.m_groupBox.Controls.Add(this.m_lMainCat); this.m_groupBox.Controls.Add(this.m_tcMainPOS); this.m_groupBox.Controls.Add(this.m_lSLots); this.m_groupBox.Controls.Add(this.m_fwcbSlots); this.m_groupBox.Controls.Add(this.m_tcSecondaryPOS); resources.ApplyResources(this.m_groupBox, "m_groupBox"); this.m_groupBox.Name = "m_groupBox"; this.m_groupBox.TabStop = false; // // m_lAfxType // resources.ApplyResources(this.m_lAfxType, "m_lAfxType"); this.m_lAfxType.Name = "m_lAfxType"; // // m_fwcbAffixTypes // this.m_fwcbAffixTypes.AdjustStringHeight = true; this.m_fwcbAffixTypes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_fwcbAffixTypes.DropDownWidth = 140; this.m_fwcbAffixTypes.DroppedDown = false; resources.ApplyResources(this.m_fwcbAffixTypes, "m_fwcbAffixTypes"); this.m_fwcbAffixTypes.Name = "m_fwcbAffixTypes"; this.m_fwcbAffixTypes.PreviousTextBoxText = null; this.m_fwcbAffixTypes.SelectedIndex = -1; this.m_fwcbAffixTypes.SelectedItem = null; this.m_fwcbAffixTypes.StyleSheet = null; // // m_lMainCat // resources.ApplyResources(this.m_lMainCat, "m_lMainCat"); this.m_lMainCat.Name = "m_lMainCat"; // // m_tcMainPOS // this.m_tcMainPOS.AdjustStringHeight = true; this.m_tcMainPOS.DropDownWidth = 140; this.m_tcMainPOS.DroppedDown = false; resources.ApplyResources(this.m_tcMainPOS, "m_tcMainPOS"); this.m_tcMainPOS.Name = "m_tcMainPOS"; this.m_tcMainPOS.SelectedNode = null; this.m_tcMainPOS.StyleSheet = null; // // m_lSLots // resources.ApplyResources(this.m_lSLots, "m_lSLots"); this.m_lSLots.Name = "m_lSLots"; // // m_fwcbSlots // this.m_fwcbSlots.AdjustStringHeight = true; this.m_fwcbSlots.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_fwcbSlots.DropDownWidth = 140; this.m_fwcbSlots.DroppedDown = false; resources.ApplyResources(this.m_fwcbSlots, "m_fwcbSlots"); this.m_fwcbSlots.Name = "m_fwcbSlots"; this.m_fwcbSlots.PreviousTextBoxText = null; this.m_fwcbSlots.SelectedIndex = -1; this.m_fwcbSlots.SelectedItem = null; this.m_fwcbSlots.StyleSheet = null; // // m_tcSecondaryPOS // this.m_tcSecondaryPOS.AdjustStringHeight = true; this.m_tcSecondaryPOS.DropDownWidth = 140; this.m_tcSecondaryPOS.DroppedDown = false; resources.ApplyResources(this.m_tcSecondaryPOS, "m_tcSecondaryPOS"); this.m_tcSecondaryPOS.Name = "m_tcSecondaryPOS"; this.m_tcSecondaryPOS.SelectedNode = null; this.m_tcSecondaryPOS.StyleSheet = null; // // MSAGroupBox // this.Controls.Add(this.m_groupBox); this.Name = "MSAGroupBox"; resources.ApplyResources(this, "$this"); this.m_groupBox.ResumeLayout(false); this.ResumeLayout(false); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if( disposing ) { if(components != null) { components.Dispose(); } } m_cache = null; m_fs = null; m_mediator = null; m_cache = null; m_bvList = null; m_valuesCombo = null; base.Dispose( disposing ); }
protected virtual void FillComboBox() { m_combo = new FwComboBox(); m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_combo.WritingSystemCode = m_ws; m_combo.StyleSheet = m_stylesheet; List<HvoLabelItem> al = GetLabeledList(); // if the possibilities list IsSorted (misnomer: needs to be sorted), do that now. bool listNeedsToBeSorted = m_cache.GetBoolProperty(m_hvoList, (int)CmPossibilityList.CmPossibilityListTags.kflidIsSorted); if (listNeedsToBeSorted) al.Sort(); // now add list to combo box in that order. for (int i = 0; i < al.Count; ++i) { HvoLabelItem hli = al[i]; m_combo.Items.Add(new HvoTssComboItem(hli.Hvo, hli.TssLabel)); } m_combo.Items.Add(new HvoTssComboItem(0, m_cache.MakeUserTss(XMLViewsStrings.ksNotSure))); m_combo.SelectedIndexChanged += new EventHandler(m_combo_SelectedIndexChanged); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LinkEntryOrSenseDlg)); this.m_rbEntry = new System.Windows.Forms.RadioButton(); this.m_rbSense = new System.Windows.Forms.RadioButton(); this.m_fwcbSenses = new SIL.FieldWorks.Common.Widgets.FwComboBox(); this.grplbl = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_tbForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.m_fwTextBoxBottomMsg)).BeginInit(); this.grplbl.SuspendLayout(); this.SuspendLayout(); // // m_btnClose // resources.ApplyResources(this.m_btnClose, "m_btnClose"); // // m_btnOK // resources.ApplyResources(this.m_btnOK, "m_btnOK"); // // m_btnInsert // resources.ApplyResources(this.m_btnInsert, "m_btnInsert"); // // m_btnHelp // resources.ApplyResources(this.m_btnHelp, "m_btnHelp"); // // m_panel1 // resources.ApplyResources(this.m_panel1, "m_panel1"); // // m_matchingObjectsBrowser // resources.ApplyResources(this.m_matchingObjectsBrowser, "m_matchingObjectsBrowser"); // // m_formLabel // resources.ApplyResources(this.m_formLabel, "m_formLabel"); // // m_tbForm // resources.ApplyResources(this.m_tbForm, "m_tbForm"); // // m_cbWritingSystems // resources.ApplyResources(this.m_cbWritingSystems, "m_cbWritingSystems"); // // label1 // resources.ApplyResources(this.m_wsLabel, "label1"); // // m_fwTextBoxBottomMsg // this.m_fwTextBoxBottomMsg.BackColor = System.Drawing.SystemColors.InactiveCaptionText; resources.ApplyResources(this.m_fwTextBoxBottomMsg, "m_fwTextBoxBottomMsg"); // // label2 // resources.ApplyResources(this.m_objectsLabel, "label2"); // // m_rbEntry // this.m_rbEntry.Checked = true; resources.ApplyResources(this.m_rbEntry, "m_rbEntry"); this.m_rbEntry.Name = "m_rbEntry"; this.m_rbEntry.TabStop = true; this.m_rbEntry.Click += new System.EventHandler(this.m_radioButtonClick); // // m_rbSense // resources.ApplyResources(this.m_rbSense, "m_rbSense"); this.m_rbSense.Name = "m_rbSense"; this.m_rbSense.Click += new System.EventHandler(this.m_radioButtonClick); // // m_fwcbSenses // this.m_fwcbSenses.AdjustStringHeight = true; resources.ApplyResources(this.m_fwcbSenses, "m_fwcbSenses"); this.m_fwcbSenses.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; this.m_fwcbSenses.Name = "m_fwcbSenses"; // // grplbl // resources.ApplyResources(this.grplbl, "grplbl"); this.grplbl.BackColor = System.Drawing.SystemColors.Control; this.grplbl.Controls.Add(this.m_rbSense); this.grplbl.Controls.Add(this.m_rbEntry); this.grplbl.Controls.Add(this.m_fwcbSenses); this.grplbl.ForeColor = System.Drawing.SystemColors.ControlText; this.grplbl.Name = "grplbl"; this.m_helpProvider.SetShowHelp(this.grplbl, ((bool)(resources.GetObject("grplbl.ShowHelp")))); this.grplbl.TabStop = false; // // groupBox1 // resources.ApplyResources(this.groupBox1, "groupBox1"); this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlText; this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // // LinkEntryOrSenseDlg // resources.ApplyResources(this, "$this"); this.Controls.Add(this.groupBox1); this.Controls.Add(this.grplbl); this.m_helpProvider.SetHelpNavigator(this, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("$this.HelpNavigator")))); this.Name = "LinkEntryOrSenseDlg"; this.m_helpProvider.SetShowHelp(this, ((bool)(resources.GetObject("$this.ShowHelp")))); this.Controls.SetChildIndex(this.m_fwTextBoxBottomMsg, 0); this.Controls.SetChildIndex(this.m_btnInsert, 0); this.Controls.SetChildIndex(this.grplbl, 0); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.m_btnClose, 0); this.Controls.SetChildIndex(this.m_btnOK, 0); this.Controls.SetChildIndex(this.m_btnHelp, 0); this.Controls.SetChildIndex(this.m_panel1, 0); this.Controls.SetChildIndex(this.m_matchingObjectsBrowser, 0); this.Controls.SetChildIndex(this.m_cbWritingSystems, 0); this.Controls.SetChildIndex(this.m_wsLabel, 0); this.Controls.SetChildIndex(this.m_objectsLabel, 0); this.m_panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.m_tbForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.m_fwTextBoxBottomMsg)).EndInit(); this.grplbl.ResumeLayout(false); this.grplbl.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { // Dispose managed resources here. if (m_combo != null) { m_combo.SelectedIndexChanged -= new EventHandler(SelectionChanged); Control.Controls.Remove(m_combo); m_combo.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_combo = null; m_mediator = null; m_persistProvider = null; base.Dispose(disposing); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (IsDisposed) return; if (disposing) { if (m_helpProvider != null) m_helpProvider.Dispose(); } m_cache = null; m_fs = null; m_ctxt = null; m_mediator = null; m_cache = null; m_bvList = null; m_valuesCombo = null; base.Dispose( disposing ); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Executes in two distinct scenarios. /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// If subclasses override this method, they should call the base implementation. /// </remarks> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { } m_combo = null; // Disposed elsewhere. base.Dispose (disposing); }
/// <summary> /// Create the common options for all FSI combos (except Integer). /// </summary> /// <param name="item"></param> protected void MakeCombo(FilterSortItem item) { FwComboBox combo = new FwComboBox(); combo.DropDownStyle = ComboBoxStyle.DropDownList; combo.BackColor = SystemColors.Window; combo.WritingSystemFactory = m_wsf; combo.StyleSheet = m_bv.StyleSheet; item.Combo = combo; combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksShowAll), null, item)); string blankPossible = XmlUtils.GetOptionalAttributeValue(item.Spec, "blankPossible", "true"); switch (blankPossible) { case "true": combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksBlanks), new BlankMatcher(), item)); combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksNonBlanks), new NonBlankMatcher(), item)); break; } // Enhance JohnT: figure whether the column has vernacular or analysis data... int ws = 0; if (item.Spec != null) { string wsParam = XmlViewsUtils.FindWsParam(item.Spec); if (wsParam.Length == 0) wsParam = XmlUtils.GetOptionalAttributeValue(item.Spec, "ws", ""); ws = XmlViewsUtils.GetWsFromString(wsParam, m_cache); } if (ws == 0) ws = m_cache.DefaultVernWs; // some sort of fall-back in case we can't determine a WS from the spec. string beSpec = XmlUtils.GetOptionalAttributeValue(item.Spec, "bulkEdit", ""); if (String.IsNullOrEmpty(beSpec)) beSpec = XmlUtils.GetOptionalAttributeValue(item.Spec, "chooserFilter", ""); string sortType = XmlUtils.GetOptionalAttributeValue(item.Spec, "sortType", null); switch (sortType) { case "integer": // For columns which are interger values we offer the user a couple preset filters // one is "0" and the other is "Greater than zero" combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksZero), new ExactMatcher(MatchExactPattern(XMLViewsStrings.ksZero)), item)); combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksGreaterThanZero), new RangeIntMatcher(1, Int32.MaxValue), item)); combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksGreaterThanOne), new RangeIntMatcher(2, Int32.MaxValue), item)); combo.Items.Add(new RestrictComboItem(MakeLabel(XMLViewsStrings.ksRestrict_), item, m_cache.DefaultUserWs, combo)); break; case "date": combo.Items.Add(new RestrictDateComboItem(MakeLabel(XMLViewsStrings.ksRestrict_), item, m_cache.DefaultUserWs, combo)); break; case "YesNo": // For columns which have only the values of "yes" or "no" we offer the user these preset // filters to choose. combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksYes), new ExactMatcher(MatchExactPattern(XMLViewsStrings.ksYes)), item)); combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksNo), new ExactMatcher(MatchExactPattern(XMLViewsStrings.ksNo)), item)); break; case "stringList": string[] labels = m_bv.BrowseView.GetStringList(item.Spec); if (labels == null) break; foreach (string aLabel in labels) { combo.Items.Add(new FilterComboItem(MakeLabel(aLabel), new ExactMatcher(MatchExactPattern(aLabel)), item)); } if (labels.Length > 2) { foreach (string aLabel in labels) { combo.Items.Add(new FilterComboItem(MakeLabel(string.Format(XMLViewsStrings.ksExcludeX, aLabel)), new InvertMatcher(new ExactMatcher(MatchExactPattern(aLabel))), item)); } } break; default: // If it isn't any of those, include the bad spelling item, provided we have a dictionary // for the relevant language, and provided it is NOT a list (for which we will make a chooser). if (!String.IsNullOrEmpty(beSpec)) break; Enchant.Dictionary dict = m_bv.BrowseView.EditingHelper.GetDictionary(ws); if (dict != null) { combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksSpellingErrors), new BadSpellingMatcher(ws, dict), item)); } break; } combo.Items.Add(new FindComboItem(MakeLabel(XMLViewsStrings.ksFilterFor_), item, ws, combo, m_bv)); if (!String.IsNullOrEmpty(beSpec)) { MakeListChoiceFilterItem(item, combo, beSpec, m_bv.Mediator); } // Todo: lots more interesting items. // - search the list for existing names // - "any of" and "none of" launch a dialog with check boxes for all existing values. // - maybe a control to check all items containing... // - "containing" launches dialog asking for string (may contain # at start or end). // - "matching pattern" launches dialog to obtain pattern. // - "custom" may launch dialog with "OR" options and "is, is not, is less than, is greater than, matches,..." // How can we get the current items? May not be available until later... // - May need to add 'ShowList' event to FwComboBox so we can populate the list when we show it. combo.SelectedIndex = 0; // Do this after selecting initial item, so we don't get a spurious notification. combo.SelectedIndexChanged += new EventHandler(Combo_SelectedIndexChanged); combo.AccessibleName = "FwComboBox"; this.Controls.Add(combo); }
public void Dispose() { if (m_combo != null && !m_combo.IsDisposed) { m_combo.Dispose(); m_combo = null; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Make a combo menu item (and install it) for choosing from a list, based on the column /// spec at item.Spec. /// </summary> /// <param name="item">The item.</param> /// <param name="combo">The combo.</param> /// <param name="beSpec">The be spec.</param> /// <param name="mediator">The mediator.</param> /// ------------------------------------------------------------------------------------ private void MakeListChoiceFilterItem(FilterSortItem item, FwComboBox combo, string beSpec, XCore.Mediator mediator) { switch (beSpec) { case "complexListMultiple": combo.Items.Add(new ListChoiceComboItem(MakeLabel(XMLViewsStrings.ksChoose_), item, m_cache, mediator, combo, false, null)); break; case "external": Type beType = DynamicLoader.TypeForLoaderNode(item.Spec); Type filterType = null; if (typeof(ListChoiceFilter).IsAssignableFrom(beType)) { // typically it is a chooserFilter attribute, and gives the actual filter. filterType = beType; } else { // typically got a bulkEdit spec, and the editor class may know a compatible filter class. MethodInfo mi = beType.GetMethod("FilterType", BindingFlags.Static | BindingFlags.Public); if (mi != null) filterType = mi.Invoke(null, null) as Type; } if (filterType != null) { PropertyInfo pi = filterType.GetProperty("Atomic", BindingFlags.Public | BindingFlags.Static); bool fAtomic = false; if (pi != null) fAtomic = (bool)pi.GetValue(null, null); ListChoiceComboItem comboItem = new ListChoiceComboItem(MakeLabel(XMLViewsStrings.ksChoose_), item, m_cache, mediator, combo, fAtomic, filterType); combo.Items.Add(comboItem); PropertyInfo piLeaf = filterType.GetProperty("LeafFlid", BindingFlags.Public | BindingFlags.Static); if (piLeaf != null) comboItem.LeafFlid = (int)piLeaf.GetValue(null, null); } break; case "atomicFlatListItem": // Fall through case "morphTypeListItem": // Fall through case "variantConditionListItem": combo.Items.Add(new ListChoiceComboItem(MakeLabel(XMLViewsStrings.ksChoose_), item, m_cache, mediator, combo, true, null)); break; default: // if we didn't find it, try "chooserFilter", if we haven't already. string chooserFilter = XmlUtils.GetOptionalAttributeValue(item.Spec, "chooserFilter", ""); if (!String.IsNullOrEmpty(chooserFilter) && chooserFilter != beSpec) MakeListChoiceFilterItem(item, combo, chooserFilter, mediator); return; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes the int combo. /// </summary> /// <param name="item">The item.</param> /// ------------------------------------------------------------------------------------ protected void MakeIntCombo(FilterSortItem item) { // This is just similar enough to MakeCombo to be annoying. FwComboBox combo = new FwComboBox(); combo.DropDownStyle = ComboBoxStyle.DropDownList; combo.WritingSystemFactory = m_wsf; item.Combo = combo; combo.Items.Add(new FilterComboItem(MakeLabel(XMLViewsStrings.ksShowAll), null, item)); combo.Items.Add(new RestrictComboItem(MakeLabel(XMLViewsStrings.ksRestrict_), item, m_cache.DefaultUserWs, combo)); combo.SelectedIndex = 0; // Do this after selecting initial item, so we don't get a spurious notification. combo.SelectedIndexChanged +=new EventHandler(Combo_SelectedIndexChanged); combo.AccessibleName = "FwComboBox"; this.Controls.Add(combo); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LinkAllomorphDlg)); this.label3 = new System.Windows.Forms.Label(); this.m_fwcbAllomorphs = new SIL.FieldWorks.Common.Widgets.FwComboBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.grplbl = new System.Windows.Forms.GroupBox(); this.m_panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_tbForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.m_fwTextBoxBottomMsg)).BeginInit(); this.SuspendLayout(); // // m_btnClose // resources.ApplyResources(this.m_btnClose, "m_btnClose"); // // m_btnOK // resources.ApplyResources(this.m_btnOK, "m_btnOK"); // // m_btnInsert // resources.ApplyResources(this.m_btnInsert, "m_btnInsert"); // // m_btnHelp // resources.ApplyResources(this.m_btnHelp, "m_btnHelp"); // // m_panel1 // resources.ApplyResources(this.m_panel1, "m_panel1"); // // m_matchingObjectsBrowser // resources.ApplyResources(this.m_matchingObjectsBrowser, "m_matchingObjectsBrowser"); // // m_fwTextBoxBottomMsg // resources.ApplyResources(this.m_fwTextBoxBottomMsg, "m_fwTextBoxBottomMsg"); // // label3 // resources.ApplyResources(this.label3, "label3"); this.label3.Name = "label3"; // // m_fwcbAllomorphs // resources.ApplyResources(this.m_fwcbAllomorphs, "m_fwcbAllomorphs"); this.m_fwcbAllomorphs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_fwcbAllomorphs.DropDownWidth = 200; this.m_fwcbAllomorphs.DroppedDown = false; this.m_fwcbAllomorphs.Name = "m_fwcbAllomorphs"; this.m_fwcbAllomorphs.PreviousTextBoxText = null; this.m_fwcbAllomorphs.SelectedIndex = -1; this.m_fwcbAllomorphs.SelectedItem = null; this.m_fwcbAllomorphs.StyleSheet = null; // // groupBox1 // resources.ApplyResources(this.groupBox1, "groupBox1"); this.groupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption; this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // // grplbl // resources.ApplyResources(this.grplbl, "grplbl"); this.grplbl.ForeColor = System.Drawing.SystemColors.ActiveCaption; this.grplbl.Name = "grplbl"; this.grplbl.TabStop = false; // // LinkAllomorphDlg // resources.ApplyResources(this, "$this"); this.Controls.Add(this.m_fwcbAllomorphs); this.Controls.Add(this.label3); this.Controls.Add(this.groupBox1); this.Controls.Add(this.grplbl); this.m_helpProvider.SetHelpNavigator(this, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("$this.HelpNavigator")))); this.Name = "LinkAllomorphDlg"; this.m_helpProvider.SetShowHelp(this, ((bool)(resources.GetObject("$this.ShowHelp")))); this.Controls.SetChildIndex(this.grplbl, 0); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.label3, 0); this.Controls.SetChildIndex(this.m_fwcbAllomorphs, 0); this.Controls.SetChildIndex(this.m_btnClose, 0); this.Controls.SetChildIndex(this.m_btnOK, 0); this.Controls.SetChildIndex(this.m_btnInsert, 0); this.Controls.SetChildIndex(this.m_btnHelp, 0); this.Controls.SetChildIndex(this.m_panel1, 0); this.Controls.SetChildIndex(this.m_matchingObjectsBrowser, 0); this.Controls.SetChildIndex(this.m_cbWritingSystems, 0); this.Controls.SetChildIndex(this.m_wsLabel, 0); this.Controls.SetChildIndex(this.m_fwTextBoxBottomMsg, 0); this.Controls.SetChildIndex(this.m_objectsLabel, 0); this.m_panel1.ResumeLayout(false); this.m_panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_tbForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.m_fwTextBoxBottomMsg)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected virtual void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (m_isDisposed) return; if (disposing) { // Dispose managed resources here. // We didn't make these either, but we need to deal with them. // No. These belong to the RecordList. //if (m_finder != null && (m_finder is IDisposable)) // (m_finder as IDisposable).Dispose(); //if (m_sorter != null && (m_sorter is IDisposable)) // (m_sorter as IDisposable).Dispose(); //if (m_filter != null) // (m_filter as IDisposable).Dispose(); //if (m_matcher != null && m_matcher is IDisposable) // (m_matcher as IDisposable).Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_viewSpec = null; m_combo = null; // We didn't create it, so let whoever did dispose it. m_finder = null; m_sorter = null; m_filter = null; m_matcher = null; m_isDisposed = true; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MSAGroupBox)); this.m_groupBox = new System.Windows.Forms.GroupBox(); this.m_lAfxType = new System.Windows.Forms.Label(); this.m_fwcbAffixTypes = new SIL.FieldWorks.Common.Widgets.FwComboBox(); this.m_lMainCat = new System.Windows.Forms.Label(); this.m_tcMainPOS = new SIL.FieldWorks.Common.Widgets.TreeCombo(); this.m_lSLots = new System.Windows.Forms.Label(); this.m_fwcbSlots = new SIL.FieldWorks.Common.Widgets.FwComboBox(); this.m_tcSecondaryPOS = new SIL.FieldWorks.Common.Widgets.TreeCombo(); this.m_groupBox.SuspendLayout(); this.SuspendLayout(); // // m_groupBox // this.m_groupBox.Controls.Add(this.m_lAfxType); this.m_groupBox.Controls.Add(this.m_fwcbAffixTypes); this.m_groupBox.Controls.Add(this.m_lMainCat); this.m_groupBox.Controls.Add(this.m_tcMainPOS); this.m_groupBox.Controls.Add(this.m_lSLots); this.m_groupBox.Controls.Add(this.m_fwcbSlots); this.m_groupBox.Controls.Add(this.m_tcSecondaryPOS); resources.ApplyResources(this.m_groupBox, "m_groupBox"); this.m_groupBox.Name = "m_groupBox"; this.m_groupBox.TabStop = false; // // m_lAfxType // resources.ApplyResources(this.m_lAfxType, "m_lAfxType"); this.m_lAfxType.Name = "m_lAfxType"; // // m_fwcbAffixTypes // this.m_fwcbAffixTypes.AdjustStringHeight = true; this.m_fwcbAffixTypes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_fwcbAffixTypes.DropDownWidth = 140; this.m_fwcbAffixTypes.DroppedDown = false; resources.ApplyResources(this.m_fwcbAffixTypes, "m_fwcbAffixTypes"); this.m_fwcbAffixTypes.Name = "m_fwcbAffixTypes"; this.m_fwcbAffixTypes.PreviousTextBoxText = null; this.m_fwcbAffixTypes.SelectedIndex = -1; this.m_fwcbAffixTypes.SelectedItem = null; this.m_fwcbAffixTypes.StyleSheet = null; // // m_lMainCat // resources.ApplyResources(this.m_lMainCat, "m_lMainCat"); this.m_lMainCat.Name = "m_lMainCat"; // // m_tcMainPOS // this.m_tcMainPOS.AdjustStringHeight = true; this.m_tcMainPOS.DropDownWidth = 140; this.m_tcMainPOS.DroppedDown = false; resources.ApplyResources(this.m_tcMainPOS, "m_tcMainPOS"); this.m_tcMainPOS.Name = "m_tcMainPOS"; this.m_tcMainPOS.SelectedNode = null; this.m_tcMainPOS.StyleSheet = null; // // m_lSLots // resources.ApplyResources(this.m_lSLots, "m_lSLots"); this.m_lSLots.Name = "m_lSLots"; // // m_fwcbSlots // this.m_fwcbSlots.AdjustStringHeight = true; this.m_fwcbSlots.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_fwcbSlots.DropDownWidth = 140; this.m_fwcbSlots.DroppedDown = false; resources.ApplyResources(this.m_fwcbSlots, "m_fwcbSlots"); this.m_fwcbSlots.Name = "m_fwcbSlots"; this.m_fwcbSlots.PreviousTextBoxText = null; this.m_fwcbSlots.SelectedIndex = -1; this.m_fwcbSlots.SelectedItem = null; this.m_fwcbSlots.StyleSheet = null; // // m_tcSecondaryPOS // this.m_tcSecondaryPOS.AdjustStringHeight = true; this.m_tcSecondaryPOS.DropDownWidth = 140; this.m_tcSecondaryPOS.DroppedDown = false; resources.ApplyResources(this.m_tcSecondaryPOS, "m_tcSecondaryPOS"); this.m_tcSecondaryPOS.Name = "m_tcSecondaryPOS"; this.m_tcSecondaryPOS.SelectedNode = null; this.m_tcSecondaryPOS.StyleSheet = null; // // MSAGroupBox // this.Controls.Add(this.m_groupBox); this.Name = "MSAGroupBox"; resources.ApplyResources(this, "$this"); this.m_groupBox.ResumeLayout(false); this.ResumeLayout(false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:ListChoiceComboItem"/> class. /// </summary> /// <param name="tssName">Name of the TSS.</param> /// <param name="fsi">The fsi.</param> /// <param name="cache">The cache.</param> /// <param name="mediator">The mediator.</param> /// <param name="combo">The combo.</param> /// <param name="fAtomic">if set to <c>true</c> [f atomic].</param> /// <param name="filterType">Type of the filter.</param> /// ------------------------------------------------------------------------------------ public ListChoiceComboItem(ITsString tssName, FilterSortItem fsi, FdoCache cache, XCore.Mediator mediator, FwComboBox combo, bool fAtomic, Type filterType) : base(tssName, null, fsi) { m_colSpec = fsi.Spec; if (filterType == null) { m_hvoList = BulkEditBar.GetNamedList(cache, fsi.Spec, "list"); // This basically duplicates the loading of treeBarHandler properties. Currently, we don't have access // to that information in XMLViews, and even if we did, the information may not be loaded until // the user actually switches to that RecordList. XmlNode windowConfiguration = (XmlNode)mediator.PropertyTable.GetValue("WindowConfiguration"); string owningClass; string property; BulkEditBar.GetListInfo(fsi.Spec, out owningClass, out property); XmlNode recordListNode = windowConfiguration.SelectSingleNode( String.Format("//recordList[@owner='{0}' and @property='{1}']", owningClass, property)); XmlNode treeBarHandlerNode = recordListNode.ParentNode.SelectSingleNode("treeBarHandler"); m_includeAbbr = XmlUtils.GetBooleanAttributeValue(treeBarHandlerNode, "includeAbbr"); m_bestWS = XmlUtils.GetOptionalAttributeValue(treeBarHandlerNode, "ws", null); } else { MethodInfo mi = filterType.GetMethod("List", BindingFlags.Public | BindingFlags.Static); m_hvoList = (int)mi.Invoke(null, new object[] { cache }); } m_cache = cache; m_mediator = mediator; m_combo = combo; m_fAtomic = fAtomic; m_filterType = filterType; }
/// <summary/> protected virtual void Dispose(bool fDisposing) { System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); if (fDisposing && !IsDisposed) { // dispose managed and unmanaged objects if (m_combo != null) m_combo.Dispose(); } m_combo = null; IsDisposed = true; }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { if (m_helpProvider != null) m_helpProvider.Dispose(); } if (m_cache != null) { IVwCacheDa cda = m_cache.MainCacheAccessor as IVwCacheDa; cda.CacheVecProp(m_cache.LangProject.Hvo, m_fakeFlid, null, 0); cda = null; m_cache = null; } m_ctxt = null; m_mediator = null; m_bvList = null; m_valuesCombo = null; base.Dispose(disposing); }