summaryrefslogtreecommitdiffstats
path: root/karbon/widgets/vruler.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 /karbon/widgets/vruler.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 'karbon/widgets/vruler.cc')
-rw-r--r--karbon/widgets/vruler.cc78
1 files changed, 39 insertions, 39 deletions
diff --git a/karbon/widgets/vruler.cc b/karbon/widgets/vruler.cc
index 0f7c2f62..28ed8939 100644
--- a/karbon/widgets/vruler.cc
+++ b/karbon/widgets/vruler.cc
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <qpainter.h>
+#include <tqpainter.h>
#include "kdebug.h"
@@ -40,7 +40,7 @@ const char *VRuler::m_nums[] = {
"XX XXXXXX XXX XXX XXXXXX XXX XXXX XXXXX XXXXX XXXX XXX"
};
-VRuler::VRuler(Qt::Orientation o, QWidget *parent, const char *name) : super(parent, name, WRepaintNoErase | WResizeNoErase), m_pixmapNums(m_nums)
+VRuler::VRuler(Qt::Orientation o, TQWidget *tqparent, const char *name) : super(tqparent, name, WRepaintNoErase | WResizeNoErase), m_pixmapNums(m_nums)
{
setBackgroundMode(NoBackground);
setFrameStyle(Box | Sunken);
@@ -67,9 +67,9 @@ VRuler::~VRuler()
delete m_pixmapBuffer;
}
-void VRuler::initMarker(Q_INT32 w, Q_INT32 h)
+void VRuler::initMarker(TQ_INT32 w, TQ_INT32 h)
{
- QPainter p;
+ TQPainter p;
m_pixmapMarker.resize(w, h);
p.begin(&m_pixmapMarker);
@@ -81,8 +81,8 @@ void VRuler::initMarker(Q_INT32 w, Q_INT32 h)
void VRuler::recalculateSize()
{
- Q_INT32 w;
- Q_INT32 h;
+ TQ_INT32 w;
+ TQ_INT32 h;
if (m_pixmapBuffer) {
delete m_pixmapBuffer;
@@ -97,7 +97,7 @@ void VRuler::recalculateSize()
h = height();
}
- m_pixmapBuffer = new QPixmap(w, h);
+ m_pixmapBuffer = new TQPixmap(w, h);
Q_CHECK_PTR(m_pixmapBuffer);
drawRuler();
@@ -114,7 +114,7 @@ void VRuler::setUnit(KoUnit::Unit u)
m_unit = u;
drawRuler();
updatePointer(m_currentPosition, m_currentPosition);
- repaint();
+ tqrepaint();
}
void VRuler::setZoom(double zoom)
@@ -123,15 +123,15 @@ void VRuler::setZoom(double zoom)
recalculateSize();
drawRuler();
updatePointer(m_currentPosition, m_currentPosition);
- repaint();
+ tqrepaint();
}
-void VRuler::updatePointer(Q_INT32 x, Q_INT32 y)
+void VRuler::updatePointer(TQ_INT32 x, TQ_INT32 y)
{
if (m_pixmapBuffer) {
if (m_orientation == Qt::Horizontal) {
if (m_currentPosition != -1)
- repaint(m_currentPosition, 1, MARKER_WIDTH, MARKER_HEIGHT);
+ tqrepaint(m_currentPosition, 1, MARKER_WIDTH, MARKER_HEIGHT);
if (x != -1) {
bitBlt(this, x, 1, &m_pixmapMarker, 0, 0, MARKER_WIDTH, MARKER_HEIGHT);
@@ -139,7 +139,7 @@ void VRuler::updatePointer(Q_INT32 x, Q_INT32 y)
}
} else {
if (m_currentPosition != -1)
- repaint(1, m_currentPosition, MARKER_HEIGHT, MARKER_WIDTH);
+ tqrepaint(1, m_currentPosition, MARKER_HEIGHT, MARKER_WIDTH);
if (y != -1) {
bitBlt(this, 1, y, &m_pixmapMarker, 0, 0, MARKER_HEIGHT, MARKER_WIDTH);
@@ -149,7 +149,7 @@ void VRuler::updatePointer(Q_INT32 x, Q_INT32 y)
}
}
-void VRuler::updateVisibleArea(Q_INT32 xpos, Q_INT32 ypos)
+void VRuler::updateVisibleArea(TQ_INT32 xpos, TQ_INT32 ypos)
{
if (m_orientation == Qt::Horizontal)
m_firstVisible = xpos;
@@ -158,15 +158,15 @@ void VRuler::updateVisibleArea(Q_INT32 xpos, Q_INT32 ypos)
//kdDebug() << "--###-- VRuler::updateVisibleArea(" << xpos << ", " << ypos << ")" << endl;
drawRuler();
- repaint();
+ tqrepaint();
updatePointer(m_currentPosition, m_currentPosition);
//kdDebug() << "--###-- VRuler::updatePointer(" << m_currentPosition << ", " << m_currentPosition << ")" << endl;
}
-void VRuler::paintEvent(QPaintEvent *e)
+void VRuler::paintEvent(TQPaintEvent *e)
{
if (m_pixmapBuffer) {
- const QRect& rect = e -> rect();
+ const TQRect& rect = e -> rect();
bitBlt(this, rect.topLeft(), m_pixmapBuffer, rect);
super::paintEvent(e);
@@ -175,20 +175,20 @@ void VRuler::paintEvent(QPaintEvent *e)
void VRuler::drawRuler()
{
- QPainter p;
- QString buf;
- Q_INT32 st1 = 0;
- Q_INT32 st2 = 0;
- Q_INT32 st3 = 0;
- Q_INT32 st4 = 0;
- Q_INT32 stt = 0;
+ TQPainter p;
+ TQString buf;
+ TQ_INT32 st1 = 0;
+ TQ_INT32 st2 = 0;
+ TQ_INT32 st3 = 0;
+ TQ_INT32 st4 = 0;
+ TQ_INT32 stt = 0;
if (!m_pixmapBuffer)
return;
p.begin(m_pixmapBuffer);
- p.setPen(QColor(0x70, 0x70, 0x70));
- p.setBackgroundColor(colorGroup().background());
+ p.setPen(TQColor(0x70, 0x70, 0x70));
+ p.setBackgroundColor(tqcolorGroup().background());
p.eraseRect(0, 0, m_pixmapBuffer -> width(), m_pixmapBuffer -> height());
switch (m_unit) {
@@ -215,7 +215,7 @@ void VRuler::drawRuler()
break;
}
- Q_INT32 pos = 0;
+ TQ_INT32 pos = 0;
bool s1 = KoUnit::fromUserValue(st1, m_unit) * m_zoom > 3.0;
bool s2 = KoUnit::fromUserValue(st2, m_unit) * m_zoom > 3.0;
bool s3 = KoUnit::fromUserValue(st3, m_unit) * m_zoom > 3.0;
@@ -224,11 +224,11 @@ void VRuler::drawRuler()
if (m_orientation == Qt::Horizontal) {
// XXX: This was 7 * 4 -- why? what was the idea about having 30 point intervals?
float cx = KoUnit::fromUserValue(100, m_unit) / m_zoom;
- Q_INT32 step = qRound(cx);//((Q_INT32)(cx / (float)stt) + 1) * stt;
- Q_INT32 start = (Q_INT32)(KoUnit::toUserValue(m_firstVisible, m_unit) / m_zoom);
+ TQ_INT32 step = tqRound(cx);//((TQ_INT32)(cx / (float)stt) + 1) * stt;
+ TQ_INT32 start = (TQ_INT32)(KoUnit::toUserValue(m_firstVisible, m_unit) / m_zoom);
do {
- pos = (Q_INT32)(KoUnit::fromUserValue(start, m_unit) * m_zoom - m_firstVisible);
+ pos = (TQ_INT32)(KoUnit::fromUserValue(start, m_unit) * m_zoom - m_firstVisible);
if (!s3 && s4 && start % st4 == 0)
p.drawLine(pos, RULER_SIZE - 9, pos, RULER_SIZE);
@@ -243,7 +243,7 @@ void VRuler::drawRuler()
p.drawLine(pos, RULER_SIZE - 5, pos, RULER_SIZE);
if (step && start % step == 0) {
- buf.setNum(QABS(start));
+ buf.setNum(TQABS(start));
drawNums(&p, pos, 4, buf, true);
}
@@ -252,12 +252,12 @@ void VRuler::drawRuler()
} else {
m_firstVisible = 0;
float cx = KoUnit::fromUserValue(100, m_unit) / m_zoom;
- Q_INT32 height = m_pixmapBuffer -> height() - 1;
- Q_INT32 step = qRound(cx);
- Q_INT32 start = (Q_INT32)(KoUnit::toUserValue(m_firstVisible, m_unit) / m_zoom);
+ TQ_INT32 height = m_pixmapBuffer -> height() - 1;
+ TQ_INT32 step = tqRound(cx);
+ TQ_INT32 start = (TQ_INT32)(KoUnit::toUserValue(m_firstVisible, m_unit) / m_zoom);
do {
- pos = height - (Q_INT32)(KoUnit::fromUserValue(start, m_unit) * m_zoom - m_firstVisible);
+ pos = height - (TQ_INT32)(KoUnit::fromUserValue(start, m_unit) * m_zoom - m_firstVisible);
if (!s3 && s4 && start % st4 == 0)
p.drawLine(RULER_SIZE - 9, pos, RULER_SIZE, pos);
@@ -272,7 +272,7 @@ void VRuler::drawRuler()
p.drawLine(RULER_SIZE - 5, pos, RULER_SIZE, pos);
if (step && start % step == 0) {
- buf.setNum(QABS(start));
+ buf.setNum(TQABS(start));
drawNums(&p, 4, pos, buf, false);
}
@@ -283,7 +283,7 @@ void VRuler::drawRuler()
p.end();
}
-void VRuler::resizeEvent(QResizeEvent *)
+void VRuler::resizeEvent(TQResizeEvent *)
{
recalculateSize();
}
@@ -309,15 +309,15 @@ void VRuler::hide()
setFixedWidth(1);
}
-void VRuler::drawNums(QPainter *p, Q_INT32 x, Q_INT32 y, QString& num, bool orientationHoriz)
+void VRuler::drawNums(TQPainter *p, TQ_INT32 x, TQ_INT32 y, TQString& num, bool orientationHoriz)
{
if (orientationHoriz)
x -= 7;
else
y -= 8;
- for (Q_UINT32 k = 0; k < num.length(); k++) {
- Q_INT32 st = num.at(k).digitValue() * 7;
+ for (TQ_UINT32 k = 0; k < num.length(); k++) {
+ TQ_INT32 st = num.at(k).digitValue() * 7;
p -> drawPixmap(x, y, m_pixmapNums, st, 0, 7, 7);