Author: dquintana
Date: Sun Dec 13 02:57:14 2015
New Revision: 70336
URL:
http://svn.reactos.org/svn/reactos?rev=70336&view=rev
Log:
[MAGNIFY]
* Replace the menubar with a notification icon and context menu.
* Change the dialog button to "Ok" instead of "Exit" (applied to en-US
and es-ES only, the translators will have to do the rest :P).
* Due to a rather bad problem presumably caused by AttachThreadInput, set the "Follow
Caret" option to disabled by default. This can be re-enabled once the problem is
fixed.
More changes toward CORE-10691
Modified:
trunk/reactos/base/applications/magnify/lang/en-US.rc
trunk/reactos/base/applications/magnify/lang/es-ES.rc
trunk/reactos/base/applications/magnify/magnifier.c
trunk/reactos/base/applications/magnify/settings.c
Modified: trunk/reactos/base/applications/magnify/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/magnify/…
==============================================================================
--- trunk/reactos/base/applications/magnify/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/magnify/lang/en-US.rc [iso-8859-1] Sun Dec 13 02:57:14
2015
@@ -33,7 +33,7 @@
CAPTION "Magnifier Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "Exit", IDOK, 96, 161, 50, 14
+ DEFPUSHBUTTON "Ok", IDOK, 96, 161, 50, 14
PUSHBUTTON "Help", IDC_BUTTON_HELP, 38, 161, 50, 14
LTEXT "Magnification level:", IDC_STATIC, 6, 8, 68, 8
COMBOBOX IDC_ZOOM, 72, 6, 63, 66, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL |
WS_TABSTOP
Modified: trunk/reactos/base/applications/magnify/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/magnify/…
==============================================================================
--- trunk/reactos/base/applications/magnify/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/magnify/lang/es-ES.rc [iso-8859-1] Sun Dec 13 02:57:14
2015
@@ -37,7 +37,7 @@
CAPTION "Configurar lupa"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "Salir", IDOK, 96, 161, 50, 14
+ DEFPUSHBUTTON "Aceptar", IDOK, 96, 161, 50, 14
PUSHBUTTON "Ayuda", IDC_BUTTON_HELP, 38, 161, 50, 14
LTEXT "Niveles de aumento:", IDC_STATIC, 6, 8, 68, 8
COMBOBOX IDC_ZOOM, 76, 6, 63, 66, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL |
WS_TABSTOP
Modified: trunk/reactos/base/applications/magnify/magnifier.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/magnify/…
==============================================================================
--- trunk/reactos/base/applications/magnify/magnifier.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/magnify/magnifier.c [iso-8859-1] Sun Dec 13 02:57:14
2015
@@ -3,8 +3,9 @@
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/applications/magnify/magnifier.c
* PURPOSE: Magnification of parts of the screen.
- * COPYRIGHT: Copyright 2007 Marc Piulachs <marc.piulachs(a)codexchange.net>
- *
+ * AUTHORS:
+ * Marc Piulachs <marc.piulachs(a)codexchange.net>
+ * David Quintana <gigaherz(a)gmail.com>
*/
/* TODO: AppBar */
@@ -14,6 +15,8 @@
#include <winuser.h>
#include <wingdi.h>
#include <winnls.h>
+#include <shellapi.h>
+#include <windowsx.h>
#include "resource.h"
@@ -28,11 +31,18 @@
TCHAR szTitle[MAX_LOADSTRING];
#define TIMER_SPEED 1
-#define REPAINT_SPEED 100
+#define REPAINT_SPEED 100
DWORD lastTicks = 0;
HWND hDesktopWindow = NULL;
+
+#define APPMSG_NOTIFYICON (WM_APP+1)
+HICON notifyIcon;
+NOTIFYICONDATA nid;
+HMENU notifyMenu;
+HWND hOptionsDialog;
+BOOL bOptionsDialog = FALSE;
/* Current magnified area */
POINT cp;
@@ -102,7 +112,7 @@
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = MAKEINTRESOURCE(IDC_MAGNIFIER);
+ wc.lpszMenuName = NULL; //MAKEINTRESOURCE(IDC_MAGNIFIER);
wc.lpszClassName = szWindowClass;
return RegisterClass(&wc);
@@ -136,6 +146,10 @@
ShowWindow(hMainWnd, bStartMinimized ? SW_MINIMIZE : nCmdShow);
UpdateWindow(hMainWnd);
+ // Windows 2003's Magnifier always shows this dialog, and exits when the dialog
isclosed.
+ // Should we add a custom means to prevent opening it?
+ hOptionsDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOGOPTIONS),
hMainWnd, OptionsProc);
+
if (bShowWarning)
DialogBox(hInstance, MAKEINTRESOURCE(IDD_WARNINGDIALOG), hMainWnd, WarningProc);
@@ -293,6 +307,22 @@
ReleaseDC(hDesktopWindow, desktopHdc);
}
+void HandleNotifyIconMessage(HWND hWnd, WPARAM wParam, LPARAM lParam)
+{
+ POINT pt;
+
+ switch(lParam)
+ {
+ case WM_LBUTTONUP:
+ PostMessage(hMainWnd, WM_COMMAND, IDM_OPTIONS, 0);
+ break;
+ case WM_RBUTTONUP:
+ GetCursorPos (&pt);
+ TrackPopupMenu(notifyMenu, 0, pt.x, pt.y, 0, hWnd, NULL);
+ break;
+ }
+}
+
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId;
@@ -390,7 +420,14 @@
switch (wmId)
{
case IDM_OPTIONS:
- DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOGOPTIONS), hWnd,
OptionsProc);
+ if(bOptionsDialog)
+ {
+ ShowWindow(hOptionsDialog, SW_HIDE);
+ }
+ else
+ {
+ ShowWindow(hOptionsDialog, SW_SHOW);
+ }
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, AboutProc);
@@ -423,9 +460,24 @@
SaveSettings();
KillTimer(hWnd , 1);
PostQuitMessage(0);
+
+ /* Cleanup notification icon */
+ ZeroMemory(&nid, sizeof(nid));
+ nid.cbSize = sizeof(nid);
+ nid.uFlags = NIF_MESSAGE;
+ nid.hWnd = hWnd;
+ nid.uCallbackMessage = APPMSG_NOTIFYICON;
+ Shell_NotifyIcon(NIM_DELETE, &nid);
+
+ DestroyIcon(notifyIcon);
+
+ DestroyWindow(hOptionsDialog);
break;
case WM_CREATE:
+ {
+ HMENU tempMenu;
+
/* Load settings from registry */
LoadSettings();
@@ -434,7 +486,36 @@
/* Set the timer */
SetTimer (hWnd , 1, TIMER_SPEED , NULL);
- break;
+
+ /* Notification icon */
+ notifyIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON,
16, 16, 0);
+
+ ZeroMemory(&nid, sizeof(nid));
+ nid.cbSize = sizeof(nid);
+ nid.uFlags = NIF_ICON | NIF_MESSAGE;
+ nid.hWnd = hWnd;
+ nid.uCallbackMessage = APPMSG_NOTIFYICON;
+ nid.hIcon = notifyIcon;
+ Shell_NotifyIcon(NIM_ADD, &nid);
+
+ tempMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDC_MAGNIFIER));
+ notifyMenu = GetSubMenu(tempMenu, 0);
+ RemoveMenu(tempMenu, 0, MF_BYPOSITION);
+ DestroyMenu(tempMenu);
+
+ break;
+ }
+
+ case APPMSG_NOTIFYICON:
+ HandleNotifyIconMessage(hWnd, wParam, lParam);
+
+ break;
+
+ case WM_CONTEXTMENU:
+ {
+ TrackPopupMenu(notifyMenu, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0,
hWnd, NULL);
+ break;
+ }
default:
return DefWindowProc(hWnd, message, wParam, lParam);
@@ -468,6 +549,9 @@
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
+ case WM_SHOWWINDOW:
+ bOptionsDialog = wParam;
+ break;
case WM_INITDIALOG:
{
// Add the zoom items...
@@ -508,7 +592,7 @@
{
case IDOK:
case IDCANCEL:
- EndDialog(hDlg, LOWORD(wParam));
+ ShowWindow(hDlg, SW_HIDE);
return (INT_PTR)TRUE;
case IDC_BUTTON_HELP:
Modified: trunk/reactos/base/applications/magnify/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/magnify/…
==============================================================================
--- trunk/reactos/base/applications/magnify/settings.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/magnify/settings.c [iso-8859-1] Sun Dec 13 02:57:14
2015
@@ -18,7 +18,7 @@
BOOL bFollowMouse = TRUE;
BOOL bFollowFocus = TRUE;
-BOOL bFollowCaret = TRUE;
+BOOL bFollowCaret = FALSE; // FIXME: Default to false because AttachThreadInput seems to
break.
BOOL bInvertColors = FALSE;
BOOL bStartMinimized = FALSE;