static void DestroyWindow ()
		{
			if (window != null) {
				window.Destroy ();
				window = null;
			}
		}
예제 #2
0
 static void DestroyWindow()
 {
     if (window != null)
     {
         window.Destroy();
         window = null;
     }
 }
        internal static void UpdateWindow(CompletionTextEditorExtension textEditorExtension, ICompletionWidget completionWidget)
        {
            // Updates the parameter information window from the information
            // of the current method overload
            if (methods.Count > 0)
            {
                if (window == null)
                {
                    window                = new ParameterInformationWindow();
                    window.Ext            = textEditorExtension;
                    window.Widget         = completionWidget;
                    window.SizeAllocated += delegate(object o, SizeAllocatedArgs args)
                    {
                        if (args.Allocation.Width == lastW && args.Allocation.Height == lastH && wasVisi == CompletionWindowManager.IsVisible)
                        {
                            return;
                        }
                        PositionParameterInfoWindow(args.Allocation);
                    };
                    window.Hidden += delegate
                    {
                        lastW = -1;
                        lastH = -1;
                    };
                }
                else
                {
                    window.Ext    = textEditorExtension;
                    window.Widget = completionWidget;
                }
                wasAbove = false;
                var lastMethod = methods [methods.Count - 1];
                int curParam   = window.Ext != null?window.Ext.GetCurrentParameterIndex(lastMethod.MethodProvider.StartOffset) : 0;

                var geometry2 = DesktopService.GetUsableMonitorGeometry(window.Screen, window.Screen.GetMonitorAtPoint(X, Y));
                window.ShowParameterInfo(lastMethod.MethodProvider, lastMethod.CurrentOverload, curParam - 1, geometry2.Width);
                window.ChangeOverload();
                PositionParameterInfoWindow(window.Allocation);
                window.Show();
            }

            if (methods.Count == 0)
            {
                if (window != null)
                {
//					window.HideParameterInfo ();
                    DestroyWindow();
                    wasAbove = false;
                    wasVisi  = false;
                    lastW    = -1;
                    lastH    = -1;
                }
                return;
            }
        }
        internal static async void UpdateWindow(CompletionTextEditorExtension textEditorExtension, ICompletionWidget completionWidget)
        {
            // Updates the parameter information window from the information
            // of the current method overload
            if (currentMethodGroup != null)
            {
                if (window == null)
                {
                    window                = new ParameterInformationWindow();
                    window.Ext            = textEditorExtension;
                    window.Widget         = completionWidget;
                    window.BoundsChanged += (o, args) => {
                        if (window.Size.Width == lastW && window.Size.Height == lastH && wasCompletionWindowVisible == (CompletionWindowManager.Wnd?.Visible ?? false))
                        {
                            return;
                        }
                        PositionParameterInfoWindow(window.ScreenBounds);
                    };
                    window.Hidden += delegate {
                        lastW = -1;
                        lastH = -1;
                    };
                }
                else
                {
                    window.Ext    = textEditorExtension;
                    window.Widget = completionWidget;
                }

                wasAbove = false;
                int curParam = window.Ext != null ? await window.Ext.GetCurrentParameterIndex(currentMethodGroup.MethodProvider.StartOffset) : 0;

                var geometry2 = window.Visible ? window.Screen.VisibleBounds.Width : 480;
                window.ShowParameterInfo(currentMethodGroup.MethodProvider, currentMethodGroup.CurrentOverload, curParam - 1, (int)geometry2);
                PositionParameterInfoWindow(window.ScreenBounds);
            }

            if (currentMethodGroup == null)
            {
                if (window != null)
                {
                    window.HideParameterInfo();
//					DestroyWindow ();
                    wasAbove = false;
                    wasCompletionWindowVisible = false;
                    lastW = -1;
                    lastH = -1;
                }
                return;
            }
        }
        internal static async void UpdateWindow(CompletionTextEditorExtension textEditorExtension, ICompletionWidget completionWidget)
        {
            // Updates the parameter information window from the information
            // of the current method overload
            if (currentMethodGroup != null)
            {
                if (window == null)
                {
                    window                = new ParameterInformationWindow();
                    window.Ext            = textEditorExtension;
                    window.Widget         = completionWidget;
                    window.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                        if (args.Allocation.Width == lastW && args.Allocation.Height == lastH && wasCompletionWindowVisible == (CompletionWindowManager.Wnd?.Visible ?? false))
                        {
                            return;
                        }
                        PositionParameterInfoWindow(args.Allocation);
                    };
                    window.Hidden += delegate {
                        lastW = -1;
                        lastH = -1;
                    };
                }
                else
                {
                    window.Ext    = textEditorExtension;
                    window.Widget = completionWidget;
                }
                wasAbove = false;
                int curParam = window.Ext != null ? await window.Ext.GetCurrentParameterIndex(currentMethodGroup.MethodProvider.StartOffset) : 0;

                var geometry2 = DesktopService.GetUsableMonitorGeometry(window.Screen.Number, window.Screen.GetMonitorAtPoint(X, Y));
                window.ShowParameterInfo(currentMethodGroup.MethodProvider, currentMethodGroup.CurrentOverload, curParam - 1, (int)geometry2.Width);
                PositionParameterInfoWindow(window.Allocation);
            }

            if (currentMethodGroup == null)
            {
                if (window != null)
                {
                    window.HideParameterInfo();
//					DestroyWindow ();
                    wasAbove = false;
                    wasCompletionWindowVisible = false;
                    lastW = -1;
                    lastH = -1;
                }
                return;
            }
        }
        internal static void UpdateWindow(CompletionTextEditorExtension textEditorExtension, ICompletionWidget completionWidget)
        {
            // Updates the parameter information window from the information
            // of the current method overload
            if (currentMethodGroup != null)
            {
                if (window == null)
                {
                    window                = new ParameterInformationWindow();
                    window.Ext            = textEditorExtension;
                    window.Widget         = completionWidget;
                    window.BoundsChanged += WindowBoundsChanged;
                    window.Hidden        += delegate {
                        lastW = -1;
                        lastH = -1;
                    };
                }
                else
                {
                    window.Ext    = textEditorExtension;
                    window.Widget = completionWidget;
                }

                wasAbove = false;
                PositionParameterInfoWindow();
            }

            if (currentMethodGroup == null)
            {
                if (window != null)
                {
                    window.HideParameterInfo();
//					DestroyWindow ();
                    wasAbove = false;
                    wasCompletionWindowVisible = false;
                    lastW = -1;
                    lastH = -1;
                }
                return;
            }
        }
		internal static void UpdateWindow (ICompletionWidget widget)
		{
			// Updates the parameter information window from the information
			// of the current method overload
			if (window == null && methods.Count > 0) {
				window = new ParameterInformationWindow ();
				wasAbove = false;
			}
			
			if (methods.Count == 0) {
				if (window != null) {
					window.Hide ();
					wasAbove = false;
				}
				return;
			}
			var ctx = widget.CurrentCodeCompletionContext;
			MethodData md = methods[methods.Count - 1];
			int cparam = md.MethodProvider.GetCurrentParameterIndex (widget, md.CompletionContext);
			Gtk.Requisition reqSize = window.ShowParameterInfo (md.MethodProvider, md.CurrentOverload, cparam - 1);
			X = md.CompletionContext.TriggerXCoord;
			if (CompletionWindowManager.IsVisible) {
				// place above
				Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - reqSize.Height - 10;
			} else {
				// place below
				Y = ctx.TriggerYCoord;
			}
			
			Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry (window.Screen, window.Screen.GetMonitorAtPoint (X + reqSize.Width, Y));
		
			if (X + reqSize.Width > geometry.Right)
				X = geometry.Right - reqSize.Width;
			
			if (Y < geometry.Top)
				Y = ctx.TriggerYCoord;
			
			if (wasAbove || Y + reqSize.Height > geometry.Bottom) {
				Y = Y - ctx.TriggerTextHeight - reqSize.Height - 4;
				wasAbove = true;
			}
			
			if (CompletionWindowManager.IsVisible) {
				Rectangle completionWindow = new Rectangle (CompletionWindowManager.X, CompletionWindowManager.Y,
				                                            CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height);
				if (completionWindow.IntersectsWith (new Rectangle (X, Y, reqSize.Width, reqSize.Height))) {
					X = completionWindow.X;
					Y = completionWindow.Y - reqSize.Height - 6;
					if (Y < 0)
						Y = completionWindow.Bottom + 6;
				}
			}
			
			window.Move (X, Y);
			window.Show ();
			
		}
