Skip to content

Commit 71ceea7

Browse files
committed
Renamed dial_base to basic_dial for consistency
1 parent 2e1f224 commit 71ceea7

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

examples/basic_sliders_and_knobs/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ slider_ptr hsliders[3];
3333
slider_ptr vsliders[3];
3434

3535
// We make three dials.
36-
using dial_ptr = std::shared_ptr<dial_base>;
36+
using dial_ptr = std::shared_ptr<basic_dial>;
3737
dial_ptr dials[3];
3838

3939
// We make linear slider markers that are placed below the sliders.

examples/custom_control/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class my_app : public app
197197
private:
198198

199199
constexpr static float default_value = my_custom_control::default_value;
200-
using dial_ptr = std::shared_ptr<dial_base>;
200+
using dial_ptr = std::shared_ptr<basic_dial>;
201201
using label_ptr = decltype(share(label("")));
202202

203203
auto make_control();

examples/sprite_sliders_and_knobs/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ auto background = box(bkd_color);
1515
using slider_ptr = std::shared_ptr<basic_slider_base>;
1616
slider_ptr vsliders[3];
1717

18-
using dial_ptr = std::shared_ptr<dial_base>;
18+
using dial_ptr = std::shared_ptr<basic_dial>;
1919
dial_ptr dials[3];
2020

2121
template <bool is_vertical>
@@ -107,7 +107,7 @@ void link_control(int index, view& view_)
107107
vsliders[index]->on_change =
108108
[index, &view_](double val)
109109
{
110-
dials[index]->dial_base::value(val);
110+
dials[index]->basic_dial::value(val);
111111
view_.refresh(*dials[index]);
112112
};
113113

lib/include/elements/element/dial.hpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ namespace cycfi::elements
2323
////////////////////////////////////////////////////////////////////////////
2424
// Dials
2525
////////////////////////////////////////////////////////////////////////////
26-
class dial_base : public tracker<proxy_base>, public receiver<double>
26+
class basic_dial : public tracker<proxy_base>, public receiver<double>
2727
{
2828
public:
2929

3030
using dial_function = std::function<void(double pos)>;
3131

32-
dial_base(double init_value = 0.0);
32+
basic_dial(double init_value = 0.0);
3333

3434
void prepare_subject(context& ctx) override;
3535
element* hit_test(context const& ctx, point p, bool leaf, bool control) override;
@@ -52,19 +52,21 @@ namespace cycfi::elements
5252
double _value;
5353
};
5454

55+
using dial_base [[deprecated("Use basic_dial instead.")]] = basic_dial;
56+
5557
template <concepts::Element Subject>
56-
inline proxy<remove_cvref_t<Subject>, dial_base>
58+
inline proxy<remove_cvref_t<Subject>, basic_dial>
5759
dial(Subject&& subject, double init_value = 0.0)
5860
{
5961
return {std::forward<Subject>(subject), init_value};
6062
}
6163

62-
inline double dial_base::value() const
64+
inline double basic_dial::value() const
6365
{
6466
return _value;
6567
}
6668

67-
inline element* dial_base::hit_test(context const& ctx, point p, bool leaf, bool /*control*/)
69+
inline element* basic_dial::hit_test(context const& ctx, point p, bool leaf, bool /*control*/)
6870
{
6971
return element::hit_test(ctx, p, leaf, false); // accept non-control subjects
7072
}

lib/src/element/dial.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212
namespace cycfi::elements
1313
{
1414
////////////////////////////////////////////////////////////////////////////
15-
// dial_base
15+
// basic_dial
1616
////////////////////////////////////////////////////////////////////////////
17-
dial_base::dial_base(double init_value)
17+
basic_dial::basic_dial(double init_value)
1818
: _value(init_value)
1919
{
2020
clamp(_value, 0.0, 1.0);
2121
}
2222

23-
void dial_base::prepare_subject(context& ctx)
23+
void basic_dial::prepare_subject(context& ctx)
2424
{
2525
proxy_base::prepare_subject(ctx);
2626
if (auto* rcvr = find_subject<receiver<double>*>(this))
2727
rcvr->value(_value);
2828
}
2929

30-
void dial_base::value(double val)
30+
void basic_dial::value(double val)
3131
{
3232
_value = clamp(val, 0.0, 1.0);
3333
if (auto* rcvr = find_subject<receiver<double>*>(this))
@@ -36,21 +36,21 @@ namespace cycfi::elements
3636

3737
namespace
3838
{
39-
inline void edit_value(dial_base* this_, double val)
39+
inline void edit_value(basic_dial* this_, double val)
4040
{
4141
this_->value(val);
4242
if (this_->on_change)
4343
this_->on_change(this_->value());
4444
}
4545
}
4646

47-
void dial_base::edit(view& view_, param_type val)
47+
void basic_dial::edit(view& view_, param_type val)
4848
{
4949
edit_value(this, val);
5050
receiver<double>::notify_edit(view_);
5151
}
5252

53-
double dial_base::radial_value(context const& ctx, tracker_info& track_info)
53+
double basic_dial::radial_value(context const& ctx, tracker_info& track_info)
5454
{
5555
using namespace radial_consts;
5656

@@ -66,7 +66,7 @@ namespace cycfi::elements
6666
return value();
6767
}
6868

69-
double dial_base::linear_value(context const& /*ctx*/, tracker_info& track_info)
69+
double basic_dial::linear_value(context const& /*ctx*/, tracker_info& track_info)
7070
{
7171
point delta{
7272
track_info.current.x - track_info.previous.x,
@@ -81,15 +81,15 @@ namespace cycfi::elements
8181
return clamp(val, 0.0, 1.0);
8282
}
8383

84-
double dial_base::compute_value(context const& ctx, tracker_info& track_info)
84+
double basic_dial::compute_value(context const& ctx, tracker_info& track_info)
8585
{
8686
return (get_theme().dial_mode == dial_mode_enum::radial)?
8787
radial_value(ctx, track_info) :
8888
linear_value(ctx, track_info)
8989
;
9090
}
9191

92-
void dial_base::keep_tracking(context const& ctx, tracker_info& track_info)
92+
void basic_dial::keep_tracking(context const& ctx, tracker_info& track_info)
9393
{
9494
if (track_info.current != track_info.previous)
9595
{
@@ -102,7 +102,7 @@ namespace cycfi::elements
102102
}
103103
}
104104

105-
bool dial_base::scroll(context const& ctx, point dir, point p)
105+
bool basic_dial::scroll(context const& ctx, point dir, point p)
106106
{
107107
auto sdir = scroll_direction();
108108
track_scroll(ctx, dir, p);

0 commit comments

Comments
 (0)