From 4b120013511a56eeee224272825c8711957d20d2 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Fri, 8 Jan 2016 10:13:05 +0000 Subject: SmileyAdd: background color setting moved to core colors git-svn-id: http://svn.miranda-ng.org/main/trunk@16055 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SmileyAdd/src/main.cpp | 8 ++++++++ plugins/SmileyAdd/src/options.cpp | 10 ---------- plugins/SmileyAdd/src/resource.h | 1 - plugins/SmileyAdd/src/services.cpp | 20 ++++++++++++++++++++ plugins/SmileyAdd/src/services.h | 1 + plugins/SmileyAdd/src/stdafx.h | 1 + 6 files changed, 30 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 1749c70a8e..5caa18710b 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -65,6 +65,13 @@ static int ModulesLoaded(WPARAM, LPARAM) g_SmileyCategories.AddAllProtocolsAsCategory(); g_SmileyCategories.ClearAndLoadAll(); + ColourID cid = { sizeof(cid) }; + strcpy_s(cid.dbSettingsGroup, "SmileyAdd"); + strcpy_s(cid.group, "SmileyAdd"); + strcpy_s(cid.name, "Background color"); + strcpy_s(cid.setting, "SelWndBkgClr"); + cid.defcolour = GetSysColor(COLOR_WINDOW); + ColourRegister(&cid); return 0; } @@ -102,6 +109,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SMILEYADD_OPTIONSCHANGED, UpdateSrmmDlg); HookEvent(ME_PROTO_ACCLISTCHANGED, AccountListChanged); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged); + HookEvent(ME_COLOUR_RELOAD, ReloadColour); //create the smiley services CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand); diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 8a9c43182d..5a8b883504 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -182,11 +182,6 @@ BOOL OptionsDialogType::DialogProcedure(UINT msg, WPARAM wParam, LPARAM lParam) SetChanged(); break; - case IDC_SELCLR: - if (HIWORD(wParam) == CPN_COLOURCHANGED) - SetChanged(); - break; - case IDC_MAXCUSTSMSZ: case IDC_MINSMSZ: if (HIWORD(wParam) == EN_CHANGE && GetFocus() == (HWND)lParam) @@ -429,9 +424,6 @@ void OptionsDialogType::InitDialog(void) SendDlgItemMessage(m_hwndDialog, IDC_MINSPIN, UDM_SETPOS, 0, opt.MinSmileySize); SendDlgItemMessage(m_hwndDialog, IDC_MINSMSZ, EM_LIMITTEXT, 2, 0); - SendDlgItemMessage(m_hwndDialog, IDC_SELCLR, CPM_SETCOLOUR, 0, opt.SelWndBkgClr); - SendDlgItemMessage(m_hwndDialog, IDC_SELCLR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOW)); - // Create and populate image list HIMAGELIST hImList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, g_SmileyCategories.NumberOfSmileyCategories(), 0); @@ -489,7 +481,6 @@ void OptionsDialogType::ApplyChanges(void) opt.HorizontalSorting = IsDlgButtonChecked(m_hwndDialog, IDC_SORTING_HORIZONTAL) == BST_CHECKED; opt.ButtonStatus = (unsigned)SendDlgItemMessage(m_hwndDialog, IDC_SMLBUT, CB_GETCURSEL, 0, 0); - opt.SelWndBkgClr = (unsigned)SendDlgItemMessage(m_hwndDialog, IDC_SELCLR, CPM_GETCOLOUR, 0, 0); opt.MaxCustomSmileySize = GetDlgItemInt(m_hwndDialog, IDC_MAXCUSTSMSZ, NULL, FALSE); opt.MinSmileySize = GetDlgItemInt(m_hwndDialog, IDC_MINSMSZ, NULL, FALSE); @@ -613,7 +604,6 @@ void OptionsType::Save(void) db_set_b(NULL, "SmileyAdd", "DisableCustom", DisableCustom); db_set_b(NULL, "SmileyAdd", "HQScaling", HQScaling); db_set_b(NULL, "SmileyAdd", "ButtonStatus", (BYTE)ButtonStatus); - db_set_dw(NULL, "SmileyAdd", "SelWndBkgClr", SelWndBkgClr); db_set_dw(NULL, "SmileyAdd", "MaxCustomSmileySize", MaxCustomSmileySize); db_set_dw(NULL, "SmileyAdd", "MinSmileySize", MinSmileySize); db_set_b(NULL, "SmileyAdd", "HorizontalSorting", HorizontalSorting); diff --git a/plugins/SmileyAdd/src/resource.h b/plugins/SmileyAdd/src/resource.h index 18d06cd4d7..27bee22de3 100644 --- a/plugins/SmileyAdd/src/resource.h +++ b/plugins/SmileyAdd/src/resource.h @@ -24,7 +24,6 @@ #define IDC_DISABLECUSTOM 1052 #define IDC_DISABLECUSTOM2 1053 #define IDC_HQSCALING 1053 -#define IDC_SELCLR 1055 #define IDC_NEWCATEGORY 1058 #define IDC_ADDCATEGORY 1059 #define IDC_DELETECATEGORY 1060 diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index c85d1789c9..4fd7bc9771 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -351,12 +351,25 @@ INT_PTR ReloadPack(WPARAM, LPARAM lParam) if (smc != NULL) smc->Load(); } else + { + g_SmileyCategories.ClearAll(); + g_SmileyCategories.AddAllProtocolsAsCategory(); g_SmileyCategories.ClearAndLoadAll(); + } NotifyEventHooks(hEvent1, 0, 0); return 0; } +INT_PTR ReloadOptions(WPARAM, LPARAM) +{ + g_SmileyCategories.ClearAll(); + g_SmileyCategories.AddAllProtocolsAsCategory(); + g_SmileyCategories.ClearAndLoadAll(); + opt.Load(); + return 0; +} + INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam) { if (opt.DisableCustom) return 0; @@ -445,3 +458,10 @@ int DbSettingChanged(WPARAM hContact, LPARAM lParam) } return 0; } + + +int ReloadColour(WPARAM, LPARAM) +{ + opt.SelWndBkgClr = db_get_dw(NULL, "SmileyAdd", "SelWndBkgClr", GetSysColor(COLOR_WINDOW)); + return 0; +} \ No newline at end of file diff --git a/plugins/SmileyAdd/src/services.h b/plugins/SmileyAdd/src/services.h index 8121ef0203..113485429b 100644 --- a/plugins/SmileyAdd/src/services.h +++ b/plugins/SmileyAdd/src/services.h @@ -37,6 +37,7 @@ INT_PTR ReloadPack(WPARAM, LPARAM lParam); INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam); int AccountListChanged(WPARAM wParam, LPARAM lParam); int DbSettingChanged(WPARAM wParam, LPARAM lParam); +int ReloadColour(WPARAM, LPARAM); SmileyPackType* GetSmileyPack(const char* proto, MCONTACT hContact = NULL, SmileyPackCType** smlc = NULL); diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h index 287a1ccf17..c968264936 100644 --- a/plugins/SmileyAdd/src/stdafx.h +++ b/plugins/SmileyAdd/src/stdafx.h @@ -61,6 +61,7 @@ along with this program. If not, see . #include #include #include +#include #include #include -- cgit v1.2.3