diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-13 14:47:34 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-13 14:47:34 +0000 |
commit | c6d2c013851f3337ab59a4413f7c7447af27142a (patch) | |
tree | f34c1b601330f06f183fb96966471d48e1e56b5b | |
parent | e95cabc57a0f82a6fb6316dbd2e3b3fdaccff6f3 (diff) |
added always on top option (also in window system menu)
added close tab miranda flat button
set window icon to message icon if any tab has a new message
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@44 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | justtabs/close.ico | bin | 0 -> 2550 bytes | |||
-rw-r--r-- | justtabs/justtabs.cpp | 2 | ||||
-rw-r--r-- | justtabs/justtabs.mdsp | 3 | ||||
-rw-r--r-- | justtabs/justtabs.plg | 72 | ||||
-rw-r--r-- | justtabs/justtabs_8.vcproj | 8 | ||||
-rw-r--r-- | justtabs/options.cpp | 6 | ||||
-rw-r--r-- | justtabs/options.h | 1 | ||||
-rw-r--r-- | justtabs/resource.h | 12 | ||||
-rw-r--r-- | justtabs/resource.rc | 11 | ||||
-rw-r--r-- | justtabs/win.cpp | 109 | ||||
-rw-r--r-- | justtabs/win.h | 3 |
11 files changed, 147 insertions, 80 deletions
diff --git a/justtabs/close.ico b/justtabs/close.ico Binary files differnew file mode 100644 index 0000000..944a5d6 --- /dev/null +++ b/justtabs/close.ico diff --git a/justtabs/justtabs.cpp b/justtabs/justtabs.cpp index 31308cc..ac38a81 100644 --- a/justtabs/justtabs.cpp +++ b/justtabs/justtabs.cpp @@ -21,7 +21,7 @@ typedef LRESULT (CALLBACK *WNDPROC)(HWND, UINT, WPARAM, LPARAM); PLUGININFO pluginInfo={
sizeof(PLUGININFO),
MODULE,
- PLUGIN_MAKE_VERSION(0,0,1,0),
+ PLUGIN_MAKE_VERSION(0,0,2,0),
"Put SRMM windows into a single frame",
"Scott Ellis",
"mail@scottellis.com.au",
diff --git a/justtabs/justtabs.mdsp b/justtabs/justtabs.mdsp index 385f6bf..2ccd298 100644 --- a/justtabs/justtabs.mdsp +++ b/justtabs/justtabs.mdsp @@ -92,4 +92,5 @@ extraResourceOptions= 1=resource.rc
[Other]
[History]
-justtabs.cpp,555
+justtabs.cpp,979
+win.cpp,25753
diff --git a/justtabs/justtabs.plg b/justtabs/justtabs.plg deleted file mode 100644 index 16b8a14..0000000 --- a/justtabs/justtabs.plg +++ /dev/null @@ -1,72 +0,0 @@ -<html>
-<body>
-<pre>
-<h1>Build Log</h1>
-<h3>
---------------------Configuration: justtabs - Win32 Release--------------------
-</h3>
-<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\sje\LOCALS~1\Temp\RSP2C8.tmp" with contents
-[
-/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JUSTTABS_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /Fp"Release/justtabs.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
-"C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\justtabs\win.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\sje\LOCALS~1\Temp\RSP2C8.tmp"
-Creating temporary file "C:\DOCUME~1\sje\LOCALS~1\Temp\RSP2C9.tmp" with contents
-[
-gdi32.lib user32.lib opengl32.lib glu32.lib comctl32.lib /nologo /dll /incremental:no /pdb:"Release/justtabs.pdb" /machine:I386 /out:"../../bin/release/plugins/justtabs.dll" /implib:"Release/justtabs.lib"
-".\Release\justtabs.obj"
-".\Release\win.obj"
-".\Release\resource.res"
-]
-Creating command line "link.exe @C:\DOCUME~1\sje\LOCALS~1\Temp\RSP2C9.tmp"
-<h3>Output Window</h3>
-Compiling...
-win.cpp
-Linking...
- Creating library Release/justtabs.lib and object Release/justtabs.exp
-LINK : warning LNK4089: all references to "KERNEL32.dll" discarded by /OPT:REF
-
-
-
-<h3>Results</h3>
-justtabs.dll - 0 error(s), 1 warning(s)
-<h3>
---------------------Configuration: justtabs - Win32 Debug--------------------
-</h3>
-<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\sje\LOCALS~1\Temp\RSP2CD.tmp" with contents
-[
-/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JUSTTABS_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /Fp"Debug/justtabs.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
-"C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\justtabs\win.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\sje\LOCALS~1\Temp\RSP2CD.tmp"
-Creating temporary file "C:\DOCUME~1\sje\LOCALS~1\Temp\RSP2CE.tmp" with contents
-[
-gdi32.lib user32.lib opengl32.lib glu32.lib comctl32.lib /nologo /dll /incremental:yes /pdb:"Debug/justtabs.pdb" /debug /machine:I386 /out:"../../bin/debug/plugins/justtabs.dll" /implib:"Debug/justtabs.lib" /pdbtype:sept
-".\Debug\justtabs.obj"
-".\Debug\win.obj"
-".\Debug\resource.res"
-]
-Creating command line "link.exe @C:\DOCUME~1\sje\LOCALS~1\Temp\RSP2CE.tmp"
-<h3>Output Window</h3>
-Compiling...
-win.cpp
-C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\justtabs\win.cpp(11) : warning C4786: 'std::reverse_bidirectional_iterator<std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::iterator,std::pair<HWND__ * const,void *>,std::pair<HWND__ * const,void *> &,std::pair<HWND__ * const,void *> *,int>' : identifier was truncated to '255' characters in the debug information
-C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\justtabs\win.cpp(11) : warning C4786: 'std::reverse_bidirectional_iterator<std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::const_iterator,std::pair<HWND__ * const,void *>,std::pair<HWND__ * const,void *> const &,std::pair<HWND__ * const,void *> const *,int>' : identifier was truncated to '255' characters in the debug information
-C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\justtabs\win.cpp(11) : warning C4786: 'std::pair<std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::iterator,std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::iterator>' : identifier was truncated to '255' characters in the debug information
-C:\Documents and Settings\sje\My Documents\MyProjects\miranda\plugins\justtabs\win.cpp(11) : warning C4786: 'std::pair<std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::const_iterator,std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::const_iterator>' : identifier was truncated to '255' characters in the debug information
-c:\program files\microsoft visual studio\vc98\include\xtree(182) : warning C4786: 'std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::~_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >' : identifier was truncated to '255' characters in the debug information
-c:\program files\microsoft visual studio\vc98\include\xtree(162) : warning C4786: 'std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >' : identifier was truncated to '255' characters in the debug information
-c:\program files\microsoft visual studio\vc98\include\xtree(236) : warning C4786: '__ehhandler$?insert@?$_Tree@PAUHWND__@@U?$pair@QAUHWND__@@PAX@std@@U_Kfn@?$map@PAUHWND__@@PAXU?$less@PAUHWND__@@@std@@V?$allocator@PAX@3@@3@U?$less@PAUHWND__@@@3@V?$allocator@PAX@3@@std@@QAE?AU?$pair@Viterator@?$_Tree@PAUHWND__@@U?$pair@QAUHWND__@@PAX@std@@U_Kfn@?$map@PAUHWND__@@PAXU?$less@PAUHWND__@@@std@@V?$allocator@PAX@3@@3@U?$less@PAUHWND__@@@3@V?$allocator@PAX@3@@std@@_N@2@ABU?$pair@QAUHWND__@@PAX@2@@Z' : identifier was truncated to '255' characters in the debug information
-c:\program files\microsoft visual studio\vc98\include\xtree(236) : warning C4786: '__unwindfunclet$?insert@?$_Tree@PAUHWND__@@U?$pair@QAUHWND__@@PAX@std@@U_Kfn@?$map@PAUHWND__@@PAXU?$less@PAUHWND__@@@std@@V?$allocator@PAX@3@@3@U?$less@PAUHWND__@@@3@V?$allocator@PAX@3@@std@@QAE?AU?$pair@Viterator@?$_Tree@PAUHWND__@@U?$pair@QAUHWND__@@PAX@std@@U_Kfn@?$map@PAUHWND__@@PAXU?$less@PAUHWND__@@@std@@V?$allocator@PAX@3@@3@U?$less@PAUHWND__@@@3@V?$allocator@PAX@3@@std@@_N@2@ABU?$pair@QAUHWND__@@PAX@2@@Z$0' : identifier was truncated to '255' characters in the debug information
-c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::pair<std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::iterator,bool>::pair<std::_Tree<HWND__ *,std::pair<HWND__ * const,void *>,std::map<HWND__ *,void *,std::less<HWND__ *>,std::allocator<void *> >::_Kfn,std::less<HWND__ *>,std::allocator<void *> >::iterator,bool>' : identifier was truncated to '255' characters in the debug information
-Linking...
-
-
-
-<h3>Results</h3>
-justtabs.dll - 0 error(s), 9 warning(s)
-</pre>
-</body>
-</html>
diff --git a/justtabs/justtabs_8.vcproj b/justtabs/justtabs_8.vcproj index 081f2a3..4cc8b24 100644 --- a/justtabs/justtabs_8.vcproj +++ b/justtabs/justtabs_8.vcproj @@ -283,6 +283,14 @@ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
<File
+ RelativePath=".\close.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\closex.ico"
+ >
+ </File>
+ <File
RelativePath="resource.rc"
>
<FileConfiguration
diff --git a/justtabs/options.cpp b/justtabs/options.cpp index d7cafc5..5175cc7 100644 --- a/justtabs/options.cpp +++ b/justtabs/options.cpp @@ -23,6 +23,7 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l TranslateDialogDefault( hwndDlg );
CheckDlgButton(hwndDlg, IDC_CHK_TITLE, options.show_titlebar ? FALSE : TRUE);
CheckDlgButton(hwndDlg, IDC_CHK_TABICON, options.tab_icon ? TRUE : FALSE);
+ CheckDlgButton(hwndDlg, IDC_CHK_ONTOP, options.ontop ? TRUE : FALSE);
return TRUE;
}
case WM_COMMAND:
@@ -39,6 +40,10 @@ static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l options.tab_icon = IsDlgButtonChecked(hwndDlg, IDC_CHK_TABICON) ? true : false;
DBWriteContactSettingByte(0, MODULE, "TabIcon", options.tab_icon ? 1 : 0);
ResetTabIcons();
+
+ options.ontop = IsDlgButtonChecked(hwndDlg, IDC_CHK_ONTOP) ? true : false;
+ DBWriteContactSettingByte(0, MODULE, "OnTop", options.ontop ? 1 : 0);
+ FixWindowStyle();
}
return TRUE;
}
@@ -67,6 +72,7 @@ int OptInit(WPARAM wParam,LPARAM lParam) void InitOptions() {
options.show_titlebar = (DBGetContactSettingByte(0, MODULE, "EnableTitle", 1) == 1);
options.tab_icon = (DBGetContactSettingByte(0, MODULE, "TabIcon", 0) == 1);
+ options.ontop = (DBGetContactSettingByte(0, MODULE, "OnTop", 0) == 1);
HookEvent(ME_OPT_INITIALISE, OptInit);
}
diff --git a/justtabs/options.h b/justtabs/options.h index e073cff..380c560 100644 --- a/justtabs/options.h +++ b/justtabs/options.h @@ -4,6 +4,7 @@ typedef struct {
bool show_titlebar;
bool tab_icon;
+ bool ontop;
} Options;
extern Options options;
diff --git a/justtabs/resource.h b/justtabs/resource.h index 9231138..7152bbb 100644 --- a/justtabs/resource.h +++ b/justtabs/resource.h @@ -5,18 +5,24 @@ #define IDD_DIALOG1 101
#define IDD_OPT1 101
#define IDD_CONTAINER 103
+#define IDI_ICON1 105
+#define IDI_CLOSE 105
#define IDC_CHK_TITLE 1007
#define IDC_CHK_TABICON 1008
#define IDC_TAB1 1008
#define IDC_TABS 1008
+#define IDC_CHK_TABICON2 1009
+#define IDC_CHK_ONTOP 1009
+#define IDC_CHAT_CLOSE 1010
+#define IDM_TOPMOST 40040
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 104
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1009
+#define _APS_NEXT_RESOURCE_VALUE 106
+#define _APS_NEXT_COMMAND_VALUE 40041
+#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/justtabs/resource.rc b/justtabs/resource.rc index 109fd2c..629076c 100644 --- a/justtabs/resource.rc +++ b/justtabs/resource.rc @@ -32,6 +32,7 @@ FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN
CONTROL "No titlebar",IDC_CHK_TITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,49,91,10
CONTROL "Show contact icon on tabs",IDC_CHK_TABICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,66,113,10
+ CONTROL "Always on top",IDC_CHK_ONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,90,113,10
END
IDD_CONTAINER DIALOGEX 0, 0, 360, 249
@@ -41,6 +42,7 @@ CAPTION "Message Session" FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_TABS,"SysTabControl32",TCS_MULTILINE | TCS_FOCUSNEVER,0,0,360,249
+ CONTROL "",IDC_CHAT_CLOSE,"MButtonClass",WS_TABSTOP,339,2,14,12,0x18000000L
END
@@ -100,6 +102,15 @@ END #endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_CLOSE ICON "close.ico"
#endif // English (Australia) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/justtabs/win.cpp b/justtabs/win.cpp index 75cb408..9ac8022 100644 --- a/justtabs/win.cpp +++ b/justtabs/win.cpp @@ -28,6 +28,8 @@ int message_icon_index = 0; #define WMU_SETTAB (WM_USER+0x300)
+#define WMU_CALCWINICON (WM_USER+0x301)
+
HANDLE window_list = 0;
typedef struct TabCtrlDataStruct
@@ -130,6 +132,23 @@ BOOL CALLBACK FrameProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { SubclassTabCtrl(tab_ctrl);
active_window = 0;
+
+ {
+ HMENU hMenu = GetSystemMenu( hwnd, FALSE );
+ InsertMenu( hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, NULL );
+ if (options.ontop) {
+ InsertMenu( hMenu, 0, MF_BYPOSITION | MF_ENABLED | MF_CHECKED | MF_STRING, IDM_TOPMOST, TranslateT("Always On Top"));
+ SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ } else {
+ InsertMenu( hMenu, 0, MF_BYPOSITION | MF_ENABLED | MF_UNCHECKED | MF_STRING, IDM_TOPMOST, TranslateT("Always On Top"));
+ }
+ }
+
+ SendDlgItemMessage(hwnd,IDC_CHAT_CLOSE, BUTTONSETASFLATBTN, 0, 0);
+ SendDlgItemMessage(hwnd, IDC_CHAT_CLOSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_CLOSE)));
+ //SendMessage(GetDlgItem(hwnd,IDC_CHAT_CLOSE), BUTTONADDTOOLTIP, (WPARAM)Translate("Close current tab"), 0);
+ SendMessage(hwnd, WM_SIZE, 0, 0);
+
return FALSE;
}
@@ -163,6 +182,10 @@ BOOL CALLBACK FrameProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { // static control is in front of the tab control.
if(active_window)
SetWindowPos(active_window, HWND_TOP, rc.left - 3, rc.top - 1, rc.right - rc.left + 4, rc.bottom - rc.top + 2, 0);
+
+ GetClientRect(hwnd, &rc);
+ SetWindowPos(GetDlgItem(hwnd,IDC_CHAT_CLOSE), 0, rc.right - 19, 3, 16, 16, SWP_NOZORDER | SWP_NOACTIVATE);
+ RedrawWindow(GetDlgItem(hwnd, IDC_CHAT_CLOSE), 0, 0, RDW_INVALIDATE);
}
break;
@@ -221,6 +244,8 @@ BOOL CALLBACK FrameProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { SendMessage(hwnd, WMU_SETTAB, 0, 0);
ShowWindow(hwnd, SW_SHOW);
+ RedrawWindow(GetDlgItem(hwnd, IDC_CHAT_CLOSE), 0, 0, RDW_INVALIDATE);
+
}
}
return TRUE;
@@ -264,11 +289,13 @@ BOOL CALLBACK FrameProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HANDLE hContact = ((TabData *)tie.lParam)->hContact;
if(active_window == child) return TRUE;
+ /*
// use GETCONTACTICON service instead of tie.iImage, because tie.iImage may be -1 depending on options
HANDLE hIcon = ImageList_GetIcon(clist_imagelist, (int)CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0), 0);
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
-
+ */
+
if(active_window) {
SetWindowPos(active_window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
ShowWindow(active_window, SW_HIDE);
@@ -287,6 +314,9 @@ BOOL CALLBACK FrameProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { tie.iImage = options.tab_icon ? (int)CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0) : -1;
SendMessage(tab_ctrl, TCM_SETITEM, (WPARAM)iPage, (LPARAM)&tie);
SetFocus(active_window);
+
+ SendMessage(hwnd, WMU_CALCWINICON, (WPARAM)hContact, 0);
+ RedrawWindow(GetDlgItem(hwnd, IDC_CHAT_CLOSE), 0, 0, RDW_INVALIDATE);
}
return TRUE;
case WM_NOTIFY:
@@ -317,13 +347,14 @@ BOOL CALLBACK FrameProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND child = WindowList_Find(window_list, hContact);
if(child) {
int t = GetTabFromHWND(tab_ctrl, child);
- if(TabCtrl_GetCurSel(tab_ctrl) != t) {
+ if(IsIconic(hwnd) || TabCtrl_GetCurSel(tab_ctrl) != t) {
//TabCtrl_HighlightItem(tab_ctrl, t, 1);
TCITEM tie;
tie.mask = TCIF_IMAGE;
tie.iImage = message_icon_index;
SendMessage(tab_ctrl, TCM_SETITEM, (WPARAM)t, (LPARAM)&tie);
}
+ SendMessage(hwnd, WMU_CALCWINICON, 0, 0);
}
}
return TRUE;
@@ -379,12 +410,15 @@ BOOL CALLBACK FrameProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { tci.iImage = options.tab_icon ? ici : -1;
SendMessage(tab_ctrl, TCM_SETITEM, (WPARAM)t, (LPARAM)&tci);
+ /*
if(t == TabCtrl_GetCurSel(tab_ctrl)) {
// use GETCONTACTICON service instead of tie.iImage, because tie.iImage may be -1 depending on options
HANDLE hIcon = ImageList_GetIcon(clist_imagelist, ici, 0);
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
}
+ */
+ SendMessage(hwnd, WMU_CALCWINICON, 0, 0);
}
} else {
int l, i;
@@ -402,6 +436,70 @@ BOOL CALLBACK FrameProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { }
}
return TRUE;
+ case WMU_CALCWINICON:
+ {
+ int l, i, s;
+ TCITEM tci;
+ HANDLE hContact = 0;
+ if(wParam) hContact = (HANDLE)wParam;
+ bool use_message_icon = false;
+ l = TabCtrl_GetItemCount(tab_ctrl);
+ s = TabCtrl_GetCurSel(tab_ctrl);
+ for (i = 0; i < l; i++) {
+ tci.mask = TCIF_IMAGE | TCIF_PARAM;
+ TabCtrl_GetItem(tab_ctrl, i, &tci);
+ if(tci.iImage == message_icon_index)
+ use_message_icon = true;
+ else if(i == s) {
+ hContact = ((TabData *)tci.lParam)->hContact;
+ }
+ }
+
+ int ici = (use_message_icon ? message_icon_index : (int)CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0));
+ HANDLE hIcon = ImageList_GetIcon(clist_imagelist, ici, 0);
+ SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+ }
+ return TRUE;
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) == WA_ACTIVE) {
+ TCITEM tci;
+ int s = TabCtrl_GetCurSel(tab_ctrl);
+ if(s != -1) {
+ tci.mask = TCIF_IMAGE | TCIF_PARAM;
+ TabCtrl_GetItem(tab_ctrl, s, &tci);
+ HANDLE hContact = ((TabData *)tci.lParam)->hContact;
+ SendMessage(hwnd, WM_RESETTABICONS, (WPARAM)hContact, lParam);
+ }
+ }
+ break;
+ case WM_SYSCOMMAND:
+ if (wParam == IDM_TOPMOST) {
+ HMENU hMenu = GetSystemMenu(hwnd, FALSE);
+ CheckMenuItem(hMenu, IDM_TOPMOST, MF_BYCOMMAND | (options.ontop ? MF_UNCHECKED : MF_CHECKED));
+ SetWindowPos(hwnd, (options.ontop ? HWND_NOTOPMOST : HWND_TOPMOST), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ options.ontop = !options.ontop;
+ DBWriteContactSettingByte(0, MODULE, "OnTop", options.ontop ? 1 : 0);
+ return TRUE;
+ }
+ break;
+ case WM_COMMAND:
+ if ( HIWORD( wParam ) == BN_CLICKED ) {
+ switch( LOWORD( wParam )) {
+ case IDC_CHAT_CLOSE:
+ {
+ TCITEM tci;
+ int s = TabCtrl_GetCurSel(tab_ctrl);
+ if(s != -1) {
+ tci.mask = TCIF_PARAM;
+ TabCtrl_GetItem(tab_ctrl, s, &tci);
+ SendMessage(((TabData *)tci.lParam)->hwndMsg, WM_CLOSE, 0, 0);
+ }
+ }
+ return TRUE;
+ }
+ }
+ break;
}
//return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -439,9 +537,10 @@ int CreateFrame(HWND parent, HINSTANCE hInst) { 0, 0, 800, 600, parent, NULL, hInst, NULL);
*/
pluginwind = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTAINER), 0, FrameProc, 0);
-
EnableTitleBar();
+ FixWindowStyle();
+
return 0;
}
@@ -681,3 +780,7 @@ BOOL CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) }
return CallWindowProc(OldTabCtrlProc, hwnd, msg, wParam, lParam);
}
+
+void FixWindowStyle() {
+ if(pluginwind) SetWindowPos(pluginwind, (options.ontop ? HWND_TOPMOST : HWND_NOTOPMOST), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+}
diff --git a/justtabs/win.h b/justtabs/win.h index 3a4f813..14f2cf5 100644 --- a/justtabs/win.h +++ b/justtabs/win.h @@ -22,6 +22,7 @@ #include <m_utils.h>
#include <m_protocols.h>
#include <m_updater.h>
+#include <m_button.h>
#include <win2k.h>
#define MODULE "JustTabs"
@@ -42,4 +43,6 @@ extern HINSTANCE hInst; LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int CreateFrame(HWND parent, HINSTANCE hInst);
+void FixWindowStyle();
+
#endif
|