Ejemplo n.º 1
0
bool qt_processTermEvent(gp_event_t* event)
{
    // Intercepts resize event
    if (event->type == GE_fontprops)
    {
        // This is an answer to a font metric request. We don't send it back to gnuplot
        if ((event->par1 > 0) && (event->par2 > 0))
        {
            fprintf(stderr, "qt_processTermEvent received a GE_fontprops event. This should not have happened\n");
            return false;
        }
        // This is a resize event
        qt_setSize   = true;
        qt_setWidth  = event->mx;
        qt_setHeight = event->my;
    }
    // Scale mouse events
    else
    {
        QPoint p = qt_gnuplotCoord(event->mx, event->my);
        event->mx = p.x();
        event->my = p.y();
    }

    if (event->type == GE_raise)
    {
#ifdef _WIN32
# ifndef WGP_CONSOLE
        SetForegroundWindow(textwin.hWndParent);
# else
        SetForegroundWindow(GetConsoleWindow());
# endif
        WinRaiseConsole();
#endif
        return true;
    }

    // Send the event to gnuplot core
    do_event(event);
    // Process pause_for_mouse
    if ((event->type == GE_buttonrelease) && (paused_for_mouse & PAUSE_CLICK))
    {
        int button = event->par1;
        if (((button == 1) && (paused_for_mouse & PAUSE_BUTTON1)) ||
                ((button == 2) && (paused_for_mouse & PAUSE_BUTTON2)) ||
                ((button == 3) && (paused_for_mouse & PAUSE_BUTTON3)))
            paused_for_mouse = 0;
        if (paused_for_mouse == 0)
            return true;
    }
    if ((event->type == GE_keypress) && (paused_for_mouse & PAUSE_KEYSTROKE) && (event->par1 > '\0'))
    {
        paused_for_mouse = 0;
        return true;
    }

    return false;
}
Ejemplo n.º 2
0
bool qt_processTermEvent(gp_event_t* event)
{
	// Intercepts resize event
	if (event->type == GE_fontprops)
	{
		// This is an answer to a font metric request. We don't send it back to gnuplot
		if ((event->par1 > 0) && (event->par2 > 0))
		{
			qDebug() << "qt_processTermEvent received a GE_fontprops event. This should not have happened";
			return false;
		}
		// This is a resize event
		qt_setSize   = true;
		qt_setWidth  = event->mx;
		qt_setHeight = event->my;
	}
	// Scale mouse events
	else
	{
		QPoint p = qt_gnuplotCoord(event->mx, event->my);
		event->mx = p.x();
		event->my = p.y();
	}

	// Send the event to gnuplot core
	do_event(event);
	// Process pause_for_mouse
	if ((event->type == GE_buttonrelease) && (paused_for_mouse & PAUSE_CLICK))
	{
		int button = event->par1;
		if (((button == 1) && (paused_for_mouse & PAUSE_BUTTON1)) ||
		    ((button == 2) && (paused_for_mouse & PAUSE_BUTTON2)) ||
		    ((button == 3) && (paused_for_mouse & PAUSE_BUTTON3)))
			paused_for_mouse = 0;
		if (paused_for_mouse == 0)
			return true;
	}
	if ((event->type == GE_keypress) && (paused_for_mouse & PAUSE_KEYSTROKE) && (event->par1 > '\0'))
	{
		paused_for_mouse = 0;
		return true;
	}

	return false;
}