Пример #1
0
 private void InitChart()
 {
     XVolate.Add("0");
     YVolateAndCn.Add(0);
     YVolateAndCn2.Add(0);
     YVolateAndCn3.Add(0);
     YVolateAndCn4.Add(0);
     XFre.Add("0");
     YVolateAndCurrent.Add(0);
     YVolateAndCurrent2.Add(0);
     YVolateAndCurrent3.Add(0);
     YVolateAndCurrent4.Add(0);
     XTime.Add("0");
     YVolateAndTan.Add(0);
     YVolateAndTan2.Add(0);
     YVolateAndTan3.Add(0);
     YVolateAndTan4.Add(0);
 }
	// Dispatch an event to this widget.
	internal override void DispatchEvent(ref XEvent xevent)
			{
				ButtonName button;
				XTime time;
	
				switch((EventType)(xevent.xany.type__))
				{
					case EventType.ButtonPress:
					{
						// Process button events.
						button = xevent.xbutton.button;
						time = xevent.xbutton.time;
						if(lastClickButton == button &&
						   lastClickTime != XTime.CurrentTime &&
						   (time - lastClickTime) < 500)
						{
							OnButtonDoubleClick(xevent.xbutton.x,
								        		xevent.xbutton.y, button,
								        		xevent.xbutton.state);
							time = XTime.CurrentTime;
						}
						else
						{
							OnButtonPress(xevent.xbutton.x,
								  		  xevent.xbutton.y, button,
								  		  xevent.xbutton.state);
						}
						lastClickTime = time;
						lastClickButton = button;
					}
					break;

					case EventType.ButtonRelease:
					{
						// Dispatch a button release event.
						button = xevent.xbutton.button;
						OnButtonRelease(xevent.xbutton.x,
										xevent.xbutton.y, button,
										xevent.xbutton.state);
					}
					break;

					case EventType.MotionNotify:
					{
						// Dispatch a pointer motion event.
						OnPointerMotion(xevent.xmotion.x,
								   	    xevent.xmotion.y,
								   	    xevent.xmotion.state);
					}
					break;

					case EventType.EnterNotify:
					{
						// Dispatch a widget enter event.
						Widget child = dpy.handleMap
							[xevent.xcrossing.subwindow];
						OnEnter(child,
							    xevent.xcrossing.x,
							    xevent.xcrossing.y,
							    xevent.xcrossing.state,
							    xevent.xcrossing.mode,
							    xevent.xcrossing.detail);
					}
					break;

					case EventType.LeaveNotify:
					{
						// Dispatch a widget leave event.
						Widget child = dpy.handleMap
							[xevent.xcrossing.subwindow];
						OnLeave(child,
							    xevent.xcrossing.x,
							    xevent.xcrossing.y,
							    xevent.xcrossing.state,
							    xevent.xcrossing.mode,
							    xevent.xcrossing.detail);
					}
					break;
				}
			}
Пример #3
0
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     if (XVolate.Count > 1)
     {
         XVolate.RemoveAt(XVolate.Count - 1);
     }
     if (YVolateAndCn.Count > 1)
     {
         YVolateAndCn.RemoveAt(YVolateAndCn.Count - 1);
     }
     if (YVolateAndCn2.Count > 1)
     {
         YVolateAndCn2.RemoveAt(YVolateAndCn2.Count - 1);
     }
     if (YVolateAndCn3.Count > 1)
     {
         YVolateAndCn3.RemoveAt(YVolateAndCn3.Count - 1);
     }
     if (YVolateAndCn4.Count > 1)
     {
         YVolateAndCn4.RemoveAt(YVolateAndCn4.Count - 1);
     }
     if (XFre.Count > 1)
     {
         XFre.RemoveAt(XFre.Count - 1);
     }
     if (YVolateAndCurrent.Count > 1)
     {
         YVolateAndCurrent.RemoveAt(YVolateAndCurrent.Count - 1);
     }
     if (YVolateAndCurrent2.Count > 1)
     {
         YVolateAndCurrent2.RemoveAt(YVolateAndCurrent2.Count - 1);
     }
     if (YVolateAndCurrent3.Count > 1)
     {
         YVolateAndCurrent3.RemoveAt(YVolateAndCurrent3.Count - 1);
     }
     if (YVolateAndCurrent4.Count > 1)
     {
         YVolateAndCurrent4.RemoveAt(YVolateAndCurrent4.Count - 1);
     }
     if (XTime.Count > 1)
     {
         XTime.RemoveAt(XTime.Count - 1);
     }
     if (YVolateAndTan.Count > 1)
     {
         YVolateAndTan.RemoveAt(YVolateAndTan.Count - 1);
     }
     if (YVolateAndTan2.Count > 1)
     {
         YVolateAndTan2.RemoveAt(YVolateAndTan2.Count - 1);
     }
     if (YVolateAndTan3.Count > 1)
     {
         YVolateAndTan3.RemoveAt(YVolateAndTan3.Count - 1);
     }
     if (YVolateAndTan4.Count > 1)
     {
         YVolateAndTan4.RemoveAt(YVolateAndTan4.Count - 1);
     }
     UpdataWaveForm();
 }
