/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> public void SetDlgInfo(FdoCache cache, Mediator mediator, WindowParams wp, DummyCmObject mainObj, List<DummyCmObject> mergeCandidates, string guiControl, string helpTopic) { CheckDisposed(); Debug.Assert(cache != null); m_mediator = mediator; m_cache = cache; m_mainObj = mainObj; m_tsf = cache.TsStrFactory; m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory; m_fwTextBoxBottomMsg.WritingSystemCode = m_cache.WritingSystemFactory.UserWs; InitBrowseView(guiControl, mergeCandidates); Text = wp.m_title; label2.Text = wp.m_label; m_helpTopic = helpTopic; if(m_helpTopic != null && m_helpTopicProvider != null) // m_helpTopicProvider could be null for testing { helpProvider = new HelpProvider(); helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile; helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic)); helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); } MoveWindowToPreviousPosition(); }
/// <summary> /// /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> public override void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator) { CheckDisposed(); m_fwcbSenses.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; base.SetDlgInfo(cache, wp, mediator); // This is needed to make the replacement MatchingEntriesBrowser visible: this.Controls.SetChildIndex(this.matchingEntries, 0); //Set the senses control so that it conforms to the size of the //DefaultAnalysisWritingSystem m_fwcbSenses.WritingSystemCode = cache.LangProject.DefaultAnalysisWritingSystem; // the default font is set to size 100, so that when adding strings to the control // this becomes a limit. m_fwcbSenses.StyleSheet = m_tbForm.StyleSheet; m_fwcbSenses.AdjustForStyleSheet(this, grplbl, m_fwcbSenses.StyleSheet); if (wp != null) { switch (wp.m_title) { case "Identify sense": m_helpTopic = "khtpAddSenseToReversalEntry"; btnHelp.Enabled = true; break; } } }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO); int type = lrt.MappingType; BaseGoDlg dlg = null; switch ((LexRefType.MappingTypes)type) { case LexRefType.MappingTypes.kmtSenseSequence: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefType.MappingTypes.kmtEntrySequence: dlg = new GoDlg(); break; case LexRefType.MappingTypes.kmtEntryOrSenseSequence: dlg = new LinkEntryOrSenseDlg(); break; } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.Name.AnalysisDefaultWritingSystem); wp.m_label = LexEdStrings.ksFind_; wp.m_btnText = LexEdStrings.ks_Add; //for collection relation of items always have an Add button dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) AddItem(dlg.SelectedID); dlg.Dispose(); }
protected override void SetDlgInfo(FdoCache cache, WindowParams wp, XCore.Mediator mediator, int wsVern) { WritingSystemAndStylesheetHelper.SetupWritingSystemAndStylesheetInfo(tcVariantTypes, cache, mediator, cache.DefaultUserWs); base.SetDlgInfo(cache, wp, mediator, wsVern); // load the variant type possibilities. LoadVariantTypes(); }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> public override void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator) { base.SetDlgInfo(cache, wp, mediator); // This is needed to make the replacement MatchingEntriesBrowser visible: Controls.SetChildIndex(m_matchingObjectsBrowser, 0); // LT-6325 fix... SetComboWritingSystemFactory(cache); }
protected override void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable, int ws) { WritingSystemAndStylesheetHelper.SetupWritingSystemAndStylesheetInfo(propertyTable, tcVariantTypes, cache, cache.DefaultUserWs); base.SetDlgInfo(cache, wp, mediator, propertyTable, ws); // load the variant type possibilities. LoadVariantTypes(); }
protected override void HandleChooser() { using (var dlg = new LinkEntryOrSenseDlg()) { var wp = new WindowParams {m_title = LexEdStrings.ksIdentifySense, m_btnText = LexEdStrings.ksSetReversal}; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SelectSensesOnly = true; if (dlg.ShowDialog(FindForm()) == DialogResult.OK) AddItem(dlg.SelectedObject); } }
protected override void HandleChooser() { using (var dlg = new RecordGoDlg()) { var wp = new WindowParams { m_title = LexEdStrings.ksIdentifyRecord, m_btnText = LexEdStrings.ks_Add }; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic(Slice.GetChooserHelpTopicID()); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) AddItem(dlg.SelectedObject); } }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> public void SetDlgInfo(FdoCache cache, Mediator mediator, WindowParams wp, DummyCmObject mainObj, List<DummyCmObject> mergeCandidates, string guiControl, string helpTopic) { CheckDisposed(); Debug.Assert(cache != null); m_mediator = mediator; m_cache = cache; m_mainObj = mainObj; m_tsf = TsStrFactoryClass.Create(); m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_fwTextBoxBottomMsg.WritingSystemCode = m_cache.LangProject.DefaultUserWritingSystem; InitBrowseView(guiControl, mergeCandidates); // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue("mergeDlgLocation"); // 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"); // 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; } Text = wp.m_title; label2.Text = wp.m_label; m_helpTopic = helpTopic; if(m_helpTopic != null && FwApp.App != null) // FwApp.App could be null for testing { helpProvider = new System.Windows.Forms.HelpProvider(); helpProvider.HelpNamespace = FwApp.App.HelpFile; helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0)); helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); } }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries or senses. /// </summary> protected override void HandleChooser() { using (LinkEntryOrSenseDlg dlg = new LinkEntryOrSenseDlg()) { WindowParams wp = new WindowParams(); wp.m_title = LexEdStrings.ksIdentifySense; wp.m_label = LexEdStrings.ksFind_; wp.m_btnText = LexEdStrings.ksSetReversal; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SelectSensesOnly = true; if (dlg.ShowDialog(FindForm()) == DialogResult.OK) AddItem(dlg.SelectedID); } }
protected override DummyCmObject GetMergeinfo(WindowParams wp, List<DummyCmObject> mergeCandidates, out string guiControl, out string helpTopic) { wp.m_title = FdoUiStrings.ksMergeReversalEntry; wp.m_label = FdoUiStrings.ksEntries; var rie = (IReversalIndexEntry) Object; var filteredHvos = new HashSet<int>(rie.AllOwnedObjects.Select(obj => obj.Hvo)) { rie.Hvo }; // exclude `rie` and all of its subentries var wsIndex = m_cache.ServiceLocator.WritingSystemManager.GetWsFromStr(rie.ReversalIndex.WritingSystem); mergeCandidates.AddRange(from rieInner in rie.ReversalIndex.AllEntries where !filteredHvos.Contains(rieInner.Hvo) select new DummyCmObject(rieInner.Hvo, rieInner.ShortName, wsIndex)); guiControl = "MergeReversalEntryList"; helpTopic = "khtpMergeReversalEntry"; return new DummyCmObject(m_hvo, rie.ShortName, wsIndex); }
/// <summary> /// Common init of the dialog, whether or not we have a starting lex entry. /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> /// <param name="propertyTable"></param> public override void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable) { CheckDisposed(); base.SetDlgInfo(cache, wp, mediator, propertyTable); // This is needed to make the replacement MatchingEntriesBrowser visible: Controls.SetChildIndex(m_matchingObjectsBrowser, 0); m_fwcbAllomorphs.WritingSystemFactory = cache.WritingSystemFactory; m_fwcbAllomorphs.WritingSystemCode = cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle; // For a resizeable dialog, we don't want AdjustForStylesheet to really change its size, // because then it ends up growing every time it launches! int oldHeight = Height; m_fwcbAllomorphs.AdjustForStyleSheet(this, grplbl, propertyTable); Height = oldHeight; }
/// <summary> /// Common init of the dialog, whether or not we have a starting lex entry. /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> public override void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator) { CheckDisposed(); base.SetDlgInfo(cache, wp, mediator); // This is needed to make the replacement MatchingEntriesBrowser visible: this.Controls.SetChildIndex(this.matchingEntries, 0); m_fwcbAllomorphs.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_fwcbAllomorphs.WritingSystemCode = cache.LangProject.DefaultVernacularWritingSystem; // For a resizeable dialog, we don't want AdjustForStylesheet to really change its size, // because then it ends up growing every time it launches! int oldHeight = this.Height; m_fwcbAllomorphs.AdjustForStyleSheet(this, grplbl, mediator); this.Height = oldHeight; }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { var lrt = (ILexRefType)m_obj.Owner; var type = (LexRefTypeTags.MappingTypes)lrt.MappingType; BaseGoDlg dlg = null; string sTitle = string.Empty; try { switch (type) { case LexRefTypeTags.MappingTypes.kmtSenseCollection: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; sTitle = String.Format(LexEdStrings.ksIdentifyXSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtEntryCollection: dlg = new EntryGoDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSenseCollection: dlg = new LinkEntryOrSenseDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; } Debug.Assert(dlg != null); var wp = new WindowParams { m_title = sTitle, m_btnText = LexEdStrings.ks_Add }; dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK && dlg.SelectedObject != null) { if (!((ILexReference)m_obj).TargetsRS.Contains(dlg.SelectedObject)) AddItem(dlg.SelectedObject); } } finally { if (dlg != null) dlg.Dispose(); } }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> public void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, ITsString tssform, int hvoType) { CheckDisposed(); SetDlgInfo(cache, wp, mediator, tssform); m_formOrig = m_tbForm.Text; m_hvoType = hvoType; // JohnT: a prior call to SetForm should have established whether this button // is enabled...and it should NOT be, if there are no entries selected, // typically because none at all match the form. //btnOK.Enabled = true; btnOK.Width += 30; btnOK.Left += 90; btnClose.Width += 30; // for balance... ShowControlsBasedOnPanel1Position(); }
private void SetupBasicTextProperties(WindowParams wp) { if (wp == null) { // NOTE: ideally we'd take visual studio designer's settings for defaults. // for now, just have the subclass dialogs override DefaultWindowParams // to return 'null' in order to take visual studio designer's wp = DefaultWindowParams; if (wp == null) { AdjustControlsToTextResize(); ShowControlsBasedOnPanel1Position(); return; // use visual studio designer's settings. } } if (wp.m_title != null) { Text = wp.m_title; } if (wp.m_label != null) { m_formLabel.Text = wp.m_label; } if (wp.m_btnText != null) { m_btnOK.Text = wp.m_btnText; } // The text may be too wide for the button. See LT-6215. if (m_btnOK.PreferredSize.Width > m_btnOK.Size.Width) { int delta = m_btnOK.PreferredSize.Width - m_btnOK.Size.Width; m_btnOK.Location = new Point(m_btnOK.Location.X - delta, m_btnOK.Location.Y); m_btnOK.Width += delta; } AdjustControlsToTextResize(); ShowControlsBasedOnPanel1Position(); }
/// <summary> /// /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> /// <param name="tssform">establishes the ws of the dialog.</param> public void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, ITsString tssform) { CheckDisposed(); SetDlgInfo(cache, wp, mediator, tssform.Text, StringUtils.GetWsAtOffset(tssform, 0)); }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> /// <param name="form">Form to use in main text edit box.</param> public void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, string form) { CheckDisposed(); SetDlgInfo(cache, wp, mediator, form, cache.DefaultVernWs); }
protected virtual void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, int wsVern) { CheckDisposed(); Debug.Assert(cache != null); m_cache = cache; m_mediator = mediator; if (m_mediator != null) { ReplaceMatchingItemsControl(); // Reset window location. // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue(PersistenceLabel + "DlgLocation"); object szWnd = m_mediator.PropertyTable.GetValue(PersistenceLabel + "DlgSize"); if (locWnd != null && szWnd != null) { Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); //grow it if it's too small. This will happen when we add new controls to the dialog box. if(rect.Width < btnHelp.Left + btnHelp.Width + 30) rect.Width = btnHelp.Left + btnHelp.Width + 30; if(rect.Height < btnHelp.Top + btnHelp.Height + 50) rect.Height = btnHelp.Top + btnHelp.Height + 50; //rect.Height = 600; ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } } SetupBasicTextProperties(wp); IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); InitializeMatchingEntries(cache, mediator); int hvoWs = wsVern; // Set font, writing system factory, and writing system code for the Lexical Form // edit box. Also set an empty string with the proper writing system. m_tbForm.Font = new Font(cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(wsVern).DefaultSerif, 10); m_tbForm.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_tbForm.WritingSystemCode = hvoWs; m_tsf = TsStrFactoryClass.Create(); m_tbForm.AdjustStringHeight = false; m_tbForm.Tss = m_tsf.MakeString("", hvoWs); m_tbForm.StyleSheet = stylesheet; // Setup the fancy message text box. // Note: at 120DPI (only), it seems to be essential to set at least the WSF of the // bottom message even if not using it. SetupBottomMsg(); SetBottomMessage(); m_fwTextBoxBottomMsg.BorderStyle = BorderStyle.None; m_analHvos.AddRange(cache.LangProject.CurAnalysisWssRS.HvoArray); List<int> vernList = new List<int>(cache.LangProject.CurVernWssRS.HvoArray); m_vernHvos.AddRange(vernList); LoadWritingSystemCombo(); int iWs = vernList.IndexOf(hvoWs); ILgWritingSystem lgwsCurrent; if (iWs < 0) { List<int> analList = new List<int>(cache.LangProject.CurAnalysisWssRS.HvoArray); iWs = analList.IndexOf(hvoWs); if (iWs < 0) { lgwsCurrent = LgWritingSystem.CreateFromDBObject(cache, hvoWs); m_cbWritingSystems.Items.Add(lgwsCurrent); } else { lgwsCurrent = cache.LangProject.CurAnalysisWssRS[iWs]; } } else { lgwsCurrent = cache.LangProject.CurVernWssRS[iWs]; } Debug.Assert(lgwsCurrent != null && lgwsCurrent.Hvo == hvoWs); m_skipCheck = true; m_cbWritingSystems.SelectedItem = lgwsCurrent; m_skipCheck = false; // Don't hook this up until AFTER we've initialized it; otherwise, it can // modify the contents of the form as a side effect of initialization. // Also, doing that triggers laying out the dialog prematurely, before // we've set WSF on all the controls. m_cbWritingSystems.SelectedIndexChanged += new System.EventHandler(this.m_cbWritingSystems_SelectedIndexChanged); // Adjust things if the form box needs to grow to accommodate its style. int oldHeight = m_tbForm.Height; int newHeight = Math.Max(oldHeight, m_tbForm.PreferredHeight); int delta = newHeight - oldHeight; if (delta != 0) { m_tbForm.Height = newHeight; panel1.Height += delta; GrowDialogAndAdjustControls(delta, panel1); } }
protected override void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, int wsVern) { CheckDisposed(); m_types = new MoMorphTypeCollection(cache); base.SetDlgInfo(cache, wp, mediator, wsVern); }
protected void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable, string form, int ws) { SetDlgInfo(cache, wp, mediator, propertyTable, ws); Form = form; }
/// <summary> /// Common init of the dialog, whether or not we have a starting lex entry. /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> public override void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator) { CheckDisposed(); base.SetDlgInfo(cache, wp, mediator); // This is needed to make the replacement MatchingEntriesBrowser visible: Controls.SetChildIndex(m_matchingObjectsBrowser, 0); m_fwcbAllomorphs.WritingSystemFactory = cache.WritingSystemFactory; m_fwcbAllomorphs.WritingSystemCode = cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle; // For a resizeable dialog, we don't want AdjustForStylesheet to really change its size, // because then it ends up growing every time it launches! int oldHeight = Height; m_fwcbAllomorphs.AdjustForStyleSheet(this, grplbl, mediator); Height = oldHeight; }
protected virtual DummyCmObject GetMergeinfo(WindowParams wp, List<DummyCmObject> mergeCandidates, out string guiControl, out string helpTopic) { Debug.Assert(false, "Subclasses must override this method."); guiControl = null; helpTopic = null; return null; }
/// <summary> /// Merge the underling objects. This method handles the confirm dialog, then delegates /// the actual merge to ReallyMergeUnderlyingObject. If the flag is true, we merge /// strings and owned atomic objects; otherwise, we don't change any that aren't null /// to begin with. /// </summary> /// <param name="fLoseNoTextData"></param> public void MergeUnderlyingObject(bool fLoseNoTextData) { CheckDisposed(); var mainWindow = (Form) m_mediator.PropertyTable.GetValue("window"); using (new WaitCursor(mainWindow)) { using (var dlg = new MergeObjectDlg(m_mediator.HelpTopicProvider)) { var wp = new WindowParams(); var mergeCandidates = new List<DummyCmObject>(); string guiControl, helpTopic; DummyCmObject dObj = GetMergeinfo(wp, mergeCandidates, out guiControl, out helpTopic); mergeCandidates.Sort(); dlg.SetDlgInfo(m_cache, m_mediator, wp, dObj, mergeCandidates, guiControl, helpTopic); if (DialogResult.OK == dlg.ShowDialog(mainWindow)) ReallyMergeUnderlyingObject(dlg.Hvo, fLoseNoTextData); } } }
public override void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, string form) { SetDlgInfo(cache, wp, mediator, form, cache.DefaultAnalWs); }
protected virtual void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, int ws) { CheckDisposed(); Debug.Assert(cache != null); m_cache = cache; m_tsf = cache.TsStrFactory; // do this very early, other initializers may depend on it. m_mediator = mediator; if (m_mediator != null) { // Reset window location. // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue(PersistenceLabel + "DlgLocation"); object szWnd = m_mediator.PropertyTable.GetValue(PersistenceLabel + "DlgSize"); if (locWnd != null && szWnd != null) { var rect = new Rectangle((Point)locWnd, (Size)szWnd); //grow it if it's too small. This will happen when we add new controls to the dialog box. if (rect.Width < m_btnHelp.Left + m_btnHelp.Width + 30) { rect.Width = m_btnHelp.Left + m_btnHelp.Width + 30; } if (rect.Height < m_btnHelp.Top + m_btnHelp.Height + 50) { rect.Height = m_btnHelp.Top + m_btnHelp.Height + 50; } //rect.Height = 600; ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } m_helpTopicProvider = m_mediator.HelpTopicProvider; if (m_helpTopicProvider != null) { m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile; SetHelpButtonEnabled(); } } SetupBasicTextProperties(wp); IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); InitializeMatchingObjects(cache, mediator); // Set font, writing system factory, and writing system code for the Lexical Form // edit box. Also set an empty string with the proper writing system. m_tbForm.Font = new Font(cache.ServiceLocator.WritingSystemManager.Get(ws).DefaultFontName, 10); m_tbForm.WritingSystemFactory = cache.WritingSystemFactory; m_tbForm.WritingSystemCode = ws; m_tbForm.AdjustStringHeight = false; m_tbForm.Tss = m_tsf.MakeString("", ws); m_tbForm.StyleSheet = stylesheet; // Setup the fancy message text box. // Note: at 120DPI (only), it seems to be essential to set at least the WSF of the // bottom message even if not using it. SetupBottomMsg(); SetBottomMessage(); m_fwTextBoxBottomMsg.BorderStyle = BorderStyle.None; m_analHvos.UnionWith(cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems.Select(wsObj => wsObj.Handle)); List <int> vernList = cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Select(wsObj => wsObj.Handle).ToList(); m_vernHvos.UnionWith(vernList); LoadWritingSystemCombo(); int iWs = vernList.IndexOf(ws); IWritingSystem currentWs; if (iWs < 0) { List <int> analList = cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems.Select(wsObj => wsObj.Handle).ToList(); iWs = analList.IndexOf(ws); if (iWs < 0) { currentWs = cache.ServiceLocator.WritingSystemManager.Get(ws); m_cbWritingSystems.Items.Add(currentWs); SetCbWritingSystemsSize(); } else { currentWs = cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems[iWs]; } } else { currentWs = cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems[iWs]; } Debug.Assert(currentWs != null && currentWs.Handle == ws); m_skipCheck = true; m_cbWritingSystems.SelectedItem = currentWs; m_skipCheck = false; // Don't hook this up until AFTER we've initialized it; otherwise, it can // modify the contents of the form as a side effect of initialization. // Also, doing that triggers laying out the dialog prematurely, before // we've set WSF on all the controls. m_cbWritingSystems.SelectedIndexChanged += m_cbWritingSystems_SelectedIndexChanged; // Adjust things if the form box needs to grow to accommodate its style. int oldHeight = m_tbForm.Height; int newHeight = Math.Max(oldHeight, m_tbForm.PreferredHeight); int delta = newHeight - oldHeight; if (delta != 0) { m_tbForm.Height = newHeight; m_panel1.Height += delta; GrowDialogAndAdjustControls(delta, m_panel1); } }
/// <summary> /// /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> /// <param name="tssform">establishes the ws of the dialog.</param> public void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, ITsString tssform) { CheckDisposed(); SetDlgInfo(cache, wp, mediator, tssform.Text, TsStringUtils.GetWsAtOffset(tssform, 0)); }
protected void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, string form, int ws) { SetDlgInfo(cache, wp, mediator, ws); Form = form; }
protected override DummyCmObject GetMergeinfo(WindowParams wp, List<DummyCmObject> mergeCandidates, out string guiControl, out string helpTopic) { wp.m_title = FdoUiStrings.ksMergeSense; wp.m_label = FdoUiStrings.ksSenses; int defAnalWs = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle; var sense = (ILexSense) Object; var le = sense.Entry; // Exclude subsenses of the chosen sense. See LT-6107. var rghvoExclude = new List<int>(); foreach (var ls in sense.AllSenses) rghvoExclude.Add(ls.Hvo); foreach (var senseInner in le.AllSenses) { if (senseInner != Object && !rghvoExclude.Contains(senseInner.Hvo)) { // Make sure we get the actual WS used (best analysis would be the // descriptive term) for the ShortName. See FWR-2812. ITsString tssName = senseInner.ShortNameTSS; mergeCandidates.Add( new DummyCmObject( senseInner.Hvo, tssName.Text, TsStringUtils.GetWsAtOffset(tssName, 0))); } } guiControl = "MergeSenseList"; helpTopic = "khtpMergeSense"; ITsString tss = Object.ShortNameTSS; return new DummyCmObject(m_hvo, tss.Text, TsStringUtils.GetWsAtOffset(tss, 0)); }
protected virtual void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, int ws) { CheckDisposed(); Debug.Assert(cache != null); m_cache = cache; m_tsf = cache.TsStrFactory; // do this very early, other initializers may depend on it. m_mediator = mediator; if (m_mediator != null) { // Reset window location. // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue(PersistenceLabel + "DlgLocation"); object szWnd = m_mediator.PropertyTable.GetValue(PersistenceLabel + "DlgSize"); if (locWnd != null && szWnd != null) { var rect = new Rectangle((Point)locWnd, (Size)szWnd); //grow it if it's too small. This will happen when we add new controls to the dialog box. if (rect.Width < m_btnHelp.Left + m_btnHelp.Width + 30) rect.Width = m_btnHelp.Left + m_btnHelp.Width + 30; if (rect.Height < m_btnHelp.Top + m_btnHelp.Height + 50) rect.Height = m_btnHelp.Top + m_btnHelp.Height + 50; //rect.Height = 600; ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } m_helpTopicProvider = m_mediator.HelpTopicProvider; if (m_helpTopicProvider != null) { m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile; SetHelpButtonEnabled(); } } SetupBasicTextProperties(wp); IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); // Set font, writing system factory, and writing system code for the Lexical Form // edit box. Also set an empty string with the proper writing system. m_tbForm.Font = new Font(cache.ServiceLocator.WritingSystemManager.Get(ws).DefaultFontName, 10); m_tbForm.WritingSystemFactory = cache.WritingSystemFactory; m_tbForm.WritingSystemCode = ws; m_tbForm.AdjustStringHeight = false; m_tbForm.Tss = m_tsf.MakeString("", ws); m_tbForm.StyleSheet = stylesheet; // Setup the fancy message text box. // Note: at 120DPI (only), it seems to be essential to set at least the WSF of the // bottom message even if not using it. SetupBottomMsg(); SetBottomMessage(); m_fwTextBoxBottomMsg.BorderStyle = BorderStyle.None; m_analHvos.UnionWith(cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems.Select(wsObj => wsObj.Handle)); List<int> vernList = cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Select(wsObj => wsObj.Handle).ToList(); m_vernHvos.UnionWith(vernList); LoadWritingSystemCombo(); int iWs = vernList.IndexOf(ws); IWritingSystem currentWs; if (iWs < 0) { List<int> analList = cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems.Select(wsObj => wsObj.Handle).ToList(); iWs = analList.IndexOf(ws); if (iWs < 0) { currentWs = cache.ServiceLocator.WritingSystemManager.Get(ws); m_cbWritingSystems.Items.Add(currentWs); SetCbWritingSystemsSize(); } else { currentWs = cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems[iWs]; } } else { currentWs = cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems[iWs]; } Debug.Assert(currentWs != null && currentWs.Handle == ws); m_skipCheck = true; m_cbWritingSystems.SelectedItem = currentWs; m_skipCheck = false; // Don't hook this up until AFTER we've initialized it; otherwise, it can // modify the contents of the form as a side effect of initialization. // Also, doing that triggers laying out the dialog prematurely, before // we've set WSF on all the controls. m_cbWritingSystems.SelectedIndexChanged += m_cbWritingSystems_SelectedIndexChanged; InitializeMatchingObjects(cache, mediator); // Adjust things if the form box needs to grow to accommodate its style. int oldHeight = m_tbForm.Height; int newHeight = Math.Max(oldHeight, m_tbForm.PreferredHeight); int delta = newHeight - oldHeight; if (delta != 0) { m_tbForm.Height = newHeight; m_panel1.Height += delta; GrowDialogAndAdjustControls(delta, m_panel1); } }
protected override DummyCmObject GetMergeinfo(WindowParams wp, List<DummyCmObject> mergeCandidates, out string guiControl, out string helpTopic) { wp.m_title = FdoUiStrings.ksMergeAllomorph; wp.m_label = FdoUiStrings.ksAlternateForms; int defVernWs = m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle; var le = (ILexEntry) Object.Owner; foreach (var allo in le.AlternateFormsOS) { if (allo.Hvo != Object.Hvo && allo.ClassID == Object.ClassID) { mergeCandidates.Add( new DummyCmObject( allo.Hvo, allo.Form.VernacularDefaultWritingSystem.Text, defVernWs)); } } if (le.LexemeFormOA.ClassID == Object.ClassID) { // Add the lexeme form. mergeCandidates.Add( new DummyCmObject( le.LexemeFormOA.Hvo, le.LexemeFormOA.Form.VernacularDefaultWritingSystem.Text, defVernWs)); } guiControl = "MergeAllomorphList"; helpTopic = "khtpMergeAllomorph"; return new DummyCmObject(m_hvo, ((IMoForm) Object).Form.VernacularDefaultWritingSystem.Text, defVernWs); }
/// <summary> /// This method is called when we are creating a new lexical relation slice. /// If the user selects an item it's hvo is returned. /// Otherwise 0 is returned and the lexical relation should not be created. /// </summary> /// <param name="lrt"></param> /// <returns></returns> private int GetRootObjectHvo(ILexRefType lrt) { int hvoFirst = 0; BaseEntryGoDlg dlg = null; switch ((LexRefType.MappingTypes)lrt.MappingType) { case LexRefType.MappingTypes.kmtSenseAsymmetricPair: case LexRefType.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefType.MappingTypes.kmtEntryAsymmetricPair: case LexRefType.MappingTypes.kmtEntryTree: dlg = new GoDlg(); break; case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: case LexRefType.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); break; default: Debug.Assert(lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseAsymmetricPair || lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseTree); return 0; } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); //wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, // lrt.Name.AnalysisDefaultWritingSystem); wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.ReverseName.BestAnalysisAlternative.Text); wp.m_label = LexEdStrings.ksFind_; //wp.m_btnText = LexEdStrings.ks_Link; wp.m_btnText = LexEdStrings.ks_Add; dlg.SetDlgInfo(m_cache, wp, Mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) hvoFirst = dlg.SelectedID; dlg.Dispose(); return hvoFirst; }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> /// <param name="mediator"></param> /// <param name="propertyTable"></param> /// <param name="form">Form to use in main text edit box.</param> public virtual void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable, string form) { CheckDisposed(); SetDlgInfo(cache, wp, mediator, propertyTable, form, cache.DefaultVernWs); }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> /// <param name="mediator"></param> public virtual void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator) { SetDlgInfo(cache, wp, mediator, cache.DefaultVernWs); }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> public virtual void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator) { SetDlgInfo(cache, wp, mediator, cache.DefaultVernWs); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Launch the Find Entry dialog, and if one is created or selected return it. /// </summary> /// <param name="cache">The cache.</param> /// <param name="mediator">The mediator.</param> /// <param name="tssForm">The TSS form.</param> /// <param name="owner">The owner.</param> /// <returns>The HVO of the selected or created entry</returns> /// ------------------------------------------------------------------------------------ internal static ILexEntry ShowFindEntryDialog(FdoCache cache, Mediator mediator, ITsString tssForm, IWin32Window owner) { // Ensure that we have a valid mediator with the proper string table. bool fRestore = false; StringTable stOrig = null; mediator = EnsureValidMediator(mediator, out fRestore, out stOrig); try { using (EntryGoDlg entryGoDlg = new EntryGoDlg()) { // Temporarily set TopMost to true so it will launch above any calling app (e.g. Paratext) // but reset after activated. SetCurrentModalForm(entryGoDlg); var wp = new WindowParams { m_btnText = FdoUiStrings.ksShow, m_title = FdoUiStrings.ksFindInDictionary, m_label = FdoUiStrings.ksFind_ }; if (owner == null) entryGoDlg.StartPosition = FormStartPosition.CenterScreen; entryGoDlg.Owner = owner as Form; entryGoDlg.SetDlgInfo(cache, wp, mediator, tssForm); entryGoDlg.SetHelpTopic("khtpFindInDictionary"); if (entryGoDlg.ShowDialog() == DialogResult.OK) { var entry = entryGoDlg.SelectedObject as ILexEntry; Debug.Assert(entry != null); return entry; } } } finally { // Restore the original string table in the mediator if needed. if (fRestore) mediator.StringTbl = stOrig; } return null; }
private void SetupBasicTextProperties(WindowParams wp) { if (wp == null) { // NOTE: ideally we'd take visual studio designer's settings for defaults. // for now, just have the subclass dialogs override DefaultWindowParams // to return 'null' in order to take visual studio designer's wp = DefaultWindowParams; if (wp == null) { AdjustControlsToTextResize(); ShowControlsBasedOnPanel1Position(); return; // use visual studio designer's settings. } } Text = wp.m_title; m_formLabel.Text = wp.m_label; btnOK.Text = wp.m_btnText; // The text may be too wide for the button. See LT-6215. if (btnOK.PreferredSize.Width > btnOK.Size.Width) { int delta = btnOK.PreferredSize.Width - btnOK.Size.Width; btnOK.Location = new Point(btnOK.Location.X - delta, btnOK.Location.Y); btnOK.Width += delta; } AdjustControlsToTextResize(); ShowControlsBasedOnPanel1Position(); }
public bool OnMoveReversalindexEntry(object cmd) { using (var dlg = new ReversalEntryGoDlg()) { Slice slice = m_dataEntryForm.CurrentSlice; Debug.Assert(slice != null, "No slice was current"); var currentEntry = (IReversalIndexEntry) slice.Object; dlg.ReversalIndex = currentEntry.ReversalIndex; AddEntryAndChildrenRecursively(dlg.FilteredReversalEntryHvos, currentEntry); IReversalIndexEntry owningEntry = currentEntry.OwningEntry; if (owningEntry != null) dlg.FilteredReversalEntryHvos.Add(owningEntry.Hvo); dlg.SetHelpTopic("khtpMoveReversalEntry"); var wp = new WindowParams {m_btnText = LexEdStrings.ks_MoveEntry, m_title = LexEdStrings.ksMoveRevEntry}; var cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache"); dlg.SetDlgInfo(cache, wp, m_mediator); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var newOwner = (IReversalIndexEntry) dlg.SelectedObject; UndoableUnitOfWorkHelper.Do(LexEdStrings.ksUndoMoveRevEntry, LexEdStrings.ksRedoMoveRevEntry, Cache.ActionHandlerAccessor, () => { newOwner.MoveIfNeeded(currentEntry); newOwner.SubentriesOS.Add(currentEntry); }); RecordClerk clerk = m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk; if (clerk != null) clerk.RemoveItemsFor(currentEntry.Hvo); // Note: PropChanged should happen on the old owner and the new while completing the unit of work. // Have to jump to a main entry, as RecordClerk doesn't know anything about subentries. m_mediator.BroadcastMessageUntilHandled("JumpToRecord", newOwner.MainEntry.Hvo); } } return true; }
protected void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, string form, int vernWs) { SetDlgInfo(cache, wp, mediator, vernWs); Form = form; }
/// <summary> /// /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> /// <param name="propertyTable"></param> /// <param name="tssform">establishes the ws of the dialog.</param> public void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable, ITsString tssform) { CheckDisposed(); SetDlgInfo(cache, wp, mediator, propertyTable, tssform.Text, TsStringUtils.GetWsAtOffset(tssform, 0)); }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> /// <param name="mediator"></param> /// <param name="propertyTable"></param> public virtual void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable) { SetDlgInfo(cache, wp, mediator, propertyTable, cache.DefaultVernWs); }
public override void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable, string form) { SetDlgInfo(cache, wp, mediator, propertyTable, form, cache.DefaultAnalWs); }
protected override DummyCmObject GetMergeinfo(WindowParams wp, List<DummyCmObject> mergeCandidates, out string guiControl, out string helpTopic) { wp.m_title = FdoUiStrings.ksMergeWordGloss; wp.m_label = FdoUiStrings.ksGlosses; var anal = (IWfiAnalysis) Object.Owner; ITsString tss; int nVar; int ws; foreach (var gloss in anal.MeaningsOC) { if (gloss.Hvo != Object.Hvo) { tss = gloss.ShortNameTSS; ws = tss.get_PropertiesAt(0).GetIntPropValues((int)FwTextPropType.ktptWs, out nVar); mergeCandidates.Add( new DummyCmObject( gloss.Hvo, tss.Text, ws)); } } guiControl = "MergeWordGlossList"; helpTopic = "khtpMergeWordGloss"; var me = (IWfiGloss) Object; tss = me.ShortNameTSS; ws = tss.get_PropertiesAt(0).GetIntPropValues((int) FwTextPropType.ktptWs, out nVar); return new DummyCmObject(m_hvo, tss.Text, ws); }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="wp">Strings used for various items in this dialog.</param> /// <param name="mediator"></param> /// <param name="form">Form to use in main text edit box.</param> public virtual void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, string form) { CheckDisposed(); SetDlgInfo(cache, wp, mediator, form, cache.DefaultVernWs); }
/// <summary> /// This method is called when we are creating a new lexical relation slice. /// If the user selects an item it's hvo is returned. /// Otherwise 0 is returned and the lexical relation should not be created. /// </summary> /// <param name="lrt"></param> /// <returns></returns> private int GetChildObjectHvo(ILexRefType lrt) { int hvoFirst = 0; BaseEntryGoDlg dlg = null; string sTitle = ""; switch ((LexRefType.MappingTypes)lrt.MappingType) { case LexRefType.MappingTypes.kmtEntryOrSensePair: case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false; sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefType.MappingTypes.kmtSenseCollection: case LexRefType.MappingTypes.kmtSensePair: case LexRefType.MappingTypes.kmtSenseAsymmetricPair: // Sense pair with different Forward/Reverse names case LexRefType.MappingTypes.kmtSenseSequence: case LexRefType.MappingTypes.kmtSenseTree: dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; sTitle = String.Format(LexEdStrings.ksIdentifyXSense, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefType.MappingTypes.kmtEntryCollection: case LexRefType.MappingTypes.kmtEntryPair: case LexRefType.MappingTypes.kmtEntryAsymmetricPair: // Entry pair with different Forward/Reverse names case LexRefType.MappingTypes.kmtEntrySequence: case LexRefType.MappingTypes.kmtEntryTree: dlg = new GoDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry, lrt.Name.BestAnalysisAlternative.Text); break; case LexRefType.MappingTypes.kmtEntryOrSenseCollection: case LexRefType.MappingTypes.kmtEntryOrSenseSequence: case LexRefType.MappingTypes.kmtEntryOrSenseTree: dlg = new LinkEntryOrSenseDlg(); sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense, lrt.Name.BestAnalysisAlternative.Text); break; default: Debug.Assert(lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseAsymmetricPair || lrt.MappingType == (int)LexRefType.MappingTypes.kmtSenseTree); return 0; } Debug.Assert(dlg != null); WindowParams wp = new WindowParams(); wp.m_title = sTitle; wp.m_label = LexEdStrings.ksFind_; wp.m_btnText = LexEdStrings.ks_Add; // Don't display the current entry in the list of matching entries. See LT-2611. ICmObject objEntry = this.Object; while (objEntry.ClassID == LexSense.kclsidLexSense) objEntry = CmObject.CreateFromDBObject(m_cache, objEntry.OwnerHVO); Debug.Assert(objEntry.ClassID == LexEntry.kclsidLexEntry); dlg.StartingEntry = objEntry as ILexEntry; dlg.SetDlgInfo(m_cache, wp, Mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) hvoFirst = dlg.SelectedID; dlg.Dispose(); return hvoFirst; }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache"></param> /// <param name="wp"></param> /// <param name="mediator"></param> public override void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator) { base.SetDlgInfo(cache, wp, mediator); // This is needed to make the replacement MatchingEntriesBrowser visible: this.Controls.SetChildIndex(this.matchingEntries, 0); // LT-6325 fix... SetComboWritingSystemFactory(cache); }
/// <summary> /// Override method to handle launching of a chooser for selecting lexical entries. /// </summary> protected override void HandleChooser() { ILexRefType lrt = (ILexRefType)m_obj.Owner; LexRefTypeTags.MappingTypes type = (LexRefTypeTags.MappingTypes)lrt.MappingType; BaseGoDlg dlg = null; try { switch (type) { case LexRefTypeTags.MappingTypes.kmtSensePair: case LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair: // Sense pair with different Forward/Reverse names dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true; break; case LexRefTypeTags.MappingTypes.kmtEntryPair: case LexRefTypeTags.MappingTypes.kmtEntryAsymmetricPair: // Entry pair with different Forward/Reverse names dlg = new EntryGoDlg(); break; case LexRefTypeTags.MappingTypes.kmtEntryOrSensePair: case LexRefTypeTags.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense pair with different Forward/Reverse dlg = new LinkEntryOrSenseDlg(); (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false; break; } Debug.Assert(dlg != null); var wp = new WindowParams(); //on creating Pair Lexical Relation have an Add button and Add in the title bar if (Target == null) { wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.Name.BestAnalysisAlternative.Text); wp.m_btnText = LexEdStrings.ks_Add; } else //Otherwise we are Replacing the item { wp.m_title = String.Format(LexEdStrings.ksReplaceXEntry); wp.m_btnText = LexEdStrings.ks_Replace; } dlg.SetDlgInfo(m_cache, wp, m_mediator); dlg.SetHelpTopic("khtpChooseLexicalRelationAdd"); if (dlg.ShowDialog(FindForm()) == DialogResult.OK) { if (dlg.SelectedObject != null) { AddItem(dlg.SelectedObject); // it is possible that the previous update has caused the data tree to refresh if (!IsDisposed) m_atomicRefView.RootBox.Reconstruct(); // view is somehow too complex for auto-update. } } } finally { if (dlg != null) dlg.Dispose(); } }
public void SetDlgInfo(Mediator mediator, WindowParams wp, List<IWfiWordform> filteredEntries) { CheckDisposed(); Debug.Assert(filteredEntries != null && filteredEntries.Count > 0); foreach (IWfiWordform ww in filteredEntries) { if (ww != null) // assignment of ww.Hvo will crash: LT-4951 { ExtantWfiWordformInfo ewi = new ExtantWfiWordformInfo(); ewi.ID = ww.Hvo; m_filteredEntries.Add(ewi); } } base.SetDlgInfo((FdoCache)mediator.PropertyTable.GetValue("cache"), wp, mediator); }