// Clear the screen and draw the currently selected background icon (if any). // Should only be called with updateMutex locked. void ScreenRecoveryUI::draw_background_locked() { pagesIdentical = false; gr_color(0, 0, 0, 255); gr_clear(); if (currentIcon != NONE) { if (max_stage != -1) { int stage_height = gr_get_height(stageMarkerEmpty); int stage_width = gr_get_width(stageMarkerEmpty); int x = (gr_fb_width() - max_stage * gr_get_width(stageMarkerEmpty)) / 2; int y = gr_fb_height() - stage_height; for (int i = 0; i < max_stage; ++i) { GRSurface* stage_surface = (i < stage) ? stageMarkerFill : stageMarkerEmpty; gr_blit(stage_surface, 0, 0, stage_width, stage_height, x, y); x += stage_width; } } GRSurface* text_surface = GetCurrentText(); int text_x = (gr_fb_width() - gr_get_width(text_surface)) / 2; int text_y = GetTextBaseline(); gr_color(255, 255, 255, 255); gr_texticon(text_x, text_y, text_surface); } }
//Set the area in which the text is to be rendered. Having the area set //will provide the width necessary to determine where to shorten the text. void ShortenenedText::SetArea(SDL_Rect textarea) { mousefunction_->SetMouseArea(textarea); if (textarea.w != maxtextwidth_) { maxtextwidth_ = textarea.w; CreateFittedText(GetCurrentText()); } }
INT_PTR CALLBACK DlgFunction( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { char szFuncName[128]; HWND hFuncName; ADDR addr; static DWORD HelpArray[]= { ID_FUNCTION_FUNCNAME, IDH_ADDR, 0, 0 }; Unreferenced( lParam ); switch (message) { case WM_INITDIALOG: /* ** Initialize the edit item for the address field */ Dbg((hFuncName = GetDlgItem(hDlg, ID_FUNCTION_FUNCNAME))!=NULL); Dbg(SendMessage(hFuncName, EM_LIMITTEXT, sizeof(szFuncName)-1, 0L)); /* ** Initialise entry field with current selection */ *szFuncName = '\0'; if (Views[curView].Doc > -1) { if ((hwndActiveEdit != NULL) && (Docs[Views[curView].Doc].docType == DOC_WIN)) { BOOL lookAround = TRUE; GetCurrentText(curView, &lookAround, (LPSTR)szFuncName, min(MAX_USER_LINE, sizeof(szFuncName)-1), NULL, NULL); } } /* ** Send the text and select it */ SendMessage(hFuncName, WM_SETTEXT, 0, (LPARAM)(LPSTR)szFuncName); #ifdef WIN32 SendMessage(hFuncName, EM_SETSEL, 0, (LPARAM) -1); #else SendMessage(hFuncName, EM_SETSEL, 0, MAKELONG(0, 0x7FFF)); #endif SetFocus(hFuncName); return (FALSE); case WM_HELP: WinHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, "windbg.hlp", HELP_WM_HELP, (DWORD_PTR)(LPVOID) HelpArray ); return TRUE; case WM_CONTEXTMENU: WinHelp ((HWND) wParam, "windbg.hlp", HELP_CONTEXTMENU, (DWORD_PTR)(LPVOID) HelpArray ); return TRUE; case WM_COMMAND: switch (wParam) { /* ** Get the address string and attempt to change to the ** desired address */ case IDOK : Dbg((hFuncName = GetDlgItem(hDlg, ID_FUNCTION_FUNCNAME))!=NULL); GetDlgItemText(hDlg, ID_FUNCTION_FUNCNAME, (LPSTR)szFuncName, sizeof(szFuncName)); if (!LocateFunction(szFuncName, &addr)) { ErrorBox2(hDlg, MB_TASKMODAL, ERR_Function_Locate); SendMessage(hFuncName, EM_SETSEL, 0, (DWORD) -1); SetFocus(hFuncName); } else { if (!MoveEditorToAddr(&addr, TRUE)) { if (disasmView == -1) { OpenDebugWindow(DISASM_WIN, TRUE); // User activated } } if (disasmView != -1) { OpenDebugWindow(DISASM_WIN, TRUE); // User activated ViewDisasm(&addr, disasmForce); } EndDialog(hDlg, TRUE); } return TRUE; case IDCANCEL : EndDialog(hDlg, FALSE); return (TRUE); } break; } return (FALSE); } /* DlgFunction() */
INT_PTR CALLBACK DlgReplace( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { Unused( lParam ); switch (message) { case WM_INITDIALOG: { BOOL lookAround = TRUE; int i; LPSTR s; frMem.replaceAll = FALSE; frMem.oneLineDone = FALSE; frMem.replacing = TRUE; SetStopLimit(); //Retrieve text from document, blank string if nothing found //and send string to dialog box if (GetCurrentText(curView, &lookAround, (LPSTR)findReplace.findWhat, MAX_USER_LINE, &frMem.leftCol, NULL)) { //Temporarly put the string in the picklist extraPick = InsertInPickList(FIND_PICK); } else extraPick = FALSE; frMem.rightCol = frMem.leftCol; SendDlgItemMessage(hDlg, ID_REPLACE_WHAT, CB_LIMITTEXT, MAX_USER_LINE, (LPARAM) NULL); SendDlgItemMessage(hDlg, ID_REPLACE_WHAT, WM_SETTEXT, 0, (LPARAM)((LPSTR)findReplace.findWhat)); //Put back last replaced value SendDlgItemMessage(hDlg, ID_REPLACE_REPLACEWITH, CB_LIMITTEXT, MAX_USER_LINE, (LPARAM) NULL); SendDlgItemMessage(hDlg, ID_REPLACE_REPLACEWITH, WM_SETTEXT, 0, (LPARAM)((LPSTR)findReplace.replaceWith)); //Transfer boolean values to Dialog Box SendDlgItemMessage(hDlg, ID_REPLACE_MATCHUPLO, BM_SETCHECK, findReplace.matchCase, 0L); SendDlgItemMessage(hDlg, ID_REPLACE_WHOLEWORD, BM_SETCHECK, !findReplace.regExpr & findReplace.wholeWord, 0L); SendDlgItemMessage(hDlg, ID_REPLACE_REGEXP, BM_SETCHECK, findReplace.regExpr, 0L); EnableWindow(GetDlgItem(hDlg, ID_REPLACE_WHOLEWORD), !findReplace.regExpr); frMem.goUpCopy = findReplace.goUp; findReplace.goUp = FALSE; //Set the line to start find frMem.line = Views[curView].Y; //Set number of replaced occurences to 0 frMem.nbReplaced = 0; //Fill find pick list for (i = 0 ; i < findReplace.nbInPick[FIND_PICK]; i++) { Dbg(s = (LPSTR)GlobalLock(findReplace.hPickList[FIND_PICK][i])); SendDlgItemMessage(hDlg, ID_REPLACE_WHAT, CB_INSERTSTRING, (WPARAM) -1, (LPARAM)(LPSTR)s); Dbg(GlobalUnlock (findReplace.hPickList[FIND_PICK][i]) == FALSE); } //Fill replace pick list for (i = 0 ; i < findReplace.nbInPick[REPLACE_PICK]; i++) { Dbg(s = (LPSTR)GlobalLock(findReplace.hPickList[REPLACE_PICK][i])); SendDlgItemMessage(hDlg, ID_REPLACE_REPLACEWITH, CB_INSERTSTRING, (WPARAM) -1, (LPARAM)(LPSTR)s); Dbg(GlobalUnlock (findReplace.hPickList[REPLACE_PICK][i]) == FALSE); } return TRUE; } case WM_COMMAND: { switch (wParam) { case ID_REPLACE_FINDNEXT: case ID_REPLACE_REPLACEALL: if (SendDlgItemMessage(hDlg, ID_REPLACE_WHAT, WM_GETTEXT, MAX_USER_LINE, (LPARAM)((LPSTR)findReplace.findWhat))) { SendDlgItemMessage(hDlg, ID_REPLACE_REPLACEWITH, WM_GETTEXT, MAX_USER_LINE, (LPARAM)((LPSTR)findReplace.replaceWith)); if (extraPick) RemoveFromPick(FIND_PICK); frMem.replaceAll = (wParam == ID_REPLACE_REPLACEALL); InsertInPickList(FIND_PICK); InsertInPickList(REPLACE_PICK); if (FindNext(hDlg, Views[curView].Y, Views[curView].X, TRUE, TRUE, TRUE)) { if (frMem.hadError) findReplace.goUp = frMem.goUpCopy; frMem.replacing = !frMem.hadError; frMem.firstConfirmInvoc = TRUE; EndDialog(hDlg, !frMem.hadError); } else { SetStopLimit(); SetFocus(GetDlgItem(hDlg, ID_REPLACE_WHAT)); } } return TRUE; case ID_REPLACE_WHOLEWORD: findReplace.wholeWord = !findReplace.wholeWord; return TRUE; case ID_REPLACE_MATCHUPLO: findReplace.matchCase = !findReplace.matchCase; return TRUE; case ID_REPLACE_REGEXP: findReplace.regExpr = !findReplace.regExpr; SendDlgItemMessage(hDlg, ID_REPLACE_WHOLEWORD, BM_SETCHECK, !findReplace.regExpr & findReplace.wholeWord, 0L); EnableWindow(GetDlgItem(hDlg, ID_REPLACE_WHOLEWORD), !findReplace.regExpr); return TRUE; case IDCANCEL : //Remove the extra pick we inserted if (extraPick) RemoveFromPick(FIND_PICK); findReplace.goUp = frMem.goUpCopy; frMem.replacing = FALSE; EndDialog(hDlg, FALSE); return TRUE; case IDWINDBGHELP : Dbg(WinHelp(hDlg,szHelpFileName,HELP_CONTEXT,ID_REPLACE_HELP)); return TRUE; } break; } } return FALSE; }