Beispiel #1
0
TGUINode * GUI_CreateSlider( float x, float y, float width, float height, TTexture * backgroundTex, TTexture * sliderTex, float minValue, float maxValue, TFont * font, const char * text ) {
    TGUINode * node = GUI_CreateNode();
    node->slider = Memory_New( TGUISlider );
    node->slider->minValue = minValue;
    node->slider->maxValue = maxValue;
    node->slider->value = maxValue;
    node->slider->background = GUI_CreateRect( x, y, width, height, backgroundTex );
    node->slider->slider = GUI_CreateRect( width - 10, -4, 10, height + 8, sliderTex );
    GUI_Attach( node->slider->slider, node->slider->background );
    node->slider->text = GUI_CreateText( width + 10, 0, width, height, text, font );
    GUI_Attach( node->slider->text, node->slider->background );
    return node;
}
Beispiel #2
0
void PAGE_DrExpInit(int page)
{
    (void)page;
    PAGE_SetModal(0);
    // draw a underline only:
    GUI_CreateRect(&gui->rect, 0, HEADER_WIDGET_HEIGHT, LCD_WIDTH, 1, &DEFAULT_FONT);
    memset(mp, 0, sizeof(*mp));
    int count = get_mixers();
    int expected = INPUT_NumSwitchPos(mapped_std_channels.switches[SWITCHFUNC_DREXP_AIL + drexp_type]);
    if (count != expected) {
        GUI_CreateLabelBox(&gui->u.msg, 0, MESSAGE_Y, 0, LINE_HEIGHT, &DEFAULT_FONT, NULL, NULL, "Invalid model ini!"); // must be invalid model ini
        return;
    }
    GUI_CreateTextSelectPlate(&gui->u.type, HEADER_X, 0, HEADER_W, HEADER_WIDGET_HEIGHT,
                     &TEXTSEL_FONT, NULL, set_type_cb, (void *)NULL);
    GUI_CreateScrollable(&gui->scrollable, 0, HEADER_HEIGHT + SCROLL_Y, SCROLL_W, LCD_HEIGHT - HEADER_HEIGHT - SCROLL_Y,
                     2 * LINE_SPACE, count, row_cb, NULL, NULL, NULL);

    GUI_CreateXYGraph(&gui->graph, GRAPH_X, GRAPH_Y, GRAPH_W, GRAPH_H,
                      CHAN_MIN_VALUE, CHAN_MIN_VALUE * 1251 / 1000,
                      CHAN_MAX_VALUE, CHAN_MAX_VALUE * 1251 / 1000,
                      0, 0, show_curve_cb, curpos_cb, NULL, NULL);

    GUI_Select1stSelectableObj();
}
Beispiel #3
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);
}
Beispiel #4
0
TGUINode * GUI_CreateButton( float x, float y, float width, float height, TTexture * backgroundTex, TFont * font, const char * text ) {
    TGUINode * node = GUI_CreateNode();
    node->button = Memory_New( TGUIButton );
    node->button->background = GUI_CreateRect( x, y, width, height, backgroundTex );
    node->button->text = GUI_CreateText( x, y, width, height, text, font );
    GUI_SetTextAlign( node, GUITA_MIDDLE );
    node->button->normalColor = Vec3_Set( 1.0f, 1.0f, 1.0f );
    node->button->pressedColor = Vec3_Set( 0.8f, 0.8f, 0.8f );
    node->button->pickedColor = Vec3_Set( 0.9f, 0.9f, 0.9f );
    node->color = node->button->normalColor;
    return node;
}
Beispiel #5
0
static void _show_bar_page(u8 num_bars)
{
    current_page = 0;
    cp->num_bars = num_bars;
    memset(cp->pctvalue, 0, sizeof(cp->pctvalue));
    GUI_CreateLabelBox(&gui->title, 0 , 0, 50, 12, &DEFAULT_FONT, _title_cb, NULL, (void *)NULL);
    labelDesc.style = LABEL_LEFTCENTER;  // bug fix: must initialize to avoid unpredictable drawing
    GUI_CreateRect(&gui->rect, 0, ITEM_HEIGHT , LCD_WIDTH, 1, &labelDesc);

    GUI_CreateScrollable(&gui->scrollable, 0, 2, LCD_WIDTH, LCD_HEIGHT-2,
                         1, (num_bars + 1)/2, row_cb, getobj_cb, NULL, NULL);
    GUI_CreateLabelBox(&gui->page, LCD_WIDTH-2, 0, 0, 0, &MICRO_FONT, _page_cb, NULL, NULL);
}
Beispiel #6
0
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);
}
Beispiel #7
0
void PAGE_LayoutEditInit(int page)
{
    (void)page;
    PAGE_SetActionCB(_layaction_cb);
    lp->selected_x = 0;
    lp->selected_y = 0;
    for (int i = 0 ; i < 5; i++)
        gui->desc[i] = (struct LabelDesc){
            .font = MICRO_FONT.font,
            .font_color = 0xffff,
            .fill_color = 0x0000,
            .outline_color = 0xffff,
            .style = LABEL_SQUAREBOX,
        };
    gui->desc[1].style = LABEL_BRACKET; //Special case for trims

    struct LabelDesc micro = MICRO_FONT;
    struct LabelDesc rect = MICRO_FONT;
    micro.style = LABEL_LEFT;
    rect.fill_color = 0x0000;
    rect.outline_color = 0x0000;
    GUI_CreateRect(&gui->editelem, 41, 1, 9, 5, &rect);
    gui->editelem.CallBack = move_cb;
    GUI_CreateLabel(&gui->xlbl, 0,  1, NULL, micro, "X:");
    GUI_CreateLabelBox(&gui->x, 8, 1, 13, 6, &micro, pos_cb, NULL, (void *) 0L);
    GUI_CreateLabel(&gui->ylbl, 22, 1, NULL, micro, "Y:");
    GUI_CreateLabelBox(&gui->y, 30, 1, 9, 6, &micro, pos_cb, NULL, (void *) 1L);
    //gui->y must be the last element!
    GUI_SelectionNotify(notify_cb);

    draw_elements();
    if(OBJ_IS_USED(&gui->elem[0]))
        GUI_SetSelected((guiObject_t *)&gui->elem[0]);
}