Пример #4
0
        // Dispatch an event to this widget.
        internal override void DispatchEvent(ref XEvent xevent)
        {
            ButtonName button;
            XTime      time;

            switch ((EventType)(xevent.xany.type__))
            {
            case EventType.ButtonPress:
            {
                // Process button events.
                button = xevent.xbutton.button;
                time   = xevent.xbutton.time;
                if (lastClickButton == button &&
                    lastClickTime != XTime.CurrentTime &&
                    (time - lastClickTime) < 500)
                {
                    OnButtonDoubleClick(xevent.xbutton.x,
                                        xevent.xbutton.y, button,
                                        xevent.xbutton.state);
                    time = XTime.CurrentTime;
                }
                else
                {
                    OnButtonPress(xevent.xbutton.x,
                                  xevent.xbutton.y, button,
                                  xevent.xbutton.state);
                }
                lastClickTime   = time;
                lastClickButton = button;
            }
            break;

            case EventType.ButtonRelease:
            {
                // Dispatch a button release event.
                button = xevent.xbutton.button;
                OnButtonRelease(xevent.xbutton.x,
                                xevent.xbutton.y, button,
                                xevent.xbutton.state);
            }
            break;

            case EventType.MotionNotify:
            {
                // Dispatch a pointer motion event.
                OnPointerMotion(xevent.xmotion.x,
                                xevent.xmotion.y,
                                xevent.xmotion.state);
            }
            break;

            case EventType.EnterNotify:
            {
                // Dispatch a widget enter event.
                Widget child = dpy.handleMap
                               [xevent.xcrossing.subwindow];
                OnEnter(child,
                        xevent.xcrossing.x,
                        xevent.xcrossing.y,
                        xevent.xcrossing.state,
                        xevent.xcrossing.mode,
                        xevent.xcrossing.detail);
            }
            break;

            case EventType.LeaveNotify:
            {
                // Dispatch a widget leave event.
                Widget child = dpy.handleMap
                               [xevent.xcrossing.subwindow];
                OnLeave(child,
                        xevent.xcrossing.x,
                        xevent.xcrossing.y,
                        xevent.xcrossing.state,
                        xevent.xcrossing.mode,
                        xevent.xcrossing.detail);
            }
            break;
            }
        }
Пример #5
0
	extern public static int XSetSelectionOwner
			(IntPtr display, XAtom selection, XWindow owner, XTime time);
Пример #6
0
	extern public static int XConvertSelection
			(IntPtr display, XAtom selection, XAtom target,
			 XAtom property, XWindow requestor, XTime time);
Пример #7
0
	extern public static int XUngrabPointer(IntPtr display, XTime time);
Пример #8
0
	extern public static int XAllowEvents
			(IntPtr display, int event_mode, XTime time);
Пример #9
0
	extern public static int XGrabPointer
			(IntPtr display, XWindow grab_window, XBool owner_events,
			 uint event_mask, int pointer_mode, int keyboard_mode,
			 XWindow confine_to, XCursor cursor, XTime time);
Пример #10
0
	extern public static int XUngrabKeyboard(IntPtr display, XTime time);
Пример #11
0
	extern public static int XGrabKeyboard
			(IntPtr display, XWindow grab_window, XBool owner_events,
			 int pointer_mode, int keyboard_mode, XTime time);
Пример #12
0
	// Constructor.
	private Display(IntPtr dpy, String displayName, Application app)
			{
				// Copy parameters in from the create process.
				this.dpy = dpy;
				this.displayName = displayName;
				this.app = app;

				// Create objects for each of the display screens.
				int nscreens = (int)(Xlib.XScreenCount(dpy));
				screens = new Screen [nscreens];
				for(int scr = 0; scr < nscreens; ++scr)
				{
					screens[scr] = new Screen
						(this, scr, Xlib.XScreenOfDisplay(dpy, scr));
				}

				// Get the index of the default screen.
				defaultScreen = (int)(Xlib.XDefaultScreen(dpy));

				// Create an array to hold the standard cursors.
				cursors = new XCursor [(int)(CursorType.XC_num_glyphs)];

				// Reset the time of the last known event.
				knownEventTime = XTime.CurrentTime;

				// Construct the window handle map if not already present.
				if(handleMap == null)
				{
					handleMap = new HandleMap();
				}

				// Initialize the standard window manager atoms that we use.
				wmProtocols = Xlib.XInternAtom
					(dpy, "WM_PROTOCOLS", XBool.False);
				wmDeleteWindow = Xlib.XInternAtom
					(dpy, "WM_DELETE_WINDOW", XBool.False);
				wmTakeFocus = Xlib.XInternAtom
					(dpy, "WM_TAKE_FOCUS", XBool.False);
				wmMwmHints = Xlib.XInternAtom
					(dpy, "_MOTIF_WM_HINTS", XBool.False);
				wmContextHelp = Xlib.XInternAtom
					(dpy, "_NET_WM_CONTEXT_HELP", XBool.False);
				wmState = Xlib.XInternAtom
					(dpy, "WM_STATE", XBool.False);
				wmNetState = Xlib.XInternAtom
					(dpy, "_NET_WM_STATE", XBool.False);
				wmPing = Xlib.XInternAtom
					(dpy, "_NET_WM_PING", XBool.False);
				internalBeginInvoke = Xlib.XInternAtom
					(dpy, "INTERNAL_BEGIN_INVOKE", XBool.False);

				// Which buttons should we use for "Select" and "Menu"?
				byte[] buttons = new byte [5];
				if(Xlib.XGetPointerMapping(dpy, buttons, 5) == 3)
				{
					menuButton = ButtonName.Button3;
				}
				else
				{
					menuButton = ButtonName.Button2;
				}
				selectButton = ButtonName.Button1;

				// Construct the font map.
				fonts = new Hashtable();

				// Load the builtin bitmaps.
				bitmaps = new BuiltinBitmaps(this);
			}
Пример #13
0
	// Dispatch an event that occurred on this display.  We currently
	// have the display lock.
	private void DispatchEvent(ref XEvent xevent)
			{
				// Find the widget that should process the event.
				Widget widget = handleMap[xevent.xany.window];

				// Record the time at which the event occurred.  We need
				// this to process keyboard and pointer grabs correctly.
				switch((EventType)(xevent.xany.type__))
				{
					case EventType.KeyPress:
					case EventType.KeyRelease:
					{
						knownEventTime = xevent.xkey.time;
						if(widget != null && !(widget.Parent is RootWindow))
						{
							// KeyPress/KeyRelease events must be dispatched
							// via the top-level window, never via children.
							while(widget.Parent != null &&
							      !(widget.Parent is RootWindow))
							{
								widget = widget.Parent;
							}
						}
					}
					break;

					case EventType.ButtonPress:
					case EventType.ButtonRelease:
					{
						knownEventTime = xevent.xbutton.time;

						if (((xevent.xbutton.button == ButtonName.Button4) ||
						     (xevent.xbutton.button == ButtonName.Button5)) &&
						    ((widget != null) && !(widget.Parent is RootWindow)))
						{
							// Mousewheel events must be dispatched
							// via the top-level window, never via children.
							while (widget.Parent != null &&
							    !(widget.Parent is RootWindow))
							{
								widget = widget.Parent;
							}
						}
					}
					break;

					case EventType.MotionNotify:
					{
						knownEventTime = xevent.xmotion.time;
					}
					break;

					case EventType.EnterNotify:
					case EventType.LeaveNotify:
					{
						knownEventTime = xevent.xcrossing.time;
					}
					break;

					case EventType.PropertyNotify:
					{
						knownEventTime = xevent.xproperty.time;
					}
					break;

					case EventType.SelectionClear:
					{
						knownEventTime = xevent.xselectionclear.time;
					}
					break;

					case EventType.SelectionNotify:
					{
						knownEventTime = xevent.xselection.time;
					}
					break;

					case EventType.SelectionRequest:
					{
						knownEventTime = xevent.xselectionrequest.time;
					}
					break;

					default:
					{
						// We don't have a time value for this event.
						knownEventTime = XTime.CurrentTime;
					}
					break;
				}

				// Dispatch the event to the widget.
				if(widget != null)
				{
					widget.DispatchEvent(ref xevent);
				}
			}
Пример #14
0
        // Dispatch an event that occurred on this display.  We currently
        // have the display lock.
        private void DispatchEvent(ref XEvent xevent)
        {
            // Find the widget that should process the event.
            Widget widget = handleMap[xevent.xany.window];

            // Record the time at which the event occurred.  We need
            // this to process keyboard and pointer grabs correctly.
            switch ((EventType)(xevent.xany.type__))
            {
            case EventType.KeyPress:
            case EventType.KeyRelease:
            {
                knownEventTime = xevent.xkey.time;
                if (widget != null && !(widget.Parent is RootWindow))
                {
                    // KeyPress/KeyRelease events must be dispatched
                    // via the top-level window, never via children.
                    while (widget.Parent != null &&
                           !(widget.Parent is RootWindow))
                    {
                        widget = widget.Parent;
                    }
                }
            }
            break;

            case EventType.ButtonPress:
            case EventType.ButtonRelease:
            {
                knownEventTime = xevent.xbutton.time;

                if (((xevent.xbutton.button == ButtonName.Button4) ||
                     (xevent.xbutton.button == ButtonName.Button5)) &&
                    ((widget != null) && !(widget.Parent is RootWindow)))
                {
                    // Mousewheel events must be dispatched
                    // via the top-level window, never via children.
                    while (widget.Parent != null &&
                           !(widget.Parent is RootWindow))
                    {
                        widget = widget.Parent;
                    }
                }
            }
            break;

            case EventType.MotionNotify:
            {
                knownEventTime = xevent.xmotion.time;
            }
            break;

            case EventType.EnterNotify:
            case EventType.LeaveNotify:
            {
                knownEventTime = xevent.xcrossing.time;
            }
            break;

            case EventType.PropertyNotify:
            {
                knownEventTime = xevent.xproperty.time;
            }
            break;

            case EventType.SelectionClear:
            {
                knownEventTime = xevent.xselectionclear.time;
            }
            break;

            case EventType.SelectionNotify:
            {
                knownEventTime = xevent.xselection.time;
            }
            break;

            case EventType.SelectionRequest:
            {
                knownEventTime = xevent.xselectionrequest.time;
            }
            break;

            default:
            {
                // We don't have a time value for this event.
                knownEventTime = XTime.CurrentTime;
            }
            break;
            }

            // Dispatch the event to the widget.
            if (widget != null)
            {
                widget.DispatchEvent(ref xevent);
            }
        }
Пример #15
0
        // Constructor.
        private Display(IntPtr dpy, String displayName, Application app)
        {
            // Copy parameters in from the create process.
            this.dpy         = dpy;
            this.displayName = displayName;
            this.app         = app;

            // Create objects for each of the display screens.
            int nscreens = (int)(Xlib.XScreenCount(dpy));

            screens = new Screen [nscreens];
            for (int scr = 0; scr < nscreens; ++scr)
            {
                screens[scr] = new Screen
                                   (this, scr, Xlib.XScreenOfDisplay(dpy, scr));
            }

            // Get the index of the default screen.
            defaultScreen = (int)(Xlib.XDefaultScreen(dpy));

            // Create an array to hold the standard cursors.
            cursors = new XCursor [(int)(CursorType.XC_num_glyphs)];

            // Reset the time of the last known event.
            knownEventTime = XTime.CurrentTime;

            // Construct the window handle map if not already present.
            if (handleMap == null)
            {
                handleMap = new HandleMap();
            }

            // Initialize the standard window manager atoms that we use.
            wmProtocols = Xlib.XInternAtom
                              (dpy, "WM_PROTOCOLS", XBool.False);
            wmDeleteWindow = Xlib.XInternAtom
                                 (dpy, "WM_DELETE_WINDOW", XBool.False);
            wmTakeFocus = Xlib.XInternAtom
                              (dpy, "WM_TAKE_FOCUS", XBool.False);
            wmMwmHints = Xlib.XInternAtom
                             (dpy, "_MOTIF_WM_HINTS", XBool.False);
            wmContextHelp = Xlib.XInternAtom
                                (dpy, "_NET_WM_CONTEXT_HELP", XBool.False);
            wmState = Xlib.XInternAtom
                          (dpy, "WM_STATE", XBool.False);
            wmNetState = Xlib.XInternAtom
                             (dpy, "_NET_WM_STATE", XBool.False);
            wmPing = Xlib.XInternAtom
                         (dpy, "_NET_WM_PING", XBool.False);
            internalBeginInvoke = Xlib.XInternAtom
                                      (dpy, "INTERNAL_BEGIN_INVOKE", XBool.False);

            // Which buttons should we use for "Select" and "Menu"?
            byte[] buttons = new byte [5];
            if (Xlib.XGetPointerMapping(dpy, buttons, 5) == 3)
            {
                menuButton = ButtonName.Button3;
            }
            else
            {
                menuButton = ButtonName.Button2;
            }
            selectButton = ButtonName.Button1;

            // Construct the font map.
            fonts = new Hashtable();

            // Load the builtin bitmaps.
            bitmaps = new BuiltinBitmaps(this);
        }