Пример #1
0
void RS232Console::render(Dashboard *dash, SDLColor color, SDLColor bg_color,
    int font_size)
{
    int char_width, char_height, height, width, mid_height;
    
    getCharMetrics(dash, char_width, char_height);
    getMetrics(dash, width, mid_height, height);
    
    rectangleColor(dash->screen, x, y,  x + width - 1, y + height - 1,
        color.toUInt32());
    lineColor(dash->screen, x, y + mid_height - 1, x + width - 1, y + mid_height - 1, color.toUInt32());
    
    int current_y = y + 2;
    int to_line = min((int)stored_text.size(), scroll_position + rows);
    
    for (int i = scroll_position; i < to_line; i++) {
        dash->putMonoText(x + 2, current_y, stored_text[i].substr(0, columns),
            font_size + 2, color);
        current_y += char_height;
    }
    
    if (scrollbar_persist_frames) {
        drawScrollbar(dash, color);
        scrollbar_persist_frames--;
    }
}
Пример #2
0
void EpsonPaperSpace::moveTo( Pos newPos )
{
	if( convertToPUnits( newPos.x ) < pos.x )
		carriageReturn();

	int oldFont = font;
	setFont( moveToFont );

	PrecPos character = getCharMetrics( font );
	int lines = (convertToPUnits( newPos.y ) - pos.y) / character.y;

	while( lines )
		{
		lineFeed();
		lines--;
		}

	lineFeed180th( (convertToPUnits( newPos.y ) - pos.y) / 2 );

	int tabPos = (convertToPUnits( newPos.x ) - pos.x) / character.x;
	setHTabulator( tabPos );
	hTabulator();

	setFont( oldFont );
}
Пример #3
0
void EpsonPaperSpace::hTabulator()
{
	printer->writeByte( 0x09 );

	PrecPos character = getCharMetrics( font );
	pos.x = origin.x + (hTabPos * character.x);
}
Пример #4
0
PrecPos EpsonPaperSpace::getPrecTextMetrics( int font, int length )
{
	PrecPos aPrecPos = getCharMetrics( font );

	aPrecPos.x *= length;

	return aPrecPos;
}
Пример #5
0
void RS232Console::getMetrics(Dashboard *dash, int &width, int &mid_height, int &height)
{
    int char_width, char_height;
    
    getCharMetrics(dash, char_width, char_height);
    
    width = columns * char_width + 4;
    mid_height = rows * char_height + 4;
    height = mid_height + char_height + 3;
}
Пример #6
0
Pos EpsonPaperSpace::getTextMetrics( int font, int length )
{
	PrecPos aPrecPos = getCharMetrics( font );

	aPrecPos.x *= length;

	Pos aPos;
	aPos.x = convertToMMeters( aPrecPos.x );
	aPos.y = convertToMMeters( aPrecPos.y );

	return aPos;
}