Example #1
0
  static
  void  refresh_rectangle( grArosSurface*  surface,
                           int          x,
                           int          y,
                           int          w,
                           int          h )
  {
     SetAPen(surface->win->RPort, 1);
     SetDrMd(surface->win->RPort, JAM2);

     if (!surface->grays)
     {
	BltTemplate(surface->root.bitmap.buffer,
     		    0,
		    w / 8,
		    surface->win->RPort,
		    surface->win->BorderLeft,
		    surface->win->BorderTop,
		    surface->bpr * 8,
		    surface->root.bitmap.rows);
     } else {
#if 0
       WritePixelArray8(surface->win->RPort,
     			surface->win->BorderLeft,
			surface->win->BorderTop,
			surface->win->BorderLeft + surface->root.bitmap.width - 1,
			surface->win->BorderTop + surface->root.bitmap.rows - 1,
			surface->root.bitmap.buffer,
			0); 
#endif
       WriteLUTPixelArray(surface->root.bitmap.buffer,
			  0,
			  0,
			  surface->root.bitmap.width,
			  surface->win->RPort,
			  surface->cgfxcoltab,
			  surface->win->BorderLeft,
			  surface->win->BorderTop,
			  surface->root.bitmap.width,
			  surface->root.bitmap.rows,
			  CTABFMT_XRGB8);

     }
  }
Example #2
0
// Show list selector
void show_list_selector(Lister *lister,short line,BOOL erase)
{
	short left,top,width,height,image_width,image_height,fpen=1,bpen=0;
	unsigned short *image;
	DirEntry *entry;

	// Get width and height
	width=KEY_SEL_OFFSET;
	height=lister->text_area.rast.TxHeight;

	// Get position
	left=lister->text_area.rect.MinX-KEY_SEL_OFFSET;
	top=lister->text_area.rect.MinY+line*height;

	// Small font?
	if (height<BIG_ARROW_HEIGHT)
	{
		image=small_arrow;
		image_width=SMALL_ARROW_WIDTH;
		image_height=SMALL_ARROW_HEIGHT;
	}

	// Big font
	else
	{
		image=big_arrow;
		image_width=BIG_ARROW_WIDTH;
		image_height=BIG_ARROW_HEIGHT;
	}

	// Center in area
	left+=(width-image_width)>>1;
	top+=(height-image_height)>>1;

	// Is lister in damage refresh mode?
	if (lister->window->Flags&WFLG_WINDOWREFRESH)
	{
		struct Rectangle rect;
	
		// Forbid for this
		Forbid();

		// End refresh temporarily
		EndRefresh(lister->window,FALSE);

		// Get rectangle for arrow
		rect.MinX=left;
		rect.MinY=top;
		rect.MaxX=left+image_width-1;
		rect.MaxY=top+image_height-1;

		// Add to damage list
		OrRectRegion(lister->window->WLayer->DamageList,&rect);

		// Continue with refresh
		BeginRefresh(lister->window);

		// Enable now we've done our dirty work
		Permit();
	}

	// Get selector line entry, and set correct colours
	if (entry=get_entry_ord(&lister->cur_buffer->entry_list,line+lister->cur_buffer->buf_VertOffset))
		getdispcol(entry,lister,&fpen,&bpen);

	// Erase?
	if (erase || lister->cur_buffer->buf_TotalEntries[0]<1)
	{
		// Get correct background colour
		SetAPen(&lister->list_area.rast,(entry)?bpen:0);

		// Erase image			
		RectFill(
			&lister->list_area.rast,
			left,top,
			left+image_width-1,top+image_height-1);
		return;
	}

	// Draw arrow-like thing
	SetAPen(&lister->list_area.rast,(entry && bpen==lister->drawinfo->dri_Pens[TEXTPEN])?fpen:lister->drawinfo->dri_Pens[TEXTPEN]);
	SetDrMd(&lister->list_area.rast,JAM1);
	BltTemplate(
		(char *)image,
		0,2,
		&lister->list_area.rast,
		left,top,
		image_width,image_height);
}