/// <summary> /// Initialize the dialog before showing it. /// </summary> /// <param name="cache"></param> /// <param name="entry"></param> /// <param name="titleForEdit">Edit title appropriate to the button's context.</param> public void SetDlgInfo(FdoCache cache, IPersistenceProvider persistProvider, Mediator mediator, ILexEntry entry, SandboxGenericMSA sandboxMsa, int hvoOriginalMsa, bool useForEdit, string titleForEdit) { CheckDisposed(); Debug.Assert(m_cache == null); MsaType msaType = sandboxMsa.MsaType; m_cache = cache; m_mediator = mediator; if (useForEdit) { // Change the window title and the OK button text. Text = titleForEdit; s_helpTopic = "khtpEditGrammaticalFunction"; btnOk.Text = LexText.Controls.LexTextControls.ks_OK; } helpProvider.HelpNamespace = mediator.HelpTopicProvider.HelpFile; helpProvider.SetHelpKeyword(this, mediator.HelpTopicProvider.GetHelpString(s_helpTopic)); helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); // Set font, writing system factory, and code for the edit box. float fntSize = label1.Font.Size * 2.0F; IWritingSystem defVernWs = m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem; m_fwtbCitationForm.Font = new Font(defVernWs.DefaultFontName, fntSize); m_fwtbCitationForm.WritingSystemFactory = m_cache.WritingSystemFactory; m_fwtbCitationForm.WritingSystemCode = defVernWs.Handle; m_fwtbCitationForm.AdjustForStyleSheet(this, null, mediator); m_fwtbCitationForm.AdjustStringHeight = false; m_fwtbCitationForm.Tss = entry.HeadWord; m_fwtbCitationForm.HasBorder = false; m_fwtbSenses.Font = new Font(defVernWs.DefaultFontName, fntSize); m_fwtbSenses.WritingSystemFactory = m_cache.WritingSystemFactory; m_fwtbSenses.WritingSystemCode = defVernWs.Handle; m_fwtbSenses.AdjustForStyleSheet(this, null, mediator); m_fwtbSenses.AdjustStringHeight = false; ITsIncStrBldr tisb = TsIncStrBldrClass.Create(); tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, m_cache.DefaultAnalWs); var msaRepository = m_cache.ServiceLocator.GetInstance <IMoMorphSynAnalysisRepository>(); if (hvoOriginalMsa != 0) { foreach (var sense in entry.AllSenses) { if (sense.MorphoSyntaxAnalysisRA != null) { if (sense.MorphoSyntaxAnalysisRA == msaRepository.GetObject(hvoOriginalMsa)) { if (tisb.Text != null) { tisb.Append(", "); // REVIEW: IS LOCALIZATION NEEDED FOR BUILDING THIS LIST? } tisb.AppendTsString(sense.ShortNameTSS); } } } } m_fwtbSenses.Tss = tisb.GetString(); m_fwtbSenses.HasBorder = false; m_msaGroupBox.Initialize(m_cache, m_mediator, this, sandboxMsa); int oldHeight = m_msaGroupBox.Height; int newHeight = Math.Max(oldHeight, m_msaGroupBox.PreferredHeight); int delta = newHeight - oldHeight; if (delta > 0) { m_msaGroupBox.AdjustInternalControlsAndGrow(); Debug.Assert(m_msaGroupBox.Height == m_msaGroupBox.PreferredHeight); FontHeightAdjuster.GrowDialogAndAdjustControls(this, delta, m_msaGroupBox); } if (mediator != null) { // Reset window location. // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue("msaCreatorDlgLocation"); // JohnT: this dialog can't be resized. So it doesn't make sense to // remember a size. If we do, we need to override OnLoad (as in SimpleListChooser) // to prevent the dialog growing every time at 120 dpi. But such an override // makes it too small to show all the controls at the default size. // It's better just to use the default size until it's resizeable for some reason. //m_mediator.PropertyTable.GetValue("msaCreatorDlgSize"); object szWnd = this.Size; if (locWnd != null && szWnd != null) { Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } } }
/// <summary> /// Constructor. /// </summary> private DummyGenericMSA(IMoUnclassifiedAffixMsa uncMsa) { m_type = MsaType.kUnclassified; m_mainPOS = uncMsa.PartOfSpeechRAHvo; }
/// <summary> /// Constructor. /// </summary> private DummyGenericMSA(IMoStemMsa stemMsa) { m_type = MsaType.kStem; m_mainPOS = stemMsa.PartOfSpeechRAHvo; m_fromPOSes = stemMsa.FromPartsOfSpeechRC; }
/// <summary> /// Constructor. /// </summary> private DummyGenericMSA(IMoInflAffMsa inflMsa) { m_type = MsaType.kInfl; m_mainPOS = inflMsa.PartOfSpeechRAHvo; //m_slot = inflMsa.SlotsRC; }
/// <summary> /// Constructor. /// </summary> private DummyGenericMSA(IMoDerivAffMsa derivMsa) { m_type = MsaType.kDeriv; m_mainPOS = derivMsa.FromPartOfSpeechRAHvo; m_secondaryPOS = derivMsa.ToPartOfSpeechRAHvo; }
/// <summary> /// Initialize the dialog. /// </summary> /// <param name="cache">The FDO cache to use.</param> /// <param name="morphType">The morpheme type</param> /// <param name="msaType">The type of msa</param> /// <param name="slot">The default slot of the inflectional affix msa to</param> /// <param name="mediator">The mediator.</param> /// <param name="filter">The filter.</param> public void SetDlgInfo(FdoCache cache, IMoMorphType morphType, MsaType msaType, IMoInflAffixSlot slot, Mediator mediator, MorphTypeFilterType filter) { CheckDisposed(); Mediator = mediator; SetDlgInfo(cache, morphType, 0, filter); m_msaGroupBox.MSAType = msaType; Slot = slot; }