X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftoolwindow.cpp;h=fda5b8e7c204a961d1a66692155f997ae462e567;hb=1881acb17ed405cdb5aa2cb333a7af77f644a86d;hp=0bee1face47b438a5ca7de8e75e8cd39987b7dda;hpb=cf3ec188764cdf34ff3472ee9806aba3a772d2df;p=ttedit diff --git a/src/toolwindow.cpp b/src/toolwindow.cpp old mode 100755 new mode 100644 index 0bee1fa..fda5b8e --- a/src/toolwindow.cpp +++ b/src/toolwindow.cpp @@ -6,7 +6,7 @@ // JLH = James L. Hammons // // Who When What -// --- ---------- ------------------------------------------------------------- +// --- ---------- ----------------------------------------------------------- // JLH 08/28/2008 Created this file // JLH 03/11/2009 Converted from wxWidgets to Qt // @@ -23,18 +23,18 @@ #define DEBUGTP // Toolpalette debugging... #include "toolwindow.h" -#include "types.h" ToolWindow::ToolWindow(void): QWidget(NULL, Qt::Window | Qt::FramelessWindowHint), prevTool(TOOLNone) { - img = QImage(":/res/toolpal1.xpm"); +// img = QImage(":/res/toolpal1.xpm"); + img = QImage(":/res/toolpal1.png"); // Set up sizes sizeTPBM.rx() = img.width(), sizeTPBM.ry() = img.height(); - sizeStamp.rx() = sizeTPBM.x() / 5, sizeStamp.ry() = sizeTPBM.y() / 2; + sizeStamp.rx() = sizeTPBM.x() / 4, sizeStamp.ry() = sizeTPBM.y() / 3; setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setVisible(false); @@ -55,7 +55,7 @@ void ToolWindow::paintEvent(QPaintEvent * event) //need ul corner of bitmap, ul corner of dest, width/height p.setCompositionMode(QPainter::RasterOp_NotSource); // QPoint pt(sizeStamp.x() * (prevTool & 0x03), sizeStamp.y() * (prevTool >> 2)); - QPoint pt(sizeStamp.x() * (prevTool % 5), sizeStamp.y() * (prevTool / 5)); + QPoint pt(sizeStamp.x() * (prevTool % 4), sizeStamp.y() * (prevTool / 4)); p.drawImage(pt.x(), pt.y(), img, pt.x(), pt.y(), sizeStamp.x(), sizeStamp.y()); } } @@ -71,18 +71,20 @@ ToolType ToolWindow::FindSelectedTool(void) //printf("pt = %u, %u\n", pt.x(), pt.y()); // Divide mouse coords by the bitmap stamp size to find which one is pointed to - uint32 x = (uint32)pt.x() / sizeStamp.x(), y = (uint32)pt.y() / sizeStamp.y(); + uint32_t x = (uint32_t)pt.x() / sizeStamp.x(), y = (uint32_t)pt.y() / sizeStamp.y(); // Preset failure into newTool, in case no new tool is selected ToolType newTool = TOOLNone; // NOTE: This works because x and y are UNSIGNED - if (x < 5 && y < 2) - newTool = (ToolType)((y * 5) + x); + if (x < 4 && y < 3) + newTool = (ToolType)((y * 4) + x); - // We don't have 10 yet, so fix this if the user selected the blank space - if (newTool == 9) - newTool = TOOLNone; + // We don't have 11 yet, so fix this if the user selected the blank space +//now we do! +// if (newTool > 10) +// newTool = TOOLNone; return newTool; } +