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)); }
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)); }
void PAGE_DrExpInit(int page) { (void)page; PAGE_SetModal(0); // draw a underline only: GUI_CreateRect(&gui->rect, 0, HEADER_WIDGET_HEIGHT, LCD_WIDTH, 1, &DEFAULT_FONT); memset(mp, 0, sizeof(*mp)); int count = get_mixers(); int expected = INPUT_NumSwitchPos(mapped_std_channels.switches[SWITCHFUNC_DREXP_AIL + drexp_type]); if (count != expected) { GUI_CreateLabelBox(&gui->u.msg, 0, MESSAGE_Y, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, "Invalid model ini!"); // must be invalid model ini return; } GUI_CreateTextSelectPlate(&gui->u.type, HEADER_X, 0, HEADER_W, HEADER_WIDGET_HEIGHT, &TEXTSEL_FONT, NULL, set_type_cb, (void *)NULL); GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT + SCROLL_Y, SCROLL_W, LCD_HEIGHT - HEADER_HEIGHT - SCROLL_Y, 2 * LINE_SPACE, count, row_cb, NULL, NULL, NULL); GUI_CreateXYGraph(&gui->graph, GRAPH_X, GRAPH_Y, GRAPH_W, GRAPH_H, CHAN_MIN_VALUE, CHAN_MIN_VALUE * 1251 / 1000, CHAN_MAX_VALUE, CHAN_MAX_VALUE * 1251 / 1000, 0, 0, show_curve_cb, curpos_cb, NULL, NULL); GUI_Select1stSelectableObj(); }
void PAGE_DrExpInit(int page) { (void)page; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); memset(mp, 0, sizeof(*mp)); int count = get_mixers(); int expected = INPUT_NumSwitchPos(mapped_std_channels.switches[SWITCHFUNC_DREXP_AIL+drexp_type]); if (count != expected) { GUI_CreateLabelBox(&gui->u.msg, 0, 10, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, "Invalid model ini!");// must be invalid model ini return; } GUI_CreateTextSelectPlate(&gui->u.type, 0, 0, 60, ITEM_HEIGHT, &DEFAULT_FONT, NULL, set_type_cb, (void *)NULL); GUI_CreateScrollable(&gui->scrollable, 0, ITEM_SPACE, 76, LCD_HEIGHT - ITEM_SPACE, 2 *ITEM_SPACE, count, row_cb, NULL, NULL, NULL); u16 ymax = CHAN_MAX_VALUE/100 * MAX_SCALAR; s16 ymin = -ymax; GUI_CreateXYGraph(&gui->graph, 77, 2, 50, RIGHT_VIEW_HEIGHT, CHAN_MIN_VALUE, ymin, CHAN_MAX_VALUE, ymax, 0, 0, show_curve_cb, curpos_cb, NULL, NULL); GUI_Select1stSelectableObj(); }
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)); }
static void _show_page() { const struct telem_layout2 *page = _get_telem_layout2(); PAGE_RemoveAllObjects(); PAGE_ShowHeader((page->header==devo_header_basic || page->header==frsky_header_basic) ? "" : _tr("Telemetry monitor")); tp->font.font = TINY_FONT.font; tp->font.font_color = 0xffff; tp->font.fill_color = 0; tp->font.style = LABEL_SQUAREBOX; DEFAULT_FONT.style = LABEL_CENTER; long i = 0; for(const struct telem_layout *ptr = page->header; ptr->source; ptr++, i++) { GUI_CreateLabelBox(&gui->header[i], ptr->x, 0, ptr->width, HEADER_HEIGHT, ptr->source == ARROW_LABEL ? &NARROW_FONT : &DEFAULT_FONT, header_cb, NULL, (void *)(long)ptr->source); } DEFAULT_FONT.style = LABEL_RIGHT; u8 row_height = page->row_height * LINE_SPACE; GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, row_height, page->num_items, row_cb, NULL, NULL, (void *)page->layout); DEFAULT_FONT.style = LABEL_LEFT; tp->telem = Telemetry; }
void PAGE_VideoSetupInit(int page) { (void)page; show_titlerow(_tr("Video")); GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, 4, row4_cb, NULL, NULL, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, 0)); }
void PAGE_TxConfigureInit(int page) { (void)page; cp->enable = CALIB_NONE; PAGE_SetModal(0); PAGE_ShowHeader(PAGE_GetName(PAGEID_TXCFG)); GUI_CreateScrollable(&gui->scrollable, 0, 32, LCD_WIDTH, LCD_HEIGHT-32, LCD_HEIGHT-32, MAX_PAGE+1, row_cb, NULL, NULL, NULL); }
void PAGE_LanguageInit(int page) { int num_lang = count_num_languages(); PAGE_ShowHeader(_tr("Press ENT to change")); GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, num_lang, row_cb, NULL, NULL, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, Transmitter.language)); }
static void _show_page() { PAGE_ShowHeader(_tr("Timers")); // using the same name as related menu item to reduce language strings PAGE_SetActionCB(_action_cb); GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LCD_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1, LCD_HEIGHT - ITEM_HEIGHT, NUM_TIMERS, row_cb, getobj_cb, NULL, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, current_selected)); }
static void _show_page(int page) { (void)page; PAGE_ShowHeader(_tr(PAGE_GetName(PAGEID_TIMER))); // using the same name as related menu item to reduce language strings GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LCD_HEIGHT - HEADER_HEIGHT, NUM_TIMERS, row_cb, NULL, NULL, NULL); PAGE_SetScrollable(&gui->scrollable, ¤t_selected); }
void PAGE_DebuglogInit(int page) { (void)page; PAGE_ShowHeader(PAGE_GetName(PAGEID_DEBUGLOG)); PAGE_SetModal(0); find_line_ends(); GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, NUM_ROWS, row_cb, NULL, NULL, NULL); }
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)); }
static void _show_page(int page) { (void) page; int init_y = 40; PAGE_ShowHeader(PAGE_GetName(PAGEID_TIMER)); GUI_CreateScrollable(&gui->scrollable, 0, init_y, LCD_WIDTH, 200, 100, NUM_TIMERS / TIMERCOLUMNS, row_cb, NULL, NULL, NULL); PAGE_SetScrollable(&gui->scrollable, ¤t_selected); }
static void _show_page() { PAGE_ShowHeader(_tr("Mixer Reorder:Hold R+")); memset(gui, 0, sizeof(*gui)); u8 channel_count = Model.num_channels + NUM_VIRT_CHANNELS; GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, channel_count, row_cb, NULL, NULL, NULL);// 7 lines PAGE_SetScrollable(&gui->scrollable, ¤t_selected); }
static void _show_page() { // PAGE_ShowHeader(_tr_noop("Trim")); // no title for devo10 GUI_CreateLabelBox(&gui->inputlbl, 0, 0, TEXTSEL_X, HEADER_HEIGHT, &TITLE_FONT, GUI_Localize, NULL, _tr_noop("Input")); GUI_CreateLabelBox(&gui->steplbl, TEXTSEL_X, STEP_Y, TRIMPOS_X - TEXTSEL_X, LINE_HEIGHT, &TITLE_FONT, GUI_Localize, NULL, _tr_noop("Step")); // no enought space in Devo10, so just display trim + in the 1st page GUI_CreateLabelBox(&gui->trimposlbl, TRIMPOS_X, STEP_Y, LCD_WIDTH - TRIMPOS_X, LINE_HEIGHT, &TITLE_FONT, GUI_Localize, NULL, _tr_noop("Trim +")); GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, NUM_TRIMS, row_cb, getobj_cb, NULL, NULL); PAGE_SetScrollable(&gui->scrollable, ¤t_selected); }
static void _show_bar_page(int row) { cur_row = row; cp->num_bars = num_disp_bars(); memset(cp->pctvalue, 0, sizeof(cp->pctvalue)); int view_height = (cp->type == MONITOR_RAWINPUT) ? RAW_HEIGHT // can only show 3 rows: (12 + 5) x 3 : CHAN_HEIGHT; // can only show 4 rows: (8 + 5) x 4 GUI_CreateScrollable(&gui->scrollable, SCROLLABLE_X, HEADER_HEIGHT, LCD_WIDTH-SCROLLABLE_X, LCD_HEIGHT - HEADER_HEIGHT, view_height, (cp->num_bars + 1)/2, row_cb, getobj_cb, NULL, NULL); GUI_CreateLabelBox(&gui->page, LCD_WIDTH -ARROW_W, 0, ARROW_W, HEADER_HEIGHT, &DEFAULT_FONT, _page_cb, NULL, NULL); }
void PAGE_TrimEditInit(int page) { struct Trim *trim = MIXER_GetAllTrims(); tp->index = page; tp->trim = trim[tp->index]; GUI_CreateLabelBox(&guit->header, 0, 0, LABEL2_WIDTH, HEADER_HEIGHT, &TITLE_FONT, GUI_Localize, NULL, _tr_noop("Edit")); GUI_CreateButtonPlateText(&guit->save, BUTTON2_X, BUTTON2_Y, BUTTON2_WIDTH, LINE_HEIGHT, &BUTTON_FONT, GUI_Localize, okcancel_cb, _tr_noop("Save")); GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, ITEM_LAST, row2_cb, getobj2_cb, NULL, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, 0)); }
static void _show_bar_page(u8 num_bars) { current_page = 0; cp->num_bars = num_bars; memset(cp->pctvalue, 0, sizeof(cp->pctvalue)); GUI_CreateLabelBox(&gui->title, 0 , 0, 50, 12, &DEFAULT_FONT, _title_cb, NULL, (void *)NULL); labelDesc.style = LABEL_LEFTCENTER; // bug fix: must initialize to avoid unpredictable drawing GUI_CreateRect(&gui->rect, 0, ITEM_HEIGHT , LCD_WIDTH, 1, &labelDesc); GUI_CreateScrollable(&gui->scrollable, 0, 2, LCD_WIDTH, LCD_HEIGHT-2, 1, (num_bars + 1)/2, row_cb, getobj_cb, NULL, NULL); GUI_CreateLabelBox(&gui->page, LCD_WIDTH-2, 0, 0, 0, &MICRO_FONT, _page_cb, NULL, NULL); }
void PAGE_SwitchAssignInit(int page) { (void)page; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); refresh_switches(); PAGE_ShowHeader(_tr("Press ENT to change")); GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LCD_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1, ITEM_SPACE, SWITCHFUNC_LAST, row_cb, getobj_cb, NULL, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, 0)); }
static void _show_page() { PAGE_SetActionCB(_action_cb); //PAGE_ShowHeader(_tr("Trim")); // no title for devo10 PAGE_ShowHeader(_tr("Input")); GUI_CreateLabelBox(&gui->steplbl, 40, 0, 30, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Step")); // no enought space in Devo10, so just display trim + in the 1st page //GUI_CreateLabelBox(w + 40, 0, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Trim -")); GUI_CreateLabelBox(&gui->trimposlbl, 80, 0, 30, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Trim +")); GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LCD_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1, ITEM_SPACE, NUM_TRIMS, row_cb, getobj_cb, NULL, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, current_selected)); }
static void _show_page() { PAGE_ShowHeader(PAGE_GetName(PAGEID_TRIM)); GUI_CreateLabelBox(&gui->inplbl, PCOL1, PROW1, 64, 15, &NARROW_FONT, NULL, NULL, _tr("Input")); GUI_CreateLabelBox(&gui->neglbl, PCOL2, PROW1, 64, 15, &NARROW_FONT, NULL, NULL, _tr("Trim -")); GUI_CreateLabelBox(&gui->poslbl, PCOL3, PROW1, 64, 15, &NARROW_FONT, NULL, NULL, _tr("Trim +")); GUI_CreateLabelBox(&gui->steplbl, PCOL4, PROW1, 108, 15, &NARROW_FONT, NULL, NULL, _tr("Trim Step")); GUI_CreateScrollable(&gui->scrollable, PCOL1, PROW2, LCD_WIDTH - 2 * PCOL1, NUM_TRIM_ROWS * 24 - 8, 24, NUM_TRIMS, row_cb, getobj_cb, NULL, NULL); PAGE_SetScrollable(&gui->scrollable, ¤t_selected); }
static void _show_simple() { GUI_SelectionNotify(NULL); GUI_Select1stSelectableObj(); // bug fix: muset reset to 1st selectable item, otherwise ,the focus will be wrong mp->firstObj = GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LEFT_VIEW_WIDTH + ARROW_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1, 2 * ITEM_SPACE, SIMPLE_LAST, simple_row_cb, simple_getobj_cb, NULL, NULL); // The following items are not draw in the logical view; GUI_CreateXYGraph(&gui->graph, 77, LCD_HEIGHT - RIGHT_VIEW_HEIGHT - 1, RIGHT_VIEW_HEIGHT, RIGHT_VIEW_HEIGHT, CHAN_MIN_VALUE, CHAN_MIN_VALUE * 5 / 4, CHAN_MAX_VALUE, CHAN_MAX_VALUE * 5 / 4, 0, 0, eval_mixer_cb, curpos_cb, touch_cb, &mp->mixer[0]); OBJ_SET_USED(&gui->bar, 0); }
void PAGE_TxConfigureInit(int page) { (void)page; cp->enable = CALIB_NONE; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); PAGE_ShowHeader(_tr("Configure")); cp->total_items = 0; GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, ITEM_LAST, row_cb, getobj_cb, size_cb, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, current_selected)); }
void PAGE_TrainConfigInit(int page) { (void)page; int mode = PPMin_Mode(); show_titlerow(mode == PPM_IN_TRAIN1 ? _tr("Trainer Cfg (Channel)") : mode == PPM_IN_TRAIN2 ? _tr("Trainer Cfg (Stick)") : _tr("PPMIn Cfg (Extend)")); GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, PPMin_Mode() == PPM_IN_SOURCE ? 3 : 3 + MAX_PPM_IN_CHANNELS, row3_cb, NULL, NULL, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, 0)); }
void show_config() { long count = 0; for (count = 0; count < NUM_ELEMS; count++) { if (! ELEM_USED(pc->elem[count])) break; } #if HAS_LAYOUT_EDITOR static const int ADD_LOAD = 2; # else static const int ADD_LOAD = 1; #endif GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, count + NUM_QUICKPAGES + ADD_LOAD, row_cb, NULL, size_cb, (void *)count); PAGE_SetScrollable(&gui->scrollable, ¤t_selected); }
void PAGE_ModelConfigInit(int page) { (void)page; switch (Model.type) { case MODELTYPE_HELI: show_titlerow(_tr("Helicopter")); break; case MODELTYPE_PLANE: show_titlerow(_tr("Airplane")); break; case MODELTYPE_MULTI: show_titlerow(_tr("Multirotor")); break; } if (Model.type == MODELTYPE_HELI) { GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT, LCD_WIDTH, LCD_HEIGHT - HEADER_HEIGHT, LINE_SPACE, ITEM_LAST, row_cb, NULL, NULL, NULL); GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, 0)); } }
static void _show_page() { #if HAS_STANDARD_GUI if (Model.mixer_mode == MIXER_STANDARD) PAGE_ShowHeader_ExitOnly(PAGE_GetName(PAGEID_TRIM), MODELMENU_Show); else #endif PAGE_ShowHeader(PAGE_GetName(PAGEID_TRIM)); GUI_CreateLabelBox(&gui->inplbl, PCOL1, PROW1, 64, 15, &NARROW_FONT, NULL, NULL, _tr("Input")); GUI_CreateLabelBox(&gui->neglbl, PCOL2, PROW1, 64, 15, &NARROW_FONT, NULL, NULL, _tr("Trim -")); GUI_CreateLabelBox(&gui->poslbl, PCOL3, PROW1, 64, 15, &NARROW_FONT, NULL, NULL, _tr("Trim +")); GUI_CreateLabelBox(&gui->steplbl, PCOL4, PROW1, 108, 15, &NARROW_FONT, NULL, NULL, _tr("Trim Step")); GUI_CreateScrollable(&gui->scrollable, PCOL1, PROW2, LCD_WIDTH - 2 * PCOL1, NUM_TRIM_ROWS * 24 - 8, 24, NUM_TRIMS, row_cb, getobj_cb, NULL, NULL); }
static void _show_bar_page() { int num_bars = num_disp_bars(); //printf("Show bar page nbars: %d, bars per row: %d\n", num_bars, NUM_BARS_PER_ROW); int num_rows = 1; if (num_bars > 2 * (NUM_BARS_PER_ROW + 1)) { num_rows = num_bars / NUM_BARS_PER_ROW + 1; num_bars -= cur_row * NUM_BARS_PER_ROW; if (num_bars > 2 * NUM_BARS_PER_ROW) num_bars = 2 * NUM_BARS_PER_ROW; } cp->num_bars = num_bars; //printf("Calculated num rows: %d, num bars: %d, cur row: %d\n", num_rows, num_bars, cur_row); GUI_CreateScrollable(&gui->scrollable, 0, 32, LCD_WIDTH, LCD_HEIGHT-32, LCD_HEIGHT - 32, num_rows, row_cb, NULL, NULL, NULL); }
void PAGE_ReorderInit(int page) { (void)page; int i; int requested = rl.max; if (rl.max < rl.count) rl.max = rl.count; for(i = 0; i < rl.max; i++) { if (i < rl.count) rl.list[i] = i+1; else rl.list[i] = 0; } u8 space = LINE_HEIGHT; u8 y = 0; guiObject_t *obj = GUI_CreateButtonPlateText(&gui->up, ROW1_X, y, ROW1_W, LINE_HEIGHT, &DEFAULT_FONT, _show_button_cb, 0x0000, press_button_cb, (void *)MOVE_UP); GUI_SetSelected(obj); GUI_CreateButtonPlateText(&gui->down, ROW2_X, y, ROW1_W , LINE_HEIGHT, &DEFAULT_FONT, _show_button_cb, 0x0000, press_button_cb, (void *)MOVE_DOWN); y += space; GUI_CreateTextSelectPlate(&gui->value, ROW1_X, y, BUTTON_W, LINE_HEIGHT, &DEFAULT_FONT, NULL, value_val_cb, NULL); y += space; GUI_CreateButtonPlateText(&gui->apply, ROW1_X, y, BUTTON_W, LINE_HEIGHT, &DEFAULT_FONT, _show_button_cb, 0x0000, press_button_cb, (void *)APPLY); y += space; GUI_CreateTextSelectPlate(&gui->copy, ROW1_X, y, BUTTON_W, LINE_HEIGHT, &DEFAULT_FONT, NULL, copy_val_cb, NULL); if (requested) { y += space; GUI_CreateButtonPlateText(&gui->insert, ROW1_X, y, ROW1_W, LINE_HEIGHT, &DEFAULT_FONT, _show_button_cb, 0x0000, press_button_cb, (void *)INSERT); GUI_CreateButtonPlateText(&gui->remove, ROW2_X, y, ROW1_W, LINE_HEIGHT, &DEFAULT_FONT, _show_button_cb, 0x0000, press_button_cb, (void *)REMOVE); } GUI_CreateButtonPlateText(&gui->save, SAVE_X, 0, SAVE_W, LINE_HEIGHT, &DEFAULT_FONT, NULL, 0x0000, okcancel_cb, (void *)_tr("Save")); GUI_CreateScrollable(&gui->scrollable, LABEL_X, LINE_HEIGHT, LCD_WIDTH - LABEL_X , LCD_HEIGHT-LINE_HEIGHT, LINE_SPACE, rl.max, row_cb, NULL, NULL, NULL); GUI_SetSelectable((guiObject_t *)&gui->scrollable, 0); }