Paint: Added cropping via attributes dialog and setting desktop wallpaper (both not...
[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, GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, NULL, FALSE) | (GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, NULL, FALSE)<<16));
88 break;
89 case IDCANCEL:
90 EndDialog(hwnd, 0);
91 break;
92 case IDD_ATTRIBUTESSTANDARD:
93 CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
94 CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
95 SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
96 SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
97 break;
98 }
99 break;
100 default:
101 return FALSE;
102 }
103 return TRUE;
104 }
105
106 int attributesDlg()
107 {
108 return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_ATTRIBUTES), hMainWnd, (DLGPROC)ATTDlgWinProc);
109 }
110
111 LRESULT CALLBACK CHSIZEDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
112 {
113 switch (message)
114 {
115 case WM_INITDIALOG:
116 SetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT1, 100, FALSE);
117 SetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT2, 100, FALSE);
118 return TRUE;
119 case WM_CLOSE:
120 EndDialog(hwnd, 0);
121 break;
122 case WM_COMMAND:
123 switch (LOWORD(wParam))
124 {
125 case IDOK:
126 EndDialog(hwnd, GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT1, NULL, FALSE) | (GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT2, NULL, FALSE)<<16));
127 break;
128 case IDCANCEL:
129 EndDialog(hwnd, 0);
130 break;
131 }
132 break;
133 default:
134 return FALSE;
135 }
136 return TRUE;
137 }
138
139 int changeSizeDlg()
140 {
141 return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_CHANGESIZE), hMainWnd, (DLGPROC)CHSIZEDlgWinProc);
142 }