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; }
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 void SetDlgInfo(FdoCache cache, Mediator mediator, ComplexConcMorphNode node) { m_cache = cache; m_mediator = mediator; m_node = node; m_formTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_formTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromMediator(mediator)); m_glossTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_glossTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromMediator(mediator)); m_entryTextBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_entryTextBox.AdjustForStyleSheet(FontHeightAdjuster.StyleSheetFromMediator(mediator)); m_categoryComboBox.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; foreach (IWritingSystem ws in m_cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems) { m_formWsComboBox.Items.Add(ws); m_entryWsComboBox.Items.Add(ws); } foreach (IWritingSystem 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, m_mediator, (Form)m_mediator.PropertyTable.GetValue("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 = m_mediator.HelpTopicProvider; m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile; m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic)); m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); }
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()); } } } }
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)); } }
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); }
/// <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> /// 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; }
/// <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); }
/// <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); }
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); } }
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)); }
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; }
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); }
/// <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); }
private void SetStyleSheet() { if (m_browseViewer == null || m_browseViewer.StyleSheet != null) { return; } m_browseViewer.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); }
/// <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); }
/// <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; IWritingSystemContainer wsContainer = m_cache.ServiceLocator.WritingSystems; IWritingSystem defVernWs = wsContainer.DefaultVernacularWritingSystem; IWritingSystem defAnalWs = wsContainer.DefaultAnalysisWritingSystem; m_fwtbCitationForm.Font = new Font(defVernWs.DefaultFontName, 10); m_fwtbGloss.Font = new Font(defAnalWs.DefaultFontName, 10); var stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); // 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, 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); }
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; }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> /// // cache, obj, flid, node, persistenceProvider, stringTbl public AtomicReferencePOSSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider, Mediator mediator) : base(new UserControl(), cache, obj, flid) { IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); IWritingSystem defAnalWs = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem; m_tree = new TreeCombo(); m_tree.WritingSystemFactory = cache.WritingSystemFactory; m_tree.WritingSystemCode = defAnalWs.Handle; m_tree.Font = new System.Drawing.Font(defAnalWs.DefaultFontName, 10); m_tree.StyleSheet = stylesheet; if (!Application.RenderWithVisualStyles) { m_tree.HasBorder = false; } // We embed the tree combo in a layer of UserControl, so it can have a fixed width // while the parent window control is, as usual, docked 'fill' to work with the splitter. m_tree.Dock = DockStyle.Left; m_tree.Width = 200; Control.Controls.Add(m_tree); if (m_pOSPopupTreeManager == null) { ICmPossibilityList list; int ws; if (obj is IReversalIndexEntry) { var rie = obj as IReversalIndexEntry; list = rie.ReversalIndex.PartsOfSpeechOA; ws = m_cache.ServiceLocator.WritingSystemManager.GetWsFromStr(rie.ReversalIndex.WritingSystem); } else { list = m_cache.LanguageProject.PartsOfSpeechOA; ws = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle; } m_tree.WritingSystemCode = ws; m_pOSPopupTreeManager = new POSPopupTreeManager(m_tree, m_cache, list, ws, false, mediator, (Form)mediator.PropertyTable.GetValue("window")); m_pOSPopupTreeManager.AfterSelect += m_pOSPopupTreeManager_AfterSelect; } try { m_handlingMessage = true; m_pOSPopupTreeManager.LoadPopupTree(POS == null ? 0 : POS.Hvo); } finally { m_handlingMessage = false; } Control.Height = m_tree.PreferredHeight; // m_tree has sensible PreferredHeight once the text is set, UserControl does not. // we need to set the Height after m_tree.Text has a value set to it. }
public void SetDlgInfo(FdoCache cache, XCore.Mediator mediator) { CheckDisposed(); m_fs = null; RestoreWindowPosition(mediator); m_cache = cache; m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_valuesCombo.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); LoadPhonFeats(null); BuildInitialBrowseView(mediator); }
public void Initialize(IEnumerable <ObjectLabel> labels, IEnumerable <ICmObject> selectedItems) { m_semdomRepo = Cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>(); m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(Mediator); m_selectedItems.UnionWith(selectedItems); UpdateDomainTreeAndListLabels(labels); searchTextBox.WritingSystemFactory = Cache.LanguageWritingSystemFactoryAccessor; searchTextBox.AdjustForStyleSheet(m_stylesheet); m_SearchTimer = new SearchTimer(this, 500, SearchSemanticDomains, new List <Control> { domainTree, domainList }); searchTextBox.TextChanged += m_SearchTimer.OnSearchTextChanged; }
/// <summary> /// Init the dialog with a PhPhoneme (or PhNCFeatures) and flid that does not yet contain a feature structure. /// </summary> /// <param name="cache"></param> /// <param name="mediator"></param> /// <param name="cobj"></param> /// <param name="owningFlid"></param> public void SetDlgInfo(FdoCache cache, Mediator mediator, ICmObject cobj, int owningFlid) { CheckDisposed(); m_fs = null; m_owningFlid = owningFlid; m_hvoOwner = cobj.Hvo; Mediator = mediator; m_cache = cache; m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_valuesCombo.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); LoadPhonFeats(null); BuildInitialBrowseView(mediator); }
/// <summary> /// Init the dialog with an existing FS. /// </summary> /// <param name="cache"></param> /// <param name="mediator"></param> /// <param name="fs"></param> public void SetDlgInfo(FdoCache cache, XCore.Mediator mediator, IFsFeatStruc fs) { CheckDisposed(); m_fs = fs; m_owningFlid = fs.OwningFlid; m_hvoOwner = fs.OwnerHVO; RestoreWindowPosition(mediator); m_cache = cache; m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_valuesCombo.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); LoadPhonFeats(fs); BuildInitialBrowseView(mediator); }
private void SetDlgInfo(FdoCache cache, Mediator mediator, int hvoOwner, int owningFlid, IFsFeatStruc fs, IPhRegularRule rule, IPhSimpleContextNC ctxt) { m_fs = fs; m_owningFlid = owningFlid; m_hvoOwner = hvoOwner; m_rule = rule; m_ctxt = ctxt; Mediator = mediator; m_cache = cache; m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_valuesCombo.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); LoadPhonFeats(m_fs); BuildInitialBrowseView(mediator); }
protected override void InitializeMatchingObjects(FdoCache cache, Mediator mediator) { var xnWindow = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration"); XmlNode configNode = xnWindow.SelectSingleNode("controls/parameters/guicontrol[@id=\"matchingEntries\"]/parameters"); var selectedWs = (IWritingSystem)m_cbWritingSystems.SelectedItem; var wsSearch = selectedWs != null ? selectedWs.Handle : 0; m_searchFieldGetter = new EntrySearchFieldGetter { AnalHvos = m_analHvos, VernHvos = m_vernHvos, SearchWs = wsSearch }; m_matchingObjectsBrowser.Initialize(cache, FontHeightAdjuster.StyleSheetFromMediator(mediator), mediator, configNode, cache.ServiceLocator.GetInstance <ILexEntryRepository>().AllInstances().Cast <ICmObject>(), SearchType.Prefix, m_searchFieldGetter.GetEntrySearchFields); }
/// <summary> /// Override method to add suitable control. /// </summary> public override void FinishInit() { CheckDisposed(); Debug.Assert(m_cache != null); base.FinishInit(); //We need to set the Font so the height of this slice will be //set appropriately to fit the text. IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(Mediator); int fontHeight = FontHeightAdjuster.GetFontHeightForStyle( "Normal", stylesheet, m_cache.DefaultVernWs, m_cache.LanguageWritingSystemFactoryAccessor); Font = new Font(m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.DefaultFontName, fontHeight / 1000f); }
internal override void Init(Mediator mediator, XmlNode node) { base.Init(mediator, node); m_semDomRepo = m_cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>(); m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); var treeBarControl = GetTreeBarControl(mediator); SetupAndShowHeaderPanel(node, treeBarControl); m_searchTimer = new SearchTimer(treeBarControl, 500, HandleChangeInSearchText, new List <Control> { treeBarControl.TreeView, treeBarControl.ListView }); m_textSearch.TextChanged += m_searchTimer.OnSearchTextChanged; m_treeView = treeBarControl.TreeView; m_listView = treeBarControl.ListView; m_listView.HeaderStyle = ColumnHeaderStyle.None; // We don't want a secondary "Records" title bar }
public override void MakeRoot() { CheckDisposed(); base.MakeRoot(); if (m_fdoCache == null || DesignMode) { return; } m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_rootb.DataAccess = m_fdoCache.MainCacheAccessor; m_fdoCache.MainCacheAccessor.RemoveNotification(m_rootb); if (m_obj != null) { m_rootb.SetRootObject(m_obj.Hvo, m_vc, m_rootFrag, FontHeightAdjuster.StyleSheetFromMediator(m_mediator)); } }