Exemplo n.º 1
0
void show_config()
{
    int count = 0;
    int row_idx = 0;
    long type;
    if (OBJ_IS_USED(&gui->dialog)) {
        u8 draw_mode = FullRedraw;
        GUI_RemoveObj((guiObject_t *)&gui->dialog);
        FullRedraw = draw_mode;
    }
    if(lp->selected_for_move >= 0) {
        type = ELEM_TYPE(pc->elem[lp->selected_for_move]);
        row_idx = elem_abs_to_rel(lp->selected_for_move);
        count = elem_get_count(type);
    }
    if (! count) {
        dialog_ok_cb(1, NULL);
        return;
    }
    int x = LAYDLG_X - (type == ELEM_TOGGLE ? 68/2 : 0);
    int width = LAYDLG_MIN_WIDTH + (type == ELEM_TOGGLE ? 64 : 0);
    GUI_CreateDialog(&gui->dialog,
         x, LAYDLG_Y,
         width, LAYDLG_HEIGHT,
         _tr("Page Config"), NULL, dialog_ok_cb, dtOk, "");

    GUI_CreateScrollable(&gui->scrollable,
         x + LAYDLG_SCROLLABLE_X, LAYDLG_Y + LAYDLG_SCROLLABLE_Y,
         width - 2 * LAYDLG_SCROLLABLE_X + 1,
         LAYDLG_SCROLLABLE_HEIGHT,
         LAYDLG_TEXT_HEIGHT, count, row_cb, NULL, NULL, (void *)type);
    GUI_SetSelected(GUI_ShowScrollableRowCol(&gui->scrollable, row_idx, 0));
}
Exemplo n.º 2
0
void PAGE_LoadSaveInit(int page)
{
    const char *name;
    int num_models;
    int selected;
    int width = LCD_WIDTH;
    mp->menu_type = page;
    OBJ_SET_USED(&gui->image, 0);

    if (page == SAVE_MODEL) {
        name = _tr("Press ENT to copy to");
    } else {
        name = _tr("Press ENT to load");
    }
    if (page == LOAD_ICON) {
        width = 75;
        GUI_CreateImage(&gui->image, 75, 20, 52, 36, mp->iconstr);
        GUI_SelectionNotify(icon_notify_cb);
    }
    selected = get_scroll_count(page);

    num_models = mp->total_items; /* set by get_scroll_page */
    PAGE_ShowHeader(name);
    GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, width, LCD_HEIGHT - HEADER_HEIGHT,
                         LINE_SPACE, num_models, row_cb, NULL, NULL, NULL);
    GUI_SetSelected(GUI_ShowScrollableRowCol(&gui->scrollable, selected, 0));
}
Exemplo n.º 3
0
static int row_cb(int absrow, int relrow, int y, void *data)
{
    int row_count = (long)data;
    struct LabelDesc listbox = {
        .font = DEFAULT_FONT.font,
        .style = LABEL_LISTBOX,
        .font_color = DEFAULT_FONT.font_color,
        .fill_color = DEFAULT_FONT.fill_color,
        .outline_color = DEFAULT_FONT.outline_color
    };
    if (absrow >= row_count) {
        GUI_CreateLabelBox(&gui->label[relrow], LCD_WIDTH/2-100, y,
                200 - ARROW_WIDTH, LINE_HEIGHT, &listbox, NULL, NULL, "");
    } else {
        GUI_CreateLabelBox(&gui->label[relrow], LCD_WIDTH/2-100, y,
                200 - ARROW_WIDTH, LINE_HEIGHT, &listbox, string_cb, press_cb, (void *)(long)absrow);
    }
    return 1;
}

void PAGE_LanguageInit(int page)
{
    (void)page;
    int num_lang = count_num_languages();
    PAGE_ShowHeader(_tr(PAGE_GetName(PAGEID_LANGUAGE)));

    int min_rows = num_lang >= LISTBOX_ITEMS ? num_lang : LISTBOX_ITEMS;
    GUI_CreateScrollable(&gui->scrollable, LCD_WIDTH/2-100, 40, 200, LISTBOX_ITEMS * LINE_HEIGHT, LINE_HEIGHT, min_rows, row_cb, NULL, NULL, (void *)(long)num_lang);
    GUI_SetSelected(GUI_ShowScrollableRowCol(&gui->scrollable, Transmitter.language, 0));
}
Exemplo n.º 4
0
void PAGE_LanguageInit(int page)
{
    (void)page;
    int num_lang = count_num_languages();
    PAGE_ShowHeader(PAGE_GetName(PAGEID_LANGUAGE));

    int min_rows = num_lang >= LISTBOX_ITEMS ? num_lang : LISTBOX_ITEMS;
    GUI_CreateScrollable(&gui->scrollable, LCD_WIDTH/2-100, 40, 200, LISTBOX_ITEMS * LINE_HEIGHT, LINE_HEIGHT, min_rows, row_cb, NULL, NULL, (void *)(long)num_lang);
    GUI_SetSelected(GUI_ShowScrollableRowCol(&gui->scrollable, Transmitter.language, 0));
}