diff options
Diffstat (limited to 'kpacman/painter.cpp')
-rw-r--r-- | kpacman/painter.cpp | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/kpacman/painter.cpp b/kpacman/painter.cpp index 93a3782..9060620 100644 --- a/kpacman/painter.cpp +++ b/kpacman/painter.cpp @@ -2,20 +2,20 @@ #include <kconfig.h> #include <kstddirs.h> -#include <qcolor.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qbitmap.h> -#include <qrect.h> -#include <qstring.h> +#include <ntqcolor.h> +#include <ntqpainter.h> +#include <ntqpixmap.h> +#include <ntqbitmap.h> +#include <ntqrect.h> +#include <ntqstring.h> -#include <qmessagebox.h> -#include <qfileinfo.h> +#include <ntqmessagebox.h> +#include <ntqfileinfo.h> #include "painter.h" #include "board.h" -Painter::Painter( Board *b, QWidget *parent, int Scheme, int Mode, Bitfont *font) +Painter::Painter( Board *b, TQWidget *parent, int Scheme, int Mode, Bitfont *font) { w = parent; board = b; @@ -53,24 +53,24 @@ Painter::Painter( Board *b, QWidget *parent, int Scheme, int Mode, Bitfont *font confScheme(); } -QList<QPixmap> *Painter::loadPixmap(QWidget *parent, QString pixmapName, - QList<QPixmap> *pixmaps) +TQList<TQPixmap> *Painter::loadPixmap(TQWidget *parent, TQString pixmapName, + TQList<TQPixmap> *pixmaps) { if (pixmaps == NULL) { - pixmaps = new QList<QPixmap>; + pixmaps = new TQList<TQPixmap>; pixmaps->setAutoDelete(TRUE); } if (!pixmaps->isEmpty()) pixmaps->clear(); - QPixmap PIXMAP(pixmapName); + TQPixmap PIXMAP(pixmapName); if (PIXMAP.isNull() || PIXMAP.mask() == NULL) { - QString msg = i18n("The pixmap could not be contructed.\n\n" + TQString msg = i18n("The pixmap could not be contructed.\n\n" "The file '@PIXMAPNAME@' does not exist,\n" "or is of an unknown format."); - msg.replace(QRegExp("@PIXMAPNAME@"), pixmapName); - // QMessageBox::critical(parent, i18n("Initialization Error"), msg); + msg.replace(TQRegExp("@PIXMAPNAME@"), pixmapName); + // TQMessageBox::critical(parent, i18n("Initialization Error"), msg); printf("%s\n", msg.data()); return 0; } @@ -78,28 +78,28 @@ QList<QPixmap> *Painter::loadPixmap(QWidget *parent, QString pixmapName, int height = PIXMAP.height(); int width = (height == 0) ? 0 : PIXMAP.width()/(PIXMAP.width()/height); - QBitmap BITMAP; - QBitmap MASK; + TQBitmap BITMAP; + TQBitmap MASK; BITMAP = *PIXMAP.mask(); MASK.resize(width, height); for (int x = 0; x < PIXMAP.width()/width; x++) { - QPixmap *pixmap = new QPixmap(width, height); + TQPixmap *pixmap = new TQPixmap(width, height); pixmaps->append(pixmap); - bitBlt(pixmap, 0, 0, &PIXMAP, x*width, 0, width, height, QPixmap::CopyROP, TRUE); - bitBlt(&MASK, 0, 0, &BITMAP, x*width, 0, width, height, QPixmap::CopyROP, TRUE); + bitBlt(pixmap, 0, 0, &PIXMAP, x*width, 0, width, height, TQPixmap::CopyROP, TRUE); + bitBlt(&MASK, 0, 0, &BITMAP, x*width, 0, width, height, TQPixmap::CopyROP, TRUE); pixmap->setMask(MASK); } return pixmaps; } -QList<QPixmap> *Painter::textPixmap(QStrList &str, QList<QPixmap> *pixmaps, - QColor fg, QColor bg) +TQList<TQPixmap> *Painter::textPixmap(TQStrList &str, TQList<TQPixmap> *pixmaps, + TQColor fg, TQColor bg) { if (pixmaps == NULL) { - pixmaps = new QList<QPixmap>; + pixmaps = new TQList<TQPixmap>; pixmaps->setAutoDelete(TRUE); } @@ -107,25 +107,25 @@ QList<QPixmap> *Painter::textPixmap(QStrList &str, QList<QPixmap> *pixmaps, pixmaps->clear(); for (uint s = 0; s < str.count(); s++) { - QPixmap *pixmap = new QPixmap(bitfont->text(str.at(s), fg, bg)); + TQPixmap *pixmap = new TQPixmap(bitfont->text(str.at(s), fg, bg)); pixmaps->append(pixmap); } return pixmaps; } -QList<QPixmap> *Painter::textPixmap(QString str, QList<QPixmap> *pixmaps, - QColor fg, QColor bg) +TQList<TQPixmap> *Painter::textPixmap(TQString str, TQList<TQPixmap> *pixmaps, + TQColor fg, TQColor bg) { if (pixmaps == NULL) { - pixmaps = new QList<QPixmap>; + pixmaps = new TQList<TQPixmap>; pixmaps->setAutoDelete(TRUE); } if (!pixmaps->isEmpty()) pixmaps->clear(); - QPixmap *pixmap = new QPixmap(bitfont->text(str, fg, bg)); + TQPixmap *pixmap = new TQPixmap(bitfont->text(str, fg, bg)); pixmaps->append(pixmap); return pixmaps; @@ -134,18 +134,18 @@ QList<QPixmap> *Painter::textPixmap(QString str, QList<QPixmap> *pixmaps, /* Return the point of the upperleft pixel of the block representing that position * on the board. */ -QPoint Painter::point(int pos) +TQPoint Painter::point(int pos) { - return QPoint((board->x(pos)-1)*BlockWidth, (board->y(pos)-1)*BlockHeight); + return TQPoint((board->x(pos)-1)*BlockWidth, (board->y(pos)-1)*BlockHeight); } -QRect Painter::rect(int pos, PixMap pix, uint i) +TQRect Painter::rect(int pos, PixMap pix, uint i) { if (pos == OUT) - return QRect(); + return TQRect(); - QPixmap *PIXMAP = NULL; + TQPixmap *PIXMAP = NULL; switch (pix) { case PacmanPix : PIXMAP = pacmanPix-> at(checkRange(i, pacmanPix->count()-1)); @@ -178,36 +178,36 @@ QRect Painter::rect(int pos, PixMap pix, uint i) at(checkRange(i, wallPix->count()-1)); } if (PIXMAP == NULL) - return QRect(); + return TQRect(); - QRect rect = PIXMAP->rect(); - QPoint point = this->point(pos); - rect.moveCenter(QPoint(point.x()-1, point.y()-1)); + TQRect rect = PIXMAP->rect(); + TQPoint point = this->point(pos); + rect.moveCenter(TQPoint(point.x()-1, point.y()-1)); return rect; } -QRect Painter::rect(int pos, QString str, int align) +TQRect Painter::rect(int pos, TQString str, int align) { if (pos == OUT) // return an empty rect if the position - return QRect(); // is invalid - QPoint point = this->point(pos); - QRect rect = bitfont->rect(str); + return TQRect(); // is invalid + TQPoint point = this->point(pos); + TQRect rect = bitfont->rect(str); - rect.moveCenter(QPoint(point.x()-1, point.y()-1)); + rect.moveCenter(TQPoint(point.x()-1, point.y()-1)); int dx = 0; int dy = 0; - if (align & QLabel::AlignLeft || align & QLabel::AlignRight) { + if (align & TQLabel::AlignLeft || align & TQLabel::AlignRight) { dx = (str.length()-1) * (bitfont->width()/2); - if (align & QLabel::AlignRight) + if (align & TQLabel::AlignRight) dx *= -1; } - if (align & QLabel::AlignTop || align & QLabel::AlignBottom) { + if (align & TQLabel::AlignTop || align & TQLabel::AlignBottom) { dy = bitfont->height()/2; - if (align & QLabel::AlignBottom) + if (align & TQLabel::AlignBottom) dy *= -1; } @@ -217,9 +217,9 @@ QRect Painter::rect(int pos, QString str, int align) return rect; } -QRect Painter::rect(QRect r1, QRect r2) +TQRect Painter::rect(TQRect r1, TQRect r2) { - QRect rect; + TQRect rect; rect.setLeft(r1.left() < r2.left() ? r1.left() : r2.left()); rect.setTop(r1.top() < r2.top() ? r1.top() : r2.top()); rect.setRight(r1.right() > r2.right() ? r1.right() : r2.right()); @@ -232,7 +232,7 @@ void Painter::erase(int pos, PixMap pix, uint i) { if (pos == OUT) return; - QRect rect = this->rect(pos, pix, i); + TQRect rect = this->rect(pos, pix, i); bitBlt(&roomPix, rect.x(), rect.y(), &backPix, rect.x(), rect.y(), rect.width(), rect.height()); } @@ -255,7 +255,7 @@ int Painter::maxPixmaps(PixMap pix) } } -void Painter::draw(QPoint point, DrawWidget where, QPixmap pix) +void Painter::draw(TQPoint point, DrawWidget where, TQPixmap pix) { switch (where) { case Widget : bitBlt(w, point.x(), point.y(), &pix); @@ -267,14 +267,14 @@ void Painter::draw(QPoint point, DrawWidget where, QPixmap pix) } } -void Painter::draw(QRect rect, DrawWidget where, QPixmap pix) +void Painter::draw(TQRect rect, DrawWidget where, TQPixmap pix) { - draw(QPoint(rect.x(), rect.y()), where, pix); + draw(TQPoint(rect.x(), rect.y()), where, pix); } void Painter::draw(int pos, DrawWidget where, PixMap pix, uint i) { - QPixmap *PIXMAP = NULL; + TQPixmap *PIXMAP = NULL; switch (pix) { case PacmanPix : PIXMAP = pacmanPix-> at(checkRange(i, pacmanPix->count()-1)); @@ -306,9 +306,9 @@ void Painter::draw(int pos, DrawWidget where, PixMap pix, uint i) if (PIXMAP == NULL) return; - QRect rect = PIXMAP->rect(); - QPoint point = this->point(pos); - rect.moveCenter(QPoint(point.x()-1, point.y()-1)); + TQRect rect = PIXMAP->rect(); + TQPoint point = this->point(pos); + rect.moveCenter(TQPoint(point.x()-1, point.y()-1)); switch (where) { case Widget : bitBlt(w, rect.x(), rect.y(), PIXMAP); @@ -320,13 +320,13 @@ void Painter::draw(int pos, DrawWidget where, PixMap pix, uint i) } } -QPixmap Painter::draw(int pos, DrawWidget where, - QString str, QColor fg, QColor bg, int align) +TQPixmap Painter::draw(int pos, DrawWidget where, + TQString str, TQColor fg, TQColor bg, int align) { - QPixmap TEXT = bitfont->text(str, fg, bg); + TQPixmap TEXT = bitfont->text(str, fg, bg); - QRect rect = this->rect(pos, str, align); - QPixmap SAVE = QPixmap(rect.width(), rect.height()); + TQRect rect = this->rect(pos, str, align); + TQPixmap SAVE = TQPixmap(rect.width(), rect.height()); switch (where) { case Widget : bitBlt(&SAVE, 0, 0, w, rect.x(), rect.y()); @@ -343,12 +343,12 @@ QPixmap Painter::draw(int pos, DrawWidget where, return SAVE; } -QRect Painter::draw(int col, int row, DrawWidget where, - QString str, QColor fg, QColor bg, int align) +TQRect Painter::draw(int col, int row, DrawWidget where, + TQString str, TQColor fg, TQColor bg, int align) { - QPixmap TEXT = bitfont->text(str, fg, bg); + TQPixmap TEXT = bitfont->text(str, fg, bg); - QRect rect = this->rect(row*BoardWidth+col, str, align); + TQRect rect = this->rect(row*BoardWidth+col, str, align); draw(rect, where, TEXT); return rect; @@ -545,7 +545,7 @@ void Painter::drawBrick(int pos) default : border = -1; } if (border != -1 && border < (int) wallPix->count()) { - QRect rect = this->rect(pos, WallPix); + TQRect rect = this->rect(pos, WallPix); bitBlt(&roomPix, rect.x(), rect.y(), wallPix->at((uint) border)); } } @@ -618,7 +618,7 @@ void Painter::drawPrison(int pos) } if (border != -1 && border < (int) prisonPix->count()) { - QRect rect = this->rect(pos, PrisonPix); + TQRect rect = this->rect(pos, PrisonPix); bitBlt(&roomPix, rect.x(), rect.y(), prisonPix->at((uint) border)); } } @@ -626,22 +626,22 @@ void Painter::drawPrison(int pos) void Painter::drawPoint(int pos) { if (!pointPix->isEmpty()) { - QRect rect = this->rect(pos, PointPix); + TQRect rect = this->rect(pos, PointPix); bitBlt(&roomPix, rect.x(), rect.y(), pointPix->at(0)); } } -QString Painter::decodeHexOctString(QString s) +TQString Painter::decodeHexOctString(TQString s) { - QString value; - QString valids; + TQString value; + TQString valids; int pos, xpos = 0, opos = 0; int v, len, leadin; const char *ptr; uchar c; - while (((xpos = s.find(QRegExp("\\\\x[0-9a-fA-F]+"), xpos)) != -1) || - ((opos = s.find(QRegExp("\\\\[0-7]+"), opos)) != -1)) { + while (((xpos = s.find(TQRegExp("\\\\x[0-9a-fA-F]+"), xpos)) != -1) || + ((opos = s.find(TQRegExp("\\\\[0-7]+"), opos)) != -1)) { if (xpos != -1) { valids = "0123456789abcdef"; leadin = 2; @@ -669,12 +669,12 @@ QString Painter::decodeHexOctString(QString s) return s; } -void Painter::fillScoreString(QStrList &list, QArray<int> &values) +void Painter::fillScoreString(TQStrList &list, TQArray<int> &values) { if( !list.isEmpty()) list.clear(); - QString s; + TQString s; for (uint i = 0; i < values.size(); i++) { @@ -697,12 +697,12 @@ void Painter::fillScoreString(QStrList &list, QArray<int> &values) } } -void Painter::fillArray(QArray<int> &array, QString values, int max) +void Painter::fillArray(TQArray<int> &array, TQString values, int max) { array.resize(max); int last = 0; bool ok; - QString value; + TQString value; for (uint i = 0; i < array.size(); i++) { if (values.find(',') < 0 && values.length() > 0) { @@ -721,13 +721,13 @@ void Painter::fillArray(QArray<int> &array, QString values, int max) } } -void Painter::fillStrList(QStrList &list, QString values, int max) +void Painter::fillStrList(TQStrList &list, TQString values, int max) { if (!list.isEmpty()) list.clear(); - QString last = ""; - QString value; + TQString last = ""; + TQString value; for (uint i = 0; i < (uint) max; i++) { if (values.find(',') < 0 && values.length() > 0) { @@ -744,16 +744,16 @@ void Painter::fillStrList(QStrList &list, QString values, int max) } } -void Painter::fillPixmapName(QStrList &pixmapName) +void Painter::fillPixmapName(TQStrList &pixmapName) { - QStrList list = pixmapName; + TQStrList list = pixmapName; if (!pixmapName.isEmpty()) pixmapName.clear(); - QString pixmap; + TQString pixmap; - QFileInfo fileInfo; + TQFileInfo fileInfo; for (uint i = 0; i < list.count(); i++) { pixmap = list.at(i); @@ -843,8 +843,8 @@ void Painter::confScoring(bool defGroup) void Painter::confScheme() { - QString oldgroup = kapp->config()->group(); - QString newgroup; + TQString oldgroup = kapp->config()->group(); + TQString newgroup; // if not set, read mode and scheme from the configfile if (mode == -1 && scheme == -1) { |