예제 #1
0
        /// <summary>
        /// Gets the font height of the specified writing system for the normal style.
        /// </summary>
        protected int GetFontHeight(int ws)
        {
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);

            return(FontHeightAdjuster.GetFontHeightForStyle("Normal", stylesheet,
                                                            ws, m_cache.LanguageWritingSystemFactoryAccessor));
        }
예제 #2
0
        public override void MakeRoot()
        {
            CheckDisposed();
            base.MakeRoot();

            if (m_fdoCache == null || DesignMode)
            {
                return;
            }

            m_rootb = VwRootBoxClass.Create();
            // the default value of 4 for MaxParasToScan isn't high enough when using the arrow keys to move
            // the cursor between items in a rule when the number of lines in the rule is high, since there might
            // be a large number of non-editable empty lines in a pile
            m_rootb.MaxParasToScan = 10;
            m_rootb.SetSite(this);
            m_rootb.DataAccess = m_sda;
            // JohnT: this notification removal was introduced by Damien in change list 25875, along with removing
            // several IgnorePropChanged wrappers in RuleFormulaControl. I don't know why we ever wanted to not see
            // (some) PropChanged messages, but ignoring them all prevents us from removing inserted items from the
            // view in Undo. (see FWR-3501)
            //m_fdoCache.MainCacheAccessor.RemoveNotification(m_rootb);
            if (m_hvo != 0)
            {
                m_rootb.SetRootObject(m_hvo, m_vc, m_rootFrag, FontHeightAdjuster.StyleSheetFromMediator(m_mediator));
            }
        }
예제 #3
0
        private string GetNormalStyleFontSize(int ws)
        {
            ILgWritingSystemFactory wsf = Cache.WritingSystemFactory;

            using (Font myFont = FontHeightAdjuster.GetFontForNormalStyle(ws, m_mediator, wsf))
                return(myFont.Size + "pt");
        }
        /// <summary>
        /// Init the dialog with a simple context.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="fs"></param>
        public void SetDlgInfo(FdoCache cache, XCore.Mediator mediator, IPhRegularRule rule, IPhSimpleContextNC ctxt)
        {
            CheckDisposed();

            m_rule = rule;
            m_ctxt = ctxt;
            RestoreWindowPosition(mediator);
            m_cache = cache;

            m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_valuesCombo.StyleSheet           = FontHeightAdjuster.StyleSheetFromMediator(mediator);
            m_valuesCombo.WritingSystemCode    = m_cache.DefaultUserWs;
            m_valuesCombo.Items.Add(MEStrings.ksFeatConstrAgree);
            m_valuesCombo.Items.Add(MEStrings.ksFeatConstrDisagree);
            m_valuesCombo.Items.Add(MEStrings.ks_DontCare_);

            List <int>    hvos     = new List <int>();
            IPhNCFeatures natClass = m_ctxt.FeatureStructureRA as IPhNCFeatures;

            foreach (int hvo in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC.HvoArray)
            {
                if (natClass.FeaturesOAHvo == 0 || natClass.FeaturesOA.FindClosedValue(hvo) == null)
                {
                    hvos.Add(hvo);
                }
            }
            LoadPhonFeats(hvos);
            BuildInitialBrowseView(mediator, hvos);
        }
예제 #5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initialize this as an IxCoreColleague
        /// </summary>
        /// <param name="mediator"></param>
        /// <param name="configurationParameters"></param>
        /// ------------------------------------------------------------------------------------
        public override void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            InitBase(mediator, configurationParameters);

            m_showDescendantInRoot = XmlUtils.GetOptionalBooleanAttributeValue(configurationParameters, "showDescendantInRoot", false);

            // retrieve persisted clerk index and set it.
            int idx = m_mediator.PropertyTable.GetIntProperty(Clerk.PersistedIndexProperty, -1, PropertyTable.SettingsGroup.LocalSettings);
            int lim = Clerk.ListSize;

            if (idx >= 0 && idx < lim)
            {
                int idxOld = Clerk.CurrentIndex;
                try
                {
                    Clerk.JumpToIndex(idx);
                }
                catch
                {
                    if (lim > idxOld && lim > 0)
                    {
                        Clerk.JumpToIndex(idxOld >= 0 ? idxOld : 0);
                    }
                }
            }

            // If possible make it use the style sheet appropriate for its main window.
            m_dataEntryForm.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
            m_fullyInitialized         = true;
        }
