diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-11-16 12:33:36 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-11-16 12:33:36 +0000 |
commit | 2dcdda76b6e9434ae5b05699d218b0ac17651d50 (patch) | |
tree | 59efc25df6aa6adfbb836e3582b0424c5460d0e2 /src/modules | |
parent | af899826864310dfc14e81c1e4bc71104ff755ff (diff) |
tabs and spaces cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@2334 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/icolib/skin2icons.cpp | 55 | ||||
-rw-r--r-- | src/modules/icolib/skin2opts.cpp | 57 |
2 files changed, 71 insertions, 41 deletions
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index ba76622f2a..620a82f0b3 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -32,7 +32,7 @@ HICON hIconBlank = NULL; static HANDLE
hIcoLib_AddNewIcon, hIcoLib_RemoveIcon, hIcoLib_GetIcon, hIcoLib_GetIcon2,
- hIcoLib_GetIconHandle, hIcoLib_IsManaged, hIcoLib_AddRef, hIcoLib_ReleaseIcon;
+ hIcoLib_GetIconHandle, hIcoLib_IsManaged, hIcoLib_AddRef, hIcoLib_ReleaseIcon;
int iconEventActive = 0;
@@ -41,19 +41,22 @@ BOOL bNeedRebuild = FALSE; CRITICAL_SECTION csIconList;
static int sttCompareSections(const SectionItem* p1, const SectionItem* p2)
-{ return _tcscmp(p1->name, p2->name);
+{
+ return _tcscmp(p1->name, p2->name);
}
LIST<SectionItem> sectionList(20, sttCompareSections);
static int sttCompareIconSourceFiles(const IconSourceFile* p1, const IconSourceFile* p2)
-{ return _tcsicmp(p1->file, p2->file);
+{
+ return _tcsicmp(p1->file, p2->file);
}
static LIST<IconSourceFile> iconSourceFileList(10, sttCompareIconSourceFiles);
static int sttCompareIconSourceItems(const IconSourceItem* p1, const IconSourceItem* p2)
-{ if (p1->indx < p2->indx)
+{
+ if (p1->indx < p2->indx)
return -1;
if (p1->indx > p2->indx)
@@ -80,7 +83,8 @@ static int sttCompareIconSourceItems(const IconSourceItem* p1, const IconSourceI static LIST<IconSourceItem> iconSourceList(20, sttCompareIconSourceItems);
static int sttCompareIcons(const IconItem* p1, const IconItem* p2)
-{ return strcmp(p1->name, p2->name);
+{
+ return strcmp(p1->name, p2->name);
}
LIST<IconItem> iconList(20, sttCompareIcons);
@@ -93,14 +97,16 @@ void __fastcall SAFE_FREE(void** p) if (*p) {
mir_free(*p);
*p = NULL;
-} }
+ }
+}
void __fastcall SafeDestroyIcon(HICON* icon)
{
if (*icon) {
DestroyIcon(*icon);
*icon = NULL;
-} }
+ }
+}
// Helper functions to manage Icon resources
@@ -151,7 +157,8 @@ int IconSourceFile_Release(IconSourceFile** pitem) }
static int BytesPerScanLine(int PixelsPerScanline, int BitsPerPixel, int Alignment)
-{ Alignment--;
+{
+ Alignment--;
int bytes = ((PixelsPerScanline * BitsPerPixel) + Alignment) & ~Alignment;
return bytes / 8;
}
@@ -232,7 +239,7 @@ static int GetIconData(HICON icon, BYTE** data, int* size) if ( !GetIconInfo(icon, &iconInfo)) return 1; // Failure
- if (InternalGetDIBSizes(iconInfo.hbmMask, &MonoInfoSize, &MonoBitsSize) ||
+ if (InternalGetDIBSizes(iconInfo.hbmMask, &MonoInfoSize, &MonoBitsSize) ||
InternalGetDIBSizes(iconInfo.hbmColor, &ColorInfoSize, &ColorBitsSize)) {
DeleteObject(iconInfo.hbmColor);
DeleteObject(iconInfo.hbmMask);
@@ -243,7 +250,7 @@ static int GetIconData(HICON icon, BYTE** data, int* size) void* ColorInfo = mir_alloc(ColorInfoSize);
void* ColorBits = mir_alloc(ColorBitsSize);
- if (InternalGetDIB(iconInfo.hbmMask, 0, MonoInfo, MonoBits) ||
+ if (InternalGetDIB(iconInfo.hbmMask, 0, MonoInfo, MonoBits) ||
InternalGetDIB(iconInfo.hbmColor, 0, ColorInfo, ColorBits)) {
SAFE_FREE(&MonoInfo);
SAFE_FREE(&MonoBits);
@@ -256,7 +263,7 @@ static int GetIconData(HICON icon, BYTE** data, int* size) *size = ColorInfoSize + ColorBitsSize + MonoBitsSize;
*data = (BYTE*)mir_alloc(*size);
-
+
BYTE* buf = *data;
((BITMAPINFOHEADER*)ColorInfo)->biHeight *= 2; // color height includes mono bits
memcpy(buf, ColorInfo, ColorInfoSize);
@@ -463,11 +470,11 @@ IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big) if (p->source_small && p->source_small->icon == hIcon) {
big = false;
return p;
- }
+ }
if (p->source_big && p->source_big->icon == hIcon) {
big = true;
return p;
- }
+ }
}
return NULL;
@@ -652,7 +659,6 @@ HICON IconItem_GetDefaultIcon(IconItem* item, bool big) return hIcon;
}
-
/////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon
@@ -782,31 +788,38 @@ static int SkinSystemModulesLoaded(WPARAM, LPARAM) // Module initialization and finalization procedure
static INT_PTR sttIcoLib_AddNewIcon(WPARAM wParam, LPARAM lParam)
-{ return (INT_PTR)IcoLib_AddNewIcon((int)wParam, (SKINICONDESC*)lParam);
+{
+ return (INT_PTR)IcoLib_AddNewIcon((int)wParam, (SKINICONDESC*)lParam);
}
static INT_PTR sttIcoLib_GetIcon(WPARAM wParam, LPARAM lParam)
-{ return (INT_PTR)IcoLib_GetIcon((const char*)lParam, wParam != 0);
+{
+ return (INT_PTR)IcoLib_GetIcon((const char*)lParam, wParam != 0);
}
static INT_PTR sttIcoLib_GetIconHandle(WPARAM, LPARAM lParam)
-{ return (INT_PTR)IcoLib_GetIconHandle((const char*)lParam);
+{
+ return (INT_PTR)IcoLib_GetIconHandle((const char*)lParam);
}
static INT_PTR sttIcoLib_GetIconByHandle(WPARAM wParam, LPARAM lParam)
-{ return (INT_PTR)IcoLib_GetIconByHandle((HANDLE)lParam, wParam != 0);
+{
+ return (INT_PTR)IcoLib_GetIconByHandle((HANDLE)lParam, wParam != 0);
}
static INT_PTR sttIcoLib_ReleaseIcon(WPARAM wParam, LPARAM lParam)
-{ return (INT_PTR)IcoLib_ReleaseIcon((HICON)wParam, (char*)lParam, false);
+{
+ return (INT_PTR)IcoLib_ReleaseIcon((HICON)wParam, (char*)lParam, false);
}
static INT_PTR sttIcoLib_ReleaseIconBig(WPARAM wParam, LPARAM lParam)
-{ return (INT_PTR)IcoLib_ReleaseIcon((HICON)wParam, (char*)lParam, true);
+{
+ return (INT_PTR)IcoLib_ReleaseIcon((HICON)wParam, (char*)lParam, true);
}
static INT_PTR sttIcoLib_IsManaged(WPARAM wParam, LPARAM)
-{ return (INT_PTR)IcoLib_IsManaged((HICON)wParam);
+{
+ return (INT_PTR)IcoLib_IsManaged((HICON)wParam);
}
int LoadIcoLibModule(void)
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 9b2c341b64..09faff70e9 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -115,18 +115,21 @@ HICON IconItem_GetIcon_Preview(IconItem* item) hIcon = CopyIcon(hRefIcon);
if (item->default_icon->icon == hRefIcon)
IconSourceItem_ReleaseIcon(item->default_icon);
- } }
+ }
+ }
if ( !hIcon && item->default_file) {
IconSourceItem_Release(&item->default_icon);
- item->default_icon = GetIconSourceItem(item->default_file, item->default_indx, item->cx, item->cy);
+ item->default_icon = GetIconSourceItem(item->default_file, item->default_indx, item->cx, item->cy);
if (item->default_icon) {
HICON hRefIcon = IconSourceItem_GetIcon(item->default_icon);
if (hRefIcon) {
hIcon = CopyIcon(hRefIcon);
if (item->default_icon->icon == hRefIcon)
IconSourceItem_ReleaseIcon(item->default_icon);
- } } }
+ }
+ }
+ }
if ( !hIcon)
return CopyIcon(hIconBlank);
@@ -138,7 +141,8 @@ HICON IconItem_GetIcon_Preview(IconItem* item) // IcoLib GUI service routines
static void __fastcall MySetCursor(TCHAR* nCursor)
-{ SetCursor(LoadCursor(NULL, nCursor));
+{
+ SetCursor(LoadCursor(NULL, nCursor));
}
static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive)
@@ -223,7 +227,8 @@ void UndoSubItemChanges(HWND htv, HTREEITEM hItem, int cmd) while (tvi.hItem) {
UndoSubItemChanges(htv, tvi.hItem, cmd);
tvi.hItem = TreeView_GetNextSibling(htv, tvi.hItem);
-} }
+ }
+}
static void OpenIconsPage()
{
@@ -518,7 +523,8 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ImageList_DragEnter(hwndDragOver, ptDrag.x, ptDrag.y);
}
onItem = 1;
- } }
+ }
+ }
if ( !onItem && dropHiLite != -1) {
ImageList_DragLeave(hwndDragOver);
@@ -548,7 +554,8 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_sntprintf(path, MAX_PATH, _T("%s,%d"), filename, (int)lvi.lParam);
SendMessage(hwndParent, DM_CHANGEICON, dropHiLite, (LPARAM)path);
ListView_SetItemState( GetDlgItem(hwndParent, IDC_PREVIEW), dropHiLite, 0, LVIS_DROPHILITED);
- } }
+ }
+ }
break;
case WM_NOTIFY:
@@ -577,7 +584,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_SIZE: // make the dlg resizeable
- if ( !IsIconic(hwndDlg)) {
+ if ( !IsIconic(hwndDlg)) {
UTILRESIZEDIALOG urd = {0};
urd.cbSize = sizeof(urd);
urd.hInstance = hInst;
@@ -603,11 +610,13 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // IcoLib options window procedure
static int CALLBACK DoSortIconsFunc(LPARAM lParam1, LPARAM lParam2, LPARAM)
-{ return lstrcmpi(iconList[lParam1]->getDescr(), iconList[lParam2]->getDescr());
+{
+ return lstrcmpi(iconList[lParam1]->getDescr(), iconList[lParam2]->getDescr());
}
static int CALLBACK DoSortIconsFuncByOrder(LPARAM lParam1, LPARAM lParam2, LPARAM)
-{ return iconList[lParam1]->orderID - iconList[lParam2]->orderID;
+{
+ return iconList[lParam1]->orderID - iconList[lParam2]->orderID;
}
static void SaveCollapseState(HWND hwndTree)
@@ -661,7 +670,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM //
{
mir_cslock lck(csIconList);
-
+
for (int indx = 0; indx < iconList.getCount(); indx++) {
iconList[indx]->temp_file = NULL;
iconList[indx]->temp_icon = NULL;
@@ -736,7 +745,8 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TreeView_GetItem(hwndTree, &tvi);
TreeItem *treeItem = (TreeItem *)tvi.lParam;
treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, SECTIONPARAM_HAVEPAGE);
- } }
+ }
+ }
if (sectionName) {
*sectionName = '/';
@@ -815,7 +825,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ( !hIcon)
hIcon = IconItem_GetIcon_Preview(iconList[lvi.lParam]);
}
-
+
if (hIcon)
ImageList_ReplaceIcon(hIml, lvi.iImage, hIcon);
if (hIcon != iconList[lvi.lParam]->temp_icon) SafeDestroyIcon(&hIcon);
@@ -872,7 +882,8 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM MySetCursor(IDC_ARROW);
DoOptionsChanged(hwndDlg);
- } }
+ }
+ }
break;
case WM_CONTEXTMENU:
@@ -898,7 +909,9 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM DoOptionsChanged(hwndDlg);
break;
- } } }
+ }
+ }
+ }
}
else {
HWND htv = GetDlgItem(hwndDlg, IDC_CATEGORYLIST);
@@ -911,7 +924,9 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM UndoSubItemChanges(htv, TreeView_GetSelection(htv), cmd);
DoOptionsChanged(hwndDlg);
break;
- } } }
+ }
+ }
+ }
break;
case WM_NOTIFY:
@@ -960,7 +975,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_sntprintf(pInfoTip->pszText, pInfoTip->cchTextMax, _T("%s, %d"), item->default_file, item->default_indx);
}
}
- if (bNeedRebuild) {
+ if (bNeedRebuild) {
bNeedRebuild = FALSE;
SendMessage(hwndDlg, DM_REBUILD_CTREE, 0, 0);
}
@@ -991,12 +1006,14 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
}
}
- if (bNeedRebuild) {
- { mir_cslock lck(csIconList);
+ if (bNeedRebuild) {
+ {
+ mir_cslock lck(csIconList);
bNeedRebuild = FALSE;
}
SendMessage(hwndDlg, DM_REBUILD_CTREE, 0, 0);
- } }
+ }
+ }
break;
case WM_DESTROY:
|