diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-05 22:06:24 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-05 22:06:24 +0300 |
commit | ca97e51bc8522538feb522940682a55f0620b90c (patch) | |
tree | a4e53d7fc7ae0252afcfdc94313a44f874150d7d | |
parent | cda14f4f5ec6f88e98285dc9af5c89231561e73f (diff) |
mir_fonts.cpp erased because the problems with translation
-rw-r--r-- | include/newpluginapi.h | 3 | ||||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 271324 -> 272104 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 498930 -> 499282 bytes | |||
-rw-r--r-- | plugins/AutoShutdown/shutdown.vcxproj | 5 | ||||
-rw-r--r-- | plugins/AutoShutdown/shutdown.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/frame.cpp | 6 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/stdafx.h | 2 | ||||
-rw-r--r-- | plugins/FloatingContacts/FltCont.vcxproj | 5 | ||||
-rw-r--r-- | plugins/FloatingContacts/FltCont.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/FloatingContacts/src/main.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/CMPluginBase.cpp | 38 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 | ||||
-rw-r--r-- | utils/mir_fonts.cpp | 45 | ||||
-rw-r--r-- | utils/mir_fonts.h | 3 |
15 files changed, 49 insertions, 72 deletions
diff --git a/include/newpluginapi.h b/include/newpluginapi.h index d964d7a52f..e04ff075c0 100644 --- a/include/newpluginapi.h +++ b/include/newpluginapi.h @@ -202,9 +202,12 @@ public: int addFont(struct FontID *pFont);
int addFont(struct FontIDW *pFont);
+ int addFont(const char *pszDbModule, const char *pszDbName, const wchar_t *pszSection, const wchar_t *pszDescription,
+ const wchar_t *pszBackgroundGroup, const wchar_t *pszBackgroundName, int position, BOOL bAllowEffects, LOGFONT *plfDefault, COLORREF clrDefault);
int addColor(struct ColourID *pColor);
int addColor(struct ColourIDW *pColor);
+ int addColor(const char *pszDbModule, const char *pszDbName, const wchar_t *pszSection, const wchar_t *pszDescription, COLORREF clrDefault);
int addEffect(struct EffectID *pEffect);
int addEffect(struct EffectIDW *pEffect);
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex a94ba8baf0..e2288c68aa 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex 1a02538fe0..664f6c20d7 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/plugins/AutoShutdown/shutdown.vcxproj b/plugins/AutoShutdown/shutdown.vcxproj index 358f9347a0..8b0bcff49f 100644 --- a/plugins/AutoShutdown/shutdown.vcxproj +++ b/plugins/AutoShutdown/shutdown.vcxproj @@ -49,11 +49,6 @@ <ClInclude Include="src\watcher.h" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\..\utils\mir_fonts.cpp">
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
<ResourceCompile Include="res\resource.rc" />
<ResourceCompile Include="res\version.rc" />
</ItemGroup>
diff --git a/plugins/AutoShutdown/shutdown.vcxproj.filters b/plugins/AutoShutdown/shutdown.vcxproj.filters index 1b2285e93d..71709f0a0e 100644 --- a/plugins/AutoShutdown/shutdown.vcxproj.filters +++ b/plugins/AutoShutdown/shutdown.vcxproj.filters @@ -29,9 +29,6 @@ <ClCompile Include="src\watcher.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\..\utils\mir_fonts.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\cpuusage.h">
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index b340a69db5..c073c64e65 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -553,13 +553,13 @@ static int FrameModulesLoaded(WPARAM, LPARAM) LOGFONT lf;
/* built-in font module is not available before this hook */
COLORREF clr = GetDefaultColor(FRAMEELEMENT_TEXT);
- FontService_RegisterFont(MODULENAME, "CountdownFont", LPGENW("Automatic shutdown"), LPGENW("Countdown on frame"), LPGENW("Automatic shutdown"), LPGENW("Background"), 0, FALSE, GetDefaultFont(&lf), clr);
+ g_plugin.addFont(MODULENAME, "CountdownFont", LPGENW("Automatic shutdown"), LPGENW("Countdown on frame"), LPGENW("Automatic shutdown"), LPGENW("Background"), 0, FALSE, GetDefaultFont(&lf), clr);
clr = GetDefaultColor(FRAMEELEMENT_BKGRND);
- FontService_RegisterColor(MODULENAME, "BkgColor", LPGENW("Automatic shutdown"), LPGENW("Background"), clr);
+ g_plugin.addColor(MODULENAME, "BkgColor", LPGENW("Automatic shutdown"), LPGENW("Background"), clr);
if (!IsThemeActive()) {
/* progressbar color can only be changed with classic theme */
clr = GetDefaultColor(FRAMEELEMENT_BAR);
- FontService_RegisterColor(MODULENAME, "ProgressColor", TranslateT("Automatic shutdown"), TranslateT("Progress bar"), clr);
+ g_plugin.addColor(MODULENAME, "ProgressColor", TranslateT("Automatic shutdown"), TranslateT("Progress bar"), clr);
}
}
return 0;
diff --git a/plugins/AutoShutdown/src/stdafx.h b/plugins/AutoShutdown/src/stdafx.h index e45715116c..3ee6fd516b 100644 --- a/plugins/AutoShutdown/src/stdafx.h +++ b/plugins/AutoShutdown/src/stdafx.h @@ -58,8 +58,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_icolib.h>
#include <m_hotkeys.h>
-#include "../../utils/mir_fonts.h"
-
#include <m_weather.h>
#include <m_toptoolbar.h>
#include <m_shutdown.h>
diff --git a/plugins/FloatingContacts/FltCont.vcxproj b/plugins/FloatingContacts/FltCont.vcxproj index ec5281e433..c68b660d84 100644 --- a/plugins/FloatingContacts/FltCont.vcxproj +++ b/plugins/FloatingContacts/FltCont.vcxproj @@ -43,11 +43,6 @@ <ClInclude Include="src\version.h" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\..\utils\mir_fonts.cpp">
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
<ResourceCompile Include="res\fltcnt.rc" />
<ResourceCompile Include="res\version.rc" />
</ItemGroup>
diff --git a/plugins/FloatingContacts/FltCont.vcxproj.filters b/plugins/FloatingContacts/FltCont.vcxproj.filters index 8beef67a69..903f361bf0 100644 --- a/plugins/FloatingContacts/FltCont.vcxproj.filters +++ b/plugins/FloatingContacts/FltCont.vcxproj.filters @@ -20,9 +20,6 @@ <ClCompile Include="src\thumbs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\..\utils\mir_fonts.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\bitmap_funcs.h">
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index eb64c54463..a1265dba97 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -16,8 +16,6 @@ No warranty for any misbehaviour. #include "stdafx.h"
-#include "../../utils/mir_fonts.h"
-
/////////////////////////////////////////////////////////////////////////////
// Globals
@@ -908,7 +906,7 @@ int CMPlugin::Load() char szId[20];
mir_snprintf(szId, "Font%d", i);
- FontService_RegisterFont(MODULENAME, szId, LPGENW("Floating contacts"), s_fonts[i], nullptr, nullptr, i + 1, false, &lf, defColor);
+ addFont(MODULENAME, szId, LPGENW("Floating contacts"), s_fonts[i], nullptr, nullptr, i + 1, false, &lf, defColor);
}
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded);
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index 910b1bbd44..8c50bfdd2e 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -208,6 +208,32 @@ int CMPluginBase::addFont(FontIDW *pFont) return Font_RegisterW(pFont, this);
}
+int CMPluginBase::addFont(const char *pszDbModule, const char *pszDbName, const wchar_t *pszSection, const wchar_t *pszDescription, const wchar_t *pszBackgroundGroup, const wchar_t *pszBackgroundName, int position, BOOL bAllowEffects, LOGFONT *plfDefault, COLORREF clrDefault)
+{
+ FontIDW fid = {};
+ mir_strncpy(fid.dbSettingsGroup, pszDbModule, sizeof(fid.dbSettingsGroup)); /* buffer safe */
+ mir_strncpy(fid.setting, pszDbName, sizeof(fid.setting)); /* buffer safe */
+ mir_wstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer safe */
+ mir_wstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */
+ mir_wstrncpy(fid.backgroundGroup, pszBackgroundGroup, _countof(fid.backgroundGroup)); /* buffer safe */
+ mir_wstrncpy(fid.backgroundName, pszBackgroundName, _countof(fid.backgroundName)); /* buffer safe */
+ fid.flags = FIDF_ALLOWREREGISTER;
+ if (bAllowEffects) fid.flags |= FIDF_ALLOWEFFECTS;
+ fid.order = position;
+ if (plfDefault != nullptr) {
+ fid.flags |= FIDF_DEFAULTVALID;
+ fid.deffontsettings.colour = clrDefault;
+ fid.deffontsettings.size = (char)plfDefault->lfHeight;
+ if (plfDefault->lfItalic) fid.deffontsettings.style |= DBFONTF_ITALIC;
+ if (plfDefault->lfWeight != FW_NORMAL) fid.deffontsettings.style |= DBFONTF_BOLD;
+ if (plfDefault->lfUnderline) fid.deffontsettings.style |= DBFONTF_UNDERLINE;
+ if (plfDefault->lfStrikeOut) fid.deffontsettings.style |= DBFONTF_STRIKEOUT;
+ fid.deffontsettings.charset = plfDefault->lfCharSet;
+ mir_wstrncpy(fid.deffontsettings.szFace, plfDefault->lfFaceName, _countof(fid.deffontsettings.szFace)); /* buffer safe */
+ }
+ return Font_RegisterW(&fid, this);
+}
+
int CMPluginBase::addColor(ColourID *pColor)
{
return Colour_Register(pColor, this);
@@ -218,6 +244,18 @@ int CMPluginBase::addColor(ColourIDW *pColor) return Colour_RegisterW(pColor, this);
}
+int CMPluginBase::addColor(const char *pszDbModule, const char *pszDbName, const wchar_t *pszSection, const wchar_t *pszDescription, COLORREF clrDefault)
+{
+ ColourIDW cid = {};
+ cid.defcolour = clrDefault;
+ mir_strncpy(cid.dbSettingsGroup, pszDbModule, sizeof(cid.dbSettingsGroup)); /* buffer safe */
+ mir_strncpy(cid.setting, pszDbName, sizeof(cid.setting)); /* buffer safe */
+ mir_wstrncpy(cid.group, pszSection, _countof(cid.group)); /* buffer safe */
+ mir_wstrncpy(cid.name, pszDescription, _countof(cid.name)); /* buffer safe */
+ Colour_RegisterW(&cid, 0);
+ return 0;
+}
+
int CMPluginBase::addEffect(EffectID *pEffect)
{
return Effect_Register(pEffect, this);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 53c82fe05e..c670d01805 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -907,3 +907,5 @@ Clist_GroupSaveExpanded @1003 NONAME ?Srmm_ApplyOptions@@YGXXZ @1025 NONAME
?OnOptionsApplied@CSrmmBaseDialog@@UAEXXZ @1026 NONAME
?Srmm_GetWindowClass@@YGPAUSrmmLogWindowClass@@PAVCMsgDialog@@@Z @1027 NONAME
+?addColor@CMPluginBase@@QAEHPBD0PB_W1K@Z @1028 NONAME
+?addFont@CMPluginBase@@QAEHPBD0PB_W111HHPAUtagLOGFONTW@@K@Z @1029 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 518db90afc..fd393985c3 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -907,3 +907,5 @@ Clist_GroupSaveExpanded @1003 NONAME ?Srmm_ApplyOptions@@YAXXZ @1025 NONAME
?OnOptionsApplied@CSrmmBaseDialog@@UEAAXXZ @1026 NONAME
?Srmm_GetWindowClass@@YAPEAUSrmmLogWindowClass@@PEAVCMsgDialog@@@Z @1027 NONAME
+?addColor@CMPluginBase@@QEAAHPEBD0PEB_W1K@Z @1028 NONAME
+?addFont@CMPluginBase@@QEAAHPEBD0PEB_W111HHPEAUtagLOGFONTW@@K@Z @1029 NONAME
diff --git a/utils/mir_fonts.cpp b/utils/mir_fonts.cpp deleted file mode 100644 index cd99916cc1..0000000000 --- a/utils/mir_fonts.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include <windows.h> - -#include <m_system.h> -#include <m_fontservice.h> - -#include "mir_fonts.h" - -int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, const wchar_t *pszSection, const wchar_t *pszDescription, const wchar_t *pszBackgroundGroup, const wchar_t *pszBackgroundName, int position, BOOL bAllowEffects, LOGFONT *plfDefault, COLORREF clrDefault) -{ - FontIDW fid = {}; - mir_strncpy(fid.dbSettingsGroup, pszDbModule, sizeof(fid.dbSettingsGroup)); /* buffer safe */ - mir_strncpy(fid.setting, pszDbName, sizeof(fid.setting)); /* buffer safe */ - mir_wstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer safe */ - mir_wstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */ - mir_wstrncpy(fid.backgroundGroup, pszBackgroundGroup, _countof(fid.backgroundGroup)); /* buffer safe */ - mir_wstrncpy(fid.backgroundName, pszBackgroundName, _countof(fid.backgroundName)); /* buffer safe */ - fid.flags = FIDF_ALLOWREREGISTER; - if (bAllowEffects) fid.flags |= FIDF_ALLOWEFFECTS; - fid.order = position; - if (plfDefault != nullptr) { - fid.flags |= FIDF_DEFAULTVALID; - fid.deffontsettings.colour = clrDefault; - fid.deffontsettings.size = (char)plfDefault->lfHeight; - if (plfDefault->lfItalic) fid.deffontsettings.style |= DBFONTF_ITALIC; - if (plfDefault->lfWeight != FW_NORMAL) fid.deffontsettings.style |= DBFONTF_BOLD; - if (plfDefault->lfUnderline) fid.deffontsettings.style |= DBFONTF_UNDERLINE; - if (plfDefault->lfStrikeOut) fid.deffontsettings.style |= DBFONTF_STRIKEOUT; - fid.deffontsettings.charset = plfDefault->lfCharSet; - mir_wstrncpy(fid.deffontsettings.szFace, plfDefault->lfFaceName, _countof(fid.deffontsettings.szFace)); /* buffer safe */ - } - Font_RegisterW(&fid, 0); - return 0; -} - -int FontService_RegisterColor(const char *pszDbModule, const char *pszDbName, const wchar_t *pszSection, const wchar_t *pszDescription, COLORREF clrDefault) -{ - ColourIDW cid = {}; - cid.defcolour = clrDefault; - mir_strncpy(cid.dbSettingsGroup, pszDbModule, sizeof(cid.dbSettingsGroup)); /* buffer safe */ - mir_strncpy(cid.setting, pszDbName, sizeof(cid.setting)); /* buffer safe */ - mir_wstrncpy(cid.group, pszSection, _countof(cid.group)); /* buffer safe */ - mir_wstrncpy(cid.name, pszDescription, _countof(cid.name)); /* buffer safe */ - Colour_RegisterW(&cid, 0); - return 0; -} diff --git a/utils/mir_fonts.h b/utils/mir_fonts.h deleted file mode 100644 index 2f7226777e..0000000000 --- a/utils/mir_fonts.h +++ /dev/null @@ -1,3 +0,0 @@ - -int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, const TCHAR *pszSection, const TCHAR *pszDescription, const TCHAR* pszBackgroundGroup, const TCHAR* pszBackgroundName, int position, BOOL bAllowEffects, LOGFONT *plfDefault, COLORREF clrDefault); -int FontService_RegisterColor(const char *pszDbModule,const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDescription,COLORREF clrDefault); |