예제 #6
0
        private void AdjustControlAndDialogHeight(Control control, int preferredHeight)
        {
            int tbNewHeight = Math.Max(preferredHeight, control.Height);

            FontHeightAdjuster.GrowDialogAndAdjustControls(this, tbNewHeight - control.Height, control);
            control.Height = tbNewHeight;
        }
예제 #7
0
        /// <summary>
        /// Gets the font height of the specified writing system for the normal style.
        /// </summary>
        /// <param name="ws">The ws.</param>
        /// <returns></returns>
        int GetFontHeight(int ws)
        {
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);

            return(FontHeightAdjuster.GetFontHeightForStyle("Normal", stylesheet,
                                                            ws, m_cache.LanguageWritingSystemFactoryAccessor));
        }
        /// <summary>
        /// Init the dialog with a simple context.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="fs"></param>
        public void SetDlgInfo(FdoCache cache, XCore.Mediator mediator, IPhRegularRule rule, IPhSimpleContextNC ctxt)
        {
            CheckDisposed();

            m_rule   = rule;
            m_ctxt   = ctxt;
            Mediator = mediator;
            m_cache  = cache;

            m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_valuesCombo.StyleSheet           = FontHeightAdjuster.StyleSheetFromMediator(mediator);
            m_valuesCombo.WritingSystemCode    = m_cache.DefaultUserWs;
            m_valuesCombo.Items.Add(MEStrings.ksFeatConstrAgree);
            m_valuesCombo.Items.Add(MEStrings.ksFeatConstrDisagree);
            m_valuesCombo.Items.Add(MEStrings.ks_DontCare_);

            var feats    = new HashSet <IFsFeatDefn>();
            var natClass = m_ctxt.FeatureStructureRA as IPhNCFeatures;

            foreach (var feat in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC)
            {
                if (natClass.FeaturesOA == null || natClass.FeaturesOA.GetValue(feat as IFsClosedFeature) == null)
                {
                    feats.Add(feat);
                }
            }
            LoadPhonFeats(feats);
            BuildInitialBrowseView(mediator, feats);
        }
예제 #9
0
        private void BuildInitialBrowseView(XCore.Mediator mediator)
        {
            XmlNode configurationParameters =
                (XmlNode)mediator.PropertyTable.GetValue("WindowConfiguration");
            XmlNode toolNode = configurationParameters.SelectSingleNode(
                "controls/parameters/guicontrol[@id='PhonologicalFeaturesFlatList']/parameters");

            m_listPanel.SuspendLayout();
            m_fakeFlid = FdoCache.DummyFlid;
            IVwCacheDa cda = m_cache.MainCacheAccessor as IVwCacheDa;

            int[] featureHvos = m_cache.LangProject.PhFeatureSystemOA.FeaturesOC.HvoArray;
            cda.CacheVecProp(m_cache.LangProject.Hvo, m_fakeFlid, featureHvos, featureHvos.Length);
            m_bvList = new BrowseViewer(toolNode, m_cache.LangProject.Hvo, m_fakeFlid, m_cache, mediator, null);
            m_bvList.SelectionChanged       += new FwSelectionChangedEventHandler(m_bvList_SelectionChanged);
            m_bvList.ScrollBar.ValueChanged += new EventHandler(ScrollBar_ValueChanged);
            m_bvList.Scroller.Scroll        += new ScrollEventHandler(ScrollBar_Scroll);
            m_bvList.ColumnsChanged         += new EventHandler(BrowseViewer_ColumnsChanged);
            m_bvList.Resize    += new EventHandler(m_bvList_Resize);
            m_bvList.TabStop    = true;
            m_bvList.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
            m_bvList.Dock       = DockStyle.Fill;
            m_bvList.BackColor  = SystemColors.Window;
            m_listPanel.Controls.Add(m_bvList);
            m_listPanel.ResumeLayout(false);
        }
        public PossibilityAutoComplete(FdoCache cache, Mediator mediator, ICmPossibilityList list, Control control,
                                       string displayNameProperty, string displayWs)
        {
            m_cache               = cache;
            m_mediator            = mediator;
            m_control             = control;
            m_displayNameProperty = displayNameProperty;
            m_displayWs           = displayWs;

            m_listBox = new ComboListBox {
                DropDownStyle = ComboBoxStyle.DropDownList, ActivateOnShow = false
            };
            m_listBox.SelectedIndexChanged += HandleSelectedIndexChanged;
            m_listBox.SameItemSelected     += HandleSameItemSelected;
            m_listBox.StyleSheet            = FontHeightAdjuster.StyleSheetFromMediator(mediator);
            m_listBox.WritingSystemFactory  = cache.WritingSystemFactory;
            m_searcher      = new StringSearcher <ICmPossibility>(SearchType.Prefix, cache.ServiceLocator.WritingSystemManager);
            m_possibilities = new List <ICmPossibility>();
            var stack = new Stack <ICmPossibility>(list.PossibilitiesOS);

            while (stack.Count > 0)
            {
                ICmPossibility poss = stack.Pop();
                m_possibilities.Add(poss);
                foreach (ICmPossibility child in poss.SubPossibilitiesOS)
                {
                    stack.Push(child);
                }
            }

            m_control.KeyDown  += HandleKeyDown;
            m_control.KeyPress += HandleKeyPress;
        }
예제 #11
0
        private string GetNormalStyleFontSize(int ws)
        {
            ILgWritingSystemFactory wsf = Cache.LanguageWritingSystemFactoryAccessor;
            Font myFont = FontHeightAdjuster.GetFontForNormalStyle(ws, m_mediator, wsf);

            return(myFont.Size.ToString() + "pt");
        }
예제 #12
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);
        }
예제 #13
0
        /// <summary>
        /// Launch the configure dialog.
        /// </summary>
        /// <param name="commandObject"></param>
        /// <returns></returns>
        public bool OnConfigureXmlDocView(object commandObject)
        {
            CheckDisposed();
            string sProp = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layoutProperty");

            if (String.IsNullOrEmpty(sProp))
            {
                sProp = "DictionaryPublicationLayout";
            }
            using (var dlg = new XmlDocConfigureDlg())
            {
                dlg.SetConfigDlgInfo(m_configurationParameters, Cache, FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable),
                                     FindForm() as IMainWindowDelegateCallbacks, m_mediator, m_propertyTable, sProp);
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    // LT-8767 When this dialog is launched from the Configure Dictionary View dialog
                    // m_mediator != null && m_rootSite == null so we need to handle this to prevent a crash.
                    if (m_mediator != null && m_rootSite != null)
                    {
                        (m_rootSite as XmlDocItemView).ResetTables(GetLayoutName(m_configurationParameters, m_mediator, m_propertyTable));
                    }
                }
                if (dlg.MasterRefreshRequired)
                {
                    m_mediator.SendMessage("MasterRefresh", null);
                }
                return(true);                // we handled it
            }
        }
예제 #14
0
        public void showProperties()
        {
            CheckDisposed();
            var pic = (ICmPicture)Object;
            var app = (IApp)m_mediator.PropertyTable.GetValue("App");

            using (var dlg = new PicturePropertiesDialog(m_cache, pic, m_mediator.HelpTopicProvider, app, true))
            {
                if (dlg.Initialize())
                {
                    var stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
                    dlg.UseMultiStringCaption(m_cache, WritingSystemServices.kwsVernAnals, stylesheet);
                    dlg.SetMultilingualCaptionValues(pic.Caption);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        UndoableUnitOfWorkHelper.Do(DetailControlsStrings.ksUndoUpdatePicture, DetailControlsStrings.ksRedoUpdatePicture, m_obj, () =>
                        {
                            string strLocalPictures = CmFolderTags.DefaultPictureFolder;
                            dlg.GetMultilingualCaptionValues(pic.Caption);
                            pic.UpdatePicture(dlg.CurrentFile, null, strLocalPictures, 0);
                        });
                        InstallPicture(m_picBox);
                        m_lastSize = new Size(0, 0);                         // forces OnSizeChanged to do something (we need to adjust to new aspect ratio).
                        OnSizeChanged(new EventArgs());
                    }
                }
            }
        }
        private void BuildInitialBrowseView(Mediator mediator)
        {
            var     configurationParameters = (XmlNode)mediator.PropertyTable.GetValue("WindowConfiguration");
            XmlNode toolNode = configurationParameters.SelectSingleNode(
                "controls/parameters/guicontrol[@id='PhonologicalFeaturesFlatList']/parameters");

            m_listPanel.SuspendLayout();
            var sortedFeatureHvos = from s in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC
                                    orderby s.Name.BestAnalysisAlternative.Text
                                    select s.Hvo;

            int[] featureHvos = sortedFeatureHvos.ToArray();
            m_sda.CacheVecProp(m_cache.LangProject.Hvo, featureHvos);
            m_bvList = new BrowseViewer(toolNode, m_cache.LangProject.Hvo, PhonologicalFeaturePublisher.ListFlid, m_cache, mediator, null, m_sda);
            m_bvList.SelectionChanged       += m_bvList_SelectionChanged;
            m_bvList.ScrollBar.ValueChanged += ScrollBar_ValueChanged;
            m_bvList.Scroller.Scroll        += ScrollBar_Scroll;
            m_bvList.ColumnsChanged         += BrowseViewer_ColumnsChanged;
            m_bvList.Resize    += m_bvList_Resize;
            m_bvList.TabStop    = true;
            m_bvList.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
            m_bvList.Dock       = DockStyle.Fill;
            m_bvList.BackColor  = SystemColors.Window;
            m_listPanel.Controls.Add(m_bvList);
            m_listPanel.ResumeLayout(false);
        }
예제 #16
0
        private void LaunchFwContextMenu(Point ptLoc)
        {
            if (m_rgfmi == null || m_rgfmi.Count == 0)
            {
                return;
            }
            m_fConstructingMenu = true;
            if (m_clb == null)
            {
                m_clb = new ComboListBox();
                m_clb.SelectedIndexChanged += new EventHandler(HandleFwMenuSelection);
                m_clb.SameItemSelected     += new EventHandler(HandleFwMenuSelection);
                // Since we may initialize with TsStrings, need to set WSF.
                m_clb.WritingSystemFactory = Cache.LanguageWritingSystemFactoryAccessor;
                m_clb.DropDownStyle        = ComboBoxStyle.DropDownList;          // Prevents direct editing.
                m_clb.StyleSheet           = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
            }
            m_clb.Items.Clear();
            for (int i = 0; i < m_rgfmi.Count; ++i)
            {
                if (m_rgfmi[i].Enabled)
                {
                    m_clb.Items.Add(m_rgfmi[i].Label);
                }
            }
            AdjustListBoxSize();
            m_clb.AdjustSize(500, 400);             // these are maximums!
            m_clb.SelectedIndex = 0;
            Rectangle boundsLauncher = new Rectangle(ptLoc, new Size(10, 10));
            Rectangle boundsScreen   = Screen.GetWorkingArea(m_inflAffixTemplateCtrl);

            m_fConstructingMenu = false;
            m_clb.Launch(boundsLauncher, boundsScreen);
        }
