Beispiel #1
0
void AWgtCheckbox::draw()
{
	int tx;
	int ty;

	if (checkCheckedBmp) {
		if (checked)
			draw_sprite(tguiBitmap, checkCheckedBmp, x, y);
		else
			draw_sprite(tguiBitmap, checkUncheckedBmp, x, y);
		tx = x + checkCheckedBmp->w + checkPadding;
		ty = y + ((checkCheckedBmp->h - text_height(aWgtFont)) / 2);
	}
	else {
		int w = text_height(aWgtFont);
		rect(tguiBitmap, x, y, x+w-1, y+w-1, shadowColor);
		rectfill(tguiBitmap, x+1, y+1, x+w-2, y+w-2, textColor);
		if (checked) {
			line(tguiBitmap, x+1, y+1, x+w-2, y+w-2, shadowColor);
			line(tguiBitmap, x+1, y+w-2, x+w-2, y+1, shadowColor);
		}
		tx = x + w + checkPadding;
		ty = y;
	}

	aWgtTextout(tguiBitmap, aWgtFont, text, tx, ty, textColor, shadowColor,
			shadowType);

	if (focus) {
		drawing_mode(DRAW_MODE_MASKED_PATTERN, linePatternBmp, 0, 0);
		rect(tguiBitmap, tx-2, ty-2, tx+text_length(aWgtFont, text)+2,
				ty+text_height(aWgtFont)+2, aWgtFocusColor);
		drawing_mode(DRAW_MODE_SOLID, 0, 0, 0);
	}
}
Beispiel #2
0
int
d_abitmap_list_proc (int msg, DIALOG *d, int c)
{
	if (msg == MSG_DRAW) {
		BITMAP *bmp = gui_get_screen();
		int height, size, i, len, bar, x, y;
		char *sel = d->dp2;
		char s[1024];
		int c = 0;

		if (d->flags & D_GOTFOCUS)
			c = 1;
		if (d->flags & D_DISABLED)
			c = 2;

		(*(char *(*)(int, int *)) d->dp) (-1, &size);
		height = (d->h - 4) / text_height (font);
		bar = (size > height);

		abitmap_draw_area (d, B_LIST, 0, 0, bar ? d->w - 12 : d->w, d->h, 0, 0);
		if (bar)
			abitmap_draw_scroller (d, d->d2, size, height);

		/* draw the contents */
		for (i = 0; i < height; i++) {
			if (d->d2 + i < size) {
				int fg = theme->bitmaps[B_LIST][c].color;

				x = d->x + 2;
				y = d->y + 2 + i * text_height (font);

				if (d->d2 + i == d->d1 || ((sel) && (sel[d->d2 + i]))) {
					abitmap_draw_area (d, B_LIST_ITEM, 0, y - d->y,
						bar ? d->w - 12 : d->w, text_height (font), 0, 0);
					fg = theme->bitmaps[B_LIST_ITEM][c].color;
				}
				ustrzcpy (s, sizeof (s),
					(*(char *(*)(int, int *)) d->dp) (i + d->d2, NULL));

				x += 8;
				len = ustrlen (s);
				while (text_length (font, s) >=
				MAX (d->w - 1 - (bar ? 22 : 11), 1)) {
					len--;
					usetat (s, len, 0);
				}
				textout_ex (bmp, font, s, x, y, fg, -1);
				x += text_length (font, s);

			}
		}
		return D_O_K;
	}
	return d_list_proc (msg, d, c);
}
Beispiel #3
0
static void gtk_draw_menu_item(MENU *m, int x, int y, int w, int h, int bar, int sel)
{
    BITMAP *bmp = gui_get_screen();
    int fg, bg;
    int i, j;
    char buf[256], *tok;

    if (m->flags & D_DISABLED) {
        fg = nshadow;
        bg = normal;
    }
    else {
        fg = black;
        bg = (sel) ? highlight : normal;
    }

    rectfill(bmp, x+1, y+1, x+w-3, y+h-4, bg);

    if (ugetc(m->text)) {
        i = 0;
        j = ugetc(m->text);

        while ((j) && (j != '\t')) {
            i += usetc(buf+i, j);
            j = ugetc(m->text+i);
        }

        usetc(buf+i, 0);

        gui_textout_ex(bmp, buf, x+8, y+1, fg, bg, FALSE);

        if (j == '\t') {
            tok = m->text+i + uwidth(m->text+i);
            gui_textout_ex(bmp, tok, x+w-gui_strlen(tok)-10, y+1, fg, bg, FALSE);
        }

        if ((m->child) && (!bar))
            draw_sprite(bmp, menu_arrow_bmp, x+w-12, y+(h-menu_arrow_bmp->h)/2);
    }
    else {
        hline(bmp, x+4, y+text_height(font)/2+2, x+w-4, nshadow);
        hline(bmp, x+4, y+text_height(font)/2+3, x+w-4, highlight);
    }

    if (m->flags & D_SELECTED) {
        line(bmp, x+1, y+text_height(font)/2+1, x+3, y+text_height(font)+1, fg);
        line(bmp, x+3, y+text_height(font)+1, x+6, y+2, fg);
    }
}
Beispiel #4
0
Imagen::Imagen(Fuente *fuente, string texto, int r, int g, int b)
{
    if ( !fuente )
    {
        bitmap = NULL ;
        throw Error::ExcepcionParametro("Graficos::Imagen::Imagen(Fuente *, string)", 1);
    }
    
    // Creamos el bitmap con el tamaño apropiado
    bitmap = create_bitmap( text_length(fuente->GetFont(), texto.c_str()), text_height(fuente->GetFont()) );
    if (!bitmap)
    {
        throw Error::ExcepcionLocalizada("Graficos::Imagen::Imagen(Fuente *, string)", "No se pudo crear el bitmap");
    }
    
    // Pintamos el texto en el bitmap creado, con el color que trae de "fabrica"
    // y con el color de fondo trasparente
    textout_ex(bitmap, fuente->GetFont(), texto.c_str(), 0, 0, makecol(r,g,b), makecol(255,0,255));
    
    // Por defecto una imagen no se pinta con mascara trasparente, pero una
    // imagen generada por una fuente si que lo hace por defecto.
    masked = true ;
    
    textura = allegro_gl_make_masked_texture(bitmap);
    
    w = bitmap->w ;
    h = bitmap->h ;    
    
    destroy_bitmap(bitmap);
    bitmap = NULL ;
}    
Beispiel #5
0
TextList::TextList(TWindow *menu, const char *identbranch, FONT *afont)
:
AreaTabletScrolled(menu, identbranch, 255)
{
	STACKTRACE;
	usefont = afont;
	Htxt = text_height(usefont);
	text_color = makecol(0,0,0);

	//	yselected = 0;

	optionlist = 0;
	N = 0;
	Nreserved = N;

	selected = false;

								 //, &scroll);
	scroll.setup(mainwindow, identbranch);
	scroll.set(0, 0, 1, 0, 1, 1);

								 // -1, because item 0 is also shown...
	Nshow = int(size.y / Htxt) - 1;

}
Beispiel #6
0
static void next(void)
{
   textprintf_centre_ex(screen, font, SCREEN_W / 2,
      SCREEN_H - text_height(font), -1, -1, "Press a key to continue");
   readkey();
   clear_bitmap(screen);
}
Beispiel #7
0
//-----------------------------------------------------------------------------
// Fonts_AddFont (int font_id, FONT *library_data)
// Register font to the fonts system
//-----------------------------------------------------------------------------
void    Fonts_AddFont (int font_id, FONT *library_data)
{
    t_meka_font *font   = &Fonts[font_id];
    font->id            = font_id;
    font->library_data  = library_data;
    font->height        = text_height (library_data);
}
bool BasicEditboxView::mouseDrag(int x, int y)
{
  int textheight = text_height(textfont);
  if(model->getSelection().isSelecting())
  {
    pair<int, int> oldsel = model->getSelection().getSelection();
    CharPos cp = findCharacter(x,y);
    model->getCursor().updateCursor(cp.totalIndex);
    model->getSelection().adjustSelection(model->getCursor());
    if(y < area_ystart)
    {
      view_y = zc_max(0, view_y-1);
    }
    if(y > area_ystart+area_height)
    {
      int ymost = zc_max(area_height, (int)model->getLines().size()*textheight);
      view_y = zc_min(ymost-area_height, view_y+1);
    }
    if(x < area_xstart)
      view_x = zc_max(0, view_x-1);
    if(x > area_xstart+area_width)
    {
      int xmost = zc_max(area_width, view_width);
      view_x = zc_min(xmost-area_width, view_x+1);
    }
    if(oldsel != model->getSelection().getSelection())
	{
      return true;
	}
  }
  return false;
}
Beispiel #9
0
static void
endpastebutton_extent(TextNode *node)
{
    int temp;
    int height;
    int twidth;

    paste_node->width = twidth = text_width(paste_node->next, Endpastebutton);
    height = paste_node->y;
    temp = text_height(paste_node->next, Endpastebutton);
    paste_node->height = temp - paste_node->y + line_height;
    if (text_y > height) {
        paste_node->y = temp;
        paste_node->width = right_margin - indent;
        if (gInLine) {
            start_newline(present_line_height, node);
            text_x = indent;
        }
    }
    else {
        paste_node->width = twidth;
        paste_node->y = text_y + paste_node->height - line_height;
    }
    pop_group_stack();
    paste_node = NULL;
    gInLine = 1;
}
Beispiel #10
0
static void
endbutton_extent(TextNode *node)
{
    int temp;
    int height;
    int twidth;
    int y;
    int maxx;

    maxx = max_x(link_node, Endbutton);
    link_node->width = twidth = text_width(link_node->next, Endbutton);
    height = link_node->y;
    temp = text_height(link_node->next, Endbutton);
    link_node->height = temp - link_node->y + line_height;

    if (gInLine)
        y = text_y;
    else
        y = text_y - past_line_height;
    if (y > height) {
        link_node->y = temp;    /* height + link_node->height -
                                 * normal_text_height; */
        link_node->width = maxx - indent;
        if (gInLine) {
            start_newline(present_line_height, node);
            text_x = indent;
        }
    }
    else {
        link_node->width = twidth;
        link_node->y = text_y + link_node->height - line_height;
    }
    pop_group_stack();
    link_node = NULL;
}
Beispiel #11
0
void
compute_header_extent(HyperDocPage *page)
{

    /*
     * Hopefully we will soon be able to actually compute the needed height
     * for the header here
     */

    int ty; /* UNUSED */

    gExtentRegion = Header;
    right_margin_space = non_scroll_right_margin_space;
    init_extents();
    ty = text_y = 3 * top_margin + line_height + max(page->title->height, twheight);
    gLineNode = page->header->next;
    compute_text_extent(page->header->next);
    page->header->height = text_height(page->header->next, Endheader);
    if (page->header->height) {
        page->header->height += 1 / 2 * line_height;
        page->top_scroll_margin = (gInLine) ? text_y : text_y - past_line_height;
        if (!(page->page_flags & NOLINES))
            page->top_scroll_margin += (int) line_height / 2;
        page->top_scroll_margin += gWindow->border_width + 2 * top_margin;
    }
    else {
        page->top_scroll_margin = page->title->height + gWindow->border_width +
            2 * scroll_top_margin;
    }
}
Beispiel #12
0
bool EditboxVScrollView::mouseDrag(int x, int  y)
{
    int textheight;
    textheight = text_height(textfont);
    
    if(model->getSelection().isSelecting())
    {
        return BasicEditboxView::mouseDrag(x,y);
    }
    else
    {
        //maybe pressing arrow, or sliding?
        if(toparrow_state == 1)
        {
            scrollUp();
            return true;
        }
        
        if(bottomarrow_state == 1)
        {
            scrollDown();
            return true;
        }
        
        if(barstate == 1)
        {
            //fake a click
            //first, clip the coords
            int fakex = toparrow_x+1;
            return mouseClick(fakex,y);
        }
        
        return mouseDragOther(x,y);
    }
}
void GuiLabel::addLabel(short x, short y, int color, string label) {
    if (firstLabel==NULL) {
        firstLabel = new LABEL_MASK;
        lastLabel = firstLabel;
        lastLabel->next = NULL;
        lastLabel->previous = NULL;
    } else {
        lastLabel->next = new LABEL_MASK;
        lastLabel->next->previous = lastLabel;
        lastLabel = lastLabel->next;
        lastLabel->next = NULL;
    }

    lastLabel->x = x;
    lastLabel->y = y;
    lastLabel->w = text_length(font, label.c_str())+10;
    lastLabel->h = text_height(font)+10;
    lastLabel->color = color;
    lastLabel->label = label;
    lastLabel->displayed = true;
    lastLabel->destroyed=false;
    lastLabel->ID = auto_increment_id;

    auto_increment_id++;

    labelAttributes = lastLabel;
}
Beispiel #14
0
int d_aphoton_button_proc(int msg, DIALOG *d, int c)
{
    int top_color, bottom_color, shift;
        
    if (msg == MSG_DRAW) {
        photon_container(screen, d->x, d->y, d->w, d->h);
    
        /* internal frame */
        if (d->flags & D_SELECTED) {
            top_color = button_border_gray;
            bottom_color = white;
            shift = 1;   
        }
        else {
            top_color = white;
            bottom_color = button_border_gray;
            shift = 0;
        }
        
        hline(screen, d->x+2, d->y+2, d->x+d->w-3, top_color);
        vline(screen, d->x+2, d->y+2, d->y+d->h-3, top_color);
        hline(screen, d->x+2, d->y+d->h-3, d->x+d->w-3, bottom_color);
        vline(screen, d->x+d->w-3, d->y+2, d->y+d->h-3, bottom_color);
        	rectgouraud(screen, d->x+3, d->y+3, d->x+d->w-4, d->y+d->h-4, &button_gray_range, FALSE);
	    
	if (d->dp)
	    photon_textout(screen, (char *)d->dp, d->x+d->w/2+shift,
	                   d->y+d->h/2-text_height(font)/2+shift, d->flags, TRUE);
	    
	return D_O_K;
    }

    return d_button_proc(msg, d, c);
}
Beispiel #15
0
int d_aphoton_check_proc(int msg, DIALOG *d, int c)
{  
    if (msg == MSG_DRAW) {
        draw_base(screen, d);
        photon_container(screen, d->x+3, d->y+d->h/2-7, 14, 14);
        rectfillwh(screen, d->x+5, d->y+d->h/2-5, 10, 10, white);
		
	if (d->flags & D_SELECTED) {
	    /* shadow */
	    line(screen, d->x+6, d->y+d->h/2-3, d->x+12, d->y+d->h/2+3, check_gray1);
	    line(screen, d->x+7, d->y+d->h/2-4, d->x+13, d->y+d->h/2+2, check_gray1);
	    line(screen, d->x+6, d->y+d->h/2+2, d->x+12, d->y+d->h/2-4, check_gray1);
	    line(screen, d->x+7, d->y+d->h/2+3, d->x+13, d->y+d->h/2-3, check_gray1);
	    
	    /* cross */
	    line(screen, d->x+6, d->y+d->h/2-4, d->x+13, d->y+d->h/2+3, check_black);
	    line(screen, d->x+6, d->y+d->h/2+3, d->x+13, d->y+d->h/2-4, check_black);
	}
	else {
  	    rect(screen, d->x+6, d->y+d->h/2-4, d->x+13, d->y+d->h/2+3, check_gray2);
	}
	
	if (d->dp)
	    photon_textout(screen, (char *)d->dp, d->x+20,
	                   d->y+d->h/2-text_height(font)/2, d->flags, FALSE);
	
	return D_O_K;
    }

    return d_button_proc(msg, d, c);
}
Beispiel #16
0
AWgtButton::AWgtButton(int x, int y, int width, int height,
			std::vector<int>* hotkeys, char* text,
			int top_color, int bottom_color,
			int border_color, int text_color,
			int shadowColor, int shadowType)
{
	this->x = x;
	this->y = y;
	if (width < 0)
		this->width = text_length(aWgtFont, text) +
			(buttonPadding*2) + 2;
	else
		this->width = width;
	if (height < 0)
		this->height = text_height(aWgtFont) +
			(buttonPadding*2) + 2;
	else
		this->height = height;
	this->hotkeys = hotkeys;
	this->text = text;
	this->top_color = top_color;
	this->bottom_color = bottom_color;
	this->border_color = border_color;
	this->text_color = text_color;
	this->shadowColor = shadowColor;
	this->shadowType = shadowType;
	pressed = false;
	depressed = false;
	clicked = false;
}
Beispiel #17
0
menu::menu(const char* ptab[],int pnb)
{
    float pasy,hint,xint,lmax,hmax;
    int taillemax,ind;
    nb=pnb;
    taillemax = text_length(font,ptab[0]);
    for(int i=0;i<nb;i++)
    {
        if(text_length(font,ptab[i])>taillemax)
        {
            taillemax = text_length(font,ptab[i]);
            ind = i;
        }
    }
    lmax = taillemax + 20;
    hmax = text_height(font) + 10;
    hint = taillemax + 10;
    xint = 20 + hint/2;
    pasy = (SCREEN_H)/(nb+1);
    tab = new bouton*[nb];
    for(int i=0;i<nb;i++)
    {
        tab[i] = new bouton(xint,(i+1)*pasy,ptab[i]);
        tab[i]->rectangle::init(lmax, hmax);
    }
}
Beispiel #18
0
void draw_button(BITMAP *bmp, int x, int y, int w, int h, int col, const char *txt, bool selected, bool disabled)
{
	int col1 = makecol( minf(255,getr(col)*1.3f), minf(255,getg(col)*1.3f), minf(255,getb(col)*1.3f) );
	int col2 = makecol( getr(col)*0.7f, getg(col)*0.7f, getb(col)*0.7f );
	int col3 = makecol( minf(255,getr(col)*1.7f), minf(255,getg(col)*1.7f), minf(255,getb(col)*1.7f) );

	if(disabled)
	{
		col1 = makecol(130,130,130);
		col2 = makecol(50,50,50);
		col3 = makecol(170,170,170);
		col = makecol(100,100,100);
	}
	else if(selected)
	{
		rect(bmp, x-2,y-2, x+w+3,y+h+3, makecol(210,210,0));
		rect(bmp, x-1,y-1, x+w+2,y+h+2, makecol(255,255,0));
		col3 = makecol(255,255,255);
	}
	
	rectfill(bmp, x,y, x+w,y+h, col);
	line(bmp, x,y, x+w,y, col1);
	line(bmp, x+w,y, x+w,y+h, col1);
	line(bmp, x,y+1, x+w,y+1, col1);
	line(bmp, x+w+1,y, x+w+1,y+h, col1);	
	
	line(bmp, x,y+h, x+w,y+h, col2);
	line(bmp, x,y, x,y+h, col2);	
	line(bmp, x,y+h+1, x+w,y+h+1, col2);
	line(bmp, x+1,y, x+1,y+h, col2);

	textout_ex(bmp, font2, txt, x + (w/2) - (text_length(font2,txt)/2), y + (h/2) - (text_height(font2)/2), col3, -1);
}
Beispiel #19
0
static void
abitmap_draw_text (DIALOG *d, int what, int offx, int offy, int push,
int halign, int valign)
{
	int s = get_state (d);

	int x = d->x + offx;
	int y = d->y + offy;
	int w = gui_strlen (d->dp);
	int h = text_height (font);
	if (halign == 1)
		x = d->x + (d->w - offx) / 2 - w / 2;
	if (halign == 2)
		x = d->x + (d->w - offx) - w;
	if (valign == 1)
		y = d->y + (d->h - offy) / 2 - h / 2;
	if (valign == 2)
		y = d->y + (d->h - offy) - h;

	if (push && (d->flags & D_SELECTED)) {
		x += theme->textpushx;
		y += theme->textpushy;
	}

	gui_textout_ex(gui_get_screen(), d->dp, x, y, theme->bitmaps[what][s].color, -1, FALSE);
}
Beispiel #20
0
static void
end_spadsrc_extent(TextNode *node)
{
    int temp;
    int height;
    int twidth;
    int maxx;
    int y = (gInLine) ? (text_y) : (text_y - past_line_height);

    maxx = max_x(spad_node, Endspadsrc);

    twidth = spad_node->width = text_width(spad_node->next, Endspadsrc);
    height = spad_node->y;
    temp = text_height(spad_node->next, Endspadsrc);
    spad_node->height = temp - height + line_height;
    if (y > height && gInLine) {
        spad_node->y = temp;
        spad_node->width = maxx - indent;
        start_newline(present_line_height, node);
        text_x = indent;
    }
    else {
        spad_node->width = twidth;
        spad_node->y = text_y - line_height + spad_node->height;
    }
    pop_group_stack();
    in_fricas_command = 0;
    spad_node = NULL;
}
Beispiel #21
0
void bott_disp_text_proc(void **pp,long *ss)
  {
  char *p,*text;
  int y = 20;
  int xx,yy;

  text = alloca(strlen(bott_text)+2);
  set_font(H_FBOLD,NOSHADOW(0));
  zalamovani(bott_text,text,390,&xx,&yy);
  RedirectScreen(bott_clear());
  if (battle && cur_mode == MD_INBATTLE) put_picture(0,0,ablock(H_BATTLE_BAR));
  else put_picture(0,0,ablock(H_DESK));
  create_frame(70,20,400,50,1);
  p = text;
  do
     {
     position(70,y);
     outtext(p);
     y += text_height(p);
     p = strchr(p,0)+1;
     }
  while (p[0]);
  *pp = GetScreenAdr();
  *ss = _msize(*pp);
  RestoreScreen();
  }
