예제 #1
0
파일: qt_term.cpp 프로젝트: gnuplot/gnuplot
// Called just before a plot is going to be displayed.
void qt_graphics()
{
    ensureOptionsCreated();
    qt->out << GEDesactivate;
    qt_flushOutBuffer();
    qt_connectToServer();

    // Set text encoding
    if (!(qt->codec = qt_encodingToCodec(encoding)))
        qt->codec = QTextCodec::codecForLocale();

    // Set font
    qt->currentFontSize = qt_optionFontSize;
    qt->currentFontName = qt_option->FontName;

    // Set plot size
    if (qt_setSize)
    {
        term->xmax = qt_oversampling*qt_setWidth;
        term->ymax = qt_oversampling*qt_setHeight;
        qt_setSize = false;
    }

    // Initialize window
    qt->out << GESetCurrentWindow << qt_optionWindowId;
    qt->out << GEInitWindow;
#ifdef _WIN32
    // Let the terminal window know our PID
    qt->out << GEPID << quint32(GetCurrentProcessId());
#endif
    qt->out << GEActivate;
    qt->out << GETitle << qt_option->Title;
    qt->out << GESetCtrl << qt_optionCtrl;
    qt->out << GESetWidgetSize << QSize(term->xmax, term->ymax)/qt_oversampling;
    // Initialize the scene
    qt->out << GESetSceneSize << QSize(term->xmax, term->ymax)/qt_oversampling;
    qt->out << GEClear;
    // Initialize the font
    qt_sendFont();
    term->v_tic = (unsigned int) (term->v_char/2.5);
    term->h_tic = (unsigned int) (term->v_char/2.5);

    if (qt_setPosition)
    {
        qt->out << GESetPosition << qt_option->position;
        qt_setPosition = false;
    }
}
예제 #2
0
파일: qt_term.cpp 프로젝트: ujaved/gnuplot
// Called just before a plot is going to be displayed.
void qt_graphics()
{
	ensureOptionsCreated();
	qt->out << GEDesactivate;
	qt_flushOutBuffer();
	qt_connectToServer();

	// Set text encoding
	if (!(qt->codec = qt_encodingToCodec(encoding)))
		qt->codec = QTextCodec::codecForLocale();

	// Set font
	qt->currentFontSize = qt_optionFontSize;
	qt->currentFontName = qt_option->FontName;

	// Set plot metrics
	QFontMetrics metrics(QFont(qt->currentFontName, qt->currentFontSize));
	term->v_char = qt_oversampling * (metrics.ascent() + metrics.descent());
	term->h_char = qt_oversampling * metrics.width("0123456789")/10.;
	term->v_tic = (unsigned int) (term->v_char/2.5);
	term->h_tic = (unsigned int) (term->v_char/2.5);
	if (qt_setSize)
	{
		term->xmax = qt_oversampling*qt_setWidth;
		term->ymax = qt_oversampling*qt_setHeight;
		qt_setSize = false;
	}

	// Initialize window
	qt->out << GESetCurrentWindow << qt_optionWindowId;
	qt->out << GEInitWindow;
	qt->out << GEActivate;
	qt->out << GETitle << qt_option->Title;
	qt->out << GESetCtrl << qt_optionCtrl;
	qt->out << GESetWidgetSize << QSize(term->xmax, term->ymax)/qt_oversampling;
	// Initialize the scene
	qt->out << GESetSceneSize << QSize(term->xmax, term->ymax)/qt_oversampling;
	qt->out << GEClear;
	// Initialize the font
	qt->out << GESetFont << qt->currentFontName << qt->currentFontSize;
}