diff options
author | George Hazan <ghazan@miranda.im> | 2021-04-04 20:00:58 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-04-04 20:00:58 +0300 |
commit | 5af1168b7f7b246a74927d01dda2d9b9a016667d (patch) | |
tree | 429cf1e946536046266a4ab4be8a44bd8ea8a232 /plugins | |
parent | 86b87c4bd7f2818723d83d7b5d44561a134adf25 (diff) |
ancient evil destroyed (also fixes #2831 - icons order is broken in NewAwaySys) + massive cycle code cleaning
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NewAwaySysMod/src/AwayOpt.cpp | 175 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/AwaySys.cpp | 47 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Client.cpp | 9 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/ContactList.cpp | 9 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/ContactList.h | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/MsgTree.cpp | 48 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/MsgTree.h | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Properties.cpp | 22 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Properties.h | 165 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 69 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/resource.h | 1 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/stdafx.h | 4 |
12 files changed, 233 insertions, 320 deletions
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index f645bf677c..a6b248ccb7 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -26,7 +26,6 @@ #include "GroupCheckbox.h"
int g_Messages_RecentRootID, g_Messages_PredefinedRootID;
-CIconList g_IconList;
// Set window size and center its controls
void MySetPos(HWND hwndParent)
@@ -96,16 +95,16 @@ static LRESULT CALLBACK DefStatusButtonSubclassProc(HWND hWnd, UINT Msg, WPARAM }
struct {
- int DlgItem, Status, IconIndex;
+ int DlgItem, Status;
}
static Dlg1DefMsgDlgItems[] = {
- { IDC_MESSAGEDLG_DEF_ONL, ID_STATUS_ONLINE, ILI_PROTO_ONL },
- { IDC_MESSAGEDLG_DEF_AWAY, ID_STATUS_AWAY, ILI_PROTO_AWAY },
- { IDC_MESSAGEDLG_DEF_NA, ID_STATUS_NA, ILI_PROTO_NA },
- { IDC_MESSAGEDLG_DEF_OCC, ID_STATUS_OCCUPIED, ILI_PROTO_OCC },
- { IDC_MESSAGEDLG_DEF_DND, ID_STATUS_DND, ILI_PROTO_DND },
- { IDC_MESSAGEDLG_DEF_FFC, ID_STATUS_FREECHAT, ILI_PROTO_FFC },
- { IDC_MESSAGEDLG_DEF_INV, ID_STATUS_INVISIBLE, ILI_PROTO_INV }
+ { IDC_MESSAGEDLG_DEF_ONL, ID_STATUS_ONLINE },
+ { IDC_MESSAGEDLG_DEF_AWAY, ID_STATUS_AWAY },
+ { IDC_MESSAGEDLG_DEF_NA, ID_STATUS_NA },
+ { IDC_MESSAGEDLG_DEF_OCC, ID_STATUS_OCCUPIED },
+ { IDC_MESSAGEDLG_DEF_DND, ID_STATUS_DND },
+ { IDC_MESSAGEDLG_DEF_FFC, ID_STATUS_FREECHAT },
+ { IDC_MESSAGEDLG_DEF_INV, ID_STATUS_INVISIBLE },
};
struct {
@@ -113,10 +112,10 @@ struct { wchar_t* Text;
}
static Dlg1Buttons[] = {
- IDC_MESSAGEDLG_NEWMSG, ILI_NEWMESSAGE, LPGENW("Create new message"),
- IDC_MESSAGEDLG_NEWCAT, ILI_NEWCATEGORY, LPGENW("Create new category"),
- IDC_MESSAGEDLG_DEL, ILI_DELETE, LPGENW("Delete"),
- IDC_MESSAGEDLG_VARS, ILI_NOICON, LPGENW("Open Variables help dialog"),
+ IDC_MESSAGEDLG_NEWMSG, IDI_NEWMESSAGE, LPGENW("Create new message"),
+ IDC_MESSAGEDLG_NEWCAT, IDI_NEWCATEGORY, LPGENW("Create new category"),
+ IDC_MESSAGEDLG_DEL, IDI_DELETE, LPGENW("Delete"),
+ IDC_MESSAGEDLG_VARS, -1, LPGENW("Open Variables help dialog"),
};
static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -133,15 +132,15 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_MESSAGEDLG_MSGTITLE, EM_LIMITTEXT, TREEITEMTITLE_MAXLEN, 0);
SendDlgItemMessage(hwndDlg, IDC_MESSAGEDLG_MSGDATA, EM_LIMITTEXT, AWAY_MSGDATA_MAX, 0);
// init image buttons
- for (int i = 0; i < _countof(Dlg1Buttons); i++) {
- HWND hButton = GetDlgItem(hwndDlg, Dlg1Buttons[i].DlgItem);
- SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)TranslateW(Dlg1Buttons[i].Text), BATF_UNICODE);
+ for (auto &it: Dlg1Buttons) {
+ HWND hButton = GetDlgItem(hwndDlg, it.DlgItem);
+ SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)TranslateW(it.Text), BATF_UNICODE);
SendMessage(hButton, BUTTONSETASFLATBTN, TRUE, 0);
}
// now default status message buttons
- for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++) {
- HWND hButton = GetDlgItem(hwndDlg, Dlg1DefMsgDlgItems[i].DlgItem);
- SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)Clist_GetStatusModeDescription(Dlg1DefMsgDlgItems[i].Status, 0), BATF_UNICODE);
+ for (auto &it: Dlg1DefMsgDlgItems) {
+ HWND hButton = GetDlgItem(hwndDlg, it.DlgItem);
+ SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)Clist_GetStatusModeDescription(it.Status, 0), BATF_UNICODE);
SendMessage(hButton, BUTTONSETASPUSHBTN, TRUE, 0);
SendMessage(hButton, BUTTONSETASFLATBTN, TRUE, 0);
g_OrigDefStatusButtonMsgProc = (WNDPROC)SetWindowLongPtr(hButton, GWLP_WNDPROC, (LONG_PTR)DefStatusButtonSubclassProc);
@@ -157,12 +156,12 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP return true;
case UM_ICONSCHANGED:
- for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++)
- SendDlgItemMessage(hwndDlg, Dlg1DefMsgDlgItems[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg1DefMsgDlgItems[i].IconIndex]);
+ for (auto &it : Dlg1DefMsgDlgItems)
+ SendDlgItemMessage(hwndDlg, it.DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadProtoIcon(nullptr, it.Status));
- for (int i = 0; i < _countof(Dlg1Buttons); i++)
- if (Dlg1Buttons[i].IconIndex != ILI_NOICON)
- SendDlgItemMessage(hwndDlg, Dlg1Buttons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg1Buttons[i].IconIndex]);
+ for (auto &it : Dlg1Buttons)
+ if (it.IconIndex != -1)
+ SendDlgItemMessage(hwndDlg, it.DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(it.IconIndex));
variables_skin_helpbutton(hwndDlg, IDC_MESSAGEDLG_VARS);
break;
@@ -207,9 +206,9 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_MESSAGEDLG_MSGDATA, TranslateT("You can put your frequently used and favorite messages in this category."));
}
}
- for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++) {
- COptItem_Checkbox *Checkbox = (COptItem_Checkbox*)g_MessagesOptPage.Find(Dlg1DefMsgDlgItems[i].DlgItem);
- Checkbox->SetWndValue(g_MessagesOptPage.GetWnd(), MsgTree->GetDefMsg(Dlg1DefMsgDlgItems[i].Status) == pnm->ItemNew->ID);
+ for (auto &it: Dlg1DefMsgDlgItems) {
+ COptItem_Checkbox *Checkbox = (COptItem_Checkbox*)g_MessagesOptPage.Find(it.DlgItem);
+ Checkbox->SetWndValue(g_MessagesOptPage.GetWnd(), MsgTree->GetDefMsg(it.Status) == pnm->ItemNew->ID);
}
ChangeLock--;
}
@@ -222,9 +221,9 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP _ASSERT(SelectedItem);
// SelectedItem contains the same info as one of ItemOld or ItemNew - so we'll just use SelectedItem and won't bother with identifying which of ItemOld or ItemNew is currently selected
if ((pnm->ItemOld && pnm->ItemOld->ID == SelectedItem->ID) || (pnm->ItemNew && pnm->ItemNew->ID == SelectedItem->ID)) {
- for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++) {
- COptItem_Checkbox *Checkbox = (COptItem_Checkbox*)g_MessagesOptPage.Find(Dlg1DefMsgDlgItems[i].DlgItem);
- Checkbox->SetWndValue(g_MessagesOptPage.GetWnd(), MsgTree->GetDefMsg(Dlg1DefMsgDlgItems[i].Status) == SelectedItem->ID);
+ for (auto &it: Dlg1DefMsgDlgItems) {
+ COptItem_Checkbox *Checkbox = (COptItem_Checkbox*)g_MessagesOptPage.Find(it.DlgItem);
+ Checkbox->SetWndValue(g_MessagesOptPage.GetWnd(), MsgTree->GetDefMsg(it.Status) == SelectedItem->ID);
}
}
}
@@ -265,9 +264,9 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_MESSAGEDLG_DEF_DND:
case IDC_MESSAGEDLG_DEF_FFC:
case IDC_MESSAGEDLG_DEF_INV:
- for (int i = 0; i < _countof(Dlg1DefMsgDlgItems); i++) {
- if (LOWORD(wParam) == Dlg1DefMsgDlgItems[i].DlgItem) {
- MsgTree->SetDefMsg(Dlg1DefMsgDlgItems[i].Status, MsgTree->GetSelection()->ID); // PSM_CHANGED is sent here through MTN_DEFMSGCHANGED, so we don't need to send it once more
+ for (auto &it: Dlg1DefMsgDlgItems) {
+ if (LOWORD(wParam) == it.DlgItem) {
+ MsgTree->SetDefMsg(it.Status, MsgTree->GetSelection()->ID); // PSM_CHANGED is sent here through MTN_DEFMSGCHANGED, so we don't need to send it once more
break;
}
}
@@ -338,16 +337,16 @@ void EnableMoreOptDlgControls() }
struct {
- int DlgItem, Status, IconIndex;
+ int DlgItem, Status;
}
static Dlg2StatusButtons[] = {
- { IDC_MOREOPTDLG_DONTPOPDLG_ONL, ID_STATUS_ONLINE, ILI_PROTO_ONL },
- { IDC_MOREOPTDLG_DONTPOPDLG_AWAY, ID_STATUS_AWAY, ILI_PROTO_AWAY },
- { IDC_MOREOPTDLG_DONTPOPDLG_NA, ID_STATUS_NA, ILI_PROTO_NA },
- { IDC_MOREOPTDLG_DONTPOPDLG_OCC, ID_STATUS_OCCUPIED, ILI_PROTO_OCC },
- { IDC_MOREOPTDLG_DONTPOPDLG_DND, ID_STATUS_DND, ILI_PROTO_DND },
- { IDC_MOREOPTDLG_DONTPOPDLG_FFC, ID_STATUS_FREECHAT, ILI_PROTO_FFC },
- { IDC_MOREOPTDLG_DONTPOPDLG_INV, ID_STATUS_INVISIBLE, ILI_PROTO_INV }
+ { IDC_MOREOPTDLG_DONTPOPDLG_ONL, ID_STATUS_ONLINE },
+ { IDC_MOREOPTDLG_DONTPOPDLG_AWAY, ID_STATUS_AWAY },
+ { IDC_MOREOPTDLG_DONTPOPDLG_NA, ID_STATUS_NA },
+ { IDC_MOREOPTDLG_DONTPOPDLG_OCC, ID_STATUS_OCCUPIED },
+ { IDC_MOREOPTDLG_DONTPOPDLG_DND, ID_STATUS_DND },
+ { IDC_MOREOPTDLG_DONTPOPDLG_FFC, ID_STATUS_FREECHAT },
+ { IDC_MOREOPTDLG_DONTPOPDLG_INV, ID_STATUS_INVISIBLE },
};
static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -364,9 +363,9 @@ static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_WAITFORMSG_SPIN, UDM_SETRANGE32, -1, 9999);
SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_RECENTMSGSCOUNT_SPIN, UDM_SETRANGE32, 0, 99);
SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_UPDATEMSGSPERIOD_SPIN, UDM_SETRANGE32, 30, 99999);
- for (int i = 0; i < _countof(Dlg2StatusButtons); i++) {
- HWND hButton = GetDlgItem(hwndDlg, Dlg2StatusButtons[i].DlgItem);
- SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)Clist_GetStatusModeDescription(Dlg2StatusButtons[i].Status, 0), BATF_UNICODE);
+ for (auto &it: Dlg2StatusButtons) {
+ HWND hButton = GetDlgItem(hwndDlg, it.DlgItem);
+ SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)Clist_GetStatusModeDescription(it.Status, 0), BATF_UNICODE);
SendMessage(hButton, BUTTONSETASPUSHBTN, TRUE, 0);
SendMessage(hButton, BUTTONSETASFLATBTN, TRUE, 0);
}
@@ -377,8 +376,8 @@ static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return true;
case UM_ICONSCHANGED:
- for (int i = 0; i < _countof(Dlg2StatusButtons); i++)
- SendDlgItemMessage(hwndDlg, Dlg2StatusButtons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg2StatusButtons[i].IconIndex]);
+ for (auto &it: Dlg2StatusButtons)
+ SendDlgItemMessage(hwndDlg, it.DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadProtoIcon(nullptr, it.Status));
break;
case WM_NOTIFY:
@@ -459,16 +458,16 @@ void EnableAutoreplyOptDlgControls() }
static struct {
- int DlgItem, Status, IconIndex;
+ int DlgItem, Status;
}
Dlg3StatusButtons[] = {
- { IDC_REPLYDLG_DISABLE_ONL, ID_STATUS_ONLINE, ILI_PROTO_ONL },
- { IDC_REPLYDLG_DISABLE_AWAY, ID_STATUS_AWAY, ILI_PROTO_AWAY },
- { IDC_REPLYDLG_DISABLE_NA, ID_STATUS_NA, ILI_PROTO_NA },
- { IDC_REPLYDLG_DISABLE_OCC, ID_STATUS_OCCUPIED, ILI_PROTO_OCC },
- { IDC_REPLYDLG_DISABLE_DND, ID_STATUS_DND, ILI_PROTO_DND },
- { IDC_REPLYDLG_DISABLE_FFC, ID_STATUS_FREECHAT, ILI_PROTO_FFC },
- { IDC_REPLYDLG_DISABLE_INV, ID_STATUS_INVISIBLE, ILI_PROTO_INV },
+ { IDC_REPLYDLG_DISABLE_ONL, ID_STATUS_ONLINE },
+ { IDC_REPLYDLG_DISABLE_AWAY, ID_STATUS_AWAY },
+ { IDC_REPLYDLG_DISABLE_NA, ID_STATUS_NA },
+ { IDC_REPLYDLG_DISABLE_OCC, ID_STATUS_OCCUPIED },
+ { IDC_REPLYDLG_DISABLE_DND, ID_STATUS_DND },
+ { IDC_REPLYDLG_DISABLE_FFC, ID_STATUS_FREECHAT },
+ { IDC_REPLYDLG_DISABLE_INV, ID_STATUS_INVISIBLE },
};
INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -509,12 +508,12 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l L"Miranda", AUTOREPLY_IDLE_MIRANDA
};
- for (int i = 0; i < _countof(IdleComboValues); i++)
- SendMessage(hCombo, CB_SETITEMDATA, SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)TranslateW(IdleComboValues[i].Text)), IdleComboValues[i].Meaning);
+ for (auto &it: IdleComboValues)
+ SendMessage(hCombo, CB_SETITEMDATA, SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)TranslateW(it.Text)), it.Meaning);
- for (int i = 0; i < _countof(Dlg3StatusButtons); i++) {
- HWND hButton = GetDlgItem(hwndDlg, Dlg3StatusButtons[i].DlgItem);
- SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)Clist_GetStatusModeDescription(Dlg3StatusButtons[i].Status, 0), BATF_UNICODE);
+ for (auto &it: Dlg3StatusButtons) {
+ HWND hButton = GetDlgItem(hwndDlg, it.DlgItem);
+ SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)Clist_GetStatusModeDescription(it.Status, 0), BATF_UNICODE);
SendMessage(hButton, BUTTONSETASPUSHBTN, TRUE, 0);
SendMessage(hButton, BUTTONSETASFLATBTN, TRUE, 0);
}
@@ -537,13 +536,13 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l IDC_MOREOPTDLG_EVNTFILE, LPGENW("File")
};
hWndTooltips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP | TTS_NOPREFIX, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandleA("mir_app.mir"), nullptr);
- TOOLINFO ti = { 0 };
+ TOOLINFO ti = {};
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.hwnd = hwndDlg;
- for (int i = 0; i < _countof(Tooltips); i++) {
- ti.uId = (UINT_PTR)GetDlgItem(hwndDlg, Tooltips[i].m_dlgItemID);
- ti.lpszText = TranslateW(Tooltips[i].Text);
+ for (auto &it: Tooltips) {
+ ti.uId = (UINT_PTR)GetDlgItem(hwndDlg, it.m_dlgItemID);
+ ti.lpszText = TranslateW(it.Text);
SendMessage(hWndTooltips, TTM_ADDTOOL, 0, (LPARAM)&ti);
}
SendMessage(hWndTooltips, TTM_SETMAXTIPWIDTH, 0, 500);
@@ -557,12 +556,12 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l return true;
case UM_ICONSCHANGED:
- for (int i = 0; i < _countof(Dlg3StatusButtons); i++)
- SendDlgItemMessage(hwndDlg, Dlg3StatusButtons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Dlg3StatusButtons[i].IconIndex]);
+ for (auto &it: Dlg3StatusButtons)
+ SendDlgItemMessage(hwndDlg, it.DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadProtoIcon(nullptr, it.Status));
variables_skin_helpbutton(hwndDlg, IDC_REPLYDLG_VARS);
- SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_EVNTMSG, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[ILI_EVENT_MESSAGE]);
- SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_EVNTFILE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[ILI_EVENT_FILE]);
+ SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_EVNTMSG, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
+ SendDlgItemMessage(hwndDlg, IDC_MOREOPTDLG_EVNTFILE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_FILE));
break;
case WM_NOTIFY:
@@ -633,16 +632,16 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l //================================================ Modern options ==============================================
static struct {
- int DlgItem, Status, IconIndex;
+ int DlgItem, Status;
}
Dlg4DefMsgDlgItems[] = {
- { IDC_MESSAGEDLG_DEF_ONL, ID_STATUS_ONLINE, ILI_PROTO_ONL },
- { IDC_MESSAGEDLG_DEF_AWAY, ID_STATUS_AWAY, ILI_PROTO_AWAY },
- { IDC_MESSAGEDLG_DEF_NA, ID_STATUS_NA, ILI_PROTO_NA },
- { IDC_MESSAGEDLG_DEF_OCC, ID_STATUS_OCCUPIED, ILI_PROTO_OCC },
- { IDC_MESSAGEDLG_DEF_DND, ID_STATUS_DND, ILI_PROTO_DND },
- { IDC_MESSAGEDLG_DEF_FFC, ID_STATUS_FREECHAT, ILI_PROTO_FFC },
- { IDC_MESSAGEDLG_DEF_INV, ID_STATUS_INVISIBLE, ILI_PROTO_INV }
+ { IDC_MESSAGEDLG_DEF_ONL, ID_STATUS_ONLINE },
+ { IDC_MESSAGEDLG_DEF_AWAY, ID_STATUS_AWAY },
+ { IDC_MESSAGEDLG_DEF_NA, ID_STATUS_NA },
+ { IDC_MESSAGEDLG_DEF_OCC, ID_STATUS_OCCUPIED },
+ { IDC_MESSAGEDLG_DEF_DND, ID_STATUS_DND },
+ { IDC_MESSAGEDLG_DEF_FFC, ID_STATUS_FREECHAT },
+ { IDC_MESSAGEDLG_DEF_INV, ID_STATUS_INVISIBLE },
};
static struct {
@@ -650,10 +649,10 @@ static struct { wchar_t* Text;
}
Dlg4Buttons[] = {
- IDC_MESSAGEDLG_NEWMSG, ILI_NEWMESSAGE, LPGENW("Create new message"),
- IDC_MESSAGEDLG_NEWCAT, ILI_NEWCATEGORY, LPGENW("Create new category"),
- IDC_MESSAGEDLG_DEL, ILI_DELETE, LPGENW("Delete"),
- IDC_MESSAGEDLG_VARS, ILI_NOICON, LPGENW("Open Variables help dialog"),
+ { IDC_MESSAGEDLG_NEWMSG, IDI_NEWMESSAGE, LPGENW("Create new message") },
+ { IDC_MESSAGEDLG_NEWCAT, IDI_NEWCATEGORY, LPGENW("Create new category") },
+ { IDC_MESSAGEDLG_DEL, IDI_DELETE, LPGENW("Delete") },
+ { IDC_MESSAGEDLG_VARS, -1, LPGENW("Open Variables help dialog") },
};
// ================================================ Contact list ================================================
@@ -879,20 +878,20 @@ INT_PTR CALLBACK ContactsOptDlg(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) {
MySetPos(hwndDlg);
HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 2);
- ImageList_AddIcon(hIml, GetIcon(IDI_DOT));
- ImageList_AddIcon(hIml, GetIcon(IDI_IGNORE));
- ImageList_AddIcon(hIml, GetIcon(IDI_SOE_ENABLED));
- ImageList_AddIcon(hIml, GetIcon(IDI_SOE_DISABLED));
- ImageList_AddIcon(hIml, GetIcon(IDI_INDEFINITE));
+ ImageList_AddIcon(hIml, g_plugin.getIcon(IDI_DOT));
+ ImageList_AddIcon(hIml, g_plugin.getIcon(IDI_IGNORE));
+ ImageList_AddIcon(hIml, g_plugin.getIcon(IDI_SOE_ENABLED));
+ ImageList_AddIcon(hIml, g_plugin.getIcon(IDI_SOE_DISABLED));
+ ImageList_AddIcon(hIml, g_plugin.getIcon(IDI_INDEFINITE));
SendMessage(hwndList, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
SendMessage(hwndDlg, UM_CONTACTSDLG_RESETLISTOPTIONS, 0, 0);
SendMessage(hwndList, CLM_SETEXTRACOLUMNS, EXTRACOLUMNSCOUNT, 0);
- SendDlgItemMessage(hwndDlg, IDC_SI_INDEFINITE, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)GetIcon(IDI_INDEFINITE));
- SendDlgItemMessage(hwndDlg, IDC_SI_SOE_ENABLED, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)GetIcon(IDI_SOE_ENABLED));
- SendDlgItemMessage(hwndDlg, IDC_SI_SOE_DISABLED, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)GetIcon(IDI_SOE_DISABLED));
- SendDlgItemMessage(hwndDlg, IDC_SI_IGNORE, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)GetIcon(IDI_IGNORE));
+ SendDlgItemMessage(hwndDlg, IDC_SI_INDEFINITE, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_INDEFINITE));
+ SendDlgItemMessage(hwndDlg, IDC_SI_SOE_ENABLED, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_SOE_ENABLED));
+ SendDlgItemMessage(hwndDlg, IDC_SI_SOE_DISABLED, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_SOE_DISABLED));
+ SendDlgItemMessage(hwndDlg, IDC_SI_IGNORE, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_IGNORE));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index e8522f9d68..cb5dbbd74e 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -50,29 +50,21 @@ bool g_fNoProcessing = false; // tells the status change proc not to do anything int g_bIsIdle = false;
VAR_PARSE_DATA VarParseData;
-IconItem iconList[] = {
- { LPGEN("Toggle Off"), "off", IDI_SOE_DISABLED },
- { LPGEN("Toggle On"), "on", IDI_SOE_ENABLED },
- { LPGEN("New message"), "new_msg", IDI_NEWMESSAGE },
- { LPGEN("New category"), "new_cat", IDI_NEWCATEGORY },
- { LPGEN("Delete"), "delete", IDI_DELETE },
- { LPGEN("Dot"), "dot", IDI_DOT },
- { LPGEN("Ignore"), "ignore", IDI_IGNORE },
- { LPGEN("Indefinite"), "indefinite", IDI_INDEFINITE },
- { LPGEN("Set status message"), "msg_icon", IDI_MSGICON },
- { LPGEN("Add"), "add", IDI_SAVEASNEW },
- { LPGEN("Save"), "save", IDI_SAVE },
- { LPGEN("Settings"), "settings", IDI_SETTINGS }
-};
-
-HICON GetIcon(int iconId, bool size)
+static IconItem iconList[] =
{
- for (size_t i = 0; i < _countof(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return IcoLib_GetIconByHandle(iconList[i].hIcolib, size);
-
- return nullptr;
-}
+ { LPGEN("Toggle Off"), "off", IDI_SOE_DISABLED },
+ { LPGEN("Toggle On"), "on", IDI_SOE_ENABLED },
+ { LPGEN("New message"), "new_msg", IDI_NEWMESSAGE },
+ { LPGEN("New category"), "new_cat", IDI_NEWCATEGORY },
+ { LPGEN("Delete"), "delete", IDI_DELETE },
+ { LPGEN("Dot"), "dot", IDI_DOT },
+ { LPGEN("Ignore"), "ignore", IDI_IGNORE },
+ { LPGEN("Indefinite"), "indefinite", IDI_INDEFINITE },
+ { LPGEN("Set status message"), "msg_icon", IDI_MSGICON },
+ { LPGEN("Add"), "add", IDI_SAVEASNEW },
+ { LPGEN("Save"), "save", IDI_SAVE },
+ { LPGEN("Settings"), "settings", IDI_SETTINGS },
+};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -367,8 +359,6 @@ static int Create_TopToolbar(WPARAM, LPARAM) static int IconsChanged(WPARAM, LPARAM)
{
- g_IconList.ReloadIcons();
-
if (g_MessagesOptPage.GetWnd())
SendMessage(g_MessagesOptPage.GetWnd(), UM_ICONSCHANGED, 0, 0);
@@ -505,7 +495,6 @@ int MirandaLoaded(WPARAM, LPARAM) LoadMsgTreeModule();
LoadCListModule();
InitUpdateMsgs();
- g_IconList.ReloadIcons();
CreateServiceFunction(MS_AWAYSYS_SETCONTACTSTATMSG, SetContactStatMsg);
CreateServiceFunction(MS_AWAYSYS_AUTOREPLY_TOGGLE, ToggleSendOnEvent);
@@ -603,10 +592,10 @@ int MirandaLoaded(WPARAM, LPARAM) tr.szService = MS_AWAYSYS_VARIABLESHANDLER;
tr.szCleanupService = MS_AWAYSYS_FREEVARMEM;
tr.memType = TR_MEM_OWNER;
- for (int i = 0; i < _countof(Variables); i++) {
- tr.flags = Variables[i].Flags | TRF_CALLSVC | TRF_TCHAR;
- tr.szTokenString.w = Variables[i].Name;
- tr.szHelpText = Variables[i].Descr;
+ for (auto &it: Variables) {
+ tr.flags = it.Flags | TRF_CALLSVC | TRF_TCHAR;
+ tr.szTokenString.w = it.Name;
+ tr.szHelpText = it.Descr;
CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
}
}
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index 1c2d519969..b99f28bf58 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -115,10 +115,11 @@ void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg) ID_STATUS_IDLE, "Idl"
};
- for (int i = 0; i < _countof(StatusDbSettings); i++) {
- if (iMode == StatusDbSettings[i].Status) {
- db_set_ws(0, "SRAway", CString(StatusDbSettings[i].Setting) + "Msg", CurMsg);
- db_set_ws(0, "SRAway", CString(StatusDbSettings[i].Setting) + "Default", CurMsg); // TODO: make it more accurate, and change not only here, but when changing status messages through UpdateMsgsTimerFunc too; and when changing messages through AutoAway() ?
+ for (auto &it: StatusDbSettings) {
+ if (iMode == it.Status) {
+ db_set_ws(0, "SRAway", CString(it.Setting) + "Msg", CurMsg);
+ db_set_ws(0, "SRAway", CString(it.Setting) + "Default", CurMsg);
+ // TODO: make it more accurate, and change not only here, but when changing status messages through UpdateMsgsTimerFunc too; and when changing messages through AutoAway() ?
break;
}
}
diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp index 791c95e108..921aec7986 100644 --- a/plugins/NewAwaySysMod/src/ContactList.cpp +++ b/plugins/NewAwaySysMod/src/ContactList.cpp @@ -51,7 +51,7 @@ void LoadCListModule() HookEvent(ME_SKIN_ICONSCHANGED, CLIconsChanged);
}
-static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CCList::ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
CCList *dat = CWndUserData(hWnd).GetCList();
switch (Msg) {
@@ -74,11 +74,10 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L {
LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam;
TREEITEMARRAY OldSelection = dat->SelectedItems;
- for (int i = 0; i < dat->SelectedItems.GetSize(); i++) {
- if (dat->SelectedItems[i] != pnmtv->itemNew.hItem) {
+ for (int i = 0; i < dat->SelectedItems.GetSize(); i++)
+ if (dat->SelectedItems[i] != pnmtv->itemNew.hItem)
TreeView_SetItemState(dat->hTreeView, dat->SelectedItems[i], 0, TVIS_SELECTED);
- }
- }
+
dat->SelectedItems.RemoveAll();
if (pnmtv->itemNew.hItem) {
dat->SelectedItems.AddElem(pnmtv->itemNew.hItem);
diff --git a/plugins/NewAwaySysMod/src/ContactList.h b/plugins/NewAwaySysMod/src/ContactList.h index e6467c282f..eb43e1c112 100644 --- a/plugins/NewAwaySysMod/src/ContactList.h +++ b/plugins/NewAwaySysMod/src/ContactList.h @@ -68,7 +68,7 @@ public: PTREEITEMARRAY GetSelection() {return &SelectedItems;}
void SetRedraw(bool bRedraw) {SendMessage(hTreeView, WM_SETREDRAW, bRedraw, 0);}
- friend LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
friend LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
friend int CALLBACK CompareItemsCallback(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp index 8917fcd961..f69f6ac055 100644 --- a/plugins/NewAwaySysMod/src/MsgTree.cpp +++ b/plugins/NewAwaySysMod/src/MsgTree.cpp @@ -63,7 +63,7 @@ static LRESULT CALLBACK EditSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA return CallWindowProc(g_OrigEditProc, hWnd, Msg, wParam, lParam);
}
-static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CMsgTree::ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
CMsgTree *dat = CWndUserData(hWnd).GetMsgTree();
switch (Msg) {
@@ -174,9 +174,9 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L TreeView_GetItemRect(lpNMCD->nmcd.hdr.hwndFrom, (HTREEITEM)lpNMCD->nmcd.dwItemSpec, &rc, true);
int iSize = GetSystemMetrics(SM_CXSMICON);
int x = rc.left - iSize - 5;
- for (int i = 0; i < _countof(SettingsList); i++) {
- if (lpNMCD->nmcd.lItemlParam == (LPARAM)dat->MsgTreePage.GetValue(SettingsList[i].DBSetting)) {
- DrawIconEx(lpNMCD->nmcd.hdc, x, rc.top, Skin_LoadProtoIcon(nullptr, SettingsList[i].Status), iSize, iSize, 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL);
+ for (auto &it: SettingsList) {
+ if (lpNMCD->nmcd.lItemlParam == (LPARAM)dat->MsgTreePage.GetValue(it.DBSetting)) {
+ DrawIconEx(lpNMCD->nmcd.hdc, x, rc.top, Skin_LoadProtoIcon(nullptr, it.Status), iSize, iSize, 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL);
x -= iSize + 1;
}
}
@@ -390,15 +390,15 @@ LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM mii.cbSize = sizeof(mii);
mii.fMask = MIIM_BITMAP | MIIM_DATA | MIIM_STATE | MIIM_CHECKMARKS;
mii.hbmpItem = HBMMENU_CALLBACK;
- for (int i = 0; i < _countof(MenuItems); i++) { // set icons
- mii.dwItemData = MenuItems[i].IconID;
- SetMenuItemInfo(hPopupMenu, MenuItems[i].ItemID, false, &mii);
+ for (auto &it: MenuItems) { // set icons
+ mii.dwItemData = it.IconID;
+ SetMenuItemInfo(hPopupMenu, it.ItemID, false, &mii);
}
mii.fMask = MIIM_STATE;
mii.fState = MFS_CHECKED;
- for (int i = 0; i < _countof(SettingsList); i++) // set checkmarks
- if (TreeCtrl->m_value[Order].ID == (int)dat->MsgTreePage.GetValue(SettingsList[i].DBSetting))
- SetMenuItemInfo(hPopupMenu, SettingsList[i].MenuItemID, false, &mii);
+ for (auto &it: SettingsList) // set checkmarks
+ if (TreeCtrl->m_value[Order].ID == (int)dat->MsgTreePage.GetValue(it.DBSetting))
+ SetMenuItemInfo(hPopupMenu, it.MenuItemID, false, &mii);
int MenuResult = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, ht.pt.x, ht.pt.y, 0, hWnd, nullptr);
switch (MenuResult) {
@@ -421,9 +421,9 @@ LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM case IDR_MSGTREEMENU_DEF_DND:
case IDR_MSGTREEMENU_DEF_FFC:
case IDR_MSGTREEMENU_DEF_INV:
- for (int i = 0; i < _countof(SettingsList); i++) {
- if (SettingsList[i].MenuItemID == MenuResult) {
- dat->SetDefMsg(SettingsList[i].Status, tvi.lParam);
+ for (auto &it: SettingsList) {
+ if (it.MenuItemID == MenuResult) {
+ dat->SetDefMsg(it.Status, tvi.lParam);
break;
}
}
@@ -468,9 +468,9 @@ CMsgTree::CMsgTree(HWND hTreeView) : MsgTreePage(g_MsgTreePage), hTreeView(hTree COptItem_TreeCtrl* TreeCtrl = (COptItem_TreeCtrl*)MsgTreePage.Find(IDV_MSGTREE);
TreeCtrl->SetDlgItemID(GetDlgCtrlID(hTreeView));
hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 2);
- ImageList_AddIcon(hImageList, GetIcon(IDI_NEWMESSAGE));
- ImageList_AddIcon(hImageList, GetIcon(IDI_NEWCATEGORY));
- ImageList_AddIcon(hImageList, GetIcon(IDI_DELETE));
+ ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_NEWMESSAGE));
+ ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_NEWCATEGORY));
+ ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_DELETE));
MsgTreePage.DBToMemToPage();
if (!g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RECENTMSGSCOUNT)) // show "Recent messages" group only when RECENTMSGSCOUNT is not set to 0.
TreeView_DeleteItem(hTreeView, TreeCtrl->RootItems[g_Messages_RecentRootID].hItem);
@@ -510,21 +510,21 @@ bool CMsgTree::SetSelection(int ID, int Flags) // set ID = -1 to unselect; retur int CMsgTree::GetDefMsg(int iMode)
{
- for (int i = 0; i < _countof(SettingsList); i++)
- if (SettingsList[i].Status == iMode)
- return (int)MsgTreePage.GetValue(SettingsList[i].DBSetting);
+ for (auto &it: SettingsList)
+ if (it.Status == iMode)
+ return (int)MsgTreePage.GetValue(it.DBSetting);
return 0;
}
void CMsgTree::SetDefMsg(int iMode, int ID)
{
- for (int i = 0; i < _countof(SettingsList); i++) {
- if (SettingsList[i].Status == iMode) {
- if ((int)MsgTreePage.GetValue(SettingsList[i].DBSetting) != ID) {
+ for (auto &it: SettingsList) {
+ if (it.Status == iMode) {
+ if ((int)MsgTreePage.GetValue(it.DBSetting) != ID) {
RECT rc;
COptItem_TreeCtrl *TreeCtrl = GetTreeCtrl();
- int OrderOld = TreeCtrl->IDToOrder((int)MsgTreePage.GetValue(SettingsList[i].DBSetting));
+ int OrderOld = TreeCtrl->IDToOrder((int)MsgTreePage.GetValue(it.DBSetting));
if (OrderOld >= 0 && TreeView_GetItemRect(hTreeView, TreeCtrl->m_value[OrderOld].hItem, &rc, false))
InvalidateRect(hTreeView, &rc, true); // refresh icons of previous default tree item
@@ -532,7 +532,7 @@ void CMsgTree::SetDefMsg(int iMode, int ID) if (OrderNew >= 0 && TreeView_GetItemRect(hTreeView, TreeCtrl->m_value[OrderNew].hItem, &rc, false))
InvalidateRect(hTreeView, &rc, true); // refresh new default item icons
- MsgTreePage.SetValue(SettingsList[i].DBSetting, ID);
+ MsgTreePage.SetValue(it.DBSetting, ID);
NMMSGTREE nm = { 0 };
if (OrderOld >= 0)
nm.ItemOld = &TreeCtrl->m_value[OrderOld];
diff --git a/plugins/NewAwaySysMod/src/MsgTree.h b/plugins/NewAwaySysMod/src/MsgTree.h index 2462880811..21537e7574 100644 --- a/plugins/NewAwaySysMod/src/MsgTree.h +++ b/plugins/NewAwaySysMod/src/MsgTree.h @@ -41,7 +41,7 @@ public: bool GetModified() {return MsgTreePage.GetModified();}
void SetModified(bool m_bModified) {MsgTreePage.SetModified(m_bModified);}
- friend LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
friend LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
private:
diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index 0e13472bf0..692b047535 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -296,22 +296,22 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) if (Message == nullptr) { // ...or we didn't succeed retrieving the last message
// get default message for this status
int DefMsgID = -1;
- static struct {
+ struct {
int DBSetting, Status;
}
- DefMsgDlgItems[] = {
- IDS_MESSAGEDLG_DEF_ONL, ID_STATUS_ONLINE,
+ static DefMsgDlgItems[] = {
+ IDS_MESSAGEDLG_DEF_ONL, ID_STATUS_ONLINE,
IDS_MESSAGEDLG_DEF_AWAY, ID_STATUS_AWAY,
- IDS_MESSAGEDLG_DEF_NA, ID_STATUS_NA,
- IDS_MESSAGEDLG_DEF_OCC, ID_STATUS_OCCUPIED,
- IDS_MESSAGEDLG_DEF_DND, ID_STATUS_DND,
- IDS_MESSAGEDLG_DEF_FFC, ID_STATUS_FREECHAT,
- IDS_MESSAGEDLG_DEF_INV, ID_STATUS_INVISIBLE,
+ IDS_MESSAGEDLG_DEF_NA, ID_STATUS_NA,
+ IDS_MESSAGEDLG_DEF_OCC, ID_STATUS_OCCUPIED,
+ IDS_MESSAGEDLG_DEF_DND, ID_STATUS_DND,
+ IDS_MESSAGEDLG_DEF_FFC, ID_STATUS_FREECHAT,
+ IDS_MESSAGEDLG_DEF_INV, ID_STATUS_INVISIBLE,
};
- for (int i = 0; i < _countof(DefMsgDlgItems); i++) {
- if (DefMsgDlgItems[i].Status == Status) {
- DefMsgID = MsgTreeData.GetDBValue(DefMsgDlgItems[i].DBSetting);
+ for (auto &it: DefMsgDlgItems) {
+ if (it.Status == Status) {
+ DefMsgID = MsgTreeData.GetDBValue(it.DBSetting);
break;
}
}
diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index 3dca12f34d..c17ce00a82 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -71,112 +71,44 @@ private: _CWndUserData *dat;
};
-#define IL_SKINICON 0x80000000
-#define IL_PROTOICON 0x40000000
-
-#define ILI_NOICON (-1)
-#define ILI_EVENT_MESSAGE 0
-#define ILI_EVENT_FILE 1
-#define ILI_PROTO_ONL 2
-#define ILI_PROTO_AWAY 3
-#define ILI_PROTO_NA 4
-#define ILI_PROTO_OCC 5
-#define ILI_PROTO_DND 6
-#define ILI_PROTO_FFC 7
-#define ILI_PROTO_INV 8
-#define ILI_DOT 11
-#define ILI_MSGICON 12
-#define ILI_IGNORE 13
-#define ILI_SOE_DISABLED 14
-#define ILI_SOE_ENABLED 15
-#define ILI_NEWMESSAGE 16
-#define ILI_NEWCATEGORY 17
-#define ILI_SAVE 18
-#define ILI_SAVEASNEW 19
-#define ILI_DELETE 20
-#define ILI_SETTINGS 21
-
-static unsigned Icons[] = {
- SKINICON_EVENT_MESSAGE | IL_SKINICON, SKINICON_EVENT_FILE | IL_SKINICON,
- ID_STATUS_ONLINE | IL_PROTOICON, ID_STATUS_AWAY | IL_PROTOICON, ID_STATUS_NA | IL_PROTOICON, ID_STATUS_OCCUPIED | IL_PROTOICON, ID_STATUS_DND | IL_PROTOICON, ID_STATUS_FREECHAT | IL_PROTOICON, ID_STATUS_INVISIBLE | IL_PROTOICON,
- IDI_DOT, IDI_MSGICON, IDI_IGNORE, IDI_SOE_ENABLED, IDI_SOE_DISABLED, IDI_NEWMESSAGE, IDI_NEWCATEGORY, IDI_SAVE, IDI_SAVEASNEW, IDI_DELETE, IDI_SETTINGS
-};
-
-
-class CIconList
-{
-public:
- ~CIconList()
- {
- for (int i = 0; i < IconList.GetSize(); i++)
- if (IconList[i])
- DestroyIcon(IconList[i]);
- }
-
- HICON& operator [] (int nIndex) {return IconList[nIndex];}
- void ReloadIcons()
- {
- int cxIcon = GetSystemMetrics(SM_CXSMICON);
- int cyIcon = GetSystemMetrics(SM_CYSMICON);
- int i;
- for (i = 0; i < _countof(Icons); i++) {
- if (IconList.GetSize() > i && IconList[i])
- DestroyIcon(IconList[i]);
-
- if (Icons[i] & IL_SKINICON)
- IconList.SetAtGrow(i) = (HICON)CopyImage(Skin_LoadIcon(Icons[i] & ~IL_SKINICON), IMAGE_ICON, cxIcon, cyIcon, LR_COPYFROMRESOURCE);
- else if (Icons[i] & IL_PROTOICON)
- IconList.SetAtGrow(i) = (HICON)CopyImage(Skin_LoadProtoIcon(nullptr, Icons[i] & ~IL_PROTOICON), IMAGE_ICON, cxIcon, cyIcon, LR_COPYFROMRESOURCE);
- else
- IconList.SetAtGrow(i) = (HICON)GetIcon(Icons[i]);
- }
- }
-
-private:
- TMyArray<HICON> IconList;
-};
-
-extern CIconList g_IconList;
-
-
class CProtoStates;
class CProtoState
{
public:
- CProtoState(const char* szProto, CProtoStates* Parent): m_szProto(szProto), m_parent(Parent), m_status(szProto, Parent), m_awaySince(szProto, Parent) {}
+ CProtoState(const char *szProto, CProtoStates *Parent) : m_szProto(szProto), m_parent(Parent), m_status(szProto, Parent), m_awaySince(szProto, Parent) {}
class CStatus
{
public:
- CStatus(const char* szProto, CProtoStates* GrandParent): m_szProto(szProto), m_grandParent(GrandParent), m_status(ID_STATUS_OFFLINE) {}
- CStatus& operator=(int Status);
- operator int() {return m_status;}
+ CStatus(const char *szProto, CProtoStates *GrandParent) : m_szProto(szProto), m_grandParent(GrandParent), m_status(ID_STATUS_OFFLINE) {}
+ CStatus &operator=(int Status);
+ operator int() { return m_status; }
friend class CProtoState;
private:
int m_status;
CString m_szProto;
- CProtoStates* m_grandParent;
+ CProtoStates *m_grandParent;
} m_status;
class CAwaySince
{
public:
- CAwaySince(const char* szProto, CProtoStates* GrandParent): m_szProto(szProto), m_grandParent(GrandParent) {Reset();}
+ CAwaySince(const char *szProto, CProtoStates *GrandParent) : m_szProto(szProto), m_grandParent(GrandParent) { Reset(); }
void Reset();
- operator LPSYSTEMTIME() {return &m_awaySince;}
+ operator LPSYSTEMTIME() { return &m_awaySince; }
friend class CProtoState;
private:
SYSTEMTIME m_awaySince;
CString m_szProto;
- CProtoStates* m_grandParent;
+ CProtoStates *m_grandParent;
} m_awaySince;
class CCurStatusMsg
{
public:
- CCurStatusMsg() {*this = nullptr;}
- CCurStatusMsg& operator=(TCString Msg)
+ CCurStatusMsg() { *this = nullptr; }
+ CCurStatusMsg &operator=(TCString Msg)
{
CurStatusMsg = Msg;
SYSTEMTIME st;
@@ -184,7 +116,7 @@ public: SystemTimeToFileTime(&st, (LPFILETIME)&LastUpdateTime); // i'm too lazy to declare FILETIME structure and then copy its data to absolutely equivalent ULARGE_INTEGER structure, so we'll just pass a pointer to the ULARGE_INTEGER directly ;-P
return *this;
}
- operator TCString() {return CurStatusMsg;}
+ operator TCString() { return CurStatusMsg; }
DWORD GetUpdateTimeDifference()
{
ULARGE_INTEGER CurTime;
@@ -201,45 +133,44 @@ public: class CTempMsg
{ // we use temporary messages to keep user-defined per-protocol messages intact, when changing messages through MS_NAS_SETSTATE, or when autoaway becomes active etc.. temporary messages are automatically resetted when protocol status changes
public:
- CTempMsg(): iIsSet(0) {}
- CTempMsg& operator=(TCString _Msg) {this->Msg = _Msg; iIsSet = true; return *this;}
+ CTempMsg() : iIsSet(0) {}
+ CTempMsg &operator=(TCString _Msg) { this->Msg = _Msg; iIsSet = true; return *this; }
operator TCString()
{
_ASSERT(iIsSet);
return Msg;
}
- void Unset() {iIsSet = false;}
- int IsSet() {return iIsSet;}
+ void Unset() { iIsSet = false; }
+ int IsSet() { return iIsSet; }
private:
int iIsSet; // as we need TempMsg to support every possible value, including NULL and "", we'll use this variable to specify whether TempMsg is set
TCString Msg;
} TempMsg;
- void SetParent(CProtoStates* _Parent)
+ void SetParent(CProtoStates *_Parent)
{
m_parent = _Parent;
m_status.m_grandParent = _Parent;
m_awaySince.m_grandParent = _Parent;
}
- CString &GetProto() {return m_szProto;}
+ CString &GetProto() { return m_szProto; }
-//NightFox: fix?
-//private:
+ //NightFox: fix?
+ //private:
public:
CString m_szProto;
CProtoStates *m_parent;
};
-
class CProtoStates // this class stores all protocols' dynamic data
{
public:
CProtoStates() {}
- CProtoStates(const CProtoStates &States) {*this = States;}
- CProtoStates& operator=(const CProtoStates& States)
+ CProtoStates(const CProtoStates &States) { *this = States; }
+ CProtoStates &operator=(const CProtoStates &States)
{
ProtoStates = States.ProtoStates;
for (int i = 0; i < ProtoStates.GetSize(); i++)
@@ -247,7 +178,7 @@ public: return *this;
}
- CProtoState& operator[](const char *szProto)
+ CProtoState &operator[](const char *szProto)
{
for (int i = 0; i < ProtoStates.GetSize(); i++)
if (ProtoStates[i].GetProto() == szProto)
@@ -266,8 +197,8 @@ public: friend class CProtoState::CAwaySince;
private:
- CProtoState& operator[](int nIndex) {return ProtoStates[nIndex];}
- int GetSize() {return ProtoStates.GetSize();}
+ CProtoState &operator[](int nIndex) { return ProtoStates[nIndex]; }
+ int GetSize() { return ProtoStates.GetSize(); }
TMyArray<CProtoState> ProtoStates;
};
@@ -308,9 +239,9 @@ public: CString ProtoStatusToDBSetting(const char *Prefix, int MoreOpt_PerStatusID = 0)
{
if (!MoreOpt_PerStatusID || g_MoreOptPage.GetDBValueCopy(MoreOpt_PerStatusID)) {
- for (int i = 0; i < _countof(StatusSettings); i++)
- if (Status == StatusSettings[i].Status)
- return szProto ? (CString(Prefix) + "_" + szProto + "_" + StatusSettings[i].Setting) : (CString(Prefix) + StatusSettings[i].Setting);
+ for (auto &it: StatusSettings)
+ if (Status == it.Status)
+ return szProto ? (CString(Prefix) + "_" + szProto + "_" + it.Setting) : (CString(Prefix) + it.Setting);
}
return szProto ? (CString(Prefix) + "_" + szProto) : CString(Prefix);
}
@@ -318,7 +249,7 @@ public: class CAutoreply
{
public:
- CAutoreply& operator=(const int m_value)
+ CAutoreply &operator=(const int m_value)
{
CString Setting(Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY);
if (g_plugin.getByte(Setting, VAL_USEDEFAULT) == m_value)
@@ -330,13 +261,13 @@ public: g_plugin.delSetting(Setting);
return *this;
}
-
+
operator int()
{
- return g_plugin.getByte(Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY,
+ return g_plugin.getByte(Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY,
Parent->szProto ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);
}
-
+
int IncludingParents() // takes into account global data also, if per-protocol setting is not defined
{
_ASSERT(Parent->szProto);
@@ -351,8 +282,8 @@ public: class CStatus
{
public:
- CStatus(int iStatus = 0, const char *szProto = nullptr): Status(iStatus), szProto(szProto) {}
- CStatus& operator=(int _Status) {this->Status = _Status; return *this;}
+ CStatus(int iStatus = 0, const char *szProto = nullptr) : Status(iStatus), szProto(szProto) {}
+ CStatus &operator=(int _Status) { this->Status = _Status; return *this; }
operator int()
{
if (!Status)
@@ -372,9 +303,9 @@ public: __inline CString StatusToDBSetting(int Status, const char *Prefix, int MoreOpt_PerStatusID = 0)
{
if (!MoreOpt_PerStatusID || g_MoreOptPage.GetDBValueCopy(MoreOpt_PerStatusID))
- for (int i = 0; i < _countof(StatusSettings); i++)
- if (Status == StatusSettings[i].Status)
- return CString(Prefix) + StatusSettings[i].Setting;
+ for (auto &it: StatusSettings)
+ if (Status == it.Status)
+ return CString(Prefix) + it.Setting;
return CString(Prefix);
}
@@ -397,7 +328,7 @@ class CContactSettings MCONTACT m_hContact;
public:
- CContactSettings(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus, _hContact), m_hContact(_hContact)
+ CContactSettings(int iStatus = 0, MCONTACT _hContact = NULL) : Status(iStatus, _hContact), m_hContact(_hContact)
{
Ignore.Parent = this;
Autoreply.Parent = this;
@@ -411,9 +342,9 @@ public: class CIgnore
{
public:
- CIgnore& operator=(const int m_value)
+ CIgnore &operator=(const int m_value)
{
- CString Setting(Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS));
+ CString Setting(Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS));
MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL;
if (m_value)
g_plugin.setByte(hContact, Setting, 1);
@@ -422,7 +353,7 @@ public: return *this;
}
- operator int()
+ operator int()
{
return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MODULENAME,
Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), 0);
@@ -436,7 +367,7 @@ public: class CAutoreply
{
public:
- CAutoreply& operator=(const int m_value)
+ CAutoreply &operator=(const int m_value)
{
CString Setting(Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS));
MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL;
@@ -449,7 +380,7 @@ public: g_plugin.delSetting(hContact, Setting);
return *this;
}
- operator int() {return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MODULENAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);}
+ operator int() { return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MODULENAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY); }
int IncludingParents(const char *szProtoOverride = nullptr) // takes into account protocol and global data also, if per-contact setting is not defined
{
_ASSERT((Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol
@@ -463,12 +394,12 @@ public: int GetNextToggleValue()
{
switch ((int)*this) {
- case VAL_USEDEFAULT: return 0; break;
- case 0: return 1; break;
- default: return Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY; break;
+ case VAL_USEDEFAULT: return 0; break;
+ case 0: return 1; break;
+ default: return Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY; break;
}
}
- int Toggle() {return *this = GetNextToggleValue();}
+ int Toggle() { return *this = GetNextToggleValue(); }
friend class CContactSettings;
private:
CContactSettings *Parent;
@@ -477,8 +408,8 @@ public: class CStatus
{
public:
- CStatus(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus), m_hContact(_hContact) {}
- CStatus& operator=(int _Status) {this->Status = _Status; return *this;}
+ CStatus(int iStatus = 0, MCONTACT _hContact = NULL) : Status(iStatus), m_hContact(_hContact) {}
+ CStatus &operator=(int _Status) { this->Status = _Status; return *this; }
operator int()
{
if (!Status) {
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 33ea5908cf..10a6260029 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -443,18 +443,20 @@ struct { }
static Buttons[] =
{
- { IDC_SAWAYMSG_SAVEMSG, ILI_SAVE, LPGENW("Save, replacing the selected message") },
- { IDC_SAWAYMSG_SAVEASNEW, ILI_SAVEASNEW, LPGENW("Save as a new message") },
- { IDC_SAWAYMSG_NEWCATEGORY, ILI_NEWCATEGORY, LPGENW("Create new category") },
- { IDC_SAWAYMSG_DELETE, ILI_DELETE, LPGENW("Delete") },
- { IDC_SAWAYMSG_VARS, ILI_NOICON, LPGENW("Open Variables help dialog") },
- { IDC_SAWAYMSG_OPTIONS, ILI_SETTINGS, LPGENW("Show settings menu") }
+ { IDC_SAWAYMSG_SAVEMSG, IDI_SAVE, LPGENW("Save, replacing the selected message") },
+ { IDC_SAWAYMSG_SAVEASNEW, IDI_SAVEASNEW, LPGENW("Save as a new message") },
+ { IDC_SAWAYMSG_NEWCATEGORY, IDI_NEWCATEGORY, LPGENW("Create new category") },
+ { IDC_SAWAYMSG_DELETE, IDI_DELETE, LPGENW("Delete") },
+ { IDC_SAWAYMSG_VARS, -1, LPGENW("Open Variables help dialog") },
+ { IDC_SAWAYMSG_OPTIONS, IDI_SETTINGS, LPGENW("Show settings menu") },
};
struct {
int m_dlgItemID;
wchar_t* Text;
-} Tooltips[] = {
+}
+static Tooltips[] =
+{
IDC_SAWAYMSG_IGNOREREQ, LPGENW("Don't send the status message to selected contact(s)"),
IDC_SAWAYMSG_SENDMSG, LPGENW("Send an autoreply to selected contact(s)"),
};
@@ -487,8 +489,8 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_MSGDATA, EM_LIMITTEXT, AWAY_MSGDATA_MAX, 0);
- SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_STATIC_IGNOREICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)GetIcon(IDI_IGNORE));
- SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_STATIC_REPLYICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)GetIcon(IDI_SOE_ENABLED));
+ SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_STATIC_IGNOREICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_IGNORE));
+ SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_STATIC_REPLYICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_SOE_ENABLED));
// init window size variables / resize the window
RECT rc;
@@ -595,9 +597,9 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA }
// init image buttons
- for (int i = 0; i < _countof(Buttons); i++) {
- HWND hButton = GetDlgItem(hwndDlg, Buttons[i].DlgItem);
- SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)TranslateW(Buttons[i].Text), BATF_UNICODE);
+ for (auto &it: Buttons) {
+ HWND hButton = GetDlgItem(hwndDlg, it.DlgItem);
+ SendMessage(hButton, BUTTONADDTOOLTIP, (WPARAM)TranslateW(it.Text), BATF_UNICODE);
SendMessage(hButton, BUTTONSETASFLATBTN, TRUE, 0);
}
@@ -606,9 +608,9 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA hWndTooltips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandleA("mir_app.mir"), nullptr);
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
- for (int i = 0; i < _countof(Tooltips); i++) {
- ti.uId = (UINT_PTR)GetDlgItem(hwndDlg, Tooltips[i].m_dlgItemID);
- ti.lpszText = TranslateW(Tooltips[i].Text);
+ for (auto &it: Tooltips) {
+ ti.uId = (UINT_PTR)GetDlgItem(hwndDlg, it.m_dlgItemID);
+ ti.lpszText = TranslateW(it.Text);
SendMessage(hWndTooltips, TTM_ADDTOOL, 0, (LPARAM)&ti);
}
SendMessage(hwndDlg, UM_ICONSCHANGED, 0, 0);
@@ -845,11 +847,11 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA {
// init contact tree
HIMAGELIST hil = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 2);
- ImageList_AddIcon(hil, GetIcon(IDI_DOT));
- ImageList_AddIcon(hil, GetIcon(IDI_IGNORE));
- ImageList_AddIcon(hil, GetIcon(IDI_MSGICON));
- ImageList_AddIcon(hil, GetIcon(IDI_SOE_ENABLED));
- ImageList_AddIcon(hil, GetIcon(IDI_SOE_DISABLED));
+ ImageList_AddIcon(hil, g_plugin.getIcon(IDI_DOT));
+ ImageList_AddIcon(hil, g_plugin.getIcon(IDI_IGNORE));
+ ImageList_AddIcon(hil, g_plugin.getIcon(IDI_MSGICON));
+ ImageList_AddIcon(hil, g_plugin.getIcon(IDI_SOE_ENABLED));
+ ImageList_AddIcon(hil, g_plugin.getIcon(IDI_SOE_DISABLED));
CList->SetExtraImageList(hil);
HTREEITEM hSelItem;
@@ -926,17 +928,15 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA return true;
case UM_SAM_SAVEDLGSETTINGS:
- {
- RECT rcRect;
- GetWindowRect(hwndDlg, &rcRect);
- g_plugin.setDword(SAM_DB_DLGPOSX, rcRect.left);
- g_plugin.setDword(SAM_DB_DLGPOSY, rcRect.top);
- g_plugin.setDword(SAM_DB_DLGSIZEX, rcRect.right - rcRect.left);
- g_plugin.setDword(SAM_DB_DLGSIZEY, rcRect.bottom - rcRect.top);
- g_plugin.setDword(SAM_DB_MSGSPLITTERPOS, g_MsgSplitterX);
- g_plugin.setDword(SAM_DB_CONTACTSPLITTERPOS, g_ContactSplitterX);
- g_SetAwayMsgPage.PageToMemToDB();
- }
+ RECT rc;
+ GetWindowRect(hwndDlg, &rc);
+ g_plugin.setDword(SAM_DB_DLGPOSX, rc.left);
+ g_plugin.setDword(SAM_DB_DLGPOSY, rc.top);
+ g_plugin.setDword(SAM_DB_DLGSIZEX, rc.right - rc.left);
+ g_plugin.setDword(SAM_DB_DLGSIZEY, rc.bottom - rc.top);
+ g_plugin.setDword(SAM_DB_MSGSPLITTERPOS, g_MsgSplitterX);
+ g_plugin.setDword(SAM_DB_CONTACTSPLITTERPOS, g_ContactSplitterX);
+ g_SetAwayMsgPage.PageToMemToDB();
break;
case UM_SAM_REPLYSETTINGCHANGED:
@@ -984,9 +984,9 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA break;
case UM_ICONSCHANGED:
- for (int i = 0; i < _countof(Buttons); i++)
- if (Buttons[i].IconIndex != ILI_NOICON)
- SendDlgItemMessage(hwndDlg, Buttons[i].DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_IconList[Buttons[i].IconIndex]);
+ for (auto &it: Buttons)
+ if (it.IconIndex != -1)
+ SendDlgItemMessage(hwndDlg, it.DlgItem, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(it.IconIndex));
variables_skin_helpbutton(hwndDlg, IDC_SAWAYMSG_VARS);
break;
@@ -1153,7 +1153,6 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case UM_SAM_SPLITTERMOVED:
switch (lParam) {
- RECT rc;
POINT pt;
int MaxSetSplitterX, MaxSplitterX;
case IDC_SAWAYMSG_MSGSPLITTER:
diff --git a/plugins/NewAwaySysMod/src/resource.h b/plugins/NewAwaySysMod/src/resource.h index 5188e5e289..7e590aab28 100644 --- a/plugins/NewAwaySysMod/src/resource.h +++ b/plugins/NewAwaySysMod/src/resource.h @@ -14,7 +14,6 @@ #define IDR_SAM_OPTIONS 122
#define IDI_DOT 123
#define IDI_IGNORE 124
-#define IDI_SAVEMSG 127
#define IDI_SAVE 127
#define IDI_SAVEASNEW 128
#define IDI_DELETE 130
diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h index f9cea15ab4..cf904867bb 100644 --- a/plugins/NewAwaySysMod/src/stdafx.h +++ b/plugins/NewAwaySysMod/src/stdafx.h @@ -332,7 +332,3 @@ static __inline int my_variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags return -1;
}
}
-
-//icons
-extern IconItem iconList[];
-HICON GetIcon(int iconId, bool size = false);
|