?? guiparser.cpp
字號:
m_EventBitmaps[i] = NULL; } for(i = 0; i < m_nbSliders; i++){ FreeSlider(m_Sliders[i]); m_Sliders[i] = NULL; } for(i = 0; i < m_nbTextTables; i++){ FreeTextTable(m_TextTables[i]); m_TextTables[i] = NULL; } for(i = 0; i < m_nbMediaFiles; i++){ FreeMediaFile(m_MediaFiles[i]); m_MediaFiles[i] = NULL; } for(i = 0; i < m_nbEvents; i++){ FreeEvent(m_Events[i]); m_Events[i] = NULL; } return RM_OK;}////////////////////////////////////////////////////////////////////////////////// SCREEN FORMAT////////////////////////////////////////////////////////////////////////////////RMstatus RMcuracaoGuiParser::ParseScreenFormat(TiXmlElement *pnode){ const RMascii *str; str = pnode->Attribute(XMLWIDTH_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read width (ParseScreenFormat)... error\n")); return RM_ERROR; } else { RMasciiToUInt16 (str, &(m_screenFormat.width)); } str = pnode->Attribute(XMLHEIGHT_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read height (ParseScreenFormat)... error\n")); return RM_ERROR; } else { RMasciiToUInt16 (str, &(m_screenFormat.height)); } str = pnode->Attribute(XMLDEFAULT_NODE, true); if (str != (RMascii *)NULL) { if (RMCompareAsciiCaseInsensitively (str, "TRUE")) { m_screenFormat.isDefault = TRUE; } else if (RMCompareAsciiCaseInsensitively (str, "FALSE")) { m_screenFormat.isDefault = FALSE; } else { RMDBGLOG((GUIPARSERDBG, "Invalid default value (ParseScreenFormat)... error\n")); return RM_ERROR; } } else m_screenFormat.isDefault = FALSE; RMDBGLOG((GUIPARSERDBG, "Screen format : wdth=%d, height=%d, default=%s\n", m_screenFormat.width, m_screenFormat.height, m_screenFormat.isDefault?"TRUE":"FALSE")); return RM_OK;}RMstatus RMcuracaoGuiParser::GetScreenFormat(guiScreenFormatType* screenFormat){ RMMemcpy(screenFormat, &m_screenFormat, sizeof(guiScreenFormatType)); return RM_OK;}////////////////////////////////////////////////////////////////////////////////// PAGES////////////////////////////////////////////////////////////////////////////////RMstatus RMcuracaoGuiParser::ParseLangTable(TiXmlElement *pnode){ TiXmlElement *ptempNode; const RMascii *str; RMuint8 tr = 0; m_langTranslations =(guiLangTranslations*)CALLOC(1, sizeof(guiLangTranslations)); RMMemset(m_langTranslations, 0, sizeof(guiLangTranslations)); for(ptempNode = pnode->FirstChildElement(); ptempNode != NULL; ptempNode = ptempNode->NextSiblingElement()) { str = ptempNode->Value(); if (str == (RMascii *)NULL) continue; if (RMCompareAsciiCaseInsensitively (str, XMLLANGITEM_NODE)) { m_langTranslations->translations[tr] = ParseTranslation(ptempNode); if(m_langTranslations->translations[tr]) { tr++; m_langTranslations->nbNumItems ++; } } else { RMDBGLOG((GUIPARSERDBG, "unknown node [%s] in langTable\n", str)); } } return RM_OK;}guiTranslation *RMcuracaoGuiParser::ParseTranslation(TiXmlElement *pnode){ TiXmlElement *ptempNode; const RMascii *str; guiTranslation *item; item = (guiTranslation*) CALLOC(1, sizeof(guiTranslation)); RMMemset(item, 0, sizeof(guiTranslation)); str = pnode->Attribute(XMLNAME_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read file (ParseListItem) ... optional\n")); } else { item->name = RMMallocAndDuplicateAscii(str); item->translations[0] = RMMallocAndDuplicateAscii(str); } for(ptempNode = pnode->FirstChildElement(); ptempNode != NULL; ptempNode = ptempNode->NextSiblingElement()) { str = ptempNode->Value(); if (str == (RMascii *)NULL) continue; if (RMCompareAsciiCaseInsensitively (str, XMLTRANSLATION_NODE)) { RMuint8 lang = 1; str = ptempNode->Attribute(XMLLANG_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read x of list ... error\n")); } else { RMasciiToUInt8 (str, &lang); } str = ptempNode->Attribute(XMLTEXT_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read file (ParseListItem) ... optional\n")); } else { item->translations[lang] = RMMallocAndDuplicateAscii(str); } printf("%d - %s\n", lang, item->translations[lang]); //ParseEventList(ptempNode, (item->events), &(item->nbEvents)); } else { RMDBGLOG((GUIPARSERDBG, "unknown node [%s] in list item\n", str)); } } return item;}RMstatus RMcuracaoGuiParser::ParseMediaControls(TiXmlElement *pnode){ TiXmlElement *ptempNode; const RMascii *str; RMuint8 panels = 0; m_mediaControls =(guiMediaControls*)CALLOC(1, sizeof(guiMediaControls)); RMMemset(m_mediaControls, 0, sizeof(guiMediaControls)); str = pnode->Attribute(XMLFILE_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read file (ParsePanel) ... error\n")); } else { m_mediaControls->file = RMCatAscii(m_bitmapsPath, "/", str, NULL); } str = pnode->Attribute(XMLX_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read x (ParsePanel) ... error\n")); } else { RMasciiToUInt16 (str, &(m_mediaControls->x)); } str = pnode->Attribute(XMLY_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read y (ParsePanel) ... error\n")); } else { RMasciiToUInt16 (str, &(m_mediaControls->y)); } for(ptempNode = pnode->FirstChildElement(); ptempNode != NULL; ptempNode = ptempNode->NextSiblingElement()) { str = ptempNode->Value(); if (str == (RMascii *)NULL) continue; if (RMCompareAsciiCaseInsensitively (str, XMLPANEL_NODE)) { m_mediaControls->panels[panels] = ParsePanels(ptempNode); if(m_mediaControls->panels[panels]) { panels++; } } else { RMDBGLOG((GUIPARSERDBG, "unknown node [%s] in osdPagesList\n", str)); } } return RM_OK;}RMstatus RMcuracaoGuiParser::ParseAnimations(TiXmlElement *pnode){ TiXmlElement *ptempNode; const RMascii *str;// RMuint8 panels = 0; m_loadAnimation =(guiAnimationType*)CALLOC(1, sizeof(guiAnimationType)); RMMemset(m_loadAnimation, 0, sizeof(guiAnimationType)); for(ptempNode = pnode->FirstChildElement(); ptempNode != NULL; ptempNode = ptempNode->NextSiblingElement()) { str = ptempNode->Value(); if (str == (RMascii *)NULL) continue; if (RMCompareAsciiCaseInsensitively (str, XMLANIMATIONITEM_NODE)) { m_loadAnimation->item = ParseAnimationItem(ptempNode); } else { RMDBGLOG((GUIPARSERDBG, "unknown node [%s] in osdPagesList\n", str)); } } return RM_OK;}RMstatus RMcuracaoGuiParser::ParsePageList(TiXmlElement *pnode){ TiXmlElement *ptempNode; const RMascii *str; for(ptempNode = pnode->FirstChildElement(); ptempNode != NULL; ptempNode = ptempNode->NextSiblingElement()) { str = ptempNode->Value(); if (str == (RMascii *)NULL) continue; if (RMCompareAsciiCaseInsensitively (str, XMLOSDPAGE_NODE)) { if(m_nbOsdPages < MAX_GUI_PAGES) { m_osdPages[m_nbOsdPages] = ParseOsdPage(ptempNode); if(m_osdPages[m_nbOsdPages] != (guiOsdPageType*)NULL){ m_nbOsdPages++; } } else{ RMDBGLOG((GUIPARSERDBG, "Exceed number of max osd pages (=%d)\n", MAX_GUI_PAGES)); } } else { RMDBGLOG((GUIPARSERDBG, "unknown node [%s] in osdPagesList\n", str)); } } return RM_OK;}guiAnimationItem* RMcuracaoGuiParser::ParseAnimationItem(TiXmlElement *pnode){ const RMascii *str; guiAnimationItem* page;// TiXmlElement *ptempNode; page =(guiAnimationItem*)CALLOC(1, sizeof(guiAnimationItem)); RMMemset(page, 0, sizeof(guiAnimationType)); str = pnode->Attribute(XMLNAME_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read name (ParsePanel) ... error\n")); goto invalidPage; } else { page->name = STRDUP(str); } str = pnode->Attribute(XMLICON_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read file (ParsePanel) ... error\n"));#ifdef GUI_REFID_2 page->object.file = RMCatAscii(m_bitmapsPath, "/", "background.jpg", NULL);#else // goto invalidPage;#endif } else { page->object.icon = RMCatAscii(m_bitmapsPath, "/", str, NULL); } str = pnode->Attribute(XMLX_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read x (ParsePanel) ... error\n")); goto invalidPage; } else { RMasciiToUInt16 (str, &(page->object.x)); } str = pnode->Attribute(XMLY_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read y (ParsePanel) ... error\n")); goto invalidPage; } else { RMasciiToUInt16 (str, &(page->object.y)); } str = pnode->Attribute(XMLICONWIDTH_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read width (ParsePanel) ... error\n")); goto invalidPage; } else { RMasciiToUInt16 (str, &(page->object.icon_width)); } RMDBGLOG((GUIPARSERDBG, "end page\n")); return page; invalidPage: FreeAnimationItem(page); return NULL;}guiPanelType* RMcuracaoGuiParser::ParsePanels(TiXmlElement *pnode){ const RMascii *str; guiPanelType* page; TiXmlElement *ptempNode; page =(guiPanelType*)CALLOC(1, sizeof(guiPanelType)); RMMemset(&page->object, 0, sizeof(RMPanelObject)); str = pnode->Attribute(XMLNAME_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read name (ParsePanel) ... error\n")); goto invalidPage; } else { page->name = STRDUP(str); } str = pnode->Attribute(XMLFILE_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read file (ParsePanel) ... error\n"));#ifdef GUI_REFID_2 page->object.file = RMCatAscii(m_bitmapsPath, "/", "background.jpg", NULL);#else // goto invalidPage;#endif } else { page->object.file = RMCatAscii(m_bitmapsPath, "/", str, NULL); } str = pnode->Attribute(XMLX_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read x (ParsePanel) ... error\n")); goto invalidPage; } else { RMasciiToUInt16 (str, &(page->object.x)); } str = pnode->Attribute(XMLORIENTATION_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read x (ParsePanel) ... error\n")); goto invalidPage; } else { RMasciiToUInt8 (str, &(page->object.orientation)); } str = pnode->Attribute(XMLY_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read y (ParsePanel) ... error\n")); goto invalidPage; } else { RMasciiToUInt16 (str, &(page->object.y)); } str = pnode->Attribute(XMLWIDTH_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read width (ParsePanel) ... error\n")); goto invalidPage; } else { RMasciiToUInt16 (str, &(page->object.width)); } str = pnode->Attribute(XMLHEIGHT_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read height (ParsePanel) ... error\n")); goto invalidPage; } else { RMasciiToUInt16 (str, &(page->object.height)); } str = pnode->Attribute(XMLVISIBLE_NODE, true); if (str != (RMascii *)NULL) { if (RMCompareAsciiCaseInsensitively (str, "TRUE")) { page->object.visible = TRUE; } else if (RMCompareAsciiCaseInsensitively (str, "FALSE")) { page->object.visible = FALSE; } else { RMDBGLOG((GUIPARSERDBG, "Invalid visible value (ParseScreenFormat) ... error\n")); goto invalidPage; } } else page->object.visible = FALSE; for(ptempNode = pnode->FirstChildElement(); ptempNode != NULL; ptempNode = ptempNode->NextSiblingElement()) { str = ptempNode->Value(); if (str == (RMascii *)NULL) continue; if (RMCompareAsciiCaseInsensitively (str, XMLSLIDER_NODE)) { page->slider = ParseSlider(ptempNode); } else if (RMCompareAsciiCaseInsensitively (str, XMLBUTTONLIST_NODE)) { ParseButtonList(ptempNode, (page->buttons), &(page->nbButtons), NULL); } else { RMDBGLOG((GUIPARSERDBG, "unknown node [%s] in osdPages\n", str)); } } RMDBGLOG((GUIPARSERDBG, "end page\n")); return page; invalidPage: FreePanel(page); return NULL;}guiOsdPageType* RMcuracaoGuiParser::ParseOsdPage(TiXmlElement *pnode){ const RMascii *str; guiOsdPageType* page; TiXmlElement *ptempNode; page =(guiOsdPageType*)CALLOC(1, sizeof(guiOsdPageType)); RMMemset(&page->object, 0, sizeof(RMPageObject)); str = pnode->Attribute(XMLNAME_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read name (ParseOsdPage) ... error\n")); goto invalidPage; } else { page->name = STRDUP(str); } str = pnode->Attribute(XMLFILE_NODE, true); if (str == (RMascii *)NULL) { RMDBGLOG((GUIPARSERDBG, "Could not read file (ParseOsdPage) ... error\n"));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -