コード例 #1
0
 private void RunStyleDialog(string styleName)
 {
     using (var dlg = new FwStylesDlg(null, m_cache, m_stylesheet,
                                      m_cache.WritingSystemFactory.get_EngineOrNull(m_cache.DefaultUserWs).RightToLeftScript,
                                      m_cache.ServiceLocator.WritingSystems.AllWritingSystems.Any(ws => ws.RightToLeftScript),
                                      m_stylesheet.GetDefaultBasedOnStyleName(),
                                      0,         // customUserLevel
                                      m_app.MeasurementSystem,
                                      styleName, //m_stylesheet.GetDefaultBasedOnStyleName(),
                                      styleName,
                                      0,         // hvoRootObject
                                      m_app, m_helpTopicProvider))
     {
         dlg.ShowTEStyleTypes = false;
         dlg.CanSelectParagraphBackgroundColor = false;
         if (dlg.ShowDialog(this) == DialogResult.OK && dlg.ChangeType != StyleChangeType.None)
         {
             m_app.Synchronize(SyncMsg.ksyncStyle);
             FwStyleSheet stylesheet = new FwStyleSheet();
             stylesheet.Init(m_cache, m_cache.LangProject.Hvo, LangProjectTags.kflidStyles);
             m_stylesheet            = stylesheet;
             m_masterRefreshRequired = true;
         }
     }
 }
コード例 #2
0
        private void m_btnStyles_Click(object sender, EventArgs e)
        {
            bool fRTL = m_cache.WritingSystemFactory.get_EngineOrNull(m_cache.DefaultUserWs).RightToLeftScript;

            using (var dlg = new FwStylesDlg(null, m_cache, m_stylesheet as FwStyleSheet,
                                             fRTL,
                                             m_cache.ServiceLocator.WritingSystems.AllWritingSystems.Any(ws => ws.RightToLeftScript),
                                             m_stylesheet.GetDefaultBasedOnStyleName(),
                                             0, // customUserLevel
                                             m_app.MeasurementSystem,
                                             m_stylesheet.GetDefaultBasedOnStyleName(),
                                             String.Empty,
                                             0, // hvoRootObject
                                             m_app, m_helpTopicProvider))
            {
                dlg.ShowTEStyleTypes = false;
                dlg.CanSelectParagraphBackgroundColor = false;
                if (dlg.ShowDialog(this) == DialogResult.OK &&
                    ((dlg.ChangeType & StyleChangeType.DefChanged) > 0 ||
                     (dlg.ChangeType & StyleChangeType.Added) > 0 ||
                     (dlg.ChangeType & StyleChangeType.RenOrDel) > 0))
                {
                    m_app.Synchronize(SyncMsg.ksyncStyle);
                    FwStyleSheet stylesheet = new FwStyleSheet();
                    stylesheet.Init(m_cache, m_cache.LangProject.Hvo, LangProjectTags.kflidStyles);
                    m_stylesheet = stylesheet;
                }
                string stySel = null;
                if (m_cbStyle.SelectedItem != null)
                {
                    stySel = m_cbStyle.SelectedItem.ToString();
                }
                FillStylesCombo(stySel);
            }
        }
コード例 #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Shows the Format Styles dialog.
        /// </summary>
        /// <param name="paraStyleName">Name of the initially selected paragraph style.</param>
        /// <param name="charStyleName">Name of the initially selected character style.</param>
        /// <returns>
        /// true if a refresh is needed to reload the cache
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public bool ShowStylesDialog(string paraStyleName, string charStyleName)
        {
            StVc        vc             = null;
            IVwRootSite activeViewSite = null;

            if (ActiveView != null)
            {
                vc             = ActiveView.EditingHelper.ViewConstructor as StVc;
                activeViewSite = ActiveView.CastAsIVwRootSite();
            }
            using (FwStylesDlg stylesDlg = new FwStylesDlg(activeViewSite,
                                                           Cache, StyleSheet, (vc == null) ? false : vc.RightToLeft,
                                                           Cache.ProjectIncludesRightToLeftWs, StyleSheet.GetDefaultBasedOnStyleName(),
                                                           MaxStyleLevelToShow, FwApp.MeasurementSystem, paraStyleName, charStyleName,
                                                           HvoAppRootObject, FwApp.App, FwApp.App))
            {
                stylesDlg.StylesRenamedOrDeleted +=
                    new FwStylesDlg.StylesRenOrDelDelegate(m_callbacks.OnStylesRenamedOrDeleted);
                stylesDlg.AllowSelectStyleTypes             = m_callbacks.ShowSelectStylesComboInStylesDialog;
                stylesDlg.CanSelectParagraphBackgroundColor = m_callbacks.CanSelectParagraphBackgroundColor;
                return(stylesDlg.ShowDialog(m_callbacks) == DialogResult.OK &&
                       ((stylesDlg.ChangeType & StyleChangeType.DefChanged) > 0 ||
                        (stylesDlg.ChangeType & StyleChangeType.Added) > 0));
            }
        }
