Commit in reactos/subsys/system/explorer on MAIN
explorer-jp.rc+2-21.11 -> 1.12
explorer.cpp+19-171.65 -> 1.66
explorer_intres.h+5-31.51 -> 1.52
explorer_intres.rc+7-61.69 -> 1.70
globals.h+2-41.38 -> 1.39
dialogs/searchprogram.cpp+15-51.21 -> 1.22
       /searchprogram.h+11.13 -> 1.14
shell/mainframe.cpp+8-121.56 -> 1.57
taskbar/favorites.cpp+64-111.7 -> 1.8
       /favorites.h+12-41.5 -> 1.6
       /startmenu.cpp+98-311.84 -> 1.85
       /startmenu.h+44-151.45 -> 1.46
+277-110
12 modified files
replace previous favorites start menu folder implementation by fast FavoritesMenu (using the internal XML bookmark informations)

reactos/subsys/system/explorer
explorer-jp.rc 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- explorer-jp.rc	4 Apr 2004 17:21:27 -0000	1.11
+++ explorer-jp.rc	9 Apr 2004 19:42:20 -0000	1.12
@@ -219,8 +219,8 @@
 FONT 9, "MS UI Gothic", 0, 0, 0x1
 BEGIN
     LTEXT           "&Filter:",IDC_STATIC,7,9,18,8
-    EDITTEXT        IDC_TOPIC,34,7,103,14,ES_AUTOHSCROLL
-    CONTROL         "List1",IDC_MAILS_FOUND,"SysListView32",LVS_REPORT | 
+    EDITTEXT        IDC_FILTER,34,7,103,14,ES_AUTOHSCROLL
+    CONTROL         "List1",IDC_PROGRAMS_FOUND,"SysListView32",LVS_REPORT | 
                     LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | 
                     WS_TABSTOP,7,25,130,33
 END

reactos/subsys/system/explorer
explorer.cpp 1.65 -> 1.66
diff -u -r1.65 -r1.66
--- explorer.cpp	7 Apr 2004 22:11:23 -0000	1.65
+++ explorer.cpp	9 Apr 2004 19:42:20 -0000	1.66
@@ -282,15 +282,18 @@
 		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 create_bitmap_from_icon(_hicon, hbrBkgnd, hdc_wnd);
 }
 
