diff --git a/client/src/cmddata.c b/client/src/cmddata.c index 10ae7e9ac..9c7db0345 100644 --- a/client/src/cmddata.c +++ b/client/src/cmddata.c @@ -1448,7 +1448,7 @@ void setClockGrid(uint32_t clk, int offset) { } int CmdGrid(const char *Cmd) { - sscanf(Cmd, "%i %i", &PlotGridX, &PlotGridY); + sscanf(Cmd, "%lf %lf", &PlotGridX, &PlotGridY); PlotGridXdefault = PlotGridX; PlotGridYdefault = PlotGridY; RepaintGraphWindow(); diff --git a/client/src/proxgui.h b/client/src/proxgui.h index 921e4dcd5..887a0e36d 100644 --- a/client/src/proxgui.h +++ b/client/src/proxgui.h @@ -28,7 +28,7 @@ void ExitGraphics(void); extern double CursorScaleFactor; extern char CursorScaleFactorUnit[11]; -extern int PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault, GridOffset; +extern double PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault, GridOffset; extern uint32_t CursorCPos, CursorDPos; extern int CommandFinished; extern int offline; diff --git a/client/src/proxguiqt.cpp b/client/src/proxguiqt.cpp index 97eba2563..188634889 100644 --- a/client/src/proxguiqt.cpp +++ b/client/src/proxguiqt.cpp @@ -503,13 +503,13 @@ void Plot::plotGridLines(QPainter *painter, QRect r) { // set GridOffset if (PlotGridX <= 0) return; - int offset = GridOffset; + double offset = GridOffset; if (GridLocked && PlotGridX) { - offset = GridOffset + PlotGridX - (GraphStart % PlotGridX); + offset = GridOffset + PlotGridX - fmod(GraphStart, PlotGridX); } else if (!GridLocked && GraphStart > 0 && PlotGridX) { - offset = PlotGridX - ((GraphStart - offset) % PlotGridX) + GraphStart - unlockStart; + offset = PlotGridX - fmod(GraphStart - offset, PlotGridX) + GraphStart - unlockStart; } - offset %= PlotGridX; + offset = fmod(offset, PlotGridX); if (offset < 0) offset += PlotGridX; double i; @@ -610,7 +610,7 @@ void Plot::paintEvent(QPaintEvent *event) { sprintf(scalestr, "[%2.2f %s] ", ((int32_t)(CursorBPos - CursorAPos)) / CursorScaleFactor, CursorScaleFactorUnit); } } - sprintf(str, "@%u..%u dt=%i %szoom=%2.2f CursorAPos=%u CursorBPos=%u GridX=%d GridY=%d (%s) GridXoffset=%d", + sprintf(str, "@%u..%u dt=%i %szoom=%2.2f CursorAPos=%u CursorBPos=%u GridX=%lf GridY=%lf (%s) GridXoffset=%lf", GraphStart, GraphStop, CursorBPos - CursorAPos, @@ -790,7 +790,7 @@ void Plot::keyPressEvent(QKeyEvent *event) { if (event->modifiers() & Qt::ShiftModifier) { if (PlotGridX) - offset = PageWidth - (PageWidth % PlotGridX); + offset = PageWidth - fmod(PageWidth, PlotGridX); else offset = PageWidth; } else { diff --git a/client/src/ui.c b/client/src/ui.c index 9bf097583..804dafd65 100644 --- a/client/src/ui.c +++ b/client/src/ui.c @@ -39,7 +39,7 @@ session_arg_t session; double CursorScaleFactor = 1; char CursorScaleFactorUnit[11] = {0}; -int PlotGridX = 0, PlotGridY = 0, PlotGridXdefault = 64, PlotGridYdefault = 64; +double PlotGridX = 0, PlotGridY = 0, PlotGridXdefault = 64, PlotGridYdefault = 64; uint32_t CursorCPos = 0, CursorDPos = 0; double GraphPixelsPerPoint = 1.f; // How many visual pixels are between each sample point (x axis) static bool flushAfterWrite = 0;