Skip to content

Commit 10e806f

Browse files
committed
アイコンを追加
1 parent 5e7215a commit 10e806f

File tree

10 files changed

+654
-789
lines changed

10 files changed

+654
-789
lines changed

curve_editor/ce_classes.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,29 @@ namespace ce {
178178
void move(LPRECT rect);
179179
virtual LRESULT wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
180180
};
181+
182+
183+
184+
//---------------------------------------------------------------------
185+
// グラフ表示
186+
//---------------------------------------------------------------------
187+
class Graph_View_Info {
188+
public:
189+
Float_Point origin;
190+
Double_Point scale;
191+
192+
void fit(LPRECT rect)
193+
{
194+
origin.x = CE_GR_PADDING;
195+
scale.x = ((double)rect->right - (int)(2 * CE_GR_PADDING)) / (double)CE_GR_RESOLUTION;
196+
if (rect->right <= rect->bottom) {
197+
origin.y = (rect->bottom + rect->right) * 0.5f - CE_GR_PADDING;
198+
scale.y = scale.x;
199+
}
200+
else {
201+
origin.y = (float)(rect->bottom - CE_GR_PADDING);
202+
scale.y = ((double)rect->bottom - (int)(2 * CE_GR_PADDING)) / (double)CE_GR_RESOLUTION;
203+
}
204+
}
205+
};
181206
}

curve_editor/ce_control.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ BOOL ce::Control::create(HWND hwnd_p, LPSTR name, LPTSTR ico_res, int ct_id, LPR
3131
tmp.lpszClassName = name;
3232

3333
if (RegisterClassEx(&tmp)) {
34-
hwnd = CreateWindowExA(
34+
hwnd = ::CreateWindowEx(
3535
NULL,
3636
name,
3737
NULL,
@@ -98,15 +98,15 @@ LRESULT ce::Control::wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
9898
{
9999
RECT rect_wnd;
100100

101-
GetClientRect(hwnd, &rect_wnd);
101+
::GetClientRect(hwnd, &rect_wnd);
102102

103103
switch (msg) {
104104
case WM_CREATE:
105105
canvas.init(hwnd);
106106

107-
hwnd_parent = GetParent(hwnd);
108-
107+
hwnd_parent = ::GetParent(hwnd);
109108

109+
icon = ::LoadIcon(g_fp->dll_hinst, icon_res);
110110

111111
tme.cbSize = sizeof(tme);
112112
tme.dwFlags = TME_LEAVE;
@@ -124,60 +124,60 @@ LRESULT ce::Control::wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
124124
ID2D1SolidColorBrush* pBrush = NULL;
125125

126126
if (clicked)
127-
bg = BRIGHTEN(g_theme[g_config.theme].bg_others, CE_CT_BR_CLICKED);
127+
bg = BRIGHTEN(g_theme[g_config.theme].bg, CE_CT_BR_CLICKED);
128128
else if (hovered)
129-
bg = BRIGHTEN(g_theme[g_config.theme].bg_others, CE_CT_BR_HOVERED);
129+
bg = BRIGHTEN(g_theme[g_config.theme].bg, CE_CT_BR_HOVERED);
130130
else
131-
bg = g_theme[g_config.theme].bg_others;
131+
bg = g_theme[g_config.theme].bg;
132132
d2d_setup(&canvas, &rect_wnd, bg);
133133

134-
if (g_render_target != NULL && g_d2d1_factory != NULL) {
135-
g_render_target->BeginDraw();
136-
if (pBrush == NULL)
137-
g_render_target->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &pBrush);
138-
g_render_target->EndDraw();
139-
}
134+
::DrawIcon(
135+
canvas.hdc_memory,
136+
(int)(rect_wnd.right * 0.5f - CE_ICON_SIZE * 0.5f),
137+
(int)(rect_wnd.bottom * 0.5f - CE_ICON_SIZE * 0.5f),
138+
icon
139+
);
140140

141141
canvas.transfer(&rect_wnd);
142142
return 0;
143143
}
144144

145145
// マウスが動いたとき
146146
case WM_MOUSEMOVE:
147-
SetCursor(LoadCursor(NULL, IDC_HAND));
147+
::SetCursor(LoadCursor(NULL, IDC_HAND));
148148
hovered = TRUE;
149-
InvalidateRect(hwnd, NULL, FALSE);
150-
TrackMouseEvent(&tme);
149+
::InvalidateRect(hwnd, NULL, FALSE);
150+
::TrackMouseEvent(&tme);
151151
return 0;
152152

153153
// 左クリックがされたとき
154154
case WM_LBUTTONDOWN:
155-
SetCursor(LoadCursor(NULL, IDC_HAND));
155+
::SetCursor(LoadCursor(NULL, IDC_HAND));
156156
clicked = TRUE;
157-
InvalidateRect(hwnd, NULL, FALSE);
158-
TrackMouseEvent(&tme);
157+
::InvalidateRect(hwnd, NULL, FALSE);
158+
::TrackMouseEvent(&tme);
159159
return 0;
160160

161161
// 左クリックが終わったとき
162162
case WM_LBUTTONUP:
163-
SetCursor(LoadCursor(NULL, IDC_HAND));
163+
::SetCursor(LoadCursor(NULL, IDC_HAND));
164164
clicked = FALSE;
165-
InvalidateRect(hwnd, NULL, FALSE);
165+
::InvalidateRect(hwnd, NULL, FALSE);
166166
SendMessage(hwnd_parent, WM_COMMAND, id, 0);
167167
return 0;
168168

169169
// マウスがウィンドウから離れたとき
170170
case WM_MOUSELEAVE:
171171
clicked = FALSE;
172172
hovered = FALSE;
173-
InvalidateRect(hwnd, NULL, FALSE);
173+
::InvalidateRect(hwnd, NULL, FALSE);
174174
return 0;
175175

176176
// コマンド
177177
case WM_COMMAND:
178178
switch (wparam) {
179179
case CE_CM_REDRAW:
180-
InvalidateRect(hwnd, NULL, FALSE);
180+
::InvalidateRect(hwnd, NULL, FALSE);
181181
return 0;
182182
}
183183
return 0;

0 commit comments

Comments
 (0)