-HICON Icon::create_icon(COLORREF bk_color, HDC hdc_wnd) const
+
+int Icon::add_to_imagelist(HIMAGELIST himl, HDC hdc_wnd, COLORREF bk_color, HBRUSH bk_brush) const
 {
+	int ret;
+
 	if (_itype == IT_SYSCACHE) {
-		return 0;	/*@@todo
 		HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();
 
 		int cx, cy;
@@ -302,9 +305,14 @@
 		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);
+
+		ret = ImageList_Add(himl, hbmp, 0);
+
+		DeleteObject(hbmp);
+	} else
+		ret = ImageList_AddAlphaIcon(himl, _hicon, bk_brush, hdc_wnd);
+
+	return ret;
 }
 
 HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
@@ -335,17 +343,6 @@
 	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;
 
@@ -371,6 +368,7 @@
 	_icons[ICID_NETWORK]	= Icon(ICID_NETWORK,	IDI_NETWORK);
 	_icons[ICID_COMPUTER]	= Icon(ICID_COMPUTER,	IDI_COMPUTER);
 	_icons[ICID_LOGOFF]		= Icon(ICID_LOGOFF,		IDI_LOGOFF);
+	_icons[ICID_BOOKMARK]	= Icon(ICID_BOOKMARK,	IDI_DOT_TRANS);
 }
 
 
@@ -424,8 +422,12 @@
 		_pathIdxMap[key] = icon;
 
 		return icon;
-	} else
+	} else {
+
+		///@todo retreive "http://.../favicon.ico" format icons
+
 		return _icons[ICID_NONE];
+	}
 }
 
 const Icon& IconCache::extract(IExtractIcon* pExtract, LPCTSTR path, int idx)

reactos/subsys/system/explorer
explorer_intres.h 1.51 -> 1.52
diff -u -r1.51 -r1.52
--- explorer_intres.h	4 Apr 2004 17:21:27 -0000	1.51
+++ explorer_intres.h	9 Apr 2004 19:42:20 -0000	1.52
@@ -134,8 +134,8 @@
 #define IDC_ICON_ALIGN_10               1012
 #define IDC_WWW                         1012
 #define IDC_ICON_ALIGN_11               1013
-#define IDC_TOPIC                       1017
-#define IDC_MAILS_FOUND                 1018
+#define IDC_FILTER                      1017
+#define IDC_PROGRAMS_FOUND              1018
 #define IDC_PICTURE                     1019
 #define IDC_NOTIFY_SHOW                 1020
 #define IDC_NOTIFY_HIDE                 1021
@@ -144,6 +144,8 @@
 #define ID_HIDE_INACTIVE_ICONS          1025
 #define ID_SHOW_CLOCK                   1026
 #define ID_DESKTOP_VERSION              1027
+#define IDC_BUTTON1                     1028
+#define IDC_CHECK_ENTRIES               1028
 #define ID_REFRESH                      1704
 #define ID_ABOUT_WINEFILE               1705
 #define IDC_FILETREE                    10001
@@ -195,7 +197,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        166
 #define _APS_NEXT_COMMAND_VALUE         40019
-#define _APS_NEXT_CONTROL_VALUE         1028
+#define _APS_NEXT_CONTROL_VALUE         1029
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

reactos/subsys/system/explorer
explorer_intres.rc 1.69 -> 1.70
diff -u -r1.69 -r1.70
--- explorer_intres.rc	4 Apr 2004 17:21:27 -0000	1.69
+++ explorer_intres.rc	9 Apr 2004 19:42:20 -0000	1.70
@@ -758,18 +758,19 @@
     PUSHBUTTON      "&Help",254,158,43,47,14
 END
 
-IDD_SEARCH_PROGRAM DIALOGEX 0, 0, 144, 65
+IDD_SEARCH_PROGRAM DIALOGEX 0, 0, 200, 65
 STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | 
     WS_SYSMENU | WS_THICKFRAME
 EXSTYLE WS_EX_APPWINDOW
 CAPTION "Search Program in Startmenu"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
+FONT 8, "MS Sans Serif"
 BEGIN
     LTEXT           "&Filter:",IDC_STATIC,7,9,18,8
-    EDITTEXT        IDC_TOPIC,34,7,103,14,ES_AUTOHSCROLL
-    CONTROL         "List1",IDC_MAILS_FOUND,"SysListView32",LVS_REPORT | 
+    EDITTEXT        IDC_FILTER,34,7,100,14,ES_AUTOHSCROLL
+    CONTROL         "List1",IDC_PROGRAMS_FOUND,"SysListView32",LVS_REPORT | 
                     LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | 
-                    WS_TABSTOP,7,25,130,33
+                    WS_TABSTOP,7,25,186,33
+    PUSHBUTTON      "&Check Entries",IDC_CHECK_ENTRIES,143,7,50,14
 END
 
 IDD_DESKBAR_DESKTOP DIALOG DISCARDABLE  0, 0, 212, 194
@@ -868,7 +869,7 @@
     IDD_SEARCH_PROGRAM, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 137
+        RIGHTMARGIN, 193
         TOPMARGIN, 7
         BOTTOMMARGIN, 58
     END

reactos/subsys/system/explorer
globals.h 1.38 -> 1.39
diff -u -r1.38 -r1.39
--- globals.h	7 Apr 2004 22:11:23 -0000	1.38
+++ globals.h	9 Apr 2004 19:42:20 -0000	1.39
@@ -80,6 +80,7 @@
 	ICID_NETWORK,
 	ICID_COMPUTER,
 	ICID_LOGOFF,
+	ICID_BOOKMARK,
 
 	ICID_DYNAMIC
 };
@@ -94,7 +95,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		add_to_imagelist(HIMAGELIST himl, HDC hdc_wnd, COLORREF bk_color=GetSysColor(COLOR_WINDOW), HBRUSH bk_brush=GetSysColorBrush(COLOR_WINDOW)) const;
 
 	int		get_sysiml_idx() const {return _itype==IT_SYSCACHE? _sys_idx: -1;}
 
@@ -152,9 +153,6 @@
  /// 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/dialogs
searchprogram.cpp 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- searchprogram.cpp	21 Mar 2004 00:31:13 -0000	1.21
+++ searchprogram.cpp	9 Apr 2004 19:42:20 -0000	1.22
@@ -93,14 +93,15 @@
 
 FindProgramDlg::FindProgramDlg(HWND hwnd)
  :	super(hwnd),
-	_list_ctrl(GetDlgItem(hwnd, IDC_MAILS_FOUND)),
+	_list_ctrl(GetDlgItem(hwnd, IDC_PROGRAMS_FOUND)),
 	_thread(collect_programs_callback, hwnd, this),
 	_sort(_list_ctrl, CompareFunc/*, (LPARAM)this*/)
 {
 	SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/);
 
-	_resize_mgr.Add(IDC_TOPIC,		RESIZE_X);
-	_resize_mgr.Add(IDC_MAILS_FOUND,RESIZE);
+	_resize_mgr.Add(IDC_FILTER,			RESIZE_X);
+	_resize_mgr.Add(IDC_CHECK_ENTRIES,	MOVE_X);
+	_resize_mgr.Add(IDC_PROGRAMS_FOUND,	RESIZE);
 
 	_resize_mgr.Resize(+520, +300);
 
@@ -151,7 +152,7 @@
 	_thread.Stop();
 
 	TCHAR buffer[1024];
-	GetWindowText(GetDlgItem(_hwnd, IDC_TOPIC), buffer, 1024);
+	GetWindowText(GetDlgItem(_hwnd, IDC_FILTER), buffer, 1024);
 #ifndef __WINE__ ///@todo
 	_tcslwr(buffer);
 #endif
@@ -290,6 +291,10 @@
 			LaunchSelected();
 			break;
 
+		  case IDC_CHECK_ENTRIES:
+			CheckEntries();
+			break;
+
 		  default:
 			return super::Command(id, code);
 		}
