summaryrefslogtreecommitdiffstats
path: root/krita/ui/kis_canvas.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /krita/ui/kis_canvas.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krita/ui/kis_canvas.cc')
-rw-r--r--krita/ui/kis_canvas.cc324
1 files changed, 162 insertions, 162 deletions
diff --git a/krita/ui/kis_canvas.cc b/krita/ui/kis_canvas.cc
index 499f4c29..4335c197 100644
--- a/krita/ui/kis_canvas.cc
+++ b/krita/ui/kis_canvas.cc
@@ -18,7 +18,7 @@
*
Some of the X11-specific event handling code is based upon code from
- src/kernel/qapplication_x11.cpp from the Qt GUI Toolkit and is subject
+ src/kernel/qapplication_x11.cpp from the TQt GUI Toolkit and is subject
to the following license and copyright:
****************************************************************************
@@ -30,27 +30,27 @@
**
** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
**
-** This file is part of the kernel module of the Qt GUI Toolkit.
+** This file is part of the kernel module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
+** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses for Unix/X11 may use this file in accordance with the Qt Commercial
+** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
+** licenses for Unix/X11 may use this file in accordance with the TQt Commercial
** License Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** information about TQt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
@@ -58,7 +58,7 @@
**
**********************************************************************/
-#include <qcursor.h>
+#include <tqcursor.h>
#include "kis_canvas.h"
#include "kis_cursor.h"
@@ -73,10 +73,10 @@
#include "kis_input_device.h"
#include "fixx11h.h"
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
-#include <qdesktopwidget.h>
-#include <qapplication.h>
+#include <tqdesktopwidget.h>
+#include <tqapplication.h>
#include <X11/keysym.h>
@@ -97,14 +97,14 @@ std::map<XID, KisCanvasWidget::X11TabletDevice> KisCanvasWidget::X11TabletDevice
#endif // EXTENDED_X11_TABLET_SUPPORT
-#endif // Q_WS_X11
+#endif // TQ_WS_X11
KisCanvasWidget::KisCanvasWidget()
{
m_enableMoveEventCompressionHint = false;
m_lastPressure = 0;
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
if (!X11SupportInitialised) {
initX11Support();
}
@@ -118,74 +118,74 @@ KisCanvasWidget::~KisCanvasWidget()
{
}
-void KisCanvasWidget::widgetGotPaintEvent(QPaintEvent *e)
+void KisCanvasWidget::widgetGotPaintEvent(TQPaintEvent *e)
{
emit sigGotPaintEvent(e);
}
-void KisCanvasWidget::widgetGotMousePressEvent(QMouseEvent *e)
+void KisCanvasWidget::widgetGotMousePressEvent(TQMouseEvent *e)
{
KisButtonPressEvent ke(KisInputDevice::mouse(), e->pos(), e->globalPos(), PRESSURE_DEFAULT, 0, 0, e->button(), e->state());
buttonPressEvent(&ke);
}
-void KisCanvasWidget::widgetGotMouseReleaseEvent(QMouseEvent *e)
+void KisCanvasWidget::widgetGotMouseReleaseEvent(TQMouseEvent *e)
{
KisButtonReleaseEvent ke(KisInputDevice::mouse(), e->pos(), e->globalPos(), PRESSURE_DEFAULT, 0, 0, e->button(), e->state());
buttonReleaseEvent(&ke);
}
-void KisCanvasWidget::widgetGotMouseDoubleClickEvent(QMouseEvent *e)
+void KisCanvasWidget::widgetGotMouseDoubleClickEvent(TQMouseEvent *e)
{
KisDoubleClickEvent ke(KisInputDevice::mouse(), e->pos(), e->globalPos(), PRESSURE_DEFAULT, 0, 0, e->button(), e->state());
doubleClickEvent(&ke);
}
-void KisCanvasWidget::widgetGotMouseMoveEvent(QMouseEvent *e)
+void KisCanvasWidget::widgetGotMouseMoveEvent(TQMouseEvent *e)
{
KisMoveEvent ke(KisInputDevice::mouse(), e->pos(), e->globalPos(), PRESSURE_DEFAULT, 0, 0, e->state());
moveEvent(&ke);
}
-void KisCanvasWidget::widgetGotTabletEvent(QTabletEvent *e)
+void KisCanvasWidget::widgetGotTabletEvent(TQTabletEvent *e)
{
KisInputDevice device;
switch (e->device()) {
default:
- case QTabletEvent::NoDevice:
- case QTabletEvent::Stylus:
+ case TQTabletEvent::NoDevice:
+ case TQTabletEvent::Stylus:
device = KisInputDevice::stylus();
break;
- case QTabletEvent::Puck:
+ case TQTabletEvent::Puck:
device = KisInputDevice::puck();
break;
- case QTabletEvent::Eraser:
+ case TQTabletEvent::Eraser:
device = KisInputDevice::eraser();
break;
}
double pressure = e->pressure() / 255.0;
- if (e->type() == QEvent::TabletPress) {
+ if (e->type() == TQEvent::TabletPress) {
KisButtonPressEvent ke(device, e->pos(), e->globalPos(), pressure, e->xTilt(), e->yTilt(), Qt::LeftButton, Qt::NoButton);
translateTabletEvent(&ke);
}
else
- if (e->type() == QEvent::TabletRelease) {
+ if (e->type() == TQEvent::TabletRelease) {
KisButtonReleaseEvent ke(device, e->pos(), e->globalPos(), pressure, e->xTilt(), e->yTilt(), Qt::LeftButton, Qt::NoButton);
translateTabletEvent(&ke);
}
else {
KisMoveEvent ke(device, e->pos(), e->globalPos(), pressure, e->xTilt(), e->yTilt(), Qt::NoButton);
translateTabletEvent(&ke);
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
// Fix the problem that when you change from using a tablet device to the mouse,
// the first mouse button event is not recognised. This is because we handle
- // X11 core mouse move events directly so Qt does not get to see them. This breaks
- // the tablet event accept/ignore mechanism, causing Qt to consume the first
+ // X11 core mouse move events directly so TQt does not get to see them. This breaks
+ // the tablet event accept/ignore mechanism, causing TQt to consume the first
// mouse button event it sees, instead of a mouse move. 'Ignoring' tablet move events
- // stops Qt from stealing the next mouse button event. This does not affect the
+ // stops TQt from stealing the next mouse button event. This does not affect the
// tablet aware tools as they do not care about mouse moves while the tablet device is
// drawing.
e->ignore();
@@ -193,37 +193,37 @@ void KisCanvasWidget::widgetGotTabletEvent(QTabletEvent *e)
}
}
-void KisCanvasWidget::widgetGotEnterEvent(QEvent *e)
+void KisCanvasWidget::widgetGotEnterEvent(TQEvent *e)
{
emit sigGotEnterEvent(e);
}
-void KisCanvasWidget::widgetGotLeaveEvent(QEvent *e)
+void KisCanvasWidget::widgetGotLeaveEvent(TQEvent *e)
{
emit sigGotLeaveEvent(e);
}
-void KisCanvasWidget::widgetGotWheelEvent(QWheelEvent *e)
+void KisCanvasWidget::widgetGotWheelEvent(TQWheelEvent *e)
{
emit sigGotMouseWheelEvent(e);
}
-void KisCanvasWidget::widgetGotKeyPressEvent(QKeyEvent *e)
+void KisCanvasWidget::widgetGotKeyPressEvent(TQKeyEvent *e)
{
emit sigGotKeyPressEvent(e);
}
-void KisCanvasWidget::widgetGotKeyReleaseEvent(QKeyEvent *e)
+void KisCanvasWidget::widgetGotKeyReleaseEvent(TQKeyEvent *e)
{
emit sigGotKeyReleaseEvent(e);
}
-void KisCanvasWidget::widgetGotDragEnterEvent(QDragEnterEvent *e)
+void KisCanvasWidget::widgetGotDragEnterEvent(TQDragEnterEvent *e)
{
emit sigGotDragEnterEvent(e);
}
-void KisCanvasWidget::widgetGotDropEvent(QDropEvent *e)
+void KisCanvasWidget::widgetGotDropEvent(TQDropEvent *e)
{
emit sigGotDropEvent(e);
}
@@ -235,7 +235,7 @@ void KisCanvasWidget::moveEvent(KisMoveEvent *e)
void KisCanvasWidget::buttonPressEvent(KisButtonPressEvent *e)
{
- QWidget *widget = dynamic_cast<QWidget *>(this);
+ TQWidget *widget = dynamic_cast<TQWidget *>(this);
Q_ASSERT(widget != 0);
if (widget) {
@@ -291,7 +291,7 @@ void KisCanvasWidget::translateTabletEvent(KisEvent *e)
m_lastPressure = e->pressure();
}
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
void KisCanvasWidget::initX11Support()
{
@@ -302,25 +302,25 @@ void KisCanvasWidget::initX11Support()
X11SupportInitialised = true;
- Display *x11Display = QApplication::desktop()->x11Display();
+ Display *x11Display = TQApplication::desktop()->x11Display();
- // Look at the modifier mapping and get the correct masks for alt/meta
+ // Look at the modifier mapping and get the correct tqmasks for alt/meta
XModifierKeymap *map = XGetModifierMapping(x11Display);
if (map) {
int mapIndex = 0;
- for (int maskIndex = 0; maskIndex < 8; maskIndex++) {
+ for (int tqmaskIndex = 0; tqmaskIndex < 8; tqmaskIndex++) {
for (int i = 0; i < map->max_keypermod; i++) {
if (map->modifiermap[mapIndex]) {
KeySym sym = XKeycodeToKeysym(x11Display, map->modifiermap[mapIndex], 0);
if (X11AltMask == 0 && (sym == XK_Alt_L || sym == XK_Alt_R)) {
- X11AltMask = 1 << maskIndex;
+ X11AltMask = 1 << tqmaskIndex;
}
if (X11MetaMask == 0 && (sym == XK_Meta_L || sym == XK_Meta_R)) {
- X11MetaMask = 1 << maskIndex;
+ X11MetaMask = 1 << tqmaskIndex;
}
}
@@ -356,9 +356,9 @@ void KisCanvasWidget::initX11Support()
tabletDevice.readSettingsFromConfig();
- QString lowerCaseName = tabletDevice.name().lower();
+ TQString lowerCaseName = tabletDevice.name().lower();
- // Find the devices that Qt will use as its stylus and eraser devices.
+ // Find the devices that TQt will use as its stylus and eraser devices.
if (!foundStylus || !foundEraser) {
if (lowerCaseName.startsWith("stylus") || lowerCaseName.startsWith("pen")) {
lastStylusSeen = device->id;
@@ -411,7 +411,7 @@ void KisCanvasWidget::initX11Support()
#endif // EXTENDED_X11_TABLET_SUPPORT
}
-Qt::ButtonState KisCanvasWidget::translateX11ButtonState(int state)
+TQt::ButtonState KisCanvasWidget::translateX11ButtonState(int state)
{
int buttonState = 0;
@@ -422,20 +422,20 @@ Qt::ButtonState KisCanvasWidget::translateX11ButtonState(int state)
if (state & Button3Mask)
buttonState |= Qt::RightButton;
if (state & ShiftMask)
- buttonState |= Qt::ShiftButton;
+ buttonState |= TQt::ShiftButton;
if (state & ControlMask)
- buttonState |= Qt::ControlButton;
+ buttonState |= TQt::ControlButton;
if (state & X11AltMask)
- buttonState |= Qt::AltButton;
+ buttonState |= TQt::AltButton;
if (state & X11MetaMask)
- buttonState |= Qt::MetaButton;
+ buttonState |= TQt::MetaButton;
- return static_cast<Qt::ButtonState>(buttonState);
+ return static_cast<TQt::ButtonState>(buttonState);
}
-Qt::ButtonState KisCanvasWidget::translateX11Button(unsigned int X11Button)
+TQt::ButtonState KisCanvasWidget::translateX11Button(unsigned int X11Button)
{
- Qt::ButtonState qtButton;
+ TQt::ButtonState qtButton;
switch (X11Button) {
case Button1:
@@ -525,7 +525,7 @@ KisCanvasWidget::X11TabletDevice::X11TabletDevice(const XDeviceInfo *deviceInfo)
m_proximityInEvent = -1;
m_proximityOutEvent = -1;
- m_XDevice = XOpenDevice(QApplication::desktop()->x11Display(), m_deviceId);
+ m_XDevice = XOpenDevice(TQApplication::desktop()->x11Display(), m_deviceId);
if (m_XDevice != NULL) {
for (int i = 0; i < m_XDevice->num_classes; i++) {
@@ -554,7 +554,7 @@ KisCanvasWidget::X11TabletDevice::X11TabletDevice(const XDeviceInfo *deviceInfo)
}
}
- // Note: We don't XCloseXDevice() since Qt will have already opened
+ // Note: We don't XCloseXDevice() since TQt will have already opened
// it, and only one XCloseDevice() call closes it for all opens.
}
@@ -573,87 +573,87 @@ bool KisCanvasWidget::X11TabletDevice::enabled() const
return m_enabled;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::numAxes() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::numAxes() const
{
return m_axisInfo.count();
}
-void KisCanvasWidget::X11TabletDevice::setXAxis(Q_INT32 axis)
+void KisCanvasWidget::X11TabletDevice::setXAxis(TQ_INT32 axis)
{
m_xAxis = axis;
}
-void KisCanvasWidget::X11TabletDevice::setYAxis(Q_INT32 axis)
+void KisCanvasWidget::X11TabletDevice::setYAxis(TQ_INT32 axis)
{
m_yAxis = axis;
}
-void KisCanvasWidget::X11TabletDevice::setPressureAxis(Q_INT32 axis)
+void KisCanvasWidget::X11TabletDevice::setPressureAxis(TQ_INT32 axis)
{
m_pressureAxis = axis;
}
-void KisCanvasWidget::X11TabletDevice::setXTiltAxis(Q_INT32 axis)
+void KisCanvasWidget::X11TabletDevice::setXTiltAxis(TQ_INT32 axis)
{
m_xTiltAxis = axis;
}
-void KisCanvasWidget::X11TabletDevice::setYTiltAxis(Q_INT32 axis)
+void KisCanvasWidget::X11TabletDevice::setYTiltAxis(TQ_INT32 axis)
{
m_yTiltAxis = axis;
}
-void KisCanvasWidget::X11TabletDevice::setWheelAxis(Q_INT32 axis)
+void KisCanvasWidget::X11TabletDevice::setWheelAxis(TQ_INT32 axis)
{
m_wheelAxis = axis;
}
-void KisCanvasWidget::X11TabletDevice::setToolIDAxis(Q_INT32 axis)
+void KisCanvasWidget::X11TabletDevice::setToolIDAxis(TQ_INT32 axis)
{
m_toolIDAxis = axis;
}
-void KisCanvasWidget::X11TabletDevice::setSerialNumberAxis(Q_INT32 axis)
+void KisCanvasWidget::X11TabletDevice::setSerialNumberAxis(TQ_INT32 axis)
{
m_serialNumberAxis = axis;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::xAxis() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::xAxis() const
{
return m_xAxis;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::yAxis() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::yAxis() const
{
return m_yAxis;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::pressureAxis() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::pressureAxis() const
{
return m_pressureAxis;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::xTiltAxis() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::xTiltAxis() const
{
return m_xTiltAxis;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::yTiltAxis() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::yTiltAxis() const
{
return m_yTiltAxis;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::wheelAxis() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::wheelAxis() const
{
return m_wheelAxis;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::toolIDAxis() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::toolIDAxis() const
{
return m_toolIDAxis;
}
-Q_INT32 KisCanvasWidget::X11TabletDevice::serialNumberAxis() const
+TQ_INT32 KisCanvasWidget::X11TabletDevice::serialNumberAxis() const
{
return m_serialNumberAxis;
}
@@ -731,7 +731,7 @@ void KisCanvasWidget::X11TabletDevice::writeSettingsToConfig()
cfg.setTabletDeviceAxis(m_name, "SerialNumberAxis", m_serialNumberAxis);
}
-void KisCanvasWidget::X11TabletDevice::enableEvents(QWidget *widget) const
+void KisCanvasWidget::X11TabletDevice::enableEvents(TQWidget *widget) const
{
if (!m_eventClassList.isEmpty()) {
int result = XSelectExtensionEvent(widget->x11AppDisplay(), widget->handle(),
@@ -760,7 +760,7 @@ double KisCanvasWidget::X11TabletDevice::translateAxisValue(int value, const XAx
}
KisCanvasWidget::X11TabletDevice::State::State(const KisPoint& pos, double pressure, const KisVector2D& tilt, double wheel,
- Q_UINT32 toolID, Q_UINT32 serialNumber)
+ TQ_UINT32 toolID, TQ_UINT32 serialNumber)
: m_pos(pos),
m_pressure(pressure),
m_tilt(tilt),
@@ -786,21 +786,21 @@ KisCanvasWidget::X11TabletDevice::State KisCanvasWidget::X11TabletDevice::transl
}
KisVector2D tilt = KisVector2D(0, 0);
- Q_UINT32 toolID = 0;
- Q_UINT32 serialNumber = 0;
+ TQ_UINT32 toolID = 0;
+ TQ_UINT32 serialNumber = 0;
if (m_xTiltAxis != NoAxis) {
// Latest wacom driver returns the tool id and serial number in
// the upper 16 bits of the x and y tilts and wheel.
- int xTiltAxisValue = (Q_INT16)(axisData[m_xTiltAxis] & 0xffff);
- toolID = ((Q_UINT32)axisData[m_xTiltAxis] >> 16) & 0xffff;
+ int xTiltAxisValue = (TQ_INT16)(axisData[m_xTiltAxis] & 0xffff);
+ toolID = ((TQ_UINT32)axisData[m_xTiltAxis] >> 16) & 0xffff;
tilt.setX(translateAxisValue(xTiltAxisValue, m_axisInfo[m_xTiltAxis]));
}
if (m_yTiltAxis != NoAxis) {
- int yTiltAxisValue = (Q_INT16)(axisData[m_yTiltAxis] & 0xffff);
- serialNumber = (Q_UINT32)axisData[m_yTiltAxis] & 0xffff0000;
+ int yTiltAxisValue = (TQ_INT16)(axisData[m_yTiltAxis] & 0xffff);
+ serialNumber = (TQ_UINT32)axisData[m_yTiltAxis] & 0xffff0000;
tilt.setY(translateAxisValue(yTiltAxisValue, m_axisInfo[m_yTiltAxis]));
}
@@ -808,13 +808,13 @@ KisCanvasWidget::X11TabletDevice::State KisCanvasWidget::X11TabletDevice::transl
double wheel = 0;
if (m_wheelAxis != NoAxis) {
- int wheelAxisValue = (Q_INT16)(axisData[m_wheelAxis] & 0xffff);
- serialNumber |= ((Q_UINT32)axisData[m_wheelAxis] >> 16) & 0xffff;
+ int wheelAxisValue = (TQ_INT16)(axisData[m_wheelAxis] & 0xffff);
+ serialNumber |= ((TQ_UINT32)axisData[m_wheelAxis] >> 16) & 0xffff;
wheel = translateAxisValue(wheelAxisValue, m_axisInfo[m_wheelAxis]);
}
- //QString ids;
+ //TQString ids;
//ids.sprintf("Tool ID: %8x Serial Number: %8x", toolID, serialNumber);
return State(pos, pressure, tilt, wheel, toolID, serialNumber);
@@ -825,7 +825,7 @@ KisCanvasWidget::X11XIDTabletDeviceMap& KisCanvasWidget::tabletDeviceMap()
return X11TabletDeviceMap;
}
-void KisCanvasWidget::selectTabletDeviceEvents(QWidget *widget)
+void KisCanvasWidget::selectTabletDeviceEvents(TQWidget *widget)
{
for (X11XIDTabletDeviceMap::const_iterator it = X11TabletDeviceMap.begin(); it != X11TabletDeviceMap.end(); ++it) {
@@ -839,20 +839,20 @@ void KisCanvasWidget::selectTabletDeviceEvents(QWidget *widget)
#endif // EXTENDED_X11_TABLET_SUPPORT
-bool KisCanvasWidget::x11Event(XEvent *event, Display *x11Display, WId winId, QPoint widgetOriginPos)
+bool KisCanvasWidget::x11Event(XEvent *event, Display *x11Display, WId winId, TQPoint widgetOriginPos)
{
if (event->type == MotionNotify) {
// Mouse move
if (!m_enableMoveEventCompressionHint) {
XMotionEvent motion = event->xmotion;
- QPoint globalPos(motion.x_root, motion.y_root);
+ TQPoint globalPos(motion.x_root, motion.y_root);
if (globalPos.x() != m_lastRootX || globalPos.y() != m_lastRootY) {
int state = translateX11ButtonState(motion.state);
- QPoint pos(motion.x, motion.y);
- QMouseEvent e(QEvent::MouseMove, pos, globalPos, Qt::NoButton, state);
+ TQPoint pos(motion.x, motion.y);
+ TQMouseEvent e(TQEvent::MouseMove, pos, globalPos, Qt::NoButton, state);
widgetGotMouseMoveEvent(&e);
}
@@ -872,8 +872,8 @@ bool KisCanvasWidget::x11Event(XEvent *event, Display *x11Display, WId winId, QP
// Tablet event.
int deviceId;
const int *axisData;
- Qt::ButtonState button;
- Qt::ButtonState buttonState;
+ TQt::ButtonState button;
+ TQt::ButtonState buttonState;
if (event->type == X11DeviceMotionNotifyEvent) {
// Tablet move
@@ -922,7 +922,7 @@ bool KisCanvasWidget::x11Event(XEvent *event, Display *x11Display, WId winId, QP
button = translateX11Button(buttonPressed->button);
buttonState = translateX11ButtonState(buttonPressed->state);
- if (QApplication::activePopupWidget() == 0) {
+ if (TQApplication::activePopupWidget() == 0) {
XEvent mouseEvent;
// Look for and swallow an accompanying core event, but only if there's
@@ -945,7 +945,7 @@ bool KisCanvasWidget::x11Event(XEvent *event, Display *x11Display, WId winId, QP
button = translateX11Button(buttonReleased->button);
buttonState = translateX11ButtonState(buttonReleased->state);
- if (QApplication::activePopupWidget() == 0) {
+ if (TQApplication::activePopupWidget() == 0) {
XEvent mouseEvent;
// Look for and swallow an accompanying core event, but only if there's
@@ -961,7 +961,7 @@ bool KisCanvasWidget::x11Event(XEvent *event, Display *x11Display, WId winId, QP
}
}
- X11XIDTabletDeviceMap::const_iterator it = X11TabletDeviceMap.find(deviceId);
+ X11XIDTabletDeviceMap::const_iterator it = X11TabletDeviceMap.tqfind(deviceId);
if (it != X11TabletDeviceMap.end()) {
@@ -971,7 +971,7 @@ bool KisCanvasWidget::x11Event(XEvent *event, Display *x11Display, WId winId, QP
X11TabletDevice::State deviceState = tabletDevice.translateAxisData(axisData);
// Map normalised position coordinates to screen coordinates
- QDesktopWidget *desktop = QApplication::desktop();
+ TQDesktopWidget *desktop = TQApplication::desktop();
KisPoint globalPos(deviceState.pos().x() * desktop->width(), deviceState.pos().y() * desktop->height());
// Convert screen coordinates to widget coordinates
KisPoint pos = globalPos - KoPoint( widgetOriginPos );
@@ -994,8 +994,8 @@ bool KisCanvasWidget::x11Event(XEvent *event, Display *x11Display, WId winId, QP
}
}
- // Consume the event even if the device is disabled otherwise Qt will
- // process it and send a QTabletEvent.
+ // Consume the event even if the device is disabled otherwise TQt will
+ // process it and send a TQTabletEvent.
return true;
}
else {
@@ -1018,7 +1018,7 @@ KisInputDevice KisCanvasWidget::findActiveInputDevice()
for (it = X11TabletDeviceMap.begin(); it != X11TabletDeviceMap.end(); ++it) {
const X11TabletDevice& tabletDevice = (*it).second;
- XDeviceState *deviceState = XQueryDeviceState(QApplication::desktop()->x11Display(),
+ XDeviceState *deviceState = XQueryDeviceState(TQApplication::desktop()->x11Display(),
tabletDevice.xDevice());
// If your the laptop sleeps, and you remove the mouse from the usb
@@ -1057,21 +1057,21 @@ KisInputDevice KisCanvasWidget::findActiveInputDevice()
#endif // EXTENDED_X11_TABLET_SUPPORT
-#endif // Q_WS_X11
+#endif // TQ_WS_X11
/*************************************************************************/
-#define QPAINTDEVICE_CANVAS_WIDGET false
+#define TQPAINTDEVICE_CANVAS_WIDGET false
#define OPENGL_CANVAS_WIDGET true
-KisCanvas::KisCanvas(QWidget *parent, const char *name)
+KisCanvas::KisCanvas(TQWidget *tqparent, const char *name)
{
- m_parent = parent;
+ m_parent = tqparent;
m_name = name;
m_enableMoveEventCompressionHint = false;
m_canvasWidget = 0;
m_useOpenGL = false;
- createCanvasWidget(QPAINTDEVICE_CANVAS_WIDGET);
+ createCanvasWidget(TQPAINTDEVICE_CANVAS_WIDGET);
}
KisCanvas::~KisCanvas()
@@ -1080,7 +1080,7 @@ KisCanvas::~KisCanvas()
}
#ifdef HAVE_GL
-void KisCanvas::createCanvasWidget(bool useOpenGL, QGLWidget *sharedContextWidget)
+void KisCanvas::createCanvasWidget(bool useOpenGL, TQGLWidget *sharedContextWidget)
#else
void KisCanvas::createCanvasWidget(bool useOpenGL)
#endif
@@ -1090,7 +1090,7 @@ void KisCanvas::createCanvasWidget(bool useOpenGL)
#ifndef HAVE_GL
useOpenGL = false;
#else
- if (useOpenGL && !QGLFormat::hasOpenGL()) {
+ if (useOpenGL && !TQGLFormat::hasOpenGL()) {
kdDebug(41001) << "Tried to create OpenGL widget when system doesn't have OpenGL\n";
useOpenGL = false;
}
@@ -1100,15 +1100,15 @@ void KisCanvas::createCanvasWidget(bool useOpenGL)
} else
#endif
{
- m_canvasWidget = new KisQPaintDeviceCanvasWidget(m_parent, m_name.latin1());
+ m_canvasWidget = new KisTQPaintDeviceCanvasWidget(m_parent, m_name.latin1());
}
m_useOpenGL = useOpenGL;
Q_CHECK_PTR(m_canvasWidget);
- QWidget *widget = dynamic_cast<QWidget *>(m_canvasWidget);
+ TQWidget *widget = dynamic_cast<TQWidget *>(m_canvasWidget);
- widget->setBackgroundMode(QWidget::NoBackground);
+ widget->setBackgroundMode(TQWidget::NoBackground);
widget->setMouseTracking(true);
widget->setAcceptDrops(true);
m_canvasWidget->enableMoveEventCompressionHint(m_enableMoveEventCompressionHint);
@@ -1117,27 +1117,27 @@ void KisCanvas::createCanvasWidget(bool useOpenGL)
selectTabletDeviceEvents();
#endif
- connect(m_canvasWidget, SIGNAL(sigGotPaintEvent(QPaintEvent *)), SIGNAL(sigGotPaintEvent(QPaintEvent *)));
- connect(m_canvasWidget, SIGNAL(sigGotEnterEvent(QEvent*)), SIGNAL(sigGotEnterEvent(QEvent*)));
- connect(m_canvasWidget, SIGNAL(sigGotLeaveEvent(QEvent*)), SIGNAL(sigGotLeaveEvent(QEvent*)));
- connect(m_canvasWidget, SIGNAL(sigGotMouseWheelEvent(QWheelEvent*)), SIGNAL(sigGotMouseWheelEvent(QWheelEvent*)));
- connect(m_canvasWidget, SIGNAL(sigGotKeyPressEvent(QKeyEvent*)), SIGNAL(sigGotKeyPressEvent(QKeyEvent*)));
- connect(m_canvasWidget, SIGNAL(sigGotKeyReleaseEvent(QKeyEvent*)), SIGNAL(sigGotKeyReleaseEvent(QKeyEvent*)));
- connect(m_canvasWidget, SIGNAL(sigGotDragEnterEvent(QDragEnterEvent*)), SIGNAL(sigGotDragEnterEvent(QDragEnterEvent*)));
- connect(m_canvasWidget, SIGNAL(sigGotDropEvent(QDropEvent*)), SIGNAL(sigGotDropEvent(QDropEvent*)));
- connect(m_canvasWidget, SIGNAL(sigGotMoveEvent(KisMoveEvent *)), SIGNAL(sigGotMoveEvent(KisMoveEvent *)));
- connect(m_canvasWidget, SIGNAL(sigGotButtonPressEvent(KisButtonPressEvent *)), SIGNAL(sigGotButtonPressEvent(KisButtonPressEvent *)));
- connect(m_canvasWidget, SIGNAL(sigGotButtonReleaseEvent(KisButtonReleaseEvent *)), SIGNAL(sigGotButtonReleaseEvent(KisButtonReleaseEvent *)));
- connect(m_canvasWidget, SIGNAL(sigGotDoubleClickEvent(KisDoubleClickEvent *)), SIGNAL(sigGotDoubleClickEvent(KisDoubleClickEvent *)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotPaintEvent(TQPaintEvent *)), TQT_SIGNAL(sigGotPaintEvent(TQPaintEvent *)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotEnterEvent(TQEvent*)), TQT_SIGNAL(sigGotEnterEvent(TQEvent*)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotLeaveEvent(TQEvent*)), TQT_SIGNAL(sigGotLeaveEvent(TQEvent*)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotMouseWheelEvent(TQWheelEvent*)), TQT_SIGNAL(sigGotMouseWheelEvent(TQWheelEvent*)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotKeyPressEvent(TQKeyEvent*)), TQT_SIGNAL(sigGotKeyPressEvent(TQKeyEvent*)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotKeyReleaseEvent(TQKeyEvent*)), TQT_SIGNAL(sigGotKeyReleaseEvent(TQKeyEvent*)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotDragEnterEvent(TQDragEnterEvent*)), TQT_SIGNAL(sigGotDragEnterEvent(TQDragEnterEvent*)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotDropEvent(TQDropEvent*)), TQT_SIGNAL(sigGotDropEvent(TQDropEvent*)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotMoveEvent(KisMoveEvent *)), TQT_SIGNAL(sigGotMoveEvent(KisMoveEvent *)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotButtonPressEvent(KisButtonPressEvent *)), TQT_SIGNAL(sigGotButtonPressEvent(KisButtonPressEvent *)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotButtonReleaseEvent(KisButtonReleaseEvent *)), TQT_SIGNAL(sigGotButtonReleaseEvent(KisButtonReleaseEvent *)));
+ connect(m_canvasWidget, TQT_SIGNAL(sigGotDoubleClickEvent(KisDoubleClickEvent *)), TQT_SIGNAL(sigGotDoubleClickEvent(KisDoubleClickEvent *)));
}
-void KisCanvas::createQPaintDeviceCanvas()
+void KisCanvas::createTQPaintDeviceCanvas()
{
- createCanvasWidget(QPAINTDEVICE_CANVAS_WIDGET);
+ createCanvasWidget(TQPAINTDEVICE_CANVAS_WIDGET);
}
#ifdef HAVE_GL
-void KisCanvas::createOpenGLCanvas(QGLWidget *sharedContextWidget)
+void KisCanvas::createOpenGLCanvas(TQGLWidget *sharedContextWidget)
{
createCanvasWidget(OPENGL_CANVAS_WIDGET, sharedContextWidget);
}
@@ -1156,20 +1156,20 @@ void KisCanvas::enableMoveEventCompressionHint(bool enableMoveCompression)
}
}
-QWidget *KisCanvas::QPaintDeviceWidget() const
+TQWidget *KisCanvas::TQPaintDeviceWidget() const
{
if (m_useOpenGL) {
return 0;
} else {
- return dynamic_cast<QWidget *>(m_canvasWidget);
+ return dynamic_cast<TQWidget *>(m_canvasWidget);
}
}
#ifdef HAVE_GL
-QGLWidget *KisCanvas::OpenGLWidget() const
+TQGLWidget *KisCanvas::OpenGLWidget() const
{
if (m_useOpenGL) {
- return dynamic_cast<QGLWidget *>(m_canvasWidget);
+ return dynamic_cast<TQGLWidget *>(m_canvasWidget);
} else {
return 0;
}
@@ -1190,115 +1190,115 @@ KisCanvasWidget *KisCanvas::canvasWidget() const
void KisCanvas::setGeometry(int x, int y, int width, int height)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->setGeometry(x, y, width, height);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->setGeometry(x, y, width, height);
}
void KisCanvas::show()
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->show();
+ dynamic_cast<TQWidget *>(m_canvasWidget)->show();
}
void KisCanvas::hide()
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->hide();
+ dynamic_cast<TQWidget *>(m_canvasWidget)->hide();
}
int KisCanvas::width() const
{
Q_ASSERT(m_canvasWidget);
- return dynamic_cast<QWidget *>(m_canvasWidget)->width();
+ return dynamic_cast<TQWidget *>(m_canvasWidget)->width();
}
int KisCanvas::height() const
{
Q_ASSERT(m_canvasWidget);
- return dynamic_cast<QWidget *>(m_canvasWidget)->height();
+ return dynamic_cast<TQWidget *>(m_canvasWidget)->height();
}
void KisCanvas::update()
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->update();
+ dynamic_cast<TQWidget *>(m_canvasWidget)->update();
}
-void KisCanvas::update(const QRect& r)
+void KisCanvas::update(const TQRect& r)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->update(r);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->update(r);
}
void KisCanvas::update(int x, int y, int width, int height)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->update(x, y, width, height);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->update(x, y, width, height);
}
-void KisCanvas::repaint()
+void KisCanvas::tqrepaint()
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->repaint();
+ dynamic_cast<TQWidget *>(m_canvasWidget)->tqrepaint();
}
-void KisCanvas::repaint(bool erase)
+void KisCanvas::tqrepaint(bool erase)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->repaint(erase);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->tqrepaint(erase);
}
-void KisCanvas::repaint(int x, int y, int width, int height, bool erase)
+void KisCanvas::tqrepaint(int x, int y, int width, int height, bool erase)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->repaint(x, y, width, height, erase);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->tqrepaint(x, y, width, height, erase);
}
-void KisCanvas::repaint(const QRect& r, bool erase)
+void KisCanvas::tqrepaint(const TQRect& r, bool erase)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->repaint(r, erase);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->tqrepaint(r, erase);
}
-void KisCanvas::repaint(const QRegion& r, bool erase)
+void KisCanvas::tqrepaint(const TQRegion& r, bool erase)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->repaint(r, erase);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->tqrepaint(r, erase);
}
bool KisCanvas::isUpdatesEnabled() const
{
Q_ASSERT(m_canvasWidget);
- return dynamic_cast<QWidget *>(m_canvasWidget)->isUpdatesEnabled();
+ return dynamic_cast<TQWidget *>(m_canvasWidget)->isUpdatesEnabled();
}
void KisCanvas::setUpdatesEnabled(bool updatesEnabled)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->setUpdatesEnabled(updatesEnabled);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->setUpdatesEnabled(updatesEnabled);
}
void KisCanvas::updateGeometry()
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->updateGeometry();
+ dynamic_cast<TQWidget *>(m_canvasWidget)->updateGeometry();
}
-void KisCanvas::setFocusPolicy(QWidget::FocusPolicy focusPolicy)
+void KisCanvas::setFocusPolicy(TQWidget::FocusPolicy focusPolicy)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->setFocusPolicy(focusPolicy);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->setFocusPolicy(focusPolicy);
}
-const QCursor& KisCanvas::cursor() const
+const TQCursor& KisCanvas::cursor() const
{
Q_ASSERT(m_canvasWidget);
- return dynamic_cast<QWidget *>(m_canvasWidget)->cursor();
+ return dynamic_cast<TQWidget *>(m_canvasWidget)->cursor();
}
-void KisCanvas::setCursor(const QCursor& cursor)
+void KisCanvas::setCursor(const TQCursor& cursor)
{
Q_ASSERT(m_canvasWidget);
- dynamic_cast<QWidget *>(m_canvasWidget)->setCursor(cursor);
+ dynamic_cast<TQWidget *>(m_canvasWidget)->setCursor(cursor);
}
#if defined(EXTENDED_X11_TABLET_SUPPORT)
@@ -1311,38 +1311,38 @@ void KisCanvas::selectTabletDeviceEvents()
bool KisCanvas::cursorIsOverCanvas() const
{
- if (QApplication::activePopupWidget() != 0) {
+ if (TQApplication::activePopupWidget() != 0) {
return false;
}
- if (QApplication::activeModalWidget() != 0) {
+ if (TQApplication::activeModalWidget() != 0) {
return false;
}
- QWidget *canvasWidget = dynamic_cast<QWidget *>(m_canvasWidget);
+ TQWidget *canvasWidget = dynamic_cast<TQWidget *>(m_canvasWidget);
Q_ASSERT(canvasWidget != 0);
if (canvasWidget) {
- if (QApplication::widgetAt(QCursor::pos(), true) == canvasWidget) {
+ if (TQApplication::widgetAt(TQCursor::pos(), true) == canvasWidget) {
return true;
}
}
return false;
}
-void KisCanvas::handleKeyEvent(QEvent *e)
+void KisCanvas::handleKeyEvent(TQEvent *e)
{
- QKeyEvent *ke = dynamic_cast<QKeyEvent *>(e);
+ TQKeyEvent *ke = dynamic_cast<TQKeyEvent *>(e);
Q_ASSERT(ke != 0);
if (ke) {
- QWidget *canvasWidget = dynamic_cast<QWidget *>(m_canvasWidget);
+ TQWidget *canvasWidget = dynamic_cast<TQWidget *>(m_canvasWidget);
Q_ASSERT(canvasWidget != 0);
if (canvasWidget) {
canvasWidget->setFocus();
- if (e->type() == QEvent::KeyPress) {
+ if (e->type() == TQEvent::KeyPress) {
emit sigGotKeyPressEvent(ke);
} else {
emit sigGotKeyReleaseEvent(ke);