diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-11 13:17:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-11 13:17:15 +0000 |
commit | 8725517f626b8c7c43e3800ad7dcae99cec0649c (patch) | |
tree | bb3be877f6d8192627fc6a8777d5668441a21174 /src | |
parent | c9bebf6848647397c70c2e7a1f93e88f052c0efe (diff) |
Unicode, auto-translatable tooltips for Srmm icons
git-svn-id: http://svn.miranda-ng.org/main/trunk@4423 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/miranda32_10.vcxproj.filters | 6 | ||||
-rw-r--r-- | src/miranda32_11.vcxproj.filters | 6 | ||||
-rw-r--r-- | src/modules/srmm/statusicon.cpp | 26 |
3 files changed, 24 insertions, 14 deletions
diff --git a/src/miranda32_10.vcxproj.filters b/src/miranda32_10.vcxproj.filters index fc15b485fc..9b737ea5d2 100644 --- a/src/miranda32_10.vcxproj.filters +++ b/src/miranda32_10.vcxproj.filters @@ -129,9 +129,6 @@ <ClInclude Include="..\include\m_langpack.h">
<Filter>SDK</Filter>
</ClInclude>
- <ClInclude Include="..\include\m_message.h">
- <Filter>SDK</Filter>
- </ClInclude>
<ClInclude Include="..\include\m_netlib.h">
<Filter>SDK</Filter>
</ClInclude>
@@ -288,6 +285,9 @@ <ClInclude Include="modules\extraicons\extraicons.h">
<Filter>Modules\extraicons</Filter>
</ClInclude>
+ <ClInclude Include="..\include\m_message.h">
+ <Filter>Modules\srmm</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="core\commonheaders.cpp">
diff --git a/src/miranda32_11.vcxproj.filters b/src/miranda32_11.vcxproj.filters index 4ec98818a1..502fcd8c9d 100644 --- a/src/miranda32_11.vcxproj.filters +++ b/src/miranda32_11.vcxproj.filters @@ -129,9 +129,6 @@ <ClInclude Include="..\include\m_langpack.h">
<Filter>SDK</Filter>
</ClInclude>
- <ClInclude Include="..\include\m_message.h">
- <Filter>SDK</Filter>
- </ClInclude>
<ClInclude Include="..\include\m_netlib.h">
<Filter>SDK</Filter>
</ClInclude>
@@ -288,6 +285,9 @@ <ClInclude Include="modules\extraicons\extraicons.h">
<Filter>Modules\extraicons</Filter>
</ClInclude>
+ <ClInclude Include="..\include\m_message.h">
+ <Filter>Modules\srmm</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="core\commonheaders.cpp">
diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp index 554df1565c..448decdf1a 100644 --- a/src/modules/srmm/statusicon.cpp +++ b/src/modules/srmm/statusicon.cpp @@ -27,13 +27,13 @@ struct StatusIconChild : public MZeroedObject {
~StatusIconChild()
{
- mir_free(szTooltip);
+ mir_free(tszTooltip);
}
HANDLE hContact;
- HICON hIcon, hIconDisabled;
- int flags;
- char *szTooltip;
+ HICON hIcon, hIconDisabled;
+ int flags;
+ TCHAR *tszTooltip;
};
struct StatusIconMain : public MZeroedObject
@@ -81,7 +81,10 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) if (hContact == NULL) {
memcpy(&p->sid, sid, sizeof(p->sid));
replaceStr(p->sid.szModule, sid->szModule);
- replaceStr(p->sid.szTooltip, sid->szTooltip);
+
+ mir_free(p->sid.szTooltip);
+ p->sid.tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip);
+
NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
return 0;
}
@@ -96,7 +99,10 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) pc->flags = sid->flags;
pc->hIcon = sid->hIcon;
pc->hIconDisabled = sid->hIconDisabled;
- replaceStr(pc->szTooltip, sid->szTooltip);
+
+ mir_free(pc->tszTooltip);
+ pc->tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip);
+
NotifyEventHooks(hHookIconsChanged, wParam, (LPARAM)p);
return 0;
}
@@ -115,7 +121,10 @@ static INT_PTR AddStatusIcon(WPARAM wParam, LPARAM lParam) memcpy(&p->sid, sid, sizeof(p->sid));
p->hPangpack = (int)wParam;
p->sid.szModule = mir_strdup(sid->szModule);
- p->sid.szTooltip = mir_strdup(sid->szTooltip);
+ if (sid->flags & MBF_UNICODE)
+ p->sid.tszTooltip = mir_u2t(sid->wszTooltip);
+ else
+ p->sid.tszTooltip = mir_a2t(sid->szTooltip);
arIcons.insert(p);
NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
@@ -156,9 +165,10 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam) if (pc) {
if (pc->hIcon) res.hIcon = pc->hIcon;
if (pc->hIconDisabled) res.hIconDisabled = pc->hIconDisabled;
- if (pc->szTooltip) res.szTooltip = pc->szTooltip;
+ if (pc->tszTooltip) res.tszTooltip = pc->tszTooltip;
res.flags = pc->flags;
}
+ res.tszTooltip = TranslateTH(p.hPangpack, res.tszTooltip);
return (INT_PTR)&res;
}
nVis++;
|