static void _show_buttons(int loadsave) { (void)show_loadsave_cb; load_save = loadsave; PAGE_SetActionCB(_action_cb); if (loadsave == LOAD_TEMPLATE || loadsave == LOAD_MODEL || loadsave == LOAD_ICON || loadsave == LOAD_LAYOUT) PAGE_ShowHeader(_tr("Press ENT to load")); else if (loadsave == SAVE_MODEL) PAGE_ShowHeader(_tr("Press ENT to copy to")); //u8 w = 40; //GUI_CreateButtonPlateText(LCD_WIDTH -w -5, 0, w, ITEM_HEIGHT, &DEFAULT_FONT, show_loadsave_cb, 0x0000, okcancel_cb, (void *)(loadsave+1L)); }
void PAGE_MainLayoutInit(int page) { (void)page; #if HAS_LAYOUT_EDITOR PAGE_ShowHeader(_tr_noop("Layout: Long-Press ENT")); PAGE_SetActionCB(_action_cb); #else PAGE_ShowHeader(PAGE_GetName(PAGEID_MAINCFG)); #endif memset(gui, 0, sizeof(*gui)); memset(lp, 0, sizeof(*lp)); show_config(); }
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_ModelConfigInit(int page) { (void)page; PAGE_ShowHeader(Model.type == 0 ? _tr_noop("Helicopter") : _tr_noop("Airplane")); if (Model.type == 0) { u8 i = ROW1; GUI_CreateLabelBox(&gui->swashlbl, COL1, i, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("SwashType")); GUI_CreateTextSelect(&gui->swash, COL2, i - 1, TEXTSELECT_96, NULL, swash_val_cb, NULL); i+=28; GUI_CreateLabelBox(&gui->invlbl[0], COL1, i, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("ELE Inv")); GUI_CreateTextSelect(&gui->inv[0], COL2, i - 1, TEXTSELECT_96, swashinv_press_cb, swashinv_val_cb, (void *)1); i+=22; GUI_CreateLabelBox(&gui->invlbl[1], COL1, i, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("AIL Inv")); GUI_CreateTextSelect(&gui->inv[1], COL2, i - 1, TEXTSELECT_96, swashinv_press_cb, swashinv_val_cb, (void *)2); i+=22; GUI_CreateLabelBox(&gui->invlbl[2], COL1, i, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("COL Inv")); GUI_CreateTextSelect(&gui->inv[2], COL2, i - 1, TEXTSELECT_96, swashinv_press_cb, swashinv_val_cb, (void *)4); i+=28; GUI_CreateLabelBox(&gui->mixlbl[0], COL1, i, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("ELE Mix")); GUI_CreateTextSelect(&gui->mix[0], COL2, i - 1, TEXTSELECT_96, NULL, swashmix_val_cb, (void *)1); i+=22; GUI_CreateLabelBox(&gui->mixlbl[1], COL1, i, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("AIL Mix")); GUI_CreateTextSelect(&gui->mix[1], COL2, i - 1, TEXTSELECT_96, NULL, swashmix_val_cb, (void *)0); i+=22; GUI_CreateLabelBox(&gui->mixlbl[2], COL1, i, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("COL Mix")); GUI_CreateTextSelect(&gui->mix[2], COL2, i - 1, TEXTSELECT_96, NULL, swashmix_val_cb, (void *)2); } }
void PAGE_InputtestInit(int page) { (void)page; PAGE_ShowHeader(PAGE_GetName(PAGEID_INPUTMON)); cp->type = MONITOR_RAWINPUT; _show_bar_page(); }
void PAGE_ButtontestInit(int page) { (void)page; PAGE_ShowHeader(PAGE_GetName(PAGEID_BTNMON)); cp->type = MONITOR_BUTTONTEST; show_button_page(); }
void PAGE_TrimEditInit(int page) { struct Trim *trim = MIXER_GetAllTrims(); tp->index = page; tp->trim = trim[tp->index]; PAGE_ShowHeader(_tr("Trim")); PAGE_CreateOkButton(LCD_WIDTH-56, 4, okcancel_cb); enum { COL1 = (64 + ((LCD_WIDTH - 320) / 2)), COL2 = (160 + ((LCD_WIDTH - 320) / 2)), ROW1 = (80 + ((LCD_HEIGHT - 240) / 2)), ROW2 = (ROW1 + 24), ROW3 = (ROW1 + 48), ROW4 = (ROW1 + 72), ROW5 = (ROW1 + 96), }; //Row 1 GUI_CreateLabel(&gui_ed->srclbl, COL1, ROW1, NULL, DEFAULT_FONT, _tr("Input")); GUI_CreateTextSource(&gui_ed->src, COL2, ROW1, TEXTSELECT_96, NULL, set_source_cb, set_input_source_cb, &tp->trim.src); //Row 2 GUI_CreateLabel(&gui_ed->steplbl, COL1, ROW2, NULL, DEFAULT_FONT, _tr("Trim Step")); GUI_CreateTextSelect(&gui_ed->step, COL2, ROW2, TEXTSELECT_96, NULL, set_trimstep_cb, (void *)(long)(tp->index + 0x100)); //0x100: Use tp->trim //Row 3 GUI_CreateLabelBox(&gui_ed->neglbl, COL1, ROW3, COL2-COL1, ROW4-ROW3, &DEFAULT_FONT, NULL, NULL, _tr("Trim -")); GUI_CreateTextSelect(&gui_ed->neg, COL2, ROW3, TEXTSELECT_96, NULL, set_trim_cb, &tp->trim.neg); //Row 4 GUI_CreateLabel(&gui_ed->poslbl, COL1, ROW4, NULL, DEFAULT_FONT, _tr("Trim +")); GUI_CreateTextSelect(&gui_ed->pos, COL2, ROW4, TEXTSELECT_96, NULL, set_trim_cb, &tp->trim.pos); //Row 5 GUI_CreateLabelBox(&gui_ed->swlbl, COL1, ROW5, COL2-COL1, ROW5-ROW4, &DEFAULT_FONT, NULL, NULL, _tr("Switch")); GUI_CreateTextSource(&gui_ed->sw, COL2, ROW5, TEXTSELECT_96, NULL, set_switch_cb, set_input_switch_cb, &tp->trim.sw); }
void PAGE_SwashInit(int page) { (void)page; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); get_swash(); u8 w = 60; u8 x = 63; PAGE_ShowHeader(_tr("SwashType")); GUI_CreateTextSelectPlate(&gui->type, x-3, 0, w + 8, LINE_HEIGHT - 1, &DEFAULT_FONT, NULL, swash_val_cb, NULL); // FIXME: need a special value for header button/textsels u8 row = LINE_SPACE; GUI_CreateLabelBox(&gui->lbl[0], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("ELE Mix")); GUI_CreateTextSelectPlate(&gui->mix[0], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, swashmix_val_cb, (void *)1); row += LINE_SPACE; GUI_CreateLabelBox(&gui->lbl[1], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("AIL Mix")); GUI_CreateTextSelectPlate(&gui->mix[1], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, swashmix_val_cb, (void *)0); row += LINE_SPACE; GUI_CreateLabelBox(&gui->lbl[2], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("PIT Mix")); GUI_CreateTextSelectPlate(&gui->mix[2], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, swashmix_val_cb, (void *)2); update_swashmixes(); GUI_Select1stSelectableObj(); }
void PAGE_ChantestInit(int page) { (void)page; PAGE_ShowHeader(PAGE_GetName(PAGEID_CHANMON)); cp->type = MONITOR_MIXEROUTPUT; _show_bar_page(); }
void PAGE_TelemconfigInit(int page) { (void)page; enum { COL1 = (10 + ((LCD_WIDTH - 320) / 2)), COL2 = (COL1 + 55), COL3 = (COL1 + 156), COL4 = (COL1 + 225), ROW1 = (70 + ((LCD_HEIGHT - 240) / 2)), }; const u8 row_height = 25; PAGE_SetModal(0); #if HAS_STANDARD_GUI if (Model.mixer_mode == MIXER_STANDARD) PAGE_ShowHeader_ExitOnly(PAGE_GetName(PAGEID_TELEMCFG), MODELMENU_Show); else #endif PAGE_ShowHeader(PAGE_GetName(PAGEID_TELEMCFG)); if (telem_state_check() == 0) { GUI_CreateLabelBox(&gui->msg, 20, 80, 280, 100, &NARROW_FONT, NULL, NULL, tempstring); return; } for (long i = 0; i < TELEM_NUM_ALARMS; i++) { GUI_CreateLabelBox(&gui->name[i], COL1, ROW1 + row_height * i, 55, 16, &DEFAULT_FONT, label_cb, NULL, (void *)i); GUI_CreateTextSelect(&gui->type[i], COL2, ROW1 + row_height * i, TEXTSELECT_96, NULL, telem_name_cb, (void *)i); GUI_CreateTextSelect(&gui->gtlt[i], COL3, ROW1 + row_height * i, TEXTSELECT_64, NULL, gtlt_cb, (void *)i); GUI_CreateTextSelect(&gui->value[i], COL4, ROW1 + row_height * i, TEXTSELECT_64, NULL, limit_cb, (void *)i); } }
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)); }
void PAGE_RTCInit(int page) { (void)page; PAGE_SetModal(0); PAGE_ShowHeader(PAGE_GetName(PAGEID_RTC)); u32 time = RTC_GetValue(); u32 timevalue = RTC_GetTimeValue(time); Rtc.value[HOUR] = (u16)(timevalue / 3600); Rtc.value[MINUTE] = (u16)(timevalue % 3600) / 60; Rtc.value[SECOND] = (u16)(timevalue % 60); RTC_GetDateStringLong(tempstring,time); int idx = (tempstring[1] == '.' ? 1 : 2); tempstring[idx] = 0; tempstring[idx+3] = 0; Rtc.value[DAY] = atoi(tempstring); Rtc.value[MONTH] = atoi(tempstring + idx + 1); Rtc.value[YEAR] = atoi(tempstring + idx + 4); min[SECOND] = 0; max[SECOND] = 59; min[MINUTE] = 0; max[MINUTE] = 59; min[HOUR] = 0; max[HOUR] = 23; min[DAY] = 1; max[DAY] = daysInMonth[Rtc.value[MONTH] - 1] + (((Rtc.value[YEAR] % 4) == 0) && (Rtc.value[MONTH] == 2) ? 1 : 0); min[MONTH] = 1; max[MONTH] = 12; min[YEAR] = RTC_STARTYEAR; max[YEAR] = RTC_STARTYEAR + 67; _show_page(); }
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; }
static void _draw_page(u8 enable) { (void)enable; PAGE_ShowHeader(PAGE_GetName(PAGEID_SCANNER)); GUI_CreateButtonPlateText(&gui->enable, 0, HEADER_HEIGHT, 40, LINE_HEIGHT, &BUTTON_FONT, enablestr_cb, press_enable_cb, NULL); GUI_CreateTextSelectPlate(&gui->averaging, LCD_WIDTH/2 - 23, HEADER_HEIGHT, 46, LINE_HEIGHT, &TEXTSEL_FONT, mode_cb, average_cb, NULL); GUI_CreateTextSelectPlate(&gui->attenuator, LCD_WIDTH - 40, HEADER_HEIGHT, 40, LINE_HEIGHT, &TEXTSEL_FONT, NULL, attenuator_cb, NULL); }
static void show_titlerow(const char *header) { PAGE_ShowHeader(header); //u8 w = 40; // I don't think there is a need for the save button //GUI_CreateButtonPlateText(LCD_WIDTH - w -5, 0, // w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, 0x0000, okcancel_cb, _tr("Save")); }
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)); }
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); }
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_MainLayoutInit(int page) { (void)page; memset(lp, 0, sizeof(*lp)); BUTTON_RegisterCallback(&action, CHAN_ButtonMask(BUT_ENTER) | CHAN_ButtonMask(BUT_EXIT) | CHAN_ButtonMask(BUT_LEFT) | CHAN_ButtonMask(BUT_LEFT) | CHAN_ButtonMask(BUT_RIGHT) | CHAN_ButtonMask(BUT_UP) | CHAN_ButtonMask(BUT_DOWN), BUTTON_PRESS | BUTTON_LONGPRESS | BUTTON_PRIORITY, _action_cb, NULL); PAGE_ShowHeader(NULL); lp->long_press = 0; lp->newelem = 0; lp->selected_x = 0; const u16 color[5] = { RGB888_to_RGB565(0xaa, 0x44, 0x44), RGB888_to_RGB565(0x44, 0xaa, 0x44), RGB888_to_RGB565(0x44, 0x44, 0xaa), RGB888_to_RGB565(0x44, 0x44, 0x44), RGB888_to_RGB565(0x33, 0x33, 0x33), }; for (int i = 0 ; i < 5; i++) gui->desc[i] = (struct LabelDesc){ .font = 0, .font_color = 0xffff, .fill_color = color[i], .outline_color = 0, .style = LABEL_FILL}; gui->desc[1].font = TINY_FONT.font; //Special case for trims GUI_CreateIcon(&gui->newelem, 32, 0, &icons[ICON_LAYOUT_ADD], add_dlg_cb, NULL); GUI_CreateIcon(&gui->editelem, 64, 0, &icons[ICON_LAYOUT_CFG], cfg_cb, NULL); GUI_SetHidden((guiObject_t *)&gui->editelem, 1); //GUI_CreateTextSelect(&gui->newelem, 36, 12, TEXTSELECT_96, newelem_press_cb, newelem_cb, NULL); GUI_CreateLabel(&gui->xlbl, 80+18, 9, NULL, TITLE_FONT, "X"); GUI_CreateTextSelect(&gui->x, 88+18, 8, TEXTSELECT_64, NULL, xpos_cb, NULL); GUI_CreateLabel(&gui->ylbl, 164+16, 9, NULL, TITLE_FONT, "Y"); GUI_CreateTextSelect(&gui->y, 172+16, 8, TEXTSELECT_64, NULL, ypos_cb, NULL); GUI_SelectionNotify(notify_cb); draw_elements(); if (show_config_menu) { lp->selected_for_move = show_config_menu; show_config(); show_config_menu = 0; } } void PAGE_MainLayoutEvent() { } void PAGE_MainLayoutExit() { BUTTON_UnregisterCallback(&action); }
void PAGE_TouchEvent(void) { if (cp->state == 0 || cp->state == 3) { if (GUI_ObjectNeedsRedraw((guiObject_t *)&guic->msg)) return; draw_target(cp->state ? LCD_WIDTH - XCOORD : XCOORD , cp->state ? LCD_HEIGHT - YCOORD : YCOORD + 32); cp->state++; } else if (cp->state == 1 || cp->state == 4) { if (SPITouch_IRQ()) { cp->coords = SPITouch_GetCoords(); cp->state++; } } else if (cp->state == 2) { if (! SPITouch_IRQ()) { cp->coords1 = cp->coords; GUI_RemoveObj((guiObject_t *)&guic->msg); GUI_CreateLabelBox(&guic->msg, LCD_WIDTH - XCOORD - 5, LCD_HEIGHT - YCOORD - 5, 11, 11, &SMALLBOX_FONT, NULL, NULL, ""); GUI_Redraw(&guic->msg1); cp->state = 3; } else { cp->coords = SPITouch_GetCoords(); } } else if (cp->state == 5) { if (! SPITouch_IRQ()) { s32 xscale, yscale; s32 xoff, yoff; printf("T1:(%d, %d)\n", cp->coords1.x, cp->coords1.y); printf("T2:(%d, %d)\n", cp->coords.x, cp->coords.y); xscale = cp->coords.x - cp->coords1.x; xscale = (LCD_WIDTH - 2 * XCOORD) * 0x10000 / xscale; yscale = cp->coords.y - cp->coords1.y; yscale = (LCD_HEIGHT - 32 - 2 * YCOORD) * 0x10000 / yscale; xoff = XCOORD - cp->coords1.x * xscale / 0x10000; yoff = YCOORD + 32 - cp->coords1.y * yscale / 0x10000; printf("Debug: scale(%d, %d) offset(%d, %d)\n", (int)xscale, (int)yscale, (int)xoff, (int)yoff); SPITouch_Calibrate(xscale, yscale, xoff, yoff); PAGE_RemoveAllObjects(); PAGE_ShowHeader(PAGE_GetName(PAGEID_TOUCH)); GUI_CreateLabelBox(&guic->msg, (LCD_WIDTH - 150) / 2, (LCD_HEIGHT - 25) / 2, 150, 25, &SMALLBOX_FONT, coords_cb, NULL, NULL); memset(&cp->coords, 0, sizeof(cp->coords)); cp->state = 6; } else { cp->coords = SPITouch_GetCoords(); } } else if(cp->state == 6) { struct touch t; if (SPITouch_IRQ()) { t = SPITouch_GetCoords(); if (memcmp(&t, &cp->coords, sizeof(t)) != 0) { cp->coords = t; GUI_Redraw(&guic->msg); } } } }
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); }
static const char *_mixermode_cb(guiObject_t *obj, int dir, void *data) { const char *ret = mixermode_cb(obj, dir, data); if(Model.mixer_mode != mp->last_mixermode) { mp->last_mixermode = Model.mixer_mode; PAGE_RemoveHeader(); PAGE_ShowHeader(PAGE_GetName(PAGEID_MODEL)); } return ret; }
void PAGE_ChantestInit(int page) { (void)page; PAGE_SetActionCB(_action_cb); PAGE_RemoveAllObjects(); PAGE_ShowHeader(cp->type == MONITOR_RAWINPUT ? _tr("Stick input") : _tr("Mixer output")); if (cp->type != MONITOR_RAWINPUT ) cp->type = MONITOR_MIXEROUTPUT;// cp->type may not be initialized yet, so do it here _show_bar_page(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)); }
static void show_iconsel_page(int SelectedIcon) { struct ImageMap img; int toggleinput = MIXER_SRC(Model.pagecfg2.elem[tp->tglidx].src); PAGE_RemoveAllObjects(); PAGE_ShowHeader(INPUT_SourceNameAbbrevSwitch(tempstring, toggleinput)); GUI_CreateButton(&gui->revert, LCD_WIDTH-96-8, 4, BUTTON_96, revert_str_cb, revert_cb, NULL); // Show name of source for toggle icon // style the switch textbox struct LabelDesc outline = { .font = DEFAULT_FONT.font, .style = LABEL_TRANSPARENT, .font_color = DEFAULT_FONT.font_color, .fill_color = DEFAULT_FONT.fill_color, .outline_color = DEFAULT_FONT.outline_color }; GUI_CreateRect(&gui->toggleframe, 80+80*SelectedIcon, 39, 77, 33, &outline); GUI_CreateLabelBox(&gui->switchbox, 4, 47, 70, 22, &NORMALBOX_FONT, NULL, NULL, INPUT_SourceNameAbbrevSwitch(tempstring, Model.pagecfg2.elem[tp->tglidx].src)); int num_positions = INPUT_NumSwitchPos(toggleinput); if(num_positions < 2) num_positions = 2; GUI_CreateLabelBox(&gui->togglelabel[0], 94, 50, 30, 14, &LABEL_FONT, NULL, NULL, _tr("Pos 0")); img = TGLICO_GetImage(Model.pagecfg2.elem[tp->tglidx].extra[0]); GUI_CreateImageOffset(&gui->toggleicon[0], 124, 40, TOGGLEICON_WIDTH, TOGGLEICON_HEIGHT, img.x_off, img.y_off, img.file, SelectedIcon == 0 ? tglico_reset_cb : tglico_setpos_cb, (void *)0L); GUI_CreateLabelBox(&gui->togglelabel[1], 174, 50, 30, 14, &LABEL_FONT, NULL, NULL, _tr("Pos 1")); img = TGLICO_GetImage(Model.pagecfg2.elem[tp->tglidx].extra[1]); GUI_CreateImageOffset(&gui->toggleicon[1], 204, 40, TOGGLEICON_WIDTH, TOGGLEICON_HEIGHT, img.x_off, img.y_off, img.file, SelectedIcon == 1 ? tglico_reset_cb : tglico_setpos_cb, (void *)1L); if (num_positions == 3) { GUI_CreateLabelBox(&gui->togglelabel[2], 254, 50, 30, 14, &LABEL_FONT, NULL, NULL, _tr("Pos 2")); img = TGLICO_GetImage(Model.pagecfg2.elem[tp->tglidx].extra[2]); GUI_CreateImageOffset(&gui->toggleicon[2], 284, 40, TOGGLEICON_WIDTH, TOGGLEICON_HEIGHT, img.x_off, img.y_off, img.file, SelectedIcon == 2 ? tglico_reset_cb : tglico_setpos_cb, (void *)2L); } int count = get_toggle_icon_count(); int max_scroll = (count + NUM_SYMBOL_COLS - 1) / NUM_SYMBOL_COLS - (NUM_SYMBOL_ROWS - 1); if (max_scroll > 1) GUI_CreateScrollbar(&gui->scrollbar, LCD_WIDTH-16, 80, LCD_HEIGHT-80, max_scroll, NULL, scroll_cb, (void *)(long)SelectedIcon); show_icons(SelectedIcon, 0); } void PAGE_ToggleEditInit(int page) { tp->tglidx = page; memcpy(tp->tglicons, Model.pagecfg2.elem[tp->tglidx].extra, sizeof(tp->tglicons)); show_iconsel_page(0); }
void PAGE_ReverseInit(int page) { struct mixer_page * mp = &pagemem.u.mixer_page; PAGE_ShowHeader(PAGE_GetName(PAGEID_REVERSE)); mp->max_scroll = Model.num_channels > ENTRIES_PER_PAGE ? Model.num_channels - ENTRIES_PER_PAGE : 0; mp->firstObj = NULL; GUI_CreateScrollbar(&gui->scrollbar, LCD_WIDTH-16, 32, LCD_HEIGHT-32, mp->max_scroll+1, NULL, STDMIX_ScrollCB, show_page); show_page(page); }
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 _draw_page(u8 enable) { PAGE_RemoveAllObjects(); PAGE_ShowHeader(_tr("USB")); PAGE_SetActionCB(_action_cb); snprintf(tempstring, sizeof(tempstring), "%s %s", _tr("Press ENT to turn \nUSB drive"), enable == 0 ? _tr("On") : _tr("Off")); GUI_CreateLabelBox(&gui->label, LABEL_X, LABEL_Y, LABEL_WIDTH, LABEL_HEIGHT, &DEFAULT_FONT, NULL, NULL, tempstring); }
static void _show_title(int page) { mp->max_scroll = Model.num_channels + NUM_VIRT_CHANNELS > ENTRIES_PER_PAGE ? Model.num_channels + NUM_VIRT_CHANNELS - ENTRIES_PER_PAGE : Model.num_channels + NUM_VIRT_CHANNELS; PAGE_ShowHeader(PAGE_GetName(PAGEID_MIXER)); GUI_CreateIcon(&gui->testico, LCD_WIDTH-128, 0, &icons[ICON_CHANTEST], show_chantest_cb, NULL); GUI_CreateIcon(&gui->reorderico, LCD_WIDTH-96, 0, &icons[ICON_ORDER], reorder_cb, NULL); GUI_CreateScrollbar(&gui->scroll, LCD_WIDTH-16, 32, LCD_HEIGHT-32, mp->max_scroll+1, NULL, scroll_cb, NULL); GUI_SetScrollbar(&gui->scroll, page); }