@@ -298,7 +303,7 @@
 	}
 	else if (code == EN_CHANGE) {
 		switch(id) {
-		  case IDC_TOPIC:
+		  case IDC_FILTER:
 			Refresh();
 			break;
 		}
@@ -407,3 +412,8 @@
 
 	return sort->_direction? -cmp: cmp;
 }
+
+void FindProgramDlg::CheckEntries()
+{
+	///@todo check all entries for existing targets, display a list of not working entries and ask the user for permission to delete them
+}

reactos/subsys/system/explorer/dialogs
searchprogram.h 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- searchprogram.h	21 Mar 2004 00:31:14 -0000	1.13
+++ searchprogram.h	9 Apr 2004 19:42:20 -0000	1.14
@@ -103,6 +103,7 @@
 	void	Refresh(bool delete_cache=false);
 	void	add_entry(const FPDEntry& cache_entry);
 	void	LaunchSelected();
+	void	CheckEntries();
 
 	static void collect_programs_callback(Entry* entry, void* param);
 	static int CALLBACK CompareFunc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort);

reactos/subsys/system/explorer/shell
mainframe.cpp 1.56 -> 1.57
diff -u -r1.56 -r1.57
--- mainframe.cpp	7 Apr 2004 22:11:24 -0000	1.56
+++ mainframe.cpp	9 Apr 2004 19:42:20 -0000	1.57
@@ -777,7 +777,7 @@
 				 // display tooltips for bookmark folders
 				if (!node._pfolder->_description.empty())
 					lstrcpyn(pnmgit->pszText, node._pfolder->_description.c_str(), pnmgit->cchTextMax);
-			} else {	// BookmarkNode::BMNT_BOOKMARK
+			} else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
 				 // display tooltips for bookmark folders
 				String txt = node._pbookmark->_description;
 
@@ -1050,19 +1050,15 @@
 
 	TreeView_DeleteAllItems(_hsidebar);
 
+	COLORREF bk_color = RGB(255,255,255);
 	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);
+
+	g_Globals._icon_cache.get_icon(ICID_FAVORITES).add_to_imagelist(_himl, canvas);
+	g_Globals._icon_cache.get_icon(ICID_BOOKMARK).add_to_imagelist(_himl, 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);
-*/
+	g_Globals._icon_cache.get_icon(ICID_FOLDER).add_to_imagelist(_himl, canvas);
+	g_Globals._icon_cache.get_icon(ICID_FOLDER).add_to_imagelist(_himl, canvas);
+
 	TV_INSERTSTRUCT tvi;
 
 	tvi.hParent = TVI_ROOT;

reactos/subsys/system/explorer/taskbar
favorites.cpp 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- favorites.cpp	7 Apr 2004 22:11:24 -0000	1.7
+++ favorites.cpp	9 Apr 2004 19:42:20 -0000	1.8
@@ -106,7 +106,7 @@
 }
 
  /// write XBEL bookmark node
-void Bookmark::write(XMLPos& pos)
+void Bookmark::write(XMLPos& pos) const
 {
 	pos.create("bookmark");
 
@@ -157,7 +157,7 @@
 }
 
  /// write bookmark folder conten from XBEL formated XML tree
