/*============================================================================== * - _ebook_cb_page() * * - when user release 'ebook' cbi, call this */ static OS_STATUS _ebook_cb_page (GUI_CBI *pCBI_ebook, GUI_COOR *pCoor) { if (pCoor->x < gra_scr_w() / 2) { _show_page (PAGE_PREV); } else { if (pCoor->y >= ICON_SIZE || pCoor->x < (gra_scr_w () - ICON_SIZE)) { _show_page (PAGE_NEXT); } else { _close_file (); } } return OS_STATUS_OK; }
static void _press_cb(guiObject_t *obj, const void *data) { (void)obj; (void)data; current_page = current_page == telemetry_gps?telemetry_basic: telemetry_gps; _show_page(TELEMETRY_Type() == TELEM_DEVO ? &devo_page[current_page] : &dsm_page[current_page]); }
/*============================================================================== * - _ebook_cb_read() * * - start read a file. when user [release] a [*.txt] file icon, call this */ static OS_STATUS _ebook_cb_read (GUI_CBI *pCBI_file, GUI_COOR *pCoor) { GUI_COOR left_up = {EBOOK_START_X, 0}; GUI_SIZE size = {0, 0}; /* restore the frame */ cbf_default_release(pCBI_file, pCoor); /* open file */ if (_open_file (pCBI_file->name) == OS_STATUS_ERROR) { msg_box_create ("Open file failed!"); return OS_STATUS_ERROR; } /* show middle fb */ gra_set_show_fb (1); /* create & register 'ebook' cbi */ _G_pCBI_ebook = cbi_create_default (EBOOK_BG_PIC, &left_up, &size, TRUE); _G_pCBI_ebook->left_up.x -= EBOOK_START_X; _G_pCBI_ebook->right_down.x -= EBOOK_START_X; _G_pCBI_ebook->func_release = _ebook_cb_page; cbi_register (_G_pCBI_ebook); /* show page 0 */ _show_page (PAGE_HOME); return OS_STATUS_OK; }
void PAGE_RTCInit(int page) { (void)page; PAGE_SetModal(1); PAGE_RemoveAllObjects(); PAGE_ShowHeader_ExitOnly(PAGE_GetName(PAGEID_RTC), okcancel_cb); u32 time = RTC_GetValue(); u32 timevalue = RTC_GetTimeValue(time); Rtc.value[HOUR] = (u16)(timevalue / 3600); Rtc.value[MINUTE] = (u16)(timevalue % 3600) / 60; Rtc.value[SECOND] = (u16)(timevalue % 60); RTC_GetDateStringLong(tempstring,time); int idx = (tempstring[1] == '.' ? 1 : 2); tempstring[idx] = 0; tempstring[idx+3] = 0; Rtc.value[DAY] = atoi(tempstring); Rtc.value[MONTH] = atoi(tempstring + idx + 1); Rtc.value[YEAR] = atoi(tempstring + idx + 4); min[SECOND] = 0; max[SECOND] = 59; min[MINUTE] = 0; max[MINUTE] = 59; min[HOUR] = 0; max[HOUR] = 23; min[DAY] = 1; max[DAY] = daysInMonth[Rtc.value[MONTH] - 1] + (((Rtc.value[YEAR] % 4) == 0) && (Rtc.value[MONTH] == 2) ? 1 : 0); min[MONTH] = 1; max[MONTH] = 12; min[YEAR] = RTC_STARTYEAR; max[YEAR] = RTC_STARTYEAR + 67; _show_page(); }
static void _press_cb(guiObject_t *obj, const void *data) { (void)obj; (void)data; current_page = current_page == telemetry_gps?telemetry_basic: telemetry_gps; _show_page(); }
static void _show_page_by_index (OlPlayerChooser *window, guint index) { OlPlayerChooserPrivate *priv = OL_PLAYER_CHOOSER_GET_PRIVATE (window); _show_page (window, g_ptr_array_index (priv->pages, index)); }
void PAGE_TrimInit(int page) { (void)page; PAGE_SetModal(0); PAGE_RemoveAllObjects(); _show_page(); }
void PAGE_TxConfigureInit(int page) { (void)page; cp->enable = CALIB_NONE; PAGE_SetModal(0); PAGE_RemoveAllObjects(); PAGE_ShowHeader(PAGE_GetName(PAGEID_TXCFG)); GUI_CreateScrollbar(&gui->scrollbar, LCD_WIDTH-16, 32, LCD_HEIGHT-32, MAX_PAGE+1, NULL, scroll_cb, NULL); firstObj = NULL; page_num = 0; _show_page(); }
void PAGE_TelemtestInit(int page) { (void)okcancel_cb; (void)page; PAGE_SetModal(0); PAGE_SetActionCB(_action_cb); if (telem_state_check() == 0) { current_page = telemetry_off; GUI_CreateLabelBox(&gui->msg, 20, 10, 0, 0, &DEFAULT_FONT, NULL, NULL, tempstring); return; } _show_page(TELEMETRY_Type() == TELEM_DEVO ? &devo_page[current_page] : &dsm_page[current_page]); }
void PAGE_TelemtestInit(int page) { (void)page; PAGE_SetModal(0); PAGE_SetActionCB(_action_cb); if (telem_state_check() == 0) { current_page = telemetry_off; GUI_CreateLabelBox(&gui->msg, 20, 10, 0, 0, &DEFAULT_FONT, NULL, NULL, tempstring); return; } if (current_page > telemetry_gps) current_page = telemetry_basic; _show_page(); }
static int scroll_cb(guiObject_t *parent, u8 pos, s8 direction, void *data) { (void)pos; (void)parent; (void)data; s8 newpos = (s8)page_num + (direction > 0 ? 1 : -1); if (newpos < 0) newpos = 0; else if (newpos > MAX_PAGE) newpos = MAX_PAGE; if (newpos != page_num) { page_num = newpos; _show_page(); } return page_num; }
void PAGE_RTCInit(int page) { (void)page; PAGE_SetModal(1); PAGE_RemoveAllObjects(); PAGE_ShowHeader_ExitOnly(PAGE_GetName(PAGEID_RTC), okcancel_cb); u32 time = RTC_GetValue(); u32 timevalue = RTC_GetTimeValue(time); Rtc.value[2] = (u16)(timevalue / 3600); Rtc.value[1] = (u16)(timevalue % 3600) / 60; Rtc.value[0] = (u16)(timevalue % 60); RTC_GetDateStringLong(rp->tmpstr,time); int idx = (rp->tmpstr[1] == '.' ? 1 : 2); rp->tmpstr[idx] = 0; rp->tmpstr[idx+3] = 0; Rtc.value[3] = atoi(rp->tmpstr); Rtc.value[4] = atoi(rp->tmpstr + idx + 1); Rtc.value[5] = atoi(rp->tmpstr + idx + 4); _show_page(); }
void PAGE_TimerInit(int page) { PAGE_SetModal(0); PAGE_RemoveAllObjects(); _show_page(page); }