예제 #17
0
        /// <summary>
        /// Creates a ListViewItem for the given ICmObject
        /// </summary>
        /// <param name="semDom">A Semantic Domain</param>
        /// <param name="stylesheet"></param>
        /// <param name="createChecked"></param>
        /// <param name="displayUsage"></param>
        /// <returns></returns>
        public static ListViewItem CreateLabelListItem(ICmObject semDom, IVwStylesheet stylesheet, bool createChecked, bool displayUsage)
        {
            var semanticDomainItem = semDom as ICmSemanticDomain;

            if (semanticDomainItem == null)
            {
                return(new ListViewItem(DetailControlsStrings.ksSemanticDomainInvalid));
            }
            var strbldr = new StringBuilder(semanticDomainItem.AbbrAndName);

            if (semanticDomainItem.OwningPossibility != null)
            {
                var parentName = semanticDomainItem.OwningPossibility.Name.BestAnalysisAlternative.Text;
                strbldr.AppendFormat(" [{0}]", parentName);
            }
            if (displayUsage)
            {
                var count = SenseReferenceCount(semanticDomainItem);
                if (count > 0)
                {
                    strbldr.AppendFormat(" ({0})", count);
                }
            }

            var item = new ListViewItem(strbldr.ToString())
            {
                Checked = createChecked, Tag = semanticDomainItem.Hvo
            };
            var cache = semDom.Cache;

            item.Font = FontHeightAdjuster.GetFontForNormalStyle(cache.DefaultAnalWs, stylesheet, cache);
            return(item);
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            FwRegistrySettings.Init();
            m_application = new MockFwXApp(new MockFwManager {
                Cache = Cache
            }, null, null);
            var configFilePath = Path.Combine(FwDirectoryFinder.CodeDirectory, m_application.DefaultConfigurationPathname);

            m_window = new MockFwXWindow(m_application, configFilePath);
            ((MockFwXWindow)m_window).Init(Cache);             // initializes Mediator values
            m_mediator = m_window.Mediator;
            m_mediator.AddColleague(new StubContentControlProvider());
            m_window.LoadUI(configFilePath);
            // set up clerk to allow DictionaryPublicationDecorator to be created during the UploadToWebonaryController driven export
            const string reversalIndexClerk = @"<?xml version='1.0' encoding='UTF-8'?>
			<root>
				<clerks>
					<clerk id='entries'>
						<recordList owner='LexDb' property='Entries'/>
					</clerk>
				</clerks>
				<tools>
					<tool label='Dictionary' value='lexiconDictionary' icon='DocumentView'>
						<control>
							<dynamicloaderinfo assemblyPath='xWorks.dll' class='SIL.FieldWorks.XWorks.XhtmlDocView'/>
							<parameters area='lexicon' clerk='entries' layout='Bartholomew' layoutProperty='DictionaryPublicationLayout' editable='false' configureObjectName='Dictionary'/>
						</control>
					</tool>
				</tools>
			</root>"            ;
            var          doc = new XmlDocument();

            doc.LoadXml(reversalIndexClerk);
            XmlNode clerkNode = doc.SelectSingleNode("//tools/tool[@label='Dictionary']//parameters[@area='lexicon']");

            m_Clerk = RecordClerkFactory.CreateClerk(m_mediator, clerkNode, false);
            m_mediator.PropertyTable.SetProperty("ActiveClerk", m_Clerk);
            m_mediator.PropertyTable.SetProperty("ToolForAreaNamed_lexicon", "lexiconDictionary");
            Cache.ProjectId.Path = Path.Combine(FwDirectoryFinder.SourceDirectory, "xWorks/xWorksTests/TestData/");
            // setup style sheet and style to allow the css to generate during the UploadToWebonaryController driven export
            m_styleSheet  = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
            m_owningTable = new StyleInfoTable("AbbySomebody", (IWritingSystemManager)Cache.WritingSystemFactory);
            var fontInfo     = new FontInfo();
            var letHeadStyle = new TestStyle(fontInfo, Cache)
            {
                Name = CssGenerator.LetterHeadingStyleName, IsParagraphStyle = false
            };
            var dictNormStyle = new TestStyle(fontInfo, Cache)
            {
                Name = CssGenerator.DictionaryNormal, IsParagraphStyle = true
            };

            m_styleSheet.Styles.Add(letHeadStyle);
            m_styleSheet.Styles.Add(dictNormStyle);
            m_owningTable.Add(CssGenerator.LetterHeadingStyleName, letHeadStyle);
            m_owningTable.Add(CssGenerator.DictionaryNormal, dictNormStyle);
        }
        /// <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);
            }
        }