예제 #8
0
        internal static void UpdateWindow(ICompletionWidget widget)
        {
            // Updates the parameter information window from the information
            // of the current method overload
            if (window == null && methods.Count > 0)
            {
                window   = new ParameterInformationWindow();
                wasAbove = false;
            }

            if (methods.Count == 0)
            {
                if (window != null)
                {
                    window.Hide();
                    wasAbove = false;
                }
                return;
            }
            var        ctx    = widget.CurrentCodeCompletionContext;
            MethodData md     = methods[methods.Count - 1];
            int        cparam = md.MethodProvider.GetCurrentParameterIndex(widget, md.CompletionContext);

            Gtk.Requisition reqSize = window.ShowParameterInfo(md.MethodProvider, md.CurrentOverload, cparam - 1);
            X = md.CompletionContext.TriggerXCoord;
            if (CompletionWindowManager.IsVisible)
            {
                // place above
                Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - reqSize.Height - 10;
            }
            else
            {
                // place below
                Y = ctx.TriggerYCoord;
            }

            Gdk.Rectangle geometry = window.Screen.GetMonitorGeometry(window.Screen.GetMonitorAtPoint(X, Y));

            if (X + reqSize.Width > geometry.Right)
            {
                X = geometry.Right - reqSize.Width;
            }

            if (Y < geometry.Top)
            {
                Y = ctx.TriggerYCoord;
            }

            if (wasAbove || Y + reqSize.Height > geometry.Bottom)
            {
                Y        = Y - ctx.TriggerTextHeight - reqSize.Height - 4;
                wasAbove = true;
            }

            if (CompletionWindowManager.IsVisible)
            {
                Rectangle completionWindow = new Rectangle(CompletionWindowManager.X, CompletionWindowManager.Y,
                                                           CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height);
                if (completionWindow.IntersectsWith(new Rectangle(X, Y, reqSize.Width, reqSize.Height)))
                {
                    X = completionWindow.X;
                    Y = completionWindow.Y - reqSize.Height - 6;
                    if (Y < 0)
                    {
                        Y = completionWindow.Bottom + 6;
                    }
                }
            }

            window.Move(X, Y);
            window.Show();
        }
		internal static async void UpdateWindow (CompletionTextEditorExtension textEditorExtension, ICompletionWidget completionWidget)
		{
			// Updates the parameter information window from the information
			// of the current method overload
			if (currentMethodGroup != null) {
				if (window == null) {
					window = new ParameterInformationWindow ();
					window.Ext = textEditorExtension;
					window.Widget = completionWidget;
					window.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
						if (args.Allocation.Width == lastW && args.Allocation.Height == lastH && wasVisi == CompletionWindowManager.IsVisible)
							return;
						PositionParameterInfoWindow (args.Allocation);
					};
					window.Hidden += delegate {
						lastW = -1;
						lastH = -1;
					};
				} else {
					window.Ext = textEditorExtension;
					window.Widget = completionWidget;
				}
				wasAbove = false;
				int curParam = window.Ext != null ? await window.Ext.GetCurrentParameterIndex (currentMethodGroup.MethodProvider.StartOffset) : 0;
				var geometry2 = DesktopService.GetUsableMonitorGeometry (window.Screen.Number, window.Screen.GetMonitorAtPoint (X, Y));
				window.ShowParameterInfo (currentMethodGroup.MethodProvider, currentMethodGroup.CurrentOverload, curParam - 1, (int)geometry2.Width);
				PositionParameterInfoWindow (window.Allocation);
			}
			
			if (currentMethodGroup == null) {
				if (window != null) {
					window.HideParameterInfo ();
//					DestroyWindow ();
					wasAbove = false;
					wasVisi = false;
					lastW = -1;
					lastH = -1;
				}
				return;
			}
		}