@@ -176,18 +176,16 @@ bool LegacyExportDrawer::exportSamples(const PPresult *result, QPaintDevice* pai
176
176
painter.setPen (colorValues->text );
177
177
178
178
// Calculate variables needed for zoomed scope
179
- double m1 = settings->scope .getMarker (0 );
180
- double m2 = settings->scope .getMarker (1 );
179
+ double m1 = settings->scope .getMarker (0 ) + DIVS_TIME / 2 ; // zero at center -> zero at left margin
180
+ double m2 = settings->scope .getMarker (1 ) + DIVS_TIME / 2 ; // zero at center -> zero at left margin
181
181
if ( m1 > m2 )
182
182
std::swap ( m1, m2 );
183
183
double divs = m2 - m1;
184
184
double zoomFactor = DIVS_TIME / divs;
185
185
double zoomOffset = (m1 + m2) / 2 ;
186
- double time1 = m1 * settings->scope .horizontal .timebase ;
187
- double time2 = m2 * settings->scope .horizontal .timebase ;
186
+ double time1 = ( m1 - DIVS_TIME * settings-> scope . trigger . position ) * settings->scope .horizontal .timebase ;
187
+ double time2 = ( m2 - DIVS_TIME * settings-> scope . trigger . position ) * settings->scope .horizontal .timebase ;
188
188
double time = divs * settings->scope .horizontal .timebase ;
189
- m1 += DIVS_TIME / 2 ; // zero at center -> zero at left margin
190
- m2 += DIVS_TIME / 2 ;
191
189
double freq1 = m1 * settings->scope .horizontal .frequencybase ;
192
190
double freq2 = m2 * settings->scope .horizontal .frequencybase ;
193
191
double freq = freq2 - freq1;
@@ -221,7 +219,7 @@ bool LegacyExportDrawer::exportSamples(const PPresult *result, QPaintDevice* pai
221
219
tr (" /div" ),
222
220
QTextOption (Qt::AlignRight));
223
221
} else {
224
- stretchBase = (double )paintDevice->width () / 7 ;
222
+ stretchBase = (double )paintDevice->width () / 8 ;
225
223
scopeHeight = (double )paintDevice->height () - (channelCount + 4 ) * lineHeight;
226
224
double top = 2.5 * lineHeight + scopeHeight;
227
225
@@ -230,13 +228,18 @@ bool LegacyExportDrawer::exportSamples(const PPresult *result, QPaintDevice* pai
230
228
" t1: " + valueToString ( time1, UNIT_SECONDS, 4 ), QTextOption (Qt::AlignRight));
231
229
painter.drawText (QRectF (stretchBase * 2 , top, stretchBase, lineHeight),
232
230
" t2: " + valueToString ( time2, UNIT_SECONDS, 4 ), QTextOption (Qt::AlignRight));
233
- painter.drawText (QRectF (stretchBase * 3 , top, stretchBase, lineHeight),
231
+ if ( time ) {
232
+ painter.drawText (QRectF (stretchBase * 3 , top, stretchBase, lineHeight),
234
233
" Δt: " + valueToString ( time , UNIT_SECONDS, 4 ), QTextOption (Qt::AlignRight));
235
- painter.drawText (QRectF (stretchBase * 4 , top, stretchBase, lineHeight),
236
- " f1: " + valueToString ( freq1, UNIT_HERTZ, 4 ), QTextOption (Qt::AlignRight));
234
+ painter.drawText (QRectF (stretchBase * 4 , top, stretchBase, lineHeight),
235
+ " (=" + valueToString ( 1 /time , UNIT_HERTZ, 4 ) + " )" , QTextOption (Qt::AlignLeft));
236
+ }
237
237
painter.drawText (QRectF (stretchBase * 5 , top, stretchBase, lineHeight),
238
- " f2 : " + valueToString ( freq2 , UNIT_HERTZ, 4 ), QTextOption (Qt::AlignRight));
238
+ " f1 : " + valueToString ( freq1 , UNIT_HERTZ, 4 ), QTextOption (Qt::AlignRight));
239
239
painter.drawText (QRectF (stretchBase * 6 , top, stretchBase, lineHeight),
240
+ " f2: " + valueToString ( freq2, UNIT_HERTZ, 4 ), QTextOption (Qt::AlignRight));
241
+ if ( freq)
242
+ painter.drawText (QRectF (stretchBase * 7 , top, stretchBase, lineHeight),
240
243
" Δf: " + valueToString ( freq, UNIT_HERTZ, 4 ), QTextOption (Qt::AlignRight));
241
244
}
242
245
@@ -325,12 +328,29 @@ bool LegacyExportDrawer::exportSamples(const PPresult *result, QPaintDevice* pai
325
328
break ;
326
329
327
330
case Dso::GraphFormat::XY:
331
+ // TODO: create also XY image
328
332
break ;
329
333
330
334
default :
331
335
break ;
332
336
}
333
337
338
+ if ( !zoomed ) { // draw marker lines and trigger position
339
+ const double trig = DIVS_TIME * ( settings->scope .trigger .position - 0.5 );
340
+ const double tick = (double )DIVS_TIME / 250.0 ;
341
+ const double top = DIVS_VOLTAGE/2 ;
342
+ const double bottom = -DIVS_VOLTAGE/2 ;
343
+ const double left = -DIVS_TIME/2 ;
344
+ // const double right = DIVS_TIME/2;
345
+ painter.setPen ( QPen (colorValues->markers , 0 ) );
346
+ // markers
347
+ painter.drawLine ( QLineF ( m1 + left, bottom - 4 * tick, m1 + left, top ) );
348
+ painter.drawLine ( QLineF ( m2 + left, bottom - 4 * tick, m2 + left, top ) );
349
+ // trigger point (t=0)
350
+ painter.drawLine ( QLineF ( trig - tick, top + 4 * tick, trig, top ) );
351
+ painter.drawLine ( QLineF ( trig + tick, top + 4 * tick, trig, top ) );
352
+ }
353
+
334
354
// Set DIVS_TIME / zoomFactor x DIVS_VOLTAGE matrix for zoomed
335
355
// oscillograph
336
356
painter.setMatrix (QMatrix ((paintDevice->width () - 1 ) / DIVS_TIME * zoomFactor, 0 , 0 ,
0 commit comments