コード例 #1
0
ファイル: window.c プロジェクト: HerrSchrader/McBetty
void
win_redraw(struct Window *win){
	if (! (win->flags & WINFLG_VISIBLE)) return;
	win_draw_border(win);
	if (win->flags & WINFLG_TEXT)
		win_draw_text(win);
	else if (win->flags & WINFLG_BAR){
		draw_progressbar(win->start_row+1, win->start_col, win->height-2, win->fg_color, win->bg_color, 100, 0);
		draw_progressbar(win->start_row+1, win->start_col, win->height-2, win->fg_color, win->bg_color, 0, win->cur_char);
	} else if (win->flags & WINFLG_RAMP){			
			trianglebar_border(win->start_row+1, win->start_col+1, win->width-2, win->height-2, win->fg_color, win->bg_color);
			draw_trianglebar(win->start_row+1, win->start_col+1, win->width-2, win->height-2, win->fg_color, win->bg_color, 0, win->cur_char);
	};
};
コード例 #2
0
ファイル: screen_playing.c プロジェクト: HerrSchrader/McBetty
void
view_time_changed(int te, int tt){
	char newstr[TIMESTR_LEN];
	int newval;
	
	sec2hms(newstr, te);
	strlcat(newstr, " / ", sizeof(newstr));	
	
	if (0 == tt)				// shoutcast ! 
		strlcat(newstr+8, "--:--", sizeof(newstr)-8);
	else
		sec2hms(newstr+8, tt);
	
	win_new_text(&time_win, newstr);
		
	if ( (te < 0) || (tt < 0) || (0 == tt ) )	// elapsed == UNKNOWN or total == UNKNOWN or Shoutcast
		newval = 0;
	else
		newval = (te * 100) / tt;
	
	if ( (win->flags & WINFLG_VISIBLE))
		draw_progressbar(time_prog_win.start_row+1, time_prog_win.start_col, time_prog_win.height-2, 
							time_prog_win.fg_color, time_prog_win.bg_color, time_prog_win.cur_char, newval);
	time_prog_win.cur_char = newval;
};
コード例 #3
0
ファイル: event.c プロジェクト: dotike/pkg
void
progressbar_tick(int64_t current, int64_t total)
{
	int percent;

	if (!quiet && progress_started) {
		if (isatty(STDOUT_FILENO))
			draw_progressbar(current, total);
		else {
			if (progress_interrupted) {
				printf("%s...", progress_message);
			} else if (!getenv("NO_TICK")){
				percent = (total != 0) ? (current * 100. / total) : 100;
				if (last_progress_percent / 10 < percent / 10) {
					last_progress_percent = percent;
					printf(".");
					fflush(stdout);
				}
			}
			if (current >= total)
				progressbar_stop();
		}
	}
	progress_interrupted = false;
}
コード例 #4
0
ファイル: screen_playing.c プロジェクト: elmo2k3/McBetty
void
view_time_changed(int te, int tt){
	char newstr[TIMESTR_LEN];
	int newval;
	
	sec2hms(newstr, te);
	strlcat(newstr, " / ", sizeof(newstr));	
	sec2hms(newstr+8, tt);
	win_new_text(&time_win, newstr);
		
	newval = (te * 100) / tt;
	
	if ( (win->flags & WINFLG_VISIBLE))
		draw_progressbar(time_prog_win.start_row+1, time_prog_win.start_col, time_prog_win.height-2, 
							time_prog_win.fg_color, time_prog_win.bg_color, time_prog_win.cur_char, newval);
	time_prog_win.cur_char = newval;
};
コード例 #5
0
ファイル: skin_render.c プロジェクト: sideral-rockbox/rockbox
static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
                             struct skin_element *element, struct viewport* vp)
{
#ifndef HAVE_LCD_BITMAP
    (void)vp; /* silence warnings */
    (void)info;
#endif    
    struct wps_token *token = (struct wps_token *)element->data;

#ifdef HAVE_LCD_BITMAP
    struct wps_data *data = gwps->data;
    bool do_refresh = (element->tag->flags & info->refresh_type) > 0;
#endif
    switch (token->type)
    {   
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
        case SKIN_TOKEN_VIEWPORT_FGCOLOUR:
        {
            struct viewport_colour *col = token->value.data;
            col->vp->fg_pattern = col->colour;
        }
        break;
        case SKIN_TOKEN_VIEWPORT_BGCOLOUR:
        {
            struct viewport_colour *col = token->value.data;
            col->vp->bg_pattern = col->colour;
        }
        break;
#endif
        case SKIN_TOKEN_VIEWPORT_ENABLE:
        {
            char *label = token->value.data;
            char temp = VP_DRAW_HIDEABLE;
            struct skin_element *viewport = gwps->data->tree;
            while (viewport)
            {
                struct skin_viewport *skinvp = (struct skin_viewport*)viewport->data;
                if (skinvp->label && !skinvp->is_infovp &&
                    !strcmp(skinvp->label, label))
                {
                    if (skinvp->hidden_flags&VP_DRAW_HIDDEN)
                    {
                        temp |= VP_DRAW_WASHIDDEN;
                    }    
                    skinvp->hidden_flags = temp;
                }
                viewport = viewport->next;
            }
        }
        break;
#ifdef HAVE_LCD_BITMAP
        case SKIN_TOKEN_UIVIEWPORT_ENABLE:
            sb_set_info_vp(gwps->display->screen_type, 
                           token->value.data);
            break;
        case SKIN_TOKEN_PEAKMETER:
            data->peak_meter_enabled = true;
            if (do_refresh)
                draw_peakmeters(gwps, info->line_number, vp);
            break;
#endif
#ifdef HAVE_LCD_BITMAP
        case SKIN_TOKEN_PEAKMETER_LEFTBAR:
        case SKIN_TOKEN_PEAKMETER_RIGHTBAR:
            data->peak_meter_enabled = true;
            /* fall through to the progressbar code */
#endif
        case SKIN_TOKEN_VOLUMEBAR:
        case SKIN_TOKEN_BATTERY_PERCENTBAR:
#ifdef HAVE_LCD_BITMAP
        case SKIN_TOKEN_PROGRESSBAR:
        case SKIN_TOKEN_TUNER_RSSI_BAR:
        {
            struct progressbar *bar = (struct progressbar*)token->value.data;
            if (do_refresh)
                draw_progressbar(gwps, info->line_number, bar);
        }
#endif
        break;
#ifdef HAVE_LCD_BITMAP
        case SKIN_TOKEN_IMAGE_DISPLAY_LISTICON:
        case SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY:
        {
            struct image_display *id = token->value.data;
            const char* label = id->label;
            struct gui_img *img = skin_find_item(label,SKIN_FIND_IMAGE, data);
            if (img && img->loaded)
            {
                if (id->token == NULL)
                {
                    img->display = id->subimage;
                }
                else
                {
                    char buf[16];
                    const char *out;
                    int a = img->num_subimages;
                    out = get_token_value(gwps, id->token, info->offset, 
                                          buf, sizeof(buf), &a);

                    /* NOTE: get_token_value() returns values starting at 1! */
                    if (a == -1)
                        a = (out && *out) ? 1 : 2;
                    if (token->type == SKIN_TOKEN_IMAGE_DISPLAY_LISTICON)
                        a -= 2; /* 2 is added in statusbar-skinned.c! */
                    else
                        a--;
                    a += id->offset;

                    /* Clear the image, as in conditionals */
                    clear_image_pos(gwps, img);

                    /* If the token returned a value which is higher than
                     * the amount of subimages, don't draw it. */
                    if (a >= 0 && a < img->num_subimages)
                    {
                        img->display = a;
                    }
                }
            }
            break;
        }
#ifdef HAVE_ALBUMART
        case SKIN_TOKEN_ALBUMART_DISPLAY:
            /* now draw the AA */
            if (do_refresh && data->albumart)
            {
                int handle = playback_current_aa_hid(data->playback_aa_slot);
#if CONFIG_TUNER
                if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
                {
                    struct dim dim = {data->albumart->width, data->albumart->height};
                    handle = radio_get_art_hid(&dim);
                }
#endif
                data->albumart->draw_handle = handle;
            }
            break;
#endif
        case SKIN_TOKEN_DRAW_INBUILTBAR:
            gui_statusbar_draw(&(statusbars.statusbars[gwps->display->screen_type]),
                               info->refresh_type == SKIN_REFRESH_ALL,
                               token->value.data);
            break;
        case SKIN_TOKEN_VIEWPORT_CUSTOMLIST:
            if (do_refresh)
                skin_render_playlistviewer(token->value.data, gwps,
                                           info->skin_vp, info->refresh_type);
            break;
        
#endif /* HAVE_LCD_BITMAP */
#ifdef HAVE_SKIN_VARIABLES
        case SKIN_TOKEN_VAR_SET:
            if (do_refresh)
            {
                struct skin_var_changer *data = token->value.data;
                if (data->direct)
                    data->var->value = data->newval;
                else
                {
                    data->var->value += data->newval;
                    if (data->max)
                    {
                        if (data->var->value > data->max)
                            data->var->value = 1;
                        else if (data->var->value < 1)
                            data->var->value = data->max;
                    }
                }
                if (data->var->value < 1)
                    data->var->value = 1;
                data->var->last_changed = current_tick;
            }
            break;
#endif
        default:
            return false;
    }
    return true;
}
コード例 #6
0
ファイル: satfind.c プロジェクト: ChakaZulu/my_tuxbox_apps
void draw_signal(struct signal *signal_data, struct signal *old_signal, screen_t screen) {
  char dec_buf[11];
  int val,count;
  
  if (signal_data->ber!=old_signal->ber) {
    draw_progressbar(screen,0,0,6,119,&max_values[0],signal_data->ber,4|1);//1656720 max?
    memset(dec_buf,0x20,10);
    dec_buf[10]=0;
    val=signal_data->ber;
    for(count=9;count>=0;count--) {
      dec_buf[count]=(val%10)+0x30;
      val/=10;
      if(val==0)
	break;
    }
    render_string(screen,32,8,dec_buf);
  }
  if (signal_data->snr!=old_signal->snr) {
    draw_progressbar(screen,0,18,6,119,&max_values[1],signal_data->snr,4|1);
    memset(dec_buf,0x20,10);
    dec_buf[10]=0;
    val=signal_data->snr;
    for(count=9;count>=0;count--) {
      dec_buf[count]=(val%10)+0x30;
      val/=10;
      if(val==0)
	break;
    }
    render_string(screen,32,26,dec_buf);
  }
  if (signal_data->strength!=old_signal->strength) {
    draw_progressbar(screen,0,37,6,119,&max_values[2],signal_data->strength,4|1);
    memset(dec_buf,0x20,10);
    dec_buf[10]=0;
    val=signal_data->strength;
    for(count=9;count>=0;count--) {
      dec_buf[count]=(val%10)+0x30;
      val/=10;
      if(val==0)
	break;
    }
    render_string(screen,32,45,dec_buf);
  }
  if ((signal_data->status&FE_HAS_SIGNAL) != (old_signal->status&FE_HAS_SIGNAL)) {
    if(signal_data->status&FE_HAS_SIGNAL) {
      /* we got signal */
      draw_bmp(screen,signal_icon,120-signal_icon[0],64-signal_icon[1]);
      render_string(screen,0,56,"???        ");
    }
    else {
      /* we lost signal */
      draw_rectangle(screen,120-signal_icon[0],64-signal_icon[1],120,64,4);
      render_string(screen,0,56,"NO SIGNAL  ");
    }
  }
  if ((signal_data->status&FE_HAS_LOCK) != (old_signal->status&FE_HAS_LOCK)) {
    if (signal_data->status&FE_HAS_LOCK)
      draw_bmp(screen,lock_icon,120-lock_icon[0]-8,64-lock_icon[1]);
    else
      draw_rectangle(screen,120-lock_icon[0]-8,64-lock_icon[1],120,64,4);
  }
  memcpy(old_signal,signal_data,sizeof(struct signal));
}