diff options
Diffstat (limited to 'tools/designer/editor/completion.cpp')
| -rw-r--r-- | tools/designer/editor/completion.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/tools/designer/editor/completion.cpp b/tools/designer/editor/completion.cpp index 22acdc951..4a8ebdecd 100644 --- a/tools/designer/editor/completion.cpp +++ b/tools/designer/editor/completion.cpp @@ -65,7 +65,7 @@ public: CompletionItem( TQListBox *lb, const TQString &txt, const TQString &t, const TQString &p, const TQString &pre, const TQString &p2 ) : TQListBoxItem( lb ), type( t ), postfix( p ), prefix( pre ), postfix2( p2 ), - parag( 0 ), lastState( FALSE ) { setText( txt ); } + parag( 0 ), lastState( false ) { setText( txt ); } ~CompletionItem() { delete parag; } void paint( TQPainter *painter ) { if ( lastState != isSelected() ) { @@ -102,7 +102,7 @@ void CompletionItem::setupParagraph() { if ( !parag ) { TQTextFormatter *formatter; formatter = new TQTextFormatterBreakWords; - formatter->setWrapEnabled( FALSE ); + formatter->setWrapEnabled( false ); parag = new TQTextParagraph( 0 ); parag->setTabStops( listBox()->fontMetrics().width( "propertyXXXX" ) ); parag->pseudoDocument()->pFormatter = formatter; @@ -115,7 +115,7 @@ void CompletionItem::setupParagraph() { listBox()->colorGroup().highlightedText() : listBox()->colorGroup().text() ); TQFont f( listBox()->font() ); - f.setBold( TRUE ); + f.setBold( true ); TQTextFormat *f2 = parag->formatCollection()->format( f, isSelected() ? listBox()->colorGroup().highlightedText() : listBox()->colorGroup().text() ); @@ -136,7 +136,7 @@ void CompletionItem::setupParagraph() { EditorCompletion::EditorCompletion( Editor *e ) { - enabled = TRUE; + enabled = true; lastDoc = 0; completionPopup = new TQVBox( e->topLevelWidget(), 0, WType_Popup ); completionPopup->setFrameStyle( TQFrame::Box | TQFrame::Plain ); @@ -216,9 +216,9 @@ TQValueList<CompletionEntry> EditorCompletion::completionList( const TQString &s void EditorCompletion::updateCompletionMap( TQTextDocument *doc ) { - bool strict = TRUE; + bool strict = true; if ( doc != lastDoc ) - strict = FALSE; + strict = false; lastDoc = doc; TQTextParagraph *s = doc->firstParagraph(); if ( !s->extraData() ) @@ -252,7 +252,7 @@ bool EditorCompletion::doCompletion() { searchString = ""; if ( !curEditor ) - return FALSE; + return false; TQTextCursor *cursor = curEditor->textCursor(); TQTextDocument *doc = curEditor->document(); @@ -263,10 +263,10 @@ bool EditorCompletion::doCompletion() int idx = cursor->index(); if ( idx == 0 ) - return FALSE; + return false; TQChar c = cursor->paragraph()->at( idx - 1 )->c; if ( !c.isLetter() && !c.isNumber() && c != '_' && c != '#' ) - return FALSE; + return false; TQString s; idx--; @@ -317,16 +317,16 @@ bool EditorCompletion::doCompletion() TQTextEdit::CheckNewLines | TQTextEdit::RemoveSelected ) ); } else { - return FALSE; + return false; } - return TRUE; + return true; } bool EditorCompletion::eventFilter( TQObject *o, TQEvent *e ) { if ( !enabled ) - return FALSE; + return false; if ( e->type() == TQEvent::KeyPress && ::tqt_cast<Editor*>(o)) { curEditor = (Editor*)o; TQKeyEvent *ke = (TQKeyEvent*)e; @@ -343,23 +343,23 @@ bool EditorCompletion::eventFilter( TQObject *o, TQEvent *e ) curEditor->textCursor()->paragraph()->at( i )->c != '\t' ) break; } - curEditor->drawCursor( FALSE ); + curEditor->drawCursor( false ); curEditor->textCursor()->setIndex( i ); - curEditor->drawCursor( TRUE ); + curEditor->drawCursor( true ); } else { curEditor->insert( "\t" ); } - return TRUE; + return true; } } if ( functionLabel->isVisible() ) { if ( ke->key() == Key_Up && ( ke->state() & ControlButton ) == ControlButton ) { functionLabel->gotoPrev(); - return TRUE; + return true; } else if ( ke->key() == Key_Down && ( ke->state() & ControlButton ) == ControlButton ) { functionLabel->gotoNext(); - return TRUE; + return true; } } @@ -369,9 +369,9 @@ bool EditorCompletion::eventFilter( TQObject *o, TQEvent *e ) if ( ke->key() == Key_Tab ) { if ( curEditor->textCursor()->index() == 0 && curEditor->textCursor()->paragraph()->isListItem() ) - return FALSE; + return false; if ( doCompletion() ) - return TRUE; + return true; } else if ( ( ke->key() == Key_Period && ( curEditor->textCursor()->index() == 0 || curEditor->textCursor()->paragraph()->at( curEditor->textCursor()->index() - 1 )->c != '.' ) ) @@ -393,15 +393,15 @@ bool EditorCompletion::eventFilter( TQObject *o, TQEvent *e ) if ( ke->key() == Key_Tab && completionListBox->count() > 1 && completionListBox->currentItem() < (int)completionListBox->count() - 1 ) { completionListBox->setCurrentItem( completionListBox->currentItem() + 1 ); - return TRUE; + return true; } completeCompletion(); - return TRUE; + return true; } else if ( ke->key() == Key_Left || ke->key() == Key_Right || ke->key() == Key_Up || ke->key() == Key_Down || ke->key() == Key_Home || ke->key() == Key_End || ke->key() == Key_Prior || ke->key() == Key_Next ) { - return FALSE; + return false; } else if ( ke->key() != Key_Shift && ke->key() != Key_Control && ke->key() != Key_Alt ) { int l = searchString.length(); @@ -416,11 +416,11 @@ bool EditorCompletion::eventFilter( TQObject *o, TQEvent *e ) curEditor->setFocus(); } TQApplication::sendEvent( curEditor, e ); - return TRUE; + return true; } } else if ( e->type() == TQEvent::MouseButtonDblClick ) { completeCompletion(); - return TRUE; + return true; } } if ( o == functionLabel || ( ::tqt_cast<Editor*>(o) && functionLabel->isVisible() ) ) { @@ -433,12 +433,12 @@ bool EditorCompletion::eventFilter( TQObject *o, TQEvent *e ) functionLabel->hide(); if ( o == functionLabel ) { TQApplication::sendEvent( curEditor, e ); - return TRUE; + return true; } } } } - return FALSE; + return false; } void EditorCompletion::completeCompletion() @@ -453,7 +453,7 @@ void EditorCompletion::completeCompletion() curEditor->setFocus(); if ( i != -1 && i < (int)s.length() ) { curEditor->setCursorPosition( curEditor->textCursor()->paragraph()->paragId(), idx + i + 1 ); - doArgumentHint( FALSE ); + doArgumentHint( false ); } } @@ -488,13 +488,13 @@ bool EditorCompletion::doObjectCompletion() object.remove( object.length() - 1, 1 ); if ( object.isEmpty() ) - return FALSE; + return false; return doObjectCompletion( object ); } bool EditorCompletion::doObjectCompletion( const TQString & ) { - return FALSE; + return false; } static void strip( TQString &txt ) @@ -513,20 +513,20 @@ bool EditorCompletion::continueComplete() (void)new CompletionItem( completionListBox, (*it).text, (*it).type, (*it).postfix, (*it).prefix, (*it).postfix2 ); completionListBox->setCurrentItem( 0 ); - completionListBox->setSelected( completionListBox->currentItem(), TRUE ); - return TRUE; + completionListBox->setSelected( completionListBox->currentItem(), true ); + return true; } TQListBoxItem *i = completionListBox->findItem( searchString ); if ( !i ) - return FALSE; + return false; TQString txt1 = i->text(); TQString txt2 = searchString; strip( txt1 ); strip( txt2 ); if ( txt1 == txt2 && !i->next() ) - return FALSE; + return false; TQValueList<CompletionEntry> res; for ( TQValueList<CompletionEntry>::ConstIterator it = cList.begin(); it != cList.end(); ++it ) { @@ -534,14 +534,14 @@ bool EditorCompletion::continueComplete() res << *it; } if ( res.isEmpty() ) - return FALSE; + return false; completionListBox->clear(); for ( TQValueList<CompletionEntry>::ConstIterator it2 = res.begin(); it2 != res.end(); ++it2 ) (void)new CompletionItem( completionListBox, (*it2).text, (*it2).type, (*it2).postfix, (*it2).prefix, (*it2).postfix2 ); completionListBox->setCurrentItem( 0 ); - completionListBox->setSelected( completionListBox->currentItem(), TRUE ); - return TRUE; + completionListBox->setSelected( completionListBox->currentItem(), true ); + return true; } bool EditorCompletion::doArgumentHint( bool useIndex ) @@ -549,7 +549,7 @@ bool EditorCompletion::doArgumentHint( bool useIndex ) TQTextCursor *cursor = curEditor->textCursor(); int i = cursor->index() ; if ( !useIndex ) { - bool foundParen = FALSE; + bool foundParen = false; int closeParens = 0; while ( i >= 0 ) { if ( cursor->paragraph()->at( i )->c == ')' && i != cursor->index() ) @@ -557,7 +557,7 @@ bool EditorCompletion::doArgumentHint( bool useIndex ) if ( cursor->paragraph()->at( i )->c == '(' ) { closeParens--; if ( closeParens == -1 ) { - foundParen = TRUE; + foundParen = true; break; } } @@ -565,18 +565,18 @@ bool EditorCompletion::doArgumentHint( bool useIndex ) } if ( !foundParen ) - return FALSE; + return false; } int j = i - 1; - bool foundSpace = FALSE; - bool foundNonSpace = FALSE; + bool foundSpace = false; + bool foundNonSpace = false; while ( j >= 0 ) { if ( foundNonSpace && ( cursor->paragraph()->at( j )->c == ' ' || cursor->paragraph()->at( j )->c == ',' ) ) { - foundSpace = TRUE; + foundSpace = true; break; } if ( !foundNonSpace && ( cursor->paragraph()->at( j )->c != ' ' || cursor->paragraph()->at( j )->c != ',' ) ) - foundNonSpace = TRUE; + foundNonSpace = true; --j; } if ( foundSpace ) @@ -601,7 +601,7 @@ bool EditorCompletion::doArgumentHint( bool useIndex ) TQString pre, post; TQValueList<TQStringList> argl = functionParameters( function, sep, pre, post ); if ( argl.isEmpty() ) - return FALSE; + return false; TQString label; int w = 0; @@ -652,7 +652,7 @@ bool EditorCompletion::doArgumentHint( bool useIndex ) } w += 16; if ( label.isEmpty() ) - return FALSE; + return false; if ( functionLabel->isVisible() ) { functionLabel->resize( w + 50, TQMAX( functionLabel->fontMetrics().height(), 16 ) ); } else { @@ -672,7 +672,7 @@ bool EditorCompletion::doArgumentHint( bool useIndex ) } TQTimer::singleShot( 0, functionLabel, TQ_SLOT( relayout() ) ); - return TRUE; + return true; } TQValueList<TQStringList> EditorCompletion::functionParameters( const TQString &, TQChar &, TQString &, TQString & ) |
