summaryrefslogtreecommitdiff
path: root/plugins/DbEditorPP/src/watchedvars.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-12-14 15:31:37 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-12-14 15:31:37 +0000
commit82fc26a0fdbd50cf60b2c93f456cbef33046ac48 (patch)
treea3c61b6e3b4ba8b7d7c9b92e9f5abaa27c90954c /plugins/DbEditorPP/src/watchedvars.cpp
parent8c538dbff915b405d9b41fe51ca78618a78cf46d (diff)
DbEditorPP: changed warning lavel to w4
git-svn-id: http://svn.miranda-ng.org/main/trunk@11414 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DbEditorPP/src/watchedvars.cpp')
-rw-r--r--plugins/DbEditorPP/src/watchedvars.cpp300
1 files changed, 150 insertions, 150 deletions
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp
index c237745bff..18250c4f09 100644
--- a/plugins/DbEditorPP/src/watchedvars.cpp
+++ b/plugins/DbEditorPP/src/watchedvars.cpp
@@ -8,13 +8,13 @@ int addSettingToWatchList(MCONTACT hContact, char* module, char* setting)
WatchListArray.item = (struct DBsetting*)mir_realloc(WatchListArray.item, sizeof(struct DBsetting)*WatchListArray.size);
}
if (!WatchListArray.item) return 0;
- if (setting && db_get(hContact,module, setting, &(WatchListArray.item[WatchListArray.count].dbv))) return 0;
+ if (setting && db_get(hContact, module, setting, &(WatchListArray.item[WatchListArray.count].dbv))) return 0;
WatchListArray.item[WatchListArray.count].hContact = hContact;
WatchListArray.item[WatchListArray.count].module = mir_tstrdup(module);
if (setting) WatchListArray.item[WatchListArray.count].setting = mir_tstrdup(setting);
else WatchListArray.item[WatchListArray.count].setting = 0;
- WatchListArray.item[WatchListArray.count].WatchModule = setting?WATCH_SETTING:WATCH_MODULE;
+ WatchListArray.item[WatchListArray.count].WatchModule = setting ? WATCH_SETTING : WATCH_MODULE;
WatchListArray.count++;
return 1;
}
@@ -41,7 +41,7 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam)
char *setting = lParam->setting;
if (!module) return;
lvItem.lParam = (LPARAM)lParam->hContact;
- lvItem.mask = LVIF_TEXT|LVIF_PARAM;
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
@@ -50,7 +50,7 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam)
ModuleSettingLL settinglist;
struct DBsetting dummy;
ModSetLinkLinkItem *setting;
- if (!EnumSettings(hContact,module,&settinglist)) return;
+ if (!EnumSettings(hContact, module, &settinglist)) return;
dummy.hContact = hContact;
dummy.module = mir_tstrdup(module);
setting = settinglist.first;
@@ -72,64 +72,64 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam)
else
lvItem.pszText = (char*)GetContactName(hContact, NULL, 1);
- index = ListView_InsertItem(hwnd2list,&lvItem);
+ index = ListView_InsertItem(hwnd2list, &lvItem);
WCHAR* ptszText = mir_a2u(lvItem.pszText);
ListView_SetItemTextW(hwnd2list, index, 0, ptszText);
mir_free(ptszText);
- ListView_SetItemText(hwnd2list,index,1,module);
- ListView_SetItemText(hwnd2list,index,2,setting);
+ ListView_SetItemText(hwnd2list, index, 1, module);
+ ListView_SetItemText(hwnd2list, index, 2, setting);
switch (dbv->type) {
case DBVT_BLOB:
+ {
+ int j;
+ char *data = NULL;
+ if (!(data = (char*)mir_realloc(data, 3 * (dbv->cpbVal + 1))))
+ return;
+ data[0] = '\0';
+ for (j = 0; j < dbv->cpbVal; j++)
{
- int j;
- char *data = NULL;
- if (!(data = (char*)mir_realloc(data, 3*(dbv->cpbVal+1)) ))
- return;
- data[0] = '\0';
- for (j=0; j<dbv->cpbVal; j++)
- {
- char tmp[16];
- mir_snprintf(tmp, SIZEOF(tmp), "%02X ", (BYTE)dbv->pbVal[j]);
- strcat(data, tmp);
- }
- ListView_SetItemText(hwnd2list,index,4,data);
- ListView_SetItemText(hwnd2list,index,3,"BLOB");
- mir_free(data);
+ char tmp[16];
+ mir_snprintf(tmp, SIZEOF(tmp), "%02X ", (BYTE)dbv->pbVal[j]);
+ strcat(data, tmp);
}
- break;
+ ListView_SetItemText(hwnd2list, index, 4, data);
+ ListView_SetItemText(hwnd2list, index, 3, "BLOB");
+ mir_free(data);
+ }
+ break;
case DBVT_BYTE:
- mir_snprintf(data, SIZEOF(data), "0x%02X (%s)", dbv->bVal, itoa(dbv->bVal,tmp,10));
- ListView_SetItemText(hwnd2list,index,4,data);
- ListView_SetItemText(hwnd2list,index,3,"BYTE");
+ mir_snprintf(data, SIZEOF(data), "0x%02X (%s)", dbv->bVal, itoa(dbv->bVal, tmp, 10));
+ ListView_SetItemText(hwnd2list, index, 4, data);
+ ListView_SetItemText(hwnd2list, index, 3, "BYTE");
break;
case DBVT_WORD:
- mir_snprintf(data, SIZEOF(data), "0x%04X (%s)", dbv->wVal, itoa(dbv->wVal,tmp,10));
- ListView_SetItemText(hwnd2list,index,4,data);
- ListView_SetItemText(hwnd2list,index,3,"WORD");
+ mir_snprintf(data, SIZEOF(data), "0x%04X (%s)", dbv->wVal, itoa(dbv->wVal, tmp, 10));
+ ListView_SetItemText(hwnd2list, index, 4, data);
+ ListView_SetItemText(hwnd2list, index, 3, "WORD");
break;
case DBVT_DWORD:
- mir_snprintf(data, SIZEOF(data), "0x%08X (%s)", dbv->dVal, itoa(dbv->dVal,tmp,10));
- ListView_SetItemText(hwnd2list,index,4,data);
- ListView_SetItemText(hwnd2list,index,3,"DWORD");
+ mir_snprintf(data, SIZEOF(data), "0x%08X (%s)", dbv->dVal, itoa(dbv->dVal, tmp, 10));
+ ListView_SetItemText(hwnd2list, index, 4, data);
+ ListView_SetItemText(hwnd2list, index, 3, "DWORD");
break;
case DBVT_ASCIIZ:
- ListView_SetItemText(hwnd2list,index,4,dbv->pszVal);
- ListView_SetItemText(hwnd2list,index,3,"STRING");
+ ListView_SetItemText(hwnd2list, index, 4, dbv->pszVal);
+ ListView_SetItemText(hwnd2list, index, 3, "STRING");
break;
case DBVT_UTF8:
int length = (int)strlen(dbv->pszVal) + 1;
WCHAR *wc = (WCHAR*)_alloca(length*sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, dbv->pszVal, -1, wc, length);
- ListView_SetItemTextW(hwnd2list,index,4,wc);
- ListView_SetItemText(hwnd2list,index,3,"UNICODE");
+ ListView_SetItemTextW(hwnd2list, index, 4, wc);
+ ListView_SetItemText(hwnd2list, index, 3, "UNICODE");
break;
}
}
@@ -138,7 +138,7 @@ void PopulateWatchedWindow(HWND hwnd)
{
int i;
ListView_DeleteAllItems(hwnd);
- for (i=0;i<WatchListArray.count;i++)
+ for (i = 0; i < WatchListArray.count; i++)
{
addwatchtolist(hwnd, &(WatchListArray.item[i]));
}
@@ -147,7 +147,7 @@ void PopulateWatchedWindow(HWND hwnd)
void freeAllWatches()
{
int i;
- for (i=0;i<WatchListArray.count;i++)
+ for (i = 0; i < WatchListArray.count; i++)
{
freeWatchListItem(i);
}
@@ -156,154 +156,154 @@ void freeAllWatches()
WatchListArray.count = 0;
}
-int WatchDialogResize(HWND hwnd,LPARAM lParam,UTILRESIZECONTROL *urc)
+int WatchDialogResize(HWND, LPARAM, UTILRESIZECONTROL *urc)
{
- switch(urc->wId)
- {
- case IDC_VARS:
- urc->rcItem.top = 0;
- urc->rcItem.bottom = urc->dlgNewSize.cy;
- urc->rcItem.left = 0;
- urc->rcItem.right = urc->dlgNewSize.cx;
- return RD_ANCHORY_CUSTOM|RD_ANCHORX_CUSTOM;
- }
- return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
+ switch (urc->wId)
+ {
+ case IDC_VARS:
+ urc->rcItem.top = 0;
+ urc->rcItem.bottom = urc->dlgNewSize.cy;
+ urc->rcItem.left = 0;
+ urc->rcItem.right = urc->dlgNewSize.cx;
+ return RD_ANCHORY_CUSTOM | RD_ANCHORX_CUSTOM;
+ }
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
- case WM_INITDIALOG:
- {
- // setup the list...
- LVCOLUMN sLC;
-
- sLC.fmt = LVCFMT_LEFT;
- ListView_SetExtendedListViewStyle(GetDlgItem(hwnd, IDC_VARS), 32|LVS_EX_SUBITEMIMAGES); //LVS_EX_FULLROWSELECT
- sLC.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;
-
- sLC.pszText = Translate("Contact"); sLC.cx = 80;
- ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS),0,&sLC);
- sLC.pszText = Translate("Module"); sLC.cx = 80;
- ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS),1,&sLC);
- sLC.pszText = Translate("Setting"); sLC.cx = 80;
- ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS),2,&sLC);
- sLC.pszText = Translate("Type"); sLC.cx = 60;
- ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS),3,&sLC);
- sLC.pszText = Translate("Data"); sLC.cx = 300;
- ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS),4,&sLC);
+ case WM_INITDIALOG:
+ {
+ // setup the list...
+ LVCOLUMN sLC;
+
+ sLC.fmt = LVCFMT_LEFT;
+ ListView_SetExtendedListViewStyle(GetDlgItem(hwnd, IDC_VARS), 32 | LVS_EX_SUBITEMIMAGES); //LVS_EX_FULLROWSELECT
+ sLC.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;
+
+ sLC.pszText = Translate("Contact"); sLC.cx = 80;
+ ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS), 0, &sLC);
+ sLC.pszText = Translate("Module"); sLC.cx = 80;
+ ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS), 1, &sLC);
+ sLC.pszText = Translate("Setting"); sLC.cx = 80;
+ ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS), 2, &sLC);
+ sLC.pszText = Translate("Type"); sLC.cx = 60;
+ ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS), 3, &sLC);
+ sLC.pszText = Translate("Data"); sLC.cx = 300;
+ ListView_InsertColumn(GetDlgItem(hwnd, IDC_VARS), 4, &sLC);
+
+ PopulateWatchedWindow(GetDlgItem(hwnd, IDC_VARS));
+
+ TranslateMenu(GetMenu(hwnd));
+ TranslateMenu(GetSubMenu(GetMenu(hwnd), 0));
+ TranslateDialogDefault(hwnd);
+ // do the icon
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)));
+ }
+ return TRUE;
+ // for the resize
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO *mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = 200;
+ mmi->ptMinTrackSize.y = 90;
+ return 0;
+ }
+ case WM_SIZE:
+ {
+ UTILRESIZEDIALOG urd;
+ memset(&urd, 0, sizeof(urd));
+ urd.cbSize = sizeof(urd);
+ urd.hInstance = hInst;
+ urd.hwndDlg = hwnd;
+ urd.lParam = 0;
+ urd.lpTemplate = MAKEINTRESOURCE(IDD_WATCH_DIAG);
+ urd.pfnResizer = WatchDialogResize;
+ CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
+ break;
+ }
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case MENU_REMALL_WATCHES:
+ freeAllWatches();
+ ListView_DeleteAllItems(GetDlgItem(hwnd, IDC_VARS));
+ break;
+ case MENU_EXIT:
+ case IDCANCEL:
+ hwnd2watchedVarsWindow = 0;
+ DestroyWindow(hwnd);
+ break;
+ case MENU_REFRESH:
PopulateWatchedWindow(GetDlgItem(hwnd, IDC_VARS));
-
- TranslateMenu(GetMenu(hwnd));
- TranslateMenu(GetSubMenu(GetMenu(hwnd),0));
- TranslateDialogDefault(hwnd);
- // do the icon
- SendMessage(hwnd,WM_SETICON,ICON_BIG,(LPARAM)LoadIcon(hInst,MAKEINTRESOURCE(ICO_REGEDIT)));
}
- return TRUE;
- // for the resize
- case WM_GETMINMAXINFO:
- {
- MINMAXINFO *mmi=(MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x=200;
- mmi->ptMinTrackSize.y=90;
- return 0;
- }
- case WM_SIZE:
- {
- UTILRESIZEDIALOG urd;
- memset(&urd, 0, sizeof(urd));
- urd.cbSize=sizeof(urd);
- urd.hInstance=hInst;
- urd.hwndDlg=hwnd;
- urd.lParam=0;
- urd.lpTemplate=MAKEINTRESOURCE(IDD_WATCH_DIAG);
- urd.pfnResizer=WatchDialogResize;
- CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd);
- break;
-
- }
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case MENU_REMALL_WATCHES:
- freeAllWatches();
- ListView_DeleteAllItems(GetDlgItem(hwnd, IDC_VARS));
- break;
- case MENU_EXIT:
- case IDCANCEL:
- hwnd2watchedVarsWindow = 0;
- DestroyWindow(hwnd);
- break;
- case MENU_REFRESH:
- PopulateWatchedWindow(GetDlgItem(hwnd, IDC_VARS));
- }
- break;
+ break;
- case WM_NOTIFY:
- switch(LOWORD(wParam))
+ case WM_NOTIFY:
+ switch (LOWORD(wParam))
+ {
+ case IDC_VARS:
+ switch (((NMHDR*)lParam)->code)
{
- case IDC_VARS:
- switch(((NMHDR*)lParam)->code)
+ case NM_DBLCLK:
+ {
+ LVHITTESTINFO hti;
+ LVITEM lvi;
+ hti.pt = ((NMLISTVIEW*)lParam)->ptAction;
+ if (ListView_SubItemHitTest(GetDlgItem(hwnd, IDC_VARS), &hti) > -1)
+ {
+ if (hti.flags&LVHT_ONITEM)
{
- case NM_DBLCLK:
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = hti.iItem;
+ lvi.iSubItem = 0;
+ if (ListView_GetItem(GetDlgItem(hwnd, IDC_VARS), &lvi))
{
- LVHITTESTINFO hti;
- LVITEM lvi;
- hti.pt=((NMLISTVIEW*)lParam)->ptAction;
- if (ListView_SubItemHitTest(GetDlgItem(hwnd,IDC_VARS),&hti) >-1)
- {
- if (hti.flags&LVHT_ONITEM)
- {
- lvi.mask = LVIF_PARAM;
- lvi.iItem = hti.iItem;
- lvi.iSubItem = 0;
- if (ListView_GetItem(GetDlgItem(hwnd,IDC_VARS),&lvi))
- {
- ItemInfo ii;
- ii.hContact = (MCONTACT)lvi.lParam;
- ListView_GetItemText(GetDlgItem(hwnd, IDC_VARS), hti.iItem, 1, ii.module, SIZEOF(ii.module));
- ListView_GetItemText(GetDlgItem(hwnd, IDC_VARS), hti.iItem, 2, ii.setting, SIZEOF(ii.setting));
- ii.type = FW_SETTINGNAME;
- SendMessage(hwnd2mainWindow,WM_FINDITEM,(WPARAM)&ii,0);
- }
- }
- }
+ ItemInfo ii;
+ ii.hContact = (MCONTACT)lvi.lParam;
+ ListView_GetItemText(GetDlgItem(hwnd, IDC_VARS), hti.iItem, 1, ii.module, SIZEOF(ii.module));
+ ListView_GetItemText(GetDlgItem(hwnd, IDC_VARS), hti.iItem, 2, ii.setting, SIZEOF(ii.setting));
+ ii.type = FW_SETTINGNAME;
+ SendMessage(hwnd2mainWindow, WM_FINDITEM, (WPARAM)&ii, 0);
}
- break;
}
- break;
+ }
}
+ break;
+ }
+ break;
+ }
break;
}
return 0;
}
-void popupWatchedVar(MCONTACT hContact,const char* module,const char* setting)
+void popupWatchedVar(MCONTACT hContact, const char* module, const char* setting)
{
HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
char lpzContactName[MAX_CONTACTNAME];
char lpzText[MAX_SECONDLINE];
- COLORREF colorBack = db_get_dw(NULL,modname,"PopupColour",RGB(255,0,0));
- COLORREF colorText = RGB(0,0,0);
- int timeout = db_get_b(NULL,modname,"PopupDelay",3);
+ COLORREF colorBack = db_get_dw(NULL, modname, "PopupColour", RGB(255, 0, 0));
+ COLORREF colorText = RGB(0, 0, 0);
+ int timeout = db_get_b(NULL, modname, "PopupDelay", 3);
if (hContact) {
// contacts nick
char szProto[256];
- if (GetValue(hContact,"Protocol","p",szProto,SIZEOF(szProto)))
+ if (GetValue(hContact, "Protocol", "p", szProto, SIZEOF(szProto)))
mir_snprintf(lpzContactName, SIZEOF(lpzContactName), "%s (%s)", (char*)GetContactName(hContact, szProto, 0), szProto);
else
mir_snprintf(lpzContactName, SIZEOF(lpzContactName), nick_unknown);
}
- else strcpy(lpzContactName,Translate("Settings"));
+ else strcpy(lpzContactName, Translate("Settings"));
// 2nd line
DBVARIANT dbv;
- if ( GetSetting(hContact, module, setting, &dbv))
+ if (GetSetting(hContact, module, setting, &dbv))
return;
switch (dbv.type) {
@@ -331,8 +331,8 @@ void popupWatchedVar(MCONTACT hContact,const char* module,const char* setting)
POPUPDATA ppd = { 0 };
ppd.lchContact = (MCONTACT)hContact;
ppd.lchIcon = hIcon;
- mir_tstrncpy(ppd.lpzContactName, lpzContactName,MAX_CONTACTNAME);
- mir_tstrncpy(ppd.lpzText, lpzText,MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lpzContactName, lpzContactName, MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lpzText, lpzText, MAX_SECONDLINE);
ppd.colorBack = colorBack;
ppd.colorText = colorText;
ppd.iSeconds = timeout ? timeout : -1;