Skip to content
Browse files

Replaced dialog resources with control template

Also fixed tabbing in dialogs.
  • Loading branch information...
1 parent 37aee69 commit 3d6132811f01d1c31b3b8e648601853e02c1630e @poiru poiru committed Dec 13, 2012
View
49 Common/ControlTemplate.cpp
@@ -0,0 +1,49 @@
+/*
+ Copyright (C) 2012 Birunthan Mohanathas
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include "ControlTemplate.h"
+
+namespace ControlTemplate
+{
+
+void CreateControls(const Control* cts, UINT ctCount, HWND parent, HFONT font, GetStringFunc getString)
+{
+ for (UINT i = 0; i < ctCount; ++i)
+ {
+ const Control& ct = cts[i];
+
+ WCHAR* text = ct.textId ? getString(ct.textId) : NULL;
+
+ RECT r = { ct.x, ct.y, ct.w, ct.h };
+ MapDialogRect(parent, &r);
+
+ HWND wnd = CreateWindowEx(
+ ct.exStyle,
+ ct.name,
+ text,
+ ct.style,
+ r.left, r.top, r.right, r.bottom,
+ parent,
+ (HMENU)ct.id,
+ NULL,
+ NULL);
+ SendMessage(wnd, WM_SETFONT, (WPARAM)font, FALSE);
+ }
+}
+
+} // namespace ControlTemplate
View
89 Common/ControlTemplate.h
@@ -0,0 +1,89 @@
+/*
+ Copyright (C) 2012 Birunthan Mohanathas
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RM_COMMON_CONTROLTEMPLATE_H_
+#define RM_COMMON_CONTROLTEMPLATE_H_
+
+#include <Windows.h>
+
+namespace ControlTemplate
+{
+
+struct Control
+{
+ const WCHAR* name;
+ WORD id;
+ WORD textId;
+ short x;
+ short y;
+ short w;
+ short h;
+ DWORD style;
+ DWORD exStyle;
+};
+
+typedef WCHAR* (*GetStringFunc)(UINT id);
+
+void CreateControls(const Control* cts, UINT ctCount, HWND parent, HFONT font, GetStringFunc getString);
+
+// Helpers to declare control structs.
+#define CT_ITEM(name, id, textId, x, y, w, h, style, exStyle) \
+ { name, id, textId, x, y, w, h, WS_CHILD | style, exStyle }
+
+#define CT_BUTTON(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"Button", id, textId, x, y, w, h, BS_PUSHBUTTON | style, exStyle)
+
+#define CT_CHECKBOX(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"Button", id, textId, x, y, w, h, BS_AUTOCHECKBOX | style, exStyle)
+
+#define CT_COMBOBOX(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"ComboBox", id, textId, x, y, w, h, style, exStyle)
+
+#define CT_EDIT(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"Edit", id, textId, x, y, w, h, ES_LEFT | style, exStyle)
+
+#define CT_GROUPBOX(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"Button", id, textId, x, y, w, h, BS_GROUPBOX | style, exStyle)
+
+#define CT_ICON(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"Static", id, textId, x, y, w, h, SS_ICON | style, exStyle)
+
+#define CT_LABEL(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"Static", id, textId, x, y, w, h, SS_LEFT | style, exStyle)
+
+#define CT_LINEH(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"Static", id, textId, x, y, w, h, SS_ETCHEDHORZ | style, exStyle)
+
+#define CT_LINKLABEL(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"SysLink", id, textId, x, y, w, h, style, exStyle)
+
+#define CT_LISTBOX(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"ListBox", id, textId, x, y, w, h, style, exStyle)
+
+#define CT_LISTVIEW(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"SysListView32", id, textId, x, y, w, h, style, exStyle)
+
+#define CT_TAB(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"SysTabControl32", id, textId, x, y, w, h, TCS_TABS | style, exStyle)
+
+#define CT_TREEVIEW(id, textId, x, y, w, h, style, exStyle) \
+ CT_ITEM(L"SysTreeView32", id, textId, x, y, w, h, style, exStyle)
+
+} // namespace ControlTemplate
+
+#endif
View
254 Common/Dialog.cpp
@@ -0,0 +1,254 @@
+/*
+ Copyright (C) 2012 Birunthan Mohanathas
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include "Dialog.h"
+#include <Commctrl.h>
+#include <Uxtheme.h>
+
+HWND CDialog::c_ActiveDialogWindow = NULL;
+
+//
+// CBaseDialog
+//
+
+CBaseDialog::CBaseDialog() :
+ m_Window()
+{
+}
+
+/*
+** Create (if not already) and show the dialog.
+**
+*/
+void CBaseDialog::Show(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent)
+{
+ if (m_Window)
+ {
+ // Show existing window.
+ ShowWindow(m_Window, SW_SHOW);
+ SetForegroundWindow(m_Window);
+ return;
+ }
+
+ const WCHAR* font = L"MS Shell Dlg 2";
+ const size_t titleSize = (wcslen(title) + 1) * sizeof(WCHAR);
+ const size_t fontSize = (wcslen(font) + 1) * sizeof(WCHAR);
+
+ const size_t dataSize = sizeof(DLGTEMPLATE) +
+ sizeof(WCHAR) + // Menu array.
+ sizeof(WCHAR) + // Class array.
+ titleSize + // Title array.
+ sizeof(WORD) + // Font point size.
+ fontSize; // Font array.
+
+ DLGTEMPLATE* dt = (DLGTEMPLATE*)new BYTE[dataSize];
+ dt->style = style | DS_SHELLFONT | WS_VISIBLE;
+ dt->dwExtendedStyle = exStyle;
+ dt->cdit = 0;
+ dt->x = x;
+ dt->y = y;
+ dt->cx = w;
+ dt->cy = h;
+
+ BYTE* dtExtra = (BYTE*)dt + sizeof(DLGTEMPLATE);
+
+ // Menu array.
+ *(WCHAR*)dtExtra = L'\0';
+ dtExtra += sizeof(WCHAR);
+
+ // Class array.
+ *(WCHAR*)dtExtra = L'\0';
+ dtExtra += sizeof(WCHAR);
+
+ // Title array.
+ memcpy(dtExtra, title, titleSize);
+ dtExtra += titleSize;
+
+ // Font point size.
+ *(WORD*)dtExtra = 8;
+ dtExtra += sizeof(WORD);
+
+ // Font array.
+ memcpy(dtExtra, font, fontSize);
+
+ CreateDialogIndirectParam(NULL, dt, parent, InitialDlgProc, (LPARAM)this);
+
+ delete [] dt;
+}
+
+void CBaseDialog::CreateControls(const ControlTemplate::Control* cts, UINT ctCount, HFONT font, ControlTemplate::GetStringFunc getString)
+{
+ ControlTemplate::CreateControls(cts, ctCount, m_Window, font, getString);
+}
+
+INT_PTR CALLBACK CBaseDialog::InitialDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ if (uMsg == WM_INITDIALOG)
+ {
+ CBaseDialog* dialog = (CBaseDialog*)lParam;
+ dialog->m_Window = hWnd;
+ SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)dialog);
+ SetWindowLongPtr(hWnd, DWLP_DLGPROC, (LONG_PTR)MainDlgProc);
+ return dialog->HandleMessage(uMsg, wParam, lParam);
+ }
+
+ return FALSE;
+}
+
+INT_PTR CALLBACK CBaseDialog::MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ CBaseDialog* dialog = (CBaseDialog*)GetWindowLongPtr(hWnd, DWLP_USER);
+ return dialog->HandleMessage(uMsg, wParam, lParam);
+}
+
+//
+// CDialog
+//
+
+CDialog::CDialog() : CBaseDialog(),
+ m_Font(),
+ m_FontBold()
+{
+ NONCLIENTMETRICS ncm;
+ ncm.cbSize = sizeof(NONCLIENTMETRICS) - sizeof(ncm.iPaddedBorderWidth);
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0);
+ m_Font = CreateFontIndirect(&ncm.lfMenuFont);
+ ncm.lfMenuFont.lfWeight = FW_BOLD;
+ ncm.lfMenuFont.lfHeight -= 2;
+ m_FontBold = CreateFontIndirect(&ncm.lfMenuFont);
+}
+
+CDialog::~CDialog()
+{
+ DestroyWindow(m_Window);
+ DeleteObject(m_Font);
+ DeleteObject(m_FontBold);
+}
+
+void CDialog::ShowDialogWindow(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent)
+{
+ Show(title, x, y, w, h, style, exStyle, parent);
+}
+
+INT_PTR CDialog::OnActivate(WPARAM wParam, LPARAM lParam)
+{
+ c_ActiveDialogWindow = wParam ? m_Window : NULL;
+ return FALSE;
+}
+
+bool CDialog::HandleMessage(MSG& msg)
+{
+ if (c_ActiveDialogWindow)
+ {
+ if (IsDialogMessage(c_ActiveDialogWindow, &msg))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*
+** Subclass button control to draw arrow on the right.
+**
+*/
+void CDialog::SetMenuButton(HWND button)
+{
+ SetWindowSubclass(button, MenuButtonProc, NULL, NULL);
+}
+
+LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
+{
+ LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
+
+ switch (uMsg)
+ {
+ case WM_PAINT:
+ {
+ // Draw arrow on top of the button
+ RECT buttonRect;
+ GetClientRect(hWnd, &buttonRect);
+ int arrowX = buttonRect.right - 18;
+ int arrowY = buttonRect.top + 4;
+ RECT arrowRect = { arrowX, arrowY, arrowX + 14, arrowY + 14 };
+
+ HDC dc = GetDC(hWnd);
+ const WORD DFCS_MENUARROWDOWN = 0x0010; // Undocumented
+ DWORD drawFlags = DFCS_TRANSPARENT | DFCS_MENUARROWDOWN | (IsWindowEnabled(hWnd) ? 0 : DFCS_INACTIVE);
+ DrawFrameControl(dc, &arrowRect, DFC_MENU, drawFlags);
+ ReleaseDC(hWnd, dc);
+ }
+ break;
+
+ case WM_GETTEXT:
+ {
+ // Append 3 spaces to the button text to move text to the left so
+ // that it looks better with BS_CENTER.
+ WCHAR* str = (WCHAR*)lParam + result;
+ str[0] = str[1] = str[2] = L' ';
+ str[3] = '\0';
+ result += 3;
+ }
+ break;
+
+ case WM_GETTEXTLENGTH:
+ result += 3;
+ break;
+
+ case WM_NCDESTROY:
+ RemoveWindowSubclass(hWnd, MenuButtonProc, uIdSubclass);
+ break;
+ }
+
+ return result;
+}
+
+//
+// CTab
+//
+
+CDialog::CTab::CTab() : CBaseDialog(),
+ m_Initialized(false)
+{
+}
+
+void CDialog::CTab::CreateTabWindow(short x, short y, short w, short h, HWND owner)
+{
+ const DWORD style = DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
+ const DWORD exStyle = WS_EX_CONTROLPARENT;
+ Show(L"", x, y, w, h, style, exStyle, owner);
+
+ EnableThemeDialogTexture(m_Window, ETDT_ENABLETAB);
+}
+
+CDialog::CTab::~CTab()
+{
+ DestroyWindow(m_Window);
+}
+
+void CDialog::CTab::Activate()
+{
+ if (!m_Initialized)
+ {
+ Initialize();
+ }
+
+ EnableWindow(m_Window, TRUE);
+ BringWindowToTop(m_Window);
+}
View
94 Common/Dialog.h
@@ -0,0 +1,94 @@
+/*
+ Copyright (C) 2012 Birunthan Mohanathas
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifndef RM_COMMON_DIALOG_H_
+#define RM_COMMON_DIALOG_H_
+
+#include <Windows.h>
+#include "ControlTemplate.h"
+
+// Shared base class for CDialog and CTab.
+class CBaseDialog
+{
+protected:
+ CBaseDialog();
+ virtual ~CBaseDialog() {}
+
+ void Show(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent);
+
+ void CreateControls(const ControlTemplate::Control* cts, UINT ctCount, HFONT font, ControlTemplate::GetStringFunc getString);
+
+ virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { return FALSE; }
+
+ HWND m_Window;
+
+private:
+ CBaseDialog(const CBaseDialog& r);
+
+ static INT_PTR CALLBACK InitialDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+};
+
+class CDialog : public CBaseDialog
+{
+public:
+ HWND GetWindow() { return m_Window; }
+
+ static bool HandleMessage(MSG& msg);
+
+protected:
+ class CTab : public CBaseDialog
+ {
+ public:
+ HWND GetWindow() { return m_Window; }
+ bool IsInitialized() { return m_Initialized; }
+ void Activate();
+
+ virtual void Initialize() {}
+ virtual void Resize(int w, int h) {}
+
+ protected:
+ CTab();
+ virtual ~CTab();
+
+ void CreateTabWindow(short x, short y, short w, short h, HWND owner);
+
+ bool m_Initialized;
+ };
+
+ CDialog();
+ virtual ~CDialog();
+
+ void ShowDialogWindow(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent);
+
+ INT_PTR OnActivate(WPARAM wParam, LPARAM lParam);
+
+ static void SetMenuButton(HWND button);
+
+ HFONT m_Font;
+ HFONT m_FontBold;
+
+private:
+ CDialog(const CDialog& r);
+
+ static LRESULT CALLBACK MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
+
+ static HWND c_ActiveDialogWindow;
+};
+
+#endif
View
338 Language/Resource.rc
@@ -10,167 +10,14 @@
#define STR_ISRTL "0"
#endif
-LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_ABOUT_DIALOG DIALOGEX 0, 0, 400, 210
-STYLE DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
-EXSTYLE DIALOG_EXSTYLE_FLAGS
-CAPTION STR_ABOUTRAINMETER
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- CONTROL "", IDC_ABOUT_TAB, "SysTabControl32", TCS_TABS | TCS_FIXEDWIDTH, 6, 6, 388, 181
- DEFPUSHBUTTON STR_CLOSE, IDCLOSE, 344, 191, 50, 14
-}
-
-IDD_ABOUTLOG_DIALOG DIALOGEX 15, 30, 370, 148
-STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- CONTROL "", IDC_ABOUTLOG_ITEMS_LISTVIEW, "SysListView32", LVS_ICON | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 0, 0, 368, 135
- AUTOCHECKBOX STR_ERROR, IDC_ABOUTLOG_ERROR_CHECKBOX, 0, 139, 70, 9
- AUTOCHECKBOX STR_WARNING, IDC_ABOUTLOG_WARNING_CHECKBOX, 70, 139, 70, 9
- AUTOCHECKBOX STR_NOTICE, IDC_ABOUTLOG_NOTICE_CHECKBOX, 140, 139, 70, 9
- AUTOCHECKBOX STR_DEBUG, IDC_ABOUTLOG_DEBUG_CHECKBOX, 210, 139, 70, 9
-}
-
-IDD_ABOUTSKINS_DIALOG DIALOGEX 15, 30, 370, 148
-STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- LISTBOX IDC_ABOUTSKINS_ITEMS_LISTBOX, 0, 0, 120, 148, LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
- CONTROL "", IDC_ABOUTSKINS_ITEMS_LISTVIEW, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 125, 0, 242, 148
-}
-
-IDD_ABOUTPLUGINS_DIALOG DIALOGEX 15, 30, 370, 148
-STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- CONTROL "", IDC_ABOUTPLUGINS_ITEMS_LISTVIEW, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 0, 0, 368, 148
-}
-
-IDD_ABOUTVERSION_DIALOG DIALOGEX 15, 30, 370, 148
-STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- CONTROL 0, IDC_ABOUTVERSION_RAINMETER_ICON, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 0, 8, 24, 24
- LTEXT "", IDC_ABOUTVERSION_VERSION_TEXT, 28, 0, 300, 9
- CONTROL STR_GETLATESTVERSION, IDC_STATIC, "SysLink", 0x0, 28, 13, 300, 9
- CONTROL STR_COPYRIGHTNOTICE, IDC_STATIC, "SysLink", 0x0, 28, 26, 300, 9
- LTEXT "", IDC_ABOUTVERSION_PATH_TEXT, 0, 43, 360, 9, SS_ENDELLIPSIS | SS_NOPREFIX
- LTEXT "", IDC_ABOUTVERSION_INIFILE_TEXT, 0, 56, 360, 9, SS_ENDELLIPSIS | SS_NOPREFIX
- LTEXT "", IDC_ABOUTVERSION_SKINPATH_TEXT, 0, 69, 360, 9, SS_ENDELLIPSIS | SS_NOPREFIX
- PUSHBUTTON STR_COPYTOCLIPBOARD, IDC_ABOUTVERSION_COPY_BUTTON, 0, 85, NUM_BUTTONWIDTH + 25, 14, WS_TABSTOP
-}
-
-IDD_MANAGE_DIALOG DIALOGEX 0, 0, 500, 322
-STYLE DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
-EXSTYLE DIALOG_EXSTYLE_FLAGS
-CAPTION STR_MANAGERAINMETER
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- CONTROL "", IDC_MANAGE_TAB, "SysTabControl32", TCS_TABS | TCS_FIXEDWIDTH, 6, 6, 488, 293
- PUSHBUTTON STR_REFRESHALL, IDC_MANAGE_REFRESHALL_BUTTON, 5, 303, NUM_BUTTONWIDTH, 14
- PUSHBUTTON STR_EDITSETTINGS, IDC_MANAGE_EDITSETTINGS_BUTTON, NUM_BUTTONWIDTH + 9, 303, NUM_BUTTONWIDTH, 14
- PUSHBUTTON STR_OPENLOG, IDC_MANAGE_OPENLOG_BUTTON, NUM_BUTTONWIDTH + NUM_BUTTONWIDTH + 13, 303, NUM_BUTTONWIDTH, 14
- PUSHBUTTON STR_HELP, IDC_MANAGE_HELP_BUTTON, 444 - 50 - 5, 303, 50, 14
- PUSHBUTTON STR_CLOSE, IDCLOSE, 444, 303, 50, 14
-}
-
-IDD_MANAGESKINS_DIALOG DIALOGEX 15, 30, 470, 260
-STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- PUSHBUTTON STR_ACTIVESKINS, IDC_MANAGESKINS_ACTIVESKINS_BUTTON, 0, 0, 146, 14, WS_TABSTOP
- CONTROL "", IDC_MANAGESKINS_SKINS_TREEVIEW, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_BORDER | WS_VSCROLL, 0, 18, 145, 221
- PUSHBUTTON "Create .rmskin package...", IDC_MANAGESKINS_CREATEPACKAGE_BUTTON, 0, 244, 146, 14, WS_TABSTOP
-
- LTEXT "N/A", IDC_MANAGESKINS_FILE_TEXT, 165, 0, 130, 14, SS_ENDELLIPSIS | SS_NOPREFIX
- LTEXT "N/A", IDC_MANAGESKINS_CONFIG_TEXT, 165, 16, 130, 9, SS_ENDELLIPSIS | SS_NOPREFIX
- PUSHBUTTON STR_LOAD, IDC_MANAGESKINS_LOAD_BUTTON, 310, 0, 50, 14, WS_DISABLED | WS_TABSTOP
- PUSHBUTTON STR_REFRESH, IDC_MANAGESKINS_REFRESH_BUTTON, 364, 0, 50, 14, WS_DISABLED | WS_TABSTOP
- PUSHBUTTON STR_EDIT, IDC_MANAGESKINS_EDIT_BUTTON, 418, 0, 50, 14, WS_DISABLED | WS_TABSTOP
- LTEXT STR_AUTHORSC, IDC_STATIC, 165, 30, 80, 9
- LTEXT "", IDC_MANAGESKINS_AUTHOR_TEXT, 230, 30, 245, 9, SS_ENDELLIPSIS | SS_NOPREFIX
- LTEXT STR_VERSIONSC, IDC_STATIC, 165, 43, 80, 9
- LTEXT "", IDC_MANAGESKINS_VERSION_TEXT, 230, 43, 245, 9, SS_ENDELLIPSIS | SS_NOPREFIX
- LTEXT STR_LICENSESC, IDC_STATIC, 165, 56, 80, 9
- LTEXT "", IDC_MANAGESKINS_LICENSE_TEXT, 230, 56, 245, 9, SS_ENDELLIPSIS | SS_NOPREFIX
- LTEXT STR_INFORMATIONSC, IDC_STATIC, 165, 69, 80, 9
- EDITTEXT IDC_MANAGESKINS_DESCRIPTION_TEXT, 228, 69, 238, 64, ES_MULTILINE | ES_READONLY
- CONTROL STR_ADDMETADATA, IDC_MANAGESKINS_ADDMETADATA_LINK, "SysLink", NOT WS_VISIBLE, 165, 142, 150, 9
+#define MAKESTRING2(num) #num
+#define MAKESTRING(num) MAKESTRING2(num)
- CONTROL "", IDC_STATIC, STATIC, SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE, 165, 156, 304, 1
- LTEXT STR_COORDINATESSC, IDC_STATIC, 165, 169, NUM_LABELWIDTH, 9
- EDITTEXT IDC_MANAGESKINS_X_TEXT, 165 + NUM_LABELWIDTH, 166, 38, 14, WS_BORDER | WS_TABSTOP | WS_DISABLED
- EDITTEXT IDC_MANAGESKINS_Y_TEXT, 165 + NUM_LABELWIDTH + 42, 166, 38, 14, WS_BORDER | WS_TABSTOP | WS_DISABLED
- LTEXT STR_POSITIONSC, IDC_STATIC, 165, 190, NUM_LABELWIDTH, 9
- COMBOBOX IDC_MANAGESKINS_ZPOSITION_COMBOBOX, 165 + NUM_LABELWIDTH, 187, 80, 14, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | WS_DISABLED
- LTEXT STR_LOADORDERSC, IDC_STATIC, 165, 208, NUM_LABELWIDTH, 9
- EDITTEXT IDC_MANAGESKINS_LOADORDER_TEXT, 165 + NUM_LABELWIDTH, 205, 80, 14, WS_BORDER | WS_TABSTOP | WS_DISABLED
- LTEXT STR_TRANSPARENCYSC, IDC_STATIC, 165, 229, NUM_LABELWIDTH, 9
- COMBOBOX IDC_MANAGESKINS_TRANSPARENCY_COMBOBOX, 165 + NUM_LABELWIDTH, 226, 80, 14, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | WS_DISABLED
- LTEXT STR_ONHOVERSC, IDC_STATIC, 165, 247, NUM_LABELWIDTH, 9
- COMBOBOX IDC_MANAGESKINS_ONHOVER_COMBOBOX, 165 + NUM_LABELWIDTH, 244, 80, 14, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | WS_DISABLED
- PUSHBUTTON STR_DISPLAYMONITOR, IDC_MANAGESKINS_DISPLAYMONITOR_BUTTON, 350, 166, 118, 14, WS_DISABLED | WS_TABSTOP
- AUTOCHECKBOX STR_DRAGGABLE, IDC_MANAGESKINS_DRAGGABLE_CHECKBOX, 350, 190, 118, 9, WS_DISABLED
- AUTOCHECKBOX STR_CLICKTHROUGH, IDC_MANAGESKINS_CLICKTHROUGH_CHECKBOX, 350, 203, 118, 9, WS_DISABLED
- AUTOCHECKBOX STR_KEEPONSCREEN, IDC_MANAGESKINS_KEEPONSCREEN_CHECKBOX, 350, 216, 118, 9, WS_DISABLED
- AUTOCHECKBOX STR_SAVEPOSITION, IDC_MANAGESKINS_SAVEPOSITION_CHECKBOX, 350, 229, 118, 9, WS_DISABLED
- AUTOCHECKBOX STR_SNAPTOEDGES, IDC_MANAGESKINS_SNAPTOEDGES_CHECKBOX, 350, 242, 118, 9, WS_DISABLED
-}
-
-IDD_MANAGETHEMES_DIALOG DIALOGEX 15, 30, 470, 260
-STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- GROUPBOX STR_SAVENEWTHEME, IDC_STATIC, 0, 0, 230, 150
- LTEXT STR_THEMEDESCRIPTION, IDC_STATIC, 6, 16, 205, 44
- AUTOCHECKBOX STR_SAVEASEMPTYTHEME, IDC_MANAGETHEMES_EMPTYTHEME_CHECKBOX, 6, 70, 220, 9, WS_TABSTOP
- AUTOCHECKBOX STR_EXCLUDEUNUSEDSKINS, IDC_MANAGETHEMES_UNUSEDSKINS_CHECKBOX, 6, 83, 220, 9, WS_TABSTOP
- AUTOCHECKBOX STR_INCLUDEWALLPAPER, IDC_MANAGETHEMES_WALLPAPER_CHECKBOX, 6, 96, 220, 9, WS_TABSTOP
- LTEXT STR_NAMESC, IDC_STATIC, 6, 115, 100, 9
- EDITTEXT IDC_MANAGETHEMES_NAME_TEXT, 6, 128, 162, 14, WS_BORDER | WS_TABSTOP
- PUSHBUTTON STR_SAVE, IDC_MANAGETHEMES_SAVE_BUTTON, 172, 128, 50, 14, WS_DISABLED | WS_TABSTOP
-
- GROUPBOX STR_SAVEDTHEMES, IDC_STATIC, 238, 0, 230, 150
- LISTBOX IDC_MANAGETHEMES_LIST, 244, 16, 160, 125, LBS_STANDARD | LBS_NOINTEGRALHEIGHT
- PUSHBUTTON STR_LOAD, IDC_MANAGETHEMES_LOAD_BUTTON, 410, 16, 50, 14, WS_DISABLED
- PUSHBUTTON STR_DELETE, IDC_MANAGETHEMES_DELETE_BUTTON, 410, 34, 50, 14, WS_DISABLED
- PUSHBUTTON STR_EDIT, IDC_MANAGETHEMES_EDIT_BUTTON, 410, 52, 50, 14, WS_DISABLED
-
-// GROUPBOX STR_BACKUP, IDC_STATIC, 0, 200, 468, 60
-// LTEXT STR_BACKUPDESCRIPTION, IDC_STATIC, 6, 216, 455, 34
-// PUSHBUTTON STR_BACKUPE, IDC_MANAGETHEMES_BACKUP_BUTTON, 460 - NUM_BUTTONWIDTH, 240, NUM_BUTTONWIDTH, 14
-}
+#define STR_NUM_BUTTONWIDTH MAKESTRING(NUM_BUTTONWIDTH)
+#define STR_NUM_LABELWIDTH MAKESTRING(NUM_LABELWIDTH)
-IDD_MANAGESETTINGS_DIALOG DIALOGEX 15, 30, 470, 260
-STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
-FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
-{
- GROUPBOX STR_GENERAL, IDC_STATIC, 0, 0, 468, 118
- LTEXT STR_LANGUAGESC, IDC_STATIC, 6, 16, 87, 14
- COMBOBOX IDC_MANAGESETTINGS_LANGUAGE_COMBOBOX, 87, 13, 222, 14, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- //AUTOCHECKBOX "Run automatically at startup", IDC_MANAGESETTINGS_AUTOSTART_CHECKBOX, 6, 16, 140, 9, WS_DISABLED
- LTEXT "Editor:", IDC_STATIC, 6, 37, 87, 9
- EDITTEXT IDC_MANAGESETTINGS_CONFIGEDITOR_TEXT, 87, 34, 222, 14, ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_TABSTOP
- PUSHBUTTON "...", IDC_MANAGESETTINGS_CONFIGEDITOR_BUTTON, 313, 34, 25, 14, WS_TABSTOP
- AUTOCHECKBOX STR_CHECKFORUPDATES, IDC_MANAGESETTINGS_CHECKUPDATES_CHECKBOX, 6, 55, 150, 9
- AUTOCHECKBOX STR_DISABLEDRAGGING, IDC_MANAGESETTINGS_LOCKSKINS_CHECKBOX, 6, 68, 150, 9
- AUTOCHECKBOX "Show notification area icon", IDC_MANAGESETTINGS_TRAYICON_CHECKBOX, 6, 81, 150, 9
- PUSHBUTTON STR_RESETSTATISTICS, IDC_MANAGESETTINGS_RESETSTATISTICS_BUTTON, 6, 97, NUM_BUTTONWIDTH + 20, 14, WS_TABSTOP
-
- GROUPBOX STR_LOGGING, IDC_STATIC, 0, 125, 468, 66
- AUTOCHECKBOX STR_DEBUGMODE, IDC_MANAGESETTINGS_VERBOSELOGGING_CHECKBOX, 6, 141, 200, 9
- AUTOCHECKBOX STR_LOGTOFILE, IDC_MANAGESETTINGS_LOGTOFILE_CHECKBOX, 6, 154, 200, 9
- PUSHBUTTON STR_SHOWLOGFILE, IDC_MANAGESETTINGS_SHOWLOGFILE_BUTTON, 6, 170, NUM_BUTTONWIDTH + 20, 14
- PUSHBUTTON STR_DELETELOGFILE, IDC_MANAGESETTINGS_DELETELOGFILE_BUTTON, NUM_BUTTONWIDTH + 30, 170, NUM_BUTTONWIDTH + 20, 14
-}
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
/////////////////////////////////////////////////////////////////////////////
//
@@ -179,10 +26,72 @@ FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
STRINGTABLE
{
+ ID_STR_NUM_BUTTONWIDTH, STR_NUM_BUTTONWIDTH
+ ID_STR_NUM_LABELWIDTH, STR_NUM_LABELWIDTH
ID_STR_ISRTL, STR_ISRTL
ID_STR_UPDATEAVAILABLE, STR_UPDATEAVAILABLE
+ ID_STR_MANAGE, STR_MANAGE
+ ID_STR_ABOUT, STR_ABOUT
+ ID_STR_HELP, STR_HELP
+ ID_STR_SKINS, STR_SKINS
+ ID_STR_NOSKINS, STR_NOSKINS
+ ID_STR_OPENFOLDER, STR_OPENFOLDER
+ ID_STR_DISABLEDRAGGING, STR_DISABLEDRAGGING
+ ID_STR_THEMES, STR_THEMES
+ ID_STR_NOTHEMES, STR_NOTHEMES
+ ID_STR_EDITSETTINGS, STR_EDITSETTINGS
+ ID_STR_REFRESHALL, STR_REFRESHALL
+ ID_STR_LOGGING, STR_LOGGING
+ ID_STR_SHOWLOGFILE, STR_SHOWLOGFILE
+ ID_STR_STARTLOGGING, STR_STARTLOGGING
+ ID_STR_STOPLOGGING, STR_STOPLOGGING
+ ID_STR_DELETELOGFILE, STR_DELETELOGFILE
+ ID_STR_DEBUGMODE, STR_DEBUGMODE
+ ID_STR_EXIT, STR_EXIT
+ ID_STR_VARIANTS, STR_VARIANTS
+ ID_STR_SETTINGS, STR_SETTINGS
+ ID_STR_POSITION, STR_POSITION
+ ID_STR_DISPLAYMONITOR, STR_DISPLAYMONITOR
+ ID_STR_USEDEFAULTMONITOR, STR_USEDEFAULTMONITOR
+ ID_STR_VIRTUALSCREEN, STR_VIRTUALSCREEN
+ ID_STR_AUTOSELECTMONITOR, STR_AUTOSELECTMONITOR
+ ID_STR_STAYTOPMOST, STR_STAYTOPMOST
+ ID_STR_TOPMOST, STR_TOPMOST
+ ID_STR_NORMAL, STR_NORMAL
+ ID_STR_BOTTOM, STR_BOTTOM
+ ID_STR_ONDESKTOP, STR_ONDESKTOP
+ ID_STR_FROMRIGHT, STR_FROMRIGHT
+ ID_STR_FROMBOTTOM, STR_FROMBOTTOM
+ ID_STR_XASPERCENTAGE, STR_XASPERCENTAGE
+ ID_STR_YASPERCENTAGE, STR_YASPERCENTAGE
+ ID_STR_TRANSPARENCY, STR_TRANSPARENCY
+ ID_STR_0PERCENT, "0%"
+ ID_STR_10PERCENT, "10%"
+ ID_STR_20PERCENT, "20%"
+ ID_STR_30PERCENT, "30%"
+ ID_STR_40PERCENT, "40%"
+ ID_STR_50PERCENT, "50%"
+ ID_STR_60PERCENT, "60%"
+ ID_STR_70PERCENT, "70%"
+ ID_STR_80PERCENT, "80%"
+ ID_STR_90PERCENT, "90%"
+ ID_STR_FADEIN, STR_FADEIN
+ ID_STR_FADEOUT, STR_FADEOUT
+ ID_STR_HIDEONMOUSEOVER, STR_HIDEONMOUSEOVER
+ ID_STR_DRAGGABLE, STR_DRAGGABLE
+ ID_STR_SAVEPOSITION, STR_SAVEPOSITION
+ ID_STR_SNAPTOEDGES, STR_SNAPTOEDGES
+ ID_STR_CLICKTHROUGH, STR_CLICKTHROUGH
+ ID_STR_KEEPONSCREEN, STR_KEEPONSCREEN
+ ID_STR_MANAGESKIN, STR_MANAGESKIN
+ ID_STR_EDITSKIN, STR_EDITSKIN
+ ID_STR_REFRESHSKIN, STR_REFRESHSKIN
+ ID_STR_UNLOADSKIN, STR_UNLOADSKIN
+ ID_STR_CLOSE, STR_CLOSE
+ ID_STR_ABOUTRAINMETER, STR_ABOUTRAINMETER
ID_STR_LOG, STR_LOG
ID_STR_MEASURES, STR_MEASURES
+ ID_STR_VARIABLES, STR_VARIABLES
ID_STR_PLUGINS, STR_PLUGINS
ID_STR_VERSION, STR_VERSION
ID_STR_TYPE, STR_TYPE
@@ -192,29 +101,57 @@ STRINGTABLE
ID_STR_RANGE, STR_RANGE
ID_STR_VALUE, STR_VALUE
ID_STR_AUTHOR, STR_AUTHOR
+ ID_STR_ERROR, STR_ERROR
+ ID_STR_WARNING, STR_WARNING
+ ID_STR_NOTICE, STR_NOTICE
+ ID_STR_DEBUG, STR_DEBUG
+ ID_STR_GETLATESTVERSION, STR_GETLATESTVERSION
+ ID_STR_COPYRIGHTNOTICE, STR_COPYRIGHTNOTICE
+ ID_STR_COPYTOCLIPBOARD, STR_COPYTOCLIPBOARD
ID_STR_MANAGERAINMETER, STR_MANAGERAINMETER
- ID_STR_SKINS, STR_SKINS
- ID_STR_THEMES, STR_THEMES
- ID_STR_SETTINGS, STR_SETTINGS
- ID_STR_STAYTOPMOST, STR_STAYTOPMOST
- ID_STR_TOPMOST, STR_TOPMOST
- ID_STR_NORMAL, STR_NORMAL
- ID_STR_BOTTOM, STR_BOTTOM
- ID_STR_ONDESKTOP, STR_ONDESKTOP
- ID_STR_DONOTHING, STR_DONOTHING
- ID_STR_HIDE, STR_HIDE
- ID_STR_FADEIN, STR_FADEIN
- ID_STR_FADEOUT, STR_FADEOUT
+ ID_STR_ACTIVESKINS, STR_ACTIVESKINS
+ ID_STR_EXPAND, STR_EXPAND
+ ID_STR_COLLAPSE, STR_COLLAPSE
+ ID_STR_OPENLOG, STR_OPENLOG
ID_STR_LOAD, STR_LOAD
ID_STR_UNLOAD, STR_UNLOAD
- ID_STR_COLLAPSE, STR_COLLAPSE
+ ID_STR_REFRESH, STR_REFRESH
+ ID_STR_EDIT, STR_EDIT
+ ID_STR_AUTHORSC, STR_AUTHORSC
+ ID_STR_VERSIONSC, STR_VERSIONSC
+ ID_STR_LICENSESC, STR_LICENSESC
+ ID_STR_INFORMATIONSC, STR_INFORMATIONSC
+ ID_STR_ADDMETADATA, STR_ADDMETADATA
+ ID_STR_COORDINATESSC, STR_COORDINATESSC
+ ID_STR_POSITIONSC, STR_POSITIONSC
+ ID_STR_LOADORDERSC, STR_LOADORDERSC
+ ID_STR_TRANSPARENCYSC, STR_TRANSPARENCYSC
+ ID_STR_ONHOVERSC, STR_ONHOVERSC
+ ID_STR_DONOTHING, STR_DONOTHING
+ ID_STR_HIDE, STR_HIDE
+ ID_STR_SAVENEWTHEME, STR_SAVENEWTHEME
+ ID_STR_THEMEDESCRIPTION, STR_THEMEDESCRIPTION
+ ID_STR_SAVEASEMPTYTHEME, STR_SAVEASEMPTYTHEME
+ ID_STR_EXCLUDEUNUSEDSKINS, STR_EXCLUDEUNUSEDSKINS
+ ID_STR_INCLUDEWALLPAPER, STR_INCLUDEWALLPAPER
+ ID_STR_NAMESC, STR_NAMESC
+ ID_STR_SAVE, STR_SAVE
+ ID_STR_SAVEDTHEMES, STR_SAVEDTHEMES
+ ID_STR_DELETE, STR_DELETE
+// ID_STR_BACKUP, STR_BACKUP
+// ID_STR_BACKUPDESCRIPTION, STR_BACKUPDESCRIPTION
+// ID_STR_BACKUPE, STR_BACKUPE
+ ID_STR_LANGUAGESC, STR_LANGUAGESC
+ ID_STR_GENERAL, STR_GENERAL
+ ID_STR_CHECKFORUPDATES, STR_CHECKFORUPDATES
+ ID_STR_RESETSTATISTICS, STR_RESETSTATISTICS
+ ID_STR_LOGTOFILE, STR_LOGTOFILE
ID_STR_SETTINGSNOTWRITABLE, STR_SETTINGSNOTWRITABLE
ID_STR_SETTINGSMOVEFILE, STR_SETTINGSMOVEFILE
ID_STR_SETTINGSREADONLY, STR_SETTINGSREADONLY
ID_STR_THEMEALREADYEXISTS, STR_THEMEALREADYEXISTS
ID_STR_THEMESAVEFAIL, STR_THEMESAVEFAIL
ID_STR_THEMEDELETE, STR_THEMEDELETE
- ID_STR_VARIABLES, STR_VARIABLES
ID_STR_LOGFILECREATEFAIL, STR_LOGFILECREATEFAIL
ID_STR_LOGFILEDELETE, STR_LOGFILEDELETE
ID_STR_NOAVAILABLESKINS, STR_NOAVAILABLESKINS
@@ -223,58 +160,11 @@ STRINGTABLE
ID_STR_NEWVERSIONREQUIRED, STR_NEWVERSIONREQUIRED
ID_STR_NOMETERSINSKIN, STR_NOMETERSINSKIN
ID_STR_INCLUDEINFINITELOOP, STR_INCLUDEINFINITELOOP
- ID_STR_ABOUTRAINMETER, STR_ABOUTRAINMETER
ID_STR_WELCOME, STR_WELCOME
ID_STR_CLICKTOMANAGE, STR_CLICKTOMANAGE
ID_STR_CLICKTODOWNLOAD, STR_CLICKTODOWNLOAD
- ID_STR_VARIANTS, STR_VARIANTS
- ID_STR_POSITION, STR_POSITION
- ID_STR_DISPLAYMONITOR, STR_DISPLAYMONITOR
- ID_STR_USEDEFAULTMONITOR, STR_USEDEFAULTMONITOR
- ID_STR_VIRTUALSCREEN, STR_VIRTUALSCREEN
- ID_STR_AUTOSELECTMONITOR, STR_AUTOSELECTMONITOR
- ID_STR_FROMRIGHT, STR_FROMRIGHT
- ID_STR_FROMBOTTOM, STR_FROMBOTTOM
- ID_STR_XASPERCENTAGE, STR_XASPERCENTAGE
- ID_STR_YASPERCENTAGE, STR_YASPERCENTAGE
- ID_STR_TRANSPARENCY, STR_TRANSPARENCY
- ID_STR_HIDEONMOUSEOVER, STR_HIDEONMOUSEOVER
- ID_STR_DRAGGABLE, STR_DRAGGABLE
- ID_STR_SAVEPOSITION, STR_SAVEPOSITION
- ID_STR_SNAPTOEDGES, STR_SNAPTOEDGES
- ID_STR_CLICKTHROUGH, STR_CLICKTHROUGH
- ID_STR_KEEPONSCREEN, STR_KEEPONSCREEN
- ID_STR_MANAGESKIN, STR_MANAGESKIN
- ID_STR_EDITSKIN, STR_EDITSKIN
- ID_STR_REFRESHSKIN, STR_REFRESHSKIN
- ID_STR_UNLOADSKIN, STR_UNLOADSKIN
- ID_STR_REFRESH, STR_REFRESH
- ID_STR_EDIT, STR_EDIT
- ID_STR_EXPAND, STR_EXPAND
- ID_STR_OPENFOLDER, STR_OPENFOLDER
- ID_STR_DISABLEDRAGGING, STR_DISABLEDRAGGING
- ID_STR_0PERCENT, "0%"
- ID_STR_10PERCENT, "10%"
- ID_STR_20PERCENT, "20%"
- ID_STR_30PERCENT, "30%"
- ID_STR_40PERCENT, "40%"
- ID_STR_50PERCENT, "50%"
- ID_STR_60PERCENT, "60%"
- ID_STR_70PERCENT, "70%"
- ID_STR_80PERCENT, "80%"
- ID_STR_90PERCENT, "90%"
- ID_STR_MANAGE, STR_MANAGE
- ID_STR_ABOUT, STR_ABOUT
- ID_STR_HELP, STR_HELP
- ID_STR_NOSKINS, STR_NOSKINS
- ID_STR_NOTHEMES, STR_NOTHEMES
- ID_STR_EDITSETTINGS, STR_EDITSETTINGS
- ID_STR_REFRESHALL, STR_REFRESHALL
- ID_STR_LOGGING, STR_LOGGING
- ID_STR_SHOWLOGFILE, STR_SHOWLOGFILE
- ID_STR_STARTLOGGING, STR_STARTLOGGING
- ID_STR_STOPLOGGING, STR_STOPLOGGING
- ID_STR_DELETELOGFILE, STR_DELETELOGFILE
- ID_STR_DEBUGMODE, STR_DEBUGMODE
- ID_STR_EXIT, STR_EXIT
-}
+ ID_STR_CREATERMSKINPACKAGE, "Create .rmskin package..."
+ ID_STR_EDITORSC, "Editor:"
+ ID_STR_ELLIPSIS, "..."
+ ID_STR_SHOWNOTIFICATIONAREAICON, "Show notification area icon"
+}
View
518 Library/DialogAbout.cpp
@@ -26,8 +26,6 @@
#include "DialogAbout.h"
#include "../Version.h"
-#define WM_DELAYED_CLOSE WM_APP + 0
-
extern CRainmeter* Rainmeter;
WINDOWPLACEMENT CDialogAbout::c_WindowPlacement = {0};
@@ -37,11 +35,7 @@ CDialogAbout* CDialogAbout::c_Dialog = NULL;
** Constructor.
**
*/
-CDialogAbout::CDialogAbout(HWND wnd) : CDialog(wnd),
- m_TabLog(wnd),
- m_TabSkins(wnd),
- m_TabPlugins(wnd),
- m_TabVersion(wnd)
+CDialogAbout::CDialogAbout() : CDialog()
{
}
@@ -54,6 +48,33 @@ CDialogAbout::~CDialogAbout()
}
/*
+** Opens the About dialog.
+**
+*/
+void CDialogAbout::Open(int tab)
+{
+ if (!c_Dialog)
+ {
+ c_Dialog = new CDialogAbout();
+ }
+
+ c_Dialog->ShowDialogWindow(
+ GetString(ID_STR_ABOUTRAINMETER),
+ 0, 0, 400, 210,
+ DS_CENTER | WS_POPUP | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
+ WS_EX_APPWINDOW | WS_EX_CONTROLPARENT,
+ Rainmeter->GetWindow());
+
+ // Fake WM_NOTIFY to change tab
+ NMHDR nm;
+ nm.code = TCN_SELCHANGE;
+ nm.idFrom = Id_Tab;
+ nm.hwndFrom = GetDlgItem(c_Dialog->m_Window, Id_Tab);
+ TabCtrl_SetCurSel(nm.hwndFrom, tab);
+ c_Dialog->OnNotify(0, (LPARAM)&nm);
+}
+
+/*
** Opens the About dialog by tab name.
**
*/
@@ -82,37 +103,6 @@ void CDialogAbout::Open(const WCHAR* name)
}
/*
-** Opens the About dialog.
-**
-*/
-void CDialogAbout::Open(int tab)
-{
- if (!c_Dialog)
- {
- HINSTANCE instance = Rainmeter->GetResourceInstance();
- HWND owner = Rainmeter->GetWindow();
- if (!CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUT_DIALOG), owner, DlgProc)) return;
- }
- else
- {
- if (!IsZoomed(c_Dialog->m_Window))
- {
- ShowWindow(c_Dialog->m_Window, SW_SHOWNORMAL);
- }
- }
-
- SetForegroundWindow(c_Dialog->m_Window);
-
- // Fake WM_NOTIFY to change tab
- NMHDR nm;
- nm.code = TCN_SELCHANGE;
- nm.idFrom = IDC_ABOUT_TAB;
- nm.hwndFrom = GetDlgItem(c_Dialog->m_Window, IDC_ABOUT_TAB);
- TabCtrl_SetCurSel(nm.hwndFrom, tab);
- c_Dialog->OnNotify(0, (LPARAM)&nm);
-}
-
-/*
** Shows log if dialog isn't already open.
**
*/
@@ -150,7 +140,7 @@ void CDialogAbout::UpdateMeasures(CMeterWindow* meterWindow)
CDialog::CTab& CDialogAbout::GetActiveTab()
{
- int sel = TabCtrl_GetCurSel(GetDlgItem(m_Window, IDC_ABOUT_TAB));
+ int sel = TabCtrl_GetCurSel(GetDlgItem(m_Window, Id_Tab));
if (sel == 0)
{
return m_TabLog;
@@ -169,98 +159,92 @@ CDialog::CTab& CDialogAbout::GetActiveTab()
}
}
-/*
-** Dialog procedure for the About dialog.
-**
-*/
-INT_PTR CALLBACK CDialogAbout::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CDialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if (!c_Dialog)
- {
- if (uMsg == WM_INITDIALOG)
- {
- c_Dialog = new CDialogAbout(hWnd);
- return c_Dialog->OnInitDialog(wParam, lParam);
- }
- }
- else
+ switch (uMsg)
{
- switch (uMsg)
- {
- case WM_ACTIVATE:
- return c_Dialog->OnActivate(wParam, lParam);
+ case WM_INITDIALOG:
+ return OnInitDialog(wParam, lParam);
- case WM_COMMAND:
- return c_Dialog->OnCommand(wParam, lParam);
+ case WM_ACTIVATE:
+ return OnActivate(wParam, lParam);
- case WM_NOTIFY:
- return c_Dialog->OnNotify(wParam, lParam);
+ case WM_COMMAND:
+ return OnCommand(wParam, lParam);
- case WM_GETMINMAXINFO:
- {
- MINMAXINFO* mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = 550;
- mmi->ptMinTrackSize.y = 350;
- }
- return TRUE;
+ case WM_NOTIFY:
+ return OnNotify(wParam, lParam);
- case WM_SIZE:
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO* mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = 550;
+ mmi->ptMinTrackSize.y = 350;
+ }
+ return TRUE;
+
+ case WM_SIZE:
+ {
+ if (wParam != SIZE_MINIMIZED)
{
- if (wParam != SIZE_MINIMIZED)
- {
- int w = LOWORD(lParam);
- int h = HIWORD(lParam);
- RECT r;
-
- HWND item = GetDlgItem(hWnd, IDC_ABOUT_TAB);
- SetWindowPos(item, NULL, 0, 0, w - 18, h - 47, SWP_NOMOVE | SWP_NOZORDER);
-
- item = GetDlgItem(hWnd, IDCLOSE);
- GetClientRect(item, &r);
- SetWindowPos(item, NULL, w - r.right - 9, h - r.bottom - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-
- w -= 48;
- h -= 100;
- c_Dialog->m_TabLog.Resize(w, h);
- c_Dialog->m_TabSkins.Resize(w, h);
- c_Dialog->m_TabPlugins.Resize(w, h);
- c_Dialog->m_TabVersion.Resize(w, h);
- }
+ int w = LOWORD(lParam);
+ int h = HIWORD(lParam);
+ RECT r;
+
+ HWND item = GetDlgItem(m_Window, Id_Tab);
+ SetWindowPos(item, NULL, 0, 0, w - 18, h - 47, SWP_NOMOVE | SWP_NOZORDER);
+
+ item = GetDlgItem(m_Window, Id_CloseButton);
+ GetClientRect(item, &r);
+ SetWindowPos(item, NULL, w - r.right - 9, h - r.bottom - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
+
+ w -= 48;
+ h -= 100;
+ m_TabLog.Resize(w, h);
+ m_TabSkins.Resize(w, h);
+ m_TabPlugins.Resize(w, h);
+ m_TabVersion.Resize(w, h);
}
- return TRUE;
-
- case WM_CLOSE:
- PostMessage(hWnd, WM_DELAYED_CLOSE, 0, 0);
- return TRUE;
-
- case WM_DESTROY:
- delete c_Dialog;
- c_Dialog = NULL;
- return FALSE;
+ }
+ return TRUE;
- case WM_DELAYED_CLOSE:
- GetWindowPlacement(hWnd, &c_WindowPlacement);
+ case WM_CLOSE:
+ {
+ GetWindowPlacement(m_Window, &c_WindowPlacement);
if (c_WindowPlacement.showCmd == SW_SHOWMINIMIZED)
{
c_WindowPlacement.showCmd = SW_SHOWNORMAL;
}
- DestroyWindow(hWnd);
- return TRUE;
+
+ delete c_Dialog;
+ c_Dialog = NULL;
}
+ return TRUE;
}
return FALSE;
}
INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
{
- HWND item = GetDlgItem(m_Window, IDCLOSE);
- SendMessage(m_Window, WM_NEXTDLGCTL, (WPARAM)item, TRUE);
+ static const ControlTemplate::Control s_Controls[] =
+ {
+ CT_TAB(Id_Tab, 0,
+ 6, 6, 388, 181,
+ WS_VISIBLE | WS_TABSTOP | TCS_FIXEDWIDTH, WS_EX_CONTROLPARENT),
+ CT_BUTTON(Id_CloseButton, ID_STR_CLOSE,
+ 344, 191, 50, 14,
+ WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 0)
+ };
- HICON hIcon = GetIcon(IDI_RAINMETER);
- SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
+ CreateControls(s_Controls, _countof(s_Controls), m_Font, GetString);
+
+ HWND item = GetDlgItem(m_Window, Id_Tab);
+ m_TabLog.Create(item);
+ m_TabSkins.Create(item);
+ m_TabPlugins.Create(item);
+ m_TabVersion.Create(item);
- item = GetDlgItem(m_Window, IDC_ABOUT_TAB);
TCITEM tci = {0};
tci.mask = TCIF_TEXT;
tci.pszText = GetString(ID_STR_LOG);
@@ -272,14 +256,17 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
tci.pszText = GetString(ID_STR_VERSION);
TabCtrl_InsertItem(item, 3, &tci);
+ HICON hIcon = GetIcon(IDI_RAINMETER);
+ SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
+
+ item = GetDlgItem(m_Window, Id_CloseButton);
+ SendMessage(m_Window, WM_NEXTDLGCTL, (WPARAM)item, TRUE);
+
if (CSystem::GetOSPlatform() >= OSPLATFORM_VISTA)
{
- // Use UI font (Segoe UI) on Vista+
- SetDialogFont();
-
- HWND item = GetDlgItem(m_TabLog.GetWindow(), IDC_ABOUTLOG_ITEMS_LISTVIEW);
+ item = GetDlgItem(m_TabLog.GetWindow(), CTabLog::Id_ItemsListView);
SetWindowTheme(item, L"explorer", NULL);
- item = GetDlgItem(m_TabSkins.GetWindow(), IDC_ABOUTSKINS_ITEMS_LISTVIEW);
+ item = GetDlgItem(m_TabSkins.GetWindow(), CTabSkins::Id_ItemsListView);
SetWindowTheme(item, L"explorer", NULL);
}
@@ -288,18 +275,17 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
c_WindowPlacement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(m_Window, &c_WindowPlacement);
}
-
SetWindowPlacement(m_Window, &c_WindowPlacement);
- return FALSE;
+ return TRUE;
}
INT_PTR CDialogAbout::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam))
{
- case IDCLOSE:
- PostMessage(m_Window, WM_DELAYED_CLOSE, 0, 0);
+ case Id_CloseButton:
+ PostMessage(m_Window, WM_CLOSE, 0, 0);
break;
default:
@@ -314,7 +300,7 @@ INT_PTR CDialogAbout::OnNotify(WPARAM wParam, LPARAM lParam)
LPNMHDR nm = (LPNMHDR)lParam;
switch (nm->idFrom)
{
- case IDC_ABOUT_TAB:
+ case Id_Tab:
if (nm->code == TCN_SELCHANGE)
{
// Disable all tab windows first
@@ -344,22 +330,48 @@ INT_PTR CDialogAbout::OnNotify(WPARAM wParam, LPARAM lParam)
** Constructor.
**
*/
-CDialogAbout::CTabLog::CTabLog(HWND owner) : CTab(Rainmeter->GetResourceInstance(), owner, IDD_ABOUTLOG_DIALOG, DlgProc),
+CDialogAbout::CTabLog::CTabLog() : CTab(),
m_Error(true),
m_Warning(true),
m_Notice(true),
m_Debug(true)
{
}
+void CDialogAbout::CTabLog::Create(HWND owner)
+{
+ CTab::CreateTabWindow(9, 24, 370, 148, owner);
+
+ static const ControlTemplate::Control s_Controls[] =
+ {
+ CT_LISTVIEW(Id_ItemsListView, 0,
+ 0, 0, 368, 135,
+ WS_VISIBLE | WS_TABSTOP | WS_BORDER | LVS_ICON | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER, 0),
+ CT_CHECKBOX(Id_ErrorCheckBox, ID_STR_ERROR,
+ 0, 139, 70, 9,
+ WS_VISIBLE | WS_TABSTOP, 0),
+ CT_CHECKBOX(Id_WarningCheckBox, ID_STR_WARNING,
+ 70, 139, 70, 9,
+ WS_VISIBLE | WS_TABSTOP, 0),
+ CT_CHECKBOX(Id_NoticeCheckBox, ID_STR_NOTICE,
+ 140, 139, 70, 9,
+ WS_VISIBLE | WS_TABSTOP, 0),
+ CT_CHECKBOX(Id_DebugCheckBox, ID_STR_DEBUG,
+ 210, 139, 70, 9,
+ WS_VISIBLE | WS_TABSTOP, 0)
+ };
+
+ CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
+}
+
/*
** Called when tab is displayed.
**
*/
void CDialogAbout::CTabLog::Initialize()
{
// Add columns to the list view
- HWND item = GetDlgItem(m_Window, IDC_ABOUTLOG_ITEMS_LISTVIEW);
+ HWND item = GetDlgItem(m_Window, Id_ItemsListView);
ListView_SetExtendedListViewStyleEx(item, 0, LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
// Set folder/.ini icons for tree list
@@ -403,16 +415,16 @@ void CDialogAbout::CTabLog::Initialize()
AddItem((*iter).level, (*iter).timestamp.c_str(), (*iter).message.c_str());
}
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_ERROR_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_ErrorCheckBox);
Button_SetCheck(item, BST_CHECKED);
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_WarningCheckBox);
Button_SetCheck(item, BST_CHECKED);
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_NOTICE_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_NoticeCheckBox);
Button_SetCheck(item, BST_CHECKED);
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_DEBUG_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_DebugCheckBox);
Button_SetCheck(item, BST_CHECKED);
m_Initialized = true;
@@ -427,21 +439,21 @@ void CDialogAbout::CTabLog::Resize(int w, int h)
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
RECT r;
- HWND item = GetDlgItem(m_Window, IDC_ABOUTLOG_ERROR_CHECKBOX);
+ HWND item = GetDlgItem(m_Window, Id_ErrorCheckBox);
GetClientRect(item, &r);
SetWindowPos(item, NULL, 0, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_WarningCheckBox);
SetWindowPos(item, NULL, r.right, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_NOTICE_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_NoticeCheckBox);
SetWindowPos(item, NULL, r.right * 2, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_DEBUG_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_DebugCheckBox);
SetWindowPos(item, NULL, r.right * 3, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_ITEMS_LISTVIEW);
+ item = GetDlgItem(m_Window, Id_ItemsListView);
SetWindowPos(item, NULL, 0, 0, w, h - r.bottom - 7, SWP_NOMOVE | SWP_NOZORDER);
// Adjust third colum
@@ -469,31 +481,31 @@ void CDialogAbout::CTabLog::AddItem(int level, LPCWSTR time, LPCWSTR message)
{
case LOG_ERROR:
if (!m_Error) return;
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_ERROR_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_ErrorCheckBox);
vitem.iImage = 0;
break;
case LOG_WARNING:
if (!m_Warning) return;
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_WarningCheckBox);
vitem.iImage = 1;
break;
case LOG_NOTICE:
if (!m_Notice) return;
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_NOTICE_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_NoticeCheckBox);
vitem.iImage = 2;
break;
case LOG_DEBUG:
if (!m_Debug) return;
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_DEBUG_CHECKBOX);
+ item = GetDlgItem(m_Window, Id_DebugCheckBox);
vitem.iImage = I_IMAGENONE;
break;
}
GetWindowText(item, buffer, 32);
- item = GetDlgItem(m_Window, IDC_ABOUTLOG_ITEMS_LISTVIEW);
+ item = GetDlgItem(m_Window, Id_ItemsListView);
ListView_InsertItem(item, &vitem);
ListView_SetItemText(item, vitem.iItem, 1, (WCHAR*)time);
ListView_SetItemText(item, vitem.iItem, 2, (WCHAR*)message);
@@ -503,16 +515,15 @@ void CDialogAbout::CTabLog::AddItem(int level, LPCWSTR time, LPCWSTR message)
}
}
-/*
-** Dialog procedure for the log dialog.
-**
-*/
-INT_PTR CALLBACK CDialogAbout::CTabLog::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CDialogAbout::CTabLog::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
- return c_Dialog->m_TabLog.OnCommand(wParam, lParam);
+ return OnCommand(wParam, lParam);
+
+ case WM_NOTIFY:
+ return OnNotify(wParam, lParam);
}
return FALSE;
@@ -522,55 +533,68 @@ INT_PTR CDialogAbout::CTabLog::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam))
{
- case IDC_ABOUTLOG_ERROR_CHECKBOX:
+ case Id_ErrorCheckBox:
if (HIWORD(wParam) == BN_CLICKED)
{
m_Error = !m_Error;
}
break;
- case IDC_ABOUTLOG_WARNING_CHECKBOX:
+ case Id_WarningCheckBox:
if (HIWORD(wParam) == BN_CLICKED)
{
m_Warning = !m_Warning;
}
break;
- case IDC_ABOUTLOG_NOTICE_CHECKBOX:
+ case Id_NoticeCheckBox:
if (HIWORD(wParam) == BN_CLICKED)
{
m_Notice = !m_Notice;
}
break;
- case IDC_ABOUTLOG_DEBUG_CHECKBOX:
+ case Id_DebugCheckBox:
if (HIWORD(wParam) == BN_CLICKED)
{
m_Debug = !m_Debug;
}
break;
- case IDM_COPY:
+ default:
+ return 1;
+ }
+
+ return 0;
+}
+
+INT_PTR CDialogAbout::CTabLog::OnNotify(WPARAM wParam, LPARAM lParam)
+{
+ LPNMHDR nm = (LPNMHDR)lParam;
+ switch (nm->code)
+ {
+ case LVN_KEYDOWN:
{
- HWND item = GetFocus();
- if (item == GetDlgItem(m_Window, IDC_ABOUTLOG_ITEMS_LISTVIEW))
+ NMLVKEYDOWN* lvkd = (NMLVKEYDOWN*)nm;
+ if (lvkd->wVKey == 0x43 && // C key.
+ IsCtrlKeyDown())
{
- int sel = ListView_GetNextItem(item, -1, LVNI_FOCUSED | LVNI_SELECTED);
+ int sel = ListView_GetNextItem(nm->hwndFrom, -1, LVNI_FOCUSED | LVNI_SELECTED);
if (sel != -1)
{
std::wstring tmpSz(512, L'0');
- ListView_GetItemText(item, sel, 2, &tmpSz[0], 512);
+ ListView_GetItemText(nm->hwndFrom, sel, 2, &tmpSz[0], 512);
CSystem::SetClipboardText(tmpSz);
}
}
}
break;
default:
- return 1;
+ return FALSE;
}
- return 0;
+ return TRUE;
}
// -----------------------------------------------------------------------------------------------
@@ -583,19 +607,32 @@ INT_PTR CDialogAbout::CTabLog::OnCommand(WPARAM wParam, LPARAM lParam)
** Constructor.
**
*/
-CDialogAbout::CTabSkins::CTabSkins(HWND owner) : CTab(Rainmeter->GetResourceInstance(), owner, IDD_ABOUTSKINS_DIALOG, DlgProc),
+CDialogAbout::CTabSkins::CTabSkins() : CTab(),
m_SkinWindow()
{
}
-/*
-** Called when tab is displayed.
-**
-*/
+void CDialogAbout::CTabSkins::Create(HWND owner)
+{
+ CTab::CreateTabWindow(9, 24, 370, 148, owner);
+
+ static const ControlTemplate::Control s_Controls[] =
+ {
+ CT_LISTBOX(Id_SkinsListBox, 0,
+ 0, 0, 120, 148,
+ WS_VISIBLE | WS_TABSTOP | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL, WS_EX_CLIENTEDGE),
+ CT_LISTVIEW(Id_ItemsListView, 0,
+ 125, 0, 242, 148,
+ WS_VISIBLE | WS_TABSTOP | WS_BORDER | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER, 0)
+ };
+
+ CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
+}
+
void CDialogAbout::CTabSkins::Initialize()
{
// Add columns to the list view
- HWND item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTVIEW);
+ HWND item = GetDlgItem(m_Window, Id_ItemsListView);
ListView_SetExtendedListViewStyleEx(item, 0, LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
LVGROUP lvg;
@@ -640,11 +677,11 @@ void CDialogAbout::CTabSkins::Resize(int w, int h)
{
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
- HWND item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTBOX);
+ HWND item = GetDlgItem(m_Window, Id_SkinsListBox);
int wList = (w < 650) ? (w - 373) : 277;
SetWindowPos(item, NULL, 0, 0, wList, h, SWP_NOMOVE | SWP_NOZORDER);
- item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTVIEW);
+ item = GetDlgItem(m_Window, Id_ItemsListView);
SetWindowPos(item, NULL, (w < 650) ? (w - 365) : 285, 0, w - wList - 10, h, SWP_NOZORDER);
// Adjust third column
@@ -661,7 +698,7 @@ void CDialogAbout::CTabSkins::Resize(int w, int h)
void CDialogAbout::CTabSkins::UpdateSkinList()
{
// Delete all entries
- HWND item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTBOX);
+ HWND item = GetDlgItem(m_Window, Id_SkinsListBox);
ListBox_ResetContent(item);
// Add entries for each skin
@@ -695,7 +732,7 @@ void CDialogAbout::CTabSkins::UpdateSkinList()
if (windows.empty())
{
m_SkinWindow = NULL;
- item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTVIEW);
+ item = GetDlgItem(m_Window, Id_ItemsListView);
ListView_DeleteAllItems(item);
}
else
@@ -717,7 +754,7 @@ void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
if (!meterWindow)
{
// Find selected skin
- HWND item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTBOX);
+ HWND item = GetDlgItem(m_Window, Id_SkinsListBox);
int selected = (int)SendMessage(item, LB_GETCURSEL, NULL, NULL);
const std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows();
@@ -736,7 +773,7 @@ void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
return;
}
- HWND item = GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTVIEW);
+ HWND item = GetDlgItem(m_Window, Id_ItemsListView);
SendMessage(item, WM_SETREDRAW, FALSE, 0);
int count = ListView_GetItemCount(item);
@@ -836,16 +873,15 @@ int CALLBACK CDialogAbout::CTabSkins::ListSortProc(LPARAM lParam1, LPARAM lParam
return wcscmp((const WCHAR*)lParam1, (const WCHAR*)lParam2);
}
-/*
-** Dialog procedure for the measures dialog.
-**
-*/
-INT_PTR CALLBACK CDialogAbout::CTabSkins::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CDialogAbout::CTabSkins::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
- return c_Dialog->m_TabSkins.OnCommand(wParam, lParam);
+ return OnCommand(wParam, lParam);
+
+ case WM_NOTIFY:
+ return OnNotify(wParam, lParam);
}
return FALSE;
@@ -855,7 +891,7 @@ INT_PTR CDialogAbout::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam))
{
- case IDC_ABOUTSKINS_ITEMS_LISTBOX:
+ case Id_SkinsListBox:
if (HIWORD(wParam) == LBN_SELCHANGE)
{
UpdateMeasureList(NULL);
@@ -865,7 +901,7 @@ INT_PTR CDialogAbout::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
case IDM_COPY:
{
HWND item = GetFocus();
- if (item == GetDlgItem(m_Window, IDC_ABOUTSKINS_ITEMS_LISTVIEW))
+ if (item == GetDlgItem(m_Window, Id_ItemsListView))
{
int sel = ListView_GetNextItem(item, -1, LVNI_FOCUSED | LVNI_SELECTED);
if (sel != -1)
@@ -885,28 +921,62 @@ INT_PTR CDialogAbout::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
return 0;
}
+INT_PTR CDialogAbout::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
+{
+ LPNMHDR nm = (LPNMHDR)lParam;
+ switch (nm->code)
+ {
+ case LVN_KEYDOWN:
+ {
+ NMLVKEYDOWN* lvkd = (NMLVKEYDOWN*)nm;
+ if (lvkd->wVKey == 0x43 && IsCtrlKeyDown()) // CTRL + C.
+ {
+ int sel = ListView_GetNextItem(nm->hwndFrom, -1, LVNI_FOCUSED | LVNI_SELECTED);
+ if (sel != -1)
+ {
+ std::wstring tmpSz(512, L'0');
+ ListView_GetItemText(nm->hwndFrom, sel, 2, &tmpSz[0], 512);
+ CSystem::SetClipboardText(tmpSz);
+ }
+ }
+ }
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
// -----------------------------------------------------------------------------------------------
//
// Plugins tab
//
// -----------------------------------------------------------------------------------------------
-/*
-** Constructor.
-**
-*/
-CDialogAbout::CTabPlugins::CTabPlugins(HWND owner) : CTab(Rainmeter->GetResourceInstance(), owner, IDD_ABOUTPLUGINS_DIALOG, DlgProc)
+CDialogAbout::CTabPlugins::CTabPlugins() : CTab()
{
}
-/*
-** Called when tab is displayed.
-**
-*/
+void CDialogAbout::CTabPlugins::Create(HWND owner)
+{
+ CTab::CreateTabWindow(9, 24, 370, 148, owner);
+
+ static const ControlTemplate::Control s_Controls[] =
+ {
+ CT_LISTVIEW(Id_ItemsListView, 0,
+ 0, 0, 368, 148,
+ WS_VISIBLE | WS_TABSTOP | WS_BORDER | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER, 0)
+ };
+
+ CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
+}
+
void CDialogAbout::CTabPlugins::Initialize()
{
// Add columns to the list view
- HWND item = GetDlgItem(m_Window, IDC_ABOUTPLUGINS_ITEMS_LISTVIEW);
+ HWND item = GetDlgItem(m_Window, Id_ItemsListView);
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
@@ -1053,7 +1123,7 @@ void CDialogAbout::CTabPlugins::Resize(int w, int h)
{
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
- HWND item = GetDlgItem(m_Window, IDC_ABOUTPLUGINS_ITEMS_LISTVIEW);
+ HWND item = GetDlgItem(m_Window, Id_ItemsListView);
SetWindowPos(item, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
// Adjust third colum
@@ -1063,15 +1133,6 @@ void CDialogAbout::CTabPlugins::Resize(int w, int h)
ListView_SetColumn(item, 2, &lvc);
}
-/*
-** Dialog procedure for the Plugins tab.
-**
-*/
-INT_PTR CALLBACK CDialogAbout::CTabPlugins::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- return FALSE;
-}
-
// -----------------------------------------------------------------------------------------------
//
// Version tab
@@ -1082,34 +1143,68 @@ INT_PTR CALLBACK CDialogAbout::CTabPlugins::DlgProc(HWND hWnd, UINT uMsg, WPARAM
** Constructor.
**
*/
-CDialogAbout::CTabVersion::CTabVersion(HWND owner) : CTab(Rainmeter->GetResourceInstance(), owner, IDD_ABOUTVERSION_DIALOG, DlgProc)
+CDialogAbout::CTabVersion::CTabVersion() : CTab()
{
}
-/*
-** Called when tab is displayed.
-**
-*/
+void CDialogAbout::CTabVersion::Create(HWND owner)
+{
+ CTab::CreateTabWindow(9, 24, 370, 148, owner);
+
+ // FIXME: Temporary hack.
+ short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH));
+
+ const ControlTemplate::Control s_Controls[] =
+ {
+ CT_ICON(Id_AppIcon, 0,
+ 0, 8, 24, 24,
+ WS_VISIBLE, 0),
+ CT_LABEL(Id_VersionLabel, 0,
+ 28, 0, 300, 9,
+ WS_VISIBLE, 0),
+ CT_LINKLABEL(Id_HomeLink, ID_STR_GETLATESTVERSION,
+ 28, 13, 300, 9,
+ WS_VISIBLE, 0),
+ CT_LINKLABEL(Id_LicenseLink, ID_STR_COPYRIGHTNOTICE,
+ 28, 26, 300, 9,
+ WS_VISIBLE, 0),
+ CT_LABEL(Id_PathLabel, 0,
+ 0, 43, 360, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_LABEL(Id_IniFileLabel, 0,
+ 0, 56, 360, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_LABEL(Id_SkinPathLabel, 0,
+ 0, 69, 360, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_BUTTON(Id_CopyButton, ID_STR_COPYTOCLIPBOARD,
+ 0, 85, buttonWidth + 25, 14,
+ WS_VISIBLE | WS_TABSTOP, 0)
+ };
+
+ CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
+}
+
void CDialogAbout::CTabVersion::Initialize()
{
- HWND item = GetDlgItem(m_Window, IDC_ABOUTVERSION_RAINMETER_ICON);
+ HWND item = GetDlgItem(m_Window, Id_AppIcon);
HICON icon = GetIcon(IDI_RAINMETER, true);
Static_SetIcon(item, icon);
- item = GetDlgItem(m_Window, IDC_ABOUTVERSION_VERSION_TEXT);
+ item = GetDlgItem(m_Window, Id_VersionLabel);
WCHAR tmpSz[64];
_snwprintf_s(tmpSz, _TRUNCATE, L"%s%s r%i %s (%s)", APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE);
SetWindowText(item, tmpSz);
- item = GetDlgItem(m_Window, IDC_ABOUTVERSION_PATH_TEXT);
+ item = GetDlgItem(m_Window, Id_PathLabel);
std::wstring text = L"Path: " + Rainmeter->GetPath();
SetWindowText(item, text.c_str());
- item = GetDlgItem(m_Window, IDC_ABOUTVERSION_INIFILE_TEXT);
+ item = GetDlgItem(m_Window, Id_IniFileLabel);
text = L"IniFile: " + Rainmeter->GetIniFile();
SetWindowText(item, text.c_str());
- item = GetDlgItem(m_Window, IDC_ABOUTVERSION_SKINPATH_TEXT);
+ item = GetDlgItem(m_Window, Id_SkinPathLabel);
text = L"SkinPath: " + Rainmeter->GetSkinPath();
SetWindowText(item, text.c_str());
@@ -1125,19 +1220,15 @@ void CDialogAbout::CTabVersion::Resize(int w, int h)
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
}
-/*
-** Dialog procedure for the Version tab.
-**
-*/
-INT_PTR CALLBACK CDialogAbout::CTabVersion::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CDialogAbout::CTabVersion::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
- return c_Dialog->m_TabVersion.OnCommand(wParam, lParam);
+ return OnCommand(wParam, lParam);
case WM_NOTIFY:
- return c_Dialog->m_TabVersion.OnNotify(wParam, lParam);
+ return OnNotify(wParam, lParam);
}
return FALSE;
@@ -1147,7 +1238,7 @@ INT_PTR CDialogAbout::CTabVersion::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam))
{
- case IDC_ABOUTVERSION_COPY_BUTTON:
+ case Id_CopyButton:
{
WCHAR tmpSz[64];
int len = _snwprintf_s(tmpSz, _TRUNCATE, L"%s%s r%i %s (%s)", APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE);
@@ -1175,7 +1266,14 @@ INT_PTR CDialogAbout::CTabVersion::OnNotify(WPARAM wParam, LPARAM lParam)
switch (nm->code)
{
case NM_CLICK:
- RunFile(((PNMLINK)lParam)->item.szUrl);
+ if (nm->idFrom == Id_HomeLink)
+ {
+ RunFile(L"http://rainmeter.net");
+ }
+ else if (nm->idFrom == Id_HomeLink)
+ {
+ RunFile(L"http://gnu.org/licenses");
+ }
break;
default:
View
84 Library/DialogAbout.h
@@ -19,21 +19,20 @@
#ifndef __DIALOGABOUT_H__
#define __DIALOGABOUT_H__
-#include "Dialog.h"
+#include "../Common/Dialog.h"
class CDialogAbout : public CDialog
{
public:
- CDialogAbout(HWND window);
+ CDialogAbout();
virtual ~CDialogAbout();
- static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR OnInitDialog(WPARAM wParam, LPARAM lParam);
INT_PTR OnNotify(WPARAM wParam, LPARAM lParam);
INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
- static void Open(const WCHAR* name);
static void Open(int tab = 0);
+ static void Open(const WCHAR* name);
static void ShowAboutLog();
static void AddLogItem(int level, LPCWSTR time, LPCWSTR message);
@@ -44,23 +43,35 @@ class CDialogAbout : public CDialog
static CDialogAbout* c_Dialog;
protected:
- virtual HWND GetActiveWindow() { return GetActiveTab().GetWindow(); }
+ virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
// Log tab
class CTabLog : public CTab
{
public:
- CTabLog(HWND owner);
-
+ enum Id
+ {
+ Id_ItemsListView = 100,
+ Id_ErrorCheckBox,
+ Id_WarningCheckBox,
+ Id_NoticeCheckBox,
+ Id_DebugCheckBox
+ };
+
+ CTabLog();
+
+ void Create(HWND owner);
virtual void Initialize();
virtual void Resize(int w, int h);
- static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
-
void AddItem(int level, LPCWSTR time, LPCWSTR message);
+ protected:
+ virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
+ INT_PTR OnNotify(WPARAM wParam, LPARAM lParam);
+
private:
bool m_Error;
bool m_Warning;
@@ -72,17 +83,26 @@ class CDialogAbout : public CDialog
class CTabSkins : public CTab
{
public:
- CTabSkins(HWND owner);
+ enum Id
+ {
+ Id_SkinsListBox = 100,
+ Id_ItemsListView
+ };
+ CTabSkins();
+
+ void Create(HWND owner);
virtual void Initialize();
virtual void Resize(int w, int h);
-
- static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
void UpdateSkinList();
void UpdateMeasureList(CMeterWindow* meterWindow);
+ protected:
+ virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
+ INT_PTR OnNotify(WPARAM wParam, LPARAM lParam);
+
private:
static int CALLBACK ListSortProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
@@ -93,13 +113,17 @@ class CDialogAbout : public CDialog
class CTabPlugins : public CTab
{
public:
- CTabPlugins(HWND owner);
+ enum Id
+ {
+ Id_ItemsListView = 100
+ };
+
+ CTabPlugins();
+ void Create(HWND owner);
virtual void Initialize();
virtual void Resize(int w, int h);
- static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
private:
typedef LPCTSTR (*GETPLUGINAUTHOR)();
typedef UINT (*GETPLUGINVERSION)();
@@ -109,16 +133,36 @@ class CDialogAbout : public CDialog
class CTabVersion : public CTab
{
public:
- CTabVersion(HWND owner);
-
+ enum Id
+ {
+ Id_AppIcon = 100,
+ Id_VersionLabel,
+ Id_HomeLink,
+ Id_LicenseLink,
+ Id_PathLabel,
+ Id_IniFileLabel,
+ Id_SkinPathLabel,
+ Id_CopyButton
+ };
+
+ CTabVersion();
+
+ void Create(HWND owner);
virtual void Initialize();
virtual void Resize(int w, int h);
- static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ protected:
+ virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR OnNotify(WPARAM wParam, LPARAM lParam);
INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
};
+ enum Id
+ {
+ Id_CloseButton = IDCLOSE,
+ Id_Tab = 100
+ };
+
CTab& GetActiveTab();
CTabLog m_TabLog;
View
721 Library/DialogManage.cpp
@@ -29,8 +29,6 @@
#include "../Version.h"
#include <Commdlg.h>
-#define WM_DELAYED_CLOSE WM_APP + 0
-
extern CRainmeter* Rainmeter;
WINDOWPLACEMENT CDialogManage::c_WindowPlacement = {0};
@@ -40,10 +38,7 @@ CDialogManage* CDialogManage::c_Dialog = NULL;
** Constructor.
**
*/
-CDialogManage::CDialogManage(HWND wnd) : CDialog(wnd),
- m_TabSkins(wnd),
- m_TabLayouts(wnd),
- m_TabSettings(wnd)
+CDialogManage::CDialogManage() : CDialog()
{
}
@@ -87,25 +82,21 @@ void CDialogManage::Open(int tab)
{
if (!c_Dialog)
{
- HINSTANCE instance = Rainmeter->GetResourceInstance();
- HWND owner = Rainmeter->GetWindow();
- if (!CreateDialog(instance, MAKEINTRESOURCE(IDD_MANAGE_DIALOG), owner, DlgProc)) return;
- }
- else
- {
- if (!IsZoomed(c_Dialog->m_Window))
- {
- ShowWindow(c_Dialog->m_Window, SW_SHOWNORMAL);
- }
+ c_Dialog = new CDialogManage();
}
- SetForegroundWindow(c_Dialog->m_Window);
+ c_Dialog->ShowDialogWindow(
+ GetString(ID_STR_MANAGERAINMETER),
+ 0, 0, 500, 322,
+ DS_CENTER | WS_POPUP | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
+ WS_EX_APPWINDOW | WS_EX_CONTROLPARENT,
+ Rainmeter->GetWindow());
// Fake WM_NOTIFY to change tab
NMHDR nm;
nm.code = TCN_SELCHANGE;
- nm.idFrom = IDC_MANAGE_TAB;
- nm.hwndFrom = GetDlgItem(c_Dialog->m_Window, IDC_MANAGE_TAB);
+ nm.idFrom = Id_Tab;
+ nm.hwndFrom = GetDlgItem(c_Dialog->m_Window, Id_Tab);
TabCtrl_SetCurSel(nm.hwndFrom, tab);
c_Dialog->OnNotify(0, (LPARAM)&nm);
}
@@ -123,7 +114,7 @@ void CDialogManage::OpenSkin(CMeterWindow* meterWindow)
std::wstring name = meterWindow->GetFolderPath() + L'\\';
name += meterWindow->GetFileName();
- HWND item = GetDlgItem(c_Dialog->m_TabSkins.GetWindow(), IDC_MANAGESKINS_SKINS_TREEVIEW);
+ HWND item = GetDlgItem(c_Dialog->m_TabSkins.GetWindow(), CTabSkins::Id_SkinsTreeView);
c_Dialog->m_TabSkins.SelectTreeItem(item, TreeView_GetRoot(item), name.c_str());
}
}
@@ -142,7 +133,7 @@ void CDialogManage::UpdateSkins(CMeterWindow* meterWindow, bool deleted)
CDialog::CTab& CDialogManage::GetActiveTab()
{
- int sel = TabCtrl_GetCurSel(GetDlgItem(m_Window, IDC_MANAGE_TAB));
+ int sel = TabCtrl_GetCurSel(GetDlgItem(m_Window, Id_Tab));
if (sel == 0)
{
return m_TabSkins;
@@ -157,65 +148,73 @@ CDialog::CTab& CDialogManage::GetActiveTab()
}
}
-/*
-** Dialog procedure for the Manage dialog.
-**
-*/
-INT_PTR CALLBACK CDialogManage::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CDialogManage::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if (!c_Dialog)
- {
- if (uMsg == WM_INITDIALOG)
- {
- c_Dialog = new CDialogManage(hWnd);
- return c_Dialog->OnInitDialog(wParam, lParam);
- }
- }
- else
+ switch (uMsg)
{
- switch (uMsg)
- {
- case WM_ACTIVATE:
- return c_Dialog->OnActivate(wParam, lParam);
+ case WM_INITDIALOG:
+ return OnInitDialog(wParam, lParam);
- case WM_COMMAND:
- return c_Dialog->OnCommand(wParam, lParam);
+ case WM_ACTIVATE:
+ return OnActivate(wParam, lParam);
- case WM_NOTIFY:
- return c_Dialog->OnNotify(wParam, lParam);
-
- case WM_CLOSE:
- PostMessage(hWnd, WM_DELAYED_CLOSE, 0, 0);
- return TRUE;
+ case WM_COMMAND:
+ return OnCommand(wParam, lParam);
- case WM_DESTROY:
- delete c_Dialog;
- c_Dialog = NULL;
- return FALSE;
+ case WM_NOTIFY:
+ return OnNotify(wParam, lParam);
- case WM_DELAYED_CLOSE:
- GetWindowPlacement(hWnd, &c_WindowPlacement);
+ case WM_CLOSE:
+ {
+ GetWindowPlacement(m_Window, &c_WindowPlacement);
if (c_WindowPlacement.showCmd == SW_SHOWMINIMIZED)
{
c_WindowPlacement.showCmd = SW_SHOWNORMAL;
}
- DestroyWindow(hWnd);
- return TRUE;
+
+ delete c_Dialog;
+ c_Dialog = NULL;
}
+ return TRUE;
}
return FALSE;
}
INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
{
- HWND item = GetDlgItem(m_Window, IDCLOSE);
- SendMessage(m_Window, WM_NEXTDLGCTL, (WPARAM)item, TRUE);
+ // FIXME: Temporary hack.
+ short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH));
- HICON hIcon = GetIcon(IDI_RAINMETER);
- SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
+ const ControlTemplate::Control s_Controls[] =
+ {
+ CT_BUTTON(Id_RefreshAllButton, ID_STR_REFRESHALL,
+ 5, 303, buttonWidth, 14,
+ WS_VISIBLE | WS_TABSTOP, 0),
+ CT_BUTTON(Id_EditSettingsButton, ID_STR_EDITSETTINGS,
+ buttonWidth + 9, 303, buttonWidth, 14,
+ WS_VISIBLE | WS_TABSTOP, 0),
+ CT_BUTTON(Id_OpenLogButton, ID_STR_OPENLOG,
+ buttonWidth + buttonWidth + 13, 303, buttonWidth, 14,
+ WS_VISIBLE | WS_TABSTOP, 0),
+ CT_BUTTON(Id_HelpButton, ID_STR_HELP,
+ 389, 303, 50, 14,
+ WS_VISIBLE | WS_TABSTOP, 0),
+ CT_BUTTON(Id_CloseButton, ID_STR_CLOSE,
+ 444, 303, 50, 14,
+ WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 0),
+ CT_TAB(Id_Tab, 0,
+ 6, 6, 488, 293,
+ WS_VISIBLE | WS_TABSTOP | TCS_FIXEDWIDTH, 0) // Last for correct tab order.
+ };
+
+ CreateControls(s_Controls, _countof(s_Controls), m_Font, GetString);
+
+ HWND item = GetDlgItem(m_Window, Id_Tab);
+ m_TabSkins.Create(item);
+ m_TabLayouts.Create(item);
+ m_TabSettings.Create(item);
- item = GetDlgItem(m_Window, IDC_MANAGE_TAB);
TCITEM tci = {0};
tci.mask = TCIF_TEXT;
tci.pszText = GetString(ID_STR_SKINS);
@@ -225,19 +224,22 @@ INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
tci.pszText = GetString(ID_STR_SETTINGS);
TabCtrl_InsertItem(item, 2, &tci);
+ HICON hIcon = GetIcon(IDI_RAINMETER);
+ SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
+
+ item = GetDlgItem(m_Window, Id_CloseButton);
+ SendMessage(m_Window, WM_NEXTDLGCTL, (WPARAM)item, TRUE);
+
+ item = GetDlgItem(m_TabSkins.GetWindow(), CTabSkins::Id_FileLabel);
+ SendMessage(item, WM_SETFONT, (WPARAM)m_FontBold, 0);
+
if (CSystem::GetOSPlatform() >= OSPLATFORM_VISTA)
{
- // Use UI font (Segoe UI) on Vista+
- SetDialogFont();
-
// Use arrows instead of plus/minus in the tree for Vista+
- item = GetDlgItem(m_TabSkins.GetWindow(), IDC_MANAGESKINS_SKINS_TREEVIEW);
+ item = GetDlgItem(m_TabSkins.GetWindow(), CTabSkins::Id_SkinsTreeView);
SetWindowTheme(item, L"explorer", NULL);
}
- item = GetDlgItem(m_TabSkins.GetWindow(), IDC_MANAGESKINS_FILE_TEXT);
- SendMessage(item, WM_SETFONT, (WPARAM)m_FontBold, 0);
-
if (c_WindowPlacement.length == 0)
{
c_WindowPlacement.length = sizeof(WINDOWPLACEMENT);
@@ -253,36 +255,36 @@ INT_PTR CDialogManage::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam))
{
- case IDC_MANAGE_REFRESHALL_BUTTON:
+ case Id_RefreshAllButton:
Rainmeter->RefreshAll();
break;
- case IDC_MANAGE_EDITSETTINGS_BUTTON:
+ case Id_EditSettingsButton:
Rainmeter->EditSettings();
break;
- case IDC_MANAGE_OPENLOG_BUTTON:
+ case Id_OpenLogButton:
CDialogAbout::Open();
break;
- case IDCLOSE:
- PostMessage(m_Window, WM_DELAYED_CLOSE, 0, 0);
+ case Id_CloseButton:
+ HandleMessage(WM_CLOSE, 0, 0);
break;
- case IDC_MANAGE_HELP_BUTTON:
+ case Id_HelpButton:
{
std::wstring url = L"http://docs.rainmeter.net/manual/user-interface/manage#";
- HWND hwnd = c_Dialog->GetActiveTabWindow();
- if (hwnd == m_TabSkins.GetWindow())
+ CTab& tab = GetActiveTab();
+ if (&tab == &m_TabSkins)
{
url += L"Skins";
}
- else if (hwnd == m_TabLayouts.GetWindow())
+ else if (&tab == &m_TabLayouts)
{
url += L"Layouts";
}
- else // if (hwnd == m_TabSettings.GetWindow())
+ else // if (&tab == &m_TabSettings)
{
url += L"Settings";
}
@@ -304,7 +306,7 @@ INT_PTR CDialogManage::OnNotify(WPARAM wParam, LPARAM lParam)
LPNMHDR nm = (LPNMHDR)lParam;
switch (nm->idFrom)
{
- case IDC_MANAGE_TAB:
+ case Id_Tab:
if (nm->code == TCN_SELCHANGE)
{
// Disable all tab windows first
@@ -333,28 +335,148 @@ INT_PTR CDialogManage::OnNotify(WPARAM wParam, LPARAM lParam)
** Constructor.
**
*/
-CDialogManage::CTabSkins::CTabSkins(HWND owner) : CTab(Rainmeter->GetResourceInstance(), owner, IDD_MANAGESKINS_DIALOG, DlgProc),
+CDialogManage::CTabSkins::CTabSkins() : CTab(),
m_SkinWindow(),
m_HandleCommands(false),
m_IgnoreUpdate(false)
{
}
-/*
-** Called when tab is displayed.
-**
-*/
+void CDialogManage::CTabSkins::Create(HWND owner)
+{
+ CTab::CreateTabWindow(9, 24, 470, 260, owner);
+
+ // FIXME: Temporary hack.
+ short labelWidth = (short)_wtoi(GetString(ID_STR_NUM_LABELWIDTH));
+
+ const ControlTemplate::Control s_Controls[] =
+ {
+ CT_BUTTON(Id_ActiveSkinsButton, ID_STR_ACTIVESKINS,
+ 0, 0, 146, 14,
+ WS_VISIBLE | WS_TABSTOP, 0),
+ CT_TREEVIEW(Id_SkinsTreeView, 0,
+ 0, 18, 145, 221,
+ WS_VISIBLE | WS_TABSTOP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_VSCROLL, WS_EX_CLIENTEDGE),
+ CT_BUTTON(Id_CreateSkinPackageButton, ID_STR_CREATERMSKINPACKAGE,
+ 0, 244, 146, 14,
+ WS_VISIBLE | WS_TABSTOP, 0),
+
+ CT_LABEL(Id_FileLabel, ID_STR_ELLIPSIS,
+ 165, 0, 130, 14,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_LABEL(Id_ConfigLabel, 0,
+ 165, 15, 130, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_BUTTON(Id_LoadButton, ID_STR_LOAD,
+ 310, 0, 50, 14,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0),
+ CT_BUTTON(Id_RefreshButton, ID_STR_REFRESH,
+ 364, 0, 50, 14,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0),
+ CT_BUTTON(Id_EditButton, ID_STR_EDIT,
+ 418, 0, 50, 14,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0),
+
+ CT_LABEL(-1, ID_STR_AUTHORSC,
+ 165, 30, 80, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_LABEL(Id_AuthorLabel, 0,
+ 230, 30, 245, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_LABEL(-1, ID_STR_VERSIONSC,
+ 165, 43, 80, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_LABEL(Id_VersionLabel, 0,
+ 230, 43, 245, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_LABEL(-1, ID_STR_LICENSESC,
+ 165, 56, 80, 9,
+ WS_VISIBLE | WS_TABSTOP | SS_NOPREFIX, 0),
+ CT_LABEL(Id_LicenseLabel, 0,
+ 230, 56, 245, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_LABEL(-1, ID_STR_INFORMATIONSC,
+ 165, 69, 80, 9,
+ WS_VISIBLE | SS_ENDELLIPSIS | SS_NOPREFIX, 0),
+ CT_EDIT(Id_DescriptionLabel, 0,
+ 228, 69, 238, 64,
+ WS_VISIBLE | ES_MULTILINE | ES_READONLY, 0),
+ CT_LINKLABEL(Id_AddMetadataLink, ID_STR_ADDMETADATA,
+ 165, 142, 150, 9,
+ 0, 0),
+
+ CT_LINEH(-1, ID_STR_COORDINATESSC,
+ 165, 156, 304, 1,
+ WS_VISIBLE, 0),
+
+ CT_LABEL(-1, ID_STR_COORDINATESSC,
+ 165, 169, labelWidth, 9,
+ WS_VISIBLE, 0),
+ CT_EDIT(Id_XPositionEdit, 0,
+ 165 + labelWidth, 166, 38, 14,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, WS_EX_CLIENTEDGE),
+ CT_EDIT(Id_YPositionEdit, 0,
+ 165 + labelWidth + 42, 166, 38, 14,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, WS_EX_CLIENTEDGE),
+ CT_LABEL(-1, ID_STR_POSITIONSC,
+ 165, 190, labelWidth, 9,
+ WS_VISIBLE, 0),
+ CT_COMBOBOX(Id_ZPositionDropDownList, 0,
+ 165 + labelWidth, 187, 80, 14,
+ WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST | WS_VSCROLL | WS_DISABLED, 0),
+ CT_LABEL(-1, ID_STR_LOADORDERSC,
+ 165, 208, labelWidth, 9,
+ WS_VISIBLE, 0),
+ CT_EDIT(Id_LoadOrderEdit, 0,
+ 165 + labelWidth, 205, 80, 14,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, WS_EX_CLIENTEDGE),
+ CT_LABEL(-1, ID_STR_TRANSPARENCYSC,
+ 165, 229, labelWidth, 9,
+ WS_VISIBLE, 0),
+ CT_COMBOBOX(Id_TransparencyDropDownList, 0,
+ 165 + labelWidth, 226, 80, 14,
+ WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST | WS_VSCROLL | WS_DISABLED, 0),
+ CT_LABEL(-1, ID_STR_ONHOVERSC,
+ 165, 247, labelWidth, 9,
+ WS_VISIBLE, 0),
+ CT_COMBOBOX(Id_OnHoverDropDownList, 0,
+ 165 + labelWidth, 244, 80, 14,
+ WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST | WS_VSCROLL | WS_DISABLED, 0),
+
+ CT_BUTTON(Id_DisplayMonitorButton, ID_STR_DISPLAYMONITOR,
+ 350, 166, 118, 14,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0),
+ CT_CHECKBOX(Id_DraggableCheckBox, ID_STR_DRAGGABLE,
+ 350, 190, 118, 9,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0),
+ CT_CHECKBOX(Id_ClickThroughCheckBox, ID_STR_CLICKTHROUGH,
+ 350, 203, 118, 9,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0),
+ CT_CHECKBOX(Id_KeepOnScreenCheckBox, ID_STR_KEEPONSCREEN,
+ 350, 216, 118, 9,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0),
+ CT_CHECKBOX(Id_SavePositionCheckBox, ID_STR_SAVEPOSITION,
+ 350, 229, 118, 9,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0),
+ CT_CHECKBOX(Id_SnapToEdgesCheckBox, ID_STR_SNAPTOEDGES,
+ 350, 242, 118, 9,
+ WS_VISIBLE | WS_TABSTOP | WS_DISABLED, 0)