[MAGNIFY]
[reactos.git] / reactos / base / applications / magnify / magnifier.c
index 31435bf..8d8bec5 100644 (file)
@@ -7,8 +7,16 @@
  *
  */
 
+/* TODO: AppBar */
 #include "magnifier.h"
 
+#include <winbase.h>
+#include <winuser.h>
+#include <wingdi.h>
+#include <winnls.h>
+
+#include "resource.h"
+
 const TCHAR szWindowClass[] = TEXT("MAGNIFIER");
 
 #define MAX_LOADSTRING 100
@@ -48,6 +56,16 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
     UNREFERENCED_PARAMETER(hPrevInstance);
     UNREFERENCED_PARAMETER(lpCmdLine);
 
+    switch (GetUserDefaultUILanguage())
+  {
+    case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT):
+      SetProcessDefaultLayout(LAYOUT_RTL);
+      break;
+
+    default:
+      break;
+  }
+
     // Initialize global strings
     LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
     MyRegisterClass(hInstance);
@@ -118,18 +136,21 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
  */
 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
 {
+   RECT rcWorkArea;
    hInst = hInstance; // Store instance handle in our global variable
 
-    // Create the Window
+   SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0);
+
+   /* Create the Window */
    hMainWnd = CreateWindowEx(
-        WS_EX_TOPMOST,
+        WS_EX_TOPMOST | WS_EX_PALETTEWINDOW,
         szWindowClass,
         szTitle,
         WS_OVERLAPPEDWINDOW,
         CW_USEDEFAULT,
         CW_USEDEFAULT,
-        CW_USEDEFAULT,
-        CW_USEDEFAULT,
+        (rcWorkArea.right - rcWorkArea.left) * 2 / 3,
+        200,
         NULL,
         NULL,
         hInstance,
@@ -166,7 +187,7 @@ void Draw(HDC aDc)
     HDC HdcStrech;
     HANDLE hOld;
     HBITMAP HbmpStrech;
-
+    
     RECT R;
     RECT appRect;
     DWORD rop = SRCCOPY;
@@ -198,7 +219,7 @@ void Draw(HDC aDc)
 
     /* Select our bitmap in memory DC and save the old one.*/
     hOld = SelectObject (HdcStrech , HbmpStrech);
-
+    
     /* Paint the screen bitmap to our in memory DC */
     BitBlt(
         HdcStrech,
@@ -210,7 +231,7 @@ void Draw(HDC aDc)
         0,
         0,
         SRCCOPY);
-
+        
     /* Draw the mouse pointer in the right position */
     DrawIcon(
         HdcStrech ,
@@ -267,8 +288,9 @@ void Draw(HDC aDc)
         blitAreaY,
         blitAreaWidth,
         blitAreaHeight,
-        rop);
-
+        rop | NOMIRRORBITMAP);
+        
+        
     /* Cleanup.*/
     if (iinfo.hbmMask)
         DeleteObject(iinfo.hbmMask);
@@ -331,22 +353,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                 //Update to new position
                 pMouse = pNewMouse;
                 cp = pNewMouse;
-                Refresh();
             }
             else if (((pCaret.x != pNewCaret.x) || (pCaret.y != pNewCaret.y)) && bFollowCaret)
             {
                 //Update to new position
                 pCaret = pNewCaret;
                 cp = pNewCaret;
-                Refresh();
             }
             else if (((pFocus.x != pNewFocus.x) || (pFocus.y != pNewFocus.y)) && bFollowFocus)
             {
                 //Update to new position
                 pFocus = pNewFocus;
                 cp = pNewFocus;
-                Refresh();
             }
+            Refresh();
         }
         break;
     case WM_COMMAND: