diff options
Diffstat (limited to 'qt/ScintillaQt.cpp')
-rw-r--r-- | qt/ScintillaQt.cpp | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/qt/ScintillaQt.cpp b/qt/ScintillaQt.cpp index 4753785..2fde58f 100644 --- a/qt/ScintillaQt.cpp +++ b/qt/ScintillaQt.cpp @@ -1,39 +1,39 @@ -// The implementation of the Qt specific subclass of ScintillaBase. +// The implementation of the TQt specific subclass of ScintillaBase. // // Copyright (c) 2006 // Riverbank Computing Limited <info@riverbankcomputing.co.uk> // -// 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 <qscrollbar.h> -#include <qpopupmenu.h> -#include <qstring.h> -#include <qtimer.h> -#include <qclipboard.h> -#include <qdragobject.h> -#include <qpainter.h> +#include <tqapplication.h> +#include <tqscrollbar.h> +#include <tqpopupmenu.h> +#include <tqstring.h> +#include <tqtimer.h> +#include <tqclipboard.h> +#include <tqdragobject.h> +#include <tqpainter.h> -#include "qextscintillabase.h" -#include "ScintillaQt.h" +#include "tqextscintillabase.h" +#include "ScintillaTQt.h" -// We want to use the Scintilla notification names as Qt signal names. +// We want to use the Scintilla notification names as TQt signal names. #undef SCEN_CHANGE #undef SCN_AUTOCSELECTION #undef SCN_CALLTIPCLICK @@ -83,35 +83,35 @@ enum // The ctor. -ScintillaQt::ScintillaQt(QextScintillaBase *qsb_) : +ScintillaTQt::ScintillaTQt(QextScintillaBase *qsb_) : capturedMouse(false), qsb(qsb_) { wMain = qsb -> txtarea; - // We aren't a QObject so we use the API class to do QObject related + // We aren't a TQObject so we use the API class to do TQObject related // things for us. - qsb -> connect(&qtimer,SIGNAL(timeout()),SLOT(handleTimer())); + qsb -> connect(&qtimer,TQT_SIGNAL(timeout()),TQT_SLOT(handleTimer())); Initialise(); } // The dtor. -ScintillaQt::~ScintillaQt() +ScintillaTQt::~ScintillaTQt() { Finalise(); } // Initialise the instance. -void ScintillaQt::Initialise() +void ScintillaTQt::Initialise() { SetTicking(true); } // Tidy up the instance. -void ScintillaQt::Finalise() +void ScintillaTQt::Finalise() { SetTicking(false); ScintillaBase::Finalise(); @@ -119,7 +119,7 @@ void ScintillaQt::Finalise() // Start a drag. -void ScintillaQt::StartDrag() +void ScintillaTQt::StartDrag() { // Allow applications to re-implement the drag start. qsb -> startDrag(); @@ -127,9 +127,9 @@ void ScintillaQt::StartDrag() // Do the real drag start. -void ScintillaQt::StartDragImpl() +void ScintillaTQt::StartDragImpl() { - QDragObject *dobj = new QTextDrag(textRange(&drag),qsb -> txtarea); + TQDragObject *dobj = new TQTextDrag(textRange(&drag),qsb -> txtarea); // Remove the dragged text if it was a move to another widget or // application. @@ -142,40 +142,40 @@ void ScintillaQt::StartDragImpl() // Handle a drag enter event. -void ScintillaQt::dragEnterEvent(QDragEnterEvent *dee) +void ScintillaTQt::dragEnterEvent(TQDragEnterEvent *dee) { dragMoveEvent(dee); } // Handle a drag move event. -void ScintillaQt::dragMoveEvent(QDragMoveEvent *dme) +void ScintillaTQt::dragMoveEvent(TQDragMoveEvent *dme) { - dme -> acceptAction(QTextDrag::canDecode(dme)); + dme -> acceptAction(TQTextDrag::canDecode(dme)); SetDragPosition(PositionFromLocation(Point(dme -> pos().x(),dme -> pos().y()))); } // Handle a drag leave event. -void ScintillaQt::dragLeaveEvent(QDragLeaveEvent *dle) +void ScintillaTQt::dragLeaveEvent(TQDragLeaveEvent *dle) { SetDragPosition(invalidPosition); } // Handle a drop event. -void ScintillaQt::dropEvent(QDropEvent *de) +void ScintillaTQt::dropEvent(TQDropEvent *de) { - QString text; + TQString text; - if (QTextDrag::decode(de,text)) + if (TQTextDrag::decode(de,text)) { - bool moving = (de -> source() == qsb -> txtarea && de -> action() == QDropEvent::Move); + bool moving = (de -> source() == qsb -> txtarea && de -> action() == TQDropEvent::Move); de -> acceptAction(); const char *s; - QCString us; + TQCString us; if (IsUnicodeMode()) { @@ -193,7 +193,7 @@ void ScintillaQt::dropEvent(QDropEvent *de) // Re-implement to trap certain messages. -sptr_t ScintillaQt::WndProc(unsigned int iMessage,uptr_t wParam,sptr_t lParam) +sptr_t ScintillaTQt::WndProc(unsigned int iMessage,uptr_t wParam,sptr_t lParam) { switch (iMessage) { @@ -213,14 +213,14 @@ sptr_t ScintillaQt::WndProc(unsigned int iMessage,uptr_t wParam,sptr_t lParam) // Windows nonsense. -sptr_t ScintillaQt::DefWndProc(unsigned int,uptr_t,sptr_t) +sptr_t ScintillaTQt::DefWndProc(unsigned int,uptr_t,sptr_t) { return 0; } // Manage the timer. -void ScintillaQt::SetTicking(bool on) +void ScintillaTQt::SetTicking(bool on) { if (timer.ticking != on) { @@ -237,7 +237,7 @@ void ScintillaQt::SetTicking(bool on) // Grab or release the mouse (and keyboard). -void ScintillaQt::SetMouseCapture(bool on) +void ScintillaTQt::SetMouseCapture(bool on) { if (mouseDownCaptures) if (on) @@ -250,21 +250,21 @@ void ScintillaQt::SetMouseCapture(bool on) // Return true if the mouse/keyboard are currently grabbed. -bool ScintillaQt::HaveMouseCapture() +bool ScintillaTQt::HaveMouseCapture() { return capturedMouse; } // Set the position of the vertical scrollbar. -void ScintillaQt::SetVerticalScrollPos() +void ScintillaTQt::SetVerticalScrollPos() { qsb -> vsb -> setValue(topLine); } // Set the position of the horizontal scrollbar. -void ScintillaQt::SetHorizontalScrollPos() +void ScintillaTQt::SetHorizontalScrollPos() { qsb -> hsb -> setValue(xOffset); } @@ -272,7 +272,7 @@ void ScintillaQt::SetHorizontalScrollPos() // Set the extent of the vertical and horizontal scrollbars and return true if // the view needs re-drawing. -bool ScintillaQt::ModifyScrollBars(int nMax,int nPage) +bool ScintillaTQt::ModifyScrollBars(int nMax,int nPage) { qsb -> vsb -> setMinValue(0); qsb -> vsb -> setMaxValue(nMax - nPage + 1); @@ -288,7 +288,7 @@ bool ScintillaQt::ModifyScrollBars(int nMax,int nPage) // Called after SCI_SETWRAPMODE and SCI_SETHSCROLLBAR. -void ScintillaQt::ReconfigureScrollBars() +void ScintillaTQt::ReconfigureScrollBars() { // Hide or show the scrollbars if needed. if (horizontalScrollBarVisible && wrapState == eWrapNone) @@ -304,15 +304,15 @@ void ScintillaQt::ReconfigureScrollBars() // Notify interested parties of any change in the document. -void ScintillaQt::NotifyChange() +void ScintillaTQt::NotifyChange() { emit qsb -> SCEN_CHANGE(); } // Notify interested parties of various events. This is the main mapping -// between Scintilla notifications and Qt signals. -void ScintillaQt::NotifyParent(SCNotification scn) +// between Scintilla notifications and TQt signals. +void ScintillaTQt::NotifyParent(SCNotification scn) { switch (scn.nmhdr.code) { @@ -408,7 +408,7 @@ void ScintillaQt::NotifyParent(SCNotification scn) // Handle a key that hasn't been filtered out as a command key. Return 0 if we // haven't handled it. -int ScintillaQt::KeyDefault(int key,int modifiers) +int ScintillaTQt::KeyDefault(int key,int modifiers) { // On Windows Alt Gr is returned as Ctrl-Alt (on X11 it seems to be the // Meta key). We therefore ignore that combination. @@ -428,14 +428,14 @@ int ScintillaQt::KeyDefault(int key,int modifiers) } -// Convert a text range to a QString. -QString ScintillaQt::textRange(const SelectionText *text) +// Convert a text range to a TQString. +TQString ScintillaTQt::textRange(const SelectionText *text) { - QString qs; + TQString qs; if (text -> s) if (IsUnicodeMode()) - qs = QString::fromUtf8(text -> s); + qs = TQString::fromUtf8(text -> s); else qs.setLatin1(text -> s); @@ -444,14 +444,14 @@ QString ScintillaQt::textRange(const SelectionText *text) // Copy the selected text to the clipboard. -void ScintillaQt::CopyToClipboard(const SelectionText &selectedText) +void ScintillaTQt::CopyToClipboard(const SelectionText &selectedText) { - QApplication::clipboard() -> setText(textRange(&selectedText)); + TQApplication::tqclipboard() -> setText(textRange(&selectedText)); } // Implement copy. -void ScintillaQt::Copy() +void ScintillaTQt::Copy() { if (currentPos != anchor) { @@ -464,9 +464,9 @@ void ScintillaQt::Copy() // Implement paste. -void ScintillaQt::Paste() +void ScintillaTQt::Paste() { - QString str = QApplication::clipboard() -> text(); + TQString str = TQApplication::tqclipboard() -> text(); if (str.isEmpty()) return; @@ -479,7 +479,7 @@ void ScintillaQt::Paste() if (IsUnicodeMode()) { - QCString s = str.utf8(); + TQCString s = str.utf8(); len = s.length(); @@ -505,26 +505,26 @@ void ScintillaQt::Paste() } -// A simple QWidget sub-class to implement a call tip. No need to bother with -// all the moc stuff. -class QtCallTip : public QWidget +// A simple TQWidget sub-class to implement a call tip. No need to bother with +// all the tqmoc stuff. +class TQtCallTip : public TQWidget { public: - QtCallTip(QWidget *parent,ScintillaQt *sci_); - ~QtCallTip(); + TQtCallTip(TQWidget *parent,ScintillaTQt *sci_); + ~TQtCallTip(); protected: - void paintEvent(QPaintEvent *); - void mousePressEvent(QMouseEvent *me); + void paintEvent(TQPaintEvent *); + void mousePressEvent(TQMouseEvent *me); private: - ScintillaQt *sci; + ScintillaTQt *sci; }; // Create a call tip. -QtCallTip::QtCallTip(QWidget *parent,ScintillaQt *sci_) : - QWidget(parent,0,WType_Popup|WStyle_Customize|WStyle_NoBorder), sci(sci_) +TQtCallTip::TQtCallTip(TQWidget *parent,ScintillaTQt *sci_) : + TQWidget(parent,0,WType_Popup|WStyle_Customize|WStyle_NoBorder), sci(sci_) { // Ensure that the main window keeps the focus (and the caret flashing) // when this is displayed. @@ -533,7 +533,7 @@ QtCallTip::QtCallTip(QWidget *parent,ScintillaQt *sci_) : // Destroy a call tip. -QtCallTip::~QtCallTip() +TQtCallTip::~TQtCallTip() { // Ensure that the main window doesn't receive a focus out event when // this is destroyed. @@ -542,13 +542,13 @@ QtCallTip::~QtCallTip() // Paint a call tip. -void QtCallTip::paintEvent(QPaintEvent *) +void TQtCallTip::paintEvent(TQPaintEvent *) { Surface *surfaceWindow = Surface::Allocate(); if (surfaceWindow) { - QPainter p(this); + TQPainter p(this); surfaceWindow -> Init(&p,0); sci -> ct.PaintCT(surfaceWindow); @@ -560,7 +560,7 @@ void QtCallTip::paintEvent(QPaintEvent *) // Handle a mouse press in a call tip. -void QtCallTip::mousePressEvent(QMouseEvent *me) +void TQtCallTip::mousePressEvent(TQMouseEvent *me) { Point pt; @@ -573,10 +573,10 @@ void QtCallTip::mousePressEvent(QMouseEvent *me) // Create a call tip window. -void ScintillaQt::CreateCallTipWindow(PRectangle rc) +void ScintillaTQt::CreateCallTipWindow(PRectangle rc) { if (!ct.wCallTip.Created()) - ct.wCallTip = ct.wDraw = new QtCallTip(qsb,this); + ct.wCallTip = ct.wDraw = new TQtCallTip(qsb,this); PWindow(ct.wCallTip) -> resize(rc.right - rc.left,rc.bottom - rc.top); ct.wCallTip.Show(); @@ -584,15 +584,15 @@ void ScintillaQt::CreateCallTipWindow(PRectangle rc) // Add an item to the right button menu. -void ScintillaQt::AddToPopUp(const char *label,int cmd,bool enabled) +void ScintillaTQt::AddToPopUp(const char *label,int cmd,bool enabled) { - QPopupMenu *pm = static_cast<QPopupMenu *>(popup.GetID()); + TQPopupMenu *pm = static_cast<TQPopupMenu *>(popup.GetID()); if (label[0] != '\0') { - QString tr_label = qApp -> translate("ContextMenu",label); + TQString tr_label = tqApp -> translate("ContextMenu",label); - pm -> insertItem(tr_label,qsb,SLOT(handlePopUp(int)),0,cmd); + pm -> insertItem(tr_label,qsb,TQT_SLOT(handlePopUp(int)),0,cmd); pm -> setItemEnabled(cmd,enabled); } else @@ -601,13 +601,13 @@ void ScintillaQt::AddToPopUp(const char *label,int cmd,bool enabled) // Claim the selection. -void ScintillaQt::ClaimSelection() +void ScintillaTQt::ClaimSelection() { bool isSel = (currentPos != anchor); if (isSel) { - QClipboard *cb = QApplication::clipboard(); + TQClipboard *cb = TQApplication::tqclipboard(); // If we support X11 style selection then make it available // now. @@ -630,12 +630,12 @@ void ScintillaQt::ClaimSelection() else primarySelection = false; - emit qsb -> QSCN_SELCHANGED(isSel); + emit qsb -> TQSCN_SELCHANGED(isSel); } // Unclaim the selection. -void ScintillaQt::UnclaimSelection() +void ScintillaTQt::UnclaimSelection() { if (primarySelection) { @@ -646,7 +646,7 @@ void ScintillaQt::UnclaimSelection() // Implemented to provide compatibility with the Windows version. -sptr_t ScintillaQt::DirectFunction(ScintillaQt *sciThis,unsigned int iMessage, +sptr_t ScintillaTQt::DirectFunction(ScintillaTQt *sciThis,unsigned int iMessage, uptr_t wParam,sptr_t lParam) { return sciThis -> WndProc(iMessage,wParam,lParam); @@ -654,13 +654,13 @@ sptr_t ScintillaQt::DirectFunction(ScintillaQt *sciThis,unsigned int iMessage, // Draw the contents of the widget. -void ScintillaQt::paintEvent(QPaintEvent *pe) +void ScintillaTQt::paintEvent(TQPaintEvent *pe) { bool isUnicodeMode = (pdoc && pdoc -> dbcsCodePage == SC_CP_UTF8); paintState = painting; - const QRect &qr = pe -> rect(); + const TQRect &qr = pe -> rect(); rcPaint.left = qr.left(); rcPaint.top = qr.top(); @@ -674,7 +674,7 @@ void ScintillaQt::paintEvent(QPaintEvent *pe) if (sw) { - QPainter painter(PWindow(wMain)); + TQPainter painter(PWindow(wMain)); sw -> Init(&painter,0); sw -> SetUnicodeMode(isUnicodeMode); @@ -683,7 +683,7 @@ void ScintillaQt::paintEvent(QPaintEvent *pe) delete sw; // If the painting area was insufficient to cover the new style - // or brace highlight positions then repaint the whole thing. + // or brace highlight positions then tqrepaint the whole thing. if (paintState == paintAbandoned) PWindow(wMain) -> update(); } |