From: <bl...@us...> - 2003-05-14 19:42:00
|
Update of /cvsroot/cpptool/rfta/src/rftavc7addin In directory sc8-pr-cvs1:/tmp/cvs-serv16044/src/rftavc7addin Modified Files: Connect.cpp VC7TextDocument.cpp VC7TextDocument.h Log Message: * fixed bugs Index: Connect.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftavc7addin/Connect.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Connect.cpp 14 May 2003 18:55:50 -0000 1.3 --- Connect.cpp 14 May 2003 19:41:55 -0000 1.4 *************** *** 369,373 **** const Refactoring::SourceRange &selectedRange ) { ! AfxMessageBox( "11Selected range: " + CString(selectedRange.toString().c_str() ) ); /* RenameLocaleVariableDialog dialog; --- 369,382 ---- const Refactoring::SourceRange &selectedRange ) { ! CString msg; ! msg.Format( "Selected range: %s\nSelected Text: %s\nAll Text: %s", ! selectedRange.toString().c_str(), ! document.getTextRange( selectedRange ).c_str(), ! document.getAllText().c_str() ); ! AfxMessageBox( msg ); ! ! Refactoring::SourceRange range( 2, 5 ); ! document.replaceTextRange( range, "ABCDE" ); ! /* RenameLocaleVariableDialog dialog; Index: VC7TextDocument.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftavc7addin/VC7TextDocument.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VC7TextDocument.cpp 14 May 2003 18:55:50 -0000 1.1 --- VC7TextDocument.cpp 14 May 2003 19:41:56 -0000 1.2 *************** *** 67,71 **** startPoint_->get_AbsoluteCharOffset( &startIndex ); endPoint_->get_AbsoluteCharOffset( &endIndex ); ! return Refactoring::SourceRange( startIndex, endIndex ); } --- 67,71 ---- startPoint_->get_AbsoluteCharOffset( &startIndex ); endPoint_->get_AbsoluteCharOffset( &endIndex ); ! return Refactoring::SourceRange( startIndex-1, endIndex-startIndex ); } *************** *** 82,87 **** } ! startPoint_->MoveToAbsoluteOffset( selection.getStartIndex() ); ! startPoint_->MoveToAbsoluteOffset( selection.getEndIndex() ); } --- 82,104 ---- } ! startPoint_->MoveToAbsoluteOffset( selection.getStartIndex()+1 ); ! endPoint_->MoveToAbsoluteOffset( selection.getEndIndex()+1 ); ! } ! ! ! std::string ! VC7TextDocument::getTextRange( const Refactoring::SourceRange &range ) ! { ! setSelectionRange( range ); ! return getSelection(); ! } ! ! ! void ! VC7TextDocument::replaceTextRange( const Refactoring::SourceRange &range, ! const std::string &text ) ! { ! setSelectionRange( range ); ! return replaceSelection( text ); } Index: VC7TextDocument.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftavc7addin/VC7TextDocument.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VC7TextDocument.h 14 May 2003 18:55:50 -0000 1.1 --- VC7TextDocument.h 14 May 2003 19:41:56 -0000 1.2 *************** *** 39,42 **** --- 39,47 ---- void setSelectionRange( const Refactoring::SourceRange &selection ); + std::string getTextRange( const Refactoring::SourceRange &range ); + + void replaceTextRange( const Refactoring::SourceRange &range, + const std::string &text ); + private: CComPtr<EnvDTE::TextDocument> document_; |