[NTDLL]
[reactos.git] / base / applications / paint / dialogs.c
1 /*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL
4 * FILE: base/applications/paint/dialogs.c
5 * PURPOSE: Window procedures of the dialog windows plus launching functions
6 * PROGRAMMERS: Benedikt Freisen
7 */
8
9 /* INCLUDES *********************************************************/
10
11 #include <windows.h>
12 #include <tchar.h>
13 #include "definitions.h"
14 #include "globalvar.h"
15
16 /* FUNCTIONS ********************************************************/
17
18 LRESULT CALLBACK
19 MRDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
20 {
21 switch (message)
22 {
23 case WM_INITDIALOG:
24 CheckDlgButton(hwnd, IDD_MIRRORROTATERB1, BST_CHECKED);
25 CheckDlgButton(hwnd, IDD_MIRRORROTATERB4, BST_CHECKED);
26 return TRUE;
27 case WM_CLOSE:
28 EndDialog(hwnd, 0);
29 break;
30 case WM_COMMAND:
31 switch (LOWORD(wParam))
32 {
33 case IDOK:
34 if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB1))
35 EndDialog(hwnd, 1);
36 else if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB2))
37 EndDialog(hwnd, 2);
38 else if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB4))
39 EndDialog(hwnd, 3);
40 else if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB5))
41 EndDialog(hwnd, 4);
42 else if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB6))
43 EndDialog(hwnd, 5);
44 break;
45 case IDCANCEL:
46 EndDialog(hwnd, 0);
47 break;
48 case IDD_MIRRORROTATERB3:
49 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB4), TRUE);
50 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB5), TRUE);
51 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB6), TRUE);
52 break;
53 case IDD_MIRRORROTATERB1:
54 case IDD_MIRRORROTATERB2:
55 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB4), FALSE);
56 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB5), FALSE);
57 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB6), FALSE);
58 break;
59 }
60 break;
61 default:
62 return FALSE;
63 }
64 return TRUE;
65 }
66
67 int
68 mirrorRotateDlg()
69 {
70 return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_MIRRORROTATE), hMainWnd, (DLGPROC) MRDlgWinProc);
71 }
72
73 LRESULT CALLBACK
74 ATTDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
75 {
76 switch (message)
77 {
78 case WM_INITDIALOG:
79 {
80 TCHAR strrc[100];
81 TCHAR res[100];
82
83 CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
84 CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
85 SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
86 SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
87
88 if (isAFile)
89 {
90 TCHAR date[100];
91 TCHAR size[100];
92 TCHAR temp[100];
93 GetDateFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, date, SIZEOF(date));
94 GetTimeFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, temp, SIZEOF(temp));
95 _tcscat(date, _T(" "));
96 _tcscat(date, temp);
97 LoadString(hProgInstance, IDS_FILESIZE, strrc, SIZEOF(strrc));
98 _stprintf(size, strrc, fileSize);
99 SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT6, date);
100 SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT7, size);
101 }
102 LoadString(hProgInstance, IDS_PRINTRES, strrc, SIZEOF(strrc));
103 _stprintf(res, strrc, fileHPPM, fileVPPM);
104 SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT8, res);
105 return TRUE;
106 }
107 case WM_CLOSE:
108 EndDialog(hwnd, 0);
109 break;
110 case WM_COMMAND:
111 switch (LOWORD(wParam))
112 {
113 case IDOK:
114 EndDialog(hwnd,
115 GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, NULL,
116 FALSE) | (GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, NULL,
117 FALSE) << 16));
118 break;
119 case IDCANCEL:
120 EndDialog(hwnd, 0);
121 break;
122 case IDD_ATTRIBUTESSTANDARD:
123 CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
124 CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
125 SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
126 SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
127 break;
128 }
129 break;
130 default:
131 return FALSE;
132 }
133 return TRUE;
134 }
135
136 int
137 attributesDlg()
138 {
139 return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_ATTRIBUTES), hMainWnd, (DLGPROC) ATTDlgWinProc);
140 }
141
142 LRESULT CALLBACK
143 CHSIZEDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
144 {
145 switch (message)
146 {
147 case WM_INITDIALOG:
148 SetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT1, 100, FALSE);
149 SetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT2, 100, FALSE);
150 return TRUE;
151 case WM_CLOSE:
152 EndDialog(hwnd, 0);
153 break;
154 case WM_COMMAND:
155 switch (LOWORD(wParam))
156 {
157 case IDOK:
158 EndDialog(hwnd,
159 GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT1, NULL,
160 FALSE) | (GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT2, NULL,
161 FALSE) << 16));
162 break;
163 case IDCANCEL:
164 EndDialog(hwnd, 0);
165 break;
166 }
167 break;
168 default:
169 return FALSE;
170 }
171 return TRUE;
172 }
173
174 int
175 changeSizeDlg()
176 {
177 return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_CHANGESIZE), hMainWnd, (DLGPROC) CHSIZEDlgWinProc);
178 }