diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-13 21:53:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-13 21:53:24 +0000 |
commit | b2b03f9f63b17e77b92cdf48ea7a2f0ff4bc33e3 (patch) | |
tree | f1526adcdc2e2fb8bb8479373eabb28c01b7d01e /src/mir_app | |
parent | 782e55572581e53ee81866a0f0a7617414199825 (diff) |
manifest returned back
git-svn-id: http://svn.miranda-ng.org/main/trunk@14153 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/mir_app.vcxproj | 4 | ||||
-rw-r--r-- | src/mir_app/res/miranda32.exe.manifest | 25 | ||||
-rw-r--r-- | src/mir_app/src/clcmsgs.cpp | 144 | ||||
-rw-r--r-- | src/mir_app/src/extraicons.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/icolib.cpp | 76 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 11 | ||||
-rw-r--r-- | src/mir_app/src/skinicons.cpp | 146 |
7 files changed, 163 insertions, 245 deletions
diff --git a/src/mir_app/mir_app.vcxproj b/src/mir_app/mir_app.vcxproj index 66bd019032..e09b34e9be 100644 --- a/src/mir_app/mir_app.vcxproj +++ b/src/mir_app/mir_app.vcxproj @@ -32,7 +32,11 @@ </ClCompile>
<Link>
<ModuleDefinitionFile>src/mir_app.def</ModuleDefinitionFile>
+ <AdditionalManifestDependencies>type=%27win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;type=%27win32%27 name=%27Microsoft.Windows.Gdiplus%27 version=%271.0.0.0%27 processorArchitecture=%27amd64%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
</Link>
+ <Manifest>
+ <AdditionalManifestFiles>res/miranda32.exe.manifest</AdditionalManifestFiles>
+ </Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Condition="'$(VisualStudioVersion)' == '10.0'" Include="..\..\plugins\zlib\zlib_10.vcxproj">
diff --git a/src/mir_app/res/miranda32.exe.manifest b/src/mir_app/res/miranda32.exe.manifest new file mode 100644 index 0000000000..b0c140a148 --- /dev/null +++ b/src/mir_app/res/miranda32.exe.manifest @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <description>Miranda</description>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel
+ level="asInvoker"
+ uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!-- Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!-- Windows Vista -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!-- Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <!-- Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ </application>
+ </compatibility>
+</assembly>
diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index 2706c6780b..822644b6f6 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -25,10 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "clc.h"
-//processing of all the CLM_ messages incoming
+// processing of all the CLM_ messages incoming
LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ ClcContact *contact;
+ ClcGroup *group;
+ int i;
+
switch (msg) {
case CLM_ADDCONTACT:
cli.pfnAddContactToTree(hwnd, dat, wParam, 1, 0);
@@ -37,41 +41,38 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_ADDGROUP:
- {
- DWORD groupFlags;
- TCHAR *szName = cli.pfnGetGroupName(wParam, &groupFlags);
- if (szName == NULL)
- break;
- cli.pfnAddGroup(hwnd, dat, szName, groupFlags, wParam, 0);
- cli.pfnRecalcScrollBar(hwnd, dat);
+ {
+ DWORD groupFlags;
+ TCHAR *szName = cli.pfnGetGroupName(wParam, &groupFlags);
+ if (szName == NULL)
+ break;
+ cli.pfnAddGroup(hwnd, dat, szName, groupFlags, wParam, 0);
+ cli.pfnRecalcScrollBar(hwnd, dat);
+ }
break;
- }
case CLM_ADDINFOITEMA:
case CLM_ADDINFOITEMW:
- {
- int i;
- ClcContact *groupContact;
- ClcGroup *group;
- CLCINFOITEM *cii = (CLCINFOITEM *)lParam;
- if (cii == NULL || cii->cbSize != sizeof(CLCINFOITEM))
- return NULL;
- if (cii->hParentGroup == NULL)
- group = &dat->list;
- else {
- if (!cli.pfnFindItem(hwnd, dat, int(cii->hParentGroup) | HCONTACT_ISGROUP, &groupContact, NULL, NULL))
+ {
+ CLCINFOITEM *cii = (CLCINFOITEM *)lParam;
+ if (cii == NULL || cii->cbSize != sizeof(CLCINFOITEM))
return NULL;
- group = groupContact->group;
- }
- if (msg == CLM_ADDINFOITEMA)
- { WCHAR* wszText = mir_a2u((char*)cii->pszText);
- i = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
- mir_free(wszText);
+ if (cii->hParentGroup == NULL)
+ group = &dat->list;
+ else {
+ if (!cli.pfnFindItem(hwnd, dat, int(cii->hParentGroup) | HCONTACT_ISGROUP, &contact, NULL, NULL))
+ return NULL;
+ group = contact->group;
+ }
+ if (msg == CLM_ADDINFOITEMA) {
+ WCHAR* wszText = mir_a2u((char*)cii->pszText);
+ i = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
+ mir_free(wszText);
+ }
+ else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
+ cli.pfnRecalcScrollBar(hwnd, dat);
+ return (LRESULT)group->cl.items[i]->hContact | HCONTACT_ISINFO;
}
- else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
- cli.pfnRecalcScrollBar(hwnd, dat);
- return (LRESULT)group->cl.items[i]->hContact | HCONTACT_ISINFO;
- }
case CLM_AUTOREBUILD:
KillTimer(hwnd, TIMERID_REBUILDAFTER);
@@ -95,27 +96,21 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_ENSUREVISIBLE:
- {
- ClcContact *contact;
- ClcGroup *group, *tgroup;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL))
break;
- for (tgroup = group; tgroup; tgroup = tgroup->parent)
+
+ for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
cli.pfnEnsureVisible(hwnd, dat, cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl, contact)), 0);
break;
- }
case CLM_EXPAND:
- {
- ClcContact *contact;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
if (contact->type != CLCIT_GROUP)
break;
cli.pfnSetGroupExpand(hwnd, dat, contact->group, lParam);
break;
- }
case CLM_FINDCONTACT:
if (!cli.pfnFindItem(hwnd, dat, wParam, NULL, NULL, NULL))
@@ -131,12 +126,9 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return dat->bkColour;
case CLM_GETCHECKMARK:
- {
- ClcContact *contact;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return 0;
return (contact->flags & CONTACTF_CHECKED) != 0;
- }
case CLM_GETCOUNT:
return cli.pfnGetGroupContentsCount(&dat->list, 0);
@@ -145,18 +137,15 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return (LRESULT)dat->hwndRenameEdit;
case CLM_GETEXPAND:
- {
- ClcContact *contact;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return CLE_INVALID;
if (contact->type != CLCIT_GROUP)
return CLE_INVALID;
return contact->group->expanded;
- }
case CLM_SETEXTRASPACE:
dat->extraColumnSpacing = (int)wParam;
- cli.pfnInvalidateRect(hwnd,NULL,FALSE);
+ cli.pfnInvalidateRect(hwnd, NULL, FALSE);
return 0;
case CLM_GETEXTRACOLUMNS:
@@ -164,7 +153,6 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETEXTRAIMAGE:
if (LOWORD(lParam) < dat->extraColumnsCount) {
- ClcContact *contact;
if (cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return contact->iExtraImage[LOWORD(lParam)];
}
@@ -185,43 +173,34 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return dat->groupIndent;
case CLM_GETISEARCHSTRING:
- mir_tstrcpy((TCHAR*) lParam, dat->szQuickSearch);
+ mir_tstrcpy((TCHAR*)lParam, dat->szQuickSearch);
return mir_tstrlen(dat->szQuickSearch);
case CLM_GETITEMTEXT:
- {
- ClcContact *contact;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return 0;
- mir_tstrcpy((TCHAR*) lParam, contact->szText);
+ mir_tstrcpy((TCHAR*)lParam, contact->szText);
return mir_tstrlen(contact->szText);
- }
case CLM_GETITEMTYPE:
- {
- ClcContact *contact;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return CLCIT_INVALID;
return contact->type;
- }
case CLM_GETLEFTMARGIN:
return dat->leftMargin;
case CLM_GETNEXTITEM:
- {
if (wParam == CLGN_ROOT) {
if (dat->list.cl.count)
return (LRESULT)cli.pfnContactToHItem(dat->list.cl.items[0]);
return NULL;
}
- ClcContact *contact;
- ClcGroup *group;
if (!cli.pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL))
return NULL;
- int i = List_IndexOf((SortedList*)&group->cl, contact);
+ i = List_IndexOf((SortedList*)&group->cl, contact);
switch (wParam) {
case CLGN_CHILD:
if (contact->type != CLCIT_GROUP)
@@ -238,16 +217,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR do {
if (++i >= group->cl.count)
return NULL;
- }
- while (group->cl.items[i]->type == CLCIT_DIVIDER);
+ } while (group->cl.items[i]->type == CLCIT_DIVIDER);
return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_PREVIOUS:
do {
if (--i < 0)
return NULL;
- }
- while (group->cl.items[i]->type == CLCIT_DIVIDER);
+ } while (group->cl.items[i]->type == CLCIT_DIVIDER);
return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_NEXTCONTACT:
@@ -287,18 +264,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
}
return NULL;
- }
case CLM_GETSCROLLTIME:
return dat->scrollTime;
case CLM_GETSELECTION:
- {
- ClcContact *contact;
if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) == -1)
return NULL;
return (LRESULT)cli.pfnContactToHItem(contact);
- }
case CLM_GETTEXTCOLOR:
if (wParam > FONTID_MAX)
@@ -306,29 +279,25 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return (LRESULT)dat->fontInfo[wParam].colour;
case CLM_HITTEST:
- {
- ClcContact *contact;
DWORD hitFlags;
- int hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
- if (wParam)
- *(PDWORD) wParam = hitFlags;
- if (hit == -1)
- return NULL;
+ {
+ int hit = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, NULL, &hitFlags);
+ if (wParam)
+ *(PDWORD)wParam = hitFlags;
+ if (hit == -1)
+ return NULL;
+ }
return (LRESULT)cli.pfnContactToHItem(contact);
- }
case CLM_SELECTITEM:
- {
- ClcContact *contact;
- ClcGroup *group, *tgroup;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL))
break;
- for (tgroup = group; tgroup; tgroup = tgroup->parent)
+
+ for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
dat->selection = cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl, contact));
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
break;
- }
case CLM_SETBKBITMAP:
if (dat->hBmpBackground) {
@@ -352,8 +321,6 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_SETCHECKMARK:
- {
- ClcContact *contact;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return 0;
if (lParam)
@@ -363,7 +330,6 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR cli.pfnRecalculateGroupCheckboxes(hwnd, dat);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
- }
case CLM_SETEXTRACOLUMNS:
if (wParam > EXTRA_ICON_COUNT)
@@ -374,8 +340,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_SETEXTRAIMAGE:
- if ( LOWORD(lParam) < dat->extraColumnsCount) {
- ClcContact *contact;
+ if (LOWORD(lParam) < dat->extraColumnsCount) {
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return 0;
@@ -385,7 +350,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_SETEXTRAIMAGELIST:
- dat->himlExtraColumns = (HIMAGELIST) lParam;
+ dat->himlExtraColumns = (HIMAGELIST)lParam;
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
@@ -393,12 +358,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (HIWORD(lParam) > FONTID_MAX)
return 0;
- dat->fontInfo[HIWORD(lParam)].hFont = (HFONT) wParam;
+ dat->fontInfo[HIWORD(lParam)].hFont = (HFONT)wParam;
dat->fontInfo[HIWORD(lParam)].changed = 1;
{
SIZE fontSize;
HDC hdc = GetDC(hwnd);
- SelectObject(hdc, (HFONT) wParam);
+ SelectObject(hdc, (HFONT)wParam);
GetTextExtentPoint32A(hdc, "x", 1, &fontSize);
dat->fontInfo[HIWORD(lParam)].fontHeight = fontSize.cy;
if (dat->rowHeight < fontSize.cy + 2)
@@ -422,7 +387,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_SETHIDEOFFLINEROOT:
- db_set_b(NULL, "CLC", "HideOfflineRoot", (BYTE) wParam);
+ db_set_b(NULL, "CLC", "HideOfflineRoot", (BYTE)wParam);
cli.pfnInitAutoRebuild(hwnd);
break;
@@ -432,15 +397,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_SETITEMTEXT:
- {
- ClcContact *contact;
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
mir_tstrncpy(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
- }
case CLM_SETLEFTMARGIN:
dat->leftMargin = wParam;
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp index fc4d267043..c2da1c93b8 100644 --- a/src/mir_app/src/extraicons.cpp +++ b/src/mir_app/src/extraicons.cpp @@ -303,7 +303,7 @@ void fnReloadExtraIcons() if (hExtraImageList)
ImageList_Destroy(hExtraImageList);
- hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);
+ hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 1, 256);
SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hExtraImageList);
SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index 06d8b132b5..f477997d99 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -113,7 +113,7 @@ void __fastcall SafeDestroyIcon(HICON* icon) IconSourceFile* IconSourceFile_Get(const TCHAR* file, bool isPath)
{
- TCHAR fileFull[ MAX_PATH ];
+ TCHAR fileFull[MAX_PATH];
if (!file)
return NULL;
@@ -126,8 +126,8 @@ IconSourceFile* IconSourceFile_Get(const TCHAR* file, bool isPath) IconSourceFile key = { fileFull };
int ix;
if ((ix = iconSourceFileList.getIndex(&key)) != -1) {
- iconSourceFileList[ ix ]->ref_count++;
- return iconSourceFileList[ ix ];
+ iconSourceFileList[ix]->ref_count++;
+ return iconSourceFileList[ix];
}
IconSourceFile* newItem = (IconSourceFile*)mir_calloc(sizeof(IconSourceFile));
@@ -202,10 +202,10 @@ static int InternalGetDIBSizes(HBITMAP bitmap, int* InfoHeaderSize, int* ImageSi else {
if (bi.biClrUsed == 0)
*InfoHeaderSize = sizeof(BITMAPINFOHEADER) +
- sizeof(RGBQUAD) * (int)(1 << bi.biBitCount);
+ sizeof(RGBQUAD) * (int)(1 << bi.biBitCount);
else
*InfoHeaderSize = sizeof(BITMAPINFOHEADER) +
- sizeof(RGBQUAD) * bi.biClrUsed;
+ sizeof(RGBQUAD) * bi.biClrUsed;
}
*ImageSize = bi.biSizeImage;
return 0; // Success
@@ -331,8 +331,8 @@ IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int c int ix;
if ((ix = iconSourceList.getIndex(&key)) != -1) {
IconSourceFile_Release(&r_file);
- iconSourceList[ ix ]->ref_count++;
- return iconSourceList[ ix ];
+ iconSourceList[ix]->ref_count++;
+ return iconSourceList[ix];
}
IconSourceItem* newItem = (IconSourceItem*)mir_calloc(sizeof(IconSourceItem));
@@ -351,7 +351,7 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyI if (!path)
return NULL;
- TCHAR file[ MAX_PATH ];
+ TCHAR file[MAX_PATH];
mir_tstrncpy(file, path, SIZEOF(file));
TCHAR *comma = _tcsrchr(file, ',');
@@ -359,7 +359,7 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyI if (!comma)
n = 0;
else {
- n = _ttoi(comma+1);
+ n = _ttoi(comma + 1);
*comma = 0;
}
return GetIconSourceItem(file, n, cxIcon, cyIcon);
@@ -367,14 +367,13 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyI IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon)
{
- TCHAR sourceName[ MAX_PATH ];
+ TCHAR sourceName[MAX_PATH];
IconSourceFile key = { sourceName };
- int i=0;
+ int i = 0;
do { // find new unique name
mir_sntprintf(sourceName, SIZEOF(sourceName), _T("*StaticIcon_%d"), i++);
- }
- while (iconSourceFileList.getIndex(&key) != -1);
+ } while (iconSourceFileList.getIndex(&key) != -1);
IconSourceItem* newItem = (IconSourceItem*)mir_calloc(sizeof(IconSourceItem));
newItem->file = IconSourceFile_Get(sourceName, false);
@@ -419,7 +418,7 @@ static SectionItem* IcoLib_AddSection(TCHAR *sectionName, BOOL create_new) int indx;
SectionItem key = { sectionName, 0 };
if ((indx = sectionList.getIndex(&key)) != -1)
- return sectionList[ indx ];
+ return sectionList[indx];
if (create_new) {
SectionItem* newItem = (SectionItem*)mir_calloc(sizeof(SectionItem));
@@ -450,7 +449,7 @@ static void IcoLib_RemoveSection(SectionItem* section) IcolibItem* IcoLib_FindIcon(const char* pszIconName)
{
int indx = iconList.getIndex((IcolibItem*)&pszIconName);
- return (indx != -1) ? iconList[ indx ] : 0;
+ return (indx != -1) ? iconList[indx] : 0;
}
IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
@@ -533,7 +532,7 @@ MIR_APP_DLL(HANDLE) IcoLib_AddNewIcon(int hLangpack, SKINICONDESC *sid) else item->orderID = 0;
if (sid->defaultFile.a) {
- WCHAR fileFull[ MAX_PATH ];
+ WCHAR fileFull[MAX_PATH];
if (utf_path)
PathToAbsoluteT(sid->defaultFile.w, fileFull);
else
@@ -573,7 +572,7 @@ MIR_APP_DLL(HANDLE) IcoLib_AddNewIcon(int hLangpack, SKINICONDESC *sid) static int IcoLib_RemoveIcon_Internal(int i)
{
- IcolibItem *item = iconList[ i ];
+ IcolibItem *item = iconList[i];
IcoLib_FreeIcon(item);
iconList.remove(i);
SAFE_FREE((void**)&item);
@@ -606,9 +605,9 @@ void KillModuleIcons(int hLangpack) return;
mir_cslock lck(csIconList);
- for (int i = iconList.getCount()-1; i >= 0; i--) {
+ for (int i = iconList.getCount() - 1; i >= 0; i--) {
IcolibItem *item = iconList[i];
- if ( item->hLangpack == hLangpack) {
+ if (item->hLangpack == hLangpack) {
IcoLib_FreeIcon(item);
iconList.remove(i);
SAFE_FREE((void**)&item);
@@ -669,7 +668,7 @@ HICON IconItem_GetDefaultIcon(IcolibItem* item, bool big) HICON IconItem_GetIcon(IcolibItem* item, bool big)
{
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
HICON hIcon = NULL;
big = big && !item->cx;
@@ -739,8 +738,8 @@ MIR_APP_DLL(HICON) IcoLib_GetIconByHandle(HANDLE hItem, bool big) return NULL;
mir_cslock lck(csIconList);
- IcolibItem* pi = (IcolibItem*)hItem;
- if ( iconList.getIndex(pi) != -1)
+ IcolibItem *pi = (IcolibItem*)hItem;
+ if (iconList.getIndex(pi) != -1)
return IconItem_GetIcon(pi, big);
return hIconBlank;
@@ -833,18 +832,18 @@ int LoadIcoLibModule(void) hIconBlank = LoadIconEx(g_hInst, MAKEINTRESOURCE(IDI_BLANK), 0);
- hIcoLib_AddNewIcon = CreateServiceFunction("Skin2/Icons/AddIcon", sttIcoLib_AddNewIcon);
- hIcoLib_RemoveIcon = CreateServiceFunction(MS_SKIN2_REMOVEICON, IcoLib_RemoveIcon);
- hIcoLib_GetIcon = CreateServiceFunction(MS_SKIN2_GETICON, sttIcoLib_GetIcon);
- hIcoLib_GetIconHandle = CreateServiceFunction(MS_SKIN2_GETICONHANDLE, sttIcoLib_GetIconHandle);
- hIcoLib_GetIcon2 = CreateServiceFunction(MS_SKIN2_GETICONBYHANDLE, sttIcoLib_GetIconByHandle);
- hIcoLib_IsManaged = CreateServiceFunction(MS_SKIN2_ISMANAGEDICON, sttIcoLib_IsManaged);
- hIcoLib_AddRef = CreateServiceFunction(MS_SKIN2_ADDREFICON, IcoLib_AddRef);
- hIcoLib_ReleaseIcon = CreateServiceFunction(MS_SKIN2_RELEASEICON, sttIcoLib_ReleaseIcon);
- hIcoLib_ReleaseIcon = CreateServiceFunction(MS_SKIN2_RELEASEICONBIG, sttIcoLib_ReleaseIconBig);
+ hIcoLib_AddNewIcon = CreateServiceFunction("Skin2/Icons/AddIcon", sttIcoLib_AddNewIcon);
+ hIcoLib_RemoveIcon = CreateServiceFunction(MS_SKIN2_REMOVEICON, IcoLib_RemoveIcon);
+ hIcoLib_GetIcon = CreateServiceFunction(MS_SKIN2_GETICON, sttIcoLib_GetIcon);
+ hIcoLib_GetIconHandle = CreateServiceFunction(MS_SKIN2_GETICONHANDLE, sttIcoLib_GetIconHandle);
+ hIcoLib_GetIcon2 = CreateServiceFunction(MS_SKIN2_GETICONBYHANDLE, sttIcoLib_GetIconByHandle);
+ hIcoLib_IsManaged = CreateServiceFunction(MS_SKIN2_ISMANAGEDICON, sttIcoLib_IsManaged);
+ hIcoLib_AddRef = CreateServiceFunction(MS_SKIN2_ADDREFICON, IcoLib_AddRef);
+ hIcoLib_ReleaseIcon = CreateServiceFunction(MS_SKIN2_RELEASEICON, sttIcoLib_ReleaseIcon);
+ hIcoLib_ReleaseIcon = CreateServiceFunction(MS_SKIN2_RELEASEICONBIG, sttIcoLib_ReleaseIconBig);
hIcons2ChangedEvent = CreateHookableEvent(ME_SKIN2_ICONSCHANGED);
- hIconsChangedEvent = CreateHookableEvent(ME_SKIN_ICONSCHANGED);
+ hIconsChangedEvent = CreateHookableEvent(ME_SKIN_ICONSCHANGED);
HookEvent(ME_SYSTEM_MODULESLOADED, SkinSystemModulesLoaded);
@@ -853,9 +852,8 @@ int LoadIcoLibModule(void) void UnloadIcoLibModule(void)
{
- int i;
-
- if (!bModuleInitialized) return;
+ if (!bModuleInitialized)
+ return;
DestroyHookableEvent(hIconsChangedEvent);
DestroyHookableEvent(hIcons2ChangedEvent);
@@ -869,14 +867,14 @@ void UnloadIcoLibModule(void) DestroyServiceFunction(hIcoLib_AddRef);
DestroyServiceFunction(hIcoLib_ReleaseIcon);
- for (i = iconList.getCount()-1; i >= 0; i--) {
+ for (int i = iconList.getCount() - 1; i >= 0; i--) {
IcolibItem* p = iconList[i];
iconList.remove(i);
IcoLib_FreeIcon(p);
mir_free(p);
}
- for (i = iconSourceList.getCount()-1; i >= 0; i--) {
+ for (int i = iconSourceList.getCount() - 1; i >= 0; i--) {
IconSourceItem* p = iconSourceList[i];
iconSourceList.remove(i);
IconSourceFile_Release(&p->file);
@@ -885,14 +883,14 @@ void UnloadIcoLibModule(void) SAFE_FREE((void**)&p);
}
- for (i = iconSourceFileList.getCount()-1; i >= 0; i--) {
+ for (int i = iconSourceFileList.getCount() - 1; i >= 0; i--) {
IconSourceFile* p = iconSourceFileList[i];
iconSourceFileList.remove(i);
SAFE_FREE((void**)&p->file);
SAFE_FREE((void**)&p);
}
- for (i = 0; i < sectionList.getCount(); i++) {
+ for (int i = 0; i < sectionList.getCount(); i++) {
SAFE_FREE((void**)§ionList[i]->name);
mir_free(sectionList[i]);
}
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index dafeb4d964..f6ae881f7a 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -544,7 +544,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) static TCHAR tszCoreErr[] = LPGENT("Core plugin '%s' cannot be loaded or missing. Miranda will exit now");
-bool LoadCorePlugin(MuuidReplacement& mr)
+bool LoadCorePlugin(MuuidReplacement &mr)
{
TCHAR exe[MAX_PATH], tszPlugName[MAX_PATH];
GetModuleFileName(NULL, exe, SIZEOF(exe));
@@ -751,8 +751,6 @@ void UnloadNewPlugins(void) int LoadNewPluginsModule(void)
{
- int i;
-
// make full path to the plugin
TCHAR exe[MAX_PATH], fullPath[MAX_PATH];
GetModuleFileName(NULL, exe, SIZEOF(exe));
@@ -796,11 +794,11 @@ int LoadNewPluginsModule(void) }
/* enable and disable as needed */
- for (i = 0; i < clistPlugins.getCount(); i++)
+ for (int i = 0; i < clistPlugins.getCount(); i++)
SetPluginOnWhiteList(clistPlugins[i]->pluginname, clist != clistPlugins[i] ? 0 : 1);
/* now loop thru and load all the other plugins, do this in one pass */
- for (i = 0; i < pluginList.getCount(); i++) {
+ for (int i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
if (!TryLoadPlugin(p, false)) {
Plugin_Uninit(p);
@@ -893,6 +891,7 @@ void UnloadNewPluginsModule(void) Plugin_Uninit(p);
}
- if (hPluginListHeap) HeapDestroy(hPluginListHeap);
+ if (hPluginListHeap)
+ HeapDestroy(hPluginListHeap);
hPluginListHeap = 0;
}
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index 93173a8f5b..75703b1b52 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -36,16 +36,16 @@ struct StandardIconDescription static struct StandardIconDescription mainIcons[] =
{
- { SKINICON_OTHER_MIRANDA, LPGEN("Miranda NG"), -IDI_MIRANDA }, // 0
- { SKINICON_EVENT_MESSAGE, LPGEN("Message"), -IDI_RECVMSG }, // 1
- { SKINICON_EVENT_URL, LPGEN("URL"), -IDI_URL }, // 2
- { SKINICON_EVENT_FILE, LPGEN("File"), -IDI_FILE }, // 3
- { SKINICON_OTHER_USERONLINE, LPGEN("User online"), -IDI_USERONLINE }, // 4
- { SKINICON_OTHER_GROUPOPEN, LPGEN("Group (open)"), -IDI_GROUPOPEN }, // 5
- { SKINICON_OTHER_GROUPSHUT, LPGEN("Group (closed)"), -IDI_GROUPSHUT }, // 6
- { SKINICON_OTHER_CONNECTING, LPGEN("Connecting"), -IDI_LOAD }, // 7
- { SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact"), -IDI_ADDCONTACT }, // 8
- { SKINICON_OTHER_USERDETAILS, LPGEN("User details"), -IDI_USERDETAILS }, // 9
+ { SKINICON_OTHER_MIRANDA, LPGEN("Miranda NG"), -IDI_MIRANDA }, // 0
+ { SKINICON_EVENT_MESSAGE, LPGEN("Message"), -IDI_RECVMSG }, // 1
+ { SKINICON_EVENT_URL, LPGEN("URL"), -IDI_URL }, // 2
+ { SKINICON_EVENT_FILE, LPGEN("File"), -IDI_FILE }, // 3
+ { SKINICON_OTHER_USERONLINE, LPGEN("User online"), -IDI_USERONLINE }, // 4
+ { SKINICON_OTHER_GROUPOPEN, LPGEN("Group (open)"), -IDI_GROUPOPEN }, // 5
+ { SKINICON_OTHER_GROUPSHUT, LPGEN("Group (closed)"), -IDI_GROUPSHUT }, // 6
+ { SKINICON_OTHER_CONNECTING, LPGEN("Connecting"), -IDI_LOAD }, // 7
+ { SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact"), -IDI_ADDCONTACT }, // 8
+ { SKINICON_OTHER_USERDETAILS, LPGEN("User details"), -IDI_USERDETAILS }, // 9
{ SKINICON_OTHER_HISTORY, LPGEN("History"), -IDI_HISTORY }, // 10
{ SKINICON_OTHER_DOWNARROW, LPGEN("Down arrow"), -IDI_DOWNARROW }, // 11
{ SKINICON_OTHER_FINDUSER, LPGEN("Find user"), -IDI_FINDUSER }, // 12
@@ -119,7 +119,6 @@ const char protoIconsFmt[] = LPGEN("%s icons"); #define GLOBAL_PROTO_NAME "*"
// load small icon (shared) it's not need to be destroyed
-
static HICON LoadSmallIconShared(HINSTANCE hInstance, LPCTSTR lpIconName)
{
int cx = GetSystemMetrics(SM_CXSMICON);
@@ -129,10 +128,12 @@ static HICON LoadSmallIconShared(HINSTANCE hInstance, LPCTSTR lpIconName) // load small icon (not shared) it IS NEED to be destroyed
static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
{
- HICON hIcon = NULL; // icon handle
+ TCHAR filename[MAX_PATH];
+ if (GetModuleFileName(hInstance, filename, MAX_PATH) == 0)
+ return NULL;
+
+ HICON hIcon = NULL; // icon handle
int index = -(int)lpIconName;
- TCHAR filename[MAX_PATH] = {0};
- GetModuleFileName(hInstance, filename, MAX_PATH);
ExtractIconEx(filename, index, NULL, &hIcon, 1);
return hIcon;
}
@@ -140,11 +141,10 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) // load small icon from hInstance
HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared)
{
- HICON hResIcon = bShared ? LoadSmallIcon(hInstance, lpIconName) : LoadSmallIconShared(hInstance, lpIconName);
- if (!hResIcon) { //Icon not found in hInstance lets try to load it from core
- if (g_hInst != hInstance)
- hResIcon = bShared ? LoadSmallIcon(g_hInst, lpIconName) : LoadSmallIconShared(g_hInst, lpIconName);
- }
+ HICON hResIcon = bShared ? LoadSmallIconShared(hInstance, lpIconName) : LoadSmallIcon(hInstance, lpIconName);
+ if (hResIcon == NULL && g_hInst != hInstance) // Icon not found in hInstance, let's try to load it from core
+ hResIcon = bShared ? LoadSmallIconShared(g_hInst, lpIconName) : LoadSmallIcon(g_hInst, lpIconName);
+
return hResIcon;
}
@@ -205,7 +205,7 @@ MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd) IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), NULL);
}
-MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char* tooltip)
+MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char *tooltip)
{
HWND hWnd = GetDlgItem(hwndDlg, itemId);
SendMessage(hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinIcon(iconId));
@@ -219,10 +219,6 @@ MIR_APP_DLL(void) Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId) IcoLib_ReleaseIcon(hIcon, 0);
}
-//
-// wParam = szProto
-// lParam = status
-//
MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big)
{
char iconName[MAX_PATH];
@@ -238,11 +234,11 @@ MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big) }
int statusIndx = -1;
- for (int i=0; i < SIZEOF(statusIcons); i++) {
+ for (int i = 0; i < SIZEOF(statusIcons); i++)
if (statusIcons[i].id == status) {
statusIndx = i;
break;
- } }
+ }
if (statusIndx == -1)
return NULL;
@@ -274,7 +270,7 @@ MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big) GetModuleFileName(NULL, szPath, SIZEOF(szPath));
//
- // Queried protocol isn't in list, adding
+ // Queried protocol isn't in list, adding
//
TCHAR tszSection[MAX_PATH];
mir_sntprintf(tszSection, SIZEOF(tszSection), _T(PROTOCOLS_PREFIX)_T("/%s"), pa->tszAccountName);
@@ -301,7 +297,8 @@ MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big) if (str != NULL)
*str = '\\';
sid.defaultFile.t = szPath;
- } }
+ }
+ }
//
// Add global icons to list
@@ -309,7 +306,7 @@ MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big) int lowidx, highidx;
if (caps2 == 0)
- lowidx = statusIndx, highidx = statusIndx+1;
+ lowidx = statusIndx, highidx = statusIndx + 1;
else
lowidx = 0, highidx = SIZEOF(statusIcons);
@@ -341,7 +338,7 @@ MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big) MIR_APP_DLL(HANDLE) GetSkinIconHandle(int idx)
{
- for (int i=0; i < SIZEOF(mainIcons); i++)
+ for (int i = 0; i < SIZEOF(mainIcons); i++)
if (idx == mainIcons[i].id)
return mainIcons[i].hIcolib;
@@ -353,20 +350,17 @@ char* GetSkinIconName(int idx) static char szIconName[100];
for (int i = 0; i < SIZEOF(mainIcons); i++) {
- if (idx != mainIcons[i].id)
- continue;
-
- mir_snprintf(szIconName, SIZEOF(szIconName), "%s%d", mainIconsFmt, i);
- return szIconName;
+ if (idx == mainIcons[i].id) {
+ mir_snprintf(szIconName, SIZEOF(szIconName), "%s%d", mainIconsFmt, i);
+ return szIconName;
+ }
}
return NULL;
}
MIR_APP_DLL(HICON) LoadSkinIcon(int idx, bool big)
{
- //
- // Query for global status icons
- //
+ // Query for global status icons
if (idx < SKINICON_EVENT_MESSAGE) {
if (idx >= SIZEOF(statusIcons))
return NULL;
@@ -380,26 +374,6 @@ MIR_APP_DLL(HICON) LoadSkinIcon(int idx, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// Initializes the icon skin module
-static void convertOneProtocol(char *moduleName, char *iconName)
-{
- char *pm = moduleName + mir_strlen(moduleName);
- char *pi = iconName + mir_strlen(iconName);
-
- for (int i = 0; i < SIZEOF(statusIcons); i++) {
- _itoa(statusIcons[i].id, pm, 10);
-
- DBVARIANT dbv;
- if (!db_get_ts(NULL, "Icons", moduleName, &dbv)) {
- _itoa(i, pi, 10);
-
- db_set_ts(NULL, "SkinIcons", iconName, dbv.ptszVal);
- db_free(&dbv);
-
- db_unset(NULL, "Icons", moduleName);
- }
- }
-}
-
static INT_PTR sttLoadSkinIcon(WPARAM wParam, LPARAM lParam)
{
switch (lParam) {
@@ -424,48 +398,6 @@ static INT_PTR sttLoadSkinProtoIconBig(WPARAM wParam, LPARAM lParam) int LoadSkinIcons(void)
{
- int i, j = 0;
- char iconName[MAX_PATH], moduleName[MAX_PATH];
- DBVARIANT dbv;
-
- //
- // Perform "1st-time running import"
-
- for (i = 0; i < SIZEOF(mainIcons); i++) {
- _itoa(mainIcons[i].id, moduleName, 10);
- if (db_get_ts(NULL, "Icons", moduleName, &dbv))
- break;
-
- mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i);
-
- db_set_ts(NULL, "SkinIcons", iconName, dbv.ptszVal);
- db_free(&dbv);
-
- db_unset(NULL, "Icons", moduleName);
- }
-
- for (;;) {
- // get the next protocol name
- moduleName[0] = 'p';
- moduleName[1] = 0;
- _itoa(j++, moduleName + 1, 100);
- if (db_get_ts(NULL, "Icons", moduleName, &dbv))
- break;
-
- db_unset(NULL, "Icons", moduleName);
-
- // make old skinicons' prefix
- mir_snprintf(moduleName, SIZEOF(moduleName), "%S", dbv.ptszVal);
- // make IcoLib's prefix
- mir_snprintf(iconName, SIZEOF(iconName), "%s%S", statusIconsFmt, dbv.ptszVal);
-
- convertOneProtocol(moduleName, iconName);
- db_free(&dbv);
- }
- moduleName[0] = 0;
- strncpy_s(iconName, "core_status_" GLOBAL_PROTO_NAME, _TRUNCATE);
- convertOneProtocol(moduleName, iconName);
-
CreateServiceFunction(MS_SKIN_LOADICON, sttLoadSkinIcon);
CreateServiceFunction(MS_SKIN_LOADPROTOICON, sttLoadSkinProtoIcon);
CreateServiceFunction(MS_SKIN_LOADPROTOICONBIG, sttLoadSkinProtoIconBig);
@@ -473,29 +405,27 @@ int LoadSkinIcons(void) TCHAR modulePath[MAX_PATH];
GetModuleFileName(g_hInst, modulePath, SIZEOF(modulePath));
+ char iconName[MAX_PATH];
SKINICONDESC sid = { 0 };
sid.defaultFile.t = modulePath;
sid.flags = SIDF_PATH_TCHAR;
sid.pszName = iconName;
- //
- // Add main icons to list
- //
- for (i = 0; i < SIZEOF(mainIcons); i++) {
+ // Add main icons to list
+ for (int i = 0; i < SIZEOF(mainIcons); i++) {
mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i);
sid.section.a = mainIcons[i].section == NULL ? LPGEN("Main icons") : (char*)mainIcons[i].section;
sid.description.a = (char*)mainIcons[i].description;
sid.iDefaultIndex = mainIcons[i].resource_id;
mainIcons[i].hIcolib = IcoLib_AddNewIcon(0, &sid);
}
- //
+
// Add global icons to list
- //
sid.section.a = PROTOCOLS_PREFIX "/" LPGEN("Global");
- //
+
// Asterisk is used, to avoid conflict with proto-plugins
// 'coz users can't rename it to name with '*'
- for (i = 0; i < SIZEOF(statusIcons); i++) {
+ for (int i = 0; i < SIZEOF(statusIcons); i++) {
mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i);
sid.pszName = iconName;
sid.description.a = (char*)statusIcons[i].description;
|