[PAINT] rearranging variable declarations for better MSVC compatiblity
authorBenedikt Freisen <b.freisen@gmx.net>
Mon, 19 Oct 2009 17:46:29 +0000 (17:46 +0000)
committerBenedikt Freisen <b.freisen@gmx.net>
Mon, 19 Oct 2009 17:46:29 +0000 (17:46 +0000)
svn path=/trunk/; revision=43615

reactos/base/applications/paint/dialogs.c
reactos/base/applications/paint/main.c
reactos/base/applications/paint/winproc.c

index 2df56f1..b29bd90 100644 (file)
@@ -73,30 +73,34 @@ LRESULT CALLBACK ATTDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
     switch (message)
     {
         case WM_INITDIALOG:
-            CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
-            CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
-            SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
-            SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
-            TCHAR strrc[100];
-            if (isAFile)
             {
-                TCHAR date[100];
-                TCHAR size[100];
-                TCHAR temp[100];
-                GetDateFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, date, sizeof(date));
-                GetTimeFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, temp, sizeof(temp));
-                _tcscat(date, _T(" "));
-                _tcscat(date, temp);
-                LoadString(hProgInstance, IDS_FILESIZE, strrc, sizeof(strrc));
-                _stprintf(size, strrc, fileSize);
-                SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT6, date);
-                SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT7, size);
+                TCHAR strrc[100];
+                TCHAR res[100];
+                
+                CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
+                CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
+                SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
+                SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
+                
+                if (isAFile)
+                {
+                    TCHAR date[100];
+                    TCHAR size[100];
+                    TCHAR temp[100];
+                    GetDateFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, date, sizeof(date));
+                    GetTimeFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, temp, sizeof(temp));
+                    _tcscat(date, _T(" "));
+                    _tcscat(date, temp);
+                    LoadString(hProgInstance, IDS_FILESIZE, strrc, sizeof(strrc));
+                    _stprintf(size, strrc, fileSize);
+                    SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT6, date);
+                    SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT7, size);
+                }
+                LoadString(hProgInstance, IDS_PRINTRES, strrc, sizeof(strrc));
+                _stprintf(res, strrc, fileHPPM, fileVPPM);
+                SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT8, res);
+                return TRUE;
             }
-            TCHAR res[100];
-            LoadString(hProgInstance, IDS_PRINTRES, strrc, sizeof(strrc));
-            _stprintf(res, strrc, fileHPPM, fileVPPM);
-            SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT8, res);
-            return TRUE;
         case WM_CLOSE:
             EndDialog(hwnd, 0);
             break;
index 7fe41e0..c3eb981 100644 (file)
@@ -351,8 +351,8 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
         {
             TCHAR tempstr[1000];
             TCHAR resstr[100];
-            insertReversible(bmNew);
             TCHAR *temp;
+            insertReversible(bmNew);
             GetFullPathName(lpszArgument, sizeof(filepathname), filepathname, &temp);
             _tcscpy(filename, temp);
             LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
index cd6e74c..c72c266 100644 (file)
@@ -50,11 +50,14 @@ void updateCanvasAndScrollbars()
 
 void zoomTo(int newZoom, int mouseX, int mouseY)
 {
+    int tbPos = 0;
+    int tempZoom = newZoom;
+
     long clientRectScrollbox[4];
     long clientRectImageArea[4];
+    int x, y, w, h;
     GetClientRect(hScrollbox, (LPRECT)&clientRectScrollbox);
     GetClientRect(hImageArea, (LPRECT)&clientRectImageArea);
-    int x, y, w, h;
     w = clientRectImageArea[2] * clientRectScrollbox[2] / (clientRectImageArea[2] * newZoom / zoom);
     h = clientRectImageArea[3] * clientRectScrollbox[3] / (clientRectImageArea[3] * newZoom / zoom);
     x = max(0, min(clientRectImageArea[2] - w, mouseX - w / 2)) * newZoom / zoom;
@@ -70,8 +73,6 @@ void zoomTo(int newZoom, int mouseX, int mouseY)
     SendMessage(hScrollbox, WM_HSCROLL, SB_THUMBPOSITION | (x << 16), 0);
     SendMessage(hScrollbox, WM_VSCROLL, SB_THUMBPOSITION | (y << 16), 0);
     
-    int tbPos = 0;
-    int tempZoom = newZoom;
     while (tempZoom>125)
     {
         tbPos++;
@@ -82,24 +83,26 @@ void zoomTo(int newZoom, int mouseX, int mouseY)
 
 void drawZoomFrame(int mouseX, int mouseY)
 {
+    HDC hdc;
+    HPEN oldPen;
+    HBRUSH oldBrush;
+    LOGBRUSH logbrush;
+    int rop;
+
     long clientRectScrollbox[4];
     long clientRectImageArea[4];
+    int x, y, w, h;
     GetClientRect(hScrollbox, (LPRECT)&clientRectScrollbox);
     GetClientRect(hImageArea, (LPRECT)&clientRectImageArea);
-    int x, y, w, h;
     w = clientRectImageArea[2] * clientRectScrollbox[2] / (clientRectImageArea[2] * 2);
     h = clientRectImageArea[3] * clientRectScrollbox[3] / (clientRectImageArea[3] * 2);
     x = max(0, min(clientRectImageArea[2] - w, mouseX - w / 2));
     y = max(0, min(clientRectImageArea[3] - h, mouseY - h / 2));
-    HDC hdc;
+    
     hdc = GetDC(hImageArea);
-    HPEN oldPen;
     oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 0, 0));
-    HBRUSH oldBrush;
-    LOGBRUSH logbrush;
     logbrush.lbStyle = BS_HOLLOW;
     oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
-    int rop;
     rop = SetROP2(hdc, R2_NOT);
     Rectangle(hdc, x, y, x + w, y + h);
     SetROP2(hdc, rop);
@@ -525,6 +528,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
             {
                 if ((!drawing)||(activeTool<=9))
                 {
+                    TRACKMOUSEEVENT tme;
+
                     TCHAR coordStr[100];
                     _stprintf(coordStr, _T("%d, %d"), (short)LOWORD(lParam)*1000/zoom, (short)HIWORD(lParam)*1000/zoom);
                     SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM)coordStr);
@@ -535,7 +540,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
                         drawZoomFrame((short)LOWORD(lParam), (short)HIWORD(lParam));
                     }
                     
-                    TRACKMOUSEEVENT tme;
                     tme.cbSize = sizeof(TRACKMOUSEEVENT);
                     tme.dwFlags = TME_LEAVE;
                     tme.hwndTrack = hImageArea;