Skip to content

Commit bd62226

Browse files
committed
readが正常に動作しないバグを修正
1 parent 114d341 commit bd62226

10 files changed

+122
-202
lines changed

curve_editor/ce_curve_value.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ std::string ce::Curve_Value::create_value_4d()
213213
void ce::Curve_Value::read_value_1d(int value)
214214
{
215215
int64_t int64;
216-
int64 = value + 2147483647;
216+
int64 = (int64_t)value + (int64_t)2147483647;
217217
ctpt[1].y = int64 / 6600047;
218-
ctpt[1].x = (int64 - g_curve_value.ctpt[1].y * 6600047) / 65347;
219-
ctpt[0].y = (int64 - (g_curve_value.ctpt[1].y * 6600047 + g_curve_value.ctpt[1].x * 65347)) / 101;
220-
ctpt[0].x = (int64 - (g_curve_value.ctpt[1].y * 6600047 + g_curve_value.ctpt[1].x * 65347)) % 101;
218+
ctpt[1].x = (int64 - (int64_t)ctpt[1].y * 6600047) / 65347;
219+
ctpt[0].y = (int64 - ((int64_t)ctpt[1].y * 6600047 + (int64_t)ctpt[1].x * 65347)) / 101;
220+
ctpt[0].x = (int64 - ((int64_t)ctpt[1].y * 6600047 + (int64_t)ctpt[1].x * 65347)) % 101;
221221
ctpt[0].x *= CE_GR_RESOLUTION / 100;
222222
ctpt[0].y *= CE_GR_RESOLUTION / 100;
223223
ctpt[1].x *= CE_GR_RESOLUTION / 100;
224224
ctpt[1].y *= CE_GR_RESOLUTION / 100;
225225
ctpt[0].y -= 2.73 * CE_GR_RESOLUTION;
226-
ctpt[0].y -= 2.73 * CE_GR_RESOLUTION;
226+
ctpt[1].y -= 2.73 * CE_GR_RESOLUTION;
227227
}

curve_editor/ce_direct2d.cpp

Lines changed: 0 additions & 62 deletions
This file was deleted.

curve_editor/ce_dlgproc.cpp

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
//---------------------------------------------------------------------
1212
// ダイアログプロシージャ(設定ダイアログ)
1313
//---------------------------------------------------------------------
14-
BOOL CALLBACK wndproc_daialog_settings(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam)
14+
BOOL CALLBACK dialogproc_settings(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
1515
{
1616
static HDC hdc, hdc_mem;
1717
static HWND hCombo, hCombo2;
1818
static HBITMAP bitmap;
1919
switch (msg) {
2020
case WM_CLOSE:
2121
DeleteObject(bitmap);
22-
EndDialog(hDlg, 1);
22+
EndDialog(hwnd, 1);
2323
return 0;
2424

2525
case WM_INITDIALOG:
26-
if (g_config.trace) SendMessage(GetDlgItem(hDlg, IDC_PREVIOUSCURVE), BM_SETCHECK, BST_CHECKED, 0);
27-
if (g_config.alert) SendMessage(GetDlgItem(hDlg, IDC_ALERT), BM_SETCHECK, BST_CHECKED, 0);
28-
if (g_config.auto_copy) SendMessage(GetDlgItem(hDlg, IDC_AUTOCOPY), BM_SETCHECK, BST_CHECKED, 0);
29-
hCombo = GetDlgItem(hDlg, IDC_THEME);
26+
if (g_config.trace) SendMessage(GetDlgItem(hwnd, IDC_PREVIOUSCURVE), BM_SETCHECK, BST_CHECKED, 0);
27+
if (g_config.alert) SendMessage(GetDlgItem(hwnd, IDC_ALERT), BM_SETCHECK, BST_CHECKED, 0);
28+
if (g_config.auto_copy) SendMessage(GetDlgItem(hwnd, IDC_AUTOCOPY), BM_SETCHECK, BST_CHECKED, 0);
29+
hCombo = GetDlgItem(hwnd, IDC_THEME);
3030
SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)"ダーク");
3131
SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)"ライト");
3232
SendMessage(hCombo, CB_SETCURSEL, g_config.theme, 0);
@@ -36,19 +36,19 @@ BOOL CALLBACK wndproc_daialog_settings(HWND hDlg, UINT msg, WPARAM wparam, LPARA
3636
case WM_COMMAND:
3737
switch (LOWORD(wparam)) {
3838
case IDOK:
39-
g_config.trace = SendMessage(GetDlgItem(hDlg, IDC_PREVIOUSCURVE), BM_GETCHECK, 0, 0);
40-
g_config.alert = SendMessage(GetDlgItem(hDlg, IDC_ALERT), BM_GETCHECK, 0, 0);
41-
g_config.auto_copy = SendMessage(GetDlgItem(hDlg, IDC_AUTOCOPY), BM_GETCHECK, 0, 0);
39+
g_config.trace = SendMessage(GetDlgItem(hwnd, IDC_PREVIOUSCURVE), BM_GETCHECK, 0, 0);
40+
g_config.alert = SendMessage(GetDlgItem(hwnd, IDC_ALERT), BM_GETCHECK, 0, 0);
41+
g_config.auto_copy = SendMessage(GetDlgItem(hwnd, IDC_AUTOCOPY), BM_GETCHECK, 0, 0);
4242
g_config.theme = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
4343
g_fp->exfunc->ini_save_int(g_fp, "theme", g_config.theme);
4444
g_fp->exfunc->ini_save_int(g_fp, "show_previous_curve", g_config.trace);
4545
g_fp->exfunc->ini_save_int(g_fp, "show_alerts", g_config.alert);
4646
g_fp->exfunc->ini_save_int(g_fp, "auto_copy", g_config.auto_copy);
47-
EndDialog(hDlg, 1);
47+
EndDialog(hwnd, 1);
4848
return 0;
4949

5050
case IDCANCEL:
51-
EndDialog(hDlg, 1);
51+
EndDialog(hwnd, 1);
5252
return 0;
5353
}
5454
}
@@ -60,37 +60,37 @@ BOOL CALLBACK wndproc_daialog_settings(HWND hDlg, UINT msg, WPARAM wparam, LPARA
6060
//---------------------------------------------------------------------
6161
// ダイアログプロシージャ(カーブ値の設定)
6262
//---------------------------------------------------------------------
63-
BOOL CALLBACK wndproc_daialog_value(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam)
63+
BOOL CALLBACK dialogproc_value(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
6464
{
6565
TCHAR buffer[30];
6666
std::regex re(R"(^((\d+ *, *)|(\d*\.\d* *, *))((-?\d+ *, *)|(-?\d*\.\d* *, *))((\d+ *, *)|(\d*\.\d* *, *))((-?\d+ *)|(-?\d*\.\d* *))$)");
6767
switch (msg) {
6868
case WM_CLOSE:
69-
EndDialog(hDlg, 1);
69+
EndDialog(hwnd, 1);
7070
return 0;
7171
case WM_COMMAND:
7272
switch (LOWORD(wparam)) {
7373
case IDOK:
74-
GetDlgItemText(hDlg, IDC_EDIT_VALUE, buffer, 30);
74+
GetDlgItemText(hwnd, IDC_EDIT_VALUE, buffer, 30);
7575
if (std::regex_match(buffer, re)) {
7676
std::string str = buffer;
7777
std::vector<std::string> vec = split(buffer, ',');
78-
g_curve_value.ctpt[0].x = (int)(std::stod(vec[0]) * 1000);
79-
g_curve_value.ctpt[0].x = (int)(std::stod(vec[0]) * 1000);
80-
g_curve_value.ctpt[0].y = (int)(std::stod(vec[1]) * 1000);
81-
g_curve_value.ctpt[1].x = (int)(std::stod(vec[2]) * 1000);
82-
g_curve_value.ctpt[1].y = (int)(std::stod(vec[3]) * 1000);
78+
g_curve_value.ctpt[0].x = (int)(std::stod(vec[0]) * CE_GR_RESOLUTION);
79+
g_curve_value.ctpt[0].x = (int)(std::stod(vec[0]) * CE_GR_RESOLUTION);
80+
g_curve_value.ctpt[0].y = (int)(std::stod(vec[1]) * CE_GR_RESOLUTION);
81+
g_curve_value.ctpt[1].x = (int)(std::stod(vec[2]) * CE_GR_RESOLUTION);
82+
g_curve_value.ctpt[1].y = (int)(std::stod(vec[3]) * CE_GR_RESOLUTION);
8383

8484
for (int i = 0; i < 2; i++) {
85-
if (g_curve_value.ctpt[i].y > 3730) g_curve_value.ctpt[i].y = 3730;
86-
else if (g_curve_value.ctpt[i].y < -2730) g_curve_value.ctpt[i].y = -2730;
85+
if (g_curve_value.ctpt[i].y > 3.73 * CE_GR_RESOLUTION) g_curve_value.ctpt[i].y = 3.73 * CE_GR_RESOLUTION;
86+
else if (g_curve_value.ctpt[i].y < -2.73 * CE_GR_RESOLUTION) g_curve_value.ctpt[i].y = -2.73 * CE_GR_RESOLUTION;
8787
}
88-
EndDialog(hDlg, 1);
88+
EndDialog(hwnd, 1);
8989
}
90-
else if (g_config.alert)MessageBox(hDlg, CE_STR_INVALIDINPUT, CE_PLUGIN_NAME, MB_OK | MB_ICONINFORMATION);
90+
else if (g_config.alert)MessageBox(hwnd, CE_STR_INVALIDINPUT, CE_PLUGIN_NAME, MB_OK | MB_ICONINFORMATION);
9191
return 0;
9292
case IDCANCEL:
93-
EndDialog(hDlg, 1);
93+
EndDialog(hwnd, 1);
9494
return 0;
9595
}
9696
}
@@ -102,7 +102,7 @@ BOOL CALLBACK wndproc_daialog_value(HWND hDlg, UINT msg, WPARAM wparam, LPARAM l
102102
//---------------------------------------------------------------------
103103
// ダイアログプロシージャ(カーブ読み取り)
104104
//---------------------------------------------------------------------
105-
BOOL CALLBACK wndproc_daialog_read(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam)
105+
BOOL CALLBACK dialogproc_read(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
106106
{
107107
// エディットコントロール
108108
HWND edit;
@@ -113,44 +113,44 @@ BOOL CALLBACK wndproc_daialog_read(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lp
113113
std::string str;
114114
switch (msg) {
115115
case WM_INITDIALOG:
116-
edit = GetDlgItem(hDlg, IDC_EDIT_READ);
116+
edit = GetDlgItem(hwnd, IDC_EDIT_READ);
117117
SendMessage(edit, EM_SETLIMITTEXT, 11, 0);
118118
return 0;
119119

120120
case WM_CLOSE:
121-
EndDialog(hDlg, 1);
121+
EndDialog(hwnd, 1);
122122
return 0;
123123

124124
case WM_KEYDOWN:
125125
if (wparam == VK_RETURN)
126-
SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
126+
SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
127127
return 0;
128128

129129
case WM_COMMAND:
130130
switch (LOWORD(wparam)) {
131131
case IDOK:
132-
GetDlgItemText(hDlg, IDC_EDIT_READ, buffer, 11);
132+
GetDlgItemText(hwnd, IDC_EDIT_READ, buffer, 11);
133133
if (std::regex_match(buffer, re)) {
134134
str = buffer;
135135
try {
136136
value = std::stoi(str);
137137
}
138138
catch (std::out_of_range& e) {
139-
if (g_config.alert) MessageBox(hDlg, CE_STR_OUTOFRANGE, CE_PLUGIN_NAME, MB_OK | MB_ICONERROR);
139+
if (g_config.alert) MessageBox(hwnd, CE_STR_OUTOFRANGE, CE_PLUGIN_NAME, MB_OK | MB_ICONERROR);
140140
return 0;
141141
}
142142
if ((value < -2147483647 || 2122746761 < value) && g_config.alert) {
143-
MessageBox(hDlg, CE_STR_OUTOFRANGE, CE_PLUGIN_NAME, MB_OK | MB_ICONERROR);
143+
MessageBox(hwnd, CE_STR_OUTOFRANGE, CE_PLUGIN_NAME, MB_OK | MB_ICONERROR);
144144
return 0;
145145
}
146146
g_curve_value.read_value_1d(value);
147-
EndDialog(hDlg, 1);
147+
EndDialog(hwnd, 1);
148148
}
149149
else if (g_config.alert)
150-
MessageBox(hDlg, CE_STR_INVALIDINPUT, CE_PLUGIN_NAME, MB_OK | MB_ICONERROR);
150+
MessageBox(hwnd, CE_STR_INVALIDINPUT, CE_PLUGIN_NAME, MB_OK | MB_ICONERROR);
151151
return 0;
152152
case IDCANCEL:
153-
EndDialog(hDlg, 1);
153+
EndDialog(hwnd, 1);
154154
return 0;
155155
}
156156
}
@@ -162,7 +162,7 @@ BOOL CALLBACK wndproc_daialog_read(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lp
162162
//---------------------------------------------------------------------
163163
// ダイアログプロシージャ(カーブ保存ダイアログ)
164164
//---------------------------------------------------------------------
165-
BOOL CALLBACK wndproc_daialog_save(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam)
165+
BOOL CALLBACK dialogproc_save(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
166166
{
167167
//4次元カーブ!Dを生成
168168
HDC hdc;
@@ -176,10 +176,10 @@ BOOL CALLBACK wndproc_daialog_save(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lp
176176

177177
switch (msg) {
178178
case WM_CLOSE:
179-
EndDialog(hDlg, 1);
179+
EndDialog(hwnd, 1);
180180
return 0;
181181
case WM_INITDIALOG:
182-
edit = GetDlgItem(hDlg, IDC_EDIT_SAVE);
182+
edit = GetDlgItem(hwnd, IDC_EDIT_SAVE);
183183
SendMessage(edit, EM_SETLIMITTEXT, 64, 0);
184184
return 0;
185185
case WM_PAINT:
@@ -195,28 +195,28 @@ BOOL CALLBACK wndproc_daialog_save(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lp
195195
0,
196196
NULL
197197
);
198-
hdc = GetDC(hDlg);
198+
hdc = GetDC(hwnd);
199199
SelectObject(hdc, hfValues);
200200
SetBkMode(hdc, TRANSPARENT);
201201
TextOut(hdc, 100, 13, lpsResult, strlen(lpsResult));
202202
DeleteObject(hfValues);
203-
ReleaseDC(hDlg, hdc);
203+
ReleaseDC(hwnd, hdc);
204204
return 0;
205205

206206
case WM_COMMAND:
207207
switch (LOWORD(wparam)) {
208208
case IDOK:
209209
ce::Preset_Value additem;
210-
GetDlgItemText(hDlg, IDC_EDIT_SAVE, buffer, 64);
210+
GetDlgItemText(hwnd, IDC_EDIT_SAVE, buffer, 64);
211211
if (strlen(buffer) < 64 && strlen(buffer) != 0) {
212212
additem = { buffer, g_curve_value.ctpt[0].x, g_curve_value.ctpt[0].y, g_curve_value.ctpt[1].x, g_curve_value.ctpt[1].y };
213213
g_presets_value.emplace_back(additem);
214-
EndDialog(hDlg, 1);
214+
EndDialog(hwnd, 1);
215215
}
216-
else if (strlen(buffer) == 0 && g_config.alert) MessageBox(hDlg, CE_STR_INPUTANAME, CE_PLUGIN_NAME, MB_OK | MB_ICONINFORMATION);
216+
else if (strlen(buffer) == 0 && g_config.alert) MessageBox(hwnd, CE_STR_INPUTANAME, CE_PLUGIN_NAME, MB_OK | MB_ICONINFORMATION);
217217
return 0;
218218
case IDCANCEL:
219-
EndDialog(hDlg, 1);
219+
EndDialog(hwnd, 1);
220220
return 0;
221221
}
222222
return 0;

curve_editor/ce_func.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void ini_load_configs(FILTER* fp)
9393
g_curve_value.ctpt[0].y = fp->exfunc->ini_load_int(fp, "y1", CE_GR_RESOLUTION * 0.4);
9494
g_curve_value.ctpt[1].x = fp->exfunc->ini_load_int(fp, "x2", CE_GR_RESOLUTION * 0.6);
9595
g_curve_value.ctpt[1].y = fp->exfunc->ini_load_int(fp, "y2", CE_GR_RESOLUTION * 0.6);
96-
g_config.separator = fp->exfunc->ini_load_int(fp, "separator", 200);
96+
g_config.separator = fp->exfunc->ini_load_int(fp, "separator", CE_SEPR_DEF);
9797
g_config.mode = fp->exfunc->ini_load_int(fp, "mode", 0);
9898
g_config.align_handle = fp->exfunc->ini_load_int(fp, "align_handle", 1);
9999
g_config.show_handle = fp->exfunc->ini_load_int(fp, "show_handle", 1);

curve_editor/ce_func_graphics.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void d2d_draw_handle(ID2D1SolidColorBrush* pBrush, ce::Double_Point st, ce::Doub
170170
//---------------------------------------------------------------------
171171
// メインウィンドウを描画
172172
//---------------------------------------------------------------------
173-
void draw_main(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd, LPRECT rect_sepr, ce::Direct2d_Window d2d_window)
173+
void draw_main(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd, LPRECT rect_sepr)
174174
{
175175
HDC hdc;
176176
static ID2D1SolidColorBrush* pBrush = NULL;
@@ -217,7 +217,7 @@ void draw_main(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd, LPRECT rect_sepr, ce::Di
217217
//---------------------------------------------------------------------
218218
// フッタパネルを描画
219219
//---------------------------------------------------------------------
220-
void draw_footer(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd, ce::Direct2d_Window* d2d_window)
220+
void draw_footer(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd)
221221
{
222222
HDC hdc;
223223
static ID2D1SolidColorBrush* pBrush = NULL;
@@ -259,7 +259,7 @@ void draw_panel_library(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd)
259259
//---------------------------------------------------------------------
260260
// エディタパネルを描画
261261
//---------------------------------------------------------------------
262-
void draw_panel_editor(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd, ce::Direct2d_Window* d2d_window)
262+
void draw_panel_editor(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd)
263263
{
264264
HDC hdc;
265265
static ID2D1SolidColorBrush* pBrush = NULL;
@@ -280,7 +280,7 @@ void draw_panel_editor(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd, ce::Direct2d_Win
280280
//---------------------------------------------------------------------
281281
// グラフパネルを描画
282282
//---------------------------------------------------------------------
283-
void draw_panel_graph(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd, ce::Direct2d_Window* d2d_window)
283+
void draw_panel_graph(HWND hwnd, HDC hdc_mem, LPRECT rect_wnd)
284284
{
285285
HDC hdc;
286286
static ID2D1SolidColorBrush* pBrush = NULL;

0 commit comments

Comments
 (0)