static void SelectNext(HWND hWnd,WPARAM wParam) { Edtmp = GetFocusChild(hWnd); if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN) { if (Edtmp ==btndelall) { if(nofp) { if(nopwd) { if(noface) { if (nohid) { if (nophoto) focuswnd = btnexit2; else focuswnd = btndelphoto; } else focuswnd = btndelhid; } else { focuswnd = btndelface; } } else focuswnd = btndelpwd; } else focuswnd = btndelfp; } else if (Edtmp == btndelfp) { if (nopwd) { if(noface) { if(nohid) { if (nophoto) focuswnd = btnexit2; else focuswnd = btndelphoto; } else focuswnd = btndelhid; } else { focuswnd = btndelface; } } else focuswnd = btndelpwd; } else if (Edtmp == btndelpwd) { if(noface) { if(nohid) { if (nophoto) focuswnd = btnexit2; else focuswnd = btndelphoto; } else focuswnd = btndelhid; } else { focuswnd = btndelface; } } else if (Edtmp == btndelface) { if(nohid) { if(nophoto) { focuswnd = btnexit2; } else { focuswnd = btndelphoto; } } else { focuswnd = btndelhid; } } else if (Edtmp == btndelhid) { if (nophoto) focuswnd = btnexit2; else focuswnd = btndelphoto; } else if (Edtmp == btndelphoto) focuswnd = btnexit2; else if (Edtmp == btnexit2) focuswnd = btndelall; SetFocusChild(focuswnd); } if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP) { if (Edtmp == btndelall) focuswnd = btnexit2; else if (Edtmp == btndelfp) focuswnd = btndelall; else if (Edtmp == btndelpwd) { if (nofp) focuswnd = btndelall; else focuswnd=btndelfp; } else if(Edtmp == btndelface) { if(nopwd) { if (nofp) { focuswnd = btndelall; } else { focuswnd = btndelfp; } } else { focuswnd = btndelpwd; } } else if (Edtmp == btnexit2) { if (nophoto) { if (nohid) { if(noface) { if (nopwd) { if (nofp) focuswnd = btndelall; else focuswnd=btndelfp; } else focuswnd = btndelpwd; } else { focuswnd = btndelface; } } else focuswnd = btndelhid; } else focuswnd = btndelphoto; } else if (Edtmp == btndelphoto) { if (nohid) { if(noface) { if (nopwd) { if (nofp) focuswnd = btndelall; else focuswnd=btndelfp; } else focuswnd = btndelpwd; } else { focuswnd = btndelface; } } else focuswnd = btndelhid; } else if(Edtmp == btndelhid) { if(noface) { if(nopwd) { if(nofp) focuswnd = btndelall; else focuswnd = btndelfp; } else focuswnd = btndelpwd; } else { focuswnd = btndelface; } } SetFocusChild(focuswnd); } }
static int WiFiPWDWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { HDC hdc; int nc, id; static char keyupFlag=0; switch (message) { case MSG_CREATE: InitWindow(hWnd); //add controls InitPWDSetting(); UpdateWindow(hWnd,TRUE); curCtlidx=0; SetFocusChild(WifiPWDWnd[curCtlidx]); break; case MSG_ERASEBKGND: { HDC hdc = (HDC)wParam; const RECT* clip = (const RECT*)lParam; BOOL fGetDC = FALSE; RECT rcTemp; if(hdc == 0) { hdc = GetClientDC(hWnd); fGetDC = TRUE; } if(clip) { rcTemp = *clip; ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top); ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom); IncludeClipRect(hdc, &rcTemp); } FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, 0, get_submenubg_jgp()); if(fGetDC) ReleaseDC (hdc); return 0; } case MSG_PAINT: hdc=BeginPaint(hWnd); EndPaint(hWnd,hdc); return 0; case MSG_KEYUP: if(3 == gOptions.TFTKeyLayout) { keyupFlag=1; } break; case MSG_KEYDOWN: SetMenuTimeOut(time(NULL)); if(3 == gOptions.TFTKeyLayout) { if(1==keyupFlag) keyupFlag=0; else break; } if (gOptions.KeyPadBeep) ExKeyBeep(); if ((LOWORD(wParam)==SCANCODE_ESCAPE)) { PostMessage(hWnd, MSG_COMMAND, WIFI_PWDEXIT, 0); } else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)) { if(hIMEWnd!=HWND_INVALID) { SendMessage(hIMEWnd,MSG_CLOSE,0,0L); hIMEWnd=HWND_INVALID; } SelectNext(wParam); return 0; } else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) || ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE)) { if(pwdmode==0) { if(curCtlidx==0 || curCtlidx==1) { int curidx = SendMessage(WifiPWDWnd[curCtlidx], CB_GETCURSEL, 0, 0); if(LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT || ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE)) { if(--curidx<0) curidx=3; } else if(LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) { if(++curidx>3) curidx=0; } SendMessage(WifiPWDWnd[curCtlidx], CB_SETCURSEL, curidx, 0); if(curCtlidx==0) { curpwdidx=curidx; RefreshPWDWindow(curpwdidx); } else { tmppwdmode[curpwdidx]=curidx; // SetWindowText(WifiPWDWnd[2+curpwdidx],""); SendMessage(WifiPWDWnd[2+curpwdidx], EM_LIMITTEXT, lenValue[curidx], 0L); } return 0; } else if((LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) &&(curCtlidx>=2 && curCtlidx<=5)&& gOptions.IMEFunOn==1&&gOptions.TFTKeyLayout==3) { T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0); //不支持中文输入 return 0; } else if(curCtlidx>=6 && curCtlidx<=7) { if(curCtlidx==6) curCtlidx=7; else curCtlidx=6; SetFocusChild(WifiPWDWnd[curCtlidx]); return 0; } } else { if(curCtlidx>=1 && curCtlidx<=2) { if(curCtlidx==1) curCtlidx=2; else curCtlidx=1; SetFocusChild(WifiPWDWnd[curCtlidx]); return 0; } else if((LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) && curCtlidx==0 && gOptions.IMEFunOn==1 && gOptions.TFTKeyLayout==3) { T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0); //不支持中文输入 } } } else if(LOWORD(wParam)==SCANCODE_ENTER) { if((pwdmode==0 && curCtlidx<6) || (pwdmode==1 && curCtlidx<1)) PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0L); } else if(LOWORD(wParam)==SCANCODE_F10) { if((pwdmode==0 && curCtlidx==7)||(pwdmode==1 && curCtlidx==2)) PostMessage(hWnd, MSG_COMMAND, WIFI_PWDEXIT, 0L); else PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0L); } else if(LOWORD(wParam)==SCANCODE_MENU) { PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0); } // else if (LOWORD(wParam) == gOptions.IMESwitchKey) else if((LOWORD(wParam)==SCANCODE_F9) || (LOWORD(wParam)==SCANCODE_F11 && (gOptions.TFTKeyLayout==0 || gOptions.TFTKeyLayout==4))) { if(((pwdmode==0 && curCtlidx>=2 && curCtlidx<=5) || (pwdmode==1 && curCtlidx==0)) && gOptions.IMEFunOn==1) T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0); //不支持中文输入 break; } break; //Liaozz 20080928 fix bug second 43 case MSG_CHAR: { char schar[255]; int slen; // printf("*************char=======l:%d,,,w:%d===\n",lParam, wParam); HWND Edtmp = GetFocusChild(hWnd); if(pwdmode==0) { curpwdidx=SendMessage(WifiPWDWnd[0], CB_GETCURSEL, 0, 0); //password index tmppwdmode[curpwdidx]=SendMessage(WifiPWDWnd[1], CB_GETCURSEL, 0, 0); //password type GetWindowText(WifiPWDWnd[2+curpwdidx], schar, 255); //password string slen=strlen(schar); //13:Enter; 27:ESC; 127:Backspace if(slen==lenValue[tmppwdmode[curpwdidx]] && Edtmp == WifiPWDWnd[2+curpwdidx] && wParam != 127 && wParam != 27 && wParam != 13) { ExBeep(1); } } else {//Liaozz 20081009 fix bug second 43 GetWindowText(WifiPWDWnd[0], schar, 255); int slen = strlen(schar); if (slen == 64 && Edtmp == WifiPWDWnd[0] && wParam != 127 && wParam != 27 && wParam != 13) ExBeep(1); } break; } //Liaozz end case MSG_COMMAND: id = LOWORD(wParam); nc = HIWORD(wParam); if(id==WIFI_PWDSAVE) { if(beModified()) { if(SaveWifiPWDSetting(hWnd) && !ismenutimeout) PostMessage(hWnd, MSG_CLOSE, 0, 0); } else PostMessage(hWnd, MSG_CLOSE, 0, 0); } else if(id==WIFI_PWDEXIT) { if(beModified() && MessageBox1(hWnd,LoadStrByID(MID_SAVEDATA),LoadStrByID(MID_APPNAME), MB_OKCANCEL|MB_ICONQUESTION|MB_BASEDONPARENT)==IDOK) PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0); else { if(!ismenutimeout) PostMessage(hWnd, MSG_CLOSE, 0, 0); } } break; case MSG_CLOSE: //UnloadBitmap(&wifipwdbkg); //MainWindowCleanup(hWnd); DestroyMainWindow(hWnd); return 0; } return DefaultMainWinProc(hWnd,message,wParam,lParam); }
void BrowserWindow::MessageReceived( BMessage* pcMsg ) { switch( pcMsg->what ) { case ID_URL_CHANGED: { std::string cURL = m_pcURLView->Text(); for ( uint i = 0 ; i <= cURL.size() ; ++i ) { if ( i == cURL.size() || isalnum( cURL[i] ) == false ) { if ( i == cURL.size() || cURL[i] != ':' ) { std::string cTmp = cURL; cURL = "http://"; for ( uint j = 0 ; j < cTmp.size() ; ++j ) { if ( cTmp[j] != '/' ) { cURL.insert( cURL.end(), cTmp.begin() + j, cTmp.end() ); break; } } } break; } } m_pcHTMLPart->view()->MakeFocus(); OpenURL( cURL, KParts::URLArgs() ); //---------------------------------------------- #if 0 uint32 nEvents = 0; pcMsg->FindInt( "events", &nEvents ); if ( nEvents & os::TextView::EI_ESC_PRESSED ) { m_pcURLView->Set( m_pcHTMLPart->url().prettyURL().utf8().data() ); m_pcHTMLPart->view()->MakeFocus(); break; } if ( nEvents & os::TextView::EI_ENTER_PRESSED ) { std::string cURL = m_pcURLView->GetBuffer()[0]; for ( uint i = 0 ; i <= cURL.size() ; ++i ) { if ( i == cURL.size() || isalnum( cURL[i] ) == false ) { if ( i == cURL.size() || cURL[i] != ':' ) { std::string cTmp = cURL; cURL = "http://"; for ( uint j = 0 ; j < cTmp.size() ; ++j ) { if ( cTmp[j] != '/' ) { cURL.insert( cURL.end(), cTmp.begin() + j, cTmp.end() ); break; } } } break; } } UpdateHistory(); AddHistoryEntry(); m_pcHTMLPart->view()->MakeFocus(); OpenURL( cURL, KParts::URLArgs() ); UpdateHistory(); } #endif break; } case ID_ACTIVATE_URLEDIT: m_pcURLView->MakeFocus( true ); #if 0 m_pcURLView->SetCursor( -1, 0 ); #endif m_pcURLView->TextView()->SelectAll(); break; case ID_RELOAD: { KParts::URLArgs cArgs; cArgs.reload = true; cArgs.xOffset = m_pcHTMLPart->browserExtension()->xOffset(); cArgs.yOffset = m_pcHTMLPart->browserExtension()->yOffset(); #if 0 OpenURL( m_pcURLView->GetBuffer()[0], cArgs ); #endif OpenURL( m_pcURLView->Text(), cArgs ); break; } case ID_NEW_WINDOW: { BrowserWindow* pcNewWindow = new BrowserWindow( Frame().OffsetByCopy( 30.0f, 30.0f ), false ); pcNewWindow->Show(); #if 0 UpdateHistory(); std::vector<HistoryEntry*> cHistory = m_cHistory; cHistory.resize( m_nCurHistoryPos + 1 ); BrowserWindow* pcNewWindow = new BrowserWindow( GetFrame() + os::Point( 30.0f, 30.0f ), &cHistory, false ); pcNewWindow->GoHistory(0); pcNewWindow->Show( true ); pcNewWindow->MakeFocus( true ); #endif break; } case ID_OPEN_LINK: { BString cURL; pcMsg->FindString( "url", &cURL ); BrowserWindow* pcNewWindow = new BrowserWindow( Frame().OffsetByCopy( 30.0f, 30.0f ), false ); pcNewWindow->OpenURL( cURL.String(), KParts::URLArgs() ); pcNewWindow->Show(); #if 0 std::string cURL; pcMsg->FindString( "url", &cURL ); std::vector<HistoryEntry*> cHistory = m_cHistory; cHistory.resize( m_nCurHistoryPos + 1 ); BrowserWindow* pcNewWindow = new BrowserWindow( GetFrame() + os::Point( 30.0f, 30.0f ), &cHistory, false ); pcNewWindow->OpenURL( cURL, KParts::URLArgs() ); pcNewWindow->AddHistoryEntry(); pcNewWindow->Show( true ); pcNewWindow->MakeFocus( true ); #endif break; } case ID_SAVE_LINK: { BString cURL; pcMsg->FindString( "url", &cURL ); m_pcHTMLPart->browserExtension()->SaveURL( cURL.String(), "Save link as..." ); break; } case ID_COPY_LINK_LOCATION: { #if 0 std::string cURL; pcMsg->FindString( "url", &cURL ); os::Clipboard cClipboard; cClipboard.Lock(); cClipboard.Clear(); os::Message* pcData = cClipboard.GetData(); pcData->AddString( "text/plain", cURL ); cClipboard.Commit(); cClipboard.Unlock(); #endif break; } case ID_COPY: { #if 0 if ( m_cSelectedText.empty() ) { break; } os::Clipboard cClipboard; cClipboard.Lock(); cClipboard.Clear(); os::Message* pcData = cClipboard.GetData(); pcData->AddString( "text/plain", m_cSelectedText ); cClipboard.Commit(); cClipboard.Unlock(); #endif break; } case ID_FIND: #if 0 if ( m_pcSearchDialog == NULL ) { m_pcHTMLPart->findTextBegin(); m_pcSearchDialog = new FindDialog( os::Messenger(this), os::Message(ID_DO_SEARCH), os::Message(ID_SEARCH_CLOSED) ); m_pcSearchDialog->Show(); m_pcSearchDialog->MakeFocus(); } #endif break; case ID_DO_SEARCH: { #if 0 bool bFromTop = false; pcMsg->FindBool( "from_top", &bFromTop ); pcMsg->FindBool( "case_sensitive", &m_bSearchCaseSensitive ); pcMsg->FindString( "string", &m_cLastSearchStr ); KHTMLView* pcActiveView = dynamic_cast<KHTMLView*>(GetFocusChild()); KHTMLPart* pcPart = m_pcHTMLPart; if ( pcActiveView != NULL ) { pcPart = pcActiveView->part(); } if ( bFromTop ) { pcPart->findTextBegin(); } pcPart->findTextNext( m_cLastSearchStr.c_str(), true, m_bSearchCaseSensitive ); break; #endif } case ID_REPEAT_FIND: #if 0 if ( m_cLastSearchStr.empty() == false ) { KHTMLView* pcActiveView = dynamic_cast<KHTMLView*>(GetFocusChild()); KHTMLPart* pcPart = m_pcHTMLPart; if ( pcActiveView != NULL ) { pcPart = pcActiveView->part(); } pcPart->findTextNext( m_cLastSearchStr.c_str(), true, m_bSearchCaseSensitive ); } else if ( m_pcSearchDialog == NULL ) { m_pcHTMLPart->findTextBegin(); m_pcSearchDialog = new FindDialog( os::Messenger(this), os::Message(ID_DO_SEARCH), os::Message(ID_SEARCH_CLOSED) ); m_pcSearchDialog->Show(); m_pcSearchDialog->MakeFocus(); } break; case ID_SEARCH_CLOSED: m_pcSearchDialog = NULL; break; #endif case ID_GOHOME: OpenURL( "http://www.openbeos.org/", KParts::URLArgs() ); #if 0 UpdateHistory(); AddHistoryEntry(); OpenURL( "http://www.atheos.cx/", KParts::URLArgs() ); UpdateHistory(); #endif break; #if 0 case ID_PREV_URL: GoHistory( -1 ); break; case ID_NEXT_URL: GoHistory( 1 ); break; #endif case ID_START_DOWNLOAD: { #if 0 DownloadNode* psNode = NULL; std::string cPath; pcMsg->FindPointer( "node", (void**) &psNode ); pcMsg->FindString( "path", &cPath ); if ( psNode == NULL ) { break; // Should never happen } psNode->m_cPath = cPath; const std::string cDstDir = os::Path( cPath.c_str() ).GetDir(); try { os::FSNode cDirNode( cDstDir ); if ( cDirNode.GetDev() == psNode->m_pcTmpFile->GetDev() ) { rename( psNode->m_pcTmpFile->GetPath().c_str(), cPath.c_str() ); psNode->m_pcTmpFile->Detatch(); // Make sure the destructor don't do anything silly. } else { psNode->m_pcFile = new os::File( cPath, O_WRONLY | O_CREAT ); psNode->m_pcTmpFile->Seek( 0, SEEK_SET ); char anBuffer[32*1024]; for (;;) { int nLen = psNode->m_pcTmpFile->Read( anBuffer, sizeof(anBuffer) ); if ( nLen < 0 ) { throw os::errno_exception( "Failed to copy temporary file" ); } if ( psNode->m_pcFile->Write( anBuffer, nLen ) != nLen ) { throw os::errno_exception( "Failed to copy temporary file" ); } if ( nLen < int(sizeof(anBuffer)) ) { break; } } delete psNode->m_pcTmpFile; psNode->m_pcTmpFile = NULL; } } catch(...) { (new os::Alert( "Error: Failed to create file!", os::String().Format( "Failed to create '%s'", cPath.c_str() ), 0, "Sorry!", NULL ))->Go(NULL); } psNode->m_pcRequester = NULL; if ( psNode->m_bDone == false ) { Message cCancelMsg( ID_CANCEL_DOWNLOAD ); cCancelMsg.AddPointer( "node", psNode ); psNode->m_pcProgressDlg = new DownloadProgress( os::Rect( 100, 100, 449, 349 ), os::String().Format( "Download: %s", cPath.c_str() ), psNode->m_cURL, cPath, psNode->m_nContentSize, psNode->m_nStartTime, os::Messenger( this ), cCancelMsg ); psNode->m_pcProgressDlg->Show(); } else { delete psNode->m_pcTmpFile; delete psNode->m_pcFile; delete psNode; } #endif break; } case ID_CANCEL_DOWNLOAD: { #if 0 DownloadNode* psNode = NULL; pcMsg->FindPointer( "node", (void**) &psNode ); if ( psNode == NULL ) { break; // Should never happen } if ( psNode->m_pcProgressDlg != NULL ) { psNode->m_pcProgressDlg->Terminate(); psNode->m_pcProgressDlg = NULL; } if ( psNode->m_cPath.empty() == false ) { unlink( psNode->m_cPath.c_str() ); } if ( psNode->m_bDone == false ) { psNode->m_pcRequester = NULL; psNode->m_bCanceled = true; delete psNode->m_pcTmpFile; psNode->m_pcTmpFile = NULL; delete psNode->m_pcFile; psNode->m_pcFile = NULL; } else { delete psNode->m_pcTmpFile; delete psNode->m_pcFile; delete psNode; } #endif break; } default: BWindow::MessageReceived( pcMsg ); break; } }
static int Verifywinproc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { HDC hdc; int id,nc, tmpvalue = 0; static char keyupFlag=0; switch (message) { case MSG_CREATE: InitWindow(hWnd); SetFocusChild(editacno3); SetWindowText(editacno3,propin); SendMessage(editacno3,EM_SETCARETPOS,0,1); return 0; case MSG_PAINT: hdc=BeginPaint(hWnd); tmpvalue= SetBkMode(hdc,BM_TRANSPARENT); SetTextColor(hdc,PIXEL_lightwhite); TextOut(hdc,60,70,LoadStrByID(HID_PLACEFINGER)); EndPaint(hWnd,hdc); return 0; case MSG_KEYUP: if(3 == gOptions.TFTKeyLayout) { keyupFlag=1; } break; case MSG_KEYDOWN: SetMenuTimeOut(time(NULL)); if(3 == gOptions.TFTKeyLayout) { if(1==keyupFlag) keyupFlag=0; else break; } if ((GetFocusChild(hWnd)==editacno3)&&((LOWORD(wParam)==SCANCODE_ENTER) ||(LOWORD(wParam)==SCANCODE_F10))) procverifychoose(hWnd); if ((LOWORD(wParam)==SCANCODE_ESCAPE)) PostMessage (hWnd, MSG_CLOSE, 0, 0L); break; case MSG_DESTROY: DestroyAllControls (hWnd); hMainWnd1 = HWND_INVALID; return 0; case MSG_CLOSE: DestroyMainWindow(hWnd); MainWindowThreadCleanup (hWnd); return 0; case MSG_COMMAND: id = LOWORD(wParam); nc = HIWORD(wParam); if (id==ID_ACNO) { if (nc==EN_CHANGE) { memset(propin,0,24); GetWindowText (editacno3, propin, 24); printf("keybuffer:%s\n",propin); } } break; } return DefaultMainWinProc(hWnd,message,wParam,lParam); }