Delete all Trailing spaces in code.
[reactos.git] / rostests / tests / primitives / primitives.cpp
index 1a34999..df61756 100644 (file)
@@ -6,7 +6,7 @@
 // Created by Damon Chandler <dmc27@ee.cornell.edu>
 // Updates can be downloaded at: <www.coriolis.com>
 //
-// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu 
+// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu
 // if you have any questions about this code.
 // ------------------------------------------------------------------
 
 
 HINSTANCE hInst;
 const char* WndClassName = "GMainWnd";
-LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, 
+LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
    LPARAM LParam);
 
 
-int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR, 
+int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR,
    int nCmdShow)
 {
    hInst = hInstance;
 
    WNDCLASS wc;
    memset(&wc, 0, sizeof(WNDCLASS));
-    
+
    wc.style = CS_VREDRAW | CS_HREDRAW;
    wc.lpszClassName = WndClassName;
    wc.lpfnWndProc = MainWndProc;
@@ -45,15 +45,15 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR,
 
    if (RegisterClass(&wc))
    {
-      HWND hWnd = 
+      HWND hWnd =
          CreateWindow(
             WndClassName, TEXT("Output Primitives Demo"),
-            WS_OVERLAPPEDWINDOW | WS_CAPTION | 
+            WS_OVERLAPPEDWINDOW | WS_CAPTION |
             WS_VISIBLE | WS_CLIPCHILDREN,
             CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
             NULL, NULL, hInst, NULL
             );
-                                 
+
       if (hWnd)
       {
          ShowWindow(hWnd, nCmdShow);
@@ -64,10 +64,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR,
          {
              TranslateMessage(&msg);
              DispatchMessage(&msg);
-         }      
+         }
       }
     }
-    return 0;                                                               
+    return 0;
 }
 //------------------------------------------------------------------
 
@@ -77,7 +77,7 @@ enum OutPrimitive {
    opEllipse, opArc, opPie, opChord, opCustom
    };
 
-void DrawPrimitive(IN HDC hDC, IN const RECT& RPrimitive, 
+void DrawPrimitive(IN HDC hDC, IN const RECT& RPrimitive,
    IN OutPrimitive PrimitiveID)
 {
    RECT R = RPrimitive;
@@ -98,8 +98,8 @@ void DrawPrimitive(IN HDC hDC, IN const RECT& RPrimitive,
             {(R.right - R.left) / 2, R.top},
             {(R.right - R.left) / 2, R.bottom},
             {R.right, R.bottom}
-            };         
-         PolyBezier(hDC, PControlPoints, 4);         
+            };
+         PolyBezier(hDC, PControlPoints, 4);
          break;
       }
       case opRectangle:
@@ -122,8 +122,8 @@ void DrawPrimitive(IN HDC hDC, IN const RECT& RPrimitive,
          const POINT PRads[] = {
             {(R.right - R.left) / 3 + R.left, R.top},
             {(R.right - R.left) / 3 + R.left, R.bottom}
-            };         
-         Arc(hDC, R.left, R.top, R.right, R.bottom, 
+            };
+         Arc(hDC, R.left, R.top, R.right, R.bottom,
              PRads[0].x, PRads[0].y, PRads[1].x, PRads[1].y);
          break;
       }
@@ -132,8 +132,8 @@ void DrawPrimitive(IN HDC hDC, IN const RECT& RPrimitive,
          const POINT PRads[] = {
             {(R.right - R.left) / 3 + R.left, R.top},
             {(R.right - R.left) / 3 + R.left, R.bottom}
-            };         
-         Pie(hDC, R.left, R.top, R.right, R.bottom, 
+            };
+         Pie(hDC, R.left, R.top, R.right, R.bottom,
              PRads[0].x, PRads[0].y, PRads[1].x, PRads[1].y);
          break;
       }
@@ -142,8 +142,8 @@ void DrawPrimitive(IN HDC hDC, IN const RECT& RPrimitive,
          const POINT PRads[] = {
             {(R.right - R.left) / 3 + R.left, R.top},
             {(R.right - R.left) / 3 + R.left, R.bottom}
-            };         
-         Chord(hDC, R.left, R.top, R.right, R.bottom, 
+            };
+         Chord(hDC, R.left, R.top, R.right, R.bottom,
              PRads[0].x, PRads[0].y, PRads[1].x, PRads[1].y);
          break;
       }
@@ -153,8 +153,8 @@ void DrawPrimitive(IN HDC hDC, IN const RECT& RPrimitive,
             {R.left, (R.bottom - R.top) / 2 + R.top},
             {(R.right - R.left) / 2 + R.left, R.top},
             {R.right, (R.bottom - R.top) / 2 + R.top},
-            {(R.right - R.left) / 2 + R.left, R.bottom}            
-            };         
+            {(R.right - R.left) / 2 + R.left, R.bottom}
+            };
          Polygon(hDC, PVertices, 4);
          break;
       }
@@ -168,20 +168,20 @@ HBRUSH hListBrush = NULL;  // handle to the list box brush
 HPEN hListPen = NULL;      // handle to the list box pen
 HFONT hListFont = NULL;    // handle to the list box font
 
-LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, 
+LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
    LPARAM lParam)
 {
    switch (msg)
    {
       case WM_CREATE:
       {
-         hListBox = 
+         hListBox =
             CreateWindowEx(
-               WS_EX_CLIENTEDGE, TEXT("LISTBOX"), TEXT(""), 
+               WS_EX_CLIENTEDGE, TEXT("LISTBOX"), TEXT(""),
                WS_CHILD | WS_VISIBLE | WS_VSCROLL |
-               LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | 
-               LBS_OWNERDRAWFIXED, 
-               0, 0, 640, 480, 
+               LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT |
+               LBS_OWNERDRAWFIXED,
+               0, 0, 640, 480,
                hWnd, NULL, hInst, NULL
                );
          assert(hListBox != NULL);
@@ -190,23 +190,23 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
             hListBox, GWL_ID, reinterpret_cast<LONG>(hListBox)
             );
 
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Line")));
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Bezier Curve")));
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Rectangle")));
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Rounded Rectangle")));
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Ellipse")));
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Arc")));
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Pie Slice")));
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Chord")));
-         SNDMSG(hListBox, LB_ADDSTRING, 0, 
+         SNDMSG(hListBox, LB_ADDSTRING, 0,
                 reinterpret_cast<LPARAM>(TEXT("Custom")));
 
          hListBrush = CreateSolidBrush(PALETTERGB(64, 192, 64));
@@ -218,9 +218,9 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
          {
             // MakeFont() from Chapter 4
             hListFont = font::MakeFont(
-               hScreenDC, "Impact", 20, ANSI_CHARSET, 
+               hScreenDC, "Impact", 20, ANSI_CHARSET,
                font::FS_BOLD | font::FS_UNDERLINE
-               ); 
+               );
          }
 #if 0
          catch (...)
@@ -234,30 +234,30 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
       }
       case WM_MEASUREITEM:
       {
-         LPMEASUREITEMSTRUCT lpmis = 
+         LPMEASUREITEMSTRUCT lpmis =
             reinterpret_cast<LPMEASUREITEMSTRUCT>(lParam);
          assert(lpmis != NULL);
 
          if (lpmis->CtlID == reinterpret_cast<UINT>(hListBox))
          {
-            lpmis->itemHeight = 150;            
-            return TRUE;         
+            lpmis->itemHeight = 150;
+            return TRUE;
          }
          break;
       }
       case WM_DRAWITEM:
       {
-         LPDRAWITEMSTRUCT lpdis = 
+         LPDRAWITEMSTRUCT lpdis =
             reinterpret_cast<LPDRAWITEMSTRUCT>(lParam);
          assert(lpdis != NULL);
 
          if (lpdis->CtlID == reinterpret_cast<UINT>(hListBox))
-         {            
+         {
             SaveDC(lpdis->hDC);
 #if 0
             try
 #endif
-            {              
+            {
                SelectObject(lpdis->hDC, hListBrush);
                SelectObject(lpdis->hDC, hListPen);
                SelectObject(lpdis->hDC, hListFont);
@@ -280,11 +280,11 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
                   0.6 * lpdis->rcItem.right + 0.5
                   );
                FillRect(
-                  lpdis->hDC, &RPrimitive, 
+                  lpdis->hDC, &RPrimitive,
                   reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1)
                   );
                DrawPrimitive(
-                  lpdis->hDC, RPrimitive, 
+                  lpdis->hDC, RPrimitive,
                   static_cast<OutPrimitive>(lpdis->itemID)
                   );
                if (selected) InvertRect(lpdis->hDC, &RPrimitive);
@@ -292,24 +292,24 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
 
                // render the text
                TCHAR text[13];
-               if (SNDMSG(hListBox, LB_GETTEXT, lpdis->itemID, 
+               if (SNDMSG(hListBox, LB_GETTEXT, lpdis->itemID,
                           reinterpret_cast<LPARAM>(&text)) != LB_ERR)
-               {           
+               {
                   RECT RText = RPrimitive;
                   RText.left =  RPrimitive.right;
-                  RText.right = lpdis->rcItem.right; 
+                  RText.right = lpdis->rcItem.right;
 
                   SelectObject(lpdis->hDC, hListFont);
                   SetBkMode(lpdis->hDC, TRANSPARENT);
                   SetTextColor(lpdis->hDC, clrText);
-            
-                  DrawText(lpdis->hDC, text, -1, &RText, 
+
+                  DrawText(lpdis->hDC, text, -1, &RText,
                            DT_CENTER | DT_VCENTER | DT_SINGLELINE);
                }
 
                // indicate keyboard focus
                if (lpdis->itemState & ODS_FOCUS)
-               {  
+               {
                   RECT RFocus = lpdis->rcItem;
                   InflateRect(&RFocus, -1, -1);
                   DrawFocusRect(lpdis->hDC, &RFocus);
@@ -330,7 +330,7 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
       {
          MoveWindow(
             hListBox, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE
-            ); 
+            );
          return 0;
       }
       case WM_DESTROY: