diff options
Diffstat (limited to 'qt/qextscintillabase.cpp')
-rw-r--r-- | qt/qextscintillabase.cpp | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/qt/qextscintillabase.cpp b/qt/qextscintillabase.cpp index 63330d4..86c4857 100644 --- a/qt/qextscintillabase.cpp +++ b/qt/qextscintillabase.cpp @@ -3,35 +3,35 @@ // Copyright (c) 2006 // Riverbank Computing Limited <[email protected]> // -// This file is part of QScintilla. +// This file is part of TQScintilla. // -// This copy of QScintilla is free software; you can redistribute it and/or +// This copy of TQScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // -// QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY +// TQScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with -// QScintilla; see the file LICENSE. If not, write to the Free Software +// TQScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include <qapplication.h> -#include <qclipboard.h> -#include <qscrollbar.h> -#include <qlayout.h> -#include <qcolor.h> -#include <qevent.h> -#include <qdragobject.h> -#include <qpainter.h> -#include <qptrlist.h> +#include <tqapplication.h> +#include <tqclipboard.h> +#include <tqscrollbar.h> +#include <tqlayout.h> +#include <tqcolor.h> +#include <tqevent.h> +#include <tqdragobject.h> +#include <tqpainter.h> +#include <tqptrlist.h> -#include "qextscintillabase.h" -#include "ScintillaQt.h" +#include "tqextscintillabase.h" +#include "ScintillaTQt.h" // The #defines in Scintilla.h and the enums in qextscintillabase.h conflict @@ -61,40 +61,40 @@ static bool lexersLinked = FALSE; // The list of instances. -static QPtrList<QextScintillaBase> poolList; +static TQPtrList<QextScintillaBase> poolList; // The ctor. -QextScintillaBase::QextScintillaBase(QWidget *parent,const char *name,WFlags f) - : QWidget(parent,name,f) +QextScintillaBase::QextScintillaBase(TQWidget *parent,const char *name,WFlags f) + : TQWidget(parent,name,f) { sci = 0; - QGridLayout *layout = new QGridLayout(this,2,2); + TQGridLayout *tqlayout = new TQGridLayout(this,2,2); - txtarea = new QWidget(this,0,WRepaintNoErase|WResizeNoErase); - txtarea -> setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); + txtarea = new TQWidget(this,0,WRepaintNoErase|WResizeNoErase); + txtarea -> tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Expanding)); txtarea -> setMouseTracking(TRUE); txtarea -> setAcceptDrops(TRUE); txtarea -> setFocusPolicy(WheelFocus); txtarea -> setFocusProxy(this); - layout -> addWidget(txtarea,0,0); + tqlayout -> addWidget(txtarea,0,0); - vsb = new QScrollBar(Vertical,this); - layout -> addWidget(vsb,0,1); - connect(vsb,SIGNAL(valueChanged(int)),SLOT(handleVSb(int))); + vsb = new TQScrollBarQt::Vertical,this); + tqlayout -> addWidget(vsb,0,1); + connect(vsb,TQT_SIGNAL(valueChanged(int)),TQT_SLOT(handleVSb(int))); - hsb = new QScrollBar(Horizontal,this); - layout -> addWidget(hsb,1,0); - connect(hsb,SIGNAL(valueChanged(int)),SLOT(handleHSb(int))); + hsb = new TQScrollBarQt::Horizontal,this); + tqlayout -> addWidget(hsb,1,0); + connect(hsb,TQT_SIGNAL(valueChanged(int)),TQT_SLOT(handleHSb(int))); txtarea -> installEventFilter(this); setFocusPolicy(WheelFocus); - sci = new ScintillaQt(this); + sci = new ScintillaTQt(this); - SendScintilla(SCI_SETCARETPERIOD,QApplication::cursorFlashTime() / 2); + SendScintilla(SCI_SETCARETPERIOD,TQApplication::cursorFlashTime() / 2); // Make sure the lexers are linked in. if (!lexersLinked) @@ -104,10 +104,10 @@ QextScintillaBase::QextScintillaBase(QWidget *parent,const char *name,WFlags f) lexersLinked = TRUE; } - QClipboard *cb = QApplication::clipboard(); + TQClipboard *cb = TQApplication::tqclipboard(); if (cb -> supportsSelection()) - connect(cb,SIGNAL(selectionChanged()),SLOT(handleSelection())); + connect(cb,TQT_SIGNAL(selectionChanged()),TQT_SLOT(handleSelection())); // Add it to the pool. poolList.append(this); @@ -125,7 +125,7 @@ QextScintillaBase::~QextScintillaBase() // Return the viewport widget. -QWidget *QextScintillaBase::viewport() const +TQWidget *QextScintillaBase::viewport() const { return txtarea; } @@ -165,7 +165,7 @@ long QextScintillaBase::SendScintilla(unsigned int msg,long cpMin,long cpMax, // Send a message to the real Scintilla widget that needs a RangeToFormat // structure. long QextScintillaBase::SendScintilla(unsigned int msg,unsigned long wParam, - QPainter *hdc,const QRect &rc, + TQPainter *hdc,const TQRect &rc, long cpMin,long cpMax) { RangeToFormat rf; @@ -186,7 +186,7 @@ long QextScintillaBase::SendScintilla(unsigned int msg,unsigned long wParam, // Send a message to the real Scintilla widget that needs a colour. long QextScintillaBase::SendScintilla(unsigned int msg,unsigned long wParam, - const QColor &col) + const TQColor &col) { long lParam = (col.blue() << 16) | (col.green() << 8) | col.red(); @@ -195,7 +195,7 @@ long QextScintillaBase::SendScintilla(unsigned int msg,unsigned long wParam, // Send a message to the real Scintilla widget that needs a colour. -long QextScintillaBase::SendScintilla(unsigned int msg,const QColor &col) +long QextScintillaBase::SendScintilla(unsigned int msg,const TQColor &col) { unsigned long wParam = (col.blue() << 16) | (col.green() << 8) | col.red(); @@ -204,61 +204,61 @@ long QextScintillaBase::SendScintilla(unsigned int msg,const QColor &col) // Handle events on behalf of the text area. -bool QextScintillaBase::eventFilter(QObject *o,QEvent *e) +bool QextScintillaBase::eventFilter(TQObject *o,TQEvent *e) { if (o != txtarea) - return QWidget::eventFilter(o,e); + return TQWidget::eventFilter(o,e); bool used = TRUE; switch (e -> type()) { - case QEvent::Paint: - sci -> paintEvent(static_cast<QPaintEvent *>(e)); + case TQEvent::Paint: + sci -> paintEvent(static_cast<TQPaintEvent *>(e)); break; - case QEvent::Resize: + case TQEvent::Resize: sci -> ChangeSize(); break; - case QEvent::MouseButtonPress: - mousePress(static_cast<QMouseEvent *>(e)); + case TQEvent::MouseButtonPress: + mousePress(static_cast<TQMouseEvent *>(e)); break; - case QEvent::MouseButtonRelease: - mouseRelease(static_cast<QMouseEvent *>(e)); + case TQEvent::MouseButtonRelease: + mouseRelease(static_cast<TQMouseEvent *>(e)); break; - case QEvent::MouseButtonDblClick: - mouseDoubleClick(static_cast<QMouseEvent *>(e)); + case TQEvent::MouseButtonDblClick: + mouseDoubleClick(static_cast<TQMouseEvent *>(e)); break; - case QEvent::MouseMove: - mouseMove(static_cast<QMouseEvent *>(e)); + case TQEvent::MouseMove: + mouseMove(static_cast<TQMouseEvent *>(e)); break; - case QEvent::Wheel: - mouseWheel(static_cast<QWheelEvent *>(e)); + case TQEvent::Wheel: + mouseWheel(static_cast<TQWheelEvent *>(e)); break; - case QEvent::ContextMenu: - contextMenu(static_cast<QContextMenuEvent *>(e)); + case TQEvent::ContextMenu: + contextMenu(static_cast<TQContextMenuEvent *>(e)); break; - case QEvent::DragEnter: - sci -> dragEnterEvent(static_cast<QDragEnterEvent *>(e)); + case TQEvent::DragEnter: + sci -> dragEnterEvent(static_cast<TQDragEnterEvent *>(e)); break; - case QEvent::DragMove: - sci -> dragMoveEvent(static_cast<QDragMoveEvent *>(e)); + case TQEvent::DragMove: + sci -> dragMoveEvent(static_cast<TQDragMoveEvent *>(e)); break; - case QEvent::DragLeave: - sci -> dragLeaveEvent(static_cast<QDragLeaveEvent *>(e)); + case TQEvent::DragLeave: + sci -> dragLeaveEvent(static_cast<TQDragLeaveEvent *>(e)); break; - case QEvent::Drop: - sci -> dropEvent(static_cast<QDropEvent *>(e)); + case TQEvent::Drop: + sci -> dropEvent(static_cast<TQDropEvent *>(e)); break; default: @@ -269,14 +269,14 @@ bool QextScintillaBase::eventFilter(QObject *o,QEvent *e) } -// Handle the timer on behalf of the ScintillaQt instance. +// Handle the timer on behalf of the ScintillaTQt instance. void QextScintillaBase::handleTimer() { sci -> Tick(); } -// Handle the context menu on behalf of the ScintillaQt instance. +// Handle the context menu on behalf of the ScintillaTQt instance. void QextScintillaBase::handlePopUp(int cmd) { sci -> Command(cmd); @@ -284,21 +284,21 @@ void QextScintillaBase::handlePopUp(int cmd) // Re-implemented to tell the widget it has the focus. -void QextScintillaBase::focusInEvent(QFocusEvent *) +void QextScintillaBase::focusInEvent(TQFocusEvent *) { sci -> SetFocusState(true); } // Re-implemented to tell the widget it has lost the focus. -void QextScintillaBase::focusOutEvent(QFocusEvent *) +void QextScintillaBase::focusOutEvent(TQFocusEvent *) { sci -> SetFocusState(false); } // Handle a mouse button press. -void QextScintillaBase::mousePress(QMouseEvent *me) +void QextScintillaBase::mousePress(TQMouseEvent *me) { setFocus(); @@ -312,7 +312,7 @@ void QextScintillaBase::mousePress(QMouseEvent *me) // It is a triple click if the timer is running and the // mouse hasn't moved too much. - if (triple_click.isActive() && (me -> globalPos() - triple_click_at).manhattanLength() < QApplication::startDragDistance()) + if (triple_click.isActive() && (me -> globalPos() - triple_click_at).manhattanLength() < TQApplication::startDragDistance()) clickTime = sci -> lastClickTime + Platform::DoubleClickTime() - 1; else clickTime = sci -> lastClickTime + Platform::DoubleClickTime() + 1; @@ -329,7 +329,7 @@ void QextScintillaBase::mousePress(QMouseEvent *me) case MidButton: { - QClipboard *cb = QApplication::clipboard(); + TQClipboard *cb = TQApplication::tqclipboard(); if (cb -> supportsSelection()) { @@ -353,9 +353,9 @@ void QextScintillaBase::mousePress(QMouseEvent *me) // Handle a context menu event. -void QextScintillaBase::contextMenu(QContextMenuEvent *cme) +void QextScintillaBase::contextMenu(TQContextMenuEvent *cme) { - QApplication::sendEvent(this,cme); + TQApplication::sendEvent(this,cme); if (!cme -> isConsumed()) sci -> ContextMenu(Point(cme -> globalX(),cme -> globalY())); @@ -363,7 +363,7 @@ void QextScintillaBase::contextMenu(QContextMenuEvent *cme) // Handle a mouse button releases. -void QextScintillaBase::mouseRelease(QMouseEvent *me) +void QextScintillaBase::mouseRelease(TQMouseEvent *me) { if (sci -> HaveMouseCapture() && me -> button() == LeftButton) { @@ -375,26 +375,26 @@ void QextScintillaBase::mouseRelease(QMouseEvent *me) // Handle a mouse move. -void QextScintillaBase::mouseMove(QMouseEvent *me) +void QextScintillaBase::mouseMove(TQMouseEvent *me) { sci -> ButtonMove(Point(me -> x(),me -> y())); } // Handle a mouse wheel event. -void QextScintillaBase::mouseWheel(QWheelEvent *we) +void QextScintillaBase::mouseWheel(TQWheelEvent *we) { setFocus(); - if (we -> orientation() == Horizontal || we -> state() & ShiftButton) - QApplication::sendEvent(hsb,we); - else if (we -> orientation() == Vertical) - QApplication::sendEvent(vsb,we); + if (we -> orientation() ==Qt::Horizontal || we -> state() & ShiftButton) + TQApplication::sendEvent(hsb,we); + else if (we -> orientation() ==Qt::Vertical) + TQApplication::sendEvent(vsb,we); } // Handle a mouse button double click. -void QextScintillaBase::mouseDoubleClick(QMouseEvent *me) +void QextScintillaBase::mouseDoubleClick(TQMouseEvent *me) { setFocus(); @@ -412,13 +412,13 @@ void QextScintillaBase::mouseDoubleClick(QMouseEvent *me) // Remember the current position and time in case it turns into a // triple click. triple_click_at = me -> globalPos(); - triple_click.start(QApplication::doubleClickInterval()); + triple_click.start(TQApplication::doubleClickInterval()); } } // Re-implemented to handle key press events. -void QextScintillaBase::keyPressEvent(QKeyEvent *ke) +void QextScintillaBase::keyPressEvent(TQKeyEvent *ke) { unsigned key; @@ -488,7 +488,7 @@ void QextScintillaBase::keyPressEvent(QKeyEvent *ke) // key. if (ke -> text().length() == 1) { - if ((key = ke -> text()[0].unicode()) >= 0x80) + if ((key = ke -> text()[0].tqunicode()) >= 0x80) key = 0; } else @@ -521,7 +521,7 @@ void QextScintillaBase::keyPressEvent(QKeyEvent *ke) { if (ke -> text().length() > 0 && !ke -> text()[0].isNull()) { - QCString s = ke -> text().utf8(); + TQCString s = ke -> text().utf8(); sci -> AddCharUTF(s.data(),s.length()); @@ -558,25 +558,25 @@ void QextScintillaBase::handleVSb(int val) // Handle the horizontal scrollbar. void QextScintillaBase::handleHSb(int val) { - sci -> HorizontalScrollTo(val); + sci ->Qt::HorizontalScrollTo(val); } // Return the current prefered size. -QSize QextScintillaBase::sizeHint() const +TQSize QextScintillaBase::tqsizeHint() const { int height = sci -> vs.lineHeight * sci -> pdoc -> LinesTotal(); if (sci -> horizontalScrollBarVisible) - height += hsb -> sizeHint().height(); + height += hsb -> tqsizeHint().height(); - return QSize(sci -> scrollWidth,height); + return TQSize(sci -> scrollWidth,height); } // Handle the selection changing. void QextScintillaBase::handleSelection() { - if (!QApplication::clipboard() -> ownsSelection()) + if (!TQApplication::tqclipboard() -> ownsSelection()) sci -> UnclaimSelection(); } |