@@ -28,45 +28,37 @@ namespace ce {
28
28
29
29
30
30
// ---------------------------------------------------------------------
31
- // カーブ(Valueモード)
31
+ // カーブ
32
32
// ---------------------------------------------------------------------
33
- class Curve_Value {
33
+ class Curve {
34
+ private:
35
+ void set_handle_position (const Point_Address& pt_address, const POINT& pt_graph, double length, bool use_angle, double angle);
36
+ void correct_handle (const Point_Address& pt_address, double angle);
37
+ double get_handle_angle (const Point_Address& pt_address);
38
+ void set_handle_angle (const Point_Address& pt_address, double angle, bool use_length, double lgth);
39
+
34
40
public:
35
- POINT ctpt[2 ];
41
+ ce::Static_Array<Curve_Points, CE_POINT_MAX> ctpts;
42
+ Mode mode;
36
43
37
- Curve_Value () { init (); }
44
+ // 共通
45
+ void initialize ();
46
+ void initialize (Mode md);
47
+ void clear ();
48
+ void pt_in_ctpt (const POINT& pt_client, Point_Address* pt_address);
49
+ void reverse_curve ();
38
50
39
- void init ();
40
- int point_in_ctpts (POINT cl_pt);
41
- void move_point (int index, POINT gr_pt);
51
+ // Valueモード用
42
52
int create_value_1d ();
43
53
std::string create_value_4d ();
44
54
void read_value_1d (int value);
45
- };
46
-
47
-
48
55
49
- // ---------------------------------------------------------------------
50
- // カーブ(IDモード)
51
- // ---------------------------------------------------------------------
52
- class Curve_ID {
53
- public:
54
- ce::Static_Array<Points_ID, CE_POINT_MAX> ctpts;
55
-
56
- Curve_ID () { init (); }
57
-
58
- void init ();
59
- void add_point (POINT cl_pt);
60
- void delete_point (POINT cl_pt);
61
- void clear ();
62
- POINT get_point (Point_Address address);
63
- void move_point (Point_Address address, POINT gr_pt, BOOL reset);
64
- Point_Address pt_in_ctpt (POINT cl_pt);
65
- double get_handle_angle (Point_Address address);
66
- void correct_handle (Point_Address address, double angle);
67
- void set_handle_angle (Point_Address address, double angle, BOOL bLength, double lgth);
68
- void reverse_curve ();
69
- double get_value (double ratio, double st, double ed);
56
+ // IDモード用
57
+ void add_point (const POINT& pt_client);
58
+ void delete_point (const POINT& pt_client);
59
+ void move_point (int index, const POINT& pt_graph, bool init);
60
+ void move_handle (const Point_Address& pt_address, const POINT& pt_graph, bool init);
61
+ double id_create_result (double ratio, double st, double ed);
70
62
};
71
63
72
64
@@ -82,8 +74,8 @@ namespace ce {
82
74
HDC hdc_memory;
83
75
84
76
void init (HWND hw);
85
- void exit ();
86
- void transfer (LPRECT rect);
77
+ void exit () const ;
78
+ void transfer (const RECT& rect) const ;
87
79
};
88
80
89
81
@@ -98,12 +90,12 @@ namespace ce {
98
90
public:
99
91
HWND hwnd;
100
92
101
- virtual BOOL create (HWND hwnd_parent, LPTSTR class_name, WNDPROC wndproc, LONG style, LPRECT rect);
102
- virtual void move (LPRECT rect);
103
- void redraw ();
104
- BOOL close ();
105
- BOOL show ();
106
- BOOL hide ();
93
+ virtual BOOL create (HWND hwnd_parent, LPTSTR class_name, WNDPROC wndproc, LONG style, const RECT& rect);
94
+ virtual void move (const RECT& rect) const ;
95
+ void redraw () const ;
96
+ BOOL close () const ;
97
+ BOOL show () const ;
98
+ BOOL hide () const ;
107
99
virtual LRESULT wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
108
100
};
109
101
@@ -116,23 +108,17 @@ namespace ce {
116
108
public:
117
109
HWND hwnd;
118
110
LPTSTR name;
119
- Curve_Value curve_value;
120
- Curve_ID curve_id;
111
+ Curve curve;
121
112
time_t unix_time;
122
- const int val_or_id, def_or_user;
123
- int index;
113
+ const int val_or_id;
124
114
125
- Preset (int v_i, Curve_Value c_value, Curve_ID c_id, LPTSTR n, int d_u ) : name(n), val_or_id(v_i ), def_or_user(d_u )
115
+ Preset (int v_i, Curve cv, LPTSTR n) : name(n), curve(cv ), val_or_id(v_i )
126
116
{
127
- if (v_i == 1 )
128
- curve_id = c_id;
129
- else
130
- curve_value = c_value;
131
- time (&unix_time);
117
+ ::time (&unix_time);
132
118
}
133
119
134
120
BOOL create (HWND hwnd_parent);
135
- void move (int width );
121
+ void move (int panel_width, int index );
136
122
LRESULT wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
137
123
};
138
124
@@ -160,8 +146,8 @@ namespace ce {
160
146
int edge_flag;
161
147
ID2D1SolidColorBrush* brush;
162
148
163
- void draw (COLORREF bg, LPRECT rect_wnd, LPTSTR content);
164
- void set_font (LPRECT rect_wnd, LPTSTR font_name);
149
+ void draw (COLORREF bg, RECT& rect_wnd, LPTSTR content);
150
+ void set_font (const RECT& rect_wnd, LPTSTR font_name);
165
151
166
152
public:
167
153
int id;
@@ -175,7 +161,7 @@ namespace ce {
175
161
LPTSTR ico_res_light,
176
162
LPTSTR lb,
177
163
int ct_id,
178
- LPRECT rect,
164
+ const RECT& rect,
179
165
int flag
180
166
);
181
167
virtual LRESULT wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
@@ -230,12 +216,12 @@ namespace ce {
230
216
public:
231
217
RECT rect;
232
218
233
- void set (RECT rc);
234
- void set (int left, int top, int right, int bottom);
235
- void set_margin (int left, int top, int right, int bottom);
236
- void divide (LPRECT* rects_child, float * weights, int n);
237
- void client_to_screen (HWND hwnd);
238
- void screen_to_client (HWND hwnd);
219
+ void set (const RECT& rc);
220
+ void set (int left, int top, int right, int bottom);
221
+ void set_margin (int left, int top, int right, int bottom);
222
+ void divide (LPRECT rects_child[] , float weights[] , int n) const ;
223
+ void client_to_screen (HWND hwnd);
224
+ void screen_to_client (HWND hwnd);
239
225
};
240
226
241
227
@@ -255,13 +241,13 @@ namespace ce {
255
241
// オブジェクト設定ダイアログのクライアント座標
256
242
Rectangle rect_button;
257
243
258
- void init (HWND hwnd) { hwnd_obj = hwnd; }
259
- BOOL is_hovered () { return id >= 0 ; }
244
+ void init (HWND hwnd) { hwnd_obj = hwnd; }
245
+ BOOL is_hovered () const { return id >= 0 ; }
260
246
261
- int update (POINT pt_sc, LPRECT old_rect);
262
- void click ();
263
- void highlight ();
264
- void invalidate (LPRECT rect);
247
+ int update (LPPOINT pt_sc, LPRECT old_rect);
248
+ void click ();
249
+ void highlight () const ;
250
+ void invalidate (const LPRECT rect) const ;
265
251
};
266
252
267
253
@@ -274,18 +260,18 @@ namespace ce {
274
260
Float_Point origin;
275
261
Double_Point scale;
276
262
277
- void fit (LPRECT rect)
263
+ void fit (const RECT& rect)
278
264
{
279
265
origin.x = CE_GR_PADDING;
280
- scale.x = ((double )rect-> right - (int )(2 * CE_GR_PADDING)) / (double )CE_GR_RESOLUTION;
266
+ scale.x = ((double )rect. right - (int )(2 * CE_GR_PADDING)) / (double )CE_GR_RESOLUTION;
281
267
282
- if (rect-> right <= rect-> bottom ) {
283
- origin.y = (rect-> bottom + rect-> right ) * 0 .5f - CE_GR_PADDING;
268
+ if (rect. right <= rect. bottom ) {
269
+ origin.y = (rect. bottom + rect. right ) * 0 .5f - CE_GR_PADDING;
284
270
scale.y = scale.x ;
285
271
}
286
- else if (rect-> bottom > CE_GR_PADDING * 2 + CE_GR_RESOLUTION * CE_GR_SCALE_MIN) {
287
- origin.y = (float )(rect-> bottom - CE_GR_PADDING);
288
- scale.y = ((double )rect-> bottom - (int )(2 * CE_GR_PADDING)) / (double )CE_GR_RESOLUTION;
272
+ else if (rect. bottom > CE_GR_PADDING * 2 + CE_GR_RESOLUTION * CE_GR_SCALE_MIN) {
273
+ origin.y = (float )(rect. bottom - CE_GR_PADDING);
274
+ scale.y = ((double )rect. bottom - (int )(2 * CE_GR_PADDING)) / (double )CE_GR_RESOLUTION;
289
275
}
290
276
}
291
277
};
0 commit comments