From c13392f8596e858110dc4c61fbdf1d41e47cc8a9 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Mon, 21 Apr 2014 17:39:45 +0000 Subject: - Added lParam to POPUPCLASS - Removed MS_POPUP_ISSECONDLINESHOWN - Support for mutating popups in Facebook git-svn-id: http://svn.miranda-ng.org/main/trunk@9021 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/font.cpp | 48 ++++++++++++++++++------------------ plugins/Popup/src/font.h | 16 ++++++------ plugins/Popup/src/main.cpp | 1 - plugins/Popup/src/services.cpp | 55 +++++++++++++++++++----------------------- 4 files changed, 57 insertions(+), 63 deletions(-) (limited to 'plugins/Popup') diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index fca4c1cf12..df6e1640ca 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -34,35 +34,35 @@ void InitFonts() { fid.flags = FIDF_DEFAULTVALID; fid.deffontsettings.charset = DEFAULT_CHARSET; fid.deffontsettings.size = -11; - lstrcpy(fid.backgroundGroup,_T(PU_FNT_AND_COLOR)); - lstrcpy(fid.backgroundName,_T(PU_COL_BACK_NAME)); - lstrcpy(fid.deffontsettings.szFace, _T("Tahoma")); + lstrcpyn(fid.backgroundGroup,_T(PU_FNT_AND_COLOR), SIZEOF(fid.backgroundGroup)); + lstrcpyn(fid.backgroundName,PU_COL_BACK_NAME, SIZEOF(fid.backgroundName)); + lstrcpyn(fid.deffontsettings.szFace, _T("Tahoma"), SIZEOF(fid.deffontsettings.szFace)); - lstrcpy(fid.name, _T(PU_FNT_NAME_TITLE)); + lstrcpyn(fid.name, PU_FNT_NAME_TITLE, SIZEOF(fid.name)); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE); fid.deffontsettings.style = DBFONTF_BOLD; fid.deffontsettings.colour = RGB(0,0,0); FontRegisterT(&fid); - lstrcpy(fid.name, _T(PU_FNT_NAME_CLOCK)); + lstrcpyn(fid.name, PU_FNT_NAME_CLOCK, SIZEOF(fid.name)); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK); //fid.deffontsettings.style = DBFONTF_BOLD; //fid.deffontsettings.colour = RGB(0,0,0); FontRegisterT(&fid); - lstrcpy(fid.name, _T(PU_FNT_NAME_TEXT)); + lstrcpyn(fid.name, PU_FNT_NAME_TEXT, SIZEOF(fid.name)); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT); fid.deffontsettings.style = 0; //fid.deffontsettings.colour = RGB(0,0,0); FontRegisterT(&fid); - lstrcpy(fid.name, _T("Action")); + lstrcpyn(fid.name, _T("Action"), SIZEOF(fid.name)); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, "Action"); //fid.deffontsettings.style = 0; fid.deffontsettings.colour = RGB(0,0,255); FontRegisterT(&fid); - lstrcpy(fid.name, LPGENT("Hovered Action")); + lstrcpyn(fid.name, LPGENT("Hovered Action"), SIZEOF(fid.name)); mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, "Hovered Action"); fid.deffontsettings.style = DBFONTF_UNDERLINE; //fid.deffontsettings.colour = RGB(0,0,255); @@ -70,16 +70,16 @@ void InitFonts() { ColourIDT cid = {0}; cid.cbSize = sizeof(ColourIDT); - lstrcpy(cid.group, _T(PU_FNT_AND_COLOR)); - strcpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB); + lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group)); + strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(cid.dbSettingsGroup)); - lstrcpy(cid.name, _T(PU_COL_BACK_NAME)); - strcpy(cid.setting, PU_COL_BACK_SETTING); + lstrcpyn(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name)); + strncpy(cid.setting, PU_COL_BACK_SETTING, SIZEOF(cid.setting)); cid.defcolour = SETTING_BACKCOLOUR_DEFAULT; ColourRegisterT(&cid); - lstrcpy(cid.name, _T(PU_COL_AVAT_NAME)); - strcpy(cid.setting, PU_COL_AVAT_SETTING); + lstrcpyn(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name)); + strncpy(cid.setting, PU_COL_AVAT_SETTING, SIZEOF(cid.setting)); cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT; ColourRegisterT(&cid); @@ -98,36 +98,36 @@ void ReloadFonts() LOGFONT lf = {0}; FontIDT fid = {0}; fid.cbSize = sizeof(FontIDT); - lstrcpy(fid.group, _T(PU_FNT_AND_COLOR)); + lstrcpyn(fid.group, _T(PU_FNT_AND_COLOR),SIZEOF(fid.name)); - lstrcpy(fid.name, _T(PU_FNT_NAME_TITLE)); + lstrcpyn(fid.name, PU_FNT_NAME_TITLE,SIZEOF(fid.name)); fonts.clTitle = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.title = CreateFontIndirect(&lf); - lstrcpy(fid.name, LPGENT("Clock")); + lstrcpyn(fid.name, LPGENT("Clock"),SIZEOF(fid.name)); fonts.clClock = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.clock = CreateFontIndirect(&lf); - lstrcpy(fid.name, _T(PU_FNT_NAME_TEXT)); + lstrcpyn(fid.name, PU_FNT_NAME_TEXT,SIZEOF(fid.name)); fonts.clText = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.text = CreateFontIndirect(&lf); - lstrcpy(fid.name, _T("Action")); + lstrcpyn(fid.name, LPGENT("Action"),SIZEOF(fid.name)); fonts.clAction = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.action = CreateFontIndirect(&lf); - lstrcpy(fid.name, LPGENT("Hovered Action")); + lstrcpyn(fid.name, LPGENT("Hovered Action"),SIZEOF(fid.name)); fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.actionHover = CreateFontIndirect(&lf); ColourIDT cid = {0}; cid.cbSize = sizeof(ColourIDT); - lstrcpy(cid.group, _T(PU_FNT_AND_COLOR)); - lstrcpy(cid.name, _T(PU_COL_BACK_NAME)); + lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR),SIZEOF(cid.group)); + lstrcpyn(cid.name, PU_COL_BACK_NAME,SIZEOF(cid.name)); fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf); - lstrcpy(cid.group, _T(PU_FNT_AND_COLOR)); - lstrcpy(cid.name, _T(PU_COL_AVAT_NAME)); + lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR),SIZEOF(cid.group)); + lstrcpyn(cid.name, PU_COL_AVAT_NAME,SIZEOF(cid.name)); fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf); //update class popupps(only temp at this point, must rework) diff --git a/plugins/Popup/src/font.h b/plugins/Popup/src/font.h index 13674ddd2b..c22a08811f 100644 --- a/plugins/Popup/src/font.h +++ b/plugins/Popup/src/font.h @@ -29,19 +29,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PU_FNT_AND_COLOR_DB MODULNAME //use eg strcpy(fid.dbSettingsGroup, PU_FNT_GROUP_DB); #define PU_FNT_PREFIX "fnt%s" //use eg mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_....); -#define PU_FNT_NAME_TITLE "Title" //use eg lstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT -#define PU_FNT_NAME_CLOCK "Clock" -#define PU_FNT_NAME_TEXT "Text" +#define PU_FNT_NAME_TITLE LPGENT("Title") //use eg lstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT +#define PU_FNT_NAME_CLOCK LPGENT("Clock") +#define PU_FNT_NAME_TEXT LPGENT("Text") -#define PU_COL_BACK_NAME "Background" +#define PU_COL_BACK_NAME LPGENT("Background") #define PU_COL_BACK_SETTING "ColourBg" -#define PU_COL_BORD_NAME "Border" +#define PU_COL_BORD_NAME LPGENT("Border") #define PU_COL_BORD_SETTING "ColourBorder" -#define PU_COL_SIDE_NAME "Sidebar" +#define PU_COL_SIDE_NAME LPGENT("Sidebar") #define PU_COL_SIDE_SETTING "ColourSidebar" -#define PU_COL_LINE_NAME "Title underline" +#define PU_COL_LINE_NAME LPGENT("Title underline") #define PU_COL_LINE_SETTING "ColourUnderline" -#define PU_COL_AVAT_NAME "Avatar Border" +#define PU_COL_AVAT_NAME LPGENT("Avatar Border") #define PU_COL_AVAT_SETTING "ColourAvatarBorder" struct PopupFonts diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 752ac6765b..eba19300b5 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -387,7 +387,6 @@ MIRAPI int Load(void) CreateServiceFunction(MS_POPUP_GETCONTACT, Popup_GetContact); CreateServiceFunction(MS_POPUP_GETPLUGINDATA, Popup_GetPluginData); - CreateServiceFunction(MS_POPUP_ISSECONDLINESHOWN, Popup_IsSecondLineShown); CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage); CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW); diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index e5e6f51687..f9d69ab9a8 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -187,12 +187,6 @@ INT_PTR Popup_GetPluginData(WPARAM wParam, LPARAM lParam) return (INT_PTR)(-1); } -//===== Popup/IsSecondLineShown -INT_PTR Popup_IsSecondLineShown(WPARAM wParam, LPARAM lParam) -{ - return 1; -} - //===== Popup/ChangeTextW INT_PTR Popup_ChangeTextW(WPARAM wParam, LPARAM lParam) { @@ -307,7 +301,7 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam) { } //===== Popup/Query -INT_PTR Popup_Query(WPARAM wParam, LPARAM lParam) +INT_PTR Popup_Query(WPARAM wParam, LPARAM) { if (!gbPopupLoaded) return -1; @@ -348,7 +342,7 @@ INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam) } -INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM lParam) +INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM) { return (INT_PTR)RegisterNotification((LPPOPUPNOTIFICATION)wParam); } @@ -386,7 +380,7 @@ INT_PTR Popup_RegisterVfx(WPARAM wParam, LPARAM lParam) } //===== Popup/RegisterClass (for core class api support) -INT_PTR Popup_RegisterPopupClass(WPARAM wParam, LPARAM lParam) +INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) { char setting[256]; POPUPCLASS *pc = (POPUPCLASS *)lParam; @@ -410,39 +404,39 @@ INT_PTR Popup_RegisterPopupClass(WPARAM wParam, LPARAM lParam) //we ignore pc->colorText and use fonts.text as default (if no setting found in DB) mir_snprintf(setting, 256, "%s/TextCol", ptd->pupClass.pszName); ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/); - FontID fid = {0}; - fid.cbSize = sizeof(FontID); - mir_snprintf(fid.group, sizeof(fid.group), "%s/%s", PU_FNT_AND_COLOR, ptd->pupClass.pszName); + FontIDT fid = {0}; + fid.cbSize = sizeof(FontIDT); + mir_sntprintf(fid.group, SIZEOF(fid.group), _T("%s/%S"), PU_FNT_AND_COLOR, ptd->pupClass.pszName); strcpy(fid.dbSettingsGroup, PU_MODULCLASS); fid.flags = FIDF_DEFAULTVALID; fid.deffontsettings.charset = DEFAULT_CHARSET; fid.deffontsettings.size = -11; - strcpy(fid.deffontsettings.szFace, "Verdana"); - strcpy(fid.name, PU_FNT_NAME_TEXT); - strcpy(fid.prefix, setting); + _tcsncpy(fid.deffontsettings.szFace, _T("Verdana"), SIZEOF(fid.deffontsettings.szFace)); + _tcsncpy(fid.name, PU_FNT_NAME_TEXT, SIZEOF(fid.name)); + strncpy(fid.prefix, setting, SIZEOF(fid.prefix)); mir_snprintf(fid.prefix, sizeof(fid.prefix), "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol" fid.deffontsettings.style = 0; fid.deffontsettings.colour = fonts.clText; - FontRegister(&fid); + FontRegisterT(&fid); //we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB) mir_snprintf(setting, 256, "%s/BgCol", ptd->pupClass.pszName); - ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/); - ColourID cid = {0}; - cid.cbSize = sizeof(ColourID); - mir_snprintf(cid.group, sizeof(cid.group), "%s/%s", PU_FNT_AND_COLOR, ptd->pupClass.pszName); + ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/); + ColourIDT cid = {0}; + cid.cbSize = sizeof(ColourIDT); + mir_sntprintf(cid.group, SIZEOF(cid.group), _T("%s/%S"), PU_FNT_AND_COLOR, ptd->pupClass.pszName); strcpy(cid.dbSettingsGroup, PU_MODULCLASS); - strcpy(cid.name, PU_COL_BACK_NAME); + _tcsncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name)); mir_snprintf(cid.setting, sizeof(cid.setting), "%s/BgCol", ptd->pupClass.pszName); cid.defcolour = fonts.clBack; - ColourRegister(&cid); + ColourRegisterT(&cid); gTreeData.insert(ptd); num_classes++; return (INT_PTR)ptd; } -INT_PTR Popup_UnregisterPopupClass(WPARAM wParam, LPARAM lParam) +INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam) { POPUPTREEDATA *ptd = (POPUPTREEDATA*)lParam; if (ptd == NULL) @@ -460,18 +454,19 @@ INT_PTR Popup_UnregisterPopupClass(WPARAM wParam, LPARAM lParam) //===== Popup/AddPopupClass (for core class api support) INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) { - int ret = 1; + INT_PTR ret = 1; POPUPDATACLASS *pdc = (POPUPDATACLASS *)lParam; if (pdc->cbSize != sizeof(POPUPDATACLASS)) return ret; - POPUPCLASS *pc = NULL; - POPUPTREEDATA *ptd = NULL; + POPUPCLASS *pc = NULL; - if (wParam) pc = (POPUPCLASS*)wParam; + if (wParam) + pc = (POPUPCLASS*)wParam; else { LPTSTR group = mir_a2t(pdc->pszClassName); - ptd = (POPUPTREEDATA *)FindTreeData(group, NULL, 2); - if (ptd) pc = &ptd->pupClass; + POPUPTREEDATA *ptd = (POPUPTREEDATA *)FindTreeData(group, NULL, 2); + if (ptd) + pc = &ptd->pupClass; } if (pc) { POPUPDATA2 ppd2 = { sizeof(ppd2) }; @@ -493,7 +488,7 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) { ppd2.lchContact = pdc->hContact; ppd2.PluginData = pdc->PluginData; - ret = Popup_AddPopup2((WPARAM)&ppd2, 0); + return Popup_AddPopup2((WPARAM)&ppd2, pc->lParam); } return ret!=0 ? 1 : 0; } -- cgit v1.2.3