Author: ekohl
Date: Sun Apr 22 19:11:04 2007
New Revision: 26464
URL:
http://svn.reactos.org/svn/reactos?rev=26464&view=rev
Log:
- Add the ability to save cursor schemes.
- Open the browse dialog upon double-click on a cursor in the cursor list.
- Localize the filter string and the title string of the browse dialog.
Modified:
trunk/reactos/dll/cpl/main/lang/cs-CZ.rc
trunk/reactos/dll/cpl/main/lang/de-DE.rc
trunk/reactos/dll/cpl/main/lang/en-US.rc
trunk/reactos/dll/cpl/main/lang/es-ES.rc
trunk/reactos/dll/cpl/main/lang/fr-FR.rc
trunk/reactos/dll/cpl/main/lang/hu-HU.rc
trunk/reactos/dll/cpl/main/lang/id-ID.rc
trunk/reactos/dll/cpl/main/lang/it-IT.rc
trunk/reactos/dll/cpl/main/lang/ja-JP.rc
trunk/reactos/dll/cpl/main/lang/nl-NL.rc
trunk/reactos/dll/cpl/main/lang/ru-RU.rc
trunk/reactos/dll/cpl/main/lang/uk-UA.rc
trunk/reactos/dll/cpl/main/mouse.c
trunk/reactos/dll/cpl/main/resource.h
Modified: trunk/reactos/dll/cpl/main/lang/cs-CZ.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/cs-CZ.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/cs-CZ.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/cs-CZ.rc Sun Apr 22 19:11:04 2007
@@ -161,4 +161,6 @@
IDS_HAND "Výbìr odkazu"
IDS_NONE "(Není)"
IDS_SYSTEM_SCHEME "(systémové schéma)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/de-DE.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/de-DE.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/de-DE.rc Sun Apr 22 19:11:04 2007
@@ -163,4 +163,6 @@
IDS_HAND "Verknüpfungsauswahl"
IDS_NONE "(Kein)"
IDS_SYSTEM_SCHEME "(Systemschema)"
+ IDS_BROWSE_FILTER "Cursor (*.ani, *.cur)\0*.ani;*.cur\0Animierte Cursor
(*.ani)\0*.ani\0Statische Cursor (*.cur)\0*.cur\0Alle Dateien\0*.*\0\0"
+ IDS_BROWSE_TITLE "Durchsuchen"
END
Modified: trunk/reactos/dll/cpl/main/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/en-US.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/en-US.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/en-US.rc Sun Apr 22 19:11:04 2007
@@ -161,4 +161,6 @@
IDS_HAND "Link Select"
IDS_NONE "(None)"
IDS_SYSTEM_SCHEME "(system scheme)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/es-ES.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/es-ES.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/es-ES.rc Sun Apr 22 19:11:04 2007
@@ -162,4 +162,6 @@
IDS_HAND "Link Select"
IDS_NONE "(None)"
IDS_SYSTEM_SCHEME "(system scheme)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/fr-FR.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/fr-FR.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/fr-FR.rc Sun Apr 22 19:11:04 2007
@@ -162,4 +162,6 @@
IDS_HAND "Sélection de lien"
IDS_NONE "(Aucun)"
IDS_SYSTEM_SCHEME "(Arrangement système)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/hu-HU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/hu-HU.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/hu-HU.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/hu-HU.rc Sun Apr 22 19:11:04 2007
@@ -162,4 +162,6 @@
IDS_HAND "Link Select"
IDS_NONE "(None)"
IDS_SYSTEM_SCHEME "(system scheme)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/id-ID.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/id-ID.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/id-ID.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/id-ID.rc Sun Apr 22 19:11:04 2007
@@ -161,4 +161,6 @@
IDS_HAND "Memilih Link"
IDS_NONE "(tidak ada)"
IDS_SYSTEM_SCHEME "(skema sistem)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/it-IT.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/it-IT.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/it-IT.rc Sun Apr 22 19:11:04 2007
@@ -163,4 +163,6 @@
IDS_HAND "Seleziona collegamento"
IDS_NONE "(Nessuna)"
IDS_SYSTEM_SCHEME "(Schema di sistema)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/ja-JP.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/ja-JP.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/ja-JP.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/ja-JP.rc Sun Apr 22 19:11:04 2007
@@ -161,4 +161,6 @@
IDS_HAND "Link Select"
IDS_NONE "(None)"
IDS_SYSTEM_SCHEME "(system scheme)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/nl-NL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/nl-NL.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/nl-NL.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/nl-NL.rc Sun Apr 22 19:11:04 2007
@@ -160,4 +160,6 @@
IDS_HAND "Link Select"
IDS_NONE "(None)"
IDS_SYSTEM_SCHEME "(system scheme)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/ru-RU.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/ru-RU.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/ru-RU.rc Sun Apr 22 19:11:04 2007
@@ -162,4 +162,6 @@
IDS_HAND "Link Select"
IDS_NONE "(None)"
IDS_SYSTEM_SCHEME "(system scheme)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/lang/uk-UA.rc…
==============================================================================
--- trunk/reactos/dll/cpl/main/lang/uk-UA.rc (original)
+++ trunk/reactos/dll/cpl/main/lang/uk-UA.rc Sun Apr 22 19:11:04 2007
@@ -169,4 +169,6 @@
IDS_HAND "Âèá³ð ïîñèëàííÿ"
IDS_NONE "(Íåìàº)"
IDS_SYSTEM_SCHEME "(ñèñòåìíà ñõåìà)"
+ IDS_BROWSE_FILTER "Cursors (*.ani, *.cur)\0*.ani;*.cur\0Animated Cursors
(*.ani)\0*.ani\0Static Cursors (*.cur)\0*.cur\0All Files\0*.*\0\0"
+ IDS_BROWSE_TITLE "Browse"
END
Modified: trunk/reactos/dll/cpl/main/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/mouse.c?rev=2…
==============================================================================
--- trunk/reactos/dll/cpl/main/mouse.c (original)
+++ trunk/reactos/dll/cpl/main/mouse.c Sun Apr 22 19:11:04 2007
@@ -26,12 +26,8 @@
*/
//TODO:
-//detect slider changes - for apply stuff
-// cursor icon shows - may need overriden items
-// implement Pointer-APPLY
-// implement Pointer-Browser
-// add missing icons
-// Options- pointer precision
+// add missing icons
+// Options- pointer precision
#define WINVER 0x0501
@@ -134,8 +130,6 @@
{IDS_UPARROW, IDC_UPARROW, 0, _T(""), _T("")},
{IDS_HAND, IDC_HAND, 0, _T(""), _T("")}};
-
-TCHAR g_szNewScheme[MAX_PATH];
#if 0
static VOID
@@ -517,8 +511,6 @@
*p = 0;
}
-// DebugMsg(_T("szCurrentScheme: \"%s\"\nszValueName:
\"%s\""), szCurrentScheme, szValueName);
-
if (_tcscmp(szValueName, szCurrentScheme) == 0)
{
nSchemeIndex = (INT)i;
@@ -619,16 +611,23 @@
IN WPARAM wParam,
IN LPARAM lParam)
{
- HWND hDlgCtrl;
- UNREFERENCED_PARAMETER(lParam);
-
- switch(uMsg)
- {
+ LPTSTR pSchemeName;
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ pSchemeName = (LPTSTR)lParam;
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSchemeName);
+ SendDlgItemMessage(hwndDlg, IDC_EDIT_SCHEME_NAME, WM_SETTEXT,
+ 0, (LPARAM)pSchemeName);
+ break;
+
case WM_COMMAND:
if (LOWORD(wParam) == IDOK)
{
- hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_SCHEME_NAME);
- SendMessage(hDlgCtrl, WM_GETTEXT, (WPARAM)MAX_PATH,
(LPARAM)g_szNewScheme);
+ pSchemeName = (LPTSTR)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ SendDlgItemMessage(hwndDlg, IDC_EDIT_SCHEME_NAME, WM_GETTEXT,
+ (WPARAM)MAX_PATH, (LPARAM)pSchemeName);
EndDialog(hwndDlg, TRUE);
}
else if (LOWORD(wParam) == IDCANCEL)
@@ -639,6 +638,82 @@
}
return FALSE;
+}
+
+
+static BOOL
+SaveCursorScheme(HWND hwndDlg)
+{
+ TCHAR szSystemScheme[MAX_PATH];
+ TCHAR szSchemeName[MAX_PATH];
+ INT nSel;
+ INT index, i, nLength;
+ LPTSTR lpSchemeData;
+ HKEY hCuKey;
+ HKEY hCuCursorKey;
+ LONG lResult = ERROR_SUCCESS;
+
+ nSel = SendDlgItemMessage(hwndDlg, IDC_COMBO_CURSOR_SCHEME, CB_GETCURSEL, 0, 0);
+ if (nSel == CB_ERR)
+ return FALSE;
+
+ if (nSel == 0)
+ {
+ szSchemeName[0] = 0;
+ }
+ else
+ {
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_CURSOR_SCHEME, CB_GETLBTEXT, nSel,
(LPARAM)szSchemeName);
+
+ LoadString(hApplet, IDS_SYSTEM_SCHEME, szSystemScheme, MAX_PATH);
+
+ if (_tcsstr(szSchemeName, szSystemScheme))
+ {
+ szSchemeName[_tcslen(szSchemeName) - _tcslen(szSystemScheme) - 1] = 0;
+ }
+ }
+
+ if (DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_CURSOR_SCHEME_SAVEAS),
+ hwndDlg, SaveSchemeProc, (LPARAM)szSchemeName))
+ {
+ /* Save the cursor scheme */
+ nLength = 0;
+ for (index = IDS_ARROW, i = 0; index <= IDS_HAND; index++, i++)
+ {
+ if (i > 0)
+ nLength++;
+ nLength += _tcslen(g_CursorData[i].szCursorPath);
+ }
+ nLength++;
+
+ lpSchemeData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength *
sizeof(TCHAR));
+
+ for (index = IDS_ARROW, i = 0; index <= IDS_HAND; index++, i++)
+ {
+ if (i > 0)
+ _tcscat(lpSchemeData, _T(","));
+ _tcscat(lpSchemeData, g_CursorData[i].szCursorPath);
+ }
+
+ if (RegOpenCurrentUser(KEY_READ | KEY_SET_VALUE, &hCuKey) != ERROR_SUCCESS)
+ return FALSE;
+
+ if (RegOpenKeyEx(hCuKey, _T("Control Panel\\Cursors\\Schemes"), 0,
KEY_READ | KEY_SET_VALUE, &hCuCursorKey) != ERROR_SUCCESS)
+ {
+ RegCloseKey(hCuKey);
+ return FALSE;
+ }
+
+ lResult = RegSetValueEx(hCuCursorKey, szSchemeName, 0, REG_EXPAND_SZ,
+ (LPBYTE)lpSchemeData, nLength * sizeof(TCHAR));
+
+ RegCloseKey(hCuCursorKey);
+ RegCloseKey(hCuKey);
+
+ HeapFree(GetProcessHeap(), 0, lpSchemeData);
+ }
+
+ return (lResult == ERROR_SUCCESS);
}
@@ -646,22 +721,23 @@
BrowseCursor(HWND hwndDlg)
{
TCHAR szFileName[MAX_PATH];
+ TCHAR szFilter[MAX_PATH];
+ TCHAR szTitle[MAX_PATH];
OPENFILENAME ofn;
INT nSel;
- /* FIXME load text resources from string */
- static TCHAR szFilter[] = _T("Cursors\0*.ani;*.cur\0Animated
Cursors\0*.ani\0Static Cursors\0*.cur\0All Files\0*.*\0\0");
+ LoadString(hApplet, IDS_BROWSE_FILTER, szFilter, MAX_PATH);
+ LoadString(hApplet, IDS_BROWSE_TITLE, szTitle, MAX_PATH);
memset(szFileName, 0x0, sizeof(szFileName));
nSel = SendDlgItemMessage(hwndDlg, IDC_LISTBOX_CURSOR, LB_GETCURSEL, 0, 0);
if (nSel == LB_ERR)
{
- MessageBox(hwndDlg, _T("LB_ERR"), _T(""),MB_ICONERROR);
+ MessageBox(hwndDlg, _T("LB_ERR"), _T(""), MB_ICONERROR);
return FALSE;
}
ZeroMemory(&ofn, sizeof(OPENFILENAME));
-
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwndDlg;
ofn.lpstrFilter = szFilter;
@@ -669,7 +745,7 @@
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = _T("%WINDIR%\\Cursors");
- ofn.lpstrTitle = _T("Browse"); /* FIXME load text resources from string */
+ ofn.lpstrTitle = szTitle;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
if (!GetOpenFileName(&ofn))
@@ -844,6 +920,15 @@
}
+static BOOL
+ApplyCursorScheme(HWND hwndDlg)
+{
+ /* FIXME: Apply the cursor scheme */
+
+ return TRUE;
+}
+
+
static INT_PTR CALLBACK
PointerProc(IN HWND hwndDlg,
IN UINT uMsg,
@@ -898,6 +983,7 @@
lppsn = (LPPSHNOTIFY) lParam;
if (lppsn->hdr.code == PSN_APPLY)
{
+ ApplyCursorScheme(hwndDlg);
#if (WINVER >= 0x0500)
SystemParametersInfo(SPI_SETDROPSHADOW, 0,
(PVOID)pPointerData->bDropShadow, SPIF_SENDCHANGE);
#endif
@@ -920,20 +1006,34 @@
break;
case IDC_LISTBOX_CURSOR:
- if (HIWORD(wParam) == LBN_SELCHANGE)
- {
- nSel = SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_IMAGE_CURRENT_CURSOR,
STM_SETIMAGE, IMAGE_CURSOR,
- (LPARAM)g_CursorData[nSel].hCursor);
- EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_USE_DEFAULT_CURSOR),
- (g_CursorData[nSel].szCursorPath[0] != 0));
+ switch (HIWORD(wParam))
+ {
+ case LBN_SELCHANGE:
+ nSel = SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_IMAGE_CURRENT_CURSOR,
STM_SETIMAGE, IMAGE_CURSOR,
+ (LPARAM)g_CursorData[nSel].hCursor);
+
EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_USE_DEFAULT_CURSOR),
+ (g_CursorData[nSel].szCursorPath[0] != 0));
+ break;
+
+ case LBN_DBLCLK:
+ if (BrowseCursor(hwndDlg))
+ {
+ /* Update cursor list and preview */
+ ReloadCurrentCursorScheme();
+ RefreshCursorList(hwndDlg, FALSE);
+
+ /* Enable the "Set Default" button */
+
EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_USE_DEFAULT_CURSOR), TRUE);
+ }
+ break;
}
break;
case IDC_BUTTON_SAVEAS_SCHEME:
- if (DialogBox(hApplet, MAKEINTRESOURCE(IDD_CURSOR_SCHEME_SAVEAS),
hwndDlg, SaveSchemeProc))
- {
- /* FIXME: save the cursor scheme */
+ if (SaveCursorScheme(hwndDlg))
+ {
+
}
break;
Modified: trunk/reactos/dll/cpl/main/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/resource.h?re…
==============================================================================
--- trunk/reactos/dll/cpl/main/resource.h (original)
+++ trunk/reactos/dll/cpl/main/resource.h Sun Apr 22 19:11:04 2007
@@ -25,7 +25,6 @@
#define IDS_CPLDESCRIPTION_1 1001
#define IDS_CPLNAME_2 1002
#define IDS_CPLDESCRIPTION_2 1003
-
#define IDS_ARROW 1016
#define IDS_HELP 1017
#define IDS_APPSTARTING 1018
@@ -43,6 +42,8 @@
#define IDS_HAND 1030
#define IDS_NONE 1031
#define IDS_SYSTEM_SCHEME 1032
+#define IDS_BROWSE_FILTER 1033
+#define IDS_BROWSE_TITLE 1034
#define IDC_SWAP_MOUSE_BUTTONS 2000