protected void InitializeMultiStringControls() { // protected for testing. N.B. if testing, set test cache first! m_uiWss = GetUiWritingSystemAndEnglish(); //m_delta = 0; m_lmscListName = ReplaceTextBoxWithMultiStringBox(m_tboxListName, m_stylesheet); m_lmscDescription = ReplaceTextBoxWithMultiStringBox(m_tboxDescription, m_stylesheet); }
protected static void SetAllMultiAlternatives(IMultiAccessorBase multiField, LabeledMultiStringControl source) { var cws = source.NumberOfWritingSystems; for (var i = 0; i < cws; i++) { var curWs = source.Ws(i); multiField.set_String(curWs, source.Value(curWs)); } }
private static bool HasMsContentChanged(IMultiAccessorBase oldStrings, LabeledMultiStringControl msControl) { var cws = msControl.NumberOfWritingSystems; for (var i = 0; i < cws; i++) { var curWs = msControl.Ws(i); if (oldStrings.get_String(curWs).Text != msControl.Value(curWs).Text) { return(true); } } return(false); }
/// <summary> /// Convert the text box for the caption to a multilingual string control. /// </summary> public void UseMultiStringCaption(FdoCache cache, int wsMagic, IVwStylesheet stylesheet) { m_lmscCaption = new LabeledMultiStringControl(cache, wsMagic, stylesheet); m_txtCaption.Hide(); m_lmscCaption.Location = m_txtCaption.Location; m_lmscCaption.Width = m_txtCaption.Width; m_lmscCaption.Anchor = m_txtCaption.Anchor; m_lmscCaption.AccessibleName = m_txtCaption.AccessibleName; m_lmscCaption.Dock = DockStyle.Fill; // Grow the dialog and move all lower controls down to make room. pnlCaption.Controls.Remove(m_txtCaption); m_lmscCaption.TabIndex = m_txtCaption.TabIndex; // assume the same tab order as the 'designed' control pnlCaption.Controls.Add(m_lmscCaption); }
protected static void LoadAllMultiAlternatives(IMultiAccessorBase multiField, LabeledMultiStringControl destination) { var cws = destination.NumberOfWritingSystems; for (var i = 0; i < cws; i++) { var curWs = destination.Ws(i); if (curWs <= 0) { continue; } int actualWs; ITsString tssStr; if (!multiField.TryWs(curWs, out actualWs, out tssStr)) { continue; } destination.SetValue(curWs, tssStr); } }
private LabeledMultiStringControl ReplaceTextBoxWithMultiStringBox(TextBox tb, IVwStylesheet stylesheet) { Debug.Assert(Cache != null, "Need a cache to setup a MultiStringBox."); tb.Hide(); if (m_uiWss.Count == 0) { return(null); } var ms = new LabeledMultiStringControl(Cache, m_uiWss, stylesheet); ms.Location = tb.Location; ms.Width = tb.Width; ms.Anchor = tb.Anchor; ms.AccessibleName = tb.AccessibleName; // Grow the dialog and move all lower controls down to make room. Controls.Remove(tb); ms.TabIndex = tb.TabIndex; // assume the same tab order as the 'designed' control Controls.Add(ms); FontHeightAdjuster.GrowDialogAndAdjustControls(this, ms.Height - tb.Height, ms); return(ms); }