// Init the list and select specified item
 void InitCurrentList(InterlinLineSpec spec)
 {
     InitCurrentList(m_choices.IndexOf(spec));
 }
Exemplo n.º 2
0
		/// <summary>
		/// Make sure there is SOME lineChoice for the specified flid in m_lineChoices.
		/// If lineChoices is non-null and contains one for the right flid, choose the first.
		/// </summary>
		/// <param name="dest"></param>
		/// <param name="source"></param>
		/// <param name="flid"></param>
		private static void GetLineChoice(InterlinLineChoices dest, InterlinLineChoices source, int flid)
		{
			if (source != null)
			{
				var index = source.IndexOf(flid);
				if (index >= 0)
				{
					dest.Add(source[index]);
					return;
				}
			}
			// Last resort.
			dest.Add(flid);
		}
            private void DisplayMorphForm(IVwEnv vwenv, int hvo, int frag, int ws, int choiceIndex)
            {
                int hvoMorphForm = vwenv.DataAccess.get_ObjectProp(hvo, ktagSbMorphForm);

                // Allow editing of the morpheme breakdown line.
                SetColor(vwenv, m_choices.LabelRGBFor(choiceIndex));
                // On this line we want an icon only for the first column (and only if it is the first
                // occurrence of the flid).
                bool fWantIcon = m_fIsMorphemeFormEditable && (frag == kfragFirstMorph) && m_choices.IsFirstOccurrenceOfFlid(choiceIndex);

                if (!fWantIcon)
                {
                    SetIndentForMissingIcon(vwenv);
                }
                vwenv.OpenParagraph();
                bool fFirstMorphLine = (m_choices.IndexOf(InterlinLineChoices.kflidMorphemes) == choiceIndex);

                if (fWantIcon)                 // Review JohnT: should we do the 'edit box' for all first columns?
                {
                    AddPullDownIcon(vwenv, ktagMorphFormIcon);
                    // Create an edit box that stays visible when the user deletes
                    // the first morpheme (like the WordGloss box).
                    // This is especially useful if the user wants to
                    // delete the entire MorphForm line (cf. LT-1621).
                    vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
                                          (int)FwTextPropVar.ktpvMilliPoint,
                                          kmpIconMargin);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
                                          (int)FwTextPropVar.ktpvMilliPoint,
                                          2000);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
                                          (int)FwTextPropVar.ktpvMilliPoint,
                                          2000);
                    vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
                                          (int)FwTextPropVar.ktpvDefault, krgbEditable);
                }
                if (m_fIsMorphemeFormEditable)
                {
                    MakeNextFlowObjectEditable(vwenv);
                }
                else
                {
                    MakeNextFlowObjectReadOnly(vwenv);
                }
                vwenv.OpenInnerPile();
                vwenv.OpenParagraph();
                if (fFirstMorphLine)
                {
                    vwenv.AddStringProp(ktagSbMorphPrefix, this);
                }
                // This is never missing, but may, or may not, be editable.
                vwenv.AddObjProp(ktagSbMorphForm, this, kfragNamedObjectNameChoices + choiceIndex);
                if (fFirstMorphLine)
                {
                    vwenv.AddStringProp(ktagSbMorphPostfix, this);
                }
                // close the special edit box we opened for the first morpheme.
                vwenv.CloseParagraph();
                vwenv.CloseInnerPile();
                vwenv.CloseParagraph();
            }
Exemplo n.º 4
0
 bool IsLineEnabled(int lineChoice)
 {
     return(m_choices.IndexOf(lineChoice) != -1);
 }