bool NativeLangSpeaker::getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message) { title = TEXT(""); message = TEXT(""); if (!_nativeLangA) return false; TiXmlNodeA *msgBoxNode = _nativeLangA->FirstChild("MessageBox"); if (!msgBoxNode) return false; msgBoxNode = searchDlgNode(msgBoxNode, msgBoxTagName); if (!msgBoxNode) return false; WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); // Set Title const char *titre = (msgBoxNode->ToElement())->Attribute("title"); const char *msg = (msgBoxNode->ToElement())->Attribute("message"); if ((titre && titre[0]) && (msg && msg[0])) { title = wmc->char2wchar(titre, _nativeLangEncoding); message = wmc->char2wchar(msg, _nativeLangEncoding); return true; } return false; }
void TiXmlElementA::StreamOut( TIXMLA_OSTREAM * stream ) const { (*stream) << "<" << value; TiXmlAttributeA* attrib; for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() ) { (*stream) << " "; attrib->StreamOut( stream ); } // If this node has children, give it a closing tag. Else // make it an empty tag. TiXmlNodeA* node; if ( firstChild ) { (*stream) << ">"; for ( node = firstChild; node; node=node->NextSibling() ) { node->StreamOut( stream ); } (*stream) << "</" << value << ">"; } else { (*stream) << " />"; } }
const char* TiXmlElementA::ReadValue( const char* p, TiXmlParsingDataA* data ) { TiXmlDocumentA* document = GetDocument(); // Read in text and elements in any order. p = SkipWhiteSpace( p ); while ( p && *p ) { if ( *p != '<' ) { // Take what we have, make a text element. TiXmlTextA* textNode = new TiXmlTextA( "" ); if ( !textNode ) { if ( document ) { document->SetError( TIXMLA_ERROR_OUT_OF_MEMORY, 0, 0 ); } return 0; } p = textNode->Parse( p, data ); if ( !textNode->Blank() ) LinkEndChild( textNode ); else delete textNode; } else { // We hit a '<' // Have we hit a new element or an end tag? if ( StringEqual( p, "</", false ) ) { return p; } else { TiXmlNodeA* node = Identify( p ); if ( node ) { p = node->Parse( p, data ); LinkEndChild( node ); } else { return 0; } } } p = SkipWhiteSpace( p ); } if ( !p ) { if ( document ) document->SetError( TIXMLA_ERROR_READING_ELEMENT_VALUE, 0, 0 ); } return p; }
void TiXmlDocumentA::Print( FILE* cfile, int depth ) const { TiXmlNodeA* node; for ( node=FirstChild(); node; node=node->NextSibling() ) { node->Print( cfile, depth ); fprintf( cfile, "\n" ); } }
TiXmlNodeA* TiXmlNodeA::FirstChild( const char * _value ) const { TiXmlNodeA* node; for ( node = firstChild; node; node = node->next ) { if ( node->SValue() == TIXMLA_STRING( _value )) return node; } return 0; }
TiXmlNodeA* TiXmlNodeA::NextSibling( const char * _value ) const { TiXmlNodeA* node; for ( node = next; node; node = node->next ) { if ( node->SValue() == TIXMLA_STRING (_value)) return node; } return 0; }
TiXmlNodeA* TiXmlNodeA::PreviousSibling( const char * _value ) const { TiXmlNodeA* node; for ( node = prev; node; node = node->prev ) { if ( node->SValue() == TIXMLA_STRING (_value)) return node; } return 0; }
TiXmlNodeA* TiXmlNodeA::LastChild( const char * _value ) const { TiXmlNodeA* node; for ( node = lastChild; node; node = node->prev ) { if ( node->SValue() == TIXMLA_STRING (_value)) return node; } return 0; }
const char* TiXmlDocumentA::Parse( const char* p, TiXmlParsingDataA* prevData ) { ClearError(); // Parse away, at the document level. Since a document // contains nothing but other tags, most of what happens // here is skipping white space. if ( !p || !*p ) { SetError( TIXMLA_ERROR_DOCUMENT_EMPTY, 0, 0 ); return 0; } // Note that, for a document, this needs to come // before the while space skip, so that parsing // starts from the pointer we are given. location.Clear(); if ( prevData ) { location.row = prevData->cursor.row; location.col = prevData->cursor.col; } else { location.row = 0; location.col = 0; } TiXmlParsingDataA data( p, TabSize(), location.row, location.col ); location = data.Cursor(); p = SkipWhiteSpace( p ); if ( !p ) { SetError( TIXMLA_ERROR_DOCUMENT_EMPTY, 0, 0 ); return 0; } while ( p && *p ) { TiXmlNodeA* node = Identify( p ); if ( node ) { p = node->Parse( p, &data ); LinkEndChild( node ); } else { break; } p = SkipWhiteSpace( p ); } // All is well. return p; }
void TiXmlDocumentA::StreamIn( TIXMLA_ISTREAM * in, TIXMLA_STRING * tag ) { // The basic issue with a document is that we don't know what we're // streaming. Read something presumed to be a tag (and hope), then // identify it, and call the appropriate stream method on the tag. // // This "pre-streaming" will never read the closing ">" so the // sub-tag can orient itself. if ( !StreamTo( in, '<', tag ) ) { SetError( TIXMLA_ERROR_PARSING_EMPTY, 0, 0 ); return; } while ( in->good() ) { int tagIndex = tag->length(); while ( in->good() && in->peek() != '>' ) { int c = in->get(); (*tag) += (char) c; } if ( in->good() ) { // We now have something we presume to be a node of // some sort. Identify it, and call the node to // continue streaming. TiXmlNodeA* node = Identify( tag->c_str() + tagIndex ); if ( node ) { node->StreamIn( in, tag ); bool isElement = node->ToElement() != 0; delete node; node = 0; // If this is the root element, we're done. Parsing will be // done by the >> operator. if ( isElement ) { return; } } else { SetError( TIXMLA_ERROR, 0, 0 ); return; } } } // We should have returned sooner. SetError( TIXMLA_ERROR, 0, 0 ); }
void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdminDlg) { if (_nativeLangA) { TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog"); if (dlgNode) { dlgNode = searchDlgNode(dlgNode, "PluginsAdminDlg"); if (dlgNode) { WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); TiXmlNodeA *ColumnPluginNode = dlgNode->FirstChild("ColumnPlugin"); if (ColumnPluginNode) { const char *name = (ColumnPluginNode->ToElement())->Attribute("name"); if (name && name[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding); pluginsAdminDlg.changeColumnName(COLUMN_PLUGIN, nameW.c_str()); } } TiXmlNodeA *ColumnVersionNode = dlgNode->FirstChild("ColumnVersion"); if (ColumnVersionNode) { const char *name = (ColumnVersionNode->ToElement())->Attribute("name"); if (name && name[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding); pluginsAdminDlg.changeColumnName(COLUMN_VERSION, nameW.c_str()); } } const char *titre1 = (dlgNode->ToElement())->Attribute("titleAvailable"); const char *titre2 = (dlgNode->ToElement())->Attribute("titleUpdates"); const char *titre3 = (dlgNode->ToElement())->Attribute("titleInstalled"); if (titre1 && titre1[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding); pluginsAdminDlg.changeTabName(AVAILABLE_LIST, nameW.c_str()); } if (titre2 && titre2[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding); pluginsAdminDlg.changeTabName(UPDATES_LIST, nameW.c_str()); } if (titre3 && titre3[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding); pluginsAdminDlg.changeTabName(INSTALLED_LIST, nameW.c_str()); } } changeDlgLang(pluginsAdminDlg.getHSelf(), "PluginsAdminDlg"); } } }
TiXmlElementA* TiXmlNodeA::NextSiblingElement( const char * _value ) const { TiXmlNodeA* node; for ( node = NextSibling( _value ); node; node = node->NextSibling( _value ) ) { if ( node->ToElement() ) return node->ToElement(); } return 0; }
TiXmlElementA* TiXmlNodeA::FirstChildElement() const { TiXmlNodeA* node; for ( node = FirstChild(); node; node = node->NextSibling() ) { if ( node->ToElement() ) return node->ToElement(); } return 0; }
TiXmlNodeA * NativeLangSpeaker::searchDlgNode(TiXmlNodeA *node, const char *dlgTagName) { TiXmlNodeA *dlgNode = node->FirstChild(dlgTagName); if (dlgNode) return dlgNode; for (TiXmlNodeA *childNode = node->FirstChildElement(); childNode ; childNode = childNode->NextSibling() ) { dlgNode = searchDlgNode(childNode, dlgTagName); if (dlgNode) return dlgNode; } return NULL; }
void TiXmlElementA::Print( FILE* cfile, int depth ) const { int i; for ( i=0; i<depth; i++ ) { fprintf( cfile, " " ); } fprintf( cfile, "<%s", value.c_str() ); TiXmlAttributeA* attrib; for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() ) { fprintf( cfile, " " ); attrib->Print( cfile, depth ); } // There are 3 different formatting approaches: // 1) An element without children is printed as a <foo /> node // 2) An element with only a text child is printed as <foo> text </foo> // 3) An element with children is printed on multiple lines. TiXmlNodeA* node; if ( !firstChild ) { fprintf( cfile, " />" ); } else if ( firstChild == lastChild && firstChild->ToText() ) { fprintf( cfile, ">" ); firstChild->Print( cfile, depth + 1 ); fprintf( cfile, "</%s>", value.c_str() ); } else { fprintf( cfile, ">" ); for ( node = firstChild; node; node=node->NextSibling() ) { if ( !node->ToText() ) { fprintf( cfile, "\n" ); } node->Print( cfile, depth+1 ); } fprintf( cfile, "\n" ); for( i=0; i<depth; ++i ) fprintf( cfile, " " ); fprintf( cfile, "</%s>", value.c_str() ); } }
generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName) const { if (!_nativeLangA) return TEXT(""); TiXmlNodeA *mainMenu = _nativeLangA->FirstChild("Menu"); if (!mainMenu) return TEXT(""); mainMenu = mainMenu->FirstChild("Main"); if (!mainMenu) return TEXT(""); TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries"); if (!entriesRoot) return TEXT(""); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item"); childNode ; childNode = childNode->NextSibling("Item") ) { TiXmlElementA *element = childNode->ToElement(); const char *idName = element->Attribute("idName"); if (idName) { const char *name = element->Attribute("name"); if (!strcmp(idName, entryName)) { return wmc->char2wchar(name, _nativeLangEncoding); } } } return TEXT(""); }
void TiXmlDocumentA::StreamOut( TIXMLA_OSTREAM * out ) const { TiXmlNodeA* node; for ( node=FirstChild(); node; node=node->NextSibling() ) { node->StreamOut( out ); // Special rule for streams: stop after the root element. // The stream in code will only read one element, so don't // write more than one. if ( node->ToElement() ) break; } }
TiXmlNodeA* TiXmlDocumentA::Clone() const { TiXmlDocumentA* clone = new TiXmlDocumentA(); if ( !clone ) return 0; CopyToClone( clone ); clone->error = error; clone->errorDesc = errorDesc.c_str (); for ( TiXmlNodeA* node = firstChild; node; node = node->NextSibling() ) { clone->LinkEndChild( node->Clone() ); } return clone; }
void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg) { if (_nativeLangA) { TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog"); if (dlgNode) { NppParameters *pNppParam = NppParameters::getInstance(); dlgNode = searchDlgNode(dlgNode, "Find"); if (dlgNode) { const char *titre1 = (dlgNode->ToElement())->Attribute("titleFind"); const char *titre2 = (dlgNode->ToElement())->Attribute("titleReplace"); const char *titre3 = (dlgNode->ToElement())->Attribute("titleFindInFiles"); const char *titre4 = (dlgNode->ToElement())->Attribute("titleMark"); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); if (titre1 && titre1[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding); pNppParam->getFindDlgTabTitiles()._find = nameW; findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str()); } if (titre2 && titre2[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding); pNppParam->getFindDlgTabTitiles()._replace = nameW; findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str()); } if (titre3 && titre3[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding); pNppParam->getFindDlgTabTitiles()._findInFiles = nameW; findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str()); } if (titre4 && titre4[0]) { basic_string<wchar_t> nameW = wmc->char2wchar(titre4, _nativeLangEncoding); pNppParam->getFindDlgTabTitiles()._mark = nameW; findReplaceDlg.changeTabName(MARK_DLG, pNppParam->getFindDlgTabTitiles()._mark.c_str()); } } } } changeDlgLang(findReplaceDlg.getHSelf(), "Find"); }
generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const { if (!_nativeLangA) return TEXT(""); TiXmlNodeA *node = _nativeLangA->FirstChild("Menu"); if (!node) return TEXT(""); node = node->FirstChild("Main"); if (!node) return TEXT(""); node = node->FirstChild("Commands"); if (!node) return TEXT(""); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); for (TiXmlNodeA *childNode = node->FirstChildElement("Item"); childNode ; childNode = childNode->NextSibling("Item") ) { TiXmlElementA *element = childNode->ToElement(); int id; if (element->Attribute("id", &id) && (id == itemID)) { const char *name = element->Attribute("name"); if (name) { return wmc->char2wchar(name, _nativeLangEncoding); } } } return TEXT(""); }
generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name) const { if (!_nativeLangA) return defaultStr; TiXmlNodeA *targetNode = _nativeLangA->FirstChild(nodeL1Name); if (!targetNode) return defaultStr; if (nodeL2Name) targetNode = targetNode->FirstChild(nodeL2Name); if (!targetNode) return defaultStr; const char *name = (targetNode->ToElement())->Attribute("name"); if (name && name[0]) { WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); return wmc->char2wchar(name, _nativeLangEncoding); } return defaultStr; }
bool WindowsDlg::changeDlgLang() { if (!_dlgNode) return false; WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); int nativeLangEncoding = CP_ACP; TiXmlDeclarationA *declaration = _dlgNode->GetDocument()->FirstChild()->ToDeclaration(); if (declaration) { const char * encodingStr = declaration->Encoding(); EncodingMapper *em = EncodingMapper::getInstance(); nativeLangEncoding = em->getEncodingFromString(encodingStr); } // Set Title const char *titre = (_dlgNode->ToElement())->Attribute("title"); if (titre && titre[0]) { const wchar_t *nameW = wmc->char2wchar(titre, nativeLangEncoding); ::SetWindowText(_hSelf, nameW); } // Set the text of child control for (TiXmlNodeA *childNode = _dlgNode->FirstChildElement("Item"); childNode ; childNode = childNode->NextSibling("Item") ) { TiXmlElementA *element = childNode->ToElement(); int id; const char *sentinel = element->Attribute("id", &id); const char *name = element->Attribute("name"); if (sentinel && (name && name[0])) { HWND hItem = ::GetDlgItem(_hSelf, id); if (hItem) { const wchar_t *nameW = wmc->char2wchar(name, nativeLangEncoding); ::SetWindowText(hItem, nameW); } } } return true; }
generic_string NativeLangSpeaker::getFileBrowserLangMenuStr(int cmdID, const TCHAR *defaultStr) const { if (!_nativeLangA) return defaultStr; TiXmlNodeA *targetNode = _nativeLangA->FirstChild("FolderAsWorkspace"); if (!targetNode) return defaultStr; targetNode = targetNode->FirstChild("Menus"); if (!targetNode) return defaultStr; const char *name = NULL; for (TiXmlNodeA *childNode = targetNode->FirstChildElement("Item"); childNode; childNode = childNode->NextSibling("Item")) { TiXmlElementA *element = childNode->ToElement(); int id; const char *idStr = element->Attribute("id", &id); if (idStr && id == cmdID) { name = element->Attribute("name"); break; } } if (name && name[0]) { WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); return wmc->char2wchar(name, _nativeLangEncoding); } return defaultStr; }
void NativeLangSpeaker::changeShortcutmapperLang(ShortcutMapper * sm) { if (!_nativeLangA) return; TiXmlNodeA *shortcuts = _nativeLangA->FirstChild("Dialog"); if (!shortcuts) return; shortcuts = shortcuts->FirstChild("ShortcutMapper"); if (!shortcuts) return; for (TiXmlNodeA *childNode = shortcuts->FirstChildElement("Item"); childNode ; childNode = childNode->NextSibling("Item") ) { TiXmlElementA *element = childNode->ToElement(); int index; if (element->Attribute("index", &index)) { if (index > -1 && index < 5) //valid index only { const char *name = element->Attribute("name"); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const wchar_t * nameW = wmc->char2wchar(name, _nativeLangEncoding); sm->translateTab(index, nameW); } } } }
generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const { if (not _nativeLangA) return defaultString; if (not strID) return defaultString; TiXmlNodeA *node = _nativeLangA->FirstChild("MiscStrings"); if (not node) return defaultString; node = node->FirstChild(strID); if (not node) return defaultString; TiXmlElementA *element = node->ToElement(); const char *value = element->Attribute("value"); if (not value) return defaultString; WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); return wmc->char2wchar(value, _nativeLangEncoding); }
TiXmlNodeA* TiXmlElementA::Clone() const { TiXmlElementA* clone = new TiXmlElementA( Value() ); if ( !clone ) return 0; CopyToClone( clone ); // Clone the attributes, then clone the children. for(TiXmlAttributeA* attribute = attributeSet.First(); attribute; attribute = attribute->Next() ) { clone->SetAttribute( attribute->Name(), attribute->Value() ); } for ( TiXmlNodeA* node = firstChild; node; node = node->NextSibling() ) { clone->LinkEndChild( node->Clone() ); } return clone; }
generic_string NativeLangSpeaker::getProjectPanelLangStr(const char *nodeName, const TCHAR *defaultStr) const { if (!_nativeLangA) return defaultStr; TiXmlNodeA *targetNode = _nativeLangA->FirstChild("ProjectManager"); if (!targetNode) return defaultStr; targetNode = targetNode->FirstChild(nodeName); if (!targetNode) return defaultStr; // Set Title const char *name = (targetNode->ToElement())->Attribute("name"); if (name && name[0]) { #ifdef UNICODE WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); return wmc->char2wchar(name, _nativeLangEncoding); #else return name; #endif } return defaultStr; }
void NativeLangSpeaker::changeUserDefineLangPopupDlg(HWND hDlg) { if (!_nativeLangA) return; TiXmlNodeA *userDefineDlgNode = _nativeLangA->FirstChild("Dialog"); if (!userDefineDlgNode) return; userDefineDlgNode = userDefineDlgNode->FirstChild("UserDefine"); if (!userDefineDlgNode) return; WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); TiXmlNodeA *stylerDialogNode = userDefineDlgNode->FirstChild("StylerDialog"); if (!stylerDialogNode) return; const char *titre = (stylerDialogNode->ToElement())->Attribute("title"); if (titre &&titre[0]) { const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); ::SetWindowText(hDlg, nameW); } for (TiXmlNodeA *childNode = stylerDialogNode->FirstChildElement("Item"); childNode ; childNode = childNode->NextSibling("Item") ) { TiXmlElementA *element = childNode->ToElement(); int id; const char *sentinel = element->Attribute("id", &id); const char *name = element->Attribute("name"); if (sentinel && (name && name[0])) { HWND hItem = ::GetDlgItem(hDlg, id); if (hItem) { const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); ::SetWindowText(hItem, nameW); } } } }
bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *title) { if (title) title[0] = '\0'; if (!_nativeLangA) return false; TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog"); if (!dlgNode) return false; dlgNode = searchDlgNode(dlgNode, dlgTagName); if (!dlgNode) return false; #ifdef UNICODE WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); #endif // Set Title const char *titre = (dlgNode->ToElement())->Attribute("title"); if ((titre && titre[0]) && hDlg) { #ifdef UNICODE const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); ::SetWindowText(hDlg, nameW); #else ::SetWindowText(hDlg, titre); #endif if (title) strcpy(title, titre); } // Set the text of child control for (TiXmlNodeA *childNode = dlgNode->FirstChildElement("Item"); childNode ; childNode = childNode->NextSibling("Item") ) { TiXmlElementA *element = childNode->ToElement(); int id; const char *sentinel = element->Attribute("id", &id); const char *name = element->Attribute("name"); if (sentinel && (name && name[0])) { HWND hItem = ::GetDlgItem(hDlg, id); if (hItem) { #ifdef UNICODE const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); ::SetWindowText(hItem, nameW); #else ::SetWindowText(hItem, name); #endif } } } return true; }
void NativeLangSpeaker::changeLangTabDrapContextMenu(HMENU hCM) { const int POS_GO2VIEW = 0; const int POS_CLONE2VIEW = 1; const char *goToViewA = NULL; const char *cloneToViewA = NULL; if (_nativeLangA) { TiXmlNodeA *tabBarMenu = _nativeLangA->FirstChild("Menu"); if (tabBarMenu) tabBarMenu = tabBarMenu->FirstChild("TabBar"); if (tabBarMenu) { for (TiXmlNodeA *childNode = tabBarMenu->FirstChildElement("Item"); childNode ; childNode = childNode->NextSibling("Item") ) { TiXmlElementA *element = childNode->ToElement(); int ordre; element->Attribute("order", &ordre); if (ordre == 5) goToViewA = element->Attribute("name"); else if (ordre == 6) cloneToViewA = element->Attribute("name"); } } //HMENU hCM = _tabPopupDropMenu.getMenuHandle(); #ifdef UNICODE WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); if (goToViewA && goToViewA[0]) { const wchar_t *goToViewG = wmc->char2wchar(goToViewA, _nativeLangEncoding); int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW); ::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION|MF_STRING, cmdID, goToViewG); } if (cloneToViewA && cloneToViewA[0]) { const wchar_t *cloneToViewG = wmc->char2wchar(cloneToViewA, _nativeLangEncoding); int cmdID = ::GetMenuItemID(hCM, POS_CLONE2VIEW); ::ModifyMenu(hCM, POS_CLONE2VIEW, MF_BYPOSITION|MF_STRING, cmdID, cloneToViewG); } #else if (goToViewA && goToViewA[0]) { int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW); ::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION, cmdID, goToViewA); } if (cloneToViewA && cloneToViewA[0]) { int cmdID = ::GetMenuItemID(hCM, POS_CLONE2VIEW); ::ModifyMenu(hCM, POS_CLONE2VIEW, MF_BYPOSITION, cmdID, cloneToViewA); } #endif } }