예제 #20
0
        /// <summary>
        /// Save the configuration parameters in case we want to use them locally.
        /// </summary>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="configurationParameters"></param>
        public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters)
        {
            CheckDisposed();

            base.Init(mediator, propertyTable, configurationParameters);
            m_configurationParameters = configurationParameters;
            m_clerk      = ToolConfiguration.FindClerk(m_propertyTable, m_configurationParameters);
            m_styleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
        }
        protected override void InitializeMatchingObjects(FdoCache cache, Mediator mediator)
        {
            var     xnWindow   = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration");
            XmlNode configNode = xnWindow.SelectSingleNode("controls/parameters/guicontrol[@id=\"matchingReversalEntries\"]/parameters");

            m_matchingObjectsBrowser.Initialize(cache, FontHeightAdjuster.StyleSheetFromMediator(mediator), mediator, configNode,
                                                ReversalIndex.AllEntries.Cast <ICmObject>(), SearchType.Prefix,
                                                GetReversalEntrySearchFields, m_cache.ServiceLocator.WritingSystemManager.Get(m_reveralIndex.WritingSystem));
        }
예제 #22
0
 // Grow the dialog's height by delta.
 // Adjust any controls that need it.
 // (Duplicated in BaseGoDlg...)
 private void GrowDialogAndAdjustControls(int delta, Control grower)
 {
     if (delta == 0)
     {
         return;
     }
     m_delta += delta;
     FontHeightAdjuster.GrowDialogAndAdjustControls(this, delta, grower);
 }
예제 #23
0
        private void SetStyleSheet()
        {
            if (m_browseViewer == null || m_browseViewer.StyleSheet != null)
            {
                return;
            }

            m_browseViewer.StyleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);
        }
예제 #24
0
        public void SetDlgInfo(CmObjectUi obj, FdoCache cache, XCore.Mediator mediator)
        {
            CheckDisposed();

            StringTable strings = mediator.StringTbl;

            m_cache = cache;
            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);

            Debug.Assert(obj != null);
            Debug.Assert(obj.Object != null);

            Text = String.Format(FdoUiStrings.ksDeleteX, strings.GetString(obj.ClassName, "ClassNames"));

            // Set the s_helpTopic based on the window title and rearrange the buttons if neccesary
            switch (obj.ClassName)
            {
            case "WfiWordform":
                s_helpTopic = "khtpDeleteWordform";
                break;
            }
            if (s_helpTopic != null)
            {
                buttonHelp.Visible = true;
                buttonHelp.Enabled = true;
                this.helpProvider  = new System.Windows.Forms.HelpProvider();
                this.helpProvider.HelpNamespace = FwApp.App.HelpFile;
                this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0));
                this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
            }
            else
            {
                m_deleteButton.Location = m_cancelButton.Location;
                m_cancelButton.Location = buttonHelp.Location;
            }

            //Use an FWTextBox so that strings of different writing systems will
            //be displayed with the correct stylesheet settings.
            m_descriptionBox3.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_descriptionBox3.WritingSystemCode    = m_cache.LangProject.DefaultUserWritingSystem;
            m_descriptionBox3.StyleSheet           = stylesheet;
            ITsIncStrBldr tisb3 = TsIncStrBldrClass.Create();

            tisb3.AppendTsString(obj.Object.DeletionTextTSS);
            m_descriptionBox3.Tss = tisb3.GetString();

            m_descriptionBox4.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_descriptionBox4.WritingSystemCode    = m_cache.LangProject.DefaultUserWritingSystem;
            m_descriptionBox4.StyleSheet           = stylesheet;
            ITsIncStrBldr tisb4 = TsIncStrBldrClass.Create();

            tisb4.AppendTsString(m_cache.MakeUserTss(" "));             //this is the default for m_descriptionBox4
            m_descriptionBox4.Tss = tisb4.GetString();

            m_deleteButton.Enabled = obj.Object.CanDelete;
            label2.Visible         = m_deleteButton.Enabled;
        }
