コード例 #1
0
ファイル: UITools.cs プロジェクト: heon21st/flashdevelop
        private void HandleDwellStart(ScintillaControl sci, int position)
        {
            if (OnMouseHover == null || sci == null || DisableEvents) return;
            try
            {
                // check mouse over the editor
                if ((position < 0) || simpleTip.Visible || CompletionList.HasMouseIn) return;
                Point mousePos = sci.PointToClient(Control.MousePosition);
                if (mousePos.X == lastMousePos.X && mousePos.Y == lastMousePos.Y)
                    return;

                lastMousePos = mousePos;
                Rectangle bounds = sci.Bounds;
                if ((mousePos.X < 0) || (mousePos.X > bounds.Width) || (mousePos.Y < 0) || (mousePos.Y > bounds.Height)) return;

                // check no panel is over the editor
                DockPanel panel = PluginBase.MainForm.DockPanel;
                DockContentCollection panels = panel.Contents;
                foreach (DockContent content in panels)
                {
                    if (content.IsHidden) continue;
                    Point pt = content.PointToClient(Control.MousePosition);
                    if (content.ClientRectangle.Contains(pt)
                        && content.GetType().ToString() != "FlashDevelop.Docking.TabbedDocument")
                        return;
                }
                if (OnMouseHover != null) OnMouseHover(sci, position);
            }
            catch (Exception ex)
            {
                ErrorManager.ShowError(ex);
                // disable this feature completely
                OnMouseHover = null;
            }
        }
コード例 #2
0
ファイル: InfoTip.cs プロジェクト: heon21st/flashdevelop
		static public void HandleDwellStart(ScintillaControl sci, int position)
		{
			// check dwell validity
			if (sci == null || CallTipActive) return;
			// TODO: Improve this code: I don't like this solution to check the mouse position
			// check mouse over the editor
			if ((position < 0) || Visible) return;
			Point mousePos = sci.PointToClient(Control.MousePosition);
			Rectangle bounds = sci.Bounds;
			if ((mousePos.X < 0) || (mousePos.X > bounds.Width) || (mousePos.Y < 0) || (mousePos.Y > bounds.Height)) return;
			// check no panel is over the editor
			bool valid = false;
			Form frm = (Form)UITools.MainForm;
			mousePos = frm.PointToClient(Control.MousePosition);
			Control ctrl = frm.GetChildAtPoint(mousePos);
			if (ctrl != null) 
			{
				mousePos = ctrl.PointToClient(Control.MousePosition);
				ctrl = ctrl.GetChildAtPoint(mousePos);
				if (ctrl != null) 
				{
					mousePos = ctrl.PointToClient(Control.MousePosition);
					ctrl = ctrl.GetChildAtPoint(mousePos);
					if (ctrl != null) 
					{
						mousePos = ctrl.PointToClient(Control.MousePosition);
						ctrl = ctrl.GetChildAtPoint(mousePos);
						if (ctrl != null) 
						{
							valid = (ctrl.GetType().ToString() == "FlashDevelop.TabbedDocument");
						}
					}
				}
			}
			if (valid && OnMouseHover != null) OnMouseHover(sci, position);
		}