diff options
author | slotwin <slotwin@users.noreply.github.com> | 2014-06-12 20:26:54 +0000 |
---|---|---|
committer | slotwin <slotwin@users.noreply.github.com> | 2014-06-12 20:26:54 +0000 |
commit | 1ea2fdee4e29056c19c22a2dad6e20ce38404e1b (patch) | |
tree | d330b6570f41cdbdb35b9b74daf28756abe7b7b6 /plugins/DbEditorPP | |
parent | 5a5af904fbe02f84dcc7bc8542ffa2f1ca178c99 (diff) |
DBEditor++: add all icons to IcoLib
proper capitalization (menus and dialogs)
code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@9445 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DbEditorPP')
-rw-r--r-- | plugins/DbEditorPP/res/resource.rc | 112 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/headers.h | 76 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/icons.cpp | 29 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main.cpp | 87 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main_window.cpp | 48 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/moduletree.cpp | 205 |
6 files changed, 297 insertions, 260 deletions
diff --git a/plugins/DbEditorPP/res/resource.rc b/plugins/DbEditorPP/res/resource.rc index 8abcd2d75d..c0e094afbb 100644 --- a/plugins/DbEditorPP/res/resource.rc +++ b/plugins/DbEditorPP/res/resource.rc @@ -26,28 +26,28 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US IDD_FIND DIALOGEX 0, 0, 340, 249
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
-CAPTION "Database Editor++ Search and Replace"
+CAPTION "Database Editor++ search and replace"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_TEXT,40,13,216,12,ES_AUTOHSCROLL
- CONTROL "Case Sensitive",IDC_CASESENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,30,72,10
- CONTROL "Module Name",IDC_MODNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,44,73,10
- CONTROL "Exact Match",IDC_EXACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,115,30,64,10
- CONTROL "Setting Name",IDC_SETTINGNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,115,44,72,10
- CONTROL "Setting Value",IDC_SETTINGVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,194,44,69,10
+ CONTROL "Case sensitive",IDC_CASESENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,30,72,10
+ CONTROL "Module name",IDC_MODNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,44,73,10
+ CONTROL "Exact match",IDC_EXACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,115,30,64,10
+ CONTROL "Setting name",IDC_SETTINGNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,115,44,72,10
+ CONTROL "Setting value",IDC_SETTINGVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,194,44,69,10
DEFPUSHBUTTON "&Search",IDC_SEARCH,277,5,60,14
EDITTEXT IDC_REPLACE,40,72,216,12,ES_AUTOHSCROLL
- CONTROL "Module Name",IDC_MODNAME2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_GROUP | WS_TABSTOP,40,90,73,10
- CONTROL "Setting Name",IDC_SETTINGNAME2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,115,90,72,10
- CONTROL "Setting Value",IDC_SETTINGVALUE2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,194,90,67,10
+ CONTROL "Module name",IDC_MODNAME2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_GROUP | WS_TABSTOP,40,90,73,10
+ CONTROL "Setting name",IDC_SETTINGNAME2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,115,90,72,10
+ CONTROL "Setting value",IDC_SETTINGVALUE2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,194,90,67,10
CONTROL "Found field",IDC_FOUND,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_TABSTOP,267,90,65,10
PUSHBUTTON "&Replace",IDOK,277,25,60,14
PUSHBUTTON "&Cancel",IDCANCEL,277,45,60,14
LISTBOX IDC_LIST,3,95,334,136,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
- GROUPBOX "Search For",IDC_STATIC,3,1,268,58
+ GROUPBOX "Search for",IDC_STATIC,3,1,268,58
LTEXT "Text:",IDC_STATIC,10,15,26,8
LTEXT "In:",IDC_STATIC,10,30,23,8
- GROUPBOX "Replace With",IDC_STATIC,3,60,334,30
+ GROUPBOX "Replace with",IDC_STATIC,3,60,334,30
LTEXT "Text:",IDC_STATIC,10,74,26,8
LTEXT "In:",IDC_STATIC,10,90,23,8,NOT WS_VISIBLE
CONTROL "",IDC_SBAR,"msctls_statusbar32",WS_TABSTOP | 0x100,3,237,334,12
@@ -61,7 +61,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN
CONTROL "Restore last opened position",IDC_RESTORESETTINGS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,13,283,10
- CONTROL "Automatically expand ""settings"" when Database Editor ++ starts",IDC_EXPANDSETTINGS,
+ CONTROL "Automatically expand ""Settings"" when Database Editor++ starts",IDC_EXPANDSETTINGS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,26,283,10
CONTROL "Warn when deleting modules",IDC_WARNONDEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,39,280,10
CONTROL "Use popups when watched settings change values",IDC_POPUPS,
@@ -79,7 +79,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN
EDITTEXT IDC_MODNAME,7,17,172,12,ES_AUTOHSCROLL
LTEXT "Add a module named",IDC_ADDMODNAMESTATIC,7,6,124,8
- CONTROL "Add to all contacts (Includes Settings)",CHK_COPY2ALL,
+ CONTROL "Add to all contacts (including Settings)",CHK_COPY2ALL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,35,172,10
DEFPUSHBUTTON "OK",IDOK,29,49,50,14
PUSHBUTTON "Cancel",IDCANCEL,107,49,50,14
@@ -87,7 +87,7 @@ END IDD_EDIT_SETTING DIALOGEX 0, 0, 252, 121
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "Edit Setting"
+CAPTION "Edit setting"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_SETTINGNAME,7,18,238,14,ES_AUTOHSCROLL
@@ -102,15 +102,15 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,132,102,50,14
RADIOBUTTON "Hexadecimal",CHK_HEX,182,49,59,10
RADIOBUTTON "Decimal",CHK_DECIMAL,182,62,59,10
- LTEXT "Value Name:",IDC_STATIC,7,7,42,8
- LTEXT "Value Data:",IDC_STATIC,7,37,38,8
+ LTEXT "Value name:",IDC_STATIC,7,7,42,8
+ LTEXT "Value data:",IDC_STATIC,7,37,38,8
GROUPBOX "Base",GRP_BASE,174,37,71,38
- GROUPBOX "Save Value as:",GRP_TYPE,7,67,160,29
+ GROUPBOX "Save value as:",GRP_TYPE,7,67,160,29
END
IDD_WATCH_DIAG DIALOGEX 0, 0, 414, 190
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
-CAPTION "Watched Database Variables"
+CAPTION "Watched database settings"
MENU IDR_WATCHWINDOWMENU
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
@@ -123,7 +123,7 @@ CAPTION "Copy module to contact" FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
COMBOBOX IDC_CONTACTS,7,17,172,99,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- CONTROL "Copy to all contacts (Includes Settings)",CHK_COPY2ALL,
+ CONTROL "Copy to all contacts (including Settings)",CHK_COPY2ALL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,35,172,10
DEFPUSHBUTTON "OK",IDOK,29,49,50,14
PUSHBUTTON "Cancel",IDCANCEL,107,49,50,14
@@ -132,14 +132,14 @@ END IDD_IMPORT DIALOGEX 0, 0, 268, 170
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Import Module/Settings"
+CAPTION "Import module/settings"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_TEXT,7,18,254,124,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
DEFPUSHBUTTON "Import",IDOK,153,149,50,14
PUSHBUTTON "Cancel",IDCANCEL,211,149,50,14
PUSHBUTTON "Insert &CR/LF",IDC_CRLF,20,149,58,14
- LTEXT "Paste the Settings to import here.",IDC_STATIC,7,7,105,8
+ LTEXT "Paste the settings to import here.",IDC_STATIC,7,7,105,8
END
IDD_MAIN DIALOGEX 0, 0, 408, 225
@@ -212,6 +212,10 @@ BEGIN HORZGUIDE, 81
END
+ IDD_WATCH_DIAG, DIALOG
+ BEGIN
+ END
+
IDD_COPY_MOD, DIALOG
BEGIN
LEFTMARGIN, 7
@@ -297,16 +301,16 @@ IDR_MAINMENU MENU BEGIN
POPUP "&Main"
BEGIN
- MENUITEM "&Refresh Modules", MENU_REFRESH_MODS
- MENUITEM "Refresh &Settings", MENU_REFRESH_SETS
+ MENUITEM "&Refresh modules", MENU_REFRESH_MODS
+ MENUITEM "Refresh &settings", MENU_REFRESH_SETS
MENUITEM SEPARATOR
MENUITEM "E&xit", MENU_EXIT
END
POPUP "&Actions"
BEGIN
- MENUITEM "&Search and Replace", MENU_FINDANDREPLACE
+ MENUITEM "&Search and replace", MENU_FINDANDREPLACE
MENUITEM SEPARATOR
- MENUITEM "&Delete Module", MENU_DELETE
+ MENUITEM "&Delete module", MENU_DELETE
END
POPUP "&Watches"
BEGIN
@@ -315,9 +319,9 @@ BEGIN END
POPUP "&Export"
BEGIN
- MENUITEM "Entire &Database", MENU_EXPORTDB
- MENUITEM "All &Settings", MENU_EXPORTMODULE
- MENUITEM "All &Contacts", MENU_EXPORTCONTACT
+ MENUITEM "Entire &database", MENU_EXPORTDB
+ MENUITEM "All &settings", MENU_EXPORTMODULE
+ MENUITEM "All &contacts", MENU_EXPORTCONTACT
END
POPUP "&Import"
BEGIN
@@ -328,16 +332,16 @@ BEGIN BEGIN
MENUITEM "&Sort by protocol", MENU_SORT_ORDER
MENUITEM SEPARATOR
- MENUITEM "Show &All", MENU_FILTER_ALL
- MENUITEM "Show only &Loaded", MENU_FILTER_LOADED
- MENUITEM "Show only &Unloaded", MENU_FILTER_UNLOADED
+ MENUITEM "Show &all", MENU_FILTER_ALL
+ MENUITEM "Show only &loaded", MENU_FILTER_LOADED
+ MENUITEM "Show only &unloaded", MENU_FILTER_UNLOADED
MENUITEM SEPARATOR
MENUITEM "Edit &Bytes in Hex", MENU_BYTE_HEX
MENUITEM "Edit &Words in Hex", MENU_WORD_HEX
MENUITEM "Edit &Dwords in Hex", MENU_DWORD_HEX
MENUITEM SEPARATOR
MENUITEM "&Restore position", MENU_SAVE_POSITION
- MENUITEM "&Open Options", MENU_OPEN_OPTIONS
+ MENUITEM "&Open options", MENU_OPEN_OPTIONS
END
END
@@ -345,9 +349,9 @@ IDR_CONTEXTMENU MENU BEGIN
POPUP "Item context"
BEGIN
- MENUITEM "&Edit / Rename", MENU_EDIT_SET
+ MENUITEM "&Edit/rename", MENU_EDIT_SET
MENUITEM SEPARATOR
- POPUP "NEW"
+ POPUP "New"
BEGIN
MENUITEM "&Byte", MENU_ADD_BYTE
MENUITEM "&Word", MENU_ADD_WORD
@@ -366,10 +370,10 @@ BEGIN END
POPUP "Encyption"
BEGIN
- MENUITEM "View Decrypted String", MENU_VIEWDECRYPT
- MENUITEM "View Encrypted String", MENU_VIEWENCRYPT
- MENUITEM "Decrypt String", MENU_DECRYPT
- MENUITEM "Encrypt String", MENU_ENCRYPT
+ MENUITEM "View decrypted string", MENU_VIEWDECRYPT
+ MENUITEM "View encrypted string", MENU_VIEWENCRYPT
+ MENUITEM "Decrypt string", MENU_DECRYPT
+ MENUITEM "Encrypt string", MENU_ENCRYPT
END
MENUITEM SEPARATOR
MENUITEM "&Watch", MENU_WATCH_ITEM
@@ -378,9 +382,9 @@ BEGIN POPUP "Null Mod context"
BEGIN
MENUITEM "&Rename", MENU_RENAME_MOD
- MENUITEM "Copy To Contact", MENU_COPY_MOD
+ MENUITEM "Copy to contact", MENU_COPY_MOD
MENUITEM SEPARATOR
- MENUITEM "Export Module", MENU_EXPORTMODULE
+ MENUITEM "Export module", MENU_EXPORTMODULE
MENUITEM SEPARATOR
MENUITEM "&Watch", MENU_WATCH_ITEM
MENUITEM "&Delete", MENU_DELETE_MOD
@@ -390,20 +394,20 @@ BEGIN MENUITEM "&Clone", MENU_CLONE_CONTACT
MENUITEM "&Delete", MENU_DELETE_CONTACT
MENUITEM SEPARATOR
- MENUITEM "Export Contact", MENU_EXPORTCONTACT
- POPUP "Import Settings"
+ MENUITEM "Export contact", MENU_EXPORTCONTACT
+ POPUP "Import settings"
BEGIN
MENUITEM "From a file", MENU_IMPORTFROMFILE
MENUITEM "From pasted text", MENU_IMPORTFROMTEXT
END
MENUITEM SEPARATOR
- MENUITEM "&Add Module", MENU_ADD_MODULE
+ MENUITEM "&Add module", MENU_ADD_MODULE
END
POPUP "NULL contact menu"
BEGIN
- MENUITEM "&Add Module", MENU_ADD_MODULE
- MENUITEM "Export Settings", MENU_EXPORTCONTACT
- POPUP "Import Settings"
+ MENUITEM "&Add module", MENU_ADD_MODULE
+ MENUITEM "Export settings", MENU_EXPORTCONTACT
+ POPUP "Import settings"
BEGIN
MENUITEM "From a file", MENU_IMPORTFROMFILE
MENUITEM "From pasted text", MENU_IMPORTFROMTEXT
@@ -411,8 +415,8 @@ BEGIN END
POPUP "Contacts menu"
BEGIN
- MENUITEM "Export Contacts", MENU_EXPORTCONTACT
- POPUP "Import Contacts"
+ MENUITEM "Export contacts", MENU_EXPORTCONTACT
+ POPUP "Import contacts"
BEGIN
MENUITEM "From a file", MENU_IMPORTFROMFILE
MENUITEM "From pasted text", MENU_IMPORTFROMTEXT
@@ -421,17 +425,17 @@ BEGIN POPUP "Contact Mod context"
BEGIN
MENUITEM "&Rename", MENU_RENAME_MOD
- MENUITEM "Copy To Contact", MENU_COPY_MOD
+ MENUITEM "Copy to contact", MENU_COPY_MOD
MENUITEM SEPARATOR
- MENUITEM "Export Module", MENU_EXPORTMODULE
- MENUITEM "Export Module from all contacts", MENU_EXPORTDB
+ MENUITEM "Export module", MENU_EXPORTMODULE
+ MENUITEM "Export module from all contacts", MENU_EXPORTDB
MENUITEM SEPARATOR
MENUITEM "&Watch", MENU_WATCH_ITEM
MENUITEM "&Delete", MENU_DELETE_MOD
END
POPUP "new item"
BEGIN
- POPUP "NEW"
+ POPUP "New"
BEGIN
MENUITEM "&Byte", MENU_ADD_BYTE
MENUITEM "&Word", MENU_ADD_WORD
@@ -445,9 +449,9 @@ END IDR_WATCHWINDOWMENU MENU
BEGIN
- POPUP "Watch Window"
+ POPUP "Watch window"
BEGIN
- MENUITEM "Reload Watch List", MENU_REFRESH
+ MENUITEM "Reload watch list", MENU_REFRESH
MENUITEM "&Delete all", MENU_REMALL_WATCHES
MENUITEM SEPARATOR
MENUITEM "E&xit", MENU_EXIT
diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 75a3830f6a..ff5bac7f74 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -47,12 +47,12 @@ #include "Version.h"
#include "modsettingenum.h"
-#define DEF_ICON 5
+#define DEF_ICON 5
#define crlf_string "\r\n\0"
/////// icons support
-void addIcons(TCHAR* szModuleFileName);
+void addIcons();
HICON LoadSkinnedDBEIcon(int icon);
int AddIconToList(HIMAGELIST hil, HICON hIcon);
void AddProtoIconsToList(HIMAGELIST hil, int newshift);
@@ -70,15 +70,15 @@ extern MCONTACT hRestore; #define modname "DBEditorpp"
#define modFullname "Database Editor++"
#define msg(a,b) MessageBoxA(0,a,b,MB_OK)
-#define nick_unknown "(UNKNOWN)"
-#define nick_unknownW L"(UNKNOWN)"
+#define nick_unknown "(UNKNOWN)"
+#define nick_unknownW L"(UNKNOWN)"
-#define WM_FINDITEM (WM_USER+1) // onyl for the main window, wparam is ItemIfno* lparam is 0
+#define WM_FINDITEM (WM_USER + 1) // onyl for the main window, wparam is ItemIfno* lparam is 0
-#define mir_strlen(ptr) ((ptr==NULL)?0:(int)strlen(ptr))
-#define mir_strncpy(dst, src, len) strncpy(dst, src, len)[len-1]=0;
-#define mir_strcmp(ptr1, ptr2) ((ptr1 && ptr2)?strcmp(ptr1, ptr2):1) // (ptr1||ptr2)
+#define mir_strlen(ptr) ((ptr == NULL) ? 0 : (int)strlen(ptr))
+#define mir_strncpy(dst, src, len) strncpy(dst, src, len)[len - 1] = 0;
+#define mir_strcmp(ptr1, ptr2) ((ptr1 && ptr2) ? strcmp(ptr1, ptr2) : 1) // (ptr1||ptr2)
#define ListView_SetItemTextW(hwndLV, i, iSubItem_, pszText_) \
{ LV_ITEMW _ms_lvi;\
@@ -113,7 +113,7 @@ typedef struct { typedef struct {
MCONTACT hContact;
- char* module;
+ char *module;
HWND hwnd2Edit;
int selectedItem; // item that is currently selected
int clicks; // set to 0 when selection changes, 1 after another click.. cant edit till this is 1
@@ -170,34 +170,34 @@ extern MIDatabase *g_db; extern BOOL usePopups;
-#define NAMEORDERCOUNT 8
+#define NAMEORDERCOUNT 8
-#define MODE_UNLOADED 1
-#define MODE_LOADED 2
-#define MODE_ALL 3
+#define MODE_UNLOADED 1
+#define MODE_LOADED 2
+#define MODE_ALL 3
-#define HEX_BYTE 1
-#define HEX_WORD 2
-#define HEX_DWORD 4
+#define HEX_BYTE 1
+#define HEX_WORD 2
+#define HEX_DWORD 4
//main.c
-int DBGetContactSettingStringStatic(MCONTACT hContact, char* szModule, char* szSetting, char* value, int maxLength);
-int WriteBlobFromString(MCONTACT hContact,const char *szModule,const char *szSetting, const char *Value, int len);
+int DBGetContactSettingStringStatic(MCONTACT hContact, char *szModule, char *szSetting, char *value, int maxLength);
+int WriteBlobFromString(MCONTACT hContact, const char *szModule, const char *szSetting, const char *Value, int len);
int GetSetting(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
-int GetValue(MCONTACT hContact, const char* szModule, const char* szSetting, char* Value, int length);
-int GetValueW(MCONTACT hContact, const char* szModule, const char* szSetting, WCHAR* Value, int length);
-char* u2a( wchar_t* src );
-wchar_t *a2u( char* src , wchar_t *buffer, int len );
+int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, char *Value, int length);
+int GetValueW(MCONTACT hContact, const char *szModule, const char *szSetting, WCHAR *Value, int length);
+char *u2a(wchar_t *src);
+wchar_t *a2u(char *src , wchar_t *buffer, int len);
WCHAR *GetContactName(MCONTACT hContact, const char *szProto, int unicode);
-BOOL IsProtocolLoaded(char* pszProtocolName);
+BOOL IsProtocolLoaded(char *pszProtocolName);
// main_window.c
INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
// modules.c
-int deleteModule(char* module, MCONTACT hContact, int fromMenu);
+int deleteModule(char *module, MCONTACT hContact, int fromMenu);
void deleteModuleGui();
-void renameModule(char* oldName, char* newName, MCONTACT hContact);
+void renameModule(char *oldName, char *newName, MCONTACT hContact);
INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int CloneContact(MCONTACT hContact);
@@ -206,42 +206,42 @@ void replaceTreeItem(HWND hwnd, MCONTACT hContact, const char *module, const cha void refreshTree(BOOL restore);
void __cdecl PopulateModuleTreeThreadFunc(LPVOID di);
void freeTree(HWND hwnd2Tree, MCONTACT hContact);
-int findItemInTree(HWND hwnd2Tree, MCONTACT hContact, char* module);
+int findItemInTree(HWND hwnd2Tree, MCONTACT hContact, char *module);
// settinglist.c
void setupSettingsList(HWND hwnd2List);
void saveListSettings(HWND hwnd2List);
void ClearListview(HWND hwnd2Settings);
void DeleteSettingsFromList(HWND hSettings, MCONTACT hContact, char *module, char *setting);
-void PopulateSettings(HWND hwnd2Settings, MCONTACT hContact, char* module);
-void SelectSetting(char* setting);
+void PopulateSettings(HWND hwnd2Settings, MCONTACT hContact, char *module);
+void SelectSetting(char *setting);
// addeditsettingsdlg.c
INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-void editSetting(MCONTACT hContact, char* module, char* setting);
-BOOL convertSetting(MCONTACT hContact, char* module, char* setting, int toType); // 0 = byte, 1 = word, 2 = dword, 3 = string
+void editSetting(MCONTACT hContact, char *module, char *setting);
+BOOL convertSetting(MCONTACT hContact, char *module, char *setting, int toType); // 0 = byte, 1 = word, 2 = dword, 3 = string
// exportimport.c
-void exportDB(MCONTACT hContact, char* module); // hContact == -1 export entire db. module == NULL export entire contact
+void exportDB(MCONTACT hContact, char *module); // hContact == -1 export entire db. module == NULL export entire contact
void ImportSettingsMenuItem(MCONTACT hContact);
-void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath);
+void ImportSettingsFromFileMenuItem(MCONTACT hContact, char *FilePath);
// find window.c
INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
// copymodule.c
-void copyModuleMenuItem(char* module, MCONTACT hContact);
-void copyModule(char* module, MCONTACT hContactFrom, MCONTACT hContactTo);
+void copyModuleMenuItem(char *module, MCONTACT hContact);
+void copyModule(char *module, MCONTACT hContactFrom, MCONTACT hContactTo);
// options.c
-int OptInit(WPARAM wParam,LPARAM lParam);
+int OptInit(WPARAM wParam, LPARAM lParam);
// watchlist
-int addSettingToWatchList(MCONTACT hContact, char* module, char* setting);
+int addSettingToWatchList(MCONTACT hContact, char *module, char *setting);
void freeWatchListItem(int item);
void PopulateWatchedWindow(HWND hwnd);
void freeAllWatches();
INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-void popupWatchedVar(MCONTACT hContact,const char* module,const char* setting);
+void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting);
-#endif //_COMMONHEADERS_H
\ No newline at end of file +#endif //_COMMONHEADERS_H
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp index 83d873b5e9..efee7c5d35 100644 --- a/plugins/DbEditorPP/src/icons.cpp +++ b/plugins/DbEditorPP/src/icons.cpp @@ -2,24 +2,33 @@ HIMAGELIST himl;
-static IconItem iconList[] =
-{
- { LPGENT("Closed Known Module"), "DBE++_1", ICO_KNOWN },
- { LPGENT("Open Known Module"), "DBE++_2", ICO_KNOWNOPEN },
+IconItem iconList[] = {
+ { LPGENT("Main icon"), "DBE++_0", ICO_DBE_BUTT },
+ { LPGENT("Closed known module"), "DBE++_1", ICO_KNOWN },
+ { LPGENT("Open known module"), "DBE++_2", ICO_KNOWNOPEN },
{ LPGENT("Settings"), "DBE++_5", ICO_SETTINGS },
- { LPGENT("Contacts Group"), "DBE++_6", ICO_CONTACTS },
- { LPGENT("Unknown Contact"), "DBE++_7", ICO_OFFLINE },
- { LPGENT("Known Contact"), "DBE++_8", ICO_ONLINE },
+ { LPGENT("Contacts group"), "DBE++_6", ICO_CONTACTS },
+ { LPGENT("Unknown contact"), "DBE++_7", ICO_OFFLINE },
+ { LPGENT("Known contact"), "DBE++_8", ICO_ONLINE },
+ { LPGENT("Open user tree"), "DBE++_9", ICO_REGUSER },
+
+ { LPGENT("BLOB setting"), "DBE++_BINARY", ICO_BINARY },
+ { LPGENT("Byte setting"), "DBE++_BYTE", ICO_BYTE },
+ { LPGENT("Word setting"), "DBE++_WORD", ICO_WORD },
+ { LPGENT("Dword setting"), "DBE++_DWORD", ICO_DWORD },
+ { LPGENT("String setting"), "DBE++_STRING", ICO_STRING },
+ { LPGENT("Unicode setting"), "DBE++_UNICODE", ICO_UNICODE },
+ { LPGENT("Handle"), "DBE++_HANDLE", ICO_HANDLE }
};
-void addIcons(TCHAR* szModuleFileName)
+void addIcons(void)
{
Icon_Register(hInst, modFullname, iconList, SIZEOF(iconList));
}
HICON LoadSkinnedDBEIcon(int icon)
{
- for (int i=0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == icon)
return Skin_GetIconByHandle(iconList[i].hIcolib);
@@ -71,7 +80,7 @@ int GetProtoIcon(char *szProto) return DEF_ICON;
}
-BOOL IsProtocolLoaded(char* pszProtocolName)
+BOOL IsProtocolLoaded(char *pszProtocolName)
{
if (protoCount)
for(int i = 0; i < protoCount; i++)
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index f523686d96..4bffb7ddee 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -13,7 +13,8 @@ HGENMENU hUserMenu; WatchListArrayStruct WatchListArray;
MCONTACT hRestore;
HANDLE sMenuCommand, sImport, sServicemodeLaunch;
-HANDLE hModulesLoadedHook = NULL, hSettingsChangedHook=NULL, hOptInitHook=NULL, hPreShutdownHook=NULL;
+HANDLE hModulesLoadedHook = NULL, hSettingsChangedHook = NULL, hOptInitHook = NULL, hPreShutdownHook = NULL;
+IconItem iconList[];
//========================
// MirandaPluginInfo
@@ -21,7 +22,7 @@ HANDLE hModulesLoadedHook = NULL, hSettingsChangedHook=NULL, hOptInitHook=NULL, PLUGININFOEX pluginInfoEx =
{
- sizeof(PLUGININFOEX),
+ sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
__DESCRIPTION,
@@ -34,7 +35,7 @@ PLUGININFOEX pluginInfoEx = {0xa8a417ef, 0x7aa, 0x4f37, {0x86, 0x9f, 0x7b, 0xfd, 0x74, 0x88, 0x65, 0x34}}
};
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfoEx;
}
@@ -51,17 +52,17 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE;
}
-void settingChanged(HWND hwnd2Settings, MCONTACT hContact, char* module, char* setting);
+void settingChanged(HWND hwnd2Settings, MCONTACT hContact, char *module, char *setting);
int DBSettingChanged(WPARAM hContact, LPARAM lParam)
{
- DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam;
+ DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING *)lParam;
char *setting;
- SettingListInfo* info;
+ SettingListInfo *info;
if (hwnd2mainWindow) {
HWND hwnd2Settings = GetDlgItem(hwnd2mainWindow, IDC_SETTINGS);
- if (info = (SettingListInfo*)GetWindowLongPtr(hwnd2Settings, GWLP_USERDATA)) {
+ if (info = (SettingListInfo *)GetWindowLongPtr(hwnd2Settings, GWLP_USERDATA)) {
if ((hContact == info->hContact) && !mir_strcmp(info->module, cws->szModule)) {
setting = mir_strdup(cws->szSetting);
if (cws->value.type == DBVT_DELETED) {
@@ -106,7 +107,7 @@ INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM lParam) {
if (!hwnd2mainWindow) { // so only opens 1 at a time
hRestore = wParam;
- SetCursor(LoadCursor(NULL,IDC_WAIT));
+ SetCursor(LoadCursor(NULL, IDC_WAIT));
CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), 0, MainDlgProc);
}
else {
@@ -119,7 +120,7 @@ INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM lParam) }
if (hTTBButt)
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)(TTBST_RELEASED));
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, (LPARAM)TTBST_RELEASED);
return 0;
}
@@ -130,26 +131,27 @@ BOOL IsCP_UTF8(void) return GetCPInfo(CP_UTF8, &CPInfo);
}
-static int OnTTBLoaded(WPARAM wParam,LPARAM lParam)
+static int OnTTBLoaded(WPARAM wParam, LPARAM lParam)
{
- HICON ico = LoadIcon(hInst, MAKEINTRESOURCE(ICO_DBE_BUTT));
-
TTBButton ttb = { sizeof(ttb) };
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = "DBEditorpp/MenuCommand";
ttb.name = LPGEN("Database Editor++");
- ttb.hIconUp = ico;
+ ttb.hIconHandleUp = iconList[0].hIcolib;
ttb.pszTooltipUp = LPGEN("Open Database Editor");
hTTBButt = TopToolbar_AddButton(&ttb);
return 0;
}
-int ModulesLoaded(WPARAM wParam,LPARAM lParam)
+int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
+ // icons
+ addIcons();
+
// Register menu item
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 1900000001;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
+ mi.icolibItem = iconList[0].hIcolib;
mi.pszPopupName = "Database";
mi.pszName = modFullname;
mi.pszService = "DBEditorpp/MenuCommand";
@@ -159,7 +161,7 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) mi.cbSize = sizeof(mi);
mi.position = 1900000001;
mi.flags = 0;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGUSER));
+ mi.icolibItem = iconList[7].hIcolib;
mi.pszName = LPGEN("Open user tree in DBE++");
mi.pszService = "DBEditorpp/MenuCommand";
hUserMenu = Menu_AddContactMenuItem(&mi);
@@ -173,11 +175,6 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D');
Hotkey_Register(&hkd);
- // icons
- TCHAR szModuleFileName[MAX_PATH];
- if (GetModuleFileName(hInst, szModuleFileName, MAX_PATH))
- addIcons(szModuleFileName);
-
UnhookEvent(hModulesLoadedHook);
usePopups = db_get_b(NULL, modname, "UsePopUps", 0);
@@ -224,7 +221,7 @@ INT_PTR ServiceMode(WPARAM wParam, LPARAM lParam) INT_PTR ImportFromFile(WPARAM wParam, LPARAM lParam)
{
- ImportSettingsFromFileMenuItem(wParam, (char*)lParam);
+ ImportSettingsFromFileMenuItem(wParam, (char *)lParam);
return 0;
}
@@ -266,7 +263,7 @@ extern "C" __declspec(dllexport) int Unload(void) // db_get_s (prob shouldnt use this unless u know how big the string is gonna be..)
//=======================================================
-int DBGetContactSettingStringStatic(MCONTACT hContact, char* szModule, char* szSetting, char* value, int maxLength)
+int DBGetContactSettingStringStatic(MCONTACT hContact, char *szModule, char *szSetting, char *value, int maxLength)
{
DBVARIANT dbv;
if (!db_get(hContact, szModule, szSetting, &dbv)) {
@@ -282,9 +279,9 @@ int DBGetContactSettingStringStatic(MCONTACT hContact, char* szModule, char* szS return 0;
}
-int WriteBlobFromString(MCONTACT hContact,const char *szModule,const char *szSetting, const char *szValue, int len)
+int WriteBlobFromString(MCONTACT hContact, const char *szModule, const char *szSetting, const char *szValue, int len)
{
- int j=0, i = 0;
+ int j = 0, i = 0;
BYTE *data = NULL;
BYTE b;
int tmp;
@@ -320,7 +317,7 @@ int GetSetting(MCONTACT hContact, const char *szModule, const char *szSetting, D return db_get_s(hContact, szModule, szSetting, dbv, 0);
}
-int GetValue(MCONTACT hContact, const char* szModule, const char* szSetting, char* Value, int length)
+int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, char *Value, int length)
{
DBVARIANT dbv = {0};
@@ -340,8 +337,8 @@ int GetValue(MCONTACT hContact, const char* szModule, const char* szSetting, cha break;
case DBVT_UTF8:
int len = (int)strlen(dbv.pszVal) + 1;
- char *sz = (char*)_alloca(len * 3);
- WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR));
+ char *sz = (char *)_alloca(len * 3);
+ WCHAR *wc = (WCHAR *)_alloca(len * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len);
WideCharToMultiByte(CP_ACP, 0, wc, -1, sz, len, NULL, NULL);
strncpy(Value, sz, length);
@@ -360,9 +357,9 @@ int GetValue(MCONTACT hContact, const char* szModule, const char* szSetting, cha return 0;
}
-int GetValueW(MCONTACT hContact, const char* szModule, const char* szSetting, WCHAR* Value, int length)
+int GetValueW(MCONTACT hContact, const char *szModule, const char *szSetting, WCHAR *Value, int length)
{
- DBVARIANT dbv = { 0 };
+ DBVARIANT dbv = {0};
WCHAR *wc;
int len;
@@ -370,16 +367,16 @@ int GetValueW(MCONTACT hContact, const char* szModule, const char* szSetting, WC switch (dbv.type) {
case DBVT_UTF8:
len = (int)strlen(dbv.pszVal) + 1;
- wc = (WCHAR*)_alloca(length*sizeof(WCHAR));
+ wc = (WCHAR *)_alloca(length * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len);
- wcsncpy((WCHAR*)Value, wc, length);
+ wcsncpy((WCHAR *)Value, wc, length);
break;
case DBVT_ASCIIZ:
len = (int)strlen(dbv.pszVal) + 1;
- wc = (WCHAR*)_alloca(len*sizeof(WCHAR));
+ wc = (WCHAR *)_alloca(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, wc, len);
- wcsncpy((WCHAR*)Value, wc, length);
+ wcsncpy((WCHAR *)Value, wc, length);
break;
case DBVT_DWORD:
@@ -407,13 +404,13 @@ int GetValueW(MCONTACT hContact, const char* szModule, const char* szSetting, WC return 0;
}
-char* u2a(wchar_t *src)
+char *u2a(wchar_t *src)
{
if (!src)
return NULL;
int cbLen = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
- char* result = (char*)mir_calloc((cbLen + 1)*sizeof(char));
+ char *result = (char *)mir_calloc((cbLen + 1) * sizeof(char));
if (result == NULL)
return NULL;
@@ -422,7 +419,7 @@ char* u2a(wchar_t *src) return result;
}
-wchar_t* a2u(char* src, wchar_t *buffer, int len)
+wchar_t *a2u(char *src, wchar_t *buffer, int len)
{
wchar_t *result = buffer;
if (result == NULL || len < 3)
@@ -434,24 +431,24 @@ wchar_t* a2u(char* src, wchar_t *buffer, int len) return result;
}
-int GetDatabaseString(MCONTACT hContact, const char *szModule, const char* szSetting, WCHAR *Value, int length, BOOL unicode)
+int GetDatabaseString(MCONTACT hContact, const char *szModule, const char *szSetting, WCHAR *Value, int length, BOOL unicode)
{
if (unicode)
return GetValueW(hContact, szModule, szSetting, Value, length);
else
- return GetValue(hContact, szModule, szSetting, (char*)Value, length);
+ return GetValue(hContact, szModule, szSetting, (char *)Value, length);
}
WCHAR* GetContactName(MCONTACT hContact, const char *szProto, int unicode)
{
int i, r = 0;
static WCHAR res[512];
- char *proto = (char*)szProto;
+ char *proto = (char *)szProto;
char name[256];
if (hContact && !proto)
- if (GetValue(hContact, "Protocol", "p", name, SIZEOF(name)))
- proto = name;
+ if (GetValue(hContact, "Protocol", "p", name, SIZEOF(name)))
+ proto = name;
if (proto) {
for (i = 0; i < NAMEORDERCOUNT - 1; i++) {
@@ -479,7 +476,7 @@ WCHAR* GetContactName(MCONTACT hContact, const char *szProto, int unicode) case 5: // Unique id
{
// protocol must define a PFLAG_UNIQUEIDSETTING
- char *uid = (char*)CallProtoService(proto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ char *uid = (char *)CallProtoService(proto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid)
r = GetDatabaseString(hContact, proto, uid, res, SIZEOF(res), unicode);
}
@@ -492,7 +489,7 @@ WCHAR* GetContactName(MCONTACT hContact, const char *szProto, int unicode) if (unicode)
len = (int)wcslen(res);
else
- len = (int)strlen((char*)res);
+ len = (int)strlen((char *)res);
}
else
res[0] = 0;
@@ -518,5 +515,5 @@ WCHAR* GetContactName(MCONTACT hContact, const char *szProto, int unicode) }
}
- return (unicode) ? nick_unknownW : (WCHAR*)nick_unknown;
+ return (unicode) ? nick_unknownW : (WCHAR *)nick_unknown;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 2442178da5..96acfc7daf 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -111,7 +111,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR tvi.pszText = module;
tvi.cchTextMax = 255;
if (TreeView_GetItem(hwnd, &tvi) && tvi.lParam) {
- ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct*)tvi.lParam;
+ ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
MCONTACT hContact = mtis->hContact;
if (wParam == VK_DELETE) {
if ((mtis->type) & MODULE) {
@@ -124,7 +124,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
char msg[1024];
mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete contact \"%s\"?"), module);
- if (MessageBox(0, msg, Translate("Confirm Contact Delete"), MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
+ if (MessageBox(0, msg, Translate("Confirm contact delete"), MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
break;
}
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
@@ -161,8 +161,9 @@ static LRESULT CALLBACK SettingListSubclassProc(HWND hwnd, UINT msg, WPARAM wPar if (wParam == VK_DELETE || wParam == VK_F5 || (wParam == VK_F2 && ListView_GetSelectedCount(hwnd) == 1)) {
char *module, setting[256];
MCONTACT hContact;
- SettingListInfo* sli = (SettingListInfo*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (!sli) break;
+ SettingListInfo* sli = (SettingListInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (!sli)
+ break;
hContact = sli->hContact;
module = sli->module;
ListView_GetItemText(hwnd, ListView_GetSelectionMark(hwnd), 0, setting, 256);
@@ -267,19 +268,19 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) numberOfIcons = 0;
if (himl2 = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 5, 0)) {
- if (AddIconToList(himl2, LoadIcon(hInst, MAKEINTRESOURCE(ICO_BINARY))))
+ if (AddIconToList(himl2, LoadSkinnedDBEIcon(ICO_BINARY)))
numberOfIcons++;
- if (AddIconToList(himl2, LoadIcon(hInst, MAKEINTRESOURCE(ICO_BYTE))))
+ if (AddIconToList(himl2, LoadSkinnedDBEIcon(ICO_BYTE)))
numberOfIcons++;
- if (AddIconToList(himl2, LoadIcon(hInst, MAKEINTRESOURCE(ICO_WORD))))
+ if (AddIconToList(himl2, LoadSkinnedDBEIcon(ICO_WORD)))
numberOfIcons++;
- if (AddIconToList(himl2, LoadIcon(hInst, MAKEINTRESOURCE(ICO_DWORD))))
+ if (AddIconToList(himl2, LoadSkinnedDBEIcon(ICO_DWORD)))
numberOfIcons++;
- if (AddIconToList(himl2, LoadIcon(hInst, MAKEINTRESOURCE(ICO_STRING))))
+ if (AddIconToList(himl2, LoadSkinnedDBEIcon(ICO_STRING)))
numberOfIcons++;
- if (AddIconToList(himl2, LoadIcon(hInst, MAKEINTRESOURCE(ICO_UNICODE))))
+ if (AddIconToList(himl2, LoadSkinnedDBEIcon(ICO_UNICODE)))
numberOfIcons++;
- if (AddIconToList(himl2, LoadIcon(hInst, MAKEINTRESOURCE(ICO_HANDLE))))
+ if (AddIconToList(himl2, LoadSkinnedDBEIcon(ICO_HANDLE)))
numberOfIcons++;
if (numberOfIcons < 7) {
@@ -316,8 +317,10 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ScreenToClient(hwnd, &pt);
splitterPos = rc.left + pt.x + 1;
- if (splitterPos<65) splitterPos = 65;
- if (splitterPos > rc2.right - rc2.left - 65) splitterPos = rc2.right - rc2.left - 65;
+ if (splitterPos < 65)
+ splitterPos = 65;
+ if (splitterPos > rc2.right - rc2.left - 65)
+ splitterPos = rc2.right - rc2.left - 65;
SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, splitterPos);
db_set_w(NULL, modname, "Splitter", (WORD)splitterPos);
}
@@ -327,7 +330,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_GETMINMAXINFO:
{
- MINMAXINFO *mmi = (MINMAXINFO*)lParam;
+ MINMAXINFO *mmi = (MINMAXINFO *)lParam;
int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
if (splitterPos + 40 > 200)
@@ -400,7 +403,8 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ListView_GetItemText(hwnd2Settings, pos, 0, text, SIZEOF(text));
db_set_s(NULL, modname, "LastSetting", text);
}
- else db_unset(NULL, modname, "LastSetting");
+ else
+ db_unset(NULL, modname, "LastSetting");
}
}
db_set_b(NULL, modname, "HexMode", (byte)Hex);
@@ -433,7 +437,8 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return 0;
case WM_COMMAND:
- if (GetKeyState(VK_ESCAPE) & 0x8000) return TRUE; // this needs to be changed to c if htere is a label edit happening..
+ if (GetKeyState(VK_ESCAPE) & 0x8000)
+ return TRUE; // this needs to be changed to c if htere is a label edit happening..
switch (LOWORD(wParam)) {
case MENU_REFRESH_MODS:
refreshTree(1);
@@ -453,16 +458,19 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mtis = (ModuleTreeInfoStruct *)tvi.lParam;
if (mtis->type == MODULE)
PopulateSettings(GetDlgItem(hwnd, IDC_SETTINGS), mtis->hContact, module);
- else ClearListview(GetDlgItem(hwnd, IDC_SETTINGS));
+ else
+ ClearListview(GetDlgItem(hwnd, IDC_SETTINGS));
}
- else ClearListview(GetDlgItem(hwnd, IDC_SETTINGS));
+ else
+ ClearListview(GetDlgItem(hwnd, IDC_SETTINGS));
}
break;
///////////////////////// // watches
case MENU_VIEW_WATCHES:
if (!hwnd2watchedVarsWindow) // so only opens 1 at a time
hwnd2watchedVarsWindow = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), 0, WatchDlgProc);
- else SetForegroundWindow(hwnd2watchedVarsWindow);
+ else
+ SetForegroundWindow(hwnd2watchedVarsWindow);
break;
case MENU_REMALL_WATCHES:
freeAllWatches();
@@ -569,7 +577,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return TRUE; // case WM_NOTIFY
case WM_FINDITEM:
- ItemInfo *ii = (ItemInfo*)wParam;
+ ItemInfo *ii = (ItemInfo *)wParam;
HWND hwnd2Settings = GetDlgItem(hwnd, IDC_SETTINGS);
int hItem = findItemInTree(GetDlgItem(hwnd, IDC_MODULES), ii->hContact, ii->module);
if (hItem != -1) {
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 4d5aa57a99..55e69821ce 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -2,8 +2,8 @@ static BOOL populating = 0;
int Select = 0;
-static ModuleTreeInfoStruct contacts_mtis = {CONTACT_ROOT_ITEM, 0};
-static ModuleTreeInfoStruct settings_mtis = {CONTACT, 0};
+static ModuleTreeInfoStruct contacts_mtis = { CONTACT_ROOT_ITEM, 0 };
+static ModuleTreeInfoStruct settings_mtis = { CONTACT, 0 };
int doContacts(HWND hwnd2Tree, HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelectedContact, char *SelectedModule, char *SelectedSetting)
{
@@ -51,7 +51,7 @@ int doContacts(HWND hwnd2Tree, HTREEITEM contactsRoot, ModuleSettingLL *modlist, lParam->type |= EMPTY;
// contacts name
- DBVARIANT dbv = { 0 };
+ DBVARIANT dbv = {0};
WCHAR nick[256];
WCHAR protoW[256]; // unicode proto
@@ -69,7 +69,8 @@ int doContacts(HWND hwnd2Tree, HTREEITEM contactsRoot, ModuleSettingLL *modlist, else
mir_snwprintf(nick, SIZEOF(nick), L"%s (%s) %s", GetContactName(hContact, szProto, 1), protoW, L"(UNLOADED)");
}
- else wcscpy(nick, nick_unknownW);
+ else
+ wcscpy(nick, nick_unknownW);
}
else {
tvi.item.iSelectedImage = (tvi.item.iImage = icon); //GetProtoIcon(szProto, 7));
@@ -79,7 +80,7 @@ int doContacts(HWND hwnd2Tree, HTREEITEM contactsRoot, ModuleSettingLL *modlist, mir_snwprintf(nick, SIZEOF(nick), L"%s (%s)", GetContactName(hContact, szProto, 1), protoW);
}
- tvi.item.pszText = (char*)nick;
+ tvi.item.pszText = (char *)nick;
contact = TreeView_InsertItemW(hwnd2Tree, &tvi);
itemscount++;
@@ -113,7 +114,8 @@ int doContacts(HWND hwnd2Tree, HTREEITEM contactsRoot, ModuleSettingLL *modlist, if (hItem != -1) {
TreeView_SelectItem(hwnd2Tree, (HTREEITEM)hItem);
TreeView_Expand(hwnd2Tree, hItem, TVE_EXPAND);
- if (SelectedSetting[0]) SelectSetting(SelectedSetting);
+ if (SelectedSetting[0])
+ SelectSetting(SelectedSetting);
}
return itemscount;
@@ -126,7 +128,7 @@ void doItems(HWND hwnd2Tree, ModuleSettingLL *modlist, int count) char percent[96], title[64];
mir_snprintf(title, SIZEOF(title), Translate("Loading modules..."));
- TVITEM item = { 0 };
+ TVITEM item = {0};
item.mask = TVIF_STATE | TVIF_PARAM;
HTREEITEM contact = TreeView_GetChild(hwnd2Tree, TVI_ROOT);
@@ -145,7 +147,8 @@ void doItems(HWND hwnd2Tree, ModuleSettingLL *modlist, int count) continue;
mtis->type = CONTACT;
}
- else continue;
+ else
+ continue;
// Caption
mir_snprintf(percent, SIZEOF(percent), "%s %d%%", title, (int)(100 * i / count));
@@ -179,12 +182,13 @@ void doItems(HWND hwnd2Tree, ModuleSettingLL *modlist, int count) // the following code to go through the whole tree is nicked from codeguru..
// http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?thread=7680
-int findItemInTree(HWND hwnd2Tree, MCONTACT hContact, char* module)
+int findItemInTree(HWND hwnd2Tree, MCONTACT hContact, char *module)
{
TVITEM item;
char text[265];
HTREEITEM lastItem;
- if (!TreeView_GetCount(hwnd2Tree)) return 0;
+ if (!TreeView_GetCount(hwnd2Tree))
+ return 0;
item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
item.hItem = TVI_ROOT;
@@ -203,13 +207,11 @@ int findItemInTree(HWND hwnd2Tree, MCONTACT hContact, char* module) }
/* back to coduguru's code*/
}
- }
- while ((item.hItem = TreeView_GetChild(hwnd2Tree, lastItem)));
+ } while ((item.hItem = TreeView_GetChild(hwnd2Tree, lastItem)));
- while ((!(item.hItem = TreeView_GetNextSibling(hwnd2Tree, lastItem))) && (lastItem = item.hItem = TreeView_GetParent(hwnd2Tree, lastItem)))
- ;
- }
- while (item.hItem);
+ while ((!(item.hItem = TreeView_GetNextSibling(hwnd2Tree, lastItem))) && (lastItem = item.hItem = TreeView_GetParent(hwnd2Tree, lastItem)));
+
+ } while (item.hItem);
return -1;
}
@@ -220,39 +222,39 @@ void freeTree(HWND hwnd2Tree, MCONTACT hContact) {
TVITEM item;
HTREEITEM lastItem;
- if (!TreeView_GetCount(hwnd2Tree)) return;
+ if (!TreeView_GetCount(hwnd2Tree))
+ return;
- item.mask = TVIF_STATE|TVIF_PARAM;
+ item.mask = TVIF_STATE | TVIF_PARAM;
item.hItem = TVI_ROOT;
do {
do {
lastItem = item.hItem;
if (lastItem != TVI_ROOT) {
- TreeView_GetItem( hwnd2Tree, &item );
+ TreeView_GetItem(hwnd2Tree, &item);
/* these next 2 lines are not from code guru..... */
if (item.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)item.lParam;
if (!hContact || (hContact == mtis->hContact)) {
if (hContact != NULL) {
- TreeView_DeleteItem(hwnd2Tree,item.hItem);
+ TreeView_DeleteItem(hwnd2Tree, item.hItem);
mir_free(mtis);
}
- else mtis->type = STUB;
+ else
+ mtis->type = STUB;
}
}
/* back to coduguru's code*/
}
- }
- while ( (item.hItem = TreeView_GetChild( hwnd2Tree, lastItem )));
+ } while (item.hItem = TreeView_GetChild(hwnd2Tree, lastItem));
- while ( (! (item.hItem = TreeView_GetNextSibling( hwnd2Tree, lastItem ))) && (lastItem = item.hItem = TreeView_GetParent( hwnd2Tree, lastItem ))) {}
+ while (!(item.hItem = TreeView_GetNextSibling(hwnd2Tree, lastItem)) && (lastItem = item.hItem = TreeView_GetParent(hwnd2Tree, lastItem))) {}
- }
- while (item.hItem);
+ } while (item.hItem);
}
-BOOL findAndRemoveDuplicates(HWND hwnd2Tree, MCONTACT hContact, char* module)
+BOOL findAndRemoveDuplicates(HWND hwnd2Tree, MCONTACT hContact, char *module)
/* the following code to go through the whole tree is nicked from codeguru..
http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?thread=7680 */
{
@@ -260,30 +262,26 @@ BOOL findAndRemoveDuplicates(HWND hwnd2Tree, MCONTACT hContact, char* module) HTREEITEM lastItem, prelastItem;
BOOL Result = 0;
char text[265];
- if (!TreeView_GetCount(hwnd2Tree)) return Result;
+ if (!TreeView_GetCount(hwnd2Tree))
+ return Result;
- item.mask = TVIF_STATE|TVIF_PARAM|TVIF_TEXT;
+ item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
item.hItem = TVI_ROOT;
item.pszText = text;
item.cchTextMax = 264;
prelastItem = item.hItem;
- do
- {
- do
- {
+ do {
+ do {
lastItem = item.hItem;
- if (lastItem != TVI_ROOT)
- {
- TreeView_GetItem( hwnd2Tree, &item );
+ if (lastItem != TVI_ROOT) {
+ TreeView_GetItem(hwnd2Tree, &item);
/* these next lines are not from code guru..... */
- if (item.lParam)
- {
+ if (item.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)item.lParam;
- if (hContact == mtis->hContact && !mir_strcmp(text,module))
- {
+ if (hContact == mtis->hContact && !mir_strcmp(text,module)) {
mir_free(mtis);
- TreeView_DeleteItem(hwnd2Tree,item.hItem);
+ TreeView_DeleteItem(hwnd2Tree, item.hItem);
lastItem = prelastItem;
Result = 1;
}
@@ -292,8 +290,9 @@ BOOL findAndRemoveDuplicates(HWND hwnd2Tree, MCONTACT hContact, char* module) }
/* back to coduguru's code*/
}
- } while ( (item.hItem = TreeView_GetChild( hwnd2Tree, lastItem )));
- while ( (! (item.hItem = TreeView_GetNextSibling( hwnd2Tree, lastItem ))) && (lastItem = item.hItem = TreeView_GetParent( hwnd2Tree, lastItem ))) {}
+ } while (item.hItem = TreeView_GetChild(hwnd2Tree, lastItem));
+
+ while (!(item.hItem = TreeView_GetNextSibling(hwnd2Tree, lastItem)) && (lastItem = item.hItem = TreeView_GetParent(hwnd2Tree, lastItem))) {}
} while ( item.hItem );
/*****************************************************************************/
@@ -304,12 +303,13 @@ BOOL findAndRemoveDuplicates(HWND hwnd2Tree, MCONTACT hContact, char* module) void replaceTreeItem(HWND hwnd, MCONTACT hContact, const char *module, const char *newModule)
{
- int hItem = findItemInTree(hwnd, hContact, (char*)module);
+ int hItem = findItemInTree(hwnd, hContact, (char *)module);
HTREEITEM hParent;
- if (hItem == -1) return;
+ if (hItem == -1)
+ return;
- hParent = TreeView_GetParent(hwnd,(HTREEITEM)hItem);
+ hParent = TreeView_GetParent(hwnd, (HTREEITEM)hItem);
{
TVITEM item;
@@ -318,18 +318,17 @@ void replaceTreeItem(HWND hwnd, MCONTACT hContact, const char *module, const cha if (TreeView_GetItem(hwnd, &item))
mir_free((ModuleTreeInfoStruct *)item.lParam);
- TreeView_DeleteItem(hwnd,item.hItem);
+ TreeView_DeleteItem(hwnd, item.hItem);
}
- if (hParent && newModule)
- {
+ if (hParent && newModule) {
TVINSERTSTRUCT tvi = {0};
ModuleTreeInfoStruct *lParam;
tvi.hParent = hParent;
tvi.hInsertAfter = TVI_SORT;
- tvi.item.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
- tvi.item.pszText = (char*)newModule;
+ tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
+ tvi.item.pszText = (char *)newModule;
lParam = (ModuleTreeInfoStruct *)mir_calloc(sizeof(ModuleTreeInfoStruct));
lParam->hContact = hContact;
@@ -345,15 +344,16 @@ void replaceTreeItem(HWND hwnd, MCONTACT hContact, const char *module, const cha void refreshTree(int restore)
{
- if (populating) return;
+ if (populating)
+ return;
populating = 1;
- forkthread(PopulateModuleTreeThreadFunc,0,(HWND)restore);
+ forkthread(PopulateModuleTreeThreadFunc, 0, (HWND)restore);
}
void __cdecl PopulateModuleTreeThreadFunc(LPVOID di)
{
TVINSERTSTRUCT tvi;
- HWND hwnd2Tree = GetDlgItem(hwnd2mainWindow,IDC_MODULES);
+ HWND hwnd2Tree = GetDlgItem(hwnd2mainWindow, IDC_MODULES);
char SelectedModule[256] = {0};
char SelectedSetting[256] = {0};
MCONTACT hSelectedContact = hRestore;
@@ -370,14 +370,17 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) hRestore = NULL;
- if (!hwnd2Tree) { msg(Translate("Module tree not found"),modFullname); return;}
+ if (!hwnd2Tree) {
+ msg(Translate("Module tree not found"), modFullname);
+ return;
+ }
Select = 0;
- switch((int)di) {
+ switch ((int)di) {
case 1: // restore after rebuild
if (HTREEITEM item = TreeView_GetSelection(hwnd2Tree)) {
- TVITEM tvi = { 0 };
+ TVITEM tvi = {0};
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.pszText = SelectedModule;
tvi.cchTextMax = 255;
@@ -387,7 +390,8 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) if (tvi.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
hSelectedContact = mtis->hContact;
- if (mtis->type == CONTACT) SelectedModule[0] = 0;
+ if (mtis->type == CONTACT)
+ SelectedModule[0] = 0;
Select = 1;
}
}
@@ -411,7 +415,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) if ((int)di != 4) { // do not rebuild on just going to another setting
if (!EnumModules(&modlist)) {
- msg(Translate("Error Loading Module List"), modFullname);
+ msg(Translate("Error loading module list"), modFullname);
return;
}
@@ -446,7 +450,8 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) tvi.hParent = NULL;
tvi.hInsertAfter = TVI_FIRST;
tvi.item.pszText = Translate("Settings");
- tvi.item.iSelectedImage = (tvi.item.iImage = 0);
+ tvi.item.iImage = 0;
+ tvi.item.iSelectedImage = 0;
contact = TreeView_InsertItem(hwnd2Tree, &tvi);
// to fix bug with CHANGE NOTIFY on window activation
@@ -483,7 +488,8 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) if (hItem != -1) {
TreeView_SelectItem(hwnd2Tree, (HTREEITEM)hItem);
TreeView_Expand(hwnd2Tree, hItem, TVE_EXPAND);
- if (SelectedSetting[0]) SelectSetting(SelectedSetting);
+ if (SelectedSetting[0])
+ SelectSetting(SelectedSetting);
}
Select = 0;
}
@@ -500,7 +506,8 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) if (hItem != -1) {
TreeView_SelectItem(hwnd2Tree, (HTREEITEM)hItem);
TreeView_Expand(hwnd2Tree, hItem, TVE_EXPAND);
- if (SelectedSetting[0]) SelectSetting(SelectedSetting);
+ if (SelectedSetting[0])
+ SelectSetting(SelectedSetting);
}
}
@@ -508,7 +515,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) }
-static LRESULT CALLBACK ModuleTreeLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+static LRESULT CALLBACK ModuleTreeLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_KEYUP:
@@ -525,18 +532,18 @@ static LRESULT CALLBACK ModuleTreeLabelEditSubClassProc(HWND hwnd,UINT msg,WPARA return mir_callNextSubclass(hwnd, ModuleTreeLabelEditSubClassProc, msg, wParam, lParam);
}
-void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam);
+void moduleListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam);
void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hwnd here is to the main window, NOT the treview
{
- switch (((NMHDR*)lParam)->code) {
+ switch (((NMHDR *)lParam)->code) {
case TVN_ITEMEXPANDINGA:
case TVN_ITEMEXPANDINGW:
if (populating && ((LPNMTREEVIEW)lParam)->action == TVE_EXPAND) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)((LPNMTREEVIEW)lParam)->itemNew.lParam;
if (mtis && (mtis->type == (CONTACT | EMPTY))) {
TVINSERTSTRUCT tvi;
- HTREEITEM item = { 0 };
+ HTREEITEM item = {0};
ModuleTreeInfoStruct *_lParam;
HWND hwnd2Tree = GetDlgItem(hwnd2mainWindow, IDC_MODULES);
ModSetLinkLinkItem *module;
@@ -545,7 +552,10 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw mtis->type = CONTACT;
- if (!EnumModules(&modlist)) { msg(Translate("Error Loading Module List"), modFullname); break; }
+ if (!EnumModules(&modlist)) {
+ msg(Translate("Error loading module list"), modFullname);
+ break;
+ }
module = modlist.first;
while (module && hwnd2mainWindow) {
@@ -578,7 +588,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw {
ModuleTreeInfoStruct *mtis;
LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam;
- TVITEM tvi = { 0 };
+ TVITEM tvi = {0};
char text[264];
MCONTACT hContact;
HWND hwnd2Settings = GetDlgItem(hwnd, IDC_SETTINGS);
@@ -592,17 +602,18 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw mtis = (ModuleTreeInfoStruct *)tvi.lParam;
hContact = mtis->hContact;
- if (mtis->type == STUB) break;
+ if (mtis->type == STUB)
+ break;
- if (populating) Select = 0;
+ if (populating)
+ Select = 0;
if (mtis->type == MODULE) {
- SettingListInfo *info = (SettingListInfo*)GetWindowLongPtr(hwnd2Settings, GWLP_USERDATA);
+ SettingListInfo *info = (SettingListInfo *)GetWindowLongPtr(hwnd2Settings, GWLP_USERDATA);
BOOL refresh = 1;
if (info) {
- if (info->hContact == hContact &&
- !mir_strcmp(info->module, text))
+ if (info->hContact == hContact && !mir_strcmp(info->module, text))
refresh = 0;
}
@@ -612,13 +623,14 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw else if (((mtis->type & CONTACT) == CONTACT && hContact) || (mtis->type == CONTACT_ROOT_ITEM && !hContact)) {
char data[32], szProto[256];
int index, loaded, multi = 0;
- LVITEM lvi = { 0 };
+ LVITEM lvi = {0};
lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
lvi.iImage = 6;
ClearListview(hwnd2Settings);
SetWindowLongPtr(hwnd2Settings, GWLP_USERDATA, 0);
- if (himl2) ListView_SetImageList(hwnd2Settings, himl2, LVSIL_SMALL);
+ if (himl2)
+ ListView_SetImageList(hwnd2Settings, himl2, LVSIL_SMALL);
if (mtis->type == CONTACT_ROOT_ITEM && !hContact) {
multi = 1;
@@ -640,7 +652,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw }
lvi.iItem = 0;
- lvi.pszText = (char*)GetContactName(hContact, NULL, FALSE);
+ lvi.pszText = (char *)GetContactName(hContact, NULL, FALSE);
index = ListView_InsertItem(hwnd2Settings, &lvi);
@@ -650,12 +662,14 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw ListView_SetItemText(hwnd2Settings, index, 2, Translate("HANDLE"));
ListView_SetItemText(hwnd2Settings, index, 3, "0x0004 (4)");
- if (!multi) break;
+ if (!multi)
+ break;
hContact = db_find_next(hContact);
}
}
- else ClearListview(hwnd2Settings);
+ else
+ ClearListview(hwnd2Settings);
}
else // clear any settings that may be there...
ClearListview(hwnd2Settings);
@@ -663,7 +677,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw break; //TVN_SELCHANGED:
case NM_RCLICK:
- if (((NMHDR*)lParam)->code == NM_RCLICK)
+ if (((NMHDR *)lParam)->code == NM_RCLICK)
moduleListRightClick(hwnd, wParam, lParam);
break;
@@ -685,7 +699,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw case TVN_ENDLABELEDITA:
case TVN_ENDLABELEDITW:
LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lParam;
- TVITEM tvi = { 0 };
+ TVITEM tvi = {0};
char text[264];
char *newtext;
ModuleTreeInfoStruct *mtis;
@@ -696,12 +710,12 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
mtis = (ModuleTreeInfoStruct *)ptvdi->item.lParam;
- newtext = u2a((WCHAR*)ptvdi->item.pszText);
+ newtext = u2a((WCHAR *)ptvdi->item.pszText);
- if (!newtext || // edit control failed
- !mtis->type || // its a root item
- mtis->type == CONTACT || // its a contact
- *newtext == 0) // empty string
+ if (!newtext // edit control failed
+ || !mtis->type // its a root item
+ || mtis->type == CONTACT // its a contact
+ || *newtext == 0) // empty string
SetWindowLongPtr(hwnd, DWLP_MSGRESULT, FALSE);
else {
if (mir_strcmp(tvi.pszText, newtext)) {
@@ -735,7 +749,7 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam) // hwnd here if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
if (hti.flags & TVHT_ONITEM) {
- TVITEM tvi = { 0 };
+ TVITEM tvi = {0};
HMENU hMenu, hSubMenu;
int menuNumber;
char module[256];
@@ -747,14 +761,19 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam) // hwnd here if (tvi.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
MCONTACT hContact = mtis->hContact;
- GetCursorPos(&(hti.pt));
+ GetCursorPos(&hti.pt);
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXTMENU));
TranslateMenu(hMenu);
- if (mtis->type == CONTACT && hContact) menuNumber = 2;
- else if ((mtis->type == MODULE) && !hContact) menuNumber = 1;
- else if (mtis->type == CONTACT && !hContact) menuNumber = 3;
- else if (mtis->type == CONTACT_ROOT_ITEM && !hContact) menuNumber = 4;
- else if ((mtis->type == MODULE) && hContact) menuNumber = 5;
+ if (mtis->type == CONTACT && hContact)
+ menuNumber = 2;
+ else if ((mtis->type == MODULE) && !hContact)
+ menuNumber = 1;
+ else if (mtis->type == CONTACT && !hContact)
+ menuNumber = 3;
+ else if (mtis->type == CONTACT_ROOT_ITEM && !hContact)
+ menuNumber = 4;
+ else if ((mtis->type == MODULE) && hContact)
+ menuNumber = 5;
else return;
hSubMenu = GetSubMenu(hMenu, menuNumber);
@@ -825,7 +844,7 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam) // hwnd here if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
char msg[1024];
mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete contact \"%s\"?"), module);
- if (MessageBox(0, msg, Translate("Confirm Contact Delete"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES) {
+ if (MessageBox(0, msg, Translate("Confirm contact delete"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES) {
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
freeTree(((LPNMHDR)lParam)->hwndFrom, hContact);
TreeView_DeleteItem(((LPNMHDR)lParam)->hwndFrom, tvi.hItem);
|