summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Scriver')
-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
13 files changed, 309 insertions, 357 deletions
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