-void BookmarkFolder::write(XMLPos& pos)
+void BookmarkFolder::write(XMLPos& pos) const
 {
 	pos.create("folder");
 
@@ -177,6 +177,12 @@
 }
 
 
+BookmarkNode::BookmarkNode()
+ :	_type(BMNT_NONE)
+{
+	_pbookmark = NULL;
+}
+
 BookmarkNode::BookmarkNode(const Bookmark& bm)
  :	_type(BMNT_BOOKMARK)
 {
@@ -192,18 +198,66 @@
 BookmarkNode::BookmarkNode(const BookmarkNode& other)
  :	_type(other._type)
 {
-	if (_type == BMNT_BOOKMARK)
+	if (other._type == BMNT_BOOKMARK)
 		_pbookmark = new Bookmark(*other._pbookmark);
-	else
+	else if (other._type == BMNT_FOLDER)
 		_pfolder = new BookmarkFolder(*other._pfolder);
+	else
+		_pbookmark = NULL;
 }
 
 BookmarkNode::~BookmarkNode()
 {
 	if (_type == BMNT_BOOKMARK)
 		delete _pbookmark;
-	else
+	else if (_type == BMNT_FOLDER)
+		delete _pfolder;
+}
+
+BookmarkNode& BookmarkNode::operator=(const Bookmark& bm)
+{
+	clear();
+
+	_pbookmark = new Bookmark(bm);
+
+	return *this;
+}
+
+BookmarkNode& BookmarkNode::operator=(const BookmarkFolder& bmf)
+{
+	clear();
+
+	_pfolder = new BookmarkFolder(bmf);
+
+	return *this;
+}
+
+BookmarkNode& BookmarkNode::operator=(const BookmarkNode& other)
+{
+	clear();
+
+	_type = other._type;
+
+	if (other._type == BMNT_BOOKMARK)
+		_pbookmark = new Bookmark(*other._pbookmark);
+	else if (other._type == BMNT_FOLDER)
+		_pfolder = new BookmarkFolder(*other._pfolder);
+
+	return *this;
+}
+
+void BookmarkNode::clear()
+{
+	if (_type == BMNT_BOOKMARK) {
+		delete _pbookmark;
+		_pbookmark = NULL;
+	}
+	else if (_type == BMNT_FOLDER) {
 		delete _pfolder;
+		_pfolder = NULL;
+	}
+
+	_type = BMNT_NONE;
 }
 
 
@@ -238,13 +292,13 @@
 		const BookmarkNode& node = *it;
 
 		if (node._type == BookmarkNode::BMNT_FOLDER) {
-			BookmarkFolder& folder = *node._pfolder;
+			const BookmarkFolder& folder = *node._pfolder;
 
 			folder.write(pos);
 
 			pos.back();
-		} else {	// BookmarkNode::BMNT_BOOKMARK
-			Bookmark& bookmark = *node._pbookmark;
+		} else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
+			const Bookmark& bookmark = *node._pbookmark;
 
 			if (!bookmark._url.empty())
 				bookmark.write(pos);
@@ -278,7 +332,7 @@
 			HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
 
 			folder._bookmarks.fill_tree(hwnd, hitem, himagelist, hdc_wnd);
-		} else {
+		} else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
 			const Bookmark& bookmark = *node._pbookmark;
 
 			tv.pszText = (LPTSTR)bookmark._name.c_str();
@@ -286,11 +340,10 @@
 			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_AddAlphaIcon(himagelist, icon, hdc_wnd);
+					tv.iImage = tv.iSelectedImage = icon.add_to_imagelist(himagelist, hdc_wnd);
 			}
 
 			TreeView_InsertItem(hwnd, &tvi);

reactos/subsys/system/explorer/taskbar
favorites.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- favorites.h	4 Apr 2004 23:13:11 -0000	1.5
+++ favorites.h	9 Apr 2004 19:42:20 -0000	1.6
@@ -38,26 +38,34 @@
 
 	bool	read_url(LPCTSTR path);
 	bool	read(const_XMLPos& pos);
-	void	write(XMLPos& pos);
+	void	write(XMLPos& pos) const;
 };
 
 struct BookmarkFolder;
 
 struct BookmarkNode
 {
+	BookmarkNode();
 	BookmarkNode(const Bookmark& bm);
 	BookmarkNode(const BookmarkFolder& bmf);
 	BookmarkNode(const BookmarkNode& other);
+
 	~BookmarkNode();
 
+	BookmarkNode& operator=(const Bookmark& bm);
+	BookmarkNode& operator=(const BookmarkFolder& bmf);
+	BookmarkNode& operator=(const BookmarkNode& other);
+
+	void	clear();
+
 	enum BOOKMARKNODE_TYPE {
-		BMNT_BOOKMARK, BMNT_FOLDER
+		BMNT_NONE, BMNT_BOOKMARK, BMNT_FOLDER
 	};
 
 	BOOKMARKNODE_TYPE	_type;
 
 	union {
-		Bookmark*	_pbookmark;
+		Bookmark*		_pbookmark;
 		BookmarkFolder* _pfolder;
 	};
 };
