diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-14 00:07:03 +0100 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-14 00:07:03 +0100 | 
| commit | 3e64bb198781eda1ac6ca0b39c7c3a3d249548b5 (patch) | |
| tree | 995fbb2eddac3892af594a33809abd3e74b6e5fd /gui | |
| parent | 249f876093c5d269a521bb190bbd9de7c57a08ac (diff) | |
gui/spline: change horizontal/vertical guide count
The amount depends on the max value on X/Y scales.
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/mapping-dialog.cpp | 44 | 
1 files changed, 36 insertions, 8 deletions
| diff --git a/gui/mapping-dialog.cpp b/gui/mapping-dialog.cpp index 7aa42b13..d4f8a1d4 100644 --- a/gui/mapping-dialog.cpp +++ b/gui/mapping-dialog.cpp @@ -125,21 +125,49 @@ void mapping_dialog::load()          const int idx = qfcs[i].axis; -        auto update_snap = [idx, &conf, &qfc](int value) { -            //qfc.reload_spline(); -            qfc.set_x_step(value + 1e-2 >= 90 ? 10 : 5); +        using c = axis_opts::max_clamp; -            if (idx >= 3) -                qfc.set_snap(.5, 1); +        auto update_xstep = [idx, &conf, &qfc](int clamp_x) { +            int value; + +            if (clamp_x <= c::r20) +                value = 1; +            else if (clamp_x <= c::r30) +                value = 5;              else -                qfc.set_snap(.5, 1); +                value = 10; + +            qfc.set_x_step(value); +        }; + +        auto update_ystep = [idx, &conf, &qfc](int clamp_y) { +            int value; +            switch (clamp_y) +            { +            default: +            case c::o_r180: +                value = 15; break; +            case c::o_r90: +                value = 10; break; +            case c::o_t75: +                value = 5; break; +            } +            qfc.set_y_step(value);          }; -        connect(&axis.opts.clamp_x_, base_value::value_changed<int>(), &qfc, update_snap); +        if (idx >= Yaw) +            qfc.set_snap(.5, 1); +        else +            qfc.set_snap(.5, 1); + +        connect(&axis.opts.clamp_x_, base_value::value_changed<int>(), &qfc, update_xstep); +        connect(&axis.opts.clamp_y_, base_value::value_changed<int>(), &qfc, update_ystep);          // force signal to avoid duplicating the slot's logic          qfc.setConfig(&conf); -        update_snap(axis.opts.clamp_x_.to<int>()); + +        update_xstep(axis.opts.clamp_x_); +        update_ystep(axis.opts.clamp_y_);          widgets[i % 6][altp ? 1 : 0] = &qfc;      } | 
