void AddSeparatorLine()
        {
            //review
            ITsStrBldr builder = TsStrBldrClass.Create();

            builder.Replace(0, 0, "-------", null);
            HvoTssComboItem newItem = new HvoTssComboItem(-1, builder.GetString());             //hack todo

            m_combo.Items.Add(newItem);
        }
Exemple #2
0
        void AddSeparatorLine()
        {
            //review
            ITsStrBldr builder = TsStringUtils.MakeStrBldr();

            builder.Replace(0, 0, "-------", null);
            builder.SetIntPropValues(0, builder.Length, (int)FwTextPropType.ktptWs,
                                     (int)FwTextPropVar.ktpvDefault, m_cache.DefaultUserWs);
            HvoTssComboItem newItem = new HvoTssComboItem(-1, builder.GetString());             //hack todo

            m_combo.Items.Add(newItem);
        }
Exemple #3
0
        // Handles a change in the item selected in the affix slot combo box.
        void HandleComboSlotChange(object sender, EventArgs ea)
        {
            if (m_skipEvents)
            {
                return;
            }

            FwComboBox      combo   = sender as FwComboBox;
            HvoTssComboItem selItem = combo.SelectedItem as HvoTssComboItem;

            m_selectedSlotHvo = (selItem == null) ? -1 : selItem.Hvo;
        }
Exemple #4
0
        // Handles a change in the item selected in the affix slot combo box.
        void HandleComboSlotChange(object sender, EventArgs ea)
        {
            if (m_skipEvents)
            {
                return;
            }

            FwComboBox      combo   = sender as FwComboBox;
            HvoTssComboItem selItem = combo.SelectedItem as HvoTssComboItem;

            m_selectedSlot = (selItem == null) ? null : m_cache.ServiceLocator.GetInstance <IMoInflAffixSlotRepository>().GetObject(selItem.Hvo);
        }
        /// <summary>
        /// Add an item to the combo box, but only if its text is non-empty.
        /// </summary>
        /// <param name="hvoAnalysis"></param>
        /// <param name="text"></param>
        /// <param name="fPossibleCurrent">generally true; false for items like "new analysis" that
        /// can't possibly be the current item, though hvoAnalysis might match.</param>
        /// <param name="tag">tag to specify an otherwise ambigious item.</param>
        void AddItem(int hvoAnalysis, ITsString text, bool fPossibleCurrent, int tag)
        {
            if (text.Length == 0)
            {
                return;
            }
            HvoTssComboItem newItem = new HvoTssComboItem(hvoAnalysis, text, tag);

            m_combo.Items.Add(newItem);
            if (fPossibleCurrent && hvoAnalysis == m_hvoAnalysis)
            {
                m_combo.SelectedItem = newItem;
            }
        }
Exemple #6
0
        /// <summary>
        /// Add an item to the combo box, but only if its text is non-empty.
        /// </summary>
        /// <param name="fPossibleCurrent">generally true; false for items like "new analysis" that
        /// can't possibly be the current item, though hvoAnalysis might match.</param>
        /// <param name="tag">tag to specify an otherwise ambigious item.</param>
        void AddItem(ICmObject co, ITsString text, bool fPossibleCurrent, int tag)
        {
            if (text.Length == 0)
            {
                return;
            }
            int             hvoObj  = co != null ? co.Hvo : 0;
            HvoTssComboItem newItem = new HvoTssComboItem(hvoObj, text, tag);

            m_combo.Items.Add(newItem);
            if (fPossibleCurrent && hvoObj == m_hvoAnalysis)
            {
                m_combo.SelectedItem = newItem;
            }
        }
