Commit in reactos/subsys/system/explorer on MAIN
explorer.cpp+38-51.64 -> 1.65
globals.h+41.37 -> 1.38
res/favorites.ico[binary]1.3 -> 1.4
   /images.bmp[binary]1.1 -> 1.2
shell/mainframe.cpp+49-201.55 -> 1.56
taskbar/favorites.cpp+5-51.6 -> 1.7
       /traynotify.cpp+1-11.58 -> 1.59
+97-31
7 modified files
better looking bookmark icons

reactos/subsys/system/explorer
explorer.cpp 1.64 -> 1.65
diff -u -r1.64 -r1.65
--- explorer.cpp	4 Apr 2004 16:04:33 -0000	1.64
+++ explorer.cpp	7 Apr 2004 22:11:23 -0000	1.65
@@ -185,7 +185,7 @@
 	ftype._neverShowExt = false;
 
 	HKEY hkey;
-	TCHAR value[MAX_PATH], display_name[MAX_PATH];;
+	TCHAR value[MAX_PATH], display_name[MAX_PATH];
 	LONG valuelen = sizeof(value);
 
 	if (!RegQueryValue(HKEY_CLASSES_ROOT, ext, value, &valuelen)) {
@@ -287,17 +287,39 @@
 		return create_bitmap_from_icon(_hicon, hbrBkgnd, hdc_wnd);
 }
 
+HICON Icon::create_icon(COLORREF bk_color, HDC hdc_wnd) const
+{
+	if (_itype == IT_SYSCACHE) {
+		return 0;	/*@@todo
+		HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();
+
+		int cx, cy;
+		ImageList_GetIconSize(himl, &cx, &cy);
+
+		HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
+		HDC hdc = CreateCompatibleDC(hdc_wnd);
+		HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
+		ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
+		SelectBitmap(hdc, hbmp_old);
+		DeleteDC(hdc);
+		return hbmp;
+*/	} else
+		return (HICON) CopyImage(_hicon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
+}
+
 HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
 {
-	HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, 16, 16);
+	int cx = GetSystemMetrics(SM_CXSMICON);
+	int cy = GetSystemMetrics(SM_CYSMICON);
+	HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
 
 	MemCanvas canvas;
 	BitmapSelection sel(canvas, hbmp);
 
-	RECT rect = {0, 0, 16, 16};
+	RECT rect = {0, 0, cx, cy};
 	FillRect(canvas, &rect, hbrush_bkgnd);
 
-	DrawIconEx(canvas, 0, 0, hIcon, 16, 16, 0, hbrush_bkgnd, DI_NORMAL);
+	DrawIconEx(canvas, 0, 0, hIcon, cx, cy, 0, hbrush_bkgnd, DI_NORMAL);
 
 	return hbmp;
 }
@@ -313,6 +335,17 @@
 	return ret;
 }
 
+int ImageList_AddAlphaIcon(HIMAGELIST himl, const Icon& icon, HDC hdc_wnd)
+{
+	HICON hicon = icon.create_icon(ImageList_GetBkColor(himl), hdc_wnd);
+
+	int ret = ImageList_AddIcon(himl, hicon);
+
+	DeleteObject(hicon);
+
+	return ret;
+}
+
 
 int IconCache::s_next_id = ICID_DYNAMIC;
 
@@ -322,7 +355,7 @@
 	_icons[ICID_NONE]		= Icon(IT_STATIC, ICID_NONE, (HICON)0);
 
 	_icons[ICID_FOLDER]		= Icon(ICID_FOLDER,		IDI_FOLDER);
-	//_icons[ICID_DOCUMENT] = Icon(ICID_DOCUMENT,	IDI_DOCUMENT);
+	//_icons[ICID_DOCUMENT]	= Icon(ICID_DOCUMENT,	IDI_DOCUMENT);
 	_icons[ICID_EXPLORER]	= Icon(ICID_EXPLORER,	IDI_EXPLORER);
 	_icons[ICID_APP]		= Icon(ICID_APP,		IDI_APPICON);
 

