summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/NotesAndReminders/res/resource.rc4
-rw-r--r--plugins/NotesAndReminders/src/miscutils.cpp26
-rw-r--r--plugins/NotesAndReminders/src/miscutils.h5
-rw-r--r--plugins/NotesAndReminders/src/notes.cpp99
-rw-r--r--plugins/NotesAndReminders/src/options.cpp19
-rw-r--r--plugins/NotesAndReminders/src/reminders.cpp215
-rw-r--r--plugins/NotesAndReminders/src/resource.h1
-rw-r--r--plugins/NotesAndReminders/src/stdafx.h5
8 files changed, 122 insertions, 252 deletions
diff --git a/plugins/NotesAndReminders/res/resource.rc b/plugins/NotesAndReminders/res/resource.rc
index d1cddd06ef..39ea977bf9 100644
--- a/plugins/NotesAndReminders/res/resource.rc
+++ b/plugins/NotesAndReminders/res/resource.rc
@@ -111,7 +111,7 @@ BEGIN
COMBOBOX IDC_COMBO_SOUND,126,182,90,81,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "",IDC_BTN_PLAYSOUND,220,183,13,12,BS_ICON
DEFPUSHBUTTON "&Add Reminder",IDC_ADDREMINDER,158,6,76,14
- PUSHBUTTON "&Close",IDC_CLOSE,158,23,76,14
+ PUSHBUTTON "&Close",IDCANCEL,158,23,76,14
PUSHBUTTON "&View Reminders",IDC_VIEWREMINDERS,158,40,76,14
LTEXT "reftime",IDC_REFTIME,0,191,22,8,NOT WS_VISIBLE | NOT WS_GROUP
END
@@ -146,7 +146,7 @@ BEGIN
CONTROL "List1",IDC_LISTREMINDERS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,3,4,251,146
EDITTEXT IDC_REMINDERDATA,3,153,251,69,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
PUSHBUTTON "Add New",IDC_ADDNEWREMINDER,151,227,50,14
- DEFPUSHBUTTON "&Close",IDC_CLOSE,203,227,50,14
+ DEFPUSHBUTTON "&Close",IDCANCEL,203,227,50,14
END
diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp
index 3b86ad8207..676bfbbed9 100644
--- a/plugins/NotesAndReminders/src/miscutils.cpp
+++ b/plugins/NotesAndReminders/src/miscutils.cpp
@@ -2,7 +2,7 @@
void FreeSettingBlob(WORD pSize, void *pbBlob)
{
- DBVARIANT dbv = { 0 };
+ DBVARIANT dbv = {};
dbv.type = DBVT_BLOB;
dbv.cpbVal = pSize;
dbv.pbVal = (BYTE*)pbBlob;
@@ -23,30 +23,6 @@ void ReadSettingBlob(MCONTACT hContact, char *ModuleName, char *SettingName, WOR
}
}
-void WriteSettingIntArray(MCONTACT hContact, char *ModuleName, char *SettingName, const int *Value, int Size)
-{
- db_set_blob(hContact, ModuleName, SettingName, (void*)Value, sizeof(int)*Size);
-}
-
-bool ReadSettingIntArray(MCONTACT hContact, char *ModuleName, char *SettingName, int *Value, int Size)
-{
- WORD sz = 4096;
- int *pData;
- ReadSettingBlob(hContact, ModuleName, SettingName, &sz, (void**)&pData);
- if (!pData)
- return false;
-
- bool bResult = false;
-
- if (sz == sizeof(int)*Size) {
- memcpy(Value, pData, sizeof(int)*Size);
- bResult = true;
- }
-
- FreeSettingBlob(sz, pData);
- return bResult;
-}
-
/////////////////////////////////////////////////////////////////////
// Email/SMS and WinSock functions
diff --git a/plugins/NotesAndReminders/src/miscutils.h b/plugins/NotesAndReminders/src/miscutils.h
index 0d9dace18d..e291a1d792 100644
--- a/plugins/NotesAndReminders/src/miscutils.h
+++ b/plugins/NotesAndReminders/src/miscutils.h
@@ -4,11 +4,6 @@ void ReadSettingBlob(MCONTACT hContact, char *ModuleName,
char *SettingName, WORD *pSize, void **pbBlob);
void FreeSettingBlob(WORD pSize,void * pbBlob);
-void WriteSettingIntArray(MCONTACT hContact,char *ModuleName,
- char *SettingName,const int *Value, int Size);
-bool ReadSettingIntArray(MCONTACT hContact,char *ModuleName,
- char *SettingName,int *Value, int Size);
-
static void __inline SAFE_FREE(void** p)
{
if (*p) {
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp
index 1dc59409b5..4ff5c393c9 100644
--- a/plugins/NotesAndReminders/src/notes.cpp
+++ b/plugins/NotesAndReminders/src/notes.cpp
@@ -43,7 +43,7 @@
#define IDM_COLORPRESET_BG 41000
#define IDM_COLORPRESET_FG 41100
-static bool ListNotesVisible = FALSE;
+static bool ListNotesVisible = false;
static HWND LV;
struct ColorPreset
@@ -112,8 +112,7 @@ struct STICKYNOTE : public MZeroedObject
static OBJLIST<STICKYNOTE> g_arStickies(1, PtrKeySortT);
void GetTriggerTimeString(const ULARGE_INTEGER *When, wchar_t *s, size_t strSize, BOOL bUtc);
-void OnListResize(HWND Dialog);
-void UpdateGeomFromWnd(HWND Dialog, int *geom, int *colgeom, int nCols);
+void OnListResize(HWND hwndDlg);
void FileTimeToTzLocalST(const FILETIME *lpUtc, SYSTEMTIME *tmLocal);
COLORREF GetCaptionColor(COLORREF bodyClr)
@@ -217,7 +216,7 @@ void CloseNotesList()
{
if (ListNotesVisible) {
DestroyWindow(LV);
- ListNotesVisible = FALSE;
+ ListNotesVisible = false;
}
}
@@ -1629,16 +1628,11 @@ static BOOL DoListContextMenu(HWND AhWnd, WPARAM wParam, LPARAM lParam, STICKYNO
}
-static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcViewNotes(HWND hwndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message) {
case WM_SIZE:
- OnListResize(Dialog);
- UpdateGeomFromWnd(Dialog, g_notesListGeom, nullptr, 0);
- break;
-
- case WM_MOVE:
- UpdateGeomFromWnd(Dialog, g_notesListGeom, nullptr, 0);
+ OnListResize(hwndDlg);
break;
case WM_GETMINMAXINFO:
@@ -1650,84 +1644,73 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
return 0;
case WM_RELOAD:
- SetDlgItemTextA(Dialog, IDC_REMINDERDATA, "");
- InitListView(GetDlgItem(Dialog, IDC_LISTREMINDERS));
+ SetDlgItemTextA(hwndDlg, IDC_REMINDERDATA, "");
+ InitListView(GetDlgItem(hwndDlg, IDC_LISTREMINDERS));
return TRUE;
case WM_CONTEXTMENU:
{
STICKYNOTE *pNote = nullptr;
- HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
+ HWND H = GetDlgItem(hwndDlg, IDC_LISTREMINDERS);
if (ListView_GetSelectedCount(H)) {
int i = ListView_GetSelectionMark(H);
if (i != -1)
pNote = &g_arStickies[i];
}
- if (DoListContextMenu(Dialog, wParam, lParam, pNote))
+ if (DoListContextMenu(hwndDlg, wParam, lParam, pNote))
return TRUE;
}
break;
case WM_INITDIALOG:
- Window_SetIcon_IcoLib(Dialog, iconList[13].hIcolib);
+ Window_SetIcon_IcoLib(hwndDlg, iconList[13].hIcolib);
- SetWindowText(Dialog, LPGENW("Notes"));
+ SetWindowText(hwndDlg, LPGENW("Notes"));
- TranslateDialogDefault(Dialog);
+ TranslateDialogDefault(hwndDlg);
- SetDlgItemText(Dialog, IDC_REMINDERDATA, L"");
+ SetDlgItemText(hwndDlg, IDC_REMINDERDATA, L"");
{
- HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
+ HWND H = GetDlgItem(hwndDlg, IDC_LISTREMINDERS);
LV_COLUMN lvCol;
lvCol.mask = LVCF_TEXT | LVCF_WIDTH;
lvCol.pszText = TranslateT("Note text");
- lvCol.cx = g_notesListColGeom[3];
+ lvCol.cx = 150;
ListView_InsertColumn(H, 0, &lvCol);
- lvCol.mask = LVCF_TEXT | LVCF_WIDTH;
lvCol.pszText = TranslateT("Top");
- lvCol.cx = g_notesListColGeom[2];
+ lvCol.cx = 20;
ListView_InsertColumn(H, 0, &lvCol);
- lvCol.mask = LVCF_TEXT | LVCF_WIDTH;
lvCol.pszText = TranslateT("Visible");
- lvCol.cx = g_notesListColGeom[1];
+ lvCol.cx = 20;
ListView_InsertColumn(H, 0, &lvCol);
- lvCol.mask = LVCF_TEXT | LVCF_WIDTH;
lvCol.pszText = TranslateT("Date/Title");
- lvCol.cx = g_notesListColGeom[0];
+ lvCol.cx = 165;
ListView_InsertColumn(H, 0, &lvCol);
InitListView(H);
SetWindowLongPtr(GetDlgItem(H, 0), GWL_ID, IDC_LISTREMINDERS_HEADER);
- LV = Dialog;
-
- if (g_notesListGeom[1] && g_notesListGeom[2]) {
- WINDOWPLACEMENT wp;
- wp.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(Dialog, &wp);
- wp.rcNormalPosition.left = g_notesListGeom[0];
- wp.rcNormalPosition.top = g_notesListGeom[1];
- wp.rcNormalPosition.right = g_notesListGeom[2] + g_notesListGeom[0];
- wp.rcNormalPosition.bottom = g_notesListGeom[3] + g_notesListGeom[1];
- SetWindowPlacement(Dialog, &wp);
- }
+ LV = hwndDlg;
+
+ Utils_RestoreWindowPosition(hwndDlg, 0, MODULENAME, "ListNotes");
}
return TRUE;
case WM_CLOSE:
- DestroyWindow(Dialog);
- ListNotesVisible = FALSE;
+ DestroyWindow(hwndDlg);
+ ListNotesVisible = false;
return TRUE;
case WM_DESTROY:
- ListNotesVisible = FALSE;
- Window_FreeIcon_IcoLib(Dialog);
+ ListNotesVisible = false;
+ Utils_SaveWindowPosition(hwndDlg, 0, MODULENAME, "ListNotes");
+ Window_FreeIcon_IcoLib(hwndDlg);
return TRUE;
case WM_NOTIFY:
@@ -1735,7 +1718,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
LPNMLISTVIEW NM = (LPNMLISTVIEW)lParam;
switch (NM->hdr.code) {
case LVN_ITEMCHANGED:
- SetDlgItemTextA(Dialog, IDC_REMINDERDATA, g_arStickies[NM->iItem].data);
+ SetDlgItemTextA(hwndDlg, IDC_REMINDERDATA, g_arStickies[NM->iItem].data);
break;
case NM_DBLCLK:
@@ -1747,21 +1730,13 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
break;
}
}
- else if (wParam == IDC_LISTREMINDERS_HEADER) {
- LPNMHEADER NM = (LPNMHEADER)lParam;
- switch (NM->hdr.code) {
- case HDN_ENDTRACK:
- UpdateGeomFromWnd(Dialog, nullptr, g_notesListColGeom, _countof(g_notesListColGeom));
- break;
- }
- }
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case ID_CONTEXTMENUNOTELISTVIEW_EDITNOTE:
{
- HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
+ HWND H = GetDlgItem(hwndDlg, IDC_LISTREMINDERS);
if (ListView_GetSelectedCount(H)) {
int i = ListView_GetSelectionMark(H);
if (i != -1) {
@@ -1773,7 +1748,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
case ID_CONTEXTMENUNOTELISTVIEW_TOGGLEVISIBILITY:
{
- HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
+ HWND H = GetDlgItem(hwndDlg, IDC_LISTREMINDERS);
if (ListView_GetSelectedCount(H)) {
int i = ListView_GetSelectionMark(H);
if (i != -1) {
@@ -1788,7 +1763,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
case IDM_TOGGLEONTOP:
{
- HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
+ HWND H = GetDlgItem(hwndDlg, IDC_LISTREMINDERS);
if (ListView_GetSelectedCount(H)) {
int i = ListView_GetSelectionMark(H);
if (i != -1) {
@@ -1802,9 +1777,9 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
}
return TRUE;
- case IDC_CLOSE:
- DestroyWindow(Dialog);
- ListNotesVisible = FALSE;
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ ListNotesVisible = false;
return TRUE;
case ID_CONTEXTMENUNOTEPOPUP_NEWNOTE:
@@ -1818,11 +1793,11 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
case IDM_REMOVENOTE:
{
- HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
+ HWND H = GetDlgItem(hwndDlg, IDC_LISTREMINDERS);
if (ListView_GetSelectedCount(H)) {
int i = ListView_GetSelectionMark(H);
if (i != -1)
- OnDeleteNote(Dialog, &g_arStickies[i]);
+ OnDeleteNote(hwndDlg, &g_arStickies[i]);
}
}
return TRUE;
@@ -1841,7 +1816,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
/////////////////////////////////////////////////////////////////////
-// Notes List Dialog (uses same dialog template as reminder list)
+// Notes List hwndDlg (uses same dialog template as reminder list)
INT_PTR PluginMenuCommandAddNew(WPARAM, LPARAM)
{
@@ -1859,7 +1834,7 @@ INT_PTR PluginMenuCommandViewNotes(WPARAM, LPARAM)
{
if (!ListNotesVisible) {
CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_LISTREMINDERS), nullptr, DlgProcViewNotes);
- ListNotesVisible = TRUE;
+ ListNotesVisible = true;
}
else BringWindowToTop(LV);
return 0;
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp
index 3c6805cabe..2e9f896030 100644
--- a/plugins/NotesAndReminders/src/options.cpp
+++ b/plugins/NotesAndReminders/src/options.cpp
@@ -16,11 +16,6 @@ char *g_RemindSMS = nullptr;
char *g_lpszAltBrowser = nullptr;
-int g_reminderListGeom[4] = {0};
-int g_reminderListColGeom[2] = {150, 205};
-int g_notesListGeom[4] = {0};
-int g_notesListColGeom[4] = {150, 20, 20, 165};
-
#define NRCDEFAULT_BODYCLR RGB(255,255,0)
struct DateFormat
@@ -371,11 +366,6 @@ void InitSettings(void)
g_NoteTitleDate = g_plugin.getDword("NoteTitleDate", 1);
g_NoteTitleTime = g_plugin.getDword("NoteTitleTime", 1);
- ReadSettingIntArray(0, MODULENAME, "ReminderListGeom", g_reminderListGeom, _countof(g_reminderListGeom));
- ReadSettingIntArray(0, MODULENAME, "ReminderListColGeom", g_reminderListColGeom, _countof(g_reminderListColGeom));
- ReadSettingIntArray(0, MODULENAME, "NotesListGeom", g_notesListGeom, _countof(g_notesListGeom));
- ReadSettingIntArray(0, MODULENAME, "NotesListColGeom", g_notesListColGeom, _countof(g_notesListColGeom));
-
BodyColor = g_plugin.getDword(colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
InitFonts();
@@ -390,15 +380,6 @@ void InitSettings(void)
void TermSettings(void)
{
- if (g_reminderListGeom[2] > 0 && g_reminderListGeom[3] > 0) {
- WriteSettingIntArray(0, MODULENAME, "ReminderListGeom", g_reminderListGeom, _countof(g_reminderListGeom));
- WriteSettingIntArray(0, MODULENAME, "ReminderListColGeom", g_reminderListColGeom, _countof(g_reminderListColGeom));
- }
- if (g_notesListGeom[2] > 0 && g_notesListGeom[3] > 0) {
- WriteSettingIntArray(0, MODULENAME, "NotesListGeom", g_notesListGeom, _countof(g_notesListGeom));
- WriteSettingIntArray(0, MODULENAME, "NotesListColGeom", g_notesListColGeom, _countof(g_notesListColGeom));
- }
-
if (g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
g_lpszAltBrowser = nullptr;
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp
index 8a4012d990..e8509dc00b 100644
--- a/plugins/NotesAndReminders/src/reminders.cpp
+++ b/plugins/NotesAndReminders/src/reminders.cpp
@@ -706,17 +706,17 @@ static BOOL ParseTime(const wchar_t *s, int *hout, int *mout, BOOL bTimeOffset,
}
// returns TRUE if combo box list displays time offsets ("23:34 (5 Minutes)" etc.)
-__inline static BOOL IsRelativeCombo(HWND hwndDlg, UINT nIDTime)
+__inline static BOOL IsRelativeCombo(CCtrlCombo &pCombo)
{
- return (((int)SendDlgItemMessage(hwndDlg, nIDTime, CB_GETITEMDATA, 0, 0)) >= 0);
+ return (pCombo.GetItemData(0) >= 0);
}
-static void PopulateTimeCombo(HWND hwndDlg, UINT nIDTime, BOOL bRelative, const SYSTEMTIME *tmUtc)
+static void PopulateTimeCombo(CCtrlCombo &pCombo, bool bRelative, const SYSTEMTIME *tmUtc)
{
// NOTE: may seem like a bit excessive time converstion and handling, but this is done in order
// to gracefully handle crossing daylight saving boundaries
- SendDlgItemMessage(hwndDlg, nIDTime, CB_RESETCONTENT, 0, 0);
+ pCombo.ResetContent();
SYSTEMTIME tm2;
ULARGE_INTEGER li;
@@ -724,7 +724,6 @@ static void PopulateTimeCombo(HWND hwndDlg, UINT nIDTime, BOOL bRelative, const
const ULONGLONG MinutesToFileTime = (ULONGLONG)60 * FILETIME_TICKS_PER_SEC;
if (!bRelative) {
-
// ensure that we start on midnight local time
SystemTimeToTzSpecificLocalTime(nullptr, (SYSTEMTIME*)tmUtc, &tm2);
tm2.wHour = 0;
@@ -741,10 +740,10 @@ static void PopulateTimeCombo(HWND hwndDlg, UINT nIDTime, BOOL bRelative, const
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
mir_snwprintf(s, L"%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute);
- int n = SendDlgItemMessage(hwndDlg, nIDTime, CB_ADDSTRING, 0, (LPARAM)s);
+
// item data contains time offset from midnight in seconds (bit 31 is set to flag that
// combo box items are absolute times and not relative times like below
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETITEMDATA, n, (LPARAM)((ULONG)((h * 60 + m) * 60) | 0x80000000));
+ pCombo.AddString(s, ((h * 60 + m) * 60) | 0x80000000);
li.QuadPart += (ULONGLONG)30 * MinutesToFileTime;
@@ -765,36 +764,31 @@ static void PopulateTimeCombo(HWND hwndDlg, UINT nIDTime, BOOL bRelative, const
WORD wCurHour = tm2.wHour;
WORD wCurMinute = tm2.wMinute;
mir_snwprintf(s, L"%02d:%02d", (UINT)tm2.wHour, (UINT)tm2.wMinute);
- int n = SendDlgItemMessage(hwndDlg, nIDTime, CB_ADDSTRING, 0, (LPARAM)s);
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart - ref) / FILETIME_TICKS_PER_SEC));
+ pCombo.AddString(s, (li.QuadPart - ref) / FILETIME_TICKS_PER_SEC);
// 5 minutes
li.QuadPart += (ULONGLONG)5 * MinutesToFileTime;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
mir_snwprintf(s, L"%02d:%02d (5 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, TranslateT("Minutes"));
- n = SendDlgItemMessage(hwndDlg, nIDTime, CB_ADDSTRING, 0, (LPARAM)s);
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart - ref) / FILETIME_TICKS_PER_SEC));
+ pCombo.AddString(s, (li.QuadPart - ref) / FILETIME_TICKS_PER_SEC);
// 10 minutes
li.QuadPart += (ULONGLONG)5 * MinutesToFileTime;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
mir_snwprintf(s, L"%02d:%02d (10 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, TranslateT("Minutes"));
- n = SendDlgItemMessage(hwndDlg, nIDTime, CB_ADDSTRING, 0, (LPARAM)s);
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart - ref) / FILETIME_TICKS_PER_SEC));
+ pCombo.AddString(s, (li.QuadPart - ref) / FILETIME_TICKS_PER_SEC);
// 15 minutes
li.QuadPart += (ULONGLONG)5 * MinutesToFileTime;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
mir_snwprintf(s, L"%02d:%02d (15 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, TranslateT("Minutes"));
- n = SendDlgItemMessage(hwndDlg, nIDTime, CB_ADDSTRING, 0, (LPARAM)s);
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart - ref) / FILETIME_TICKS_PER_SEC));
+ pCombo.AddString(s, (li.QuadPart - ref) / FILETIME_TICKS_PER_SEC);
// 30 minutes
li.QuadPart += (ULONGLONG)15 * MinutesToFileTime;
FileTimeToTzLocalST((FILETIME*)&li, &tm2);
mir_snwprintf(s, L"%02d:%02d (30 %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, TranslateT("Minutes"));
- n = SendDlgItemMessage(hwndDlg, nIDTime, CB_ADDSTRING, 0, (LPARAM)s);
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETITEMDATA, n, (LPARAM)((li.QuadPart - ref) / FILETIME_TICKS_PER_SEC));
+ pCombo.AddString(s, (li.QuadPart - ref) / FILETIME_TICKS_PER_SEC);
// round +1h time to nearest even or half hour
li.QuadPart += (ULONGLONG)30 * MinutesToFileTime;
@@ -825,8 +819,7 @@ static void PopulateTimeCombo(HWND hwndDlg, UINT nIDTime, BOOL bRelative, const
mir_snwprintf(s, L"%02d:%02d (%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt, TranslateT("Minutes"));
else
mir_snwprintf(s, L"%02d:%02d (%d.%d %s)", (UINT)tm2.wHour, (UINT)tm2.wMinute, dt / 60, ((dt % 60) * 10) / 60, TranslateT("Hours"));
- n = SendDlgItemMessage(hwndDlg, nIDTime, CB_ADDSTRING, 0, (LPARAM)s);
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETITEMDATA, n, dt * 60);
+ pCombo.AddString(s, dt * 60);
li.QuadPart += (ULONGLONG)30 * MinutesToFileTime;
}
@@ -834,19 +827,17 @@ static void PopulateTimeCombo(HWND hwndDlg, UINT nIDTime, BOOL bRelative, const
// returns non-zero if specified time was inside "missing" hour of daylight saving
// IMPORTANT: triggerRelUtcOut is only initialized if IsRelativeCombo() is TRUE and return value is 0
-static int ReformatTimeInput(HWND hwndDlg, UINT nIDTime, UINT nIDRefTime, int h, int m, const SYSTEMTIME *pDateLocal, ULARGE_INTEGER *triggerRelUtcOut = nullptr)
+static int ReformatTimeInput(CCtrlCombo &pCombo, CCtrlBase &pRef, int h, int m, const SYSTEMTIME *pDateLocal, ULARGE_INTEGER *triggerRelUtcOut = nullptr)
{
- int n;
- UINT dt;
const ULONGLONG MinutesToFileTime = (ULONGLONG)60 * FILETIME_TICKS_PER_SEC;
if (h < 0) {
// time value is an offset ('m' holds the offset in minutes)
- if (IsRelativeCombo(hwndDlg, nIDTime)) {
+ if (IsRelativeCombo(pCombo)) {
// get reference time (UTC) from hidden control
wchar_t buf[64];
- GetDlgItemText(hwndDlg, nIDRefTime, buf, 30);
+ pRef.GetText(buf, _countof(buf));
ULONGLONG ref;
ULARGE_INTEGER li;
@@ -866,26 +857,23 @@ static int ReformatTimeInput(HWND hwndDlg, UINT nIDTime, UINT nIDRefTime, int h,
if (triggerRelUtcOut)
*triggerRelUtcOut = li;
- dt = (UINT)((li.QuadPart / MinutesToFileTime) - (ref / MinutesToFileTime));
-
+ UINT dt = (UINT)((li.QuadPart / MinutesToFileTime) - (ref / MinutesToFileTime));
if (dt < 60)
mir_snwprintf(buf, L"%02d:%02d (%d %s)", h, m, dt, TranslateT("Minutes"));
else
mir_snwprintf(buf, L"%02d:%02d (%d.%d %s)", h, m, dt / 60, ((dt % 60) * 10) / 60, TranslateT("Hours"));
// search for preset
- n = SendDlgItemMessage(hwndDlg, nIDTime, CB_FINDSTRING, (WPARAM)-1, (LPARAM)buf);
- if (n != CB_ERR) {
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETCURSEL, n, 0);
+ int n = pCombo.FindString(buf);
+ if (n != -1) {
+ pCombo.SetCurSel(n);
return 0;
}
- SetDlgItemText(hwndDlg, nIDTime, buf);
- }
- else {
- // should never happen
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETCURSEL, 0, 0);
+ pCombo.SetText(buf);
}
+ else // should never happen
+ pCombo.SetCurSel(0);
return 0;
}
@@ -894,19 +882,19 @@ static int ReformatTimeInput(HWND hwndDlg, UINT nIDTime, UINT nIDRefTime, int h,
mir_snwprintf(buf, L"%02d:%02d", h, m);
// search for preset first
- n = SendDlgItemMessage(hwndDlg, nIDTime, CB_FINDSTRING, (WPARAM)-1, (LPARAM)buf);
- if (n != CB_ERR) {
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETCURSEL, n, 0);
+ int n = pCombo.FindString(buf);
+ if (n != -1) {
+ pCombo.SetCurSel(n);
return 0;
}
- if (IsRelativeCombo(hwndDlg, nIDTime)) {
+ if (IsRelativeCombo(pCombo)) {
// date format is a time offset ("24:43 (5 Minutes)" etc.)
SYSTEMTIME tmTriggerLocal, tmTriggerLocal2;
// get reference time (UTC) from hidden control
- GetDlgItemText(hwndDlg, nIDRefTime, buf, 30);
+ pRef.GetText(buf, _countof(buf));
ULONGLONG ref = _wcstoui64(buf, nullptr, 16);
SYSTEMTIME tmRefLocal;
@@ -955,9 +943,11 @@ static int ReformatTimeInput(HWND hwndDlg, UINT nIDTime, UINT nIDRefTime, int h,
if ((tmTriggerLocal2.wHour * 60 + tmTriggerLocal2.wMinute) < (tmTriggerLocal.wHour * 60 + tmTriggerLocal.wMinute)) {
// special case detected, fall back to current time so at least the reminder won't be missed
// due to ending up at an undesired time (this way the user immediately notices something was wrong)
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETCURSEL, 0, 0);
+ pCombo.SetCurSel(0);
invalid_dst:
- MessageBox(hwndDlg, TranslateT("The specified time is invalid due to begin of daylight saving (summer time)."), _A2W(SECTIONNAME), MB_OK | MB_ICONWARNING);
+ MessageBox(pCombo.GetParent()->GetHwnd(),
+ TranslateT("The specified time is invalid due to begin of daylight saving (summer time)."),
+ _A2W(SECTIONNAME), MB_OK | MB_ICONWARNING);
return 1;
}
@@ -965,8 +955,7 @@ output_result:
if (triggerRelUtcOut)
*triggerRelUtcOut = li;
- dt = (UINT)((li.QuadPart / MinutesToFileTime) - (ref / MinutesToFileTime));
-
+ UINT dt = (UINT)((li.QuadPart / MinutesToFileTime) - (ref / MinutesToFileTime));
if (dt < 60)
mir_snwprintf(buf, L"%02d:%02d (%d %s)", h, m, dt, TranslateT("Minutes"));
else
@@ -988,39 +977,39 @@ output_result:
mir_snwprintf(buf, L"%02d:%02d", Date.wHour, Date.wMinute);
// search for preset again
- n = SendDlgItemMessage(hwndDlg, nIDTime, CB_FINDSTRING, -1, (LPARAM)buf);
- if (n != CB_ERR) {
- SendDlgItemMessage(hwndDlg, nIDTime, CB_SETCURSEL, n, 0);
+ n = pCombo.FindString(buf);
+ if (n != -1) {
+ pCombo.SetCurSel(n);
goto invalid_dst;
}
- SetDlgItemText(hwndDlg, nIDTime, buf);
+ pRef.SetText(buf);
goto invalid_dst;
}
}
- SetDlgItemText(hwndDlg, nIDTime, buf);
+ pCombo.SetText(buf);
return 0;
}
// in: pDate contains the desired trigger date in LOCAL time
// out: pDate contains the resulting trigger time and date in UTC
-static bool GetTriggerTime(HWND hwndDlg, UINT nIDTime, UINT nIDRefTime, SYSTEMTIME *pDate)
+static bool GetTriggerTime(CCtrlCombo &pCombo, CCtrlBase &pRef, SYSTEMTIME *pDate)
{
// get reference (UTC) time from hidden control
wchar_t buf[32];
- GetDlgItemText(hwndDlg, nIDRefTime, buf, 30);
+ pRef.GetText(buf, _countof(buf));
ULARGE_INTEGER li;
li.QuadPart = _wcstoui64(buf, nullptr, 16);
- int n = SendDlgItemMessage(hwndDlg, nIDTime, CB_GETCURSEL, 0, 0);
- if (n != CB_ERR) {
+ int n = pCombo.GetCurSel();
+ if (n != -1) {
// use preset value
preset_value:;
- if (IsRelativeCombo(hwndDlg, nIDTime)) {
+ if (IsRelativeCombo(pCombo)) {
// time offset from ref time ("24:43 (5 Minutes)" etc.)
- UINT nDeltaSeconds = (UINT)SendDlgItemMessage(hwndDlg, nIDTime, CB_GETITEMDATA, n, 0);
+ UINT nDeltaSeconds = pCombo.GetItemData(n);
li.QuadPart += (ULONGLONG)nDeltaSeconds * FILETIME_TICKS_PER_SEC;
FileTimeToSystemTime((FILETIME*)&li, pDate);
@@ -1034,8 +1023,7 @@ preset_value:;
}
else {
// absolute time (offset from midnight on pDate)
-
- UINT nDeltaSeconds = (UINT)((ULONG)SendDlgItemMessage(hwndDlg, nIDTime, CB_GETITEMDATA, n, 0) & ~0x80000000);
+ UINT nDeltaSeconds = pCombo.GetItemData(n) & ~0x80000000;
pDate->wHour = 0;
pDate->wMinute = 0;
pDate->wSecond = 0;
@@ -1049,33 +1037,33 @@ preset_value:;
}
// user entered a custom value
- GetDlgItemText(hwndDlg, nIDTime, buf, 30);
+ pCombo.GetText(buf, _countof(buf));
int h, m;
- if (!ParseTime(buf, &h, &m, FALSE, IsRelativeCombo(hwndDlg, nIDTime))) {
- MessageBox(hwndDlg, TranslateT("The specified time is invalid."), _A2W(SECTIONNAME), MB_OK | MB_ICONWARNING);
+ if (!ParseTime(buf, &h, &m, FALSE, IsRelativeCombo(pCombo))) {
+ MessageBox(pCombo.GetParent()->GetHwnd(), TranslateT("The specified time is invalid."), _A2W(SECTIONNAME), MB_OK | MB_ICONWARNING);
return false;
}
- if (IsRelativeCombo(hwndDlg, nIDTime)) {
+ if (IsRelativeCombo(pCombo)) {
// date has not been changed, the specified time is a time between reftime and reftime+24h
ULARGE_INTEGER li2;
- if (ReformatTimeInput(hwndDlg, nIDTime, nIDRefTime, h, m, pDate, &li2))
+ if (ReformatTimeInput(pCombo, pRef, h, m, pDate, &li2))
return FALSE;
// check if reformatted value is a preset
- if ((n = SendDlgItemMessage(hwndDlg, nIDTime, CB_GETCURSEL, 0, 0)) != CB_ERR)
+ if ((n = pCombo.GetCurSel()) != -1)
goto preset_value;
FileTimeToSystemTime((FILETIME*)&li2, pDate);
return true;
}
- if (ReformatTimeInput(hwndDlg, nIDTime, nIDRefTime, h, m, pDate, nullptr))
+ if (ReformatTimeInput(pCombo, pRef, h, m, pDate, nullptr))
return false;
// check if reformatted value is a preset
- if ((n = SendDlgItemMessage(hwndDlg, nIDTime, CB_GETCURSEL, 0, 0)) != CB_ERR)
+ if ((n = pCombo.GetCurSel()) != -1)
goto preset_value;
// absolute time (on pDate)
@@ -1089,20 +1077,20 @@ preset_value:;
return true;
}
-static void OnDateChanged(HWND hwndDlg, UINT nDateID, UINT nTimeID, UINT nRefTimeID)
+static void OnDateChanged(CCtrlDate &pDate, CCtrlCombo &pTime, CCtrlBase &refTime)
{
// repopulate time combo list with regular times (not offsets like "23:32 (5 minutes)" etc.)
wchar_t s[32];
- GetDlgItemText(hwndDlg, nTimeID, s, _countof(s));
+ pTime.GetText(s, _countof(s));
int h = -1, m;
ParseTime(s, &h, &m, FALSE, FALSE);
SYSTEMTIME Date, DateUtc;
- SendDlgItemMessage(hwndDlg, nDateID, DTM_GETSYSTEMTIME, 0, (LPARAM)&Date);
+ pDate.GetTime(&Date);
TzSpecificLocalTimeToSystemTime(nullptr, &Date, &DateUtc);
- PopulateTimeCombo(hwndDlg, nTimeID, FALSE, &DateUtc);
+ PopulateTimeCombo(pTime, false, &DateUtc);
if (h < 0) {
// parsing failed, default to current time
@@ -1112,7 +1100,7 @@ static void OnDateChanged(HWND hwndDlg, UINT nDateID, UINT nTimeID, UINT nRefTim
m = (UINT)tm.wMinute;
}
- ReformatTimeInput(hwndDlg, nTimeID, nRefTimeID, h, m, &Date);
+ ReformatTimeInput(pTime, refTime, h, m, &Date);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1158,6 +1146,7 @@ class CReminderNotifyDlg : public CDlgBase
cmbRemindAgainIn.AddString(s, 7 * 24 * 60);
}
+ CCtrlBase refTime;
CCtrlDate dateAgain;
CCtrlCheck chkAfter, chkOnDate;
CCtrlCombo cmbTimeAgain, cmbRemindAgainIn;
@@ -1167,6 +1156,7 @@ public:
CReminderNotifyDlg(REMINDERDATA *pReminder) :
CDlgBase(g_plugin, IDD_NOTIFYREMINDER),
m_pReminder(pReminder),
+ refTime(this, IDC_REFTIME),
btnNone(this, IDC_NONE),
btnDismiss(this, IDC_DISMISS),
btnRemindAgain(this, IDC_REMINDAGAIN),
@@ -1201,7 +1191,7 @@ public:
// which could potentially mess up things otherwise)
wchar_t s[32];
mir_snwprintf(s, L"%I64x", li.QuadPart);
- SetDlgItemText(m_hwnd, IDC_REFTIME, s);
+ refTime.SetText(s);
BringWindowToTop(m_hwnd);
@@ -1225,11 +1215,10 @@ public:
SendDlgItemMessage(m_hwnd, IDC_REMDATA, EM_LIMITTEXT, MAX_REMINDER_LEN, 0);
- PopulateTimeCombo(m_hwnd, IDC_TIMEAGAIN, TRUE, &tm);
-
- FileTimeToTzLocalST((FILETIME*)&li, &tm);
+ PopulateTimeCombo(cmbTimeAgain, true, &tm);
// make sure date picker uses reference time
+ FileTimeToTzLocalST((FILETIME*)&li, &tm);
dateAgain.SetTime(&tm);
InitDatePicker(m_hwnd, IDC_DATEAGAIN);
@@ -1274,7 +1263,7 @@ public:
void onChange_Date(CCtrlDate*)
{
- OnDateChanged(m_hwnd, IDC_DATEAGAIN, IDC_TIMEAGAIN, IDC_REFTIME);
+ OnDateChanged(dateAgain, cmbTimeAgain, refTime);
}
void onKillFocus_TimeAgain(CCtrlCombo*)
@@ -1285,10 +1274,10 @@ public:
cmbTimeAgain.GetText(buf, _countof(buf));
int h, m;
- if (ParseTime(buf, &h, &m, FALSE, IsRelativeCombo(m_hwnd, IDC_TIMEAGAIN))) {
+ if (ParseTime(buf, &h, &m, FALSE, IsRelativeCombo(cmbTimeAgain))) {
SYSTEMTIME Date;
dateAgain.GetTime(&Date);
- ReformatTimeInput(m_hwnd, IDC_TIMEAGAIN, IDC_REFTIME, h, m, &Date);
+ ReformatTimeInput(cmbTimeAgain, refTime, h, m, &Date);
}
else cmbTimeAgain.SetCurSel(0);
}
@@ -1376,7 +1365,7 @@ public:
else if (chkOnDate.GetState()) {
SYSTEMTIME Date;
dateAgain.GetTime(&Date);
- if (!GetTriggerTime(m_hwnd, IDC_TIMEAGAIN, IDC_REFTIME, &Date))
+ if (!GetTriggerTime(cmbTimeAgain, refTime, &Date))
return;
SystemTimeToFileTime(&Date, (FILETIME*)&m_pReminder->When);
@@ -1445,6 +1434,7 @@ class CReminderFormDlg : public CDlgBase
{
REMINDERDATA *m_pReminder;
+ CCtrlBase refTime;
CCtrlDate date;
CCtrlCheck chkRepeat;
CCtrlCombo cmbSound, cmbRepeat, cmbTime;
@@ -1458,6 +1448,7 @@ public:
btnAdd(this, IDC_ADDREMINDER),
btnView(this, IDC_VIEWREMINDERS),
btnPlaySound(this, IDC_BTN_PLAYSOUND),
+ refTime(this, IDC_REFTIME),
chkRepeat(this, IDC_CHECK_REPEAT),
cmbTime(this, IDC_COMBOREMINDERTIME),
cmbSound(this, IDC_COMBO_SOUND),
@@ -1497,9 +1488,9 @@ public:
// which could potentially mess up things otherwise)
wchar_t s[64];
mir_snwprintf(s, L"%I64x", li.QuadPart);
- SetDlgItemText(m_hwnd, IDC_REFTIME, s);
+ refTime.SetText(s);
- PopulateTimeCombo(m_hwnd, IDC_COMBOREMINDERTIME, m_pReminder == nullptr, &tm);
+ PopulateTimeCombo(cmbTime, m_pReminder == nullptr, &tm);
// make sure date picker uses reference time
FileTimeToTzLocalST((FILETIME*)&li, &tm);
@@ -1593,11 +1584,11 @@ public:
{
SYSTEMTIME Date;
date.GetTime(&Date);
- if (!GetTriggerTime(m_hwnd, IDC_COMBOREMINDERTIME, IDC_REFTIME, &Date))
+ if (!GetTriggerTime(cmbTime, refTime, &Date))
return;
int RepeatSound = cmbRepeat.GetCurSel();
- if (RepeatSound != CB_ERR)
+ if (RepeatSound != -1)
RepeatSound = cmbRepeat.GetItemData(RepeatSound);
else
RepeatSound = 0;
@@ -1671,7 +1662,7 @@ public:
void onChange_Date(CCtrlDate*)
{
- OnDateChanged(m_hwnd, IDC_DATE, IDC_COMBOREMINDERTIME, IDC_REFTIME);
+ OnDateChanged(date, cmbTime, refTime);
}
void onChange_Time(CCtrlCombo*)
@@ -1683,10 +1674,10 @@ public:
cmbTime.GetText(buf, _countof(buf));
int h, m;
- if (ParseTime(buf, &h, &m, FALSE, IsRelativeCombo(m_hwnd, IDC_COMBOREMINDERTIME))) {
+ if (ParseTime(buf, &h, &m, FALSE, IsRelativeCombo(cmbTime))) {
SYSTEMTIME Date;
date.GetTime(&Date);
- ReformatTimeInput(m_hwnd, IDC_COMBOREMINDERTIME, IDC_REFTIME, h, m, &Date);
+ ReformatTimeInput(cmbTime, refTime, h, m, &Date);
}
else cmbTime.SetCurSel(0);
}
@@ -1757,7 +1748,7 @@ void OnListResize(HWND hwndDlg)
hList = GetDlgItem(hwndDlg, IDC_LISTREMINDERS);
hText = GetDlgItem(hwndDlg, IDC_REMINDERDATA);
hBtnNew = GetDlgItem(hwndDlg, IDC_ADDNEWREMINDER);
- hBtnClose = GetDlgItem(hwndDlg, IDC_CLOSE);
+ hBtnClose = GetDlgItem(hwndDlg, IDCANCEL);
ClientToScreen(hwndDlg, &org);
GetClientRect(hwndDlg, &cr);
@@ -1793,27 +1784,6 @@ void OnListResize(HWND hwndDlg)
RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
}
-void UpdateGeomFromWnd(HWND hwndDlg, int *geom, int *colgeom, int nCols)
-{
- if (geom) {
- WINDOWPLACEMENT wp;
- wp.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(hwndDlg, &wp);
-
- geom[0] = wp.rcNormalPosition.left;
- geom[1] = wp.rcNormalPosition.top;
- geom[2] = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
- geom[3] = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
- }
-
- if (colgeom) {
- HWND H = GetDlgItem(hwndDlg, IDC_LISTREMINDERS);
-
- for (int i = 0; i < nCols; i++)
- colgeom[i] = ListView_GetColumnWidth(H, i);
- }
-}
-
static BOOL DoListContextMenu(HWND AhWnd, WPARAM wParam, LPARAM lParam, REMINDERDATA *pReminder)
{
HWND hwndListView = (HWND)wParam;
@@ -1847,11 +1817,6 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND hwndDlg, UINT Message, WPARAM
switch (Message) {
case WM_SIZE:
OnListResize(hwndDlg);
- UpdateGeomFromWnd(hwndDlg, g_reminderListGeom, nullptr, 0);
- break;
-
- case WM_MOVE:
- UpdateGeomFromWnd(hwndDlg, g_reminderListGeom, nullptr, 0);
break;
case WM_GETMINMAXINFO:
@@ -1891,12 +1856,12 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND hwndDlg, UINT Message, WPARAM
LV_COLUMN lvCol;
lvCol.mask = LVCF_TEXT | LVCF_WIDTH;
lvCol.pszText = TranslateT("Reminder text");
- lvCol.cx = g_reminderListColGeom[1];
+ lvCol.cx = 150;
ListView_InsertColumn(H, 0, &lvCol);
lvCol.mask = LVCF_TEXT | LVCF_WIDTH;
lvCol.pszText = TranslateT("Date of activation");
- lvCol.cx = g_reminderListColGeom[0];
+ lvCol.cx = 205;
ListView_InsertColumn(H, 0, &lvCol);
InitListView(H);
@@ -1904,21 +1869,12 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND hwndDlg, UINT Message, WPARAM
SetWindowLongPtr(GetDlgItem(H, 0), GWL_ID, IDC_LISTREMINDERS_HEADER);
LV = hwndDlg;
- if (g_reminderListGeom[1] && g_reminderListGeom[2]) {
- WINDOWPLACEMENT wp;
- wp.length = sizeof(WINDOWPLACEMENT);
- GetWindowPlacement(hwndDlg, &wp);
- wp.rcNormalPosition.left = g_reminderListGeom[0];
- wp.rcNormalPosition.top = g_reminderListGeom[1];
- wp.rcNormalPosition.right = g_reminderListGeom[2] + g_reminderListGeom[0];
- wp.rcNormalPosition.bottom = g_reminderListGeom[3] + g_reminderListGeom[1];
- SetWindowPlacement(hwndDlg, &wp);
- }
+ Utils_RestoreWindowPosition(hwndDlg, 0, MODULENAME, "ListReminders");
return TRUE;
case WM_CLOSE:
DestroyWindow(hwndDlg);
- bListReminderVisible = FALSE;
+ bListReminderVisible = false;
return TRUE;
case WM_NOTIFY:
@@ -1938,14 +1894,6 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND hwndDlg, UINT Message, WPARAM
break;
}
}
- else if (wParam == IDC_LISTREMINDERS_HEADER) {
- LPNMHEADER NM = (LPNMHEADER)lParam;
- switch (NM->hdr.code) {
- case HDN_ENDTRACK:
- UpdateGeomFromWnd(hwndDlg, nullptr, g_reminderListColGeom, _countof(g_reminderListColGeom));
- break;
- }
- }
break;
case WM_COMMAND:
@@ -1958,7 +1906,7 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND hwndDlg, UINT Message, WPARAM
}
return TRUE;
- case IDC_CLOSE:
+ case IDCANCEL:
DestroyWindow(hwndDlg);
bListReminderVisible = false;
return TRUE;
@@ -1991,6 +1939,7 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND hwndDlg, UINT Message, WPARAM
break;
case WM_DESTROY:
+ Utils_SaveWindowPosition(hwndDlg, 0, MODULENAME, "ListReminders");
Window_FreeIcon_IcoLib(hwndDlg);
break;
}
diff --git a/plugins/NotesAndReminders/src/resource.h b/plugins/NotesAndReminders/src/resource.h
index 2f8c77c23c..1cf018e1ed 100644
--- a/plugins/NotesAndReminders/src/resource.h
+++ b/plugins/NotesAndReminders/src/resource.h
@@ -27,7 +27,6 @@
#define IDC_ADDREMINDER 1002
#define IDC_ADDNEWREMINDER 1002
#define IDC_REMINDAGAININ 1003
-#define IDC_CLOSE 1003
#define IDC_AFTER 1004
#define IDC_REMINDER 1004
#define IDC_ONDATE 1005
diff --git a/plugins/NotesAndReminders/src/stdafx.h b/plugins/NotesAndReminders/src/stdafx.h
index 74456c5bad..504c5da958 100644
--- a/plugins/NotesAndReminders/src/stdafx.h
+++ b/plugins/NotesAndReminders/src/stdafx.h
@@ -90,11 +90,6 @@ extern int g_Transparency;
extern char *g_RemindSMS;
extern char *g_lpszAltBrowser;
-extern int g_reminderListGeom[4];
-extern int g_reminderListColGeom[2];
-extern int g_notesListGeom[4];
-extern int g_notesListColGeom[4];
-
extern IconItem iconList[];
INT_PTR PluginMenuCommandAddNew(WPARAM, LPARAM);