Exemplo n.º 1
0
static void notify_cb(guiObject_t * obj)
{
    if(obj && mp->cur_template == MIXERTEMPLATE_EXPO_DR && OBJ_IS_SCROLLABLE(obj)) {
        /* We exploit the fact that each row has only one selecteable object */
        int row_offset = GUI_ScrollableGetObjRowOffset(&gui->scrollable, obj);
        int idx = (row_offset >> 8) + (row_offset & 0xff);
        if(idx >= EXPO_SWITCH1 && idx <= EXPO_SCALE1) {
            if(mp->cur_mixer != &mp->mixer[1]) {
                sync_mixers();
                mp->cur_mixer = &mp->mixer[1];
                GUI_Redraw(&gui->graph);
            }
        } else if(idx >= EXPO_SWITCH2 && idx <= EXPO_SCALE2) {
            if(mp->cur_mixer != &mp->mixer[2]) {
                sync_mixers();
                mp->cur_mixer = &mp->mixer[2];
                GUI_Redraw(&gui->graph);
            }
        } else {
            if(mp->cur_mixer != &mp->mixer[0]) {
                mp->cur_mixer = &mp->mixer[0];
                GUI_Redraw(&gui->graph);
            }
        }
    }
Exemplo n.º 2
0
const char *set_drsource_cb(guiObject_t *obj, int dir, void *data)
{
    (void) obj;
    u8 *source = (u8 *)data;
    u8 is_neg = MIXER_SRC_IS_INV(*source);
    u8 changed;
    u8 oldsrc = *source;
    *source = GUI_TextSelectHelper(MIXER_SRC(*source), 0, NUM_SOURCES, dir, 1, 1, &changed);
    MIXER_SET_SRC_INV(*source, is_neg);
    if (changed) {
        sync_mixers();
        if ((!! MIXER_SRC(oldsrc)) ^ (!! MIXER_SRC(*source))) {
            // bug fix (issues #191) : only invoke _update_rate_widgets() for expo template
            if (mp->cur_template == MIXERTEMPLATE_EXPO_DR) {
                if(data == &mp->mixer[1].sw)
                    _update_rate_widgets(0);
                else if(data == &mp->mixer[2].sw)
                    _update_rate_widgets(1);
            }
        } else {    
            MIXPAGE_RedrawGraphs();
        }
    }
    GUI_TextSelectEnablePress((guiTextSelect_t *)obj, MIXER_SRC(*source));
    return INPUT_SourceName(mp->tmpstr, *source);
}
Exemplo n.º 3
0
const char *set_source_cb(guiObject_t *obj, int dir, void *data)
{
    (void) obj;
    u8 *source = (u8 *)data;
    if (!GUI_IsTextSelectEnabled(obj) ) {
        strcpy(mp->tmpstr, _tr("None"));
        return mp->tmpstr;
    }
    u8 is_neg = MIXER_SRC_IS_INV(*source);
    u8 changed;
    *source = GUI_TextSelectHelper(MIXER_SRC(*source), 1, NUM_SOURCES, dir, 1, 1, &changed);
    MIXER_SET_SRC_INV(*source, is_neg);
    if (changed) {
        if(mp->cur_template == MIXERTEMPLATE_COMPLEX) {
            guiObject_t *trim = _get_obj(COMPLEX_TRIM, 0);
            if(trim) {
                if (MIXER_SourceHasTrim(MIXER_SRC(mp->mixer[0].src)))
                    GUI_SetHidden(trim, 0);
                else
                    GUI_SetHidden(trim, 1);
            }
        }
        sync_mixers();
        MIXPAGE_RedrawGraphs();
    }
    GUI_TextSelectEnablePress((guiTextSelect_t *)obj, MIXER_SRC(*source));
    return INPUT_SourceName(mp->tmpstr, *source);
}
Exemplo n.º 4
0
const char *set_mux_cb(guiObject_t *obj, int dir, void *data)
{
    (void)obj;
    (void)data;
    u8 changed;
    u8 mux = MIXER_MUX(mp->cur_mixer);
    mux = GUI_TextSelectHelper(mux, MUX_REPLACE, MUX_LAST-1, dir, 1, 1, &changed);
    if (changed) {
        MIXER_SET_MUX(mp->cur_mixer, mux);
        MIXPAGE_RedrawGraphs();
        sync_mixers();
    }
    switch(mux) {
    case MUX_REPLACE:
        return _tr("replace");
    case MUX_MULTIPLY:
        return _tr("mult");
    case MUX_ADD:
        return _tr("add");
    case MUX_MAX:
        return _tr("max");
    case MUX_MIN:
        return _tr("min");
    case MUX_DELAY:
        return _tr("delay");
    case MUX_LAST:
        break;
    }
    return "";
}
Exemplo n.º 5
0
void toggle_link_cb(guiObject_t *obj, const void *data)
{
    (void)obj;
    if(data) {
        mp->link_curves ^= 0x02;
        if (mp->link_curves & 0x02) { //Redraw graphs when re-linking
            sync_mixers();
            set_src_enable(CURVE_TYPE(&mp->mixer[0].curve));
            MIXPAGE_RedrawGraphs();
        }
    } else {
        mp->link_curves ^= 0x01;
        if (mp->link_curves & 0x01) { //Redraw graphs when re-linking
            sync_mixers();
            set_src_enable(CURVE_TYPE(&mp->mixer[0].curve));
            MIXPAGE_RedrawGraphs();
        }
    }
    _update_rate_widgets(data ? 1 : 0);
}
Exemplo n.º 6
0
static void _show_expo_dr()
{
    GUI_SelectionNotify(notify_cb);
    GUI_Select1stSelectableObj();

    sync_mixers();

    mp->firstObj = GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LEFT_VIEW_WIDTH + ARROW_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1,
                         ITEM_SPACE, EXPO_LAST, expo_row_cb, simple_getobj_cb, expo_size_cb, NULL);

    GUI_CreateXYGraph(&gui->graph, 77, LCD_HEIGHT - RIGHT_VIEW_HEIGHT - 1, RIGHT_VIEW_HEIGHT, RIGHT_VIEW_HEIGHT,
                              CHAN_MIN_VALUE, CHAN_MIN_VALUE * 5 / 4,
                              CHAN_MAX_VALUE, CHAN_MAX_VALUE * 5 / 4,
                              0, 0, eval_mixer_cb, curpos_cb, NULL, NULL);

    mp->cur_mixer = &mp->mixer[0];
    //Enable/Disable the relevant widgets
}
Exemplo n.º 7
0
static const char *set_curvename_cb(guiObject_t *obj, int dir, void *data)
{
    if (!GUI_IsTextSelectEnabled(obj)) {
        strcpy(mp->tmpstr, _tr("Linked"));
        return mp->tmpstr;
    }
    u8 changed;
    struct Mixer *mix = (struct Mixer *)data;
    u8 type = CURVE_TYPE(&mix->curve);
    type = GUI_TextSelectHelper(type, 0, CURVE_MAX, dir, 1, 1, &changed);
    if (changed) {
        CURVE_SET_TYPE(&mix->curve, type);
        sync_mixers();
        set_src_enable(type);
        MIXPAGE_RedrawGraphs();
    }
    GUI_TextSelectEnablePress((guiTextSelect_t *)obj, type > CURVE_FIXED);
    return CURVE_GetName(mp->tmpstr, &mix->curve);
}
Exemplo n.º 8
0
const char *set_number100_cb(guiObject_t *obj, int dir, void *data)
{
    (void)obj;
    u8 changed;
    s8 *value = (s8 *)data;
    if (!GUI_IsTextSelectEnabled(obj) ) {
        sprintf(mp->tmpstr, "%d", *value);
        return mp->tmpstr;
    }
    s8 min = -125; //(value == &mp->limit.max) ? mp->limit.min : -100;
    s8 max = 125; //(value == &mp->limit.min) ? mp->limit.max : 100;
    *value = GUI_TextSelectHelper(*value, min, max, dir, 1, 5, &changed);
    sprintf(mp->tmpstr, "%d", *value);
    if (changed) {
        sync_mixers();
        MIXPAGE_RedrawGraphs();
    }
    return mp->tmpstr;
}
Exemplo n.º 9
0
void MIXPAGE_ChangeTemplate(int show_header)
{
    if (mp->cur_template != MIXERTEMPLATE_COMPLEX
        || mp->cur_mixer < mp->mixer
        || mp->cur_mixer > mp->mixer + mp->num_mixers)
    {
        mp->cur_mixer = mp->mixer;
    }
    if (Model.type == MODELTYPE_PLANE && mp->cur_template > MIXERTEMPLATE_MAX_PLANE) {
        mp->cur_template = MIXERTEMPLATE_NONE;
    }
    sync_mixers();
    if (show_header) {
        PAGE_RemoveAllObjects();
        _show_titlerow();
    } else {
        GUI_RemoveHierObjects(mp->firstObj); 
    }
    mp->firstObj = NULL;
    switch(mp->cur_template)  {
    case MIXERTEMPLATE_NONE:
    case MIXERTEMPLATE_CYC1:
    case MIXERTEMPLATE_CYC2:
    case MIXERTEMPLATE_CYC3:
        show_none();
        return;
    case MIXERTEMPLATE_SIMPLE:
        _show_simple();
        break;
    case MIXERTEMPLATE_EXPO_DR:
        _show_expo_dr();
        break;
    case MIXERTEMPLATE_COMPLEX:
        _show_complex(0);
        break;
    }
    set_src_enable(CURVE_TYPE(&mp->mixer[0].curve));
}
Exemplo n.º 10
0
const char *set_nummixers_cb(guiObject_t *obj, int dir, void *data)
{
    (void)obj;
    (void)data;
    u8 changed;
    int old = mp->num_mixers;
    mp->num_mixers = GUI_TextSelectHelper(
                     mp->num_mixers,
                     1 + (mp->cur_mixer - mp->mixer),
                     NUM_COMPLEX_MIXERS,
                     dir, 1, 1, &changed);
    if (changed) {
        if (mp->num_mixers > old) {
            //initialize mixer
            mp->mixer[mp->num_mixers-1].src = 1;
        }
        mp->num_complex_mixers = mp->num_mixers;
        MIXPAGE_RedrawGraphs();
        sync_mixers();
    }
    sprintf(mp->tmpstr, "%d", mp->num_mixers);
    return mp->tmpstr;
}
Exemplo n.º 11
0
static const char *set_source_helper(guiObject_t *obj, void *data, int changed) {
    (void) obj;
    u8 *source = (u8 *)data;
    if (!GUI_IsTextSelectEnabled(obj) ) {
        tempstring_cpy(_tr("None"));
        return tempstring;
    }
    if (changed) {
        if(mp->cur_template == MIXERTEMPLATE_COMPLEX) {
            guiObject_t *trim = _get_obj(COMPLEX_TRIM, 0);
            if(trim) {
                if (MIXER_SourceHasTrim(MIXER_SRC(mp->mixer[0].src)))
                    GUI_SetHidden(trim, 0);
                else
                    GUI_SetHidden(trim, 1);
            }
        }
        sync_mixers();
        MIXPAGE_RedrawGraphs();
    }
    GUI_TextSelectEnablePress((guiTextSelect_t *)obj, MIXER_SRC(*source));
    return INPUT_SourceName(tempstring, *source);
}