]>
Commit | Line | Data |
---|---|---|
adb4b10c | 1 | /* |
b3f22de0 | 2 | * This file is part of the PulseView project. |
adb4b10c JH |
3 | * |
4 | * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
269528f5 | 21 | #ifdef ENABLE_DECODE |
4e5a4405 | 22 | #include <libsigrokdecode/libsigrokdecode.h> |
269528f5 | 23 | #endif |
4e5a4405 | 24 | |
adb4b10c | 25 | #include <assert.h> |
f25770e2 | 26 | #include <limits.h> |
adb4b10c JH |
27 | #include <math.h> |
28 | ||
adb4b10c | 29 | #include <QEvent> |
cbd80f64 | 30 | #include <QMouseEvent> |
adb4b10c JH |
31 | #include <QScrollBar> |
32 | ||
84a0d458 | 33 | #include "cursorheader.h" |
b9329558 | 34 | #include "decodetrace.h" |
1d8dca91 | 35 | #include "header.h" |
ccdd3ef5 | 36 | #include "ruler.h" |
2e575351 | 37 | #include "signal.h" |
cdf7bea7 JH |
38 | #include "view.h" |
39 | #include "viewport.h" | |
adb4b10c | 40 | |
1b1ec774 JH |
41 | #include "pv/sigsession.h" |
42 | #include "pv/data/logic.h" | |
43 | #include "pv/data/logicsnapshot.h" | |
adb4b10c | 44 | |
1bc6525b | 45 | using pv::data::SignalData; |
a2321722 | 46 | using std::back_inserter; |
819f4c25 JH |
47 | using std::deque; |
48 | using std::list; | |
49 | using std::max; | |
1bc6525b | 50 | using std::make_pair; |
819f4c25 | 51 | using std::min; |
1bc6525b | 52 | using std::pair; |
819f4c25 | 53 | using std::set; |
f9abf97e | 54 | using std::shared_ptr; |
819f4c25 | 55 | using std::vector; |
f9abf97e | 56 | using std::weak_ptr; |
adb4b10c | 57 | |
cdf7bea7 JH |
58 | namespace pv { |
59 | namespace view { | |
adb4b10c | 60 | |
cdf7bea7 JH |
61 | const double View::MaxScale = 1e9; |
62 | const double View::MinScale = 1e-15; | |
adb4b10c | 63 | |
f25770e2 JH |
64 | const int View::MaxScrollValue = INT_MAX / 2; |
65 | ||
8d44d030 JH |
66 | const int View::SignalHeight = 30; |
67 | const int View::SignalMargin = 10; | |
49153683 | 68 | const int View::SignalSnapGridSize = 10; |
1d8dca91 | 69 | |
f76af637 JH |
70 | const QColor View::CursorAreaColour(220, 231, 243); |
71 | ||
2e04f9bd JH |
72 | const QSizeF View::LabelPadding(4, 0); |
73 | ||
cdf7bea7 | 74 | View::View(SigSession &session, QWidget *parent) : |
adb4b10c JH |
75 | QAbstractScrollArea(parent), |
76 | _session(session), | |
cdf7bea7 | 77 | _viewport(new Viewport(*this)), |
ccdd3ef5 | 78 | _ruler(new Ruler(*this)), |
84a0d458 | 79 | _cursorheader(new CursorHeader(*this)), |
1d8dca91 | 80 | _header(new Header(*this)), |
adb4b10c JH |
81 | _scale(1e-6), |
82 | _offset(0), | |
cbd80f64 | 83 | _v_offset(0), |
528bd8a1 | 84 | _updating_scroll(false), |
f76af637 | 85 | _show_cursors(false), |
b42d25c4 | 86 | _cursors(*this), |
cbd80f64 | 87 | _hover_point(-1, -1) |
adb4b10c | 88 | { |
b16907d3 JH |
89 | connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), |
90 | this, SLOT(h_scroll_value_changed(int))); | |
adb4b10c JH |
91 | connect(verticalScrollBar(), SIGNAL(valueChanged(int)), |
92 | this, SLOT(v_scroll_value_changed(int))); | |
69dd2b03 JH |
93 | |
94 | connect(&_session, SIGNAL(signals_changed()), | |
95 | this, SLOT(signals_changed())); | |
50f97924 PZ |
96 | connect(&_session, SIGNAL(capture_state_changed(int)), |
97 | this, SLOT(data_updated())); | |
1f374035 JH |
98 | connect(&_session, SIGNAL(data_received()), |
99 | this, SLOT(data_updated())); | |
100 | connect(&_session, SIGNAL(frame_ended()), | |
adb4b10c | 101 | this, SLOT(data_updated())); |
1d8dca91 | 102 | |
58864c5c | 103 | connect(_cursors.first().get(), SIGNAL(time_changed()), |
ca4ec3ea | 104 | this, SLOT(marker_time_changed())); |
58864c5c | 105 | connect(_cursors.second().get(), SIGNAL(time_changed()), |
ca4ec3ea JH |
106 | this, SLOT(marker_time_changed())); |
107 | ||
d7c0ca4a JH |
108 | connect(_header, SIGNAL(geometry_updated()), |
109 | this, SLOT(on_geometry_updated())); | |
54401bbb | 110 | connect(_header, SIGNAL(signals_moved()), |
07204819 | 111 | this, SLOT(on_signals_moved())); |
54401bbb | 112 | |
17348f85 | 113 | connect(_header, SIGNAL(selection_changed()), |
84a0d458 JS |
114 | _cursorheader, SLOT(clear_selection())); |
115 | connect(_cursorheader, SIGNAL(selection_changed()), | |
17348f85 JH |
116 | _header, SLOT(clear_selection())); |
117 | ||
8b454527 JH |
118 | connect(_header, SIGNAL(selection_changed()), |
119 | this, SIGNAL(selection_changed())); | |
84a0d458 | 120 | connect(_cursorheader, SIGNAL(selection_changed()), |
8b454527 JH |
121 | this, SIGNAL(selection_changed())); |
122 | ||
33c62f44 JH |
123 | connect(this, SIGNAL(hover_point_changed()), |
124 | this, SLOT(on_hover_point_changed())); | |
125 | ||
adb4b10c | 126 | setViewport(_viewport); |
cbd80f64 JH |
127 | |
128 | _viewport->installEventFilter(this); | |
129 | _ruler->installEventFilter(this); | |
84a0d458 | 130 | _cursorheader->installEventFilter(this); |
cbd80f64 | 131 | _header->installEventFilter(this); |
d873f4d6 | 132 | |
9f46d905 JH |
133 | // Trigger the initial event manually. The default device has signals |
134 | // which were created before this object came into being | |
d873f4d6 | 135 | signals_changed(); |
84a0d458 | 136 | |
512bfc56 | 137 | // make sure the transparent widgets are on the top |
84a0d458 | 138 | _cursorheader->raise(); |
512bfc56 | 139 | _header->raise(); |
adb4b10c JH |
140 | } |
141 | ||
1d19ef83 JH |
142 | SigSession& View::session() |
143 | { | |
144 | return _session; | |
145 | } | |
146 | ||
38eeddea JH |
147 | const SigSession& View::session() const |
148 | { | |
149 | return _session; | |
150 | } | |
151 | ||
eae6e30a JH |
152 | View* View::view() |
153 | { | |
154 | return this; | |
155 | } | |
156 | ||
157 | const View* View::view() const | |
158 | { | |
159 | return this; | |
160 | } | |
161 | ||
2ae445ba SA |
162 | Viewport* View::viewport() |
163 | { | |
164 | return _viewport; | |
165 | } | |
166 | ||
167 | const Viewport* View::viewport() const | |
168 | { | |
169 | return _viewport; | |
170 | } | |
171 | ||
cdf7bea7 | 172 | double View::scale() const |
adb4b10c JH |
173 | { |
174 | return _scale; | |
175 | } | |
176 | ||
cdf7bea7 | 177 | double View::offset() const |
adb4b10c JH |
178 | { |
179 | return _offset; | |
180 | } | |
181 | ||
eae6e30a | 182 | int View::owner_v_offset() const |
adb4b10c | 183 | { |
23935421 | 184 | return -_v_offset; |
adb4b10c JH |
185 | } |
186 | ||
cdf7bea7 | 187 | void View::zoom(double steps) |
adb4b10c | 188 | { |
f3f98f8f | 189 | zoom(steps, _viewport->width() / 2); |
adb4b10c JH |
190 | } |
191 | ||
17c0f398 JH |
192 | void View::zoom(double steps, int offset) |
193 | { | |
8b2e2a9a | 194 | set_zoom(_scale * pow(3.0/2.0, -steps), offset); |
17c0f398 JH |
195 | } |
196 | ||
ca46b534 JH |
197 | void View::zoom_fit() |
198 | { | |
1bc6525b JH |
199 | const pair<double, double> extents = get_time_extents(); |
200 | const double delta = extents.second - extents.first; | |
201 | if (delta < 1e-12) | |
ca46b534 JH |
202 | return; |
203 | ||
204 | assert(_viewport); | |
205 | const int w = _viewport->width(); | |
206 | if (w <= 0) | |
207 | return; | |
208 | ||
78311127 JH |
209 | const double scale = max(min(delta / w, MaxScale), MinScale); |
210 | set_scale_offset(scale, extents.first); | |
ca46b534 JH |
211 | } |
212 | ||
d1e7d82c JH |
213 | void View::zoom_one_to_one() |
214 | { | |
215 | using pv::data::SignalData; | |
216 | ||
217 | const vector< shared_ptr<Signal> > sigs( | |
218 | session().get_signals()); | |
219 | ||
220 | // Make a set of all the visible data objects | |
0fc664a9 | 221 | set< shared_ptr<SignalData> > visible_data = get_visible_data(); |
d1e7d82c JH |
222 | if (visible_data.empty()) |
223 | return; | |
224 | ||
225 | double samplerate = 0.0; | |
d9aecf1f | 226 | for (const shared_ptr<SignalData> d : visible_data) { |
d1e7d82c JH |
227 | assert(d); |
228 | samplerate = max(samplerate, d->samplerate()); | |
229 | } | |
230 | ||
231 | if (samplerate == 0.0) | |
232 | return; | |
233 | ||
234 | assert(_viewport); | |
235 | const int w = _viewport->width(); | |
236 | if (w <= 0) | |
237 | return; | |
238 | ||
239 | set_zoom(1.0 / samplerate, w / 2); | |
240 | } | |
241 | ||
cdf7bea7 | 242 | void View::set_scale_offset(double scale, double offset) |
adb4b10c JH |
243 | { |
244 | _scale = scale; | |
245 | _offset = offset; | |
ccdd3ef5 | 246 | |
adb4b10c | 247 | update_scroll(); |
ccdd3ef5 | 248 | _ruler->update(); |
84a0d458 | 249 | _cursorheader->update(); |
adb4b10c | 250 | _viewport->update(); |
e0fc5810 | 251 | scale_offset_changed(); |
adb4b10c JH |
252 | } |
253 | ||
eae6e30a | 254 | vector< shared_ptr<RowItem> > View::child_items() const |
38eeddea | 255 | { |
eae6e30a | 256 | vector< shared_ptr<RowItem> > row_items; |
a2321722 | 257 | |
38eeddea JH |
258 | const vector< shared_ptr<Signal> > sigs( |
259 | session().get_signals()); | |
eae6e30a | 260 | copy(sigs.begin(), sigs.end(), back_inserter(row_items)); |
a2321722 | 261 | |
269528f5 | 262 | #ifdef ENABLE_DECODE |
b9329558 | 263 | const vector< shared_ptr<DecodeTrace> > decode_sigs( |
38eeddea | 264 | session().get_decode_signals()); |
eae6e30a | 265 | copy(decode_sigs.begin(), decode_sigs.end(), back_inserter(row_items)); |
269528f5 | 266 | #endif |
38eeddea | 267 | |
eae6e30a JH |
268 | stable_sort(row_items.begin(), row_items.end(), |
269 | [](const shared_ptr<RowItem> &a, const shared_ptr<RowItem> &b) { | |
1ef49ddd | 270 | return a->v_offset() < b->v_offset(); }); |
2c25d912 | 271 | |
eae6e30a | 272 | return row_items; |
38eeddea JH |
273 | } |
274 | ||
94936133 JH |
275 | list<weak_ptr<SelectableItem> > View::selected_items() const |
276 | { | |
277 | list<weak_ptr<SelectableItem> > items; | |
278 | ||
279 | // List the selected signals | |
eae6e30a JH |
280 | const vector< shared_ptr<RowItem> > row_items(child_items()); |
281 | for (shared_ptr<RowItem> r : row_items) { | |
282 | assert(r); | |
283 | if (r->selected()) | |
284 | items.push_back(r); | |
94936133 JH |
285 | } |
286 | ||
287 | // List the selected cursors | |
288 | if (_cursors.first()->selected()) | |
289 | items.push_back(_cursors.first()); | |
290 | if (_cursors.second()->selected()) | |
291 | items.push_back(_cursors.second()); | |
292 | ||
293 | return items; | |
294 | } | |
295 | ||
1bc6525b JH |
296 | set< shared_ptr<SignalData> > View::get_visible_data() const |
297 | { | |
298 | const vector< shared_ptr<Signal> > sigs( | |
299 | session().get_signals()); | |
300 | ||
301 | // Make a set of all the visible data objects | |
302 | set< shared_ptr<SignalData> > visible_data; | |
d9aecf1f | 303 | for (const shared_ptr<Signal> sig : sigs) |
1bc6525b JH |
304 | if (sig->enabled()) |
305 | visible_data.insert(sig->data()); | |
306 | ||
307 | return visible_data; | |
308 | } | |
309 | ||
310 | pair<double, double> View::get_time_extents() const | |
311 | { | |
312 | const set< shared_ptr<SignalData> > visible_data = get_visible_data(); | |
313 | if (visible_data.empty()) | |
314 | return make_pair(0.0, 0.0); | |
315 | ||
316 | double left_time = DBL_MAX, right_time = DBL_MIN; | |
d9aecf1f | 317 | for (const shared_ptr<SignalData> d : visible_data) |
1bc6525b JH |
318 | { |
319 | const double start_time = d->get_start_time(); | |
a472a884 JH |
320 | double samplerate = d->samplerate(); |
321 | samplerate = (samplerate <= 0.0) ? 1.0 : samplerate; | |
322 | ||
1bc6525b JH |
323 | left_time = min(left_time, start_time); |
324 | right_time = max(right_time, start_time + | |
a472a884 | 325 | d->get_max_sample_count() / samplerate); |
1bc6525b JH |
326 | } |
327 | ||
328 | assert(left_time < right_time); | |
329 | return make_pair(left_time, right_time); | |
330 | } | |
331 | ||
f76af637 JH |
332 | bool View::cursors_shown() const |
333 | { | |
334 | return _show_cursors; | |
335 | } | |
336 | ||
337 | void View::show_cursors(bool show) | |
338 | { | |
339 | _show_cursors = show; | |
84a0d458 | 340 | _cursorheader->update(); |
f76af637 JH |
341 | _viewport->update(); |
342 | } | |
343 | ||
b4d91e56 JH |
344 | void View::centre_cursors() |
345 | { | |
346 | const double time_width = _scale * _viewport->width(); | |
58864c5c JH |
347 | _cursors.first()->set_time(_offset + time_width * 0.4); |
348 | _cursors.second()->set_time(_offset + time_width * 0.6); | |
84a0d458 | 349 | _cursorheader->update(); |
b4d91e56 JH |
350 | _viewport->update(); |
351 | } | |
352 | ||
b42d25c4 | 353 | CursorPair& View::cursors() |
f76af637 JH |
354 | { |
355 | return _cursors; | |
356 | } | |
357 | ||
58864c5c JH |
358 | const CursorPair& View::cursors() const |
359 | { | |
360 | return _cursors; | |
361 | } | |
362 | ||
cbd80f64 JH |
363 | const QPoint& View::hover_point() const |
364 | { | |
365 | return _hover_point; | |
366 | } | |
367 | ||
4b192962 JH |
368 | void View::normalize_layout() |
369 | { | |
eae6e30a | 370 | const vector< shared_ptr<RowItem> > row_items(child_items()); |
4b192962 JH |
371 | |
372 | int v_min = INT_MAX; | |
eae6e30a JH |
373 | for (const shared_ptr<RowItem> r : row_items) |
374 | v_min = min(r->v_offset(), v_min); | |
4b192962 JH |
375 | |
376 | const int delta = -min(v_min, 0); | |
eae6e30a JH |
377 | for (shared_ptr<RowItem> r : row_items) |
378 | r->set_v_offset(r->v_offset() + delta); | |
4b192962 JH |
379 | |
380 | verticalScrollBar()->setSliderPosition(_v_offset + delta); | |
381 | v_scroll_value_changed(verticalScrollBar()->sliderPosition()); | |
382 | } | |
383 | ||
9cef9567 JH |
384 | void View::update_viewport() |
385 | { | |
386 | assert(_viewport); | |
387 | _viewport->update(); | |
388 | } | |
389 | ||
f25770e2 JH |
390 | void View::get_scroll_layout(double &length, double &offset) const |
391 | { | |
1bc6525b JH |
392 | const pair<double, double> extents = get_time_extents(); |
393 | length = (extents.second - extents.first) / _scale; | |
f25770e2 JH |
394 | offset = _offset / _scale; |
395 | } | |
396 | ||
d1e7d82c JH |
397 | void View::set_zoom(double scale, int offset) |
398 | { | |
399 | const double cursor_offset = _offset + _scale * offset; | |
400 | const double new_scale = max(min(scale, MaxScale), MinScale); | |
401 | const double new_offset = cursor_offset - new_scale * offset; | |
402 | set_scale_offset(new_scale, new_offset); | |
403 | } | |
404 | ||
cdf7bea7 | 405 | void View::update_scroll() |
adb4b10c JH |
406 | { |
407 | assert(_viewport); | |
408 | ||
409 | const QSize areaSize = _viewport->size(); | |
410 | ||
411 | // Set the horizontal scroll bar | |
412 | double length = 0, offset = 0; | |
f25770e2 JH |
413 | get_scroll_layout(length, offset); |
414 | length = max(length - areaSize.width(), 0.0); | |
adb4b10c | 415 | |
b4ef7f2a | 416 | horizontalScrollBar()->setPageStep(areaSize.width() / 2); |
f25770e2 | 417 | |
528bd8a1 JH |
418 | _updating_scroll = true; |
419 | ||
333d5bbc | 420 | if (length < MaxScrollValue) { |
f25770e2 JH |
421 | horizontalScrollBar()->setRange(0, length); |
422 | horizontalScrollBar()->setSliderPosition(offset); | |
423 | } else { | |
424 | horizontalScrollBar()->setRange(0, MaxScrollValue); | |
425 | horizontalScrollBar()->setSliderPosition( | |
426 | _offset * MaxScrollValue / (_scale * length)); | |
427 | } | |
adb4b10c | 428 | |
528bd8a1 JH |
429 | _updating_scroll = false; |
430 | ||
adb4b10c JH |
431 | // Set the vertical scrollbar |
432 | verticalScrollBar()->setPageStep(areaSize.height()); | |
433 | verticalScrollBar()->setRange(0, | |
4b192962 JH |
434 | _viewport->get_total_height() + SignalMargin - |
435 | areaSize.height()); | |
adb4b10c JH |
436 | } |
437 | ||
d7c0ca4a JH |
438 | void View::update_layout() |
439 | { | |
512bfc56 JS |
440 | setViewportMargins( |
441 | _header->sizeHint().width() - pv::view::Header::BaselineOffset, | |
a6c1726e | 442 | _ruler->sizeHint().height(), 0, 0); |
d7c0ca4a JH |
443 | _ruler->setGeometry(_viewport->x(), 0, |
444 | _viewport->width(), _viewport->y()); | |
84a0d458 JS |
445 | _cursorheader->setGeometry( |
446 | _viewport->x(), | |
447 | _ruler->sizeHint().height() - _cursorheader->sizeHint().height() / 2, | |
448 | _viewport->width(), _cursorheader->sizeHint().height()); | |
d7c0ca4a | 449 | _header->setGeometry(0, _viewport->y(), |
512bfc56 | 450 | _header->sizeHint().width(), _viewport->height()); |
d7c0ca4a JH |
451 | update_scroll(); |
452 | } | |
453 | ||
eae6e30a JH |
454 | void View::paint_label(QPainter &p, int right, bool hover) |
455 | { | |
456 | (void)p; | |
457 | (void)right; | |
458 | (void)hover; | |
459 | } | |
460 | ||
461 | QRectF View::label_rect(int right) | |
462 | { | |
463 | (void)right; | |
464 | return QRectF(); | |
465 | } | |
466 | ||
cbd80f64 JH |
467 | bool View::eventFilter(QObject *object, QEvent *event) |
468 | { | |
469 | const QEvent::Type type = event->type(); | |
333d5bbc | 470 | if (type == QEvent::MouseMove) { |
cbd80f64 JH |
471 | |
472 | const QMouseEvent *const mouse_event = (QMouseEvent*)event; | |
333d5bbc | 473 | if (object == _viewport) |
cbd80f64 | 474 | _hover_point = mouse_event->pos(); |
84a0d458 | 475 | else if (object == _ruler || object == _cursorheader) |
cbd80f64 | 476 | _hover_point = QPoint(mouse_event->x(), 0); |
333d5bbc | 477 | else if (object == _header) |
cbd80f64 JH |
478 | _hover_point = QPoint(0, mouse_event->y()); |
479 | else | |
480 | _hover_point = QPoint(-1, -1); | |
481 | ||
482 | hover_point_changed(); | |
483 | ||
333d5bbc | 484 | } else if (type == QEvent::Leave) { |
cbd80f64 JH |
485 | _hover_point = QPoint(-1, -1); |
486 | hover_point_changed(); | |
487 | } | |
488 | ||
489 | return QObject::eventFilter(object, event); | |
490 | } | |
491 | ||
cdf7bea7 | 492 | bool View::viewportEvent(QEvent *e) |
adb4b10c JH |
493 | { |
494 | switch(e->type()) { | |
495 | case QEvent::Paint: | |
496 | case QEvent::MouseButtonPress: | |
497 | case QEvent::MouseButtonRelease: | |
498 | case QEvent::MouseButtonDblClick: | |
499 | case QEvent::MouseMove: | |
500 | case QEvent::Wheel: | |
4b4f1c0d MC |
501 | case QEvent::TouchBegin: |
502 | case QEvent::TouchUpdate: | |
503 | case QEvent::TouchEnd: | |
adb4b10c JH |
504 | return false; |
505 | ||
506 | default: | |
507 | return QAbstractScrollArea::viewportEvent(e); | |
508 | } | |
509 | } | |
510 | ||
e314eca4 | 511 | void View::resizeEvent(QResizeEvent*) |
adb4b10c | 512 | { |
d7c0ca4a | 513 | update_layout(); |
adb4b10c JH |
514 | } |
515 | ||
b16907d3 | 516 | void View::h_scroll_value_changed(int value) |
adb4b10c | 517 | { |
528bd8a1 JH |
518 | if (_updating_scroll) |
519 | return; | |
520 | ||
f25770e2 | 521 | const int range = horizontalScrollBar()->maximum(); |
333d5bbc | 522 | if (range < MaxScrollValue) |
f25770e2 JH |
523 | _offset = _scale * value; |
524 | else { | |
525 | double length = 0, offset; | |
526 | get_scroll_layout(length, offset); | |
527 | _offset = _scale * length * value / MaxScrollValue; | |
528 | } | |
529 | ||
ccdd3ef5 | 530 | _ruler->update(); |
84a0d458 | 531 | _cursorheader->update(); |
adb4b10c JH |
532 | _viewport->update(); |
533 | } | |
534 | ||
cdf7bea7 | 535 | void View::v_scroll_value_changed(int value) |
adb4b10c JH |
536 | { |
537 | _v_offset = value; | |
1d8dca91 | 538 | _header->update(); |
adb4b10c JH |
539 | _viewport->update(); |
540 | } | |
541 | ||
69dd2b03 JH |
542 | void View::signals_changed() |
543 | { | |
ef8311a4 | 544 | int offset = SignalMargin + SignalHeight; |
eae6e30a JH |
545 | const vector< shared_ptr<RowItem> > row_items(child_items()); |
546 | for (shared_ptr<RowItem> r : row_items) { | |
547 | r->set_owner(this); | |
548 | r->set_v_offset(offset); | |
ef8311a4 JH |
549 | offset += SignalHeight + 2 * SignalMargin; |
550 | } | |
551 | ||
a6c1726e | 552 | update_layout(); |
ef8311a4 | 553 | normalize_layout(); |
69dd2b03 JH |
554 | } |
555 | ||
cdf7bea7 | 556 | void View::data_updated() |
adb4b10c | 557 | { |
adb4b10c JH |
558 | // Update the scroll bars |
559 | update_scroll(); | |
560 | ||
561 | // Repaint the view | |
562 | _viewport->update(); | |
563 | } | |
cdf7bea7 | 564 | |
ca4ec3ea JH |
565 | void View::marker_time_changed() |
566 | { | |
84a0d458 | 567 | _cursorheader->update(); |
ca4ec3ea JH |
568 | _viewport->update(); |
569 | } | |
570 | ||
07204819 | 571 | void View::on_signals_moved() |
54401bbb | 572 | { |
07204819 JH |
573 | update_scroll(); |
574 | signals_moved(); | |
54401bbb JH |
575 | } |
576 | ||
d7c0ca4a JH |
577 | void View::on_geometry_updated() |
578 | { | |
579 | update_layout(); | |
580 | } | |
581 | ||
33c62f44 JH |
582 | void View::on_hover_point_changed() |
583 | { | |
eae6e30a JH |
584 | const vector< shared_ptr<RowItem> > row_items(child_items()); |
585 | for (shared_ptr<RowItem> r : row_items) | |
586 | r->hover_point_changed(); | |
33c62f44 JH |
587 | } |
588 | ||
cdf7bea7 JH |
589 | } // namespace view |
590 | } // namespace pv |