@@ -79,7 +87,7 @@
 	BookmarkList _bookmarks;
 
 	void	read(const_XMLPos& pos);
-	void	write(XMLPos& pos);
+	void	write(XMLPos& pos) const;
 };
 
 struct Favorites : public BookmarkList

reactos/subsys/system/explorer/taskbar
startmenu.cpp 1.84 -> 1.85
diff -u -r1.84 -r1.85
--- startmenu.cpp	4 Apr 2004 16:04:34 -0000	1.84
+++ startmenu.cpp	9 Apr 2004 19:42:20 -0000	1.85
@@ -95,7 +95,7 @@
 
 Window::CREATORFUNC_INFO StartMenu::s_def_creator = STARTMENU_CREATOR(StartMenu);
 
-HWND StartMenu::Create(int x, int y, const StartMenuFolders& folders, HWND hwndParent, LPCTSTR title, CREATORFUNC_INFO creator)
+HWND StartMenu::Create(int x, int y, const StartMenuFolders& folders, HWND hwndParent, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
 {
 	UINT style, ex_style;
 	int top_height;
@@ -123,6 +123,7 @@
 	create_info._folders = folders;
 	create_info._border_top = top_height;
 	create_info._creator = creator;
+	create_info._info = info;
 
 	if (title)
 		create_info._title = title;
@@ -862,7 +863,7 @@
 }
 
 
-StartMenuEntry& StartMenu::AddEntry(const String& title, ICON_ID icon_id, Entry* entry)
+ShellEntryMap::iterator StartMenu::AddEntry(const String& title, ICON_ID icon_id, Entry* entry)
 {
 	 // search for an already existing subdirectory entry with the same name
 	if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
@@ -874,32 +875,35 @@
 					if ((*it2)->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
 						 // merge the new shell entry with the existing of the same name
 						sme._entries.insert(entry);
-						return sme;
+
+						return it;
 					}
 				}
 		}
 
-	StartMenuEntry& sme = AddEntry(title, icon_id);
+	ShellEntryMap::iterator sme = AddEntry(title, icon_id);
 
-	sme._entries.insert(entry);
+	sme->second._entries.insert(entry);
 
 	return sme;
 }
 
-StartMenuEntry& StartMenu::AddEntry(const String& title, ICON_ID icon_id, int id)
+ShellEntryMap::iterator StartMenu::AddEntry(const String& title, ICON_ID icon_id, int id)
 {
 	if (id == -1)
 		id = ++_next_id;
 
-	StartMenuEntry& sme = _entries[id];
+	StartMenuEntry sme;
 
 	sme._title = title;
 	sme._icon_id = icon_id;
 
-	return sme;
+	ShellEntryMap::iterator it = _entries.insert(make_pair(id, sme)).first;
+
+	return it;
 }
 
-StartMenuEntry& StartMenu::AddEntry(const ShellFolder folder, ShellEntry* entry)
+ShellEntryMap::iterator StartMenu::AddEntry(const ShellFolder folder, ShellEntry* entry)
 {
 	ICON_ID icon_id;
 
@@ -911,7 +915,7 @@
 	return AddEntry(folder.get_name(entry->_pidl), icon_id, entry);
 }
 
-StartMenuEntry& StartMenu::AddEntry(const ShellFolder folder, Entry* entry)
+ShellEntryMap::iterator StartMenu::AddEntry(const ShellFolder folder, Entry* entry)
 {
 	ICON_ID icon_id;
 
@@ -1004,12 +1008,12 @@
 }
 
 