static void xpos_cb(guiObject_t *obj, int dir, void *data)
{
    (void)obj;
    (void)data;
    if (lp->selected_for_move >= 0) {
        int x = GUI_TextSelectHelper(lp->selected_x, 0, LCD_WIDTH-lp->selected_w, dir, 1, 10, NULL);
        if (x != lp->selected_x) {
            lp->selected_x = x;
            move_elem();
        }
    }
}
Beispiel #8
0
static void show_iconsel_page(int SelectedIcon) {
    GUI_RemoveAllObjects();
    memset(gui, 0, sizeof(*gui));
    current_toggleicon = SelectedIcon;
    int toggleinput = MIXER_SRC(Model.pagecfg2.elem[tp->tglidx].src);

    //Header
    PAGE_ShowHeader(INPUT_SourceNameAbbrevSwitch(tempstring, toggleinput));
    labelDesc.style = LABEL_CENTER;
    GUI_CreateButtonPlateText(&gui->revert, REVERT_X, 0, REVERT_W, HEADER_WIDGET_HEIGHT, &labelDesc, NULL, 0, revert_cb, (void *)_tr("Revert"));

#if SEPARATOR
    GUI_CreateRect(&gui->separator, SEPARATOR_X, HEADER_WIDGET_HEIGHT, 1, LCD_HEIGHT-HEADER_HEIGHT, &labelDesc);
#endif

    int row = ROW_Y;
    int num_positions = INPUT_NumSwitchPos(toggleinput);
    if(num_positions < 2)
        num_positions = 2;

    static const char * const tglidx[3] = {"0:", "1:", "2:"};
    labelDesc.style = LABEL_INVERTED;
    for (int i = 0; i < num_positions; i++) {
        GUI_CreateLabelBox(&gui->togglelabel[i], LABEL_X, row, LABEL_W, LABEL_H, SelectedIcon == i ? &labelDesc : &DEFAULT_FONT, NULL, NULL, tglidx[i]);
#ifdef HAS_CHAR_ICONS
        GUI_CreateLabelBox(&gui->toggleicon[i], ICON_X, row, ICON_W, LABEL_H, &DEFAULT_FONT, TGLICO_font_cb,
                           NULL, (void *)(long)Model.pagecfg2.elem[tp->tglidx].extra[i]); 
#else
        struct ImageMap img = TGLICO_GetImage(Model.pagecfg2.elem[tp->tglidx].extra[i]);
        GUI_CreateImageOffset(&gui->toggleicon[i], ICON_X, row, ICON_W, LABEL_H, img.x_off, img.y_off, img.file,
             NULL, //SelectedIcon == 0 ? tglico_reset_cb : tglico_setpos_cb,
             (void *)(long)i);
#endif

        row += ROW_INCREMENT;
    }

    int count = get_toggle_icon_count();
    int rows = (count + NUM_COLS - 1) / NUM_COLS;
    GUI_CreateScrollable(&gui->scrollable, SCROLLABLE_X, SCROLLABLE_Y, LCD_WIDTH - SCROLLABLE_X,
                     SCROLLABLE_H,
                     SCROLL_ROW_H, rows, row_cb, NULL, NULL, (void *)(long)SelectedIcon);
}
Beispiel #9
0
static void show_icons(int SelectedIcon, int idx)
{
    int x, y;
    struct ImageMap img;
    u8 cursel = Model.pagecfg2.elem[tp->tglidx].extra[SelectedIcon];

    for(int i = 0; i < NUM_SYMBOL_ELEMS; i++) {
        y = 80 + (i / NUM_SYMBOL_COLS) * 40;
        x = 8 + (i - (i / NUM_SYMBOL_COLS) * NUM_SYMBOL_COLS) * (TOGGLEICON_WIDTH+8);
        img = TGLICO_GetImage(idx);
        //printf("%d(%d): (%d, %d) %s / %d\n", i, idx, x, y, img.file, img.x_off);
        GUI_CreateImageOffset(&gui->symbolicon[i], x, y, TOGGLEICON_WIDTH, TOGGLEICON_HEIGHT,
                              img.x_off, img.y_off, img.file, tglico_select_cb,
                              (void *)((long)(SelectedIcon << 8) | idx));
        if (idx == cursel)
            GUI_CreateRect(&gui->symbolframe, x-1, y-1, TOGGLEICON_WIDTH+2, TOGGLEICON_HEIGHT+2, &outline);
        idx = get_next_icon(idx);
        if(idx < 0)
            break;
    }
}
Beispiel #10
0
static int expo_row_cb(int absrow, int relrow, int y, void *data)
{
    const char *label = NULL;
    int underline = 0;
    void * label_cb = NULL;
    void *tgl = NULL;
    void *value = NULL;
    data = NULL;
    void *but_tgl = NULL;
    void *but_txt = NULL;
    void *but_data = NULL;
    int disable = 0;

    int x = 0;
    int w = LEFT_VIEW_WIDTH;
    switch(absrow) {
        case COMMON_SRC:
            label = _tr("Src");
            tgl = sourceselect_cb; value = set_source_cb; data = &mp->cur_mixer->src;
            break;
        case COMMON_CURVE:
            label = _tr("High-Rate");
            tgl = curveselect_cb; value = set_curvename_cb; data = &mp->mixer[0];
            break;
        case COMMON_SCALE:
            label = (void *)0; label_cb = scalestring_cb;
            value = set_number100_cb; data = &mp->mixer[0].scalar;
            break;
        case EXPO_SWITCH1:
            label = _tr("Switch1"); underline = 1;
            tgl = sourceselect_cb; value = set_drsource_cb; data = &mp->mixer[1].sw;
            break;
        case EXPO_LINK1:
            but_tgl = toggle_link_cb; but_txt = show_rate_cb; but_data = (void *)0;
            if(! MIXER_SRC(mp->mixer[1].sw))
                disable = 1;
            break;
        case EXPO_CURVE1:
            tgl = curveselect_cb; value = set_curvename_cb; data = &mp->mixer[1];
            if(! MIXER_SRC(mp->mixer[1].sw) || mp->link_curves & 0x01)
                disable = 1;
            break;
        case EXPO_SCALE1:
            label = (void *)1; label_cb = scalestring_cb;
            value = set_number100_cb; data = &mp->mixer[1].scalar;
            if(! MIXER_SRC(mp->mixer[1].sw))
                disable = 1;
            break;
        case EXPO_SWITCH2:
            label = _tr("Switch2"); underline = 1;
            tgl = sourceselect_cb; value = set_drsource_cb; data = &mp->mixer[2].sw;
            break;
        case EXPO_LINK2:
            but_tgl = toggle_link_cb; but_txt = show_rate_cb; but_data = (void *)1;
            if(! MIXER_SRC(mp->mixer[2].sw))
                disable = 1;
            break;
        case EXPO_CURVE2:
            tgl = curveselect_cb; value = set_curvename_cb; data = &mp->mixer[2];
            if(! MIXER_SRC(mp->mixer[2].sw) || mp->link_curves & 0x02)
                disable = 1;
            break;
        case EXPO_SCALE2:
            label = (void *)2; label_cb = scalestring_cb;
            value = set_number100_cb; data = &mp->mixer[2].scalar;
            if(! MIXER_SRC(mp->mixer[2].sw))
                disable = 1;
            break;
    }
    if(label || label_cb) {
        labelDesc.style = LABEL_LEFTCENTER;
        GUI_CreateLabelBox(&gui->label[relrow], x, y, w, ITEM_HEIGHT,
            &labelDesc, label_cb, NULL, label);
        if(underline)
            GUI_CreateRect(&gui->rect1, x, y, LEFT_VIEW_WIDTH, 1, &labelDesc);
        y += ITEM_HEIGHT + 1;
    }
    labelDesc.style = LABEL_CENTER;
    if(but_tgl) {
        GUI_CreateButtonPlateText(&gui->value[relrow].but, x, y,
            w, ITEM_HEIGHT, &labelDesc, but_txt, 0xffff, but_tgl, but_data);
        if(disable) {
            GUI_ButtonEnable((guiObject_t *)&gui->value[relrow].but, 0);
        }
    } else {
        GUI_CreateTextSelectPlate(&gui->value[relrow].ts, x, y,
            w, ITEM_HEIGHT, &labelDesc, tgl, value, data);
        if(disable) {
            GUI_TextSelectEnable(&gui->value[relrow].ts, 0);
        }
    }
    return 1;
}