Rev 454 | Rev 459 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 454 | Rev 456 | ||
---|---|---|---|
Line 82... | Line 82... | ||
82 | MessageBoxA((HWND)p->hwnd, text, title, MB_TASKMODAL|MB_ICONINFORMATION|MB_OK); |
82 | MessageBoxA((HWND)p->hwnd, text, title, MB_TASKMODAL|MB_ICONINFORMATION|MB_OK); |
83 | } |
83 | } |
84 | 84 | ||
85 | Boolean simplealert(TCHAR* s){ |
85 | Boolean simplealert(TCHAR* s){ |
86 | HWND hwnd; |
86 | HWND hwnd; |
87 | TCHAR title[256]; |
87 | TCHAR title[256] = { 0 }; |
88 | if (gdata && gdata->standalone) { |
88 | if (gdata && gdata->standalone) { |
89 | #ifdef UNICODE |
89 | #ifdef UNICODE |
90 | mbstowcs(&title[0], (const char*)gdata->parm.szTitle, 256); |
90 | mbstowcs(&title[0], (const char*)gdata->parm.szTitle, 256); |
91 | #else |
91 | #else |
92 | strcpy(&title[0], gdata->parm.szTitle); |
92 | strcpy(&title[0], gdata->parm.szTitle); |
Line 99... | Line 99... | ||
99 | return MessageBox(hwnd, s, title, MB_TASKMODAL|MB_ICONERROR|MB_OK) == IDOK; |
99 | return MessageBox(hwnd, s, title, MB_TASKMODAL|MB_ICONERROR|MB_OK) == IDOK; |
100 | } |
100 | } |
101 | 101 | ||
102 | Boolean simplewarning(TCHAR* s) { |
102 | Boolean simplewarning(TCHAR* s) { |
103 | HWND hwnd; |
103 | HWND hwnd; |
104 | TCHAR title[256]; |
104 | TCHAR title[256] = { 0 }; |
105 | if (gdata && gdata->standalone) { |
105 | if (gdata && gdata->standalone) { |
106 | #ifdef UNICODE |
106 | #ifdef UNICODE |
107 | mbstowcs(&title[0], (const char*)gdata->parm.szTitle, 256); |
107 | mbstowcs(&title[0], (const char*)gdata->parm.szTitle, 256); |
108 | #else |
108 | #else |
109 | strcpy(&title[0], gdata->parm.szTitle); |
109 | strcpy(&title[0], gdata->parm.szTitle); |
Line 115... | Line 115... | ||
115 | return MessageBox(hwnd,s,title,MB_TASKMODAL|MB_ICONEXCLAMATION|MB_OK) == IDOK; |
115 | return MessageBox(hwnd,s,title,MB_TASKMODAL|MB_ICONEXCLAMATION|MB_OK) == IDOK; |
116 | } |
116 | } |
117 | 117 | ||
118 | Boolean showmessage(TCHAR *s) { |
118 | Boolean showmessage(TCHAR *s) { |
119 | HWND hwnd; |
119 | HWND hwnd; |
120 | TCHAR title[256]; |
120 | TCHAR title[256] = { 0 }; |
121 | if (gdata && gdata->standalone) { |
121 | if (gdata && gdata->standalone) { |
122 | #ifdef UNICODE |
122 | #ifdef UNICODE |
123 | mbstowcs(&title[0], (const char*)gdata->parm.szTitle, 256); |
123 | mbstowcs(&title[0], (const char*)gdata->parm.szTitle, 256); |
124 | #else |
124 | #else |
125 | strcpy(&title[0], gdata->parm.szTitle); |
125 | strcpy(&title[0], gdata->parm.szTitle); |
Line 224... | Line 224... | ||
224 | static Boolean panning = false; |
224 | static Boolean panning = false; |
225 | 225 | ||
226 | int item,i; |
226 | int item,i; |
227 | POINT newpos; |
227 | POINT newpos; |
228 | DRAWITEMSTRUCT *pdi; |
228 | DRAWITEMSTRUCT *pdi; |
229 | Point newscroll; |
229 | Point newscroll = { 0, 0 }; |
230 | HGDIOBJ hfnt; |
230 | HGDIOBJ hfnt; |
231 | 231 | ||
232 | extern Boolean doupdates; |
232 | extern Boolean doupdates; |
233 | extern Handle preview_handle; |
233 | extern Handle preview_handle; |
234 | 234 | ||
Line 236... | Line 236... | ||
236 | // This is for the PLUGIN.DLL sliders only |
236 | // This is for the PLUGIN.DLL sliders only |
237 | if (doupdates) { |
237 | if (doupdates) { |
238 | int sliderNum = (int)wParam - FIRSTCTLITEM; |
238 | int sliderNum = (int)wParam - FIRSTCTLITEM; |
239 | int sliderVal = (lParam & 0xFFFF); |
239 | int sliderVal = (lParam & 0xFFFF); |
240 | if (sliderVal < 0) sliderVal = 0; |
240 | if (sliderVal < 0) sliderVal = 0; |
241 | if (sliderVal > 255) sliderVal = 255; |
241 | else if (sliderVal > 255) sliderVal = 255; |
242 | slider[sliderNum] = sliderVal; |
242 | slider[sliderNum] = (uint8_t)sliderVal; |
243 | 243 | ||
244 | SETCTLTEXTINT(hDlg, FIRSTCTLTEXTITEM + sliderNum, sliderVal, false); |
244 | SETCTLTEXTINT(hDlg, FIRSTCTLTEXTITEM + sliderNum, sliderVal, false); |
245 | REPAINTCTL(hDlg, FIRSTCTLTEXTITEM + sliderNum); |
245 | REPAINTCTL(hDlg, FIRSTCTLTEXTITEM + sliderNum); |
246 | 246 | ||
247 | recalc_preview(gpb, hDlg); |
247 | recalc_preview(gpb, hDlg); |
Line 308... | Line 308... | ||
308 | for(i = 0; i < 4; ++i){ |
308 | for(i = 0; i < 4; ++i){ |
309 | SendDlgItemMessage(hDlg,FIRSTEXPRITEM+i, EM_SETLIMITTEXT,MAXEXPR-1,0); // we need 1 byte as NUL terminator, so our formula can be max 1023 |
309 | SendDlgItemMessage(hDlg,FIRSTEXPRITEM+i, EM_SETLIMITTEXT,MAXEXPR-1,0); // we need 1 byte as NUL terminator, so our formula can be max 1023 |
310 | SendDlgItemMessage(hDlg,FIRSTEXPRITEM+i, WM_SETFONT,(WPARAM)hfnt,false); |
310 | SendDlgItemMessage(hDlg,FIRSTEXPRITEM+i, WM_SETFONT,(WPARAM)hfnt,false); |
311 | } |
311 | } |
312 | 312 | ||
313 | maindlginit(hDlg); |
- | |
314 | - | ||
315 | // Some versions of Windows (NT 3.x) won't show the preview if it is calculated here. |
- | |
316 | // So we need to put it in a timer. |
- | |
317 | // Note that 1 millisecond is enough, even if the window needs longer than 1 millisecond to load. |
- | |
318 | //recalc_preview(gpb, hDlg); |
- | |
319 | SetTimer(hDlg, IDT_TIMER_INITPREVIEW_DRAW, 1, (TIMERPROC)NULL); |
- | |
320 | - | ||
321 | // Implement "up" and "down" keys for the edit controls |
313 | // Implement "up" and "down" keys for the edit controls |
322 | // TODO: Better use a spin-edit? |
314 | // TODO: Better use a spin-edit? |
323 | for (i = 0; i < 8; ++i) { |
315 | for (i = 0; i < 8; ++i) { |
324 | #ifdef _WIN64 |
316 | #ifdef _WIN64 |
325 | lpControlEditWndProc[i] = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, FIRSTCTLTEXTITEM + i), GWLP_WNDPROC, (LONG_PTR)&ControlTextWndProc); |
317 | lpControlEditWndProc[i] = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, FIRSTCTLTEXTITEM + i), GWLP_WNDPROC, (LONG_PTR)&ControlTextWndProc); |
326 | #else |
318 | #else |
327 | lpControlEditWndProc[i] = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, FIRSTCTLTEXTITEM + i), GWL_WNDPROC, (LONG_PTR)&ControlTextWndProc); |
319 | lpControlEditWndProc[i] = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, FIRSTCTLTEXTITEM + i), GWL_WNDPROC, (LONG_PTR)&ControlTextWndProc); |
328 | #endif |
320 | #endif |
329 | } |
321 | } |
330 | 322 | ||
- | 323 | maindlginit(hDlg); |
|
- | 324 | ||
- | 325 | // Some versions of Windows (NT 3.x) won't show the preview if it is calculated here. |
|
- | 326 | // So we need to put it in a timer. |
|
- | 327 | // Note that 1 millisecond is enough, even if the window needs longer than 1 millisecond to load. |
|
- | 328 | //recalc_preview(gpb, hDlg); |
|
- | 329 | SetTimer(hDlg, IDT_TIMER_INITPREVIEW_DRAW, 1, (TIMERPROC)NULL); |
|
- | 330 | ||
331 | break; |
331 | break; |
332 | case WM_DESTROY: |
332 | case WM_DESTROY: |
333 | gdata->hWndMainDlg = 0; |
333 | gdata->hWndMainDlg = 0; |
334 | DestroyCursor(hCurHandOpen); |
334 | DestroyCursor(hCurHandOpen); |
335 | DestroyCursor(hCurHandGrab); |
335 | DestroyCursor(hCurHandGrab); |