-void StartMenu::CreateSubmenu(int id, LPCTSTR title, CREATORFUNC_INFO creator)
+void StartMenu::CreateSubmenu(int id, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
 {
-	CreateSubmenu(id, StartMenuFolders(), title, creator);
+	CreateSubmenu(id, StartMenuFolders(), title, creator, info);
 }
 
-bool StartMenu::CreateSubmenu(int id, int folder_id, LPCTSTR title, CREATORFUNC_INFO creator)
+bool StartMenu::CreateSubmenu(int id, int folder_id, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
 {
 	try {
 		SpecialFolderPath folder(folder_id, _hwnd);
@@ -1017,7 +1021,7 @@
 		StartMenuFolders new_folders;
 		new_folders.push_back(folder);
 
-		CreateSubmenu(id, new_folders, title, creator);
+		CreateSubmenu(id, new_folders, title, creator, info);
 
 		return true;
 	} catch(COMException&) {
@@ -1028,7 +1032,7 @@
 	}
 }
 
-bool StartMenu::CreateSubmenu(int id, int folder_id1, int folder_id2, LPCTSTR title, CREATORFUNC_INFO creator)
+bool StartMenu::CreateSubmenu(int id, int folder_id1, int folder_id2, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
 {
 	StartMenuFolders new_folders;
 
@@ -1043,7 +1047,7 @@
 	}
 
 	if (!new_folders.empty()) {
-		CreateSubmenu(id, new_folders, title, creator);
+		CreateSubmenu(id, new_folders, title, creator, info);
 		return true;
 	} else {
 		CloseOtherSubmenus(id);
@@ -1052,7 +1056,7 @@
 	}
 }
 
-void StartMenu::CreateSubmenu(int id, const StartMenuFolders& new_folders, LPCTSTR title, CREATORFUNC_INFO creator)
+void StartMenu::CreateSubmenu(int id, const StartMenuFolders& new_folders, LPCTSTR title, CREATORFUNC_INFO creator, void* info)
 {
 	 // Only open one submenu at a time.
 	if (!CloseOtherSubmenus(id))
@@ -1074,7 +1078,7 @@
 	}
 
 	_submenu_id = id;
-	_submenu = StartMenu::Create(x, y, new_folders, _hwnd, title, creator);
+	_submenu = StartMenu::Create(x, y, new_folders, _hwnd, title, creator, info);
 }
 
 
@@ -1108,7 +1112,7 @@
 			HWND hparent = GetParent(_hwnd);
 			ShellPath shell_path = entry->create_absolute_pidl();
 
-			 // close start menus after launching the selected entry
+			 // close start menus when launching the selected entry
 			CloseStartMenu(id);
 
 			///@todo launch in the background; specify correct HWND for error message box titles
@@ -1616,7 +1620,11 @@
 		break;
 
 	  case IDC_FAVORITES:
+#ifndef _SHELL32_FAVORITES
+		CreateSubmenu(id, ResString(IDS_FAVORITES), STARTMENU_CREATOR(FavoritesMenu), &static_cast<BookmarkList&>(g_Globals._favorites));
+#else
 		CreateSubmenu(id, CSIDL_COMMON_FAVORITES, CSIDL_FAVORITES, ResString(IDS_FAVORITES));
+#endif
 		break;
 
 	  case IDC_BROWSE:
@@ -1805,13 +1813,13 @@
 		AddButton(ResString(IDS_CONTROL_PANEL),	ICID_CONFIG, false, IDC_CONTROL_PANEL);
 
 #ifdef _ROS_	// to be removed when printer/network will be implemented
-	AddButton(ResString(IDS_PRINTERS),		ICID_PRINTER, false, IDC_PRINTERS);
-	AddButton(ResString(IDS_CONNECTIONS),	ICID_NETWORK, false, IDC_CONNECTIONS);
+	AddButton(ResString(IDS_PRINTERS),			ICID_PRINTER, false, IDC_PRINTERS);
+	AddButton(ResString(IDS_CONNECTIONS),		ICID_NETWORK, false, IDC_CONNECTIONS);
 #else
-	AddButton(ResString(IDS_PRINTERS),		ICID_PRINTER, true, IDC_PRINTERS);
-	AddButton(ResString(IDS_CONNECTIONS),	ICID_NETWORK, true, IDC_CONNECTIONS);
+	AddButton(ResString(IDS_PRINTERS),			ICID_PRINTER, true, IDC_PRINTERS);
+	AddButton(ResString(IDS_CONNECTIONS),		ICID_NETWORK, true, IDC_CONNECTIONS);
 #endif
-	AddButton(ResString(IDS_ADMIN),			ICID_CONFIG, true, IDC_ADMIN);
+	AddButton(ResString(IDS_ADMIN),				ICID_CONFIG, true, IDC_ADMIN);
 
 #ifndef __MINGW32__	// SHRestricted() missing in MinGW (as of 29.10.2003)
 	if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
@@ -1829,26 +1837,26 @@
 	if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD))	// or REST_NOENTIRENETWORK ?
 #endif
 #ifdef _ROS_	// to be removed when printer/network will be implemented
