/// <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. if (m_editingHelper != null) { m_editingHelper.Dispose(); } if (m_RootSite != null) { m_RootSite.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_editingHelper = null; m_RootSite = null; base.Dispose(disposing); }
public void GetWSForInputMethod_PrefersWSCurrentIfEqualMatches() { var wsEn = new CoreWritingSystemDefinition("en"); var wsEnUS = new CoreWritingSystemDefinition("en-US"); var wsEnIpa = new CoreWritingSystemDefinition("en-fonipa"); var wsFr = new CoreWritingSystemDefinition("fr"); var wsDe = new CoreWritingSystemDefinition("de"); DefaultKeyboardDefinition kbdEn = CreateKeyboard("English", "en-US"); wsEn.LocalKeyboard = kbdEn; DefaultKeyboardDefinition kbdEnIpa = CreateKeyboard("English-IPA", "en-US"); wsEnIpa.LocalKeyboard = kbdEnIpa; wsEnUS.LocalKeyboard = kbdEn; // exact same keyboard used! DefaultKeyboardDefinition kbdFr = CreateKeyboard("French", "fr-FR"); wsFr.LocalKeyboard = kbdFr; DefaultKeyboardDefinition kbdDe = CreateKeyboard("German", "de-DE"); wsDe.LocalKeyboard = kbdDe; CoreWritingSystemDefinition[] wss = { wsEn, wsFr, wsDe, wsEnIpa, wsEnUS }; // Exact matches Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEn, wsFr, wss), Is.EqualTo(wsEn)); // first of 2 Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEn, wsEn, wss), Is.EqualTo(wsEn)); // prefer default Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEn, wsEnUS, wss), Is.EqualTo(wsEnUS)); // prefer default }
public void OnFwRightMouseClick(SimpleRootSite sender, FwRightMouseClickEventArgs e) { CheckDisposed(); XmlBrowseView browseView = sender as XmlBrowseView; if (browseView != null) { IVwSelection sel = e.Selection; int clev = sel.CLevels(false); // anchor int hvoRoot, tag, ihvo, cpropPrevious; IVwPropertyStore vps; sel.PropInfo(false, clev - 1, out hvoRoot, out tag, out ihvo, out cpropPrevious, out vps); // First make the selection so it will be highlighted before the context menu popup. if (browseView.SelectedIndex != ihvo) // No sense in waking up the beast for no reason. { browseView.SelectedIndex = ihvo; } int hvo = browseView.HvoAt(ihvo); CmObjectUi ui = CmObjectUi.MakeUi(Cache, hvo); if (ui != null) { e.EventHandled = ui.HandleRightClick(m_mediator, sender, true, "mnuBrowseView"); } } }
/// <summary> /// Initializes a new instance of the <see cref="BaseFragmentProvider{TFragmentProvider}"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="site">The site.</param> /// <param name="childControlFactory">The child control factory.</param> protected BaseFragmentProvider(IChildControlNavigation parent, SimpleRootSite site, Func <TFragmentProvider, Func <IChildControlNavigation, IList <IRawElementProviderFragment> > > childControlFactory) : this(parent, site) { // Setup child control creation m_childControlFactory = childControlFactory(this as TFragmentProvider); }
/// <summary> /// Initializes a new instance of the <see cref="VwSelectionBasedControl{TSelectionBasedControl}"/> class. /// </summary> /// <param name="parent">The control parent.</param> /// <param name="site">The site.</param> /// <param name="selection">The selection.</param> /// <param name="childControlFactory">The child control factory.</param> protected VwSelectionBasedControl(IChildControlNavigation parent, SimpleRootSite site, IVwSelection selection, Func <TSelectionBasedControl, Func <IChildControlNavigation, IList <IRawElementProviderFragment> > > childControlFactory) : base(parent, site, childControlFactory) { Selection = selection; m_site.Invoke(ComputeScreenBoundingRectangle); }
/// <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 virtual void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (m_isDisposed) { return; } if (disposing) { // Dispose managed resources here. // The previous comment was not correct, as this code was indeed being executed when // the parent was null. A DestroyHandle has been added to help with the re-entrant processing. Debug.Assert(m_Parent != null && !m_Parent.IsDisposed && !m_Parent.Disposing); if (m_Parent != null) { m_Parent.UninitGraphics(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_Parent = null; m_isDisposed = true; }
/// <summary> /// /// </summary> public override void TestSetup() { base.TestSetup(); m_RootSite = new DummySimpleRootSite(Cache); m_editingHelper = new DummyFootnoteEditingHelper(Cache, m_RootSite); }
public void OnFwRightMouseClick(SimpleRootSite sender, FwRightMouseClickEventArgs e) { CheckDisposed(); var browseView = sender as XmlBrowseView; if (browseView != null) { IVwSelection sel = e.Selection; int clev = sel.CLevels(false); // anchor int hvoRoot, tag, ihvo, cpropPrevious; IVwPropertyStore vps; sel.PropInfo(false, clev - 1, out hvoRoot, out tag, out ihvo, out cpropPrevious, out vps); // First make the selection so it will be highlighted before the context menu popup. if (browseView.SelectedIndex != ihvo) // No sense in waking up the beast for no reason. { browseView.SelectedIndex = ihvo; } int hvo = browseView.HvoAt(ihvo); if (Cache.ServiceLocator.IsValidObjectId(hvo)) // may be fake one from decorator. { CmObjectUi ui = CmObjectUi.MakeUi(Cache, hvo); // Disposes of itself when menu closes since true passed in lext line. if (ui != null) { ui.Mediator = m_mediator; ui.PropTable = m_propertyTable; e.EventHandled = ui.HandleRightClick(m_mediator, m_propertyTable, sender, true, "mnuBrowseView"); } } } }
/// <summary> /// Creates a new instance of InputBusController for a supplied instance of a SimpleRootSite. /// </summary> public InputBusController(SimpleRootSite simpleRootSite, IIBusCommunicator ibusCommunicator) { if (simpleRootSite == null) { throw new ArgumentException("simpleRootSite"); } if (ibusCommunicator == null) { throw new ArgumentException("ibusCommunicator"); } IBusCommunicator = ibusCommunicator; if (!IBusCommunicator.Connected) { return; } AssociatedSimpleRootSite = simpleRootSite; IBusCommunicator.CreateInputContext("SimpleRootSite"); IBusCommunicator.CommitText += CommitTextEventHandler; IBusCommunicator.UpdatePreeditText += UpdatePreeditTextEventHandler; IBusCommunicator.HidePreeditText += HidePreeditTextEventHandler; IBusCommunicator.ForwardKeyEvent += HandleIBusCommunicatorForwardKeyEvent; }
/// <summary> /// This code exactly matches code in ReferenceVectorSlice; could we refactor somehow? /// </summary> /// <param name="e"></param> protected override void OnSizeChanged(EventArgs e) { base.OnSizeChanged(e); if (this.Width == m_dxLastWidth) { return; } m_dxLastWidth = Width; // BEFORE doing anything, actions below may trigger recursive call. ReferenceLauncher rl = (ReferenceLauncher)this.Control; SimpleRootSite view = (SimpleRootSite)rl.MainControl; view.PerformLayout(); int h1 = view.RootBox.Height; int hNew = Math.Max(h1, ContainingDataTree.GetMinFieldHeight()); //When the slice is first created view.RootBox.Height is 0 and //GetMinFieldHeight returns a constant of 18 so this is too short //especially with Arabic scripts (see LT-7327) hNew = Math.Max(hNew, Font.Height) + 3; if (hNew != this.Height) { this.Height = hNew; } }
public void GetWsForInputMethod_CorrectlyPrioritizesInputMethod() { var wsEn = new CoreWritingSystemDefinition("en"); var wsEnIpa = new CoreWritingSystemDefinition("en-fonipa"); var wsFr = new CoreWritingSystemDefinition("fr"); var wsDe = new CoreWritingSystemDefinition("de"); DefaultKeyboardDefinition kbdEn = CreateKeyboard("English", "en-US"); wsEn.LocalKeyboard = kbdEn; DefaultKeyboardDefinition kbdEnIpa = CreateKeyboard("English-IPA", "en-US"); wsEnIpa.LocalKeyboard = kbdEnIpa; DefaultKeyboardDefinition kbdFr = CreateKeyboard("French", "fr-FR"); wsFr.LocalKeyboard = kbdFr; DefaultKeyboardDefinition kbdDe = CreateKeyboard("German", "de-DE"); wsDe.LocalKeyboard = kbdDe; CoreWritingSystemDefinition[] wss = { wsEn, wsFr, wsDe, wsEnIpa }; // Exact match selects correct one, even though there are other matches for layout and/or culture Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEn, wsFr, wss), Is.EqualTo(wsEn)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEnIpa, wsEn, wss), Is.EqualTo(wsEnIpa)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdFr, wsDe, wss), Is.EqualTo(wsFr)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdDe, wsEn, wss), Is.EqualTo(wsDe)); }
/// <summary> /// Initializes a new instance of the <see cref="UiaButton"/> class. /// </summary> /// <param name="parent">The parent control.</param> /// <param name="site">The site.</param> /// <param name="selection">The selection.</param> /// <param name="buttonName">The name of the button control is the text that is used to label it. /// Whenever an image is used to label a button, alternate text must be supplied for the button's Name property. /// (e.g. "Drop Down Button")</param> protected UiaButton(IChildControlNavigation parent, SimpleRootSite site, IVwSelection selection, string buttonName) : base(parent, site, selection, button => button.CreateLabelImage) { // Localized string corresponding to the Button control type. AddStaticProperty(AutomationElementIdentifiers.LocalizedControlTypeProperty.Id, Properties.Resources.ksButton); // The name of the button control is the text that is used to label it. Whenever an image is used to label a button, // alternate text must be supplied for the button's Name property. AddStaticProperty(AutomationElementIdentifiers.NameProperty.Id, buttonName); AddStaticProperty(AutomationElementIdentifiers.ControlTypeProperty.Id, null); // ControlType.Button // The Button control must always be content. AddStaticProperty(AutomationElementIdentifiers.IsContentElementProperty.Id, true); // The Button control must always be a control. AddStaticProperty(AutomationElementIdentifiers.IsControlElementProperty.Id, true); // The Button control typically must support an accelerator key to enable an end user to perform the action it represents quickly from the keyboard. AddStaticProperty(AutomationElementIdentifiers.AcceleratorKeyProperty.Id, null); // The value of this property needs to be unique across all controls in an application. AddStaticProperty(AutomationElementIdentifiers.AutomationIdProperty.Id, null); // The outermost rectangle that contains the whole control. AddStaticProperty(AutomationElementIdentifiers.BoundingRectangleProperty.Id, null); // Supported if there is a bounding rectangle. If not every point within the bounding // rectangle is clickable, and you perform specialized hit testing, then override and provide a clickable point. AddStaticProperty(AutomationElementIdentifiers.ClickablePointProperty.Id, null); // The Help Text can indicate what the end result of activating the button will be. // This is typically the same type of information presented through a ToolTip. AddStaticProperty(AutomationElementIdentifiers.HelpTextProperty.Id, null); // If the control can receive keyboard focus, it must support this property. AddStaticProperty(AutomationElementIdentifiers.IsKeyboardFocusableProperty.Id, true); // Button controls are self-labeled by their contents. AddStaticProperty(AutomationElementIdentifiers.LabeledByProperty.Id, null); }
/// <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. SimpleRootSite rs = RootSite; if (rs != null) { rs.LayoutSizeChanged -= new EventHandler(this.HandleLayoutSizeChanged); rs.Enter -= new EventHandler(ViewSlice_Enter); rs.SizeChanged -= new EventHandler(rs_SizeChanged); } } // Dispose unmanaged resources here, whether disposing is true or false. base.Dispose(disposing); }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_RootSite = new DummySimpleRootSite(Cache); m_editingHelper = new DummyFootnoteEditingHelper(Cache, m_RootSite); }
/// <summary> /// Initializes a new instance of the <see cref="ImageControl"/> class. /// </summary> /// <param name="parent">The parent control.</param> /// <param name="site">The site.</param> /// <param name="selection">The selection.</param> public ImageControl(IChildControlNavigation parent, SimpleRootSite site, IVwSelection selection) : base(parent, site, selection) { #if !__MonoCS__ // Localized string corresponding to the Image control type. AddStaticProperty(AutomationElementIdentifiers.LocalizedControlTypeProperty.Id, Properties.Resources.ksImage); #endif }
/// -------------------------------------------------------------------------------- /// <summary> /// Initializes the graphics object /// </summary> /// <param name="parent">Containing rootsite</param> /// -------------------------------------------------------------------------------- public HoldGraphics(SimpleRootSite parent) { if (parent.Disposing || parent.IsDisposed) { return; // don't do anything if the parent is disposing or already disposed } m_Parent = parent; m_Parent.InitGraphics(); }
/// <summary> /// /// </summary> public override void TestTearDown() { m_editingHelper.Dispose(); m_editingHelper = null; m_RootSite.Dispose(); m_RootSite = null; base.TestTearDown(); }
/// <summary> /// Initializes a new instance of the <see cref="SimpleRootSiteEditControl"/> class. /// </summary> /// <param name="parent">The parent control.</param> /// <param name="site">The site.</param> /// <param name="editableSelection">The editable selection.</param> /// <param name="label">The label.</param> public SimpleRootSiteEditControl(IChildControlNavigation parent, SimpleRootSite site, IVwSelection editableSelection, string label) : base(parent, site, editableSelection) { m_rootb = editableSelection.RootBox; Label = label; DocumentRange = new SimpleRootSiteTextRangeProvider(m_site, Selection); // Localized string corresponding to the Edit control type. AddStaticProperty(AutomationElementIdentifiers.LocalizedControlTypeProperty.Id, Properties.Resources.ksEdit); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Process left or right mouse button down /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (Group.Slaves[DraftViewSlaveIndex] is SimpleRootSite) { SimpleRootSite view = (SimpleRootSite)Group.Slaves[DraftViewSlaveIndex]; view.ShowRangeSelAfterLostFocus = true; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Shows the Format Apply Style dialog. Apply the results to the selection of the active /// view if the user clicks OK. /// </summary> /// <param name="paraStyleName">Name of the para style.</param> /// <param name="charStyleName">Name of the char style.</param> /// <param name="maxStyleLevel">The maximum style level that will be shown in this /// dialog. (apps that do not use style levels in their stylesheets can pass 0)</param> /// ------------------------------------------------------------------------------------ public void ShowApplyStyleDialog(string paraStyleName, string charStyleName, int maxStyleLevel) { SimpleRootSite rootsite = (ActiveView as SimpleRootSite); try { if (rootsite != null) { rootsite.ShowRangeSelAfterLostFocus = true; } int hvoRoot, frag; IVwViewConstructor vc; IVwStylesheet ss; ActiveView.CastAsIVwRootSite().RootBox.GetRootObject(out hvoRoot, out vc, out frag, out ss); using (FwApplyStyleDlg applyStyleDlg = new FwApplyStyleDlg(ActiveView.CastAsIVwRootSite(), Cache, StyleSheet.RootObjectHvo, StyleSheetOwningFlid, StyleSheet.GetDefaultBasedOnStyleName(), maxStyleLevel, paraStyleName, charStyleName, hvoRoot, FwApp.App, FwApp.App)) { if (FwEditingHelper != null) { if (FwEditingHelper.ApplicableStyleContexts != null) { applyStyleDlg.ApplicableStyleContexts = FwEditingHelper.ApplicableStyleContexts; } } else if (FwApp.App != null) { // Window doesn't have an editing helper, go with whole-app default if (FwApp.App.DefaultStyleContexts != null) { applyStyleDlg.ApplicableStyleContexts = FwApp.App.DefaultStyleContexts; } } applyStyleDlg.AllowSelectStyleTypes = m_callbacks.ShowSelectStylesComboInStylesDialog; IVwSelection sel = EditingHelper.CurrentSelection.Selection; applyStyleDlg.CanApplyCharacterStyle = sel.CanFormatChar; applyStyleDlg.CanApplyParagraphStyle = sel.CanFormatPara; if (applyStyleDlg.ShowDialog(m_callbacks) == DialogResult.OK) { EditingHelper.ApplyStyle(applyStyleDlg.StyleChosen); } } } finally { if (rootsite != null) { rootsite.ShowRangeSelAfterLostFocus = false; } } }
public override void Exit() { CheckDisposed(); m_editingHelper.Dispose(); m_editingHelper = null; m_RootSite.Dispose(); m_RootSite = null; base.Exit(); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Creates and shows a context menu with spelling suggestions. /// </summary> /// <param name="pt">The location on the screen of the word for which we want spelling /// suggestions (usually the mouse position)</param> /// <param name="rootsite">The focused rootsite</param> /// <returns><c>true</c> if a menu was created and shown (with at least one item); /// <c>false</c> otherwise</returns> /// ----------------------------------------------------------------------------------- public bool ShowContextMenu(Point pt, SimpleRootSite rootsite) { ContextMenuStrip menu = new ContextMenuStrip(); MakeSpellCheckMenuOptions(pt, rootsite, menu); if (menu.Items.Count == 0) { return(false); } menu.Show(rootsite, pt); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="BaseFragmentProvider{TFragmentProvider}"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="site">The site.</param> protected BaseFragmentProvider(IChildControlNavigation parent, SimpleRootSite site) { m_parent = parent; #if !__MonoCS__ if (parent != null) { m_rootProvider = parent.FragmentRoot; } else #endif m_rootProvider = this as IRawElementProviderFragmentRoot; m_site = site; }
void HandleRightMouseClickedEvent(SimpleRootSite sender, FwRightMouseClickEventArgs e) { string sMenu = XmlUtils.GetOptionalAttributeValue(this.ConfigurationNode, "contextMenu"); if (String.IsNullOrEmpty(sMenu)) { return; } e.EventHandled = true; e.Selection.Install(); XWindow xwind = (XWindow)this.Mediator.PropertyTable.GetValue("window"); xwind.ShowContextMenu(sMenu, new Point(Cursor.Position.X, Cursor.Position.Y), null, null); }
public SelectionWrapper(SimpleRootSite rootSite) { SelectionHelper = new SelectionHelper(rootSite.EditingHelper.CurrentSelection); ITsTextProps[] textProps; IVwPropertyStore[] propertyStores; int numberOfProps; SelectionHelper.GetSelectionProps(SelectionHelper.Selection, out textProps, out propertyStores, out numberOfProps); if (numberOfProps > 0) { m_TextProps = textProps; } }
public void GetWSForInputMethod_PrefersCurrentLayoutIfTwoMatch() { var wsEn = new CoreWritingSystemDefinition("en"); var wsFr = new CoreWritingSystemDefinition("fr"); DefaultKeyboardDefinition kbdEn = CreateKeyboard("English", "en-US"); wsEn.LocalKeyboard = kbdEn; DefaultKeyboardDefinition kbdFr = CreateKeyboard("French", "fr-FR"); wsFr.LocalKeyboard = kbdFr; DefaultKeyboardDefinition kbdDe = CreateKeyboard("German", "de-DE"); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdDe, wsEn, new[] { wsEn, wsFr }), Is.EqualTo(wsEn)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdDe, wsFr, new[] { wsEn, wsFr }), Is.EqualTo(wsFr)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdDe, wsEn, new[] { wsFr, wsEn }), Is.EqualTo(wsEn)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdDe, wsFr, new[] { wsFr, wsEn }), Is.EqualTo(wsFr)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the control. This consists of calling MakeRoot and creating the handle /// of the control. /// </summary> /// <param name="cell">The cell.</param> /// ------------------------------------------------------------------------------------ private void InitControl(DataGridViewControlCell cell) { if (cell.ControlCreateInfo == null) { return; } Control c = cell.ControlCreateInfo.Control; if (c is SimpleRootSite) { SimpleRootSite rootSite = c as SimpleRootSite; rootSite.AllowLayout = false; rootSite.MakeRoot(); } cell.Control = c; }
public void GetWSForInputMethod_GetsMatchingWSByInputMethod() { var wsEn = new CoreWritingSystemDefinition("en"); var wsFr = new CoreWritingSystemDefinition("fr"); DefaultKeyboardDefinition kbdEn = CreateKeyboard("English", "en-US"); wsEn.LocalKeyboard = kbdEn; DefaultKeyboardDefinition kbdFr = CreateKeyboard("French", "fr-FR"); wsFr.LocalKeyboard = kbdFr; Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEn, wsEn, new[] { wsEn, wsFr }), Is.EqualTo(wsEn)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEn, wsFr, new[] { wsEn, wsFr }), Is.EqualTo(wsEn)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEn, wsEn, new[] { wsFr, wsEn }), Is.EqualTo(wsEn)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdEn, wsFr, new[] { wsFr, wsEn }), Is.EqualTo(wsEn)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdFr, wsEn, new[] { wsFr, wsEn }), Is.EqualTo(wsFr)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdFr, wsEn, new[] { wsEn, wsFr }), Is.EqualTo(wsFr)); Assert.That(SimpleRootSite.GetWSForInputMethod(kbdFr, null, new[] { wsEn, wsFr }), Is.EqualTo(wsFr)); }
/// <summary> /// This code exactly matches code in ReferenceVectorSlice; could we refactor somehow? /// </summary> /// <param name="e"></param> protected override void OnSizeChanged(EventArgs e) { base.OnSizeChanged(e); if (this.Width == m_dxLastWidth) { return; } m_dxLastWidth = Width; // BEFORE doing anything, actions below may trigger recursive call. ReferenceLauncher rl = (ReferenceLauncher)this.Control; SimpleRootSite view = (SimpleRootSite)rl.MainControl; view.PerformLayout(); int h1 = view.RootBox.Height; int hNew = Math.Max(h1, ContainingDataTree.GetMinFieldHeight()) + 3; if (hNew != this.Height) { this.Height = hNew; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="SelectionRestorer"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public SelectionRestorer(SimpleRootSite rootSite) { // we can't use EditingHelper.CurrentSelection here because the scroll position // of the selection may have changed. m_savedSelection = SelectionHelper.Create(rootSite); m_rootSite = rootSite; Rectangle rcSrc, rcDst; rootSite.GetCoordRects(out rcSrc, out rcDst); try { IVwSelection sel = rootSite.RootBox.MakeSelAt(5, 5, rcSrc, rcDst, false); m_topOfViewSelection = SelectionHelper.Create(sel, rootSite); } catch (COMException) { // Just ignore any errors } }
public DummyRootBox(SimpleRootSite srs) { m_dummySimpleRootSite = srs; m_dummySelection = new DummyVwSelection(this, 0, 0); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a new dummy selection helper /// </summary> /// <param name="rootSite"></param> /// <returns></returns> /// ------------------------------------------------------------------------------------ public static DummySelectionHelper Create(SimpleRootSite rootSite) { return new DummySelectionHelper(SelectionHelper.Create(null, rootSite)); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Create a selection helper based on an existing selection /// </summary> /// ----------------------------------------------------------------------------------- public DummySelectionHelper(IVwSelection vwSel, SimpleRootSite rootSite) : base(vwSel, rootSite) { }