static void ypos_cb(guiObject_t *obj, int dir, void *data) { (void)obj; (void)data; if (lp->selected_for_move >= 0) { int y = GUI_TextSelectHelper(lp->selected_y, HEADER_Y, LCD_HEIGHT-lp->selected_h, dir, 1, 10, NULL); if (y != lp->selected_y) { lp->selected_y = y; move_elem(); } } }
const char *ypos_cb(guiObject_t *obj, int dir, void *data) { (void)obj; (void)data; if (lp->selected_for_move >= 0) { int y = GUI_TextSelectHelper(lp->selected_y, HEADER_Y, LCD_HEIGHT-lp->selected_h, dir, 1, 10, NULL); if (y != lp->selected_y) { lp->selected_y = y; move_elem(); } } sprintf(tempstring, "%d", lp->selected_y); return tempstring; }
const char *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(); } } sprintf(tempstring, "%d", lp->selected_x); return tempstring; }
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, µ, pos_cb, NULL, (void *) 0L); GUI_CreateLabel(&gui->ylbl, 22, 1, NULL, micro, "Y:"); GUI_CreateLabelBox(&gui->y, 30, 1, 9, 6, µ, 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(); } } }