diff options
Diffstat (limited to 'plugins/NotesAndReminders/src/options.cpp')
-rw-r--r-- | plugins/NotesAndReminders/src/options.cpp | 299 |
1 files changed, 109 insertions, 190 deletions
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index c088db9257..928d9e6d3f 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -1,71 +1,67 @@ -#include "globals.h"
+#include "stdafx.h"
// min allowed alpha (don't want 0 because it's a waste of resources as well as might confuse user)
#define MIN_ALPHA 30
-BOOL g_CloseAfterAddReminder, g_UseDefaultPlaySound;
HICON g_hReminderIcon = nullptr;
-LOGFONT lfBody,lfCaption;
+LOGFONTA lfBody, lfCaption;
HFONT hBodyFont = nullptr, hCaptionFont = nullptr;
long BodyColor;
-long CaptionFontColor,BodyFontColor;
-BOOL g_ShowNotesAtStart,g_ShowScrollbar,g_AddContListMI,g_ShowNoteButtons;
+long CaptionFontColor, BodyFontColor;
int g_NoteTitleDate, g_NoteTitleTime;
-int g_NoteWidth,g_NoteHeight;
+int g_NoteWidth, g_NoteHeight;
int g_Transparency;
char *g_RemindSMS = nullptr;
char *g_lpszAltBrowser = nullptr;
int g_reminderListGeom[4] = {0};
-int g_reminderListColGeom[2] = { 150, 205 };
+int g_reminderListColGeom[2] = {150, 205};
int g_notesListGeom[4] = {0};
-int g_notesListColGeom[4] = { 150, 20, 20, 165 };
-
+int g_notesListColGeom[4] = {150, 20, 20, 165};
#define NRCDEFAULT_BODYCLR RGB(255,255,0)
struct DateFormat
{
- LPCSTR lpszUI;
- LPCSTR lpszFmt;
+ wchar_t *lpszUI;
+ wchar_t *lpszFmt;
}
static dateFormats[] =
{
- { "1981-12-31", "yyyy'-'MM'-'dd" },
- { "31-12-1981", "dd'-'MM'-'yyyy" },
- { "12-31-1981", "MM'-'dd'-'yyyy" },
- { "1981-dec-31", "yyyy'-'MMM'-'dd" },
- { "31-dec-1981", "dd'-'MMM'-'yyyy" },
- { "dec-31-1981", "MMM'-'dd'-'yyyy" },
- { "1981/12/31", "yyyy'/'MM'/'dd" },
- { "31/12/1981", "dd'/'MM'/'yyyy" },
- { "12/31/1981", "MM'/'dd'/'yyyy" },
- { "1981/dec/31", "yyyy'/'MMM'/'dd" },
- { "31/dec/1981", "dd'/'MMM'/'yyyy" },
- { "dec/31/1981", "MMM'/'dd'/'yyyy" },
- { "1981 dec 31", "yyyy MMM dd" },
- { "31 dec 1981", "dd MMM yyyy" },
- { "dec 31 1981", "MMM dd yyyy" }
+ { L"1981-12-31", L"yyyy'-'MM'-'dd" },
+ { L"31-12-1981", L"dd'-'MM'-'yyyy" },
+ { L"12-31-1981", L"MM'-'dd'-'yyyy" },
+ { L"1981-dec-31", L"yyyy'-'MMM'-'dd" },
+ { L"31-dec-1981", L"dd'-'MMM'-'yyyy" },
+ { L"dec-31-1981", L"MMM'-'dd'-'yyyy" },
+ { L"1981/12/31", L"yyyy'/'MM'/'dd" },
+ { L"31/12/1981", L"dd'/'MM'/'yyyy" },
+ { L"12/31/1981", L"MM'/'dd'/'yyyy" },
+ { L"1981/dec/31", L"yyyy'/'MMM'/'dd" },
+ { L"31/dec/1981", L"dd'/'MMM'/'yyyy" },
+ { L"dec/31/1981", L"MMM'/'dd'/'yyyy" },
+ { L"1981 dec 31", L"yyyy MMM dd" },
+ { L"31 dec 1981", L"dd MMM yyyy" },
+ { L"dec 31 1981", L"MMM dd yyyy" }
};
struct TimeFormat
{
- LPCSTR lpszUI;
- LPCSTR lpszFmt;
+ wchar_t *lpszUI;
+ wchar_t *lpszFmt;
}
static timeFormats[] =
{
- { "19:30:00", "HH':'mm':'ss" },
- { "19:30", "HH':'mm'" },
- { "7:30:00 PM", "hh':'mm':'ss tt" },
- { "7:30 PM", "hh':'mm tt" },
- { "7:30:00P", "hh':'mm':'sst" },
- { "7:30P", "hh':'mmt" }
+ { L"19:30:00", L"HH':'mm':'ss" },
+ { L"19:30", L"HH':'mm'" },
+ { L"7:30:00 PM", L"hh':'mm':'ss tt" },
+ { L"7:30 PM", L"hh':'mm tt" },
+ { L"7:30:00P", L"hh':'mm':'sst" },
+ { L"7:30P", L"hh':'mmt" }
};
-
struct FontOptionsList
{
char *szDescr;
@@ -78,9 +74,6 @@ struct FontOptionsList static fontOptionsList[] =
{
{ LPGEN("Sticky Note Caption"), RGB(0, 0, 0), "Small Fonts", 0, 7, LPGEN("Sticky Note Background Color") },
- // { LPGEN("Sticky Note Caption"), RGB(0,0,0), L"Terminal", 0, 6, LPGEN("Sticky Note Background Color")},
- // { LPGEN("Sticky Note Caption"), RGB(0,0,0), L"MS Serif", 0, 7, LPGEN("Sticky Note Background Color")},
- // { LPGEN("Sticky Note Body"), RGB(0,0,0), L"Tahoma", 0, 8, LPGEN("Sticky Note Background Color")},
{ LPGEN("Sticky Note Body"), RGB(0, 0, 0), "System", DBFONTF_BOLD, 10, LPGEN("Sticky Note Background Color") },
};
@@ -97,91 +90,20 @@ static colourOptionsList[] = };
-LPCSTR GetDateFormatStr()
+wchar_t* GetDateFormatStr()
{
return dateFormats[g_NoteTitleDate ? g_NoteTitleDate - 1 : 0].lpszFmt;
}
-LPCSTR GetTimeFormatStr()
+wchar_t* GetTimeFormatStr()
{
return timeFormats[g_NoteTitleTime ? g_NoteTitleTime - 1 : 0].lpszFmt;
}
-#if defined( _UNICODE )
-static BYTE MsgDlgGetFontDefaultCharset(const wchar_t* szFont)
-{
- return DEFAULT_CHARSET;
-}
-#else
-// get font charset according to current CP
-static BYTE MsgDlgGetCPDefaultCharset()
-{
- switch (GetACP()) {
- case 1250:
- return EASTEUROPE_CHARSET;
- case 1251:
- return RUSSIAN_CHARSET;
- case 1252:
- return ANSI_CHARSET;
- case 1253:
- return GREEK_CHARSET;
- case 1254:
- return TURKISH_CHARSET;
- case 1255:
- return HEBREW_CHARSET;
- case 1256:
- return ARABIC_CHARSET;
- case 1257:
- return BALTIC_CHARSET;
- case 1361:
- return JOHAB_CHARSET;
- case 874:
- return THAI_CHARSET;
- case 932:
- return SHIFTJIS_CHARSET;
- case 936:
- return GB2312_CHARSET;
- case 949:
- return HANGEUL_CHARSET;
- case 950:
- return CHINESEBIG5_CHARSET;
- default:
- return DEFAULT_CHARSET;
- }
-}
-
-static int CALLBACK EnumFontFamExProc(const LOGFONT *, const TEXTMETRIC *, DWORD, LPARAM lParam)
-{
- *(int*)lParam = 1;
- return 0;
-}
-
-// get font charset according to current CP, if available for specified font
-static BYTE MsgDlgGetFontDefaultCharset(const char *szFont)
-{
- LOGFONT lf = { 0 };
- int found = 0;
-
- mir_strcpy(lf.lfFaceName, szFont);
- lf.lfCharSet = MsgDlgGetCPDefaultCharset();
-
- // check if the font supports specified charset
- HDC hdc = GetDC(nullptr);
- EnumFontFamiliesEx(hdc, &lf, &EnumFontFamExProc, (LPARAM)&found, 0);
- ReleaseDC(nullptr, hdc);
-
- if (found)
- return lf.lfCharSet;
- else // no, give default
- return DEFAULT_CHARSET;
-}
-#endif
-
-
static void InitFonts()
{
- memset(&lfBody, 0, sizeof(LOGFONT));
- memset(&lfCaption, 0, sizeof(LOGFONT));
+ memset(&lfBody, 0, sizeof(lfBody));
+ memset(&lfCaption, 0, sizeof(lfCaption));
LoadNRFont(NR_FONTID_CAPTION, &lfCaption, (COLORREF*)&CaptionFontColor);
LoadNRFont(NR_FONTID_BODY, &lfBody, (COLORREF*)&BodyFontColor);
@@ -191,8 +113,8 @@ static void InitFonts() if (hCaptionFont)
DeleteObject(hCaptionFont);
- hBodyFont = CreateFontIndirect(&lfBody);
- hCaptionFont = CreateFontIndirect(&lfCaption);
+ hBodyFont = CreateFontIndirectA(&lfBody);
+ hCaptionFont = CreateFontIndirectA(&lfCaption);
}
@@ -244,7 +166,7 @@ void RegisterFontServiceFonts() //fontid.deffontsettings.size = fontOptionsList[i].defSize;
fontid.deffontsettings.style = fontOptionsList[i].defStyle;
- fontid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace);
+ fontid.deffontsettings.charset = DEFAULT_CHARSET;
strncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fontid.deffontsettings.szFace));
strncpy(fontid.backgroundName, fontOptionsList[i].szBkgName, _countof(fontid.backgroundName));
@@ -269,7 +191,7 @@ void RegisterFontServiceFonts() HookEvent(ME_COLOUR_RELOAD, FS_ColorChanged);
}
-void LoadNRFont(int i, LOGFONT *lf, COLORREF *colour)
+void LoadNRFont(int i, LOGFONTA *lf, COLORREF *colour)
{
COLORREF col = Font_Get(SECTIONNAME, fontOptionsList[i].szDescr, lf);
if (colour)
@@ -311,42 +233,48 @@ static void TrimString(char *s) }
}
+static void FillValues(HWND hdlg)
+{
+ CheckDlgButton(hdlg, IDC_CHECK_HIDENOTES, g_plugin.bShowNotesAtStart ? BST_UNCHECKED : BST_CHECKED); // reversed
+ CheckDlgButton(hdlg, IDC_CHECK_MENUS, g_plugin.bAddContListMI ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_CHECK_BUTTONS, g_plugin.bShowNoteButtons ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_CHECK_SCROLLBARS, g_plugin.bShowScrollbar ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_CHECK_CLOSE, g_plugin.bCloseAfterAddReminder ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_CHECK_MSI, g_plugin.bUseMSI ? BST_CHECKED : BST_UNCHECKED);
-INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
+ SetDlgItemInt(hdlg, IDC_EDIT_WIDTH, g_NoteWidth, FALSE);
+ SetDlgItemInt(hdlg, IDC_EDIT_HEIGHT, g_NoteHeight, FALSE);
+
+ SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_SETCURSEL, (WPARAM)(g_NoteTitleDate ? g_NoteTitleDate - 1 : SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_GETCOUNT, 0, 0) - 1), 0);
+ SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_SETCURSEL, (WPARAM)(g_NoteTitleTime ? g_NoteTitleTime - 1 : SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_GETCOUNT, 0, 0) - 1), 0);
+
+ SendDlgItemMessage(hdlg, IDC_SLIDER_TRANSPARENCY, TBM_SETPOS, TRUE, 255 - g_Transparency);
+}
+
+static INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
SendDlgItemMessage(hdlg, IDC_SLIDER_TRANSPARENCY, TBM_SETRANGE, TRUE, MAKELONG(0, 255 - MIN_ALPHA));
- SendDlgItemMessage(hdlg, IDC_SLIDER_TRANSPARENCY, TBM_SETPOS, TRUE, 255 - g_Transparency);
- CheckDlgButton(hdlg, IDC_CHECK_HIDENOTES, !g_ShowNotesAtStart ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_MENUS, g_AddContListMI ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_BUTTONS, g_ShowNoteButtons ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_SCROLLBARS, g_ShowScrollbar ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_CLOSE, g_CloseAfterAddReminder ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_MSI, !g_UseDefaultPlaySound ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hdlg, IDC_EDIT_WIDTH, g_NoteWidth, FALSE);
- SetDlgItemInt(hdlg, IDC_EDIT_HEIGHT, g_NoteHeight, FALSE);
+ FillValues(hdlg);
SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_RESETCONTENT, 0, 0);
- for (int i = 0; i < _countof(dateFormats); i++)
- SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_ADDSTRING, 0, (LPARAM)dateFormats[i].lpszUI);
- for (int i = 0; i < _countof(timeFormats); i++)
- SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_ADDSTRING, 0, (LPARAM)timeFormats[i].lpszUI);
- SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_ADDSTRING, 0, (LPARAM)Translate("None"));
- SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_ADDSTRING, 0, (LPARAM)Translate("None"));
-
- SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_SETCURSEL, (WPARAM)(g_NoteTitleDate ? g_NoteTitleDate - 1 : SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_GETCOUNT, 0, 0) - 1), 0);
- SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_SETCURSEL, (WPARAM)(g_NoteTitleTime ? g_NoteTitleTime - 1 : SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_GETCOUNT, 0, 0) - 1), 0);
+ for (auto &it : dateFormats)
+ SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_ADDSTRING, 0, (LPARAM)it.lpszUI);
+ for (auto &it : timeFormats)
+ SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_ADDSTRING, 0, (LPARAM)it.lpszUI);
+ SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("None"));
+ SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("None"));
if (g_RemindSMS)
- SetDlgItemText(hdlg, IDC_EDIT_EMAILSMS, g_RemindSMS);
+ SetDlgItemTextA(hdlg, IDC_EDIT_EMAILSMS, g_RemindSMS);
else
- SetDlgItemText(hdlg, IDC_EDIT_EMAILSMS, "");
+ SetDlgItemTextA(hdlg, IDC_EDIT_EMAILSMS, "");
- SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser ? g_lpszAltBrowser : "");
+ SetDlgItemTextA(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser ? g_lpszAltBrowser : "");
return TRUE;
case WM_HSCROLL:
@@ -355,16 +283,19 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- g_ShowNotesAtStart = !(BOOL)IsDlgButtonChecked(hdlg, IDC_CHECK_HIDENOTES);
- g_ShowNoteButtons = (BOOL)IsDlgButtonChecked(hdlg, IDC_CHECK_BUTTONS);
- g_ShowScrollbar = (BOOL)IsDlgButtonChecked(hdlg, IDC_CHECK_SCROLLBARS);
- g_AddContListMI = (BOOL)IsDlgButtonChecked(hdlg, IDC_CHECK_MENUS);
+ g_plugin.bShowNotesAtStart = IsDlgButtonChecked(hdlg, IDC_CHECK_HIDENOTES) == 0; // reversed
+ g_plugin.bShowNoteButtons = IsDlgButtonChecked(hdlg, IDC_CHECK_BUTTONS) != 0;
+ g_plugin.bShowScrollbar = IsDlgButtonChecked(hdlg, IDC_CHECK_SCROLLBARS) != 0;
+ g_plugin.bAddContListMI = IsDlgButtonChecked(hdlg, IDC_CHECK_MENUS) != 0;
+
BOOL LB;
g_NoteWidth = GetDlgItemInt(hdlg, IDC_EDIT_WIDTH, &LB, FALSE);
g_NoteHeight = GetDlgItemInt(hdlg, IDC_EDIT_HEIGHT, &LB, FALSE);
g_Transparency = 255 - SendDlgItemMessage(hdlg, IDC_SLIDER_TRANSPARENCY, TBM_GETPOS, 0, 0);
- g_CloseAfterAddReminder = (BOOL)IsDlgButtonChecked(hdlg, IDC_CHECK_CLOSE);
- g_UseDefaultPlaySound = !(BOOL)IsDlgButtonChecked(hdlg, IDC_CHECK_MSI);
+
+ g_plugin.bCloseAfterAddReminder = IsDlgButtonChecked(hdlg, IDC_CHECK_CLOSE) != 0;
+ g_plugin.bUseMSI = IsDlgButtonChecked(hdlg, IDC_CHECK_MSI) != 0;
+
g_NoteTitleDate = (SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_GETCURSEL, 0, 0) + 1) % SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_GETCOUNT, 0, 0);
g_NoteTitleTime = (SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_GETCURSEL, 0, 0) + 1) % SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_GETCOUNT, 0, 0);
if (g_NoteWidth < 179) {
@@ -378,7 +309,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l WORD SzT = (WORD)SendDlgItemMessage(hdlg, IDC_EDIT_EMAILSMS, WM_GETTEXTLENGTH, 0, 0);
if (SzT != 0) {
g_RemindSMS = (char*)realloc(g_RemindSMS, SzT + 1);
- GetDlgItemText(hdlg, IDC_EDIT_EMAILSMS, g_RemindSMS, SzT + 1);
+ GetDlgItemTextA(hdlg, IDC_EDIT_EMAILSMS, g_RemindSMS, SzT + 1);
}
char *P = g_RemindSMS;
db_set_blob(0, MODULENAME, "RemindEmail", P, SzT);
@@ -386,7 +317,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l SzT = (WORD)SendDlgItemMessage(hdlg, IDC_EDIT_ALTBROWSER, WM_GETTEXTLENGTH, 0, 0);
if (SzT != 0) {
g_lpszAltBrowser = (char*)mir_realloc(g_lpszAltBrowser, SzT + 1);
- GetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser, SzT + 1);
+ GetDlgItemTextA(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser, SzT + 1);
TrimString(g_lpszAltBrowser);
if (!*g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
@@ -397,23 +328,18 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l mir_free(g_lpszAltBrowser);
g_lpszAltBrowser = nullptr;
}
- SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser ? g_lpszAltBrowser : "");
+ SetDlgItemTextA(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser ? g_lpszAltBrowser : "");
if (g_lpszAltBrowser)
g_plugin.setString("AltBrowser", g_lpszAltBrowser);
else
g_plugin.delSetting("AltBrowser");
- g_plugin.setDword("ShowNotesAtStart", g_ShowNotesAtStart);
- g_plugin.setDword("ShowNoteButtons", g_ShowNoteButtons);
- g_plugin.setDword("ShowScrollbar", g_ShowScrollbar);
- g_plugin.setDword("AddContactMenuItems", g_AddContListMI);
g_plugin.setDword("NoteWidth", g_NoteWidth);
g_plugin.setDword("NoteHeight", g_NoteHeight);
g_plugin.setDword("Transparency", g_Transparency);
g_plugin.setDword("NoteTitleDate", g_NoteTitleDate);
g_plugin.setDword("NoteTitleTime", g_NoteTitleTime);
- g_plugin.setDword("CloseAfterAddReminder", g_CloseAfterAddReminder);
- g_plugin.setDword("UseMCI", !g_UseDefaultPlaySound);
+
SaveNotes();
LoadNotes(FALSE);
return TRUE;
@@ -424,20 +350,19 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l switch (LOWORD(wParam)) {
case IDC_BTN_BROWSEBROWSER:
{
- char s[MAX_PATH];
+ wchar_t s[MAX_PATH];
+ GetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, s, _countof(s));
- OPENFILENAME ofn = { 0 };
+ OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hdlg;
- ofn.lpstrFilter = Translate("Executable Files\0*.exe\0All Files\0*.*\0\0");
+ ofn.lpstrFilter = TranslateT("Executable Files\0*.exe\0All Files\0*.*\0\0");
ofn.lpstrFile = s;
ofn.nMaxFile = _countof(s);
- ofn.lpstrTitle = Translate("Select Executable");
- ofn.lpstrInitialDir = ".";
+ ofn.lpstrTitle = TranslateT("Select Executable");
+ ofn.lpstrInitialDir = L".";
ofn.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_ENABLESIZING | OFN_DONTADDTORECENT;
- GetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, s, ofn.nMaxFile);
-
if (GetOpenFileName(&ofn)) {
SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, s);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
@@ -447,34 +372,20 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l case IDC_BUTTON_RESET:
SAFE_FREE((void**)&g_RemindSMS);
- SetDlgItemText(hdlg, IDC_EDIT_EMAILSMS, "");
- if (g_lpszAltBrowser) {
- mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = nullptr;
- }
- SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, "");
- g_ShowNotesAtStart = TRUE;
- g_AddContListMI = TRUE;
- g_ShowScrollbar = TRUE;
- g_ShowNoteButtons = TRUE;
+ SetDlgItemTextA(hdlg, IDC_EDIT_EMAILSMS, "");
+ SetDlgItemTextA(hdlg, IDC_EDIT_ALTBROWSER, "");
+
+ replaceStr(g_lpszAltBrowser, nullptr);
+
+ g_plugin.bShowNotesAtStart = g_plugin.bAddContListMI = g_plugin.bShowScrollbar = g_plugin.bShowNoteButtons = true;
+ g_plugin.bCloseAfterAddReminder = g_plugin.bUseMSI = true;
+
g_NoteTitleDate = 1;
g_NoteTitleTime = 1;
- g_CloseAfterAddReminder = TRUE;
- g_UseDefaultPlaySound = FALSE;
- CheckDlgButton(hdlg, IDC_CHECK_HIDENOTES, !g_ShowNotesAtStart ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_MENUS, g_AddContListMI ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_SCROLLBARS, g_ShowScrollbar ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_BUTTONS, g_ShowNoteButtons ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_CLOSE, g_CloseAfterAddReminder ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_CHECK_MSI, !g_UseDefaultPlaySound ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hdlg, IDC_COMBODATE, CB_SETCURSEL, (WPARAM)(g_NoteTitleDate - 1), 0);
- SendDlgItemMessage(hdlg, IDC_COMBOTIME, CB_SETCURSEL, (WPARAM)(g_NoteTitleTime - 1), 0);
g_NoteWidth = 179;
g_NoteHeight = 35;
- SetDlgItemInt(hdlg, IDC_EDIT_WIDTH, g_NoteWidth, FALSE);
- SetDlgItemInt(hdlg, IDC_EDIT_HEIGHT, g_NoteHeight, FALSE);
g_Transparency = 255;
- SendDlgItemMessage(hdlg, IDC_SLIDER_TRANSPARENCY, TBM_SETPOS, TRUE, 0);
+ FillValues(hdlg);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0); // JK optim
return TRUE;
@@ -506,6 +417,20 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l return FALSE;
}
+int OnOptInitialise(WPARAM w, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.position = 900002000;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_STNOTEOPTIONS);
+ odp.szTitle.a = SECTIONNAME;
+ odp.szGroup.a = LPGEN("Plugins");
+ odp.pfnDlgProc = DlgProcOptions;
+ g_plugin.addOptions(w, &odp);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void InitSettings(void)
{
void *P = nullptr;
@@ -523,17 +448,11 @@ void InitSettings(void) g_lpszAltBrowser = g_plugin.getStringA("AltBrowser");
- g_ShowNotesAtStart = (BOOL)g_plugin.getDword("ShowNotesAtStart", 1);
- g_ShowNoteButtons = (BOOL)g_plugin.getDword("ShowNoteButtons", 1);
- g_ShowScrollbar = (BOOL)g_plugin.getDword("ShowScrollbar", 1);
- g_AddContListMI = (BOOL)g_plugin.getDword("AddContactMenuItems", 1);
g_NoteWidth = g_plugin.getDword("NoteWidth", 179);
g_NoteHeight = g_plugin.getDword("NoteHeight", 50);
g_Transparency = g_plugin.getDword("Transparency", 255);
g_NoteTitleDate = g_plugin.getDword("NoteTitleDate", 1);
g_NoteTitleTime = g_plugin.getDword("NoteTitleTime", 1);
- g_CloseAfterAddReminder = (BOOL)g_plugin.getDword("CloseAfterAddReminder", 1);
- g_UseDefaultPlaySound = !(BOOL)g_plugin.getDword("UseMCI", 1);
ReadSettingIntArray(0, MODULENAME, "ReminderListGeom", g_reminderListGeom, _countof(g_reminderListGeom));
ReadSettingIntArray(0, MODULENAME, "ReminderListColGeom", g_reminderListColGeom, _countof(g_reminderListColGeom));
|