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 *********************************************************/
15 /* FUNCTIONS ********************************************************/
18 MRDlgWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
23 CheckDlgButton(hwnd
, IDD_MIRRORROTATERB1
, BST_CHECKED
);
24 CheckDlgButton(hwnd
, IDD_MIRRORROTATERB4
, BST_CHECKED
);
30 switch (LOWORD(wParam
))
33 if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB1
))
35 else if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB2
))
37 else if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB4
))
39 else if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB5
))
41 else if (IsDlgButtonChecked(hwnd
, IDD_MIRRORROTATERB6
))
47 case IDD_MIRRORROTATERB3
:
48 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB4
), TRUE
);
49 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB5
), TRUE
);
50 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB6
), TRUE
);
52 case IDD_MIRRORROTATERB1
:
53 case IDD_MIRRORROTATERB2
:
54 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB4
), FALSE
);
55 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB5
), FALSE
);
56 EnableWindow(GetDlgItem(hwnd
, IDD_MIRRORROTATERB6
), FALSE
);
69 return DialogBox(hProgInstance
, MAKEINTRESOURCE(IDD_MIRRORROTATE
), hMainWnd
, MRDlgWinProc
);
73 ATTDlgWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
82 widthSetInDlg
= imgXRes
;
83 heightSetInDlg
= imgYRes
;
85 CheckDlgButton(hwnd
, IDD_ATTRIBUTESRB3
, BST_CHECKED
);
86 CheckDlgButton(hwnd
, IDD_ATTRIBUTESRB5
, BST_CHECKED
);
87 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT1
, widthSetInDlg
, FALSE
);
88 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT2
, heightSetInDlg
, FALSE
);
95 GetDateFormat(LOCALE_USER_DEFAULT
, 0, &fileTime
, NULL
, date
, SIZEOF(date
));
96 GetTimeFormat(LOCALE_USER_DEFAULT
, 0, &fileTime
, NULL
, temp
, SIZEOF(temp
));
97 _tcscat(date
, _T(" "));
99 LoadString(hProgInstance
, IDS_FILESIZE
, strrc
, SIZEOF(strrc
));
100 _stprintf(size
, strrc
, fileSize
);
101 SetDlgItemText(hwnd
, IDD_ATTRIBUTESTEXT6
, date
);
102 SetDlgItemText(hwnd
, IDD_ATTRIBUTESTEXT7
, size
);
104 LoadString(hProgInstance
, IDS_PRINTRES
, strrc
, SIZEOF(strrc
));
105 _stprintf(res
, strrc
, fileHPPM
, fileVPPM
);
106 SetDlgItemText(hwnd
, IDD_ATTRIBUTESTEXT8
, res
);
113 switch (LOWORD(wParam
))
121 case IDD_ATTRIBUTESSTANDARD
:
122 widthSetInDlg
= imgXRes
;
123 heightSetInDlg
= imgYRes
;
124 CheckDlgButton(hwnd
, IDD_ATTRIBUTESRB3
, BST_CHECKED
);
125 CheckDlgButton(hwnd
, IDD_ATTRIBUTESRB5
, BST_CHECKED
);
126 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT1
, widthSetInDlg
, FALSE
);
127 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT2
, heightSetInDlg
, FALSE
);
129 case IDD_ATTRIBUTESRB1
:
132 _stprintf(number
, _T("%.3lf"), widthSetInDlg
/ (0.0254 * fileHPPM
));
133 SetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, number
);
134 _stprintf(number
, _T("%.3lf"), heightSetInDlg
/ (0.0254 * fileVPPM
));
135 SetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, number
);
138 case IDD_ATTRIBUTESRB2
:
141 _stprintf(number
, _T("%.3lf"), widthSetInDlg
* 100.0 / fileHPPM
);
142 SetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, number
);
143 _stprintf(number
, _T("%.3lf"), heightSetInDlg
* 100.0 / fileVPPM
);
144 SetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, number
);
147 case IDD_ATTRIBUTESRB3
:
148 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT1
, widthSetInDlg
, FALSE
);
149 SetDlgItemInt(hwnd
, IDD_ATTRIBUTESEDIT2
, heightSetInDlg
, FALSE
);
151 case IDD_ATTRIBUTESEDIT1
:
152 if (Edit_GetModify((HWND
)lParam
))
155 if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB1
))
157 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, tempS
, SIZEOF(tempS
));
158 widthSetInDlg
= max(1, (int) (_tcstod(tempS
, NULL
) * fileHPPM
* 0.0254));
160 else if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB2
))
162 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, tempS
, SIZEOF(tempS
));
163 widthSetInDlg
= max(1, (int) (_tcstod(tempS
, NULL
) * fileHPPM
/ 100));
165 else if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB3
))
167 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT1
, tempS
, SIZEOF(tempS
));
168 widthSetInDlg
= max(1, _tstoi(tempS
));
170 Edit_SetModify((HWND
)lParam
, FALSE
);
173 case IDD_ATTRIBUTESEDIT2
:
174 if (Edit_GetModify((HWND
)lParam
))
177 if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB1
))
179 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, tempS
, SIZEOF(tempS
));
180 heightSetInDlg
= max(1, (int) (_tcstod(tempS
, NULL
) * fileVPPM
* 0.0254));
182 else if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB2
))
184 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, tempS
, SIZEOF(tempS
));
185 heightSetInDlg
= max(1, (int) (_tcstod(tempS
, NULL
) * fileVPPM
/ 100));
187 else if (IsDlgButtonChecked(hwnd
, IDD_ATTRIBUTESRB3
))
189 GetDlgItemText(hwnd
, IDD_ATTRIBUTESEDIT2
, tempS
, SIZEOF(tempS
));
190 heightSetInDlg
= max(1, _tstoi(tempS
));
192 Edit_SetModify((HWND
)lParam
, FALSE
);
206 return DialogBox(hProgInstance
, MAKEINTRESOURCE(IDD_ATTRIBUTES
), hMainWnd
, ATTDlgWinProc
);
210 CHSIZEDlgWinProc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
215 SetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITHSTRETCH
, 100, FALSE
);
216 SetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITVSTRETCH
, 100, FALSE
);
217 SetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITHSKEW
, 0, FALSE
);
218 SetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITVSKEW
, 0, FALSE
);
224 switch (LOWORD(wParam
))
228 TCHAR strrcIntNumbers
[100];
229 TCHAR strrcPercentage
[100];
230 TCHAR strrcAngle
[100];
231 BOOL tr1
, tr2
, tr3
, tr4
;
233 LoadString(hProgInstance
, IDS_INTNUMBERS
, strrcIntNumbers
, SIZEOF(strrcIntNumbers
));
234 LoadString(hProgInstance
, IDS_PERCENTAGE
, strrcPercentage
, SIZEOF(strrcPercentage
));
235 LoadString(hProgInstance
, IDS_ANGLE
, strrcAngle
, SIZEOF(strrcAngle
));
237 stretchSkew
.percentage
.x
= GetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITHSTRETCH
, &tr1
, FALSE
);
238 stretchSkew
.percentage
.y
= GetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITVSTRETCH
, &tr2
, FALSE
);
239 stretchSkew
.angle
.x
= GetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITHSKEW
, &tr3
, TRUE
);
240 stretchSkew
.angle
.y
= GetDlgItemInt(hwnd
, IDD_STRETCHSKEWEDITVSKEW
, &tr4
, TRUE
);
242 if (!(tr1
&& tr2
&& tr3
&& tr4
))
243 MessageBox(hwnd
, strrcIntNumbers
, NULL
, MB_ICONEXCLAMATION
);
244 else if (stretchSkew
.percentage
.x
< 1 || stretchSkew
.percentage
.x
> 500
245 || stretchSkew
.percentage
.y
< 1 || stretchSkew
.percentage
.y
> 500)
246 MessageBox(hwnd
, strrcPercentage
, NULL
, MB_ICONEXCLAMATION
);
247 else if (stretchSkew
.angle
.x
< -89 || stretchSkew
.angle
.x
> 89
248 || stretchSkew
.angle
.y
< -89 || stretchSkew
.angle
.y
> 89)
249 MessageBox(hwnd
, strrcAngle
, NULL
, MB_ICONEXCLAMATION
);
269 return DialogBox(hProgInstance
, MAKEINTRESOURCE(IDD_STRETCHSKEW
), hMainWnd
, CHSIZEDlgWinProc
);