From 199ffcb9bc42dba975213342f1184a2d1578da58 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 4 Apr 2004 19:12:55 +0000 Subject: [PATCH] icons and tooltips for bookmarks svn path=/trunk/; revision=8968 --- .../subsys/system/explorer/doc/changes.txt | 7 +++++ .../system/explorer/shell/mainframe.cpp | 29 +++++++++++++++++-- .../subsys/system/explorer/shell/mainframe.h | 2 ++ .../system/explorer/shell/shellbrowser.cpp | 2 +- .../system/explorer/taskbar/favorites.cpp | 12 +++++--- .../system/explorer/taskbar/favorites.h | 2 +- .../subsys/system/explorer/utility/window.h | 2 +- 7 files changed, 47 insertions(+), 9 deletions(-) diff --git a/reactos/subsys/system/explorer/doc/changes.txt b/reactos/subsys/system/explorer/doc/changes.txt index 7715b521dce..634948856d1 100644 --- a/reactos/subsys/system/explorer/doc/changes.txt +++ b/reactos/subsys/system/explorer/doc/changes.txt @@ -68,3 +68,10 @@ If you search for more information, look into the CVS repository. 25.02.2004 m. fuchs rebar control for desktop bar 28.02.2004 m. fuchs "minimize all" functionality various fixes for notification icons, task bar and desktop switching +12.03.2004 m. fuchs automatic adjustment start button to text size +15.03.2004 m. fuchs implementation of volume control tray icon +20.03.2004 m. fuchs context menu for notification area +21.03.2004 m. fuchs configuration dialog for notification icons + XML storage for configuration options +28.03.2004 m. fuchs configuration options for showing/hiding clock, ... +04.04.2004 m. fuchs import of IE bookmarks; explorer sidebar with bookmark display diff --git a/reactos/subsys/system/explorer/shell/mainframe.cpp b/reactos/subsys/system/explorer/shell/mainframe.cpp index 0adce711475..00d72fb4657 100644 --- a/reactos/subsys/system/explorer/shell/mainframe.cpp +++ b/reactos/subsys/system/explorer/shell/mainframe.cpp @@ -277,9 +277,12 @@ MainFrame::MainFrame(HWND hwnd) 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_NOTOOLTIPS|TVS_SHOWSELALWAYS, + WS_CHILD|WS_TABSTOP|WS_BORDER|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|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); FillBookmarks(); @@ -288,6 +291,8 @@ MainFrame::MainFrame(HWND hwnd) MainFrame::~MainFrame() { + ImageList_Destroy(_himl); + // don't exit desktop when closing file manager window if (!g_Globals._desktop_mode) PostQuitMessage(0); @@ -757,8 +762,25 @@ int MainFrame::Command(int id, int code) int MainFrame::Notify(int id, NMHDR* pnmh) { - if (pnmh->code == RBN_AUTOSIZE) + switch(pnmh->code) { + case RBN_AUTOSIZE: resize_frame_rect(ClientRect(_hwnd)); + break; + + case TVN_GETINFOTIP: { + NMTVGETINFOTIP* pnmgit = (NMTVGETINFOTIP*)pnmh; + const BookmarkNode& node = *(BookmarkNode*)pnmgit->lParam; + + if (node._type == BookmarkNode::BMNT_FOLDER) { + 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); + break;} + } return 0; } @@ -766,6 +788,9 @@ int MainFrame::Notify(int id, NMHDR* pnmh) void MainFrame::resize_frame_rect(PRECT prect) { + if (prect->bottom <= prect->top) + return; // avoid resizing children when receiving RBN_AUTOSIZE while getting minimized + if (_hwndrebar) { int height = ClientRect(_hwndrebar).bottom; MoveWindow(_hwndrebar, prect->left, prect->top, prect->right-prect->left, height, TRUE); diff --git a/reactos/subsys/system/explorer/shell/mainframe.h b/reactos/subsys/system/explorer/shell/mainframe.h index 2a951f8a743..e3b0085b614 100644 --- a/reactos/subsys/system/explorer/shell/mainframe.h +++ b/reactos/subsys/system/explorer/shell/mainframe.h @@ -62,6 +62,8 @@ protected: WindowHandle _hcommandedit; WindowHandle _hsidebar; + HIMAGELIST _himl; + HMENU _hMenuFrame; HMENU _hMenuWindow; diff --git a/reactos/subsys/system/explorer/shell/shellbrowser.cpp b/reactos/subsys/system/explorer/shell/shellbrowser.cpp index 2537e7928f6..dbf08e0cc48 100644 --- a/reactos/subsys/system/explorer/shell/shellbrowser.cpp +++ b/reactos/subsys/system/explorer/shell/shellbrowser.cpp @@ -96,7 +96,7 @@ LRESULT ShellBrowserChild::Init(LPCREATESTRUCT pcs) // create explorer treeview if (_create_info._open_mode & OWM_EXPLORE) _left_hwnd = CreateWindowEx(0, WC_TREEVIEW, NULL, - WS_CHILD|WS_TABSTOP|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_NOTOOLTIPS|TVS_SHOWSELALWAYS, + WS_CHILD|WS_TABSTOP|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS,//|TVS_NOTOOLTIPS 0, rect.top, _split_pos-SPLIT_WIDTH/2, rect.bottom-rect.top, _hwnd, (HMENU)IDC_FILETREE, g_Globals._hInstance, 0); diff --git a/reactos/subsys/system/explorer/taskbar/favorites.cpp b/reactos/subsys/system/explorer/taskbar/favorites.cpp index c9c2612423c..0fcbb0ee689 100644 --- a/reactos/subsys/system/explorer/taskbar/favorites.cpp +++ b/reactos/subsys/system/explorer/taskbar/favorites.cpp @@ -159,7 +159,7 @@ void BookmarkList::write(XMLPos& pos) const folder._bookmarks.write(pos); pos.back(); - } else { // node._type == BookmarkNode::BMNT_BOOKMARK + } else { // BookmarkNode::BMNT_BOOKMARK Bookmark& bookmark = *node._pbookmark; if (!bookmark._url.empty()) { @@ -186,16 +186,19 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent) const tvi.hInsertAfter = TVI_LAST; TV_ITEM& tv = tvi.item; - tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; for(const_iterator it=begin(); it!=end(); ++it) { const BookmarkNode& node = *it; + tv.lParam = (LPARAM)&node; + if (node._type == BookmarkNode::BMNT_FOLDER) { const BookmarkFolder& folder = *node._pfolder; tv.pszText = (LPTSTR)folder._name.c_str(); - tv.iSelectedImage = tv.iImage = 0; + tv.iImage = 3; + tv.iSelectedImage = 4; HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi); folder._bookmarks.fill_tree(hwnd, hitem); @@ -203,7 +206,8 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent) const const Bookmark& bookmark = *node._pbookmark; tv.pszText = (LPTSTR)bookmark._name.c_str(); - tv.iSelectedImage = tv.iImage = 0; + tv.iImage = 0; + tv.iSelectedImage = 1; TreeView_InsertItem(hwnd, &tvi); } } diff --git a/reactos/subsys/system/explorer/taskbar/favorites.h b/reactos/subsys/system/explorer/taskbar/favorites.h index 0e8ee7848f8..2143d75d626 100644 --- a/reactos/subsys/system/explorer/taskbar/favorites.h +++ b/reactos/subsys/system/explorer/taskbar/favorites.h @@ -31,8 +31,8 @@ struct Bookmark Bookmark() : _icon_idx(0) {} String _name; - String _url; String _description; + String _url; String _icon_path; int _icon_idx; diff --git a/reactos/subsys/system/explorer/utility/window.h b/reactos/subsys/system/explorer/utility/window.h index 5bd030bd531..82318b108fe 100644 --- a/reactos/subsys/system/explorer/utility/window.h +++ b/reactos/subsys/system/explorer/utility/window.h @@ -1017,7 +1017,7 @@ protected: }; if (tooltip) - _tcsncpy(nid.szTip, tooltip, COUNTOF(nid.szTip)); + lstrcpyn(nid.szTip, tooltip, COUNTOF(nid.szTip)); if (nid.szTip[0]) nid.uFlags |= NIF_TIP;