void FindReplaceDlg::processReplaceAll() { //bool tmp = _isWrapAround; //_isWrapAround = true; for ( ; processReplace() ; ); //_isWrapAround = tmp; }
////////////////////////////////////////////////////// // Member "text" is used to communicate with the above processXxx methods; // the resulting string is returned to caller in parameter "fixed_data", // not in "text" ("text" not used elsewhere). // (Member "command" and the "pos/len" members -- same for them.) ////////////////////////////////////////////////////// InputStmt::Option InputStmt::fix_string(const char * in_data, char * fixed_data, size_t data_maxlen) { command = new char[data_maxlen + 1]; command_pos = 0; text_pos = 0; text = fixed_data; text_maxlen = strlen(in_data); #pragma nowarn(1506) // warning elimination str_pad(text, data_maxlen, ' '); #pragma warn(1506) // warning elimination #pragma nowarn(1506) // warning elimination str_cpy_all(text, in_data, strlen(in_data)); #pragma warn(1506) // warning elimination char c; Option option; cout << ">>" << in_data << endl; cout << ".."; #pragma nowarn(1506) // warning elimination if (cin.peek() != '\n') cin.get(command, data_maxlen, '\n'); else command[0] = '\0'; #pragma warn(1506) // warning elimination if (cin.eof()) { // Abort the "FC", not the whole SQLCI session CLEAR_STDIN_EOF; option = ABORT_O; } else { // consume the eol ('\n') cin.get(c); option = EMPTY_O; } while ((option != DONE_O) && (option != ABORT_O)) { option = nextOption(); switch (option) { case INSERT_O: processInsert(); break; case REPLACE_O: processReplace(); break; case EXPLICIT_REPLACE_O: processReplace(); text_pos++; break; case DELETE_O: processDelete(); break; case ADVANCE_O: text_pos += 1; break; case END_O: text_pos += 2; break; case ABORT_O: strncpy(text, in_data, strlen(in_data)); break; case DONE_O: text[text_maxlen] = 0; break; case AGAIN_O: text[text_maxlen] = 0; cout << ">>" << text << endl; text[text_maxlen] = ' '; cout << ".."; #pragma nowarn(1506) // warning elimination if (cin.peek() != '\n') cin.get(command, data_maxlen, '\n'); else command[0] = '\0'; #pragma warn(1506) // warning elimination if (cin.eof()) { CLEAR_STDIN_EOF; option = ABORT_O; } else { // consume the eol ('\n') cin.get(c); command_pos = 0; text_pos = 0; } break; default: break; } } delete [] command; command = 0; // delete text; // text points to fixed_data, memory owned by caller! text = 0; return option; } // fix_string()
BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND : { switch (wParam) { case IDCANCEL : // Close display(false); //::AnimateWindow(_hSelf, 200, AW_HIDE|AW_SLIDE|AW_HOR_POSITIVE|AW_VER_POSITIVE); return TRUE; case IDOK : // Find Next processFindNext(); return TRUE; case IDREPLACE : processReplace(); return TRUE; case IDREPLACEALL : processReplaceAll(); return TRUE; case IDWHOLEWORD : _isWholeWord = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDWHOLEWORD), BM_GETCHECK, 0, 0)); return TRUE; case IDMATCHCASE : _isMatchCase = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDMATCHCASE), BM_GETCHECK, 0, 0)); return TRUE; case IDREGEXP : _isRegExp = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDREGEXP), BM_GETCHECK, 0, 0)); if (_isRegExp) _isWholeWord = false; ::SendMessage(::GetDlgItem(_hSelf, IDWHOLEWORD), BM_SETCHECK, _isWholeWord?BST_CHECKED:BST_UNCHECKED, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDWHOLEWORD), (BOOL)!_isRegExp); ::SendMessage(::GetDlgItem(_hSelf, IDDIRECTIONUP), BM_SETCHECK, BST_UNCHECKED, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDDIRECTIONUP), (BOOL)!_isRegExp); ::SendMessage(::GetDlgItem(_hSelf, IDDIRECTIONDOWN), BM_SETCHECK, BST_CHECKED, 0); _whitchDirection = DIR_DOWN; return TRUE; case IDWRAP : _isWrapAround = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDWRAP), BM_GETCHECK, 0, 0)); return TRUE; case IDDIRECTIONUP : case IDDIRECTIONDOWN : _whitchDirection = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDDIRECTIONDOWN), BM_GETCHECK, BST_CHECKED, 0)); return TRUE; default : break; } } } return FALSE; }