예제 #1
0
 private void SetupAndShowHeaderPanel(XmlNode node, RecordBar treeBarControl)
 {
     if (!treeBarControl.HasHeaderControl)
     {
         m_titleBar = new PaneBar {
             Dock = DockStyle.Top
         };
         var headerPanel = new Panel {
             Visible = false
         };
         headerPanel.Controls.Add(m_titleBar);
         m_btnCancelSearch = new FwCancelSearchButton();
         m_btnCancelSearch.Init();
         m_btnCancelSearch.Click += m_btnCancelSearch_Click;
         headerPanel.Controls.Add(m_btnCancelSearch);
         m_textSearch        = CreateSearchBox();
         m_textSearch.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
         headerPanel.Controls.Add(m_textSearch);
         m_textSearch.AdjustForStyleSheet(m_stylesheet);
         headerPanel.Height = SetHeaderPanelHeight();
         treeBarControl.AddHeaderControl(headerPanel);
         // Keep the text box from covering the cancel search button
         m_textSearch.Width         = headerPanel.Width - m_btnCancelSearch.Width;
         m_btnCancelSearch.Location = new Point(headerPanel.Width - m_btnCancelSearch.Width, m_textSearch.Location.Y);
         SetInfoBarText(node, m_titleBar);
     }
     treeBarControl.ShowHeaderControl();
 }
예제 #2
0
        public void SetDlgInfo(LcmCache cache, Mediator mediator, PropertyTable propertyTable, ComplexConcMorphNode node)
        {
            m_cache = cache;
            m_node  = node;

            m_formTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_formTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable));

            m_glossTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_glossTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable));

            m_entryTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_entryTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable));

            m_categoryComboBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;

            foreach (CoreWritingSystemDefinition ws in m_cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems)
            {
                m_formWsComboBox.Items.Add(ws);
                m_entryWsComboBox.Items.Add(ws);
            }

            foreach (CoreWritingSystemDefinition ws in m_cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems)
            {
                m_glossWsComboBox.Items.Add(ws);
            }

            m_inflModel = new InflFeatureTreeModel(m_cache.LangProject.MsFeatureSystemOA, m_node.InflFeatures, m_imageList.Images[0], m_imageList.Images[1]);
            m_inflFeatsTreeView.Model = m_inflModel;
            m_inflFeatsTreeView.ExpandAll();

            SetTextBoxValue(m_node.Form, m_formTextBox, m_formWsComboBox, true);
            SetTextBoxValue(m_node.Entry, m_entryTextBox, m_entryWsComboBox, true);
            SetTextBoxValue(m_node.Gloss, m_glossTextBox, m_glossWsComboBox, false);

            m_catPopupTreeManager = new PossibilityComboController(m_categoryComboBox,
                                                                   m_cache,
                                                                   m_cache.LanguageProject.PartsOfSpeechOA,
                                                                   m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle,
                                                                   false,
                                                                   mediator,
                                                                   propertyTable,
                                                                   propertyTable.GetValue <Form>("window"));

            if (m_node.Category != null)
            {
                m_categoryNotCheckBox.Checked = m_node.NegateCategory;
                m_catPopupTreeManager.LoadPopupTree(m_node.Category.Hvo);
            }
            else
            {
                m_catPopupTreeManager.LoadPopupTree(0);
            }

            m_helpTopicProvider = propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");

            m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
            m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
            m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
        }
예제 #3
0
 private void SetFontInfo()
 {
     // Set writing system factory and code for the two edit boxes.
     m_wordformTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
     m_wordformTextBox.WritingSystemCode    = m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle;
     m_wordformTextBox.Text = "";
     m_wordformTextBox.AdjustForStyleSheet(this, m_wordPanel, m_mediator);
 }
        /// <summary>
        /// Set up the dlg in preparation to showing it.
        /// </summary>
        /// <param name="cache">FDO cache.</param>
        /// <param name="mediator"></param>
        /// <param name="entry">LexEntry</param>
        public void SetDlgInfo(FdoCache cache, Mediator mediator, ILexEntry entry)
        {
            CheckDisposed();

            Debug.Assert(cache != null);

            m_mediator = mediator;
            m_cache    = cache;
            m_entry    = entry;
            m_tsf      = m_cache.TsStrFactory;
            m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory;
            //m_fwTextBoxBottomMsg.WritingSystemCode = 1; // What!? Why? No longer makes ANY sense!
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);

            // We want to do this BEFORE the text gets set, to avoid overriding its height properties.
            // However, because of putting multiple lines in the box, we also need to do it AFTER we set the text
            // (in SetBottomMessage) so it adjusts to the resulting even greater height.
            m_fwTextBoxBottomMsg.AdjustForStyleSheet(this, null, stylesheet);
            Font f = FontHeightAdjuster.GetFontForNormalStyle(
                m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle, stylesheet, m_cache.LanguageWritingSystemFactoryAccessor);

            foreach (IMoForm allo in entry.AlternateFormsOS)
            {
                ListViewItem lvi = m_lvAlloOptions.Items.Add(allo.Form.VernacularDefaultWritingSystem.Text);
                lvi.Tag = allo;
                lvi.UseItemStyleForSubItems = true;
                lvi.Font = f;
            }
            m_lvAlloOptions.Font = f;
            // Get location to the stored values, if any.
            object locWnd = m_mediator.PropertyTable.GetValue("swapDlgLocation");
            // And when I do this, it works the first time, but later times the window is
            // too small and doesn't show all the controls. Give up on smart location for now.
            //object szWnd = this.Size;
            object szWnd = null;             // suppresses the smart location stuff.

            //if (locWnd != null && szWnd != null)
            //{
            //    Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd);
            //    ScreenUtils.EnsureVisibleRect(ref rect);
            //    DesktopBounds = rect;
            //    StartPosition = FormStartPosition.Manual;
            //}
            m_lvAlloOptions.Items[0].Selected = true;
            Text        = LexEdStrings.ksSwapLexWithAllo;
            label2.Text = LexEdStrings.ksAlternateForms;

            // Determine the help file to use, if any
            m_helpTopic = "khtpSwapLexemeWithAllomorph";

            if (m_mediator.HelpTopicProvider != null)
            {
                helpProvider = new HelpProvider();
                helpProvider.HelpNamespace = m_mediator.HelpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }
        }
