/// <summary> /// Construct one, using the "part ref" element (caller) that /// invoked the "slice" node that specified this editor. /// </summary> /// <param name="caller"></param> /// <param name="node"></param> public SummarySlice(ICmObject obj, XmlNode caller, XmlNode node, StringTable stringTbl) : base() { string paramType = XmlUtils.GetOptionalAttributeValue(node.ParentNode, "paramType"); if (paramType == "LiteralString") { // Instead of the parameter being a layout name, it is literal text which will be // the whole contents of the slice, with standard properties. string text = XmlUtils.GetManditoryAttributeValue(caller, "label"); if (stringTbl != null) text = stringTbl.LocalizeAttributeValue(text); m_view = new LiteralLabelView(text, this); m_fLiteralString = true; } else { string layout = XmlUtils.GetOptionalAttributeValue(caller, "param"); if (layout == null) layout = XmlUtils.GetManditoryAttributeValue(node, "layout"); m_view = new SummaryXmlView(obj.Hvo, layout, stringTbl, this); } UserControl mainControl = new UserControl(); m_view.Dock = DockStyle.Left; m_view.LayoutSizeChanged += new EventHandler(m_view_LayoutSizeChanged); mainControl.Height = m_view.Height; Control = mainControl; m_commandControl = new SummaryCommandControl(this); m_commandControl.Dock = DockStyle.Fill; m_commandControl.Visible = XmlUtils.GetOptionalBooleanAttributeValue(caller, "commandVisible", false); mainControl.Controls.Add(m_commandControl); mainControl.Dock = DockStyle.Fill; mainControl.Controls.Add(m_view); }
protected override int DesiredHeight(RootSite rs) { int height = base.DesiredHeight(rs); // only include the height of the insertion contorl when it is visible if (RuleFormulaControl.InsertionControl.Visible) height += RuleFormulaControl.InsertionControl.Height; return height; }
public override void FinishInit() { base.FinishInit(); string paramType = XmlUtils.GetOptionalAttributeValue(m_configurationNode.ParentNode, "paramType"); if (paramType == "LiteralString") { // Instead of the parameter being a layout name, it is literal text which will be // the whole contents of the slice, with standard properties. string text = XmlUtils.GetManditoryAttributeValue(m_callerNode, "label"); if (m_stringTable != null) text = m_stringTable.LocalizeAttributeValue(text); m_view = new LiteralLabelView(text, this); } else { m_layout = XmlUtils.GetOptionalAttributeValue(m_callerNode, "param") ?? XmlUtils.GetManditoryAttributeValue(m_configurationNode, "layout"); m_collapsedLayout = XmlUtils.GetOptionalAttributeValue(m_callerNode, "collapsedLayout") ?? XmlUtils.GetOptionalAttributeValue(m_configurationNode, "collapsedLayout"); m_view = new SummaryXmlView(m_obj.Hvo, m_layout, m_stringTable, this); m_view.Mediator = Mediator; } var panel = new Panel { Dock = DockStyle.Fill }; Control = panel; m_view.Dock = DockStyle.Left; m_view.LayoutSizeChanged += m_view_LayoutSizeChanged; panel.Controls.Add(m_view); m_button = new ExpandCollapseButton { Dock = DockStyle.Left }; m_button.Click += m_button_Click; panel.Controls.Add(m_button); panel.MouseDown += OnMouseDownInPanel; m_commandControl = new SummaryCommandControl(this) { Dock = DockStyle.Fill, Visible = XmlUtils.GetOptionalBooleanAttributeValue(m_callerNode, "commandVisible", false) }; panel.Controls.Add(m_commandControl); }
/// <summary></summary> public ViewPropertySlice(RootSite ctrlT, ICmObject obj, int flid): base(ctrlT) { Reuse(obj, flid); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Display the Find/Replace modeless dialog /// </summary> /// <param name="fReplace"><c>true</c> to make the replace tab active</param> /// <param name="rootsite">The view where the find will be conducted</param> /// <returns><c>true</c> if the dialog is successfully displayed</returns> /// ------------------------------------------------------------------------------------ public bool ShowFindReplaceDialog(bool fReplace, RootSite rootsite) { CheckDisposed(); if (rootsite == null || rootsite.RootBox == null) return false; int hvoRoot, frag; IVwViewConstructor vc; IVwStylesheet ss; rootsite.RootBox.GetRootObject(out hvoRoot, out vc, out frag, out ss); if (hvoRoot == 0) return false; if (FindReplaceDialog == null) { m_findReplaceDlg = new FwFindReplaceDlg(); ConfigureFindReplacedialog(); } bool fOverlay = (rootsite.RootBox.Overlay != null); if (m_findReplaceDlg.SetDialogValues(rootsite.Cache, FindPattern, rootsite, fReplace, fOverlay, rootsite.FindForm(), this, this)) { m_findReplaceDlg.Show(); return true; } return false; }
/// <summary> /// The height that the slice would ideally be to accommodate the rootsite. /// </summary> /// <param name="rs"></param> /// <returns></returns> protected virtual int DesiredHeight(RootSite rs) { return rs.RootBox.Height; }
protected override int DesiredHeight(RootSite rs) { return Math.Max(base.DesiredHeight(rs), (Control as MSADlgLauncher).LauncherButton.Height); }
/// ------------------------------------------------------------------------------------ /// <summary> /// If there is a mis-spelled word at the specified point, display the spell-check menu and return true. /// Otherwise, return false. /// </summary> /// <param name="pt">The screen position for which the context menu is requested</param> /// <param name="rootsite">The focused rootsite</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ internal bool DoSpellCheckContextMenu(Point pt, RootSite rootsite) { CheckDisposed(); return SpellCheckHelper.ShowContextMenu(pt, rootsite); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Displays the specified context menu for the specified rootsite at the specified /// mouse position. This will also determine whether or not to include the spelling /// correction options. /// </summary> /// ------------------------------------------------------------------------------------ public void ShowContextMenu(Point mousePos, ITMAdapter tmAdapter, RootSite rootsite, string contextMenuName, string addToDictMenuName, string insertBeforeMenuName, string changeMultipleMenuName, bool fShowSpellingOptions) { CheckDisposed(); m_spellCheckStatus = SpellCheckStatus.Disabled; List<string> menuItemNames = null; if (fShowSpellingOptions) { Debug.Assert(rootsite.RootBox == Callbacks.EditedRootBox); menuItemNames = MakeSpellCheckMenuOptions(mousePos, rootsite, tmAdapter, contextMenuName, addToDictMenuName, insertBeforeMenuName, changeMultipleMenuName); m_spellCheckStatus = (menuItemNames == null ? SpellCheckStatus.WordInDictionary : SpellCheckStatus.Enabled); } Point pt = rootsite.PointToScreen(mousePos); tmAdapter.PopupMenu(contextMenuName, pt.X, pt.Y, menuItemNames); }
protected override int DesiredHeight(RootSite rs) { if (rs != null && !rs.AllowLayout) rs.AllowLayout = true; // Fixes LT-13603 where sometimes the slice was constructed by not laid out by now. int height = base.DesiredHeight(rs); // only include the height of the insertion contorl when it is visible if (RuleFormulaControl.InsertionControl.Visible) height += RuleFormulaControl.InsertionControl.Height; return height; }
/// ----------------------------------------------------------------------------------- /// <summary> /// Start the undo task /// </summary> /// <param name="rootSite">The view</param> /// <param name="stid">String resource id used for Undo/Redo labels</param> /// <param name="fSavePoint"><c>true</c> to set a save point</param> /// ----------------------------------------------------------------------------------- public DummyUndoTaskHelper(RootSite rootSite, string stid, bool fSavePoint) : base(rootSite, stid, fSavePoint) { }
/// ----------------------------------------------------------------------------------- /// <summary> /// Start the undo task /// </summary> /// <param name="rootSite">The view</param> /// <param name="stid">String resource id used for Undo/Redo labels</param> /// ----------------------------------------------------------------------------------- public DummyUndoTaskHelper(RootSite rootSite, string stid) : base(rootSite, stid) { }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { // Dispose managed resources here. } // Dispose unmanaged resources here, whether disposing is true or false. m_view = null; // Gets disposed elsewhere, since it is in the Controls collection of another active widget. m_commandControl = null; // Gets disposed elsewhere, since it is in the Controls collection of another active widget. base.Dispose(disposing); }
public ViewPropertySlice(RootSite ctrlT, int hvoObj, int flid): base(ctrlT) { m_hvoContext = hvoObj; m_flid = flid; }
public bool ShowFindReplaceDialog(bool fReplace, RootSite rootsite) { throw new NotImplementedException(); }
/// <summary> /// Override to give the height that the AnalysisInterlinearRs wants to be. /// </summary> /// <param name="rs"></param> /// <returns></returns> protected override int DesiredHeight(RootSite rs) { return ((AnalysisInterlinearRs)rs).DesiredSize.Height; }
protected override void SetupDataContext() { Debug.Assert(m_configurationParameters != null); base.SetupDataContext(); m_rootSite = ConstructRoot(); m_rootSite.Init(m_mediator, m_configurationParameters); // Init it as xCoreColleague. //m_rootSite.PersistenceProvder = new XCore.PersistenceProvider(m_mediator.PropertyTable); m_rootSite.Dock = System.Windows.Forms.DockStyle.Fill; m_rootSite.Cache = Cache; Controls.Add(m_rootSite); m_rootSite.BringToFront(); // Review JohnT: is this needed? }
private List<string> MakeSpellCheckMenuOptions(Point mousePos, RootSite rootsite, ITMAdapter tmAdapter, string menuName, string addToDictMenuName, string changeMultipleMenuName, string insertBeforeMenuName) { int hvoObj, tag, wsAlt, wsText; string word; ISpellEngine dict; bool nonSpellingError; ICollection<SpellCorrectMenuItem> suggestions = SpellCheckHelper.GetSuggestions(mousePos, rootsite, out hvoObj, out tag, out wsAlt, out wsText, out word, out dict, out nonSpellingError); IVwRootBox rootb = rootsite.RootBox; // These two menu items are disabled for non-spelling errors. In addition, for addToDict, we need // to set the tag to an AddToDictMenuItem which can actually do the work. UpdateItemProps(tmAdapter, addToDictMenuName, nonSpellingError, new AddToDictMenuItem(dict, word, rootb, hvoObj, tag, wsAlt, wsText, RootSiteStrings.ksAddToDictionary, Cache)); // any non-null value of tag will indicate the item should be enabled, tested in TeMainWnd.UpdateSpellingMenus. UpdateItemProps(tmAdapter, changeMultipleMenuName, nonSpellingError, "ok to change"); if (suggestions == null) return null; // Make the menu options. List<string> menuItemNames = new List<string>(); TMItemProperties itemProps; if (suggestions.Count == 0) { itemProps = new TMItemProperties(); itemProps.Name = "noSpellingSuggestion"; itemProps.Text = RootSiteStrings.ksNoSuggestions; itemProps.Enabled = false; menuItemNames.Add(itemProps.Name); tmAdapter.AddContextMenuItem(itemProps, menuName, insertBeforeMenuName); } int cSuggestions = 0; string additionalSuggestionsMenuName = "additionalSpellSuggestion"; foreach (SpellCorrectMenuItem scmi in suggestions) { itemProps = new TMItemProperties(); itemProps.Name = "spellSuggestion" + scmi.Text; itemProps.Text = scmi.Text; itemProps.Message = "SpellingSuggestionChosen"; itemProps.CommandId = "CmdSpellingSuggestionChosen"; itemProps.Tag = scmi; itemProps.Font = (wsText == 0) ? null : GetFontForNormalStyle(wsText, rootb.Stylesheet, rootb.DataAccess.WritingSystemFactory); if (cSuggestions++ == kMaxSpellingSuggestionsInRootMenu) { TMItemProperties tmpItemProps = new TMItemProperties(); tmpItemProps.Name = additionalSuggestionsMenuName; tmpItemProps.Text = RootSiteStrings.ksAdditionalSuggestions; menuItemNames.Add(tmpItemProps.Name); tmAdapter.AddContextMenuItem(tmpItemProps, menuName, insertBeforeMenuName); insertBeforeMenuName = null; } if (insertBeforeMenuName != null) { menuItemNames.Add(itemProps.Name); tmAdapter.AddContextMenuItem(itemProps, menuName, insertBeforeMenuName); } else { tmAdapter.AddContextMenuItem(itemProps, menuName, additionalSuggestionsMenuName, null); } } return menuItemNames; }
/// ----------------------------------------------------------------------------------- /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged /// resources; <c>false</c> to release only unmanaged resources. /// </param> /// ----------------------------------------------------------------------------------- protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { if (m_rootSite != null) m_rootSite.Dispose(); } m_rootSite = null; // m_mediator = null; // Bad idea, since superclass still needs it. base.Dispose(disposing); }
internal FreeformAdder(int hvoType, RootSite site, bool fNeedReconstruct, InterlinVc vc) : base(site.Cache) { m_hvoType = hvoType; m_site = site; m_fNeedReconstruct = fNeedReconstruct; m_choices = vc.LineChoices; m_vc = vc; }
private void SetHeightFromRootBox(RootSite rs) { if (rs.RootBox != null) { //Debug.WriteLine(String.Format("ViewSlice.SetHeightFromRootBox(): orig rs.Size = {0}, this.Size = {1}", // rs.Size.ToString(), this.Size.ToString())); int widthOrig = rs.Width; this.Height = Math.Max(LabelHeight, DesiredHeight(rs)); // Allow it to be the height it wants. //Debug.WriteLine(String.Format("ViewSlice.SetHeightFromRootBox(): new rs.Size = {0}, this.Size = {1}", // rs.Size.ToString(), this.Size.ToString())); if (widthOrig != rs.Width) { // If the rootsite width changes, we need to layout again. See LT-6156. (This is too much // like a band-aid, but it's taken me 3 days to figure even this much out!) rs.AllowLayout = true; this.Height = Math.Max(LabelHeight, DesiredHeight(rs)); // Debug.WriteLine(String.Format("ViewSlice.SetHeightFromRootBox(): final rs.Size = {0}, this.Size = {1}", // rs.Size.ToString(), this.Size.ToString())); } } }
protected override int DesiredHeight(RootSite rs) { return Math.Max(base.DesiredHeight(rs), (Control as PhonologicalFeatureListDlgLauncher).LauncherButton.Height); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Start the undo task /// </summary> /// <param name="actionHandler">The action handler.</param> /// <param name="rootSite">The view</param> /// <param name="stid">String resource id used for Undo/Redo labels</param> /// ------------------------------------------------------------------------------------ public DummyUndoTaskHelper(IActionHandler actionHandler, RootSite rootSite, string stid) : base(actionHandler, rootSite, stid) { }