diff options
20 files changed, 296 insertions, 102 deletions
diff --git a/Plugins/extraicons/CallbackExtraIcon.cpp b/Plugins/extraicons/CallbackExtraIcon.cpp index 81153d6..8ea2631 100644 --- a/Plugins/extraicons/CallbackExtraIcon.cpp +++ b/Plugins/extraicons/CallbackExtraIcon.cpp @@ -20,10 +20,9 @@ #include "commons.h"
CallbackExtraIcon::CallbackExtraIcon(const char *name, const char *description, const char *descIcon,
- int(*RebuildIcons)(WPARAM wParam, LPARAM lParam), int(*ApplyIcon)(WPARAM wParam, LPARAM lParam), int(*OnClick)(
- WPARAM wParam, LPARAM lParam)) :
- ExtraIcon(name, description, descIcon, OnClick), RebuildIcons(RebuildIcons), ApplyIcon(ApplyIcon), needToRebuild(
- true)
+ MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick, LPARAM param) :
+ ExtraIcon(name, description, descIcon, OnClick, param), RebuildIcons(RebuildIcons), ApplyIcon(ApplyIcon),
+ needToRebuild(true)
{
}
diff --git a/Plugins/extraicons/CallbackExtraIcon.h b/Plugins/extraicons/CallbackExtraIcon.h index 3db9e15..a51e0d4 100644 --- a/Plugins/extraicons/CallbackExtraIcon.h +++ b/Plugins/extraicons/CallbackExtraIcon.h @@ -25,9 +25,8 @@ class CallbackExtraIcon : public ExtraIcon
{
public:
- CallbackExtraIcon(const char *name, const char *description, const char *descIcon, int(*RebuildIcons)(
- WPARAM wParam, LPARAM lParam), int(*ApplyIcon)(WPARAM wParam, LPARAM lParam), int(*OnClick)(WPARAM wParam,
- LPARAM lParam));
+ CallbackExtraIcon(const char *name, const char *description, const char *descIcon, MIRANDAHOOK RebuildIcons,
+ MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
virtual ~CallbackExtraIcon();
virtual int getType() const;
diff --git a/Plugins/extraicons/DefaultExtraIcons.cpp b/Plugins/extraicons/DefaultExtraIcons.cpp index e8aa647..9d7de2d 100644 --- a/Plugins/extraicons/DefaultExtraIcons.cpp +++ b/Plugins/extraicons/DefaultExtraIcons.cpp @@ -34,13 +34,11 @@ static void ProtocolInit();
static void DBExtraIconsInit();
-static void VisibilityInit();
void DefaultExtraIcons_Load()
{
ProtocolInit();
DBExtraIconsInit();
- VisibilityInit();
}
void DefaultExtraIcons_Unload()
@@ -49,7 +47,10 @@ void DefaultExtraIcons_Unload() // DB extra icons ///////////////////////////////////////////////////////////////////////
+struct Info;
+
HANDLE hExtraVisibility = NULL;
+HANDLE hExtraGender = NULL;
static void SetVisibility(HANDLE hContact, int apparentMode, BOOL clear)
{
@@ -87,40 +88,69 @@ static void SetVisibility(HANDLE hContact, int apparentMode, BOOL clear) ExtraIcon_SetIcon(hExtraVisibility, hContact, ico);
}
-static void VisibilityInit()
+static void SetGender(HANDLE hContact, int gender, BOOL clear)
{
- hExtraVisibility = ExtraIcon_Register("visibility", "Visibility/Chat activity", "AlwaysVis");
+ if (hContact == NULL)
+ return;
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact != NULL)
- {
- SetVisibility(hContact, -1, FALSE);
+ char *proto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ if (IsEmpty(proto))
+ return;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
+ if (gender < 0)
+ gender = DBGetContactSettingByte(hContact, proto, "Gender", -1);
+ if (gender < 0)
+ gender = DBGetContactSettingByte(hContact, "UserInfo", "Gender", -1);
+
+ const char *ico = NULL;
+ if (gender == 'M')
+ ico = "gender_male";
+ else if (gender == 'F')
+ ico = "gender_female";
+ else
+ ico = NULL;
+
+ if (ico == NULL && !clear)
+ return;
+
+ ExtraIcon_SetIcon(hExtraGender, hContact, ico);
}
-static int EmailOnClick(WPARAM wParam, LPARAM lParam);
-static int HomepageOnClick(WPARAM wParam, LPARAM lParam);
+static void EmailOnClick(Info *info, const char *text);
+static void HomepageOnClick(Info *info, const char *text);
+static void DefaultSetIcon(HANDLE hContact, Info *info, const char *text);
struct Info
{
const char *name;
const char *desc;
const char *icon;
- const char *db[4];
- int (*OnClick)(WPARAM wParam, LPARAM lParam);
+ const char *db[6];
+ void (*SetIcon)(HANDLE hContact, Info *info, const char *text);
+ void (*OnClick)(Info *info, const char *text);
HANDLE hExtraIcon;
+} infos[] = {
+ { "email", "E-mail", "core_main_14", { NULL, "e-mail", "UserInfo", "Mye-mail0", "UserInfo", "e-mail" }, DefaultSetIcon, &EmailOnClick, NULL },
+ { "sms", "Phone/SMS", "core_main_17", { NULL, "Cellular", "UserInfo", "MyPhone0", "UserInfo", "Phone" }, DefaultSetIcon, NULL, NULL },
+ { "homepage", "Homepage", "core_main_2", { NULL, "Homepage", "UserInfo", "Homepage" }, DefaultSetIcon, &HomepageOnClick, NULL },
+};
-} infos[] = {
-
-{ "email", "E-mail", "core_main_14", { NULL, "e-mail", "UserInfo", "Mye-mail0" }, &EmailOnClick, NULL },
-
-{ "sms", "Phone/SMS", "core_main_17", { NULL, "Cellular", "UserInfo", "MyPhone0" }, NULL, NULL },
+static void EmailOnClick(Info *info, const char *text)
+{
+ char cmd[1024];
+ mir_snprintf(cmd, MAX_REGS(cmd), "mailto:%s", text);
+ ShellExecute(NULL, "open", cmd, NULL, NULL, SW_SHOW);
+}
-{ "homepage", "Homepage", "core_main_2", { NULL, "Homepage", "UserInfo", "Homepage" }, &HomepageOnClick, NULL },
+static void HomepageOnClick(Info *info, const char *text)
+{
+ ShellExecute(NULL, "open", text, NULL, NULL, SW_SHOW);
+}
-};
+static void DefaultSetIcon(HANDLE hContact, Info *info, const char *text)
+{
+ ExtraIcon_SetIcon(info->hExtraIcon, hContact, text ? info->icon : NULL);
+}
static void SetExtraIcons(HANDLE hContact)
{
@@ -145,13 +175,13 @@ static void SetExtraIcons(HANDLE hContact) if (!DBGetContactSettingString(hContact, info.db[j] == NULL ? proto : info.db[j], info.db[j+1], &dbv))
{
if (!IsEmpty(dbv.pszVal))
+ {
+ info.SetIcon(hContact, &info, dbv.pszVal);
show = true;
+ }
DBFreeVariant(&dbv);
}
}
-
- if (show)
- ExtraIcon_SetIcon(info.hExtraIcon, hContact, info.icon);
}
}
@@ -175,6 +205,12 @@ static int SettingChanged(WPARAM wParam, LPARAM lParam) return 0;
}
+ if (strcmp(cws->szSetting, "Gender") == 0 && (isProto || strcmp(cws->szModule, "UserInfo") == 0))
+ {
+ SetGender(hContact, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal, TRUE);
+ return 0;
+ }
+
for (unsigned int i = 0; i < MAX_REGS(infos); ++i)
{
Info &info = infos[i];
@@ -191,7 +227,7 @@ static int SettingChanged(WPARAM wParam, LPARAM lParam) continue;
bool show = (cws->value.type != DBVT_DELETED && !IsEmpty(cws->value.pszVal));
- ExtraIcon_SetIcon(info.hExtraIcon, hContact, show ? info.icon : NULL);
+ info.SetIcon(hContact, &info, show ? cws->value.pszVal : NULL);
break;
}
@@ -200,44 +236,11 @@ static int SettingChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-static int EmailOnClick(WPARAM wParam, LPARAM lParam)
+static int DefaultOnClick(WPARAM wParam, LPARAM lParam, LPARAM param)
{
- HANDLE hContact = (HANDLE) wParam;
- if (hContact == NULL)
- return 0;
-
- char *proto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (IsEmpty(proto))
+ if (param == NULL)
return 0;
- Info &info = infos[0];
-
- bool found = false;
- for (unsigned int j = 0; !found && j < MAX_REGS(info.db); j += 2)
- {
- if (info.db[j + 1] == NULL)
- break;
-
- DBVARIANT dbv = { 0 };
- if (!DBGetContactSettingString(hContact, info.db[j] == NULL ? proto : info.db[j], info.db[j+1], &dbv))
- {
- if (!IsEmpty(dbv.ptszVal))
- {
- char cmd[1024];
- mir_snprintf(cmd, MAX_REGS(cmd), "mailto:%s", dbv.ptszVal);
- ShellExecute(NULL, "open", cmd, NULL, NULL, SW_SHOW);
- found = true;
- }
-
- DBFreeVariant(&dbv);
- }
- }
-
- return 0;
-}
-
-static int HomepageOnClick(WPARAM wParam, LPARAM lParam)
-{
HANDLE hContact = (HANDLE) wParam;
if (hContact == NULL)
return 0;
@@ -246,20 +249,20 @@ static int HomepageOnClick(WPARAM wParam, LPARAM lParam) if (IsEmpty(proto))
return 0;
- Info &info = infos[2];
+ Info *info = (Info *) param;
bool found = false;
- for (unsigned int j = 0; !found && j < MAX_REGS(info.db); j += 2)
+ for (unsigned int j = 0; !found && j < MAX_REGS(info->db); j += 2)
{
- if (info.db[j + 1] == NULL)
+ if (info->db[j + 1] == NULL)
break;
DBVARIANT dbv = { 0 };
- if (!DBGetContactSettingString(hContact, info.db[j] == NULL ? proto : info.db[j], info.db[j+1], &dbv))
+ if (!DBGetContactSettingString(hContact, info->db[j] == NULL ? proto : info->db[j], info->db[j+1], &dbv))
{
if (!IsEmpty(dbv.ptszVal))
{
- ShellExecute(NULL, "open", dbv.ptszVal, NULL, NULL, SW_SHOW);
+ info->OnClick(info, dbv.ptszVal);
found = true;
}
@@ -275,13 +278,20 @@ static void DBExtraIconsInit() for (unsigned int i = 0; i < MAX_REGS(infos); ++i)
{
Info &info = infos[i];
- info.hExtraIcon = ExtraIcon_Register(info.name, info.desc, info.icon, info.OnClick);
+ if (info.OnClick)
+ info.hExtraIcon = ExtraIcon_Register(info.name, info.desc, info.icon, DefaultOnClick, (LPARAM) &info);
+ else
+ info.hExtraIcon = ExtraIcon_Register(info.name, info.desc, info.icon);
}
+ hExtraVisibility = ExtraIcon_Register("visibility", "Visibility/Chat activity", "AlwaysVis");
+ hExtraGender = ExtraIcon_Register("gender", "Gender", "gender_male");
HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact != NULL)
{
SetExtraIcons(hContact);
+ SetVisibility(hContact, -1, FALSE);
+ SetGender(hContact, -1, FALSE);
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
}
@@ -356,7 +366,7 @@ static int ProtocolApplyIcon(WPARAM wParam, LPARAM lParam) return 0;
}
-static int ProtocolOnClick(WPARAM wParam, LPARAM lParam)
+static int ProtocolOnClick(WPARAM wParam, LPARAM lParam, LPARAM param)
{
HANDLE hContact = (HANDLE) wParam;
if (hContact == NULL)
@@ -368,6 +378,6 @@ static int ProtocolOnClick(WPARAM wParam, LPARAM lParam) static void ProtocolInit()
{
- hExtraProto = ExtraIcon_Register("protocol", "Account", "core_main_34", &ProtocolRebuildIcons, &ProtocolApplyIcon,
- &ProtocolOnClick);
+ hExtraProto = ExtraIcon_Register("protocol", "Account", "core_main_34",
+ &ProtocolRebuildIcons, &ProtocolApplyIcon, &ProtocolOnClick);
}
diff --git a/Plugins/extraicons/Docs/extraicons_changelog.txt b/Plugins/extraicons/Docs/extraicons_changelog.txt new file mode 100644 index 0000000..38cc836 --- /dev/null +++ b/Plugins/extraicons/Docs/extraicons_changelog.txt @@ -0,0 +1,6 @@ +Extra Icons Service
+
+Changelog:
+
+. 0.1.0.0
+ + Initial version
\ No newline at end of file diff --git a/Plugins/extraicons/Docs/extraicons_readme.txt b/Plugins/extraicons/Docs/extraicons_readme.txt new file mode 100644 index 0000000..5ab11d3 --- /dev/null +++ b/Plugins/extraicons/Docs/extraicons_readme.txt @@ -0,0 +1,25 @@ +Extra Icons Service plugin
+--------------------------
+
+CAUTION: THIS IS A BETA STAGE PLUGIN. IT CAN DO VERY BAD THINGS. USE AT YOUR OWN RISK.
+
+
+This is a simple plugin to allow the user to select which extra icons he wants to see.
+
+It is based on the idea that plugins register icons, the contact list shows them, and this plugin is the glue. By default it supports:
+ - Account
+ - E-mail
+ - Phone/SMS
+ - Homepage
+ - Visibility/Chat activity
+ - Gender
+
+By now it is supported my clist_modern and clist_mw. I intend to add clist_nicer next.
+
+Thanks to FYR for some code that I copied from clist_modern and to Angeli-Ka for the nice icons.
+
+
+To report bugs/make suggestions, go to the forum thread: http://forums.miranda-im.org/showthread.php?t=
+
+
+
diff --git a/Plugins/extraicons/Docs/extraicons_version.txt b/Plugins/extraicons/Docs/extraicons_version.txt new file mode 100644 index 0000000..59dd7e0 --- /dev/null +++ b/Plugins/extraicons/Docs/extraicons_version.txt @@ -0,0 +1 @@ +Extra Icons Service 0.1.0.0
\ No newline at end of file diff --git a/Plugins/extraicons/Docs/langpack_extraicons.txt b/Plugins/extraicons/Docs/langpack_extraicons.txt new file mode 100644 index 0000000..575b4ef --- /dev/null +++ b/Plugins/extraicons/Docs/langpack_extraicons.txt @@ -0,0 +1,22 @@ +; Extra Icons Service
+; Author: Pescuma
+
+[Slot 1]
+[Slot 2]
+[Slot 3]
+[Slot 4]
+[Slot 5]
+[Slot 6]
+[Slot 7]
+[Slot 8]
+[Slot 9]
+[Slot 10]
+
+[<Empty>]
+[Account]
+[E-mail]
+[Phone/SMS]
+[Homepage]
+[Visibility/Chat activity]
+[Gender]
+
diff --git a/Plugins/extraicons/ExtraIcon.cpp b/Plugins/extraicons/ExtraIcon.cpp index 7fc60dc..89775f1 100644 --- a/Plugins/extraicons/ExtraIcon.cpp +++ b/Plugins/extraicons/ExtraIcon.cpp @@ -19,9 +19,9 @@ #include "commons.h"
-ExtraIcon::ExtraIcon(const char *name, const char *description, const char *descIcon, int(*OnClick)(WPARAM wParam,
- LPARAM lParam)) :
- name(name), description(description), descIcon(descIcon), OnClick(OnClick), slot(-1)
+ExtraIcon::ExtraIcon(const char *name, const char *description, const char *descIcon, MIRANDAHOOKPARAM OnClick,
+ LPARAM param) :
+ name(name), description(description), descIcon(descIcon), OnClick(OnClick), onClickParam(param), slot(-1)
{
}
@@ -91,6 +91,6 @@ void ExtraIcon::onClick(HANDLE hContact) if (OnClick == NULL)
return;
- OnClick((WPARAM) hContact, (LPARAM) ConvertToClistSlot(slot));
+ OnClick((WPARAM) hContact, (LPARAM) ConvertToClistSlot(slot), onClickParam);
}
diff --git a/Plugins/extraicons/ExtraIcon.h b/Plugins/extraicons/ExtraIcon.h index 1c639f0..b1ada82 100644 --- a/Plugins/extraicons/ExtraIcon.h +++ b/Plugins/extraicons/ExtraIcon.h @@ -25,8 +25,7 @@ class ExtraIcon
{
public:
- ExtraIcon(const char *name, const char *description, const char *descIcon, int(*OnClick)(WPARAM wParam,
- LPARAM lParam));
+ ExtraIcon(const char *name, const char *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
virtual ~ExtraIcon();
virtual bool needToRebuildIcons() =0;
@@ -53,7 +52,8 @@ protected: std::string name;
std::string description;
std::string descIcon;
- int(*OnClick)(WPARAM wParam, LPARAM lParam);
+ MIRANDAHOOKPARAM OnClick;
+ LPARAM onClickParam;
int slot;
};
diff --git a/Plugins/extraicons/IcolibExtraIcon.cpp b/Plugins/extraicons/IcolibExtraIcon.cpp index 7f9cae9..5531aae 100644 --- a/Plugins/extraicons/IcolibExtraIcon.cpp +++ b/Plugins/extraicons/IcolibExtraIcon.cpp @@ -19,9 +19,9 @@ #include "commons.h"
-IcolibExtraIcon::IcolibExtraIcon(const char *name, const char *description, const char *descIcon, int(*OnClick)(
- WPARAM wParam, LPARAM lParam)) :
- ExtraIcon(name, description, descIcon, OnClick)
+IcolibExtraIcon::IcolibExtraIcon(const char *name, const char *description, const char *descIcon,
+ MIRANDAHOOKPARAM OnClick, LPARAM param) :
+ ExtraIcon(name, description, descIcon, OnClick, param)
{
char setting[512];
mir_snprintf(setting, MAX_REGS(setting), "%s/%s", MODULE_NAME, name);
diff --git a/Plugins/extraicons/IcolibExtraIcon.h b/Plugins/extraicons/IcolibExtraIcon.h index e813b48..b385294 100644 --- a/Plugins/extraicons/IcolibExtraIcon.h +++ b/Plugins/extraicons/IcolibExtraIcon.h @@ -25,8 +25,8 @@ class IcolibExtraIcon : public ExtraIcon
{
public:
- IcolibExtraIcon(const char *name, const char *description, const char *descIcon, int(*OnClick)(WPARAM wParam,
- LPARAM lParam));
+ IcolibExtraIcon(const char *name, const char *description, const char *descIcon, MIRANDAHOOKPARAM OnClick,
+ LPARAM param);
virtual ~IcolibExtraIcon();
virtual int getType() const;
diff --git a/Plugins/extraicons/ZIP/doit.bat b/Plugins/extraicons/ZIP/doit.bat new file mode 100644 index 0000000..83b23de --- /dev/null +++ b/Plugins/extraicons/ZIP/doit.bat @@ -0,0 +1,95 @@ +@echo off
+
+rem Batch file to build and upload files
+rem
+rem TODO: Integration with FL
+
+set name=extraicons
+
+rem To upload, this var must be set here or in other batch
+rem set ftp=ftp://<user>:<password>@<ftp>/<path>
+
+echo Building %name% ...
+
+msdev ..\%name%.dsp /MAKE "%name% - Win32 Release" /REBUILD
+
+echo Generating files for %name% ...
+
+del *.zip
+del *.dll
+copy ..\Docs\%name%_changelog.txt
+copy ..\Docs\%name%_version.txt
+copy ..\Docs\%name%_readme.txt
+mkdir Docs
+cd Docs
+del /Q *.*
+copy ..\..\Docs\langpack_%name%.txt
+copy ..\..\m_%name%.h
+cd ..
+mkdir Plugins
+cd Plugins
+cd ..
+mkdir src
+cd src
+del /Q *.*
+copy ..\..\*.h
+copy ..\..\*.cpp
+copy ..\..\*.
+copy ..\..\*.rc
+copy ..\..\*.dsp
+copy ..\..\*.dsw
+mkdir Docs
+cd Docs
+del /Q *.*
+copy ..\..\..\Docs\*.*
+cd ..
+mkdir sdk
+cd sdk
+del /Q *.*
+copy ..\..\..\sdk\*.*
+cd ..
+cd ..
+
+cd Plugins
+copy "..\..\..\..\bin\release\Plugins\%name%.dll"
+cd ..
+
+"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%.zip %name%.dll Docs Plugins
+
+"C:\Program Files\Filzip\Filzip.exe" -a -rp %name%_src.zip src
+
+del *.dll
+cd Docs
+del /Q *.*
+cd ..
+rmdir Docs
+cd Plugins
+del /Q *.*
+cd ..
+rmdir Plugins
+cd src
+del /Q *.*
+cd Docs
+del /Q *.*
+cd ..
+rmdir Docs
+cd sdk
+del /Q *.*
+cd ..
+rmdir sdk
+cd ..
+rmdir src
+
+if "%ftp%"=="" GOTO END
+
+echo Going to upload files...
+pause
+
+"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%.zip %ftp% -overwrite -close
+"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_changelog.txt %ftp% -overwrite -close
+"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_version.txt %ftp% -overwrite -close
+"C:\Program Files\FileZilla\FileZilla.exe" -u .\%name%_readme.txt %ftp% -overwrite -close
+
+:END
+
+echo Done.
diff --git a/Plugins/extraicons/extraicons.cpp b/Plugins/extraicons/extraicons.cpp index a337a20..9edccd3 100644 --- a/Plugins/extraicons/extraicons.cpp +++ b/Plugins/extraicons/extraicons.cpp @@ -24,8 +24,8 @@ PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
"Extra Icons Service",
- PLUGIN_MAKE_VERSION(0,0,0,1),
- "Extra Icons",
+ PLUGIN_MAKE_VERSION(0,1,0,0),
+ "Extra Icons Service",
"Ricardo Pescuma Domenecci",
"",
"© 2009 Ricardo Pescuma Domenecci",
@@ -124,6 +124,8 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) IcoLib_Register("AlwaysVis", "Contact List", "Always Visible", IDI_ALWAYSVIS);
IcoLib_Register("NeverVis", "Contact List", "Never Visible", IDI_NEVERVIS);
IcoLib_Register("ChatActivity", "Contact List", "Chat Activity", IDI_CHAT);
+ IcoLib_Register("gender_male", "Contact List", "Male", IDI_MALE);
+ IcoLib_Register("gender_female", "Contact List", "Female", IDI_FEMALE);
// Hooks
@@ -312,10 +314,11 @@ int ExtraIcon_Register(WPARAM wParam, LPARAM lParam) {
case EXTRAICON_TYPE_CALLBACK:
extra = new CallbackExtraIcon(ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->RebuildIcons,
- ei->ApplyIcon, ei->OnClick);
+ ei->ApplyIcon, ei->OnClick, ei->onClickParam);
break;
case EXTRAICON_TYPE_ICOLIB:
- extra = new IcolibExtraIcon(ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->OnClick);
+ extra = new IcolibExtraIcon(ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->OnClick,
+ ei->onClickParam);
break;
default:
return 0;
diff --git a/Plugins/extraicons/extraicons.dsp b/Plugins/extraicons/extraicons.dsp index fea1d82..9fe9872 100644 --- a/Plugins/extraicons/extraicons.dsp +++ b/Plugins/extraicons/extraicons.dsp @@ -212,6 +212,14 @@ SOURCE=.\res\Chatchannel.ico # End Source File
# Begin Source File
+SOURCE=.\res\female.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\res\male.ico
+# End Source File
+# Begin Source File
+
SOURCE=.\res\NeverVis.ico
# End Source File
# Begin Source File
diff --git a/Plugins/extraicons/m_extraicons.h b/Plugins/extraicons/m_extraicons.h index 66f45dd..589d040 100644 --- a/Plugins/extraicons/m_extraicons.h +++ b/Plugins/extraicons/m_extraicons.h @@ -42,19 +42,22 @@ typedef struct { // Callback to add icons to clist, calling MS_CLIST_EXTRA_ADD_ICON
// wParam=lParam=0
- int (*RebuildIcons)(WPARAM wParam, LPARAM lParam);
+ MIRANDAHOOK RebuildIcons;
// Callback to set the icon to clist, calling MS_CLIST_EXTRA_SET_ICON or MS_EXTRAICON_SET_ICON
// wParam = HANDLE hContact
// lParam = int slot
- int (*ApplyIcon)(WPARAM wParam, LPARAM lParam);
+ MIRANDAHOOK ApplyIcon;
// Other optional callbacks
// [Optional] Callback called when extra icon was clicked
// wParam = HANDLE hContact
// lParam = int slot
- int (*OnClick)(WPARAM wParam, LPARAM lParam);
+ // param = onClickParam
+ MIRANDAHOOKPARAM OnClick;
+
+ LPARAM onClickParam;
} EXTRAICON_INFO;
@@ -87,9 +90,9 @@ typedef struct { #ifdef __cplusplus
static HANDLE ExtraIcon_Register(const char *name, const char *description, const char *descIcon,
- int (*RebuildIcons)(WPARAM wParam, LPARAM lParam),
- int (*ApplyIcon)(WPARAM wParam, LPARAM lParam),
- int (*OnClick)(WPARAM wParam, LPARAM lParam) = NULL)
+ MIRANDAHOOK RebuildIcons,
+ MIRANDAHOOK ApplyIcon,
+ MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = NULL)
{
if (!ServiceExists(MS_EXTRAICON_REGISTER))
return NULL;
@@ -103,12 +106,13 @@ static HANDLE ExtraIcon_Register(const char *name, const char *description, cons ei.RebuildIcons = RebuildIcons;
ei.ApplyIcon = ApplyIcon;
ei.OnClick = OnClick;
+ ei.onClickParam = onClickParam;
return (HANDLE) CallService(MS_EXTRAICON_REGISTER, (WPARAM) &ei, 0);
}
static HANDLE ExtraIcon_Register(const char *name, const char *description, const char *descIcon = NULL,
- int (*OnClick)(WPARAM wParam, LPARAM lParam) = NULL)
+ MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = NULL)
{
if (!ServiceExists(MS_EXTRAICON_REGISTER))
return NULL;
@@ -120,6 +124,7 @@ static HANDLE ExtraIcon_Register(const char *name, const char *description, cons ei.description = description;
ei.descIcon = descIcon;
ei.OnClick = OnClick;
+ ei.onClickParam = onClickParam;
return (HANDLE) CallService(MS_EXTRAICON_REGISTER, (WPARAM) &ei, 0);
}
diff --git a/Plugins/extraicons/options.cpp b/Plugins/extraicons/options.cpp index c1b4852..23dd723 100644 --- a/Plugins/extraicons/options.cpp +++ b/Plugins/extraicons/options.cpp @@ -139,7 +139,7 @@ static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char desc[256];
mir_snprintf(desc, MAX_REGS(desc), "Slot %d:", i + 1);
- HWND tmp = CreateWindow("STATIC", desc,
+ HWND tmp = CreateWindow("STATIC", Translate(desc),
WS_CHILD | WS_VISIBLE,
rcLabel.left, rcLabel.top + i * height,
rcLabel.right - rcLabel.left, rcLabel.bottom - rcLabel.top,
@@ -175,9 +175,26 @@ static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
case WM_COMMAND:
{
- if (HIWORD(wParam) != CBN_SELCHANGE || (HWND) lParam != GetFocus())
+ HWND cbl = (HWND) lParam;
+ if (HIWORD(wParam) != CBN_SELCHANGE || cbl != GetFocus())
return 0;
+ int sel = SendMessage(cbl, CB_GETCURSEL, 0, 0);
+ if (sel > 0)
+ {
+ for (int i = 0; i < numSlots; ++i)
+ {
+ int id = IDC_SLOT + i * 2;
+
+ if (GetDlgItem(hwndDlg, id) == cbl)
+ continue;
+
+ int sl = SendDlgItemMessage(hwndDlg, id, CB_GETCURSEL, 0, 0);
+ if (sl == sel)
+ SendDlgItemMessage(hwndDlg, id, CB_SETCURSEL, 0, 0);
+ }
+ }
+
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
diff --git a/Plugins/extraicons/res/female.ico b/Plugins/extraicons/res/female.ico Binary files differnew file mode 100644 index 0000000..faa08fc --- /dev/null +++ b/Plugins/extraicons/res/female.ico diff --git a/Plugins/extraicons/res/male.ico b/Plugins/extraicons/res/male.ico Binary files differnew file mode 100644 index 0000000..5bee531 --- /dev/null +++ b/Plugins/extraicons/res/male.ico diff --git a/Plugins/extraicons/resource.h b/Plugins/extraicons/resource.h index d5dd729..7ede69e 100644 --- a/Plugins/extraicons/resource.h +++ b/Plugins/extraicons/resource.h @@ -6,6 +6,8 @@ #define IDI_ALWAYSVIS 120
#define IDI_NEVERVIS 121
#define IDI_CHAT 122
+#define IDI_MALE 123
+#define IDI_FEMALE 124
#define IDC_SLOT_L 1075
#define IDC_SLOT 1076
#define IDC_STATIC -1
@@ -16,7 +18,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 123
+#define _APS_NEXT_RESOURCE_VALUE 125
#define _APS_NEXT_COMMAND_VALUE 40005
#define _APS_NEXT_CONTROL_VALUE 1077
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/Plugins/extraicons/resource.rc b/Plugins/extraicons/resource.rc index 3fb9549..0dfe3e6 100644 --- a/Plugins/extraicons/resource.rc +++ b/Plugins/extraicons/resource.rc @@ -70,6 +70,8 @@ END IDI_ALWAYSVIS ICON DISCARDABLE "res\\AlwaysVis.ico"
IDI_NEVERVIS ICON DISCARDABLE "res\\NeverVis.ico"
IDI_CHAT ICON DISCARDABLE "res\\Chatchannel.ico"
+IDI_MALE ICON DISCARDABLE "res\\male.ico"
+IDI_FEMALE ICON DISCARDABLE "res\\female.ico"
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
|