a5592dcfea73dfb9d1416127337ed69e58128ede
[reactos.git] / reactos / base / applications / paint / dialogs.c
1 /*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL
4 * FILE: 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 "definitions.h"
13 #include "globalvar.h"
14
15 /* FUNCTIONS ********************************************************/
16
17 LRESULT CALLBACK MRDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
18 {
19 switch (message)
20 {
21 case WM_INITDIALOG:
22 CheckDlgButton(hwnd, IDD_MIRRORROTATERB1, BST_CHECKED);
23 CheckDlgButton(hwnd, IDD_MIRRORROTATERB4, BST_CHECKED);
24 return TRUE;
25 case WM_CLOSE:
26 EndDialog(hwnd, 0);
27 break;
28 case WM_COMMAND:
29 switch (LOWORD(wParam))
30 {
31 case IDOK:
32 if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB1))
33 EndDialog(hwnd, 1);
34 else if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB2))
35 EndDialog(hwnd, 2);
36 else if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB4))
37 EndDialog(hwnd, 3);
38 else if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB5))
39 EndDialog(hwnd, 4);
40 else if (IsDlgButtonChecked(hwnd, IDD_MIRRORROTATERB6))
41 EndDialog(hwnd, 5);
42 break;
43 case IDCANCEL:
44 EndDialog(hwnd, 0);
45 break;
46 case IDD_MIRRORROTATERB3:
47 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB4), TRUE);
48 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB5), TRUE);
49 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB6), TRUE);
50 break;
51 case IDD_MIRRORROTATERB1:
52 case IDD_MIRRORROTATERB2:
53 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB4), FALSE);
54 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB5), FALSE);
55 EnableWindow(GetDlgItem(hwnd, IDD_MIRRORROTATERB6), FALSE);
56 break;
57 }
58 break;
59 default:
60 return FALSE;
61 }
62 return TRUE;
63 }
64
65 int mirrorRotateDlg()
66 {
67 return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_MIRRORROTATE), hMainWnd, (DLGPROC)MRDlgWinProc);
68 }
69
70 LRESULT CALLBACK ATTDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
71 {
72 switch (message)
73 {
74 case WM_INITDIALOG:
75 CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
76 CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
77 SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
78 SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
79 return TRUE;
80 case WM_CLOSE:
81 EndDialog(hwnd, 0);
82 break;
83 case WM_COMMAND:
84 switch (LOWORD(wParam))
85 {
86 case IDOK:
87 EndDialog(hwnd, 1);
88 break;
89 case IDCANCEL:
90 EndDialog(hwnd, 0);
91 break;
92 }
93 break;
94 default:
95 return FALSE;
96 }
97 return TRUE;
98 }
99
100 int attributesDlg()
101 {
102 return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_ATTRIBUTES), hMainWnd, (DLGPROC)ATTDlgWinProc);
103 }
104
105 LRESULT CALLBACK CHSIZEDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
106 {
107 switch (message)
108 {
109 case WM_INITDIALOG:
110 SetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT1, 100, FALSE);
111 SetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT2, 100, FALSE);
112 return TRUE;
113 case WM_CLOSE:
114 EndDialog(hwnd, 0);
115 break;
116 case WM_COMMAND:
117 switch (LOWORD(wParam))
118 {
119 case IDOK:
120 EndDialog(hwnd, GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT1, NULL, FALSE) | (GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT2, NULL, FALSE)<<16));
121 break;
122 case IDCANCEL:
123 EndDialog(hwnd, 0);
124 break;
125 }
126 break;
127 default:
128 return FALSE;
129 }
130 return TRUE;
131 }
132
133 int changeSizeDlg()
134 {
135 return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_CHANGESIZE), hMainWnd, (DLGPROC)CHSIZEDlgWinProc);
136 }