diff options
-rw-r--r-- | src/core/stdpopup/src/icons.cpp | 22 | ||||
-rw-r--r-- | src/core/stdpopup/src/icons.h | 16 | ||||
-rw-r--r-- | src/core/stdpopup/src/services.cpp | 8 | ||||
-rw-r--r-- | src/core/stdpopup/src/stdafx.h | 3 | ||||
-rw-r--r-- | src/core/stdpopup/src/yapp.cpp | 89 | ||||
-rw-r--r-- | src/core/stdpopup/src/yapp_history_dlg.cpp | 2 | ||||
-rw-r--r-- | src/core/stdpopup/stdpopup.vcxproj | 2 | ||||
-rw-r--r-- | src/core/stdpopup/stdpopup.vcxproj.filters | 85 |
8 files changed, 121 insertions, 106 deletions
diff --git a/src/core/stdpopup/src/icons.cpp b/src/core/stdpopup/src/icons.cpp deleted file mode 100644 index 60ada65a13..0000000000 --- a/src/core/stdpopup/src/icons.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "stdafx.h" - -static IconItem iconList1[] = -{ - // toolbar - { LPGEN("Popups are enabled"), ICO_TB_POPUP_ON, IDI_POPUP }, - { LPGEN("Popups are disabled"), ICO_TB_POPUP_OFF, IDI_NOPOPUP } -}; - -static IconItem iconList2[] = -{ - // common - { LPGEN("Popups are enabled"), ICO_POPUP_ON, IDI_POPUP }, - { LPGEN("Popups are disabled"), ICO_POPUP_OFF, IDI_NOPOPUP }, - { LPGEN("Popup history"), ICO_HISTORY, IDI_HISTORY }, -}; - -void InitIcons() -{ - g_plugin.registerIcon(SECT_TOLBAR, iconList1); - g_plugin.registerIcon(SECT_POPUP, iconList2); -} diff --git a/src/core/stdpopup/src/icons.h b/src/core/stdpopup/src/icons.h deleted file mode 100644 index 6b35713b67..0000000000 --- a/src/core/stdpopup/src/icons.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __icons_h__ -#define __icons_h__ - -//ICONS -#define SECT_TOLBAR "Toolbar" -#define SECT_POPUP MODULENAME - -#define ICO_TB_POPUP_ON "TBButton_popup_ToogleUp" -#define ICO_TB_POPUP_OFF "TBButton_popup_ToogleDOWN" -#define ICO_POPUP_ON MODULENAME"_enabled" -#define ICO_POPUP_OFF MODULENAME"_disabled" -#define ICO_HISTORY MODULENAME"_history" - -void InitIcons(); - -#endif // __icons_h__ diff --git a/src/core/stdpopup/src/services.cpp b/src/core/stdpopup/src/services.cpp index 8e90c9da1b..771f51d049 100644 --- a/src/core/stdpopup/src/services.cpp +++ b/src/core/stdpopup/src/services.cpp @@ -190,12 +190,12 @@ void UpdateMenu() { bool isEnabled = Popup_Enabled() == 1; if (isEnabled) { - Menu_ModifyItem(hMenuItem, LPGENW("Disable popups"), IcoLib_GetIconHandle(ICO_POPUP_ON)); - Menu_ModifyItem(hMenuRoot, nullptr, IcoLib_GetIconHandle(ICO_POPUP_ON)); + Menu_ModifyItem(hMenuItem, LPGENW("Disable popups"), g_plugin.getIconHandle(IDI_POPUP)); + Menu_ModifyItem(hMenuRoot, nullptr, g_plugin.getIconHandle(IDI_POPUP)); } else { - Menu_ModifyItem(hMenuItem, LPGENW("Enable popups"), IcoLib_GetIconHandle(ICO_POPUP_OFF)); - Menu_ModifyItem(hMenuRoot, nullptr, IcoLib_GetIconHandle(ICO_POPUP_OFF)); + Menu_ModifyItem(hMenuItem, LPGENW("Enable popups"), g_plugin.getIconHandle(IDI_NOPOPUP)); + Menu_ModifyItem(hMenuRoot, nullptr, g_plugin.getIconHandle(IDI_NOPOPUP)); } if (hTTButton) diff --git a/src/core/stdpopup/src/stdafx.h b/src/core/stdpopup/src/stdafx.h index 063f31acc9..9fbddc138a 100644 --- a/src/core/stdpopup/src/stdafx.h +++ b/src/core/stdpopup/src/stdafx.h @@ -35,7 +35,6 @@ #include "services.h" #include "resource.h" #include "yapp_history.h" -#include "icons.h" #define MODULENAME "YAPP" @@ -43,6 +42,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> { CMPlugin(); + void InitIcons(); + int Load() override; int Unload() override; }; diff --git a/src/core/stdpopup/src/yapp.cpp b/src/core/stdpopup/src/yapp.cpp index 951be5588a..96f5e635a7 100644 --- a/src/core/stdpopup/src/yapp.cpp +++ b/src/core/stdpopup/src/yapp.cpp @@ -23,6 +23,14 @@ HANDLE hTTButton; // menu items HGENMENU hMenuRoot, hMenuItem, hMenuItemHistory; +// icons +static IconItem iconList[] = +{ + { LPGEN("Popups are enabled"), MODULENAME"_enabled", IDI_POPUP }, + { LPGEN("Popups are disabled"), MODULENAME"_disabled", IDI_NOPOPUP }, + { LPGEN("Popup history"), MODULENAME"_history", IDI_HISTORY }, +}; + ///////////////////////////////////////////////////////////////////////////////////////// PLUGININFOEX pluginInfoEx = @@ -79,8 +87,8 @@ static int TTBLoaded(WPARAM, LPARAM) if (Popup_Enabled()) ttb.dwFlags |= TTBBF_PUSHED; ttb.name = LPGEN("Toggle popups"); - ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_TB_POPUP_OFF); - ttb.hIconHandleDn = IcoLib_GetIconHandle(ICO_TB_POPUP_ON); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_NOPOPUP); + ttb.hIconHandleDn = g_plugin.getIconHandle(IDI_POPUP); ttb.pszTooltipUp = LPGEN("Enable popups"); ttb.pszTooltipDn = LPGEN("Disable popups"); hTTButton = g_plugin.addTTB(&ttb); @@ -90,63 +98,63 @@ static int TTBLoaded(WPARAM, LPARAM) static void InitFonts() { font_id_firstline.flags = FIDF_ALLOWEFFECTS; - mir_wstrcpy(font_id_firstline.group, LPGENW("Popups")); - mir_wstrcpy(font_id_firstline.name, LPGENW("First line")); - mir_strcpy(font_id_firstline.dbSettingsGroup, MODULENAME); - mir_strcpy(font_id_firstline.setting, "FontFirst"); - mir_wstrcpy(font_id_firstline.backgroundGroup, L"Popups"); - mir_wstrcpy(font_id_firstline.backgroundName, L"Background"); + wcsncpy_s(font_id_firstline.group, LPGENW("Popups"), _TRUNCATE); + wcsncpy_s(font_id_firstline.name, LPGENW("First line"), _TRUNCATE); + strncpy_s(font_id_firstline.dbSettingsGroup, MODULENAME, _TRUNCATE); + strncpy_s(font_id_firstline.setting, "FontFirst", _TRUNCATE); + wcsncpy_s(font_id_firstline.backgroundGroup, L"Popups", _TRUNCATE); + wcsncpy_s(font_id_firstline.backgroundName, L"Background", _TRUNCATE); font_id_firstline.order = 0; g_plugin.addFont(&font_id_firstline); font_id_secondline.flags = FIDF_ALLOWEFFECTS; - mir_wstrcpy(font_id_secondline.group, LPGENW("Popups")); - mir_wstrcpy(font_id_secondline.name, LPGENW("Second line")); - mir_strcpy(font_id_secondline.dbSettingsGroup, MODULENAME); - mir_strcpy(font_id_secondline.setting, "FontSecond"); - mir_wstrcpy(font_id_secondline.backgroundGroup, L"Popups"); - mir_wstrcpy(font_id_secondline.backgroundName, L"Background"); + wcsncpy_s(font_id_secondline.group, LPGENW("Popups"), _TRUNCATE); + wcsncpy_s(font_id_secondline.name, LPGENW("Second line"), _TRUNCATE); + strncpy_s(font_id_secondline.dbSettingsGroup, MODULENAME, _TRUNCATE); + strncpy_s(font_id_secondline.setting, "FontSecond", _TRUNCATE); + wcsncpy_s(font_id_secondline.backgroundGroup, L"Popups", _TRUNCATE); + wcsncpy_s(font_id_secondline.backgroundName, L"Background", _TRUNCATE); font_id_secondline.order = 1; g_plugin.addFont(&font_id_secondline); font_id_time.flags = FIDF_ALLOWEFFECTS; - mir_wstrcpy(font_id_time.group, LPGENW("Popups")); - mir_wstrcpy(font_id_time.name, LPGENW("Time")); - mir_strcpy(font_id_time.dbSettingsGroup, MODULENAME); - mir_strcpy(font_id_time.setting, "FontTime"); - mir_wstrcpy(font_id_time.backgroundGroup, L"Popups"); - mir_wstrcpy(font_id_time.backgroundName, L"Background"); + wcsncpy_s(font_id_time.group, LPGENW("Popups"), _TRUNCATE); + wcsncpy_s(font_id_time.name, LPGENW("Time"), _TRUNCATE); + strncpy_s(font_id_time.dbSettingsGroup, MODULENAME, _TRUNCATE); + strncpy_s(font_id_time.setting, "FontTime", _TRUNCATE); + wcsncpy_s(font_id_time.backgroundGroup, L"Popups", _TRUNCATE); + wcsncpy_s(font_id_time.backgroundName, L"Background", _TRUNCATE); font_id_time.order = 2; g_plugin.addFont(&font_id_time); - mir_wstrcpy(colour_id_bg.group, LPGENW("Popups")); - mir_wstrcpy(colour_id_bg.name, LPGENW("Background")); - mir_strcpy(colour_id_bg.dbSettingsGroup, MODULENAME); - mir_strcpy(colour_id_bg.setting, "ColourBg"); + wcsncpy_s(colour_id_bg.group, LPGENW("Popups"), _TRUNCATE); + wcsncpy_s(colour_id_bg.name, LPGENW("Background"), _TRUNCATE); + strncpy_s(colour_id_bg.dbSettingsGroup, MODULENAME, _TRUNCATE); + strncpy_s(colour_id_bg.setting, "ColourBg", _TRUNCATE); colour_id_bg.defcolour = GetSysColor(COLOR_3DSHADOW); colour_id_bg.order = 0; g_plugin.addColor(&colour_id_bg); - mir_wstrcpy(colour_id_border.group, LPGENW("Popups")); - mir_wstrcpy(colour_id_border.name, LPGENW("Border")); - mir_strcpy(colour_id_border.dbSettingsGroup, MODULENAME); - mir_strcpy(colour_id_border.setting, "ColourBorder"); + wcsncpy_s(colour_id_border.group, LPGENW("Popups"), _TRUNCATE); + wcsncpy_s(colour_id_border.name, LPGENW("Border"), _TRUNCATE); + strncpy_s(colour_id_border.dbSettingsGroup, MODULENAME, _TRUNCATE); + strncpy_s(colour_id_border.setting, "ColourBorder", _TRUNCATE); colour_id_border.defcolour = RGB(0, 0, 0); colour_id_border.order = 1; g_plugin.addColor(&colour_id_border); - mir_wstrcpy(colour_id_sidebar.group, LPGENW("Popups")); - mir_wstrcpy(colour_id_sidebar.name, LPGENW("Sidebar")); - mir_strcpy(colour_id_sidebar.dbSettingsGroup, MODULENAME); - mir_strcpy(colour_id_sidebar.setting, "ColourSidebar"); + wcsncpy_s(colour_id_sidebar.group, LPGENW("Popups"), _TRUNCATE); + wcsncpy_s(colour_id_sidebar.name, LPGENW("Sidebar"), _TRUNCATE); + strncpy_s(colour_id_sidebar.dbSettingsGroup, MODULENAME, _TRUNCATE); + strncpy_s(colour_id_sidebar.setting, "ColourSidebar", _TRUNCATE); colour_id_sidebar.defcolour = RGB(128, 128, 128); colour_id_sidebar.order = 2; g_plugin.addColor(&colour_id_sidebar); - mir_wstrcpy(colour_id_titleunderline.group, LPGENW("Popups")); - mir_wstrcpy(colour_id_titleunderline.name, LPGENW("Title underline")); - mir_strcpy(colour_id_titleunderline.dbSettingsGroup, MODULENAME); - mir_strcpy(colour_id_titleunderline.setting, "ColourTitleUnderline"); + wcsncpy_s(colour_id_titleunderline.group, LPGENW("Popups"), _TRUNCATE); + wcsncpy_s(colour_id_titleunderline.name, LPGENW("Title underline"), _TRUNCATE); + strncpy_s(colour_id_titleunderline.dbSettingsGroup, MODULENAME, _TRUNCATE); + strncpy_s(colour_id_titleunderline.setting, "ColourTitleUnderline", _TRUNCATE); colour_id_titleunderline.defcolour = GetSysColor(COLOR_3DSHADOW); colour_id_titleunderline.order = 3; g_plugin.addColor(&colour_id_titleunderline); @@ -158,7 +166,7 @@ static void InitMenuItems(void) { bool isEnabled = Popup_Enabled() == 1; - hMenuRoot = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 500010000, IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0)); + hMenuRoot = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 500010000, g_plugin.getIcon(isEnabled ? IDI_POPUP : IDI_NOPOPUP, 0)); Menu_ConfigureItem(hMenuRoot, MCI_OPT_UID, "043A641A-2767-4C57-AA57-9233D6F9DC54"); CMenuItem mi(&g_plugin); @@ -166,13 +174,13 @@ static void InitMenuItems(void) mi.root = hMenuRoot; SET_UID(mi, 0x92c386ae, 0x6e81, 0x452d, 0xb5, 0x71, 0x87, 0x46, 0xe9, 0x2, 0x66, 0xe9); - mi.hIcolibItem = IcoLib_GetIcon(ICO_HISTORY, 0); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_HISTORY); mi.pszService = MS_POPUP_SHOWHISTORY; mi.name.w = LPGENW("Popup history"); hMenuItemHistory = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x4353d44e, 0x177, 0x4843, 0x88, 0x30, 0x25, 0x5d, 0x91, 0xad, 0xdf, 0x3f); - mi.hIcolibItem = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0); + mi.hIcolibItem = g_plugin.getIconHandle(isEnabled ? IDI_POPUP : IDI_NOPOPUP); mi.pszService = "Popup/EnableDisableMenuCommand"; mi.name.w = (isEnabled ? LPGENW("Disable popups") : LPGENW("Enable popups")); hMenuItem = Menu_AddMainMenuItem(&mi); @@ -203,10 +211,11 @@ static int PreShutdown(WPARAM, LPARAM) int CMPlugin::Load() { + registerIcon(LPGEN("Popups"), iconList); + InitMessagePump(); InitOptions(); InitFonts(); - InitIcons(); InitMenuItems(); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); diff --git a/src/core/stdpopup/src/yapp_history_dlg.cpp b/src/core/stdpopup/src/yapp_history_dlg.cpp index a2edcaecee..0e51efb3af 100644 --- a/src/core/stdpopup/src/yapp_history_dlg.cpp +++ b/src/core/stdpopup/src/yapp_history_dlg.cpp @@ -528,7 +528,7 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara switch (msg) { case WM_INITDIALOG: bInitializing = 1; - Window_SetIcon_IcoLib(hWnd, IcoLib_GetIconHandle(ICO_HISTORY)); + Window_SetIcon_IcoLib(hWnd, g_plugin.getIconHandle(IDI_HISTORY)); { int renderer = lstPopupHistory.GetRenderer(); LoadRenderer(hWnd, renderer); diff --git a/src/core/stdpopup/stdpopup.vcxproj b/src/core/stdpopup/stdpopup.vcxproj index 508636c1b4..3a07efb5d4 100644 --- a/src/core/stdpopup/stdpopup.vcxproj +++ b/src/core/stdpopup/stdpopup.vcxproj @@ -26,7 +26,6 @@ <Import Project="$(ProjectDir)..\..\..\build\vc.common\core.props" /> </ImportGroup> <ItemGroup> - <ClCompile Include="src\icons.cpp" /> <ClCompile Include="src\message_pump.cpp" /> <ClCompile Include="src\options.cpp" /> <ClCompile Include="src\popwin.cpp" /> @@ -37,7 +36,6 @@ <ClCompile Include="src\yapp.cpp" /> <ClCompile Include="src\yapp_history.cpp" /> <ClCompile Include="src\yapp_history_dlg.cpp" /> - <ClInclude Include="src\icons.h" /> <ClInclude Include="src\message_pump.h" /> <ClInclude Include="src\options.h" /> <ClInclude Include="src\popwin.h" /> diff --git a/src/core/stdpopup/stdpopup.vcxproj.filters b/src/core/stdpopup/stdpopup.vcxproj.filters index d8c0d2fb69..b74d57bae9 100644 --- a/src/core/stdpopup/stdpopup.vcxproj.filters +++ b/src/core/stdpopup/stdpopup.vcxproj.filters @@ -1,29 +1,74 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <ClCompile Include="src\icons.cpp" /> - <ClCompile Include="src\message_pump.cpp" /> - <ClCompile Include="src\options.cpp" /> - <ClCompile Include="src\popwin.cpp" /> - <ClCompile Include="src\services.cpp" /> - <ClCompile Include="src\stdafx.cxx" /> - <ClCompile Include="src\yapp.cpp" /> - <ClCompile Include="src\yapp_history.cpp" /> - <ClCompile Include="src\yapp_history_dlg.cpp" /> + <ClCompile Include="src\message_pump.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\options.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\popwin.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\services.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\stdafx.cxx"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\yapp.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\yapp_history.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\yapp_history_dlg.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="src\icons.h" /> - <ClInclude Include="src\message_pump.h" /> - <ClInclude Include="src\options.h" /> - <ClInclude Include="src\popwin.h" /> - <ClInclude Include="src\resource.h" /> - <ClInclude Include="src\services.h" /> - <ClInclude Include="src\stdafx.h" /> - <ClInclude Include="src\version.h" /> - <ClInclude Include="src\yapp_history.h" /> + <ClInclude Include="src\message_pump.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\options.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\popwin.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\resource.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\services.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\stdafx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\version.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\yapp_history.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> <ItemGroup> - <ResourceCompile Include="res\resource.rc" /> - <ResourceCompile Include="res\version.rc" /> + <ResourceCompile Include="res\resource.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + <ResourceCompile Include="res\version.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{5352918c-1f93-4998-9542-0260ab5c2e8b}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{246b5589-9ba3-402e-97bd-e8b8f1a3a1ad}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{ea034602-68f7-4995-9449-665b7244883f}</UniqueIdentifier> + </Filter> </ItemGroup> </Project>
\ No newline at end of file |