kopia lustrzana https://gitlab.com/Teuniz/DSRemote
Added keyboard shortcut to center the trigger position.
rodzic
143f18efb3
commit
b0515b26cf
2
global.h
2
global.h
|
@ -35,7 +35,7 @@
|
|||
|
||||
|
||||
#define PROGRAM_NAME "DSRemote"
|
||||
#define PROGRAM_VERSION "0.33_1612281147"
|
||||
#define PROGRAM_VERSION "0.33_1612281232"
|
||||
|
||||
#define MAX_PATHLEN 4096
|
||||
|
||||
|
|
|
@ -1869,6 +1869,7 @@ void UI_Mainwindow::show_howto_operate()
|
|||
"Decrease vertical scale: +\n"
|
||||
"Press '1' to select or deselect channel 1\n"
|
||||
"Press '2' to select or deselect channel 2, etc.\n"
|
||||
"Press 'c' to center the trigger position (set timebase offset to zero).\n"
|
||||
"Press 'f' to toggle FFT.\n"
|
||||
);
|
||||
|
||||
|
|
|
@ -1492,6 +1492,86 @@ void UI_Mainwindow::shift_page_right()
|
|||
}
|
||||
|
||||
|
||||
void UI_Mainwindow::center_trigger()
|
||||
{
|
||||
char str[256];
|
||||
|
||||
if(device == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!devparms.connected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(devparms.math_fft && devparms.math_fft_split)
|
||||
{
|
||||
devparms.math_fft_hcenter = 0;
|
||||
|
||||
if(devparms.modelserie != 1)
|
||||
{
|
||||
sprintf(str, ":CALC:FFT:HCEN %e", devparms.math_fft_hcenter);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(str, ":MATH:FFT:HCEN %e", devparms.math_fft_hcenter);
|
||||
}
|
||||
|
||||
set_cue_cmd(str);
|
||||
|
||||
strcpy(str, "FFT center: ");
|
||||
|
||||
convert_to_metric_suffix(str + strlen(str), devparms.math_fft_hcenter, 0);
|
||||
|
||||
strcat(str, "Hz");
|
||||
|
||||
statusLabel->setText(str);
|
||||
|
||||
waveForm->update();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(devparms.activechannel < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(devparms.timebasedelayenable)
|
||||
{
|
||||
devparms.timebasedelayoffset = 0;
|
||||
|
||||
strcpy(str, "Delayed timebase position: ");
|
||||
|
||||
convert_to_metric_suffix(str + strlen(str), devparms.timebasedelayoffset, 2);
|
||||
|
||||
strcat(str, "s");
|
||||
|
||||
statusLabel->setText(str);
|
||||
|
||||
horPosDial_timer->start(TMC_DIAL_TIMER_DELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
devparms.timebaseoffset = 0;
|
||||
|
||||
strcpy(str, "Horizontal position: ");
|
||||
|
||||
convert_to_metric_suffix(str + strlen(str), devparms.timebaseoffset, 2);
|
||||
|
||||
strcat(str, "s");
|
||||
|
||||
statusLabel->setText(str);
|
||||
|
||||
horPosDial_timer->start(TMC_DIAL_TIMER_DELAY);
|
||||
}
|
||||
|
||||
waveForm->update();
|
||||
}
|
||||
|
||||
|
||||
void UI_Mainwindow::zoom_in()
|
||||
{
|
||||
char str[256];
|
||||
|
|
|
@ -223,7 +223,8 @@ private:
|
|||
*select_chan2_act,
|
||||
*select_chan3_act,
|
||||
*select_chan4_act,
|
||||
*toggle_fft_act;
|
||||
*toggle_fft_act,
|
||||
*center_trigger_act;
|
||||
|
||||
struct tmcdev *device;
|
||||
|
||||
|
@ -405,6 +406,7 @@ private slots:
|
|||
void chan_scale_minus();
|
||||
void shift_trace_up();
|
||||
void shift_trace_down();
|
||||
void center_trigger();
|
||||
|
||||
void set_to_factory();
|
||||
|
||||
|
|
|
@ -435,6 +435,11 @@ UI_Mainwindow::UI_Mainwindow()
|
|||
connect(shift_page_left_act, SIGNAL(triggered()), this, SLOT(shift_page_left()));
|
||||
addAction(shift_page_left_act);
|
||||
|
||||
center_trigger_act = new QAction(this);
|
||||
center_trigger_act->setShortcut(QKeySequence("c"));
|
||||
connect(center_trigger_act, SIGNAL(triggered()), this, SLOT(center_trigger()));
|
||||
addAction(center_trigger_act);
|
||||
|
||||
shift_page_right_act = new QAction(this);
|
||||
shift_page_right_act->setShortcut(QKeySequence::MoveToNextChar);
|
||||
connect(shift_page_right_act, SIGNAL(triggered()), this, SLOT(shift_page_right()));
|
||||
|
|
113
wave_view.cpp
113
wave_view.cpp
|
@ -59,10 +59,6 @@ WaveCurve::WaveCurve(QWidget *w_parent) : QWidget(w_parent)
|
|||
mouse_old_x = 0;
|
||||
mouse_old_y = 0;
|
||||
|
||||
trig_pos_arrow_moving = 0;
|
||||
|
||||
trig_pos_arrow_pos = 100;
|
||||
|
||||
use_move_events = 0;
|
||||
|
||||
old_w = 10000;
|
||||
|
@ -378,38 +374,31 @@ void WaveCurve::paintEvent(QPaintEvent *)
|
|||
}
|
||||
}
|
||||
|
||||
if(trig_pos_arrow_moving)
|
||||
if(devparms->timebasedelayenable)
|
||||
{
|
||||
drawArrow(painter, trig_pos_arrow_pos, 27, 1, QColor(255, 128, 0), 'T');
|
||||
trig_pos_arrow_pos = (curve_w / 2) - ((devparms->timebasedelayoffset / (devparms->timebasedelayscale * (double)devparms->hordivisions)) * curve_w);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(devparms->timebasedelayenable)
|
||||
trig_pos_arrow_pos = (curve_w / 2) - ((devparms->timebaseoffset / (devparms->timebasescale * (double)devparms->hordivisions)) * curve_w);
|
||||
}
|
||||
|
||||
if(trig_pos_arrow_pos < 0)
|
||||
{
|
||||
trig_pos_arrow_pos = -1;
|
||||
|
||||
drawArrow(painter, trig_pos_arrow_pos, 18, 2, QColor(255, 128, 0), 'T');
|
||||
}
|
||||
else if(trig_pos_arrow_pos > curve_w)
|
||||
{
|
||||
trig_pos_arrow_pos = (curve_w / 2) - ((devparms->timebasedelayoffset / (devparms->timebasedelayscale * (double)devparms->hordivisions)) * curve_w);
|
||||
trig_pos_arrow_pos = curve_w + 1;
|
||||
|
||||
drawArrow(painter, trig_pos_arrow_pos, 18, 0, QColor(255, 128, 0), 'T');
|
||||
}
|
||||
else
|
||||
{
|
||||
trig_pos_arrow_pos = (curve_w / 2) - ((devparms->timebaseoffset / (devparms->timebasescale * (double)devparms->hordivisions)) * curve_w);
|
||||
drawArrow(painter, trig_pos_arrow_pos, 27, 1, QColor(255, 128, 0), 'T');
|
||||
}
|
||||
|
||||
if(trig_pos_arrow_pos < 0)
|
||||
{
|
||||
trig_pos_arrow_pos = -1;
|
||||
|
||||
drawArrow(painter, trig_pos_arrow_pos, 18, 2, QColor(255, 128, 0), 'T');
|
||||
}
|
||||
else if(trig_pos_arrow_pos > curve_w)
|
||||
{
|
||||
trig_pos_arrow_pos = curve_w + 1;
|
||||
|
||||
drawArrow(painter, trig_pos_arrow_pos, 18, 0, QColor(255, 128, 0), 'T');
|
||||
}
|
||||
else
|
||||
{
|
||||
drawArrow(painter, trig_pos_arrow_pos, 27, 1, QColor(255, 128, 0), 'T');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -860,49 +849,28 @@ void WaveCurve::setBorderSize(int newsize)
|
|||
}
|
||||
|
||||
|
||||
void WaveCurve::mousePressEvent(QMouseEvent *press_event)
|
||||
void WaveCurve::mousePressEvent(QMouseEvent *) //press_event)
|
||||
{
|
||||
int m_x,
|
||||
m_y;
|
||||
// int m_x,
|
||||
// m_y;
|
||||
|
||||
setFocus(Qt::MouseFocusReason);
|
||||
|
||||
w = width() - (2 * bordersize);
|
||||
h = height() - (2 * bordersize);
|
||||
|
||||
m_x = press_event->x() - bordersize;
|
||||
m_y = press_event->y() - bordersize;
|
||||
// m_x = press_event->x() - bordersize;
|
||||
// m_y = press_event->y() - bordersize;
|
||||
|
||||
if(devparms == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!devparms->connected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(press_event->button() == Qt::LeftButton)
|
||||
{
|
||||
if(((m_x > (trig_pos_arrow_pos - 8)) && (m_x < (trig_pos_arrow_pos + 8)) && (m_y > 5) && (m_y < 24)) ||
|
||||
((trig_pos_arrow_pos > w) && (m_x > (trig_pos_arrow_pos - 24)) && (m_x <= trig_pos_arrow_pos) && (m_y > 9) && (m_y < 26)) ||
|
||||
((trig_pos_arrow_pos < 0) && (m_x < 24) && (m_x >= 0) && (m_y > 9) && (m_y < 26)))
|
||||
{
|
||||
trig_pos_arrow_moving = 1;
|
||||
use_move_events = 1;
|
||||
setMouseTracking(true);
|
||||
mouse_old_x = m_x;
|
||||
mouse_old_y = m_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WaveCurve::mouseReleaseEvent(QMouseEvent *release_event)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
w = width() - (2 * bordersize);
|
||||
h = height() - (2 * bordersize);
|
||||
|
||||
|
@ -914,30 +882,6 @@ void WaveCurve::mouseReleaseEvent(QMouseEvent *release_event)
|
|||
return;
|
||||
}
|
||||
|
||||
if(trig_pos_arrow_moving)
|
||||
{
|
||||
trig_pos_arrow_pos = mouse_x;
|
||||
|
||||
if(trig_pos_arrow_pos < 0)
|
||||
{
|
||||
trig_pos_arrow_pos = 0;
|
||||
}
|
||||
|
||||
if(trig_pos_arrow_pos > w)
|
||||
{
|
||||
trig_pos_arrow_pos = w;
|
||||
}
|
||||
|
||||
// printf("w is %i trig_pos_arrow_pos is %i\n", w, trig_pos_arrow_pos);
|
||||
|
||||
devparms->timebaseoffset = ((devparms->timebasescale * (double)devparms->hordivisions) / w) * ((w / 2) - trig_pos_arrow_pos);
|
||||
|
||||
tmp = devparms->timebaseoffset / (devparms->timebasescale / 50);
|
||||
|
||||
devparms->timebaseoffset = (devparms->timebasescale / 50) * tmp;
|
||||
}
|
||||
|
||||
trig_pos_arrow_moving = 0;
|
||||
use_move_events = 0;
|
||||
setMouseTracking(false);
|
||||
|
||||
|
@ -965,21 +909,6 @@ void WaveCurve::mouseMoveEvent(QMouseEvent *move_event)
|
|||
return;
|
||||
}
|
||||
|
||||
if(trig_pos_arrow_moving)
|
||||
{
|
||||
trig_pos_arrow_pos = mouse_x;
|
||||
|
||||
if(trig_pos_arrow_pos < 0)
|
||||
{
|
||||
trig_pos_arrow_pos = 0;
|
||||
}
|
||||
|
||||
if(trig_pos_arrow_pos > w)
|
||||
{
|
||||
trig_pos_arrow_pos = w;
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,6 @@ private:
|
|||
chan_arrow_pos[MAX_CHNS],
|
||||
trig_level_arrow_pos,
|
||||
trig_pos_arrow_pos,
|
||||
trig_pos_arrow_moving,
|
||||
use_move_events,
|
||||
mouse_x,
|
||||
mouse_y,
|
||||
|
|
Ładowanie…
Reference in New Issue