summaryrefslogtreecommitdiffstats
path: root/krita/ui/kobirdeyepanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'krita/ui/kobirdeyepanel.cpp')
-rw-r--r--krita/ui/kobirdeyepanel.cpp188
1 files changed, 94 insertions, 94 deletions
diff --git a/krita/ui/kobirdeyepanel.cpp b/krita/ui/kobirdeyepanel.cpp
index fda95945..c3091680 100644
--- a/krita/ui/kobirdeyepanel.cpp
+++ b/krita/ui/kobirdeyepanel.cpp
@@ -17,15 +17,15 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <qpixmap.h>
-#include <qimage.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qframe.h>
-#include <qlabel.h>
-#include <qtoolbutton.h>
-#include <qslider.h>
-#include <qcursor.h>
+#include <tqpixmap.h>
+#include <tqimage.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
+#include <tqframe.h>
+#include <tqlabel.h>
+#include <tqtoolbutton.h>
+#include <tqslider.h>
+#include <tqcursor.h>
#include <kdebug.h>
#include <kglobalsettings.h>
@@ -52,33 +52,33 @@ KoThumbnailAdapter::~KoThumbnailAdapter() {}
KoBirdEyePanel::KoBirdEyePanel( KoZoomAdapter * zoomListener,
KoThumbnailAdapter * thumbnailProvider,
KoCanvasAdapter * canvas,
- QWidget * parent,
+ TQWidget * tqparent,
const char * name,
WFlags f)
- : QWidget(parent, name, f)
+ : TQWidget(tqparent, name, f)
, m_zoomListener(zoomListener)
, m_thumbnailProvider(thumbnailProvider)
, m_canvas(canvas)
, m_dragging(false)
{
- QHBoxLayout * l = new QHBoxLayout(this);
+ TQHBoxLayout * l = new TQHBoxLayout(this);
m_page = new WdgBirdEye(this);
- m_page->zoom->setRange((int) (QMAX(1, 100 * zoomListener->getMinZoom())), (int) (100 * zoomListener->getMaxZoom()));
+ m_page->zoom->setRange((int) (TQMAX(1, 100 * zoomListener->getMinZoom())), (int) (100 * zoomListener->getMaxZoom()));
m_page->zoom->setValue(100);
m_page->zoom->setSuffix("%");
m_page->toolbar->setIconSize(16);
m_page->view->installEventFilter(this);
- m_page->view->setBackgroundMode(Qt::NoBackground);
+ m_page->view->setBackgroundMode(TQt::NoBackground);
- m_zoomIn = new KAction( i18n("Zoom In"), "birdeye_zoom_plus", 0, this, SLOT(zoomPlus()), this, "zoomIn" );
- m_zoomOut = new KAction( i18n("Zoom Out"), "birdeye_zoom_minus", 0, this, SLOT(zoomMinus()), this, "zoomOut" );
+ m_zoomIn = new KAction( i18n("Zoom In"), "birdeye_zoom_plus", 0, this, TQT_SLOT(zoomPlus()), this, "zoomIn" );
+ m_zoomOut = new KAction( i18n("Zoom Out"), "birdeye_zoom_minus", 0, this, TQT_SLOT(zoomMinus()), this, "zoomOut" );
l->addWidget(m_page);
- connect(m_page->zoom, SIGNAL(valueChanged(int)), SLOT(zoomValueChanged(int)));
- connect(m_page->bn100, SIGNAL(clicked()), SLOT(zoom100()));
- connect(m_page->slZoom, SIGNAL(valueChanged(int)), SLOT(sliderChanged( int )));
+ connect(m_page->zoom, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(zoomValueChanged(int)));
+ connect(m_page->bn100, TQT_SIGNAL(clicked()), TQT_SLOT(zoom100()));
+ connect(m_page->slZoom, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(sliderChanged( int )));
}
KoBirdEyePanel::~KoBirdEyePanel()
@@ -192,10 +192,10 @@ void KoBirdEyePanel::sliderChanged( int v )
}
}
-void KoBirdEyePanel::cursorPosChanged(Q_INT32 xpos, Q_INT32 ypos)
+void KoBirdEyePanel::cursorPosChanged(TQ_INT32 xpos, TQ_INT32 ypos)
{
- m_page->txtX->setText(QString("%L1").arg(xpos, 5));
- m_page->txtY->setText(QString("%L1").arg(ypos, 5));
+ m_page->txtX->setText(TQString("%L1").tqarg(xpos, 5));
+ m_page->txtY->setText(TQString("%L1").tqarg(ypos, 5));
}
void KoBirdEyePanel::setThumbnailProvider(KoThumbnailAdapter * thumbnailProvider)
@@ -209,36 +209,36 @@ void KoBirdEyePanel::slotViewTransformationChanged()
updateVisibleArea();
renderView();
m_page->view->update();
- setZoom(qRound(m_canvas->zoomFactor() * 100));
+ setZoom(tqRound(m_canvas->zoomFactor() * 100));
}
-void KoBirdEyePanel::slotUpdate(const QRect & r)
+void KoBirdEyePanel::slotUpdate(const TQRect & r)
{
- QRect updateRect = r;
+ TQRect updateRect = r;
if (m_thumbnailProvider->pixelSize() != m_documentSize) {
m_documentSize = m_thumbnailProvider->pixelSize();
fitThumbnailToView();
- updateRect = QRect(0, 0, m_documentSize.width(), m_documentSize.height());
+ updateRect = TQRect(0, 0, m_documentSize.width(), m_documentSize.height());
}
- updateRect &= QRect(0, 0, m_documentSize.width(), m_documentSize.height());
+ updateRect &= TQRect(0, 0, m_documentSize.width(), m_documentSize.height());
if (!updateRect.isEmpty() && !m_documentSize.isEmpty()) {
- QRect thumbnailRect = documentToThumbnail(KoRect::fromQRect(updateRect));
+ TQRect thumbnailRect = documentToThumbnail(KoRect::fromTQRect(updateRect));
if (!thumbnailRect.isEmpty()) {
- QImage thumbnailImage = m_thumbnailProvider->image(thumbnailRect, m_thumbnail.size());
+ TQImage thumbnailImage = m_thumbnailProvider->image(thumbnailRect, m_thumbnail.size());
if (!thumbnailImage.isNull()) {
Q_ASSERT(thumbnailImage.size() == thumbnailRect.size());
- QPainter painter(&m_thumbnail);
+ TQPainter painter(&m_thumbnail);
- painter.fillRect(thumbnailRect, colorGroup().mid());
+ painter.fillRect(thumbnailRect, tqcolorGroup().mid());
painter.drawImage(thumbnailRect.x(), thumbnailRect.y(), thumbnailImage);
}
}
@@ -248,24 +248,24 @@ void KoBirdEyePanel::slotUpdate(const QRect & r)
m_page->view->update();
}
-QRect KoBirdEyePanel::documentToThumbnail(const KoRect& docRect)
+TQRect KoBirdEyePanel::documentToThumbnail(const KoRect& docRect)
{
if (docRect.isEmpty() || m_documentSize.isEmpty() || m_thumbnail.isNull()) {
- return QRect();
+ return TQRect();
}
- Q_INT32 thumbnailLeft = static_cast<Q_INT32>((docRect.left() * m_thumbnail.width()) / m_documentSize.width());
- Q_INT32 thumbnailRight = static_cast<Q_INT32>(((docRect.right() + 1) * m_thumbnail.width()) / m_documentSize.width());
- Q_INT32 thumbnailTop = static_cast<Q_INT32>((docRect.top() * m_thumbnail.height()) / m_documentSize.height());
- Q_INT32 thumbnailBottom = static_cast<Q_INT32>(((docRect.bottom() + 1) * m_thumbnail.height()) / m_documentSize.height());
+ TQ_INT32 thumbnailLeft = static_cast<TQ_INT32>((docRect.left() * m_thumbnail.width()) / m_documentSize.width());
+ TQ_INT32 thumbnailRight = static_cast<TQ_INT32>(((docRect.right() + 1) * m_thumbnail.width()) / m_documentSize.width());
+ TQ_INT32 thumbnailTop = static_cast<TQ_INT32>((docRect.top() * m_thumbnail.height()) / m_documentSize.height());
+ TQ_INT32 thumbnailBottom = static_cast<TQ_INT32>(((docRect.bottom() + 1) * m_thumbnail.height()) / m_documentSize.height());
- QRect thumbnailRect(thumbnailLeft, thumbnailTop, thumbnailRight - thumbnailLeft + 1, thumbnailBottom - thumbnailTop + 1);
+ TQRect thumbnailRect(thumbnailLeft, thumbnailTop, thumbnailRight - thumbnailLeft + 1, thumbnailBottom - thumbnailTop + 1);
thumbnailRect &= m_thumbnail.rect();
return thumbnailRect;
}
-KoRect KoBirdEyePanel::thumbnailToDocument(const QRect& thumbnailRect)
+KoRect KoBirdEyePanel::thumbnailToDocument(const TQRect& thumbnailRect)
{
if (thumbnailRect.isEmpty() || m_documentSize.isEmpty() || m_thumbnail.isNull()) {
return KoRect();
@@ -282,12 +282,12 @@ KoRect KoBirdEyePanel::thumbnailToDocument(const QRect& thumbnailRect)
return docRect;
}
-QPoint KoBirdEyePanel::viewToThumbnail(const QPoint& viewPoint)
+TQPoint KoBirdEyePanel::viewToThumbnail(const TQPoint& viewPoint)
{
int thumbnailX = (m_viewBuffer.width() - m_thumbnail.width()) / 2;
int thumbnailY = (m_viewBuffer.height() - m_thumbnail.height()) / 2;
- return QPoint(viewPoint.x() - thumbnailX, viewPoint.y() - thumbnailY);
+ return TQPoint(viewPoint.x() - thumbnailX, viewPoint.y() - thumbnailY);
}
@@ -305,20 +305,20 @@ void KoBirdEyePanel::updateVisibleArea()
}
-bool KoBirdEyePanel::eventFilter(QObject* o, QEvent* ev)
+bool KoBirdEyePanel::eventFilter(TQObject* o, TQEvent* ev)
{
- if (o == m_page->view && ev->type() == QEvent::Resize) {
- resizeViewEvent(static_cast<QResizeEvent *>(ev)->size());
+ if (o == m_page->view && ev->type() == TQEvent::Resize) {
+ resizeViewEvent(static_cast<TQResizeEvent *>(ev)->size());
}
- if (o == m_page->view && ev->type() == QEvent::Paint) {
- paintViewEvent(static_cast<QPaintEvent *>(ev));
+ if (o == m_page->view && ev->type() == TQEvent::Paint) {
+ paintViewEvent(static_cast<TQPaintEvent *>(ev));
}
- if (o == m_page->view && ev->type() == QEvent::MouseMove) {
+ if (o == m_page->view && ev->type() == TQEvent::MouseMove) {
- QMouseEvent* me = (QMouseEvent*)ev;
- QPoint thumbnailPos = viewToThumbnail(me->pos());
+ TQMouseEvent* me = (TQMouseEvent*)ev;
+ TQPoint thumbnailPos = viewToThumbnail(me->pos());
if (m_dragging) {
handleMouseMoveAction(thumbnailPos);
@@ -329,10 +329,10 @@ bool KoBirdEyePanel::eventFilter(QObject* o, QEvent* ev)
return true;
}
- if (o == m_page->view && ev->type() == QEvent::MouseButtonPress) {
+ if (o == m_page->view && ev->type() == TQEvent::MouseButtonPress) {
- QMouseEvent* me = (QMouseEvent*)ev;
- QPoint thumbnailPos = viewToThumbnail(me->pos());
+ TQMouseEvent* me = (TQMouseEvent*)ev;
+ TQPoint thumbnailPos = viewToThumbnail(me->pos());
if (me->button() == LeftButton) {
handleMousePress(thumbnailPos);
@@ -341,9 +341,9 @@ bool KoBirdEyePanel::eventFilter(QObject* o, QEvent* ev)
return true;
}
- if (o == m_page->view && ev->type() == QEvent::MouseButtonRelease) {
+ if (o == m_page->view && ev->type() == TQEvent::MouseButtonRelease) {
- QMouseEvent* me = (QMouseEvent*)ev;
+ TQMouseEvent* me = (TQMouseEvent*)ev;
if (me->button() == LeftButton) {
m_dragging = false;
@@ -355,58 +355,58 @@ bool KoBirdEyePanel::eventFilter(QObject* o, QEvent* ev)
return m_page->eventFilter(o, ev);
}
-KoBirdEyePanel::enumDragHandle KoBirdEyePanel::dragHandleAt(QPoint p)
+KoBirdEyePanel::enumDragHandle KoBirdEyePanel::dragHandleAt(TQPoint p)
{
- QRect left = QRect(m_visibleAreaInThumbnail.left()-1, m_visibleAreaInThumbnail.top()-1, 3, m_visibleAreaInThumbnail.height()+2);
- QRect right = QRect(m_visibleAreaInThumbnail.right()-1, m_visibleAreaInThumbnail.top()-1, 3, m_visibleAreaInThumbnail.height()+2);
- QRect top = QRect(m_visibleAreaInThumbnail.left()-1, m_visibleAreaInThumbnail.top()-1, m_visibleAreaInThumbnail.width()+2, 3);
- QRect bottom = QRect(m_visibleAreaInThumbnail.left()-1, m_visibleAreaInThumbnail.bottom()-1, m_visibleAreaInThumbnail.width()+2, 3);
+ TQRect left = TQRect(m_visibleAreaInThumbnail.left()-1, m_visibleAreaInThumbnail.top()-1, 3, m_visibleAreaInThumbnail.height()+2);
+ TQRect right = TQRect(m_visibleAreaInThumbnail.right()-1, m_visibleAreaInThumbnail.top()-1, 3, m_visibleAreaInThumbnail.height()+2);
+ TQRect top = TQRect(m_visibleAreaInThumbnail.left()-1, m_visibleAreaInThumbnail.top()-1, m_visibleAreaInThumbnail.width()+2, 3);
+ TQRect bottom = TQRect(m_visibleAreaInThumbnail.left()-1, m_visibleAreaInThumbnail.bottom()-1, m_visibleAreaInThumbnail.width()+2, 3);
- if (left.contains(p)) {
+ if (left.tqcontains(p)) {
return DragHandleLeft;
}
- if (right.contains(p)) {
+ if (right.tqcontains(p)) {
return DragHandleRight;
}
- if (top.contains(p)) {
+ if (top.tqcontains(p)) {
return DragHandleTop;
}
- if (bottom.contains(p)) {
+ if (bottom.tqcontains(p)) {
return DragHandleBottom;
}
- if (m_visibleAreaInThumbnail.contains(p)) {
+ if (m_visibleAreaInThumbnail.tqcontains(p)) {
return DragHandleCentre;
}
return DragHandleNone;
}
-void KoBirdEyePanel::handleMouseMove(QPoint p)
+void KoBirdEyePanel::handleMouseMove(TQPoint p)
{
- QCursor cursor;
+ TQCursor cursor;
switch (dragHandleAt(p)) {
case DragHandleLeft:
case DragHandleRight:
- cursor = Qt::sizeHorCursor;
+ cursor = TQt::sizeHorCursor;
break;
case DragHandleTop:
case DragHandleBottom:
- cursor = Qt::sizeVerCursor;
+ cursor = TQt::sizeVerCursor;
break;
case DragHandleCentre:
- cursor = Qt::sizeAllCursor;
+ cursor = TQt::sizeAllCursor;
break;
default:
case DragHandleNone:
- if (m_thumbnail.rect().contains(p)) {
- cursor = Qt::PointingHandCursor;
+ if (m_thumbnail.rect().tqcontains(p)) {
+ cursor = TQt::PointingHandCursor;
} else {
- cursor = Qt::arrowCursor;
+ cursor = TQt::arrowCursor;
}
break;
}
@@ -414,16 +414,16 @@ void KoBirdEyePanel::handleMouseMove(QPoint p)
m_page->view->setCursor(cursor);
}
-void KoBirdEyePanel::handleMouseMoveAction(QPoint p)
+void KoBirdEyePanel::handleMouseMoveAction(TQPoint p)
{
if (m_dragging) {
- Q_INT32 dx = p.x() - m_lastDragPos.x();
- Q_INT32 dy = p.y() - m_lastDragPos.y();
+ TQ_INT32 dx = p.x() - m_lastDragPos.x();
+ TQ_INT32 dy = p.y() - m_lastDragPos.y();
m_lastDragPos = p;
- QRect thumbnailRect = m_visibleAreaInThumbnail;
+ TQRect thumbnailRect = m_visibleAreaInThumbnail;
switch (m_dragHandle) {
case DragHandleLeft: {
@@ -455,23 +455,23 @@ void KoBirdEyePanel::handleMouseMoveAction(QPoint p)
}
}
-void KoBirdEyePanel::handleMousePress(QPoint p)
+void KoBirdEyePanel::handleMousePress(TQPoint p)
{
if (!m_dragging) {
enumDragHandle dragHandle = dragHandleAt(p);
if (dragHandle == DragHandleNone) {
- if (m_thumbnail.rect().contains(p)) {
+ if (m_thumbnail.rect().tqcontains(p)) {
// Snap visible area centre to p and begin a centre drag.
- QRect thumbnailRect = m_visibleAreaInThumbnail;
+ TQRect thumbnailRect = m_visibleAreaInThumbnail;
thumbnailRect.moveCenter(p);
makeThumbnailRectVisible(thumbnailRect);
m_dragHandle = DragHandleCentre;
- m_page->view->setCursor(Qt::sizeAllCursor);
+ m_page->view->setCursor(TQt::sizeAllCursor);
m_dragging = true;
}
} else {
@@ -482,13 +482,13 @@ void KoBirdEyePanel::handleMousePress(QPoint p)
}
}
-void KoBirdEyePanel::makeThumbnailRectVisible(const QRect& r)
+void KoBirdEyePanel::makeThumbnailRectVisible(const TQRect& r)
{
if (r.isEmpty()) {
return;
}
- QRect thumbnailRect = r;
+ TQRect thumbnailRect = r;
if (thumbnailRect.left() < m_thumbnail.rect().left()) {
thumbnailRect.moveLeft(m_thumbnail.rect().left());
@@ -538,18 +538,18 @@ void KoBirdEyePanel::makeThumbnailRectVisible(const QRect& r)
m_zoomListener->zoomTo(docRect.center().x(), docRect.center().y(), zoomFactor);
}
-void KoBirdEyePanel::resizeViewEvent(QSize size)
+void KoBirdEyePanel::resizeViewEvent(TQSize size)
{
m_viewBuffer.resize(size);
fitThumbnailToView();
- slotUpdate(QRect(0, 0, m_documentSize.width(), m_documentSize.height()));
+ slotUpdate(TQRect(0, 0, m_documentSize.width(), m_documentSize.height()));
}
void KoBirdEyePanel::fitThumbnailToView()
{
- QRect docRect = QRect(0, 0, m_thumbnailProvider->pixelSize().width(), m_thumbnailProvider->pixelSize().height());
- Q_INT32 thumbnailWidth;
- Q_INT32 thumbnailHeight;
+ TQRect docRect = TQRect(0, 0, m_thumbnailProvider->pixelSize().width(), m_thumbnailProvider->pixelSize().height());
+ TQ_INT32 thumbnailWidth;
+ TQ_INT32 thumbnailHeight;
if (docRect.isEmpty()) {
thumbnailWidth = 0;
@@ -562,9 +562,9 @@ void KoBirdEyePanel::fitThumbnailToView()
if (xScale < yScale) {
thumbnailWidth = m_page->view->contentsRect().width() - thumbnailBorderPixels;
- thumbnailHeight = Q_INT32(ceil(docRect.height() * xScale));
+ thumbnailHeight = TQ_INT32(ceil(docRect.height() * xScale));
} else {
- thumbnailWidth = Q_INT32(ceil(docRect.width() * yScale));
+ thumbnailWidth = TQ_INT32(ceil(docRect.width() * yScale));
thumbnailHeight = m_page->view->contentsRect().height() - thumbnailBorderPixels;
}
}
@@ -581,9 +581,9 @@ void KoBirdEyePanel::renderView()
updateVisibleArea();
- QPainter painter(&m_viewBuffer);
+ TQPainter painter(&m_viewBuffer);
- painter.fillRect(0, 0, m_viewBuffer.width(), m_viewBuffer.height(), colorGroup().mid());
+ painter.fillRect(0, 0, m_viewBuffer.width(), m_viewBuffer.height(), tqcolorGroup().mid());
if (!m_thumbnail.isNull()) {
@@ -592,12 +592,12 @@ void KoBirdEyePanel::renderView()
painter.drawPixmap(thumbnailX, thumbnailY, m_thumbnail);
- painter.setPen(Qt::red);
+ painter.setPen(TQt::red);
painter.drawRect(thumbnailX + m_visibleAreaInThumbnail.x() - 1,
thumbnailY + m_visibleAreaInThumbnail.y() - 1,
m_visibleAreaInThumbnail.width() + 2,
m_visibleAreaInThumbnail.height() + 2);
- painter.setPen(Qt::red.light());
+ painter.setPen(TQt::red.light());
painter.drawRect(thumbnailX + m_visibleAreaInThumbnail.x() - 2,
thumbnailY + m_visibleAreaInThumbnail.y() - 2,
m_visibleAreaInThumbnail.width() + 4,
@@ -606,7 +606,7 @@ void KoBirdEyePanel::renderView()
}
}
-void KoBirdEyePanel::paintViewEvent(QPaintEvent *e)
+void KoBirdEyePanel::paintViewEvent(TQPaintEvent *e)
{
Q_ASSERT(!m_viewBuffer.isNull());