예제 #25
0
        protected override void InitializeMatchingObjects(FdoCache cache, Mediator mediator)
        {
            var xnWindow   = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration");
            var configNode = xnWindow.SelectSingleNode("controls/parameters/guicontrol[@id=\"WordformsBrowseView\"]/parameters");

            m_matchingObjectsBrowser.Initialize(cache, FontHeightAdjuster.StyleSheetFromMediator(mediator), mediator, configNode,
                                                cache.ServiceLocator.GetInstance <IWfiWordformRepository>().AllInstances().Cast <ICmObject>(), SearchType.Prefix,
                                                GetWordformSearchFields);
        }
예제 #26
0
        private void SetStyleSheet()
        {
            if (m_browseViewer == null || m_browseViewer.StyleSheet != null)
            {
                return;
            }

            m_browseViewer.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
        }
예제 #27
0
        /// <summary>
        /// Save the configuration parameters in case we want to use them locally.
        /// </summary>
        /// <param name="mediator"></param>
        /// <param name="configurationParameters"></param>
        public override void Init(Mediator mediator, System.Xml.XmlNode configurationParameters)
        {
            CheckDisposed();

            base.Init(mediator, configurationParameters);
            m_configurationParameters = configurationParameters;
            m_clerk      = ToolConfiguration.FindClerk(m_mediator, m_configurationParameters);
            m_styleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
        }
예제 #28
0
        /// <summary>
        /// This sets the original citation form into the dialog.
        /// </summary>
        /// <param name="sWord"></param>
        /// <param name="sMorphs"></param>
        public void SetDlgInfo(ITsString tssCitationForm, ILexEntry le, Mediator mediator)
        {
            CheckDisposed();

            Debug.Assert(tssCitationForm != null);
            Debug.Assert(le != null);

            m_le       = le;
            m_cache    = le.Cache;
            m_mediator = mediator;

            m_fwtbCitationForm.Font =
                new Font(m_cache.LangProject.DefaultVernacularWritingSystemFont, 10);
            m_fwtbGloss.Font = new Font(m_cache.LangProject.DefaultAnalysisWritingSystemFont, 10);

            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);

            // Set writing system factory and code for the two edit boxes.
            m_fwtbCitationForm.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_fwtbCitationForm.WritingSystemCode    =
                m_cache.LangProject.DefaultVernacularWritingSystem;
            m_fwtbCitationForm.StyleSheet         = stylesheet;
            m_fwtbCitationForm.AdjustStringHeight = false;
            m_fwtbGloss.WritingSystemFactory      = m_cache.LanguageWritingSystemFactoryAccessor;
            m_fwtbGloss.WritingSystemCode         = m_cache.LangProject.DefaultAnalysisWritingSystem;
            m_fwtbGloss.StyleSheet         = stylesheet;
            m_fwtbGloss.AdjustStringHeight = false;
            m_fwtbCitationForm.Tss         = tssCitationForm;
            m_fwtbGloss.Text             = String.Empty;
            m_fwtbCitationForm.HasBorder = false;

            m_msaGroupBox.Initialize(m_cache, mediator, this, new DummyGenericMSA());

            // get the current morph type from the lexical entry.
            IMoMorphType mmt = null;

            foreach (IMoForm mf in le.AlternateFormsOS)
            {
                mmt = mf.MorphTypeRA;
                if (mmt != null)
                {
                    m_msaGroupBox.MorphTypePreference = mmt;
                    break;                     // Assume the first allomorph's type is good enough.
                }
            }

            m_skipCheck        = true;
            m_cbIsStem.Checked = (m_msaGroupBox.MSAType == MsaType.kRoot || m_msaGroupBox.MSAType == MsaType.kStem);
            m_skipCheck        = false;

            // Adjust sizes of the two FwTextBoxes if needed, and adjust the locations for the
            // controls below them.  Do the same for the MSAGroupBox.
            AdjustHeightAndPositions(m_fwtbCitationForm);
            AdjustHeightAndPositions(m_fwtbGloss);
            AdjustHeightAndPositions(m_msaGroupBox);
        }