reactos/subsys/system/explorer
globals.h 1.37 -> 1.38
diff -u -r1.37 -r1.38
--- globals.h	4 Apr 2004 16:04:33 -0000	1.37
+++ globals.h	7 Apr 2004 22:11:23 -0000	1.38
@@ -94,6 +94,7 @@
 
 	void	draw(HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const;
 	HBITMAP	create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const;
+	HICON	create_icon(COLORREF bk_color, HDC hdc_wnd) const;
 
 	int		get_sysiml_idx() const {return _itype==IT_SYSCACHE? _sys_idx: -1;}
 
@@ -151,6 +152,9 @@
  /// add icon with alpha channel to imagelist using the specified background color
 extern int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
 
+ /// add Icon object to image list
+extern int ImageList_AddAlphaIcon(HIMAGELIST himl, const Icon& icon, HDC hdc_wnd);
+
  /// retrieve icon from window
 extern HICON get_window_icon_small(HWND hwnd);
 extern HICON get_window_icon_big(HWND hwnd, bool allow_from_class=true);

reactos/subsys/system/explorer/shell
mainframe.cpp 1.55 -> 1.56
diff -u -r1.55 -r1.56
--- mainframe.cpp	4 Apr 2004 23:13:11 -0000	1.55
+++ mainframe.cpp	7 Apr 2004 22:11:24 -0000	1.56
@@ -41,7 +41,8 @@
 
 
 MainFrame::MainFrame(HWND hwnd)
- :	super(hwnd)
+ :	super(hwnd),
+	_himl(ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0))
 {
 	_hMenuFrame = GetMenu(hwnd);
 	_hMenuWindow = GetSubMenu(_hMenuFrame, GetMenuItemCount(_hMenuFrame)-2);
@@ -277,10 +278,9 @@
 	CheckMenuItem(_menu_info._hMenuView, ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
 
 	_hsidebar = CreateWindowEx(WS_EX_STATICEDGE, WC_TREEVIEW, TEXT("Sidebar"),
-					WS_CHILD|WS_TABSTOP|WS_BORDER|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS|TVS_INFOTIP,
+					WS_CHILD|WS_TABSTOP|WS_BORDER|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_SHOWSELALWAYS|TVS_INFOTIP,
 					-1, -1, 200, 0, _hwnd, (HMENU)IDW_SIDEBAR, g_Globals._hInstance, 0);
 
-	_himl = ImageList_LoadBitmap(g_Globals._hInstance, MAKEINTRESOURCE(IDB_IMAGES), 16, 0, RGB(0,255,0));
 	TreeView_SetImageList(_hsidebar, _himl, TVSIL_NORMAL);
 
 	CheckMenuItem(_menu_info._hMenuView, ID_VIEW_SIDE_BAR, MF_BYCOMMAND|MF_CHECKED);
@@ -769,24 +769,27 @@
 
 	  case TVN_GETINFOTIP: {
 		NMTVGETINFOTIP* pnmgit = (NMTVGETINFOTIP*)pnmh;
-		const BookmarkNode& node = *(BookmarkNode*)pnmgit->lParam;
 
-		if (node._type == BookmarkNode::BMNT_FOLDER) {
-			 // display tooltips for bookmark folders
-			if (!node._pfolder->_description.empty())
-				lstrcpyn(pnmgit->pszText, node._pfolder->_description.c_str(), pnmgit->cchTextMax);
-		} else {	// BookmarkNode::BMNT_BOOKMARK
-			 // display tooltips for bookmark folders
-			String txt = node._pbookmark->_description;
-
-			if (!node._pbookmark->_url.empty()) {
-				if (!txt.empty())
-					txt += TEXT("  -  ");
+		if (pnmgit->lParam) {
+			const BookmarkNode& node = *(BookmarkNode*)pnmgit->lParam;
 
-				txt += node._pbookmark->_url;
-			}
+			if (node._type == BookmarkNode::BMNT_FOLDER) {
+				 // display tooltips for bookmark folders
+				if (!node._pfolder->_description.empty())
+					lstrcpyn(pnmgit->pszText, node._pfolder->_description.c_str(), pnmgit->cchTextMax);
+			} else {	// BookmarkNode::BMNT_BOOKMARK
+				 // display tooltips for bookmark folders
+				String txt = node._pbookmark->_description;
+
+				if (!node._pbookmark->_url.empty()) {
+					if (!txt.empty())
+						txt += TEXT("  -  ");
+
+					txt += node._pbookmark->_url;
+				}
 
-			lstrcpyn(pnmgit->pszText, txt.c_str(), pnmgit->cchTextMax);
+				lstrcpyn(pnmgit->pszText, txt.c_str(), pnmgit->cchTextMax);
+			}
 		}
 		break;}
 	}
@@ -1043,11 +1046,37 @@
 void MainFrame::FillBookmarks()
 {
 	HiddenWindow hide(_hsidebar);
+	WindowCanvas canvas(_hwnd);
 
 	TreeView_DeleteAllItems(_hsidebar);
 
-	WindowCanvas canvas(_hwnd);
-	g_Globals._favorites.fill_tree(_hsidebar, TVI_ROOT, _himl, canvas);
+	HBRUSH hbr_bkgnd = GetStockBrush(WHITE_BRUSH);
+	ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_FAVORITES), hbr_bkgnd, canvas);
+	ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT_TRANS), hbr_bkgnd, canvas);
+	ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT), hbr_bkgnd, canvas);
+	ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_FOLDER), hbr_bkgnd, canvas);
+	ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_FOLDER), hbr_bkgnd, canvas);
+/*@@ This does not produce the expected result because CopyImage() seems not to duplicate 32 BIT alpha blended images:
+	ImageList_AddAlphaIcon(_himl, g_Globals._icon_cache.get_icon(ICID_FAVORITES), canvas);
+	ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT_TRANS), hbr_bkgnd, canvas);
+	ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT), hbr_bkgnd, canvas);
+	ImageList_AddAlphaIcon(_himl, g_Globals._icon_cache.get_icon(ICID_FOLDER), canvas);
+	ImageList_AddAlphaIcon(_himl, g_Globals._icon_cache.get_icon(ICID_FOLDER), canvas);
+*/
+	TV_INSERTSTRUCT tvi;
+
+	tvi.hParent = TVI_ROOT;
+	tvi.hInsertAfter = TVI_LAST;
+	tvi.item.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+	ResString sFavorites(IDS_FAVORITES);
+	tvi.item.pszText = (LPTSTR)sFavorites.c_str();
+	tvi.item.iSelectedImage = tvi.item.iImage = 0;
+
+	HTREEITEM hitem_bookmarks = TreeView_InsertItem(_hsidebar, &tvi);
+
+	g_Globals._favorites.fill_tree(_hsidebar, hitem_bookmarks, _himl, canvas);
+
+	TreeView_Expand(_hsidebar, hitem_bookmarks, TVE_EXPAND);
 }
 
 #endif

