1 /*
2  * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3  *           (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
4  *
5  * This file is part of lsp-plugins
6  * Created on: 27 июл. 2017 г.
7  *
8  * lsp-plugins is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * any later version.
12  *
13  * lsp-plugins is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with lsp-plugins. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef UI_CTL_CTLAXIS_H_
23 #define UI_CTL_CTLAXIS_H_
24 
25 namespace lsp
26 {
27     namespace ctl
28     {
29         class CtlAxis: public CtlWidget
30         {
31             public:
32                 static const ctl_class_t metadata;
33 
34             protected:
35                 enum flags_t
36                 {
37                     F_MIN_SET       = 1 << 0,
38                     F_MAX_SET       = 1 << 1,
39                     F_LOG_SET       = 1 << 2,
40                     F_LOG           = 1 << 3
41                 };
42 
43             protected:
44                 size_t          nFlags;
45                 CtlExpression   sMin;
46                 CtlExpression   sMax;
47                 CtlExpression   sAngle;
48                 CtlExpression   sLength;
49                 CtlExpression   sDX;
50                 CtlExpression   sDY;
51                 CtlPort        *pPort;
52                 CtlColor        sColor;
53 
54             protected:
55                 static status_t     slot_graph_resize(LSPWidget *sender, void *ptr, void *data);
56 
57                 void                update_axis();
58                 void                trigger_expr();
59                 float               eval_expr(CtlExpression *expr);
60 
61             public:
62                 explicit CtlAxis(CtlRegistry *src, LSPAxis *axis);
63                 virtual ~CtlAxis();
64 
65             public:
66                 /** Begin initialization of controller
67                  *
68                  */
69                 virtual void init();
70 
71                 /** Set attribute
72                  *
73                  * @param att widget attribute
74                  * @param value widget value
75                  */
76                 virtual void set(widget_attribute_t att, const char *value);
77 
78                 virtual void end();
79 
80                 virtual void notify(CtlPort *port);
81         };
82 
83     } /* namespace ctl */
84 } /* namespace lsp */
85 
86 #endif /* UI_CTL_CTLAXIS_H_ */
87