diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-09-19 20:59:08 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-09-19 20:59:08 +0000 |
commit | b741839a3b40ef50eaab1b745bdf5a9c0456ec45 (patch) | |
tree | 553a79f0a3580c8d1ba7c1098091f2c0c6d28139 | |
parent | e87725cb4be71a58c0ddf4d0b0b6d92b8cc47d7b (diff) |
Toaster: added simple options page
git-svn-id: http://svn.miranda-ng.org/main/trunk@15404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Toaster/res/resource.rc | 52 | ||||
-rw-r--r-- | plugins/Toaster/src/main.cpp | 7 | ||||
-rw-r--r-- | plugins/Toaster/src/options.cpp | 47 | ||||
-rw-r--r-- | plugins/Toaster/src/options.h | 20 | ||||
-rw-r--r-- | plugins/Toaster/src/resource.h | 7 | ||||
-rw-r--r-- | plugins/Toaster/src/stdafx.h | 6 |
6 files changed, 132 insertions, 7 deletions
diff --git a/plugins/Toaster/res/resource.rc b/plugins/Toaster/res/resource.rc index 0bf3781247..4618ccd183 100644 --- a/plugins/Toaster/res/resource.rc +++ b/plugins/Toaster/res/resource.rc @@ -13,6 +13,58 @@ #undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1251)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPTIONS_MAIN DIALOGEX 0, 0, 304, 228
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ PUSHBUTTON "Preview",IDC_PREVIEW,219,203,73,14
+ PUSHBUTTON "Add shortcut",IDC_SHORTCUT,11,203,73,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPTIONS_MAIN, DIALOG
+ BEGIN
+ HORZGUIDE, 203
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_OPTIONS_MAIN AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
+#endif // Neutral resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
// Russian (Russia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index a005a1b8c6..e7006bb52d 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -39,7 +39,9 @@ extern "C" int __declspec(dllexport) Load(void) {
mir_getLP(&pluginInfo);
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized);
HookEvent(ME_SYSTEM_PRESHUTDOWN, &OnPreShutdown);
+
InitServices();
GetEnvironmentVariableW(L"TEMP", wszTempDir, MAX_PATH);
@@ -49,11 +51,6 @@ extern "C" int __declspec(dllexport) Load(void) if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(wszTempDir);
- if (FAILED(TryCreateShortcut()))
- {
- MessageBox(NULL, TranslateT("Failed to create shortcut"), _T(MODULE), MB_OK | MB_ICONERROR);
- }
-
return 0;
}
diff --git a/plugins/Toaster/src/options.cpp b/plugins/Toaster/src/options.cpp new file mode 100644 index 0000000000..7bb01412f5 --- /dev/null +++ b/plugins/Toaster/src/options.cpp @@ -0,0 +1,47 @@ +#include "stdafx.h"
+
+COptions::COptions()
+ : CDlgBase(g_hInstance, IDD_OPTIONS_MAIN),
+ m_shortcut(this, IDC_SHORTCUT),
+ m_preview(this, IDC_PREVIEW)
+{
+ m_shortcut.OnClick = Callback(this, &COptions::Shortcut_OnClick);
+ m_preview.OnClick = Callback(this, &COptions::Preview_OnClick);
+}
+
+void COptions::OnInitDialog()
+{
+}
+
+void COptions::Shortcut_OnClick(CCtrlBase*)
+{
+ if (FAILED(TryCreateShortcut()))
+ {
+ CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Failed to create shortcut"), (LPARAM)SM_ERROR);
+ return;
+ }
+ CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Shortcut was added to the start menu"), (LPARAM)SM_NOTIFY);
+}
+
+void COptions::Preview_OnClick(CCtrlBase*)
+{
+ CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Information"), (LPARAM)SM_NOTIFY);
+ CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Warning"), (LPARAM)SM_WARNING);
+ CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Error"), (LPARAM)SM_ERROR);
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+
+int OnOptionsInitialized(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.ptszTitle = _T(MODULE);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
+ odp.ptszGroup = LPGENT("Popups");
+
+ odp.ptszTab = _T("Main");
+ odp.pDialog = new COptions();
+ Options_AddPage(wParam, &odp);
+
+ return 0;
+}
diff --git a/plugins/Toaster/src/options.h b/plugins/Toaster/src/options.h new file mode 100644 index 0000000000..35d6c049b6 --- /dev/null +++ b/plugins/Toaster/src/options.h @@ -0,0 +1,20 @@ +#ifndef _OPTIONS_H_
+#define _OPTIONS_H_
+
+class COptions : public CDlgBase
+{
+private:
+ CCtrlButton m_shortcut;
+ CCtrlButton m_preview;
+
+protected:
+ void OnInitDialog();
+
+ void Shortcut_OnClick(CCtrlBase*);
+ void Preview_OnClick(CCtrlBase*);
+
+public:
+ COptions();
+};
+
+#endif //_OPTIONS_H_
\ No newline at end of file diff --git a/plugins/Toaster/src/resource.h b/plugins/Toaster/src/resource.h index 0f01763f97..0e65385bd2 100644 --- a/plugins/Toaster/src/resource.h +++ b/plugins/Toaster/src/resource.h @@ -1,13 +1,16 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by e:\Projects\C++\MirandaNG\plugins\Toaster\res\resource.rc
+// Used by E:\Projects\C++\MirandaNG\plugins\Toaster\res\resource.rc
//
+#define IDD_OPTIONS_MAIN 107
+#define IDC_PREVIEW 1033
+#define IDC_SHORTCUT 1034
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 107
+#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h index effea40186..2088db9016 100644 --- a/plugins/Toaster/src/stdafx.h +++ b/plugins/Toaster/src/stdafx.h @@ -21,6 +21,8 @@ #include <m_imgsrvc.h>
#include <m_netlib.h>
#include <m_xml.h>
+#include <m_options.h>
+#include <m_gui.h>
#include "version.h"
#include "resource.h"
@@ -37,6 +39,7 @@ DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, #include "toast_event_handler.h"
#include "toast_notification.h"
#include "add_to_start_menu.h"
+#include "options.h"
#include "structs.h"
#include "images.h"
@@ -49,4 +52,7 @@ void CleanupClasses(); void InitServices();
int OnPreShutdown(WPARAM, LPARAM);
void __stdcall HideAllToasts(void*);
+
+int OnOptionsInitialized(WPARAM wParam, LPARAM);
+
#endif //_COMMON_H_
|