reactos/subsys/system/explorer/taskbar
favorites.cpp 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- favorites.cpp	4 Apr 2004 23:13:11 -0000	1.6
+++ favorites.cpp	7 Apr 2004 22:11:24 -0000	1.7
@@ -273,8 +273,8 @@
 			const BookmarkFolder& folder = *node._pfolder;
 
 			tv.pszText = (LPTSTR)folder._name.c_str();
-			tv.iImage = 3;
-			tv.iSelectedImage = 4;
+			tv.iImage = 3;			// folder
+			tv.iSelectedImage = 4;	// open folder
 			HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
 
 			folder._bookmarks.fill_tree(hwnd, hitem, himagelist, hdc_wnd);
@@ -282,15 +282,15 @@
 			const Bookmark& bookmark = *node._pbookmark;
 
 			tv.pszText = (LPTSTR)bookmark._name.c_str();
-			tv.iImage = 0;
-			tv.iSelectedImage = 1;
+			tv.iImage = 1;			// bookmark
+			tv.iSelectedImage = 2;	// selected bookmark
 
 			if (!bookmark._icon_path.empty()) {
 				///@todo retreive "http://.../favicon.ico" icons
 				const Icon& icon = g_Globals._icon_cache.extract(bookmark._icon_path, bookmark._icon_idx);
 
 				if ((ICON_ID)icon != ICID_NONE)
-					tv.iImage = tv.iSelectedImage = ImageList_Add(himagelist, icon.create_bitmap(RGB(255,255,255), GetStockBrush(WHITE_BRUSH), hdc_wnd), 0);
+					tv.iImage = tv.iSelectedImage = ImageList_AddAlphaIcon(himagelist, icon, hdc_wnd);
 			}
 
 			TreeView_InsertItem(hwnd, &tvi);

reactos/subsys/system/explorer/taskbar
traynotify.cpp 1.58 -> 1.59
diff -u -r1.58 -r1.59
--- traynotify.cpp	6 Apr 2004 22:15:25 -0000	1.58
+++ traynotify.cpp	7 Apr 2004 22:11:24 -0000	1.59
@@ -756,7 +756,7 @@
 TrayNotifyDlg::TrayNotifyDlg(HWND hwnd)
  :	super(hwnd),
 	_tree_ctrl(GetDlgItem(hwnd, IDC_NOTIFY_ICONS)),
-	_himl(ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR24, 2, 0)),
+	_himl(ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR24, 3, 0)),
 	_pNotifyArea(static_cast<NotifyArea*>(Window::get_window((HWND)SendMessage(g_Globals._hwndDesktopBar, PM_GET_NOTIFYAREA, 0, 0))))
 {
 	_selectedItem = 0;
CVSspam 0.2.8