]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - linux/proxguiqt.cpp
Fix define typo
[proxmark3-svn] / linux / proxguiqt.cpp
index 773d74b85ea32d439017829e617f057e25f3bc60..2be3f68228ec26cf1658cee0c02ced2b8685414f 100644 (file)
@@ -86,7 +86,7 @@ ProxGuiQT::~ProxGuiQT(void)
 void ProxWidget::paintEvent(QPaintEvent *event)
 {
        QPainter painter(this);
 void ProxWidget::paintEvent(QPaintEvent *event)
 {
        QPainter painter(this);
-       QPainterPath penPath, whitePath, greyPath, cursorAPath, cursorBPath;
+       QPainterPath penPath, whitePath, greyPath, lightgreyPath, cursorAPath, cursorBPath;
        QRect r;
        QBrush brush(QColor(100, 255, 100));
        QPen pen(QColor(100, 255, 100));
        QRect r;
        QBrush brush(QColor(100, 255, 100));
        QPen pen(QColor(100, 255, 100));
@@ -97,6 +97,11 @@ void ProxWidget::paintEvent(QPaintEvent *event)
                GraphStart = 0;
        }
 
                GraphStart = 0;
        }
 
+       if (CursorAPos > GraphTraceLen)
+               CursorAPos= 0;
+       if(CursorBPos > GraphTraceLen)
+               CursorBPos= 0;
+
        r = rect();
 
        painter.fillRect(r, QColor(0, 0, 0));
        r = rect();
 
        painter.fillRect(r, QColor(0, 0, 0));
@@ -110,6 +115,29 @@ void ProxWidget::paintEvent(QPaintEvent *event)
        greyPath.lineTo(r.right(), zeroHeight);
        painter.setPen(QColor(100, 100, 100));
        painter.drawPath(greyPath);
        greyPath.lineTo(r.right(), zeroHeight);
        painter.setPen(QColor(100, 100, 100));
        painter.drawPath(greyPath);
+
+        // plot X and Y grid lines
+        int i;
+        if ((PlotGridX > 0) && ((PlotGridX * GraphPixelsPerPoint) > 1)) {
+               for(i = 40; i < r.right(); i += (int)(PlotGridX * GraphPixelsPerPoint)) {
+                       //SelectObject(hdc, GreyPenLite);
+                       //MoveToEx(hdc, r.left + i, r.top, NULL);
+                       //LineTo(hdc, r.left + i, r.bottom);
+                       lightgreyPath.moveTo(r.left()+i,r.top());
+                       lightgreyPath.lineTo(r.left()+i,r.bottom());
+                       painter.drawPath(lightgreyPath);
+                } 
+        } 
+        if ((PlotGridY > 0) && ((PlotGridY * GraphPixelsPerPoint) > 1)){
+               for(i = 0; i < ((r.top() + r.bottom())>>1); i += (int)(PlotGridY * GraphPixelsPerPoint)) {
+                               lightgreyPath.moveTo(r.left() + 40,zeroHeight + i);
+                       lightgreyPath.lineTo(r.right(),zeroHeight + i);
+                       painter.drawPath(lightgreyPath);
+                       lightgreyPath.moveTo(r.left() + 40,zeroHeight - i);
+                       lightgreyPath.lineTo(r.right(),zeroHeight - i);
+                       painter.drawPath(lightgreyPath);
+                       }
+               }
        
        int startMax =
                (GraphTraceLen - (int)((r.right() - r.left() - 40) / GraphPixelsPerPoint));
        
        int startMax =
                (GraphTraceLen - (int)((r.right() - r.left() - 40) / GraphPixelsPerPoint));
@@ -122,7 +150,6 @@ void ProxWidget::paintEvent(QPaintEvent *event)
 
        int absYMax = 1;
 
 
        int absYMax = 1;
 
-       int i;
        for(i = GraphStart; ; i++) {
                if(i >= GraphTraceLen) {
                        break;
        for(i = GraphStart; ; i++) {
                if(i >= GraphTraceLen) {
                        break;
@@ -226,9 +253,9 @@ void ProxWidget::paintEvent(QPaintEvent *event)
        painter.drawPath(cursorBPath);
 
        char str[100];
        painter.drawPath(cursorBPath);
 
        char str[100];
-       sprintf(str, "@%d   max=%d min=%d mean=%d n=%d/%d    dt=%d [%.3f]",
+       sprintf(str, "@%d   max=%d min=%d mean=%d n=%d/%d    dt=%d [%.3f] zoom=%.3f CursorA=%d [%d] CursorB=%d [%d]",
                        GraphStart, yMax, yMin, yMean, n, GraphTraceLen,
                        GraphStart, yMax, yMin, yMean, n, GraphTraceLen,
-                       CursorBPos - CursorAPos, (CursorBPos - CursorAPos)/CursorScaleFactor);
+                       CursorBPos - CursorAPos, (CursorBPos - CursorAPos)/CursorScaleFactor,GraphPixelsPerPoint,CursorAPos,GraphBuffer[CursorAPos],CursorBPos,GraphBuffer[CursorBPos]);
 
        painter.setPen(QColor(255, 255, 255));
        painter.drawText(50, r.bottom() - 20, str);
 
        painter.setPen(QColor(255, 255, 255));
        painter.drawText(50, r.bottom() - 20, str);
Impressum, Datenschutz