2 * PROJECT: PAINT for ReactOS
4 * FILE: base/applications/paint/dialogs.c
5 * PURPOSE: Window procedures of the dialog windows plus launching functions
6 * PROGRAMMERS: Benedikt Freisen
9 /* INCLUDES *********************************************************/
13 /* FUNCTIONS ********************************************************/
16 MRDlgWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
21 CheckDlgButton(hwnd
, IDD_MIRRORROTATERB1
, BST_CHECKED
);
22 CheckDlgButton(hwnd
, IDD_MIRRORROTATERB4
, BST_CHECKED
);
28 switch (LOWORD(wParam
))
31 if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB1
))
33 else if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB2
))
35 else if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB4
))
37 else if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB5
))
39 else if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB6
))
45 case IDD_MIRRORROTATERB3
:
46 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB4
), TRUE
);
47 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB5
), TRUE
);
48 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB6
), TRUE
);
50 case IDD_MIRRORROTATERB1
:
51 case IDD_MIRRORROTATERB2
:
52 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB4
), FALSE
);
53 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB5
), FALSE
);
54 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB6
), FALSE
);
67 return DialogBox(hProgInstance
, MAKEINTRESOURCE(IDD_MIRRORROTATE
), hMainWnd
, (DLGPROC
) MRDlgWinProc
);
71 ATTDlgWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
80 widthSetInDlg
= imgXRes
;
81 heightSetInDlg
= imgYRes
;
83 CheckDlgButton(hwnd
, IDD_ATTRIBUTESRB3
, BST_CHECKED
);
84 CheckDlgButton(hwnd
, IDD_ATTRIBUTESRB5
, BST_CHECKED
);
85 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT1
, widthSetInDlg
, FALSE
);
86 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT2
, heightSetInDlg
, FALSE
);
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(" "));
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
);
102 LoadString(hProgInstance
, IDS_PRINTRES
, strrc
, SIZEOF(strrc
));
103 _stprintf(res
, strrc
, fileHPPM
, fileVPPM
);
104 SetDlgItemText(hwnd
, IDD_ATTRIBUTESTEXT8
, res
);
111 switch (LOWORD(wParam
))
119 case IDD_ATTRIBUTESSTANDARD
:
120 widthSetInDlg
= imgXRes
;
121 heightSetInDlg
= imgYRes
;
122 CheckDlgButton(hwnd
, IDD_ATTRIBUTESRB3
, BST_CHECKED
);
123 CheckDlgButton(hwnd
, IDD_ATTRIBUTESRB5
, BST_CHECKED
);
124 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT1
, widthSetInDlg
, FALSE
);
125 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT2
, heightSetInDlg
, FALSE
);
127 case IDD_ATTRIBUTESRB1
:
130 _stprintf(number
, _T("%.3lf"), widthSetInDlg
/ (0.0254 * fileHPPM
));
131 SetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, number
);
132 _stprintf(number
, _T("%.3lf"), heightSetInDlg
/ (0.0254 * fileVPPM
));
133 SetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, number
);
136 case IDD_ATTRIBUTESRB2
:
139 _stprintf(number
, _T("%.3lf"), widthSetInDlg
* 100.0 / fileHPPM
);
140 SetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, number
);
141 _stprintf(number
, _T("%.3lf"), heightSetInDlg
* 100.0 / fileVPPM
);
142 SetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, number
);
145 case IDD_ATTRIBUTESRB3
:
146 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT1
, widthSetInDlg
, FALSE
);
147 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT2
, heightSetInDlg
, FALSE
);
149 case IDD_ATTRIBUTESEDIT1
:
150 if (Edit_GetModify((HWND
)lParam
))
153 if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB1
))
155 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, tempS
, SIZEOF(tempS
));
156 widthSetInDlg
= max(1, (int) (_tcstod(tempS
, NULL
) * fileHPPM
* 0.0254));
158 else if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB2
))
160 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, tempS
, SIZEOF(tempS
));
161 widthSetInDlg
= max(1, (int) (_tcstod(tempS
, NULL
) * fileHPPM
/ 100));
163 else if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB3
))
165 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, tempS
, SIZEOF(tempS
));
166 widthSetInDlg
= max(1, _tstoi(tempS
));
168 Edit_SetModify((HWND
)lParam
, FALSE
);
171 case IDD_ATTRIBUTESEDIT2
:
172 if (Edit_GetModify((HWND
)lParam
))
175 if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB1
))
177 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, tempS
, SIZEOF(tempS
));
178 heightSetInDlg
= max(1, (int) (_tcstod(tempS
, NULL
) * fileVPPM
* 0.0254));
180 else if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB2
))
182 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, tempS
, SIZEOF(tempS
));
183 heightSetInDlg
= max(1, (int) (_tcstod(tempS
, NULL
) * fileVPPM
/ 100));
185 else if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB3
))
187 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, tempS
, SIZEOF(tempS
));
188 heightSetInDlg
= max(1, _tstoi(tempS
));
190 Edit_SetModify((HWND
)lParam
, FALSE
);
204 return DialogBox(hProgInstance
, MAKEINTRESOURCE(IDD_ATTRIBUTES
), hMainWnd
, (DLGPROC
) ATTDlgWinProc
);
208 CHSIZEDlgWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
213 SetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITHSTRETCH
, 100, FALSE
);
214 SetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITVSTRETCH
, 100, FALSE
);
215 SetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITHSKEW
, 0, FALSE
);
216 SetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITVSKEW
, 0, FALSE
);
222 switch (LOWORD(wParam
))
226 TCHAR strrcIntNumbers
[100];
227 TCHAR strrcPercentage
[100];
228 TCHAR strrcAngle
[100];
229 BOOL tr1
, tr2
, tr3
, tr4
;
231 LoadString(hProgInstance
, IDS_INTNUMBERS
, strrcIntNumbers
, SIZEOF(strrcIntNumbers
));
232 LoadString(hProgInstance
, IDS_PERCENTAGE
, strrcPercentage
, SIZEOF(strrcPercentage
));
233 LoadString(hProgInstance
, IDS_ANGLE
, strrcAngle
, SIZEOF(strrcAngle
));
235 stretchSkew
.percentage
.x
= GetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITHSTRETCH
, &tr1
, FALSE
);
236 stretchSkew
.percentage
.y
= GetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITVSTRETCH
, &tr2
, FALSE
);
237 stretchSkew
.angle
.x
= GetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITHSKEW
, &tr3
, TRUE
);
238 stretchSkew
.angle
.y
= GetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITVSKEW
, &tr4
, TRUE
);
240 if (!(tr1
&& tr2
&& tr3
&& tr4
))
241 MessageBox(hwnd
, strrcIntNumbers
, NULL
, MB_ICONEXCLAMATION
);
242 else if (stretchSkew
.percentage
.x
< 1 || stretchSkew
.percentage
.x
> 500
243 || stretchSkew
.percentage
.y
< 1 || stretchSkew
.percentage
.y
> 500)
244 MessageBox(hwnd
, strrcPercentage
, NULL
, MB_ICONEXCLAMATION
);
245 else if (stretchSkew
.angle
.x
< -89 || stretchSkew
.angle
.x
> 89
246 || stretchSkew
.angle
.y
< -89 || stretchSkew
.angle
.y
> 89)
247 MessageBox(hwnd
, strrcAngle
, NULL
, MB_ICONEXCLAMATION
);
267 return DialogBox(hProgInstance
, MAKEINTRESOURCE(IDD_STRETCHSKEW
), hMainWnd
, (DLGPROC
) CHSIZEDlgWinProc
);