diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 8 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.h | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcopts.cpp | 50 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistevents.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_toolbar.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_viewmodebar.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/stdafx.h | 10 | ||||
-rw-r--r-- | plugins/ExternalAPI/m_skin_eng.h | 9 | ||||
-rw-r--r-- | plugins/TopToolBar/TopToolBar.vcxproj | 1 | ||||
-rw-r--r-- | plugins/TopToolBar/TopToolBar.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/TopToolBar/src/BkgrCfg.h | 20 | ||||
-rw-r--r-- | plugins/TopToolBar/src/stdafx.h | 2 | ||||
-rw-r--r-- | plugins/TopToolBar/src/toolbar.cpp | 7 |
13 files changed, 40 insertions, 78 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 4d92425f45..69ecf3ad18 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1615,10 +1615,10 @@ static int clcHookModulesLoaded(WPARAM, LPARAM) for (auto &hContact : Contacts())
SetRateExtraIcon(hContact, -1, FALSE);
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("List background")"/CLC"), 0);
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Menu background")"/Menu"), 0);
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Status bar background")"/StatusBar"), 0);
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"), 0);
+ BackgroundConfig_Register(LPGEN("List background")"/CLC");
+ BackgroundConfig_Register(LPGEN("Menu background")"/Menu");
+ BackgroundConfig_Register(LPGEN("Status bar background")"/StatusBar");
+ BackgroundConfig_Register(LPGEN("Frames title bar background")"/FrameTitleBar");
HookEvent(ME_BACKGROUNDCONFIG_CHANGED, clcHookBkgndConfigChanged);
HookEvent(ME_BACKGROUNDCONFIG_CHANGED, BgStatusBarChange);
diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h index c0956ee8cd..4d06174025 100644 --- a/plugins/Clist_modern/src/modern_clc.h +++ b/plugins/Clist_modern/src/modern_clc.h @@ -57,8 +57,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INTM_AVATARCHANGED (WM_USER+28)
#define INTM_TIMEZONECHANGED (WM_USER+29)
-#define CLBF_TILEVTOROWHEIGHT 0x0100
-
#define TIMERID_SUBEXPAND 21
#define TIMERID_INVALIDATE 22
#define TIMERID_RECALCSCROLLBAR 26
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 33f7ef7972..f10ff33484 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -1168,8 +1168,14 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP #define DEFAULT_BKBMPUSE CLB_STRETCH
#define DEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT)
-char **bkgrList = nullptr;
-int bkgrCount = 0;
+struct BkgrInternal
+{
+ ptrW wszDescr;
+ ptrA szModule;
+ HPLUGIN hPlugin;
+};
+
+static OBJLIST<BkgrInternal> g_arBkrg(1);
#define M_BKGR_UPDATE (WM_USER+10)
#define M_BKGR_SETSTATE (WM_USER+11)
@@ -1195,6 +1201,7 @@ struct BkgrItem uint16_t flags;
uint8_t useWinColours;
};
+
struct BkgrData
{
struct BkgrItem *item;
@@ -1214,11 +1221,11 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, dat = (struct BkgrData*)mir_alloc(sizeof(struct BkgrData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
- dat->count = bkgrCount;
+ dat->count = g_arBkrg.getCount();
dat->item = (struct BkgrItem*)mir_alloc(sizeof(struct BkgrItem)*dat->count);
dat->indx = CB_ERR;
for (indx = 0; indx < dat->count; indx++) {
- char *module = bkgrList[indx] + mir_strlen(bkgrList[indx]) + 1;
+ char *module = g_arBkrg[indx].szModule;
int jndx;
dat->item[indx].changed = FALSE;
@@ -1237,7 +1244,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, else *dat->item[indx].filename = 0;
dat->item[indx].flags = db_get_w(0, module, "BkBmpUse", DEFAULT_BKBMPUSE);
- jndx = SendMessageA(hList, CB_ADDSTRING, 0, (LPARAM)Translate(bkgrList[indx]));
+ jndx = SendMessageW(hList, CB_ADDSTRING, 0, (LPARAM)TranslateW_LP(g_arBkrg[indx].wszDescr, g_arBkrg[indx].hPlugin));
SendMessage(hList, CB_SETITEMDATA, jndx, indx);
}
SendMessage(hList, CB_SETCURSEL, 0, 0);
@@ -1383,7 +1390,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (!p.changed)
continue;
- char *module = bkgrList[indx] + mir_strlen(bkgrList[indx]) + 1;
+ char *module = g_arBkrg[indx].szModule;
db_set_b(0, module, "UseBitmap", (uint8_t)p.useBitmap);
COLORREF col;
@@ -1420,38 +1427,29 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, static INT_PTR BkgrCfg_Register(WPARAM wParam, LPARAM lParam)
{
- char *szSetting = (char*)wParam;
- size_t len = mir_strlen(szSetting) + 1;
-
- char *value = (char *)mir_alloc(len + 4); // add room for flags (uint32_t)
- memcpy(value, szSetting, len);
- char *tok = strchr(value, '/');
- if (tok == nullptr) {
- mir_free(value);
+ char *szSetting = NEWSTR_ALLOCA((char *)wParam);
+ char *tok = strchr(szSetting, '/');
+ if (tok == nullptr)
return 1;
- }
- *tok = 0;
- *(uint32_t*)(value + len) = lParam;
- bkgrList = (char **)mir_realloc(bkgrList, sizeof(char*)*(bkgrCount + 1));
- bkgrList[bkgrCount] = value;
- bkgrCount++;
+ *tok = 0;
+ auto *pNew = new BkgrInternal();
+ pNew->wszDescr = mir_a2u(szSetting);
+ pNew->szModule = mir_strdup(tok + 1);
+ pNew->hPlugin = (HPLUGIN)lParam;
+ g_arBkrg.insert(pNew);
return 0;
}
HRESULT BackgroundsLoadModule()
{
- CreateServiceFunction(MS_BACKGROUNDCONFIG_REGISTER, BkgrCfg_Register);
+ CreateServiceFunction("ModernBkgrCfg/Register", BkgrCfg_Register);
return S_OK;
}
int BackgroundsUnloadModule(void)
{
- if (bkgrList != nullptr) {
- for (int indx = 0; indx < bkgrCount; indx++)
- mir_free(bkgrList[indx]);
- mir_free(bkgrList);
- }
+ g_arBkrg.destroy();
DestroyHookableEvent(g_CluiData.hEventBkgrChanged);
g_CluiData.hEventBkgrChanged = nullptr;
return 0;
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index a578a69a29..403fc548de 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -455,7 +455,7 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP int EventArea_Create(HWND hCluiWnd)
{
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Event area background")"/EventArea"), 0);
+ BackgroundConfig_Register(LPGEN("Event area background")"/EventArea");
HookEvent(ME_BACKGROUNDCONFIG_CHANGED, ehhEventAreaBackgroundSettingsChanged);
ehhEventAreaBackgroundSettingsChanged(0, 0);
diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index fc5ab73936..774e10335a 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -321,7 +321,7 @@ static int Toolbar_ModuleReloaded(WPARAM wParam, LPARAM) static int Toolbar_ModulesLoaded(WPARAM, LPARAM)
{
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Toolbar background")"/ToolBar"), 0);
+ BackgroundConfig_Register(LPGEN("Toolbar background")"/ToolBar");
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ehhToolBarSettingsChanged);
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index a6239a2a5a..e267f41c2d 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -1190,7 +1190,7 @@ static int ViewModePaintCallbackProc(HWND hWnd, HDC hDC, RECT *, HRGN, uint32_t, void CreateViewModeFrame()
{
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("View mode background")"/ViewMode"), 0);
+ BackgroundConfig_Register(LPGEN("View mode background")"/ViewMode");
HookEvent(ME_BACKGROUNDCONFIG_CHANGED, ehhViewModeBackgroundSettingsChanged);
ehhViewModeBackgroundSettingsChanged(0, 0);
diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h index e00671a124..cc2ce1371c 100644 --- a/plugins/Clist_modern/src/stdafx.h +++ b/plugins/Clist_modern/src/stdafx.h @@ -161,16 +161,6 @@ extern wchar_t SkinsFolder[MAX_PATH]; char* __cdecl strstri(char *a, const char *b);
-// Register of plugin's user
-//
-// wParam = (WPARAM)szSetting - string that describes a user
-// format: Category/ModuleName,
-// eg: "Contact list background/CLUI",
-// "Status bar background/StatusBar"
-// lParam = (LPARAM)dwFlags
-//
-#define MS_BACKGROUNDCONFIG_REGISTER "ModernBkgrCfg/Register"
-
//
// Notification about changed background
// wParam = ModuleName
diff --git a/plugins/ExternalAPI/m_skin_eng.h b/plugins/ExternalAPI/m_skin_eng.h index 6ea48aced9..bed802b4f9 100644 --- a/plugins/ExternalAPI/m_skin_eng.h +++ b/plugins/ExternalAPI/m_skin_eng.h @@ -55,6 +55,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ST_FRAGMENT 5
#define ST_GRADIENT 6
+#define CLBF_TILEVTOROWHEIGHT 0x0100
+
//formats:
#define ADT_TOP 0x00000000
#define ADT_LEFT 0x00000000
@@ -425,10 +427,11 @@ int __inline mod_DrawIconEx_helper(HDC hdc, int xLeft, int yTop, HICON hIcon, in // format: Category/ModuleName,
// eg: "Contact list background/CLUI",
// "Status bar background/StatusBar"
-// lParam = (LPARAM)dwFlags
-//
-#define MS_BACKGROUNDCONFIG_REGISTER "ModernBkgrCfg/Register"
+void __forceinline BackgroundConfig_Register(const char *pszModule)
+{
+ CallService("ModernBkgrCfg/Register", (WPARAM)pszModule, (LPARAM)&g_plugin);
+}
////////////////////////////////////////////////////////////////////////////////
// Notification about changed background
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj b/plugins/TopToolBar/TopToolBar.vcxproj index b946dc01b6..c6790f3174 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj +++ b/plugins/TopToolBar/TopToolBar.vcxproj @@ -35,7 +35,6 @@ <ClCompile Include="src\toolbarwnd.cpp" />
<ClCompile Include="src\topbutton.cpp" />
<ClCompile Include="src\ttbopt.cpp" />
- <ClInclude Include="src\BkgrCfg.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\stdafx.h" />
<ClInclude Include="src\version.h" />
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj.filters b/plugins/TopToolBar/TopToolBar.vcxproj.filters index 8ebf36fae1..a121160476 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj.filters +++ b/plugins/TopToolBar/TopToolBar.vcxproj.filters @@ -25,9 +25,6 @@ </ClCompile>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="src\BkgrCfg.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/TopToolBar/src/BkgrCfg.h b/plugins/TopToolBar/src/BkgrCfg.h deleted file mode 100644 index 9d50386bae..0000000000 --- a/plugins/TopToolBar/src/BkgrCfg.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once
-
-//
-// Register of plugin's user
-//
-// wParam = (WPARAM)szSetting - string that describes a user
-// format: Category/ModuleName,
-// eg: "Contact list background/CLUI",
-// "Status bar background/StatusBar"
-// lParam = (LPARAM)dwFlags
-//
-#define MS_BACKGROUNDCONFIG_REGISTER "BkgrCfg/Register"
-
-//
-// Notification about changed background
-// wParam = ModuleName
-// lParam = 0
-#define ME_BACKGROUNDCONFIG_CHANGED "BkgrCfg/Changed"
-
-#define CLBF_TILEVTOROWHEIGHT 0x0100
diff --git a/plugins/TopToolBar/src/stdafx.h b/plugins/TopToolBar/src/stdafx.h index 9f1442acf8..c684fb65ec 100644 --- a/plugins/TopToolBar/src/stdafx.h +++ b/plugins/TopToolBar/src/stdafx.h @@ -17,11 +17,11 @@ #include <m_button.h> #include <m_icolib.h> +#include <m_skin_eng.h> #include <m_toptoolbar.h> #include "resource.h" #include "version.h" -#include "BkgrCfg.h" #define TTB_BUTTON_CLASS L"TopToolbarButtonClass" diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index f7eb887558..2176783277 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -581,11 +581,8 @@ static int OnModulesLoad(WPARAM, LPARAM) Miranda_WaitOnHandle(OnEventFire);
- if (HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnBGChange)) {
- char buf[256];
- mir_snprintf(buf, "%s/%s", LPGEN("TopToolBar background"), TTB_OPTDIR);
- CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)buf, 0);
- }
+ if (HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnBGChange))
+ BackgroundConfig_Register(LPGEN("TopToolBar background") "/" TTB_OPTDIR);
return 0;
}
|