void ti_mlwlb_draw(TWidget * wid, ttk_surface srf)
{
	ttk_color tcol;
	unsigned short disp[33];
	ttk_ap_fillrect(srf, ti_ap_getx(0), wid->x, wid->y, wid->x+wid->w, wid->y+wid->h);
	
	if (ti_mlwlb_position<1) {
		ttk_ap_fillrect(srf, ti_ap_getx(2), wid->x, wid->y, wid->x+wid->w/2, wid->y+wid->h);
		tcol = ti_ap_get(3);
	} else {
		tcol = ti_ap_get(1);
	}
	
	memcpy(disp, &ti_mlwlb_charset.chars[ti_mlwlb_startpos], ti_mlwlb_limit*2);
	disp[ti_mlwlb_limit]=0;
	ttk_text_uc16(srf, ttk_menufont, wid->x+1, wid->y, tcol, disp);
	
	if (ti_mlwlb_position>5) {
		ttk_ap_fillrect(srf, ti_ap_getx(2), wid->x+wid->w/2, wid->y, wid->x+wid->w, wid->y+wid->h);
		tcol = ti_ap_get(3);
	} else {
		tcol = ti_ap_get(1);
	}
	memcpy(disp, &ti_mlwlb_charset.chars[ti_mlwlb_limit+ti_mlwlb_startpos], ti_mlwlb_limit*2);
	disp[ti_mlwlb_limit]=0;
	ttk_text_uc16(srf, ttk_menufont, wid->x+wid->w/2+1, wid->y, tcol, disp);
	
	/* Position */
	ttk_line(srf, wid->x+wid->w/2, wid->y, wid->x+((ti_mlwlb_position*wid->w)/6), wid->y, ttk_makecol(GREY));
	ttk_line(srf, wid->x+wid->w/2, wid->y+1, wid->x+((ti_mlwlb_position*wid->w)/6), wid->y+1, ttk_makecol(GREY));
	ttk_line(srf, wid->x+wid->w/2, wid->y+wid->h-2, wid->x+((ti_mlwlb_position*wid->w)/6), wid->y+wid->h-2, ttk_makecol(GREY));
	ttk_line(srf, wid->x+wid->w/2, wid->y+wid->h-1, wid->x+((ti_mlwlb_position*wid->w)/6), wid->y+wid->h-1, ttk_makecol(GREY));
}
예제 #2
0
void ti_dial_draw(TWidget * wid, ttk_surface srf)
{
	int sc, n, i, j, ty;
	int m = ti_dial_max()+1;
	uc16 s[2] = {0,0};
	ttk_ap_fillrect(srf, ti_ap_getx(0), wid->x, wid->y, wid->x+wid->w, wid->y+wid->h);
	n = wid->w / CW;
	sc = ti_dial_charlist_pos - n/2;
	ty = 0;
	if (sc > (m-n) ) { sc = (m-n); }
	if (sc < 0) { sc = 0; }
	if (ti_dial_cursormode()) {
		ttk_text(srf, ttk_menufont, wid->x+(wid->w - ttk_text_width(ttk_menufont, ti_dial_cmstring))/2, wid->y+ty, ti_ap_get(1), ti_dial_cmstring);
	} else {
		for (i = sc, j = 0; ((i<m) && (j<n)); i++, j++)
		{
			s[0] = ti_dial_get_char(i);
			if (i == ti_dial_charlist_pos) {
				ttk_ap_fillrect(srf, ti_ap_getx(2), wid->x+j*CW, wid->y, wid->x+j*CW+CW, wid->y+wid->h);
				ttk_text_uc16(srf, ttk_menufont, wid->x+j*CW+(10-ttk_text_width_uc16(ttk_menufont, s))/2, wid->y+ty, ti_ap_get(3), s);
			} else {
				ttk_text_uc16(srf, ttk_menufont, wid->x+j*CW+(10-ttk_text_width_uc16(ttk_menufont, s))/2, wid->y+ty, ti_ap_get(1), s);
			}
		}
	}
}
예제 #3
0
/* progress bar borrowed from courtc's mpdc module */
static void fill_copied_percent(PzWidget *wid, ttk_surface srf, int per, int y){
	int num = per > 100 ? 100 : per;
	int w = wid->w - (wid->w / 6);
	int x = (wid->w - w) / 2;
	//int y = wid->h - 30;
	int pw = (w * num) / 100;
	const int h = 9;

	if (ttk_ap_get("music.bar.bg"))
		ttk_ap_fillrect(srf, ttk_ap_get("music.bar.bg"), x,y,x+w+1,y+h);

	ttk_ap_fillrect(srf, ttk_ap_get("music.bar"), x, y, x + pw + 1, y + h);

	ttk_ap_hline(srf, ttk_ap_get("window.fg"), x, x + w, y - 1);
	ttk_ap_hline(srf, ttk_ap_get("window.fg"), x, x + w, y + h);
	ttk_ap_vline(srf, ttk_ap_get("window.fg"), x - 1, y, y +(h - 1));
	ttk_ap_vline(srf, ttk_ap_get("window.fg"), x+w+1, y, y +(h - 1));
}
예제 #4
0
void podwrite_widget_draw(TWidget * wid, ttk_surface srf)
{
	int h = wid->h - (((TiBuffer *)wid->data)->idata[2]) - 1;
	
	ttk_ap_fillrect(srf, ti_ap_getx(0), wid->x, wid->y, wid->x+wid->w, wid->y+wid->h);
	ti_multiline_text(srf, ttk_textfont, wid->x+5, wid->y+5, wid->w-15, wid->h-10-(((TiBuffer *)wid->data)->idata[2]),
		ti_ap_get(1), ((TiBuffer *)wid->data)->text, ((TiBuffer *)wid->data)->cpos,
		((podwrite_linecount > podwrite_screenlines)?podwrite_scroll:0),
		&podwrite_linecount, &podwrite_screenlines, &podwrite_cursor_out_of_bounds);
	
	if (podwrite_linecount > podwrite_screenlines) {
	ttk_ap_fillrect (srf, ttk_ap_get ("scroll.bg"), wid->x + wid->w - 10,
			 wid->y + ttk_ap_getx ("header.line") -> spacing,
			 wid->x + wid->w, wid->y + h);
	ttk_ap_rect (srf, ttk_ap_get ("scroll.box"), wid->x + wid->w - 10,
		     wid->y + ttk_ap_getx ("header.line") -> spacing,
		     wid->x + wid->w, wid->y + h);
	ttk_ap_fillrect (srf, ttk_ap_get ("scroll.bar"), wid->x + wid->w - 10,
			 wid->y + ttk_ap_getx ("header.line") -> spacing + ((podwrite_scroll) * (h-2) / podwrite_linecount),
			 wid->x + wid->w,
			 wid->y - ttk_ap_getx ("header.line") -> spacing + ((podwrite_scroll + podwrite_screenlines) * (h-2) / podwrite_linecount) );	
    }
}
예제 #5
0
void tix_run_draw(TWidget * wid, ttk_surface srf)
{
	ttk_ap_fillrect(srf, ttk_ap_getx("window.bg"), wid->x, wid->y, wid->w, wid->h);
	if (ttk_screen->w < 160) {
		ti_multiline_text(srf, ttk_textfont, wid->x, wid->y, wid->w, wid->h, ttk_ap_getx("window.fg")->color,
			_("Type the name of a file to open."), -1, 0, 0, 0, 0);
	} else if (ttk_screen->w < 200) {
		ti_multiline_text(srf, ttk_textfont, wid->x, wid->y, wid->w, wid->h, ttk_ap_getx("window.fg")->color,
			_("Type the name of a program, folder, or document to open."), -1, 0, 0, 0, 0);
	} else {
		ti_multiline_text(srf, ttk_textfont, wid->x, wid->y, wid->w, wid->h, ttk_ap_getx("window.fg")->color,
			_("Type the name of a program, folder, or document, and podzilla will open it for you."), -1, 0, 0, 0, 0);
	}
}
예제 #6
0
void ti_thumbscript_draw(TWidget * wid, ttk_surface srf)
{
	char s[2];
	ttk_ap_fillrect(srf, ti_ap_getx(0), wid->x, wid->y, wid->x+wid->w, wid->y+wid->h);
	switch (ti_thumbscript_mode) {
	case 1:
		ttk_text_lat1(srf, ttk_menufont, wid->x+wid->w/2, wid->y, ti_ap_get(1), "shift");
		break;
	case 3:
	case 2: case 4: case 5: case 6:
		ttk_text_lat1(srf, ttk_menufont, wid->x+wid->w/2, wid->y, ti_ap_get(1), "mod");
		break;
	}
	if (ti_thumbscript_last != 0) {
		s[0] = (ti_thumbscript_last + '0');
		s[1] = 0;
		ttk_text_lat1(srf, ttk_menufont, wid->x+(wid->w*3)/4, wid->y, ti_ap_get(1), s);
	}
}
예제 #7
0
static void draw_digit( ttk_surface srf, clocks_globals *glob, int w, int v, 
			int use_ap, 
			ttk_color c_ol, ttk_color c_fill, ttk_color c_dark )
{
	/*  0  1
            2  3  */
	int array[9];		/* the bits - one for each light */
	TApItem *boxOn = NULL, *boxOnB = NULL;
	TApItem *boxOff = NULL, *boxOffB = NULL;
	int x, z;		/* misc */
	int sx=0, sy=0;		/* start x/ start y for the box */
	int w2 = glob->w>>1;	/* w/2 */
	int h2 = glob->h>>1;	/* h/2 */

	int w6 = glob->w/6;	/* w/6 */
	int h6 = glob->h/6;	/* h/6 */

	/* the positions in the 3x3 grid for each of the 9 lights */
	int xp[9] = { 0, w6, w6+w6, 0, w6, w6+w6, 0, w6, w6+w6 };
	int yp[9] = { 0, 0, 0, h6, h6, h6, h6+h6, h6+h6, h6+h6 };

	/* determine sx/sy */
	if( w & 0x01 )  sx = w2;  else  sx = 0;
	if( w & 0x02 )  sy = h2;  else  sy = 0;

	/* use the apearance colorscheme */
	if( use_ap ) {
		if( w == 0 || w == 3 ) {
			boxOff = ttk_ap_getx( "box.default.bg" );
			boxOffB = ttk_ap_getx( "box.default.border" );
			boxOn = ttk_ap_getx( "box.selected.bg" );
			boxOnB = ttk_ap_getx( "box.selected.border" );
		} else {
			boxOff = ttk_ap_getx( "box.default.bg" );
			boxOffB = ttk_ap_getx( "box.default.border" );
			boxOn = ttk_ap_getx( "box.special.bg" );
			boxOnB = ttk_ap_getx( "box.special.border" );
		}
	}

	/* generate the array */
	for( x=0 ; x<9 ; x++ ) array[x] = 0;
	for( x=0 ; x<v ; ) {
		int idx = rand()%9;
		if( !array[idx]) {
			array[idx] = 1;
			x++;
		}
	}

	/* draw the number */
	/* 0 1 2
	   3 4 5
	   6 7 8 */
	for( z=0 ; z<9 ; z++ ) {
		int x1 = sx+xp[z]+INS;
		int y1 = sy+yp[z]+INS;
		int x2 = sx+xp[z]+w6-INS;
		int y2 = sy+yp[z]+h6-INS;

		if( use_ap ) {
			ttk_ap_fillrect( srf, (array[z])? boxOn : boxOff,
				x1, y1, x2, y2 );
			ttk_ap_rect( srf, (array[z])? boxOnB : boxOffB,
				x1, y1, x2, y2 );
		} else {
			if( array[z] ) {
				ttk_fillrect( srf, x1, y1, x2, y2, c_fill );
				ttk_rect( srf, x1, y1, x2, y2, c_ol );
			} else {
				ttk_fillrect( srf, x1, y1, x2, y2, c_dark );
			}
		}
	}
}
예제 #8
0
void tix_rename_draw(TWidget * wid, ttk_surface srf)
{
	ttk_ap_fillrect(srf, ttk_ap_getx("window.bg"), wid->x, wid->y, wid->w, wid->h);
	ttk_text(srf, ttk_menufont, wid->x, wid->y, ttk_ap_getx("window.fg")->color, _("Rename file to:"));
}
예제 #9
0
void tix_mkdir_draw(TWidget * wid, ttk_surface srf)
{
	ttk_ap_fillrect(srf, ttk_ap_getx("window.bg"), wid->x, wid->y, wid->w, wid->h);
	ttk_text(srf, ttk_menufont, wid->x, wid->y, ttk_ap_getx("window.fg")->color, _("Make directory named:"));
}