Beispiel #22
0
void ce_game::drawTitle(const char *text, ce_cord center){
	//Draw a title dependant on parameters given
	BITMAP *bmp = create_bitmap(text_length(font, text),text_height(font));
	clear_to_color(bmp,makecol(0,0,0));
	textout_ex(bmp, font, text, 0, 0, makecol(240,0,240), -1);
	stretch_blit(bmp,buffer, 0,0,bmp->w, bmp->h, center.x - ((bmp->w*5)/2), center.y - ((bmp->h*5)/2),bmp->w * 5, bmp->h * 5);
	destroy_bitmap(bmp);
}
/* This function returns the height of the minicontact in question */
static int
addressbook_height (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
{
	EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
	EAddressbookReflowAdapterPrivate *priv = adapter->priv;
	EContactField field;
	int count = 0;
	char *string;
	EContact *contact = (EContact*)eab_model_contact_at (priv->model, i);
	PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), "");
	int height;

	string = e_contact_get(contact, E_CONTACT_FILE_AS);
	height = text_height (layout, string ? string : "") + 10.0;
	g_free(string);

	for(field = E_CONTACT_FULL_NAME; field != E_CONTACT_LAST_SIMPLE_STRING && count < 5; field++) {

		if (field == E_CONTACT_FAMILY_NAME || field == E_CONTACT_GIVEN_NAME)
			continue;

		string = e_contact_get(contact, field);
		if (string && *string) {
			int this_height;
			int field_text_height;

			this_height = text_height (layout, e_contact_pretty_name(field));

			field_text_height = text_height (layout, string);
			if (this_height < field_text_height)
				this_height = field_text_height;

			this_height += 3;

			height += this_height;
			count ++;
		}
		g_free (string);
	}
	height += 2;

	g_object_unref (layout);

	return height;
}
Beispiel #24
0
static void test_8bit_acs(const FONT *f, int c, int c0, int x)
{
	char s[2] = "";
	s[0] = c;
	x += 8*(c-c0);
	puttext(f, s, x, 10);
	convert_chars(s, s, 2);
	puttext(f, s, x, 12+text_height(f));
}
Beispiel #25
0
static void test_unicode_acs(const FONT *f, int c, int c0, int x)
{
	char s[4] = "";
	s[0] = c;
	x += 8*(c-c0);
	puttext(f, s, x, 10);
	if (usetc(s, acs_to_unicode(c)) > 0)
		puttext(f, s, x, 12+text_height(f));
}
void EditboxView::pageDown()
{
  int textheight = text_height(textfont);
  int height = getAreaHeight();
  int numlines = height/textheight;
  for(int i=0; i<int(numlines);i++)
  {
    lineDown();
  }
}
Beispiel #27
0
void BasicEditboxView::enforceHardLimits()
{
    int textheight = text_height(textfont);
    int ymost = zc_max(area_height, (int)model->getLines().size()*textheight);
    view_y = zc_max(view_y, 0);
    view_y = zc_min(view_y, ymost-area_height);
    int xmost = zc_max(area_width, view_width);
    view_x = zc_max(view_x, 0);
    view_x = zc_min(view_x, xmost-area_width);
}
void BasicEditboxView::createStripBitmap(list<LineData>::iterator it, int width)
{
   //now create the bitmap
    int textheight = text_height(textfont);
  if(it->strip)
    destroy_bitmap(it->strip);
  it->strip = create_bitmap_ex(8,width,textheight);
  rectfill(it->strip, 0,0,width, textheight, bgcolor);
    Unicode::textout_ex_nonstupid(it->strip, textfont, (*it).line, 0, 0, fgcolor, bgcolor);
}
Beispiel #29
0
Datei: console.c Projekt: rj76/kq
/*! \brief Show the current console
*
* Display the current state of the console on the double
* buffer. This includes a horizontal line. The console takes 
* up 320x120 pixels.
* \author PH
* \param xofs x-offset display position
* \param yofs y-offset display position
*/
void display_console(int xofs, int yofs) {
	int i, y;
	if (g_console.on != 1) return;
	rectfill(double_buffer, xofs, yofs + 120, xofs + 320, yofs + 240, makecol(0,0,0));
	hline(double_buffer, xofs, yofs + 120, xofs + 320, makecol(255,255,255));
	y = yofs + 240 - 2 * text_height(font);
	i = 24;
	while (y > yofs + 120) {
		if (g_console.lines[i]) {
			textout_ex(double_buffer, font, g_console.lines[i], xofs, y, makecol(255,255,255), makecol(0,0,0));
		}
		y -= text_height(font);
		--i;
	}
	textout_ex(double_buffer, font, g_console.inputline, xofs, yofs + 240 - text_height(font), makecol(255,255,255), makecol(0,0,0));
	rectfill(double_buffer, xofs + text_length(font, g_console.inputline), yofs + 238, 
			 xofs + text_length(font, g_console.inputline) + text_length(font, "_"), yofs + 240, 
			 makecol(192,192,192));
}
Beispiel #30
0
void EditboxVScrollView::drawExtraComponents()
{
    int textheight = text_height(textfont);
    //draw the scrollbar
    draw_arrow_button(dbuf, toparrow_x-host->x, toparrow_y-host->y, 16, 16, true, toparrow_state*3);
    draw_arrow_button(dbuf, bottomarrow_x-host->x, bottomarrow_y-host->y, 16, 16, false, bottomarrow_state*3);
    
    if(!sbarpattern)
    {
        sbarpattern = create_bitmap_ex(bitmap_color_depth(screen),2,2);
        putpixel(sbarpattern, 0, 1, scheme[jcLIGHT]);
        putpixel(sbarpattern, 0, 1, scheme[jcLIGHT]);
        putpixel(sbarpattern, 0, 1, scheme[jcLIGHT]);
        putpixel(sbarpattern, 0, 1, scheme[jcLIGHT]);
    }
    
    drawing_mode(DRAW_MODE_COPY_PATTERN, sbarpattern, 0, 0);
    int barstart = toparrow_y + 16 - host->y;
    int barend = bottomarrow_y - host->y-1;
    
    if(barstart < barend)
        rectfill(dbuf, toparrow_x-host->x, barstart, toparrow_x-host->x+15, barend, 0);
        
    solid_mode();
    //compute the bar button, based on view_y
    int totallen = (int)model->getLines().size()*textheight;
    int available = bottomarrow_y-(toparrow_y+16);
    
    if(available < 0)
    {
        baroff=barlen=0;
    }
    
    else
    {
        //area_height:totallen = barlen:available
        barlen = (available*area_height)/zc_max(totallen,area_height)+1;
        //clip to reasonable values
        barlen = zc_max(barlen, 8);
        baroff = zc_min(baroff, available-barlen);
        
        //view_y:(totallen-area_height) = baroff:(available-barlen)
        if(totallen <= area_height)
            baroff=0;
        else
            baroff = ((available-barlen)*view_y)/(totallen-area_height);
            
    }
    
    if(barlen > 0)
    {
        jwin_draw_button(dbuf, toparrow_x-host->x, toparrow_y+16-host->y+baroff, 16, barlen, false, 1);
    }
}