mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
display bookmarks in sidebar
svn path=/trunk/; revision=8966
This commit is contained in:
parent
9af64d9189
commit
b60d102548
8 changed files with 84 additions and 9 deletions
|
@ -145,6 +145,7 @@ BEGIN
|
|||
MENUITEM SEPARATOR
|
||||
MENUITEM "ツールバー(&T)", ID_VIEW_TOOL_BAR, CHECKED
|
||||
MENUITEM "ドライブバー(&D)", ID_VIEW_DRIVE_BAR, CHECKED
|
||||
MENUITEM "&Side bar", ID_VIEW_SIDE_BAR
|
||||
MENUITEM "ステータスバー(&S)", ID_VIEW_STATUSBAR, CHECKED
|
||||
MENUITEM "全画面表\示(&U)\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#define IDW_DRIVEBAR 0x103
|
||||
#define IDW_ADDRESSBAR 0x104
|
||||
#define IDW_COMMANDBAR 0x105
|
||||
#define IDW_SIDEBAR 0x106
|
||||
#define IDW_FIRST_CHILD 0xC000 /*0x200*/
|
||||
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
#define ID_VIEW_DRIVE_BAR 507
|
||||
#define ID_VIEW_TOOL_BAR 508
|
||||
#define ID_VIEW_EXTRA_BAR 509
|
||||
#define ID_VIEW_SIDE_BAR 510
|
||||
#define IDC_ROS_EXPLORER 1000
|
||||
#define IDC_ICON_ALIGN_0 1002
|
||||
#define IDC_ICON_ALIGN_1 1003
|
||||
|
|
|
@ -38,6 +38,7 @@ BEGIN
|
|||
MENUITEM "&Extra Bar", ID_VIEW_EXTRA_BAR
|
||||
MENUITEM "&Drivebar", ID_VIEW_DRIVE_BAR, CHECKED
|
||||
MENUITEM "&Bara de stare", ID_VIEW_STATUSBAR
|
||||
MENUITEM "&Side Bar", ID_VIEW_SIDE_BAR
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
|
||||
END
|
||||
|
@ -327,6 +328,7 @@ BEGIN
|
|||
MENUITEM "&Toolbar", ID_VIEW_TOOL_BAR
|
||||
MENUITEM "&Extra Bar", ID_VIEW_EXTRA_BAR
|
||||
MENUITEM "Lauf&werkleiste", ID_VIEW_DRIVE_BAR, CHECKED
|
||||
MENUITEM "&Side Bar", ID_VIEW_SIDE_BAR
|
||||
MENUITEM "&Status Bar", ID_VIEW_STATUSBAR
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Vollbild\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
|
||||
|
@ -569,6 +571,7 @@ BEGIN
|
|||
MENUITEM "&Toolbar", ID_VIEW_TOOL_BAR
|
||||
MENUITEM "&Extra Bar", ID_VIEW_EXTRA_BAR
|
||||
MENUITEM "&Drivebar", ID_VIEW_DRIVE_BAR, CHECKED
|
||||
MENUITEM "&Side Bar", ID_VIEW_SIDE_BAR
|
||||
MENUITEM "&Status Bar", ID_VIEW_STATUSBAR
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
|
||||
|
@ -668,6 +671,7 @@ BEGIN
|
|||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Toolbar", ID_VIEW_TOOL_BAR, CHECKED
|
||||
MENUITEM "&Drivebar", ID_VIEW_DRIVE_BAR, CHECKED
|
||||
MENUITEM "&Side Bar", ID_VIEW_SIDE_BAR
|
||||
MENUITEM "&Status Bar", ID_VIEW_STATUSBAR, CHECKED
|
||||
MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
|
||||
MENUITEM SEPARATOR
|
||||
|
@ -993,6 +997,7 @@ BEGIN
|
|||
MENUITEM "Barre d'&outils", ID_VIEW_TOOL_BAR
|
||||
MENUITEM "&Extra Bar", ID_VIEW_EXTRA_BAR
|
||||
MENUITEM "&Drivebar", ID_VIEW_DRIVE_BAR, CHECKED
|
||||
MENUITEM "&Side Bar", ID_VIEW_SIDE_BAR
|
||||
MENUITEM "Barre d'&état", ID_VIEW_STATUSBAR
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
|
||||
|
@ -1193,6 +1198,7 @@ BEGIN
|
|||
MENUITEM SEPARATOR
|
||||
MENUITEM "Barra de Ferramentas", ID_VIEW_TOOL_BAR, CHECKED
|
||||
MENUITEM "Barra de Drives", ID_VIEW_DRIVE_BAR, CHECKED
|
||||
MENUITEM "&Side Bar", ID_VIEW_SIDE_BAR
|
||||
MENUITEM "Barra de Estado", ID_VIEW_STATUSBAR, CHECKED
|
||||
MENUITEM "Ecrã Cheio\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -275,6 +275,14 @@ MainFrame::MainFrame(HWND hwnd)
|
|||
|
||||
_hstatusbar = CreateStatusWindow(WS_CHILD|WS_VISIBLE, 0, hwnd, IDW_STATUSBAR);
|
||||
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,
|
||||
-1, -1, 200, 0, _hwnd, (HMENU)IDW_SIDEBAR, g_Globals._hInstance, 0);
|
||||
|
||||
CheckMenuItem(_menu_info._hMenuView, ID_VIEW_SIDE_BAR, MF_BYCOMMAND|MF_CHECKED);
|
||||
|
||||
FillBookmarks();
|
||||
}
|
||||
|
||||
|
||||
|
@ -602,6 +610,10 @@ int MainFrame::Command(int id, int code)
|
|||
toggle_child(_hwnd, id, _hstatusbar);
|
||||
break;
|
||||
|
||||
case ID_VIEW_SIDE_BAR:
|
||||
toggle_child(_hwnd, id, _hsidebar);
|
||||
break;
|
||||
|
||||
case ID_EXECUTE: {
|
||||
ExecuteDialog dlg = {{0}, 0};
|
||||
|
||||
|
@ -761,27 +773,27 @@ void MainFrame::resize_frame_rect(PRECT prect)
|
|||
} else {
|
||||
if (IsWindowVisible(_htoolbar)) {
|
||||
SendMessage(_htoolbar, WM_SIZE, 0, 0);
|
||||
ClientRect rt(_htoolbar);
|
||||
prect->top = rt.bottom+3;
|
||||
// prect->bottom -= rt.bottom+3;
|
||||
WindowRect rt(_htoolbar);
|
||||
prect->top = rt.bottom;
|
||||
// prect->bottom -= rt.bottom;
|
||||
}
|
||||
|
||||
if (IsWindowVisible(_hextrabar)) {
|
||||
SendMessage(_hextrabar, WM_SIZE, 0, 0);
|
||||
ClientRect rt(_hextrabar);
|
||||
int new_top = --prect->top + rt.bottom+3;
|
||||
WindowRect rt(_hextrabar);
|
||||
int new_top = --prect->top + rt.bottom;
|
||||
MoveWindow(_hextrabar, 0, prect->top, rt.right, new_top, TRUE);
|
||||
prect->top = new_top;
|
||||
// prect->bottom -= rt.bottom+2;
|
||||
// prect->bottom -= rt.bottom;
|
||||
}
|
||||
|
||||
if (IsWindowVisible(_hdrivebar)) {
|
||||
SendMessage(_hdrivebar, WM_SIZE, 0, 0);
|
||||
ClientRect rt(_hdrivebar);
|
||||
int new_top = --prect->top + rt.bottom+3;
|
||||
WindowRect rt(_hdrivebar);
|
||||
int new_top = --prect->top + rt.bottom;
|
||||
MoveWindow(_hdrivebar, 0, prect->top, rt.right, new_top, TRUE);
|
||||
prect->top = new_top;
|
||||
// prect->bottom -= rt.bottom+2;
|
||||
// prect->bottom -= rt.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -803,6 +815,13 @@ void MainFrame::resize_frame_rect(PRECT prect)
|
|||
SetWindowPos(_hcommandedit, 0, mid+1, prect->bottom, prect->right-(mid+1), rt.bottom, SWP_NOACTIVATE|SWP_NOZORDER);
|
||||
}
|
||||
|
||||
if (IsWindowVisible(_hsidebar)) {
|
||||
WindowRect rt(_hsidebar);
|
||||
prect->left += rt.right-rt.left;
|
||||
|
||||
SetWindowPos(_hsidebar, 0, -1, prect->top-1, rt.right-rt.left, prect->bottom-prect->top+1, SWP_NOACTIVATE|SWP_NOZORDER);
|
||||
}
|
||||
|
||||
#ifndef _NO_MDI
|
||||
MoveWindow(_hmdiclient, prect->left-1, prect->top-1, prect->right-prect->left+2, prect->bottom-prect->top+1, TRUE);
|
||||
#endif
|
||||
|
@ -986,4 +1005,14 @@ bool MainFrame::activate_child_window(LPCTSTR filesys)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainFrame::FillBookmarks()
|
||||
{
|
||||
HiddenWindow hide(_hsidebar);
|
||||
|
||||
TreeView_DeleteAllItems(_hsidebar);
|
||||
|
||||
g_Globals._favorites.fill_tree(_hsidebar, TVI_ROOT);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -60,6 +60,7 @@ protected:
|
|||
WindowHandle _hdrivebar;
|
||||
WindowHandle _haddressedit;
|
||||
WindowHandle _hcommandedit;
|
||||
WindowHandle _hsidebar;
|
||||
|
||||
HMENU _hMenuFrame;
|
||||
HMENU _hMenuWindow;
|
||||
|
@ -82,6 +83,8 @@ protected:
|
|||
BOOL toggle_fullscreen();
|
||||
void fullscreen_move();
|
||||
|
||||
void FillBookmarks();
|
||||
|
||||
HACCEL _hAccel;
|
||||
TCHAR _drives[BUFFER_LEN];
|
||||
};
|
||||
|
|
|
@ -178,6 +178,38 @@ void BookmarkList::write(XMLPos& pos) const
|
|||
}
|
||||
|
||||
|
||||
void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent) const
|
||||
{
|
||||
TV_INSERTSTRUCT tvi;
|
||||
|
||||
tvi.hParent = parent;
|
||||
tvi.hInsertAfter = TVI_LAST;
|
||||
|
||||
TV_ITEM& tv = tvi.item;
|
||||
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
||||
|
||||
for(const_iterator it=begin(); it!=end(); ++it) {
|
||||
const BookmarkNode& node = *it;
|
||||
|
||||
if (node._type == BookmarkNode::BMNT_FOLDER) {
|
||||
const BookmarkFolder& folder = *node._pfolder;
|
||||
|
||||
tv.pszText = (LPTSTR)folder._name.c_str();
|
||||
tv.iSelectedImage = tv.iImage = 0;
|
||||
HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
|
||||
|
||||
folder._bookmarks.fill_tree(hwnd, hitem);
|
||||
} else {
|
||||
const Bookmark& bookmark = *node._pbookmark;
|
||||
|
||||
tv.pszText = (LPTSTR)bookmark._name.c_str();
|
||||
tv.iSelectedImage = tv.iImage = 0;
|
||||
TreeView_InsertItem(hwnd, &tvi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BookmarkList::import_IE_favorites(ShellDirectory& dir, HWND hwnd)
|
||||
{
|
||||
TCHAR path[MAX_PATH], ext[_MAX_EXT];
|
||||
|
|
|
@ -67,6 +67,8 @@ struct BookmarkList : public list<BookmarkNode>
|
|||
|
||||
void read(const_XMLPos& pos);
|
||||
void write(XMLPos& pos) const;
|
||||
|
||||
void fill_tree(HWND hwnd, HTREEITEM parent) const;
|
||||
};
|
||||
|
||||
struct BookmarkFolder
|
||||
|
|
Loading…
Reference in a new issue