コード例 #1
0
ファイル: swash_page.c プロジェクト: nongxiaoming/STM32F4_Tx
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();
}
コード例 #2
0
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);
}
コード例 #3
0
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);
    }
}
コード例 #4
0
ファイル: lang_select.c プロジェクト: Chen-Leon/DeviationX
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));
}
コード例 #5
0
ファイル: drexp_page.c プロジェクト: TheSFReader/deviation
void PAGE_DrExpInit(int page)
{
    (void)page;
    enum {
        COL3 = (4 + ((LCD_WIDTH - 320) / 2)),
        COL4 = (112 + ((LCD_WIDTH - 320) / 2)),
        COL5 = (216 + ((LCD_WIDTH - 320) / 2)),
        COL1 = COL4,
        COL2 = (COL1 + 32),
        ROW1 = (36 + ((LCD_HEIGHT - 240) / 2)),
        ROW2 = (ROW1 + 20),
        ROW3 = (ROW1 + 40),
        ROW4 = (ROW1 + 60),
        ROW5 = (ROW1 + 80),
    };
    PAGE_ShowHeader_ExitOnly(PAGE_GetName(PAGEID_DREXP), MODELMENU_Show);
    PAGE_ShowHeader_ExitOnly(NULL, MODELMENU_Show);
    PAGE_ShowHeader_SetLabel(STDMIX_TitleString, SET_TITLE_DATA(PAGEID_DREXP, SWITCHFUNC_DREXP_AIL+drexp_type));
    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->msg, 0, 120, 240, 16, &NARROW_FONT, NULL, NULL, "Invalid model ini!");// must be invalid model ini
        return;
    }
    /* Row 1 */
    GUI_CreateLabelBox(&gui->srclbl, COL1, ROW1, 96, 16, &DEFAULT_FONT, NULL, NULL, _tr("Src"));
    GUI_CreateTextSelect(&gui->src, COL2, ROW1, TEXTSELECT_64, NULL, set_type_cb, NULL);
    /* Row 2 */
    GUI_CreateLabelBox(&gui->mode[0], COL3, ROW2, 96, 16, &DEFAULT_FONT, NULL, NULL, STDMIX_ModeName(PITTHROMODE_NORMAL));
    GUI_CreateLabelBox(&gui->mode[1], COL4, ROW2, 96, 16, &DEFAULT_FONT, NULL, NULL, STDMIX_ModeName(PITTHROMODE_IDLE1));
    GUI_CreateLabelBox(&gui->mode[2], COL5, ROW2, 96, 16, &DEFAULT_FONT, NULL, NULL, STDMIX_ModeName(PITTHROMODE_IDLE2));
    /* Row 3 */
    GUI_CreateTextSelect(&gui->dr[0], COL3, ROW3, TEXTSELECT_96, NULL, set_dr_cb, ((void *)(long)PITTHROMODE_NORMAL));
    GUI_CreateTextSelect(&gui->dr[1], COL4, ROW3, TEXTSELECT_96, NULL, set_dr_cb, ((void *)(long)PITTHROMODE_IDLE1));
    GUI_CreateTextSelect(&gui->dr[2], COL5, ROW3, TEXTSELECT_96, NULL, set_dr_cb, ((void *)(long)PITTHROMODE_IDLE2));
    /* Row 4 */
    GUI_CreateTextSelect(&gui->exp[0], COL3, ROW4, TEXTSELECT_96, NULL, set_exp_cb, ((void *)(long)PITTHROMODE_NORMAL));
    GUI_CreateTextSelect(&gui->exp[1], COL4, ROW4, TEXTSELECT_96, NULL, set_exp_cb, ((void *)(long)PITTHROMODE_IDLE1));
    GUI_CreateTextSelect(&gui->exp[2], COL5, ROW4, TEXTSELECT_96, NULL, set_exp_cb, ((void *)(long)PITTHROMODE_IDLE2));
    /* Row 5 */
    u16 ymax = CHAN_MAX_VALUE/100 * MAX_SCALAR;
    s16 ymin = -ymax;
    GUI_CreateXYGraph(&gui->graph[0], COL3, ROW5, 96, 120,
                              CHAN_MIN_VALUE, ymin,
                              CHAN_MAX_VALUE, ymax,
                              0, 0, show_curve_cb, curpos_cb, NULL, (void *)(PITTHROMODE_NORMAL+1L));
    GUI_CreateXYGraph(&gui->graph[1], COL4, ROW5, 96, 120,
                              CHAN_MIN_VALUE, ymin,
                              CHAN_MAX_VALUE, ymax,
                              0, 0, show_curve_cb, curpos_cb, NULL, (void *)(PITTHROMODE_IDLE1+1L));
    GUI_CreateXYGraph(&gui->graph[2], COL5, ROW5, 96, 120,
                              CHAN_MIN_VALUE, ymin,
                              CHAN_MAX_VALUE, ymax,
                              0, 0, show_curve_cb, curpos_cb, NULL, (void *)(PITTHROMODE_IDLE2+1L));
    _refresh_page();
}
コード例 #6
0
ファイル: tx_configure.c プロジェクト: caoqing32/deviation
static void calibrate_touch(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_SetModal(1);
            PAGE_ShowHeader_ExitOnly(_tr("Touch Test"), okcancel_cb);
            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);
            }
        }
    }
}
コード例 #7
0
ファイル: timer_page.c プロジェクト: Chen-Leon/DeviationX
/*            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;
 }
コード例 #8
0
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;
}
コード例 #9
0
ファイル: toggle_select.c プロジェクト: silpstream/deviation
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);
}
コード例 #10
0
ファイル: tx_configure.c プロジェクト: DeviationTX/deviation
void PAGE_TouchInit(int page)
{
    (void)page;
    //PAGE_ShowHeader_ExitOnly("Touch Calibrate", okcancel_cb); //Can't do this while calibrating
    GUI_CreateLabelBox(&guic->title, 40, 10, LCD_WIDTH - 40, 14, &TITLE_FONT, GUI_Localize, NULL, _tr_noop("Touch Calibrate"));
    GUI_CreateLabelBox(&guic->msg, XCOORD - 5, YCOORD + 32 - 5, 11, 11, &SMALLBOX_FONT, NULL, NULL, "");
    GUI_CreateLabelBox(&guic->msg1, (LCD_WIDTH - 100) /2, (LCD_HEIGHT - 20)/2, 100, 20, &NARROW_FONT, show_msg_cb, NULL, NULL);
    memset(&cp->coords, 0, sizeof(cp->coords));
    SPITouch_Calibrate(0x10000, 0x10000, 0, 0);
    cp->state = 0;
}
コード例 #11
0
ファイル: chantest_page.c プロジェクト: F-D-R/deviation
static int row_cb(int absrow, int relrow, int y, void *data)
{
    (void)relrow;
    (void)y;
    (void)data;
    cur_row = absrow;
    int i;
    u8 height;
    u8 count;
    int num_bars = cp->num_bars;
    int num_rows = 1;
    int row_len;

    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;
        row_len = NUM_BARS_PER_ROW;
    } else {
        row_len = NUM_BARS_PER_ROW + 1;
    }


    if (num_bars > row_len) {
        height = 70 + (LCD_HEIGHT - 240) / 2;
        count = (num_bars + 1) / 2;
    } else {
        height = 155 + (LCD_HEIGHT - 240);
        count = num_bars;
    }
    u16 offset = (LCD_WIDTH + (SEPARATION - 10) - SEPARATION * ((num_rows > 2 ? 1 : 0) + count)) / 2;
    memset(cp->pctvalue, 0, sizeof(cp->pctvalue));
    for(i = 0; i < count; i++) {
        GUI_CreateLabelBox(&gui->chan[i], offset + SEPARATION * i - (SEPARATION - 10)/2, 32,
                                      SEPARATION, 19, &TINY_FONT, channum_cb, NULL, (void *)(long)i);
        GUI_CreateBarGraph(&gui->bar[i], offset + SEPARATION * i, 52, 10, height,
                                    -100, 100, BAR_VERTICAL,
                                    showchan_cb, (void *)(long)i);
        GUI_CreateLabelBox(&gui->value[i], offset + SEPARATION * i - (SEPARATION - 10)/2, 53 + height,
                                      SEPARATION, 10, &TINY_FONT, value_cb, NULL, (void *)(long)i);
    }
    offset = (LCD_WIDTH + (SEPARATION - 10) - SEPARATION * ((num_rows > 2 ? 1 : 0) + (num_bars - count))) / 2;
    for(i = count; i < num_bars; i++) {
        GUI_CreateLabelBox(&gui->chan[i], offset + SEPARATION * (i - count) - (SEPARATION - 10)/2, 210 + (LCD_HEIGHT - 240) - height,
                                      SEPARATION, 19, &TINY_FONT, channum_cb, NULL, (void *)(long)i);
        GUI_CreateBarGraph(&gui->bar[i], offset + SEPARATION * (i - count), 230 + (LCD_HEIGHT - 240) - height, 10, height,
                                    -100, 100, BAR_VERTICAL,
                                    showchan_cb, (void *)(long)i);
        GUI_CreateLabelBox(&gui->value[i], offset + SEPARATION * (i - count) - (SEPARATION - 10)/2, 230 + (LCD_HEIGHT - 240),
                                      SEPARATION, 10, &TINY_FONT, value_cb, NULL, (void *)(long)i);
    }
    return 0;
}
コード例 #12
0
ファイル: trim_page.c プロジェクト: DeviationTX/deviation
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, &current_selected);
}
コード例 #13
0
ファイル: chantest_page.c プロジェクト: caoqing32/deviation
static void draw_chan(long ch, int row, int y)
{
    int x = ch%2 ? 13 : 0;
    int idx = ch%2 ? 2*row + 1 : 2*row;
    int x_tra = cp->type == MONITOR_RAWINPUT ? 7 : 2;
   
    GUI_CreateLabelBox(&gui->chan[idx], x, y,
        0, 0, &labelDesc, _channum_cb, NULL, (void *)ch);
    GUI_CreateLabelBox(&gui->value[idx], x+x_tra, y,
        0, 0, &MICRO_FONT, value_cb, NULL, (void *)ch);
}
コード例 #14
0
ファイル: about_page.c プロジェクト: caoqing32/deviation
void PAGE_AboutInit(int page)
{
    (void)page;
    PAGE_RemoveAllObjects();
    PAGE_ShowHeader(PAGE_GetName(PAGEID_ABOUT));
    PAGE_SetActionCB(_action_cb);

    strcpy(up->tmpstr, (const char *) _tr("Deviation FW version:"));
    GUI_CreateLabelBox(&gui->label[0], 0, 15, LCD_WIDTH, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, "www.deviationtx.com");
    GUI_CreateLabelBox(&gui->label[1], 0, 30, LCD_WIDTH, ITEM_HEIGHT, &DEFAULT_FONT, NULL, NULL, up->tmpstr);
    GUI_CreateLabelBox(&gui->label[2], 0, 45, LCD_WIDTH, ITEM_HEIGHT, &MICRO_FONT, NULL, NULL, _tr_noop(DeviationVersion));
}
コード例 #15
0
ファイル: lang_select.c プロジェクト: DeviationTX/deviation
static int row_cb(int absrow, int relrow, int y, void *data)
{
    int row_count = (long)data;
    if (absrow >= row_count) {
        GUI_CreateLabelBox(&gui->label[relrow], LCD_WIDTH/2-100, y,
                200 - ARROW_WIDTH, LINE_HEIGHT, &LISTBOX_FONT, NULL, NULL, "");
    } else {
        GUI_CreateLabelBox(&gui->label[relrow], LCD_WIDTH/2-100, y,
                200 - ARROW_WIDTH, LINE_HEIGHT, &LISTBOX_FONT, string_cb, press_cb, (void *)(long)absrow);
    }
    return 1;
}
コード例 #16
0
ファイル: tx_configure.c プロジェクト: caoqing32/deviation
static void init_touch_calib()
{
    PAGE_RemoveAllObjects();
    PAGE_SetModal(1);
    //PAGE_ShowHeader_ExitOnly("Touch Calibrate", okcancel_cb); //Can't do this while calibrating
    GUI_CreateLabel(&guic->title, 40, 10, NULL, TITLE_FONT, _tr("Touch Calibrate"));
    GUI_CreateLabelBox(&guic->msg, XCOORD - 5, YCOORD + 32 - 5, 11, 11, &SMALLBOX_FONT, NULL, NULL, "");
    GUI_CreateLabelBox(&guic->msg1, (LCD_WIDTH - 100) /2, (LCD_HEIGHT - 20)/2, 100, 20, &NARROW_FONT, show_msg_cb, NULL, NULL);
    memset(&cp->coords, 0, sizeof(cp->coords));
    SPITouch_Calibrate(0x10000, 0x10000, 0, 0);
    cp->state = 0;
}
コード例 #17
0
ファイル: chantest_page.c プロジェクト: caoqing32/deviation
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);
}
コード例 #18
0
ファイル: splash_page.c プロジェクト: theseankelly/deviation
void PAGE_SplashInit(int page)
{
    (void)page;

    if(Transmitter.splash_delay == 0) {
        PAGE_ChangeByID(PAGEID_MAIN, 0);
        return;
    }
    PAGE_RemoveAllObjects();
    PAGE_SetActionCB(_action_cb);

    GUI_CreateLabelBox(&gui->splash_text, 3*ITEM_SPACE, 4*LINE_HEIGHT, 0, 0, &MODELNAME_FONT, NULL, NULL, _tr("Deviation"));
    GUI_CreateLabelBox(&gui->version, 0, 7*LINE_HEIGHT, 0, 0, &DEFAULT_FONT, NULL, NULL, DeviationVersion);
}
コード例 #19
0
ファイル: trim_page.c プロジェクト: supermk2/Deviation
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));

}
コード例 #20
0
ファイル: traveladj_page.c プロジェクト: Chen-Leon/DeviationX
void PAGE_TravelAdjInit(int page)
{
    (void)page;
    struct mixer_page * mp = &pagemem.u.mixer_page;
    PAGE_ShowHeader(PAGE_GetName(PAGEID_TRAVELADJ));
    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);
    GUI_CreateLabelBox(&gui->dnlbl, 90 + ((LCD_WIDTH - 320) / 2), 36 + ((LCD_HEIGHT - 240) / 2),  96, 16, &NARROW_FONT, NULL, NULL, _tr("Down"));
    GUI_CreateLabelBox(&gui->uplbl, 196 + ((LCD_WIDTH - 320) / 2), 36 + ((LCD_HEIGHT - 240) / 2),  96, 16, &NARROW_FONT, NULL, NULL, _tr("Up"));
    show_page(page);
}
コード例 #21
0
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, &current_selected);
}
コード例 #22
0
ファイル: mixer_limits.c プロジェクト: DeviationTX/deviation
static void _show_limits()
{
    enum {
        COL1 = (8 + ((LCD_WIDTH - 320) / 2)),
        COL2 = (COL1 + 120),
        ROW1 = (40 + ((LCD_HEIGHT - 240) / 2)),
        LABEL_WIDTH = (COL2 - COL1),
    };
    int y = ROW1;
    int height = 20;
    //Row 1
    GUI_CreateLabelBox(&gui->reverselbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Reverse"));
    GUI_CreateTextSelect(&gui->reverse, COL2, y, TEXTSELECT_96, toggle_reverse_cb, reverse_cb, (void *)((long)mp->channel));
    y += height;
    //Row 2
    GUI_CreateLabelBox(&gui->failsafelbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Fail-safe"));
    GUI_CreateTextSelect(&gui->failsafe, COL2, y, TEXTSELECT_96, toggle_failsafe_cb, set_failsafe_cb, NULL);
    y += height;
    //Row 3
    GUI_CreateLabelBox(&gui->safetylbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Safety"));
    GUI_CreateTextSource(&gui->safety, COL2, y, TEXTSELECT_96, sourceselect_cb, set_source_cb, set_input_source_cb, &mp->limit->safetysw);
    y += height;
    //Row 4
    GUI_CreateLabelBox(&gui->safevallbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Safe Val"));
    GUI_CreateTextSelect(&gui->safeval, COL2, y, TEXTSELECT_96, NULL, set_safeval_cb, NULL);
    y += height;
    //Row 5
    GUI_CreateLabelBox(&gui->minlbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Min Limit"));
    GUI_CreateTextSelect(&gui->min, COL2, y, TEXTSELECT_96, NULL, set_limits_cb, &mp->limit->min);
    y += height;
    //Row 6
    GUI_CreateLabelBox(&gui->maxlbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Max Limit"));
    GUI_CreateTextSelect(&gui->max, COL2, y, TEXTSELECT_96, NULL, set_limits_cb, &mp->limit->max);
    y += height;
    //Row 5
    GUI_CreateLabelBox(&gui->scaleneglbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, scalestring_cb, NULL, (void *)0L);
    GUI_CreateTextSelect(&gui->scaleneg, COL2, y, TEXTSELECT_96, NULL, set_limitsscale_cb, &mp->limit->servoscale_neg);
    y += height;
    GUI_CreateLabelBox(&gui->scalelbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, scalestring_cb, NULL, (void *)1L);
    GUI_CreateTextSelect(&gui->scale, COL2, y, TEXTSELECT_96, NULL, set_limitsscale_cb, &mp->limit->servoscale);
    y += height;
    //Row 6
    GUI_CreateLabelBox(&gui->subtrimlbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Subtrim"));
    GUI_CreateTextSelect(&gui->subtrim, COL2, y, TEXTSELECT_96, NULL, set_trimstep_cb, &mp->limit->subtrim);
    y += height;
    //Row 7
    GUI_CreateLabelBox(&gui->speedlbl, COL1, y, LABEL_WIDTH, 0, &LABEL_FONT, GUI_Localize, NULL, _tr_noop("Speed"));
    GUI_CreateTextSelect(&gui->speed, COL2, y, TEXTSELECT_96, NULL, set_limits_cb, &mp->limit->speed);
}
コード例 #23
0
ファイル: mixer_curves.c プロジェクト: F-D-R/deviation
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);
}
コード例 #24
0
ファイル: reverse_page.c プロジェクト: DeviationTX/deviation
static void show_page(int page)
{
    enum {
        COL1 = (30 + ((LCD_WIDTH - 320) / 2)),
        COL2 = (150 + ((LCD_WIDTH - 320) / 2)),
        LABEL_WIDTH = (COL2 - COL1),
        ROW1 = (40 + ((LCD_HEIGHT - 240) / 2)),
        ROW_HEIGHT = 24,
    };
    struct mixer_page * mp = &pagemem.u.mixer_page;
    if (mp->firstObj) {
        GUI_RemoveHierObjects(mp->firstObj);
        FullRedraw = REDRAW_ONLY_DIRTY;
        mp->firstObj = NULL;
        GUI_DrawBackground(0, 32, LCD_WIDTH - 16, LCD_HEIGHT - 32);
    }
    for (long i = 0; i < ENTRIES_PER_PAGE; i++) {
        int row = ROW1 + ROW_HEIGHT * i;
        long ch = page  + i;
        if (ch >= Model.num_channels)
            break;
        guiObject_t *obj = GUI_CreateLabelBox(&gui->name[i], COL1, row, LABEL_WIDTH, 16, &LABEL_FONT, STDMIX_channelname_cb, NULL, (void *)(ch));
        if (! mp->firstObj)
            mp->firstObj = obj;
        GUI_CreateTextSelect(&gui->value[i], COL2, row, TEXTSELECT_128, toggle_reverse_cb, reverse_cb, (void *)(ch));
    }
}
コード例 #25
0
ファイル: lang_select.c プロジェクト: Chen-Leon/DeviationX
static int row_cb(int absrow, int relrow, int y, void *data)
{
    (void)data;
    GUI_CreateLabelBox(&gui->label[relrow], 0, y,
            0, ITEM_HEIGHT, &DEFAULT_FONT, string_cb, press_cb, (void *)(long)absrow);
    return 1;
}
コード例 #26
0
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,
                       &DEFAULT_FONT, list_cb, NULL, (void *)(long)absrow);
    return 0;
}
コード例 #27
0
static int row_cb(int absrow, int relrow, int y, void *data)
{
    (void)relrow;
    const struct telem_layout *layout = (const struct telem_layout *)data;
    int i = 0;
    struct LabelDesc *font;
    void *cmd = NULL;
    int orig_y = y;
    for(const struct telem_layout *ptr = layout; ptr->source; ptr++, i++) {
        if((ptr->row_type & 0x0f) < absrow)
            continue;
        if((ptr->row_type & 0x0f) > absrow)
            break;
        y = orig_y;
        font = &DEFAULT_FONT;
        switch (ptr->row_type & 0xf0) {
            case TYPE_INDEX:  font = &TINY_FONT; cmd = idx_cb; break;
            case TYPE_HEADER: cmd = header_cb; break;
            case TYPE_LABEL:  cmd = label_cb; break;
            case TYPE_LABEL3: cmd = label_cb; y =orig_y + 2*LINE_HEIGHT; break;
            case TYPE_VALUE:  font = &tp->font;  cmd = telem_cb; break;
            case TYPE_VALUE2: font = &tp->font;  cmd = telem_cb; y = orig_y + LINE_HEIGHT;break;
            case TYPE_VALUE4: font = &tp->font;  cmd = telem_cb; y =orig_y + 3*LINE_HEIGHT; break;
        }
        GUI_CreateLabelBox(&gui->box[i], ptr->x, y, ptr->width, LINE_HEIGHT,
                font, cmd, NULL, (void *)(long)ptr->source);
    }
    return 0;
}
コード例 #28
0
ファイル: model_config.c プロジェクト: Chen-Leon/DeviationX
static int row4_cb(int absrow, int relrow, int y, void *data)
{
    (void)data;
    void *ts = NULL;
    void *input_ts = NULL;
    void *ts_press = NULL;
    void *ts_data = NULL;
    char *label = NULL;

    switch (absrow) {
    case 0:
        label = _tr_noop("Video Enable");
        ts = set_source_cb; ts_press = sourceselect_cb; ts_data = (void *)&Model.videosrc; input_ts = set_input_source_cb;
        break;
    case 1:
        label = _tr_noop("Video Channel");
        ts = set_videoch_cb;
        break;
    case 2:
        label = _tr_noop("Contrast");
        ts = set_videocontrast_cb;
        break;
    case 3:
        label = _tr_noop("Brightness");
        ts = set_videobrightness_cb;
        break;
    }
    GUI_CreateLabelBox(&gui->label[relrow], LABEL_X, y,
            LABEL_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, _tr(label));
    GUI_CreateTextSourcePlate(&gui->value[relrow], SELECT_X, y,
            SELECT_WIDTH, LINE_HEIGHT, &DEFAULT_FONT, ts_press, ts, input_ts, ts_data);
    return 1;
}
コード例 #29
0
ファイル: drexp_page.c プロジェクト: Chen-Leon/DeviationX
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();
}
コード例 #30
0
ファイル: drexp_page.c プロジェクト: DeviationTX/deviation
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();
}