summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/clist/clc.cpp4
-rw-r--r--src/modules/clist/clistcore.cpp4
-rw-r--r--src/modules/clist/clisttray.cpp6
-rw-r--r--src/modules/clist/clui.cpp2
-rw-r--r--src/modules/clist/groups.cpp2
-rw-r--r--src/modules/clist/movetogroup.cpp4
-rw-r--r--src/modules/extraicons/DefaultExtraIcons.cpp10
-rw-r--r--src/modules/extraicons/ExtraIconGroup.cpp18
-rw-r--r--src/modules/extraicons/extraicons.cpp384
-rw-r--r--src/modules/extraicons/extraicons.h5
-rw-r--r--src/modules/extraicons/options_ei.cpp24
-rw-r--r--src/modules/extraicons/usedIcons.cpp10
-rw-r--r--src/modules/fonts/FontOptions.cpp8
-rw-r--r--src/modules/icolib/skin2icons.cpp2
-rw-r--r--src/modules/netlib/netlibautoproxy.cpp6
-rw-r--r--src/modules/netlib/netliblog.cpp2
-rw-r--r--src/modules/netlib/netlibopts.cpp14
-rw-r--r--src/modules/netlib/netlibsock.cpp2
-rw-r--r--src/modules/netlib/netlibupnp.cpp12
-rw-r--r--src/modules/options/headerbar.cpp2
-rw-r--r--src/modules/options/options.cpp2
-rw-r--r--src/modules/protocols/protocols.cpp4
-rw-r--r--src/modules/protocols/protoopts.cpp10
-rw-r--r--src/modules/skin/hotkey_opts.cpp2
-rw-r--r--src/modules/skin/hotkeys.cpp4
-rw-r--r--src/modules/utils/timezones.cpp6
-rw-r--r--src/modules/xml/xmlParser.cpp12
27 files changed, 316 insertions, 245 deletions
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index e3bb5c01ef..ec5b36b624 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -123,13 +123,13 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam)
static int ClcAccountsChanged(WPARAM, LPARAM)
{
int i, cnt;
- for (i=0, cnt=0; i < accounts.getCount(); ++i)
+ for (i=0, cnt=0; i < accounts.getCount(); i++)
if (Proto_IsAccountEnabled(accounts[i])) ++cnt;
cli.hClcProtoCount = cnt;
cli.clcProto = (ClcProtoStatus *) mir_realloc(cli.clcProto, sizeof(ClcProtoStatus) * cli.hClcProtoCount);
- for (i=0, cnt=0; i < accounts.getCount(); ++i) {
+ for (i=0, cnt=0; i < accounts.getCount(); i++) {
if (Proto_IsAccountEnabled(accounts[i])) {
cli.clcProto[cnt].szProto = accounts[i]->szModuleName;
cli.clcProto[cnt].dwStatus = CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETSTATUS, 0, 0);
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp
index 12fbcc032e..19fb928247 100644
--- a/src/modules/clist/clistcore.cpp
+++ b/src/modules/clist/clistcore.cpp
@@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "..\..\core\commonheaders.h"
#include "clc.h"
#include "genmenu.h"
+#include "..\extraicons\extraicons.h"
CLIST_INTERFACE cli = { 0 };
@@ -207,6 +208,9 @@ static INT_PTR srvRetrieveInterface(WPARAM, LPARAM lParam)
cli.pfnGetProtocolMenu = fnGetProtocolMenu;
cli.pfnConvertMenu = fnConvertMenu;
+ cli.pfnReloadExtraIcons = fnReloadExtraIcons;
+ cli.pfnSetAllExtraIcons = fnSetAllExtraIcons;
+
cli.hInst = (HMODULE)lParam;
rc = LoadContactListModule2();
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp
index aaf7d79fcd..e2833d27fc 100644
--- a/src/modules/clist/clisttray.cpp
+++ b/src/modules/clist/clisttray.cpp
@@ -288,7 +288,7 @@ int fnTrayIconInit(HWND hwnd)
(averageMode < 0 || db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)))
{
cli.trayIconCount = netProtoCount;
- for (int i=0; i < accounts.getCount(); ++i)
+ for (int i=0; i < accounts.getCount(); i++)
{
int j = cli.pfnGetAccountIndexByPos(i);
if (j >= 0)
@@ -748,14 +748,14 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
POINT pt;
HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
- for (int i=0; i < cli.trayIconCount; ++i)
+ for (int i=0; i < cli.trayIconCount; i++)
{
if ((unsigned)cli.trayIcon[i].id == msg->wParam)
{
if ( !cli.trayIcon[i].szProto) break;
int ind = 0;
- for (int j = 0; j < accounts.getCount(); ++j)
+ for (int j = 0; j < accounts.getCount(); j++)
{
int k = cli.pfnGetAccountIndexByPos(j);
if (k >= 0)
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp
index 3d24e77a92..0e569f7ccb 100644
--- a/src/modules/clist/clui.cpp
+++ b/src/modules/clist/clui.cpp
@@ -948,7 +948,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
{
unsigned int cpnl = 0;
int mcnt = GetMenuItemCount(hMenu);
- for (int i=0; i<mcnt; ++i) {
+ for (int i=0; i<mcnt; i++) {
HMENU hMenus = GetSubMenu(hMenu, i);
if (hMenus && cpnl++ == nPanel) {
hMenu = hMenus;
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp
index cc3d79f280..1351289f49 100644
--- a/src/modules/clist/groups.cpp
+++ b/src/modules/clist/groups.cpp
@@ -93,7 +93,7 @@ static INT_PTR CreateGroup(WPARAM wParam, LPARAM lParam)
else {
i = 1;
while (GroupNameExists(newName + 1, -1))
- mir_sntprintf(newName + 1, SIZEOF(newName) - 1, _T("%s (%d)"), newBaseName, ++i);
+ mir_sntprintf(newName + 1, SIZEOF(newName) - 1, _T("%s (%d)"), newBaseName, i++);
}
if (i) {
const CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, newName };
diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp
index eaf4bc1906..83c233cefd 100644
--- a/src/modules/clist/movetogroup.cpp
+++ b/src/modules/clist/movetogroup.cpp
@@ -112,7 +112,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
pos += 100000; // Separator
- for (i=0; ; ++i)
+ for (i=0; ; i++)
{
char intname[20];
_itoa(i, intname, 10);
@@ -127,7 +127,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
mir_free(dbv.ptszVal);
}
- for (i=0; i < groups.getCount(); ++i)
+ for (i=0; i < groups.getCount(); i++)
{
bool checked = szContactGroup && !_tcscmp(szContactGroup, groups[i].name);
AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
diff --git a/src/modules/extraicons/DefaultExtraIcons.cpp b/src/modules/extraicons/DefaultExtraIcons.cpp
index f7e44dafab..4c05a8e590 100644
--- a/src/modules/extraicons/DefaultExtraIcons.cpp
+++ b/src/modules/extraicons/DefaultExtraIcons.cpp
@@ -177,7 +177,7 @@ static void SetExtraIcons(HANDLE hContact)
if (IsEmpty(proto))
return;
- for (unsigned int i = 0; i < SIZEOF(infos); ++i)
+ for (unsigned int i = 0; i < SIZEOF(infos); i++)
{
Info &info = infos[i];
@@ -227,7 +227,7 @@ static int SettingChanged(WPARAM wParam, LPARAM lParam)
return 0;
}
- for (unsigned int i = 0; i < SIZEOF(infos); ++i)
+ for (unsigned int i = 0; i < SIZEOF(infos); i++)
{
Info &info = infos[i];
@@ -293,7 +293,7 @@ static void DBExtraIconsInit()
hExtraChat = ExtraIcon_Register("chat_activity", "Chat activity", "ChatActivity");
hExtraVisibility = ExtraIcon_Register("visibility", "Visibility", "AlwaysVis");
hExtraGender = ExtraIcon_Register("gender", "Gender", "gender_male");
- for (unsigned int i = 0; i < SIZEOF(infos); ++i)
+ for (unsigned int i = 0; i < SIZEOF(infos); i++)
{
Info &info = infos[i];
if (info.OnClick)
@@ -335,7 +335,7 @@ static int ProtocolRebuildIcons(WPARAM wParam, LPARAM lParam)
static ProtoInfo *FindProto(const char * proto)
{
- for (unsigned int i = 0; i < protos.size(); ++i)
+ for (unsigned int i = 0; i < protos.size(); i++)
{
ProtoInfo *pi = &protos[i];
if (strcmp(pi->proto.c_str(), proto) == 0)
@@ -346,7 +346,7 @@ static ProtoInfo *FindProto(const char * proto)
if (hIcon == NULL)
return NULL;
- HANDLE hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM) hIcon, 0);
+ HANDLE hImage = ExtraIcon_Add(hIcon);
if (hImage == INVALID_HANDLE_VALUE)
return NULL;
diff --git a/src/modules/extraicons/ExtraIconGroup.cpp b/src/modules/extraicons/ExtraIconGroup.cpp
index 6e823bde03..c38aed8bf7 100644
--- a/src/modules/extraicons/ExtraIconGroup.cpp
+++ b/src/modules/extraicons/ExtraIconGroup.cpp
@@ -41,7 +41,7 @@ void ExtraIconGroup::addExtraIcon(BaseExtraIcon *extra)
items.push_back(extra);
description.clear();
- for (unsigned int i = 0; i < items.size(); ++i)
+ for (unsigned int i = 0; i < items.size(); i++)
{
if (i > 0)
description += _T(" / ");
@@ -51,7 +51,7 @@ void ExtraIconGroup::addExtraIcon(BaseExtraIcon *extra)
void ExtraIconGroup::rebuildIcons()
{
- for (unsigned int i = 0; i < items.size(); ++i)
+ for (unsigned int i = 0; i < items.size(); i++)
items[i]->rebuildIcons();
}
@@ -65,7 +65,7 @@ void ExtraIconGroup::applyIcon(HANDLE hContact)
insideApply = true;
unsigned int i;
- for (i = 0; i < items.size(); ++i)
+ for (i = 0; i < items.size(); i++)
{
items[i]->applyIcon(hContact);
@@ -81,7 +81,7 @@ void ExtraIconGroup::applyIcon(HANDLE hContact)
int ExtraIconGroup::getPosition() const
{
int pos = INT_MAX;
- for (unsigned int i = 0; i < items.size(); ++i)
+ for (unsigned int i = 0; i < items.size(); i++)
pos = MIN(pos, items[i]->getPosition());
return pos;
}
@@ -90,7 +90,7 @@ void ExtraIconGroup::setSlot(int slot)
{
ExtraIcon::setSlot(slot);
- for (unsigned int i = 0; i < items.size(); ++i)
+ for (unsigned int i = 0; i < items.size(); i++)
items[i]->setSlot(slot);
}
@@ -100,7 +100,7 @@ ExtraIcon * ExtraIconGroup::getCurrentItem(HANDLE hContact) const
if (id < 1)
return NULL;
- for (unsigned int i = 0; i < items.size(); ++i)
+ for (unsigned int i = 0; i < items.size(); i++)
if (id == items[i]->getID())
return items[i];
@@ -118,7 +118,7 @@ int ExtraIconGroup::setIcon(int id, HANDLE hContact, void *icon)
{
if (insideApply)
{
- for (unsigned int i = 0; i < items.size(); ++i)
+ for (unsigned int i = 0; i < items.size(); i++)
if (items[i]->getID() == id)
return items[i]->setIcon(id, hContact, icon);
@@ -128,7 +128,7 @@ int ExtraIconGroup::setIcon(int id, HANDLE hContact, void *icon)
ExtraIcon *current = getCurrentItem(hContact);
int currentPos = (int)items.size();
int storePos = (int)items.size();
- for (unsigned int i = 0; i < items.size(); ++i)
+ for (unsigned int i = 0; i < items.size(); i++)
{
if (items[i]->getID() == id)
storePos = i;
@@ -194,7 +194,7 @@ const TCHAR *ExtraIconGroup::getDescription() const
const char *ExtraIconGroup::getDescIcon() const
{
- for (unsigned int i = 0; i < items.size(); ++i)
+ for (unsigned int i = 0; i < items.size(); i++)
if (!IsEmpty(items[i]->getDescIcon()))
return items[i]->getDescIcon();
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp
index a2d7c3b34a..9688ec364c 100644
--- a/src/modules/extraicons/extraicons.cpp
+++ b/src/modules/extraicons/extraicons.cpp
@@ -30,6 +30,7 @@
#include "extraicons.h"
#include "usedIcons.h"
+#include "..\clist\clc.h"
// Prototypes ///////////////////////////////////////////////////////////////////////////
@@ -43,79 +44,9 @@ BOOL clistApplyAlreadyCalled = FALSE;
int clistFirstSlot = 0;
int clistSlotCount = 0;
-int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-int PreShutdown(WPARAM wParam, LPARAM lParam);
-int IconsChanged(WPARAM wParam, LPARAM lParam);
-int ClistExtraListRebuild(WPARAM wParam, LPARAM lParam);
-int ClistExtraImageApply(WPARAM wParam, LPARAM lParam);
-int ClistExtraClick(WPARAM wParam, LPARAM lParam);
-int InitOptionsCallback(WPARAM wParam, LPARAM lParam);
-
-INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam);
-INT_PTR ExtraIcon_SetIcon(WPARAM wParam, LPARAM lParam);
-
// Functions ////////////////////////////////////////////////////////////////////////////
-void LoadExtraIconsModule()
-{
- DWORD ret = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS2, 0);
- clistFirstSlot = HIWORD(ret);
- clistSlotCount = LOWORD(ret);
-
- // Icons
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(NULL, tszFile, MAX_PATH);
-
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(SKINICONDESC);
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = tszFile;
- sid.pszSection = "Contact List";
-
- sid.pszName = "AlwaysVis";
- sid.pszDescription = LPGEN("Always Visible");
- sid.iDefaultIndex = -IDI_ALWAYSVIS;
- Skin_AddIcon(&sid);
-
- sid.pszName = "NeverVis";
- sid.pszDescription = LPGEN("Never Visible");
- sid.iDefaultIndex = -IDI_NEVERVIS;
- Skin_AddIcon(&sid);
-
- sid.pszName = "ChatActivity";
- sid.pszDescription = LPGEN("Chat Activity");
- sid.iDefaultIndex = -IDI_CHAT;
- Skin_AddIcon(&sid);
-
- sid.pszName = "gender_male";
- sid.pszDescription = LPGEN("Male");
- sid.iDefaultIndex = -IDI_MALE;
- Skin_AddIcon(&sid);
-
- sid.pszName = "gender_female";
- sid.pszDescription = LPGEN("Female");
- sid.iDefaultIndex = -IDI_FEMALE;
- Skin_AddIcon(&sid);
-
- // Hooks
- HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, &PreShutdown);
- HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &ClistExtraListRebuild);
- HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &ClistExtraImageApply);
- HookEvent(ME_CLIST_EXTRA_CLICK, &ClistExtraClick);
-
- // Services
- CreateServiceFunction(MS_EXTRAICON_REGISTER, &ExtraIcon_Register);
- CreateServiceFunction(MS_EXTRAICON_SET_ICON, &ExtraIcon_SetIcon);
-
- DefaultExtraIcons_Load();
-}
-
-void UnloadExtraIconsModule(void)
-{
- for (size_t i=0; i < registeredExtraIcons.size(); i++)
- delete registeredExtraIcons[i];
-}
+int InitOptionsCallback(WPARAM wParam, LPARAM lParam);
// Called when all the modules are loaded
int ModulesLoaded(WPARAM wParam, LPARAM lParam)
@@ -124,16 +55,10 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0);
CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME "Groups", 0);
- HookEvent(ME_SKIN2_ICONSCHANGED, &IconsChanged);
HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
return 0;
}
-int IconsChanged(WPARAM wParam, LPARAM lParam)
-{
- return 0;
-}
-
int PreShutdown(WPARAM wParam, LPARAM lParam)
{
DefaultExtraIcons_Unload();
@@ -153,17 +78,29 @@ int ConvertToClistSlot(int slot)
return clistFirstSlot + slot;
}
+int ExtraImage_ExtraIDToColumnNum(int extra)
+{
+ return (extra < 1 || extra > EXTRA_ICON_COUNT) ? -1 : extra-1;
+}
+
int Clist_SetExtraIcon(HANDLE hContact, int slot, HANDLE hImage)
{
- IconExtraColumn iec = { 0 };
- iec.cbSize = sizeof(iec);
- iec.ColumnType = ConvertToClistSlot(slot);
- iec.hImage = hImage;
+ if (cli.hwndContactTree == 0)
+ return -1;
+
+ int icol = ExtraImage_ExtraIDToColumnNum( ConvertToClistSlot(slot));
+ if (icol == -1)
+ return -1;
- return CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) hContact, (LPARAM) &iec);
+ HANDLE hItem = (HANDLE)SendMessage(cli.hwndContactTree, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ if (hItem == 0)
+ return -1;
+
+ SendMessage(cli.hwndContactTree, CLM_SETWIDEEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol,hImage));
+ return 0;
}
-ExtraIcon * GetExtraIcon(HANDLE id)
+ExtraIcon* GetExtraIcon(HANDLE id)
{
unsigned int i = (int) id;
@@ -173,10 +110,9 @@ ExtraIcon * GetExtraIcon(HANDLE id)
return extraIconsByHandle[i - 1];
}
-ExtraIcon * GetExtraIconBySlot(int slot)
+ExtraIcon* GetExtraIconBySlot(int slot)
{
- for (unsigned int i = 0; i < extraIconsBySlot.size(); ++i)
- {
+ for (unsigned int i = 0; i < extraIconsBySlot.size(); i++) {
ExtraIcon *extra = extraIconsBySlot[i];
if (extra->getSlot() == slot)
return extra;
@@ -184,10 +120,9 @@ ExtraIcon * GetExtraIconBySlot(int slot)
return NULL;
}
-BaseExtraIcon * GetExtraIconByName(const char *name)
+BaseExtraIcon* GetExtraIconByName(const char *name)
{
- for (unsigned int i = 0; i < registeredExtraIcons.size(); ++i)
- {
+ for (unsigned int i = 0; i < registeredExtraIcons.size(); i++) {
BaseExtraIcon *extra = registeredExtraIcons[i];
if (strcmp(name, extra->getName()) == 0)
return extra;
@@ -198,8 +133,7 @@ BaseExtraIcon * GetExtraIconByName(const char *name)
static void LoadGroups(vector<ExtraIconGroup *> &groups)
{
unsigned int count = DBGetContactSettingWord(NULL, MODULE_NAME "Groups", "Count", 0);
- for (unsigned int i = 0; i < count; ++i)
- {
+ for (unsigned int i = 0; i < count; i++) {
char setting[512];
mir_snprintf(setting, SIZEOF(setting), "%d_count", i);
unsigned int items = DBGetContactSettingWord(NULL, MODULE_NAME "Groups", setting, 0);
@@ -209,18 +143,14 @@ static void LoadGroups(vector<ExtraIconGroup *> &groups)
mir_snprintf(setting, SIZEOF(setting), "__group_%d", i);
ExtraIconGroup *group = new ExtraIconGroup(setting);
- for (unsigned int j = 0; j < items; ++j)
- {
+ for (unsigned int j = 0; j < items; j++) {
mir_snprintf(setting, SIZEOF(setting), "%d_%d", i, j);
DBVARIANT dbv = { 0 };
- if (!DBGetContactSettingString(NULL, MODULE_NAME "Groups", setting, &dbv))
- {
- if (!IsEmpty(dbv.pszVal))
- {
+ if (!DBGetContactSettingString(NULL, MODULE_NAME "Groups", setting, &dbv)) {
+ if (!IsEmpty(dbv.pszVal)) {
BaseExtraIcon *extra = GetExtraIconByName(dbv.pszVal);
- if (extra != NULL)
- {
+ if (extra != NULL) {
group->items.push_back(extra);
if (extra->getSlot() >= 0)
@@ -231,8 +161,7 @@ static void LoadGroups(vector<ExtraIconGroup *> &groups)
}
}
- if (group->items.size() < 2)
- {
+ if (group->items.size() < 2) {
delete group;
continue;
}
@@ -243,11 +172,9 @@ static void LoadGroups(vector<ExtraIconGroup *> &groups)
static ExtraIconGroup * IsInGroup(vector<ExtraIconGroup *> &groups, BaseExtraIcon *extra)
{
- for (unsigned int i = 0; i < groups.size(); ++i)
- {
+ for (unsigned int i = 0; i < groups.size(); i++) {
ExtraIconGroup *group = groups[i];
- for (unsigned int j = 0; j < group->items.size(); ++j)
- {
+ for (unsigned int j = 0; j < group->items.size(); j++) {
if (extra == group->items[j])
return group;
}
@@ -266,11 +193,10 @@ struct compareFunc : std::binary_function<const ExtraIcon *, const ExtraIcon *,
void RebuildListsBasedOnGroups(vector<ExtraIconGroup *> &groups)
{
unsigned int i;
- for (i = 0; i < extraIconsByHandle.size(); ++i)
+ for (i = 0; i < extraIconsByHandle.size(); i++)
extraIconsByHandle[i] = registeredExtraIcons[i];
- for (i = 0; i < extraIconsBySlot.size(); ++i)
- {
+ for (i = 0; i < extraIconsBySlot.size(); i++) {
ExtraIcon *extra = extraIconsBySlot[i];
if (extra->getType() != EXTRAICON_TYPE_GROUP)
continue;
@@ -279,18 +205,16 @@ void RebuildListsBasedOnGroups(vector<ExtraIconGroup *> &groups)
}
extraIconsBySlot.clear();
- for (i = 0; i < groups.size(); ++i)
- {
+ for (i = 0; i < groups.size(); i++) {
ExtraIconGroup *group = groups[i];
- for (unsigned int j = 0; j < group->items.size(); ++j)
+ for (unsigned int j = 0; j < group->items.size(); j++)
extraIconsByHandle[group->items[j]->getID() - 1] = group;
extraIconsBySlot.push_back(group);
}
- for (i = 0; i < extraIconsByHandle.size(); ++i)
- {
+ for (i = 0; i < extraIconsByHandle.size(); i++) {
ExtraIcon *extra = extraIconsByHandle[i];
if (extra->getType() != EXTRAICON_TYPE_GROUP)
extraIconsBySlot.push_back(extra);
@@ -299,6 +223,124 @@ void RebuildListsBasedOnGroups(vector<ExtraIconGroup *> &groups)
std::sort(extraIconsBySlot.begin(), extraIconsBySlot.end(), compareFunc());
}
+///////////////////////////////////////////////////////////////////////////////
+
+int ClistExtraListRebuild(WPARAM wParam, LPARAM lParam)
+{
+ clistRebuildAlreadyCalled = TRUE;
+
+ ResetIcons();
+
+ for (unsigned int i = 0; i < extraIconsBySlot.size(); i++)
+ extraIconsBySlot[i]->rebuildIcons();
+
+ return 0;
+}
+
+int ClistExtraImageApply(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact == NULL)
+ return 0;
+
+ clistApplyAlreadyCalled = TRUE;
+
+ for (unsigned int i = 0; i < extraIconsBySlot.size(); i++)
+ extraIconsBySlot[i]->applyIcon(hContact);
+
+ return 0;
+}
+
+int ClistExtraClick(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact == NULL)
+ return 0;
+
+ int clistSlot = (int) lParam;
+
+ for (unsigned int i = 0; i < extraIconsBySlot.size(); i++) {
+ ExtraIcon *extra = extraIconsBySlot[i];
+ if (ConvertToClistSlot(extra->getSlot()) == clistSlot) {
+ extra->onClick(hContact);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Extra image list functions
+
+static HANDLE hEventExtraImageListRebuilding, hEventExtraImageApplying, hEventExtraClick;
+static bool bImageCreated = false;
+static int g_mutex_bSetAllExtraIconsCycle = 0;
+
+HANDLE ExtraIcon_Add(HICON hIcon)
+{
+ if (cli.hExtraImageList == 0 || hIcon == 0)
+ return INVALID_HANDLE_VALUE;
+
+ int res = ImageList_AddIcon(cli.hExtraImageList, hIcon);
+ return (res > 0xFFFE) ? INVALID_HANDLE_VALUE : (HANDLE)res;
+}
+
+void fnReloadExtraIcons()
+{
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNSSPACE, db_get_b(NULL,"CLUI","ExtraColumnSpace",18), 0);
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, 0);
+
+ if (cli.hExtraImageList)
+ ImageList_Destroy(cli.hExtraImageList);
+
+ cli.hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);
+
+ SendMessage(cli.hwndContactTree,CLM_SETEXTRAIMAGELIST,(WPARAM)cli.hExtraImageList,0);
+ SendMessage(cli.hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
+ NotifyEventHooks(hEventExtraImageListRebuilding,0,0);
+ bImageCreated = true;
+}
+
+void fnSetAllExtraIcons(HWND hwndList,HANDLE hContact)
+{
+ if (cli.hwndContactTree == 0)
+ return;
+
+ g_mutex_bSetAllExtraIconsCycle = 1;
+ bool hcontgiven = (hContact != 0);
+
+ if (!bImageCreated)
+ cli.pfnReloadExtraIcons();
+
+ SendMessage(cli.hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
+
+ if (hContact == NULL)
+ hContact = db_find_first();
+
+ do {
+ HANDLE hItem = hContact;
+ if (hItem == 0)
+ continue;
+
+ ClcCacheEntry* pdnce = (ClcCacheEntry*)cli.pfnGetCacheEntry(hItem);
+ if (pdnce == NULL)
+ continue;
+
+ NotifyEventHooks(hEventExtraImageApplying, (WPARAM)hContact, 0);
+ if (hcontgiven) break;
+ Sleep(0);
+ }
+ while(hContact = db_find_next(hContact));
+
+ g_mutex_bSetAllExtraIconsCycle = 0;
+ cli.pfnInvalidateRect(hwndList, NULL, FALSE);
+ Sleep(0);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Services
+
INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
{
if (wParam == 0)
@@ -317,15 +359,13 @@ INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
TCHAR *desc = Langpack_PcharToTchar(ei->description);
BaseExtraIcon *extra = GetExtraIconByName(ei->name);
- if (extra != NULL)
- {
+ if (extra != NULL) {
if (ei->type != extra->getType() || ei->type != EXTRAICON_TYPE_ICOLIB)
return 0;
// Found one, now merge it
- if (_tcsicmp(extra->getDescription(), desc))
- {
+ if ( _tcsicmp(extra->getDescription(), desc)) {
tstring newDesc = extra->getDescription();
newDesc += _T(" / ");
newDesc += desc;
@@ -338,8 +378,7 @@ INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
if (ei->OnClick != NULL)
extra->setOnClick(ei->OnClick, ei->onClickParam);
- if (extra->getSlot() > 0)
- {
+ if (extra->getSlot() > 0) {
if (clistRebuildAlreadyCalled)
extra->rebuildIcons();
if (clistApplyAlreadyCalled)
@@ -382,26 +421,21 @@ INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
ExtraIconGroup *group = IsInGroup(groups, extra);
if (group != NULL)
- {
RebuildListsBasedOnGroups(groups);
- }
- else
- {
- for (unsigned int i = 0; i < groups.size(); ++i)
+ else {
+ for (unsigned int i = 0; i < groups.size(); i++)
delete groups[i];
extraIconsBySlot.push_back(extra);
std::sort(extraIconsBySlot.begin(), extraIconsBySlot.end(), compareFunc());
}
- if (slot >= 0 || group != NULL)
- {
+ if (slot >= 0 || group != NULL) {
if (clistRebuildAlreadyCalled)
extra->rebuildIcons();
slot = 0;
- for (unsigned int i = 0; i < extraIconsBySlot.size(); ++i)
- {
+ for (unsigned int i = 0; i < extraIconsBySlot.size(); i++) {
ExtraIcon *ex = extraIconsBySlot[i];
if (ex->getSlot() < 0)
continue;
@@ -435,49 +469,77 @@ INT_PTR ExtraIcon_SetIcon(WPARAM wParam, LPARAM lParam)
return extra->setIcon((int) ei->hExtraIcon, ei->hContact, ei->hImage);
}
-int ClistExtraListRebuild(WPARAM wParam, LPARAM lParam)
+static INT_PTR svcExtraIcon_Add(WPARAM wParam, LPARAM lParam)
{
- clistRebuildAlreadyCalled = TRUE;
+ return (INT_PTR)ExtraIcon_Add((HICON)wParam);
+}
- ResetIcons();
+///////////////////////////////////////////////////////////////////////////////
- for (unsigned int i = 0; i < extraIconsBySlot.size(); ++i)
- extraIconsBySlot[i]->rebuildIcons();
+void LoadExtraIconsModule()
+{
+ DWORD ret = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS2, 0);
+ clistFirstSlot = HIWORD(ret);
+ clistSlotCount = LOWORD(ret);
- return 0;
-}
+ // Services
+ CreateServiceFunction(MS_EXTRAICON_REGISTER, &ExtraIcon_Register);
+ CreateServiceFunction(MS_EXTRAICON_SET_ICON, &ExtraIcon_SetIcon);
-int ClistExtraImageApply(WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact = (HANDLE) wParam;
- if (hContact == NULL)
- return 0;
+ CreateServiceFunction(MS_CLIST_EXTRA_ADD_ICON, &svcExtraIcon_Add);
- clistApplyAlreadyCalled = TRUE;
+ hEventExtraClick = CreateHookableEvent(ME_CLIST_EXTRA_CLICK);
+ hEventExtraImageApplying = CreateHookableEvent(ME_CLIST_EXTRA_IMAGE_APPLY);
+ hEventExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD);
- for (unsigned int i = 0; i < extraIconsBySlot.size(); ++i)
- extraIconsBySlot[i]->applyIcon(hContact);
+ // Icons
+ TCHAR tszFile[MAX_PATH];
+ GetModuleFileName(NULL, tszFile, MAX_PATH);
- return 0;
-}
+ SKINICONDESC sid = {0};
+ sid.cbSize = sizeof(SKINICONDESC);
+ sid.flags = SIDF_PATH_TCHAR;
+ sid.ptszDefaultFile = tszFile;
+ sid.pszSection = "Contact List";
-int ClistExtraClick(WPARAM wParam, LPARAM lParam)
-{
- HANDLE hContact = (HANDLE) wParam;
- if (hContact == NULL)
- return 0;
+ sid.pszName = "AlwaysVis";
+ sid.pszDescription = LPGEN("Always Visible");
+ sid.iDefaultIndex = -IDI_ALWAYSVIS;
+ Skin_AddIcon(&sid);
- int clistSlot = (int) lParam;
+ sid.pszName = "NeverVis";
+ sid.pszDescription = LPGEN("Never Visible");
+ sid.iDefaultIndex = -IDI_NEVERVIS;
+ Skin_AddIcon(&sid);
- for (unsigned int i = 0; i < extraIconsBySlot.size(); ++i)
- {
- ExtraIcon *extra = extraIconsBySlot[i];
- if (ConvertToClistSlot(extra->getSlot()) == clistSlot)
- {
- extra->onClick(hContact);
- break;
- }
- }
+ sid.pszName = "ChatActivity";
+ sid.pszDescription = LPGEN("Chat Activity");
+ sid.iDefaultIndex = -IDI_CHAT;
+ Skin_AddIcon(&sid);
- return 0;
+ sid.pszName = "gender_male";
+ sid.pszDescription = LPGEN("Male");
+ sid.iDefaultIndex = -IDI_MALE;
+ Skin_AddIcon(&sid);
+
+ sid.pszName = "gender_female";
+ sid.pszDescription = LPGEN("Female");
+ sid.iDefaultIndex = -IDI_FEMALE;
+ Skin_AddIcon(&sid);
+
+ // Hooks
+ HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, &PreShutdown);
+
+ HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &ClistExtraListRebuild);
+ HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &ClistExtraImageApply);
+ HookEvent(ME_CLIST_EXTRA_CLICK, &ClistExtraClick);
+
+ DefaultExtraIcons_Load();
+}
+
+void UnloadExtraIconsModule(void)
+{
+ for (size_t i=0; i < registeredExtraIcons.size(); i++)
+ delete registeredExtraIcons[i];
}
diff --git a/src/modules/extraicons/extraicons.h b/src/modules/extraicons/extraicons.h
index 21ad6e955f..2ee5982e9c 100644
--- a/src/modules/extraicons/extraicons.h
+++ b/src/modules/extraicons/extraicons.h
@@ -44,6 +44,11 @@ int ConvertToClistSlot(int slot);
int Clist_SetExtraIcon(HANDLE hContact, int slot, HANDLE hImage);
+HANDLE ExtraIcon_Add(HICON hIcon);
+
+void fnReloadExtraIcons();
+void fnSetAllExtraIcons(HWND hwndList,HANDLE hContact);
+
static inline BOOL IsEmpty(const char *str)
{
return str == NULL || str[0] == 0;
diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp
index b23a4a4bed..36e05d4179 100644
--- a/src/modules/extraicons/options_ei.cpp
+++ b/src/modules/extraicons/options_ei.cpp
@@ -271,7 +271,7 @@ static HTREEITEM Tree_AddExtraIconGroup(HWND tree, vector<int> &group, bool sele
vector<int> *ids = new vector<int> ;
tstring desc;
int img = 0;
- for (unsigned int i = 0; i < group.size(); ++i) {
+ for (unsigned int i = 0; i < group.size(); i++) {
BaseExtraIcon *extra = registeredExtraIcons[group[i] - 1];
ids->push_back(extra->getID());
@@ -338,7 +338,7 @@ static void GroupSelectedItems(HWND tree)
// Remove old
- for (unsigned int i = 0; i < toRemove.size(); ++i) {
+ for (unsigned int i = 0; i < toRemove.size(); i++) {
delete Tree_GetIDs(tree, toRemove[i]);
TreeView_DeleteItem(tree, toRemove[i]);
}
@@ -443,7 +443,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
DestroyIcon(hDefaultIcon);
unsigned int i;
- for (i = 0; i < registeredExtraIcons.size(); ++i) {
+ for (i = 0; i < registeredExtraIcons.size(); i++) {
ExtraIcon *extra = registeredExtraIcons[i];
HICON hIcon = Skin_GetIcon(extra->getDescIcon());
@@ -460,13 +460,13 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
TreeView_SetImageList(tree, hImageList, TVSIL_NORMAL);
- for (i = 0; i < extraIconsBySlot.size(); ++i) {
+ for (i = 0; i < extraIconsBySlot.size(); i++) {
ExtraIcon *extra = extraIconsBySlot[i];
if (extra->getType() == EXTRAICON_TYPE_GROUP) {
ExtraIconGroup *group = (ExtraIconGroup *) extra;
vector<int> ids;
- for (unsigned int j = 0; j < group->items.size(); ++j)
+ for (unsigned int j = 0; j < group->items.size(); j++)
ids.push_back(group->items[j]->getID());
Tree_AddExtraIconGroup(tree, ids, extra->isEnabled());
}
@@ -496,7 +496,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
// Store old slots
int *oldSlots = new int[registeredExtraIcons.size()];
int lastUsedSlot = -1;
- for (i = 0; i < registeredExtraIcons.size(); ++i) {
+ for (i = 0; i < registeredExtraIcons.size(); i++) {
if (extraIconsByHandle[i] == registeredExtraIcons[i])
oldSlots[i] = registeredExtraIcons[i]->getSlot();
else
@@ -539,7 +539,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 (i = 0; i < ids->size(); i++) {
BaseExtraIcon *extra = registeredExtraIcons[ids->at(i) - 1];
extra->setPosition(pos++);
@@ -554,7 +554,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
// Store data
- for (i = 0; i < registeredExtraIcons.size(); ++i) {
+ for (i = 0; i < registeredExtraIcons.size(); i++) {
BaseExtraIcon *extra = registeredExtraIcons[i];
char setting[512];
@@ -567,14 +567,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM) MODULE_NAME "Groups");
DBWriteContactSettingWord(NULL, MODULE_NAME "Groups", "Count", (WORD)groups.size());
- for (i = 0; i < groups.size(); ++i) {
+ for (i = 0; i < groups.size(); i++) {
ExtraIconGroup *group = groups[i];
char setting[512];
mir_snprintf(setting, SIZEOF(setting), "%d_count", i);
DBWriteContactSettingWord(NULL, MODULE_NAME "Groups", setting, (WORD)group->items.size());
- for (unsigned int j = 0; j < group->items.size(); ++j) {
+ for (unsigned int j = 0; j < group->items.size(); j++) {
BaseExtraIcon *extra = group->items[j];
mir_snprintf(setting, SIZEOF(setting), "%d_%d", i, j);
@@ -583,12 +583,12 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
// Clean removed slots
- for (int j = firstEmptySlot; j <= lastUsedSlot; ++j)
+ for (int j = firstEmptySlot; j <= lastUsedSlot; j++)
RemoveExtraIcons(j);
// Apply icons to new slots
RebuildListsBasedOnGroups(groups);
- for (i = 0; i < extraIconsBySlot.size(); ++i) {
+ for (i = 0; i < extraIconsBySlot.size(); i++) {
ExtraIcon *extra = extraIconsBySlot[i];
if (extra->getType() != EXTRAICON_TYPE_GROUP)
diff --git a/src/modules/extraicons/usedIcons.cpp b/src/modules/extraicons/usedIcons.cpp
index 79ea375803..1c42104490 100644
--- a/src/modules/extraicons/usedIcons.cpp
+++ b/src/modules/extraicons/usedIcons.cpp
@@ -19,7 +19,7 @@
#include "..\..\core\commonheaders.h"
-#include "m_cluiframes.h"
+#include "extraicons.h"
struct Icon
{
@@ -39,7 +39,7 @@ static Icon * FindIcon(const char *icolibName)
{
Icon *icon = NULL;
- for (unsigned int i = 0; i < usedIcons.size(); ++i)
+ for (unsigned int i = 0; i < usedIcons.size(); i++)
{
Icon *tmp = &usedIcons[i];
if (tmp->name != icolibName)
@@ -60,7 +60,7 @@ static Icon * FindIcon(const char *icolibName)
HICON hIcon = Skin_GetIcon(icon->name.c_str());
if (hIcon != NULL)
{
- icon->hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM) hIcon, 0);
+ icon->hImage = ExtraIcon_Add(hIcon);
Skin_ReleaseIcon(hIcon);
}
}
@@ -82,7 +82,7 @@ HANDLE AddIcon(const char *icolibName)
void RemoveIcon(const char *icolibName)
{
- for (unsigned int i = 0; i < usedIcons.size(); ++i)
+ for (unsigned int i = 0; i < usedIcons.size(); i++)
{
Icon *icon = &usedIcons[i];
@@ -103,6 +103,6 @@ void ResetIcons()
{
usedIcons.erase(std::remove_if(usedIcons.begin(), usedIcons.end(), NotUsedIcon), usedIcons.end());
- for (unsigned int i = 0; i < usedIcons.size(); ++i)
+ for (unsigned int i = 0; i < usedIcons.size(); i++)
usedIcons[i].hImage = INVALID_HANDLE_VALUE;
}
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp
index 3abff53e39..9651e22a43 100644
--- a/src/modules/fonts/FontOptions.cpp
+++ b/src/modules/fonts/FontOptions.cpp
@@ -927,7 +927,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) {
int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int));
SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems);
- for (i=0; i < selCount; ++i) {
+ for (i=0; i < selCount; i++) {
FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0);
if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData
@@ -1017,7 +1017,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
else cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
if (ChooseFont(&cf)) {
- for (i=0; i < selCount; ++i) {
+ for (i=0; i < selCount; i++) {
FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0);
if (itemData->font_id < 0)
continue;
@@ -1054,7 +1054,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
FONTEFFECT es = { 0 };
es = E.value;
if (IDOK == DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndDlg, ChooseEffectDlgProc, (LPARAM)&es)) {
- for (int i=0; i < selCount; ++i) {
+ for (int i=0; i < selCount; i++) {
FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0);
if (itemData->effect_id < 0)
continue;
@@ -1110,7 +1110,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if (font_id_list_w2.getCount() && (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0))) {
int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int));
SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems);
- for (i=0; i < selCount; ++i) {
+ for (i=0; i < selCount; i++) {
FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0);
if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp
index e4796692a3..fd16b4c391 100644
--- a/src/modules/icolib/skin2icons.cpp
+++ b/src/modules/icolib/skin2icons.cpp
@@ -366,7 +366,7 @@ IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon)
int i=0;
do { // find new unique name
- mir_sntprintf(sourceName, SIZEOF(sourceName), _T("*StaticIcon_%d"), ++i);
+ mir_sntprintf(sourceName, SIZEOF(sourceName), _T("*StaticIcon_%d"), i++);
} while (iconSourceFileList.getIndex(&key) != -1);
IconSourceItem* newItem = (IconSourceItem*)mir_calloc(sizeof(IconSourceItem));
diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp
index 292a743109..e25b1ef17e 100644
--- a/src/modules/netlib/netlibautoproxy.cpp
+++ b/src/modules/netlib/netlibautoproxy.cpp
@@ -325,7 +325,7 @@ char* NetlibGetIeProxy(char *szUrl)
if (bEnabled)
{
- for (int i=0; i < proxyBypass.getCount(); ++i)
+ for (int i=0; i < proxyBypass.getCount(); i++)
{
if (strcmp(proxyBypass[i], "<local>") == 0)
{
@@ -447,10 +447,10 @@ void NetlibUnloadIeProxy(void)
{
int i;
- for (i=0; i < 3; ++i)
+ for (i=0; i < 3; i++)
mir_free(szProxyHost[i]);
- for (i=0; i < proxyBypass.getCount(); ++i)
+ for (i=0; i < proxyBypass.getCount(); i++)
mir_free(proxyBypass[i]);
proxyBypass.destroy();
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp
index 72b98f20e0..6c7c63e2bd 100644
--- a/src/modules/netlib/netliblog.cpp
+++ b/src/modules/netlib/netliblog.cpp
@@ -107,7 +107,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_STATE;
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- for (i=0; i < netlibUser.getCount(); ++i)
+ for (i=0; i < netlibUser.getCount(); i++)
{
tvis.item.pszText = netlibUser[i]->user.ptszDescriptiveName;
tvis.item.lParam = i;
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp
index 386de096f2..c2427c951e 100644
--- a/src/modules/netlib/netlibopts.cpp
+++ b/src/modules/netlib/netlibopts.cpp
@@ -177,7 +177,7 @@ static void ChangeSettingStringByEdit(HWND hwndDlg, UINT ctrlId, int iUser, int
char *szNewValue = (char*)mir_alloc(newValueLen+1);
GetDlgItemTextA(hwndDlg, ctrlId, szNewValue, newValueLen+1);
if (iUser == -1) {
- for (int i=0; i<tempSettings.getCount(); ++i)
+ for (int i=0; i<tempSettings.getCount(); i++)
if ( !(tempSettings[i]->flags & NUF_NOOPTIONS)) {
char **ppszNew = (char**)(((PBYTE)&tempSettings[i]->settings)+memberOffset);
mir_free(*ppszNew);
@@ -235,7 +235,7 @@ void NetlibSaveUserSettingsStruct(const char *szSettingsModule, NETLIBUSERSETTIN
combinedSettings.cbSize = sizeof(combinedSettings);
DWORD flags = 0;
- for (int i=0; i < netlibUser.getCount(); ++i) {
+ for (int i=0; i < netlibUser.getCount(); i++) {
if (thisUser->user.flags & NUF_NOOPTIONS)
continue;
CombineSettingsStructs(&combinedSettings, &flags, &thisUser->settings, thisUser->user.flags);
@@ -290,7 +290,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if (iUser == -1) {
settings.cbSize = sizeof(settings);
- for (int i=0; i < tempSettings.getCount(); ++i) {
+ for (int i=0; i < tempSettings.getCount(); i++) {
if (tempSettings[i]->flags & NUF_NOOPTIONS) continue;
CombineSettingsStructs(&settings, &flags, &tempSettings[i]->settings, tempSettings[i]->flags);
}
@@ -344,7 +344,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
int enableAuth = 0, enableUser = 0, enablePass = 0, enableServer = 1;
EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), TRUE);
if (selectedProxyType == 0) {
- for (int i=0; i < tempSettings.getCount(); ++i) {
+ for (int i=0; i < tempSettings.getCount(); i++) {
if ( !tempSettings[i]->settings.useProxy ||
tempSettings[i]->flags & NUF_NOOPTIONS || !(tempSettings[i]->flags & NUF_OUTGOING))
continue;
@@ -397,7 +397,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
int newValue = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0);
if (iUser == -1) {
if (newValue == 0) return 0;
- for (int i=0; i < tempSettings.getCount(); ++i) {
+ for (int i=0; i < tempSettings.getCount(); i++) {
if (tempSettings[i]->flags & NUF_NOOPTIONS) continue;
if (newValue == PROXYTYPE_HTTP && !(tempSettings[i]->flags & (NUF_HTTPCONNS|NUF_HTTPGATEWAY)))
tempSettings[i]->settings.proxyType = PROXYTYPE_HTTPS;
@@ -444,7 +444,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
int newValue = GetDlgItemInt(hwndDlg, LOWORD(wParam), NULL, FALSE);
if (iUser == -1) {
- for (int i=0; i < tempSettings.getCount(); ++i)
+ for (int i=0; i < tempSettings.getCount(); i++)
if ( !(tempSettings[i]->flags & NUF_NOOPTIONS))
tempSettings[i]->settings.wProxyPort = newValue;
}
@@ -503,7 +503,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM)
int optionsCount = 0;
{
mir_cslock lck(csNetlibUser);
- for (int i=0; i < netlibUser.getCount(); ++i)
+ for (int i=0; i < netlibUser.getCount(); i++)
if ( !(netlibUser[i]->user.flags & NUF_NOOPTIONS))
++optionsCount;
}
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp
index ac0435564e..5918263110 100644
--- a/src/modules/netlib/netlibsock.cpp
+++ b/src/modules/netlib/netlibsock.cpp
@@ -336,7 +336,7 @@ static NETLIBIPLIST* GetMyIpv4(void)
NETLIBIPLIST *addr = (NETLIBIPLIST*)mir_calloc(n * 64 + 4);
addr->cbNum = n;
- for (unsigned i=0; i < n; ++i)
+ for (unsigned i=0; i < n; i++)
strcpy(addr->szIp[i], inet_ntoa(*(PIN_ADDR)he->h_addr_list[i]));
return addr;
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp
index 31b52bb433..33f48221c3 100644
--- a/src/modules/netlib/netlibupnp.cpp
+++ b/src/modules/netlib/netlibupnp.cpp
@@ -626,7 +626,7 @@ static void discoverUPnP(void)
ips = (unsigned*)mir_alloc(nip * sizeof(unsigned));
- for (j = 0; j < nip; ++j)
+ for (j = 0; j < nip; j++)
ips[j] = *(unsigned*)he->h_addr_list[j];
}
@@ -634,7 +634,7 @@ static void discoverUPnP(void)
for (i = 3; --i && szUrl[0] == 0;)
{
- for (j = 0; j < nip; ++j)
+ for (j = 0; j < nip; j++)
{
if (ips)
setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (char *)&ips[j], sizeof(unsigned));
@@ -784,7 +784,7 @@ void NetlibUPnPDeletePortMapping(WORD extport, char* proto)
mir_snprintf(szData, 4096, delete_port_mapping, extport, proto);
httpTransact(szCtlUrl, szData, 4096, "DeletePortMapping", ControlAction);
- for (i=0; i < numports; ++i)
+ for (i=0; i < numports; i++)
if (portList[i] == extport && --numports > 0)
memmove(&portList[i], &portList[i+1], (numports - i) * sizeof(WORD));
@@ -802,7 +802,7 @@ void NetlibUPnPCleanup(void*)
{
int incoming = 0;
mir_cslock lck(csNetlibUser);
- for (int i=0; i < netlibUser.getCount(); ++i)
+ for (int i=0; i < netlibUser.getCount(); i++)
if (netlibUser[i]->user.flags & NUF_INCOMING) {
incoming = 1;
break;
@@ -828,7 +828,7 @@ void NetlibUPnPCleanup(void*)
txtParseParam(szData, "QueryStateVariableResponse", "<return>", "<", buf, sizeof(buf)))
num = atol(buf);
- for (i=0; i<num && !Miranda_Terminated(); ++i)
+ for (i=0; i<num && !Miranda_Terminated(); i++)
{
mir_snprintf(szData, 4096, get_port_mapping, i);
@@ -862,7 +862,7 @@ void NetlibUPnPCleanup(void*)
ReleaseMutex(portListMutex);
- for (i=0; i<j && !Miranda_Terminated(); ++i)
+ for (i=0; i<j && !Miranda_Terminated(); i++)
NetlibUPnPDeletePortMapping(ports[i], "TCP");
}
}
diff --git a/src/modules/options/headerbar.cpp b/src/modules/options/headerbar.cpp
index 4d6b93268b..3f2cca1a26 100644
--- a/src/modules/options/headerbar.cpp
+++ b/src/modules/options/headerbar.cpp
@@ -260,7 +260,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg,
temprc.bottom = mit->width;
HRGN hRgn = CreateRectRgnIndirect(&temprc);
- for (int i=0; i < mit->nControlsToRedraw; ++i)
+ for (int i=0; i < mit->nControlsToRedraw; i++)
{
GetWindowRect(mit->controlsToRedraw[i], &temprc);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&temprc, 2);
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp
index 9cce3dfc10..43ee3f6571 100644
--- a/src/modules/options/options.cpp
+++ b/src/modules/options/options.cpp
@@ -414,7 +414,7 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg =
// Fix alpha channel
GdiFlush();
- for (int i=0; i < rc.right*rc.bottom; ++i, pBits += 4)
+ for (int i=0; i < rc.right*rc.bottom; i++, pBits += 4)
if ( !pBits[3]) pBits[3] = 255;
//Copy to output
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index 2ab2c79c14..bac663a48f 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -279,7 +279,7 @@ char** __fastcall Proto_FilesMatrixA(wchar_t **files)
while (files[ count++ ]);
char** filesA = (char**)mir_alloc(count * sizeof(char*));
- for (int i=0; i < count; ++i)
+ for (int i=0; i < count; i++)
filesA[ i ] = mir_u2a(files[ i ]);
return filesA;
@@ -293,7 +293,7 @@ static wchar_t** __fastcall Proto_FilesMatrixU(char **files)
while (files[ count++ ]);
wchar_t** filesU = (wchar_t**)mir_alloc(count * sizeof(wchar_t*));
- for (int i=0; i < count; ++i)
+ for (int i=0; i < count; i++)
filesU[ i ] = mir_a2u(files[ i ]);
return filesU;
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp
index e5adade60a..123c93bada 100644
--- a/src/modules/protocols/protoopts.cpp
+++ b/src/modules/protocols/protoopts.cpp
@@ -124,7 +124,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam
GetDlgItemTextA(hwndDlg, IDC_ACCINTERNALNAME, buf, SIZEOF(buf));
rtrim(buf);
if (buf[0]) {
- for (int i=0; i < accounts.getCount(); ++i)
+ for (int i=0; i < accounts.getCount(); i++)
if (_stricmp(buf, accounts[i]->szModuleName) == 0)
return FALSE;
} }
@@ -659,7 +659,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
dat->iSelected = -1;
SendMessage(hList, LB_RESETCONTENT, 0, 0);
- for (i=0; i < accounts.getCount(); ++i) {
+ for (i=0; i < accounts.getCount(); i++) {
int iItem = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM)accounts[i]->tszAccountName);
SendMessage(hList, LB_SETITEMDATA, iItem, (LPARAM)accounts[i]);
@@ -966,7 +966,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
int i;
PSHNOTIFY pshn = {0};
pshn.hdr.code = PSN_APPLY;
- for (i=0; i < accounts.getCount(); ++i) {
+ for (i=0; i < accounts.getCount(); i++) {
if (accounts[i]->hwndAccMgrUI && accounts[i]->bAccMgrUIChanged) {
pshn.hdr.hwndFrom = accounts[i]->hwndAccMgrUI;
SendMessage(accounts[i]->hwndAccMgrUI, WM_NOTIFY, 0, (LPARAM)&pshn);
@@ -979,7 +979,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
int i;
PSHNOTIFY pshn = {0};
pshn.hdr.code = PSN_RESET;
- for (i=0; i < accounts.getCount(); ++i) {
+ for (i=0; i < accounts.getCount(); i++) {
if (accounts[i]->hwndAccMgrUI && accounts[i]->bAccMgrUIChanged) {
pshn.hdr.hwndFrom = accounts[i]->hwndAccMgrUI;
SendMessage(accounts[i]->hwndAccMgrUI, WM_NOTIFY, 0, (LPARAM)&pshn);
@@ -993,7 +993,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
break;
case WM_DESTROY:
{
- for (int i=0; i < accounts.getCount(); ++i) {
+ for (int i=0; i < accounts.getCount(); i++) {
accounts[i]->bAccMgrUIChanged = FALSE;
if (accounts[i]->hwndAccMgrUI) {
DestroyWindow(accounts[i]->hwndAccMgrUI);
diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp
index 9bf5bdc86e..3e6a30c76c 100644
--- a/src/modules/skin/hotkey_opts.cpp
+++ b/src/modules/skin/hotkey_opts.cpp
@@ -886,7 +886,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
else if (param->uNewState>>12 == 2) {
int i, nItems = ListView_GetItemCount(lpnmhdr->hwndFrom);
initialized = FALSE;
- for (i=0; i < hotkeys.getCount(); ++i) {
+ for (i=0; i < hotkeys.getCount(); i++) {
LVITEM lvi = {0};
THotkeyItem *item = hotkeys[i];
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp
index 1e72b380a1..613ab96bd6 100644
--- a/src/modules/skin/hotkeys.cpp
+++ b/src/modules/skin/hotkeys.cpp
@@ -220,7 +220,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam)
mir_snprintf(pszNamePrefix, SIZEOF(pszNamePrefix), "%s$", pszName);
cbNamePrefix = strlen(pszNamePrefix);
- for (i=0; i < hotkeys.getCount(); ++i)
+ for (i=0; i < hotkeys.getCount(); i++)
{
char *pszCurrentName = hotkeys[i]->rootHotkey ?
hotkeys[i]->rootHotkey->pszName :
@@ -235,7 +235,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam)
if (g_hwndHkOptions)
SendMessage(g_hwndHkOptions, WM_HOTKEYUNREGISTERED, 0, 0);
- for (i=0; i < hotkeys.getCount(); ++i)
+ for (i=0; i < hotkeys.getCount(); i++)
if (hotkeys[i]->UnregisterHotkey) {
FreeHotkey(hotkeys[i]);
List_Remove((SortedList *)&hotkeys, i);
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp
index b5a2087e32..96935bb8af 100644
--- a/src/modules/utils/timezones.cpp
+++ b/src/modules/utils/timezones.cpp
@@ -382,7 +382,7 @@ static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags)
if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
{
unsigned hash = mir_hashstrT(dbv.ptszVal);
- for (int i=0; i < g_timezonesBias.getCount(); ++i)
+ for (int i=0; i < g_timezonesBias.getCount(); i++)
{
if (hash == g_timezonesBias[i]->hash)
{
@@ -409,7 +409,7 @@ static int timeapiPrepareList(HANDLE hContact, HWND hWnd, DWORD dwFlags)
SendMessage(hWnd, lstMsg->addStr, 0, (LPARAM)TranslateT("<unspecified>"));
- for (int i=0; i < g_timezonesBias.getCount(); ++i)
+ for (int i=0; i < g_timezonesBias.getCount(); i++)
{
MIM_TIMEZONE *tz = g_timezonesBias[i];
@@ -537,7 +537,7 @@ extern "C" __declspec(dllexport) void RecalculateTime(void)
found = true;
}
- for (int i=0; i < g_timezones.getCount(); ++i)
+ for (int i=0; i < g_timezones.getCount(); i++)
{
MIM_TIMEZONE &tz = g_timezones[i];
if (tz.offset != INT_MIN) tz.offset = INT_MIN;
diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp
index a473c9b194..b0e9c27970 100644
--- a/src/modules/xml/xmlParser.cpp
+++ b/src/modules/xml/xmlParser.cpp
@@ -2540,10 +2540,10 @@ XMLNode XMLNode::getNextNode() const
XMLNodeDataTag *par = d->pParent;
if ( !par) return emptyXMLNode;
int i, n = par->nChild;
- for (i=0; i<n; ++i)
- {
- if (par->pChild[i].d == d) break;
- }
+ for (i=0; i<n; i++)
+ if (par->pChild[i].d == d)
+ break;
+
return XMLNode(par).getChildNode(d->lpszName, &++i);
}
@@ -2705,7 +2705,7 @@ XMLCSTR XMLNode::getInnerText() const
int count = nElement();
int i, length = 1;
- for (i=0; i < count; ++i)
+ for (i=0; i < count; i++)
{
XMLNodeContents c = enumContents(i);
switch (c.etype)
@@ -2720,7 +2720,7 @@ XMLCSTR XMLNode::getInnerText() const
}
XMLCHAR *buf = (XMLCHAR *)malloc(sizeof(XMLCHAR) * length);
XMLCHAR *pos = buf;
- for (i=0; i < count; ++i)
+ for (i=0; i < count; i++)
{
XMLNodeContents c = enumContents(i);
switch (c.etype)