-		AddButton(ResString(IDS_NETWORK),	ICID_NETWORK, false, IDC_NETWORK);
+		AddButton(ResString(IDS_NETWORK),		ICID_NETWORK, false, IDC_NETWORK);
 #else
-		AddButton(ResString(IDS_NETWORK),	ICID_NETWORK, true, IDC_NETWORK);
+		AddButton(ResString(IDS_NETWORK),		ICID_NETWORK, true, IDC_NETWORK);
 #endif
 
-	AddButton(ResString(IDS_DRIVES),	ICID_FOLDER, true, IDC_DRIVES);
+	AddButton(ResString(IDS_DRIVES),			ICID_FOLDER, true, IDC_DRIVES);
 }
 
 void SearchMenu::AddEntries()
 {
 	super::AddEntries();
 
-	AddButton(ResString(IDS_SEARCH_PRG),	ICID_APPS, false, IDC_SEARCH_PROGRAM);
-
-	AddButton(ResString(IDS_SEARCH_FILES),	ICID_SEARCH_DOC, false, IDC_SEARCH_FILES);
+	AddButton(ResString(IDS_SEARCH_FILES),		ICID_SEARCH_DOC, false, IDC_SEARCH_FILES);
 
 #ifndef __MINGW32__	// SHRestricted() missing in MinGW (as of 29.10.2003)
 	if (!g_Globals._SHRestricted || !SHRestricted(REST_HASFINDCOMPUTERS))
 #endif
-		AddButton(ResString(IDS_SEARCH_COMPUTER),	ICID_COMPUTER, false, IDC_SEARCH_COMPUTER);
+		AddButton(ResString(IDS_SEARCH_COMPUTER),ICID_COMPUTER, false, IDC_SEARCH_COMPUTER);
+
+	AddButton(ResString(IDS_SEARCH_PRG),		ICID_APPS, false, IDC_SEARCH_PROGRAM);
 }
 
 
@@ -1872,3 +1880,62 @@
 		AddShellEntries(dir, RECENT_DOCS_COUNT, smd._subfolders);
 	}
 }
+
+
+#ifndef _SHELL32_FAVORITES
+
+void FavoritesMenu::AddEntries()
+{
+	super::AddEntries();
+
+	for(BookmarkList::iterator it=_bookmarks.begin(); it!=_bookmarks.end(); ++it) {
+		BookmarkNode& node = *it;
+
+		int id = ++_next_id;
+
+		_entries[id] = node;
+
+		if (node._type == BookmarkNode::BMNT_FOLDER) {
+			BookmarkFolder& folder = *node._pfolder;
+
+			AddButton(folder._name, ICID_FOLDER, true, id);
+		} else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
+			Bookmark& bookmark = *node._pbookmark;
+
+			ICON_ID icon = ICID_NONE;
+
+			if (!bookmark._icon_path.empty())
+				icon = g_Globals._icon_cache.extract(bookmark._icon_path, bookmark._icon_idx);
+
+			AddButton(bookmark._name, icon!=ICID_NONE?icon:ICID_BOOKMARK, false, id);
+		}
+	}
+}
+
+int FavoritesMenu::Command(int id, int code)
+{
+	BookmarkMap::iterator found = _entries.find(id);
+
+	if (found != _entries.end()) {
+		BookmarkNode& node = found->second;
+
+		if (node._type == BookmarkNode::BMNT_FOLDER) {
+			BookmarkFolder& folder = *node._pfolder;
+
+			if (CloseOtherSubmenus(id))
+				CreateSubmenu(id, folder._name, STARTMENU_CREATOR(FavoritesMenu), &static_cast<BookmarkList&>(folder._bookmarks));
+		} else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
+			Bookmark& bookmark = *node._pbookmark;
+
+			String url = bookmark._url;
+			CloseStartMenu(id);
+			launch_file(GetParent(_hwnd), url, SW_SHOWNORMAL);
+		}
+
+		return 0;
+	}
+
+	return super::Command(id, code);
+}
+
+#endif

reactos/subsys/system/explorer/taskbar
startmenu.h 1.45 -> 1.46
diff -u -r1.45 -r1.46
--- startmenu.h	20 Mar 2004 13:49:12 -0000	1.45
+++ startmenu.h	9 Apr 2004 19:42:21 -0000	1.46
@@ -138,7 +138,7 @@
 
 typedef list<ShellPath> StartMenuFolders;
 
