コード例 #1
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// When the style changes, raise the ValidStateChanged event
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private void StyleChosen(StyleListItem prevStyle, StyleListItem newStyle)
 {
     if (ValidStateChanged != null)
     {
         ValidStateChanged(this, Valid);
     }
 }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Save mapping details
        /// </summary>
        /// <remarks>Caller is responsible for saving the mapping somewhere useful. This
        /// just updates the mapping info.</remarks>
        /// ------------------------------------------------------------------------------------
        public void Save()
        {
            CheckDisposed();

            m_mapping.IsExcluded = chkExclude.Checked;
            if (!chkExclude.Checked)
            {
                m_mapping.Domain = MarkerDomain.Default;

                UpdateMapping(m_mapping, m_styleListHelper.SelectedStyleName);

                StyleListItem styleItem = (StyleListItem)lbStyles.SelectedItem;
                if (styleItem.Type != StyleType.kstCharacter ||
                    m_mapping.StyleName == ResourceHelper.DefaultParaCharsStyleName)
                {
                    if (rbtnFootnotes.Checked)
                    {
                        m_mapping.Domain = MarkerDomain.Footnote;
                    }
                    else if (rbtnNotes.Checked)
                    {
                        m_mapping.Domain = MarkerDomain.Note;
                    }
                    else
                    {
                        m_mapping.Domain = MarkerDomain.Default;
                    }

                    if (chkBackTranslation.Checked)
                    {
                        m_mapping.Domain |= MarkerDomain.BackTrans;
                    }
                }
                else
                {
                    ContextValues context =
                        (ContextValues)m_StyleSheet.GetContext(m_mapping.StyleName);
                    FunctionValues function = m_StyleSheet.GetFunction(m_mapping.StyleName);
                    if (context == ContextValues.BackTranslation ||
                        (context == ContextValues.Title && chkBackTranslation.Checked))
                    {
                        m_mapping.Domain = MarkerDomain.BackTrans;
                    }
                    else if (context == ContextValues.Note || function == FunctionValues.Footnote)
                    {
                        m_mapping.Domain = MarkerDomain.Footnote;
                    }
                }

                m_mapping.WsId = WritingSystem;
            }
        }