Commit in reactos/subsys/system/explorer on MAIN
shell/mainframe.cpp+15-61.53 -> 1.54
taskbar/favorites.cpp+122-341.3 -> 1.4
       /favorites.h+6-21.3 -> 1.4
utility/xmlstorage.h-51.11 -> 1.12
+143-47
4 modified files
store icon information in metadata nodes

reactos/subsys/system/explorer/shell
mainframe.cpp 1.53 -> 1.54
diff -u -r1.53 -r1.54
--- mainframe.cpp	4 Apr 2004 19:12:55 -0000	1.53
+++ mainframe.cpp	4 Apr 2004 20:23:51 -0000	1.54
@@ -772,13 +772,22 @@
 		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
-			if (!node._pbookmark->_description.empty())
-				lstrcpyn(pnmgit->pszText, node._pbookmark->_description.c_str(), pnmgit->cchTextMax);
-			else
-				lstrcpyn(pnmgit->pszText, node._pbookmark->_url.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);
+		}
 		break;}
 	}
 
@@ -1037,7 +1046,7 @@
 
 	TreeView_DeleteAllItems(_hsidebar);
 
-	g_Globals._favorites.fill_tree(_hsidebar, TVI_ROOT);
+	g_Globals._favorites.fill_tree(_hsidebar, TVI_ROOT, _himl);
 }
 
 #endif

reactos/subsys/system/explorer/taskbar
favorites.cpp 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- favorites.cpp	4 Apr 2004 19:12:55 -0000	1.3
+++ favorites.cpp	4 Apr 2004 20:23:51 -0000	1.4
@@ -67,18 +67,113 @@
 }
 
  /// convert XBEL bookmark node
-bool Bookmark::read_xbel(const_XMLPos& pos)
+bool Bookmark::read(const_XMLPos& pos)
 {
 	_url = pos.get("href");
 
-	if (!pos.go_down("title"))
-		return false;
+	if (pos.go_down("title")) {
+		_name = pos->get_content();
+		pos.back();
+	}
+
+	if (pos.go_down("desc")) {
+		_description = pos->get_content();
+		pos.back();
+	}
+
+	if (pos.go_down("info")) {
+		const_XMLChildrenFilter metadata(pos, "metadata");
+
+		for(const_XMLChildrenFilter::const_iterator it=metadata.begin(); it!=metadata.end(); ++it) {
+			const XMLNode& node = **it;
+			const_XMLPos sub_pos(&node);
+
+			if (node.get("owner") == "ros-explorer") {
+				if (sub_pos.go_down("icon")) {
+					_icon_path = sub_pos.get("path");
+					_icon_idx = _ttoi(sub_pos.get("index"));
+
+					sub_pos.back();	// </icon>
+				}
+			}
+		}
+
+		pos.back();	// </metadata>
+		pos.back();	// </info>
+	}
 
-	_name = pos->get_content();
+	return !_url.empty();	// _url is mandatory.
+}
+
+ /// write XBEL bookmark node
+void Bookmark::write(XMLPos& pos)
+{
+	pos.create("bookmark");
+
+	pos["href"] = _url;
+
+	if (!_name.empty()) {
+		pos.create("title");
+		pos->set_content(_name);
+		pos.back();
+	}
+
+	if (!_description.empty()) {
+		pos.create("desc");
+		pos->set_content(_description);
+		pos.back();
+	}
+
+	if (!_icon_path.empty()) {
+		pos.create("info");
+		pos.create("metadata");
+		pos["owner"] = "ros-explorer";
+		pos.create("icon");
+		pos["path"] = _icon_path;
+		pos["index"].printf(TEXT("%d"), _icon_idx);
+		pos.back();	// </icon>
+		pos.back();	// </metadata>
+		pos.back();	// </info>
+	}
 
 	pos.back();
+}
 
-	return true;
+
+ /// read bookmark folder from XBEL formated XML tree
+void BookmarkFolder::read(const_XMLPos& pos)
+{
+	if (pos.go_down("title")) {
+		_name = pos->get_content();
+		pos.back();
+	}
+
+	if (pos.go_down("desc")) {
+		_description = pos->get_content();
+		pos.back();
+	}
+
+	_bookmarks.read(pos);
+}
+
+ /// write bookmark folder conten from XBEL formated XML tree
+void BookmarkFolder::write(XMLPos& pos)
+{
+	pos.create("folder");
+
+	if (!_name.empty()) {
+		pos.create("title");
+		pos->set_content(_name);
+		pos.back();
+	}
+
+	if (!_description.empty()) {
+		pos.create("desc");
+		pos->set_content(_description);
+		pos.back();
+	}
+
+	_bookmarks.write(pos);
 }
 
 
