summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2016-12-06 14:22:46 +0300
committerGeorge Hazan <ghazan@miranda.im>2016-12-06 14:23:55 +0300
commitc8e8e884a6a632c5766eddab2d84c6a6b2216d6c (patch)
treedb983f5c371bd7f3c5190dcd6f6f3171947ad105
parent8271ae317370f9c27de576075a2d779ccaf9a560 (diff)
StdMsg & Scriver:
- switched to the toolbar buttons instead of the fixed button set; - switched to the shared windows list
-rw-r--r--include/m_message.h5
-rw-r--r--plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc1
-rw-r--r--plugins/Scriver/res/resource.rc23
-rw-r--r--plugins/Scriver/src/chat/chat.h3
-rw-r--r--plugins/Scriver/src/chat/main.cpp6
-rw-r--r--plugins/Scriver/src/chat/options.cpp149
-rw-r--r--plugins/Scriver/src/chat/window.cpp113
-rw-r--r--plugins/Scriver/src/globals.cpp2
-rw-r--r--plugins/Scriver/src/msgdialog.cpp109
-rw-r--r--plugins/Scriver/src/msgoptions.cpp71
-rw-r--r--plugins/Scriver/src/msgs.cpp107
-rw-r--r--plugins/Scriver/src/resource.h5
-rw-r--r--plugins/Scriver/src/stdafx.h1
-rw-r--r--plugins/Scriver/src/utils.cpp72
-rw-r--r--plugins/Scriver/src/utils.h5
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp193
-rw-r--r--plugins/SmileyAdd/src/download.cpp2
-rw-r--r--plugins/SmileyAdd/src/main.cpp7
-rw-r--r--plugins/SmileyAdd/src/options.cpp93
-rw-r--r--plugins/SmileyAdd/src/stdafx.h11
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp21
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp25
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp28
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp1
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp3
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp19
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.h1
-rw-r--r--plugins/TabSRMM/src/msgs.h57
-rw-r--r--plugins/TabSRMM/src/resource.h1
-rw-r--r--src/core/stdmsg/res/resource.rc14
-rw-r--r--src/core/stdmsg/src/chat_window.cpp126
-rw-r--r--src/core/stdmsg/src/globals.cpp13
-rw-r--r--src/core/stdmsg/src/globals.h1
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp384
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp11
-rw-r--r--src/core/stdmsg/src/msgs.cpp113
-rw-r--r--src/core/stdmsg/src/msgtimedout.cpp4
-rw-r--r--src/core/stdmsg/src/resource.h1
-rw-r--r--src/core/stdmsg/src/srmm.cpp4
-rw-r--r--src/core/stdmsg/src/statusicon.cpp4
-rw-r--r--src/mir_app/src/srmm_toolbar.cpp6
41 files changed, 845 insertions, 970 deletions
diff --git a/include/m_message.h b/include/m_message.h
index f5106c4ce9..6136e50676 100644
--- a/include/m_message.h
+++ b/include/m_message.h
@@ -244,9 +244,8 @@ struct BBButton
wchar_t *pwszTooltip;
DWORD dwDefPos; // default order pos of button, counted from window edge (left or right)
// use value >100, because internal buttons using 10,20,30... 80, etc
- int iButtonWidth; // must be 0
DWORD bbbFlags; // combine of BBBF_ flags above
- HANDLE hIcon; // Handle to icolib registered icon, it's better to register with pszSection = "TabSRMM/Toolbar"
+ HANDLE hIcon; // Handle to icolib registered icon
};
// adds a new toolbar button
@@ -290,7 +289,7 @@ EXTERN_C MIR_APP_DLL(void) Srmm_RedrawToolbarIcons(HWND hwndDlg);
EXTERN_C MIR_APP_DLL(void) Srmm_ClickToolbarIcon(MCONTACT hContact, DWORD idFrom, HWND hwndFrom, BOOL code);
// wParam = (HANDLE)hContact;
-// lParam = (CustomButtonClickData *)&CustomButtonClickData;
+// lParam = (CustomButtonClickData*) pointer to the click data;
// catch to show a popup menu, etc.
#define ME_MSG_BUTTONPRESSED "SRMM/ButtonsBar/ButtonPressed"
diff --git a/plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc b/plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc
index 2db75cc7e5..593773019a 100644
--- a/plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc
+++ b/plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc
@@ -62,7 +62,6 @@ type
szTooltip :PWideChar; // button's tooltip
dwDefPos :dword; // default order pos of button, counted from window edge (left or right)
// use value >100, because internal buttons using 10,20,30... 80, etc
- iButtonWidth :int; // must be 0
bbbFlags :dword; // combine of BBBF_ flags above
hIcon :HICON; // Handle to icolib registered icon, it's better to register with pszSection = "TabSRMM/Toolbar"
end;
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc
index 6d0b45a9f1..59e03ef0ee 100644
--- a/plugins/Scriver/res/resource.rc
+++ b/plugins/Scriver/res/resource.rc
@@ -204,13 +204,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "",IDC_LOG,"RichEdit50W",WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP | 0x844,1,41,181,28,WS_EX_STATICEDGE
CONTROL "",IDC_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,87,181,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
- CONTROL "&User menu",IDC_USERMENU,"MButtonClass",0x0,1,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "User &details",IDC_DETAILS,"MButtonClass",0x0,17,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Add",IDC_ADD,"MButtonClass",0x0,110,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&History",IDC_HISTORY,"MButtonClass",0x0,130,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Quote",IDC_QUOTE,"MButtonClass",0x0,130,71,16,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&OK",IDOK,"MButtonClass",0x0,162,71,20,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "",IDC_SPLITTER,"Static",SS_ENHMETAFILE | WS_CLIPSIBLINGS,0,85,183,2
+ CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE | WS_CLIPSIBLINGS,0,85,183,2
CONTROL "",IDC_AVATAR,"Static",SS_OWNERDRAW,180,80,0,0
END
@@ -232,20 +226,9 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "",IDC_CHAT_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,0,128,127,12,WS_EX_STATICEDGE
- CONTROL "&Bold",IDC_CHAT_BOLD,"MButtonClass",WS_DISABLED | WS_TABSTOP,24,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Italic",IDC_CHAT_ITALICS,"MButtonClass",WS_DISABLED | WS_TABSTOP,36,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Underline",IDC_CHAT_UNDERLINE,"MButtonClass",WS_DISABLED | WS_TABSTOP,52,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Color",IDC_CHAT_COLOR,"MButtonClass",WS_DISABLED | WS_TABSTOP,80,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Background color",IDC_CHAT_BKGCOLOR,"MButtonClass",WS_DISABLED | WS_TABSTOP,96,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&History",IDC_CHAT_HISTORY,"MButtonClass",WS_TABSTOP,188,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&OK",IDOK,"MButtonClass",0x0,162,71,20,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Filter",IDC_CHAT_FILTER,"MButtonClass",WS_TABSTOP,220,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Room settings",IDC_CHAT_CHANMGR,"MButtonClass",WS_DISABLED | WS_TABSTOP,204,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Show/hide nick list",IDC_CHAT_SHOWNICKLIST,
- "MButtonClass",WS_TABSTOP,236,108,15,13,WS_EX_NOACTIVATE | 0x10000000L
CONTROL "",IDC_CHAT_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,8,23,164,73,WS_EX_STATICEDGE
- CONTROL "",IDC_CHAT_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
- CONTROL "",IDC_CHAT_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
+ CONTROL "",IDC_SPLITTERX,"Static",SS_ENHMETAFILE,172,23,10,73
+ CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,102,251,6
LISTBOX IDC_CHAT_LIST,182,23,69,73,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
END
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h
index e1d2c3a693..adb495934c 100644
--- a/plugins/Scriver/src/chat/chat.h
+++ b/plugins/Scriver/src/chat/chat.h
@@ -81,9 +81,6 @@ void FreeMsgLogBitmaps(void);
// window.c
int GetTextPixelSize( wchar_t* pszText, HFONT hFont, BOOL bWidth);
-// options.c
-int OptionsInit(void);
-
// services.c
void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground);
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp
index 06b0235d2b..b0379b0743 100644
--- a/plugins/Scriver/src/chat/main.cpp
+++ b/plugins/Scriver/src/chat/main.cpp
@@ -193,9 +193,3 @@ int Chat_Unload(void)
DestroyMenu(g_hMenu);
return 0;
}
-
-int Chat_ModulesLoaded(WPARAM, LPARAM)
-{
- OptionsInit();
- return 0;
-}
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp
index 3108e26592..a9b59f3005 100644
--- a/plugins/Scriver/src/chat/options.cpp
+++ b/plugins/Scriver/src/chat/options.cpp
@@ -50,8 +50,8 @@ static struct branch_t branch1[] = {
static struct branch_t branch2[] = {
{ LPGENW("Show icons"), "IconFlags", GC_EVENT_TOPIC | GC_EVENT_JOIN | GC_EVENT_QUIT |
- GC_EVENT_MESSAGE | GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT | GC_EVENT_PART |
- GC_EVENT_KICK | GC_EVENT_NOTICE | GC_EVENT_NICK | GC_EVENT_INFORMATION | GC_EVENT_ADDSTATUS, 0, NULL },
+ GC_EVENT_MESSAGE | GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT | GC_EVENT_PART |
+ GC_EVENT_KICK | GC_EVENT_NOTICE | GC_EVENT_NICK | GC_EVENT_INFORMATION | GC_EVENT_ADDSTATUS, 0, NULL },
{ LPGENW("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL },
{ LPGENW("Only prefix with timestamp if it has changed"), "ShowTimeStampIfChanged", 0, 0, NULL },
{ LPGENW("Timestamp has same color as event"), "TimeStampEventColour", 0, 0, NULL },
@@ -225,7 +225,7 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p
static void InitSetting(wchar_t **ppPointer, char *pszSetting, wchar_t *pszDefault)
{
DBVARIANT dbv;
- if ( !db_get_ws(NULL, CHAT_MODULE, pszSetting, &dbv )) {
+ if (!db_get_ws(NULL, CHAT_MODULE, pszSetting, &dbv)) {
replaceStrW(*ppPointer, dbv.ptszVal);
db_free(&dbv);
}
@@ -234,18 +234,18 @@ static void InitSetting(wchar_t **ppPointer, char *pszSetting, wchar_t *pszDefau
#define OPT_FIXHEADINGS (WM_USER+1)
-INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HTREEITEM hListHeading1 = 0;
- static HTREEITEM hListHeading4= 0;
+ static HTREEITEM hListHeading4 = 0;
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETRANGE,0,MAKELONG(255,10));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,CHAT_MODULE,"NicklistRowDist",12),0));
- hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance and functionality of chat windows"), db_get_b(NULL, CHAT_MODULE, "Branch1Exp", 0)?TRUE:FALSE);
- hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Icons to display in the tray"), db_get_b(NULL, CHAT_MODULE, "Branch5Exp", 0)?TRUE:FALSE);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(255, 10));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12), 0));
+ hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance and functionality of chat windows"), db_get_b(NULL, CHAT_MODULE, "Branch1Exp", 0) ? TRUE : FALSE);
+ hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Icons to display in the tray"), db_get_b(NULL, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, _countof(branch4), 0x1000);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
@@ -263,7 +263,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
break;
case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_CHAT_NICKROW || LOWORD(wParam) == IDC_CHAT_GROUP) && (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()))
+ if ((LOWORD(wParam) == IDC_CHAT_NICKROW || LOWORD(wParam) == IDC_CHAT_GROUP) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return 0;
if (lParam != 0)
@@ -272,10 +272,10 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
case UM_CHECKSTATECHANGE:
{
- TVITEM tvi = {0};
- tvi.mask=TVIF_HANDLE|TVIF_STATE;
- tvi.hItem=(HTREEITEM) lParam;
- TreeView_GetItem((HWND)wParam,&tvi);
+ TVITEM tvi = { 0 };
+ tvi.mask = TVIF_HANDLE | TVIF_STATE;
+ tvi.hItem = (HTREEITEM)lParam;
+ TreeView_GetItem((HWND)wParam, &tvi);
if (tvi.hItem == hListHeading1)
CheckBranches(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1);
else if (tvi.hItem == hListHeading4)
@@ -287,23 +287,23 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
break;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_CHAT_CHECKBOXES:
- if (((LPNMHDR)lParam)->code==NM_CLICK) {
+ if (((LPNMHDR)lParam)->code == NM_CLICK) {
TVHITTESTINFO hti;
- hti.pt.x=(short)LOWORD(GetMessagePos());
- hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti))
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti))
if (hti.flags&TVHT_ONITEMSTATEICON) {
SendMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)hti.hItem);
}
}
else if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE)
+ if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)
SendMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom,
- (LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom));
+ (LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom));
}
break;
@@ -334,34 +334,34 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
break;
case WM_DESTROY:
- BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
+ BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
db_set_b(NULL, CHAT_MODULE, "Branch1Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
+ b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
db_set_b(NULL, CHAT_MODULE, "Branch5Exp", b);
break;
}
return FALSE;
}
-INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static HTREEITEM hListHeading2= 0;
- static HTREEITEM hListHeading3= 0;
+ static HTREEITEM hListHeading2 = 0;
+ static HTREEITEM hListHeading3 = 0;
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETRANGE,0,MAKELONG(5000,0));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,CHAT_MODULE,"LogLimit",100),0));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETRANGE,0,MAKELONG(10000,0));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,CHAT_MODULE,"LoggingLimit",100),0));
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LogLimit", 100), 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(10000, 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100), 0));
{
wchar_t tszTemp[MAX_PATH];
PathToRelativeW(g_Settings.pszLogDir, tszTemp);
SetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, tszTemp);
}
-
+
wchar_t tszTooltipText[2048];
RECT rect;
@@ -427,22 +427,22 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
break;
case WM_COMMAND:
- if ( (LOWORD(wParam) == IDC_CHAT_INSTAMP
- || LOWORD(wParam) == IDC_CHAT_OUTSTAMP
- || LOWORD(wParam) == IDC_CHAT_TIMESTAMP
- || LOWORD(wParam) == IDC_CHAT_LOGLIMIT
- || LOWORD(wParam) == IDC_CHAT_HIGHLIGHTWORDS
- || LOWORD(wParam) == IDC_CHAT_LOGDIRECTORY
- || LOWORD(wParam) == IDC_CHAT_LOGTIMESTAMP
- || LOWORD(wParam) == IDC_CHAT_LIMIT)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
+ if ((LOWORD(wParam) == IDC_CHAT_INSTAMP
+ || LOWORD(wParam) == IDC_CHAT_OUTSTAMP
+ || LOWORD(wParam) == IDC_CHAT_TIMESTAMP
+ || LOWORD(wParam) == IDC_CHAT_LOGLIMIT
+ || LOWORD(wParam) == IDC_CHAT_HIGHLIGHTWORDS
+ || LOWORD(wParam) == IDC_CHAT_LOGDIRECTORY
+ || LOWORD(wParam) == IDC_CHAT_LOGTIMESTAMP
+ || LOWORD(wParam) == IDC_CHAT_LIMIT)
+ && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
switch (LOWORD(wParam)) {
case IDC_CHAT_LOGGING:
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY), IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED?TRUE:FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRCHOOSE), IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED?TRUE:FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIMIT), IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED?TRUE:FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIMITTEXT2), IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED?TRUE:FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY), IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRCHOOSE), IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIMIT), IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIMITTEXT2), IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED ? TRUE : FALSE);
break;
case IDC_CHAT_HIGHLIGHT:
@@ -480,10 +480,10 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
case UM_CHECKSTATECHANGE:
{
- TVITEM tvi = {0};
- tvi.mask=TVIF_HANDLE|TVIF_STATE;
- tvi.hItem=(HTREEITEM) lParam;
- TreeView_GetItem((HWND)wParam,&tvi);
+ TVITEM tvi = { 0 };
+ tvi.mask = TVIF_HANDLE | TVIF_STATE;
+ tvi.hItem = (HTREEITEM)lParam;
+ TreeView_GetItem((HWND)wParam, &tvi);
if (tvi.hItem == hListHeading2)
CheckBranches(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2);
else if (tvi.hItem == hListHeading3)
@@ -496,18 +496,18 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == IDC_CHAT_CHECKBOXES) {
- if (((LPNMHDR)lParam)->code==NM_CLICK) {
+ if (((LPNMHDR)lParam)->code == NM_CLICK) {
TVHITTESTINFO hti;
- hti.pt.x=(short)LOWORD(GetMessagePos());
- hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti))
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti))
if (hti.flags&TVHT_ONITEMSTATEICON) {
SendMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)hti.hItem);
}
}
- else if (((LPNMHDR) lParam)->code == TVN_KEYDOWN) {
- if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE) {
+ else if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE) {
SendMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom,
(LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom));
}
@@ -537,7 +537,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY));
if (iLen > 0) {
- wchar_t *pszText1 = (wchar_t*)malloc(iLen*sizeof(wchar_t)+2);
+ wchar_t *pszText1 = (wchar_t*)malloc(iLen*sizeof(wchar_t) + 2);
GetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, pszText1, iLen + 1);
db_set_ws(NULL, CHAT_MODULE, "LogDirectory", pszText1);
free(pszText1);
@@ -623,16 +623,16 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa
hPathTip = 0;
}
- BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
+ BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
db_set_b(NULL, CHAT_MODULE, "Branch2Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED?1:0;
+ b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
db_set_b(NULL, CHAT_MODULE, "Branch3Exp", b);
break;
}
return FALSE;
}
-static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
@@ -688,7 +688,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam
else if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)
SendMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom,
- (LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom));
+ (LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom));
}
break;
@@ -727,26 +727,3 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam
}
return FALSE;
}
-
-static int OptionsInitialize(WPARAM wParam, LPARAM)
-{
- if (g_dat.popupInstalled) {
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.position = 910000002;
- odp.hInstance = g_hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP);
- odp.szTitle.a = LPGEN("Messaging");
- odp.szGroup.a = LPGEN("Popups");
- odp.pfnDlgProc = DlgProcOptionsPopup;
- odp.flags = ODPF_BOLDGROUPS;
- Options_AddPage(wParam, &odp);
- }
-
- return 0;
-}
-
-int OptionsInit(void)
-{
- HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
- return 0;
-}
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index c895b9e179..81e1b92c12 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -21,19 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../stdafx.h"
-static ToolbarButton toolbarButtons[] = {
- { LPGENW("Bold"), IDC_CHAT_BOLD, 0, 4, 24 },
- { LPGENW("Italic"), IDC_CHAT_ITALICS, 0, 0, 24 },
- { LPGENW("Underline"), IDC_CHAT_UNDERLINE, 0, 0, 24 },
- { LPGENW("Text color"), IDC_CHAT_COLOR, 0, 0, 24 },
- { LPGENW("Background color"), IDC_CHAT_BKGCOLOR, 0, 0, 24 },
- { LPGENW("History"), IDC_CHAT_HISTORY, 1, 0, 24 },
- { LPGENW("Filter"), IDC_CHAT_FILTER, 1, 0, 24 },
- { LPGENW("Manager"), IDC_CHAT_CHANMGR, 1, 0, 24 },
- { LPGENW("Nick list"), IDC_CHAT_SHOWNICKLIST, 1, 0, 24 },
- { LPGENW("Send"), IDOK, 1, 0, 38 },
-};
-
struct MESSAGESUBDATA
{
time_t lastEnterTime;
@@ -76,44 +63,8 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
{
- SendDlgItemMessage(hwndDlg, IDC_CHAT_BOLD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_bold"));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_ITALICS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_italics"));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_UNDERLINE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_underline"));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_fgcol"));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_bkgcol"));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_history"));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_CHANMGR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_settings"));
SendDlgItemMessage(hwndDlg, IDC_CHAT_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(si->bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
SendDlgItemMessage(hwndDlg, IDC_CHAT_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(si->bFilterEnabled ? "chat_filter" : "chat_filter2"));
- SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SEND"));
-
- SendDlgItemMessage(hwndDlg, IDC_CHAT_BOLD, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_ITALICS, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_UNDERLINE, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_HISTORY, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SHOWNICKLIST, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_CHANMGR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_FILTER, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASFLATBTN, TRUE, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_CHAT_BOLD, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text bold (CTRL+B)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_ITALICS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text italicized (CTRL+I)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_UNDERLINE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text underlined (CTRL+U)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a background color for the text (CTRL+L)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a foreground color for the text (CTRL+K)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_HISTORY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show the history (CTRL+H)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SHOWNICKLIST, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show/hide the nick list (CTRL+N)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_CHANMGR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Control this room (CTRL+O)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_FILTER, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Enable/disable the event filter (CTRL+F)"), 0);
- SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Send message"), 0);
-
- SendDlgItemMessage(hwndDlg, IDC_CHAT_BOLD, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_ITALICS, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_UNDERLINE, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BUTTONSETASPUSHBTN, TRUE, 0);
MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
if (pInfo) {
@@ -132,9 +83,8 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
int logBottom, toolbarTopY;
BOOL bNick = si->iType != GCW_SERVER && si->bNicklistEnabled;
BOOL bToolbar = SendMessage(GetParent(hwndDlg), CM_GETTOOLBARSTATUS, 0, 0);
- int buttonVisibility = bToolbar ? g_dat.chatBbuttonVisibility : 0;
int hSplitterMinTop = TOOLBAR_HEIGHT + si->minLogBoxHeight, hSplitterMinBottom = si->minEditBoxHeight;
- int toolbarHeight = bToolbar ? IsToolbarVisible(_countof(toolbarButtons), g_dat.chatBbuttonVisibility) ? TOOLBAR_HEIGHT : TOOLBAR_HEIGHT / 3 : 0;
+ int toolbarHeight = TOOLBAR_HEIGHT;
si->iSplitterY = si->desiredInputAreaHeight + SPLITTER_HEIGHT + 3;
@@ -143,8 +93,7 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
if (si->iSplitterY < hSplitterMinBottom)
si->iSplitterY = hSplitterMinBottom;
- ShowToolbarControls(hwndDlg, _countof(toolbarButtons), toolbarButtons, buttonVisibility, SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), bNick ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), bNick ? SW_SHOW : SW_HIDE);
if (si->iType != GCW_SERVER)
ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
else
@@ -162,7 +111,7 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_CHANMGR), pci->MM_FindModule(si->pszModule)->bChanMgr);
}
- HDWP hdwp = BeginDeferWindowPos(20);
+ HDWP hdwp = BeginDeferWindowPos(5);
toolbarTopY = bToolbar ? h - si->iSplitterY - toolbarHeight : h - si->iSplitterY;
if (si->hwndLog != NULL)
logBottom = toolbarTopY / 2;
@@ -171,11 +120,13 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_LOG), 0, 1, 0, bNick ? w - si->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_LIST), 0, w - si->iSplitterX + 2, 0, si->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), 0, w - si->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY), 0, 0, h - si->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SPLITTERX), 0, w - si->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SPLITTERY), 0, 0, h - si->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), 0, 1, h - si->iSplitterY + SPLITTER_HEIGHT, w - 2, si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
- hdwp = ResizeToolbar(hwndDlg, hdwp, w, toolbarTopY + 1, toolbarHeight - 1, _countof(toolbarButtons), toolbarButtons, buttonVisibility);
EndDeferWindowPos(hdwp);
+
+ SetButtonsPos(hwndDlg);
+
if (si->hwndLog != NULL) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
@@ -986,7 +937,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_LOG));
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_LIST));
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc);
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NicklistSubclassProc);
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_LOG), LogSubclassProc);
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), ButtonSubclassProc);
@@ -994,6 +945,20 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_BKGCOLOR), ButtonSubclassProc);
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), MessageSubclassProc);
+ CustomButtonData *cbd;
+ for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
+ if (!cbd->m_bChatButton)
+ continue;
+
+ int width = (cbd->m_dwArrowCID) ? 34 : 22;
+ HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, width, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL);
+ SendMessage(hwndButton, BUTTONSETASFLATBTN, TRUE, 0);
+ if (cbd->m_pwszTooltip)
+ SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE);
+ if (cbd->m_hIcon)
+ SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon));
+ }
+
RECT minEditInit;
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), &minEditInit);
si->minEditBoxHeight = minEditInit.bottom - minEditInit.top;
@@ -1406,7 +1371,7 @@ LABEL_SHOWWINDOW:
break;
case GC_SPLITTERMOVED:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX)) {
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERX)) {
GetClientRect(hwndDlg, &rc);
pt.x = wParam; pt.y = 0;
ScreenToClient(hwndDlg, &pt);
@@ -1418,7 +1383,7 @@ LABEL_SHOWWINDOW:
si->iSplitterX = rc.right - rc.left - 35;
g_Settings.iSplitterX = si->iSplitterX;
}
- else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY)) {
+ else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY)) {
GetClientRect(hwndDlg, &rc);
pt.x = 0; pt.y = wParam;
ScreenToClient(hwndDlg, &pt);
@@ -1807,34 +1772,6 @@ LABEL_SHOWWINDOW:
SendMessage(GetParent(hwndDlg), WM_LBUTTONDOWN, wParam, lParam);
return TRUE;
- case WM_RBUTTONUP:
- hToolbarMenu = CreatePopupMenu();
- for (int i = 0; i < _countof(toolbarButtons); i++) {
- MENUITEMINFO mii = { 0 };
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE | MIIM_DATA | MIIM_BITMAP;
- mii.fType = MFT_STRING;
- mii.fState = (g_dat.chatBbuttonVisibility & (1 << i)) ? MFS_CHECKED : MFS_UNCHECKED;
- mii.wID = i + 1;
- mii.dwItemData = (ULONG_PTR)g_dat.hChatButtonIconList;
- mii.hbmpItem = HBMMENU_CALLBACK;
- mii.dwTypeData = TranslateW((toolbarButtons[i].name));
- InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
- }
-
- pt.x = (short)LOWORD(GetMessagePos());
- pt.y = (short)HIWORD(GetMessagePos());
- {
- int res = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if (res > 0) {
- g_dat.chatBbuttonVisibility ^= (1 << (res - 1));
- db_set_dw(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, g_dat.chatBbuttonVisibility);
- pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
- }
- }
- DestroyMenu(hToolbarMenu);
- return TRUE;
-
case DM_GETCONTEXTMENU:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LPARAM)Menu_BuildContactMenu(si->hContact));
return TRUE;
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index cf50d1ad42..ea52bcf287 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -25,8 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
GlobalMessageData g_dat;
-int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam);
-
static const char *buttonIcons[] =
{
"scriver_CLOSEX", "scriver_QUOTE", "scriver_ADD", NULL,
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 70156a8b2b..d2aa4d42f0 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -32,16 +32,6 @@ extern HANDLE hHookWinEvt;
static void UpdateReadChars(HWND hwndDlg, SrmmWindowData * dat);
-static ToolbarButton toolbarButtons[] =
-{
- { LPGENW("Quote"), IDC_QUOTE, 0, 4, 24 },
- { LPGENW("Add contact"), IDC_ADD, 0, 10, 24 },
- { LPGENW("User menu"), IDC_USERMENU, 1, 0, 24 },
- { LPGENW("User details"), IDC_DETAILS, 1, 0, 24 },
- { LPGENW("History"), IDC_HISTORY, 1, 0, 24 },
- { LPGENW("Send"), IDOK, 1, 0, 38 }
-};
-
static wchar_t* GetIEViewSelection(SrmmWindowData *dat)
{
IEVIEWEVENT evt = { sizeof(evt) };
@@ -189,12 +179,20 @@ static void SetDialogToType(HWND hwndDlg)
else
ShowWindow(dat->infobarData->hWnd, SW_HIDE);
- if (dat->hContact) {
- ShowToolbarControls(hwndDlg, _countof(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
- if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
- ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
+ CustomButtonData *cbd;
+ for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
+ HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
+ if (hwndButton == NULL)
+ continue;
+
+ if (dat->hContact) {
+ if (cbd->m_dwButtonCID == IDC_ADD && !db_get_b(dat->hContact, "CList", "NotOnList", 0))
+ ShowWindow(hwndButton, SW_HIDE);
+ else
+ ShowWindow(hwndButton, showToolbar ? SW_SHOW : SW_HIDE);
+ }
+ else ShowWindow(hwndButton, SW_HIDE);
}
- else ShowToolbarControls(hwndDlg, _countof(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), SW_SHOW);
if (dat->hwndLog != NULL)
@@ -202,7 +200,7 @@ static void SetDialogToType(HWND hwndDlg)
else
ShowWindow(GetDlgItem(hwndDlg, IDC_LOG), SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTERY), SW_SHOW);
UpdateReadChars(hwndDlg, dat);
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, FALSE) ? TRUE : FALSE);
SendMessage(hwndDlg, DM_CLISTSETTINGSCHANGED, 0, 0);
@@ -453,7 +451,7 @@ static void SubclassLogEdit(HWND hwnd)
static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h)
{
ParentWindowData *pdat = dat->parent;
- int hSplitterPos = dat->splitterPos, toolbarHeight = (pdat->flags2 & SMF2_SHOWTOOLBAR) ? IsToolbarVisible(_countof(toolbarButtons), g_dat.buttonVisibility) ? dat->toolbarSize.cy : dat->toolbarSize.cy / 3 : 0;
+ int hSplitterPos = dat->splitterPos, toolbarHeight = dat->toolbarSize.cy;
int hSplitterMinTop = toolbarHeight + dat->minLogBoxHeight, hSplitterMinBottom = dat->minEditBoxHeight;
int infobarInnerHeight = INFO_BAR_INNER_HEIGHT;
int infobarHeight = INFO_BAR_HEIGHT;
@@ -484,7 +482,7 @@ static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h)
hSplitterPos = hSplitterMinBottom;
if (!(pdat->flags2 & SMF2_SHOWINFOBAR)) {
- if (dat->avatarPic && (g_dat.flags&SMF_AVATAR)) {
+ if (dat->avatarPic && (g_dat.flags & SMF_AVATAR)) {
avatarWidth = BOTTOM_RIGHT_AVATAR_HEIGHT;
avatarHeight = toolbarHeight + hSplitterPos - 2;
if (avatarHeight < BOTTOM_RIGHT_AVATAR_HEIGHT) {
@@ -510,17 +508,16 @@ static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h)
logY = infobarInnerHeight;
logH = h - hSplitterPos - toolbarHeight - infobarInnerHeight;
- HDWP hdwp = BeginDeferWindowPos(15);
- if (NULL != dat->infobarData->hWnd) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, dat->infobarData->hWnd, 0, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER);
+ HDWP hdwp = BeginDeferWindowPos(5);
+ hdwp = DeferWindowPos(hdwp, dat->infobarData->hWnd, 0, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_LOG), 0, 1, logY, w - 2, logH, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 1, h - hSplitterPos + SPLITTER_HEIGHT, messageEditWidth, hSplitterPos - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_AVATAR), 0, w - avatarWidth - 1, h - (avatarHeight + avatarWidth) / 2 - 1, avatarWidth, avatarWidth, SWP_NOZORDER);
-
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SPLITTER), 0, 0, h - hSplitterPos - 1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
- hdwp = ResizeToolbar(hwndDlg, hdwp, toolbarWidth, h - hSplitterPos - toolbarHeight + 1, toolbarHeight, _countof(toolbarButtons), toolbarButtons, g_dat.buttonVisibility);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SPLITTERY), 0, 0, h - hSplitterPos - 1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
+ SetButtonsPos(hwndDlg);
+
if (dat->hwndLog != NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_SETPOS;
@@ -664,8 +661,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
LPNMHDR pNmhdr;
HCURSOR hCur;
- static HMENU hToolbarMenu;
-
SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (!dat && msg != WM_INITDIALOG)
return FALSE;
@@ -748,7 +743,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->minEditBoxHeight = minEditInit.bottom - minEditInit.top;
dat->minLogBoxHeight = dat->minEditBoxHeight;
dat->toolbarSize.cy = TOOLBAR_HEIGHT;
- dat->toolbarSize.cx = GetToolbarWidth(_countof(toolbarButtons), toolbarButtons);
+ dat->toolbarSize.cx = 0;
if (dat->splitterPos == -1)
dat->splitterPos = dat->minEditBoxHeight;
@@ -765,18 +760,19 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
}
- SendMessage(hwndDlg, DM_CHANGEICONS, 0, 0);
- // Make them flat buttons
- for (int i = 0; i < _countof(toolbarButtons); i++)
- SendDlgItemMessage(hwndDlg, toolbarButtons[i].controlId, BUTTONSETASFLATBTN, TRUE, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_ADD, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Add contact permanently to list"), 0);
- SendDlgItemMessage(hwndDlg, IDC_USERMENU, BUTTONADDTOOLTIP, (WPARAM)LPGEN("User menu"), 0);
- SendDlgItemMessage(hwndDlg, IDC_DETAILS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("View user's details"), 0);
- SendDlgItemMessage(hwndDlg, IDC_HISTORY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("View user's history"), 0);
-
- SendDlgItemMessage(hwndDlg, IDC_QUOTE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Quote text"), 0);
- SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Send message"), 0);
+ CustomButtonData *cbd;
+ for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
+ if (!cbd->m_bIMButton)
+ continue;
+
+ int width = (cbd->m_dwArrowCID) ? 34 : 22;
+ HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, width, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL);
+ SendMessage(hwndButton, BUTTONSETASFLATBTN, TRUE, 0);
+ if (cbd->m_pwszTooltip)
+ SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE);
+ if (cbd->m_hIcon)
+ SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon));
+ }
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS);
@@ -784,7 +780,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST));
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
/* duh, how come we didnt use this from the start? */
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, (WPARAM)TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
@@ -920,32 +916,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendMessage(dat->hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0);
break;
- case WM_RBUTTONUP:
- hToolbarMenu = CreatePopupMenu();
- for (int i = 0; i < _countof(toolbarButtons); i++) {
- MENUITEMINFO mii = { 0 };
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE | MIIM_DATA | MIIM_BITMAP;
- mii.fType = MFT_STRING;
- mii.fState = (g_dat.buttonVisibility & (1 << i)) ? MFS_CHECKED : MFS_UNCHECKED;
- mii.wID = i + 1;
- mii.dwItemData = (ULONG_PTR)g_dat.hButtonIconList;
- mii.hbmpItem = HBMMENU_CALLBACK;
- mii.dwTypeData = TranslateW((toolbarButtons[i].name));
- InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
- }
- {
- POINT pt = { (short)LOWORD(GetMessagePos()), (short)HIWORD(GetMessagePos()) };
- int i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if (i > 0) {
- g_dat.buttonVisibility ^= (1 << (i - 1));
- db_set_dw(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, g_dat.buttonVisibility);
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
- }
- }
- DestroyMenu(hToolbarMenu);
- return TRUE;
-
case WM_DROPFILES:
if (dat->szProto == NULL) break;
if (!(CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break;
@@ -983,11 +953,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case DM_CHANGEICONS:
- SendDlgItemMessage(hwndDlg, IDC_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_ADD"));
- SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_USERDETAILS"));
- SendDlgItemMessage(hwndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_HISTORY"));
- SendDlgItemMessage(hwndDlg, IDC_QUOTE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_QUOTE"));
- SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SEND"));
SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
SetStatusIcon(dat);
@@ -1255,7 +1220,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return TRUE;
case DM_SPLITTERMOVED:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) {
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY)) {
RECT rc, rcLog;
GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog);
GetClientRect(hwndDlg, &rc);
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp
index 6beeab12ce..0dfdb2d36a 100644
--- a/plugins/Scriver/src/msgoptions.cpp
+++ b/plugins/Scriver/src/msgoptions.cpp
@@ -23,28 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-struct TabDef
-{
- DLGPROC dlgProc;
- DWORD dlgId;
- const char *tabName;
-};
-
-static const TabDef tabPages[] = {
- { DlgProcOptions, IDD_OPT_MSGDLG, LPGEN("General") },
- { DlgProcTabsOptions, IDD_OPT_MSGTABS, LPGEN("Tabs") },
- { DlgProcLayoutOptions, IDD_OPT_LAYOUT, LPGEN("Layout") },
- { DlgProcLogOptions, IDD_OPT_MSGLOG, LPGEN("Event log") },
- { DlgProcOptions1, IDD_OPTIONS1, LPGEN("Group chat") },
- { DlgProcOptions2, IDD_OPTIONS2, LPGEN("Group chat log") }
-};
+INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
#define FONTF_BOLD 1
#define FONTF_ITALIC 2
@@ -946,6 +927,8 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam
return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int OptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
@@ -953,12 +936,36 @@ int OptInitialise(WPARAM wParam, LPARAM)
odp.hInstance = g_hInst;
odp.szTitle.a = LPGEN("Message sessions");
odp.flags = ODPF_BOLDGROUPS;
- for (int i = 0; i < _countof(tabPages); i++) {
- odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId);
- odp.pfnDlgProc = tabPages[i].dlgProc;
- odp.szTab.a = (char *)tabPages[i].tabName;
- Options_AddPage(wParam, &odp);
- }
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG);
+ odp.pfnDlgProc = DlgProcOptions;
+ odp.szTab.a = LPGEN("General");
+ Options_AddPage(wParam, &odp);
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTABS);
+ odp.pfnDlgProc = DlgProcTabsOptions;
+ odp.szTab.a = LPGEN("Tabs");
+ Options_AddPage(wParam, &odp);
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LAYOUT);
+ odp.pfnDlgProc = DlgProcLayoutOptions;
+ odp.szTab.a = LPGEN("Layout");
+ Options_AddPage(wParam, &odp);
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGLOG);
+ odp.pfnDlgProc = DlgProcLogOptions;
+ odp.szTab.a = LPGEN("Event log");
+ Options_AddPage(wParam, &odp);
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1);
+ odp.pfnDlgProc = DlgProcOptions1;
+ odp.szTab.a = LPGEN("Group chat");
+ Options_AddPage(wParam, &odp);
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS2);
+ odp.pfnDlgProc = DlgProcOptions2;
+ odp.szTab.a = LPGEN("Group chat log");
+ Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTYPE);
odp.szGroup.a = LPGEN("Message sessions");
@@ -966,5 +973,17 @@ int OptInitialise(WPARAM wParam, LPARAM)
odp.pfnDlgProc = DlgProcTypeOptions;
odp.szTab.a = NULL;
Options_AddPage(wParam, &odp);
+
+ if (g_dat.popupInstalled) {
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.position = 910000002;
+ odp.hInstance = g_hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP);
+ odp.szTitle.a = LPGEN("Messaging");
+ odp.szGroup.a = LPGEN("Popups");
+ odp.pfnDlgProc = DlgProcOptionsPopup;
+ odp.flags = ODPF_BOLDGROUPS;
+ Options_AddPage(wParam, &odp);
+ }
return 0;
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 49310e20e8..3f286a8fea 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -382,6 +382,9 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// status icons processing
+
static void RegisterStatusIcons()
{
StatusIconData sid = { sizeof(sid) };
@@ -419,6 +422,108 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// toolbar icons processing
+
+int RegisterToolbarIcons(WPARAM, LPARAM)
+{
+ BBButton bbd = {};
+ bbd.pszModuleName = "SRMM";
+ bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISIMBUTTON | BBBF_CREATEBYID | BBBF_ISRSIDEBUTTON;
+ bbd.dwButtonID = IDOK;
+ bbd.dwDefPos = 5;
+ bbd.hIcon = IcoLib_GetIconHandle("scriver_SEND");
+ bbd.pwszTooltip = LPGENW("Send message");
+ Srmm_AddButton(&bbd);
+
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_CREATEBYID;
+ bbd.dwButtonID = IDC_QUOTE;
+ bbd.dwDefPos = 10;
+ bbd.hIcon = IcoLib_GetIconHandle("scriver_QUOTE");
+ bbd.pwszTooltip = LPGENW("Quote");
+ Srmm_AddButton(&bbd);
+
+ bbd.bbbFlags |= BBBF_ISRSIDEBUTTON;
+ bbd.dwButtonID = IDC_ADD;
+ bbd.dwDefPos = 20;
+ bbd.hIcon = IcoLib_GetIconHandle("scriver_ADD");
+ bbd.pwszTooltip = LPGENW("Add contact permanently to list");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_USERMENU;
+ bbd.dwDefPos = 30;
+ bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_DOWNARROW);
+ bbd.pwszTooltip = LPGENW("User menu");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_DETAILS;
+ bbd.dwDefPos = 40;
+ bbd.hIcon = IcoLib_GetIconHandle("scriver_USERDETAILS");
+ bbd.pwszTooltip = LPGENW("View user's details");
+ Srmm_AddButton(&bbd);
+
+ bbd.bbbFlags |= BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
+ bbd.dwButtonID = IDC_HISTORY;
+ bbd.dwDefPos = 50;
+ bbd.hIcon = IcoLib_GetIconHandle("scriver_HISTORY");
+ bbd.pwszTooltip = LPGENW("View user's history");
+ Srmm_AddButton(&bbd);
+
+ // chat buttons
+ bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID;
+ bbd.dwButtonID = IDC_CHAT_BOLD;
+ bbd.dwDefPos = 10;
+ bbd.hIcon = IcoLib_GetIconHandle("chat_bold");
+ bbd.pwszTooltip = LPGENW("Make the text bold(CTRL+B)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_CHAT_ITALICS;
+ bbd.dwDefPos = 15;
+ bbd.hIcon = IcoLib_GetIconHandle("chat_italics");
+ bbd.pwszTooltip = LPGENW("Make the text italicized (CTRL+I)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_CHAT_UNDERLINE;
+ bbd.dwDefPos = 20;
+ bbd.hIcon = IcoLib_GetIconHandle("chat_underline");
+ bbd.pwszTooltip = LPGENW("Make the text underlined (CTRL+U)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_CHAT_COLOR;
+ bbd.dwDefPos = 25;
+ bbd.hIcon = IcoLib_GetIconHandle("chat_fgcol");
+ bbd.pwszTooltip = LPGENW("Select a foreground color for the text (CTRL+K)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_CHAT_BKGCOLOR;
+ bbd.dwDefPos = 30;
+ bbd.hIcon = IcoLib_GetIconHandle("chat_bkgcol");
+ bbd.pwszTooltip = LPGENW("Select a background color for the text");
+ Srmm_AddButton(&bbd);
+
+ bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
+ bbd.dwButtonID = IDC_CHAT_CHANMGR;
+ bbd.dwDefPos = 30;
+ bbd.hIcon = IcoLib_GetIconHandle("chat_settings");
+ bbd.pwszTooltip = LPGENW("Control this room (CTRL+O)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_CHAT_SHOWNICKLIST;
+ bbd.dwDefPos = 20;
+ bbd.hIcon = IcoLib_GetIconHandle("chat_nicklist");
+ bbd.pwszTooltip = LPGENW("Show/hide the nick list (CTRL+N)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_CHAT_FILTER;
+ bbd.dwDefPos = 10;
+ bbd.hIcon = IcoLib_GetIconHandle("chat_filter");
+ bbd.pwszTooltip = LPGENW("Enable/disable the event filter (CTRL+F)");
+ Srmm_AddButton(&bbd);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int ModuleLoad(WPARAM, LPARAM)
{
g_dat.smileyAddInstalled = ServiceExists(MS_SMILEYADD_SHOWSELECTION) && ServiceExists(MS_SMILEYADD_REPLACESMILEYS);
@@ -459,10 +564,10 @@ static int OnModulesLoaded(WPARAM, LPARAM)
HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
HookEvent(ME_FONT_RELOAD, FontServiceFontsChanged);
HookEvent(ME_MSG_ICONPRESSED, StatusIconPressed);
+ HookEvent(ME_MSG_TOOLBARLOADED, RegisterToolbarIcons);
HookEvent(ME_MC_DEFAULTTCHANGED, MetaContactChanged);
RestoreUnreadMessageAlerts();
- OptionsInit();
RegisterStatusIcons();
return 0;
}
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h
index bfe983a996..6cd0df7ca7 100644
--- a/plugins/Scriver/src/resource.h
+++ b/plugins/Scriver/src/resource.h
@@ -88,7 +88,6 @@
#define IDC_LIMITCHATSTABS 1013
#define IDC_LIMITCHATSTABSNUM 1014
#define IDC_LIMITCHATSTABSNUMSPIN 1015
-#define IDC_SPLITTER 1017
#define IDC_SHOWNAMES 1020
#define IDC_USETABS 1022
#define IDC_SHOWSECONDS 1023
@@ -171,8 +170,8 @@
#define IDC_INPUTLINES 1647
#define IDC_INPUTLINESSPIN 1648
#define IDC_CHAT_LOG 5005
-#define IDC_CHAT_SPLITTERX 5006
-#define IDC_CHAT_SPLITTERY 5008
+#define IDC_SPLITTERX 5006
+#define IDC_SPLITTERY 5008
#define IDC_CHAT_MESSAGE 5009
#define IDC_CHAT_BOLD 5010
#define IDC_CHAT_ITALICS 5011
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h
index f97876c4ab..b46f88eadb 100644
--- a/plugins/Scriver/src/stdafx.h
+++ b/plugins/Scriver/src/stdafx.h
@@ -121,7 +121,6 @@ extern CREOleCallback2 reOleCallback2;
int Chat_Load();
int Chat_Unload();
-int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam);
int OptInitialise(WPARAM wParam, LPARAM lParam);
int FontServiceFontsChanged(WPARAM wParam, LPARAM lParam);
int StatusIconPressed(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index e52f9db5cc..2bf9c3c699 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -434,54 +434,36 @@ void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT *rect)
SendMessage(hwndTT, TTM_NEWTOOLRECT, 0, (LPARAM)&ti);
}
-/* toolbar-related stuff, to be moved to a separate file */
-
-HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton *buttons, int controlVisibility)
+void SetButtonsPos(HWND hwndDlg)
{
- HWND hCtrl;
- int i;
- int lPos = 0;
- int rPos = width;
- for (i = 0; i < cControls; i++) {
- if (!buttons[i].alignment && (controlVisibility & (1 << i))) {
- lPos += buttons[i].spacing;
- hCtrl = GetDlgItem(hwnd, buttons[i].controlId);
- if (NULL != hCtrl) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, hCtrl, 0, lPos, vPos, buttons[i].width, height, SWP_NOZORDER);
- lPos += buttons[i].width;
+ HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount());
+
+ RECT rc;
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTERY), &rc);
+ POINT pt = { 0, rc.top };
+ ScreenToClient(hwndDlg, &pt);
+ pt.y -= 20;
+
+ GetClientRect(hwndDlg, &rc);
+ int iLeftX = 2, iRightX = rc.right - 2;
+ int iGap = db_get_b(NULL, SRMMMOD, "ButtonsBarGap", 1);
+
+ CustomButtonData *cbd;
+ for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
+ HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
+ if (hwndButton == NULL)
+ continue;
+
+ int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22);
+ if (cbd->m_bRSided) {
+ iRightX -= width;
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
- }
- for (i = cControls - 1; i >= 0; i--) {
- if (buttons[i].alignment && (controlVisibility & (1 << i))) {
- rPos -= buttons[i].spacing + buttons[i].width;
- hCtrl = GetDlgItem(hwnd, buttons[i].controlId);
- if (NULL != hCtrl) /* Wine fix. */
- hdwp = DeferWindowPos(hdwp, hCtrl, 0, rPos, vPos, buttons[i].width, height, SWP_NOZORDER);
+ else {
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ iLeftX += width;
}
}
- return hdwp;
-}
-
-void ShowToolbarControls(HWND hwndDlg, int cControls, const ToolbarButton* buttons, int controlVisibility, int state)
-{
- for (int i = 0; i < cControls; i++)
- ShowWindow(GetDlgItem(hwndDlg, buttons[i].controlId), (controlVisibility & (1 << i)) ? state : SW_HIDE);
-}
-
-int GetToolbarWidth(int cControls, const ToolbarButton *buttons)
-{
- int w = 0;
- for (int i = 0; i < cControls; i++)
- w += buttons[i].width + buttons[i].spacing;
-
- return w;
-}
-
-BOOL IsToolbarVisible(int cControls, int visibilityFlags)
-{
- for (int i = 0; i < cControls; i++)
- if (visibilityFlags & (1 << i))
- return TRUE;
- return FALSE;
+ EndDeferWindowPos(hdwp);
}
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h
index de18f2d2b5..66db731f03 100644
--- a/plugins/Scriver/src/utils.h
+++ b/plugins/Scriver/src/utils.h
@@ -44,8 +44,6 @@ wchar_t *GetRichTextWord(HWND hwnd, POINTL *pt);
int SetRichText(HWND hwnd, const wchar_t *text);
int SetRichTextRTF(HWND hwnd, const char *text);
void SearchWord(wchar_t * word, int engine);
-HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton * buttons, int controlVisibility);
-void ShowToolbarControls(HWND hwndDlg, int cControls, const ToolbarButton * buttons, int controlVisibility, int state);
void AppendToBuffer(char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced, const char *fmt, ...);
int MeasureMenuItem(WPARAM wParam, LPARAM lParam);
int DrawMenuItem(WPARAM wParam, LPARAM lParam);
@@ -54,6 +52,5 @@ void GetContactUniqueId(SrmmWindowData *dat, char *buf, int maxlen);
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT *rect);
void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTitle);
void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect);
-int GetToolbarWidth(int cControls, const ToolbarButton * buttons);
-BOOL IsToolbarVisible(int cControls, int visibilityFlags);
+void SetButtonsPos(HWND hwndDlg);
#endif
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index 70f5082737..5fddca1ebe 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -23,72 +23,13 @@ static mir_cs csWndList;
// type definitions
-class MsgWndData : public MZeroedObject
+struct MsgWndData : public MZeroedObject
{
-public:
- HWND hwnd;
- char ProtocolName[52];
- HWND REdit;
- HWND MEdit;
- HWND LButton;
- mutable HWND hSmlButton;
- mutable HBITMAP hSmlBmp;
- mutable HICON hSmlIco;
- int idxLastChar;
+ HWND hwnd, hwndLog, hwndInput;
+ int idxLastChar;
+ bool doSmileyReplace, doSmileyButton;
MCONTACT hContact;
- bool doSmileyReplace;
- bool doSmileyButton;
- bool isSplit;
- bool isSend;
-
- MsgWndData()
- {
- }
-
- ~MsgWndData()
- {
- clear();
- }
-
- void clear(void)
- {
- if (hSmlBmp != NULL) {
- DeleteObject(hSmlBmp);
- hSmlBmp = NULL;
- }
- if (hSmlIco != NULL) {
- DestroyIcon(hSmlIco);
- hSmlIco = NULL;
- }
- if (hSmlButton != NULL) {
- DestroyWindow(hSmlButton);
- hSmlButton = NULL;
- }
- }
-
- RECT CalcSmileyButtonPos(void)
- {
- RECT rect;
- GetWindowRect(LButton, &rect);
-
- POINT pt;
- pt.y = rect.top;
-
- MUUID muidScriver = { 0x84636f78, 0x2057, 0x4302, { 0x8a, 0x65, 0x23, 0xa1, 0x6d, 0x46, 0x84, 0x4c } };
- int iShift = (IsPluginLoaded(muidScriver)) ? 28 : -28;
-
- if ((GetWindowLongPtr(LButton, GWL_STYLE) & WS_VISIBLE) != 0)
- pt.x = rect.left + iShift;
- else
- pt.x = rect.left;
-
- ScreenToClient(GetParent(LButton), &pt);
- rect.bottom += pt.y - rect.top;
- rect.right += pt.x - rect.left;
- rect.top = pt.y;
- rect.left = pt.x;
- return rect;
- }
+ char ProtocolName[52];
void CreateSmileyButton(void)
{
@@ -98,7 +39,6 @@ public:
doSmileyButton &= SmileyPack != NULL && SmileyPack->VisibleSmileyCount() != 0;
doSmileyReplace = true;
- doSmileyButton &= db_get_b(NULL, "SRMM", "ShowButtonLine", TRUE) != 0;
if (ProtocolName[0] != 0) {
INT_PTR cap = CallProtoService(ProtocolName, PS_GETCAPS, PFLAGNUM_1, 0);
@@ -106,37 +46,13 @@ public:
doSmileyReplace &= ((cap & (PF1_IMRECV | PF1_CHAT)) != 0);
}
- if (doSmileyButton && opt.PluginSupportEnabled) {
- // create smiley button
- RECT rect = CalcSmileyButtonPos();
-
- hSmlButton = CreateWindowEx(
- WS_EX_LEFT | WS_EX_NOPARENTNOTIFY | WS_EX_TOPMOST,
- MIRANDABUTTONCLASS,
- L"S",
- WS_CHILD | WS_VISIBLE | WS_TABSTOP,
- rect.left,
- rect.top,
- rect.bottom - rect.top + 1,
- rect.bottom - rect.top + 1,
- GetParent(LButton),
- (HMENU)IDC_SMLBUTTON,
- NULL, NULL);
-
- // Conversion to bitmap done to prevent Miranda from scaling the image
- SmileyType *sml = FindButtonSmiley(SmileyPack);
- if (sml != NULL) {
- hSmlBmp = sml->GetBitmap(GetSysColor(COLOR_BTNFACE), 0, 0);
- SendMessage(hSmlButton, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hSmlBmp);
- }
- else {
- hSmlIco = GetDefaultIcon();
- SendMessage(hSmlButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hSmlIco);
- }
-
- SendMessage(hSmlButton, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show smiley selection window"), 0);
- SendMessage(hSmlButton, BUTTONSETASFLATBTN, TRUE, 0);
- }
+ BBButton bbd = {};
+ bbd.pszModuleName = MODULENAME;
+ if (!doSmileyButton)
+ bbd.bbbFlags = BBBF_DISABLED;
+ else if (!opt.PluginSupportEnabled)
+ bbd.bbbFlags = BBBF_HIDDEN;
+ Srmm_SetButtonState(hContact, &bbd);
}
};
@@ -172,7 +88,6 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam,
switch (uMsg) {
case DM_OPTIONSAPPLIED:
- dat->clear();
dat->CreateSmileyButton();
break;
@@ -182,7 +97,7 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam,
GETTEXTLENGTHEX gtl;
gtl.codepage = 1200;
gtl.flags = GTL_PRECISE | GTL_NUMCHARS;
- dat->idxLastChar = (int)SendMessage(dat->REdit, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
+ dat->idxLastChar = (int)SendMessage(dat->hwndLog, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
}
break;
}
@@ -203,20 +118,13 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam,
}
break;
- case WM_SIZE:
- if (dat->doSmileyButton) {
- RECT rect = dat->CalcSmileyButtonPos();
- SetWindowPos(dat->hSmlButton, NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
- }
- break;
-
case DM_APPENDTOLOG:
if (dat->doSmileyReplace) {
SmileyPackCType *smcp;
SmileyPackType *SmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact, &smcp);
if (SmileyPack != NULL) {
const CHARRANGE sel = { dat->idxLastChar, LONG_MAX };
- ReplaceSmileys(dat->REdit, SmileyPack, smcp, sel, false, false, false);
+ ReplaceSmileys(dat->hwndLog, SmileyPack, smcp, sel, false, false, false);
}
}
break;
@@ -227,38 +135,56 @@ static LRESULT CALLBACK MessageDlgSubclass(HWND hwnd, UINT uMsg, WPARAM wParam,
SmileyPackType *SmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact, &smcp);
if (SmileyPack != NULL) {
static const CHARRANGE sel = { 0, LONG_MAX };
- ReplaceSmileys(dat->REdit, SmileyPack, smcp, sel, false, false, false);
+ ReplaceSmileys(dat->hwndLog, SmileyPack, smcp, sel, false, false, false);
}
}
break;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_SMLBUTTON && HIWORD(wParam) == BN_CLICKED) {
- RECT rect;
- GetWindowRect(dat->hSmlButton, &rect);
-
- SmileyToolWindowParam *stwp = new SmileyToolWindowParam;
- stwp->pSmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact);
- stwp->hWndParent = hwnd;
- stwp->hWndTarget = dat->MEdit;
- stwp->targetMessage = EM_REPLACESEL;
- stwp->targetWParam = TRUE;
- stwp->direction = 0;
- stwp->xPosition = rect.left;
- stwp->yPosition = rect.top + 24;
- mir_forkthread(SmileyToolThread, stwp);
- }
-
- if (LOWORD(wParam) == MI_IDC_ADD && HIWORD(wParam) == BN_CLICKED && dat->doSmileyButton) {
- RECT rect = dat->CalcSmileyButtonPos();
- SetWindowPos(dat->hSmlButton, NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
- }
- break;
}
return result;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// toolbar button processing
+
+int SmileyButtonCreate(WPARAM, LPARAM)
+{
+ BBButton bbd = {};
+ bbd.pszModuleName = MODULENAME;
+ bbd.pwszTooltip = LPGENW("Show smiley selection window");
+ bbd.dwDefPos = 31;
+ bbd.hIcon = IcoLib_GetIconHandle("SmileyAdd_ButtonSmiley");
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON;
+ Srmm_AddButton(&bbd);
+ return 0;
+}
+
+int SmileyButtonPressed(WPARAM, LPARAM lParam)
+{
+ CustomButtonClickData *pcbc = (CustomButtonClickData*)lParam;
+ if (mir_strcmp(pcbc->pszModule, MODULENAME))
+ return 0;
+
+ MsgWndData *dat = IsMsgWnd(pcbc->hwndFrom);
+ if (dat == NULL)
+ return 0;
+
+ SmileyToolWindowParam *stwp = new SmileyToolWindowParam;
+ stwp->pSmileyPack = GetSmileyPack(dat->ProtocolName, dat->hContact);
+ stwp->hWndParent = pcbc->hwndFrom;
+ stwp->hWndTarget = dat->hwndInput;
+ stwp->targetMessage = EM_REPLACESEL;
+ stwp->targetWParam = TRUE;
+ stwp->direction = 0;
+ stwp->xPosition = pcbc->pt.x;
+ stwp->yPosition = pcbc->pt.y;
+ mir_forkthread(SmileyToolThread, stwp);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// window hook
+
static int MsgDlgHook(WPARAM, LPARAM lParam)
{
const MessageWindowEventData *wndEvtData = (MessageWindowEventData*)lParam;
@@ -268,11 +194,8 @@ static int MsgDlgHook(WPARAM, LPARAM lParam)
MsgWndData *msgwnd = new MsgWndData();
msgwnd->hwnd = wndEvtData->hwndWindow;
msgwnd->hContact = wndEvtData->hContact;
- msgwnd->REdit = wndEvtData->hwndLog;
- msgwnd->MEdit = wndEvtData->hwndInput;
- msgwnd->LButton = GetDlgItem(wndEvtData->hwndWindow, MI_IDC_ADD);
- if (msgwnd->LButton == NULL)
- msgwnd->LButton = GetDlgItem(wndEvtData->hwndWindow, 5019);
+ msgwnd->hwndLog = wndEvtData->hwndLog;
+ msgwnd->hwndInput = wndEvtData->hwndInput;
// Get the protocol for this contact to display correct smileys.
char *protonam = GetContactProto(DecodeMetaContact(msgwnd->hContact));
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp
index fe117a0b9e..1a68a8c86b 100644
--- a/plugins/SmileyAdd/src/download.cpp
+++ b/plugins/SmileyAdd/src/download.cpp
@@ -220,7 +220,7 @@ void DownloadInit(void)
{
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
- nlu.szSettingsModule = "SmileyAdd";
+ nlu.szSettingsModule = MODULENAME;
nlu.ptszDescriptiveName = TranslateT("SmileyAdd HTTP connections");
hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp
index 112f3face5..a2d6c704df 100644
--- a/plugins/SmileyAdd/src/main.cpp
+++ b/plugins/SmileyAdd/src/main.cpp
@@ -61,14 +61,14 @@ static int ModulesLoaded(WPARAM, LPARAM)
DownloadInit();
- //install hooks if enabled
+ // install hooks if enabled
InstallDialogBoxHook();
g_SmileyCategories.AddAllProtocolsAsCategory();
g_SmileyCategories.ClearAndLoadAll();
ColourID cid = { sizeof(cid) };
- strcpy_s(cid.dbSettingsGroup, "SmileyAdd");
+ strcpy_s(cid.dbSettingsGroup, MODULENAME);
strcpy_s(cid.group, LPGEN("SmileyAdd"));
strcpy_s(cid.name, LPGEN("Background color"));
strcpy_s(cid.setting, "SelWndBkgClr");
@@ -114,6 +114,9 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged);
HookEvent(ME_COLOUR_RELOAD, ReloadColour);
+ HookEvent(ME_MSG_BUTTONPRESSED, SmileyButtonPressed);
+ HookEvent(ME_MSG_TOOLBARLOADED, SmileyButtonCreate);
+
//create the smiley services
CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand);
CreateServiceFunction(MS_SMILEYADD_SHOWSELECTION, ShowSmileySelectionCommand);
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp
index b5570be9ed..f7341b561d 100644
--- a/plugins/SmileyAdd/src/options.cpp
+++ b/plugins/SmileyAdd/src/options.cpp
@@ -543,68 +543,67 @@ void OptionsDialogType::ShowSmileyPreview(void)
void OptionsType::Save(void)
{
- db_set_b(NULL, "SmileyAdd", "PluginSupportEnabled", PluginSupportEnabled);
- db_set_b(NULL, "SmileyAdd", "EnforceSpaces", EnforceSpaces);
- db_set_b(NULL, "SmileyAdd", "ScaleToTextheight", ScaleToTextheight);
- db_set_b(NULL, "SmileyAdd", "UseOneForAll", UseOneForAll);
- db_set_b(NULL, "SmileyAdd", "UsePhysProto", UsePhysProto);
- db_set_b(NULL, "SmileyAdd", "SurroundSmileyWithSpaces", SurroundSmileyWithSpaces);
- db_set_b(NULL, "SmileyAdd", "ScaleAllSmileys", ScaleAllSmileys);
- db_set_b(NULL, "SmileyAdd", "IEViewStyle", IEViewStyle);
- db_set_b(NULL, "SmileyAdd", "AnimateSel", AnimateSel);
- db_set_b(NULL, "SmileyAdd", "AnimateDlg", AnimateDlg);
- db_set_b(NULL, "SmileyAdd", "InputSmileys", InputSmileys);
- db_set_b(NULL, "SmileyAdd", "DCursorSmiley", DCursorSmiley);
- db_set_b(NULL, "SmileyAdd", "DisableCustom", DisableCustom);
- db_set_b(NULL, "SmileyAdd", "HQScaling", HQScaling);
- db_set_b(NULL, "SmileyAdd", "ButtonStatus", (BYTE)ButtonStatus);
- db_set_dw(NULL, "SmileyAdd", "MaxCustomSmileySize", MaxCustomSmileySize);
- db_set_dw(NULL, "SmileyAdd", "MinSmileySize", MinSmileySize);
- db_set_b(NULL, "SmileyAdd", "HorizontalSorting", HorizontalSorting);
+ db_set_b(NULL, MODULENAME, "PluginSupportEnabled", PluginSupportEnabled);
+ db_set_b(NULL, MODULENAME, "EnforceSpaces", EnforceSpaces);
+ db_set_b(NULL, MODULENAME, "ScaleToTextheight", ScaleToTextheight);
+ db_set_b(NULL, MODULENAME, "UseOneForAll", UseOneForAll);
+ db_set_b(NULL, MODULENAME, "UsePhysProto", UsePhysProto);
+ db_set_b(NULL, MODULENAME, "SurroundSmileyWithSpaces", SurroundSmileyWithSpaces);
+ db_set_b(NULL, MODULENAME, "ScaleAllSmileys", ScaleAllSmileys);
+ db_set_b(NULL, MODULENAME, "IEViewStyle", IEViewStyle);
+ db_set_b(NULL, MODULENAME, "AnimateSel", AnimateSel);
+ db_set_b(NULL, MODULENAME, "AnimateDlg", AnimateDlg);
+ db_set_b(NULL, MODULENAME, "InputSmileys", InputSmileys);
+ db_set_b(NULL, MODULENAME, "DCursorSmiley", DCursorSmiley);
+ db_set_b(NULL, MODULENAME, "DisableCustom", DisableCustom);
+ db_set_b(NULL, MODULENAME, "HQScaling", HQScaling);
+ db_set_b(NULL, MODULENAME, "ButtonStatus", (BYTE)ButtonStatus);
+ db_set_dw(NULL, MODULENAME, "MaxCustomSmileySize", MaxCustomSmileySize);
+ db_set_dw(NULL, MODULENAME, "MinSmileySize", MinSmileySize);
+ db_set_b(NULL, MODULENAME, "HorizontalSorting", HorizontalSorting);
}
void OptionsType::Load(void)
{
- PluginSupportEnabled = db_get_b(NULL, "SmileyAdd", "PluginSupportEnabled", TRUE) != 0;
- EnforceSpaces = db_get_b(NULL, "SmileyAdd", "EnforceSpaces", FALSE) != 0;
- ScaleToTextheight = db_get_b(NULL, "SmileyAdd", "ScaleToTextheight", FALSE) != 0;
- UseOneForAll = db_get_b(NULL, "SmileyAdd", "UseOneForAll", TRUE) != 0;
- UsePhysProto = db_get_b(NULL, "SmileyAdd", "UsePhysProto", FALSE) != 0;
- SurroundSmileyWithSpaces =
- db_get_b(NULL, "SmileyAdd", "SurroundSmileyWithSpaces", FALSE) != 0;
- ScaleAllSmileys = db_get_b(NULL, "SmileyAdd", "ScaleAllSmileys", FALSE) != 0;
- IEViewStyle = db_get_b(NULL, "SmileyAdd", "IEViewStyle", FALSE) != 0;
- AnimateSel = db_get_b(NULL, "SmileyAdd", "AnimateSel", TRUE) != 0;
- AnimateDlg = db_get_b(NULL, "SmileyAdd", "AnimateDlg", TRUE) != 0;
- InputSmileys = db_get_b(NULL, "SmileyAdd", "InputSmileys", TRUE) != 0;
- DCursorSmiley = db_get_b(NULL, "SmileyAdd", "DCursorSmiley", FALSE) != 0;
- DisableCustom = db_get_b(NULL, "SmileyAdd", "DisableCustom", FALSE) != 0;
- HQScaling = db_get_b(NULL, "SmileyAdd", "HQScaling", FALSE) != 0;
-
- ButtonStatus = db_get_b(NULL, "SmileyAdd", "ButtonStatus", 1);
- SelWndBkgClr = db_get_dw(NULL, "SmileyAdd", "SelWndBkgClr", GetSysColor(COLOR_WINDOW));
- MaxCustomSmileySize = db_get_dw(NULL, "SmileyAdd", "MaxCustomSmileySize", 0);
- MinSmileySize = db_get_dw(NULL, "SmileyAdd", "MinSmileySize", 0);
- HorizontalSorting = db_get_b(NULL, "SmileyAdd", "HorizontalSorting", 1) != 0;
+ PluginSupportEnabled = db_get_b(NULL, MODULENAME, "PluginSupportEnabled", TRUE) != 0;
+ EnforceSpaces = db_get_b(NULL, MODULENAME, "EnforceSpaces", FALSE) != 0;
+ ScaleToTextheight = db_get_b(NULL, MODULENAME, "ScaleToTextheight", FALSE) != 0;
+ UseOneForAll = db_get_b(NULL, MODULENAME, "UseOneForAll", TRUE) != 0;
+ UsePhysProto = db_get_b(NULL, MODULENAME, "UsePhysProto", FALSE) != 0;
+ SurroundSmileyWithSpaces = db_get_b(NULL, MODULENAME, "SurroundSmileyWithSpaces", FALSE) != 0;
+ ScaleAllSmileys = db_get_b(NULL, MODULENAME, "ScaleAllSmileys", FALSE) != 0;
+ IEViewStyle = db_get_b(NULL, MODULENAME, "IEViewStyle", FALSE) != 0;
+ AnimateSel = db_get_b(NULL, MODULENAME, "AnimateSel", TRUE) != 0;
+ AnimateDlg = db_get_b(NULL, MODULENAME, "AnimateDlg", TRUE) != 0;
+ InputSmileys = db_get_b(NULL, MODULENAME, "InputSmileys", TRUE) != 0;
+ DCursorSmiley = db_get_b(NULL, MODULENAME, "DCursorSmiley", FALSE) != 0;
+ DisableCustom = db_get_b(NULL, MODULENAME, "DisableCustom", FALSE) != 0;
+ HQScaling = db_get_b(NULL, MODULENAME, "HQScaling", FALSE) != 0;
+
+ ButtonStatus = db_get_b(NULL, MODULENAME, "ButtonStatus", 1);
+ SelWndBkgClr = db_get_dw(NULL, MODULENAME, "SelWndBkgClr", GetSysColor(COLOR_WINDOW));
+ MaxCustomSmileySize = db_get_dw(NULL, MODULENAME, "MaxCustomSmileySize", 0);
+ MinSmileySize = db_get_dw(NULL, MODULENAME, "MinSmileySize", 0);
+ HorizontalSorting = db_get_b(NULL, MODULENAME, "HorizontalSorting", 1) != 0;
}
void OptionsType::ReadPackFileName(CMStringW &filename, const CMStringW &name, const CMStringW &defaultFilename)
{
CMStringW settingKey = name + L"-filename";
- ptrW tszValue(db_get_wsa(NULL, "SmileyAdd", _T2A(settingKey.c_str())));
+ ptrW tszValue(db_get_wsa(NULL, MODULENAME, _T2A(settingKey.c_str())));
filename = (tszValue != NULL) ? (wchar_t*)tszValue : defaultFilename;
}
void OptionsType::WritePackFileName(const CMStringW &filename, const CMStringW &name)
{
CMStringW settingKey = name + L"-filename";
- db_set_ws(NULL, "SmileyAdd", _T2A(settingKey.c_str()), filename.c_str());
+ db_set_ws(NULL, MODULENAME, _T2A(settingKey.c_str()), filename.c_str());
}
void OptionsType::ReadCustomCategories(CMStringW &cats)
{
- ptrW tszValue(db_get_wsa(NULL, "SmileyAdd", "CustomCategories"));
+ ptrW tszValue(db_get_wsa(NULL, MODULENAME, "CustomCategories"));
if (tszValue != NULL)
cats = tszValue;
}
@@ -612,14 +611,14 @@ void OptionsType::ReadCustomCategories(CMStringW &cats)
void OptionsType::WriteCustomCategories(const CMStringW &cats)
{
if (cats.IsEmpty())
- db_unset(NULL, "SmileyAdd", "CustomCategories");
+ db_unset(NULL, MODULENAME, "CustomCategories");
else
- db_set_ws(NULL, "SmileyAdd", "CustomCategories", cats.c_str());
+ db_set_ws(NULL, MODULENAME, "CustomCategories", cats.c_str());
}
void OptionsType::ReadContactCategory(MCONTACT hContact, CMStringW &cats)
{
- ptrW tszValue(db_get_wsa(hContact, "SmileyAdd", "CustomCategory"));
+ ptrW tszValue(db_get_wsa(hContact, MODULENAME, "CustomCategory"));
if (tszValue != NULL)
cats = tszValue;
}
@@ -627,9 +626,9 @@ void OptionsType::ReadContactCategory(MCONTACT hContact, CMStringW &cats)
void OptionsType::WriteContactCategory(MCONTACT hContact, const CMStringW &cats)
{
if (cats.IsEmpty())
- db_unset(hContact, "SmileyAdd", "CustomCategory");
+ db_unset(hContact, MODULENAME, "CustomCategory");
else
- db_set_ws(hContact, "SmileyAdd", "CustomCategory", cats.c_str());
+ db_set_ws(hContact, MODULENAME, "CustomCategory", cats.c_str());
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h
index bd91bfe5a5..f467be8697 100644
--- a/plugins/SmileyAdd/src/stdafx.h
+++ b/plugins/SmileyAdd/src/stdafx.h
@@ -99,9 +99,7 @@ extern SmileyCategoryListType g_SmileyCategories;
extern SmileyPackListType g_SmileyPacks;
extern LIST<void> menuHandleArray;
-#define IDC_SMLBUTTON (WM_USER + 33)
-
-#define MI_IDC_ADD 1070 // Add button
+#define MODULENAME "SmileyAdd"
#define DM_REMAKELOG (WM_USER + 11)
#define DM_OPTIONSAPPLIED (WM_USER + 14)
@@ -116,9 +114,12 @@ extern LIST<void> menuHandleArray;
// init functions
void InstallDialogBoxHook(void);
void RemoveDialogBoxHook(void);
-int UpdateSrmmDlg(WPARAM wParam, LPARAM lParam);
-//functions for general use (defined in general.cpp)
+int UpdateSrmmDlg(WPARAM, LPARAM);
+int SmileyButtonCreate(WPARAM, LPARAM);
+int SmileyButtonPressed(WPARAM, LPARAM);
+
+// functions for general use (defined in general.cpp)
int CalculateTextHeight(HDC hdc, CHARFORMAT2 *chf);
const wchar_t* GetImageExt(CMStringW &fname);
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index 7c39d01b8c..6d08d323cb 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -21,16 +21,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.pwszTooltip = LPGENW("Info button");
Srmm_AddButton(&bbd);
- if (PluginConfig.g_SmileyAddAvail) {
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID;
- bbd.dwButtonID = IDC_SMILEYBTN;
- bbd.iButtonWidth = 0;
- bbd.dwDefPos = 30;
- bbd.hIcon = PluginConfig.g_buttonBarIconHandles[9];
- bbd.pwszTooltip = LPGENW("Insert emoticon");
- Srmm_AddButton(&bbd);
- }
-
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISPUSHBUTTON | BBBF_CANBEHIDDEN | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_FONTBOLD;
bbd.dwDefPos = 40;
@@ -62,7 +52,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_ISARROWBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDOK;
bbd.dwDefPos = 10;
- bbd.iButtonWidth = 51;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[6];
bbd.pwszTooltip = LPGENW("Send message\nClick dropdown arrow for sending options");
Srmm_AddButton(&bbd);
@@ -70,7 +59,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SAVE;
bbd.dwDefPos = 20;
- bbd.iButtonWidth = 0;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[8];
bbd.pwszTooltip = LPGENW("Close session");
Srmm_AddButton(&bbd);
@@ -78,7 +66,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_QUOTE;
bbd.dwDefPos = 30;
- bbd.iButtonWidth = 0;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[4];
bbd.pwszTooltip = LPGENW("Quote last message OR selected text");
Srmm_AddButton(&bbd);
@@ -86,7 +73,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_TIME;
bbd.dwDefPos = 40;
- bbd.iButtonWidth = 0;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[2];
bbd.pwszTooltip = LPGENW("Message log options");
Srmm_AddButton(&bbd);
@@ -94,7 +80,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_HISTORY;
bbd.dwDefPos = 50;
- bbd.iButtonWidth = 0;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[0];
bbd.pwszTooltip = LPGENW("View user's history");
Srmm_AddButton(&bbd);
@@ -102,7 +87,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_PIC;
bbd.dwDefPos = 60;
- bbd.iButtonWidth = 0;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[7];
bbd.pwszTooltip = LPGENW("Edit user notes");
Srmm_AddButton(&bbd);
@@ -112,7 +96,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.dwButtonID = 1;
bbd.pszModuleName = "tb_splitter";
bbd.dwDefPos = 31;
- bbd.iButtonWidth = 22;
bbd.hIcon = 0;
bbd.pwszTooltip = 0;
Srmm_AddButton(&bbd);
@@ -138,7 +121,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISPUSHBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_BKGCOLOR;
bbd.dwDefPos = 81;
- bbd.iButtonWidth = 22;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[16];
bbd.pwszTooltip = LPGENW("Change background color");
Srmm_AddButton(&bbd);
@@ -146,7 +128,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_SHOWNICKLIST;
bbd.dwDefPos = 22;
- bbd.iButtonWidth = 22;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[19];
bbd.pwszTooltip = LPGENW("Toggle nick list");
Srmm_AddButton(&bbd);
@@ -154,7 +135,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_FILTER;
bbd.dwDefPos = 24;
- bbd.iButtonWidth = 22;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[18];
bbd.pwszTooltip = LPGENW("Event filter - right click to setup, left click to activate/deactivate");
Srmm_AddButton(&bbd);
@@ -162,7 +142,6 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM)
bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
bbd.dwButtonID = IDC_CHANMGR;
bbd.dwDefPos = 33;
- bbd.iButtonWidth = 22;
bbd.hIcon = PluginConfig.g_buttonBarIconHandles[17];
bbd.pwszTooltip = LPGENW("Channel manager");
Srmm_AddButton(&bbd);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 423320a909..67d25d9174 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1647,7 +1647,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3));
dat->Panel->loadHeight();
- Utils::enableDlgControl(hwndDlg, IDC_SMILEYBTN, true);
if (PluginConfig.g_hMenuTrayUnread != 0 && dat->hContact != 0 && dat->szProto != NULL)
UpdateTrayMenu(0, dat->wStatus, dat->szProto, dat->szStatus, dat->hContact, FALSE);
@@ -1712,7 +1711,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case GC_SETWNDPROPS:
InitButtons(hwndDlg, si);
- ConfigureSmileyButton(dat);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETBKGNDCOLOR, 0, M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
DM_InitRichEdit(dat);
@@ -2740,28 +2738,6 @@ LABEL_SHOWWINDOW:
}
break;
- case IDC_SMILEY:
- case IDC_SMILEYBTN:
- if (lParam == 0)
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc);
- else
- GetWindowRect((HWND)lParam, &rc);
- {
- SMADD_SHOWSEL3 smaddInfo = { sizeof(smaddInfo) };
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = si->pszModule;
- smaddInfo.Direction = 0;
- smaddInfo.xPosition = rc.left;
- smaddInfo.yPosition = rc.top + 24;
- smaddInfo.hContact = si->hContact;
- smaddInfo.hwndParent = dat->pContainer->hwnd;
- if (PluginConfig.g_SmileyAddAvail)
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
- }
- break;
-
case IDC_CHAT_HISTORY:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_HISTORY))) {
MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
@@ -3217,7 +3193,6 @@ LABEL_SHOWWINDOW:
break;
case DM_SMILEYOPTIONSCHANGED:
- ConfigureSmileyButton(dat);
SendMessage(hwndDlg, GC_REDRAWLOG, 0, 1);
break;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index d4d0ee5983..8aeb9d5bcb 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -171,9 +171,6 @@ LRESULT TSAPI DM_GenericHotkeysCheck(MSG *message, TWindowData *dat)
dat->Panel->setActive(!dat->Panel->isActive());
dat->Panel->showHide();
return 1;
- case TABSRMM_HK_EMOTICONS:
- SendMessage(hwndDlg, WM_COMMAND, IDC_SMILEYBTN, 0);
- return 1;
case TABSRMM_HK_TOGGLETOOLBAR:
SendMessage(hwndDlg, WM_COMMAND, IDC_TOGGLETOOLBAR, 0);
return 1;
@@ -267,31 +264,6 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *pContainer, T
CallService(MS_HISTORY_SHOWCONTACTHISTORY, dat->hContact, 0);
break;
- case IDC_SMILEYBTN:
- if (dat->bShowSmileys && PluginConfig.g_SmileyAddAvail) {
- MCONTACT hContact = dat->cache->getActiveContact();
- if (CheckValidSmileyPack(dat->cache->getProto(), hContact) != 0) {
- if (lParam == 0)
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYBTN), &rc);
- else
- GetWindowRect((HWND)lParam, &rc);
-
- SMADD_SHOWSEL3 smaddInfo = { 0 };
- smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = const_cast<char *>(dat->cache->getProto());
- smaddInfo.Direction = 0;
- smaddInfo.xPosition = rc.left;
- smaddInfo.yPosition = rc.top + 24;
- smaddInfo.hwndParent = hwndContainer;
- smaddInfo.hContact = hContact;
- CallService(MS_SMILEYADD_SHOWSELECTION, (WPARAM)hwndContainer, (LPARAM)&smaddInfo);
- }
- }
- break;
-
case IDC_TIME:
submenu = GetSubMenu(PluginConfig.g_hMenuContext, 2);
MsgWindowUpdateMenu(dat, submenu, MENU_LOGMENU);
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 35233489fd..9425bcb192 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -50,7 +50,6 @@ static HOTKEYDESC _hotkeydescs[] = {
{ 0, "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER },
{ 0, "tabsrmm_send", LPGEN("Send message"), TABSRMM_HK_SECTION_GENERIC, 0, 0, TABSRMM_HK_SEND },
- { 0, "tabsrmm_emot", LPGEN("Smiley selector"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'E'), TABSRMM_HK_EMOTICONS },
{ 0, "tabsrmm_hist", LPGEN("Show message history"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'H'), TABSRMM_HK_HISTORY },
{ 0, "tabsrmm_sendmenu", LPGEN("Show send menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'S'), TABSRMM_HK_SENDMENU },
{ 0, "tabsrmm_protomenu", LPGEN("Show protocol menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'P'), TABSRMM_HK_PROTOMENU },
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index cb92cdf4e0..8a7660a4c1 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -413,8 +413,6 @@ void TSAPI SetDialogToType(HWND hwndDlg)
if (!dat->SendFormat)
ShowMultipleControls(hwndDlg, formatControls, _countof(formatControls), SW_HIDE);
- ConfigureSmileyButton(dat);
-
if (dat->pContainer->hwndActive == hwndDlg)
UpdateReadChars(dat);
@@ -2940,7 +2938,6 @@ quote_from_last:
break;
case DM_SMILEYOPTIONSCHANGED:
- ConfigureSmileyButton(dat);
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
break;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index d07dc77e1b..cbda23fd94 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -1652,25 +1652,6 @@ void TSAPI LoadOverrideTheme(TContainerData *pContainer)
LoadThemeDefaults(pContainer);
}
-void TSAPI ConfigureSmileyButton(TWindowData *dat)
-{
- HWND hwndDlg = dat->hwnd;
- int nrSmileys = 0;
- int showToolbar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
- int iItemID = IDC_SMILEYBTN;
-
- if (PluginConfig.g_SmileyAddAvail) {
- nrSmileys = CheckValidSmileyPack(dat->cache->getActiveProto(), dat->cache->getActiveContact());
- dat->bShowSmileys = true;
- }
-
- if (nrSmileys == 0 || dat->hContact == 0)
- dat->bShowSmileys = false;
-
- Utils::showDlgControl(hwndDlg, iItemID, (dat->bShowSmileys && showToolbar) ? SW_SHOW : SW_HIDE);
- Utils::enableDlgControl(hwndDlg, iItemID, dat->bShowSmileys);
-}
-
HICON TSAPI GetXStatusIcon(const TWindowData *dat)
{
BYTE xStatus = dat->cache->getXStatusId();
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h
index 0563e33832..1b2e94beb8 100644
--- a/plugins/TabSRMM/src/msgdlgutils.h
+++ b/plugins/TabSRMM/src/msgdlgutils.h
@@ -63,7 +63,6 @@ void TSAPI HandlePasteAndSend(const TWindowData *dat);
int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat);
void TSAPI LoadOverrideTheme(TContainerData *pContainer);
void TSAPI LoadThemeDefaults(TContainerData *pContainer);
-void TSAPI ConfigureSmileyButton(TWindowData *dat);
int TSAPI CutContactName(const wchar_t *szold, wchar_t *sznew, size_t size);
void TSAPI SendNudge(const TWindowData *dat);
void TSAPI EnableSendButton(const TWindowData *dat, int iMode);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 38911e1741..0f05fc04e6 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -914,35 +914,34 @@ struct TABSRMM_SessionInfo {
* core hotkey service ids
*/
-#define TABSRMM_HK_LASTUNREAD 2
-#define TABSRMM_HK_LASTRECENT 4
-#define TABSRMM_HK_PASTEANDSEND 8
-#define TABSRMM_HK_SETUSERPREFS 9
-#define TABSRMM_HK_CONTAINEROPTIONS 10
-#define TABSRMM_HK_NUDGE 11
-#define TABSRMM_HK_SENDFILE 12
-#define TABSRMM_HK_QUOTEMSG 13
-#define TABSRMM_HK_SEND 14
-#define TABSRMM_HK_EMOTICONS 15
-#define TABARMM_HK_TOGGLEINFOPANEL 16
-#define TABSRMM_HK_HISTORY 17
-#define TABSRMM_HK_TOGGLETOOLBAR 18
-#define TABSRMM_HK_TOGGLEMULTISEND 19
-#define TABSRMM_HK_TOGGLERTL 20
-#define TABSRMM_HK_USERMENU 21
-#define TABSRMM_HK_USERDETAILS 22
-#define TABSRMM_HK_TOGGLEINFOPANEL 23
-#define TABSRMM_HK_CLEARLOG 24
-#define TABSRMM_HK_EDITNOTES 25
-#define TABSRMM_HK_TOGGLESENDLATER 26
-#define TABSRMM_HK_TOGGLESIDEBAR 27
-#define TABSRMM_HK_CHANNELMGR 28
-#define TABSRMM_HK_FILTERTOGGLE 29
-#define TABSRMM_HK_LISTTOGGLE 30
-#define TABSRMM_HK_MUC_SHOWSERVER 31
-#define TABSRMM_HK_CLOSE_OTHER 32
-#define TABSRMM_HK_SENDMENU 33
-#define TABSRMM_HK_PROTOMENU 34
+#define TABSRMM_HK_LASTUNREAD 2
+#define TABSRMM_HK_LASTRECENT 4
+#define TABSRMM_HK_PASTEANDSEND 8
+#define TABSRMM_HK_SETUSERPREFS 9
+#define TABSRMM_HK_CONTAINEROPTIONS 10
+#define TABSRMM_HK_NUDGE 11
+#define TABSRMM_HK_SENDFILE 12
+#define TABSRMM_HK_QUOTEMSG 13
+#define TABSRMM_HK_SEND 14
+#define TABARMM_HK_TOGGLEINFOPANEL 16
+#define TABSRMM_HK_HISTORY 17
+#define TABSRMM_HK_TOGGLETOOLBAR 18
+#define TABSRMM_HK_TOGGLEMULTISEND 19
+#define TABSRMM_HK_TOGGLERTL 20
+#define TABSRMM_HK_USERMENU 21
+#define TABSRMM_HK_USERDETAILS 22
+#define TABSRMM_HK_TOGGLEINFOPANEL 23
+#define TABSRMM_HK_CLEARLOG 24
+#define TABSRMM_HK_EDITNOTES 25
+#define TABSRMM_HK_TOGGLESENDLATER 26
+#define TABSRMM_HK_TOGGLESIDEBAR 27
+#define TABSRMM_HK_CHANNELMGR 28
+#define TABSRMM_HK_FILTERTOGGLE 29
+#define TABSRMM_HK_LISTTOGGLE 30
+#define TABSRMM_HK_MUC_SHOWSERVER 31
+#define TABSRMM_HK_CLOSE_OTHER 32
+#define TABSRMM_HK_SENDMENU 33
+#define TABSRMM_HK_PROTOMENU 34
#define TABSRMM_HK_SECTION_IM LPGEN("Message windows - IM")
#define TABSRMM_HK_SECTION_GENERIC LPGEN("Message windows - all")
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h
index 029ae6c4d9..610daca35e 100644
--- a/plugins/TabSRMM/src/resource.h
+++ b/plugins/TabSRMM/src/resource.h
@@ -179,7 +179,6 @@
#define IDC_DELAY_ERR 1102
#define IDC_RTL 1103
#define IDC_PIC 1104
-#define IDC_SMILEYBTN 1105
#define IDC_FONTBOLD 1106
#define IDC_FONTITALIC 1107
#define IDC_FONTUNDERLINE 1108
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc
index 9a0800758c..8871c47a48 100644
--- a/src/core/stdmsg/res/resource.rc
+++ b/src/core/stdmsg/res/resource.rc
@@ -87,10 +87,6 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW,2,5,12,12
CONTROL "User &details",IDC_NAME,"MButtonClass",WS_TABSTOP,15,2,95,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Add",IDC_ADD,"MButtonClass",WS_TABSTOP,110,2,16,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&User menu",IDC_USERMENU,"MButtonClass",WS_TABSTOP,128,2,16,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&Details",IDC_DETAILS,"MButtonClass",WS_TABSTOP,146,2,16,14,WS_EX_NOACTIVATE | 0x10000000L
- CONTROL "&History",IDC_HISTORY,"MButtonClass",WS_TABSTOP,164,2,16,14,WS_EX_NOACTIVATE | 0x10000000L
CONTROL "",IDC_MESSAGE,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_WANTRETURN | WS_VSCROLL | WS_TABSTOP,1,49,141,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
DEFPUSHBUTTON "&Send",IDOK,143,48,39,15
PUSHBUTTON "Close",IDCANCEL,129,0,54,15,NOT WS_VISIBLE
@@ -211,16 +207,6 @@ BEGIN
ES_NUMBER | WS_VSCROLL | WS_TABSTOP,0,128,127,12,
WS_EX_STATICEDGE
PUSHBUTTON "&Send",IDOK,136,126,115,14,WS_DISABLED
- CONTROL "&Emoticons",IDC_SMILEY,"MButtonClass",WS_DISABLED | WS_TABSTOP,112,108,15,13,0x18000000L
- CONTROL "&Bold",IDC_BOLD,"MButtonClass",WS_DISABLED | WS_TABSTOP,8,108,15,13,0x18000000L
- CONTROL "&Italic",IDC_ITALICS,"MButtonClass",WS_DISABLED | WS_TABSTOP,24,108,15,13,0x18000000L
- CONTROL "&Underline",IDC_UNDERLINE,"MButtonClass",WS_DISABLED | WS_TABSTOP,40,108,15,13,0x18000000L
- CONTROL "&Color",IDC_COLOR,"MButtonClass",WS_DISABLED | WS_TABSTOP,68,108,15,13,0x18000000L
- CONTROL "&Background color",IDC_BKGCOLOR,"MButtonClass",WS_DISABLED | WS_TABSTOP,84,108,15,13,0x18000000L
- CONTROL "&History",IDC_HISTORY,"MButtonClass",WS_TABSTOP,188,108,15,13,0x18000000L
- CONTROL "&Filter",IDC_FILTER,"MButtonClass",WS_TABSTOP,220,108,15,13,0x18000000L
- CONTROL "&Room settings",IDC_CHANMGR,"MButtonClass",WS_DISABLED | WS_TABSTOP,204,108,15,13,0x18000000L
- CONTROL "&Show/Hide nick list",IDC_SHOWNICKLIST,"MButtonClass",WS_TABSTOP,236,108,15,13,0x18000000L
CONTROL "",IDC_LOG,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL |
ES_READONLY | ES_NUMBER | WS_VSCROLL | WS_TABSTOP,8,23,
164,73,WS_EX_STATICEDGE
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 61e9fbb0f5..6bfa86272b 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -66,46 +66,12 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
{
- SendDlgItemMessage(hwndDlg, IDC_SMILEY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("smiley", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("bold", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_ITALICS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("italics", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("underline", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_COLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("fgcol", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("bkgcol", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("history", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("settings", FALSE));
SendDlgItemMessage(hwndDlg, IDC_CLOSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx("close", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bFilterEnabled ? "filter" : "filter2", FALSE));
-
- SendDlgItemMessage(hwndDlg, IDC_SMILEY, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_HISTORY, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_CLOSE, BUTTONSETASFLATBTN, TRUE, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_SMILEY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Insert a smiley"), 0);
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text bold (CTRL+B)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text italicized (CTRL+I)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text underlined (CTRL+U)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a background color for the text (CTRL+L)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a foreground color for the text (CTRL+K)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_HISTORY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show the history (CTRL+H)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show/hide the nick list (CTRL+N)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_CHANMGR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Control this room (CTRL+O)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Enable/disable the event filter (CTRL+F)"), 0);
SendDlgItemMessage(hwndDlg, IDC_CLOSE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Close current tab (CTRL+F4)"), 0);
- SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONSETASPUSHBTN, TRUE, 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
+ SendDlgItemMessage(hwndDlg, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(si->bFilterEnabled ? "filter" : "filter2", FALSE));
MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
if (pInfo) {
@@ -136,7 +102,6 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
int TabHeight = rcTabs.bottom - rcTabs.top;
TabCtrl_AdjustRect(GetDlgItem(hwndDlg, IDC_TAB), FALSE, &rcTabs);
TabHeight -= (rcTabs.bottom - rcTabs.top);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEY), (SmileyAddInstalled && bFormat) ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_BOLD), bFormat ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_UNDERLINE), bFormat ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_ITALICS), bFormat ? SW_SHOW : SW_HIDE);
@@ -220,7 +185,6 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1;
return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
- case IDC_SMILEY:
case IDC_ITALICS:
case IDC_BOLD:
case IDC_UNDERLINE:
@@ -1108,6 +1072,51 @@ static void __cdecl phase2(void * lParam)
PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0);
}
+static void SetButtonsPos(HWND hwndDlg)
+{
+ HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount());
+
+ RECT rc;
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTERY), &rc);
+ POINT pt = { 0, rc.bottom };
+ ScreenToClient(hwndDlg, &pt);
+ pt.y -= 2;
+
+ GetClientRect(hwndDlg, &rc);
+ int iLeftX = 2, iRightX = rc.right - 2;
+ int iGap = db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1);
+
+ for (int i = 0;; i++) {
+ CustomButtonData *cbd = Srmm_GetNthButton(i);
+ if (cbd == NULL || cbd->m_bRSided)
+ break;
+
+ HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
+ if (hwndButton == NULL)
+ continue;
+
+ int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22);
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ iLeftX += width;
+ }
+
+ for (int i = Srmm_GetButtonCount() - 1; i >= 0; i--) {
+ CustomButtonData *cbd = Srmm_GetNthButton(i);
+ if (!cbd->m_bRSided)
+ break;
+
+ HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
+ if (hwndButton == NULL)
+ continue;
+
+ int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22);
+ iRightX -= width;
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+
+ EndDeferWindowPos(hdwp);
+}
+
INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
SESSION_INFO *s, *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -1121,6 +1130,21 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
si = (SESSION_INFO*)lParam;
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si);
+
+ CustomButtonData *cbd;
+ for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
+ if (!cbd->m_bChatButton)
+ continue;
+
+ int width = (cbd->m_dwArrowCID) ? 34 : 22;
+ HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, width, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL);
+ SendMessage(hwndButton, BUTTONSETASFLATBTN, TRUE, 0);
+ if (cbd->m_pwszTooltip)
+ SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE);
+ if (cbd->m_hIcon)
+ SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon));
+ }
+
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERX), SplitterSubclassProc);
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc);
mir_subclassWindow(hNickList, NicklistSubclassProc);
@@ -1156,8 +1180,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
TabM_RemoveAll();
- EnableWindow(GetDlgItem(hwndDlg, IDC_SMILEY), TRUE);
-
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, TRUE, 0);
SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0);
@@ -1169,7 +1191,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case GC_SETWNDPROPS:
{
- // LoadGlobalSettings(); !!!!!!!!!!!!!!!!!!!!!!
InitButtons(hwndDlg, si);
// stupid hack to make icons show. I dunno why this is needed currently
@@ -1343,6 +1364,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
SendMessage(si->hwndStatus, WM_SIZE, 0, 0);
Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)si);
+ SetButtonsPos(hwndDlg);
InvalidateRect(si->hwndStatus, NULL, TRUE);
RedrawWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
@@ -1838,7 +1860,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{
POINT pt;
RECT rcLog;
- BOOL bFormat = IsWindowVisible(GetDlgItem(hwndDlg, IDC_SMILEY));
static int x = 0;
@@ -1858,6 +1879,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
g_Settings.iSplitterX = si->iSplitterX;
}
else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY)) {
+ BOOL bFormat = IsWindowVisible(GetDlgItem(hwndDlg, IDC_BOLD));
int oldSplitterY;
GetClientRect(hwndDlg, &rc);
pt.x = 0; pt.y = wParam;
@@ -2304,24 +2326,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
break;
- case IDC_SMILEY:
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEY), &rc);
-
- if (SmileyAddInstalled) {
- SMADD_SHOWSEL3 smaddInfo = { sizeof(smaddInfo) };
- smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_MESSAGE);
- smaddInfo.targetMessage = EM_REPLACESEL;
- smaddInfo.targetWParam = TRUE;
- smaddInfo.Protocolname = si->pszModule;
- smaddInfo.Direction = 3;
- smaddInfo.xPosition = rc.left + 3;
- smaddInfo.yPosition = rc.top - 1;
- smaddInfo.hContact = si->hContact;
- smaddInfo.hwndParent = hwndDlg;
- CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
- }
- break;
-
case IDC_HISTORY:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_HISTORY))) {
MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp
index 0523308b66..55b2214d7f 100644
--- a/src/core/stdmsg/src/globals.cpp
+++ b/src/core/stdmsg/src/globals.cpp
@@ -44,9 +44,6 @@ static int IconsChanged(WPARAM, LPARAM)
static int OnShutdown(WPARAM, LPARAM)
{
- WindowList_Destroy(g_dat.hMessageWindowList);
- g_dat.hMessageWindowList = NULL;
-
for (SESSION_INFO *si = pci->wndList; si; si = si->next)
SendMessage(si->hWnd, WM_CLOSE, 0, 0);
@@ -58,7 +55,7 @@ static int OnShutdown(WPARAM, LPARAM)
static int OnMetaChanged(WPARAM hMeta, LPARAM)
{
if (hMeta) {
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hMeta);
+ HWND hwnd = WindowList_Find(pci->hWindowList, hMeta);
if (hwnd != NULL)
SendMessage(hwnd, DM_GETAVATAR, 0, 0);
}
@@ -68,13 +65,13 @@ static int OnMetaChanged(WPARAM hMeta, LPARAM)
static int dbaddedevent(WPARAM hContact, LPARAM hDbEvent)
{
if (hContact) {
- HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ HWND h = WindowList_Find(pci->hWindowList, hContact);
if (h)
SendMessage(h, HM_DBEVENTADDED, hContact, hDbEvent);
MCONTACT hEventContact = db_event_getContact(hDbEvent);
if (hEventContact != hContact)
- if ((h = WindowList_Find(g_dat.hMessageWindowList, hEventContact)) != NULL)
+ if ((h = WindowList_Find(pci->hWindowList, hEventContact)) != NULL)
SendMessage(h, HM_DBEVENTADDED, hEventContact, hDbEvent);
}
return 0;
@@ -94,7 +91,7 @@ static int ackevent(WPARAM, LPARAM lParam)
int AvatarChanged(WPARAM hContact, LPARAM lParam)
{
- HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ HWND h = WindowList_Find(pci->hWindowList, hContact);
if (h)
SendMessage(h, HM_AVATARACK, hContact, lParam);
return 0;
@@ -157,8 +154,6 @@ void ReloadGlobals()
void InitGlobals()
{
- g_dat.hMessageWindowList = WindowList_Create();
-
HookEvent(ME_DB_EVENT_ADDED, dbaddedevent);
HookEvent(ME_PROTO_ACK, ackevent);
HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h
index a6e0c43682..1b8dfb1aaa 100644
--- a/src/core/stdmsg/src/globals.h
+++ b/src/core/stdmsg/src/globals.h
@@ -50,7 +50,6 @@ struct SrmmFlags
struct GlobalMessageData
{
SrmmFlags flags;
- MWindowList hMessageWindowList;
DWORD openFlags;
DWORD msgTimeout;
DWORD nFlashMax;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 0209a74695..da30d9a647 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -34,7 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus);
static const UINT infoLineControls[] = { IDC_PROTOCOL, IDC_NAME };
-static const UINT buttonLineControls[] = { IDC_ADD, IDC_USERMENU, IDC_DETAILS, IDC_HISTORY };
static const UINT sendControls[] = { IDC_MESSAGE };
static void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type)
@@ -103,8 +102,7 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* s
if (!mir_wstrcmp(fd.cFileName, L".") || !mir_wstrcmp(fd.cFileName, L"..")) continue;
mir_snwprintf(szPath, L"%s\\%s", szFilename, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
- }
- while (FindNextFile(hFind, &fd));
+ } while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
}
@@ -177,14 +175,21 @@ static void SetDialogToType(HWND hwndDlg)
else
ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), SW_HIDE);
- if (dat->hContact) {
- ShowMultipleControls(hwndDlg, buttonLineControls, _countof(buttonLineControls), g_dat.flags.bShowButtons ? SW_SHOW : SW_HIDE);
- if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
- ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
+ CustomButtonData *cbd;
+ for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
+ HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
+ if (hwndButton == NULL)
+ continue;
+
+ if (dat->hContact) {
+ if (cbd->m_dwButtonCID == IDC_ADD && !db_get_b(dat->hContact, "CList", "NotOnList", 0))
+ ShowWindow(hwndButton, SW_HIDE);
+ else
+ ShowWindow(hwndButton, g_dat.flags.bShowButtons ? SW_SHOW : SW_HIDE);
+ }
+ else ShowWindow(hwndButton, SW_HIDE);
}
- else ShowMultipleControls(hwndDlg, buttonLineControls, _countof(buttonLineControls), SW_HIDE);
- ShowMultipleControls(hwndDlg, sendControls, _countof(sendControls), SW_SHOW);
if (!dat->hwndStatus) {
int grip = (GetWindowLongPtr(hwndDlg, GWL_STYLE) & WS_THICKFRAME) ? SBARS_SIZEGRIP : 0;
dat->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | grip, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL);
@@ -265,7 +270,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
else dat->lastEnterTime = 0;
if (((wParam == VK_INSERT && (GetKeyState(VK_SHIFT) & 0x8000)) || (wParam == 'V' && (GetKeyState(VK_CONTROL) & 0x8000))) &&
- !(GetKeyState(VK_MENU) & 0x8000)) { // ctrl-v (paste clean text)
+ !(GetKeyState(VK_MENU) & 0x8000)) { // ctrl-v (paste clean text)
SendMessage(hwnd, WM_PASTE, 0, 0);
return 0;
}
@@ -317,104 +322,104 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
break;
case WM_CONTEXTMENU:
- {
- static const CHARRANGE all = { 0, -1 };
-
- MessageWindowPopupData mwpd = { 0 };
- mwpd.cbSize = sizeof(mwpd);
- mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
- mwpd.uFlags = MSG_WINDOWPOPUP_INPUT;
- mwpd.hContact = pdat->hContact;
- mwpd.hwnd = hwnd;
-
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
-
- mwpd.hMenu = GetSubMenu(hMenu, 2);
- TranslateMenu(mwpd.hMenu);
-
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin == sel.cpMax) {
- EnableMenuItem(mwpd.hMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(mwpd.hMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(mwpd.hMenu, IDM_DELETE, MF_BYCOMMAND | MF_GRAYED);
- }
- if (!SendMessage(hwnd, EM_CANUNDO, 0, 0))
- EnableMenuItem(mwpd.hMenu, IDM_UNDO, MF_BYCOMMAND | MF_GRAYED);
+ {
+ static const CHARRANGE all = { 0, -1 };
+
+ MessageWindowPopupData mwpd = { 0 };
+ mwpd.cbSize = sizeof(mwpd);
+ mwpd.uType = MSG_WINDOWPOPUP_SHOWING;
+ mwpd.uFlags = MSG_WINDOWPOPUP_INPUT;
+ mwpd.hContact = pdat->hContact;
+ mwpd.hwnd = hwnd;
+
+ HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+
+ mwpd.hMenu = GetSubMenu(hMenu, 2);
+ TranslateMenu(mwpd.hMenu);
+
+ CHARRANGE sel;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin == sel.cpMax) {
+ EnableMenuItem(mwpd.hMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED);
+ EnableMenuItem(mwpd.hMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED);
+ EnableMenuItem(mwpd.hMenu, IDM_DELETE, MF_BYCOMMAND | MF_GRAYED);
+ }
+ if (!SendMessage(hwnd, EM_CANUNDO, 0, 0))
+ EnableMenuItem(mwpd.hMenu, IDM_UNDO, MF_BYCOMMAND | MF_GRAYED);
- if (!SendMessage(hwnd, EM_CANREDO, 0, 0))
- EnableMenuItem(mwpd.hMenu, IDM_REDO, MF_BYCOMMAND | MF_GRAYED);
+ if (!SendMessage(hwnd, EM_CANREDO, 0, 0))
+ EnableMenuItem(mwpd.hMenu, IDM_REDO, MF_BYCOMMAND | MF_GRAYED);
- if (!SendMessage(hwnd, EM_CANPASTE, 0, 0)) {
- if (!IsClipboardFormatAvailable(CF_HDROP))
- EnableMenuItem(mwpd.hMenu, IDM_PASTE, MF_BYCOMMAND | MF_GRAYED);
- EnableMenuItem(mwpd.hMenu, IDM_PASTESEND, MF_BYCOMMAND | MF_GRAYED);
- }
+ if (!SendMessage(hwnd, EM_CANPASTE, 0, 0)) {
+ if (!IsClipboardFormatAvailable(CF_HDROP))
+ EnableMenuItem(mwpd.hMenu, IDM_PASTE, MF_BYCOMMAND | MF_GRAYED);
+ EnableMenuItem(mwpd.hMenu, IDM_PASTESEND, MF_BYCOMMAND | MF_GRAYED);
+ }
- if (lParam == 0xFFFFFFFF) {
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&mwpd.pt, (LPARAM)sel.cpMax);
- ClientToScreen(hwnd, &mwpd.pt);
- }
- else {
- mwpd.pt.x = GET_X_LPARAM(lParam);
- mwpd.pt.y = GET_Y_LPARAM(lParam);
- }
+ if (lParam == 0xFFFFFFFF) {
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&mwpd.pt, (LPARAM)sel.cpMax);
+ ClientToScreen(hwnd, &mwpd.pt);
+ }
+ else {
+ mwpd.pt.x = GET_X_LPARAM(lParam);
+ mwpd.pt.y = GET_Y_LPARAM(lParam);
+ }
- // First notification
- NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd);
+ // First notification
+ NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd);
- // Someone added items?
- if (GetMenuItemCount(mwpd.hMenu) > 0) {
- SetCursor(LoadCursor(NULL, IDC_ARROW));
- mwpd.selection = TrackPopupMenu(mwpd.hMenu, TPM_RETURNCMD, mwpd.pt.x, mwpd.pt.y, 0, hwnd, NULL);
- }
+ // Someone added items?
+ if (GetMenuItemCount(mwpd.hMenu) > 0) {
+ SetCursor(LoadCursor(NULL, IDC_ARROW));
+ mwpd.selection = TrackPopupMenu(mwpd.hMenu, TPM_RETURNCMD, mwpd.pt.x, mwpd.pt.y, 0, hwnd, NULL);
+ }
- // Second notification
- mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
- NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd);
+ // Second notification
+ mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
+ NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd);
- switch (mwpd.selection) {
- case IDM_UNDO:
- SendMessage(hwnd, WM_UNDO, 0, 0);
- break;
+ switch (mwpd.selection) {
+ case IDM_UNDO:
+ SendMessage(hwnd, WM_UNDO, 0, 0);
+ break;
- case IDM_REDO:
- SendMessage(hwnd, EM_REDO, 0, 0);
- break;
+ case IDM_REDO:
+ SendMessage(hwnd, EM_REDO, 0, 0);
+ break;
- case IDM_CUT:
- SendMessage(hwnd, WM_CUT, 0, 0);
- break;
+ case IDM_CUT:
+ SendMessage(hwnd, WM_CUT, 0, 0);
+ break;
- case IDM_COPY:
- SendMessage(hwnd, WM_COPY, 0, 0);
- break;
+ case IDM_COPY:
+ SendMessage(hwnd, WM_COPY, 0, 0);
+ break;
- case IDM_PASTE:
- SendMessage(hwnd, WM_PASTE, 0, 0);
- break;
+ case IDM_PASTE:
+ SendMessage(hwnd, WM_PASTE, 0, 0);
+ break;
- case IDM_PASTESEND:
- SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0);
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- break;
+ case IDM_PASTESEND:
+ SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0);
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
+ break;
- case IDM_DELETE:
- SendMessage(hwnd, EM_REPLACESEL, TRUE, 0);
- break;
+ case IDM_DELETE:
+ SendMessage(hwnd, EM_REPLACESEL, TRUE, 0);
+ break;
- case IDM_SELECTALL:
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all);
- break;
+ case IDM_SELECTALL:
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all);
+ break;
- case IDM_CLEAR:
- SetWindowText(hwnd, L"");
- break;
+ case IDM_CLEAR:
+ SetWindowText(hwnd, L"");
+ break;
+ }
+ DestroyMenu(hMenu);
+ return 0;
}
- DestroyMenu(hMenu);
- return 0;
- }
case WM_PASTE:
if (IsClipboardFormatAvailable(CF_HDROP)) {
@@ -468,46 +473,68 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
-static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc)
+static void SetButtonsPos(SrmmWindowData *dat, HWND hwndDlg)
{
- SrmmWindowData *dat = (SrmmWindowData *)lParam;
+ HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount());
- if (!g_dat.flags.bShowInfo && !g_dat.flags.bShowButtons) {
- for (int i = 0; i < _countof(buttonLineControls); i++)
- if (buttonLineControls[i] == urc->wId)
- OffsetRect(&urc->rcItem, 0, -dat->lineHeight);
+ RECT rc;
+ GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc);
+ int iButtonY = rc.top + 4;
+ if (!g_dat.flags.bShowInfo && !g_dat.flags.bShowButtons)
+ iButtonY -= dat->lineHeight;
+
+ GetClientRect(hwndDlg, &rc);
+ int iButtonX = rc.right - 2;
+ int iGap = db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1);
+ bool bIsRight = true;
+
+ for (int i = Srmm_GetButtonCount()-1; i >= 0; i--) {
+ CustomButtonData *cbd = Srmm_GetNthButton(i);
+ int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22);
+
+ HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
+ if (NULL != hwndButton) /* Wine fix. */ {
+ iButtonX -= width;
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iButtonX, iButtonY, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+
+ if (bIsRight && !cbd->m_bRSided) {
+ bIsRight = false;
+ iButtonX -= 8; // draw gap
+ }
}
+ EndDeferWindowPos(hdwp);
+}
+
+static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
+{
+ SrmmWindowData *dat = (SrmmWindowData *)lParam;
+
switch (urc->wId) {
case IDC_NAME:
- {
- HWND h = GetDlgItem(hwndDlg, IDC_NAME);
- int len = GetWindowTextLength(h);
- if (len > 0) {
- wchar_t buf[256];
- GetWindowText(h, buf, _countof(buf));
-
- HDC hdc = GetDC(h);
- HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0));
-
- SIZE textSize;
- GetTextExtentPoint32(hdc, buf, (int)mir_wstrlen(buf), &textSize);
- urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
- if (g_dat.flags.bShowButtons && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
- urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight;
- SelectObject(hdc, hFont);
- ReleaseDC(h, hdc);
+ {
+ HWND h = GetDlgItem(hwndDlg, IDC_NAME);
+ int len = GetWindowTextLength(h);
+ if (len > 0) {
+ wchar_t buf[256];
+ GetWindowText(h, buf, _countof(buf));
+
+ HDC hdc = GetDC(h);
+ HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0));
+
+ SIZE textSize;
+ GetTextExtentPoint32(hdc, buf, (int)mir_wstrlen(buf), &textSize);
+ urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
+ if (g_dat.flags.bShowButtons && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
+ urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight;
+ SelectObject(hdc, hFont);
+ ReleaseDC(h, hdc);
+ }
}
- }
case IDC_PROTOCOL:
return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
- case IDC_ADD:
- case IDC_USERMENU:
- case IDC_DETAILS:
- case IDC_HISTORY:
- return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP;
-
case IDC_LOG:
if (!(g_dat.flags.bShowInfo) && !(g_dat.flags.bShowButtons))
urc->rcItem.top -= dat->lineHeight;
@@ -621,7 +648,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
SetDlgItemText(hwndDlg, IDC_MESSAGE, (wchar_t*)newData->szInitialText);
else
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
-
+
int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
}
@@ -644,29 +671,35 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL);
{
RECT rc, rc2;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc);
GetWindowRect(hwndDlg, &rc2);
dat->nLabelRight = rc2.right - rc.left;
POINT pt;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTER), &rc);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_SPLITTER), &rc);
pt.y = (rc.top + rc.bottom) / 2;
pt.x = 0;
- ScreenToClient(hwndDlg, &pt);
dat->originalSplitterPos = pt.y;
if (dat->splitterPos == -1)
dat->splitterPos = dat->originalSplitterPos;// + 60;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rc);
- dat->lineHeight = rc.bottom - rc.top + 3;
+
+ CustomButtonData *cbd;
+ for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
+ if (!cbd->m_bIMButton)
+ continue;
+
+ int width = (cbd->m_dwArrowCID) ? 34 : 22;
+ HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, width, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL);
+ if (cbd->m_pwszTooltip)
+ SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE);
+ if (cbd->m_hIcon)
+ SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon));
+ }
}
- WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->hContact);
+ WindowList_Add(pci->hWindowList, hwndDlg, dat->hContact);
GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &dat->minEditInit);
SendMessage(hwndDlg, DM_UPDATESIZEBAR, 0, 0);
dat->hwndStatus = NULL;
- Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list"));
- Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
- Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history"));
- Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu"));
SendDlgItemMessage(hwndDlg, IDC_NAME, BUTTONSETASFLATBTN, TRUE, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOL), FALSE);
@@ -749,8 +782,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
PostMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
break;
}
- }
- while (hdbEvent = db_event_prev(dat->hContact, hdbEvent));
+ } while (hdbEvent = db_event_prev(dat->hContact, hdbEvent));
}
SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 1, 0);
@@ -780,7 +812,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
else SetWindowPos(hwndDlg, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);
}
if (!savePerContact && db_get_b(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE))
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_CASCADENEWWINDOW, (WPARAM)hwndDlg, (LPARAM)& dat->windowWasCascaded);
+ WindowList_Broadcast(pci->hWindowList, DM_CASCADENEWWINDOW, (WPARAM)hwndDlg, (LPARAM)& dat->windowWasCascaded);
}
if (newData->noActivate) {
SetWindowPos(hwndDlg, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
@@ -825,7 +857,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
wchar_t szFilename[MAX_PATH];
HDROP hDrop = (HDROP)wParam;
int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
- wchar_t** ppFiles = NULL;
+ wchar_t **ppFiles = NULL;
for (i = 0; i < fileCount; i++) {
DragQueryFile(hDrop, i, szFilename, _countof(szFilename));
AddToFileList(&ppFiles, &totalCount, szFilename);
@@ -915,7 +947,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact, dat->szProto));
if (id != NULL && OpenClipboard(hwndDlg)) {
EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(id) * sizeof(wchar_t)+1);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(id) * sizeof(wchar_t) + 1);
mir_wstrcpy((wchar_t*)GlobalLock(hData), id);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
@@ -993,41 +1025,38 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
break;
case DM_UPDATETITLE:
- {
- wchar_t newtitle[256];
- if (dat->hContact && dat->szProto) {
- int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON);
-
- dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
+ wchar_t newtitle[256];
+ if (dat->hContact && dat->szProto) {
+ int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON);
- ptrW id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto));
- SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
+ dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
- wchar_t *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
- if (statusIcon)
- mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
- else
- mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
-
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
- if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) {
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE);
- if (statusIcon)
- SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
- }
+ ptrW id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto));
+ SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
- dat->wOldStatus = dat->wStatus;
- }
+ wchar_t *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
+ if (statusIcon)
+ mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
else
- mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
+ mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
- wchar_t oldtitle[256];
- GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
- if (mir_wstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
- SetWindowText(hwndDlg, newtitle);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
+ if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) {
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE);
+ if (statusIcon)
+ SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
}
+
+ dat->wOldStatus = dat->wStatus;
+ }
+ else mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
+
+ wchar_t oldtitle[256];
+ GetWindowText(hwndDlg, oldtitle, _countof(oldtitle));
+ if (mir_wstrcmp(newtitle, oldtitle)) { //swt() flickers even if the title hasn't actually changed
+ SetWindowText(hwndDlg, newtitle);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
break;
@@ -1039,8 +1068,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
case DM_GETWINDOWSTATE:
{
- UINT state = 0;
- state |= MSG_WINDOW_STATE_EXISTS;
+ UINT state = MSG_WINDOW_STATE_EXISTS;
if (IsWindowVisible(hwndDlg))
state |= MSG_WINDOW_STATE_VISIBLE;
if (GetForegroundWindow() == hwndDlg)
@@ -1077,7 +1105,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
case WM_GETMINMAXINFO:
{
- MINMAXINFO* mmi = (MINMAXINFO *)lParam;
+ MINMAXINFO *mmi = (MINMAXINFO *)lParam;
RECT rcWindow, rcLog;
GetWindowRect(hwndDlg, &rcWindow);
GetWindowRect(GetDlgItem(hwndDlg, IDC_LOG), &rcLog);
@@ -1104,6 +1132,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
}
Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_MSG), MessageDialogResize, (LPARAM)dat);
+ SetButtonsPos(dat, hwndDlg);
// The statusbar sometimes draws over these 2 controls so
// redraw them
@@ -1318,7 +1347,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
SetStretchBltMode(dis->hDC, HALFTONE);
StretchBlt(dis->hDC, 1, 1, dat->avatarWidth - 2, dat->avatarHeight - 2, hdcMem, 0, 0,
- bminfo.bmWidth, bminfo.bmHeight, SRCCOPY);
+ bminfo.bmWidth, bminfo.bmHeight, SRCCOPY);
SelectObject(hdcMem, hbmMem);
DeleteDC(hdcMem);
@@ -1331,6 +1360,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if (!lParam && Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, dat->hContact))
break;
+ // custom button handling
+ if (HIWORD(wParam) == BN_CLICKED)
+ if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
+ Srmm_ClickToolbarIcon(dat->hContact, LOWORD(wParam), GetDlgItem(hwndDlg, LOWORD(wParam)), 0);
+ break;
+ }
+
switch (LOWORD(wParam)) {
case IDOK:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) {
@@ -1436,7 +1472,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
switch (((LPNMHDR)lParam)->code) {
case EN_MSGFILTER:
switch (((MSGFILTER *)lParam)->msg) {
- HCURSOR hCur;
+ HCURSOR hCur;
case WM_LBUTTONDOWN:
hCur = GetCursor();
if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) {
@@ -1600,7 +1636,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
mir_free(dat->cmdList[i]);
dat->cmdList.destroy();
- WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
+ WindowList_Remove(pci->hWindowList, hwndDlg);
db_set_dw(bSavePerContact ? dat->hContact : NULL, SRMMMOD, "splitterPos", dat->splitterPos);
if (dat->hFont) {
@@ -1624,10 +1660,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
db_delete_contact(dat->hContact);
- Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD);
- Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS);
- Button_FreeIcon_IcoLib(hwndDlg, IDC_HISTORY);
- Button_FreeIcon_IcoLib(hwndDlg, IDC_USERMENU);
Window_FreeIcon_IcoLib(hwndDlg);
delete dat;
}
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 3f43915736..c7b6095213 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -312,7 +312,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
db_set_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
ReloadGlobals();
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0);
return TRUE;
}
}
@@ -407,7 +407,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
FreeMsgLogIcons();
LoadMsgLogIcons();
ReloadGlobals();
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0);
return TRUE;
}
break;
@@ -536,7 +536,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam
db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY));
db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
ReloadGlobals();
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0);
}
}
break;
@@ -549,11 +549,12 @@ static int OptInitialise(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 910000000;
odp.hInstance = g_hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG);
odp.szTab.a = LPGEN("Messaging");
+ odp.flags = ODPF_BOLDGROUPS;
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG);
odp.szTitle.a = LPGEN("Message sessions");
odp.pfnDlgProc = DlgProcOptions;
- odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGLOG);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 7c68133a7c..43f1c0fa5c 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -62,7 +62,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
pcli->pfnRemoveEvent(hContact, 1);
/* does a window for the contact exist? */
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
if (hwnd) {
if (!db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS)) {
ShowWindow(hwnd, SW_RESTORE);
@@ -113,7 +113,7 @@ INT_PTR SendMessageCmd(MCONTACT hContact, char *msg, int isWchar)
hContact = db_mc_tryMeta(hContact);
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
if (hwnd) {
if (msg) {
SendDlgItemMessage(hwnd, IDC_MESSAGE, EM_SETSEL, -1, SendDlgItemMessage(hwnd, IDC_MESSAGE, WM_GETTEXTLENGTH, 0, 0));
@@ -164,7 +164,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
SkinPlaySound((lParam) ? "TNStart" : "TNStop");
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
if (hwnd)
SendMessage(hwnd, DM_TYPING, 0, lParam);
else if (lParam && g_dat.flags.bShowTypingTray) {
@@ -197,14 +197,14 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
if (!strcmp(cws->szModule, "CList"))
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM)cws, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_UPDATETITLE, (WPARAM)cws, 0);
else if (hContact) {
if (cws->szSetting && !strcmp(cws->szSetting, "Timezone"))
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_NEWTIMEZONE, (WPARAM)cws, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_NEWTIMEZONE, (WPARAM)cws, 0);
else {
char *szProto = GetContactProto(hContact);
if (szProto && !strcmp(cws->szModule, szProto))
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM)cws, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_UPDATETITLE, (WPARAM)cws, 0);
}
}
return 0;
@@ -213,7 +213,7 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam)
// If a contact gets deleted, close its message window if there is any
static int ContactDeleted(WPARAM wParam, LPARAM)
{
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam);
+ HWND hwnd = WindowList_Find(pci->hWindowList, wParam);
if (hwnd)
SendMessage(hwnd, WM_CLOSE, 0, 0);
@@ -246,7 +246,7 @@ static void RestoreUnreadMessageAlerts(void)
dbei.cbBlob = 0;
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
- int windowAlreadyExists = WindowList_Find(g_dat.hMessageWindowList, hContact) != NULL;
+ int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != NULL;
if (windowAlreadyExists)
continue;
@@ -284,9 +284,93 @@ static void RestoreUnreadMessageAlerts(void)
void RegisterSRMMFonts(void);
+int RegisterToolbarIcons(WPARAM, LPARAM)
+{
+ BBButton bbd = {};
+ bbd.pszModuleName = "SRMM";
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_CREATEBYID;
+
+ bbd.dwButtonID = IDC_ADD;
+ bbd.dwDefPos = 10;
+ bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_ADDCONTACT);
+ bbd.pwszTooltip = LPGENW("Add contact permanently to list");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_USERMENU;
+ bbd.dwDefPos = 20;
+ bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_DOWNARROW);
+ bbd.pwszTooltip = LPGENW("User menu");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_DETAILS;
+ bbd.dwDefPos = 30;
+ bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS);
+ bbd.pwszTooltip = LPGENW("View user's details");
+ Srmm_AddButton(&bbd);
+
+ bbd.bbbFlags |= BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
+ bbd.dwButtonID = IDC_HISTORY;
+ bbd.dwDefPos = 40;
+ bbd.hIcon = Skin_GetIconHandle(SKINICON_OTHER_HISTORY);
+ bbd.pwszTooltip = LPGENW("View user's history");
+ Srmm_AddButton(&bbd);
+
+ // chat buttons
+ bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID;
+ bbd.dwButtonID = IDC_BOLD;
+ bbd.dwDefPos = 10;
+ bbd.hIcon = GetIconHandle("bold");
+ bbd.pwszTooltip = LPGENW("Make the text bold(CTRL + B)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_ITALICS;
+ bbd.dwDefPos = 15;
+ bbd.hIcon = GetIconHandle("italics");
+ bbd.pwszTooltip = LPGENW("Make the text italicized (CTRL+I)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_UNDERLINE;
+ bbd.dwDefPos = 20;
+ bbd.hIcon = GetIconHandle("underline");
+ bbd.pwszTooltip = LPGENW("Make the text underlined (CTRL+U)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_COLOR;
+ bbd.dwDefPos = 25;
+ bbd.hIcon = GetIconHandle("fgcol");
+ bbd.pwszTooltip = LPGENW("Select a foreground color for the text (CTRL+K)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_BKGCOLOR;
+ bbd.dwDefPos = 30;
+ bbd.hIcon = GetIconHandle("bkgcol");
+ bbd.pwszTooltip = LPGENW("Select a background color for the text");
+ Srmm_AddButton(&bbd);
+
+ bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID;
+ bbd.dwButtonID = IDC_CHANMGR;
+ bbd.dwDefPos = 30;
+ bbd.hIcon = GetIconHandle("settings");
+ bbd.pwszTooltip = LPGENW("Control this room (CTRL+O)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_SHOWNICKLIST;
+ bbd.dwDefPos = 20;
+ bbd.hIcon = GetIconHandle("nicklist");
+ bbd.pwszTooltip = LPGENW("Show/hide the nick list (CTRL+N)");
+ Srmm_AddButton(&bbd);
+
+ bbd.dwButtonID = IDC_FILTER;
+ bbd.dwDefPos = 10;
+ bbd.hIcon = GetIconHandle("filter");
+ bbd.pwszTooltip = LPGENW("Enable/disable the event filter (CTRL+F)");
+ Srmm_AddButton(&bbd);
+ return 0;
+}
+
static int FontsChanged(WPARAM, LPARAM)
{
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0);
return 0;
}
@@ -306,6 +390,7 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM)
hMsgMenuItem = Menu_AddContactMenuItem(&mi);
HookEvent(ME_FONT_RELOAD, FontsChanged);
+ HookEvent(ME_MSG_TOOLBARLOADED, RegisterToolbarIcons);
RestoreUnreadMessageAlerts();
return 0;
@@ -313,7 +398,7 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM)
int PreshutdownSendRecv(WPARAM, LPARAM)
{
- WindowList_Broadcast(g_dat.hMessageWindowList, WM_CLOSE, 0, 0);
+ WindowList_Broadcast(pci->hWindowList, WM_CLOSE, 0, 0);
DeinitStatusIcons();
return 0;
@@ -323,9 +408,9 @@ static int IconsChanged(WPARAM, LPARAM)
{
FreeMsgLogIcons();
LoadMsgLogIcons();
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_REMAKELOG, 0, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_REMAKELOG, 0, 0);
// change all the icons
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATEWINICON, 0, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_UPDATEWINICON, 0, 0);
return 0;
}
@@ -361,7 +446,7 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam)
static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam)
{
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam);
+ HWND hwnd = WindowList_Find(pci->hWindowList, wParam);
if (hwnd == NULL)
return 1;
@@ -389,7 +474,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
if(mwd == NULL || (mwd->cbSize != sizeof(MessageWindowData)))
return 1;
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, mwid->hContact);
+ HWND hwnd = WindowList_Find(pci->hWindowList, mwid->hContact);
mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
mwd->hwndWindow = hwnd;
mwd->local = 0;
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp
index 2a39135e88..22a09500ad 100644
--- a/src/core/stdmsg/src/msgtimedout.cpp
+++ b/src/core/stdmsg/src/msgtimedout.cpp
@@ -93,11 +93,11 @@ void MessageFailureProcess(TMsgQueue *item, const char* err)
{
MCONTACT hContact = db_mc_tryMeta(item->hContact);
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
if (hwnd == NULL) {
// If message window doesn't already exist, open a new one
SendMessageCmd(item->hContact, NULL, 0);
- hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ hwnd = WindowList_Find(pci->hWindowList, hContact);
}
else SendMessage(hwnd, DM_REMAKELOG, 0, 0);
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h
index 197b67b769..3e90360cb3 100644
--- a/src/core/stdmsg/src/resource.h
+++ b/src/core/stdmsg/src/resource.h
@@ -67,7 +67,6 @@
#define IDC_AUTOCLOSE 1004
#define IDC_AUTOMIN 1005
#define IDC_DONOTSTEALFOCUS 1006
-#define IDC_SMILEY 1007
#define IDC_SPLITTERY 1008
#define IDC_SPLITTER 1008
#define IDC_NAME 1009
diff --git a/src/core/stdmsg/src/srmm.cpp b/src/core/stdmsg/src/srmm.cpp
index 434d561160..d534862607 100644
--- a/src/core/stdmsg/src/srmm.cpp
+++ b/src/core/stdmsg/src/srmm.cpp
@@ -38,7 +38,7 @@ PLUGININFOEX pluginInfo = {
__COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE,
- {0x657fe89b, 0xd121, 0x40c2, { 0x8a, 0xc9, 0xb9, 0xfa, 0x57, 0x55, 0xb3, 0x0D }} //{657FE89B-D121-40c2-8AC9-B9FA5755B30D}
+ { 0x657fe89b, 0xd121, 0x40c2, { 0x8a, 0xc9, 0xb9, 0xfa, 0x57, 0x55, 0xb3, 0x0D } } //{657FE89B-D121-40c2-8AC9-B9FA5755B30D}
};
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
@@ -47,7 +47,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp
index fc3be1fe4e..50ee08084e 100644
--- a/src/core/stdmsg/src/statusicon.cpp
+++ b/src/core/stdmsg/src/statusicon.cpp
@@ -27,9 +27,9 @@ HANDLE hHookIconPressedEvt;
static int OnSrmmIconChanged(WPARAM hContact, LPARAM)
{
if (hContact == NULL)
- WindowList_Broadcast(g_dat.hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(pci->hWindowList, DM_STATUSICONCHANGE, 0, 0);
else {
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
if (hwnd != NULL)
PostMessage(hwnd, DM_STATUSICONCHANGE, 0, 0);
}
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp
index e3e93a29b2..988f5d9949 100644
--- a/src/mir_app/src/srmm_toolbar.cpp
+++ b/src/mir_app/src/srmm_toolbar.cpp
@@ -113,12 +113,10 @@ MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang)
return 1;
CustomButtonData *cbd = new CustomButtonData();
- if (!bbdi->iButtonWidth && (bbdi->bbbFlags & BBBF_ISARROWBUTTON))
+ if (bbdi->bbbFlags & BBBF_ISARROWBUTTON)
cbd->m_iButtonWidth = DPISCALEX_S(34);
- else if (!bbdi->iButtonWidth)
- cbd->m_iButtonWidth = DPISCALEX_S(22);
else
- cbd->m_iButtonWidth = DPISCALEX_S(bbdi->iButtonWidth);
+ cbd->m_iButtonWidth = DPISCALEX_S(22);
cbd->m_pszModuleName = mir_strdup(bbdi->pszModuleName);
cbd->m_pwszTooltip = mir_wstrdup(bbdi->pwszTooltip);