From 72a8c7e76a3048f733df1bf101ec6547606fdfbe Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 Aug 2017 21:40:02 +0300 Subject: minus ModernOpt --- plugins/ModernOpt/src/main.cpp | 58 --- plugins/ModernOpt/src/modernopt.cpp | 683 -------------------------------- plugins/ModernOpt/src/modernopt.h | 50 --- plugins/ModernOpt/src/mopt_home.cpp | 71 ---- plugins/ModernOpt/src/mopt_ignore.cpp | 53 --- plugins/ModernOpt/src/mopt_selector.cpp | 362 ----------------- plugins/ModernOpt/src/resource.h | 36 -- plugins/ModernOpt/src/stdafx.cxx | 18 - plugins/ModernOpt/src/stdafx.h | 45 --- plugins/ModernOpt/src/version.h | 14 - 10 files changed, 1390 deletions(-) delete mode 100644 plugins/ModernOpt/src/main.cpp delete mode 100644 plugins/ModernOpt/src/modernopt.cpp delete mode 100644 plugins/ModernOpt/src/modernopt.h delete mode 100644 plugins/ModernOpt/src/mopt_home.cpp delete mode 100644 plugins/ModernOpt/src/mopt_ignore.cpp delete mode 100644 plugins/ModernOpt/src/mopt_selector.cpp delete mode 100644 plugins/ModernOpt/src/resource.h delete mode 100644 plugins/ModernOpt/src/stdafx.cxx delete mode 100644 plugins/ModernOpt/src/stdafx.h delete mode 100644 plugins/ModernOpt/src/version.h (limited to 'plugins/ModernOpt/src') diff --git a/plugins/ModernOpt/src/main.cpp b/plugins/ModernOpt/src/main.cpp deleted file mode 100644 index fffb2fc1fb..0000000000 --- a/plugins/ModernOpt/src/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "stdafx.h" - - -HINSTANCE hInst; -int hLangpack; - -PLUGININFOEX pluginInfoEx = { - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {621F886B-A7F6-457F-9D62-8EE84C275993} - {0x621f886b, 0xa7f6, 0x457f, {0x9d, 0x62, 0x8e, 0xe8, 0x4c, 0x27, 0x59, 0x93}} -}; - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// MirandaPluginInfoEx - returns an information about a plugin - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) -{ - return &pluginInfoEx; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// Performs a primary set of actions upon plugin loading - -void LoadModernOptsModule(); - -extern "C" int __declspec(dllexport) Load(void) -{ - - mir_getLP(&pluginInfoEx); - - LoadModernOptsModule(); - return 0; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// Unload a plugin - -void UnloadModernOptsModule(); - -extern "C" int __declspec(dllexport) Unload(void) -{ - UnloadModernOptsModule(); - return 0; -} diff --git a/plugins/ModernOpt/src/modernopt.cpp b/plugins/ModernOpt/src/modernopt.cpp deleted file mode 100644 index 7d27974d92..0000000000 --- a/plugins/ModernOpt/src/modernopt.cpp +++ /dev/null @@ -1,683 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-17 Miranda NG project (https://miranda-ng.org), -Copyright (c) 2000-07 Miranda ICQ/IM project, -Copyright 2007 Artem Shpynov - -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -//#define MOPT_SAMPLE_PAGES - -extern HMODULE hInst; - -static HANDLE hevtModernOpt_Initialize = 0; - -static HWND hwndModernOpt = NULL; -static INT_PTR CALLBACK ModernOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -struct ModernOptionsObject -{ - MODERNOPTOBJECT optObject; - - HWND hwnd; - BOOL bChanged; - DWORD dwFlags; - int iTreeImageIndex; - DWORD dwIdx; -}; - -static DWORD g_dwIdx = 0; -static int g_iSectionRestore = 0; - -static int ModernOptionsObject_Comparator(const ModernOptionsObject *ptr1, const ModernOptionsObject *ptr2); - -struct ModernOptionsData : public MZeroedObject -{ - ModernOptionsData(): pObjectList(1, ModernOptionsObject_Comparator) {} - - LIST pObjectList; - HFONT hfntBold; - int iPage, iSection; -}; - -//////////////////////////////////////////////////////////////////////////////// -// Forwards -static void ModernOptUI_ShowPage(HWND hwndDlg, struct ModernOptionsData *dat, int iPage); -static void ModernOptUI_SelectSection(HWND hwndDlg, struct ModernOptionsData *dat, int iSection); - -//////////////////////////////////////////////////////////////////////////////// -// Main option pages -struct ModernOptMainPageInfo g_ModernOptPages[MODERNOPT_PAGE_COUNT] = -{ - {0, FALSE, IDI_MIRANDA, LPGENW("Home"), LPGENW("Miranda NG configuration center")}, - {IDC_BTN_ACCOUNTS, TRUE, IDI_BIG_NETWORK, LPGENW("Accounts"), LPGENW("Setup your account information to start messaging.")}, - {IDC_BTN_SKINS, TRUE, IDI_BIG_SKINS, LPGENW("Style"), LPGENW("Change the look of Miranda NG according to your taste.")}, - {IDC_BTN_CLIST, TRUE, IDI_BIG_BUDDYLIST, LPGENW("Contacts"), LPGENW("Configure behavior of your contact list.")}, - {IDC_BTN_MESSAGING, TRUE, IDI_BIG_MESSAGE, LPGENW("Chats"), LPGENW("Customize look&&feel of your chat windows here.")}, - {IDC_BTN_IGNORE, TRUE, IDI_BIG_IGNORE, LPGENW("Ignore"), LPGENW("Ban those users and events, you are annoyed with.")}, - {IDC_BTN_STATUS, TRUE, IDI_BIG_STATUS, LPGENW("Status"), LPGENW("Set your status messages and idle reporting.")}, - {IDC_BTN_ADVANCED, TRUE, IDI_BIG_ADVANCED, LPGENW("Advanced"), LPGENW("")}, - {IDC_BTN_PLUGINS, TRUE, IDI_BIG_MODULES, LPGENW("Plugins"), LPGENW("Miranda NG is all about plugins. Manage all the plugins you have here.")}, -}; - -//////////////////////////////////////////////////////////////////////////////// -// Utilities -typedef void (*ItemDestuctor)(void *); - -static void ModernOptionsObject_Dtor(void *ptr) -{ - ModernOptionsObject *obj = (struct ModernOptionsObject *)ptr; - - mir_free(obj->optObject.lptzSubsection); - mir_free(obj->optObject.iBoldControls); - mir_free(obj->optObject.lpzClassicGroup); - mir_free(obj->optObject.lpzClassicPage); - mir_free(obj->optObject.lpzClassicTab); - mir_free(obj->optObject.lpzHelpUrl); - mir_free(obj->optObject.lpzThemeExtension); - mir_free(obj->optObject.lpzThemeModuleName); - - switch (obj->optObject.iType) { - case MODERNOPT_TYPE_IGNOREOBJECT: - mir_free(obj->optObject.lpzIgnoreModule); - mir_free(obj->optObject.lpzIgnoreSetting); - break; - } - - if (obj->hwnd) DestroyWindow(obj->hwnd); - mir_free(obj); -} - -static int ModernOptionsObject_Comparator(const ModernOptionsObject *ptr1, const ModernOptionsObject *ptr2) -{ - struct ModernOptionsObject *obj1 = ((struct ModernOptionsObject *)ptr1); - struct ModernOptionsObject *obj2 = ((struct ModernOptionsObject *)ptr2); - - if (obj1->optObject.iSection < obj2->optObject.iSection) return -1; - if (obj1->optObject.iSection > obj2->optObject.iSection) return +1; - - if (obj1->optObject.iType < obj2->optObject.iType) return -1; - if (obj1->optObject.iType > obj2->optObject.iType) return +1; - - if (obj1->optObject.lptzSubsection && obj2->optObject.lptzSubsection) - { - int c = mir_wstrcmp(obj1->optObject.lptzSubsection, obj2->optObject.lptzSubsection); - if (c) return c; - } - - if (obj1->dwIdx < obj2->dwIdx) return -1; - if (obj1->dwIdx > obj2->dwIdx) return +1; - return 0; -} - -void li_List_Destruct(LIST &pList, ItemDestuctor pItemDestructor) -{ - for (int i=0; ipObjectList.getCount(); ++i) - { - struct ModernOptionsObject *obj = (struct ModernOptionsObject *)dat->pObjectList[i]; - if (obj->hwnd && obj->bChanged) - { - obj->bChanged = FALSE; - pshn.hdr.hwndFrom = obj->hwnd; - SendMessage(obj->hwnd, WM_NOTIFY, 0, (LPARAM)&pshn); - } - } -} - -static INT_PTR CALLBACK ModernOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - struct ModernOptionsData *dat = (struct ModernOptionsData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - - int i; - HWND hwndCtrl; - - switch (msg) { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - - dat = (struct ModernOptionsData *)lParam; - dat->iPage = -1; - - LOGFONT lf; - dat->hfntBold = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0); - GetObject(dat->hfntBold, sizeof(lf), &lf); - lf.lfWeight = FW_BOLD; - dat->hfntBold = CreateFontIndirect(&lf); - - hwndCtrl = GetDlgItem(hwndDlg, IDC_TV_SUBSECTIONS); - HIMAGELIST himl = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 1); - TreeView_SetImageList(hwndCtrl, himl, TVSIL_NORMAL); - - for (i = 0; i < dat->pObjectList.getCount(); ++i) { - struct ModernOptionsObject *obj = (struct ModernOptionsObject *)dat->pObjectList[i]; - if ((obj->optObject.iSection >= 0) && (obj->optObject.iSection < MODERNOPT_PAGE_COUNT)) - g_ModernOptPages[obj->optObject.iSection].bShow = TRUE; - if (obj->optObject.hIcon) - obj->iTreeImageIndex = ImageList_AddIcon(himl, obj->optObject.hIcon); - } - - hwndCtrl = GetDlgItem(hwndDlg, IDC_ICOTABS); - for (i = 0; i < _countof(g_ModernOptPages); ++i) - if (g_ModernOptPages[i].bShow && g_ModernOptPages[i].bShowTab) - { - HICON hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(g_ModernOptPages[i].iIcon), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - MIcoTab_AddItem(hwndCtrl, TranslateW(g_ModernOptPages[i].lpzTitle), hIcon, i, FALSE); - DestroyIcon(hIcon); - } - - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - - if (g_iSectionRestore) - CallService(MS_MODERNOPT_SELECTPAGE, g_iSectionRestore, 0); - else - ModernOptUI_SelectSection(hwndDlg, dat, g_iSectionRestore); - - Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "Options", ""); - - return TRUE; - } - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_ICOTABS: - { - int iPage = MIcoTab_GetItemData(GetDlgItem(hwndDlg, IDC_ICOTABS), lParam); - ModernOptUI_SelectSection(hwndDlg, dat, iPage); - SetFocus(GetDlgItem(hwndDlg, IDC_ICOTABS)); - } - break; - - case IDC_BTN_CLASSICOPT: - PostMessage(hwndDlg, WM_CLOSE, 0, 0); - db_set_b(NULL, "Options", "Expert", 1); - Options_Open(NULL); - break; - - case IDC_BTN_HELP: - { - struct ModernOptionsObject *obj = (struct ModernOptionsObject *)dat->pObjectList[dat->iPage]; - if (obj->optObject.lpzHelpUrl) - Utils_OpenUrl(obj->optObject.lpzHelpUrl); - } - break; - - case IDC_BTN_EXPERT: - if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BTN_APPLY))) { - int idResult = MessageBox(hwndDlg, - TranslateT("You have some unsaved changes here.\n Do you wish to apply settings before switching?"), - L"Miranda NG", MB_ICONQUESTION | MB_YESNOCANCEL); - if (idResult == IDCANCEL) break; - sttNotifyPages(dat, (idResult == IDYES) ? PSN_APPLY : PSN_RESET); - } - - Utils_SaveWindowPosition(hwndDlg, NULL, "Options", ""); - g_iSectionRestore = dat->iSection; - { - struct ModernOptionsObject *obj = (struct ModernOptionsObject *)dat->pObjectList[dat->iPage]; - if (obj->optObject.lpzClassicGroup || obj->optObject.lpzClassicPage) - Options_OpenPage(_A2T(obj->optObject.lpzClassicGroup), _A2T(obj->optObject.lpzClassicPage), _A2T(obj->optObject.lpzClassicTab)); - else - CallService("Options/OptionsCommand", 0, 0); - - PostMessage(hwndDlg, WM_CLOSE, 0, 0); - } - break; - - case IDOK: - sttNotifyPages(dat, PSN_APPLY); - PostMessage(hwndDlg, WM_CLOSE, 0, 0); - break; - - case IDCANCEL: - sttNotifyPages(dat, PSN_RESET); - PostMessage(hwndDlg, WM_CLOSE, 0, 0); - break; - - case IDC_BTN_APPLY: - EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_APPLY), FALSE); - sttNotifyPages(dat, PSN_APPLY); - break; - } - - return TRUE; - - case PSM_CHANGED: - EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_APPLY), TRUE); - for (i = 0; i < dat->pObjectList.getCount(); ++i) { - struct ModernOptionsObject *obj = (struct ModernOptionsObject *)dat->pObjectList[i]; - if (obj->hwnd && IsWindowVisible(obj->hwnd)) - obj->bChanged = TRUE; - } - break; - - case WM_NOTIFY: - { - LPNMHDR lpnmhdr = (LPNMHDR)lParam; - if (lpnmhdr->idFrom == IDC_TV_SUBSECTIONS ) { - LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)lParam; - if (lpnmhdr->code == TVN_SELCHANGED ) { - ModernOptUI_ShowPage(hwndDlg, dat, lpnmtv->itemNew.lParam); - break; - } - break; - } - return TRUE; - } - - case WM_CLOSE: - DestroyWindow(hwndDlg); - hwndModernOpt = 0; - return TRUE; - - case WM_DESTROY: - if (!dat) return TRUE; - li_List_Destruct(dat->pObjectList, ModernOptionsObject_Dtor); - DeleteObject(dat->hfntBold); - ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TV_SUBSECTIONS), NULL, TVSIL_NORMAL)); - Utils_SaveWindowPosition(hwndDlg, NULL, "Options", ""); - delete dat; - } - return FALSE; -} - -//////////////////////////////////////////////////////////////////////////////// -// UI utilities -static HWND ModernOptUI_ShowPage_Impl(HWND hwndDlg, struct ModernOptionsData *dat, int iPage, int dx, HWND hwndInsertAfter) -{ - if ((iPage < 0) || (iPage >= dat->pObjectList.getCount())) - return NULL; - - dat->iPage = iPage; - struct ModernOptionsObject *obj = (struct ModernOptionsObject *)dat->pObjectList[dat->iPage]; - if (!obj->hwnd) { - RECT rc1, rc2; - GetWindowRect(GetDlgItem(hwndDlg, IDC_TV_SUBSECTIONS), &rc1); - GetWindowRect(GetDlgItem(hwndDlg, IDC_TXT_DUMMY), &rc2); - MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc1, 2); - MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc2, 2); - rc1.top += dx; rc2.top += dx; - - obj->hwnd = CreateDialogParamA(obj->optObject.hInstance, obj->optObject.lpzTemplate, hwndDlg, obj->optObject.pfnDlgProc, (LPARAM)&obj->optObject); - if (obj->hwnd) { - DWORD dwShowFlags = - SWP_SHOWWINDOW | - ((obj->optObject.dwFlags & MODEROPT_FLG_NORESIZE) ? SWP_NOSIZE : 0); - - int i = 0; - - if (obj->optObject.iBoldControls) - for (i = 0; obj->optObject.iBoldControls[i]; ++i) { - HWND hwndChild = GetDlgItem(obj->hwnd, obj->optObject.iBoldControls[i]); - if (!hwndChild) continue; - SendMessage(hwndChild, WM_SETFONT, (WPARAM)dat->hfntBold, TRUE); - } - - if (obj->optObject.iType == MODERNOPT_TYPE_SECTIONPAGE) - SetWindowPos(obj->hwnd, hwndInsertAfter, rc1.left, rc1.top, rc2.right-rc1.left, rc2.bottom-rc1.top, dwShowFlags); - else - SetWindowPos(obj->hwnd, hwndInsertAfter, rc2.left, rc2.top, rc2.right-rc2.left, rc2.bottom-rc2.top, dwShowFlags); - - if (obj->optObject.iSection == MODERNOPT_PAGE_IGNORE) { - for (i = 0; i < dat->pObjectList.getCount(); ++i) { - struct ModernOptionsObject *ignoreObj = (struct ModernOptionsObject *)dat->pObjectList[i]; - if (ignoreObj->optObject.iType == MODERNOPT_TYPE_IGNOREOBJECT) - ModernOptIgnore_AddItem(&ignoreObj->optObject); - } } } - } - else ShowWindow(obj->hwnd, SW_SHOW); - - ShowWindow(GetDlgItem(hwndDlg, IDC_BTN_EXPERT), (obj->optObject.lpzClassicGroup || obj->optObject.lpzClassicPage) ? SW_SHOW : SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_BTN_HELP), obj->optObject.lpzHelpUrl ? SW_SHOW : SW_HIDE); - - return obj->hwnd; -} - -static int lstrcmp_null(wchar_t *p1, wchar_t *p2) -{ - if (!p1 && !p2) return 0; - if (!p1) return -1; - if (!p2) return 1; - return mir_wstrcmp(p1, p2); -} - -static void ModernOptUI_ShowPage(HWND hwndDlg, struct ModernOptionsData *dat, int iPage) -{ - HWND hwndInsertAfter = GetDlgItem(hwndDlg, IDC_TV_SUBSECTIONS); - - int dx = 0; - for (int i = 0; i < dat->pObjectList.getCount(); ++i) - if ((dat->pObjectList[i]->optObject.iType == dat->pObjectList[iPage]->optObject.iType) && - (dat->pObjectList[i]->optObject.iSection == dat->pObjectList[iPage]->optObject.iSection) && - !lstrcmp_null(dat->pObjectList[i]->optObject.lptzSubsection, dat->pObjectList[iPage]->optObject.lptzSubsection)) - { - hwndInsertAfter = ModernOptUI_ShowPage_Impl(hwndDlg, dat, i, dx, hwndInsertAfter); - - if (dat->pObjectList[i]->hwnd) { - RECT rcWnd; GetWindowRect(dat->pObjectList[i]->hwnd, &rcWnd); - dx += rcWnd.bottom - rcWnd.top;// + 30; - } - } - else if (dat->pObjectList[i]->hwnd) - { - ShowWindow(dat->pObjectList[i]->hwnd, SW_HIDE); - } -} - -static void ModernOptUI_SelectSection(HWND hwndDlg, struct ModernOptionsData *dat, int iSection) -{ - int iPageType = -1; - - HWND hwndTree = GetDlgItem(hwndDlg, IDC_TV_SUBSECTIONS); - dat->iSection = iSection; - - SendMessage(hwndTree, WM_SETREDRAW, FALSE, 0); - TreeView_DeleteAllItems(hwndTree); - for (int i = 0; i < dat->pObjectList.getCount(); ++i) { - struct ModernOptionsObject *obj = (struct ModernOptionsObject *)dat->pObjectList[i]; - if (obj->optObject.iSection != iSection) continue; - - if ((iPageType < -1) && (iPageType != obj->optObject.iType)) continue; - iPageType = obj->optObject.iType; - - if (obj->optObject.iType == MODERNOPT_TYPE_SECTIONPAGE) { - ModernOptUI_ShowPage(hwndDlg, dat, i); - break; - } - - if (obj->optObject.iType == MODERNOPT_TYPE_SUBSECTIONPAGE) { - TVINSERTSTRUCT tvis = {0}; - tvis.hParent = TVI_ROOT; - tvis.hInsertAfter = TVI_LAST; - tvis.item.mask = TVIF_IMAGE|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; - tvis.item.pszText = TranslateW(obj->optObject.lptzSubsection); - tvis.item.iImage = tvis.item.iSelectedImage = obj->iTreeImageIndex; - tvis.item.lParam = i; - TreeView_InsertItem(hwndTree, &tvis); - } } - - SendMessage(hwndTree, WM_SETREDRAW, TRUE, 0); - - if (iPageType < 0) - return; - - if (iPageType != MODERNOPT_TYPE_SECTIONPAGE) { - ShowWindow(hwndTree, SW_SHOW); - RedrawWindow(hwndTree, NULL, NULL, RDW_INVALIDATE); - TreeView_Select(hwndTree, TreeView_GetRoot(hwndTree), TVGN_CARET); - } - else ShowWindow(hwndTree, SW_HIDE); -} - -//////////////////////////////////////////////////////////////////////////////// -// Services -static INT_PTR svcModernOpt_Impl(WPARAM, LPARAM) -{ - if (!hwndModernOpt) { - ModernOptionsData *dat = new ModernOptionsData; - g_dwIdx = 0; - NotifyEventHooks(hevtModernOpt_Initialize, (WPARAM)dat, 0); - hwndModernOpt = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MODERNOPT), NULL, ModernOptDlgProc, (LPARAM)dat); - ShowWindow(hwndModernOpt, SW_SHOW); - } - else SetForegroundWindow(hwndModernOpt); - - return 0; -} - -static INT_PTR svcModernOpt_Show(WPARAM wParam, LPARAM lParam) -{ - if (db_get_b(NULL, "Options", "Expert", 0)) - return Options_Open(NULL); - - g_iSectionRestore = 0; - return svcModernOpt_Impl(wParam, lParam); -} - -static INT_PTR svcModernOpt_Restore(WPARAM wParam, LPARAM lParam) -{ - if (g_iSectionRestore == 0) return 0; - return svcModernOpt_Impl(wParam, lParam); -} - -static INT_PTR svcModernOpt_SelectPage(WPARAM wParam, LPARAM) -{ - if (!hwndModernOpt) - return 0; - - struct ModernOptionsData *dat = (struct ModernOptionsData *)GetWindowLongPtr(hwndModernOpt, GWLP_USERDATA); - if (!dat) - return 0; - - int nIdx = 0; - for (size_t i = 0; i < MODERNOPT_PAGE_COUNT; ++i) - if (g_ModernOptPages[i].bShow && g_ModernOptPages[i].bShowTab) { - if (i == wParam) { - MIcoTab_SetSel(GetDlgItem(hwndModernOpt, IDC_ICOTABS), nIdx); - break; - } - - ++nIdx; - } - -// ModernOptUI_SelectSection(hwndModernOpt, dat, wParam); - return 0; -} - -static INT_PTR svcModernOpt_AddObject(WPARAM wParam, LPARAM lParam) -{ - struct ModernOptionsData *dat = (struct ModernOptionsData *)wParam; - MODERNOPTOBJECT *obj = (MODERNOPTOBJECT *)lParam; - struct ModernOptionsObject *objCopy = (struct ModernOptionsObject *)mir_calloc(sizeof(struct ModernOptionsObject)); - - objCopy->dwIdx = ++g_dwIdx; - - objCopy->optObject.cbSize = sizeof(MODERNOPTOBJECT); - objCopy->optObject.dwFlags = obj->dwFlags; - objCopy->optObject.hIcon = obj->hIcon; - objCopy->optObject.iSection = obj->iSection; - objCopy->optObject.iType = obj->iType; - objCopy->optObject.hInstance = obj->hInstance; - objCopy->optObject.lpzTemplate = obj->lpzTemplate; - objCopy->optObject.pfnDlgProc = obj->pfnDlgProc; - - if (obj->lpzClassicGroup) objCopy->optObject.lpzClassicGroup = mir_strdup(obj->lpzClassicGroup); - if (obj->lpzClassicPage) objCopy->optObject.lpzClassicPage = mir_strdup(obj->lpzClassicPage); - if (obj->lpzClassicTab) objCopy->optObject.lpzClassicTab = mir_strdup(obj->lpzClassicTab); - if (obj->lpzHelpUrl) objCopy->optObject.lpzHelpUrl = mir_strdup(obj->lpzHelpUrl); - - if (obj->iBoldControls) { - int count = 0; - while (obj->iBoldControls[count++]) ; - objCopy->optObject.iBoldControls = (int *)mir_alloc(sizeof(int) * count); - memcpy(objCopy->optObject.iBoldControls, obj->iBoldControls, sizeof(int) * count); - } - - switch (obj->iType) { - case MODERNOPT_TYPE_SECTIONPAGE: - objCopy->optObject.lptzSubsection = NULL; - break; - - case MODERNOPT_TYPE_SUBSECTIONPAGE: - objCopy->optObject.lptzSubsection = (objCopy->optObject.dwFlags & MODEROPT_FLG_UNICODE) ? - mir_wstrdup(obj->lpwzSubsection) : - mir_a2u(obj->lpzSubsection); - break; - - case MODERNOPT_TYPE_IGNOREOBJECT: - objCopy->optObject.lptzSubsection = (objCopy->optObject.dwFlags & MODEROPT_FLG_UNICODE) ? - mir_wstrdup(obj->lpwzSubsection) : - mir_a2u(obj->lpzSubsection); - objCopy->optObject.lpzIgnoreModule = mir_strdup(obj->lpzIgnoreModule); - objCopy->optObject.lpzIgnoreSetting = mir_strdup(obj->lpzIgnoreSetting); - objCopy->optObject.dwIgnoreBit = obj->dwIgnoreBit; - break; - - case MODERNOPT_TYPE_SELECTORPAGE: - objCopy->optObject.iType = MODERNOPT_TYPE_SUBSECTIONPAGE; - objCopy->optObject.hInstance = hInst; - objCopy->optObject.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT_SKINS); - objCopy->optObject.pfnDlgProc = ModernOptSelector_DlgProc; - objCopy->optObject.lptzSubsection = (objCopy->optObject.dwFlags & MODEROPT_FLG_UNICODE) ? - mir_wstrdup(obj->lpwzSubsection) : - mir_a2u(obj->lpzSubsection); - objCopy->optObject.lpzThemeExtension = mir_strdup(obj->lpzThemeExtension); - objCopy->optObject.lpzThemeModuleName = mir_strdup(obj->lpzThemeModuleName); - break; - } - - dat->pObjectList.insert(objCopy); - return 0; -} - -static int hookModernOpt_Initialize(WPARAM wParam, LPARAM) -{ - static int iBoldControls[] = - { - IDC_TXT_TITLE1, IDC_TXT_TITLE2, IDC_TXT_TITLE3, IDC_TXT_TITLE4, -// IDC_TXT_TITLE5, IDC_TXT_TITLE6, IDC_TXT_TITLE7, IDC_TXT_TITLE8, - MODERNOPT_CTRL_LAST - }; - - MODERNOPTOBJECT obj = {0}; - - obj.cbSize = sizeof(obj); - obj.dwFlags = MODEROPT_FLG_TCHAR; - - obj.hIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); - obj.hInstance = hInst; - - obj.iSection = MODERNOPT_PAGE_HOME; - obj.iType = MODERNOPT_TYPE_SECTIONPAGE; - obj.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT_HOME); - obj.pfnDlgProc = ModernOptHome_DlgProc; - obj.lpzHelpUrl = "https://wiki.miranda-ng.org/"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - - #if defined(_DEBUG) && defined(MOPT_SAMPLE_PAGES) - obj.iSection = MODERNOPT_PAGE_ADVANCED; - obj.iType = MODERNOPT_TYPE_SUBSECTIONPAGE; - obj.lptzSubsection = L"Page 1"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.lptzSubsection = L"Page 2"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.lptzSubsection = L"Page 3"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - - obj.iType = MODERNOPT_TYPE_IGNOREOBJECT; - obj.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); - obj.lptzSubsection = L"Files"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); - obj.lptzSubsection = L"Messages"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.hIcon = Skin_LoadIcon(SKINICON_EVENT_URL); - obj.lptzSubsection = L"URL events"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.hIcon = Skin_LoadIcon(SKINICON_OTHER_TYPING); - obj.lptzSubsection = L"Typing notifications"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.hIcon = Skin_LoadIcon(SKINICON_OTHER_ADDCONTACT); - obj.lptzSubsection = L"Added notifications"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.hIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); - obj.lptzSubsection = L"Auth requests"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - - obj.iSection = MODERNOPT_PAGE_SKINS; - obj.iType = MODERNOPT_TYPE_SECTIONPAGE; - obj.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT_SKINS); - obj.pfnDlgProc = NULL; - obj.iBoldControls = iBoldControls; - obj.lpzHelpUrl = NULL; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - - obj.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT_EMPTY); - obj.pfnDlgProc = NULL; - obj.iBoldControls = 0; - obj.lpzClassicGroup = 0; - obj.lpzClassicPage = 0; - obj.lpzHelpUrl = 0; - - obj.iSection = MODERNOPT_PAGE_CLIST; - obj.iType = MODERNOPT_TYPE_SECTIONPAGE; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - - obj.iSection = MODERNOPT_PAGE_MSGS; - obj.iType = MODERNOPT_TYPE_SECTIONPAGE; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - - obj.iSection = MODERNOPT_PAGE_ADVANCED; - obj.iType = MODERNOPT_TYPE_SUBSECTIONPAGE; - obj.lptzSubsection = L"Page 1"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.lptzSubsection = L"Page 2"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.lptzSubsection = L"Page 3"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - - obj.iSection = MODERNOPT_PAGE_MODULES; - obj.iType = MODERNOPT_TYPE_SUBSECTIONPAGE; - obj.lptzSubsection = L"Configure"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.lptzSubsection = L"Update"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - obj.lptzSubsection = L"Download"; - CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj); - #endif - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// Load module -void LoadModernOptsModule() -{ - CreateServiceFunction(MS_MODERNOPT_SHOW, svcModernOpt_Show); - CreateServiceFunction(MS_MODERNOPT_RESTORE, svcModernOpt_Restore); - CreateServiceFunction(MS_MODERNOPT_SELECTPAGE, svcModernOpt_SelectPage); - CreateServiceFunction(MS_MODERNOPT_ADDOBJECT, svcModernOpt_AddObject); - hevtModernOpt_Initialize = CreateHookableEvent(ME_MODERNOPT_INITIALIZE); - HookEvent(ME_MODERNOPT_INITIALIZE, hookModernOpt_Initialize); -} - -//////////////////////////////////////////////////////////////////////////////// -// Unload module -void UnloadModernOptsModule() -{ - if (hwndModernOpt) - { - DestroyWindow(hwndModernOpt); - hwndModernOpt = 0; - } -} diff --git a/plugins/ModernOpt/src/modernopt.h b/plugins/ModernOpt/src/modernopt.h deleted file mode 100644 index 5921419ece..0000000000 --- a/plugins/ModernOpt/src/modernopt.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-17 Miranda NG project (https://miranda-ng.org), -Copyright (c) 2000-07 Miranda ICQ/IM project, -Copyright (c) 2007 Artem Shpynov - -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef MODERNOPT_H__ -#define MODERNOPT_H__ 1 - -struct ModernOptMainPageInfo -{ - int idcButton; - BOOL bShowTab; - int iIcon; - wchar_t *lpzTitle; - wchar_t *lpzDescription; - int iPageType; - BOOL bShow; -}; - -extern struct ModernOptMainPageInfo g_ModernOptPages[MODERNOPT_PAGE_COUNT]; - -extern HMODULE hInst; - -INT_PTR CALLBACK ModernOptHome_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK ModernOptSelector_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -void ModernOptIgnore_AddItem(MODERNOPTOBJECT *obj); - -#endif // MODERNOPT_H__ diff --git a/plugins/ModernOpt/src/mopt_home.cpp b/plugins/ModernOpt/src/mopt_home.cpp deleted file mode 100644 index a1ac78d79e..0000000000 --- a/plugins/ModernOpt/src/mopt_home.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-17 Miranda NG project (https://miranda-ng.org), -Copyright (c) 2000-07 Miranda ICQ/IM project, -Copyright (c) 2007 Artem Shpynov - -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -extern HMODULE hInst; - -INT_PTR CALLBACK ModernOptHome_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) -{ - int i; - - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - for (i = 0; i < _countof(g_ModernOptPages); ++i) { - if (g_ModernOptPages[i].idcButton) { - HWND hwndCtrl = GetDlgItem(hwndDlg, g_ModernOptPages[i].idcButton); - if (g_ModernOptPages[i].bShow) { - HICON hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(g_ModernOptPages[i].iIcon), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - MDescButton_SetIcon(hwndCtrl, hIcon); - MDescButton_SetTitle(hwndCtrl, TranslateW(g_ModernOptPages[i].lpzTitle)); - MDescButton_SetDescription(hwndCtrl, TranslateW(g_ModernOptPages[i].lpzDescription)); - DestroyIcon(hIcon); - } - else ShowWindow(hwndCtrl, SW_HIDE); - } } - - return FALSE; - - case WM_COMMAND: - switch ( LOWORD(wParam)) { - case IDC_BTN_HELP: - Utils_OpenUrl("https://miranda-ng.org/"); - break; - - default: - for (i = 0; i < _countof(g_ModernOptPages); ++i) { - if (g_ModernOptPages[i].idcButton == LOWORD(wParam)) - { - CallService(MS_MODERNOPT_SELECTPAGE, i, 0); - return TRUE; - } } } - - case WM_DESTROY: - return FALSE; - } - return FALSE; -} diff --git a/plugins/ModernOpt/src/mopt_ignore.cpp b/plugins/ModernOpt/src/mopt_ignore.cpp deleted file mode 100644 index 94ad025944..0000000000 --- a/plugins/ModernOpt/src/mopt_ignore.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-17 Miranda NG project (https://miranda-ng.org), -Copyright (c) 2000-07 Miranda ICQ/IM project, -Copyright (c) 2007 Artem Shpynov - -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -static HWND g_hwndModernOptIgnore = NULL; - -void ModernOptIgnore_AddItem(MODERNOPTOBJECT *obj) -{ - if (g_hwndModernOptIgnore) - SendMessage(g_hwndModernOptIgnore, WM_APP, 0, (LPARAM)obj); -} - -/* -static void ResetListOptions(HWND hwndList) -{ - SendMessage(hwndList, CLM_SETHIDEEMPTYGROUPS, 1, 0); -} - -static void SetAllContactIcons(HWND hwndList, int count) -{ - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - DWORD hItem = SendMessage(hwndList,CLM_FINDCONTACT,hContact,0); - for (int i = 0; i < count; ++i) - SendMessage(hwndList,CLM_SETEXTRAIMAGE,hItem,MAKELPARAM(i, i+1)); - if (!db_get_b(hContact,"CList","Hidden",0)) - SendMessage(hwndList,CLM_SETCHECKMARK,hItem,1); - } -} -*/ \ No newline at end of file diff --git a/plugins/ModernOpt/src/mopt_selector.cpp b/plugins/ModernOpt/src/mopt_selector.cpp deleted file mode 100644 index ec8df93826..0000000000 --- a/plugins/ModernOpt/src/mopt_selector.cpp +++ /dev/null @@ -1,362 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-17 Miranda NG project (https://miranda-ng.org), -Copyright (c) 2000-07 Miranda ICQ/IM project, -Copyright (c) 2007 Artem Shpynov - -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -static void sttApplySkin(MODERNOPTOBJECT *obj, wchar_t *fn) -{ - CallProtoService(obj->lpzThemeModuleName, TS_SKIN_APPLY, NULL, (LPARAM)fn); -} - -static wchar_t *sttGetActiveSkin(MODERNOPTOBJECT *obj) -{ - return ProtoServiceExists(obj->lpzThemeModuleName, TS_SKIN_ACTIVE) ? - (wchar_t*)CallProtoService(obj->lpzThemeModuleName, TS_SKIN_ACTIVE, 0, 0) : 0; -} - -static void sttPreviewSkin(MODERNOPTOBJECT *obj, wchar_t *fn, LPDRAWITEMSTRUCT lps) -{ - if (!fn) return; - - if (ProtoServiceExists(obj->lpzThemeModuleName, TS_SKIN_PREVIEW)) { - CallProtoService(obj->lpzThemeModuleName, TS_SKIN_PREVIEW, (WPARAM)lps, (LPARAM)fn); - return; - } - - HBITMAP hbmPreview = Bitmap_Load(CMStringW(fn) + L".png"); - if (!hbmPreview) - return; - - BITMAP bmp; - GetObject(hbmPreview, sizeof(bmp), &bmp); - - SIZE szDst = { abs(bmp.bmWidth), abs(bmp.bmHeight) }; - if ((szDst.cx > lps->rcItem.right - lps->rcItem.left) || (szDst.cy > lps->rcItem.bottom - lps->rcItem.top)) { - float q = min( - float(lps->rcItem.right - lps->rcItem.left) / szDst.cx, - float(lps->rcItem.bottom - lps->rcItem.top) / szDst.cy); - szDst.cx *= q; - szDst.cy *= q; - } - POINT ptDst = { - (lps->rcItem.left + lps->rcItem.right - szDst.cx) / 2, - (lps->rcItem.top + lps->rcItem.bottom - szDst.cy) / 2 }; - - HDC hdc = CreateCompatibleDC(lps->hDC); - SelectObject(hdc, hbmPreview); - SetStretchBltMode(hdc, HALFTONE); - StretchBlt(lps->hDC, ptDst.x, ptDst.y, szDst.cx, szDst.cy, hdc, 0, 0, abs(bmp.bmWidth), abs(bmp.bmHeight), SRCCOPY); - DeleteDC(hdc); - DeleteObject(hbmPreview); -} - -struct TSkinListItem -{ - wchar_t *path; - wchar_t *title; - wchar_t *filename; - - TSkinListItem(wchar_t *fn) - { - title = mir_wstrdup(fn); - if (wchar_t *p = wcsrchr(title, '.')) - *p = 0; - - wchar_t curPath[MAX_PATH]; - GetCurrentDirectory(_countof(curPath), curPath); - - path = (wchar_t *)mir_alloc(MAX_PATH * sizeof(wchar_t)); - PathToRelativeW(curPath, path); - - size_t length = mir_wstrlen(curPath) + mir_wstrlen(fn) + 2; - filename = (wchar_t *)mir_alloc(length * sizeof(wchar_t)); - mir_snwprintf(filename, length, L"%s\\%s", curPath, fn); - } - - ~TSkinListItem() - { - mir_free(path); - mir_free(title); - mir_free(filename); - } -}; - -struct TSelectorData -{ - MODERNOPTOBJECT *obj; - wchar_t *active; - HBITMAP hbmpPreview; - - TSelectorData() - { - memset(this, 0, sizeof(*this)); - } - ~TSelectorData() - { - mir_free(active); - DeleteObject(hbmpPreview); - } -}; - -static bool CheckExt(wchar_t *fn, wchar_t *ext, int n) -{ - size_t l = mir_wstrlen(fn); - return (l > n) && !mir_wstrcmp(fn + l - n, ext); -} - -static void BuildSkinList(HWND hwndList, wchar_t *szExt, int nExtLength = -1, bool start = true) -{ - if (start) { - static wchar_t mirPath[MAX_PATH]; - GetModuleFileName(NULL, mirPath, _countof(mirPath)); - if (wchar_t *p = wcsrchr(mirPath, '\\')) *p = 0; - SetCurrentDirectory(mirPath); - SendMessage(hwndList, LB_RESETCONTENT, 0, 0); - nExtLength = (int)mir_wstrlen(szExt); - SendMessage(hwndList, WM_SETREDRAW, FALSE, 0); - } - - WIN32_FIND_DATA ffd = { 0 }; - HANDLE h = FindFirstFile(L"*.*", &ffd); - if (h != INVALID_HANDLE_VALUE) { - do { - if (!mir_wstrcmp(ffd.cFileName, L"") || !mir_wstrcmp(ffd.cFileName, L".") || !mir_wstrcmp(ffd.cFileName, L"..")) - continue; - - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - SetCurrentDirectory(ffd.cFileName); - BuildSkinList(hwndList, szExt, nExtLength, false); - SetCurrentDirectory(L".."); - } - else { - if (CheckExt(ffd.cFileName, szExt, nExtLength)) { - TSkinListItem *dat = new TSkinListItem(ffd.cFileName); - DWORD dwItem = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)ffd.cFileName); - SendMessage(hwndList, LB_SETITEMDATA, dwItem, (LPARAM)dat); - } - } - } while (FindNextFile(h, &ffd)); - FindClose(h); - } - - if (start) { - SendMessage(hwndList, WM_SETREDRAW, TRUE, 0); - RedrawWindow(hwndList, NULL, NULL, RDW_INVALIDATE); - } -} - -static void CreatePreview(TSelectorData *sd, wchar_t *fn, LPDRAWITEMSTRUCT lps) -{ - HDC hdc = CreateCompatibleDC(lps->hDC); - sd->hbmpPreview = CreateCompatibleBitmap(lps->hDC, lps->rcItem.right - lps->rcItem.left, lps->rcItem.bottom - lps->rcItem.top); - SelectObject(hdc, sd->hbmpPreview); - - BITMAPINFO bi = { 0 }; - bi.bmiHeader.biSize = sizeof(bi.bmiHeader); - bi.bmiHeader.biWidth = 8; - bi.bmiHeader.biHeight = -8; - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biBitCount = 32; - bi.bmiHeader.biCompression = BI_RGB; - - HBITMAP hBmpBrush = (HBITMAP)CreateDIBSection(0, &bi, DIB_RGB_COLORS, 0, 0, 0); - HDC dcBmp = CreateCompatibleDC(0); - HBITMAP hBmpSave = (HBITMAP)SelectObject(dcBmp, hBmpBrush); - HBRUSH hbr = CreateSolidBrush(RGB(0xcc, 0xcc, 0xcc)); - RECT rc; - SetRect(&rc, 0, 0, 8, 8); - FillRect(dcBmp, &rc, hbr); - DeleteObject(hbr); - hbr = CreateSolidBrush(RGB(0xff, 0xff, 0xff)); - SetRect(&rc, 4, 0, 8, 4); - FillRect(dcBmp, &rc, hbr); - SetRect(&rc, 0, 4, 4, 8); - FillRect(dcBmp, &rc, hbr); - DeleteObject(hbr); - SelectObject(dcBmp, hBmpSave); - DeleteDC(dcBmp); - - rc = lps->rcItem; - OffsetRect(&rc, -rc.left, -rc.top); - hbr = CreatePatternBrush(hBmpBrush); - SetBrushOrgEx(hdc, 1, 1, 0); - FillRect(hdc, &rc, hbr); - DeleteObject(hbr); - DeleteObject(hBmpBrush); - - HDC hdcSave = lps->hDC; - lps->hDC = hdc; - sttPreviewSkin(sd->obj, fn, lps); - lps->hDC = hdcSave; - - FrameRect(hdc, &rc, GetStockBrush(LTGRAY_BRUSH)); - DeleteDC(hdc); -} - -INT_PTR CALLBACK ModernOptSelector_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - TSelectorData *sd = (TSelectorData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - - switch (msg) { - case WM_INITDIALOG: - sd = new TSelectorData; - sd->obj = (MODERNOPTOBJECT*)lParam; - sd->active = sttGetActiveSkin(sd->obj); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)sd); - - BuildSkinList(GetDlgItem(hwndDlg, IDC_SKINLIST), _A2T(sd->obj->lpzThemeExtension)); - return FALSE; - - case WM_COMMAND: - if (LOWORD(wParam) == IDC_SKINLIST) { - switch (HIWORD(wParam)) { - case LBN_SELCHANGE: - DeleteObject(sd->hbmpPreview); - sd->hbmpPreview = 0; - RedrawWindow(GetDlgItem(hwndDlg, IDC_PREVIEW1), NULL, NULL, RDW_INVALIDATE); - break; - - case LBN_DBLCLK: - int idx = SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETCURSEL, 0, 0); - if (idx >= 0) { - TSkinListItem *dat = (TSkinListItem *)SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETITEMDATA, idx, 0); - sttApplySkin(sd->obj, dat->filename); - mir_free(sd->active); - sd->active = sttGetActiveSkin(sd->obj); - RedrawWindow(GetDlgItem(hwndDlg, IDC_SKINLIST), NULL, NULL, RDW_INVALIDATE); - } - break; - } - break; - } - return FALSE; - - case WM_MEASUREITEM: - { - LPMEASUREITEMSTRUCT lps = (LPMEASUREITEMSTRUCT)lParam; - if (lps->CtlID != IDC_SKINLIST) - break; - TSkinListItem *dat = (TSkinListItem *)lps->itemData; - if (!dat) break; - - lps->itemWidth = 10; - lps->itemHeight = 30; - - return FALSE; - } - - case WM_DRAWITEM: - { - LPDRAWITEMSTRUCT lps = (LPDRAWITEMSTRUCT)lParam; - if (lps->CtlID == IDC_SKINLIST) { - TSkinListItem *dat = (TSkinListItem *)lps->itemData; - if (!dat) break; - - SetBkMode(lps->hDC, TRANSPARENT); - COLORREF clLine1, clLine2, clBack; - if (lps->itemState & ODS_SELECTED) { - FillRect(lps->hDC, &lps->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT)); - clBack = GetSysColor(COLOR_HIGHLIGHT); - clLine1 = GetSysColor(COLOR_HIGHLIGHTTEXT); - } - else { - FillRect(lps->hDC, &lps->rcItem, GetSysColorBrush(COLOR_WINDOW)); - clBack = GetSysColor(COLOR_WINDOW); - clLine1 = GetSysColor(COLOR_WINDOWTEXT); - } - clLine2 = RGB( - GetRValue(clLine1) * 0.66 + GetRValue(clBack) * 0.34, - GetGValue(clLine1) * 0.66 + GetGValue(clBack) * 0.34, - GetBValue(clLine1) * 0.66 + GetBValue(clBack) * 0.34); - - lps->rcItem.left += 2; - lps->rcItem.top += 2; - lps->rcItem.bottom -= 2; - lps->rcItem.right -= 5; - - int cxIcon = GetSystemMetrics(SM_CXSMICON); - int cyIcon = GetSystemMetrics(SM_CYSMICON); - - if (sd->active && !mir_wstrcmp(sd->active, dat->filename)) { - DrawIconEx(lps->hDC, lps->rcItem.left, (lps->rcItem.top + lps->rcItem.bottom - cyIcon) / 2, - Skin_LoadIcon(SKINICON_OTHER_EMPTYBLOB), - cxIcon, cyIcon, 0, NULL, DI_NORMAL); - } - else { - DrawIconEx(lps->hDC, lps->rcItem.left, (lps->rcItem.top + lps->rcItem.bottom - cyIcon) / 2, - Skin_LoadIcon(SKINICON_OTHER_SMALLDOT), - cxIcon, cyIcon, 0, NULL, DI_NORMAL); - } - lps->rcItem.left += cxIcon; - lps->rcItem.left += 5; - - SetTextColor(lps->hDC, clLine1); - DrawText(lps->hDC, dat->title, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS | DT_TOP); - lps->rcItem.left += cxIcon; - - SetTextColor(lps->hDC, clLine2); - DrawText(lps->hDC, dat->path, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_PATH_ELLIPSIS | DT_BOTTOM); - } - else if (lps->CtlID == IDC_PREVIEW1) { - int idx = SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETCURSEL, 0, 0); - - if (!sd->hbmpPreview) { - if (idx >= 0) { - TSkinListItem *dat = (TSkinListItem *)SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETITEMDATA, idx, 0); - CreatePreview(sd, dat->filename, lps); - } - else CreatePreview(sd, NULL, lps); - } - - if (sd->hbmpPreview) { - HDC hdc = CreateCompatibleDC(lps->hDC); - SelectObject(hdc, sd->hbmpPreview); - BitBlt(lps->hDC, - lps->rcItem.left, lps->rcItem.top, - lps->rcItem.right - lps->rcItem.left, lps->rcItem.bottom - lps->rcItem.top, - hdc, 0, 0, SRCCOPY); - DeleteDC(hdc); - } - } - - return TRUE; - } - - case WM_DELETEITEM: - { - LPDELETEITEMSTRUCT lps = (LPDELETEITEMSTRUCT)lParam; - if (lps->CtlID != IDC_SKINLIST) break; - TSkinListItem *dat = (TSkinListItem *)lps->itemData; - if (dat) delete dat; - return FALSE; - } - - case WM_DESTROY: - delete sd; - return FALSE; - } - return FALSE; -} diff --git a/plugins/ModernOpt/src/resource.h b/plugins/ModernOpt/src/resource.h deleted file mode 100644 index de4fbab2e0..0000000000 --- a/plugins/ModernOpt/src/resource.h +++ /dev/null @@ -1,36 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// - -#define IDD_MODERNOPT_EMPTY 206 -#define IDD_MODERNOPT 216 -#define IDD_MODERNOPT_HOME 219 -#define IDD_MODERNOPT_SKINS 220 - -#define IDI_BIG_ADVANCED 308 -#define IDI_BIG_BUDDYLIST 309 -#define IDI_BIG_IGNORE 310 -#define IDI_BIG_MESSAGE 311 -#define IDI_BIG_MODULES 312 -#define IDI_BIG_NETWORK 313 -#define IDI_BIG_SKINS 314 -#define IDI_BIG_STATUS 315 - -#define IDC_BTN_HELP 1001 -#define IDC_BTN_CLASSICOPT 1002 -#define IDC_BTN_ACCOUNTS 1004 -#define IDC_BTN_SKINS 1005 -#define IDC_BTN_CLIST 1006 -#define IDC_BTN_MESSAGING 1007 -#define IDC_BTN_IGNORE 1008 -#define IDC_BTN_STATUS 1009 -#define IDC_BTN_ADVANCED 1010 -#define IDC_BTN_PLUGINS 1011 -#define IDC_TV_SUBSECTIONS 1012 -#define IDC_ICOTABS 1013 -#define IDC_BTN_EXPERT 1015 -#define IDC_BTN_APPLY 1016 -#define IDC_TXT_DUMMY 1017 -#define IDC_SKINLIST 1029 -#define IDC_PREVIEW1 1030 diff --git a/plugins/ModernOpt/src/stdafx.cxx b/plugins/ModernOpt/src/stdafx.cxx deleted file mode 100644 index b05ed73bc5..0000000000 --- a/plugins/ModernOpt/src/stdafx.cxx +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-17 Miranda NG project (https://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "stdafx.h" \ No newline at end of file diff --git a/plugins/ModernOpt/src/stdafx.h b/plugins/ModernOpt/src/stdafx.h deleted file mode 100644 index a7087d7ce7..0000000000 --- a/plugins/ModernOpt/src/stdafx.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-17 Miranda NG project (https://miranda-ng.org), -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "resource.h" -#include "version.h" -#include "modernopt.h" -#include "../../../src/mir_app/src/resource.h" diff --git a/plugins/ModernOpt/src/version.h b/plugins/ModernOpt/src/version.h deleted file mode 100644 index 0e8a857e5d..0000000000 --- a/plugins/ModernOpt/src/version.h +++ /dev/null @@ -1,14 +0,0 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 1 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 0 - -#include - -#define __PLUGIN_NAME "ModernOpt" -#define __FILENAME "ModernOpt.dll" -#define __DESCRIPTION "Support for new options design." -#define __AUTHOR "Victor Pavlychko, George Hazan" -#define __AUTHOREMAIL "ghazan@miranda-ng.org" -#define __AUTHORWEB "https://miranda-ng.org/p/ModernOpt/" -#define __COPYRIGHT "© 2009 Victor Pavlychko, George Hazan" -- cgit v1.2.3