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(); }
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); }
/* Advanced Standard Row1 Timer Timer Row2 Switch Switch Row3 Reset(perm)/ResetSwitch Reset(perm)/Start Row4 Start/Set-to Set-to */ static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; (void)relrow; u8 space = LINE_SPACE; //Row 1 GUI_CreateLabelBox(&gui->name, LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, timer_str_cb, NULL, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->type, TEXTSEL_X, y, TEXTSEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, NULL, set_timertype_cb, (void *)(long)absrow); //Row 2 y += space; GUI_CreateLabelBox(&gui->switchlbl, LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT,&DEFAULT_FONT, switch_str_cb, NULL, (void *)(long)absrow); GUI_CreateTextSourcePlate(&gui->src, TEXTSEL_X, y, TEXTSEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, toggle_source_cb, set_source_cb, set_input_source_cb, (void *)(long)absrow); //Row 3 y += space; /*prem-timer reset */ GUI_CreateLabelBox(&gui->resetpermlbl, LABEL_X, y , LABEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Reset")); GUI_CreateButtonPlateText(&gui->resetperm, RESET_X, y , RESET_WIDTH, LINE_HEIGHT,&DEFAULT_FONT, show_timerperm_cb, 0x0000, reset_timerperm_cb,(void *)(long)absrow); if(Model.mixer_mode != MIXER_STANDARD) { /* or Reset switch */ GUI_CreateLabelBox(&gui->resetlbl, LABEL_X, y , LABEL_WIDTH, LINE_HEIGHT,&DEFAULT_FONT, NULL, NULL, _tr("Reset sw")); GUI_CreateTextSourcePlate(&gui->resetsrc, TEXTSEL_X, y , TEXTSEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, toggle_resetsrc_cb, set_resetsrc_cb, set_input_rstsrc_cb, (void *)(long)absrow); y += space; } //Row 4 GUI_CreateLabelBox(&gui->startlbl, LABEL_X, y, START_WIDTH, // bug fix: label width and height can't be 0, otherwise, the label couldn't be hidden dynamically LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Start")); GUI_CreateTextSelectPlate(&gui->start, TEXTSEL_X, y, TEXTSEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT,NULL, set_start_cb, (void *)(long)absrow); // don't include this in Devo7e due to memory restrictions #if HAS_PERMANENT_TIMER if(Model.mixer_mode == MIXER_STANDARD) y+= space; GUI_CreateButtonPlateText(&gui->setperm, RESET_X, y, RESET_WIDTH, LINE_HEIGHT,&DEFAULT_FONT, show_timerperm_cb, 0x0000, reset_timerperm_cb,(void *)(long)(absrow | 0x80)); #endif update_countdown(absrow); int selectable = (Model.timer[absrow].type < TIMER_COUNTDOWN) ? 2 : 3; if (Model.mixer_mode == MIXER_ADVANCED) selectable++; #if HAS_PERMANENT_TIMER if (Model.timer[absrow].type == TIMER_PERMANENT) selectable = 4; #endif return selectable; }
static int row_cb(int absrow, int relrow, int y, void *data) { int num_elems = (long)data; int y_ts = y; //show elements in order int row = -1; #if HAS_LAYOUT_EDITOR if (absrow == num_elems + NUM_QUICKPAGES) { GUI_CreateTextSelectPlate(&gui->value[relrow], NEWTEXTSEL_X, y_ts, NEWTEXTSEL_W, LINE_HEIGHT, &TEXTSEL_FONT, NULL, newelem_cb, NULL); GUI_CreateButtonPlateText(&gui->col1[relrow].button, NEWBUTTON_X, y, NEWBUTTON_W, LINE_HEIGHT, &BUTTON_FONT, add_dlgbut_str_cb, newelem_press_cb, (void *)1); return 2; } #endif if (absrow >= num_elems + NUM_QUICKPAGES) { GUI_CreateButtonPlateText(&gui->col1[relrow].button, QPBUTTON_X, y, QPBUTTON_W, LINE_HEIGHT, &BUTTON_FONT, add_dlgbut_str_cb, add_dlgbut_cb, (void *)0); return 1; } if (absrow >= num_elems && absrow < num_elems + NUM_QUICKPAGES) { GUI_CreateLabelBox(&gui->col1[relrow].label, MENULABEL_X, y, MENULABEL_W, LINE_HEIGHT, &LABEL_FONT, menulabel_cb, NULL, (void *)(long)(absrow - num_elems)); GUI_CreateTextSelectPlate(&gui->value[relrow], MENUTEXT_X, y + LINE_HEIGHT * LINE_OFFSET, MENUTEXT_W, LINE_HEIGHT, &TEXTSEL_FONT, NULL, menusel_cb, (void *)(long)(absrow - num_elems)); return 1; } for(int type = 0; type < ELEM_LAST; type++) { if (type == ELEM_BIGBOX || type == ELEM_HTRIM) continue; long nxt = -1; long item = -1; while((nxt = MAINPAGE_FindNextElem(type, nxt+1)) >= 0) { item = nxt; row++; if(row == absrow) break; } if (nxt == -1) continue; int selectable = 1; if (type == ELEM_TOGGLE) { GUI_CreateButtonPlateText(&gui->col1[relrow].button, ELEMBUT_X, y, ELEMBUT_W, LINE_HEIGHT, &BUTTON_FONT, cfglabel_cb, switchicon_press_cb, (void *)item); selectable = 2; } else GUI_CreateLabelBox(&gui->col1[relrow].label, ELEMLBL_X, y, ELEMLBL_W, LINE_HEIGHT, &LABEL_FONT, cfglabel_cb, NULL, (void *)item); GUI_CreateTextSelectPlate(&gui->value[relrow], ELEMTXT_X, y_ts, ELEMTXT_W, LINE_HEIGHT, &TEXTSEL_FONT, (void(*)(guiObject_t *, void *))dlgbut_cb, dlgts1_cb, (void *)item); return selectable; } return 0; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; GUI_CreateLabelBox(&gui->idx[relrow], LABEL_X, y, LABEL_W, LINE_HEIGHT, &TINY_FONT, idx_cb, NULL, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->name[relrow], TEXTSEL1_X, y, TEXTSEL1_W, LINE_HEIGHT, &DEFAULT_FONT, NULL, telem_name_cb, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->gtlt[relrow], TEXTSEL2_X, y, TEXTSEL2_W, LINE_HEIGHT, &TINY_FONT, sound_test_cb, gtlt_cb, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->value[relrow], TEXTSEL3_X, y, TEXTSEL3_W, LINE_HEIGHT, &DEFAULT_FONT, NULL, limit_cb, (void *)(long)absrow); return 3; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; GUI_CreateLabelBox(&gui->label[relrow], LABEL_X, y, LABEL3_X + LABEL3_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, STDMIX_ModeName(absrow - PITTHROMODE_NORMAL)); y += LINE_SPACE; GUI_CreateTextSelectPlate(&gui->value1[relrow], LABEL_X, y, LABEL2_WIDTH, LINE_HEIGHT, &TINY_FONT, NULL, set_dr_cb, (void *)(long)(absrow - PITTHROMODE_NORMAL)); GUI_CreateTextSelectPlate(&gui->value2[relrow], LABEL_X + LABEL3_X, y, LABEL3_WIDTH, LINE_HEIGHT, &TINY_FONT, NULL, set_exp_cb, (void *)(long)(absrow - PITTHROMODE_NORMAL)); return 2; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; u8 w1 = 30; u8 w2 = 36; GUI_CreateLabelBox(&gui->label[relrow], 0, y, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, STDMIX_ModeName(absrow - PITTHROMODE_NORMAL)); y += ITEM_SPACE; GUI_CreateTextSelectPlate(&gui->value1[relrow], 0, y, w1, ITEM_HEIGHT, &TINY_FONT, NULL, set_dr_cb, (void *)(long)(absrow - PITTHROMODE_NORMAL)); GUI_CreateTextSelectPlate(&gui->value2[relrow], w1+1, y, w2, ITEM_HEIGHT, &DEFAULT_FONT, NULL, set_exp_cb, (void *)(long)(absrow - PITTHROMODE_NORMAL)); return 2; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; u8 w = 35; u8 x = 50; MIXER_GetLimit(absrow, &mp->limit); GUI_CreateLabelBox(&gui->chan[relrow], 0, y, 0, LINE_HEIGHT, &DEFAULT_FONT, STDMIX_channelname_cb, NULL, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->dn[relrow], x, y, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, traveldown_cb, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->up[relrow], x + w + 3, y, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, travelup_cb, (void *)(long)absrow); return 2; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; (void)relrow; u8 space = ITEM_HEIGHT + 1; u8 w = 65; u8 x = 55; //Row 1 GUI_CreateLabelBox(&gui->name, 0, y, 0, ITEM_HEIGHT, &DEFAULT_FONT, timer_str_cb, NULL, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->type, x, y, w, ITEM_HEIGHT, &DEFAULT_FONT, toggle_timertype_cb, set_timertype_cb, (void *)(long)absrow); //Row 2 y += space; GUI_CreateLabelBox(&gui->switchlbl, 0, y, 0, ITEM_HEIGHT,&DEFAULT_FONT, switch_str_cb, NULL, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->src, x, y, w, ITEM_HEIGHT, &DEFAULT_FONT, toggle_source_cb, set_source_cb, (void *)(long)absrow); //Row 3 y += space; if(Model.mixer_mode != MIXER_STANDARD) { GUI_CreateLabelBox(&gui->resetlbl, 0, y , 55, ITEM_HEIGHT,&DEFAULT_FONT, NULL, NULL, _tr("Reset sw")); GUI_CreateTextSelectPlate(&gui->resetsrc, x, y , w, ITEM_HEIGHT, &DEFAULT_FONT, toggle_resetsrc_cb, set_resetsrc_cb, (void *)(long)absrow); /* or Reset Perm timer*/ GUI_CreateLabelBox(&gui->resetpermlbl, 0, y , 55, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Reset")); GUI_CreateButtonPlateText(&gui->resetperm, x, y , 55, ITEM_HEIGHT,&DEFAULT_FONT, show_timerperm_cb, 0x0000, reset_timerperm_cb,(void *)(long)absrow); y += space; } else { GUI_CreateLabelBox(&gui->resetpermlbl, 0, y , 55, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Reset")); GUI_CreateButtonPlateText(&gui->resetperm, x, y , 55, ITEM_HEIGHT,&DEFAULT_FONT, show_timerperm_cb, 0x0000, reset_timerperm_cb,(void *)(long)absrow); } //Row 4 GUI_CreateLabelBox(&gui->startlbl, 0, y , 50, // bug fix: label width and height can't be 0, otherwise, the label couldn't be hidden dynamically ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Start")); GUI_CreateTextSelectPlate(&gui->start, x, y, w, ITEM_HEIGHT, &DEFAULT_FONT,NULL, set_start_cb, (void *)(long)absrow); update_countdown(absrow); return 4; }
void PAGE_EditCurvesInit(int page) { (void)page; struct Curve *curve = edit->curveptr; u8 type = CURVE_TYPE(curve); PAGE_SetActionCB(action_cb); edit->pointnum = 0; edit->reverse = MIXER_SRC_IS_INV(pagemem.u.mixer_page.cur_mixer->src); if ((type == CURVE_EXPO || type == CURVE_DEADBAND) && curve->points[0] == curve->points[1]) { edit->pointnum = -1; } edit->curve = *curve; GUI_CreateTextSelectPlate(&gui->name, NAME_X, 0, NAME_W, HEADER_HEIGHT, &TEXTSEL_FONT, NULL, set_curvename_cb, NULL); GUI_CreateButtonPlateText(&gui->save, SAVE_X, 0, SAVE_W, HEADER_WIDGET_HEIGHT, &BUTTON_FONT , NULL, okcancel_cb, (void *)_tr("Save")); // Draw a line if (UNDERLINE) GUI_CreateRect(&gui->rect, 0, HEADER_WIDGET_HEIGHT, LCD_WIDTH, 1, &DEFAULT_FONT); u8 space = LINE_SPACE; u8 y = space; if (type >= CURVE_3POINT) { GUI_CreateLabelBox(&gui->smoothlbl, LABEL_X, y, LABEL1_W, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("Smooth")); GUI_CreateTextSelectPlate(&gui->smooth, TEXTSEL1_X, y, TEXTSEL1_W, LINE_HEIGHT, &TEXTSEL_FONT, NULL, set_smooth_cb, NULL); y += space; GUI_CreateLabelBox(&gui->pointlbl, LABEL_X, y , LABEL2_W, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("Point")); GUI_CreateTextSelectPlate(&gui->point, TEXTSEL2_X, y, TEXTSEL2_W, LINE_HEIGHT, &TEXTSEL_FONT, NULL, set_pointnum_cb, NULL); } else if(type == CURVE_DEADBAND || type == CURVE_EXPO) { GUI_CreateLabelBox(&gui->pointlbl, LABEL_X, y , LABEL_W, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("Pos/Neg")); y += space; GUI_CreateTextSelectPlate(&gui->point, LABEL_X, y, LABEL_W, LINE_HEIGHT, &TEXTSEL_FONT, NULL, set_expopoint_cb, NULL); } y += space; GUI_CreateLabelBox(&gui->valuelbl, LABEL_X, y , LABEL_W, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("Value")); y += VALUE_Y_OFFSET; GUI_CreateTextSelectPlate(&gui->value, VALUE_X, y, LABEL_W, LINE_HEIGHT, &TEXTSEL_FONT, NULL, set_value_cb, NULL); GUI_CreateXYGraph(&gui->graph, GRAPH_X, GRAPH_Y, GRAPH_W, GRAPH_H, CHAN_MIN_VALUE, CHAN_MIN_VALUE, CHAN_MAX_VALUE, CHAN_MAX_VALUE, 0, 0, //CHAN_MAX_VALUE / 4, CHAN_MAX_VALUE / 4, show_curve_cb, NULL, touch_cb, &edit->curve); GUI_SetSelected((guiObject_t *)&gui->point); }
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) { (void)data; void * tgl = NULL; void * label_cb = NULL; const void * label = NULL; void * disp = NULL; void * value = NULL; switch(absrow) { case ITEM_REVERSE: label = _tr("Reverse"); tgl = toggle_reverse_cb; disp = reverse_cb; value = (void *)((long)mp->channel); break; case ITEM_FAILSAFE: label = _tr("Fail-safe"); tgl = toggle_failsafe_cb; disp = set_failsafe_cb; break; case ITEM_SAFETY: label = _tr("Safety"); tgl = sourceselect_cb; disp = set_source_cb; value = &mp->limit.safetysw; break; case ITEM_SAFEVAL: label = _tr("Safe Val"); disp = set_safeval_cb; break; case ITEM_MINLIMIT: label = _tr("Min Limit"); disp = set_limits_cb; value = &mp->limit.min; break; case ITEM_MAXLIMIT: label = _tr("Max Limit"); disp = set_limits_cb; value = &mp->limit.max; break; case ITEM_SCALEPOS: label_cb = scalestring_cb; label = (void *)1L; disp = set_limitsscale_cb; value = &mp->limit.servoscale; break; case ITEM_SCALENEG: label_cb = scalestring_cb; label = (void *)0L; disp = set_limitsscale_cb; value = &mp->limit.servoscale_neg; break; case ITEM_SUBTRIM: label = _tr("Subtrim"); disp = set_trimstep_cb; value = &mp->limit.subtrim; break; case ITEM_SPEED: label = _tr("Speed"); disp = set_limits_cb; value = &mp->limit.speed; break; } labelDesc.style = LABEL_LEFTCENTER; GUI_CreateLabelBox(&gui->label[relrow], 0, y, 60, LINE_HEIGHT, &labelDesc, label_cb, NULL, label); labelDesc.style = LABEL_CENTER; GUI_CreateTextSelectPlate(&gui->value[relrow], 60, y, 60, LINE_HEIGHT, &labelDesc, tgl, disp, value); if(absrow == ITEM_SAFEVAL) GUI_TextSelectEnable(&gui->value[relrow], mp->limit.safetysw); return 1; }
static int simple_row_cb(int absrow, int relrow, int y, void *data) { const char *label = NULL; void *tgl = NULL; void *value = NULL; data = NULL; switch(absrow) { case COMMON_SRC: label = _tr_noop("Src"); tgl = sourceselect_cb; value = set_source_cb; data = &mp->mixer[0].src; break; case COMMON_CURVE: label = _tr_noop("Curve"); tgl = curveselect_cb; value = set_curvename_cb; data = &mp->mixer[0]; break; case COMMON_SCALE: label = _tr_noop("Scale"); value = set_number100_cb; data = &mp->mixer[0].scalar; break; case SIMPLE_OFFSET: label = _tr_noop("Offset"); value = set_number100_cb; data = &mp->mixer[0].offset; break; } int x = 0; u8 w = LEFT_VIEW_WIDTH; labelDesc.style = LABEL_LEFTCENTER; GUI_CreateLabelBox(&gui->label[relrow], x, y, w, ITEM_HEIGHT, &labelDesc, NULL, NULL, _tr(label)); labelDesc.style = LABEL_CENTER; GUI_CreateTextSelectPlate(&gui->value[relrow].ts, x, y + ITEM_HEIGHT + 1, w, ITEM_HEIGHT, &labelDesc, tgl, value, data); return 1; }
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(); }
static int complex_row_cb(int absrow, int relrow, int y, void *data) { const char *label = NULL; void *tgl = NULL; void *value = NULL; data = NULL; int x = 0; int w = LEFT_VIEW_WIDTH; if (absrow + COMMON_LAST == COMPLEX_TRIM) { GUI_CreateButtonPlateText(&gui->value[relrow].but, x, y, w, ITEM_HEIGHT, &labelDesc, show_trim_cb, 0x0000, toggle_trim_cb, NULL); if (! MIXER_SourceHasTrim(MIXER_SRC(mp->mixer[0].src))) GUI_SetHidden((guiObject_t *)&gui->label[relrow], 1); return 1; } switch(absrow + COMMON_LAST) { case COMPLEX_MIXER: label = _tr_noop("Mixers"); value = set_nummixers_cb; break; case COMPLEX_PAGE: label = _tr_noop("Page"); tgl = reorder_cb; value = set_mixernum_cb; break; case COMPLEX_SWITCH: label = _tr_noop("Switch"); tgl = sourceselect_cb; value = set_drsource_cb; data = &mp->cur_mixer->sw; break; case COMPLEX_MUX: label = _tr_noop("Mux"); value = set_mux_cb; break; case COMPLEX_SRC: label = _tr_noop("Src"); tgl = sourceselect_cb; value = set_source_cb; data = &mp->cur_mixer->src; break; case COMPLEX_CURVE: label = _tr_noop("Curve"); tgl = curveselect_cb; value = set_curvename_cb; data = mp->cur_mixer; break; case COMPLEX_SCALE: label = _tr_noop("Scale"); value = set_number100_cb; data = &mp->cur_mixer->scalar; break; case COMPLEX_OFFSET: label = _tr_noop("Offset"); value = set_number100_cb; data = &mp->cur_mixer->offset; break; } labelDesc.style = LABEL_LEFTCENTER; GUI_CreateLabelBox(&gui->label[relrow], x, y, w, ITEM_HEIGHT, &labelDesc, NULL, NULL, _tr(label)); labelDesc.style = LABEL_CENTER; GUI_CreateTextSelectPlate(&gui->value[relrow].ts, x, y + ITEM_HEIGHT + 1, w, ITEM_HEIGHT, &labelDesc, tgl, value, data); if (absrow + COMMON_LAST == COMPLEX_SRC) set_src_enable(CURVE_TYPE(&mp->cur_mixer->curve)); return 1; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; GUI_CreateLabelBox(&gui->name[relrow], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, label_cb, NULL, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->value[relrow], FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, switch_cb, (void *)(long)absrow); return 1; }
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); }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; int x = 9; u8 w1 = 44; u8 w2 = 21; u8 w3 = 40; GUI_CreateLabelBox(&gui->idx[relrow], 0, y, 9, ITEM_HEIGHT, &TINY_FONT, idx_cb, NULL, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->name[relrow], x, y, w1, ITEM_HEIGHT, &DEFAULT_FONT, NULL, telem_name_cb, (void *)(long)absrow); x += w1 + 5; GUI_CreateTextSelectPlate(&gui->gtlt[relrow], x, y, w2, ITEM_HEIGHT, &TINY_FONT, NULL, gtlt_cb, (void *)(long)absrow); x += w2 + 3; GUI_CreateTextSelectPlate(&gui->value[relrow], x, y, w3, ITEM_HEIGHT, &DEFAULT_FONT, NULL, limit_cb, (void *)(long)absrow); return 3; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; u8 w = 46; u8 x = 77; GUI_CreateLabelBox(&gui->name[relrow], 0, y, 0, ITEM_HEIGHT, &DEFAULT_FONT, label_cb, NULL, (void *)(long)absrow); GUI_CreateTextSelectPlate(&gui->value[relrow], x, y, w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, switch_cb, (void *)(long)absrow); return 1; }
void PAGE_GyroSenseInit(int page) { (void)page; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); memset(mp, 0, sizeof(*mp)); int expected = INPUT_NumSwitchPos(mapped_std_channels.switches[SWITCHFUNC_GYROSENSE]); int count = STDMIX_GetMixers(mp->mixer_ptr, mapped_std_channels.aux2, GYROMIXER_COUNT); if (! count) { count = STDMIX_GetMixers(mp->mixer_ptr, mapped_std_channels.gear, GYROMIXER_COUNT); } if (count != expected) { GUI_CreateLabelBox(&gui->msg, 0, 10, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, "Invalid model ini!");// must be invalid model ini return; } gyro_output = mp->mixer_ptr[0]->dest; convert_output_to_percentile(); PAGE_ShowHeader(_tr("Gyro sense")); u8 w = 65; u8 x = 63; u8 row = LINE_SPACE; GUI_CreateLabelBox(&gui->chanlbl, 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Channel")); GUI_CreateTextSelectPlate(&gui->chan, x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, gyro_output_cb, NULL); row += LINE_SPACE; w = 40; GUI_CreateLabelBox(&gui->gyrolbl[0], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, label_cb, NULL, (void *)(long)0); GUI_CreateTextSelectPlate(&gui->gyro[0], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, gyro_val_cb, (void *)0); row += LINE_SPACE; GUI_CreateLabelBox(&gui->gyrolbl[1], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, label_cb, NULL, (void *)(long)1); GUI_CreateTextSelectPlate(&gui->gyro[1], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, gyro_val_cb, (void *)1); if(INPUT_NumSwitchPos(mapped_std_channels.switches[SWITCHFUNC_GYROSENSE]) == 3) { row += LINE_SPACE; GUI_CreateLabelBox(&gui->gyrolbl[2], 0, row, 0, LINE_HEIGHT, &DEFAULT_FONT, label_cb, NULL, (void *)(long)2); GUI_CreateTextSelectPlate(&gui->gyro[2], x, row, w, LINE_HEIGHT, &DEFAULT_FONT, NULL, gyro_val_cb, (void *)2); } GUI_Select1stSelectableObj(); }
void PAGE_ThroHoldInit(int page) { (void)page; PAGE_SetModal(0); PAGE_RemoveAllObjects(); PAGE_ShowHeader(_tr("Throttle hold")); u8 y = HEADER_HEIGHT + HEADER_OFFSET; GUI_CreateLabelBox(&gui->enlbl, LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("Thr hold")); GUI_CreateTextSelectPlate(&gui->en, FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, throhold_cb, NULL); y += LINE_SPACE; GUI_CreateLabelBox(&gui->valuelbl, LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("Hold position")); GUI_CreateTextSelectPlate(&gui->value, FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, holdpostion_cb, NULL); GUI_Select1stSelectableObj(); }
guiObject_t *GUI_CreateTextSourcePlate(guiTextSelect_t *select, u16 x, u16 y, u16 width, u16 height, const struct LabelDesc *desc, void (*select_cb)(guiObject_t *obj, void *data), const char *(*value_cb)(guiObject_t *obj, int value, void *data), const char *(*input_value_cb)(guiObject_t *obj, int src, int value, void *data), void *cb_data) { GUI_CreateTextSelectPlate(select, x, y, width, height, desc, select_cb, value_cb, cb_data); select->InputValueCB = input_value_cb; return (guiObject_t *)select; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; struct Trim *trim = MIXER_GetAllTrims(); GUI_CreateButtonPlateText(&gui->src[relrow], BUTTON_X, y, BUTTON_WIDTH, LINE_HEIGHT, &BUTTON_FONT, trimsource_name_cb, edit_trim_cb, (void *)((long)absrow)); GUI_CreateTextSelectPlate(&gui->item[relrow], TEXTSEL_X, y, TEXTSEL_WIDTH, LINE_HEIGHT, &TINY_FONT, NULL, set_trimstep_cb, (void *)(long)(absrow + 0x000)); //0x000: Use Model.trims GUI_CreateLabelBox(&gui->name[relrow], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &TINY_FONT, GUI_Localize, NULL, (void *)INPUT_ButtonName(trim[absrow].pos)); return 2; }
static int row_cb(int absrow, int relrow, int y, void *data) { (void)data; u8 w = 30; struct Trim *trim = MIXER_GetAllTrims(); GUI_CreateButtonPlateText(&gui->src[relrow], 0, y, w, ITEM_HEIGHT, &DEFAULT_FONT, trimsource_name_cb, 0x0000, _edit_cb, (void *)((long)absrow)); GUI_CreateTextSelectPlate(&gui->item[relrow], 32, y, 40, ITEM_HEIGHT, &TINY_FONT, NULL, set_trimstep_cb, (void *)(long)(absrow+0x000)); //0x000: Use Model.trims GUI_CreateLabelBox(&gui->name[relrow], 75, y, 50, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, (void *)INPUT_ButtonName(trim[absrow].pos)); return 1; }
void PAGE_ThroHoldInit(int page) { if (page < 0 && current_selected > 0) // enter this page from childen page , so we need to get its previous mp->current_selected item page = current_selected; PAGE_SetActionCB(_action_cb); PAGE_SetModal(0); PAGE_RemoveAllObjects(); current_selected = 0; PAGE_ShowHeader(_tr("Throttle hold")); u8 y = ITEM_SPACE; GUI_CreateLabelBox(&gui->enlbl, 0, y, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Thr hold")); u8 w = 40; GUI_CreateTextSelectPlate(&gui->en, 75, y, w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, throhold_cb, NULL); y += ITEM_SPACE; GUI_CreateLabelBox(&gui->valuelbl, 0, y, 0, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr("Hold position")); GUI_CreateTextSelectPlate(&gui->value, 75, y, w, ITEM_HEIGHT, &DEFAULT_FONT, NULL, holdpostion_cb, NULL); GUI_Select1stSelectableObj(); }
static void _show_list(int loadsave,u8 num_models) { if (loadsave == LOAD_ICON) { mp->modeltype = Model.type; guiObject_t *obj = GUI_CreateTextSelectPlate(&gui->ico, 10, ITEM_HEIGHT + 1, LCD_WIDTH - 20, ITEM_HEIGHT, &DEFAULT_FONT, iconpress_cb, iconstr_cb, (void *)(long)num_models); GUI_CreateImage(&gui->image, LCD_WIDTH / 2 - 18, LCD_HEIGHT-37, 52, 36, mp->iconstr); GUI_SetSelected(obj); } else { OBJ_SET_USED(&gui->image, 0); guiObject_t *obj = GUI_CreateListBoxPlateText(&gui->listbox, 0, ITEM_HEIGHT + 1, LCD_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1, num_models, mp->selected-1, &DEFAULT_FONT, LISTBOX_KEY_UPDOWN, // change listbox's browser key to up/down since there is only 1 widget in this page string_cb, select_cb, _press_cb, (void *)(long)loadsave); GUI_SetSelected(obj); } }
void PAGE_SwashInit(int page) { (void)page; PAGE_SetModal(0); PAGE_RemoveAllObjects(); get_swash(); PAGE_ShowHeaderWithSize(_tr("SwashType"), LABEL_WIDTH, HEADER_HEIGHT); GUI_CreateTextSelectPlate(&gui->type, FIELD_X, 0, FIELD_WIDTH, HEADER_WIDGET_HEIGHT, &TEXTSEL_FONT, NULL, swash_val_cb, NULL); // FIXME: need a special value for header button/textsels u8 y = HEADER_HEIGHT + 1; GUI_CreateLabelBox(&gui->lbl[0], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("ELE Mix")); GUI_CreateTextSelectPlate(&gui->mix[0], FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, swashmix_val_cb, (void *)1); y += LINE_SPACE; GUI_CreateLabelBox(&gui->lbl[1], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("AIL Mix")); GUI_CreateTextSelectPlate(&gui->mix[1], FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, swashmix_val_cb, (void *)0); y += LINE_SPACE; GUI_CreateLabelBox(&gui->lbl[2], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &LABEL_FONT, NULL, NULL, _tr("PIT Mix")); GUI_CreateTextSelectPlate(&gui->mix[2], FIELD_X, y, FIELD_WIDTH, LINE_HEIGHT, &TEXTSEL_FONT, NULL, swashmix_val_cb, (void *)2); update_swashmixes(); GUI_Select1stSelectableObj(); }
static int row2_cb(int absrow, int relrow, int y, void *data) { (void)data; int idx = 0; int pos = 0; while(idx < absrow) { while(proto_strs[++pos]) ; pos++; idx++; } GUI_CreateLabelBox(&gui->label[relrow], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr(proto_strs[pos])); GUI_CreateTextSelectPlate(&gui->value[relrow], SELECT_X, y, SELECT_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, NULL, proto_opt_cb, (void *)(long)absrow); return 1; }
static void _show_titlerow() { PAGE_SetActionCB(action_cb); mp->entries_per_page = 2; memset(gui, 0, sizeof(*gui)); labelDesc.style = LABEL_UNDERLINE; labelDesc.font_color = labelDesc.fill_color = labelDesc.outline_color = 0xffff; GUI_CreateLabelBox(&gui->chan, 0, 0 , LCD_WIDTH, ITEM_HEIGHT, &labelDesc, MIXPAGE_ChanNameProtoCB, NULL, (void *)((long)mp->cur_mixer->dest)); u8 x =40; u8 w = 50; labelDesc.style = LABEL_CENTER; GUI_CreateTextSelectPlate(&gui->tmpl, x, 0, w, ITEM_HEIGHT, &labelDesc, NULL, templatetype_cb, (void *)((long)mp->channel)); w = 38; GUI_CreateButtonPlateText(&gui->save, LCD_WIDTH - w, 0, w, ITEM_HEIGHT, &labelDesc, NULL, 0, okcancel_cb, (void *)_tr("Save")); }
static int row_cb(int absrow, int relrow, int y, void *data) { const void *label = NULL; void *value = NULL; void *tgl = NULL; switch(absrow) { case ITEM_SWASHTYPE: label = _tr("SwashType"); value = swash_val_cb; break; case ITEM_ELEINV: label = _tr("ELE Inv"); tgl = swashinv_press_cb; value = swashinv_val_cb; data = (void *)1L; break; case ITEM_AILINV: label = _tr("AIL Inv"); tgl = swashinv_press_cb; value = swashinv_val_cb; data = (void *)2L; break; case ITEM_COLINV: label = _tr("COL Inv"); tgl = swashinv_press_cb; value = swashinv_val_cb; data = (void *)4L; break; case ITEM_ELEMIX: label = _tr("ELE Mix"); value = swashmix_val_cb; data = (void *)1L; break; case ITEM_AILMIX: label = _tr("AIL Mix"); value = swashmix_val_cb; data = (void *)0L; break; case ITEM_COLMIX: label = _tr("COL Mix"); value = swashmix_val_cb; data = (void *)2L; break; } GUI_CreateLabelBox(&gui->label[relrow], LABEL_X, y, LABEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, label); GUI_CreateTextSelectPlate(&gui->value[relrow], SELECT_X, y, SELECT_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, tgl, value, data); return 1; }