diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-19 14:02:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-19 14:02:37 +0000 |
commit | 1541d27e5a23f2fa680d129603a73420483c7689 (patch) | |
tree | b6bfd1df9d175d4f8675c9548fb9b898469266f0 | |
parent | 9e28cb9292146942a0eccc0712ee80fb83f5b2d7 (diff) |
fix for dynamic fonts registering
git-svn-id: http://svn.miranda-ng.org/main/trunk@7758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_chat_int.h | 8 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/main.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/main.cpp | 2 | ||||
-rw-r--r-- | src/core/stdchat/src/main.cpp | 2 | ||||
-rw-r--r-- | src/modules/chat/chat.h | 2 | ||||
-rw-r--r-- | src/modules/chat/chat_opts.cpp | 30 | ||||
-rw-r--r-- | src/modules/chat/manager.cpp | 4 |
7 files changed, 32 insertions, 18 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index f7179aa2f8..34affee3d5 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -286,11 +286,16 @@ struct GlobalLogSettingsBase /////////////////////////////////////////////////////////////////////////////////////////
+#define FONTMODE_USE 1
+#define FONTMODE_SKIP 2
+#define FONTMODE_ALTER 3
+
struct CHAT_MANAGER_INITDATA
{
GlobalLogSettingsBase *pSettings;
int cbModuleInfo, cbSession;
TCHAR *szFontGroup;
+ int iFontMode;
};
struct CHAT_MANAGER
@@ -426,10 +431,11 @@ struct CHAT_MANAGER };
extern CHAT_MANAGER ci, *pci;
+extern int hLangpack;
__forceinline void mir_getCI(CHAT_MANAGER_INITDATA *pData)
{
- pci = (CHAT_MANAGER*)CallService("GChat/GetInterface", 0, (LPARAM)pData);
+ pci = (CHAT_MANAGER*)CallService("GChat/GetInterface", hLangpack, (LPARAM)pData);
}
#endif // M_CHAT_INT_H__
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index b4a3de264b..cfad024c45 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -165,7 +165,7 @@ static void RegisterFonts() int Chat_Load()
{
- CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Messaging")_T("/")LPGENT("Group chats") };
+ CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Messaging")_T("/")LPGENT("Group chats"), FONTMODE_SKIP };
mir_getCI(&data);
saveCI = *pci;
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index ef5c0f6a9b..b7ba1099d1 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -249,7 +249,7 @@ int Chat_Load() {
CheckUpdate();
- CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Message Sessions")_T("/")LPGENT("Group chats") };
+ CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), FONTMODE_ALTER };
mir_getCI(&data);
saveCI = *pci;
pci->OnCreateModule = OnCreateModule;
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 1bda6ebd07..0e5f6758a2 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -317,7 +317,7 @@ extern "C" __declspec(dllexport) int Load(void) AddIcons();
RegisterFonts();
- CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Chat module") };
+ CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Chat module"), FONTMODE_USE };
mir_getCI(&data);
saveCI = *pci;
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index 6fdfca7202..57e940de54 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -37,7 +37,7 @@ struct GCPTRS extern HGENMENU hJoinMenuItem, hLeaveMenuItem;
extern GlobalLogSettingsBase *g_Settings;
-extern int g_cbSession, g_cbModuleInfo;
+extern int g_cbSession, g_cbModuleInfo, g_iFontMode, g_iChatLang;
extern TCHAR *g_szFontGroup;
extern CRITICAL_SECTION cs;
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index 5396d94f5b..5d4656231d 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern SESSION_INFO g_TabSession;
GlobalLogSettingsBase *g_Settings;
-int g_cbSession, g_cbModuleInfo;
+int g_cbSession, g_cbModuleInfo, g_iFontMode, g_iChatLang;
TCHAR *g_szFontGroup;
#define FONTF_BOLD 1
@@ -39,10 +39,6 @@ struct FontOptionsList LPCTSTR szDefFace;
BYTE defCharset, defStyle;
char defSize;
- COLORREF colour;
- LPCTSTR szFace;
- BYTE charset, style;
- char size;
}
//remeber to put these in the Translate( ) template file too
@@ -64,7 +60,7 @@ static const fontOptionsList[] = { { LPGENT("User disables status for ..."), RGB(150, 70, 70), _T("Verdana"), DEFAULT_CHARSET, 0, -12 },
{ LPGENT("Action message"), RGB(160, 90, 160), _T("Verdana"), DEFAULT_CHARSET, 0, -12 },
{ LPGENT("Highlighted message"), RGB(180, 150, 80), _T("Verdana"), DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Message typing area"), RGB(0, 0, 40), _T("Verdana"), DEFAULT_CHARSET, 0, -12 },
+ { _T(""), 0, _T("Verdana"), DEFAULT_CHARSET, 0, -12 },
{ LPGENT("User list members (online)"), RGB(0, 0, 0), _T("Verdana"), DEFAULT_CHARSET, 0, -12 },
{ LPGENT("User list members (away)"), RGB(170, 170, 170), _T("Verdana"), DEFAULT_CHARSET, 0, -12 }
};
@@ -151,18 +147,28 @@ void RegisterFonts(void) _tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace));
_tcsncpy(fontid.backgroundGroup, g_szFontGroup, SIZEOF(fontid.backgroundGroup));
switch (i) {
- case 17:
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), _T("Message background"), _TRUNCATE);
- break;
case 18:
case 19:
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), _T("Userlist background"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Userlist background"), _TRUNCATE);
break;
+ case 17:
+ if (g_iFontMode == FONTMODE_SKIP)
+ continue;
+ if (g_iFontMode == FONTMODE_USE) {
+ _tcsncpy_s(fontid.name, SIZEOF(fontid.name), LPGENT("Message typing area"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Message background"), _TRUNCATE);
+ fontid.deffontsettings.colour = RGB(0, 0, 40);
+ break;
+ }
+
+ _tcsncpy_s(fontid.name, SIZEOF(fontid.name), LPGENT("Chat log symbols (Webdings)"), _TRUNCATE);
+ fontid.deffontsettings.colour = RGB(170, 170, 170);
+ // fall through
default:
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), _T("Group chat log background"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Group chat log background"), _TRUNCATE);
break;
}
- FontRegisterT(&fontid);
+ CallService("Font/RegisterW", (WPARAM)&fontid, g_iChatLang);
}
}
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index d12f27036b..a840f1a248 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -1337,7 +1337,7 @@ static BOOL LM_RemoveAll(LOGINFO** ppLogListStart, LOGINFO** ppLogListEnd) return TRUE;
}
-INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam)
+INT_PTR SvcGetChatManager(WPARAM wParam, LPARAM lParam)
{
// wipe out old junk
memset(PBYTE(&ci) + offsetof(CHAT_MANAGER, OnCreateModule), 0, sizeof(CHAT_MANAGER)-offsetof(CHAT_MANAGER, OnCreateModule));
@@ -1379,6 +1379,8 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam) g_szFontGroup = pInit->szFontGroup;
g_cbSession = pInit->cbSession;
g_cbModuleInfo = pInit->cbModuleInfo;
+ g_iFontMode = pInit->iFontMode;
+ g_iChatLang = (int)wParam;
ci.SetActiveSession = SetActiveSession;
ci.SetActiveSessionEx = SetActiveSessionEx;
|