-
- assert(spinners[source_bus_idx].count(field_number));
- QSpinBox *source_spinner = spinners[source_bus_idx][field_number].spinner;
- assert(spinners[source_bus_idx][field_number].group == this_spinner_group);
+ if (spinner->value() == 0) {
+ if (source_spinner->value() != 0) {
+ // If the source value is e.g. 3, offset can't be less than -2 or larger than 124.
+ // Otherwise, we'd extrapolate values outside [1..127].
+ minimum_allowed_offset = max(minimum_allowed_offset, 1 - source_spinner->value());
+ maximum_allowed_offset = min(maximum_allowed_offset, 127 - source_spinner->value());
+ }
+ continue;
+ }