Exemple #7
0
        /// <summary>
        /// Reset the slot combo box.
        /// </summary>
        private void ResetSlotCombo()
        {
            m_fwcbSlots.SuspendLayout();
            m_fwcbSlots.Items.Clear();
            int matchIdx = -1;

            if (m_selectedMainPOS != null)
            {
                // Cache items to add, which prevents prop changed being called for each add. (Fixes FWR-3083)
                List <HvoTssComboItem> itemsToAdd = new List <HvoTssComboItem>();
                foreach (var slot in GetSlots())
                {
                    string name = slot.Name.BestAnalysisAlternative.Text;
                    if (name != null && name.Length > 0)                     // Don't add empty strings.
                    {
                        HvoTssComboItem newItem = new HvoTssComboItem(slot.Hvo,
                                                                      m_tsf.MakeString(name, m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle));
                        itemsToAdd.Add(newItem);
                        if (m_selectedSlot != null && m_selectedSlot.Hvo == newItem.Hvo)
                        {
                            matchIdx = itemsToAdd.Count - 1;
                        }
                    }
                }
                m_fwcbSlots.Items.AddRange(itemsToAdd.ToArray());
            }
            if (matchIdx == -1)
            {
                m_fwcbSlots.SelectedIndex = -1;
                m_selectedSlot            = null;      // if the current proposed slot isn't possible for the POS, forget it.
            }
            else
            {
                try
                {
                    m_skipEvents = true;
                    m_fwcbSlots.SelectedIndex = matchIdx;
                }
                finally
                {
                    m_skipEvents = false;
                }
            }
            m_fwcbSlots.Enabled = m_fwcbSlots.Items.Count > 0;
            m_lSLots.Enabled    = m_fwcbSlots.Enabled;
            m_fwcbSlots.ResumeLayout();
        }
Exemple #8
0
        /// <summary>
        /// Reset the slot combo box.
        /// </summary>
        private void ResetSlotCombo()
        {
            m_fwcbSlots.SuspendLayout();
            m_fwcbSlots.Items.Clear();
            int matchIdx = -1;

            if (m_selectedMainPOSHvo > 0)
            {
                Set <int> hvoSlots = GetHvoSlots();
                foreach (int slotID in hvoSlots)
                {
                    IMoInflAffixSlot slot = MoInflAffixSlot.CreateFromDBObject(m_cache, slotID);
                    string           name = slot.Name.BestAnalysisAlternative.Text;
                    if (name != null && name.Length > 0)                     // Don't add empty strings.
                    {
                        HvoTssComboItem newItem = new HvoTssComboItem(slotID,
                                                                      m_tsf.MakeString(name, m_cache.LangProject.DefaultAnalysisWritingSystem));
                        int idx = m_fwcbSlots.Items.Add(newItem);
                        if (newItem.Hvo == m_selectedSlotHvo)
                        {
                            matchIdx = idx;
                        }
                    }
                }
            }
            if (matchIdx == -1)
            {
                m_fwcbSlots.SelectedIndex = -1;
                m_selectedSlotHvo         = 0;         // if the current proposed slot isn't possible for the POS, forget it.
            }
            else
            {
                try
                {
                    m_skipEvents = true;
                    m_fwcbSlots.SelectedIndex = matchIdx;
                }
                finally
                {
                    m_skipEvents = false;
                }
            }
            m_fwcbSlots.Enabled = m_fwcbSlots.Items.Count > 0;
            m_lSLots.Enabled    = m_fwcbSlots.Enabled;
            m_fwcbSlots.ResumeLayout();
        }
		void AddSeparatorLine()
		{
			//review
			ITsStrBldr builder = TsStrBldrClass.Create();
			builder.Replace(0,0,"-------", null);
			builder.SetIntPropValues(0, builder.Length, (int)FwTextPropType.ktptWs,
				(int)FwTextPropVar.ktpvDefault, m_cache.DefaultUserWs);
			HvoTssComboItem newItem = new HvoTssComboItem(-1, builder.GetString()); //hack todo
			m_combo.Items.Add(newItem);
		}
		/// <summary>
		/// Add an item to the combo box, but only if its text is non-empty.
		/// </summary>
		/// <param name="fPossibleCurrent">generally true; false for items like "new analysis" that
		/// can't possibly be the current item, though hvoAnalysis might match.</param>
		/// <param name="tag">tag to specify an otherwise ambigious item.</param>
		void AddItem(ICmObject co, ITsString text, bool fPossibleCurrent, int tag)
		{
			if (text.Length == 0)
				return;
			int hvoObj = co != null ? co.Hvo : 0;
			HvoTssComboItem newItem = new HvoTssComboItem(hvoObj, text, tag);
			m_combo.Items.Add(newItem);
			if (fPossibleCurrent && hvoObj == m_hvoAnalysis)
				m_combo.SelectedItem = newItem;
		}
