diff options
author | George Hazan <george.hazan@gmail.com> | 2015-07-26 13:43:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-07-26 13:43:27 +0000 |
commit | 38f9ee31afcb519f7ecba02b56737ae637de5c7a (patch) | |
tree | 98a676cd76c8897c1a12ae69a4a3c740ac5cc065 /plugins/NewAwaySysMod | |
parent | f4af257e9365602dc81a4b324b0ffeed1e0b2eef (diff) |
more warning fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@14728 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewAwaySysMod')
-rw-r--r-- | plugins/NewAwaySysMod/src/AwayOpt.cpp | 42 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/AwaySys.cpp | 32 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Client.cpp | 19 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/ContactList.cpp | 12 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 4 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/MsgTree.cpp | 22 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Notification.cpp | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Options.cpp | 116 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Options.h | 397 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Properties.cpp | 54 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Properties.h | 80 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/ReadAwayMsg.cpp | 2 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/Services.cpp | 10 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 73 | ||||
-rw-r--r-- | plugins/NewAwaySysMod/src/stdafx.h | 2 |
15 files changed, 448 insertions, 419 deletions
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index 134c494b3e..d34894cf92 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -333,13 +333,13 @@ COptPage g_MoreOptPage(MOD_NAME, NULL); void EnableMoreOptDlgControls()
{
- g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS));
- int Enabled = g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_RECENTMSGSCOUNT);
+ g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS) != 0);
+ int Enabled = g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_RECENTMSGSCOUNT) != 0;
g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSMRM, Enabled);
g_MoreOptPage.Enable(IDC_MOREOPTDLG_USELASTMSG, Enabled);
g_MoreOptPage.Enable(IDC_MOREOPTDLG_USEDEFMSG, Enabled);
- g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS));
- g_MoreOptPage.Enable(IDC_MOREOPTDLG_UPDATEMSGSPERIOD, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_UPDATEMSGS));
+ g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS) != 0);
+ g_MoreOptPage.Enable(IDC_MOREOPTDLG_UPDATEMSGSPERIOD, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_UPDATEMSGS) != 0);
InvalidateRect(GetDlgItem(g_MoreOptPage.GetWnd(), IDC_MOREOPTDLG_UPDATEMSGSPERIOD_SPIN), NULL, false); // update spin control
g_MoreOptPage.MemToPage(true);
}
@@ -454,7 +454,7 @@ COptPage g_AutoreplyOptPage(MOD_NAME, NULL); void EnableAutoreplyOptDlgControls()
{
g_AutoreplyOptPage.PageToMem();
- int Autoreply = g_AutoreplyOptPage.GetValue(IDC_REPLYDLG_ENABLEREPLY);
+ int Autoreply = g_AutoreplyOptPage.GetValue(IDC_REPLYDLG_ENABLEREPLY) != 0;
for (int i = 0; i < g_AutoreplyOptPage.Items.GetSize(); i++) {
switch (g_AutoreplyOptPage.Items[i]->GetParam()) {
@@ -944,7 +944,7 @@ __inline int ReplyIconToDBValue(int Value) static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem)
{
- int Icons[EXTRACOLUMNSCOUNT] = { 0xFF, 0xFF, 0xFF };
+ int GroupIcons[EXTRACOLUMNSCOUNT] = { 0xFF, 0xFF, 0xFF };
int FirstItemType = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
HANDLE hItem = (FirstItemType == CLCIT_GROUP) ? hFirstItem : (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
while (hItem) {
@@ -952,30 +952,31 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt if (hChildItem)
SetListGroupIcons(hwndList, hChildItem, hItem);
- for (int i = 0; i < _countof(Icons); i++) {
+ for (int i = 0; i < _countof(GroupIcons); i++) {
int Icon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
- if (Icons[i] == 0xFF)
- Icons[i] = Icon;
- else if (Icon != 0xFF && Icons[i] != Icon)
- Icons[i] = EXTRAICON_INDEFINITE;
+ if (GroupIcons[i] == 0xFF)
+ GroupIcons[i] = Icon;
+ else if (Icon != 0xFF && GroupIcons[i] != Icon)
+ GroupIcons[i] = EXTRAICON_INDEFINITE;
}
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
+
hItem = (FirstItemType == CLCIT_CONTACT) ? hFirstItem : (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for (int i = 0; i < _countof(Icons); i++) {
+ for (int i = 0; i < _countof(GroupIcons); i++) {
int Icon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
- if (Icons[i] == 0xFF)
- Icons[i] = Icon;
- else if (Icon != 0xFF && Icons[i] != Icon)
- Icons[i] = EXTRAICON_INDEFINITE;
+ if (GroupIcons[i] == 0xFF)
+ GroupIcons[i] = Icon;
+ else if (Icon != 0xFF && GroupIcons[i] != Icon)
+ GroupIcons[i] = EXTRAICON_INDEFINITE;
}
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
// set icons
- for (int i = 0; i < _countof(Icons); i++)
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, Icons[i]));
+ for (int i = 0; i < _countof(GroupIcons); i++)
+ SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, GroupIcons[i]));
}
static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage)
@@ -1065,7 +1066,6 @@ static void SetAllContactIcons(HWND hwndList, HANDLE hItemUnknown) do {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
if (hItem) {
- char *szProto = GetContactProto(hContact);
int Ignore = CContactSettings(ID_STATUS_ONLINE, hContact).Ignore;
int Reply = CContactSettings(ID_STATUS_ONLINE, hContact).Autoreply;
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS)) {
@@ -1098,7 +1098,7 @@ static LRESULT CALLBACK ContactsSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, return CallWindowProc(g_OrigContactsProc, hWnd, Msg, wParam, lParam);
}
-INT_PTR CALLBACK ContactsOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK ContactsOptDlg(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_CONTACTSDLG_LIST);
static HANDLE hItemAll, hItemUnknown;
@@ -1360,7 +1360,7 @@ void InitOptions() }
// NightFox
-int ModernOptInitialise(WPARAM wParam, LPARAM lParam)
+int ModernOptInitialise(WPARAM wParam, LPARAM)
{
static int iBoldControls[] =
{
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index b67a5b9cfe..12ce7b1df4 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -72,7 +72,7 @@ PLUGININFOEX pluginInfo = { { 0xb2dd9270, 0xce5e, 0x11df, { 0xbd, 0x3d, 0x8, 0x0, 0x20, 0xc, 0x9a, 0x66 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
g_hInstance = hinstDLL;
return TRUE;
@@ -80,7 +80,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRAWAY, MIID_LAST }; // TODO: add MIID_WHOISREADING here if there'll be any some time in future..
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -200,7 +200,7 @@ static StatusModeList[] = { int StatusChanged(WPARAM wParam, LPARAM lParam)
{
LogMessage("MS_CLIST_SETSTATUSMODE called. szProto=%s, Status=%d", lParam ? (char*)lParam : "NULL", wParam);
- g_ProtoStates[(char*)lParam].Status = wParam;
+ g_ProtoStates[(char*)lParam].m_status = wParam;
// let's check if we handle this thingy
if (g_fNoProcessing) { // we're told not to do anything
g_fNoProcessing = false; // take it off
@@ -272,7 +272,7 @@ int CSStatusChange(WPARAM wParam, LPARAM lParam) // CommonStatus plugins (Startu i + 1, ps[i]->cbSize, ps[i]->szName ? (char*)ps[i]->szName : "NULL", ps[i]->status, ps[i]->lastStatus, ps[i]->szMsg ? ps[i]->szMsg : _T("NULL"));
if (ps[i]->status != ID_STATUS_DISABLED) {
if (ps[i]->status != ID_STATUS_CURRENT)
- g_ProtoStates[ps[i]->szName].Status = (ps[i]->status == ID_STATUS_LAST) ? ps[i]->lastStatus : ps[i]->status;
+ g_ProtoStates[ps[i]->szName].m_status = (ps[i]->status == ID_STATUS_LAST) ? ps[i]->lastStatus : ps[i]->status;
CProtoSettings(ps[i]->szName).SetMsgFormat(SMF_TEMPORARY, ps[i]->szMsg ? ps[i]->szMsg : CProtoSettings(ps[i]->szName).GetMsgFormat(GMF_LASTORDEFAULT));
}
@@ -322,7 +322,7 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM) // if this contact supports sending/receiving messages
if ((Flag1 & PF1_IM) == PF1_IM) {
- int iAutoreply = CContactSettings(g_ProtoStates[szProto].Status, hContact).Autoreply;
+ int iAutoreply = CContactSettings(g_ProtoStates[szProto].m_status, hContact).Autoreply;
HANDLE hIcon;
switch (iAutoreply) {
case VAL_USEDEFAULT: hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT)); break;
@@ -373,10 +373,10 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM) INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM)
{
// used only for the global setting
- CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : NULL].Status, hContact).Autoreply.Toggle();
+ CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : NULL].m_status, hContact).Autoreply.Toggle();
if (hContact == NULL) {
- int SendOnEvent = CContactSettings(g_ProtoStates[(LPSTR)NULL].Status).Autoreply;
+ int SendOnEvent = CContactSettings(g_ProtoStates[(LPSTR)NULL].m_status).Autoreply;
if (SendOnEvent)
Menu_ModifyItem(g_hToggleSOEMenuItem, ENABLE_SOE_COMMAND, iconList[1].hIcolib);
@@ -392,25 +392,25 @@ INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM) INT_PTR srvAutoreplyOn(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = 1;
+ CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = 1;
return 0;
}
INT_PTR srvAutoreplyOff(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = 0;
+ CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = 0;
return 0;
}
INT_PTR srvAutoreplyUseDefault(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = VAL_USEDEFAULT;
+ CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = VAL_USEDEFAULT;
return 0;
}
static int Create_TopToolbar(WPARAM, LPARAM)
{
- int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
+ int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].m_status).Autoreply;
if (ServiceExists(MS_TTB_REMOVEBUTTON)) {
TTBButton ttbb = { 0 };
ttbb.name = LPGEN("Toggle autoreply on/off");;
@@ -470,15 +470,15 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) ai->flags = AIF_DONTPARSE;
TCString Result;
if (!mir_tstrcmp(ai->targv[0], VAR_AWAYSINCE_TIME)) {
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].AwaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : _T("H:mm"), Result.GetBuffer(256), 256);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].m_awaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : _T("H:mm"), Result.GetBuffer(256), 256);
Result.ReleaseBuffer();
}
else if (!mir_tstrcmp(ai->targv[0], VAR_AWAYSINCE_DATE)) {
- GetDateFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].AwaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : NULL, Result.GetBuffer(256), 256);
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].m_awaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : NULL, Result.GetBuffer(256), 256);
Result.ReleaseBuffer();
}
else if (!mir_tstrcmp(ai->targv[0], VAR_STATDESC)) {
- Result = (VarParseData.Flags & VPF_XSTATUS) ? STR_XSTATUSDESC : pcli->pfnGetStatusModeDescription(g_ProtoStates[VarParseData.szProto].Status, 0);
+ Result = (VarParseData.Flags & VPF_XSTATUS) ? STR_XSTATUSDESC : pcli->pfnGetStatusModeDescription(g_ProtoStates[VarParseData.szProto].m_status, 0);
}
else if (!mir_tstrcmp(ai->targv[0], VAR_MYNICK)) {
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_MYNICKPERPROTO) && VarParseData.szProto)
@@ -503,7 +503,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) SYSTEMTIME st;
GetLocalTime(&st);
SystemTimeToFileTime(&st, (LPFILETIME)&ul_Now);
- SystemTimeToFileTime(g_ProtoStates[VarParseData.szProto].AwaySince, (LPFILETIME)&ul_AwaySince);
+ SystemTimeToFileTime(g_ProtoStates[VarParseData.szProto].m_awaySince, (LPFILETIME)&ul_AwaySince);
ul_Now.QuadPart -= ul_AwaySince.QuadPart;
ul_Now.QuadPart /= 10000000; // now it's in seconds
Result.GetBuffer(256);
@@ -609,7 +609,7 @@ int MirandaLoaded(WPARAM, LPARAM) g_hReadWndList = WindowList_Create();
- int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
+ int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].m_status).Autoreply;
CMenuItem mi;
mi.position = 1000020000;
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index bc733d00c6..adc448b232 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -35,13 +35,13 @@ void __cdecl UpdateMsgsThreadProc(void *) Proto_EnumAccounts(&numAccs, &accs);
while (WaitForSingleObject(g_hTerminateUpdateMsgsThread, 0) == WAIT_TIMEOUT && !Miranda_Terminated()) {
- DWORD MinUpdateTimeDifference = g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGSPERIOD) * 1000; // in milliseconds
+ DWORD MinUpdateTimeDifference = (DWORD)g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGSPERIOD) * 1000; // in milliseconds
for (int i = 0; i < numAccs; i++) {
PROTOACCOUNT *p = accs[i];
if (CallProtoService(p->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND && !IsAnICQProto(p->szModuleName)) {
int Status = CallProtoService(p->szModuleName, PS_GETSTATUS, 0, 0);
if (Status < ID_STATUS_OFFLINE || Status > ID_STATUS_OUTTOLUNCH) {
- Status = g_ProtoStates[p->szModuleName].Status;
+ Status = g_ProtoStates[p->szModuleName].m_status;
}
if (CallProtoService(p->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(Status) && g_ProtoStates[p->szModuleName].CurStatusMsg.GetUpdateTimeDifference() >= MinUpdateTimeDifference) {
TCString CurMsg(GetDynamicStatMsg(INVALID_CONTACT_ID, p->szModuleName));
@@ -63,7 +63,7 @@ static void __stdcall DummyAPCFunc(ULONG_PTR) void InitUpdateMsgs()
{
- int UpdateMsgs = g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGS);
+ int UpdateMsgs = (int)g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGS);
if (g_hUpdateMsgsThread && !UpdateMsgs) {
_ASSERT(WaitForSingleObject(g_hUpdateMsgsThread, 0) == WAIT_TIMEOUT);
SetEvent(g_hTerminateUpdateMsgsThread);
@@ -79,7 +79,7 @@ void InitUpdateMsgs() }
-void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg)
+void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg)
{
TCString CurMsg(Msg);
if (szProto) {
@@ -109,7 +109,8 @@ void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg) {
int Status;
char *Setting;
- } StatusSettings[] = {
+ }
+ StatusDbSettings[] = {
ID_STATUS_OFFLINE, "Off",
ID_STATUS_ONLINE, "On",
ID_STATUS_AWAY, "Away",
@@ -123,10 +124,10 @@ void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg) ID_STATUS_IDLE, "Idl"
};
- for (int i = 0; i < _countof(StatusSettings); i++) {
- if (iMode == StatusSettings[i].Status) {
- db_set_ts(NULL, "SRAway", CString(StatusSettings[i].Setting) + "Msg", CurMsg);
- db_set_ts(NULL, "SRAway", CString(StatusSettings[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 (int i = 0; i < _countof(StatusDbSettings); i++) {
+ if (iMode == StatusDbSettings[i].Status) {
+ db_set_ts(NULL, "SRAway", CString(StatusDbSettings[i].Setting) + "Msg", CurMsg);
+ db_set_ts(NULL, "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() ?
break;
}
}
diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp index a920db8026..355b51e037 100644 --- a/plugins/NewAwaySysMod/src/ContactList.cpp +++ b/plugins/NewAwaySysMod/src/ContactList.cpp @@ -51,7 +51,6 @@ void LoadCListModule() HookEvent(ME_SKIN_ICONSCHANGED, CLIconsChanged);
}
-
static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
CCList *dat = CWndUserData(hWnd).GetCList();
@@ -151,8 +150,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L return CallWindowProc(dat->OrigParentProc, hWnd, Msg, wParam, lParam);
}
-
-static LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
TVITEM tvi;
CCList *dat = CWndUserData(GetParent(hWnd)).GetCList();
@@ -464,7 +462,7 @@ void CCList::SetInfoIcon(HTREEITEM hItem, HICON hIcon) TreeView_SetItem(hTreeView, &tvi);
}
-static int CALLBACK CompareItemsCallback(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+int CALLBACK CompareItemsCallback(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CCList *dat = (CCList*)lParamSort;
if (IsHContactInfo(dat->Items[lParam1].hContact)) // Info items precede all other items
@@ -689,13 +687,13 @@ CCLItemData& CCList::GetItemData(HTREEITEM hItem) return Items[tvi.lParam];
}
-HTREEITEM CCList::TreeView_GetLastChild(HWND hTreeView, HTREEITEM hItem)
+HTREEITEM CCList::TreeView_GetLastChild(HWND hTree, HTREEITEM hItem)
{
- HTREEITEM hPrevItem = TreeView_GetChild(hTreeView, hItem);
+ HTREEITEM hPrevItem = TreeView_GetChild(hTree, hItem);
hItem = hPrevItem;
while (hItem) { // find last sibling
hPrevItem = hItem;
- hItem = TreeView_GetNextSibling(hTreeView, hPrevItem);
+ hItem = TreeView_GetNextSibling(hTree, hPrevItem);
}
return hPrevItem;
}
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index ac2cda974b..50da664b4e 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -173,7 +173,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) return 0;
}
- unsigned int iMode = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ int iMode = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int i;
for (i = _countof(StatusModeList) - 1; i >= 0; i--)
if (iMode == StatusModeList[i].Status)
@@ -217,7 +217,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) if (IsAnICQProto(szProto))
UIN = db_get_dw(hContact, szProto, "UIN", 0);
- int SendCount = AutoreplyOptData.GetValue(IDC_REPLYDLG_SENDCOUNT);
+ int SendCount = (int)AutoreplyOptData.GetValue(IDC_REPLYDLG_SENDCOUNT);
if ((AutoreplyOptData.GetValue(IDC_REPLYDLG_DONTSENDTOICQ) && UIN) || // an icq contact
(SendCount != -1 && db_get_b(hContact, MOD_NAME, DB_SENDCOUNT, 0) >= SendCount))
return 0;
diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp index f515e7c65b..7263f8a0c6 100644 --- a/plugins/NewAwaySysMod/src/MsgTree.cpp +++ b/plugins/NewAwaySysMod/src/MsgTree.cpp @@ -175,7 +175,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L int iSize = GetSystemMetrics(SM_CXSMICON);
int x = rc.left - iSize - 5;
for (int i = 0; i < _countof(SettingsList); i++) {
- if (lpNMCD->nmcd.lItemlParam == dat->MsgTreePage.GetValue(SettingsList[i].DBSetting)) {
+ if (lpNMCD->nmcd.lItemlParam == (LPARAM)dat->MsgTreePage.GetValue(SettingsList[i].DBSetting)) {
DrawIconEx(lpNMCD->nmcd.hdc, x, rc.top, Skin_LoadProtoIcon(NULL, SettingsList[i].Status), iSize, iSize, 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL);
x -= iSize + 1;
}
@@ -256,7 +256,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L return CallWindowProc(dat->OrigParentProc, hWnd, Msg, wParam, lParam);
}
-static LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
CMsgTree *dat = CWndUserData(GetParent(hWnd)).GetMsgTree();
switch (Msg) {
@@ -390,15 +390,14 @@ static LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, mii.cbSize = sizeof(mii);
mii.fMask = MIIM_BITMAP | MIIM_DATA | MIIM_STATE | MIIM_CHECKMARKS;
mii.hbmpItem = HBMMENU_CALLBACK;
- int i;
- for (i = 0; i < _countof(MenuItems); i++) { // set icons
+ for (int i = 0; i < _countof(MenuItems); i++) { // set icons
mii.dwItemData = MenuItems[i].IconID;
SetMenuItemInfo(hPopupMenu, MenuItems[i].ItemID, false, &mii);
}
mii.fMask = MIIM_STATE;
mii.fState = MFS_CHECKED;
- for (i = 0; i < _countof(SettingsList); i++) // set checkmarks
- if (TreeCtrl->Value[Order].ID == dat->MsgTreePage.GetValue(SettingsList[i].DBSetting))
+ for (int i = 0; i < _countof(SettingsList); i++) // set checkmarks
+ if (TreeCtrl->Value[Order].ID == (int)dat->MsgTreePage.GetValue(SettingsList[i].DBSetting))
SetMenuItemInfo(hPopupMenu, SettingsList[i].MenuItemID, false, &mii);
int MenuResult = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, ht.pt.x, ht.pt.y, 0, hWnd, NULL);
@@ -515,7 +514,7 @@ int CMsgTree::GetDefMsg(int iMode) {
for (int i = 0; i < _countof(SettingsList); i++)
if (SettingsList[i].Status == iMode)
- return MsgTreePage.GetValue(SettingsList[i].DBSetting);
+ return (int)MsgTreePage.GetValue(SettingsList[i].DBSetting);
return 0;
}
@@ -524,10 +523,10 @@ void CMsgTree::SetDefMsg(int iMode, int ID) {
for (int i = 0; i < _countof(SettingsList); i++) {
if (SettingsList[i].Status == iMode) {
- if (MsgTreePage.GetValue(SettingsList[i].DBSetting) != ID) {
+ if ((int)MsgTreePage.GetValue(SettingsList[i].DBSetting) != ID) {
RECT rc;
COptItem_TreeCtrl *TreeCtrl = GetTreeCtrl();
- int OrderOld = TreeCtrl->IDToOrder(MsgTreePage.GetValue(SettingsList[i].DBSetting));
+ int OrderOld = TreeCtrl->IDToOrder((int)MsgTreePage.GetValue(SettingsList[i].DBSetting));
if (OrderOld >= 0 && TreeView_GetItemRect(hTreeView, TreeCtrl->Value[OrderOld].hItem, &rc, false))
InvalidateRect(hTreeView, &rc, true); // refresh icons of previous default tree item
@@ -652,10 +651,10 @@ CTreeItem* CMsgTree::AddMessage() return TreeItem;
}
-CBaseTreeItem* CMsgTree::GetNextItem(int Flags, CBaseTreeItem* Item) // Item is 'int ID' if MTGN_BYID flag is set; returns CBaseTreeItem* or NULL
+CBaseTreeItem* CMsgTree::GetNextItem(int Flags, CBaseTreeItem *Item) // Item is 'int ID' if MTGN_BYID flag is set; returns CBaseTreeItem* or NULL
{
COptItem_TreeCtrl *TreeCtrl = GetTreeCtrl();
- CBaseTreeItem* TreeItem = Item;
+ CBaseTreeItem *TreeItem = Item;
if (Flags & MTGN_BYID) {
int Order = TreeCtrl->IDToOrder((int)Item);
_ASSERT(Order != -1);
@@ -671,6 +670,7 @@ CBaseTreeItem* CMsgTree::GetNextItem(int Flags, CBaseTreeItem* Item) // Item is case MTGN_PREV: TVFlag = TVGN_PREVIOUS; break;
default: _ASSERT(0);
}
+
int Order = TreeCtrl->hItemToOrder(TreeView_GetNextItem(hTreeView, TreeItem ? TreeItem->hItem : NULL, TVFlag));
if (Order == -1)
return NULL;
diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp index a26b823b27..2d004aa625 100644 --- a/plugins/NewAwaySysMod/src/Notification.cpp +++ b/plugins/NewAwaySysMod/src/Notification.cpp @@ -66,7 +66,7 @@ static VOID CALLBACK ShowContactMenu(MCONTACT hContact) void ShowLog(TCString &LogFilePath)
{
- int Result = (int)ShellExecute(NULL, _T("open"), LogFilePath, NULL, NULL, SW_SHOW);
+ INT_PTR Result = (INT_PTR)ShellExecute(NULL, _T("open"), LogFilePath, NULL, NULL, SW_SHOW);
if (Result <= 32) {
TCHAR szError[64];
mir_sntprintf(szError, _countof(szError), TranslateT("Error #%d"), Result);
diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp index cce59a1601..3bdb0d2660 100644 --- a/plugins/NewAwaySysMod/src/Options.cpp +++ b/plugins/NewAwaySysMod/src/Options.cpp @@ -114,20 +114,20 @@ COptPage& COptPage::operator = (const COptPage& Page) }
-int COptItem::GetIntDBVal(CString &sModule, int bSigned, CString *sDBSettingPrefix)
+int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*)
{ // default procedure for reading value from DB; used only for integral types
if (sDBSetting != NULL) {
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
DBVARIANT dbv;
if (db_get(NULL, sModule, sDBSetting, &dbv))
- return GetDefValue();
+ return (int)GetDefValue();
return (nValueSize == DBVT_BYTE) ? (bSigned ? (signed char)dbv.bVal : (unsigned char)dbv.bVal) : ((nValueSize == DBVT_WORD) ? (bSigned ? (signed short)dbv.wVal : (unsigned short)dbv.wVal) : dbv.dVal);
}
- return GetDefValue();
+ return (int)GetDefValue();
}
-void COptItem::SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefix)
+void COptItem::SetIntDBVal(const CString &sModule, int Value, CString*)
{ // default procedure for writing value to the DB; used only for integral types
if (sDBSetting != NULL && !ReadOnly) {
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
@@ -139,7 +139,7 @@ void COptItem::SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefi }
}
-TCString COptItem::GetStrDBVal(CString &sModule, CString *sDBSettingPrefix)
+TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix)
{
if (sDBSetting != NULL) {
_ASSERT(GetDefValue());
@@ -148,14 +148,14 @@ TCString COptItem::GetStrDBVal(CString &sModule, CString *sDBSettingPrefix) return *(TCString*)GetDefValue();
}
-void COptItem::SetStrDBVal(CString &sModule, TCString &Str, CString *sDBSettingPrefix)
+void COptItem::SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix)
{
if (sDBSetting != NULL && !ReadOnly) {
db_set_ts(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
}
}
-void COptItem_Checkbox::DBToMem(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_Checkbox::DBToMem(const CString &sModule, CString *sDBSettingPrefix)
{
if (ValueMask)
Value = (GetIntDBVal(sModule, false, sDBSettingPrefix) & ValueMask) ? BST_CHECKED : BST_UNCHECKED;
@@ -165,7 +165,7 @@ void COptItem_Checkbox::DBToMem(CString &sModule, CString *sDBSettingPrefix) COptItem::DBToMem(sModule, sDBSettingPrefix);
}
-void COptItem_Checkbox::MemToDB(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_Checkbox::MemToDB(const CString &sModule, CString *sDBSettingPrefix)
{
if (ValueMask) {
if (Value == BST_CHECKED)
@@ -192,7 +192,7 @@ void COptItem_Checkbox::MemToWnd(HWND hWnd) COptItem::MemToWnd(hWnd);
}
-void COptItem_BitDBSetting::DBToMem(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_BitDBSetting::DBToMem(const CString &sModule, CString *sDBSettingPrefix)
{
if (ValueMask)
Value = (GetIntDBVal(sModule, false, sDBSettingPrefix) & ValueMask) != 0;
@@ -202,7 +202,7 @@ void COptItem_BitDBSetting::DBToMem(CString &sModule, CString *sDBSettingPrefix) COptItem::DBToMem(sModule, sDBSettingPrefix);
}
-void COptItem_BitDBSetting::MemToDB(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_BitDBSetting::MemToDB(const CString &sModule, CString *sDBSettingPrefix)
{
if (ValueMask) {
if (Value)
@@ -253,51 +253,55 @@ int COptItem_TreeCtrl::GenerateID() return ID;
}
-typedef struct
+struct sTreeReadEnumData
{
+ sTreeReadEnumData(COptItem_TreeCtrl *_p1, const CString &_p2, const CString &_p3) :
+ TreeCtrl(_p1),
+ sModule(_p2),
+ sDBSettingPrefix(_p3)
+ {}
+
COptItem_TreeCtrl *TreeCtrl;
- CString *sModule;
- CString *sDBSettingPrefix;
-} sTreeReadEnumData;
+ const CString &sModule, &sDBSettingPrefix;
+};
int TreeReadEnum(const char *szSetting, LPARAM lParam)
{
- sTreeReadEnumData *TreeReadEnumData = (sTreeReadEnumData*)lParam;
- int Len = TreeReadEnumData->TreeCtrl->sDBSetting.GetLen() + _countof(TREEITEM_DBSTR_TITLE) - 1;
- if (!strncmp(szSetting, TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_TITLE, Len) && isdigit(szSetting[Len])) {
+ sTreeReadEnumData *pData = (sTreeReadEnumData*)lParam;
+ int Len = pData->TreeCtrl->sDBSetting.GetLen() + _countof(TREEITEM_DBSTR_TITLE) - 1;
+ if (!strncmp(szSetting, pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_TITLE, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
- short ParentID = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(NULL, *TreeReadEnumData->sModule,
- *TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_PARENT + (szSetting + Len), -1);
- short Order = db_get_w(NULL, *TreeReadEnumData->sModule,
- *TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_ORDER + (szSetting + Len), -1);
- char Flags = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(NULL, *TreeReadEnumData->sModule,
- *TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_FLAGS + (szSetting + Len), 0);
+ short ParentID = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(NULL, pData->sModule,
+ pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_PARENT + (szSetting + Len), -1);
+ short Order = db_get_w(NULL, pData->sModule,
+ pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_ORDER + (szSetting + Len), -1);
+ char Flags = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(NULL, pData->sModule,
+ pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_FLAGS + (szSetting + Len), 0);
if (ParentID >= 0 && Order >= 0) {
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).ID = ID;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).ParentID = ParentID;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).Flags = Flags;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).hItem = NULL;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).Title = db_get_s(NULL, *TreeReadEnumData->sModule, *TreeReadEnumData->sDBSettingPrefix + szSetting, _T(""));
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).User_Str1 = (TreeReadEnumData->TreeCtrl->User_Str1_DBName == NULL) ? NULL :
- db_get_s(NULL, *TreeReadEnumData->sModule,
- *TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TreeReadEnumData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (TCHAR*)NULL);
+ CTreeItem &pItem = pData->TreeCtrl->Value.SetAtGrow(Order);
+ pItem.ID = ID;
+ pItem.ParentID = ParentID;
+ pItem.Flags = Flags;
+ pItem.hItem = NULL;
+ pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, _T(""));
+ pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == NULL) ? NULL :
+ db_get_s(NULL, pData->sModule,
+ *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (TCHAR*)NULL);
}
}
return 0;
}
-void COptItem_TreeCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_TreeCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefix)
{
if (!sDBSettingPrefix)
sDBSettingPrefix = &sEmptyString;
Value.RemoveAll();
- sTreeReadEnumData TreeReadEnumData;
- TreeReadEnumData.TreeCtrl = this;
- TreeReadEnumData.sModule = &sModule;
- TreeReadEnumData.sDBSettingPrefix = sDBSettingPrefix;
+ sTreeReadEnumData pData(this, sModule, *sDBSettingPrefix);
+
DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&TreeReadEnumData;
+ dbEnum.lParam = (LPARAM)&pData;
dbEnum.ofsSettings = 0;
dbEnum.pfnEnumProc = TreeReadEnum;
dbEnum.szModule = sModule;
@@ -316,7 +320,7 @@ void COptItem_TreeCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix) COptItem::DBToMem(sModule, sDBSettingPrefix);
}
-void COptItem_TreeCtrl::MemToDB(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_TreeCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefix)
{
if (!ReadOnly && Modified) {
if (!sDBSettingPrefix)
@@ -469,7 +473,7 @@ int TreeDeleteEnum(const char *szSetting, LPARAM lParam) return 0;
}
-void COptItem_TreeCtrl::CleanDBSettings(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_TreeCtrl::CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix)
{
if (!sDBSettingPrefix)
sDBSettingPrefix = &sEmptyString;
@@ -638,36 +642,38 @@ void COptItem_TreeCtrl::MoveItem(HWND hWnd, HTREEITEM hItem, HTREEITEM hMoveTo) // ================================================ COptItem_ListCtrl ================================================
-typedef struct
+struct sListReadEnumData
{
+ sListReadEnumData(COptItem_ListCtrl *p1, const CString &p2, const CString &p3) :
+ ListCtrl(p1),
+ sModule(p2),
+ sDBSettingPrefix(p3)
+ {}
+
COptItem_ListCtrl *ListCtrl;
- CString *sModule;
- CString *sDBSettingPrefix;
-} sListReadEnumData;
+ const CString &sModule, &sDBSettingPrefix;
+};
int ListReadEnum(const char *szSetting, LPARAM lParam)
{
- sListReadEnumData *ListReadEnumData = (sListReadEnumData*)lParam;
- int Len = ListReadEnumData->sDBSettingPrefix->GetLen() + ListReadEnumData->ListCtrl->sDBSetting.GetLen() + _countof(LISTITEM_DBSTR_TEXT) - 1;
- if (!strncmp(szSetting, *ListReadEnumData->sDBSettingPrefix + ListReadEnumData->ListCtrl->sDBSetting + LISTITEM_DBSTR_TEXT, Len) && isdigit(szSetting[Len])) {
+ sListReadEnumData *pData = (sListReadEnumData*)lParam;
+ int Len = pData->sDBSettingPrefix.GetLen() + pData->ListCtrl->sDBSetting.GetLen() + _countof(LISTITEM_DBSTR_TEXT) - 1;
+ if (!strncmp(szSetting, pData->sDBSettingPrefix + pData->ListCtrl->sDBSetting + LISTITEM_DBSTR_TEXT, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
- ListReadEnumData->ListCtrl->Value.SetAtGrow(ID).Text = db_get_s(NULL, *ListReadEnumData->sModule, *ListReadEnumData->sDBSettingPrefix + szSetting, _T(""));
+ pData->ListCtrl->Value.SetAtGrow(ID).Text = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, _T(""));
}
return 0;
}
-void COptItem_ListCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_ListCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefix)
{
if (!sDBSettingPrefix)
sDBSettingPrefix = &sEmptyString;
Value.RemoveAll();
- sListReadEnumData ListReadEnumData;
- ListReadEnumData.ListCtrl = this;
- ListReadEnumData.sModule = &sModule;
- ListReadEnumData.sDBSettingPrefix = sDBSettingPrefix;
+ sListReadEnumData pData(this, sModule, *sDBSettingPrefix);
DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&ListReadEnumData;
+ dbEnum.lParam = (LPARAM)&pData;
dbEnum.ofsSettings = 0;
dbEnum.pfnEnumProc = ListReadEnum;
dbEnum.szModule = sModule;
@@ -685,7 +691,7 @@ void COptItem_ListCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix) COptItem::DBToMem(sModule, sDBSettingPrefix);
}
-void COptItem_ListCtrl::MemToDB(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_ListCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefix)
{
if (!ReadOnly && Modified) {
if (!sDBSettingPrefix)
@@ -738,7 +744,7 @@ int ListDeleteEnum(const char *szSetting, LPARAM lParam) return 0;
}
-void COptItem_ListCtrl::CleanDBSettings(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_ListCtrl::CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix)
{
if (!sDBSettingPrefix)
sDBSettingPrefix = &sEmptyString;
diff --git a/plugins/NewAwaySysMod/src/Options.h b/plugins/NewAwaySysMod/src/Options.h index 8560b5d705..1e547356cb 100644 --- a/plugins/NewAwaySysMod/src/Options.h +++ b/plugins/NewAwaySysMod/src/Options.h @@ -26,48 +26,50 @@ class COptItem {
public:
COptItem() {}
- COptItem(int DlgItemID, char *szDBSetting, int nValueSize, int lParam = 0, bool ReadOnly = false):
- DlgItemID(DlgItemID), nValueSize(nValueSize), sDBSetting(szDBSetting), lParam(lParam), Enabled(true), ReadOnly(ReadOnly), Modified(false) {}
-/* COptItem(const COptItem &Item): DlgItemID(Item.DlgItemID), nValueSize(Item.nValueSize),
- sDBSetting(Item.szDBSetting), lParam(Item.lParam), Enabled(Item.Enabled) {};*/
+ COptItem(int DlgItemID, char *szDBSetting, int nValueSize, int lParam = 0, bool ReadOnly = false) :
+ DlgItemID(DlgItemID), nValueSize(nValueSize), sDBSetting(szDBSetting), lParam(lParam), Enabled(true), ReadOnly(ReadOnly), Modified(false)
+ {
+ }
+
virtual ~COptItem() {}
- virtual void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Modified = false;}
- virtual void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {Modified = false;}
- virtual void WndToMem(HWND hWnd) {}
- virtual void MemToWnd(HWND hWnd) {EnableWindow(GetDlgItem(hWnd, DlgItemID), Enabled);}
- void DBToMemToWnd(CString &sModule, HWND hWnd, CString *sDBSettingPrefix = NULL) {DBToMem(sModule, sDBSettingPrefix); MemToWnd(hWnd);}
- void WndToMemToDB(HWND hWnd, CString &sModule, CString *sDBSettingPrefix = NULL) {WndToMem(hWnd); MemToDB(sModule, sDBSettingPrefix);}
- virtual void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL) {db_unset(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting);}; // TODO: also set Value to DefValue?
-
- virtual void SetValue(int Value) {Modified = true;}
- virtual void SetDefValue(int DefValue) {}
- virtual int GetValue() {return 0;}
- virtual int GetDefValue() {return 0;}
- int GetDBValue(CString &sModule, CString *sDBSettingPrefix = NULL) {DBToMem(sModule, sDBSettingPrefix); return GetValue();}
- void SetDBValue(CString &sModule, int Value, CString *sDBSettingPrefix = NULL) {SetValue(Value); MemToDB(sModule, sDBSettingPrefix);}
- int GetDBValueCopy(CString &sModule, CString *sDBSettingPrefix = NULL) {COptItem* Item = Copy(); Item->DBToMem(sModule, sDBSettingPrefix); int Value = Item->GetValue(); delete Item; return Value;} // retrieves DB value, but doesn't affect current page/item state; beware! it doesn't work with string values / other dynamic pointers
- void SetDBValueCopy(CString &sModule, int Value, CString *sDBSettingPrefix = NULL) {COptItem* Item = Copy(); Item->SetValue(Value); Item->MemToDB(sModule, sDBSettingPrefix); delete Item;}
- int GetWndValue(HWND hWnd) {WndToMem(hWnd); return GetValue();}
- void SetWndValue(HWND hWnd, int Value) {SetValue(Value); MemToWnd(hWnd);}
- void SetDlgItemID(int DlgItemID) {this->DlgItemID = DlgItemID;}
- bool GetModified() {return Modified;}
- void SetModified(bool Modified) {this->Modified = Modified;}
-
- void Enable(int Enabled) {this->Enabled = Enabled;}
- int GetParam() {return lParam;}
- int GetID() {return DlgItemID;}
-
-// virtual COptItem& operator = (const COptItem& Item) {return *this;};
- virtual COptItem* Copy() {_ASSERT(0); return NULL;} // Attention! Free Copy() result when it's not needed anymore!
+ virtual void DBToMem(const CString&, CString* = NULL) { Modified = false; }
+ virtual void MemToDB(const CString&, CString* = NULL) { Modified = false; }
+ virtual void WndToMem(HWND) {}
+ virtual void MemToWnd(HWND hWnd) { EnableWindow(GetDlgItem(hWnd, DlgItemID), Enabled); }
+ void DBToMemToWnd(const CString &sModule, HWND hWnd, CString *sDBSettingPrefix = NULL) { DBToMem(sModule, sDBSettingPrefix); MemToWnd(hWnd); }
+ void WndToMemToDB(HWND hWnd, const CString &sModule, CString *sDBSettingPrefix = NULL) { WndToMem(hWnd); MemToDB(sModule, sDBSettingPrefix); }
+ virtual void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL) { db_unset(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting); }; // TODO: also set Value to DefValue?
+
+ virtual void SetValue(int) { Modified = true; }
+ virtual void SetDefValue(int) {}
+ virtual int GetValue() { return 0; }
+ virtual int GetDefValue() { return 0; }
+
+ int GetDBValue(const CString &sModule, CString *sDBSettingPrefix = NULL) { DBToMem(sModule, sDBSettingPrefix); return GetValue(); }
+ void SetDBValue(const CString &sModule, int Value, CString *sDBSettingPrefix = NULL) { SetValue(Value); MemToDB(sModule, sDBSettingPrefix); }
+ int GetDBValueCopy(const CString &sModule, CString *sDBSettingPrefix = NULL) { COptItem* Item = Copy(); Item->DBToMem(sModule, sDBSettingPrefix); int Value = Item->GetValue(); delete Item; return Value; } // retrieves DB value, but doesn't affect current page/item state; beware! it doesn't work with string values / other dynamic pointers
+ void SetDBValueCopy(const CString &sModule, int Value, CString *sDBSettingPrefix = NULL) { COptItem* Item = Copy(); Item->SetValue(Value); Item->MemToDB(sModule, sDBSettingPrefix); delete Item; }
+ int GetWndValue(HWND hWnd) { WndToMem(hWnd); return GetValue(); }
+ void SetWndValue(HWND hWnd, int Value) { SetValue(Value); MemToWnd(hWnd); }
+ void SetDlgItemID(int _DlgItemID) { this->DlgItemID = _DlgItemID; }
+ bool GetModified() { return Modified; }
+ void SetModified(bool _Modified) { this->Modified = _Modified; }
+
+ void Enable(int _Enabled) { this->Enabled = _Enabled; }
+ int GetParam() { return lParam; }
+ int GetID() { return DlgItemID; }
+
+ // virtual COptItem& operator = (const COptItem& Item) {return *this;};
+ virtual COptItem* Copy() { _ASSERT(0); return NULL; } // Attention! Free Copy() result when it's not needed anymore!
CString sDBSetting;
protected:
- int GetIntDBVal(CString &sModule, int bSigned = false, CString *sDBSettingPrefix = NULL);
- void SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefix = NULL);
- TCString GetStrDBVal(CString &sModule, CString *sDBSettingPrefix = NULL);
- void SetStrDBVal(CString &sModule, TCString &Str, CString *sDBSettingPrefix = NULL);
+ int GetIntDBVal(const CString &sModule, int bSigned = false, CString *sDBSettingPrefix = NULL);
+ void SetIntDBVal(const CString &sModule, int Value, CString *sDBSettingPrefix = NULL);
+ TCString GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix = NULL);
int DlgItemID;
int Enabled;
@@ -77,33 +79,34 @@ protected: int lParam;
};
-
class COptItem_Generic : public COptItem
{
public:
COptItem_Generic() {}
- COptItem_Generic(int DlgItemID, int lParam = 0): COptItem(DlgItemID, NULL, 0, lParam) {}
- virtual COptItem* Copy() {return new COptItem_Generic(*this);}
+ COptItem_Generic(int DlgItemID, int lParam = 0) : COptItem(DlgItemID, NULL, 0, lParam) {}
+ virtual COptItem* Copy() { return new COptItem_Generic(*this); }
};
-
class COptItem_Edit : public COptItem
{
public:
COptItem_Edit() {}
- COptItem_Edit(int DlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nMaxLen, lParam, ReadOnly), sDefValue(szDefValue) {}
-// COptItem_Edit(const COptItem_Edit &Item): sDefValue(Item.sDefValue), sValue(Item.sValue) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {GetDlgItemText(hWnd, DlgItemID, sValue.GetBuffer(nValueSize), nValueSize); sValue.ReleaseBuffer(); COptItem::MemToWnd(hWnd);}
- void MemToWnd(HWND hWnd) {SetDlgItemText(hWnd, DlgItemID, sValue); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {sValue = *(TCString*)Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {sDefValue = *(TCString*)DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return (int)&sValue;}
- int GetDefValue() {return (int)&sDefValue;}
-
-// COptItem_Edit& operator = (const COptItem_Edit& Item) {return *this;};
- virtual COptItem* Copy() {return new COptItem_Edit(*this);}
+ COptItem_Edit(int DlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nMaxLen, lParam, ReadOnly), sDefValue(szDefValue)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { GetDlgItemText(hWnd, DlgItemID, sValue.GetBuffer(nValueSize), nValueSize); sValue.ReleaseBuffer(); COptItem::MemToWnd(hWnd); }
+ void MemToWnd(HWND hWnd) { SetDlgItemText(hWnd, DlgItemID, sValue); COptItem::MemToWnd(hWnd); }
+ void SetValue(int Value) { sValue = *(TCString*)Value; COptItem::SetValue(Value); }
+ void SetDefValue(int DefValue) { sDefValue = *(TCString*)DefValue; COptItem::SetDefValue(DefValue); }
+
+ virtual int GetValue() { return 1; }
+ virtual int GetDefValue() { return 1; }
+
+ // COptItem_Edit& operator = (const COptItem_Edit& Item) {return *this;};
+ virtual COptItem* Copy() { return new COptItem_Edit(*this); }
TCString sDefValue;
TCString sValue;
@@ -114,16 +117,20 @@ class COptItem_IntEdit : public COptItem {
public:
COptItem_IntEdit() {}
- COptItem_IntEdit(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int bSigned = true, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), bSigned(bSigned) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = GetDlgItemInt(hWnd, DlgItemID, NULL, bSigned); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {SetDlgItemInt(hWnd, DlgItemID, Value, bSigned); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_IntEdit(*this);}
+ COptItem_IntEdit(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int bSigned = true, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), bSigned(bSigned)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = GetDlgItemInt(hWnd, DlgItemID, NULL, bSigned); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { SetDlgItemInt(hWnd, DlgItemID, Value, bSigned); COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_IntEdit(*this); }
int DefValue;
int Value;
@@ -135,82 +142,89 @@ class COptItem_Checkbox : public COptItem {
public:
COptItem_Checkbox() {}
- COptItem_Checkbox(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int ValueMask = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask) {}
+ COptItem_Checkbox(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int ValueMask = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask)
+ {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL);
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL);
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL);
void WndToMem(HWND hWnd);
void MemToWnd(HWND hWnd);
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Checkbox(*this);}
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Checkbox(*this); }
int Value;
int DefValue;
int ValueMask;
};
-
class COptItem_Radiobutton : public COptItem
{
public:
COptItem_Radiobutton() {}
- COptItem_Radiobutton(int DlgItemID, char *szDBSetting, int nValueSize, int DefValue, int ValueMask, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask) {}
+ COptItem_Radiobutton(int DlgItemID, char *szDBSetting, int nValueSize, int DefValue, int ValueMask, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask)
+ {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = (GetIntDBVal(sModule, false, sDBSettingPrefix) == ValueMask) ? BST_CHECKED : BST_UNCHECKED; COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {if ((Value == BST_CHECKED)) SetIntDBVal(sModule, ValueMask, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = IsDlgButtonChecked(hWnd, DlgItemID); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {CheckDlgButton(hWnd, DlgItemID, Value ? BST_CHECKED : BST_UNCHECKED); COptItem::MemToWnd(hWnd);}
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = (GetIntDBVal(sModule, false, sDBSettingPrefix) == ValueMask) ? BST_CHECKED : BST_UNCHECKED; COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { if ((Value == BST_CHECKED)) SetIntDBVal(sModule, ValueMask, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = IsDlgButtonChecked(hWnd, DlgItemID); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { CheckDlgButton(hWnd, DlgItemID, Value ? BST_CHECKED : BST_UNCHECKED); COptItem::MemToWnd(hWnd); }
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Radiobutton(*this);}
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Radiobutton(*this); }
int Value;
int DefValue;
int ValueMask;
};
-
class COptItem_Combobox : public COptItem
{
public:
COptItem_Combobox() {}
- COptItem_Combobox(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = SendDlgItemMessage(hWnd, DlgItemID, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hWnd, DlgItemID, CB_GETCURSEL, 0, 0), 0); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {SendDlgItemMessage(hWnd, DlgItemID, CB_SETCURSEL, Value, 0); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Combobox(*this);}
+ COptItem_Combobox(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = SendDlgItemMessage(hWnd, DlgItemID, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hWnd, DlgItemID, CB_GETCURSEL, 0, 0), 0); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, DlgItemID, CB_SETCURSEL, Value, 0); COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Combobox(*this); }
int DefValue;
int Value;
};
-
class COptItem_Colourpicker : public COptItem
{
public:
COptItem_Colourpicker() {}
- COptItem_Colourpicker(int DlgItemID, char *szDBSetting, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue), Value(0) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = SendDlgItemMessage(hWnd, DlgItemID, CPM_GETCOLOUR, 0, 0); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {SendDlgItemMessage(hWnd, DlgItemID, CPM_SETCOLOUR, 0, Value); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Colourpicker(*this);}
+ COptItem_Colourpicker(int DlgItemID, char *szDBSetting, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue), Value(0)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = SendDlgItemMessage(hWnd, DlgItemID, CPM_GETCOLOUR, 0, 0); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, DlgItemID, CPM_SETCOLOUR, 0, Value); COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Colourpicker(*this); }
DWORD DefValue;
DWORD Value;
@@ -221,16 +235,20 @@ class COptItem_Slider : public COptItem {
public:
COptItem_Slider() {}
- COptItem_Slider(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = SendDlgItemMessage(hWnd, DlgItemID, TBM_GETPOS, 0, 0); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {SendDlgItemMessage(hWnd, DlgItemID, TBM_SETPOS, true, Value); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Slider(*this);}
+ COptItem_Slider(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = SendDlgItemMessage(hWnd, DlgItemID, TBM_GETPOS, 0, 0); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, DlgItemID, TBM_SETPOS, true, Value); COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Slider(*this); }
int DefValue;
int Value;
@@ -241,16 +259,20 @@ class COptItem_IntDBSetting : public COptItem {
public:
COptItem_IntDBSetting() {}
- COptItem_IntDBSetting(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int bSigned = true, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), bSigned(bSigned) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_IntDBSetting(*this);}
+ COptItem_IntDBSetting(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int bSigned = true, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), bSigned(bSigned)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_IntDBSetting(*this); }
int Value;
int DefValue;
@@ -262,18 +284,19 @@ class COptItem_BitDBSetting : public COptItem {
public:
COptItem_BitDBSetting() {}
- COptItem_BitDBSetting(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int ValueMask = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask) {}
+ COptItem_BitDBSetting(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int ValueMask = 0, int lParam = 0, bool ReadOnly = false) : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask) {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); }
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL);
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL);
- void WndToMem(HWND hWnd) {COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {COptItem::MemToWnd(hWnd);}
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_BitDBSetting(*this);}
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_BitDBSetting(*this); }
int Value;
int DefValue;
@@ -285,16 +308,17 @@ class COptItem_StrDBSetting : public COptItem {
public:
COptItem_StrDBSetting() {}
- COptItem_StrDBSetting(int DlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nMaxLen, lParam, ReadOnly), sDefValue(szDefValue) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {sValue = *(TCString*)Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {sDefValue = *(TCString*)DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return (int)&sValue;}
- int GetDefValue() {return (int)&sDefValue;}
- virtual COptItem* Copy() {return new COptItem_StrDBSetting(*this);}
+ COptItem_StrDBSetting(int DlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool ReadOnly = false) : COptItem(DlgItemID, szDBSetting, nMaxLen, lParam, ReadOnly), sDefValue(szDefValue) {}
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { sValue = *(TCString*)_Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { sDefValue = *(TCString*)_DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return 1; }
+ virtual int GetDefValue() { return 1; }
+ virtual COptItem* Copy() { return new COptItem_StrDBSetting(*this); }
TCString sDefValue;
TCString sValue;
@@ -311,7 +335,7 @@ class CBaseTreeItem {
public:
CBaseTreeItem();
- CBaseTreeItem(TCString Title, int ID, int Flags): Title(Title), ID(ID), Flags(Flags), hItem(NULL) {}
+ CBaseTreeItem(TCString Title, int ID, int Flags) : Title(Title), ID(ID), Flags(Flags), hItem(NULL) {}
TCString Title;
int ID;
@@ -323,8 +347,10 @@ class CTreeItem : public CBaseTreeItem {
public:
CTreeItem();
- CTreeItem(TCString Title, int ParentID, int ID, int Flags = 0, TCString User_Str1 = NULL):
- CBaseTreeItem(Title, ID, Flags & ~TIF_ROOTITEM), ParentID(ParentID), User_Str1(User_Str1) {}
+ CTreeItem(TCString Title, int ParentID, int ID, int Flags = 0, TCString User_Str1 = NULL) :
+ CBaseTreeItem(Title, ID, Flags & ~TIF_ROOTITEM), ParentID(ParentID), User_Str1(User_Str1)
+ {
+ }
int ParentID;
TCString User_Str1;
@@ -334,7 +360,7 @@ class CTreeRootItem : public CBaseTreeItem {
public:
CTreeRootItem();
- CTreeRootItem(TCString Title, int ID, int Flags): CBaseTreeItem(Title, ID, Flags | TIF_ROOTITEM) {}
+ CTreeRootItem(TCString Title, int ID, int Flags) : CBaseTreeItem(Title, ID, Flags | TIF_ROOTITEM) {}
};
typedef TMyArray<CTreeItem> TreeItemArray;
@@ -359,26 +385,26 @@ class COptItem_TreeCtrl : public COptItem {
public:
COptItem_TreeCtrl() {}
- COptItem_TreeCtrl(int DlgItemID, char *szDBSetting, TreeItemArray &DefValue, TreeRootItemArray RootItems, int lParam = 0, CString User_Str1_DBName = NULL, bool ReadOnly = false, int TreeFlags = 0): COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue), RootItems(RootItems), User_Str1_DBName(User_Str1_DBName), TreeFlags(TreeFlags)
+ COptItem_TreeCtrl(int DlgItemID, char *szDBSetting, TreeItemArray &DefValue, TreeRootItemArray RootItems, int lParam = 0, CString User_Str1_DBName = NULL, bool ReadOnly = false, int TreeFlags = 0) : COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue), RootItems(RootItems), User_Str1_DBName(User_Str1_DBName), TreeFlags(TreeFlags)
{
- if (TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL)
- {
+ if (TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) {
_ASSERT(!RootItems.GetSize()); // there can't be any root items when the tree is a plain list
this->RootItems.AddElem(CTreeRootItem(_T(""), 0, TIF_EXPANDED)); // TODO??
this->RootItems[0].hItem = TVI_ROOT;
}
}
~COptItem_TreeCtrl() {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL);
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL);
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL);
void WndToMem(HWND hWnd);
void MemToWnd(HWND hWnd);
- void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL);
- void SetValue(int Value) {this->Value = *(TreeItemArray*)Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = *(TreeItemArray*)DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return (int)&Value;}
- int GetDefValue() {return (int)&DefValue;}
- virtual COptItem* Copy() {return new COptItem_TreeCtrl(*this);}
+ void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void SetValue(int _Value) { this->Value = *(TreeItemArray*)_Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = *(TreeItemArray*)_DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return 1; }
+ virtual int GetDefValue() { return 1; }
+ virtual COptItem* Copy() { return new COptItem_TreeCtrl(*this); }
int IDToOrder(int ID);
int hItemToOrder(HTREEITEM hItem);
@@ -403,7 +429,7 @@ class CListItem {
public:
CListItem();
- CListItem(TCString Text): Text(Text) {}
+ CListItem(TCString Text) : Text(Text) {}
TCString Text;
};
@@ -416,18 +442,19 @@ class COptItem_ListCtrl : public COptItem {
public:
COptItem_ListCtrl() {}
- COptItem_ListCtrl(int DlgItemID, char *szDBSetting, ListItemArray &DefValue, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue) {}
+ COptItem_ListCtrl(int DlgItemID, char *szDBSetting, ListItemArray &DefValue, int lParam = 0, bool ReadOnly = false) : COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue) {}
~COptItem_ListCtrl() {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL);
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL);
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL);
void WndToMem(HWND hWnd);
void MemToWnd(HWND hWnd);
- void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL);
- void SetValue(int Value) {this->Value = *(ListItemArray*)Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = *(ListItemArray*)DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return (int)&Value;}
- int GetDefValue() {return (int)&DefValue;}
- virtual COptItem* Copy() {return new COptItem_ListCtrl(*this);}
+ void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void SetValue(int _Value) { this->Value = *(ListItemArray*)_Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = *(ListItemArray*)_DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return 1; }
+ virtual int GetDefValue() { return 1; }
+ virtual COptItem* Copy() { return new COptItem_ListCtrl(*this); }
int GetSelectedItemID(HWND hWnd); // returns -1 if there's no selection
int SetSelectedItemID(HWND hWnd, int ID);
@@ -442,8 +469,8 @@ public: class COptPage
{
public:
- COptPage(): hWnd(NULL), sDBSettingPrefix("") {}
- COptPage(char *szModule, HWND hWnd, CString sDBSettingPrefix = ""): sModule(szModule), hWnd(hWnd), sDBSettingPrefix(sDBSettingPrefix) {}
+ COptPage() : hWnd(NULL), sDBSettingPrefix("") {}
+ COptPage(char *szModule, HWND hWnd, CString sDBSettingPrefix = "") : sModule(szModule), hWnd(hWnd), sDBSettingPrefix(sDBSettingPrefix) {}
COptPage(const COptPage &Item);
~COptPage();
@@ -451,22 +478,22 @@ public: void MemToDB();
void MemToPage(int OnlyEnable = 0);
void PageToMem();
- void DBToMemToPage() {DBToMem(); MemToPage();}
- void PageToMemToDB() {PageToMem(); MemToDB();}
+ void DBToMemToPage() { DBToMem(); MemToPage(); }
+ void PageToMemToDB() { PageToMem(); MemToDB(); }
void CleanDBSettings();
- COptItem *Find(int DlgItemID);
- int GetValue(int DlgItemID) {return Find(DlgItemID)->GetValue();}
- void SetValue(int DlgItemID, int Value) {Find(DlgItemID)->SetValue(Value);}
- int GetDBValue(int DlgItemID) {return Find(DlgItemID)->GetDBValue(sModule, &sDBSettingPrefix);}
- void SetDBValue(int DlgItemID, int Value) {Find(DlgItemID)->SetDBValue(sModule, Value, &sDBSettingPrefix);}
- int GetDBValueCopy(int DlgItemID) {return Find(DlgItemID)->GetDBValueCopy(sModule, &sDBSettingPrefix);}
- void SetDBValueCopy(int DlgItemID, int Value) {Find(DlgItemID)->SetDBValueCopy(sModule, Value, &sDBSettingPrefix);}
- int GetWndValue(int DlgItemID) {return Find(DlgItemID)->GetWndValue(hWnd);}
- void SetWndValue(int DlgItemID, int Value) {Find(DlgItemID)->SetWndValue(hWnd, Value);}
- HWND GetWnd() {return hWnd;}
- void SetWnd(HWND hWnd) {_ASSERT(!this->hWnd || !hWnd); this->hWnd = hWnd;}
- void Enable(int DlgItemID, int Enabled) {Find(DlgItemID)->Enable(Enabled);}
+ COptItem* Find(int DlgItemID);
+ int GetValue(int DlgItemID) { return Find(DlgItemID)->GetValue(); }
+ void SetValue(int DlgItemID, int Value) { Find(DlgItemID)->SetValue(Value); }
+ int GetDBValue(int DlgItemID) { return Find(DlgItemID)->GetDBValue(sModule, &sDBSettingPrefix); }
+ void SetDBValue(int DlgItemID, int Value) { Find(DlgItemID)->SetDBValue(sModule, Value, &sDBSettingPrefix); }
+ int GetDBValueCopy(int DlgItemID) { return Find(DlgItemID)->GetDBValueCopy(sModule, &sDBSettingPrefix); }
+ void SetDBValueCopy(int DlgItemID, int Value) { Find(DlgItemID)->SetDBValueCopy(sModule, Value, &sDBSettingPrefix); }
+ int GetWndValue(int DlgItemID) { return Find(DlgItemID)->GetWndValue(hWnd); }
+ void SetWndValue(int DlgItemID, int Value) { Find(DlgItemID)->SetWndValue(hWnd, Value); }
+ HWND GetWnd() { return hWnd; }
+ void SetWnd(HWND _hWnd) { _ASSERT(!this->hWnd || !_hWnd); this->hWnd = _hWnd; }
+ void Enable(int DlgItemID, int Enabled) { Find(DlgItemID)->Enable(Enabled); }
bool GetModified();
void SetModified(bool Modified);
diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index 70716fdfcb..e921a72096 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -55,26 +55,26 @@ CProtoState::CStatus& CProtoState::CStatus::operator = (int Status) return *this; // ignore status change if the new status is unknown
bool bModified = false;
- if (szProto) {
- if (this->Status != Status) {
- this->Status = Status;
- (*GrandParent)[szProto].AwaySince.Reset();
- ResetSettingsOnStatusChange(szProto, true, Status);
+ if (m_szProto) {
+ if (this->m_status != Status) {
+ this->m_status = Status;
+ (*m_grandParent)[m_szProto].m_awaySince.Reset();
+ ResetSettingsOnStatusChange(m_szProto, true, Status);
bModified = true;
}
- if ((*GrandParent)[szProto].TempMsg.IsSet()) {
- (*GrandParent)[szProto].TempMsg.Unset();
+ if ((*m_grandParent)[m_szProto].TempMsg.IsSet()) {
+ (*m_grandParent)[m_szProto].TempMsg.Unset();
bModified = true;
}
}
else { // global status change
int bStatusModified = false;
- for (int i = 0; i < GrandParent->GetSize(); i++) {
- CProtoState &State = (*GrandParent)[i];
+ for (int i = 0; i < m_grandParent->GetSize(); i++) {
+ CProtoState &State = (*m_grandParent)[i];
if (!db_get_b(NULL, State.GetProto(), "LockMainStatus", 0)) { // if the protocol isn't locked
- if (State.Status != Status) {
- State.Status.Status = Status; // "Status.Status" - changing Status directly to prevent recursive calls to the function
- State.AwaySince.Reset();
+ if (State.m_status != Status) {
+ State.m_status.m_status = Status; // "Status.Status" - changing Status directly to prevent recursive calls to the function
+ State.m_awaySince.Reset();
bModified = true;
bStatusModified = true;
}
@@ -83,24 +83,24 @@ CProtoState::CStatus& CProtoState::CStatus::operator = (int Status) bModified = true;
}
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RESETPROTOMSGS))
- CProtoSettings(State.szProto, Status).SetMsgFormat(SMF_PERSONAL, NULL);
+ CProtoSettings(State.m_szProto, Status).SetMsgFormat(SMF_PERSONAL, NULL);
}
}
if (bStatusModified)
ResetSettingsOnStatusChange(NULL, true, Status);
}
if (bModified && g_SetAwayMsgPage.GetWnd())
- SendMessage(g_SetAwayMsgPage.GetWnd(), UM_SAM_PROTOSTATUSCHANGED, (WPARAM)(char*)szProto, 0);
+ SendMessage(g_SetAwayMsgPage.GetWnd(), UM_SAM_PROTOSTATUSCHANGED, (WPARAM)(char*)m_szProto, 0);
return *this;
}
void CProtoState::CAwaySince::Reset()
{
- GetLocalTime(&AwaySince);
+ GetLocalTime(&m_awaySince);
- if (GrandParent && !szProto)
- for (int i = 0; i < GrandParent->GetSize(); i++)
- GetLocalTime((*GrandParent)[i].AwaySince);
+ if (m_grandParent && !m_szProto)
+ for (int i = 0; i < m_grandParent->GetSize(); i++)
+ GetLocalTime((*m_grandParent)[i].m_awaySince);
}
@@ -110,16 +110,16 @@ void CContactSettings::SetMsgFormat(int Flags, TCString Message) // if Message == NULL, then the function deletes the message.
CString DBSetting(StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL));
if (g_AutoreplyOptPage.GetDBValueCopy(IDC_REPLYDLG_RESETCOUNTERWHENSAMEICON) && GetMsgFormat(SMF_PERSONAL) != (const TCHAR*)Message)
- ResetContactSettingsOnStatusChange(hContact);
+ ResetContactSettingsOnStatusChange(m_hContact);
if (Message != NULL)
- db_set_ts(hContact, MOD_NAME, DBSetting, Message);
+ db_set_ts(m_hContact, MOD_NAME, DBSetting, Message);
else
- db_unset(hContact, MOD_NAME, DBSetting);
+ db_unset(m_hContact, MOD_NAME, DBSetting);
}
if (Flags & (SMF_LAST | SMF_TEMPORARY)) {
- _ASSERT(!hContact);
+ _ASSERT(!m_hContact);
CProtoSettings().SetMsgFormat(Flags & (SMF_LAST | SMF_TEMPORARY), Message);
}
}
@@ -135,16 +135,16 @@ TCString CContactSettings::GetMsgFormat(int Flags, int *pOrder, char *szProtoOve *pOrder = -1;
if (Flags & GMF_PERSONAL) // try getting personal message (it overrides global)
- Message = db_get_s(hContact, MOD_NAME, StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL), (TCHAR*)NULL);
+ Message = db_get_s(m_hContact, MOD_NAME, StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL), (TCHAR*)NULL);
if (Flags & (GMF_LASTORDEFAULT | GMF_PROTOORGLOBAL | GMF_TEMPORARY) && Message.IsEmpty()) {
- char *szProto = szProtoOverride ? szProtoOverride : (hContact ? GetContactProto(hContact) : NULL);
+ char *szProto = szProtoOverride ? szProtoOverride : (m_hContact ? GetContactProto(m_hContact) : NULL);
// we mustn't pass here by GMF_TEMPORARY flag, as otherwise we'll handle GMF_TEMPORARY | GMF_PERSONAL combination incorrectly,
// which is supposed to get only per-contact messages, and at the same time also may be used with NULL contact to get the global status message
if (Flags & (GMF_LASTORDEFAULT | GMF_PROTOORGLOBAL))
Message = CProtoSettings(szProto).GetMsgFormat(Flags, pOrder);
- else if (!hContact) { // handle global temporary message too
+ else if (!m_hContact) { // handle global temporary message too
if (g_ProtoStates[szProto].TempMsg.IsSet())
Message = g_ProtoStates[szProto].TempMsg;
}
@@ -158,7 +158,7 @@ void CProtoSettings::SetMsgFormat(int Flags, TCString Message) ResetSettingsOnStatusChange(szProto);
if (Flags & SMF_TEMPORARY) {
- _ASSERT(!Status || Status == g_ProtoStates[szProto].Status);
+ _ASSERT(!Status || Status == g_ProtoStates[szProto].m_status);
g_ProtoStates[szProto].TempMsg = (szProto || Message != NULL) ? Message : CProtoSettings(NULL, Status).GetMsgFormat(GMF_LASTORDEFAULT);
}
@@ -259,7 +259,7 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) *pOrder = -1;
if (Flags & GMF_TEMPORARY) {
- _ASSERT(!Status || Status == g_ProtoStates[szProto].Status);
+ _ASSERT(!Status || Status == g_ProtoStates[szProto].m_status);
if (g_ProtoStates[szProto].TempMsg.IsSet()) {
Message = g_ProtoStates[szProto].TempMsg;
Flags &= ~GMF_PERSONAL; // don't allow personal message to overwrite our NULL temporary message
diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index d95e328822..2f03c935a4 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -100,7 +100,7 @@ private: #define ILI_SETTINGS 22
#define ILI_STATUS_OTHER 23
-static int Icons[] = {
+static unsigned Icons[] = {
SKINICON_EVENT_MESSAGE | IL_SKINICON, SKINICON_EVENT_URL | 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, ID_STATUS_ONTHEPHONE | IL_PROTOICON, ID_STATUS_OUTTOLUNCH | 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, IDI_STATUS_OTHER
@@ -148,33 +148,33 @@ class CProtoStates; class CProtoState
{
public:
- CProtoState(const char* szProto, CProtoStates* Parent): szProto(szProto), Parent(Parent), Status(szProto, Parent), 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): szProto(szProto), GrandParent(GrandParent), Status(ID_STATUS_OFFLINE) {}
+ CStatus(const char* szProto, CProtoStates* GrandParent): m_szProto(szProto), m_grandParent(GrandParent), m_status(ID_STATUS_OFFLINE) {}
CStatus& operator = (int Status);
- operator int() {return Status;}
+ operator int() {return m_status;}
friend class CProtoState;
private:
- int Status;
- CString szProto;
- CProtoStates* GrandParent;
- } Status;
+ int m_status;
+ CString m_szProto;
+ CProtoStates* m_grandParent;
+ } m_status;
class CAwaySince
{
public:
- CAwaySince(const char* szProto, CProtoStates* GrandParent): szProto(szProto), GrandParent(GrandParent) {Reset();}
+ CAwaySince(const char* szProto, CProtoStates* GrandParent): m_szProto(szProto), m_grandParent(GrandParent) {Reset();}
void Reset();
- operator LPSYSTEMTIME() {return &AwaySince;}
+ operator LPSYSTEMTIME() {return &m_awaySince;}
friend class CProtoState;
private:
- SYSTEMTIME AwaySince;
- CString szProto;
- CProtoStates* GrandParent;
- } AwaySince;
+ SYSTEMTIME m_awaySince;
+ CString m_szProto;
+ CProtoStates* m_grandParent;
+ } m_awaySince;
class CCurStatusMsg
{
@@ -206,7 +206,7 @@ public: { // 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& operator = (TCString _Msg) {this->Msg = _Msg; iIsSet = true; return *this;}
operator TCString()
{
_ASSERT(iIsSet);
@@ -220,20 +220,20 @@ public: TCString Msg;
} TempMsg;
- void SetParent(CProtoStates* Parent)
+ void SetParent(CProtoStates* _Parent)
{
- this->Parent = Parent;
- Status.GrandParent = Parent;
- AwaySince.GrandParent = Parent;
+ m_parent = _Parent;
+ m_status.m_grandParent = _Parent;
+ m_awaySince.m_grandParent = _Parent;
}
- CString &GetProto() {return szProto;}
+ CString &GetProto() {return m_szProto;}
//NightFox: fix?
//private:
public:
- CString szProto;
- CProtoStates *Parent;
+ CString m_szProto;
+ CProtoStates *m_parent;
};
@@ -361,11 +361,11 @@ public: {
public:
CStatus(int iStatus = 0, const char *szProto = NULL): Status(iStatus), szProto(szProto) {}
- CStatus& operator = (int Status) {this->Status = Status; return *this;}
+ CStatus& operator = (int _Status) {this->Status = _Status; return *this;}
operator int()
{
if (!Status)
- Status = g_ProtoStates[szProto].Status;
+ Status = g_ProtoStates[szProto].m_status;
return Status;
}
private:
@@ -403,10 +403,10 @@ __inline CString ContactStatusToDBSetting(int Status, const char *Prefix, int Mo class CContactSettings
{
- MCONTACT hContact;
+ MCONTACT m_hContact;
public:
- CContactSettings(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus, hContact), hContact(_hContact)
+ CContactSettings(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus, _hContact), m_hContact(_hContact)
{
Ignore.Parent = this;
Autoreply.Parent = this;
@@ -414,7 +414,7 @@ public: CString ContactStatusToDBSetting(const char *Prefix, int MoreOpt_PerStatusID = 0)
{
- return ::ContactStatusToDBSetting((hContact != INVALID_CONTACT_ID) ? Status : NULL, Prefix, MoreOpt_PerStatusID, hContact);
+ return ::ContactStatusToDBSetting((m_hContact != INVALID_CONTACT_ID) ? Status : NULL, Prefix, MoreOpt_PerStatusID, m_hContact);
}
class CIgnore
@@ -423,7 +423,7 @@ public: CIgnore& operator = (const int Value)
{
CString Setting(Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS));
- MCONTACT hContact = (Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL;
+ MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL;
if (Value)
db_set_b(hContact, MOD_NAME, Setting, 1);
else
@@ -433,7 +433,7 @@ public: operator int()
{
- return db_get_b((Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL, MOD_NAME,
+ return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MOD_NAME,
Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), 0);
}
@@ -448,7 +448,7 @@ public: CAutoreply& operator = (const int Value)
{
CString Setting(Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS));
- MCONTACT hContact = (Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL;
+ MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL;
if (db_get_b(hContact, MOD_NAME, Setting, VAL_USEDEFAULT) == Value)
return *this;
@@ -458,13 +458,13 @@ public: db_unset(hContact, MOD_NAME, Setting);
return *this;
}
- operator int() {return db_get_b((Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL, MOD_NAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);}
+ operator int() {return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MOD_NAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);}
int IncludingParents(const char *szProtoOverride = NULL) // takes into account protocol and global data also, if per-contact setting is not defined
{
- _ASSERT((Parent->hContact && Parent->hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol
+ _ASSERT((Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol
int Value = *this;
if (Value == VAL_USEDEFAULT) {
- const char *szProto = (Parent->hContact && Parent->hContact != INVALID_CONTACT_ID) ? GetContactProto(Parent->hContact) : szProtoOverride;
+ const char *szProto = (Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) ? GetContactProto(Parent->m_hContact) : szProtoOverride;
return CProtoSettings(szProto).Autoreply.IncludingParents();
}
return Value;
@@ -474,7 +474,7 @@ public: switch ((int)*this) {
case VAL_USEDEFAULT: return 0; break;
case 0: return 1; break;
- default: return Parent->hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY; break;
+ default: return Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY; break;
}
}
int Toggle() {return *this = GetNextToggleValue();}
@@ -486,14 +486,14 @@ public: class CStatus
{
public:
- CStatus(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus), 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) {
- _ASSERT(hContact != INVALID_CONTACT_ID);
- char *szProto = hContact ? GetContactProto(hContact) : NULL;
- Status = (szProto || !hContact) ? g_ProtoStates[szProto].Status : ID_STATUS_AWAY;
+ _ASSERT(m_hContact != INVALID_CONTACT_ID);
+ char *szProto = m_hContact ? GetContactProto(m_hContact) : NULL;
+ Status = (szProto || !m_hContact) ? g_ProtoStates[szProto].m_status : ID_STATUS_AWAY;
}
return Status;
}
@@ -501,7 +501,7 @@ public: friend class CAutoreply;
private:
int Status;
- MCONTACT hContact;
+ MCONTACT m_hContact;
} Status;
void SetMsgFormat(int Flags, TCString Message);
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 4ea1d3d978..849633183a 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -32,7 +32,7 @@ struct READAWAYMSGDATA MWindowList g_hReadWndList = NULL;
-static int ReadAwayMsgDlgResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
+static int ReadAwayMsgDlgResize(HWND, LPARAM, UTILRESIZECONTROL *urc)
{
switch (urc->wId) {
case IDC_READAWAYMSG_MSG:
diff --git a/plugins/NewAwaySysMod/src/Services.cpp b/plugins/NewAwaySysMod/src/Services.cpp index 1d4b114528..46399f0b97 100644 --- a/plugins/NewAwaySysMod/src/Services.cpp +++ b/plugins/NewAwaySysMod/src/Services.cpp @@ -36,13 +36,13 @@ struct NAS_PROTOINFOv1 __inline void PSSetStatus(char *szProto, WORD Status, int bNoClistSetStatusMode = false) // just a helper function that sets the status and handles szProto==NULL correctly
{
- g_ProtoStates[szProto].Status = Status;
+ g_ProtoStates[szProto].m_status = Status;
if (szProto)
CallProtoService(szProto, PS_SETSTATUS, Status, 0);
else if (!bNoClistSetStatusMode) { // global status
g_fNoProcessing = true;
CallService(MS_CLIST_SETSTATUSMODE, Status, 0);
- _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].Status == Status);
+ _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].m_status == Status);
g_fNoProcessing = false;
}
}
@@ -66,7 +66,7 @@ INT_PTR SetStatusMode(WPARAM wParam, LPARAM lParam) // called by GamerStatus and g_fNoProcessing = true;
CallService(MS_CLIST_SETSTATUSMODE, wParam, 0);
- _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].Status == wParam);
+ _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].m_status == wParam);
g_fNoProcessing = false;
CProtoSettings(NULL, wParam).SetMsgFormat(SMF_TEMPORARY, lParam ? (TCHAR*)_A2T((char*)lParam) : CProtoSettings(NULL, wParam).GetMsgFormat(GMF_LASTORDEFAULT));
ChangeProtoMessages(NULL, wParam, TCString());
@@ -97,7 +97,7 @@ int GetState(WPARAM wParam, LPARAM lParam, int Widechar) else pi->szMsg = NULL;
if (!pi->status)
- pi->status = g_ProtoStates[pi->szProto].Status;
+ pi->status = g_ProtoStates[pi->szProto].m_status;
}
else pi->szMsg = NULL;
@@ -134,7 +134,7 @@ int SetState(WPARAM wParam, LPARAM lParam, int Widechar) if (pi->status)
PSSetStatus(pi->szProto, pi->status, Flags & PIF_NO_CLIST_SETSTATUSMODE);
else
- pi->status = g_ProtoStates[pi->szProto].Status;
+ pi->status = g_ProtoStates[pi->szProto].m_status;
CProtoSettings(pi->szProto).SetMsgFormat((Flags & PIF_NOTTEMPORARY) ? SMF_PERSONAL : SMF_TEMPORARY, Widechar ? pi->wszMsg : _A2T(pi->szMsg));
if (pi->szMsg || !(Flags & PIF_NO_CLIST_SETSTATUSMODE))
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 6e46c9aaa2..fdceb93f39 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -156,7 +156,7 @@ static LRESULT CALLBACK CListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LP return CallWindowProc(g_OrigCListProc, hWnd, Msg, wParam, lParam);
}
-static int SetAwayMsgDlgResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
+int SetAwayMsgDlgResize(HWND, LPARAM lParam, UTILRESIZECONTROL *urc)
{
COptPage *SetAwayMsgPage = (COptPage*)lParam;
int bShowMsgTree = SetAwayMsgPage->GetValue(IDS_SAWAYMSG_SHOWMSGTREE), X;
@@ -302,8 +302,7 @@ void SetExtraIcon(CCList *CList, int nColumn, HTREEITEM hItem, int nIcon) CList->SetExtraImage(hItem, nColumn, nIcon);
}
-
-void SetCListGroupIcons(SetAwayMsgData *dat, CCList *CList)
+void SetCListGroupIcons(CCList *CList)
{
_ASSERT(CList);
HTREEITEM hItem = CList->GetNextItem(MCLGN_LAST, NULL); // start from last item, so every item is processed before its parents
@@ -484,7 +483,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA char *szProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol;
int Status = 0;
- Status = g_ProtoStates[dat->szProtocol].Status;
+ Status = g_ProtoStates[dat->szProtocol].m_status;
HICON hTitleIcon = Skin_LoadProtoIcon(szProto, Status);
HICON hTitleIconBig = Skin_LoadProtoIcon(szProto, Status, true);
@@ -565,8 +564,8 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // init message tree
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RECENTMSGSCOUNT) && g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSMRM)) {
- char *szProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol;
- int ID = GetRecentGroupID((szProto || !dat->hInitContact) ? g_ProtoStates[szProto].Status : ID_STATUS_AWAY);
+ char *szInitProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol;
+ int ID = GetRecentGroupID((szInitProto || !dat->hInitContact) ? g_ProtoStates[szInitProto].m_status : ID_STATUS_AWAY);
CBaseTreeItem* pTreeItem = MsgTree->GetNextItem(MTGN_CHILD | MTGN_BYID, (CBaseTreeItem*)g_Messages_RecentRootID);
while (pTreeItem) {
if (pTreeItem->Flags & TIF_GROUP) {
@@ -661,7 +660,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA hCurItem = CList->GetNextItem(MCLGN_NEXT | MCLGN_ANY | MCLGN_MULTILEVEL, hCurItem);
}
}
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
UpdateCheckboxesState(CList);
}
}
@@ -669,22 +668,22 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case MCLN_SELCHANGED:
{
- PNMCLIST nm = (PNMCLIST)lParam;
+ PNMCLIST pnm = (PNMCLIST)lParam;
TCString BtnTitle(TranslateT("OK"));
if (CList)
UpdateCheckboxesState(CList);
bool bOnlyInfo;
- bool bLeaveOldMessage = nm->OldSelection == nm->NewSelection; // OldSelection == NewSelection when we send MCLN_SELCHANGED from UM_SAM_PROTOSTATUSCHANGED; seems that it's better to leave old message then
- int nOldContacts = GetSelContactsNum(CList, nm->OldSelection);
- int nNewContacts = GetSelContactsNum(CList, nm->NewSelection, &bOnlyInfo);
+ bool bLeaveOldMessage = pnm->OldSelection == pnm->NewSelection; // OldSelection == NewSelection when we send MCLN_SELCHANGED from UM_SAM_PROTOSTATUSCHANGED; seems that it's better to leave old message then
+ int nOldContacts = GetSelContactsNum(CList, pnm->OldSelection);
+ int nNewContacts = GetSelContactsNum(CList, pnm->NewSelection, &bOnlyInfo);
EnableWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_IGNOREREQ), !bOnlyInfo);
if (CList) {
if (SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_MSGDATA, EM_GETMODIFY, 0, 0)) {
int i, j;
- for (i = nm->OldSelection->GetSize() - 1; i >= 0; i--) {
- for (j = nm->NewSelection->GetSize() - 1; j >= 0; j--)
- if ((*nm->NewSelection)[j] == (*nm->OldSelection)[i])
+ for (i = pnm->OldSelection->GetSize() - 1; i >= 0; i--) {
+ for (j = pnm->NewSelection->GetSize() - 1; j >= 0; j--)
+ if ((*pnm->NewSelection)[j] == (*pnm->OldSelection)[i])
break;
if (j < 0)
break;
@@ -695,14 +694,14 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // there's at least one item in the old selection that is not present in the new one
if (i >= 0 && nOldContacts) {
if ((nOldContacts == 1) || MessageBox(hwndDlg, TranslateT("Do you want to apply the message?"), TranslateT("New Away System"), MB_ICONQUESTION | MB_YESNO) == IDYES)
- ApplySelContactsMessage(dat, CList, nm->OldSelection);
+ ApplySelContactsMessage(dat, CList, pnm->OldSelection);
}
else if (nOldContacts)
bLeaveOldMessage = true; // don't change the edit control text yet - we're still writing...
}
}
else if (nOldContacts && !nNewContacts)
- ApplySelContactsMessage(dat, CList, nm->OldSelection);
+ ApplySelContactsMessage(dat, CList, pnm->OldSelection);
// determine the right new message and window title for the edit control now
TCString Message;
@@ -710,8 +709,8 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (CList) {
bool MessageDetermined = false;
bool StatusDetermined = false;
- for (int i = 0; i < nm->NewSelection->GetSize(); i++) {
- HTREEITEM hItem = (*nm->NewSelection)[i];
+ for (int i = 0; i < pnm->NewSelection->GetSize(); i++) {
+ HTREEITEM hItem = (*pnm->NewSelection)[i];
MCONTACT hContact;
char *szProto;
int ItemType = CList->GetItemType(hItem);
@@ -725,7 +724,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA szProto = (char*)CList->GetItemParam(hItem);
if (ItemType == MCLCIT_CONTACT || ItemType == MCLCIT_INFO) {
- int CurStatus = g_ProtoStates[szProto].Status;
+ int CurStatus = g_ProtoStates[szProto].m_status;
if (!MessageDetermined) {
TCString CurMessage((ItemType == MCLCIT_CONTACT) ? CContactSettings(0, hContact).GetMsgFormat(GMF_PERSONAL) : CProtoSettings(szProto).GetMsgFormat(GMF_TEMPORARY | GMF_PERSONAL));
if (CurMessage == NULL)
@@ -751,7 +750,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA }
}
else if (nNewContacts) {
- Status = g_ProtoStates[dat->szProtocol].Status;
+ Status = g_ProtoStates[dat->szProtocol].m_status;
Message = dat->hInitContact ? CContactSettings(0, dat->hInitContact).GetMsgFormat(GMF_PERSONAL) : CProtoSettings(dat->szProtocol).GetMsgFormat(GMF_TEMPORARY | GMF_PERSONAL);
}
@@ -767,11 +766,11 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA MCONTACT hContact = NULL;
char *szProto = NULL;
if (CList) {
- for (int i = 0; i < nm->NewSelection->GetSize(); i++) {
- HTREEITEM hItem = (*nm->NewSelection)[i];
+ for (int i = 0; i < pnm->NewSelection->GetSize(); i++) {
+ HTREEITEM hItem = (*pnm->NewSelection)[i];
int ItemType = CList->GetItemType(hItem);
if (ItemType == MCLCIT_CONTACT) {
- hContact = CList->GethContact((*nm->NewSelection)[i]);
+ hContact = CList->GethContact((*pnm->NewSelection)[i]);
break;
}
if (ItemType == MCLCIT_INFO) {
@@ -869,7 +868,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA CList->SetExtraImageList(hil);
HTREEITEM hSelItem;
- HTREEITEM hItem = hSelItem = CList->AddInfo(TranslateT("** All contacts **"), CLC_ROOT, CLC_ROOT, NULL, Skin_LoadProtoIcon(NULL, g_ProtoStates[(char*)NULL].Status));
+ HTREEITEM hItem = hSelItem = CList->AddInfo(TranslateT("** All contacts **"), CLC_ROOT, CLC_ROOT, NULL, Skin_LoadProtoIcon(NULL, g_ProtoStates[(char*)NULL].m_status));
int numAccs;
PROTOACCOUNT **accs;
Proto_EnumAccounts(&numAccs, &accs);
@@ -878,7 +877,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // don't forget to change Recent Message Save loop in the UM_SAM_APPLYANDCLOSE if you're changing something here
if (CallProtoService(p->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
PROTOACCOUNT * acc = Proto_GetAccount(p->szModuleName);
- hItem = CList->AddInfo(TCString(_T("* ")) + acc->tszAccountName + _T(" *"), CLC_ROOT, hItem, (LPARAM)p->szModuleName, Skin_LoadProtoIcon(p->szModuleName, g_ProtoStates[p->szModuleName].Status));
+ hItem = CList->AddInfo(TCString(_T("* ")) + acc->tszAccountName + _T(" *"), CLC_ROOT, hItem, (LPARAM)p->szModuleName, Skin_LoadProtoIcon(p->szModuleName, g_ProtoStates[p->szModuleName].m_status));
if (dat->szProtocol && !mir_strcmp(p->szModuleName, dat->szProtocol))
hSelItem = hItem;
}
@@ -891,9 +890,9 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (szProto) {
int Flag1 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if ((Flag1 & PF1_IM) == PF1_IM || Flag1 & PF1_INDIVMODEMSG) { // check if the protocol supports message sending/receiving or individual status messages before adding this contact
- HTREEITEM hItem = CList->AddContact(hContact);
+ HTREEITEM hNewItem = CList->AddContact(hContact);
if (dat->hInitContact == hContact)
- hSelItem = hItem;
+ hSelItem = hNewItem;
}
}
}
@@ -905,7 +904,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetExtraIcon(CList, EXTRACOLUMN_IGNORE, hItem, -1);
SetExtraIcon(CList, EXTRACOLUMN_REPLY, hItem, -1);
}
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
CList->SetRedraw(true); // SetRedraw must be before SelectItem - otherwise SelectItem won't change scrollbar position to make the selected contact visible
CList->SelectItem(hSelItem); // must be selected after setting all extra icons, to set checkboxes properly
}
@@ -935,7 +934,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA TCString Message(CProtoSettings(p->szModuleName).GetMsgFormat(GMF_PERSONAL)); // yes, we don't specify GMF_TEMPORARY here, because we don't need to save it
if (Message != NULL)
CProtoSettings(p->szModuleName).SetMsgFormat(SMF_LAST, Message); // if the user set a message for this protocol, save it to the recent messages
- ChangeProtoMessages(p->szModuleName, g_ProtoStates[p->szModuleName].Status, TCString(NULL)); // and actual setting of a status message for the protocol
+ ChangeProtoMessages(p->szModuleName, g_ProtoStates[p->szModuleName].m_status, TCString(NULL)); // and actual setting of a status message for the protocol
}
}
TCString Message(CProtoSettings().GetMsgFormat(GMF_PERSONAL));
@@ -979,7 +978,6 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA }
else { // it's a contact's autoreply setting
while (hItem = CList->GetNextItem(MCLGN_NEXT | MCLGN_CONTACT | MCLGN_MULTILEVEL, hItem)) {
- MCONTACT hContact = CList->GethContact(hItem);
if (CList->GethContact(hItem) == wParam) { // we found the item
SetExtraIcon(CList, EXTRACOLUMN_REPLY, hItem, -1); // update it
break;
@@ -996,14 +994,13 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA while (hItem = CList->GetNextItem(MCLGN_NEXT | MCLGN_CONTACT | MCLGN_INFO | MCLGN_MULTILEVEL, hItem)) {
if (CList->GetItemType(hItem) == MCLCIT_INFO) {
char *szProto = (char*)CList->GetItemParam(hItem);
- if (!wParam || !mir_strcmp(szProto, (char*)wParam)) {
- CList->SetInfoIcon(hItem, Skin_LoadProtoIcon(szProto, g_ProtoStates[szProto].Status));
- }
+ if (!wParam || !mir_strcmp(szProto, (char*)wParam))
+ CList->SetInfoIcon(hItem, Skin_LoadProtoIcon(szProto, g_ProtoStates[szProto].m_status));
}
SetExtraIcon(CList, EXTRACOLUMN_IGNORE, hItem, -1);
SetExtraIcon(CList, EXTRACOLUMN_REPLY, hItem, -1);
}
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
}
nm.hdr.code = MCLN_SELCHANGED;
nm.hdr.hwndFrom = GetDlgItem(hwndDlg, IDC_SAWAYMSG_CONTACTSTREE);
@@ -1047,7 +1044,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (Selection->GetSize() == 1)
CList->EnsureVisible((*Selection)[0]);
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
}
break;
@@ -1061,7 +1058,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetExtraIcon(CList, EXTRACOLUMN_REPLY, (*Selection)[i], ReplyIcon);
if (Selection->GetSize() == 1)
CList->EnsureVisible((*Selection)[0]);
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
}
break;
@@ -1322,7 +1319,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetClassLong(hTreeView, GCLP_HCURSOR, NULL);
hCursor = LoadCursor(NULL, IDC_HAND); // set mouse cursor to a hand when hovering over items or their extra images
}
- else SetClassLong(hTreeView, GCLP_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW));
+ else SetClassLongPtr(hTreeView, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
if (!hCursor)
hCursor = LoadCursor(NULL, IDC_ARROW);
@@ -1330,7 +1327,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetCursor(hCursor);
return true;
}
- else SetClassLong(hTreeView, GCLP_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW));
+ else SetClassLongPtr(hTreeView, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
}
break;
diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h index 56a4975ca3..b87211b678 100644 --- a/plugins/NewAwaySysMod/src/stdafx.h +++ b/plugins/NewAwaySysMod/src/stdafx.h @@ -282,7 +282,7 @@ int IsAnICQProto(char *szProto); // Client.cpp
void InitUpdateMsgs();
-void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg);
+void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg);
int GetRecentGroupID(int iMode);
TCString VariablesEscape(TCString Str);
|