diff --git a/interface.cpp b/interface.cpp index 0a02f28..545e75c 100644 --- a/interface.cpp +++ b/interface.cpp @@ -142,11 +142,11 @@ void UI_Mainwindow::navDialChanged(int npos) devparms.timebasedelayoffset += (val * mpr); - lefttime = (7 * devparms.timebasescale) - devparms.timebaseoffset; + lefttime = ((devparms.hordivisions / 2) * devparms.timebasescale) - devparms.timebaseoffset; - righttime = (7 * devparms.timebasescale) + devparms.timebaseoffset; + righttime = ((devparms.hordivisions / 2) * devparms.timebasescale) + devparms.timebaseoffset; - delayrange = 7 * devparms.timebasedelayscale; + delayrange = (devparms.hordivisions / 2) * devparms.timebasedelayscale; if(devparms.timebasedelayoffset < -(lefttime - delayrange)) { @@ -657,7 +657,7 @@ void UI_Mainwindow::horPosDialChanged(int new_pos) { if(dir) { - if(devparms.timebasedelayoffset >= ((7 * devparms.timebasescale) + devparms.timebaseoffset - (7 * devparms.timebasedelayscale))) + if(devparms.timebasedelayoffset >= (((devparms.hordivisions / 2) * devparms.timebasescale) + devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) { old_pos = new_pos; @@ -668,7 +668,7 @@ void UI_Mainwindow::horPosDialChanged(int new_pos) } else { - if(devparms.timebasedelayoffset <= -((7 * devparms.timebasescale) - devparms.timebaseoffset - (7 * devparms.timebasedelayscale))) + if(devparms.timebasedelayoffset <= -(((devparms.hordivisions / 2) * devparms.timebasescale) - devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) { old_pos = new_pos; @@ -1595,7 +1595,12 @@ void UI_Mainwindow::show_howto_operate() "To set the horizontal position to zero, right-click on the horizontal position dial.\n" "To set the vertical offset to zero, right-click on the vertical position dial.\n\n" "In addition of using the dials to change the scale and offset of the traces and the trigger position," - "you can use the mouse to drag the colored arrows aside of the plot.\n" + "you can use the mouse to drag the colored arrows aside of the plot.\n\n" + "Keyboard shortcuts:\n" + "PageUp: move trace 12 (or 14) divisions to the right.\n" + "PageDn: move trace 12 (or 14) divisions to the left.\n" + "Arrow left: move trace 1 division to the right.\n" + "Arrow right: move trace 1 division to the left.\n" ); msgBox.exec(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 075916f..a6e0774 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1839,6 +1839,231 @@ void UI_Mainwindow::get_device_model(const char *str) } +void UI_Mainwindow::former_page() +{ + char str[256]; + + if((device == NULL) || (!devparms.connected) || (devparms.activechannel < 0)) + { + return; + } + + if(devparms.timebasedelayenable) + { + if(devparms.timebasedelayoffset <= -(((devparms.hordivisions / 2) * devparms.timebasescale) - devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) + { + return; + } + + devparms.timebasedelayoffset -= devparms.timebasedelayscale * devparms.hordivisions; + + if(devparms.timebasedelayoffset <= -(((devparms.hordivisions / 2) * devparms.timebasescale) - devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) + { + devparms.timebasedelayoffset = -(((devparms.hordivisions / 2) * devparms.timebasescale) - devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale)); + } + + strcpy(str, "Delayed timebase position: "); + + convert_to_metric_suffix(str + strlen(str), devparms.timebasedelayoffset, 2); + + strcat(str, "s"); + + statusLabel->setText(str); + + sprintf(str, ":TIM:DEL:OFFS %e", devparms.timebasedelayoffset); + + tmcdev_write(device, str); + } + else + { + devparms.timebaseoffset -= devparms.timebasescale * devparms.hordivisions; + + strcpy(str, "Horizontal position: "); + + convert_to_metric_suffix(str + strlen(str), devparms.timebaseoffset, 2); + + strcat(str, "s"); + + statusLabel->setText(str); + + sprintf(str, ":TIM:OFFS %e", devparms.timebaseoffset); + + tmcdev_write(device, str); + } + + waveForm->update(); +} + + +void UI_Mainwindow::next_page() +{ + char str[256]; + + if((device == NULL) || (!devparms.connected) || (devparms.activechannel < 0)) + { + return; + } + + if(devparms.timebasedelayenable) + { + if(devparms.timebasedelayoffset >= (((devparms.hordivisions / 2) * devparms.timebasescale) + devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) + { + return; + } + + devparms.timebasedelayoffset += devparms.timebasedelayscale * devparms.hordivisions; + + if(devparms.timebasedelayoffset >= (((devparms.hordivisions / 2) * devparms.timebasescale) + devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) + { + devparms.timebasedelayoffset = (((devparms.hordivisions / 2) * devparms.timebasescale) + devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale)); + } + + strcpy(str, "Delayed timebase position: "); + + convert_to_metric_suffix(str + strlen(str), devparms.timebasedelayoffset, 2); + + strcat(str, "s"); + + statusLabel->setText(str); + + sprintf(str, ":TIM:DEL:OFFS %e", devparms.timebasedelayoffset); + + tmcdev_write(device, str); + } + else + { + devparms.timebaseoffset += devparms.timebasescale * devparms.hordivisions; + + strcpy(str, "Horizontal position: "); + + convert_to_metric_suffix(str + strlen(str), devparms.timebaseoffset, 2); + + strcat(str, "s"); + + statusLabel->setText(str); + + sprintf(str, ":TIM:OFFS %e", devparms.timebaseoffset); + + tmcdev_write(device, str); + } + + waveForm->update(); +} + + +void UI_Mainwindow::shift_page_left() +{ + char str[256]; + + if((device == NULL) || (!devparms.connected) || (devparms.activechannel < 0)) + { + return; + } + + if(devparms.timebasedelayenable) + { + if(devparms.timebasedelayoffset <= -(((devparms.hordivisions / 2) * devparms.timebasescale) - devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) + { + return; + } + + devparms.timebasedelayoffset -= devparms.timebasedelayscale; + + if(devparms.timebasedelayoffset <= -(((devparms.hordivisions / 2) * devparms.timebasescale) - devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) + { + devparms.timebasedelayoffset = -(((devparms.hordivisions / 2) * devparms.timebasescale) - devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale)); + } + + strcpy(str, "Delayed timebase position: "); + + convert_to_metric_suffix(str + strlen(str), devparms.timebasedelayoffset, 2); + + strcat(str, "s"); + + statusLabel->setText(str); + + sprintf(str, ":TIM:DEL:OFFS %e", devparms.timebasedelayoffset); + + tmcdev_write(device, str); + } + else + { + devparms.timebaseoffset -= devparms.timebasescale; + + strcpy(str, "Horizontal position: "); + + convert_to_metric_suffix(str + strlen(str), devparms.timebaseoffset, 2); + + strcat(str, "s"); + + statusLabel->setText(str); + + sprintf(str, ":TIM:OFFS %e", devparms.timebaseoffset); + + tmcdev_write(device, str); + } + + waveForm->update(); +} + + +void UI_Mainwindow::shift_page_right() +{ + char str[256]; + + if((device == NULL) || (!devparms.connected) || (devparms.activechannel < 0)) + { + return; + } + + if(devparms.timebasedelayenable) + { + if(devparms.timebasedelayoffset >= (((devparms.hordivisions / 2) * devparms.timebasescale) + devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) + { + return; + } + + devparms.timebasedelayoffset += devparms.timebasedelayscale; + + if(devparms.timebasedelayoffset >= (((devparms.hordivisions / 2) * devparms.timebasescale) + devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale))) + { + devparms.timebasedelayoffset = (((devparms.hordivisions / 2) * devparms.timebasescale) + devparms.timebaseoffset - ((devparms.hordivisions / 2) * devparms.timebasedelayscale)); + } + + strcpy(str, "Delayed timebase position: "); + + convert_to_metric_suffix(str + strlen(str), devparms.timebasedelayoffset, 2); + + strcat(str, "s"); + + statusLabel->setText(str); + + sprintf(str, ":TIM:DEL:OFFS %e", devparms.timebasedelayoffset); + + tmcdev_write(device, str); + } + else + { + devparms.timebaseoffset += devparms.timebasescale; + + strcpy(str, "Horizontal position: "); + + convert_to_metric_suffix(str + strlen(str), devparms.timebaseoffset, 2); + + strcat(str, "s"); + + statusLabel->setText(str); + + sprintf(str, ":TIM:OFFS %e", devparms.timebaseoffset); + + tmcdev_write(device, str); + } + + waveForm->update(); +} + + + diff --git a/mainwindow.h b/mainwindow.h index 39decfd..4550a16 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -188,6 +188,11 @@ private: QPixmap screenXpm; + QAction *former_page_act, + *shift_page_left_act, + *shift_page_right_act, + *next_page_act; + struct tmcdev *device; TLed *trigModeAutoLed, @@ -346,6 +351,11 @@ private slots: void set_memdepth_28m(); void set_memdepth_56m(); + void former_page(); + void shift_page_left(); + void shift_page_right(); + void next_page(); + protected: void closeEvent(QCloseEvent *); diff --git a/mainwindow_constr.cpp b/mainwindow_constr.cpp index db28b0a..8f68a4b 100644 --- a/mainwindow_constr.cpp +++ b/mainwindow_constr.cpp @@ -329,6 +329,26 @@ UI_Mainwindow::UI_Mainwindow() dockPanelRight->setMinimumHeight(400); addDockWidget(Qt::RightDockWidgetArea, dockPanelRight); + former_page_act = new QAction(this); + former_page_act->setShortcut(QKeySequence::MoveToPreviousPage); + connect(former_page_act, SIGNAL(triggered()), this, SLOT(former_page())); + addAction(former_page_act); + + shift_page_left_act = new QAction(this); + shift_page_left_act->setShortcut(QKeySequence::MoveToPreviousChar); + connect(shift_page_left_act, SIGNAL(triggered()), this, SLOT(shift_page_left())); + addAction(shift_page_left_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())); + addAction(shift_page_right_act); + + next_page_act = new QAction(this); + next_page_act->setShortcut(QKeySequence::MoveToNextPage); + connect(next_page_act, SIGNAL(triggered()), this, SLOT(next_page())); + addAction(next_page_act); + DPRwidget->setEnabled(false); recent_dir[0] = 0; diff --git a/notes.txt b/notes.txt index 42a66e6..b0c42a2 100644 --- a/notes.txt +++ b/notes.txt @@ -1,6 +1,6 @@ -DSRemote 0.1 ------------- +DSRemote 0.11 +------------- When opening a connection, the program reads the settings from the device. It does not lock the device, so it's still possible to change settings on the device. @@ -43,6 +43,14 @@ click on it with the right mouse button. In addition of using the dials to change the scale and offset of the traces and the trigger position, you can use the mouse to drag the yellow and orange arrows aside of the plot. +Keyboard shortcuts: +PageUp: move trace 12 (or 14) divisions to the right. +PageDn: move trace 12 (or 14) divisions to the left. +Arrow left: move trace 1 division to the right. +Arrow right: move trace 1 division to the left. + + + What's implemented so far: --------------------------