// our application-specific read function HFileInputResult HSolidModel::Read(const wchar_t * FileName, HBaseView * pHView, bool clean_include, HInputHandlerOptions * options) { // This process is going to take sometime, convey that to the user CWaitCursor show_hourglass_cursor_through_this_function; HFileInputResult success = InputOK; wchar_t extension[64]; wchar_t const * ext = wcsrchr(FileName, L'.'); if(!ext) return InputBadFileName; ++ext; //move one past the dot; // in case we have a Pro/E file which ends with a number, e.g., *.prt.1 or *.xas.1 bool good_filename = true; wchar_t *filename_copy = 0; if ( good_filename && ext[0] >= L'0' && ext[0] <= L'9' ) { if (filename_copy == 0) { int original_filename_len = (int)wcslen(FileName); filename_copy = new wchar_t [original_filename_len + 1]; swprintf(filename_copy, original_filename_len, L"%ls", FileName); filename_copy[original_filename_len] = '\0'; } wchar_t *bad_ext = wcsrchr(filename_copy, L'.'); bad_ext[0] = '\0'; ext = wcsrchr(filename_copy, L'.'); if (!ext) good_filename = false; else ext++; } if (ext) swprintf(extension, 64, L"%ls", ext); if (filename_copy) delete [] filename_copy; if (!good_filename) return InputBadFileName; HC_Open_Segment_By_Key(GetModelKey()); // we should maybe read ach file into it's own subsegment of the main model segment // however I am keeping with reading it into the modelkey directly so that reading // and writing out a file doesn't result in nesting occuring. Gavin #ifdef INTEROP if (wcsieq(extension, L"catpart") || wcsieq(extension, L"catproduct") || wcsieq(extension, L"cgr") || wcsieq(extension, L"model") || wcsieq(extension, L"session") || wcsieq(extension, L"exp") || wcsieq(extension, L"prt") || wcsieq(extension, L"xpr") || wcsieq(extension, L"asm") || wcsieq(extension, L"xas") || wcsieq(extension, L"igs") || wcsieq(extension, L"iges") || wcsieq(extension, L"stp") || wcsieq(extension, L"step") || wcsieq(extension, L"vda") || wcsieq(extension, L"sldprt") || wcsieq(extension, L"sldasm") || wcsieq(extension, L"ipt") || wcsieq(extension, L"iam") #ifdef ACIS || wcsieq(extension, L"x_t") || wcsieq(extension, L"x_b") #endif // ACIS ) { m_bSolidModel = true; m_bSolidData = true; SetBRepGeometry(true); SetModelHandedness(HandednessSetLeft); #ifdef ACIS DELTA_STATE *ds; outcome o = api_note_state(ds); CHECK_OUTCOME(o); #endif // ACIS success = iop_fio->Import(FileName, extension, (HBaseView *)pHView); #ifdef ACIS o = api_note_state(ds); CHECK_OUTCOME(o); SetHistoryStream(); o = api_note_state(ds); CHECK_OUTCOME(o); #endif // ACIS } #endif // INTEROP #ifdef ACIS #ifdef INTEROP else #endif // INTEROP if (!wcsnicmp(extension, L"sat", wcslen(L"sat"))) { ENTITY_LIST elist; ENTITY* entity; m_bSolidModel = true; m_bSolidData = true; SetBRepGeometry(true); SetModelHandedness(HandednessSetLeft); logical read_sat_result = HA_Read_Sat_File(H_ASCII_TEXT(FileName), elist); // read an SAT file if( read_sat_result == FALSE ) { AfxMessageBox(_T("Failed to read SAT file. The file may be corrupt or from later version of ACIS.")); success = InputFail; } elist.init(); // set next() function to return first element in "list" while (entity = elist.next()) { m_entityList.add(entity); } } else if( !wcsnicmp(extension, L"asat", wcslen(L"asat")) ) { m_bSolidModel = true; m_bSolidData = true; SetBRepGeometry(true); SetModelHandedness(HandednessSetLeft); logical read_asat_result = HA_Read_Asat_File(H_ASCII_TEXT(FileName), m_modelList); if( read_asat_result == FALSE ) { AfxMessageBox(_T("Failed to read ASAT file. The file may be corrupt or from later version of ACIS.")); success = InputFail; } else { // render the entities m_modelList.init(); asm_model* this_model = m_modelList.next(); while (this_model) { MODEL_BEGIN(this_model) HA_Render_Model(this_model, "entity"); this_model->get_top_level_entities(m_entityList, TRUE); HA_Render_Entities(m_entityList); MODEL_END(ASM_NO_CHANGE) this_model = m_modelList.next(); } } } #endif // ACIS #ifdef HOOPS_ONLY if( wcsieq(extension, L"") ) { AfxMessageBox(_T("Failed to read file. Unrecognized file extension.")); } #endif // HOOPS_ONLY else { // we don't know what extensions the base class is capable of handling // let it try and read the file whatever the extension might be //#ifndef HOOPS_ONLY // if (wcsieq(extension, _T(KERN_STREAM_FILE))) // m_bSolidModel = true; // else //#endif m_bSolidModel = true; SetBRepGeometry(false); if (wcsieq(extension, L"dwg") || wcsieq(extension, L"dxf")|| wcsieq(extension, L"dgn")) { //HInputHandlerOptions options; //wchar_t * p_dwg_textures_dir = 0; //if(CAppSettings::DWGTextureDirectory.IsEmpty() == FALSE) //{ // H_WCS wcs(CAppSettings::DWGTextureDirectory); // p_dwg_textures_dir = wcsdup(wcs.encodedText()); //} //options.m_pHBaseView = view; //options.m_pExtendedData = (void*) p_dwg_textures_dir; //options.m_bInputViaHSF = CAppSettings::bImportDWGviaBstream; //options.m_Deviation = atof(H_ASCII_TEXT(CAppSettings::DWGDeviation)); //options.m_bImportMetadata = CAppSettings::bImportDWGXData; //options.m_bMergeEntityShells = true; //options.m_bImportAllLayouts = CAppSettings::bImportAllLayouts; ////For DGN //options.m_bIgnoreOffLayer = CAppSettings::bIgnoreInvisibleLayers; //options.m_bIgnoreOffEntity = CAppSettings::bIgnoreInvisibleEntity; //options.m_coneFactor = atof(H_ASCII_TEXT(CAppSettings::DGNFactorForCone)); //options.m_factorForSmartSolids = atof(H_ASCII_TEXT(CAppSettings::DGNFactorForSmartSolids )); //success = HBaseModel::Read(FileName, 0, true, &options); //if(p_dwg_textures_dir) // free(p_dwg_textures_dir); } else { //HInputHandlerOptions opt; //// PRC options //opt.m_pPRCPMIConnector = m_pPMIConnector; //opt.m_pPRCTopologyManager = m_TopologyManager; //opt.m_bPRCMergeFaces = !CAppSettings::bPrcFaceEdgeVertexSelectability; //opt.m_pPRCMultiModelSelectionCallback = MultiModelSelectionCallback; //// Other options //opt.m_pConnector = m_pConnector; //opt.m_tk = GetStreamFileTK(); //opt.m_pHBaseView = view; //opt.m_bImportMetadata = CAppSettings::bImportDWGXData;; success = HBaseModel::Read(FileName/*, view, true, &opt*/); /*m_pPRCAsmModelFile = opt.m_pPRCAsmModelFile; HObjectManager::FileLoadHObjectCheck(GetModelKey()); if (opt.m_bPRCWrongVersion) { MessageBox(0, H_TEXT(L"PRC Import requires functionality that is not available in your version of Acrobat.\nPlease update to the latest version of Acrobat to view this file."), _T("ERROR!"), MB_OK); success = InputOK; }*/ } } // update the polygon handedness for this model //UpdateModelHandedness(); HC_Close_Segment(); #if 0 if( m_bSolidModel ) GenerateLODsForBodies(); #endif return success; }
int test_implicit_compare_with_functions() { if (memcmp(A, "a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'memcmp' is called without explicitly comparing result // CHECK-FIXES: memcmp(A, "a", 1) != 0) if (wmemcmp(W, L"a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wmemcmp' is called without explicitly comparing result // CHECK-FIXES: wmemcmp(W, L"a", 1) != 0) if (memicmp(A, "a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'memicmp' is called without explicitly comparing result // CHECK-FIXES: memicmp(A, "a", 1) != 0) if (_memicmp(A, "a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_memicmp' is called without explicitly comparing result // CHECK-FIXES: _memicmp(A, "a", 1) != 0) if (_memicmp_l(A, "a", 1, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_memicmp_l' is called without explicitly comparing result // CHECK-FIXES: _memicmp_l(A, "a", 1, locale) != 0) if (strcmp(A, "a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strcmp' is called without explicitly comparing result // CHECK-FIXES: strcmp(A, "a") != 0) if (strncmp(A, "a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strncmp' is called without explicitly comparing result // CHECK-FIXES: strncmp(A, "a", 1) != 0) if (strcasecmp(A, "a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strcasecmp' is called without explicitly comparing result // CHECK-FIXES: strcasecmp(A, "a") != 0) if (strncasecmp(A, "a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strncasecmp' is called without explicitly comparing result // CHECK-FIXES: strncasecmp(A, "a", 1) != 0) if (stricmp(A, "a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'stricmp' is called without explicitly comparing result // CHECK-FIXES: stricmp(A, "a") != 0) if (strcmpi(A, "a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strcmpi' is called without explicitly comparing result // CHECK-FIXES: strcmpi(A, "a") != 0) if (_stricmp(A, "a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_stricmp' is called without explicitly comparing result // CHECK-FIXES: _stricmp(A, "a") != 0) if (strnicmp(A, "a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strnicmp' is called without explicitly comparing result // CHECK-FIXES: strnicmp(A, "a", 1) != 0) if (_strnicmp(A, "a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_strnicmp' is called without explicitly comparing result // CHECK-FIXES: _strnicmp(A, "a", 1) != 0) if (_stricmp_l(A, "a", locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_stricmp_l' is called without explicitly comparing result // CHECK-FIXES: _stricmp_l(A, "a", locale) != 0) if (_strnicmp_l(A, "a", 1, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_strnicmp_l' is called without explicitly comparing result // CHECK-FIXES: _strnicmp_l(A, "a", 1, locale) != 0) if (wcscmp(W, L"a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcscmp' is called without explicitly comparing result // CHECK-FIXES: wcscmp(W, L"a") != 0) if (wcsncmp(W, L"a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcsncmp' is called without explicitly comparing result // CHECK-FIXES: wcsncmp(W, L"a", 1) != 0) if (wcscasecmp(W, L"a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcscasecmp' is called without explicitly comparing result // CHECK-FIXES: wcscasecmp(W, L"a") != 0) if (wcsicmp(W, L"a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcsicmp' is called without explicitly comparing result // CHECK-FIXES: wcsicmp(W, L"a") != 0) if (_wcsicmp(W, L"a")) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_wcsicmp' is called without explicitly comparing result // CHECK-FIXES: _wcsicmp(W, L"a") != 0) if (_wcsicmp_l(W, L"a", locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_wcsicmp_l' is called without explicitly comparing result // CHECK-FIXES: _wcsicmp_l(W, L"a", locale) != 0) if (wcsnicmp(W, L"a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'wcsnicmp' is called without explicitly comparing result // CHECK-FIXES: wcsnicmp(W, L"a", 1) != 0) if (_wcsnicmp(W, L"a", 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_wcsnicmp' is called without explicitly comparing result // CHECK-FIXES: _wcsnicmp(W, L"a", 1) != 0) if (_wcsnicmp_l(W, L"a", 1, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_wcsnicmp_l' is called without explicitly comparing result // CHECK-FIXES: _wcsnicmp_l(W, L"a", 1, locale) != 0) if (_mbscmp(U, V)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbscmp' is called without explicitly comparing result // CHECK-FIXES: _mbscmp(U, V) != 0) if (_mbsncmp(U, V, 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsncmp' is called without explicitly comparing result // CHECK-FIXES: _mbsncmp(U, V, 1) != 0) if (_mbsnbcmp(U, V, 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsnbcmp' is called without explicitly comparing result // CHECK-FIXES: _mbsnbcmp(U, V, 1) != 0) if (_mbsnbicmp(U, V, 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsnbicmp' is called without explicitly comparing result // CHECK-FIXES: _mbsnbicmp(U, V, 1) != 0) if (_mbsicmp(U, V)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsicmp' is called without explicitly comparing result // CHECK-FIXES: _mbsicmp(U, V) != 0) if (_mbsnicmp(U, V, 1)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsnicmp' is called without explicitly comparing result // CHECK-FIXES: _mbsnicmp(U, V, 1) != 0) if (_mbscmp_l(U, V, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbscmp_l' is called without explicitly comparing result // CHECK-FIXES: _mbscmp_l(U, V, locale) != 0) if (_mbsncmp_l(U, V, 1, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsncmp_l' is called without explicitly comparing result // CHECK-FIXES: _mbsncmp_l(U, V, 1, locale) != 0) if (_mbsicmp_l(U, V, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsicmp_l' is called without explicitly comparing result // CHECK-FIXES: _mbsicmp_l(U, V, locale) != 0) if (_mbsnicmp_l(U, V, 1, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsnicmp_l' is called without explicitly comparing result // CHECK-FIXES: _mbsnicmp_l(U, V, 1, locale) != 0) if (_mbsnbcmp_l(U, V, 1, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsnbcmp_l' is called without explicitly comparing result // CHECK-FIXES: _mbsnbcmp_l(U, V, 1, locale) != 0) if (_mbsnbicmp_l(U, V, 1, locale)) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function '_mbsnbicmp_l' is called without explicitly comparing result // CHECK-FIXES: _mbsnbicmp_l(U, V, 1, locale) != 0) return 1; }
TextToken* TextToken::tokenizeMath(const wchar_t *text) { TextToken *firstToken = NULL, *lastToken = NULL, *mathToken = NULL; static bool mathModInitialized = false; static wchar_t *mathTagName[] = {NULL, NULL}; static int mathTagLen[] = {0, 0}; int i; if (!mathModInitialized) { if (ServiceExists(MATH_GET_PARAMS)) { char* mthDelStart = (char *)CallService(MATH_GET_PARAMS, (WPARAM)MATH_PARAM_STARTDELIMITER, 0); char* mthDelEnd = (char *)CallService(MATH_GET_PARAMS, (WPARAM)MATH_PARAM_ENDDELIMITER, 0); if (mthDelStart!=NULL) { mathTagName[0] = Utils::convertToWCS(mthDelStart); mathTagLen[0] = wcslen(mathTagName[0]); } if (mthDelEnd!=NULL) { mathTagName[1] = Utils::convertToWCS(mthDelEnd); mathTagLen[1] = wcslen(mathTagName[1]); } CallService(MTH_FREE_MATH_BUFFER,0, (LPARAM) mthDelStart); CallService(MTH_FREE_MATH_BUFFER,0, (LPARAM) mthDelEnd); } mathModInitialized = true; } int textLen = 0; int l = wcslen(text); if (mathTagName[0] != NULL && mathTagName[1] != NULL) { for (i=0; i<=l;) { int k, tagDataStart=0, newTokenType = 0, newTokenSize = 0; bool mathFound = false; if (!wcsnicmp(text+i, mathTagName[0], mathTagLen[0])) { k = tagDataStart = i + mathTagLen[0]; for (; k < l; k++) { if (!wcsnicmp(text+k, mathTagName[1], mathTagLen[1])) { k += mathTagLen[1]; mathFound = true; break; } } } if (mathFound) { mathToken = new TextToken(MATH, text + tagDataStart, k - mathTagLen[1] - tagDataStart); char* mathPath=(char*)CallService(MTH_GET_GIF_UNICODE, 0, (LPARAM) mathToken->getTextW()); if (mathPath!=NULL) { mathToken->setLink(mathPath); CallService(MTH_FREE_GIFPATH, 0, (LPARAM) mathPath); } else { mathToken->setLink(""); } mathToken->setEnd(false); newTokenType = MATH; newTokenSize = k - i; } else { if (i==l) { newTokenType = END; newTokenSize = 1; } else { newTokenType = TEXT; newTokenSize = 1; } } if (newTokenType != TEXT) { if (textLen >0 ) { TextToken *newToken = new TextToken(TEXT, text+i-textLen, textLen); textLen = 0; if (lastToken == NULL) { firstToken = newToken; } else { lastToken->setNext(newToken); } lastToken = newToken; } if (newTokenType == MATH) { if (lastToken == NULL) { firstToken = mathToken; } else { lastToken->setNext(mathToken); } lastToken = mathToken; } } else { textLen += newTokenSize; } i += newTokenSize; } } return firstToken; }
TextToken* TextToken::tokenizeBBCodes(const wchar_t *text, int l) { static wchar_t *bbTagName[] = {L"b", L"i", L"u", L"img", L"color", L"size"}; static int bbTagNameLen[] = {1, 1, 1, 3, 5, 4}; static int bbTagArg[] = {0, 0, 0, 0, 1, 1}; static int bbTagId[] = {BB_B, BB_I, BB_U, BB_IMG, BB_COLOR, BB_SIZE}; static int bbTagEnd[6]; static int bbTagCount[6]; int i,j; TextToken *firstToken = NULL, *lastToken = NULL, * bbToken = NULL; int textLen = 0; for (j = 0; j < 6; j++) { bbTagCount[j] = 0; bbTagEnd[j] = 0; } for (i = 0; i <= l;) { int k, tagArgStart=0, tagArgEnd=0, tagDataStart=0, newTokenType = 0, newTokenSize = 0; bool bbFound = false; if (text[i] == '[') { if (text[i+1] != '/') { for (j = 0; j < 6; j++) { k = i + 1; if (!wcsnicmp(text+k, bbTagName[j], bbTagNameLen[j])) { tagArgStart = tagArgEnd = 0; k += bbTagNameLen[j]; if (bbTagArg[j]) { if (text[k] != '=') continue; k++; tagArgStart = k; for (; text[k]!='\0'; k++) { if ((text[k]>='0' && text[k]<='9') || (text[k]>='A' && text[k]<='Z') || (text[k]>='a' && text[k]<='z') || (text[k]=='#')) continue; break; } tagArgEnd = k; } if (text[k] == ']') { k++; tagDataStart = k; if (k < bbTagEnd[j]) k = bbTagEnd[j]; for (; k < l; k++) { if (text[k] == '[' && text[k+1] == '/') { k += 2; if (!wcsnicmp(text+k, bbTagName[j], bbTagNameLen[j])) { k += bbTagNameLen[j]; if (text[k] == ']') { k++; bbFound = true; break; } } } } if (bbFound) break; } } } if (bbFound) { bbTagEnd[j] = k; switch (bbTagId[j]) { case BB_B: case BB_I: case BB_U: case BB_COLOR: case BB_SIZE: bbTagCount[j]++; if (bbTagArg[j]) { bbToken = new TextToken(BBCODE, text + tagArgStart, tagArgEnd - tagArgStart); } else { bbToken = new TextToken(BBCODE, bbTagName[j], bbTagNameLen[j]); } bbToken->setEnd(false); bbToken->setTag(bbTagId[j]); newTokenType = BBCODE; newTokenSize = tagDataStart - i; break; case BB_IMG: bbToken = new TextToken(BBCODE, text + tagDataStart, k - 6 - tagDataStart); bbToken->setTag(bbTagId[j]); bbToken->setEnd(false); newTokenType = BBCODE; newTokenSize = k - i; break; } } } else { for (j = 0; j < 6; j++) { k = i + 2; if (bbTagCount[j]>0 && !wcsnicmp(text+k, bbTagName[j], bbTagNameLen[j])) { k += bbTagNameLen[j]; if (text[k] == ']') { k++; bbFound = true; break; } } } if (bbFound) { bbTagCount[j]--; bbToken = new TextToken(BBCODE, bbTagName[j], bbTagNameLen[j]); bbToken->setEnd(true); bbToken->setTag(bbTagId[j]); newTokenType = BBCODE; newTokenSize = k - i; } } } if (!bbFound) { if (i==l) { newTokenType = END; newTokenSize = 1; } else { newTokenType = TEXT; newTokenSize = 1; } } if (newTokenType != TEXT) { if (textLen >0 ) { TextToken *newToken = new TextToken(TEXT, text+i-textLen, textLen); textLen = 0; if (lastToken == NULL) { firstToken = newToken; } else { lastToken->setNext(newToken); } lastToken = newToken; } if (newTokenType == BBCODE) { if (lastToken == NULL) { firstToken = bbToken; } else { lastToken->setNext(bbToken); } lastToken = bbToken; } } else { textLen += newTokenSize; } i += newTokenSize; } return firstToken; }
/** * \author Darryn Campbell (DCC, JRQ768) * \date October 2009 */ LRESULT CIEBrowserEngine::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lResult = S_OK; switch (uMsg) { case WM_NOTIFY: { // Received a message from the Pocket Internet Explorer component // to indicate something has happened (BeforeNavigate / DocumentComplete etc). // The lParam contains an NM_HTMLVIEWW containing information about // the event, parse it. NM_HTMLVIEWW * pnmHTML; LPNMHDR pnmh; pnmHTML = (NM_HTMLVIEWW *) lParam; pnmh = (LPNMHDR) &(pnmHTML->hdr); // The message has originated from one of the tabs we created, determine // the tab ID from the hwnd //IETab* tab = GetSpecificTab(hwndParentOfOriginator); CIEBrowserEngine* mobileTab = CIEBrowserEngine::getInstance(); // Invoke the appropriate tab with the event. The data will vary // depending on which event has been received TCHAR tcTarget[MAX_URL + 1]; memset (tcTarget, 0, sizeof(TCHAR) * MAX_URL + 1); switch (pnmh->code) { case NM_PIE_TITLE: // The Page Title has been received from the Page, convert // the content to a wide string if (pnmHTML->szTarget) mbstowcs(tcTarget, (LPSTR)pnmHTML->szTarget, MAX_URL); if (tcTarget) mobileTab->InvokeEngineEventTitleChange(tcTarget); break; case NM_PIE_META: // A Meta Tag has been received from the Page, convert the content // and data to wide strings. if (pnmHTML->szTarget) mbstowcs(tcTarget, (LPSTR)pnmHTML->szTarget, MAX_URL); TCHAR tcData[MAX_URL+1]; memset(tcData, 0, sizeof(TCHAR) * MAX_URL + 1); if (pnmHTML->szData) mbstowcs(tcData, (LPSTR)pnmHTML->szData, MAX_URL); // If there is both an HTTP Equiv and some Content to the Meta // tag then invoke it if (tcTarget && tcData) mobileTab->InvokeEngineEventMetaTag(tcTarget, tcData); break; case NM_PIE_BEFORENAVIGATE: if (pnmHTML->szTarget) mbstowcs(tcTarget, (LPSTR)pnmHTML->szTarget, MAX_URL); // GD - stop navigation if target starts with file:// and ends with '\'. // This is the generated target when using <a href=""> from a local page. // If we don't stop it then the File Explorer is launched. if (wcslen (tcTarget) >= 8) if (!wcsnicmp (tcTarget, L"file://", 7)) if (tcTarget [wcslen (tcTarget) - 1] == '\\') { LOG(TRACE) + "Navigation to file folder aborted\n"; return S_FALSE; } if (tcTarget) mobileTab->InvokeEngineEventLoad(tcTarget, EEID_BEFORENAVIGATE); break; case NM_PIE_DOCUMENTCOMPLETE: if (pnmHTML->szTarget) mbstowcs(tcTarget, (LPSTR)pnmHTML->szTarget, MAX_URL); // If the network is available but the server being reached // is inaccessible the browser component appears to immediately // give a document complete with the current page URL (not the // page being navigated to) which is hiding the hourglass, // stop this behaviour. if (tcTarget && !wcsicmp(tcTarget, mobileTab->m_tcNavigatedURL)) mobileTab->InvokeEngineEventLoad(tcTarget, EEID_DOCUMENTCOMPLETE); break; case NM_PIE_NAVIGATECOMPLETE: if (pnmHTML->szTarget) mbstowcs(tcTarget, (LPSTR)pnmHTML->szTarget, MAX_URL); if (tcTarget) mobileTab->InvokeEngineEventLoad(tcTarget, EEID_NAVIGATECOMPLETE); break; case NM_PIE_KEYSTATE: case NM_PIE_ALPHAKEYSTATE: // Not Used break; } } lResult = DefWindowProc(hwnd, uMsg, wParam, lParam); } return lResult; }