Example #1
0
static void gui_quickscreen_draw(const struct gui_quickscreen *qs,
                                 struct screen *display,
                                 struct viewport *parent,
                                 struct viewport vps[QUICKSCREEN_ITEM_COUNT],
                                 struct viewport *vp_icons)
{
    int i;
    char buf[MAX_PATH];
    unsigned const char *title, *value;
    void *setting;
    int temp;
    display->set_viewport(parent);
    display->clear_viewport();
    for (i = 0; i < QUICKSCREEN_ITEM_COUNT; i++)
    {
        struct viewport *vp = &vps[i];
        if (!qs->items[i])
            continue;
        display->set_viewport(vp);
        display->scroll_stop(vp);

        title = P2STR(ID2P(qs->items[i]->lang_id));
        setting = qs->items[i]->setting;
        temp = option_value_as_int(qs->items[i]);
        value = option_get_valuestring(qs->items[i],
                                       buf, MAX_PATH, temp);

        if (viewport_get_nb_lines(vp) < 2)
        {
            char text[MAX_PATH];
            snprintf(text, MAX_PATH, "%s: %s", title, value);
            display->puts_scroll(0, 0, text);
        }
        else
        {
            display->puts_scroll(0, 0, title);
            display->puts_scroll(0, 1, value);
        }
        display->update_viewport();
    }
    /* draw the icons */
    display->set_viewport(vp_icons);

    display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
                    (vp_icons->width/2) - 4, 0,      7, 8);
    display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
                    vp_icons->width - 8,
                    (vp_icons->height/2) - 4,        7, 8);
    display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],   0,
                    (vp_icons->height/2) - 4,        7, 8);

    display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
                         (vp_icons->width/2) - 4, 
                          vp_icons->height - 8,       7, 8);

    display->set_viewport(parent);
    display->update_viewport();
    display->set_viewport(NULL);
}
Example #2
0
static const char * value_setting_get_name_cb(int selected_item, 
                                              void * data,
                                              char *buffer,
                                              size_t buffer_len)
{
    selected_item = selection_to_val(data, selected_item);
    return option_get_valuestring(data, buffer, buffer_len, selected_item);
}