summaryrefslogtreecommitdiff
path: root/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins')
-rw-r--r--Plugins/extraicons/DefaultExtraIcons.cpp10
-rw-r--r--Plugins/extraicons/Docs/extraicons_changelog.txt6
-rw-r--r--Plugins/extraicons/Docs/extraicons_version.txt2
-rw-r--r--Plugins/extraicons/ExtraIcon.cpp3
-rw-r--r--Plugins/extraicons/ExtraIconGroup.cpp8
-rw-r--r--Plugins/extraicons/ExtraIconGroup.h1
-rw-r--r--Plugins/extraicons/commons.h2
-rw-r--r--Plugins/extraicons/extraicons.cpp29
-rw-r--r--Plugins/extraicons/extraicons.dsp6
-rw-r--r--Plugins/extraicons/options.cpp21
-rw-r--r--Plugins/extraicons/usedIcons.cpp6
11 files changed, 45 insertions, 49 deletions
diff --git a/Plugins/extraicons/DefaultExtraIcons.cpp b/Plugins/extraicons/DefaultExtraIcons.cpp
index 32549be..ebdaddf 100644
--- a/Plugins/extraicons/DefaultExtraIcons.cpp
+++ b/Plugins/extraicons/DefaultExtraIcons.cpp
@@ -62,7 +62,7 @@ static void SetVisibility(HANDLE hContact, int apparentMode, BOOL clear)
if (IsEmpty(proto))
return;
- if (apparentMode < 0)
+ if (apparentMode <= 0)
apparentMode = DBGetContactSettingWord(hContact, proto, "ApparentMode", 0);
const char *ico = NULL;
@@ -103,10 +103,10 @@ static void SetGender(HANDLE hContact, int gender, BOOL clear)
if (IsEmpty(proto))
return;
- if (gender < 0)
- gender = DBGetContactSettingByte(hContact, proto, "Gender", -1);
- if (gender < 0)
- gender = DBGetContactSettingByte(hContact, "UserInfo", "Gender", -1);
+ if (gender <= 0)
+ gender = DBGetContactSettingByte(hContact, proto, "Gender", 0);
+ if (gender <= 0)
+ gender = DBGetContactSettingByte(hContact, "UserInfo", "Gender", 0);
const char *ico = NULL;
if (gender == 'M')
diff --git a/Plugins/extraicons/Docs/extraicons_changelog.txt b/Plugins/extraicons/Docs/extraicons_changelog.txt
index 3ce4d69..2691db4 100644
--- a/Plugins/extraicons/Docs/extraicons_changelog.txt
+++ b/Plugins/extraicons/Docs/extraicons_changelog.txt
@@ -2,6 +2,12 @@ Extra Icons Service
Changelog:
+. 0.2.3.0
+ * Fix for initial position of icons
+
+. 0.2.2.0
+ * Fix for external plugins overriding internal icons
+
. 0.2.1.0
* Fix for multi selection in Windows Vista
+ CTRL now deselects too
diff --git a/Plugins/extraicons/Docs/extraicons_version.txt b/Plugins/extraicons/Docs/extraicons_version.txt
index cff5772..d375c54 100644
--- a/Plugins/extraicons/Docs/extraicons_version.txt
+++ b/Plugins/extraicons/Docs/extraicons_version.txt
@@ -1 +1 @@
-Extra Icons Service 0.2.1.0 \ No newline at end of file
+Extra Icons Service 0.2.3.0 \ No newline at end of file
diff --git a/Plugins/extraicons/ExtraIcon.cpp b/Plugins/extraicons/ExtraIcon.cpp
index 52047a5..1aaab01 100644
--- a/Plugins/extraicons/ExtraIcon.cpp
+++ b/Plugins/extraicons/ExtraIcon.cpp
@@ -77,6 +77,9 @@ void ExtraIcon::applyIcons()
int ExtraIcon::compare(const ExtraIcon *other) const
{
+ if (this == other)
+ return 0;
+
int ret = getPosition() - other->getPosition();
if (ret != 0)
return ret;
diff --git a/Plugins/extraicons/ExtraIconGroup.cpp b/Plugins/extraicons/ExtraIconGroup.cpp
index ca12394..64edf5b 100644
--- a/Plugins/extraicons/ExtraIconGroup.cpp
+++ b/Plugins/extraicons/ExtraIconGroup.cpp
@@ -70,6 +70,14 @@ void ExtraIconGroup::applyIcon(HANDLE hContact)
DBWriteContactSettingDword(hContact, MODULE_NAME, name.c_str(), setValidExtraIcon ? items[i]->getID() : 0);
}
+int ExtraIconGroup::getPosition() const
+{
+ int pos = INT_MAX;
+ for (unsigned int i = 0; i < items.size(); ++i)
+ pos = MIN(pos, items[i]->getPosition());
+ return pos;
+}
+
void ExtraIconGroup::setSlot(int slot)
{
ExtraIcon::setSlot(slot);
diff --git a/Plugins/extraicons/ExtraIconGroup.h b/Plugins/extraicons/ExtraIconGroup.h
index 9a4d221..aa02a03 100644
--- a/Plugins/extraicons/ExtraIconGroup.h
+++ b/Plugins/extraicons/ExtraIconGroup.h
@@ -44,6 +44,7 @@ public:
virtual const char *getDescIcon() const;
virtual int getType() const;
+ virtual int getPosition() const;
virtual void setSlot(int slot);
std::vector<BaseExtraIcon*> items;
diff --git a/Plugins/extraicons/commons.h b/Plugins/extraicons/commons.h
index ffe0505..e2140fd 100644
--- a/Plugins/extraicons/commons.h
+++ b/Plugins/extraicons/commons.h
@@ -57,6 +57,8 @@ using namespace std;
#include <m_skin.h>
#include <m_userinfo.h>
+#include "..\utils\mir_icons.h"
+
#include "resource.h"
#include "m_extraicons.h"
diff --git a/Plugins/extraicons/extraicons.cpp b/Plugins/extraicons/extraicons.cpp
index d7e8d88..cf87a3b 100644
--- a/Plugins/extraicons/extraicons.cpp
+++ b/Plugins/extraicons/extraicons.cpp
@@ -24,7 +24,7 @@
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
"Extra Icons Service",
- PLUGIN_MAKE_VERSION(0,2,1,0),
+ PLUGIN_MAKE_VERSION(0,2,3,0),
"Extra Icons Service",
"Ricardo Pescuma Domenecci",
"",
@@ -89,28 +89,6 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
return interfaces;
}
-static void IcoLib_Register(char *name, char *section, char *description, int id)
-{
- HICON hIcon = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) name);
- if (hIcon != NULL)
- return;
-
- SKINICONDESC sid = { 0 };
- sid.cbSize = sizeof(SKINICONDESC);
- sid.flags = SIDF_TCHAR;
- sid.pszName = name;
- sid.pszSection = section;
- sid.pszDescription = description;
-
- int cx = GetSystemMetrics(SM_CXSMICON);
- sid.hDefaultIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED);
-
- CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
-
- if (sid.hDefaultIcon)
- DestroyIcon(sid.hDefaultIcon);
-}
-
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
pluginLink = link;
@@ -283,7 +261,7 @@ static void LoadGroups(vector<ExtraIconGroup *> &groups)
continue;
mir_snprintf(setting, MAX_REGS(setting), "__group_%d", i);
- ExtraIconGroup *group = new ExtraIconGroup(setting); // TODO Remove name
+ ExtraIconGroup *group = new ExtraIconGroup(setting);
for (unsigned int j = 0; j < items; ++j)
{
@@ -395,14 +373,13 @@ int ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
BaseExtraIcon *extra = GetExtraIconByName(ei->name);
if (extra != NULL)
{
- if (ei->type != extra->getType() || ei->type != EXTRAICON_TYPE_CALLBACK)
+ if (ei->type != extra->getType() || ei->type != EXTRAICON_TYPE_ICOLIB)
return 0;
// Found one, now merge it
if (stricmp(extra->getDescription(), desc))
{
- // TODO Handle group
string newDesc = extra->getDescription();
newDesc += " / ";
newDesc += desc;
diff --git a/Plugins/extraicons/extraicons.dsp b/Plugins/extraicons/extraicons.dsp
index 7350649..cb0d8d2 100644
--- a/Plugins/extraicons/extraicons.dsp
+++ b/Plugins/extraicons/extraicons.dsp
@@ -192,7 +192,7 @@ SOURCE=.\m_extraicons.h
# End Source File
# Begin Source File
-SOURCE=..\utils\mir_memory.h
+SOURCE=..\utils\mir_icons.h
# End Source File
# Begin Source File
@@ -272,6 +272,10 @@ SOURCE=.\IcolibExtraIcon.cpp
# End Source File
# Begin Source File
+SOURCE=..\utils\mir_icons.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\options.cpp
# End Source File
# Begin Source File
diff --git a/Plugins/extraicons/options.cpp b/Plugins/extraicons/options.cpp
index 6c1ed72..965cb2a 100644
--- a/Plugins/extraicons/options.cpp
+++ b/Plugins/extraicons/options.cpp
@@ -194,7 +194,6 @@ static int GetNumSelected(HWND tree)
static void Tree_GetSelected(HWND tree, vector<HTREEITEM> &selected)
{
- int ret = 0;
HTREEITEM hItem = TreeView_GetRoot(tree);
while (hItem)
{
@@ -206,7 +205,7 @@ static void Tree_GetSelected(HWND tree, vector<HTREEITEM> &selected)
static void Tree_Select(HWND tree, vector<HTREEITEM> &selected)
{
- for(unsigned int i = 0; i < selected.size(); i++)
+ for (unsigned int i = 0; i < selected.size(); i++)
if (selected[i] != NULL)
Tree_Select(tree, selected[i]);
}
@@ -241,8 +240,9 @@ LRESULT CALLBACK TreeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
vector<HTREEITEM> selected;
Tree_GetSelected(hwndDlg, selected);
+
// Check if have to deselect it
- for(unsigned int i = 0; i < selected.size(); i++)
+ for (unsigned int i = 0; i < selected.size(); i++)
{
if (selected[i] == hti.hItem)
{
@@ -254,7 +254,7 @@ LRESULT CALLBACK TreeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
hti.hItem = selected[0];
else if (i + 1 < selected.size())
- hti.hItem = selected[i+1];
+ hti.hItem = selected[i + 1];
else
hti.hItem = NULL;
@@ -505,9 +505,7 @@ static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
{
ExtraIcon *extra = registeredExtraIcons[i];
- HICON hIcon = NULL;
- if (!IsEmpty(extra->getDescIcon()))
- hIcon = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) extra->getDescIcon());
+ HICON hIcon = IcoLib_LoadIcon(extra->getDescIcon());
if (hIcon == NULL)
{
@@ -517,10 +515,10 @@ static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
DestroyIcon(hDefaultIcon);
}
else
+ {
ImageList_AddIcon(hImageList, hIcon);
-
- if (hIcon != NULL)
- CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
+ }
}
TreeView_SetImageList(tree, hImageList, TVSIL_NORMAL);
@@ -614,7 +612,6 @@ static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
mir_snprintf(name, MAX_REGS(name), "__group_%d", groups.size());
ExtraIconGroup *group = new ExtraIconGroup(name);
- group->setPosition(pos);
for (i = 0; i < ids->size(); ++i)
{
@@ -635,7 +632,7 @@ static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
// Store data
for (i = 0; i < registeredExtraIcons.size(); ++i)
{
- ExtraIcon *extra = registeredExtraIcons[i];
+ BaseExtraIcon *extra = registeredExtraIcons[i];
char setting[512];
mir_snprintf(setting, MAX_REGS(setting), "Position_%s", extra->getName());
diff --git a/Plugins/extraicons/usedIcons.cpp b/Plugins/extraicons/usedIcons.cpp
index 010f0d8..9726381 100644
--- a/Plugins/extraicons/usedIcons.cpp
+++ b/Plugins/extraicons/usedIcons.cpp
@@ -19,7 +19,6 @@
#include "commons.h"
-
struct Icon
{
string name;
@@ -56,14 +55,14 @@ static Icon * FindIcon(const char *icolibName)
if (icon->hImage == NULL)
{
- HICON hIcon = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) icon->name.c_str());
+ HICON hIcon = IcoLib_LoadIcon(icon->name.c_str());
if (hIcon != NULL)
{
icon->hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM) hIcon, 0);
if (icon->hImage == (HANDLE) -1)
icon->hImage = NULL;
- CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
}
}
@@ -110,4 +109,3 @@ void ResetIcons()
}
}
-