예제 #29
0
        /// <summary>
        /// This sets the original citation form into the dialog.
        /// </summary>
        /// <param name="tssCitationForm"></param>
        /// <param name="le"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        public void SetDlgInfo(ITsString tssCitationForm, ILexEntry le, Mediator mediator, XCore.PropertyTable propertyTable)
        {
            CheckDisposed();

            Debug.Assert(tssCitationForm != null);
            Debug.Assert(le != null);

            m_le    = le;
            m_cache = le.Cache;

            IWritingSystemContainer     wsContainer = m_cache.ServiceLocator.WritingSystems;
            CoreWritingSystemDefinition defVernWs   = wsContainer.DefaultVernacularWritingSystem;
            CoreWritingSystemDefinition defAnalWs   = wsContainer.DefaultAnalysisWritingSystem;

            m_fwtbCitationForm.Font = new Font(defVernWs.DefaultFontName, 10);
            m_fwtbGloss.Font        = new Font(defAnalWs.DefaultFontName, 10);
            var stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable);

            // Set writing system factory and code for the two edit boxes.
            m_fwtbCitationForm.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_fwtbCitationForm.WritingSystemCode    = defVernWs.Handle;
            m_fwtbCitationForm.StyleSheet           = stylesheet;
            m_fwtbCitationForm.AdjustStringHeight   = false;
            m_fwtbGloss.WritingSystemFactory        = m_cache.WritingSystemFactory;
            m_fwtbGloss.WritingSystemCode           = defAnalWs.Handle;
            m_fwtbGloss.StyleSheet         = stylesheet;
            m_fwtbGloss.AdjustStringHeight = false;
            m_fwtbCitationForm.Tss         = tssCitationForm;
            m_fwtbGloss.Text             = String.Empty;
            m_fwtbCitationForm.HasBorder = false;

            m_msaGroupBox.Initialize(m_cache, mediator, propertyTable, this, new SandboxGenericMSA());

            // get the current morph type from the lexical entry.
            IMoMorphType mmt;

            foreach (var mf in le.AlternateFormsOS)
            {
                mmt = mf.MorphTypeRA;
                if (mmt != null)
                {
                    m_msaGroupBox.MorphTypePreference = mmt;
                    break;                     // Assume the first allomorph's type is good enough.
                }
            }

            m_skipCheck = true;
            m_skipCheck = false;

            // Adjust sizes of the two FwTextBoxes if needed, and adjust the locations for the
            // controls below them.  Do the same for the MSAGroupBox.
            AdjustHeightAndPositions(m_fwtbCitationForm);
            AdjustHeightAndPositions(m_fwtbGloss);
            AdjustHeightAndPositions(m_msaGroupBox);
        }
예제 #30
0
 private void CustomListDlg_Load(object sender, EventArgs e)
 {
     if (m_mediator != null && m_mediator.HelpTopicProvider != null)
     {
         InitializeHelpProvider();
     }
     m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
     InitializeMultiStringControls();
     InitializeDialogFields();
     m_finSetup = false;
 }