diff options
Diffstat (limited to 'tqtinterface/qt4/src/widgets/tqtextedit.cpp')
-rw-r--r-- | tqtinterface/qt4/src/widgets/tqtextedit.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/tqtinterface/qt4/src/widgets/tqtextedit.cpp b/tqtinterface/qt4/src/widgets/tqtextedit.cpp index c2c3141..7900d3c 100644 --- a/tqtinterface/qt4/src/widgets/tqtextedit.cpp +++ b/tqtinterface/qt4/src/widgets/tqtextedit.cpp @@ -283,7 +283,7 @@ static bool block_set_tqalignment = FALSE; \i \e{current format} -- this is the format at the current cursor position, \e and it is the format of the selected text if any. - \i \e{current paragraph} -- the paragraph which tqcontains the + \i \e{current paragraph} -- the paragraph which contains the cursor. \endlist @@ -325,8 +325,8 @@ static bool block_set_tqalignment = FALSE; TQTextEdit can display a large HTML subset, including tables and images. - The text is set or tqreplaced using setText() which deletes any - existing text and tqreplaces it with the text passed in the + The text is set or replaced using setText() which deletes any + existing text and replaces it with the text passed in the setText() call. If you call setText() with legacy HTML (with setTextFormat(RichText) in force), and then call text(), the text that is returned may have different markup, but will render the @@ -384,8 +384,8 @@ static bool block_set_tqalignment = FALSE; length(). You can scroll to an anchor in the text, e.g. - \c{<a name="anchor">} with scrollToAnchor(). The tqfind() function - can be used to tqfind and select a given string within the text. + \c{<a name="anchor">} with scrollToAnchor(). The find() function + can be used to find and select a given string within the text. A read-only TQTextEdit provides the same functionality as the (obsolete) TQTextView. (TQTextView is still supplied for @@ -490,7 +490,7 @@ static bool block_set_tqalignment = FALSE; Use setSelection() to select text. The setSelectionAttributes() function is used to indicate how selected text should be - displayed. Use hasSelectedText() to tqfind out if any text is + displayed. Use hasSelectedText() to find out if any text is selected. The currently selected text's position is available using getSelection() and the selected text itself is returned by selectedText(). The selection can be copied to the clipboard with @@ -850,7 +850,7 @@ static bool block_set_tqalignment = FALSE; \fn void TQTextEdit::cursorPositionChanged( int para, int pos ) This signal is emitted if the position of the cursor has changed. - \a para tqcontains the paragraph index and \a pos tqcontains the + \a para contains the paragraph index and \a pos contains the character position within the paragraph. \sa setCursorPosition() @@ -910,7 +910,7 @@ TQTextEdit::TQTextEdit( TQWidget *tqparent, const char *name ) uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data. - For example if the text tqcontains an image tag, + For example if the text contains an image tag, \c{<img src="image.png">}, and the context is "path/to/look/in", the TQMimeSourceFactory will try to load the image from "path/to/look/in/image.png". If the tag was @@ -2546,12 +2546,12 @@ void TQTextEdit::contentsMouseDoubleClickEvent( TQMouseEvent * e ) int startIdx = index, endIdx = index, i; if ( !str[ index ].isSpace() ) { i = startIdx; - // tqfind start of word + // find start of word while ( i >= 0 && !str[ i ].isSpace() ) { startIdx = i--; } i = endIdx; - // tqfind end of word.. + // find end of word.. while ( (uint) i < str.length() && !str[ i ].isSpace() ) { endIdx = ++i; } @@ -3053,9 +3053,9 @@ void TQTextEdit::insert( const TQString &text, bool indent, RedoIndentation is set, the paragraph is re-indented. If \c CheckNewLines is set, newline characters in \a text result in hard line breaks (i.e. new paragraphs). If \c checkNewLine is not set, - the behaviour of the editor is undefined if the \a text tqcontains + the behaviour of the editor is undefined if the \a text contains newlines. (It is not possible to change TQTextEdit's newline handling - behavior, but you can use TQString::tqreplace() to preprocess text + behavior, but you can use TQString::replace() to preprocess text before inserting it.) If \c RemoveSelected is set, any selected text (in selection 0) is removed before the text is inserted. @@ -4040,10 +4040,10 @@ void TQTextEdit::setText( const TQString &text, const TQString &context ) modify the cursor position. Using the \a para and \a index parameters will not work correctly - in case the document tqcontains tables. + in case the document contains tables. */ -bool TQTextEdit::tqfind( const TQString &expr, bool cs, bool wo, bool forward, +bool TQTextEdit::find( const TQString &expr, bool cs, bool wo, bool forward, int *para, int *index ) { #ifdef TQT_TEXTEDIT_OPTIMIZATION @@ -4054,29 +4054,29 @@ bool TQTextEdit::tqfind( const TQString &expr, bool cs, bool wo, bool forward, #ifndef TQT_NO_CURSOR viewport()->setCursor( isReadOnly() ? Qt::ArrowCursor : Qt::IBeamCursor ); #endif - TQTextCursor tqfindcur = *cursor; + TQTextCursor findcur = *cursor; if ( para && index ) { if ( doc->paragAt( *para ) ) - tqfindcur.gotoPosition( doc->paragAt(*para), *index ); + findcur.gotoPosition( doc->paragAt(*para), *index ); else - tqfindcur.gotoEnd(); + findcur.gotoEnd(); } else if ( doc->hasSelection( TQTextDocument::Standard ) ){ - // maks sure we do not tqfind the same selection again + // maks sure we do not find the same selection again if ( forward ) - tqfindcur.gotoNextLetter(); + findcur.gotoNextLetter(); else - tqfindcur.gotoPreviousLetter(); - } else if (!forward && tqfindcur.index() == 0 && tqfindcur.paragraph() == tqfindcur.topParagraph()) { - tqfindcur.gotoEnd(); + findcur.gotoPreviousLetter(); + } else if (!forward && findcur.index() == 0 && findcur.paragraph() == findcur.topParagraph()) { + findcur.gotoEnd(); } removeSelection( TQTextDocument::Standard ); - bool found = doc->tqfind( tqfindcur, expr, cs, wo, forward ); + bool found = doc->find( findcur, expr, cs, wo, forward ); if ( found ) { if ( para ) - *para = tqfindcur.paragraph()->paragId(); + *para = findcur.paragraph()->paragId(); if ( index ) - *index = tqfindcur.index(); - *cursor = tqfindcur; + *index = findcur.index(); + *cursor = findcur; repaintChanged(); ensureCursorVisible(); } @@ -4146,7 +4146,7 @@ void TQTextEdit::getCursorPosition( int *para, int *index ) const Any existing selections which have a different id (\a selNum) are left alone, but if an existing selection has the same id as \a - selNum it is removed and tqreplaced by this selection. + selNum it is removed and replaced by this selection. Uses the selection settings of selection \a selNum. If \a selNum is 0, this is the default selection. @@ -5003,7 +5003,7 @@ void TQTextEdit::scrollToAnchor( const TQString& name ) if( c->isAnchor() ) { TQString a = c->anchorName(); if ( a == name || - (a.tqcontains( '#' ) && TQStringList::split( '#', a ).tqcontains( name ) ) ) { + (a.contains( '#' ) && TQStringList::split( '#', a ).contains( name ) ) ) { setContentsPos( contentsX(), TQMIN( cursor.paragraph()->rect().top() + cursor.totalOffsetY(), contentsHeight() - visibleHeight() ) ); break; } @@ -5125,9 +5125,9 @@ void TQTextEdit::pasteSubType( const TQCString& subtype, TQMimeSource *m ) return; if ( st == "application/x-qrichtext" ) { int start; - if ( (start = t.tqfind( "<!--StartFragment-->" )) != -1 ) { + if ( (start = t.find( "<!--StartFragment-->" )) != -1 ) { start += 20; - int end = t.tqfind( "<!--EndFragment-->" ); + int end = t.find( "<!--EndFragment-->" ); TQTextCursor oldC = *cursor; // during the setRichTextInternal() call the cursors @@ -5200,10 +5200,10 @@ void TQTextEdit::pasteSubType( const TQCString& subtype, TQMimeSource *m ) } else { #if defined(TQ_OS_WIN32) // Need to convert CRLF to LF - t.tqreplace( "\r\n", "\n" ); + t.replace( "\r\n", "\n" ); #elif defined(TQ_OS_MAC) //need to convert CR to LF - t.tqreplace( '\r', '\n' ); + t.replace( '\r', '\n' ); #endif TQChar *uc = (TQChar *)t.tqunicode(); for ( int i=0; (uint) i<t.length(); i++ ) { @@ -5241,12 +5241,12 @@ TQCString TQTextEdit::pickSpecial( TQMimeSource* ms, bool always_ask, const TQPo int n = 0; TQDict<void> done; for (int i = 0; !( fmt = ms->format( i ) ).isNull(); i++) { - int semi = fmt.tqfind( ";" ); + int semi = fmt.find( ";" ); if ( semi >= 0 ) fmt = fmt.left( semi ); if ( fmt.left( 5 ) == "text/" ) { fmt = fmt.mid( 5 ); - if ( !done.tqfind( fmt ) ) { + if ( !done.find( fmt ) ) { done.insert( fmt,(void*)1 ); popup.insertItem( fmt, i ); n++; @@ -5261,7 +5261,7 @@ TQCString TQTextEdit::pickSpecial( TQMimeSource* ms, bool always_ask, const TQPo #else TQString fmt; for (int i = 0; !( fmt = ms->format( i ) ).isNull(); i++) { - int semi = fmt.tqfind( ";" ); + int semi = fmt.find( ";" ); if ( semi >= 0 ) fmt = fmt.left( semi ); if ( fmt.left( 5 ) == "text/" ) { @@ -6220,7 +6220,7 @@ TQString TQTextEdit::optimText() const } else { tmp = d->od->lines[ LOGOFFSET(i) ] + "\n"; // inject the tags for this line - if ( (it = d->od->tagIndex.tqfind( LOGOFFSET(i) )) != d->od->tagIndex.end() ) + if ( (it = d->od->tagIndex.find( LOGOFFSET(i) )) != d->od->tagIndex.end() ) ftag = it.data(); offset = 0; while ( ftag && ftag->line == i ) { @@ -6286,7 +6286,7 @@ TQTextEditOptimPrivate::Tag * TQTextEdit::optimAppendTag( int index, const TQStr d->od->lastTag = t; tmp = d->od->tagIndex[ LOGOFFSET(t->line) ]; if ( !tmp || (tmp && tmp->index > t->index) ) { - d->od->tagIndex.tqreplace( LOGOFFSET(t->line), t ); + d->od->tagIndex.replace( LOGOFFSET(t->line), t ); } return t; } @@ -6311,9 +6311,9 @@ TQTextEditOptimPrivate::Tag *TQTextEdit::optimInsertTag(int line, int index, con t->next = 0; t->prev = 0; - // tqfind insertion pt. in tag struct. + // find insertion pt. in tag struct. TQMap<int,TQTextEditOptimPrivate::Tag *>::ConstIterator it; - if ((it = d->od->tagIndex.tqfind(LOGOFFSET(line))) != d->od->tagIndex.end()) { + if ((it = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { tmp = *it; if (tmp->index >= index) { // the exisiting tag may be placed AFTER the one we want to insert tmp = tmp->prev; @@ -6338,7 +6338,7 @@ TQTextEditOptimPrivate::Tag *TQTextEdit::optimInsertTag(int line, int index, con tmp = d->od->tagIndex[LOGOFFSET(t->line)]; if (!tmp || (tmp && tmp->index >= t->index)) { - d->od->tagIndex.tqreplace(LOGOFFSET(t->line), t); + d->od->tagIndex.replace(LOGOFFSET(t->line), t); } return t; } @@ -6405,7 +6405,7 @@ void TQTextEdit::optimParseTags( TQString * line, int lineNo, int indexOffset ) c = '>'; else if ( esc == "&" ) c = '&'; - line->tqreplace( escIndex, i - escIndex + 1, c ); + line->replace( escIndex, i - escIndex + 1, c ); len = line->length(); i -= i-escIndex; escIndex = -1; @@ -6518,7 +6518,7 @@ void TQTextEdit::optimParseTags( TQString * line, int lineNo, int indexOffset ) // calculate the width of a string in pixels inc. tabs static int qStrWidth(const TQString& str, int tabWidth, const TQFontMetrics& fm) { - int tabs = str.tqcontains('\t'); + int tabs = str.contains('\t'); if (!tabs) return fm.width(str); @@ -6528,7 +6528,7 @@ static int qStrWidth(const TQString& str, int tabWidth, const TQFontMetrics& fm) int strWidth = 0; int tn; for (tn = 1; tn <= tabs; ++tn) { - newIdx = str.tqfind('\t', newIdx); + newIdx = str.find('\t', newIdx); strWidth += fm.width(str.mid(lastIdx, newIdx - lastIdx)); if (strWidth >= tn * tabWidth) { int u = tn; @@ -6549,7 +6549,7 @@ bool TQTextEdit::optimHasBoldMetrics(int line) { TQTextEditOptimPrivate::Tag *t; TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; - if ((it = d->od->tagIndex.tqfind(line)) != d->od->tagIndex.end()) { + if ((it = d->od->tagIndex.find(line)) != d->od->tagIndex.end()) { t = *it; while (t && t->line == line) { if (t->bold) @@ -6564,7 +6564,7 @@ bool TQTextEdit::optimHasBoldMetrics(int line) /*! \internal - Append \a str to the current text buffer. Parses each line to tqfind + Append \a str to the current text buffer. Parses each line to find formatting tags. */ void TQTextEdit::optimAppend( const TQString &str ) @@ -6628,7 +6628,7 @@ static void qStripTags(TQString *line) c = '>'; else if ( esc == "&" ) c = '&'; - line->tqreplace( escIndex, i - escIndex + 1, c ); + line->replace( escIndex, i - escIndex + 1, c ); len = line->length(); i -= i-escIndex; escIndex = -1; @@ -6685,7 +6685,7 @@ void TQTextEdit::optimInsert(const TQString& text, int line, int index) qStripTags( &stripped ); d->od->lines[LOGOFFSET(line)].insert(index, stripped); // move the tag indices following the insertion pt. - if ((ii = d->od->tagIndex.tqfind(LOGOFFSET(line))) != d->od->tagIndex.end()) { + if ((ii = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { tag = *ii; while (tag && (LOGOFFSET(tag->line) == line && tag->index < index)) tag = tag->next; @@ -6710,7 +6710,7 @@ void TQTextEdit::optimInsert(const TQString& text, int line, int index) // fix the tag index and the tag line/index numbers - this // might take a while.. for (x = line; x < d->od->numLines; x++) { - if ((ii = d->od->tagIndex.tqfind(LOGOFFSET(line))) != d->od->tagIndex.end()) { + if ((ii = d->od->tagIndex.find(LOGOFFSET(line))) != d->od->tagIndex.end()) { tag = ii.data(); if (LOGOFFSET(tag->line) == line) while (tag && (LOGOFFSET(tag->line) == line && tag->index < index)) @@ -6731,7 +6731,7 @@ void TQTextEdit::optimInsert(const TQString& text, int line, int index) d->od->tagIndex.clear(); tag = d->od->tags; while (tag) { - if (!((ii = d->od->tagIndex.tqfind(LOGOFFSET(tag->line))) != d->od->tagIndex.end())) + if (!((ii = d->od->tagIndex.find(LOGOFFSET(tag->line))) != d->od->tagIndex.end())) d->od->tagIndex[LOGOFFSET(tag->line)] = tag; tag = tag->next; } @@ -6739,7 +6739,7 @@ void TQTextEdit::optimInsert(const TQString& text, int line, int index) // update the tag indices on the spliced line - needs to be done before new tags are added TQString stripped = strl[strl.count() - 1]; qStripTags(&stripped); - if ((ii = d->od->tagIndex.tqfind(LOGOFFSET(line + numNewLines))) != d->od->tagIndex.end()) { + if ((ii = d->od->tagIndex.find(LOGOFFSET(line + numNewLines))) != d->od->tagIndex.end()) { tag = *ii; while (tag && (LOGOFFSET(tag->line) == line + numNewLines)) { tag->index += stripped.length(); @@ -6794,7 +6794,7 @@ TQTextEditOptimPrivate::Tag * TQTextEdit::optimPreviousLeftTag( int line ) { TQTextEditOptimPrivate::Tag * ftag = 0; TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; - if ( (it = d->od->tagIndex.tqfind( LOGOFFSET(line) )) != d->od->tagIndex.end() ) + if ( (it = d->od->tagIndex.find( LOGOFFSET(line) )) != d->od->tagIndex.end() ) ftag = it.data(); if ( !ftag ) { // start searching for an open tag @@ -6823,7 +6823,7 @@ TQTextEditOptimPrivate::Tag * TQTextEdit::optimPreviousLeftTag( int line ) /*! \internal Set the format for the string starting at index \a start and ending - at \a end according to \a tag. If \a tag is a Format tag, tqfind the + at \a end according to \a tag. If \a tag is a Format tag, find the first open color tag appearing before \a tag and use that tag to color the string. */ @@ -6854,7 +6854,7 @@ void TQTextEdit::optimSetTextFormat( TQTextDocument * td, TQTextCursor * cur, if ( tag ) { TQString col = tag->tag.simplifyWhiteSpace(); if ( col.left( 10 ) == "font color" ) { - int i = col.tqfind( '=', 10 ); + int i = col.find( '=', 10 ); col = TQT_TQSTRING(col.mid( i + 1 )).simplifyWhiteSpace(); if ( col[0] == '\"' ) col = col.mid( 1, col.length() - 2 ); @@ -6923,10 +6923,10 @@ void TQTextEdit::optimDrawContents( TQPainter * p, int clipx, int clipy, TQMapConstIterator<int,TQTextEditOptimPrivate::Tag *> it; TQTextEditOptimPrivate::Tag * tag = 0, * tmp = 0; TQTextCursor cur( td ); - // Step 1 - tqfind previous left-tag + // Step 1 - find previous left-tag tmp = optimPreviousLeftTag( i ); for ( ; i < startLine + nLines; i++ ) { - if ( (it = d->od->tagIndex.tqfind( LOGOFFSET(i) )) != d->od->tagIndex.end() ) + if ( (it = d->od->tagIndex.find( LOGOFFSET(i) )) != d->od->tagIndex.end() ) tag = it.data(); // Step 2 - iterate over tags on the current line int lastIndex = 0; @@ -7124,7 +7124,7 @@ void TQTextEdit::optimDoAutoScroll() int xx = contentsX() + pos.x(); int yy = contentsY() + pos.y(); - // tqfind out how much we have to scroll in either dir. + // find out how much we have to scroll in either dir. if ( pos.x() < 0 || pos.x() > viewport()->width() || pos.y() < 0 || pos.y() > viewport()->height() ) { int my = yy; @@ -7201,7 +7201,7 @@ int TQTextEdit::optimCharIndex( const TQString &str, int mx ) const int strWidth; mx = mx - 4; // ### get the real margin from somewhere - if (!str.tqcontains('\t') && mx > fm.width(str)) + if (!str.contains('\t') && mx > fm.width(str)) return str.length(); while (i < str.length()) { @@ -7296,8 +7296,8 @@ bool TQTextEdit::optimFind( const TQString & expr, bool cs, bool /*wo*/, return FALSE; for ( i = parag; fw ? i < d->od->numLines : i >= 0; fw ? i++ : i-- ) { - idx = fw ? d->od->lines[ LOGOFFSET(i) ].tqfind( expr, idx, cs ) : - d->od->lines[ LOGOFFSET(i) ].tqfindRev( expr, idx, cs ); + idx = fw ? d->od->lines[ LOGOFFSET(i) ].find( expr, idx, cs ) : + d->od->lines[ LOGOFFSET(i) ].findRev( expr, idx, cs ); if ( idx != -1 ) { found = TRUE; break; @@ -7413,11 +7413,11 @@ void TQTextEdit::optimCheckLimit( const TQString& str ) } // ...in the tag index as well TQMapIterator<int, TQTextEditOptimPrivate::Tag *> idx; - if ( (idx = d->od->tagIndex.tqfind( d->logOffset )) != d->od->tagIndex.end() ) + if ( (idx = d->od->tagIndex.find( d->logOffset )) != d->od->tagIndex.end() ) d->od->tagIndex.remove( idx ); TQMapIterator<int,TQString> it; - if ( (it = d->od->lines.tqfind( d->logOffset )) != d->od->lines.end() ) { + if ( (it = d->od->lines.find( d->logOffset )) != d->od->lines.end() ) { d->od->len -= (*it).length(); d->od->lines.remove( it ); d->od->numLines--; |