@@ -122,20 +217,15 @@
 		const_XMLPos sub_pos(&node);
 
 		if (node == "folder") {
-			BookmarkFolder new_folder;
+			BookmarkFolder folder;
 
-			if (sub_pos.go_down("title")) {
-				new_folder._name = sub_pos->get_content();
-				sub_pos.back();
-			}
-
-			new_folder._bookmarks.read(sub_pos);
+			folder.read(sub_pos);
 
-			push_back(new_folder);
+			push_back(folder);
 		} else if (node == "bookmark") {
 			Bookmark bookmark;
 
-			if (bookmark.read_xbel(sub_pos))
+			if (bookmark.read(sub_pos))
 				push_back(bookmark);
 		}
 	}
@@ -150,36 +240,23 @@
 		if (node._type == BookmarkNode::BMNT_FOLDER) {
 			BookmarkFolder& folder = *node._pfolder;
 
-			pos.create("folder");
-
-			pos.create("title");
-			pos->set_content(folder._name);
-			pos.back();
-
-			folder._bookmarks.write(pos);
+			folder.write(pos);
 
 			pos.back();
 		} else {	// BookmarkNode::BMNT_BOOKMARK
 			Bookmark& bookmark = *node._pbookmark;
 
-			if (!bookmark._url.empty()) {
-				pos.create("bookmark");
-
-				pos["href"] = bookmark._url;
-
-				pos.create("title");
-				pos->set_content(bookmark._name);
-				pos.back();
-
-				pos.back();
-			}
+			if (!bookmark._url.empty())
+				bookmark.write(pos);
 		}
 	}
 }
 
 
-void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent) const
+void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST himagelist) const
 {
+	HDC hdc = GetDC(hwnd);
+
 	TV_INSERTSTRUCT tvi;
 
 	tvi.hParent = parent;
@@ -201,16 +278,27 @@
 			tv.iSelectedImage = 4;
 			HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
 
-			folder._bookmarks.fill_tree(hwnd, hitem);
+			folder._bookmarks.fill_tree(hwnd, hitem, himagelist);
 		} else {
 			const Bookmark& bookmark = *node._pbookmark;
 
 			tv.pszText = (LPTSTR)bookmark._name.c_str();
 			tv.iImage = 0;
 			tv.iSelectedImage = 1;
+
+			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), 0);
+			}
+
 			TreeView_InsertItem(hwnd, &tvi);
 		}
 	}
+
+	ReleaseDC(hwnd, hdc);
 }
 
 

reactos/subsys/system/explorer/taskbar
favorites.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- favorites.h	4 Apr 2004 19:12:55 -0000	1.3
+++ favorites.h	4 Apr 2004 20:23:51 -0000	1.4
@@ -37,7 +37,8 @@
 	int		_icon_idx;
 
 	bool	read_url(LPCTSTR path);
-	bool	read_xbel(const_XMLPos& pos);
+	bool	read(const_XMLPos& pos);
+	void	write(XMLPos& pos);
 };
 
 struct BookmarkFolder;
@@ -68,7 +69,7 @@
 	void	read(const_XMLPos& pos);
 	void	write(XMLPos& pos) const;
 
-	void	fill_tree(HWND hwnd, HTREEITEM parent) const;
+	void	fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST) const;
 };
 
 struct BookmarkFolder
@@ -76,6 +77,9 @@
 	String	_name;
 	String	_description;
 	BookmarkList _bookmarks;
+
+	void	read(const_XMLPos& pos);
+	void	write(XMLPos& pos);
 };
 
 struct Favorites : public BookmarkList

reactos/subsys/system/explorer/utility
xmlstorage.h 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- xmlstorage.h	4 Apr 2004 16:04:34 -0000	1.11
+++ xmlstorage.h	4 Apr 2004 20:23:51 -0000	1.12
@@ -733,11 +733,6 @@
 			return *_cur;
 		}
 
-		XMLNode* operator*()
-		{
-			return *_cur;
-		}
-
 		const_iterator& operator++()
 		{
 			++_cur;
CVSspam 0.2.8