ReactOS 0.4.15-dev-8235-gcd88a97
winmain.c
Go to the documentation of this file.
1/*
2 * ReactOS Calc (main program)
3 *
4 * Copyright 2007-2017, Carlo Bramini
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "calc.h"
22
23#define HTMLHELP_PATH(_pt) _T("%systemroot%\\Help\\calc.chm::") _T(_pt)
24
25#define MAKE_BITMASK4(_show_b16, _show_b10, _show_b8, _show_b2) \
26 (((_show_b2) << 0) | \
27 ((_show_b8) << 1) | \
28 ((_show_b10) << 2) | \
29 ((_show_b16) << 3))
30
31#define MAKE_BITMASK5(_transl, _is_stats, _is_ctrl, _show_b16, _show_b10, _show_b8, _show_b2) \
32 (((_show_b2) << 0) | \
33 ((_show_b8) << 1) | \
34 ((_show_b10) << 2) | \
35 ((_show_b16) << 3) | \
36 ((_is_ctrl) << 5) | \
37 ((_is_stats) << 6) | \
38 ((_transl) << 7))
39
40#define KEY_IS_UP 0x80000000
41#define KEY_WAS_DOWN 0x40000000
42
43#define BITMASK_IS_ASCII 0x80
44#define BITMASK_IS_STATS 0x40
45#define BITMASK_IS_CTRL 0x20
46#define BITMASK_HEX_MASK 0x08
47#define BITMASK_DEC_MASK 0x04
48#define BITMASK_OCT_MASK 0x02
49#define BITMASK_BIN_MASK 0x01
50
51#define CALC_CLR_RED RGB(0xFF, 0x00, 0x00)
52#define CALC_CLR_BLUE RGB(0x00, 0x00, 0xFF)
53#define CALC_CLR_PURP RGB(0xFF, 0x00, 0xFF)
54
55typedef struct {
56 CHAR key; // Virtual key identifier
57 WORD idc; // IDC for posting message
59
60typedef struct {
61 WORD idc; // IDC for posting message
62 CHAR key; // Virtual key identifier
63 BYTE mask; // enable/disable into the various modes.
64 COLORREF col; // color used for drawing the text
66
67#define CTRL_FLAG 0x100
68#define ALT_FLAG 0x200
69
70#define CTRL_A (0x0001+'A'-'A')
71#define CTRL_C (0x0001+'C'-'A')
72#define CTRL_D (0x0001+'D'-'A')
73#define CTRL_L (0x0001+'L'-'A')
74#define CTRL_M (0x0001+'M'-'A')
75#define CTRL_P (0x0001+'P'-'A')
76#define CTRL_R (0x0001+'R'-'A')
77#define CTRL_S (0x0001+'S'-'A')
78#define CTRL_T (0x0001+'T'-'A')
79#define CTRL_V (0x0001+'V'-'A')
80#define CTRL_Z (0x0001+'Z'-'A')
81
82static const key3code_t key2code[] = {
83 /* CONTROL-ID Key asc sta ctl hex dec oct bin */
84 { IDC_BUTTON_STA, CTRL_S, MAKE_BITMASK5( 1, 0, 1, 1, 1, 1, 1), CALC_CLR_BLUE, },
85 { IDC_BUTTON_AVE, CTRL_A, MAKE_BITMASK5( 1, 1, 1, 1, 1, 1, 1), CALC_CLR_BLUE, },
86 { IDC_BUTTON_SUM, CTRL_T, MAKE_BITMASK5( 1, 1, 1, 1, 1, 1, 1), CALC_CLR_BLUE, },
87 { IDC_BUTTON_S, CTRL_D, MAKE_BITMASK5( 1, 1, 1, 1, 1, 1, 1), CALC_CLR_BLUE, },
88 { IDC_BUTTON_MS, CTRL_M, MAKE_BITMASK5( 1, 0, 1, 1, 1, 1, 1), CALC_CLR_RED, },
89 { IDC_BUTTON_MR, CTRL_R, MAKE_BITMASK5( 1, 0, 1, 1, 1, 1, 1), CALC_CLR_RED, },
90 { IDC_BUTTON_MP, CTRL_P, MAKE_BITMASK5( 1, 0, 1, 1, 1, 1, 1), CALC_CLR_RED, },
91 { IDC_BUTTON_MC, CTRL_L, MAKE_BITMASK5( 1, 0, 1, 1, 1, 1, 1), CALC_CLR_RED, },
92 { IDC_BUTTON_0, '0', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_BLUE, },
93 { IDC_BUTTON_1, '1', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_BLUE, },
94 { IDC_BUTTON_2, '2', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 0), CALC_CLR_BLUE, },
95 { IDC_BUTTON_3, '3', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 0), CALC_CLR_BLUE, },
96 { IDC_BUTTON_4, '4', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 0), CALC_CLR_BLUE, },
97 { IDC_BUTTON_5, '5', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 0), CALC_CLR_BLUE, },
98 { IDC_BUTTON_6, '6', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 0), CALC_CLR_BLUE, },
99 { IDC_BUTTON_7, '7', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 0), CALC_CLR_BLUE, },
100 { IDC_BUTTON_8, '8', MAKE_BITMASK5( 1, 0, 0, 1, 1, 0, 0), CALC_CLR_BLUE, },
101 { IDC_BUTTON_9, '9', MAKE_BITMASK5( 1, 0, 0, 1, 1, 0, 0), CALC_CLR_BLUE, },
102 { IDC_BUTTON_DOT, '.', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_BLUE, },
103 { IDC_BUTTON_DOT, ',', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), -1, },
104 { IDC_BUTTON_ADD, '+', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
105 { IDC_BUTTON_SUB, '-', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
106 { IDC_BUTTON_MULT, '*', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
107 { IDC_BUTTON_DIV, '/', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
108 { IDC_BUTTON_AND, '&', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
109 { IDC_BUTTON_OR, '|', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
110 { IDC_BUTTON_XOR, '^', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
111 { IDC_BUTTON_LSH, '<', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
112 { IDC_BUTTON_NOT, '~', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
113 { IDC_BUTTON_INT, ';', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_RED, },
114 { IDC_BUTTON_EQU, '=', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
115 { IDC_BUTTON_A, 'A', MAKE_BITMASK5( 1, 0, 0, 1, 0, 0, 0), CALC_CLR_BLUE, },
116 { IDC_BUTTON_B, 'B', MAKE_BITMASK5( 1, 0, 0, 1, 0, 0, 0), CALC_CLR_BLUE, },
117 { IDC_BUTTON_C, 'C', MAKE_BITMASK5( 1, 0, 0, 1, 0, 0, 0), CALC_CLR_BLUE, },
118 { IDC_BUTTON_D, 'D', MAKE_BITMASK5( 1, 0, 0, 1, 0, 0, 0), CALC_CLR_BLUE, },
119 { IDC_BUTTON_E, 'E', MAKE_BITMASK5( 1, 0, 0, 1, 0, 0, 0), CALC_CLR_BLUE, },
120 { IDC_BUTTON_F, 'F', MAKE_BITMASK5( 1, 0, 0, 1, 0, 0, 0), CALC_CLR_BLUE, },
121 { IDC_CHECK_HYP, 'H', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), -1, },
122 { IDC_CHECK_INV, 'I', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), -1, },
123 { IDC_BUTTON_LOG, 'L', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
124 { IDC_BUTTON_DMS, 'M', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
125 { IDC_BUTTON_LN, 'N', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
126 { IDC_BUTTON_PI, 'P', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_BLUE, },
127 { IDC_BUTTON_RX, 'R', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
128 { IDC_BUTTON_SIN, 'S', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
129 { IDC_BUTTON_COS, 'O', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
130 { IDC_BUTTON_TAN, 'T', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
131 { IDC_BUTTON_FE, 'V', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
132 { IDC_BUTTON_EXP, 'X', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_PURP, },
133 { IDC_BUTTON_XeY, 'Y', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_PURP, },
134 { IDC_BUTTON_SQRT, '@', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_BLUE, },
135 { IDC_BUTTON_Xe2, '@', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_PURP, },
136 { IDC_BUTTON_Xe3, '#', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_PURP, },
137 { IDC_BUTTON_NF, '!', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_PURP, },
138 { IDC_BUTTON_LEFTPAR, '(', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_PURP, },
139 { IDC_BUTTON_RIGHTPAR, ')', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_PURP, },
140 { IDC_BUTTON_MOD, '%', MAKE_BITMASK5( 1, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
141 { IDC_BUTTON_PERCENT, '%', MAKE_BITMASK5( 1, 0, 0, 0, 1, 0, 0), CALC_CLR_BLUE, },
142 /*----------------------------------------------------------------------*/
143 { IDC_BUTTON_DAT, VK_INSERT, MAKE_BITMASK5( 0, 1, 0, 1, 1, 1, 1), CALC_CLR_BLUE, },
144 { IDC_BUTTON_EQU, VK_RETURN, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
145 { IDC_BUTTON_CANC, VK_ESCAPE, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
146 { IDC_BUTTON_CE, VK_DELETE, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
147 { IDC_BUTTON_BACK, VK_BACK, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), CALC_CLR_RED, },
148 { IDC_RADIO_HEX, VK_F5, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), -1, },
149 { IDC_RADIO_DEC, VK_F6, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), -1, },
150 { IDC_RADIO_OCT, VK_F7, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), -1, },
151 { IDC_RADIO_BIN, VK_F8, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), -1, },
152 { IDC_BUTTON_SIGN, VK_F9, MAKE_BITMASK5( 0, 0, 0, 1, 1, 1, 1), CALC_CLR_BLUE, },
153};
154
155static const key2code_t key2code_base16[] = {
157 { VK_F3, IDC_RADIO_WORD, },
158 { VK_F4, IDC_RADIO_BYTE, },
160};
161
162static const key2code_t key2code_base10[] = {
163 { VK_F2, IDC_RADIO_DEG, },
164 { VK_F3, IDC_RADIO_RAD, },
165 { VK_F4, IDC_RADIO_GRAD, },
166};
167
168static const WORD operator_codes[] = {
169 /* CONTROL-ID operator */
170 (WORD)IDC_STATIC, // RPN_OPERATOR_PARENT
171 IDC_BUTTON_PERCENT, // RPN_OPERATOR_PERCENT
172 IDC_BUTTON_EQU, // RPN_OPERATOR_EQUAL
173 IDC_BUTTON_OR, // RPN_OPERATOR_OR
174 IDC_BUTTON_XOR, // RPN_OPERATOR_XOR
175 IDC_BUTTON_AND, // RPN_OPERATOR_AND
176 IDC_BUTTON_LSH, // RPN_OPERATOR_LSH
177 IDC_BUTTON_RSH, // RPN_OPERATOR_RSH
178 IDC_BUTTON_ADD, // RPN_OPERATOR_ADD
179 IDC_BUTTON_SUB, // RPN_OPERATOR_SUB
180 IDC_BUTTON_MULT, // RPN_OPERATOR_MULT
181 IDC_BUTTON_DIV, // RPN_OPERATOR_DIV
182 IDC_BUTTON_MOD, // RPN_OPERATOR_MOD
183 IDC_BUTTON_XeY, // RPN_OPERATOR_POW
184 IDC_BUTTON_XrY, // RPN_OPERATOR_SQR
185};
186
188
189typedef struct {
198
199static void run_fe(calc_number_t *number);
200static void run_dat_sta(calc_number_t *number);
201static void run_mp(calc_number_t *c);
202static void run_mm(calc_number_t *c);
203static void run_ms(calc_number_t *c);
204static void run_mw(calc_number_t *c);
205static void run_canc(calc_number_t *c);
206static void run_rpar(calc_number_t *c);
207static void run_lpar(calc_number_t *c);
208
214 { IDC_BUTTON_RX, 0, 1, rpn_reci, NULL, NULL, NULL },
215 { IDC_BUTTON_NOT, 0, 1, rpn_not, NULL, NULL, NULL },
221 { IDC_BUTTON_NF, 0, 1, rpn_fact, NULL, NULL, NULL },
227 { IDC_BUTTON_FE, 0, 1, run_fe, NULL, NULL, NULL },
228 { IDC_BUTTON_DAT, 0, 1, run_dat_sta, NULL, NULL, NULL, },
234};
235
236/* Sub-classing information for theming support */
237typedef struct{
241
242
243/*
244 * Global variable declaration
245 */
246
248
249/* Hot-state info for theming support */
252
253static void UpdateNumberIntl(void)
254{
255 /* Get current user defaults */
257 StringCbCopy(calc.sDecimal, sizeof(calc.sDecimal), _T("."));
258
260 StringCbCopy(calc.sThousand, sizeof(calc.sThousand), _T(","));
261
262 /* get the string lengths */
265}
266
267static int LoadRegInt(LPCTSTR lpszApp, LPCTSTR lpszKey, int iDefault)
268{
269 HKEY hKey;
270 int iValue;
271 DWORD tmp;
272
274 {
275 /* Try to load integer value */
276 tmp = sizeof(int);
277
278 if (RegQueryValueEx(hKey, lpszKey, NULL, NULL, (LPBYTE)&iValue, &tmp) == ERROR_SUCCESS)
279 iDefault = iValue;
280
281 /* close the key */
283 }
284
285 return iDefault;
286}
287
288static void SaveRegInt(LPCTSTR lpszApp, LPCTSTR lpszKey, int iValue)
289{
290 HKEY hKey;
291
293 {
294 RegSetValueEx(hKey, lpszKey, 0, REG_DWORD, (const BYTE*)&iValue, sizeof(int));
295
296 /* close the key */
298 }
299}
300
301static void load_config(void)
302{
304
305 osvi.dwOSVersionInfoSize = sizeof(osvi);
307
308 switch (osvi.dwPlatformId) {
311 /* Try to load last selected layout */
312 calc.layout = GetProfileInt(_T("SciCalc"), _T("layout"), CALC_LAYOUT_STANDARD);
313
314 /* Try to load last selected formatting option */
315 calc.usesep = (GetProfileInt(_T("SciCalc"), _T("UseSep"), FALSE)) ? TRUE : FALSE;
316 break;
317
318 default: /* VER_PLATFORM_WIN32_NT */
319 /* Try to load last selected layout */
320 calc.layout = LoadRegInt(_T("SOFTWARE\\Microsoft\\Calc"), _T("layout"), CALC_LAYOUT_STANDARD);
321
322 /* Try to load last selected formatting option */
323 calc.usesep = (LoadRegInt(_T("SOFTWARE\\Microsoft\\Calc"), _T("UseSep"), FALSE)) ? TRUE : FALSE;
324 break;
325 }
326
327 /* memory is empty at startup */
329
330 /* Get locale info for numbers */
332}
333
334static void save_config(void)
335{
336 TCHAR buf[32];
338
339 osvi.dwOSVersionInfoSize = sizeof(osvi);
341
342 switch (osvi.dwPlatformId) {
345 StringCbPrintf(buf, sizeof(buf), _T("%lu"), calc.layout);
346 WriteProfileString(_T("SciCalc"), _T("layout"), buf);
347 WriteProfileString(_T("SciCalc"), _T("UseSep"), (calc.usesep==TRUE) ? _T("1") : _T("0"));
348 break;
349
350 default: /* VER_PLATFORM_WIN32_NT */
351 SaveRegInt(_T("SOFTWARE\\Microsoft\\Calc"), _T("layout"), calc.layout);
352 SaveRegInt(_T("SOFTWARE\\Microsoft\\Calc"), _T("UseSep"), calc.usesep);
353 break;
354 }
355}
356
358{
359 HWND hCtlWnd = GetDlgItem(calc.hWnd,idc);
360 TCHAR ClassName[64];
361
362 /* check if the key is enabled! */
363 if (!IsWindowEnabled(hCtlWnd))
364 return 1;
365
366 if (!GetClassName(hCtlWnd, ClassName, SIZEOF(ClassName)))
367 return 1;
368
369 if (!_tcscmp(ClassName, WC_BUTTON)) {
370 DWORD dwStyle = GetWindowLongPtr(hCtlWnd, GWL_STYLE) & 0xF;
371
372 /* Set states for press/release, but only for push buttons */
373 if (dwStyle == BS_PUSHBUTTON || dwStyle == BS_DEFPUSHBUTTON || dwStyle == BS_OWNERDRAW) {
374 if (!(lParam & KEY_WAS_DOWN)) {
375 PostMessage(hCtlWnd, BM_SETSTATE, 1, 0);
376 } else
377 if ((lParam & KEY_IS_UP)) {
378 PostMessage(hCtlWnd, BM_SETSTATE, 0, 0);
379 PostMessage(hCtlWnd, BM_CLICK, 0, 0);
380 }
381 return 1;
382 }
383 }
384 /* default action: simple click event at key release */
385 if ((lParam & KEY_IS_UP)) {
386 PostMessage(hCtlWnd, BM_CLICK, 0, 0);
387 }
388 return 1;
389}
390
391static int vk2ascii(unsigned int vk)
392{
393 unsigned short int s;
394 int scan;
395 BYTE state[256];
397
399 return 0;
400
401 scan=MapVirtualKeyEx(vk, 0, layout);
402 s = 0;
403 if (ToAsciiEx(vk, scan, state, &s, 0, layout)>0) {
404 /* convert to upper case */
405 if (s >= 'a' && s <= 'z')
406 s = s - 'a' + 'A';
407 /* add check to CTRL key */
408 if (vk >= 'A' && vk <= 'Z' &&
409 s >= CTRL_A && s <= CTRL_Z)
410 s |= CTRL_FLAG;
411 else
412 if (GetAsyncKeyState(VK_MENU) < 0)
413 s |= ALT_FLAG;
414 return s;
415 }
416 return 0;
417}
418
420{
421 const key2code_t *k;
422 unsigned int x;
423 unsigned short int ch;
424
425 ch = vk2ascii(LOWORD(wParam));
426 if ((lParam & KEY_IS_UP)) {
427 /* Test for "copy" to clipboard */
428 if (ch == (CTRL_C|CTRL_FLAG)) {
430 return 1;
431 }
432 /* Test for "paste" from clipboard */
433 if (ch == (CTRL_V|CTRL_FLAG)) {
435 return 1;
436 }
437 /* Test of help menu */
438 if (LOWORD(wParam) == VK_F1) {
440 return 1;
441 }
442 }
443
444 for (x=0; x<SIZEOF(key2code); x++) {
445 int key = key2code[x].key;
447 key |= CTRL_FLAG;
448 if ((key == ch && (key2code[x].mask & BITMASK_IS_ASCII)) ||
450 ) {
452 continue;
453 return post_key_press(lParam, key2code[x].idc);
454 }
455 }
457 if (calc.base == IDC_RADIO_DEC) {
460 } else {
463 }
464 do {
465 if (k->key == LOWORD(wParam)) {
466 return post_key_press(lParam, k->idc);
467 }
468 k++;
469 } while (--x);
470 }
471 return 0;
472}
473
474#ifdef USE_KEYBOARD_HOOK
475static LRESULT CALLBACK
477{
478 if(nCode<0 || calc.is_menu_on)
479 return CallNextHookEx(calc.hKeyboardHook,nCode,wParam,lParam);
480
481 if(nCode==HC_ACTION)
483 return;
484
485 return CallNextHookEx(calc.hKeyboardHook,nCode,wParam,lParam);
486}
487#endif
488
490{
491 /*
492 * multiply size of calc.buffer by 2 because it may
493 * happen that separator is used between each digit.
494 * Also added little additional space for dot and '\0'.
495 */
496 TCHAR tmp[MAX_CALC_SIZE * 2 + 2];
497
498 if (calc.buffer[0] == _T('\0'))
499 StringCbCopy(tmp, sizeof(tmp), _T("0"));
500 else
501 StringCbCopy(tmp, sizeof(tmp), calc.buffer);
502
503 /* Add final '.' in decimal mode (if it's missing), but
504 * only if it's a result: no append if it prints "ERROR".
505 */
506 if (calc.base == IDC_RADIO_DEC && !calc.is_nan) {
507 if (_tcschr(tmp, _T('.')) == NULL)
508 StringCbCat(tmp, sizeof(tmp), _T("."));
509 }
510 /* if separator mode is on, let's add an additional space */
511 if (calc.usesep && !calc.sci_in && !calc.sci_out && !calc.is_nan) {
512 /* go to the integer part of the string */
513 TCHAR *p = _tcschr(tmp, _T('.'));
514 TCHAR *e = _tcschr(tmp, _T('\0'));
515 int n=0, t;
516
517 if (p == NULL) p = e;
518 switch (calc.base) {
519 case IDC_RADIO_HEX:
520 case IDC_RADIO_BIN:
521 t = 4;
522 break;
523 default:
524 /* fall here for:
525 IDC_RADIO_DEC:
526 IDC_RADIO_OCT: */
527 t = 3;
528 break;
529 }
530 while (--p > tmp) {
531 if (++n == t && *(p-1) != _T('-')) {
532 memmove(p+1, p, (e-p+1)*sizeof(TCHAR));
533 e++;
534 *p = _T(' ');
535 n = 0;
536 }
537 }
538 /* if decimal mode, apply regional settings */
539 if (calc.base == IDC_RADIO_DEC) {
540 TCHAR *p = tmp;
541 TCHAR *e = _tcschr(tmp, _T('.'));
542
543 /* searching for thousands default separator */
544 while (p < e) {
545 if (*p == _T(' ')) {
546 memmove(p+calc.sThousand_len, p+1, _tcslen(p)*sizeof(TCHAR));
549 } else
550 p++;
551 }
552 /* update decimal point too. */
553 memmove(p+calc.sDecimal_len, p+1, _tcslen(p)*sizeof(TCHAR));
555 }
556 } else {
557 TCHAR *p = _tcschr(tmp, _T('.'));
558
559 /* update decimal point when usesep is false */
560 if (p != NULL) {
561 memmove(p+calc.sDecimal_len, p+1, _tcslen(p)*sizeof(TCHAR));
563 }
564 }
566}
567
569{
570 TCHAR str[8];
571 int n = eval_parent_count();
572
573 if (!n)
574 str[0] = _T('\0');
575 else
576 StringCbPrintf(str, sizeof(str), _T("(=%d"), n);
578}
579
580static void build_operand(HWND hwnd, DWORD idc)
581{
582 unsigned int i = 0, n;
583 size_t cbPtr;
584
585 if (idc == IDC_BUTTON_DOT) {
586 /* if dot is the first char, it's added automatically */
587 if (calc.buffer == calc.ptr) {
588 *calc.ptr++ = _T('0');
589 *calc.ptr++ = _T('.');
590 *calc.ptr = _T('\0');
592 return;
593 }
594 /* if pressed dot and it's already in the string, then return */
595 if (_tcschr(calc.buffer, _T('.')) != NULL)
596 return;
597 }
598 if (idc != IDC_STATIC) {
599 while (idc != key2code[i].idc) i++;
600 }
601 n = calc.ptr - calc.buffer;
602 if (idc == IDC_BUTTON_0 && n == 0) {
603 /* no need to put the dot because it's handled by update_lcd_display() */
604 calc.buffer[0] = _T('0');
605 calc.buffer[1] = _T('\0');
607 return;
608 }
609 switch (calc.base) {
610 case IDC_RADIO_HEX:
611 if (n >= 16)
612 return;
613 break;
614 case IDC_RADIO_DEC:
615 if (n >= SIZEOF(calc.buffer)-1)
616 return;
617 if (calc.sci_in) {
618 if (idc != IDC_STATIC)
619 calc.esp = (calc.esp * 10 + (key2code[i].key-'0')) % LOCAL_EXP_SIZE;
620 if (calc.ptr == calc.buffer)
621 StringCbPrintf(calc.ptr, sizeof(calc.buffer), _T("0.e%+d"), calc.esp);
622 else {
623 /* adds the dot at the end if the number has no decimal part */
624 if (!_tcschr(calc.buffer, _T('.')))
625 *calc.ptr++ = _T('.');
626
627 cbPtr = sizeof(calc.buffer) - ((BYTE*)calc.ptr - (BYTE*)calc.buffer);
628 StringCbPrintf(calc.ptr, cbPtr, _T("e%+d"), calc.esp);
629 }
631 return;
632 }
633 break;
634 case IDC_RADIO_OCT:
635 if (n >= 22)
636 return;
637 break;
638 case IDC_RADIO_BIN:
639 if (n >= 64)
640 return;
641 break;
642 }
643
644 cbPtr = sizeof(calc.buffer) - ((BYTE*)calc.ptr - (BYTE*)calc.buffer);
646 _T("%C"), key2code[i].key);
647
649}
650
652{
653 if (calc.is_nan) {
656 return;
657 }
659}
660
662{
663 calc.sci_in = FALSE;
668}
669
671{
672 set_rpn_result(hwnd, rpn);
674}
675
677{
678 int modifiers = 0;
679
681 modifiers |= MODIFIER_INV;
683 modifiers |= MODIFIER_HYP;
684
685 return modifiers;
686}
687
689{
690 /* if the screen output buffer is empty, then */
691 /* the operand is taken from the last input */
692 if (calc.buffer == calc.ptr) {
693 /* if pushed valued is ZERO then we should grab it */
694 if (!_tcscmp(calc.buffer, _T("0.")) ||
695 !_tcscmp(calc.buffer, _T("0")))
696 /* this zero is good for both integer and decimal */
697 rpn_zero(a);
698 else
699 rpn_copy(a, &calc.code);
700 return;
701 }
702 /* ZERO is the default value for all numeric bases */
703 rpn_zero(a);
705}
706
707static const struct _update_check_menus {
711} upd[] = {
715 /*-----------------------------------------*/
720 /*-----------------------------------------*/
724 /*-----------------------------------------*/
730
732{
733 HMENU hMenu = GetSubMenu(GetMenu(hWnd), 1);
734 unsigned int x;
735
736 for (x=0; x<SIZEOF(upd); x++) {
737 if (*(upd[x].sel) != upd[x].idc) {
740 } else {
743 }
744 }
746}
747
748typedef struct {
752
753static const radio_config_t radio_setup[] = {
754 /* CONTROL-ID hex dec oct bin */
755 { IDC_RADIO_QWORD, MAKE_BITMASK4( 1, 0, 1, 1) },
756 { IDC_RADIO_DWORD, MAKE_BITMASK4( 1, 0, 1, 1) },
757 { IDC_RADIO_WORD, MAKE_BITMASK4( 1, 0, 1, 1) },
758 { IDC_RADIO_BYTE, MAKE_BITMASK4( 1, 0, 1, 1) },
759 { IDC_RADIO_DEG, MAKE_BITMASK4( 0, 1, 0, 0) },
760 { IDC_RADIO_RAD, MAKE_BITMASK4( 0, 1, 0, 0) },
761 { IDC_RADIO_GRAD, MAKE_BITMASK4( 0, 1, 0, 0) },
762};
763
765{
766 BYTE mask;
767 int n;
768
769 switch (base) {
770 case IDC_RADIO_DEC:
772 break;
773 case IDC_RADIO_HEX:
775 break;
776 case IDC_RADIO_OCT:
778 break;
779 case IDC_RADIO_BIN:
781 break;
782 default:
783 return;
784 }
785 for (n=0; n<SIZEOF(key2code); n++) {
786 if (key2code[n].mask != 0) {
787 HWND hCtlWnd = GetDlgItem(hwnd, key2code[n].idc);
789
792 else
793 current = (key2code[n].mask & mask) ? TRUE : FALSE;
794 if (IsWindowEnabled(hCtlWnd) != current)
795 EnableWindow(hCtlWnd, current);
796 }
797 }
798}
799
800static void update_radio(HWND hwnd, unsigned int base)
801{
802 HMENU hMenu;
803 LPCTSTR lpMenuId;
804 WORD mask;
805 int n;
806
807 switch (base) {
808 case IDC_RADIO_DEC:
811 break;
812 case IDC_RADIO_HEX:
815 break;
816 case IDC_RADIO_OCT:
819 break;
820 case IDC_RADIO_BIN:
823 break;
824 default:
825 return;
826 }
827
828 if (calc.base != base) {
831 calc.base = base;
833
834 hMenu = GetMenu(hwnd);
835 DestroyMenu(hMenu);
836 hMenu = LoadMenu(calc.hInstance, lpMenuId);
837 SetMenu(hwnd, hMenu);
839
840 for (n=0; n<SIZEOF(radio_setup); n++)
842
844 }
845
847
848 if (base == IDC_RADIO_DEC)
850 else
852}
853
854static void update_memory_flag(HWND hWnd, BOOL mem_flag)
855{
856 calc.is_memory = mem_flag;
857 SetDlgItemText(hWnd, IDC_TEXT_MEMORY, mem_flag ? _T("M") : _T(""));
858}
859
860static void update_n_stats_items(HWND hWnd, TCHAR *buffer, size_t cbBuffer)
861{
862 unsigned int n = SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_GETCOUNT, 0, 0);
863
864 StringCbPrintf(buffer, cbBuffer, _T("n=%u"), n);
866}
867
868static void clean_stat_list(void)
869{
871
872 while (p != NULL) {
873 statistic_t *s = p;
874 p = (statistic_t *)(p->next);
875 rpn_free(&s->num);
876 free(s);
877 }
878 calc.stat = p;
879}
880
881static void delete_stat_item(int n)
882{
884 statistic_t *s;
885
886 if (n == 0) {
887 calc.stat = (statistic_t *)p->next;
888 rpn_free(&p->num);
889 free(p);
890 } else {
891 s = (statistic_t *)p->next;
892 while (--n) {
893 p = s;
894 s = (statistic_t *)p->next;
895 }
896 p->next = s->next;
897 rpn_free(&s->num);
898 free(s);
899 }
900}
901
902static char *ReadConversion(const char *formula)
903{
904 size_t len = strlen(formula);
905 char *str = (char *)malloc(len+3);
906
907 if (str == NULL)
908 return NULL;
909
910 str[0] = '(';
911 memcpy(str+1, formula, len);
912 str[len+1] = ')';
913 str[len+2] = '\0';
914
915 StringCbCopy(calc.source, sizeof(calc.source), (*calc.buffer == _T('\0')) ? _T("0") : calc.buffer);
916
917 /* clear display content before proceeding */
919 calc.buffer[0] = _T('\0');
920
921 return str;
922}
923
925{
927 DWORD n;
928
929 switch (msg) {
930 case WM_INITDIALOG:
931 return TRUE;
932 case WM_COMMAND:
933 switch (LOWORD(wp)) {
934 case IDC_LIST_STAT:
935 if (HIWORD(wp) == CBN_DBLCLK)
937 return TRUE;
938 case IDC_BUTTON_RET:
940 return TRUE;
941 case IDC_BUTTON_LOAD:
943 if (n == LB_ERR)
944 return TRUE;
946 return TRUE;
947 case IDC_BUTTON_CD:
949 if (n == LB_ERR)
950 return TRUE;
954 return TRUE;
955 case IDC_BUTTON_CAD:
959 return TRUE;
960 }
961 break;
962 case WM_CLOSE:
964 return TRUE;
965 case WM_DESTROY:
968 return TRUE;
969 case WM_INSERT_STAT:
972 ((statistic_t *)lp)->base);
975 return TRUE;
976 }
977 return FALSE;
978}
979
980static WPARAM idm_2_idc(int idm)
981{
982 int x;
983
984 for (x=0; x<SIZEOF(upd); x++) {
985 if (upd[x].idm == idm)
986 break;
987 }
988 return (WPARAM)(upd[x].idc);
989}
990
991static void CopyMemToClipboard(void *ptr)
992{
993 if(OpenClipboard(NULL)) {
994 HGLOBAL clipbuffer;
995 TCHAR *buffer;
996 size_t cbBuffer;
997
999 cbBuffer = (_tcslen(ptr) + 1) * sizeof(TCHAR);
1000 clipbuffer = GlobalAlloc(GMEM_DDESHARE, cbBuffer);
1001 buffer = (TCHAR *)GlobalLock(clipbuffer);
1002 StringCbCopy(buffer, cbBuffer, ptr);
1003 GlobalUnlock(clipbuffer);
1004#ifdef UNICODE
1005 SetClipboardData(CF_UNICODETEXT,clipbuffer);
1006#else
1007 SetClipboardData(CF_TEXT,clipbuffer);
1008#endif
1010 }
1011}
1012
1014{
1016 UINT n;
1017
1019
1020 if (calc.base == IDC_RADIO_DEC && _tcschr(calc.buffer, _T('.')) == NULL)
1021 display[n - calc.sDecimal_len] = _T('\0');
1022
1024}
1025
1026static char *ReadClipboard(void)
1027{
1028 char *buffer = NULL;
1029
1030 if (OpenClipboard(NULL)) {
1032 char *fromClipboard;
1033
1034 if (hData != NULL) {
1035 fromClipboard = (char *)GlobalLock(hData);
1036 if (fromClipboard[0])
1037 buffer = _strupr(_strdup(fromClipboard));
1038 GlobalUnlock( hData );
1039 }
1041 }
1042 return buffer;
1043}
1044
1046{
1047 char *ptr = seq->ptr;
1048 int ch, x;
1049
1050 ch = *ptr++;
1051 if (ch == '\\')
1053 else
1054 if (ch == ':') {
1055 ch = *ptr;
1056 if (ch != '\0')
1057 ptr++;
1058 switch (ch) {
1059 case 'C': PostMessage(hwnd, WM_COMMAND, (WPARAM)IDC_BUTTON_MC, 0); break;
1060 case 'E': PostMessage(hwnd, WM_COMMAND, (WPARAM)IDC_BUTTON_EXP,0); break;
1061 case 'M': PostMessage(hwnd, WM_COMMAND, (WPARAM)IDC_BUTTON_MS, 0); break;
1062 case 'P': PostMessage(hwnd, WM_COMMAND, (WPARAM)IDC_BUTTON_MP, 0); break;
1063 case 'Q': PostMessage(hwnd, WM_COMMAND, (WPARAM)IDC_BUTTON_CANC, 0); break;
1064 case 'R': PostMessage(hwnd, WM_COMMAND, (WPARAM)IDC_BUTTON_MR, 0); break;
1065 }
1066 } else
1067 if (ch == '$') {
1070 } else {
1071 for (x=0; x<SIZEOF(key2code); x++) {
1072 if (!(key2code[x].mask & BITMASK_IS_ASCII) ||
1074 continue;
1075 if (key2code[x].key == ch) {
1077 break;
1078 }
1079 }
1080 }
1081
1082 if (*ptr != '\0')
1083 {
1084 seq->ptr = ptr;
1085 PostMessage(hwnd, seq->wm_msg, 0, 0);
1086 } else {
1087 free(seq->data);
1088 seq->data = seq->ptr = ptr = NULL;
1089 }
1090 return ptr;
1091}
1092
1094{
1097
1098 rpn_alloc(&s->num);
1099 rpn_copy(&s->num, a);
1100 s->base = calc.base;
1101 s->next = NULL;
1102 if (p == NULL)
1103 calc.stat = s;
1104 else {
1105 while (p->next != NULL)
1106 p = (statistic_t *)(p->next);
1107 p->next = s;
1108 }
1110}
1111
1113{
1115
1116 cn.number = *c;
1117 cn.base = calc.base;
1120}
1121
1123{
1125
1126 cn.number = *c;
1127 cn.base = calc.base;
1130}
1131
1133{
1137}
1138
1140{
1141 calc_number_t tmp;
1142
1143 rpn_copy(&tmp, &calc.memory.number);
1146 if (calc.is_memory)
1147 rpn_copy(c, &tmp);
1149}
1150
1152{
1154
1155 if (p == NULL)
1156 return p;
1157
1158 while (n--) {
1159 p = (statistic_t *)(p->next);
1160 if (p == NULL)
1161 return p;
1162 }
1163
1164#ifndef ENABLE_MULTI_PRECISION
1165 if (calc.base != p->base) {
1166 if (calc.base == IDC_RADIO_DEC)
1167 calc.code.f = (double)p->num.i;
1168 else {
1169 calc.code.i = (__int64)p->num.f;
1171 }
1172 } else
1173#endif
1174 rpn_copy(&calc.code, &p->num);
1175
1176 calc.is_nan = FALSE;
1177
1178 return p;
1179}
1180
1182{
1183 calc.sci_out = ((calc.sci_out != FALSE) ? FALSE : TRUE);
1184}
1185
1187{
1188 TCHAR text[64];
1189 HMENU hMenu = CreatePopupMenu();
1190 BOOL idm;
1191
1194 idm = TrackPopupMenu( hMenu,
1196 LOWORD(lp),
1197 HIWORD(lp),
1198 0,
1199 hWnd,
1200 NULL);
1201 DestroyMenu(hMenu);
1202#ifndef DISABLE_HTMLHELP_SUPPORT
1203 if (idm) {
1204 HH_POPUP popup;
1205
1206 memset(&popup, 0, sizeof(popup));
1207 popup.cbStruct = sizeof(HH_POPUP);
1208 popup.clrForeground = 1;
1209 popup.clrBackground = -1;
1210 popup.pt.x = LOWORD(lp);
1211 popup.pt.y = HIWORD(lp);
1212 popup.rcMargins.top = -1;
1213 popup.rcMargins.bottom = -1;
1214 popup.rcMargins.left = -1;
1215 popup.rcMargins.right = -1;
1216 popup.idString = GetWindowLongPtr((HWND)wp, GWL_ID);
1217 calc_HtmlHelp((HWND)wp, HTMLHELP_PATH("/popups.txt"), HH_DISPLAY_TEXT_POPUP, (DWORD_PTR)&popup);
1218 }
1219#else
1220 (void)idm;
1221#endif
1222}
1223
1225{
1226 flush_postfix();
1227 rpn_zero(c);
1228
1229 /* clear also scientific display modes */
1230 calc.sci_out = FALSE;
1231 calc.sci_in = FALSE;
1232
1233 /* clear state of inv and hyp flags */
1236}
1237
1239{
1241}
1242
1244{
1246}
1247
1249{
1251 UINT dwText;
1252 TCHAR text[64];
1253 int dx, dy, len;
1254 SIZE size;
1255 POINT pt;
1256
1257 if(dis->CtlType == ODT_BUTTON)
1258 {
1259 HTHEME hTheme = NULL;
1260 LPBTNINFO lpBtnInfo;
1261
1263 hTheme = calc_OpenThemeData(hWnd, L"Button");
1264
1265 if (hTheme)
1266 {
1267 int iState = 0;
1268
1269 if ((dis->itemState & ODS_DISABLED))
1270 iState |= PBS_DISABLED;
1271 if ((dis->itemState & ODS_SELECTED))
1272 iState |= PBS_PRESSED;
1273
1275 if (lpBtnInfo != NULL)
1276 {
1277 if (lpBtnInfo->bHover)
1278 iState |= PBS_HOT;
1279 }
1280
1282 {
1284 }
1285
1286 // Draw the frame around the control
1287 calc_DrawThemeBackground(hTheme, dis->hDC, BP_PUSHBUTTON, iState, &dis->rcItem, NULL);
1288
1289 calc_CloseThemeData(hTheme);
1290 } else {
1291 /* default state: unpushed */
1292 DWORD dwStyle = 0;
1293
1294 if ((dis->itemState & ODS_SELECTED))
1295 dwStyle = DFCS_PUSHED;
1296
1297 DrawFrameControl(dis->hDC, &dis->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH | dwStyle);
1298 }
1299
1300 /* button text to write */
1302
1303 /*
1304 * little exception: 1/x has different color
1305 * in standard and scientific modes
1306 */
1309 IDC_BUTTON_RX == dis->CtlID) {
1311 } else
1312 for (dx=0; dx<SIZEOF(key2code); dx++) {
1313 if (key2code[dx].idc == dis->CtlID) {
1314 SetTextColor(dis->hDC, key2code[dx].col);
1315 break;
1316 }
1317 }
1318
1319 /* No background, to avoid corruption of the texture */
1320 SetBkMode(dis->hDC, TRANSPARENT);
1321
1322 /* Default state: enabled */
1323 dwText = 0;
1324 if ((dis->itemState & ODS_DISABLED))
1325 dwText = DSS_DISABLED;
1326
1327 /* Draw the text in the button */
1329 dx = ((dis->rcItem.right-dis->rcItem.left) - size.cx) >> 1;
1330 dy = ((dis->rcItem.bottom-dis->rcItem.top) - size.cy) >> 1;
1331 if ((dis->itemState & ODS_SELECTED)) {
1332 dx++;
1333 dy++;
1334 }
1335 pt.x = dis->rcItem.left + dx;
1336 pt.y = dis->rcItem.top + dy;
1337 DrawState(dis->hDC, NULL, NULL, (LPARAM)text, 0, pt.x, pt.y, size.cx, size.cy, DST_TEXT | dwText);
1338 }
1339 return 1L;
1340}
1341
1343{
1346
1347 switch (msg) {
1348 case WM_MOUSEMOVE:
1349 mouse_event.cbSize = sizeof(TRACKMOUSEEVENT);
1350 mouse_event.dwFlags = TME_QUERY;
1352 {
1354 mouse_event.hwndTrack = hWnd;
1355 mouse_event.dwHoverTime = 1;
1357 }
1358 break;
1359
1360 case WM_MOUSEHOVER:
1361 lpBtnInfo->bHover = TRUE;
1363 break;
1364
1365 case WM_MOUSELEAVE:
1366 lpBtnInfo->bHover = FALSE;
1368 break;
1369 }
1370
1371 return CallWindowProc(lpBtnInfo->oldProc, hWnd, msg, wp, lp);
1372}
1373
1375{
1376 TCHAR szClass[64];
1377
1378 if (!GetClassName(hWnd, szClass, SIZEOF(szClass)))
1379 return TRUE;
1380
1381 if (!_tcscmp(szClass, WC_BUTTON))
1382 {
1383 int *pnCtrls = (int *)lParam;
1384 int nCtrls = *pnCtrls;
1385
1387 BtnInfo[nCtrls].bHover = FALSE;
1388
1391
1392 *pnCtrls = ++nCtrls;
1393 }
1394 return TRUE;
1395}
1396
1398{
1399 /* Check for user policy and area string valid */
1400 if (wParam == 0 && lParam != 0)
1401 {
1402 LPTSTR lpArea = (LPTSTR)lParam;
1403
1404 /* Check if a parameter has been changed into the locale settings */
1405 if (!_tcsicmp(lpArea, _T("intl")))
1406 {
1407 /* Re-load locale parameters */
1409
1410 /* Update text for decimal button */
1412
1413 /* Update text into the output display */
1415 }
1416 }
1417 return 0;
1418}
1419
1421{
1422 unsigned int x;
1423 RECT rc;
1424
1425 switch (msg) {
1426 case WM_DRAWITEM:
1427 return SubclassButtonProc(hWnd, wp, lp);
1428
1429 case WM_INITDIALOG:
1430#ifdef DISABLE_HTMLHELP_SUPPORT
1432#endif
1433 calc.hWnd=hWnd;
1434 /* Enumerate children and apply hover function */
1435 BtnCount = 0;
1437
1438#ifdef USE_KEYBOARD_HOOK
1439 calc.hKeyboardHook=SetWindowsHookEx(
1442 NULL,
1444 );
1445#endif
1446 rpn_zero(&calc.code);
1447 calc.sci_out = FALSE;
1451 calc.ptr = calc.buffer;
1452 calc.is_nan = FALSE;
1458 /* remove keyboard focus */
1460 /* set our calc icon */
1461 SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)calc.hBgIcon);
1462 SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)calc.hSmIcon);
1463 /* update text for decimal button */
1465 /* Fill combo box for conversion */
1467 ConvInit(hWnd);
1468 /* Restore the window at the same position it was */
1469 if (calc.x_coord >= 0 && calc.y_coord >= 0) {
1470 int w, h, sw, sh;
1471
1472 GetWindowRect(hWnd, &rc);
1473 w = rc.right-rc.left;
1474 h = rc.bottom-rc.top;
1477 if (calc.x_coord+w > sw) calc.x_coord = sw - w;
1478 if (calc.y_coord+h > sh) calc.y_coord = sh - h;
1480 }
1481 break;
1482 case WM_CTLCOLORSTATIC:
1483 if ((HWND)lp == GetDlgItem(hWnd, IDC_TEXT_OUTPUT))
1485 break;
1488 return TRUE;
1489 case WM_COMMAND:
1490 /*
1491 * if selection of category is changed, we must
1492 * update the content of the "from/to" combo boxes.
1493 */
1496 return TRUE;
1497 }
1498 if (HIWORD(wp) != BN_CLICKED && HIWORD(wp) != BN_DBLCLK)
1499 break;
1500 /* avoid flicker if the user selects from keyboard */
1503 switch (LOWORD(wp)) {
1504 case IDM_HELP_ABOUT:
1505 {
1506 TCHAR infotitle[100];
1507 TCHAR infotext[200];
1508 LoadString(calc.hInstance, IDS_CALC_NAME, infotitle, SIZEOF(infotitle));
1509 LoadString(calc.hInstance, IDS_AUTHOR, infotext, SIZEOF(infotext));
1510 ShellAbout(hWnd, infotitle, infotext, calc.hBgIcon);
1511 return TRUE;
1512 }
1513 case IDM_HELP_HELP:
1514#ifndef DISABLE_HTMLHELP_SUPPORT
1515 calc_HtmlHelp(hWnd, HTMLHELP_PATH("/general_information.htm"), HH_DISPLAY_TOPIC, (DWORD_PTR)NULL);
1516#endif
1517 return TRUE;
1518 case IDM_VIEW_STANDARD:
1522 return TRUE;
1527 return TRUE;
1532 return TRUE;
1533 case IDM_VIEW_HEX:
1534 case IDM_VIEW_DEC:
1535 case IDM_VIEW_OCT:
1536 case IDM_VIEW_BIN:
1537 case IDM_VIEW_DEG:
1538 case IDM_VIEW_RAD:
1539 case IDM_VIEW_GRAD:
1540 case IDM_VIEW_QWORD:
1541 case IDM_VIEW_DWORD:
1542 case IDM_VIEW_WORD:
1543 case IDM_VIEW_BYTE:
1545 return TRUE;
1546 case IDM_EDIT_COPY:
1548 return TRUE;
1549 case IDM_EDIT_PASTE:
1550 if (calc.Clipboard.data != NULL)
1551 break;
1553 if (calc.Clipboard.data != NULL) {
1554 /* clear the content of the display before pasting */
1559 }
1560 return TRUE;
1561 case IDM_VIEW_GROUP:
1562 calc.usesep = (calc.usesep ? FALSE : TRUE);
1565 return TRUE;
1566 case IDC_BUTTON_CONVERT:
1568 return TRUE;
1569 case IDC_BUTTON_CE: {
1570 calc_number_t tmp;
1571 rpn_zero(&tmp);
1572 display_rpn_result(hWnd, &tmp);
1573 }
1574 return TRUE;
1575 case IDC_RADIO_DEC:
1576 case IDC_RADIO_HEX:
1577 case IDC_RADIO_OCT:
1578 case IDC_RADIO_BIN:
1579/* GNU WINDRES is bugged so I must always force radio update */
1580/* (Fix for Win95/98) */
1581#ifdef _MSC_VER
1582 if (calc.base == LOWORD(wp))
1583 break;
1584#endif
1585 calc.is_nan = FALSE;
1586 update_radio(hWnd, LOWORD(wp));
1587 return TRUE;
1588 case IDC_RADIO_DEG:
1589 case IDC_RADIO_RAD:
1590 case IDC_RADIO_GRAD:
1591/* GNU WINDRES is bugged so I must always force radio update */
1592/* (Fix for Win95/98) */
1593#ifdef _MSC_VER
1594 if (calc.degr == LOWORD(wp))
1595 break;
1596#endif
1597 calc.degr = LOWORD(wp);
1598 calc.is_nan = FALSE;
1600 return TRUE;
1601 case IDC_RADIO_QWORD:
1602 case IDC_RADIO_DWORD:
1603 case IDC_RADIO_WORD:
1604 case IDC_RADIO_BYTE:
1605/* GNU WINDRES is bugged so I must always force radio update */
1606/* (Fix for Win95/98) */
1607#ifdef _MSC_VER
1608 if (calc.size == LOWORD(wp))
1609 break;
1610#endif
1611 calc.size = LOWORD(wp);
1612 calc.is_nan = FALSE;
1614 /*
1615 * update the content of the display
1616 */
1620 return TRUE;
1621 case IDC_BUTTON_1:
1622 case IDC_BUTTON_2:
1623 case IDC_BUTTON_3:
1624 case IDC_BUTTON_4:
1625 case IDC_BUTTON_5:
1626 case IDC_BUTTON_6:
1627 case IDC_BUTTON_7:
1628 case IDC_BUTTON_8:
1629 case IDC_BUTTON_9:
1630 case IDC_BUTTON_0:
1631 case IDC_BUTTON_DOT:
1632 case IDC_BUTTON_A:
1633 case IDC_BUTTON_B:
1634 case IDC_BUTTON_C:
1635 case IDC_BUTTON_D:
1636 case IDC_BUTTON_E:
1637 case IDC_BUTTON_F:
1638 if (calc.is_nan) break;
1640 return TRUE;
1641 case IDC_BUTTON_PERCENT:
1642 case IDC_BUTTON_ADD:
1643 case IDC_BUTTON_SUB:
1644 case IDC_BUTTON_MULT:
1645 case IDC_BUTTON_DIV:
1646 case IDC_BUTTON_MOD:
1647 case IDC_BUTTON_AND:
1648 case IDC_BUTTON_OR:
1649 case IDC_BUTTON_XOR:
1650 case IDC_BUTTON_LSH:
1651 case IDC_BUTTON_RSH:
1652 case IDC_BUTTON_EQU:
1653 case IDC_BUTTON_XeY:
1654 case IDC_BUTTON_XrY:
1655 if (calc.is_nan) break;
1656 /*
1657 * LSH and XeY buttons hold also the RSH and XrY functions with INV modifier,
1658 * but since they are two operand operators, they must be handled here.
1659 */
1661 {
1662 WPARAM IdcSim = IDC_STATIC;
1663
1664 switch (LOWORD(wp)) {
1665 case IDC_BUTTON_LSH: IdcSim = MAKEWPARAM(IDC_BUTTON_RSH, BN_CLICKED); break;
1666 case IDC_BUTTON_XeY: IdcSim = MAKEWPARAM(IDC_BUTTON_XrY, BN_CLICKED); break;
1667 }
1668
1669 if (IdcSim != IDC_STATIC)
1670 {
1671 PostMessage(hWnd, WM_COMMAND, IdcSim, 0);
1673 break;
1674 }
1675 }
1676
1677 for (x=0; x<SIZEOF(operator_codes); x++) {
1678 if (LOWORD(wp) == operator_codes[x]) {
1680
1681 if (calc.ptr == calc.buffer) {
1682 if (calc.last_operator != x) {
1683 if (x != RPN_OPERATOR_EQUAL)
1685 } else
1686 if (x == RPN_OPERATOR_EQUAL) {
1689 } else
1690 break;
1691 }
1692
1693 /* if no change then quit silently, */
1694 /* without display updates */
1695 if (!exec_infix2postfix(&calc.code, x))
1696 break;
1697
1699 break;
1700 }
1701 }
1702 return TRUE;
1703 case IDC_BUTTON_BACK:
1704 if (calc.is_nan) break;
1705 if (calc.sci_in) {
1706 if (calc.esp == 0) {
1707 TCHAR *ptr;
1708
1709 calc.sci_in = FALSE;
1710 ptr = _tcschr(calc.ptr, _T('e'));
1711 if (ptr)
1712 *ptr = _T('\0');
1714 } else {
1715 calc.esp /= 10;
1717 }
1718 } else
1719 if (calc.ptr != calc.buffer) {
1720 *--calc.ptr = _T('\0');
1721 if (!_tcscmp(calc.buffer, _T("-")) ||
1722 !_tcscmp(calc.buffer, _T("-0")) ||
1723 !_tcscmp(calc.buffer, _T("0"))) {
1724 calc.ptr = calc.buffer;
1725 calc.buffer[0] = _T('\0');
1726 }
1728 }
1729 return TRUE;
1730 case IDC_BUTTON_MC:
1733 return TRUE;
1734 case IDC_BUTTON_MR:
1735 if (calc.is_memory) {
1736 calc.is_nan = FALSE;
1739 }
1740 return TRUE;
1741 case IDC_BUTTON_EXP:
1742 if (calc.sci_in || calc.is_nan || calc.buffer == calc.ptr)
1743 break;
1744 calc.sci_in = TRUE;
1745 calc.esp = 0;
1747 return TRUE;
1748 case IDC_BUTTON_SIGN:
1749 if (calc.sci_in) {
1750 calc.esp = 0-calc.esp;
1752 } else {
1753 if (calc.is_nan || calc.buffer[0] == _T('\0'))
1754 break;
1755
1756 if (calc.buffer[0] == _T('-')) {
1757 /* make the number positive */
1758 memmove(calc.buffer, calc.buffer+1, sizeof(calc.buffer)-1);
1759 if (calc.buffer != calc.ptr)
1760 calc.ptr--;
1761 } else {
1762 /* if first char is '0' and no dot, it isn't valid */
1763 if (calc.buffer[0] == _T('0') &&
1764 calc.buffer[1] != _T('.'))
1765 break;
1766 /* make the number negative */
1767 memmove(calc.buffer+1, calc.buffer, sizeof(calc.buffer)-1);
1768 calc.buffer[0] = _T('-');
1769 if (calc.buffer != calc.ptr)
1770 calc.ptr++;
1771 }
1772 /* If the input buffer is empty, then
1773 we change also the sign of calc.code
1774 because it could be the result of a
1775 previous calculation. */
1776 if (calc.buffer == calc.ptr)
1777 rpn_sign(&calc.code);
1779 }
1780 return TRUE;
1782 case IDC_BUTTON_LEFTPAR:
1783 case IDC_BUTTON_CANC:
1784 case IDC_BUTTON_MP:
1785 case IDC_BUTTON_DAT:
1786 case IDC_BUTTON_FE:
1787 case IDC_BUTTON_DMS:
1788 case IDC_BUTTON_SQRT:
1789 case IDC_BUTTON_S:
1790 case IDC_BUTTON_SUM:
1791 case IDC_BUTTON_AVE:
1792 case IDC_BUTTON_NF:
1793 case IDC_BUTTON_LN:
1794 case IDC_BUTTON_LOG:
1795 case IDC_BUTTON_Xe2:
1796 case IDC_BUTTON_Xe3:
1797 case IDC_BUTTON_PI:
1798 case IDC_BUTTON_NOT:
1799 case IDC_BUTTON_RX:
1800 case IDC_BUTTON_INT:
1801 case IDC_BUTTON_SIN:
1802 case IDC_BUTTON_COS:
1803 case IDC_BUTTON_TAN:
1804 case IDC_BUTTON_MS:
1805 for (x=0; x<SIZEOF(function_table); x++) {
1806 if (LOWORD(wp) == function_table[x].idc) {
1808
1809 /* test if NaN state is important or not */
1810 if (calc.is_nan && function_table[x].check_nan) break;
1811 /* otherwise, it's cleared */
1812 calc.is_nan = FALSE;
1813
1814 switch (get_modifiers(hWnd) & function_table[x].range) {
1815 case 0:
1817 break;
1818 case MODIFIER_INV:
1820 break;
1821 case MODIFIER_HYP:
1823 break;
1826 break;
1827 }
1828 if (cb != NULL) {
1830 cb(&calc.code);
1831// display_rpn_result(hWnd, &calc.code);
1833
1834 if ((function_table[x].range & NO_CHAIN))
1835 calc.ptr = calc.buffer;
1836
1837// if (!(function_table[x].range & NO_CHAIN))
1838// exec_infix2postfix(&calc.code, RPN_OPERATOR_NONE);
1843 }
1844 break;
1845 }
1846 }
1847 return TRUE;
1848 case IDC_BUTTON_STA:
1849 if (IsWindow(calc.hStatWnd))
1850 break;
1853 if (calc.hStatWnd != NULL) {
1856 }
1857 return TRUE;
1858 }
1859 break;
1860 case WM_CLOSE_STATS:
1861 calc.hStatWnd = NULL;
1863 return TRUE;
1864 case WM_LOAD_STAT:
1865 if (upload_stat_number((int)LOWORD(wp)) != NULL)
1867 return TRUE;
1868 case WM_START_CONV:
1869 x = LOWORD(lp);
1871 if (calc.Convert[x].data != NULL) {
1873 PostMessage(hWnd, HIWORD(lp), 0, 0);
1874 }
1875 return TRUE;
1876 case WM_HANDLE_FROM:
1877 if (calc.is_nan)
1878 break;
1881 MAKELPARAM(0x0001, WM_HANDLE_TO));
1882 return TRUE;
1883 case WM_HANDLE_TO:
1884 if (!calc.is_nan)
1886 return TRUE;
1887 case WM_CLOSE:
1890 return TRUE;
1891
1892 case WM_DESTROY:
1893 /* Get (x,y) position of the calculator */
1894 GetWindowRect(hWnd, &rc);
1895 calc.x_coord = rc.left;
1896 calc.y_coord = rc.top;
1897#ifdef USE_KEYBOARD_HOOK
1898 UnhookWindowsHookEx(calc.hKeyboardHook);
1899#endif
1900 PostQuitMessage(0);
1901 return TRUE;
1902 case WM_CONTEXTMENU:
1903 if ((HWND)wp != hWnd)
1904 handle_context_menu(hWnd, wp, lp);
1905 return TRUE;
1906 case WM_ENTERMENULOOP:
1908 /* Check if a valid format is available in the clipboard */
1914 break;
1915 case WM_EXITMENULOOP:
1917 break;
1918
1919 case WM_SETTINGCHANGE:
1920 return OnSettingChange(hWnd, wp, lp);
1921
1922 case WM_THEMECHANGED:
1924 break;
1925 }
1926 return FALSE;
1927}
1928
1929#if defined(__GNUC__) && !defined(__REACTOS__)
1930int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
1931#else
1932int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
1933#endif
1934{
1935 MSG msg;
1936 DWORD dwLayout;
1937
1938 /* Initialize controls for theming & manifest support */
1940
1942
1943 calc.x_coord = -1;
1944 calc.y_coord = -1;
1945
1946 load_config();
1948
1950
1952
1954 hInstance,
1956 IMAGE_ICON,
1957 0,
1958 0,
1960
1962 hInstance,
1964 IMAGE_ICON,
1967 LR_SHARED);
1968
1969 do {
1970 /* ignore hwnd: dialogs are already visible! */
1972 dwLayout = IDD_DIALOG_SCIENTIFIC;
1973 else
1975 dwLayout = IDD_DIALOG_CONVERSION;
1976 else
1977 dwLayout = IDD_DIALOG_STANDARD;
1978
1979 /* This call will always fail if UNICODE for Win9x */
1981 break;
1982
1983 while (GetMessage(&msg, NULL, 0, 0)) {
1984#ifndef USE_KEYBOARD_HOOK
1985 if ((msg.message == WM_KEYUP ||
1986 msg.message == WM_KEYDOWN) &&
1988 process_vk_key(msg.wParam, msg.lParam);
1989#endif
1992 }
1993
1994 save_config();
1995 } while (calc.action != IDC_STATIC);
1996
1998
1999 Theme_Stop();
2000 HtmlHelp_Stop();
2001
2002 return 0;
2003}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static int state
Definition: maze.c:121
#define msg(x)
Definition: auth_time.c:54
#define IDC_BUTTON_TAN
Definition: resource.h:38
#define IDD_DIALOG_STANDARD
Definition: resource.h:14
#define IDM_VIEW_CONVERSION
Definition: resource.h:392
#define IDC_RADIO_DWORD
Definition: resource.h:85
#define IDM_VIEW_DEG
Definition: resource.h:382
#define IDC_BUTTON_B
Definition: resource.h:63
#define IDC_BUTTON_MS
Definition: resource.h:51
#define IDM_VIEW_STANDARD
Definition: resource.h:376
#define IDD_DIALOG_STAT
Definition: resource.h:16
#define IDC_BUTTON_DMS
Definition: resource.h:35
#define IDC_RADIO_QWORD
Definition: resource.h:84
#define IDC_BUTTON_BACK
Definition: resource.h:93
#define IDC_BUTTON_CAD
Definition: resource.h:102
#define IDC_BUTTON_A
Definition: resource.h:58
#define IDC_BUTTON_ADD
Definition: resource.h:72
#define IDC_BUTTON_PI
Definition: resource.h:53
#define IDC_BUTTON_LN
Definition: resource.h:45
#define IDC_BUTTON_DAT
Definition: resource.h:33
#define IDC_BUTTON_STA
Definition: resource.h:29
#define IDC_BUTTON_MC
Definition: resource.h:49
#define IDC_BUTTON_XeY
Definition: resource.h:41
#define IDM_VIEW_RAD
Definition: resource.h:383
#define IDC_BUTTON_3
Definition: resource.h:66
#define IDM_EDIT_PASTE
Definition: resource.h:375
#define IDS_QUICKHELP
Definition: resource.h:11
#define IDI_CALC
Definition: resource.h:22
#define IDC_CHECK_INV
Definition: resource.h:27
#define IDC_BUTTON_FOCUS
Definition: resource.h:108
#define IDC_BUTTON_RSH
Definition: resource.h:112
#define IDM_VIEW_WORD
Definition: resource.h:389
#define IDC_BUTTON_LOG
Definition: resource.h:46
#define IDM_VIEW_BYTE
Definition: resource.h:390
#define IDS_CALC_NAME
Definition: resource.h:9
#define IDC_BUTTON_INT
Definition: resource.h:82
#define IDC_BUTTON_D
Definition: resource.h:73
#define IDC_BUTTON_S
Definition: resource.h:32
#define IDC_CHECK_HYP
Definition: resource.h:28
#define IDC_BUTTON_OR
Definition: resource.h:75
#define IDC_BUTTON_SUB
Definition: resource.h:71
#define IDM_VIEW_DWORD
Definition: resource.h:391
#define IDC_BUTTON_NOT
Definition: resource.h:81
#define IDD_DIALOG_CONVERSION
Definition: resource.h:17
#define IDC_BUTTON_RIGHTPAR
Definition: resource.h:44
#define IDC_RADIO_WORD
Definition: resource.h:86
#define IDM_VIEW_QWORD
Definition: resource.h:388
#define IDC_RADIO_GRAD
Definition: resource.h:90
#define IDC_BUTTON_NF
Definition: resource.h:47
#define IDM_VIEW_BIN
Definition: resource.h:381
#define IDC_BUTTON_CE
Definition: resource.h:92
#define IDC_RADIO_DEG
Definition: resource.h:88
#define IDC_RADIO_RAD
Definition: resource.h:89
#define IDC_BUTTON_EQU
Definition: resource.h:77
#define IDS_MATH_ERROR
Definition: resource.h:10
#define IDD_DIALOG_SCIENTIFIC
Definition: resource.h:13
#define IDM_VIEW_OCT
Definition: resource.h:380
#define IDR_MENU_SCIENTIFIC_2
Definition: resource.h:19
#define IDC_COMBO_CATEGORY
Definition: resource.h:109
#define IDC_BUTTON_E
Definition: resource.h:78
#define IDC_BUTTON_CD
Definition: resource.h:101
#define IDC_BUTTON_RET
Definition: resource.h:99
#define IDC_BUTTON_0
Definition: resource.h:57
#define IDC_TEXT_MEMORY
Definition: resource.h:96
#define IDC_BUTTON_2
Definition: resource.h:61
#define IDC_BUTTON_8
Definition: resource.h:59
#define IDC_BUTTON_XOR
Definition: resource.h:80
#define IDM_EDIT_COPY
Definition: resource.h:374
#define IDC_BUTTON_DIV
Definition: resource.h:69
#define IDC_BUTTON_MOD
Definition: resource.h:74
#define IDC_RADIO_BIN
Definition: resource.h:26
#define IDC_BUTTON_Xe2
Definition: resource.h:42
#define IDC_TEXT_OUTPUT
Definition: resource.h:94
#define IDC_RADIO_OCT
Definition: resource.h:25
#define IDC_BUTTON_LSH
Definition: resource.h:76
#define IDM_VIEW_GROUP
Definition: resource.h:385
#define IDC_BUTTON_FE
Definition: resource.h:34
#define IDR_MENU_SCIENTIFIC_1
Definition: resource.h:18
#define IDC_TEXT_NITEMS
Definition: resource.h:103
#define IDC_BUTTON_6
Definition: resource.h:65
#define IDC_BUTTON_SIN
Definition: resource.h:36
#define IDC_BUTTON_AVE
Definition: resource.h:30
#define IDC_BUTTON_COS
Definition: resource.h:37
#define IDC_RADIO_DEC
Definition: resource.h:24
#define IDC_BUTTON_PERCENT
Definition: resource.h:105
#define IDC_BUTTON_DOT
Definition: resource.h:67
#define IDC_BUTTON_9
Definition: resource.h:64
#define IDM_VIEW_GRAD
Definition: resource.h:384
#define IDC_BUTTON_MULT
Definition: resource.h:70
#define IDM_VIEW_DEC
Definition: resource.h:379
#define IDM_VIEW_SCIENTIFIC
Definition: resource.h:377
#define IDC_TEXT_PARENT
Definition: resource.h:95
#define IDC_BUTTON_C
Definition: resource.h:68
#define IDC_BUTTON_SIGN
Definition: resource.h:62
#define IDC_BUTTON_CANC
Definition: resource.h:91
#define IDM_HELP_HELP
Definition: resource.h:386
#define IDC_BUTTON_MR
Definition: resource.h:50
#define IDC_LIST_STAT
Definition: resource.h:98
#define IDC_BUTTON_MP
Definition: resource.h:52
#define IDC_RADIO_BYTE
Definition: resource.h:87
#define IDC_STATIC
Definition: resource.h:4
#define IDM_VIEW_HEX
Definition: resource.h:378
#define IDC_BUTTON_AND
Definition: resource.h:79
#define IDC_BUTTON_F
Definition: resource.h:83
#define IDC_BUTTON_LEFTPAR
Definition: resource.h:39
#define IDC_BUTTON_SQRT
Definition: resource.h:104
#define IDC_BUTTON_RX
Definition: resource.h:48
#define IDC_BUTTON_LOAD
Definition: resource.h:100
#define IDC_BUTTON_Xe3
Definition: resource.h:43
#define IDM_HELP_ABOUT
Definition: resource.h:387
#define IDC_BUTTON_EXP
Definition: resource.h:40
#define IDC_BUTTON_CONVERT
Definition: resource.h:106
#define IDC_BUTTON_5
Definition: resource.h:60
#define IDC_BUTTON_7
Definition: resource.h:54
#define IDS_AUTHOR
Definition: resource.h:12
#define IDC_BUTTON_4
Definition: resource.h:55
#define IDC_BUTTON_SUM
Definition: resource.h:31
#define IDC_RADIO_HEX
Definition: resource.h:23
#define IDC_BUTTON_1
Definition: resource.h:56
#define IDC_BUTTON_XrY
Definition: resource.h:113
HWND hWnd
Definition: settings.c:17
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
Definition: main.c:8
#define CF_UNICODETEXT
Definition: constants.h:408
#define CF_TEXT
Definition: constants.h:396
#define __int64
Definition: basetyps.h:16
#define RegCloseKey(hKey)
Definition: registry.h:49
void rpn_2pi(calc_number_t *c)
Definition: fun_ieee.c:295
@ RPN_OPERATOR_SUB
Definition: calc.h:112
@ RPN_OPERATOR_EQUAL
Definition: calc.h:104
@ RPN_OPERATOR_PARENT
Definition: calc.h:102
@ RPN_OPERATOR_ADD
Definition: calc.h:111
void run_operator(calc_node_t *result, calc_node_t *a, calc_node_t *b, unsigned int operation)
Definition: rpn_ieee.c:314
#define NO_CHAIN
Definition: calc.h:218
#define MODIFIER_INV
Definition: calc.h:216
#define MAX_CALC_SIZE
Definition: calc.h:49
void rpn_ln(calc_number_t *c)
Definition: fun_ieee.c:421
void start_rpn_engine(void)
Definition: rpn_ieee.c:479
void rpn_pi(calc_number_t *c)
Definition: fun_ieee.c:290
void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
Definition: utl_ieee.c:23
void rpn_free(calc_number_t *c)
Definition: fun_ieee.c:605
void rpn_sinh(calc_number_t *c)
Definition: fun_ieee.c:163
type_DrawThemeParentBackground calc_DrawThemeParentBackground
Definition: theme.c:57
#define WM_INSERT_STAT
Definition: calc.h:26
void HtmlHelp_Stop(void)
Definition: htmlhelp.c:60
void rpn_frac(calc_number_t *c)
Definition: fun_ieee.c:209
void apply_int_mask(calc_number_t *a)
Definition: fun_ieee.c:26
void convert_text2number_2(calc_number_t *a)
Definition: utl_ieee.c:86
void rpn_tan(calc_number_t *c)
Definition: fun_ieee.c:131
type_OpenThemeData calc_OpenThemeData
Definition: theme.c:50
void rpn_dec2dms(calc_number_t *c)
Definition: fun_ieee.c:577
void ConvExecute(HWND hWnd)
Definition: convert.c:568
void rpn_sqrt(calc_number_t *c)
Definition: fun_ieee.c:358
#define WM_HANDLE_FROM
Definition: calc.h:29
void rpn_exp3(calc_number_t *c)
Definition: fun_ieee.c:318
void rpn_exp2(calc_number_t *c)
Definition: fun_ieee.c:308
void HtmlHelp_Start(HINSTANCE hInstance)
Definition: htmlhelp.c:50
#define WM_LOAD_STAT
Definition: calc.h:27
void ConvInit(HWND hWnd)
Definition: convert.c:650
void Theme_Start(HINSTANCE hInstance)
Definition: theme.c:105
void rpn_int(calc_number_t *c)
Definition: fun_ieee.c:201
void rpn_cbrt(calc_number_t *c)
Definition: fun_ieee.c:387
void rpn_alloc(calc_number_t *c)
Definition: fun_ieee.c:601
void rpn_asin(calc_number_t *c)
Definition: fun_ieee.c:144
void rpn_sin(calc_number_t *c)
Definition: fun_ieee.c:101
void rpn_reci(calc_number_t *c)
Definition: fun_ieee.c:216
#define LOCAL_EXP_SIZE
Definition: calc.h:43
void exec_change_infix(void)
Definition: rpn_ieee.c:422
void rpn_exp(calc_number_t *c)
Definition: fun_ieee.c:400
void rpn_sign(calc_number_t *c)
Definition: fun_ieee.c:300
void rpn_atan(calc_number_t *c)
Definition: fun_ieee.c:156
void rpn_asinh(calc_number_t *c)
Definition: fun_ieee.c:182
void rpn_cosh(calc_number_t *c)
Definition: fun_ieee.c:169
void rpn_ave2(calc_number_t *c)
Definition: fun_ieee.c:483
void rpn_fact(calc_number_t *c)
Definition: fun_ieee.c:224
#define SIZEOF(_ar)
Definition: calc.h:97
void rpn_log(calc_number_t *c)
Definition: fun_ieee.c:429
void rpn_zero(calc_number_t *c)
Definition: fun_ieee.c:586
void exec_closeparent(calc_number_t *)
Definition: rpn_ieee.c:436
void ConvAdjust(HWND hWnd, int n_cat)
Definition: convert.c:621
#define WM_START_CONV
Definition: calc.h:28
void rpn_acos(calc_number_t *c)
Definition: fun_ieee.c:150
type_DrawThemeBackground calc_DrawThemeBackground
Definition: theme.c:52
#define calc_HtmlHelp
Definition: calc.h:59
void rpn_s(calc_number_t *c)
Definition: fun_ieee.c:553
void rpn_tanh(calc_number_t *c)
Definition: fun_ieee.c:175
int eval_parent_count(void)
Definition: rpn_ieee.c:457
void rpn_sum(calc_number_t *c)
Definition: fun_ieee.c:499
void Theme_Stop(void)
Definition: theme.c:120
int rpn_is_zero(calc_number_t *c)
Definition: fun_ieee.c:596
void rpn_dms2dec(calc_number_t *c)
Definition: fun_ieee.c:563
int exec_infix2postfix(calc_number_t *, unsigned int)
Definition: rpn_ieee.c:391
void rpn_ave(calc_number_t *c)
Definition: fun_ieee.c:467
type_IsThemeBackgroundPartiallyTransparent calc_IsThemeBackgroundPartiallyTransparent
Definition: theme.c:55
void rpn_s_m1(calc_number_t *c)
Definition: fun_ieee.c:558
void convert_real_integer(unsigned int base)
Definition: utl_ieee.c:112
#define MODIFIER_HYP
Definition: calc.h:217
#define WM_HANDLE_TO
Definition: calc.h:30
void rpn_cos(calc_number_t *c)
Definition: fun_ieee.c:116
void rpn_sum2(calc_number_t *c)
Definition: fun_ieee.c:509
@ CALC_LAYOUT_SCIENTIFIC
Definition: calc.h:161
@ CALC_LAYOUT_STANDARD
Definition: calc.h:162
@ CALC_LAYOUT_CONVERSION
Definition: calc.h:163
#define WM_HANDLE_CLIPBOARD
Definition: calc.h:25
void stop_rpn_engine(void)
Definition: rpn_ieee.c:484
type_CloseThemeData calc_CloseThemeData
Definition: theme.c:51
void rpn_copy(calc_number_t *dst, calc_number_t *src)
Definition: fun_ieee.c:591
void rpn_exp10(calc_number_t *c)
Definition: fun_ieee.c:407
void rpn_acosh(calc_number_t *c)
Definition: fun_ieee.c:188
void rpn_atanh(calc_number_t *c)
Definition: fun_ieee.c:194
type_IsThemeActive calc_IsThemeActive
Definition: theme.c:54
type_IsAppThemed calc_IsAppThemed
Definition: theme.c:53
void flush_postfix(void)
Definition: rpn_ieee.c:470
void rpn_not(calc_number_t *c)
Definition: fun_ieee.c:280
#define WM_CLOSE_STATS
Definition: calc.h:24
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
#define free
Definition: debug_ros.c:5
#define _strdup
Definition: debug_ros.c:7
#define malloc
Definition: debug_ros.c:4
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
const WCHAR * text
Definition: package.c:1799
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define pt(x, y)
Definition: drawing.c:79
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxAutoRegKey hKey
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble t
Definition: gl.h:2047
GLsizeiptr size
Definition: glext.h:5919
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
const GLubyte * c
Definition: glext.h:8905
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLint * range
Definition: glext.h:7539
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat GLfloat p
Definition: glext.h:8902
GLuint GLuint num
Definition: glext.h:9618
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define HH_DISPLAY_TOPIC
Definition: htmlhelp.h:22
#define HH_DISPLAY_TEXT_POPUP
Definition: htmlhelp.h:37
#define _tcscmp
Definition: tchar.h:1424
#define _tWinMain
Definition: tchar.h:498
#define _tcschr
Definition: tchar.h:1406
#define e
Definition: ke_i.h:82
#define c
Definition: ke_i.h:80
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
struct task_struct * current
Definition: linux.c:32
static PVOID ptr
Definition: dispmode.c:27
static BYTE cn[]
Definition: cert.c:2938
static unsigned int number
Definition: dsound.c:1479
static DWORD layout
Definition: bitmap.c:46
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
WORD vk
Definition: input.c:77
static LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
Definition: msg.c:16658
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
int k
Definition: mpi.c:3369
UINT_PTR HKL
Definition: msctf.idl:143
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:237
#define VER_PLATFORM_WIN32s
Definition: rtltypes.h:236
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define LOCALE_USER_DEFAULT
#define STRSAFE_FILL_ON_FAILURE
Definition: ntstrsafe.h:33
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define BS_OWNERDRAW
Definition: pedump.c:661
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define TME_LEAVE
Definition: commctrl.h:4981
#define WM_MOUSELEAVE
Definition: commctrl.h:4975
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
#define WM_MOUSEHOVER
Definition: commctrl.h:4974
#define TME_QUERY
Definition: commctrl.h:4983
#define WC_BUTTON
Definition: commctrl.h:4625
#define TME_HOVER
Definition: commctrl.h:4980
#define WM_CONTEXTMENU
Definition: richedit.h:64
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:596
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
#define memset(x, y, z)
Definition: compat.h:39
short sh
Definition: format.c:272
#define ShellAbout
Definition: shellapi.h:692
#define StringCbCat
Definition: strsafe.h:334
#define StringCbCopyEx
Definition: strsafe.h:192
#define StringCbPrintfEx
Definition: strsafe.h:600
#define StringCbCopy
Definition: strsafe.h:155
#define StringCbPrintf
Definition: strsafe.h:544
WNDPROC oldProc
Definition: winmain.c:239
BOOL bHover
Definition: winmain.c:238
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
calc_number_t number
Definition: calc.h:133
DWORD base
Definition: calc.h:135
Definition: calc.h:166
HWND hWnd
Definition: calc.h:171
TCHAR sThousand[8]
Definition: calc.h:200
DWORD degr
Definition: calc.h:191
HINSTANCE hInstance
Definition: calc.h:167
sequence_t Convert[2]
Definition: calc.h:196
signed int y_coord
Definition: calc.h:204
DWORD layout
Definition: calc.h:174
BOOL sci_in
Definition: calc.h:185
calc_node_t memory
Definition: calc.h:180
unsigned int prev_operator
Definition: calc.h:198
unsigned int sThousand_len
Definition: calc.h:202
TCHAR buffer[MAX_CALC_SIZE]
Definition: calc.h:175
unsigned int last_operator
Definition: calc.h:197
DWORD action
Definition: calc.h:192
BOOL is_nan
Definition: calc.h:183
calc_number_t code
Definition: calc.h:178
HICON hSmIcon
Definition: calc.h:173
BOOL usesep
Definition: calc.h:186
signed int esp
Definition: calc.h:188
signed int x_coord
Definition: calc.h:203
calc_number_t prev
Definition: calc.h:179
TCHAR sDecimal[8]
Definition: calc.h:199
statistic_t * stat
Definition: calc.h:181
sequence_t Clipboard
Definition: calc.h:195
TCHAR source[MAX_CALC_SIZE]
Definition: calc.h:176
HICON hBgIcon
Definition: calc.h:172
HWND hStatWnd
Definition: calc.h:193
BOOL sci_out
Definition: calc.h:184
DWORD size
Definition: calc.h:190
TCHAR * ptr
Definition: calc.h:177
BOOL is_memory
Definition: calc.h:182
unsigned int sDecimal_len
Definition: calc.h:201
DWORD base
Definition: calc.h:189
BOOL is_menu_on
Definition: calc.h:187
rpn_callback1 direct
Definition: winmain.c:193
rpn_callback1 inverse
Definition: winmain.c:194
rpn_callback1 inv_hyp
Definition: winmain.c:196
rpn_callback1 hyperb
Definition: winmain.c:195
WORD idc
Definition: winmain.c:57
CHAR key
Definition: winmain.c:56
CHAR key
Definition: winmain.c:62
COLORREF col
Definition: winmain.c:64
WORD idc
Definition: winmain.c:61
BYTE mask
Definition: winmain.c:63
Definition: copy.c:22
char * data
Definition: calc.h:149
char * ptr
Definition: calc.h:150
UINT wm_msg
Definition: calc.h:151
void * next
Definition: calc.h:157
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HIWORD(l)
Definition: typedefs.h:247
INT64 i
Definition: calc.h:127
double f
Definition: calc.h:126
OSVERSIONINFO osvi
Definition: ver.c:28
#define _T(x)
Definition: vfdio.h:22
@ PBS_DISABLED
Definition: vsstyle.h:89
@ PBS_PRESSED
Definition: vsstyle.h:88
@ PBS_HOT
Definition: vsstyle.h:87
@ BP_PUSHBUTTON
Definition: vsstyle.h:74
#define WriteProfileString
Definition: winbase.h:3926
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define GetVersionEx
Definition: winbase.h:3852
#define GMEM_DDESHARE
Definition: winbase.h:298
#define GetProfileInt
Definition: winbase.h:3837
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
#define WINAPI
Definition: msvc.h:6
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define GetTextExtentPoint32
Definition: wingdi.h:4472
#define TRANSPARENT
Definition: wingdi.h:950
#define WHITE_BRUSH
Definition: wingdi.h:902
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
static int get_modifiers(HWND hWnd)
Definition: winmain.c:676
static const WORD operator_codes[]
Definition: winmain.c:168
static void load_config(void)
Definition: winmain.c:301
#define MAKE_BITMASK5(_transl, _is_stats, _is_ctrl, _show_b16, _show_b10, _show_b8, _show_b2)
Definition: winmain.c:31
static LRESULT post_key_press(LPARAM lParam, WORD idc)
Definition: winmain.c:357
static void run_lpar(calc_number_t *c)
Definition: winmain.c:1243
static const key2code_t key2code_base10[]
Definition: winmain.c:162
#define CTRL_Z
Definition: winmain.c:80
static int vk2ascii(unsigned int vk)
Definition: winmain.c:391
static void update_lcd_display(HWND hwnd)
Definition: winmain.c:489
#define CTRL_T
Definition: winmain.c:78
static void update_radio(HWND hwnd, unsigned int base)
Definition: winmain.c:800
#define CALC_CLR_BLUE
Definition: winmain.c:52
#define CTRL_M
Definition: winmain.c:74
#define MAKE_BITMASK4(_show_b16, _show_b10, _show_b8, _show_b2)
Definition: winmain.c:25
#define BITMASK_IS_CTRL
Definition: winmain.c:45
#define BITMASK_IS_STATS
Definition: winmain.c:44
static void UpdateNumberIntl(void)
Definition: winmain.c:253
BTNINFO BtnInfo[255]
Definition: winmain.c:250
#define CTRL_D
Definition: winmain.c:72
static INT_PTR CALLBACK DlgMainProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: winmain.c:1420
static void prepare_rpn_result(calc_number_t *rpn, TCHAR *buffer, int size, int base)
Definition: winmain.c:651
static void convert_text2number(calc_number_t *a)
Definition: winmain.c:688
static void run_mm(calc_number_t *c)
Definition: winmain.c:1122
static void update_menu(HWND hWnd)
Definition: winmain.c:731
#define BITMASK_OCT_MASK
Definition: winmain.c:48
static void handle_copy_command(HWND hWnd)
Definition: winmain.c:1013
struct BTNINFO * LPBTNINFO
static void build_operand(HWND hwnd, DWORD idc)
Definition: winmain.c:580
static char * ReadConversion(const char *formula)
Definition: winmain.c:902
static void run_dat_sta(calc_number_t *number)
Definition: winmain.c:1093
static WPARAM idm_2_idc(int idm)
Definition: winmain.c:980
static const key2code_t key2code_base16[]
Definition: winmain.c:155
#define BITMASK_DEC_MASK
Definition: winmain.c:47
void(* rpn_callback1)(calc_number_t *)
Definition: winmain.c:187
static void update_n_stats_items(HWND hWnd, TCHAR *buffer, size_t cbBuffer)
Definition: winmain.c:860
static void CopyMemToClipboard(void *ptr)
Definition: winmain.c:991
static INT_PTR CALLBACK OnSettingChange(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: winmain.c:1397
static void update_memory_flag(HWND hWnd, BOOL mem_flag)
Definition: winmain.c:854
#define CTRL_P
Definition: winmain.c:75
#define CTRL_C
Definition: winmain.c:71
static void run_canc(calc_number_t *c)
Definition: winmain.c:1224
#define CALC_CLR_PURP
Definition: winmain.c:53
static INT_PTR CALLBACK DlgStatProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: winmain.c:924
static void SaveRegInt(LPCTSTR lpszApp, LPCTSTR lpszKey, int iValue)
Definition: winmain.c:288
#define ALT_FLAG
Definition: winmain.c:68
#define CTRL_FLAG
Definition: winmain.c:67
#define KEY_WAS_DOWN
Definition: winmain.c:41
static void delete_stat_item(int n)
Definition: winmain.c:881
static void run_mp(calc_number_t *c)
Definition: winmain.c:1112
static INT_PTR CALLBACK HotButtonProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: winmain.c:1342
#define BITMASK_BIN_MASK
Definition: winmain.c:49
#define CALC_CLR_RED
Definition: winmain.c:51
static const struct _update_check_menus upd[]
#define CTRL_S
Definition: winmain.c:77
static int LoadRegInt(LPCTSTR lpszApp, LPCTSTR lpszKey, int iDefault)
Definition: winmain.c:267
static void enable_allowed_controls(HWND hwnd, DWORD base)
Definition: winmain.c:764
static void save_config(void)
Definition: winmain.c:334
#define CTRL_L
Definition: winmain.c:73
calc_t calc
Definition: winmain.c:247
static const key3code_t key2code[]
Definition: winmain.c:82
static void update_parent_display(HWND hWnd)
Definition: winmain.c:568
#define BITMASK_HEX_MASK
Definition: winmain.c:46
static void clean_stat_list(void)
Definition: winmain.c:868
#define CTRL_R
Definition: winmain.c:76
static const radio_config_t radio_setup[]
Definition: winmain.c:753
static char * handle_sequence_input(HWND hwnd, sequence_t *seq)
Definition: winmain.c:1045
static BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam)
Definition: winmain.c:1374
static char * ReadClipboard(void)
Definition: winmain.c:1026
#define HTMLHELP_PATH(_pt)
Definition: winmain.c:23
static void run_ms(calc_number_t *c)
Definition: winmain.c:1132
#define KEY_IS_UP
Definition: winmain.c:40
static const function_table_t function_table[]
Definition: winmain.c:209
static void run_mw(calc_number_t *c)
Definition: winmain.c:1139
#define CTRL_V
Definition: winmain.c:79
static void run_fe(calc_number_t *number)
Definition: winmain.c:1181
#define CTRL_A
Definition: winmain.c:70
static void handle_context_menu(HWND hWnd, WPARAM wp, LPARAM lp)
Definition: winmain.c:1186
static void display_rpn_result(HWND hwnd, calc_number_t *rpn)
Definition: winmain.c:670
static int process_vk_key(WPARAM wParam, LPARAM lParam)
Definition: winmain.c:419
static void set_rpn_result(HWND hwnd, calc_number_t *rpn)
Definition: winmain.c:661
UINT BtnCount
Definition: winmain.c:251
#define BITMASK_IS_ASCII
Definition: winmain.c:43
static void run_rpar(calc_number_t *c)
Definition: winmain.c:1238
static statistic_t * upload_stat_number(int n)
Definition: winmain.c:1151
static LRESULT CALLBACK SubclassButtonProc(HWND hWnd, WPARAM wp, LPARAM lp)
Definition: winmain.c:1248
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define GetLocaleInfo
Definition: winnls.h:1186
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define RegQueryValueEx
Definition: winreg.h:524
#define ODS_DISABLED
Definition: winuser.h:2547
HWND WINAPI GetFocus(void)
Definition: window.c:1893
#define LB_ERR
Definition: winuser.h:2432
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define DrawState
Definition: winuser.h:5779
#define WH_KEYBOARD
Definition: winuser.h:32
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1772
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define LB_GETCOUNT
Definition: winuser.h:2038
#define ODS_SELECTED
Definition: winuser.h:2545
#define SW_HIDE
Definition: winuser.h:768
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
#define WM_CLOSE
Definition: winuser.h:1621
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define BN_DBLCLK
Definition: winuser.h:1926
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
#define VK_F12
Definition: winuser.h:2266
#define VK_F9
Definition: winuser.h:2263
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#define WM_KEYUP
Definition: winuser.h:1716
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define SM_CYSCREEN
Definition: winuser.h:960
#define CallWindowProc
Definition: winuser.h:5744
#define BST_UNCHECKED
Definition: winuser.h:199
#define IMAGE_ICON
Definition: winuser.h:212
#define AppendMenu
Definition: winuser.h:5740
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define DSS_DISABLED
Definition: winuser.h:519
#define GWL_ID
Definition: winuser.h:859
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define GetClassName
Definition: winuser.h:5792
#define GetDlgItemText
Definition: winuser.h:5794
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define BM_SETSTATE
Definition: winuser.h:1923
#define WM_COMMAND
Definition: winuser.h:1740
#define MF_STRING
Definition: winuser.h:138
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define CreateDialog
Definition: winuser.h:5758
#define HC_ACTION
Definition: winuser.h:48
#define DFC_BUTTON
Definition: winuser.h:476
#define SM_CYSMICON
Definition: winuser.h:1013
#define WM_SETFOCUS
Definition: winuser.h:1613
#define MF_CHECKED
Definition: winuser.h:132
#define WM_MOUSEMOVE
Definition: winuser.h:1775
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
BOOL WINAPI TrackMouseEvent(_Inout_ LPTRACKMOUSEEVENT)
#define WM_INITDIALOG
Definition: winuser.h:1739
#define LB_ADDSTRING
Definition: winuser.h:2031
#define SetWindowsHookEx
Definition: winuser.h:5865
HANDLE WINAPI GetClipboardData(_In_ UINT)
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define VK_F1
Definition: winuser.h:2255
#define VK_F6
Definition: winuser.h:2260
#define MF_UNCHECKED
Definition: winuser.h:204
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define TPM_TOPALIGN
Definition: winuser.h:2383
#define WM_DRAWITEM
Definition: winuser.h:1645
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define CBN_SELCHANGE
Definition: winuser.h:1979
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_SETTINGCHANGE
Definition: winuser.h:1629
#define GetMessage
Definition: winuser.h:5799
#define SM_CXSMICON
Definition: winuser.h:1012
#define WM_ENTERMENULOOP
Definition: winuser.h:1804
#define LB_RESETCONTENT
Definition: winuser.h:2055
#define LB_DELETESTRING
Definition: winuser.h:2032
#define VK_RETURN
Definition: winuser.h:2201
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define VK_F5
Definition: winuser.h:2259
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MF_ENABLED
Definition: winuser.h:128
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define VK_F8
Definition: winuser.h:2262
#define BM_CLICK
Definition: winuser.h:1917
#define TPM_LEFTALIGN
Definition: winuser.h:2377
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define SendMessage
Definition: winuser.h:5852
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define VK_BACK
Definition: winuser.h:2198
#define WM_EXITMENULOOP
Definition: winuser.h:1805
#define VK_F3
Definition: winuser.h:2257
#define LR_SHARED
Definition: winuser.h:1100
#define LoadMenu
Definition: winuser.h:5826
#define DST_TEXT
Definition: winuser.h:513
#define VK_F4
Definition: winuser.h:2258
#define GetWindowText
Definition: winuser.h:5807
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define PostMessage
Definition: winuser.h:5841
HWND WINAPI GetParent(_In_ HWND)
#define LoadImage
Definition: winuser.h:5824
#define MapVirtualKeyEx
Definition: winuser.h:5830
BOOL WINAPI DestroyMenu(_In_ HMENU)
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define LoadString
Definition: winuser.h:5828
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define CBN_DBLCLK
Definition: winuser.h:1973
#define BN_CLICKED
Definition: winuser.h:1925
#define SW_SHOW
Definition: winuser.h:775
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define VK_DELETE
Definition: winuser.h:2233
#define WM_DESTROY
Definition: winuser.h:1609
#define LR_DEFAULTSIZE
Definition: winuser.h:1094
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define SM_CXSCREEN
Definition: winuser.h:959
#define ODT_BUTTON
Definition: winuser.h:2540
#define WM_KEYDOWN
Definition: winuser.h:1715
#define DispatchMessage
Definition: winuser.h:5774
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define TPM_RETURNCMD
Definition: winuser.h:2387
#define LB_GETCURSEL
Definition: winuser.h:2039
#define CB_GETCURSEL
Definition: winuser.h:1943
#define GWL_STYLE
Definition: winuser.h:852
#define SendDlgItemMessage
Definition: winuser.h:5851
int WINAPI ToAsciiEx(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT, _In_opt_ HKL)
#define VK_ESCAPE
Definition: winuser.h:2214
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DFCS_PUSHED
Definition: winuser.h:503
int WINAPI GetSystemMetrics(_In_ int)
#define SetDlgItemText
Definition: winuser.h:5858
#define VK_F7
Definition: winuser.h:2261
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
#define VK_INSERT
Definition: winuser.h:2232
#define BST_CHECKED
Definition: winuser.h:197
HMENU WINAPI GetMenu(_In_ HWND)
#define VK_MENU
Definition: winuser.h:2204
#define MF_GRAYED
Definition: winuser.h:129
#define VK_F2
Definition: winuser.h:2256
int * display
Definition: x11stubs.c:12
char TCHAR
Definition: xmlstorage.h:189
char * LPSTR
Definition: xmlstorage.h:182
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _tcslen
Definition: xmlstorage.h:198
#define _tcsicmp
Definition: xmlstorage.h:205
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193