예제 #5
0
        protected virtual void m_cbWritingSystems_SelectedIndexChanged(object sender, EventArgs e)
        {
            int start  = m_tbForm.SelectionStart;
            int length = m_tbForm.SelectionLength;

            m_tbForm.WritingSystemCode = ((ILgWritingSystem)m_cbWritingSystems.SelectedItem).Handle;
            // Change the writing system inside the ITsString.
            ITsStrBldr tsb = m_tbForm.Tss.GetBldr();
            int        cch = tsb.Length;

            tsb.SetIntPropValues(0, cch, (int)FwTextPropType.ktptWs, 0,
                                 m_tbForm.WritingSystemCode);
            m_tbForm.Tss = tsb.GetString();
            //we need to adjust the size of the box based on the changed writing system
            m_tbForm.AdjustForStyleSheet(this, m_panel1, m_tbForm.StyleSheet);
            // Restore the selection, whether IP or range.
            m_tbForm.Select(start, length);
            m_oldSearchKey = string.Empty;
            ResetMatches(m_tbForm.Text);
            m_tbForm.Select();
        }
 private void SetupAndShowHeaderPanel(Mediator mediator, XmlNode node, RecordBar treeBarControl)
 {
     if (!treeBarControl.HasHeaderControl)
     {
         m_titleBar = new PaneBar {
             Dock = DockStyle.Top
         };
         var headerPanel = new Panel {
             Visible = false
         };
         headerPanel.Controls.Add(m_titleBar);
         m_textSearch = CreateSearchBox();
         //m_textSearch.Dock = DockStyle.Fill;
         m_textSearch.Anchor = (AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right;
         headerPanel.Controls.Add(m_textSearch);
         m_textSearch.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromMediator(mediator));
         headerPanel.Height = SetHeaderPanelHeight();
         treeBarControl.AddHeaderControl(headerPanel);
         SetInfoBarText(node, m_titleBar);
     }
     treeBarControl.ShowHeaderControl();
 }
예제 #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize the dialog, based on the old matcher, if any, and if recognized.
		/// </summary>
		/// <param name="matcher">The matcher.</param>
		/// <param name="stylesheet">The stylesheet.</param>
		/// ------------------------------------------------------------------------------------
		public void SetDlgValues(IMatcher matcher, IVwStylesheet stylesheet)
		{
			CheckDisposed();

			// Figure out which kind to check
			if (matcher is AnywhereMatcher)
			{
				m_anywhereButton.Checked = true;
			}
			else if (matcher is EndMatcher)
			{
				m_atEndButton.Checked = true;
			}
			else if (matcher is BeginMatcher)
			{
				m_atStartButton.Checked = true;
			}
			else if (matcher is RegExpMatcher)
			{
				m_regExButton.Checked = true;
			}
			else if (matcher is ExactMatcher)
			{
				m_wholeItemButton.Checked = true;
			}

			// Now get the attributes
			if (matcher is SimpleStringMatcher)
			{
				SimpleStringMatcher ssMatcher = (matcher as SimpleStringMatcher);
				m_textBox.Tss = ssMatcher.Pattern.Pattern;
				m_MatchCasecheckBox.Checked = ssMatcher.Pattern.MatchCase;
				m_MatchDiacriticscheckBox.Checked = ssMatcher.Pattern.MatchDiacritics;
			}
			m_textBox.AdjustForStyleSheet(this, null, stylesheet);
		}