+void StandardBar::on_segment_changed(int segment_id)
+{
+ // We need to adjust the value by 1 because internally, segments
+ // start at 0 while they start with 1 for the spinbox
+ const uint32_t ui_segment_id = segment_id + 1;
+
+ // This is called when the current segment was changed
+ // by other parts of the UI, e.g. the view itself
+
+ // Make sure our value isn't limited by a too low maximum
+ // Note: this can happen if on_segment_changed() is called before
+ // on_new_segment()
+ if ((uint32_t)segment_selector_->maximum() < ui_segment_id)
+ segment_selector_->setMaximum(ui_segment_id);
+
+ segment_selector_->setValue(ui_segment_id);
+}
+
+void StandardBar::on_segment_selected(int ui_segment_id)
+{
+ // We need to adjust the value by 1 because internally, segments
+ // start at 0 while they start with 1 for the spinbox
+ const uint32_t segment_id = ui_segment_id - 1;
+
+ // This is called when the user selected a segment using the spin box
+ // or when the value of the spinbox was assigned a new value. Since we
+ // only care about the former, we filter out the latter:
+ if (segment_id == view_->current_segment())
+ return;
+
+ // No matter which segment display mode we were in, we now show a single segment
+ if (view_->segment_display_mode() != Trace::ShowSingleSegmentOnly)
+ on_actionSDMSingle_triggered();
+
+ segment_selected(segment_id);
+}
+
+void StandardBar::on_segment_display_mode_changed(int mode, bool segment_selectable)
+{
+ segment_selector_->setReadOnly(!segment_selectable);
+
+ switch ((Trace::SegmentDisplayMode)mode) {
+ case Trace::ShowLastSegmentOnly:
+ segment_display_mode_selector_->setDefaultAction(action_sdm_last_);
+ break;
+ case Trace::ShowLastCompleteSegmentOnly:
+ segment_display_mode_selector_->setDefaultAction(action_sdm_last_complete_);
+ break;
+ case Trace::ShowSingleSegmentOnly:
+ segment_display_mode_selector_->setDefaultAction(action_sdm_single_);
+ break;
+ default:
+ break;
+ }
+}
+
+void StandardBar::on_cursor_state_changed(bool show)
+{
+ action_view_show_cursors_->setChecked(show);
+}
+