void Menu_AddItem(menuframework_s *menu, void *item) { menucommon_s *itemptr; if (menu->nitems >= MAX_MENUITEMS) { trap_Error ("Menu_AddItem: excessive items"); } menu->items[menu->nitems] = item; ((menucommon_s*)menu->items[menu->nitems])->parent = menu; ((menucommon_s*)menu->items[menu->nitems])->menuPosition = menu->nitems; ((menucommon_s*)menu->items[menu->nitems])->flags &= ~QMF_HASMOUSEFOCUS; // perform any item specific initializations itemptr = (menucommon_s*)item; if (!(itemptr->flags & QMF_NODEFAULTINIT)) { switch (itemptr->type) { case MTYPE_ACTION: Action_Init((menuaction_s*)item); break; case MTYPE_FIELD: MenuField_Init((menufield_s*)item); break; case MTYPE_SPINCONTROL: SpinControl_Init((menulist_s*)item); break; case MTYPE_RADIOBUTTON: RadioButton_Init((menuradiobutton_s*)item); break; case MTYPE_SLIDER: Slider_Init((menuslider_s*)item); break; case MTYPE_BITMAP: Bitmap_Init((menubitmap_s*)item); break; case MTYPE_TEXT: Text_Init((menutext_s*)item); break; case MTYPE_SCROLLLIST: ScrollList_Init((menulist_s*)item); break; case MTYPE_PTEXT: PText_Init((menutext_s*)item); break; case MTYPE_BTEXT: BText_Init((menutext_s*)item); break; case MTYPE_BUTTON: Button_Init((menubutton_s*)item); break; default: trap_Error(va("Menu_Init: unknown type %d", itemptr->type)); } } menu->nitems++; }
/** ****************************************************************************** ** Initializes the HMI (transfers bitmaps for GDC VRAM and configures layers ** ** \return None *****************************************************************************/ void Hmi_Init(void) { // Switch all layers off for initialization GdcDispLayerOff(GDC_DISP_LAYER_L0); GdcDispLayerOff(GDC_DISP_LAYER_L1); GdcDispLayerOff(GDC_DISP_LAYER_L2); GdcDispLayerOff(GDC_DISP_LAYER_L3); GdcDispLayerOff(GDC_DISP_LAYER_L4); GdcDispLayerOff(GDC_DISP_LAYER_L5); GdcDispLayerOrder(GDC_DISP_LAYER_L3, GDC_DISP_LAYER_L5, GDC_DISP_LAYER_L0, GDC_DISP_LAYER_L4, GDC_DISP_LAYER_L2, GDC_NO_LAYER); // ------------------------------------------------------------------------ // Erase backgrounds MyGDC_FillArea(L3ADR0, GDC_16BPP_FORMAT, 0, 0, WIN_WIDTH, WIN_HEIGHT, GDC_TRANS16); MyGDC_FillArea(L3ADR1, GDC_16BPP_FORMAT, 0, 0, WIN_WIDTH, WIN_HEIGHT, GDC_TRANS16); MyGDC_FillArea(L5ADR0, GDC_8BPP_FORMAT, 0, 0, WIN_WIDTH, WIN_HEIGHT, 190); MyGDC_FillArea(L5ADR1, GDC_8BPP_FORMAT, 0, 0, WIN_WIDTH, WIN_HEIGHT, 190); // Clear layer 2 (use 16 bpp draw format as 24 bpp BltFill is not supported) XGdcDrawDimension(&g_stcMyGDC_DrvCTX, GDC_16BPP_FORMAT, L2ADR0, WIN_WIDTH, WIN_HEIGHT); XGdcColor(&g_stcMyGDC_DrvCTX, GDC_TRANS16); XGdcBltFill(&g_stcMyGDC_DrvCTX, 0, 0, WIN_WIDTH, WIN_HEIGHT); // Clear layer 4 строки GdcDispSetLayerWindow(GDC_DISP_LAYER_L4 , INFO_STR_X_POS, INFO_STR_Y_POS, INFO_STR_WIDTH, INFO_STR_HEIGHT); XGdcDrawDimension(&g_stcMyGDC_DrvCTX, GDC_16BPP_FORMAT, L4ADR0, WIN_WIDTH, WIN_HEIGHT); XGdcColor(&g_stcMyGDC_DrvCTX, 0); XGdcBltFill(&g_stcMyGDC_DrvCTX, 0, 0, WIN_WIDTH, WIN_HEIGHT); // Clear layer 5 menu GdcDispSetLayerWindow(GDC_DISP_LAYER_L5 , CENTER_X_POS, CENTER_Y_POS+50, CENTER_WIDTH, CENTER_HEIGHT-50); XGdcDrawDimension(&g_stcMyGDC_DrvCTX, GDC_16BPP_FORMAT, L5ADR0, L5_WIDTH, L5_HEIGHT); XGdcColor(&g_stcMyGDC_DrvCTX, 0); XGdcBltFill(&g_stcMyGDC_DrvCTX, 0, 0, L5_WIDTH, L5_WIDTH); // Clear layer 0 верхняя часть экрана GdcDispSetLayerWindow(GDC_DISP_LAYER_L0 , TOP_X_POS, TOP_Y_POS, TOP_WIDTH, TOP_HEIGHT); XGdcDrawDimension(&g_stcMyGDC_DrvCTX, GDC_16BPP_FORMAT, L0ADR0, WIN_WIDTH, WIN_HEIGHT); XGdcColor(&g_stcMyGDC_DrvCTX, 0); XGdcBltFill(&g_stcMyGDC_DrvCTX, 0, 0, WIN_WIDTH, WIN_HEIGHT); // Enable alpha blending for layer 3 (alpha map on layer 5) // GdcLayerOverlayBlend(GDC_DISP_LAYER_L3, GDC_BLEND_CURRENT_RATIO, GDC_BLEND_NO_CORRECT, GDC_BLEND_RATIO_L5, 0); GdcColorZeroMode(GDC_DISP_LAYER_L3, GDC_COLOR_TRANSPARENT); // Disable transparent mode for layer 2 -> last layer (background for alpha blending) GdcColorZeroMode(GDC_DISP_LAYER_L0, GDC_COLOR_NOTRANSPARENT); GdcColorZeroMode(GDC_DISP_LAYER_L2, GDC_COLOR_NOTRANSPARENT); GdcColorZeroMode(GDC_DISP_LAYER_L4, GDC_COLOR_NOTRANSPARENT); GdcColorZeroMode(GDC_DISP_LAYER_L5, GDC_COLOR_TRANSPARENT); MyGDC_TextureInit(128, 128); TransferDisplayList(&g_stcMyGDC_DrvCTX); XGdcCancelDisplayList(&g_stcMyGDC_DrvCTX); HWWD_CL = 0; Text_Init(); Text_SetLanguage(TEXT_LANGUAGE_RUSSIAN); // Выбор языка InitCoordScale(); // Расчет координат для шкал HWWD_CL = 0; HmiPrepare(); // Switch on used layers GdcDispLayerOn(GDC_DISP_LAYER_L2); GdcDispLayerOn(GDC_DISP_LAYER_L3); GdcDispLayerOn(GDC_DISP_LAYER_L4); GdcDispLayerOn(GDC_DISP_LAYER_L0); GdcDispLayerOn(GDC_DISP_LAYER_L5); Timer_Start(TIMER_ID_MYGDC, HMI_TIME_UPDATE, TRUE, Hmi_Main); }