summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-01 10:55:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-01 10:55:53 +0000
commitf11c036cdf66a3f0ab9261ee6398b6907b7b59ff (patch)
treee696c02044ba79f5e8c064aad17bf66eaf579e47
parent8580a1f565a8c99f6c133a4e75424b0b79b5700c (diff)
fix in GDI leak in extra icons options
git-svn-id: http://svn.miranda-ng.org/main/trunk@2584 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--src/miranda32_10.vcxproj4
-rw-r--r--src/miranda32_10.vcxproj.filters12
-rw-r--r--src/modules/extraicons/BaseExtraIcon.h51
-rw-r--r--src/modules/extraicons/CallbackExtraIcon.h47
-rw-r--r--src/modules/extraicons/DefaultExtraIcons.h26
-rw-r--r--src/modules/extraicons/ExtraIcon.h117
-rw-r--r--src/modules/extraicons/ExtraIconGroup.h63
-rw-r--r--src/modules/extraicons/IcolibExtraIcon.h41
-rw-r--r--src/modules/extraicons/extraicons.h7
-rw-r--r--src/modules/extraicons/options_ei.cpp73
10 files changed, 145 insertions, 296 deletions
diff --git a/src/miranda32_10.vcxproj b/src/miranda32_10.vcxproj
index 006a9ee102..b9359a4688 100644
--- a/src/miranda32_10.vcxproj
+++ b/src/miranda32_10.vcxproj
@@ -246,11 +246,7 @@
<ClInclude Include="core\stdplug.h" />
<ClInclude Include="modules\database\database.h" />
<ClInclude Include="modules\database\profilemanager.h" />
- <ClInclude Include="modules\extraicons\BaseExtraIcon.h" />
- <ClInclude Include="modules\extraicons\CallbackExtraIcon.h" />
- <ClInclude Include="modules\extraicons\DefaultExtraIcons.h" />
<ClInclude Include="modules\extraicons\ExtraIcon.h" />
- <ClInclude Include="modules\extraicons\ExtraIconGroup.h" />
<ClInclude Include="modules\extraicons\extraicons.h" />
<ClInclude Include="modules\extraicons\IcolibExtraIcon.h" />
<ClInclude Include="modules\extraicons\usedIcons.h" />
diff --git a/src/miranda32_10.vcxproj.filters b/src/miranda32_10.vcxproj.filters
index 2a08b590be..e803048fde 100644
--- a/src/miranda32_10.vcxproj.filters
+++ b/src/miranda32_10.vcxproj.filters
@@ -276,21 +276,9 @@
<ClInclude Include="modules\database\database.h">
<Filter>Modules\database</Filter>
</ClInclude>
- <ClInclude Include="modules\extraicons\BaseExtraIcon.h">
- <Filter>Modules\extraicons</Filter>
- </ClInclude>
- <ClInclude Include="modules\extraicons\CallbackExtraIcon.h">
- <Filter>Modules\extraicons</Filter>
- </ClInclude>
- <ClInclude Include="modules\extraicons\DefaultExtraIcons.h">
- <Filter>Modules\extraicons</Filter>
- </ClInclude>
<ClInclude Include="modules\extraicons\ExtraIcon.h">
<Filter>Modules\extraicons</Filter>
</ClInclude>
- <ClInclude Include="modules\extraicons\ExtraIconGroup.h">
- <Filter>Modules\extraicons</Filter>
- </ClInclude>
<ClInclude Include="modules\extraicons\IcolibExtraIcon.h">
<Filter>Modules\extraicons</Filter>
</ClInclude>
diff --git a/src/modules/extraicons/BaseExtraIcon.h b/src/modules/extraicons/BaseExtraIcon.h
deleted file mode 100644
index 3f5e15c986..0000000000
--- a/src/modules/extraicons/BaseExtraIcon.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- Copyright (C) 2009 Ricardo Pescuma Domenecci
-
- This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this file; see the file license.txt. If
- not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-#ifndef __BASEEXTRAICON_H__
-#define __BASEEXTRAICON_H__
-
-#include "ExtraIcon.h"
-
-class BaseExtraIcon : public ExtraIcon
-{
-public:
- BaseExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
- virtual ~BaseExtraIcon();
-
- virtual int getID() const;
- virtual const TCHAR *getDescription() const;
- virtual void setDescription(const TCHAR *desc);
- virtual const char *getDescIcon() const;
- virtual void setDescIcon(const char *icon);
- virtual int getType() const =0;
-
- virtual void onClick(HANDLE hContact);
- virtual void setOnClick(MIRANDAHOOKPARAM OnClick, LPARAM param);
-
- virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage);
-
-protected:
- int id;
- std::tstring description;
- std::string descIcon;
- MIRANDAHOOKPARAM OnClick;
- LPARAM onClickParam;
-};
-
-#endif // __BASEEXTRAICON_H__
diff --git a/src/modules/extraicons/CallbackExtraIcon.h b/src/modules/extraicons/CallbackExtraIcon.h
deleted file mode 100644
index 0434f91aeb..0000000000
--- a/src/modules/extraicons/CallbackExtraIcon.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Copyright (C) 2009 Ricardo Pescuma Domenecci
-
- This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this file; see the file license.txt. If
- not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-#ifndef __CALLBACKEXTRAICON_H__
-#define __CALLBACKEXTRAICON_H__
-
-#include "BaseExtraIcon.h"
-
-class CallbackExtraIcon : public BaseExtraIcon
-{
-public:
- CallbackExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon,
- MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
- virtual ~CallbackExtraIcon();
-
- virtual int getType() const;
-
- virtual void rebuildIcons();
- virtual void applyIcon(HANDLE hContact);
-
- virtual int setIcon(int id, HANDLE hContact, HANDLE icon);
- virtual int setIconByName(int id, HANDLE hContact, const char* icon);
-
-private:
- int(*RebuildIcons)(WPARAM wParam, LPARAM lParam);
- int(*ApplyIcon)(WPARAM wParam, LPARAM lParam);
-
- bool needToRebuild;
-};
-
-#endif // __CALLBACKEXTRAICON_H__
diff --git a/src/modules/extraicons/DefaultExtraIcons.h b/src/modules/extraicons/DefaultExtraIcons.h
deleted file mode 100644
index fba4602d41..0000000000
--- a/src/modules/extraicons/DefaultExtraIcons.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- Copyright (C) 2009 Ricardo Pescuma Domenecci
-
- This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this file; see the file license.txt. If
- not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-#ifndef __DEFAULTEXTRAICONS_H__
-#define __DEFAULTEXTRAICONS_H__
-
-void DefaultExtraIcons_Load();
-void DefaultExtraIcons_Unload();
-
-#endif // __DEFAULTEXTRAICONS_H__
diff --git a/src/modules/extraicons/ExtraIcon.h b/src/modules/extraicons/ExtraIcon.h
index ae9e1ab797..a4623b454f 100644
--- a/src/modules/extraicons/ExtraIcon.h
+++ b/src/modules/extraicons/ExtraIcon.h
@@ -21,9 +21,13 @@
#define __EXTRAICON_H__
#include <string>
+#include <vector>
#define EXTRAICON_TYPE_GROUP -1
+/////////////////////////////////////////////////////////////////////////////////////////
+// ExtraIcon - base class for all extra icons
+
class ExtraIcon
{
public:
@@ -62,7 +66,7 @@ public:
bool operator>(const ExtraIcon &other) const;
bool operator>=(const ExtraIcon &other) const;
- virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage) =0;
+ virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage) = 0;
int hLangpack;
@@ -73,4 +77,115 @@ protected:
int position;
};
+/////////////////////////////////////////////////////////////////////////////////////////
+// BaseExtraIcon - basic class for all 'real' extra icons
+
+class BaseExtraIcon : public ExtraIcon
+{
+public:
+ BaseExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
+ virtual ~BaseExtraIcon();
+
+ virtual int getID() const;
+ virtual const TCHAR *getDescription() const;
+ virtual void setDescription(const TCHAR *desc);
+ virtual const char *getDescIcon() const;
+ virtual void setDescIcon(const char *icon);
+ virtual int getType() const =0;
+
+ virtual void onClick(HANDLE hContact);
+ virtual void setOnClick(MIRANDAHOOKPARAM OnClick, LPARAM param);
+
+ virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage);
+
+protected:
+ int id;
+ std::tstring description;
+ std::string descIcon;
+ MIRANDAHOOKPARAM OnClick;
+ LPARAM onClickParam;
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// CallbackExtraIcon - extra icon, implemented using callback functions
+
+class CallbackExtraIcon : public BaseExtraIcon
+{
+public:
+ CallbackExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon,
+ MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
+ virtual ~CallbackExtraIcon();
+
+ virtual int getType() const;
+
+ virtual void rebuildIcons();
+ virtual void applyIcon(HANDLE hContact);
+
+ virtual int setIcon(int id, HANDLE hContact, HANDLE icon);
+ virtual int setIconByName(int id, HANDLE hContact, const char* icon);
+
+private:
+ int(*RebuildIcons)(WPARAM wParam, LPARAM lParam);
+ int(*ApplyIcon)(WPARAM wParam, LPARAM lParam);
+
+ bool needToRebuild;
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// IcolibExtraIcon - extra icon, implemented using icolib
+
+class IcolibExtraIcon : public BaseExtraIcon
+{
+public:
+ IcolibExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
+ virtual ~IcolibExtraIcon();
+
+ virtual int getType() const;
+
+ virtual void rebuildIcons();
+ virtual void applyIcon(HANDLE hContact);
+
+ virtual int setIcon(int id, HANDLE hContact, HANDLE icon);
+ virtual int setIconByName(int id, HANDLE hContact, const char* icon);
+ virtual void storeIcon(HANDLE hContact, void *icon);
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// ExtraIconGroup - joins some slots into one
+
+class ExtraIconGroup : public ExtraIcon
+{
+ int internalSetIcon(int id, HANDLE hContact, HANDLE icon, bool bByName);
+public:
+ ExtraIconGroup(const char *name);
+ virtual ~ExtraIconGroup();
+
+ virtual void addExtraIcon(BaseExtraIcon *extra);
+
+ virtual void rebuildIcons();
+ virtual void applyIcon(HANDLE hContact);
+ virtual void onClick(HANDLE hContact);
+
+ virtual int setIcon(int id, HANDLE hContact, HANDLE icon);
+ virtual int setIconByName(int id, HANDLE hContact, const char* icon);
+
+ virtual const TCHAR *getDescription() const;
+ virtual const char *getDescIcon() const;
+ virtual int getType() const;
+
+ virtual int getPosition() const;
+ virtual void setSlot(int slot);
+
+ std::vector<BaseExtraIcon*> items;
+
+ virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage);
+
+protected:
+ std::tstring description;
+ bool setValidExtraIcon;
+ bool insideApply;
+
+ virtual ExtraIcon *getCurrentItem(HANDLE hContact) const;
+};
+
#endif // __EXTRAICON_H__
diff --git a/src/modules/extraicons/ExtraIconGroup.h b/src/modules/extraicons/ExtraIconGroup.h
deleted file mode 100644
index 24671d07d8..0000000000
--- a/src/modules/extraicons/ExtraIconGroup.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Copyright (C) 2009 Ricardo Pescuma Domenecci
-
- This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this file; see the file license.txt. If
- not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EXTRAICONGROUP_H__
-#define __EXTRAICONGROUP_H__
-
-#include <vector>
-#include "ExtraIcon.h"
-
-class BaseExtraIcon;
-
-class ExtraIconGroup : public ExtraIcon
-{
- int internalSetIcon(int id, HANDLE hContact, HANDLE icon, bool bByName);
-public:
- ExtraIconGroup(const char *name);
- virtual ~ExtraIconGroup();
-
- virtual void addExtraIcon(BaseExtraIcon *extra);
-
- virtual void rebuildIcons();
- virtual void applyIcon(HANDLE hContact);
- virtual void onClick(HANDLE hContact);
-
- virtual int setIcon(int id, HANDLE hContact, HANDLE icon);
- virtual int setIconByName(int id, HANDLE hContact, const char* icon);
-
- virtual const TCHAR *getDescription() const;
- virtual const char *getDescIcon() const;
- virtual int getType() const;
-
- virtual int getPosition() const;
- virtual void setSlot(int slot);
-
- std::vector<BaseExtraIcon*> items;
-
- virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage);
-
-protected:
- std::tstring description;
- bool setValidExtraIcon;
- bool insideApply;
-
- virtual ExtraIcon *getCurrentItem(HANDLE hContact) const;
-};
-
-#endif // __EXTRAICONGROUP_H__
diff --git a/src/modules/extraicons/IcolibExtraIcon.h b/src/modules/extraicons/IcolibExtraIcon.h
deleted file mode 100644
index beb24fbdc3..0000000000
--- a/src/modules/extraicons/IcolibExtraIcon.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Copyright (C) 2009 Ricardo Pescuma Domenecci
-
- This is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this file; see the file license.txt. If
- not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
-
-#ifndef __ICOLIBEXTRAICON_H__
-#define __ICOLIBEXTRAICON_H__
-
-#include "BaseExtraIcon.h"
-
-class IcolibExtraIcon : public BaseExtraIcon
-{
-public:
- IcolibExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
- virtual ~IcolibExtraIcon();
-
- virtual int getType() const;
-
- virtual void rebuildIcons();
- virtual void applyIcon(HANDLE hContact);
-
- virtual int setIcon(int id, HANDLE hContact, HANDLE icon);
- virtual int setIconByName(int id, HANDLE hContact, const char* icon);
- virtual void storeIcon(HANDLE hContact, void *icon);
-};
-
-#endif // __ICOLIBEXTRAICON_H__
diff --git a/src/modules/extraicons/extraicons.h b/src/modules/extraicons/extraicons.h
index 95807832e3..7d8f14e2fc 100644
--- a/src/modules/extraicons/extraicons.h
+++ b/src/modules/extraicons/extraicons.h
@@ -29,9 +29,7 @@ extern HINSTANCE hInst;
#define ICON_SIZE 16
-class ExtraIconGroup;
-class ExtraIcon;
-class BaseExtraIcon;
+#include "Extraicon.h"
extern LIST<BaseExtraIcon> registeredExtraIcons;
extern vector<ExtraIcon*> extraIconsByHandle;
@@ -44,6 +42,9 @@ int ConvertToClistSlot(int slot);
int Clist_SetExtraIcon(HANDLE hContact, int slot, HANDLE hImage);
+void DefaultExtraIcons_Load();
+void DefaultExtraIcons_Unload();
+
HANDLE ExtraIcon_Add(HICON hIcon);
void fnReloadExtraIcons();
diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp
index 3a70169f98..59d80c3da9 100644
--- a/src/modules/extraicons/options_ei.cpp
+++ b/src/modules/extraicons/options_ei.cpp
@@ -254,7 +254,6 @@ static HTREEITEM Tree_AddExtraIcon(HWND tree, BaseExtraIcon *extra, bool selecte
ids->push_back(extra->getID());
TVINSERTSTRUCT tvis = { 0 };
- tvis.hParent = NULL;
tvis.hInsertAfter = hAfter;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
@@ -283,7 +282,6 @@ static HTREEITEM Tree_AddExtraIconGroup(HWND tree, vector<int> &group, bool sele
}
TVINSERTSTRUCT tvis = { 0 };
- tvis.hParent = NULL;
tvis.hInsertAfter = hAfter;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
@@ -411,6 +409,8 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor
static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ HWND tree = GetDlgItem(hwndDlg, IDC_EXTRAORDER);
+
static int dragging = 0;
static HANDLE hDragItem = NULL;
@@ -428,36 +428,30 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
ShowWindow(label, SW_SHOW);
}
- HWND tree = GetDlgItem(hwndDlg, IDC_EXTRAORDER);
SetWindowLongPtr(tree, GWL_STYLE, GetWindowLongPtr(tree, GWL_STYLE) | TVS_NOHSCROLL);
int cx = GetSystemMetrics(SM_CXSMICON);
HIMAGELIST hImageList = ImageList_Create(cx, cx, ILC_COLOR32 | ILC_MASK, 2, 2);
- HICON hDefaultIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED);
- ImageList_AddIcon(hImageList, hDefaultIcon);
- DestroyIcon(hDefaultIcon);
+ HICON hBlankIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, cx, cx, 0);
+ ImageList_AddIcon(hImageList, hBlankIcon);
- unsigned int i;
- for (i = 0; i < registeredExtraIcons.getCount(); i++) {
+ for (int i = 0; i < registeredExtraIcons.getCount(); i++) {
ExtraIcon *extra = registeredExtraIcons[i];
HICON hIcon = Skin_GetIcon(extra->getDescIcon());
- if (hIcon == NULL) {
- HICON hDefaultIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, cx, cx,
- LR_DEFAULTCOLOR | LR_SHARED);
- ImageList_AddIcon(hImageList, hDefaultIcon);
- DestroyIcon(hDefaultIcon);
- }
+ if (hIcon == NULL)
+ ImageList_AddIcon(hImageList, hBlankIcon);
else {
ImageList_AddIcon(hImageList, hIcon);
Skin_ReleaseIcon(hIcon);
}
}
TreeView_SetImageList(tree, hImageList, TVSIL_NORMAL);
+ DestroyIcon(hBlankIcon);
- for (i = 0; i < extraIconsBySlot.size(); i++) {
- ExtraIcon *extra = extraIconsBySlot[i];
+ for (unsigned k = 0; k < extraIconsBySlot.size(); k++) {
+ ExtraIcon *extra = extraIconsBySlot[k];
if (extra->getType() == EXTRAICON_TYPE_GROUP) {
ExtraIconGroup *group = (ExtraIconGroup *) extra;
@@ -476,21 +470,17 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
TreeView_SortChildrenCB(tree, &sort, 0);
origTreeProc = (WNDPROC) SetWindowLongPtr(tree, GWLP_WNDPROC, (INT_PTR)TreeProc);
-
- return TRUE;
}
+ return TRUE;
+
case WM_NOTIFY:
{
LPNMHDR lpnmhdr = (LPNMHDR) lParam;
if (lpnmhdr->idFrom == 0) {
if (lpnmhdr->code == (UINT) PSN_APPLY) {
- unsigned int i;
-
- HWND tree = GetDlgItem(hwndDlg, IDC_EXTRAORDER);
-
// Store old slots
int *oldSlots = new int[registeredExtraIcons.getCount()];
- int lastUsedSlot = -1;
+ int i, lastUsedSlot = -1;
for (i = 0; i < registeredExtraIcons.getCount(); i++) {
if (extraIconsByHandle[i] == registeredExtraIcons[i])
oldSlots[i] = registeredExtraIcons[i]->getSlot();
@@ -534,7 +524,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
ExtraIconGroup *group = new ExtraIconGroup(name);
- for (i = 0; i < ids->size(); i++) {
+ for (unsigned i = 0; i < ids->size(); i++) {
BaseExtraIcon *extra = registeredExtraIcons[ids->at(i) - 1];
extra->setPosition(pos++);
@@ -599,8 +589,6 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
}
else if (lpnmhdr->idFrom == IDC_EXTRAORDER) {
- HWND tree = GetDlgItem(hwndDlg, IDC_EXTRAORDER);
-
switch (lpnmhdr->code) {
case TVN_BEGINDRAGW:
case TVN_BEGINDRAGA:
@@ -670,12 +658,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
}
case WM_MOUSEMOVE:
- {
- if (!dragging)
- break;
-
- HWND tree = GetDlgItem(hwndDlg, IDC_EXTRAORDER);
-
+ if (dragging) {
TVHITTESTINFO hti;
hti.pt.x = (short) LOWORD(lParam);
hti.pt.y = (short) HIWORD(lParam);
@@ -698,15 +681,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SendDlgItemMessage(hwndDlg, IDC_EXTRAORDER, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN,0), 0);
TreeView_SetInsertMark(tree, NULL, 0);
}
- break;
}
- case WM_LBUTTONUP:
- {
- if (!dragging)
- break;
-
- HWND tree = GetDlgItem(hwndDlg, IDC_EXTRAORDER);
+ break;
+ case WM_LBUTTONUP:
+ if (dragging) {
TreeView_SetInsertMark(tree, NULL, 0);
dragging = 0;
ReleaseCapture();
@@ -749,16 +728,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
case WM_DESTROY:
- {
- HWND tree = GetDlgItem(hwndDlg, IDC_EXTRAORDER);
- HTREEITEM hItem = TreeView_GetRoot(tree);
- while (hItem) {
- delete Tree_GetIDs(tree, hItem);
- hItem = TreeView_GetNextSibling(tree, hItem);
- }
-
- break;
+ HTREEITEM hItem = TreeView_GetRoot(tree);
+ while (hItem) {
+ delete Tree_GetIDs(tree, hItem);
+ hItem = TreeView_GetNextSibling(tree, hItem);
}
+
+ ImageList_Destroy( TreeView_GetImageList(tree, TVSIL_NORMAL));
+ break;
}
return 0;