private void UpdateUIState(bool bSetModified, bool bFocusText)
{
++m_uBlockEvents;
if(bSetModified) m_bModified = true;
this.Text = (((m_strDataDesc.Length > 0) ? (m_strDataDesc +
(m_bModified ? "*" : string.Empty) + " - ") : string.Empty) +
PwDefs.ShortProductName + " " + KPRes.DataEditor);
m_menuViewFont.Enabled = (m_bdc == BinaryDataClass.Text);
UIUtil.SetChecked(m_menuViewWordWrap, m_rtbText.WordWrap);
m_tbFileSave.Image = (m_bModified ? Properties.Resources.B16x16_FileSave :
Properties.Resources.B16x16_FileSave_Disabled);
m_tbEditUndo.Enabled = m_rtbText.CanUndo;
m_tbEditRedo.Enabled = m_rtbText.CanRedo;
Font fSel = m_rtbText.SelectionFont;
if(fSel != null)
{
m_tbFormatBold.Checked = fSel.Bold;
m_tbFormatItalic.Checked = fSel.Italic;
m_tbFormatUnderline.Checked = fSel.Underline;
m_tbFormatStrikeout.Checked = fSel.Strikeout;
string strFontName = fSel.Name;
if(m_tbFontCombo.Items.IndexOf(strFontName) >= 0)
m_tbFontCombo.SelectedItem = strFontName;
else m_tbFontCombo.Text = strFontName;
string strFontSize = fSel.SizeInPoints.ToString();
if(m_tbFontSizeCombo.Items.IndexOf(strFontSize) >= 0)
m_tbFontSizeCombo.SelectedItem = strFontSize;
else m_tbFontSizeCombo.Text = strFontSize;
}
HorizontalAlignment ha = m_rtbText.SelectionAlignment;
m_tbAlignLeft.Checked = (ha == HorizontalAlignment.Left);
m_tbAlignCenter.Checked = (ha == HorizontalAlignment.Center);
m_tbAlignRight.Checked = (ha == HorizontalAlignment.Right);
--m_uBlockEvents;
if(bFocusText) UIUtil.SetFocus(m_rtbText, this);
}