cb = create_checkbox(GlobalSettings::Key_View_TriggerIsZeroTime,
SLOT(on_view_triggerIsZero_changed(int)));
- trace_view_layout->addRow(tr("Show time zero at the trigger"), cb);
+ trace_view_layout->addRow(tr("Show time zero at the &trigger"), cb);
cb = create_checkbox(GlobalSettings::Key_View_StickyScrolling,
SLOT(on_view_stickyScrolling_changed(int)));
trace_view_layout->addRow(tr("Always keep &newest samples at the right edge during capture"), cb);
+ cb = create_checkbox(GlobalSettings::Key_View_AllowVerticalDragging,
+ SLOT(on_view_allowVerticalDragging_changed(int)));
+ trace_view_layout->addRow(tr("Allow &vertical dragging in the view area"), cb);
+
cb = create_checkbox(GlobalSettings::Key_View_ShowSamplingPoints,
SLOT(on_view_showSamplingPoints_changed(int)));
trace_view_layout->addRow(tr("Show data &sampling points"), cb);
cb = create_checkbox(GlobalSettings::Key_View_FillSignalHighAreas,
SLOT(on_view_fillSignalHighAreas_changed(int)));
- trace_view_layout->addRow(tr("Fill high areas of logic signals"), cb);
+ trace_view_layout->addRow(tr("Fill &high areas of logic signals"), cb);
ColorButton* high_fill_cb = new ColorButton(parent);
high_fill_cb->set_color(QColor::fromRgba(
settings.setValue(GlobalSettings::Key_View_StickyScrolling, state ? true : false);
}
+void Settings::on_view_allowVerticalDragging_changed(int state)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_AllowVerticalDragging, state ? true : false);
+}
+
void Settings::on_view_showSamplingPoints_changed(int state)
{
GlobalSettings settings;
void on_view_triggerIsZero_changed(int state);
void on_view_coloredBG_changed(int state);
void on_view_stickyScrolling_changed(int state);
+ void on_view_allowVerticalDragging_changed(int state);
void on_view_showSamplingPoints_changed(int state);
void on_view_fillSignalHighAreas_changed(int state);
void on_view_fillSignalHighAreaColor_changed(QColor color);
const QString GlobalSettings::Key_View_TriggerIsZeroTime = "View_TriggerIsZeroTime";
const QString GlobalSettings::Key_View_ColoredBG = "View_ColoredBG";
const QString GlobalSettings::Key_View_StickyScrolling = "View_StickyScrolling";
+const QString GlobalSettings::Key_View_AllowVerticalDragging = "View_AllowVerticalDragging";
const QString GlobalSettings::Key_View_ShowSamplingPoints = "View_ShowSamplingPoints";
const QString GlobalSettings::Key_View_FillSignalHighAreas = "View_FillSignalHighAreas";
const QString GlobalSettings::Key_View_FillSignalHighAreaColor = "View_FillSignalHighAreaColor";
if (!contains(Key_View_ZoomToFitAfterAcq))
setValue(Key_View_ZoomToFitAfterAcq, true);
+ // Allow vertical dragging by default
+ if (!contains(Key_View_AllowVerticalDragging))
+ setValue(Key_View_AllowVerticalDragging, true);
+
// Enable colored trace backgrounds by default
if (!contains(Key_View_ColoredBG))
setValue(Key_View_ColoredBG, true);
static const QString Key_View_TriggerIsZeroTime;
static const QString Key_View_ColoredBG;
static const QString Key_View_StickyScrolling;
+ static const QString Key_View_AllowVerticalDragging;
static const QString Key_View_ShowSamplingPoints;
static const QString Key_View_FillSignalHighAreas;
static const QString Key_View_FillSignalHighAreaColor;
{
setAutoFillBackground(true);
setBackgroundRole(QPalette::Base);
+
+ // Set up settings and event handlers
+ GlobalSettings settings;
+ allow_vertical_dragging_ = settings.value(GlobalSettings::Key_View_AllowVerticalDragging).toBool();
+
+ GlobalSettings::add_change_handler(this);
+}
+
+Viewport::~Viewport()
+{
+ GlobalSettings::remove_change_handler(this);
}
shared_ptr<ViewItem> Viewport::get_mouse_over_item(const QPoint &pt)
void Viewport::drag()
{
drag_offset_ = view_.offset();
- drag_v_offset_ = view_.owner_visual_v_offset();
+
+ if (allow_vertical_dragging_)
+ drag_v_offset_ = view_.owner_visual_v_offset();
}
void Viewport::drag_by(const QPoint &delta)
view_.set_scale_offset(view_.scale(),
(*drag_offset_ - delta.x() * view_.scale()));
- view_.set_v_offset(-drag_v_offset_ - delta.y());
+ if (allow_vertical_dragging_)
+ view_.set_v_offset(-drag_v_offset_ - delta.y());
}
void Viewport::drag_release()
}
}
+void Viewport::on_setting_changed(const QString &key, const QVariant &value)
+{
+ if (key == GlobalSettings::Key_View_AllowVerticalDragging) {
+ GlobalSettings settings;
+ allow_vertical_dragging_ = settings.value(GlobalSettings::Key_View_AllowVerticalDragging).toBool();
+ }
+}
+
} // namespace trace
} // namespace views
} // namespace pv
#include <QTimer>
#include <QTouchEvent>
+#include <pv/globalsettings.hpp>
+
#include "pv/util.hpp"
#include "viewwidget.hpp"
class View;
-class Viewport : public ViewWidget
+class Viewport : public ViewWidget, public GlobalSettingsInterface
{
Q_OBJECT
public:
explicit Viewport(View &parent);
+ ~Viewport();
/**
* Gets the first view item which has a hit-box that contains @c pt .
*/
bool touch_event(QTouchEvent *event);
-private:
void paintEvent(QPaintEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
+
void wheelEvent(QWheelEvent *event);
+ void on_setting_changed(const QString &key, const QVariant &value);
+
private:
boost::optional<pv::util::Timestamp> drag_offset_;
int drag_v_offset_;
+ bool allow_vertical_dragging_;
double pinch_offset0_;
double pinch_offset1_;