From baa0c8ab5a4e5dc7a94a6bb0b8be095a760f48d0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 24 Nov 2017 14:52:14 +0300 Subject: dbeditor: - code cleaning - version bump --- plugins/DbEditorPP/src/settinglist.cpp | 36 ++++++++-------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) (limited to 'plugins/DbEditorPP/src/settinglist.cpp') diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 8718da8bec..26f5a6f9f7 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -26,7 +26,6 @@ int ListView_GetItemTextA(HWND hwndLV, int i, int iSubItem, char *pszText, int c return SendMessageA(hwndLV, LVM_GETITEMTEXTA, (WPARAM)(i), (LPARAM)(LV_ITEMA *)&lvi); } - int ListView_SetItemTextA(HWND hwndLV, int i, int iSubItem, const char *pszText) { LV_ITEMA lvi; @@ -35,7 +34,6 @@ int ListView_SetItemTextA(HWND hwndLV, int i, int iSubItem, const char *pszText) return SendMessageA(hwndLV, LVM_SETITEMTEXTA, (WPARAM)(i), (LPARAM)(LV_ITEMA *)&lvi); } - int convertSetting(MCONTACT hContact, const char *module, const char *setting, int toType) { DBVARIANT dbv = { 0 }; @@ -78,7 +76,6 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i } switch (toType) { - case DBVT_BYTE: case DBVT_WORD: case DBVT_DWORD: @@ -103,7 +100,6 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i return res; } - void EditFinish(int selected) { if (info.hwnd2Edit) { @@ -113,7 +109,6 @@ void EditFinish(int selected) info.selectedItem = selected; } - void ClearListView() { EditFinish(0); @@ -124,7 +119,6 @@ void ClearListView() ListView_DeleteAllItems(hwnd2List); } - void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *setting) { int count = ListView_GetSelectedCount(hwnd2List); @@ -160,7 +154,6 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s replaceTreeItem(hContact, module, nullptr); } - int findListItem(const char *setting) { if (!setting || !setting[0]) return -1; @@ -172,7 +165,6 @@ int findListItem(const char *setting) return SendMessageA(hwnd2List, LVM_FINDITEMA, -1, (LPARAM)&lvfi); } - void deleteListItem(const char *setting) { int item = findListItem(setting); @@ -180,7 +172,6 @@ void deleteListItem(const char *setting) ListView_DeleteItem(hwnd2List, item); } - void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident) { if (!dbv || !dbv->type) { @@ -292,7 +283,6 @@ void updateListItem(int index, const char *setting, DBVARIANT *dbv, int resident ListView_SetItemText(hwnd2List, index, 2, DBVType(dbv->type)); } - void addListHandle(MCONTACT hContact) { wchar_t name[NAME_SIZE], data[32]; @@ -322,7 +312,6 @@ void addListHandle(MCONTACT hContact) } } - void addListItem(const char *setting, int resident) { DBVARIANT dbv; @@ -334,18 +323,16 @@ void addListItem(const char *setting, int resident) updateListItem(index, setting, &dbv, resident); db_free(&dbv); } - else - if (!resident) { - LVITEMA lvi = { 0 }; - lvi.mask = LVIF_TEXT; - lvi.pszText = (char*)setting; - int index = SendMessageA(hwnd2List, LVM_INSERTITEMA, 0, (LPARAM)&lvi); - ListView_SetItemText(hwnd2List, index, 1, TranslateT("*** buggy resident ***")); - return; - } + else if (!resident) { + LVITEMA lvi = { 0 }; + lvi.mask = LVIF_TEXT; + lvi.pszText = (char*)setting; + int index = SendMessageA(hwnd2List, LVM_INSERTITEMA, 0, (LPARAM)&lvi); + ListView_SetItemText(hwnd2List, index, 1, TranslateT("*** buggy resident ***")); + return; + } } - void PopulateSettings(MCONTACT hContact, const char *module) { // save module as it can be erased by ClearListView() @@ -359,7 +346,6 @@ void PopulateSettings(MCONTACT hContact, const char *module) mir_strncpy(info.module, tmp, _countof(info.module)); ModuleSettingLL setlist; - if (IsModuleEmpty(info.hContact, info.module) || !EnumSettings(info.hContact, info.module, &setlist)) return; @@ -378,7 +364,6 @@ void PopulateSettings(MCONTACT hContact, const char *module) FreeModuleSettingLL(&setlist); } - void SelectSetting(const char *setting) { LVITEM lvItem = { 0 }; @@ -401,7 +386,6 @@ void SelectSetting(const char *setting) } } - void settingChanged(MCONTACT hContact, const char *module, const char *setting, DBVARIANT *dbv) { // modules tree @@ -433,7 +417,6 @@ void settingChanged(MCONTACT hContact, const char *module, const char *setting, } } - static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -683,10 +666,8 @@ void EditLabel(int item, int subitem) SendMessage(info.hwnd2Edit, WM_USER, 0, 0); } - void SettingsListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam); - void SettingsListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam) { LVHITTESTINFO hti; @@ -745,7 +726,6 @@ void SettingsListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam) } } - void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to the main window, NOT the listview { LVHITTESTINFO hti; -- cgit v1.2.3