From 83402fe2934d403c8d3a436baed5261cd315dc85 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 10 Jan 2017 19:56:54 +0300 Subject: account manager dialog for Discord --- protocols/Discord/res/discord.rc | 26 ++++++++++++++++++++------ protocols/Discord/src/options.cpp | 14 +++++++++++--- protocols/Discord/src/proto.cpp | 1 + protocols/Discord/src/proto.h | 2 ++ protocols/Discord/src/resource.h | 13 ++++++------- 5 files changed, 40 insertions(+), 16 deletions(-) (limited to 'protocols') diff --git a/protocols/Discord/res/discord.rc b/protocols/Discord/res/discord.rc index fc31363075..b8b5e4ae5a 100644 --- a/protocols/Discord/res/discord.rc +++ b/protocols/Discord/res/discord.rc @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "winres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -32,7 +32,7 @@ END 2 TEXTINCLUDE BEGIN - "#include ""afxres.h""\r\n" + "#include ""winres.h""\r\n" "\0" END @@ -44,6 +44,7 @@ END #endif // APSTUDIO_INVOKED + ///////////////////////////////////////////////////////////////////////////// // // Icon @@ -51,9 +52,8 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. - -IDI_MAIN ICON "discord.ico" -IDI_OFFLINE ICON "offline.ico" +IDI_MAIN ICON "discord.ico" +IDI_OFFLINE ICON "offline.ico" ///////////////////////////////////////////////////////////////////////////// // @@ -70,12 +70,26 @@ BEGIN EDITTEXT IDC_USERNAME,84,18,123,13,ES_AUTOHSCROLL LTEXT "Password:",IDC_STATIC,17,36,61,8,0,WS_EX_RIGHT EDITTEXT IDC_PASSWORD,84,34,123,13,ES_PASSWORD | ES_AUTOHSCROLL - GROUPBOX "Contacts",IDC_STATIC,7,77,291,88 LTEXT "Default group:",IDC_STATIC,17,91,61,8,0,WS_EX_RIGHT EDITTEXT IDC_GROUP,84,89,123,13,ES_AUTOHSCROLL END +IDD_OPTIONS_ACCMGR DIALOGEX 0, 0, 200, 88 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "User details",IDC_STATIC,7,7,178,46 + LTEXT "E-mail:",IDC_STATIC,17,20,69,8,0,WS_EX_RIGHT + EDITTEXT IDC_USERNAME,92,18,86,13,ES_AUTOHSCROLL + LTEXT "Password:",IDC_STATIC,17,36,69,8,0,WS_EX_RIGHT + EDITTEXT IDC_PASSWORD,92,34,86,13,ES_PASSWORD | ES_AUTOHSCROLL + GROUPBOX "Contacts",IDC_STATIC,7,56,178,28 + LTEXT "Default group:",IDC_STATIC,17,67,69,8,0,WS_EX_RIGHT + EDITTEXT IDC_GROUP,92,65,86,13,ES_AUTOHSCROLL +END + IDD_EXTSEARCH DIALOGEX 0, 0, 114, 55 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU EXSTYLE WS_EX_TRANSPARENT | WS_EX_CONTROLPARENT diff --git a/protocols/Discord/src/options.cpp b/protocols/Discord/src/options.cpp index 2114e47af9..c52424ce6f 100644 --- a/protocols/Discord/src/options.cpp +++ b/protocols/Discord/src/options.cpp @@ -25,8 +25,8 @@ class CDiscardAccountOptions : public CProtoDlgBase ptrW m_wszOldGroup; public: - CDiscardAccountOptions(CDiscordProto *ppro) : - CProtoDlgBase(ppro, IDD_OPTIONS_ACCOUNT), + CDiscardAccountOptions(CDiscordProto *ppro, int iDlgID) : + CProtoDlgBase(ppro, iDlgID, false), m_edGroup(this, IDC_GROUP), m_edUserName(this, IDC_USERNAME), m_edPassword(this, IDC_PASSWORD), @@ -55,6 +55,14 @@ public: ///////////////////////////////////////////////////////////////////////////////////////// +INT_PTR CDiscordProto::SvcCreateAccMgrUI(WPARAM, LPARAM hwndParent) +{ + CDiscardAccountOptions *pDlg = new CDiscardAccountOptions(this, IDD_OPTIONS_ACCMGR); + pDlg->SetParent((HWND)hwndParent); + pDlg->Create(); + return (INT_PTR)pDlg->GetHwnd(); +} + int CDiscordProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; @@ -65,7 +73,7 @@ int CDiscordProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.position = 1; odp.szTab.w = LPGENW("Account"); - odp.pDialog = new CDiscardAccountOptions(this); + odp.pDialog = new CDiscardAccountOptions(this, IDD_OPTIONS_ACCOUNT); Options_AddPage(wParam, &odp); return 0; } diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 5d72ea501a..e8ac7c269c 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -37,6 +37,7 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : { // Services CreateProtoService(PS_GETSTATUS, &CDiscordProto::GetStatus); + CreateProtoService(PS_CREATEACCMGRUI, &CDiscordProto::SvcCreateAccMgrUI); CreateProtoService(PS_GETAVATARINFO, &CDiscordProto::GetAvatarInfo); CreateProtoService(PS_GETAVATARCAPS, &CDiscordProto::GetAvatarCaps); diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index c3cbae6d4a..21f59e3377 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -210,7 +210,9 @@ public: virtual int __cdecl OnEvent(PROTOEVENTTYPE, WPARAM, LPARAM) override; // Services + INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM); INT_PTR __cdecl GetStatus(WPARAM, LPARAM); + INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM); INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM); INT_PTR __cdecl GetMyAvatar(WPARAM, LPARAM); diff --git a/protocols/Discord/src/resource.h b/protocols/Discord/src/resource.h index 840b444d17..20a3000f8c 100644 --- a/protocols/Discord/src/resource.h +++ b/protocols/Discord/src/resource.h @@ -1,17 +1,16 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by twitter.rc +// Used by w:\miranda-ng\protocols\Discord\res\discord.rc // - #define IDI_MAIN 101 #define IDI_OFFLINE 102 #define IDD_OPTIONS_ACCOUNT 103 #define IDD_EXTSEARCH 104 - -#define IDC_PASSWORD 1001 -#define IDC_USERNAME 1002 -#define IDC_GROUP 1003 -#define IDC_NICK 1004 +#define IDD_OPTIONS_ACCMGR 105 +#define IDC_PASSWORD 1001 +#define IDC_USERNAME 1002 +#define IDC_GROUP 1003 +#define IDC_NICK 1004 // Next default values for new objects // -- cgit v1.2.3