Subversion Repositories freemyipod

Rev

Rev 764 | Rev 768 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 764 Rev 765
Line 316... Line 316...
316
        memcpy(framebuf, bg, 176 * 132 * 3);
316
        memcpy(framebuf, bg, 176 * 132 * 3);
317
        message(7, "Loading uninstaller failed!", "  Returning to main menu.  ");
317
        message(7, "Loading uninstaller failed!", "  Returning to main menu.  ");
318
    }
318
    }
319
}
319
}
320
 
320
 
-
 
321
bool update_display(struct chooser_data* data)
-
 
322
{
-
 
323
    char buf[6];
-
 
324
    struct rtc_datetime dt;
-
 
325
    rtc_read_datetime(&dt);
-
 
326
    snprintf(buf, sizeof(buf), "%02d:%02d", dt.hour, dt.minute);
-
 
327
    // clock
-
 
328
    rendertext(framebuf, 143, 4, 176, 0xffffcccc, 0, buf);
-
 
329
    unsigned int batt_level = 22 * read_battery_mwh_current(0) / read_battery_mwh_full(0);
-
 
330
    // remaining battery level
-
 
331
    ui->blendcolor(batt_level, 6, 0xc0ffcccc, framebuf, 5, 5, 176, framebuf, 5, 5, 176);
-
 
332
    // background of the rest space
-
 
333
    ui->blendcolor(22 - batt_level, 6, 0x40000000, framebuf, 5 + batt_level, 5, 176, framebuf, 5 + batt_level, 5, 176);
-
 
334
    return false;
-
 
335
}
-
 
336
 
321
struct chooser_renderer_list_params toolchooser_rparams =
337
struct chooser_renderer_list_params toolchooser_rparams =
322
{
338
{
323
    .version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
339
    .version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
324
    .copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 176), LIBUI_POINT(0, 0)),
340
    .copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 176), LIBUI_POINT(0, 0)),
325
    .copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 176), LIBUI_POINT(0, 0)),
341
    .copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 176), LIBUI_POINT(0, 0)),
Line 334... Line 350...
334
    .viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 176), LIBUI_POINT(7, 30)),
350
    .viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 176), LIBUI_POINT(7, 30)),
335
                              LIBUI_POINT(162, 80)),
351
                              LIBUI_POINT(162, 80)),
336
    .blit_dest = LIBUI_POINT(0, 0),
352
    .blit_dest = LIBUI_POINT(0, 0),
337
    .blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 176), LIBUI_POINT(0, 0)),
353
    .blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 176), LIBUI_POINT(0, 0)),
338
                              LIBUI_POINT(176, 132)),
354
                              LIBUI_POINT(176, 132)),
339
    .preblit = NULL,
355
    .preblit = update_display,
340
    .postblit = NULL
356
    .postblit = NULL
341
};
357
};
342
 
358
 
343
struct chooser_action_handler_wheel_params toolchooser_aparams =
359
struct chooser_action_handler_wheel_params toolchooser_aparams =
344
{
360
{
Line 416... Line 432...
416
    }
432
    }
417
};
433
};
418
 
434
 
419
bool mainchooser_preblit(struct chooser_data* data)
435
bool mainchooser_preblit(struct chooser_data* data)
420
{
436
{
421
    char buf[6];
437
    char buf[4];
422
    struct rtc_datetime dt;
-
 
423
    rtc_read_datetime(&dt);
-
 
424
    snprintf(buf, sizeof(buf), "%02d:%02d", dt.hour, dt.minute);
-
 
425
    // clock
-
 
426
    rendertext(framebuf, 143, 4, 176, 0xffffcccc, 0, buf);
-
 
427
    struct chooser_action_handler_wheel_data* adata;
438
    struct chooser_action_handler_wheel_data* adata;
428
    adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
439
    adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
429
    snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
440
    snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
430
    // remaining time
-
 
431
    rendertext(framebuf, 155, 121, 176, 0xffffcccc, 0, buf);
441
    rendertext(framebuf, 155, 121, 176, 0xffffcccc, 0, buf);
432
    unsigned int batt_level = 22 * read_battery_mwh_current(0) / read_battery_mwh_full(0);
-
 
433
    // remaining battery level
442
    update_display(data);
434
    ui->blendcolor(batt_level, 6, 0xc0ffcccc, framebuf, 5, 5, 176, framebuf, 5, 5, 176);
-
 
435
    // background of the rest space
-
 
436
    ui->blendcolor(22 - batt_level, 6, 0x40000000, framebuf, 5 + batt_level, 5, 176, framebuf, 5 + batt_level, 5, 176);
-
 
437
    return false;
443
    return false;
438
}
444
}
439
 
445
 
440
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
446
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
441
{
447
{