Exemple #11
0
		/// <summary>
		/// Reset the slot combo box.
		/// </summary>
		private void ResetSlotCombo()
		{
			m_fwcbSlots.SuspendLayout();
			m_fwcbSlots.Items.Clear();
			int matchIdx = -1;
			if (m_selectedMainPOS != null)
			{
				// Cache items to add, which prevents prop changed being called for each add. (Fixes FWR-3083)
				List<HvoTssComboItem> itemsToAdd = new List<HvoTssComboItem>();
				foreach (var slot in GetSlots())
				{
					string name = slot.Name.BestAnalysisAlternative.Text;
					if (name != null && name.Length > 0) // Don't add empty strings.
					{
						HvoTssComboItem newItem = new HvoTssComboItem(slot.Hvo,
							m_tsf.MakeString(name, m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle));
						itemsToAdd.Add(newItem);
						if (m_selectedSlot != null && m_selectedSlot.Hvo == newItem.Hvo)
							matchIdx = itemsToAdd.Count - 1;
					}
				}
				m_fwcbSlots.Items.AddRange(itemsToAdd.ToArray());
			}
			if (matchIdx == -1)
			{
				m_fwcbSlots.SelectedIndex = -1;
				m_selectedSlot = null; // if the current proposed slot isn't possible for the POS, forget it.
			}
			else
			{
				try
				{
					m_skipEvents = true;
					m_fwcbSlots.SelectedIndex = matchIdx;
				}
				finally
				{
					m_skipEvents = false;
				}
			}
			m_fwcbSlots.Enabled = m_fwcbSlots.Items.Count > 0;
			m_lSLots.Enabled = m_fwcbSlots.Enabled;
			m_fwcbSlots.ResumeLayout();
		}
Exemple #12
0
		/// <summary>
		/// Reset the slot combo box.
		/// </summary>
		private void ResetSlotCombo()
		{
			m_fwcbSlots.SuspendLayout();
			m_fwcbSlots.Items.Clear();
			int matchIdx = -1;
			if (m_selectedMainPOSHvo > 0)
			{
				Set<int> hvoSlots = GetHvoSlots();
				foreach (int slotID in hvoSlots)
				{
					IMoInflAffixSlot slot = MoInflAffixSlot.CreateFromDBObject(m_cache, slotID);
					string name = slot.Name.BestAnalysisAlternative.Text;
					if (name != null && name.Length > 0) // Don't add empty strings.
					{
						HvoTssComboItem newItem = new HvoTssComboItem(slotID,
							m_tsf.MakeString(name, m_cache.LangProject.DefaultAnalysisWritingSystem));
						int idx = m_fwcbSlots.Items.Add(newItem);
						if (newItem.Hvo == m_selectedSlotHvo)
							matchIdx = idx;
					}
				}
			}
			if (matchIdx == -1)
			{
				m_fwcbSlots.SelectedIndex = -1;
				m_selectedSlotHvo = 0; // if the current proposed slot isn't possible for the POS, forget it.
			}
			else
			{
				try
				{
					m_skipEvents = true;
					m_fwcbSlots.SelectedIndex = matchIdx;
				}
				finally
				{
					m_skipEvents = false;
				}
			}
			m_fwcbSlots.Enabled = m_fwcbSlots.Items.Count > 0;
			m_lSLots.Enabled = m_fwcbSlots.Enabled;
			m_fwcbSlots.ResumeLayout();
		}
		void AddSeparatorLine()
		{
			//review
			ITsStrBldr builder = TsStrBldrClass.Create();
			builder.Replace(0,0,"-------", null);
			HvoTssComboItem newItem = new HvoTssComboItem(-1, builder.GetString()); //hack todo
			m_combo.Items.Add(newItem);
		}
		/// <summary>
		/// Add an item to the combo box, but only if its text is non-empty.
		/// </summary>
		/// <param name="hvoAnalysis"></param>
		/// <param name="text"></param>
		/// <param name="fPossibleCurrent">generally true; false for items like "new analysis" that
		/// can't possibly be the current item, though hvoAnalysis might match.</param>
		/// <param name="tag">tag to specify an otherwise ambigious item.</param>
		void AddItem(int hvoAnalysis, ITsString text, bool fPossibleCurrent, int tag)
		{
			if (text.Length == 0)
				return;
			HvoTssComboItem newItem = new HvoTssComboItem(hvoAnalysis, text, tag);
			m_combo.Items.Add(newItem);
			if (fPossibleCurrent && hvoAnalysis == m_hvoAnalysis)
				m_combo.SelectedItem = newItem;
		}