- /// structor containing information for creating start menus
+ /// structor containing information for creating of start menus
 struct StartMenuCreateInfo
 {
 	StartMenuCreateInfo() : _border_top(0) {}
@@ -147,6 +147,7 @@
 	int		_border_top;
 	String	_title;
 	Window::CREATORFUNC_INFO _creator;
+	void*	_info;
 };
 
 #define STARTMENU_CREATOR(WND_CLASS) WINDOW_CREATOR_INFO(WND_CLASS, StartMenuCreateInfo)
@@ -216,7 +217,8 @@
 	StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info);
 	~StartMenu();
 
-	static HWND Create(int x, int y, const StartMenuFolders&, HWND hwndParent, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator);
+	static HWND Create(int x, int y, const StartMenuFolders&, HWND hwndParent, LPCTSTR title,
+						CREATORFUNC_INFO creator=s_def_creator, void* info=NULL);
 	static CREATORFUNC_INFO s_def_creator;
 
 protected:
@@ -266,10 +268,10 @@
 
 	virtual void AddEntries();
 
-	StartMenuEntry& AddEntry(const String& title, ICON_ID icon_id, Entry* entry);
-	StartMenuEntry& AddEntry(const String& title, ICON_ID icon_id=ICID_NONE, int id=-1);
-	StartMenuEntry& AddEntry(const ShellFolder folder, ShellEntry* entry);
-	StartMenuEntry& AddEntry(const ShellFolder folder, Entry* entry);
+	ShellEntryMap::iterator AddEntry(const String& title, ICON_ID icon_id, Entry* entry);
+	ShellEntryMap::iterator AddEntry(const String& title, ICON_ID icon_id=ICID_NONE, int id=-1);
+	ShellEntryMap::iterator AddEntry(const ShellFolder folder, ShellEntry* entry);
+	ShellEntryMap::iterator AddEntry(const ShellFolder folder, Entry* entry);
 
 	void	AddShellEntries(const ShellDirectory& dir, int max=-1, bool subfolders=true);
 
@@ -278,10 +280,10 @@
 
 	bool	CloseSubmenus() {return CloseOtherSubmenus();}
 	bool	CloseOtherSubmenus(int id=0);
-	void	CreateSubmenu(int id, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator);
-	bool	CreateSubmenu(int id, int folder, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator);
-	bool	CreateSubmenu(int id, int folder1, int folder2, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator);
-	void	CreateSubmenu(int id, const StartMenuFolders& new_folders, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator);
+	void	CreateSubmenu(int id, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void*info=NULL);
+	bool	CreateSubmenu(int id, int folder, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void*info=NULL);
+	bool	CreateSubmenu(int id, int folder1, int folder2, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void*info=NULL);
+	void	CreateSubmenu(int id, const StartMenuFolders& new_folders, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void*info=NULL);
 	void	ActivateEntry(int id, const ShellEntrySet& entries);
 	virtual void CloseStartMenu(int id=0);
 
@@ -357,10 +359,11 @@
 
 	SIZE	_logo_size;
 
-	void	AddEntries();
+	virtual void AddEntries();
+	virtual void ProcessKey(int vk);
+
 	void	Paint(PaintCanvas& canvas);
 	void	CloseStartMenu(int id=0);
-	virtual void ProcessKey(int vk);
 };
 
 
@@ -375,7 +378,7 @@
 	}
 
 protected:
-	void	AddEntries();
+	virtual void AddEntries();
 };
 
 
@@ -390,7 +393,7 @@
 	}
 
 protected:
-	void	AddEntries();
+	virtual void AddEntries();
 };
 
 
@@ -405,7 +408,7 @@
 	}
 
 protected:
-	void	AddEntries();
+	virtual void AddEntries();
 };
 
 
@@ -424,3 +427,29 @@
 protected:
 	virtual void AddEntries();
 };
+
+
+#ifndef _SHELL32_FAVORITES
+
+typedef map<int, BookmarkNode> BookmarkMap;
+
+ /// Bookmarks sub-startmenu
+struct FavoritesMenu : public StartMenu
+{
+	typedef StartMenu super;
+
+	FavoritesMenu(HWND hwnd, const StartMenuCreateInfo& create_info)
+	 :	super(hwnd, create_info),
+		_bookmarks(*(BookmarkList*)create_info._info)
+	{
+	}
+
+protected:
+	virtual int Command(int id, int code);
+	virtual void AddEntries();
+
+	BookmarkList _bookmarks;
+	BookmarkMap	_entries;
+};
+
+#endif
CVSspam 0.2.8