Exemplo n.º 1
0
static unsigned _action_cb(u32 button, unsigned flags, void *data)
{
    (void)data;

    if(! GUI_GetSelected() || lp->selected_for_move < 0 || GUI_IsModal())
        return 0;
    if(CHAN_ButtonIsPressed(button, BUT_EXIT)) {
        gui->elem[lp->selected_for_move].desc.font_color ^= 0xffff;
        gui->elem[lp->selected_for_move].desc.fill_color ^= 0xffff;
        GUI_Redraw((guiObject_t *)&gui->elem[lp->selected_for_move]);
        set_selected_for_move(-1);
        return 1;
    }
    if(CHAN_ButtonIsPressed(button, BUT_ENTER)) {
        show_config();
        return 1;
    }
    if(CHAN_ButtonIsPressed(button, BUT_LEFT)) {
        xpos_cb(NULL, (flags & BUTTON_LONGPRESS) ? -2 : -1, NULL);
        return 1;
    }
    if(CHAN_ButtonIsPressed(button, BUT_RIGHT)) {
        xpos_cb(NULL, (flags & BUTTON_LONGPRESS) ? 2 : 1, NULL);
        return 1;
    }
    if(CHAN_ButtonIsPressed(button, BUT_UP)) {
        ypos_cb(NULL, (flags & BUTTON_LONGPRESS) ? -2 : -1, NULL);
        return 1;
    }
    if(CHAN_ButtonIsPressed(button, BUT_DOWN)) {
        ypos_cb(NULL, (flags & BUTTON_LONGPRESS) ? 2 : 1, NULL);
        return 1;
    }
    return 0;
}
Exemplo n.º 2
0
void PAGE_ShowWarning(const char *title, const char *str)
{   
    if (dialog)
        return;
    if(str != tempstring)
        sprintf(tempstring, "%s", str);
    dialogcrc = 0;
    current_selected_obj = GUI_GetSelected();
    dialog = GUI_CreateDialog(&gui->dialog, 10 + DLG_XOFFSET, 42 + DLG_YOFFSET, 300, 188, title, NULL, lowbatt_ok_cb, dtOk, tempstring);
}
Exemplo n.º 3
0
void reset_timerperm_cb(guiObject_t *obj, const void *data)
{
    long index = (long)data & 0xff;
// don't include this in Devo7e due to memory restrictions
#if HAS_PERMANENT_TIMER
    if (index & 0x80) {   // set
        current_selected = GUI_ScrollableGetObjRowOffset(&gui->scrollable, GUI_GetSelected());
        PAGE_PushByID(PAGEID_SETTIMER, index & 0x7f);
    } else  // reset
#endif
        PAGE_ShowResetPermTimerDialog(obj,(void *)(index & 0x7f));
}
Exemplo n.º 4
0
static unsigned _layaction_cb(u32 button, unsigned flags, void *data)
{
    (void)data;
    if(CHAN_ButtonIsPressed(button, BUT_EXIT)) {
        if (flags & BUTTON_RELEASE) {
            if (lp->selected_for_move >= 0) {
                set_selected_for_move(-1);
            } else {
                PAGE_Pop();
            }
        }
        return 1;
    }
    if (! GUI_GetSelected() || flags & BUTTON_RELEASE)
        return 0;
    if (CHAN_ButtonIsPressed(button, BUT_ENTER) && lp->selected_for_move < 0) {
        select_for_move((guiLabel_t *)GUI_GetSelected());
        return 1;
    }
    if (lp->selected_for_move < 0)
        return 0;
    if(CHAN_ButtonIsPressed(button, BUT_LEFT)) {
        xpos_cb(NULL, (flags & BUTTON_LONGPRESS) ? -2 : -1, NULL);
        return 1;
    }
    if(CHAN_ButtonIsPressed(button, BUT_RIGHT)) {
        xpos_cb(NULL, (flags & BUTTON_LONGPRESS) ? 2 : 1, NULL);
        return 1;
    }
    if(CHAN_ButtonIsPressed(button, BUT_UP)) {
        ypos_cb(NULL, (flags & BUTTON_LONGPRESS) ? -2 : -1, NULL);
        return 1;
    }
    if(CHAN_ButtonIsPressed(button, BUT_DOWN)) {
        ypos_cb(NULL, (flags & BUTTON_LONGPRESS) ? 2 : 1, NULL);
        return 1;
    }
    return 0;
}
Exemplo n.º 5
0
static void navigate_symbolicons(s8 direction) {
    guiObject_t *obj = GUI_GetSelected();
    if (direction == -1)
        GUI_SetSelected((guiObject_t *)GUI_GetPrevSelectable(obj));
    else
        GUI_SetSelected((guiObject_t *)GUI_GetNextSelectable(obj));
    return;
#if 0
    obj = GUI_GetSelected();
    if (obj == (guiObject_t *)&gui->toggleicon[0]
        || obj == (guiObject_t *)&gui->toggleicon[1]
        || obj == (guiObject_t *)&gui->toggleicon[2])
    {
        // skip toggle icon for right/left pressing
        if (direction == -1)
            GUI_SetSelected((guiObject_t *)&gui->revert);
        else {
            GUI_SetSelected((guiObject_t *)&gui->symbolicon[0]);
        }
    }
#endif
}
Exemplo n.º 6
0
void GUI_DrawImage(struct guiObject *obj)
{
#define SELECT_BORDER_OFFSET 1
    struct guiImage *image = (struct guiImage *)obj;
    struct guiBox *box = &obj->box;

    //  clear the whole widget, including its selected border for devo10/7e
    if (LCD_DEPTH == 1)
        GUI_DrawBackground(box->x -SELECT_BORDER_OFFSET, box->y -SELECT_BORDER_OFFSET,
            box->width + SELECT_BORDER_OFFSET + SELECT_BORDER_OFFSET, box->height + SELECT_BORDER_OFFSET + SELECT_BORDER_OFFSET);

    LCD_DrawWindowedImageFromFile(box->x, box->y,
            image->file, box->width, box->height,
            image->x_off, image->y_off);

    if (LCD_DEPTH == 1 && GUI_GetSelected() == obj)
        LCD_DrawRect(box->x -SELECT_BORDER_OFFSET, box->y -SELECT_BORDER_OFFSET,
            box->width + SELECT_BORDER_OFFSET + SELECT_BORDER_OFFSET, box->height + SELECT_BORDER_OFFSET + SELECT_BORDER_OFFSET, 1);
}
Exemplo n.º 7
0
static int scroll_cb(guiObject_t *parent, u8 pos, s8 direction, void *data) {
    (void)parent;
    (void)pos;
    int sel_row = -1;
    int sel_col = 0;
    guiScrollable_t *scrollable = (guiScrollable_t *)data;
    int row = scrollable->cur_row;
    if (direction > 1)
        row += scrollable->visible_rows;
    else if (direction < -1)
        row -= scrollable->visible_rows;
    else
        row += direction;
    if (row < 0) {
        row = 0;
    } else if (row > scrollable->item_count - scrollable->visible_rows) {
        row = scrollable->item_count - scrollable->visible_rows;
    }
    guiObject_t *sel = GUI_GetSelected();
    if (sel) {
        if(get_obj_abs_row_col(scrollable, sel, &sel_row, &sel_col)) {
            if (sel_row < row) {
                sel_row = row;
                sel_col = 0;
            }
        } else {
            sel_row = -1;
        }
    }
    create_scrollable_objs(scrollable, -row);
    if (sel_row >= 0) {
        if(sel_row >= row + scrollable->visible_rows) {
            sel_row = row + scrollable->visible_rows - 1;
            sel_col = 0;
        }
        GUI_SetSelected(set_selected_abs_row_col(scrollable, sel_row, sel_col));
    }
    return -1;
}
Exemplo n.º 8
0
static void _show_complex(int page_change)
{
    GUI_SelectionNotify(NULL);
    mp->max_scroll = 2;
    int selection = 0;
    if (page_change) {
        selection = GUI_ScrollableGetObjRowOffset(&gui->scrollable, GUI_GetSelected());
    }
    mp->firstObj = GUI_CreateScrollable(&gui->scrollable, 0, ITEM_HEIGHT + 1, LEFT_VIEW_WIDTH + ARROW_WIDTH, LCD_HEIGHT - ITEM_HEIGHT -1,
                         2 * ITEM_SPACE, COMPLEX_LAST - COMMON_LAST, complex_row_cb, simple_getobj_cb, complex_size_cb, NULL);
    // The following items are not draw in the logical view;
    GUI_CreateBarGraph(&gui->bar, LEFT_VIEW_WIDTH +10, LCD_HEIGHT - RIGHT_VIEW_HEIGHT -1, 5, RIGHT_VIEW_HEIGHT,
                              CHAN_MIN_VALUE, CHAN_MAX_VALUE, BAR_VERTICAL, eval_chan_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, touch_cb, mp->cur_mixer);
    if (page_change) {
        GUI_SetSelected(GUI_ShowScrollableRowOffset(&gui->scrollable, selection));
    } else {
        GUI_Select1stSelectableObj(); // bug fix: muset reset to 1st selectable item, otherwise ,the focus will be wrong
    }
}
Exemplo n.º 9
0
void PAGE_TelemconfigExit()
{
    current_selected = GUI_ScrollableGetObjRowOffset(&gui->scrollable, GUI_GetSelected());
}
Exemplo n.º 10
0
void PAGE_TelemconfigExit()
{
    if(telem_state_check())
        current_selected = GUI_ScrollableGetObjRowOffset(&gui->scrollable, GUI_GetSelected());
}
Exemplo n.º 11
0
static unsigned _action_cb(u32 button, unsigned flags, void *data)
{
    (void)data;
    if ((flags & BUTTON_PRESS) || (flags & BUTTON_LONGPRESS)) {
        if (CHAN_ButtonIsPressed(button, BUT_EXIT)) {
            BUTTON_UnregisterCallback(&action);
            PAGE_RemoveAllObjects();
            rl.return_page(NULL);
        } else if (CHAN_ButtonIsPressed(button, BUT_LEFT) && ((guiObject_t *)&gui->value == GUI_GetSelected())) {
            // catch the left/right keys when r1.textsel is selected
            copy_val_cb(NULL, 1, NULL);
            GUI_Redraw(&gui->value);

        } else if (CHAN_ButtonIsPressed(button, BUT_RIGHT)&& ((guiObject_t *)&gui->value == GUI_GetSelected())) {
            copy_val_cb(NULL, -1, NULL);
            GUI_Redraw(&gui->value);
        }
        else {
            // only one callback can handle a button press, so we don't handle BUT_ENTER here, let it handled by press cb
            return 0;
        }
    }
    return 1;
}
Exemplo n.º 12
0
void PAGE_TravelAdjExit()
{
    current_selected = GUI_ScrollableGetObjRowOffset(&gui->scrollable, GUI_GetSelected());
}