コード例 #4
0
        private void btnStyles_Click(object sender, EventArgs e)
        {
            XCore.PropertyTable propertyTable = null;
            LexImportWizard     wiz           = LexImportWizard.Wizard();

            if (wiz != null)
            {
                propertyTable = wiz.PropTable;
            }
            if (propertyTable == null)
            {
                // See LT-9100 and LT-9266.  Apparently this condition can happen.
                MessageBox.Show(LexTextControls.ksCannotSoTryAgain, LexTextControls.ksInternalProblem,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            FwStylesDlg.RunStylesDialogForCombo(cbStyle, InitializeStylesComboBox, "", m_stylesheet as LcmStyleSheet,
                                                0, 0, m_cache, this, propertyTable.GetValue <IApp>("App"), m_helpTopicProvider, null);
        }
コード例 #5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Shows the Format Styles dialog.
        /// </summary>
        /// <param name="paraStyleName">Name of the initially selected paragraph style.</param>
        /// <param name="charStyleName">Name of the initially selected character style.</param>
        /// <param name="setPropsToFactorySettings">Delegate to set style info properties back
        /// to the default facotry settings</param>
        /// <returns>
        /// true if a refresh is needed to reload the cache
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public bool ShowStylesDialog(string paraStyleName, string charStyleName,
                                     Action <StyleInfo> setPropsToFactorySettings)
        {
            StVc        vc             = null;
            IVwRootSite activeViewSite = null;

            if (EditingHelper == null)            // If the calling location doesn't provide this just bring up the dialog with normal selected
            {
                paraStyleName = "Normal";
            }
            if (ActiveView != null)
            {
                vc             = ActiveView.EditingHelper.ViewConstructor as StVc;
                activeViewSite = ActiveView.CastAsIVwRootSite();
            }
            if (paraStyleName == null && charStyleName == null && EditingHelper.CurrentSelection != null &&
                EditingHelper.CurrentSelection.Selection != null)
            {
                // If the caller didn't know the default style, try to figure it out from
                // the selection.
                GetStyleNames(ActiveView as SimpleRootSite, EditingHelper.CurrentSelection.Selection,
                              ref paraStyleName, ref charStyleName);
            }
            using (FwStylesDlg stylesDlg = new FwStylesDlg(activeViewSite,
                                                           Cache, ActiveStyleSheet, (vc == null) ? false : vc.RightToLeft,
                                                           Cache.ServiceLocator.WritingSystems.AllWritingSystems.Any(ws => ws.RightToLeftScript),
                                                           ActiveStyleSheet.GetDefaultBasedOnStyleName(),
                                                           MaxStyleLevelToShow, m_app.MeasurementSystem, paraStyleName, charStyleName,
                                                           HvoAppRootObject, m_app, m_app))
            {
                stylesDlg.SetPropsToFactorySettings         = setPropsToFactorySettings;
                stylesDlg.StylesRenamedOrDeleted           += m_callbacks.OnStylesRenamedOrDeleted;
                stylesDlg.AllowSelectStyleTypes             = true;
                stylesDlg.ShowTEStyleTypes                  = m_callbacks.ShowTEStylesComboInStylesDialog;
                stylesDlg.CanSelectParagraphBackgroundColor = m_callbacks.CanSelectParagraphBackgroundColor;
                return(stylesDlg.ShowDialog(m_callbacks) == DialogResult.OK &&
                       ((stylesDlg.ChangeType & StyleChangeType.DefChanged) > 0 ||
                        (stylesDlg.ChangeType & StyleChangeType.Added) > 0));
            }
        }