Esempio n. 1
0
/* set text to NULL for updating, to a value for new window stuff */
static void updateprogress( TWindow * sliderwin, TWidget * slider,
			    int newVal, char * displayText,
			    char * lineTwo )
{
	ttk_color menu_bg_color = 0;
	ttk_color menu_fg_color = 0;
	int textw;

	if( newVal < 0 ) newVal = 0; /* jsut in case */

	/* if displayText is non-NULL, rerender the whole thing */
	if( displayText || lineTwo ) {
		if( ttk_ap_getx( "menu.bg" ))
			menu_bg_color = ttk_ap_getx("menu.bg")->color;
		if( ttk_ap_getx( "menu.fg" ))
			menu_fg_color = ttk_ap_getx("menu.fg")->color;

		if( menu_fg_color == menu_bg_color ) {
		    if( menu_fg_color == 0 || menu_fg_color == 3 ) { /*why 3?*/
			menu_fg_color = ttk_makecol( BLACK );
			menu_bg_color = ttk_makecol( WHITE );
		    }
		}

		ttk_fillrect(sliderwin->srf,0,0,
				sliderwin->w,sliderwin->h,
				menu_bg_color );

		if( displayText ) {
			textw = ttk_text_width(ttk_textfont,displayText);
			ttk_text(sliderwin->srf,ttk_textfont,
				ttk_screen->w/ 2 - textw/2, ttk_screen->h/2,
				menu_fg_color, displayText);
		}

		if( lineTwo ) {
			textw = ttk_text_width(ttk_textfont, lineTwo);
			ttk_text(sliderwin->srf,ttk_textfont,
				ttk_screen->w/ 2 - textw/2, 
				ttk_screen->h/2 + ttk_textfont->height + 5,
				menu_fg_color, lineTwo);
		}
	}

	ttk_slider_set_val(slider,newVal);
	ttk_slider_draw(slider,sliderwin->srf);
	ttk_draw_window(sliderwin);
	ttk_gfx_update(ttk_screen->srf);
//	ttk_delay(10);  //useful for testing
}
Esempio n. 2
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);
	}
}
Esempio n. 3
0
static void othello_color_draw(PzWidget *wid, ttk_surface srf)
{
	unsigned char xline, yline, c;
	int x, y, step, startx, endx, size;

#ifdef SDL
	ttk_fillrect(srf, 0,0, wid->w, wid->h, ttk_ap_getx("window.bg")->color);
#endif
	step = (wid->h / 8);
	size = step * 8;
	startx = (wid->w - wid->h) / 2;
	endx = startx + size;
	ttk_fillrect(srf, startx,0, endx, size, BGCOLOR);
	for (x = 0; x < 9; ++x) {
		int mod = (size / 8) * x;
		ttk_line(srf, startx, mod, endx, mod, 0x000000);
		ttk_line(srf, startx + mod, 0, startx + mod, size, 0x000000);
	}
	yline = 0;
	for (c = 0; c < 64; c++) {
		xline = c % 8;
		x = xline * step + step/2 + startx;
		y = yline * step + step/2 + 0;
		if (_othello->b_set & (1ULL << c)) {
			if (_othello->board & (1ULL << c))
				draw_image(_othello->black, srf, x, y);
			else
				draw_image(_othello->white, srf, x, y);
		}
		else if (_othello->cur_bit == c)
			draw_image(_othello->selection, srf, x, y);
		if (xline == 7) yline++;
	}
}
Esempio n. 4
0
void transfer_alt_stat_draw (PzWidget *wid, ttk_surface srf) {
	char buf[128];
	stat_data *stats = (stat_data *)wid->data;
    int y = wid->y + 5; 
	
	ttk_color color = ttk_ap_getx ("window.fg")->color;
	
    ttk_text (srf, ttk_textfont, wid->x + 5, y, color, _("Selected:"));
	y += ttk_text_height (ttk_textfont) + 1;

	sprintf(buf, "%i tracks.", stats->num_files);
    ttk_text (srf, ttk_textfont, wid->x + 5, y, color, buf);
/*
    ttk_text (srf, ttk_textfont, wid->x + 5, y, color, _("Tracks:"));
    sprintf(buf, "%i", stats->num_tracks);
	printf("textwid: %i\n", ttk_text_width(ttk_textfont, buf));
    ttk_text (srf, ttk_textfont, wid->w - ttk_text_width(ttk_textfont, buf) - 6,
                      y, color, buf);
*/	
	y += ttk_text_height (ttk_textfont) + 1;

	sprintf(buf, "%s bytes.", humanize_size(stats->total_bytes));
    ttk_text (srf, ttk_textfont, wid->x + 5, y, color, buf);
	y += ttk_text_height (ttk_textfont) + 1;
}
Esempio n. 5
0
static void pp_place_text(PzWidget *wid, ttk_surface srf, void *text, int num) {
	int w, h;
	w = ttk_text_width(ttk_menufont,  (char *)text); 
	h = ttk_text_height(ttk_menufont);
	
	ttk_text(srf, ttk_menufont, w < wid->w ? (wid->w - w) / 2 : 8,
			h*num - (2*h)/3, ttk_ap_getx("window.fg")->color,
			(char *)text); 
}
Esempio n. 6
0
static void othello_mono_draw(PzWidget *wid, ttk_surface srf)
{
	unsigned char xline, yline, c;
	int coordx, coordy;
	ttk_color fg = ttk_ap_getx("window.fg")->color;

#ifdef SDL
	ttk_fillrect(srf, 0,0, wid->w, wid->h, ttk_ap_getx("window.bg")->color);
#endif
	yline = 0;
	for (c = 0; c < 64; c++) {
		xline = c % 8;
		coordx = xline*(PC_SZ+PC_PAD) + PC_PAD/2 + BO_XS;
		coordy = yline*(PC_SZ+PC_PAD) + PC_PAD/2 + BO_YS;
		if (_othello->b_set & (1ULL << c)) {

			if (_othello->board & (1ULL << c)) {
				ttk_aafillellipse(srf, coordx + PC_SZ/2,
						coordy + PC_SZ/2, PC_SZ/2,
						PC_SZ/2, fg);
			}
			else {
				ttk_aaellipse(srf, coordx + PC_SZ/2,
						coordy + PC_SZ/2, PC_SZ/2,
						PC_SZ/2, fg);
			}
		}
		else {
			ttk_pixel(srf, coordx + PC_SZ/2,
					coordy + PC_SZ/2, fg);
		}
		if (_othello->cur_bit == c) {
			ttk_aaellipse(srf, coordx + PC_SZ/2,
					coordy + PC_SZ/2, PC_SZ/2, PC_SZ/2,
					ttk_ap_getx("scroll.bar")->color);
			ttk_aaellipse(srf, coordx + PC_SZ/2,
					coordy + PC_SZ/2, PC_SZ/4, PC_SZ/4,
					ttk_ap_getx("scroll.bar")->color);
		}
		if (xline == 7) yline++;
	}
	/*XXX*/
}
Esempio n. 7
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) );	
    }
}
Esempio n. 8
0
TApItem * ti_ap_getx(int i)
{
	TApItem * tai;
	switch (i) {
	case 0:
		tai = ttk_ap_get("input.bg");
		if (!tai) { tai = ttk_ap_getx("window.bg"); }
		return tai;
		break;
	case 1:
		tai = ttk_ap_get("input.fg");
		if (!tai) { tai = ttk_ap_getx("window.fg"); }
		return tai;
		break;
	case 2:
		tai = ttk_ap_get("input.selbg");
		if (!tai) { tai = ttk_ap_getx("menu.selbg"); }
		return tai;
		break;
	case 3:
		tai = ttk_ap_get("input.selfg");
		if (!tai) { tai = ttk_ap_getx("menu.selfg"); }
		return tai;
		break;
	case 4:
		tai = ttk_ap_get("input.border");
		if (!tai) { tai = ttk_ap_getx("window.border"); }
		return tai;
		break;
	case 5:
		tai = ttk_ap_get("input.cursor");
		if (!tai) { tai = ttk_ap_getx("window.border"); }
		return tai;
		break;
	}
	return 0;
}
Esempio n. 9
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 );
			}
		}
	}
}
Esempio n. 10
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:"));
}
Esempio n. 11
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:"));
}