Exemplo n.º 1
0
void qt_set_cursor(int c, int x, int y)
{
	// Cancel zoombox when Echap is pressed
	if (c == 0)
		qt_out << GEZoomStop << QString();

	if (c == -4)
		qt_out << GELineTo << false;
	else if (c == -3)
		qt_out << GELineTo << true;
	else if (c == -2) // warp the pointer to the given position
		qt_out << GEWrapCursor << qt_termCoord(x, y);
	else if (c == -1) // start zooming
		qt_out << GECursor << Qt::SizeFDiagCursor;
	else if (c ==  1) // Rotation
		qt_out << GECursor << Qt::ClosedHandCursor;
	else if (c ==  2) // Rescale
		qt_out << GECursor << Qt::SizeAllCursor;
	else if (c ==  3) // Zoom
		qt_out << GECursor << Qt::SizeFDiagCursor;
	else
		qt_out << GECursor << Qt::CrossCursor;

	qt_flushOutBuffer();
}
Exemplo n.º 2
0
void qt_image(unsigned int M, unsigned int N, coordval* image, gpiPoint* corner, t_imagecolor color_mode)
{
	QImage qimage = qt_imageToQImage(M, N, image, color_mode);
	qt_out << GEImage;
	for (int i = 0; i < 4; i++)
		qt_out << qt_termCoord(corner[i].x, corner[i].y);
	qt_out << qimage;
}
Exemplo n.º 3
0
void qt_put_text(unsigned int x, unsigned int y, const char* string)
{
    // if ignore_enhanced_text is set, draw with the normal routine.
    // This is meant to avoid enhanced syntax when the enhanced mode is on
    if (!qt_optionEnhanced || ignore_enhanced_text)
    {
        /// @todo Symbol font to unicode
        /// @todo bold, italic
        qt->out << GEPutText << qt_termCoord(x, y) << qt->codec->toUnicode(string);
        return;
    }

    // Uses enhanced_recursion() to analyse the string to print.
    // enhanced_recursion() calls _enhanced_open() to initialize the text drawing,
    // then it calls _enhanced_writec() which buffers the characters to draw,
    // and finally _enhanced_flush() to draw the buffer with the correct justification.

    // set up the global variables needed by enhanced_recursion()
    enhanced_fontscale = 1.0;
    strncpy(enhanced_escape_format, "%c", sizeof(enhanced_escape_format));

    // Baseline correction
    qt_max_pos_base = qt_max_neg_base = 0.0;

    // Set the recursion going. We say to keep going until a closing brace, but
    // we don't really expect to find one.  If the return value is not the nul-
    // terminator of the string, that can only mean that we did find an unmatched
    // closing brace in the string. We increment past it (else we get stuck
    // in an infinite loop) and try again.
    while (*(string = enhanced_recursion((char*)string, TRUE, qt->currentFontName.toUtf8().data(),
                                         qt->currentFontSize, 0.0, TRUE, TRUE, 0)))
    {
        qt_enhanced_flush();
        enh_err_check(string); // we can only get here if *str == '}'
        if (!*++string)
            break; // end of string
        // else carry on and process the rest of the string
    }

    // Baseline correction
    y += qt_max_pos_base * 5;
    y += qt_max_neg_base * 5;

    qt->out << GEEnhancedFinish << qt_termCoord(x, y);
}
Exemplo n.º 4
0
void qt_fillbox(int style, unsigned int x, unsigned int y, unsigned int width, unsigned int height)
{
    qt->out << GEBrushStyle << style;
    qt->out << GEFillBox << QRect(qt_termCoord(x, y + height), QSize(width, height)/qt_oversampling);
}
Exemplo n.º 5
0
void qt_set_ruler(int x, int y)
{
	qt_out << GERuler << qt_termCoord(x, y);
	qt_flushOutBuffer();
}