mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 15:36:04 +00:00
replace previous favorites start menu folder implementation by fast FavoritesMenu (using the internal XML bookmark informations)
svn path=/trunk/; revision=9050
This commit is contained in:
parent
50133e0fad
commit
05cab1ebfd
12 changed files with 277 additions and 110 deletions
|
@ -93,14 +93,15 @@ void CollectProgramsThread::free_dirs()
|
||||||
|
|
||||||
FindProgramDlg::FindProgramDlg(HWND hwnd)
|
FindProgramDlg::FindProgramDlg(HWND hwnd)
|
||||||
: super(hwnd),
|
: super(hwnd),
|
||||||
_list_ctrl(GetDlgItem(hwnd, IDC_MAILS_FOUND)),
|
_list_ctrl(GetDlgItem(hwnd, IDC_PROGRAMS_FOUND)),
|
||||||
_thread(collect_programs_callback, hwnd, this),
|
_thread(collect_programs_callback, hwnd, this),
|
||||||
_sort(_list_ctrl, CompareFunc/*, (LPARAM)this*/)
|
_sort(_list_ctrl, CompareFunc/*, (LPARAM)this*/)
|
||||||
{
|
{
|
||||||
SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/);
|
SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/);
|
||||||
|
|
||||||
_resize_mgr.Add(IDC_TOPIC, RESIZE_X);
|
_resize_mgr.Add(IDC_FILTER, RESIZE_X);
|
||||||
_resize_mgr.Add(IDC_MAILS_FOUND,RESIZE);
|
_resize_mgr.Add(IDC_CHECK_ENTRIES, MOVE_X);
|
||||||
|
_resize_mgr.Add(IDC_PROGRAMS_FOUND, RESIZE);
|
||||||
|
|
||||||
_resize_mgr.Resize(+520, +300);
|
_resize_mgr.Resize(+520, +300);
|
||||||
|
|
||||||
|
@ -151,7 +152,7 @@ void FindProgramDlg::Refresh(bool delete_cache)
|
||||||
_thread.Stop();
|
_thread.Stop();
|
||||||
|
|
||||||
TCHAR buffer[1024];
|
TCHAR buffer[1024];
|
||||||
GetWindowText(GetDlgItem(_hwnd, IDC_TOPIC), buffer, 1024);
|
GetWindowText(GetDlgItem(_hwnd, IDC_FILTER), buffer, 1024);
|
||||||
#ifndef __WINE__ ///@todo
|
#ifndef __WINE__ ///@todo
|
||||||
_tcslwr(buffer);
|
_tcslwr(buffer);
|
||||||
#endif
|
#endif
|
||||||
|
@ -290,6 +291,10 @@ int FindProgramDlg::Command(int id, int code)
|
||||||
LaunchSelected();
|
LaunchSelected();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDC_CHECK_ENTRIES:
|
||||||
|
CheckEntries();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super::Command(id, code);
|
return super::Command(id, code);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +303,7 @@ int FindProgramDlg::Command(int id, int code)
|
||||||
}
|
}
|
||||||
else if (code == EN_CHANGE) {
|
else if (code == EN_CHANGE) {
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case IDC_TOPIC:
|
case IDC_FILTER:
|
||||||
Refresh();
|
Refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -407,3 +412,8 @@ int CALLBACK FindProgramDlg::CompareFunc(LPARAM lparam1, LPARAM lparam2, LPARAM
|
||||||
|
|
||||||
return sort->_direction? -cmp: cmp;
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ protected:
|
||||||
void Refresh(bool delete_cache=false);
|
void Refresh(bool delete_cache=false);
|
||||||
void add_entry(const FPDEntry& cache_entry);
|
void add_entry(const FPDEntry& cache_entry);
|
||||||
void LaunchSelected();
|
void LaunchSelected();
|
||||||
|
void CheckEntries();
|
||||||
|
|
||||||
static void collect_programs_callback(Entry* entry, void* param);
|
static void collect_programs_callback(Entry* entry, void* param);
|
||||||
static int CALLBACK CompareFunc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort);
|
static int CALLBACK CompareFunc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort);
|
||||||
|
|
|
@ -219,8 +219,8 @@ CAPTION "
|
||||||
FONT 9, "MS UI Gothic", 0, 0, 0x1
|
FONT 9, "MS UI Gothic", 0, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "&Filter:",IDC_STATIC,7,9,18,8
|
LTEXT "&Filter:",IDC_STATIC,7,9,18,8
|
||||||
EDITTEXT IDC_TOPIC,34,7,103,14,ES_AUTOHSCROLL
|
EDITTEXT IDC_FILTER,34,7,103,14,ES_AUTOHSCROLL
|
||||||
CONTROL "List1",IDC_MAILS_FOUND,"SysListView32",LVS_REPORT |
|
CONTROL "List1",IDC_PROGRAMS_FOUND,"SysListView32",LVS_REPORT |
|
||||||
LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER |
|
LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER |
|
||||||
WS_TABSTOP,7,25,130,33
|
WS_TABSTOP,7,25,130,33
|
||||||
END
|
END
|
||||||
|
|
|
@ -282,15 +282,18 @@ HBITMAP Icon::create_bitmap(COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) con
|
||||||
ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
|
ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
|
||||||
SelectBitmap(hdc, hbmp_old);
|
SelectBitmap(hdc, hbmp_old);
|
||||||
DeleteDC(hdc);
|
DeleteDC(hdc);
|
||||||
|
|
||||||
return hbmp;
|
return hbmp;
|
||||||
} else
|
} else
|
||||||
return create_bitmap_from_icon(_hicon, hbrBkgnd, hdc_wnd);
|
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) {
|
if (_itype == IT_SYSCACHE) {
|
||||||
return 0; /*@@todo
|
|
||||||
HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();
|
HIMAGELIST himl = g_Globals._icon_cache.get_sys_imagelist();
|
||||||
|
|
||||||
int cx, cy;
|
int cx, cy;
|
||||||
|
@ -302,9 +305,14 @@ HICON Icon::create_icon(COLORREF bk_color, HDC hdc_wnd) const
|
||||||
ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
|
ImageList_DrawEx(himl, _sys_idx, hdc, 0, 0, cx, cy, bk_color, CLR_DEFAULT, ILD_NORMAL);
|
||||||
SelectBitmap(hdc, hbmp_old);
|
SelectBitmap(hdc, hbmp_old);
|
||||||
DeleteDC(hdc);
|
DeleteDC(hdc);
|
||||||
return hbmp;
|
|
||||||
*/ } else
|
ret = ImageList_Add(himl, hbmp, 0);
|
||||||
return (HICON) CopyImage(_hicon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 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)
|
HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
|
||||||
|
@ -335,17 +343,6 @@ int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HD
|
||||||
return ret;
|
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;
|
int IconCache::s_next_id = ICID_DYNAMIC;
|
||||||
|
|
||||||
|
@ -371,6 +368,7 @@ void IconCache::init()
|
||||||
_icons[ICID_NETWORK] = Icon(ICID_NETWORK, IDI_NETWORK);
|
_icons[ICID_NETWORK] = Icon(ICID_NETWORK, IDI_NETWORK);
|
||||||
_icons[ICID_COMPUTER] = Icon(ICID_COMPUTER, IDI_COMPUTER);
|
_icons[ICID_COMPUTER] = Icon(ICID_COMPUTER, IDI_COMPUTER);
|
||||||
_icons[ICID_LOGOFF] = Icon(ICID_LOGOFF, IDI_LOGOFF);
|
_icons[ICID_LOGOFF] = Icon(ICID_LOGOFF, IDI_LOGOFF);
|
||||||
|
_icons[ICID_BOOKMARK] = Icon(ICID_BOOKMARK, IDI_DOT_TRANS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -424,8 +422,12 @@ const Icon& IconCache::extract(LPCTSTR path, int idx)
|
||||||
_pathIdxMap[key] = icon;
|
_pathIdxMap[key] = icon;
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
} else
|
} else {
|
||||||
|
|
||||||
|
///@todo retreive "http://.../favicon.ico" format icons
|
||||||
|
|
||||||
return _icons[ICID_NONE];
|
return _icons[ICID_NONE];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Icon& IconCache::extract(IExtractIcon* pExtract, LPCTSTR path, int idx)
|
const Icon& IconCache::extract(IExtractIcon* pExtract, LPCTSTR path, int idx)
|
||||||
|
|
|
@ -134,8 +134,8 @@
|
||||||
#define IDC_ICON_ALIGN_10 1012
|
#define IDC_ICON_ALIGN_10 1012
|
||||||
#define IDC_WWW 1012
|
#define IDC_WWW 1012
|
||||||
#define IDC_ICON_ALIGN_11 1013
|
#define IDC_ICON_ALIGN_11 1013
|
||||||
#define IDC_TOPIC 1017
|
#define IDC_FILTER 1017
|
||||||
#define IDC_MAILS_FOUND 1018
|
#define IDC_PROGRAMS_FOUND 1018
|
||||||
#define IDC_PICTURE 1019
|
#define IDC_PICTURE 1019
|
||||||
#define IDC_NOTIFY_SHOW 1020
|
#define IDC_NOTIFY_SHOW 1020
|
||||||
#define IDC_NOTIFY_HIDE 1021
|
#define IDC_NOTIFY_HIDE 1021
|
||||||
|
@ -144,6 +144,8 @@
|
||||||
#define ID_HIDE_INACTIVE_ICONS 1025
|
#define ID_HIDE_INACTIVE_ICONS 1025
|
||||||
#define ID_SHOW_CLOCK 1026
|
#define ID_SHOW_CLOCK 1026
|
||||||
#define ID_DESKTOP_VERSION 1027
|
#define ID_DESKTOP_VERSION 1027
|
||||||
|
#define IDC_BUTTON1 1028
|
||||||
|
#define IDC_CHECK_ENTRIES 1028
|
||||||
#define ID_REFRESH 1704
|
#define ID_REFRESH 1704
|
||||||
#define ID_ABOUT_WINEFILE 1705
|
#define ID_ABOUT_WINEFILE 1705
|
||||||
#define IDC_FILETREE 10001
|
#define IDC_FILETREE 10001
|
||||||
|
@ -195,7 +197,7 @@
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 166
|
#define _APS_NEXT_RESOURCE_VALUE 166
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40019
|
#define _APS_NEXT_COMMAND_VALUE 40019
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1028
|
#define _APS_NEXT_CONTROL_VALUE 1029
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -758,18 +758,19 @@ BEGIN
|
||||||
PUSHBUTTON "&Help",254,158,43,47,14
|
PUSHBUTTON "&Help",254,158,43,47,14
|
||||||
END
|
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 |
|
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||||
WS_SYSMENU | WS_THICKFRAME
|
WS_SYSMENU | WS_THICKFRAME
|
||||||
EXSTYLE WS_EX_APPWINDOW
|
EXSTYLE WS_EX_APPWINDOW
|
||||||
CAPTION "Search Program in Startmenu"
|
CAPTION "Search Program in Startmenu"
|
||||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
FONT 8, "MS Sans Serif"
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "&Filter:",IDC_STATIC,7,9,18,8
|
LTEXT "&Filter:",IDC_STATIC,7,9,18,8
|
||||||
EDITTEXT IDC_TOPIC,34,7,103,14,ES_AUTOHSCROLL
|
EDITTEXT IDC_FILTER,34,7,100,14,ES_AUTOHSCROLL
|
||||||
CONTROL "List1",IDC_MAILS_FOUND,"SysListView32",LVS_REPORT |
|
CONTROL "List1",IDC_PROGRAMS_FOUND,"SysListView32",LVS_REPORT |
|
||||||
LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER |
|
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
|
END
|
||||||
|
|
||||||
IDD_DESKBAR_DESKTOP DIALOG DISCARDABLE 0, 0, 212, 194
|
IDD_DESKBAR_DESKTOP DIALOG DISCARDABLE 0, 0, 212, 194
|
||||||
|
@ -868,7 +869,7 @@ BEGIN
|
||||||
IDD_SEARCH_PROGRAM, DIALOG
|
IDD_SEARCH_PROGRAM, DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
LEFTMARGIN, 7
|
LEFTMARGIN, 7
|
||||||
RIGHTMARGIN, 137
|
RIGHTMARGIN, 193
|
||||||
TOPMARGIN, 7
|
TOPMARGIN, 7
|
||||||
BOTTOMMARGIN, 58
|
BOTTOMMARGIN, 58
|
||||||
END
|
END
|
||||||
|
|
|
@ -80,6 +80,7 @@ enum ICON_ID {
|
||||||
ICID_NETWORK,
|
ICID_NETWORK,
|
||||||
ICID_COMPUTER,
|
ICID_COMPUTER,
|
||||||
ICID_LOGOFF,
|
ICID_LOGOFF,
|
||||||
|
ICID_BOOKMARK,
|
||||||
|
|
||||||
ICID_DYNAMIC
|
ICID_DYNAMIC
|
||||||
};
|
};
|
||||||
|
@ -94,7 +95,7 @@ struct Icon {
|
||||||
|
|
||||||
void draw(HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const;
|
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;
|
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;}
|
int get_sysiml_idx() const {return _itype==IT_SYSCACHE? _sys_idx: -1;}
|
||||||
|
|
||||||
|
@ -152,9 +153,6 @@ extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc
|
||||||
/// add icon with alpha channel to imagelist using the specified background color
|
/// 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);
|
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
|
/// retrieve icon from window
|
||||||
extern HICON get_window_icon_small(HWND hwnd);
|
extern HICON get_window_icon_small(HWND hwnd);
|
||||||
extern HICON get_window_icon_big(HWND hwnd, bool allow_from_class=true);
|
extern HICON get_window_icon_big(HWND hwnd, bool allow_from_class=true);
|
||||||
|
|
|
@ -777,7 +777,7 @@ int MainFrame::Notify(int id, NMHDR* pnmh)
|
||||||
// display tooltips for bookmark folders
|
// display tooltips for bookmark folders
|
||||||
if (!node._pfolder->_description.empty())
|
if (!node._pfolder->_description.empty())
|
||||||
lstrcpyn(pnmgit->pszText, node._pfolder->_description.c_str(), pnmgit->cchTextMax);
|
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
|
// display tooltips for bookmark folders
|
||||||
String txt = node._pbookmark->_description;
|
String txt = node._pbookmark->_description;
|
||||||
|
|
||||||
|
@ -1050,19 +1050,15 @@ void MainFrame::FillBookmarks()
|
||||||
|
|
||||||
TreeView_DeleteAllItems(_hsidebar);
|
TreeView_DeleteAllItems(_hsidebar);
|
||||||
|
|
||||||
|
COLORREF bk_color = RGB(255,255,255);
|
||||||
HBRUSH hbr_bkgnd = GetStockBrush(WHITE_BRUSH);
|
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);
|
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, SmallIcon(IDI_DOT), hbr_bkgnd, canvas);
|
||||||
ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_FOLDER), hbr_bkgnd, canvas);
|
g_Globals._icon_cache.get_icon(ICID_FOLDER).add_to_imagelist(_himl, canvas);
|
||||||
ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_FOLDER), hbr_bkgnd, canvas);
|
g_Globals._icon_cache.get_icon(ICID_FOLDER).add_to_imagelist(_himl, 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;
|
TV_INSERTSTRUCT tvi;
|
||||||
|
|
||||||
tvi.hParent = TVI_ROOT;
|
tvi.hParent = TVI_ROOT;
|
||||||
|
|
|
@ -106,7 +106,7 @@ bool Bookmark::read(const_XMLPos& pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// write XBEL bookmark node
|
/// write XBEL bookmark node
|
||||||
void Bookmark::write(XMLPos& pos)
|
void Bookmark::write(XMLPos& pos) const
|
||||||
{
|
{
|
||||||
pos.create("bookmark");
|
pos.create("bookmark");
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void BookmarkFolder::read(const_XMLPos& pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// write bookmark folder conten from XBEL formated XML tree
|
/// write bookmark folder conten from XBEL formated XML tree
|
||||||
void BookmarkFolder::write(XMLPos& pos)
|
void BookmarkFolder::write(XMLPos& pos) const
|
||||||
{
|
{
|
||||||
pos.create("folder");
|
pos.create("folder");
|
||||||
|
|
||||||
|
@ -177,6 +177,12 @@ void BookmarkFolder::write(XMLPos& pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BookmarkNode::BookmarkNode()
|
||||||
|
: _type(BMNT_NONE)
|
||||||
|
{
|
||||||
|
_pbookmark = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
BookmarkNode::BookmarkNode(const Bookmark& bm)
|
BookmarkNode::BookmarkNode(const Bookmark& bm)
|
||||||
: _type(BMNT_BOOKMARK)
|
: _type(BMNT_BOOKMARK)
|
||||||
{
|
{
|
||||||
|
@ -192,20 +198,68 @@ BookmarkNode::BookmarkNode(const BookmarkFolder& bmf)
|
||||||
BookmarkNode::BookmarkNode(const BookmarkNode& other)
|
BookmarkNode::BookmarkNode(const BookmarkNode& other)
|
||||||
: _type(other._type)
|
: _type(other._type)
|
||||||
{
|
{
|
||||||
if (_type == BMNT_BOOKMARK)
|
if (other._type == BMNT_BOOKMARK)
|
||||||
_pbookmark = new Bookmark(*other._pbookmark);
|
_pbookmark = new Bookmark(*other._pbookmark);
|
||||||
else
|
else if (other._type == BMNT_FOLDER)
|
||||||
_pfolder = new BookmarkFolder(*other._pfolder);
|
_pfolder = new BookmarkFolder(*other._pfolder);
|
||||||
|
else
|
||||||
|
_pbookmark = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkNode::~BookmarkNode()
|
BookmarkNode::~BookmarkNode()
|
||||||
{
|
{
|
||||||
if (_type == BMNT_BOOKMARK)
|
if (_type == BMNT_BOOKMARK)
|
||||||
delete _pbookmark;
|
delete _pbookmark;
|
||||||
else
|
else if (_type == BMNT_FOLDER)
|
||||||
delete _pfolder;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// read bookmark list from XBEL formated XML tree
|
/// read bookmark list from XBEL formated XML tree
|
||||||
void BookmarkList::read(const_XMLPos& pos)
|
void BookmarkList::read(const_XMLPos& pos)
|
||||||
|
@ -238,13 +292,13 @@ void BookmarkList::write(XMLPos& pos) const
|
||||||
const BookmarkNode& node = *it;
|
const BookmarkNode& node = *it;
|
||||||
|
|
||||||
if (node._type == BookmarkNode::BMNT_FOLDER) {
|
if (node._type == BookmarkNode::BMNT_FOLDER) {
|
||||||
BookmarkFolder& folder = *node._pfolder;
|
const BookmarkFolder& folder = *node._pfolder;
|
||||||
|
|
||||||
folder.write(pos);
|
folder.write(pos);
|
||||||
|
|
||||||
pos.back();
|
pos.back();
|
||||||
} else { // BookmarkNode::BMNT_BOOKMARK
|
} else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
|
||||||
Bookmark& bookmark = *node._pbookmark;
|
const Bookmark& bookmark = *node._pbookmark;
|
||||||
|
|
||||||
if (!bookmark._url.empty())
|
if (!bookmark._url.empty())
|
||||||
bookmark.write(pos);
|
bookmark.write(pos);
|
||||||
|
@ -278,7 +332,7 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST himagelist,
|
||||||
HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
|
HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
|
||||||
|
|
||||||
folder._bookmarks.fill_tree(hwnd, hitem, himagelist, hdc_wnd);
|
folder._bookmarks.fill_tree(hwnd, hitem, himagelist, hdc_wnd);
|
||||||
} else {
|
} else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
|
||||||
const Bookmark& bookmark = *node._pbookmark;
|
const Bookmark& bookmark = *node._pbookmark;
|
||||||
|
|
||||||
tv.pszText = (LPTSTR)bookmark._name.c_str();
|
tv.pszText = (LPTSTR)bookmark._name.c_str();
|
||||||
|
@ -286,11 +340,10 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST himagelist,
|
||||||
tv.iSelectedImage = 2; // selected bookmark
|
tv.iSelectedImage = 2; // selected bookmark
|
||||||
|
|
||||||
if (!bookmark._icon_path.empty()) {
|
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);
|
const Icon& icon = g_Globals._icon_cache.extract(bookmark._icon_path, bookmark._icon_idx);
|
||||||
|
|
||||||
if ((ICON_ID)icon != ICID_NONE)
|
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);
|
TreeView_InsertItem(hwnd, &tvi);
|
||||||
|
|
|
@ -38,26 +38,34 @@ struct Bookmark
|
||||||
|
|
||||||
bool read_url(LPCTSTR path);
|
bool read_url(LPCTSTR path);
|
||||||
bool read(const_XMLPos& pos);
|
bool read(const_XMLPos& pos);
|
||||||
void write(XMLPos& pos);
|
void write(XMLPos& pos) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BookmarkFolder;
|
struct BookmarkFolder;
|
||||||
|
|
||||||
struct BookmarkNode
|
struct BookmarkNode
|
||||||
{
|
{
|
||||||
|
BookmarkNode();
|
||||||
BookmarkNode(const Bookmark& bm);
|
BookmarkNode(const Bookmark& bm);
|
||||||
BookmarkNode(const BookmarkFolder& bmf);
|
BookmarkNode(const BookmarkFolder& bmf);
|
||||||
BookmarkNode(const BookmarkNode& other);
|
BookmarkNode(const BookmarkNode& other);
|
||||||
|
|
||||||
~BookmarkNode();
|
~BookmarkNode();
|
||||||
|
|
||||||
|
BookmarkNode& operator=(const Bookmark& bm);
|
||||||
|
BookmarkNode& operator=(const BookmarkFolder& bmf);
|
||||||
|
BookmarkNode& operator=(const BookmarkNode& other);
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
enum BOOKMARKNODE_TYPE {
|
enum BOOKMARKNODE_TYPE {
|
||||||
BMNT_BOOKMARK, BMNT_FOLDER
|
BMNT_NONE, BMNT_BOOKMARK, BMNT_FOLDER
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOKMARKNODE_TYPE _type;
|
BOOKMARKNODE_TYPE _type;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
Bookmark* _pbookmark;
|
Bookmark* _pbookmark;
|
||||||
BookmarkFolder* _pfolder;
|
BookmarkFolder* _pfolder;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -79,7 +87,7 @@ struct BookmarkFolder
|
||||||
BookmarkList _bookmarks;
|
BookmarkList _bookmarks;
|
||||||
|
|
||||||
void read(const_XMLPos& pos);
|
void read(const_XMLPos& pos);
|
||||||
void write(XMLPos& pos);
|
void write(XMLPos& pos) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Favorites : public BookmarkList
|
struct Favorites : public BookmarkList
|
||||||
|
|
|
@ -95,7 +95,7 @@ BtnWindowClass& StartMenu::GetWndClasss()
|
||||||
|
|
||||||
Window::CREATORFUNC_INFO StartMenu::s_def_creator = STARTMENU_CREATOR(StartMenu);
|
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;
|
UINT style, ex_style;
|
||||||
int top_height;
|
int top_height;
|
||||||
|
@ -123,6 +123,7 @@ HWND StartMenu::Create(int x, int y, const StartMenuFolders& folders, HWND hwndP
|
||||||
create_info._folders = folders;
|
create_info._folders = folders;
|
||||||
create_info._border_top = top_height;
|
create_info._border_top = top_height;
|
||||||
create_info._creator = creator;
|
create_info._creator = creator;
|
||||||
|
create_info._info = info;
|
||||||
|
|
||||||
if (title)
|
if (title)
|
||||||
create_info._title = title;
|
create_info._title = title;
|
||||||
|
@ -862,7 +863,7 @@ int StartMenu::Command(int id, int code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
// search for an already existing subdirectory entry with the same name
|
||||||
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
|
@ -874,32 +875,35 @@ StartMenuEntry& StartMenu::AddEntry(const String& title, ICON_ID icon_id, Entry*
|
||||||
if ((*it2)->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
if ((*it2)->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
// merge the new shell entry with the existing of the same name
|
// merge the new shell entry with the existing of the same name
|
||||||
sme._entries.insert(entry);
|
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;
|
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)
|
if (id == -1)
|
||||||
id = ++_next_id;
|
id = ++_next_id;
|
||||||
|
|
||||||
StartMenuEntry& sme = _entries[id];
|
StartMenuEntry sme;
|
||||||
|
|
||||||
sme._title = title;
|
sme._title = title;
|
||||||
sme._icon_id = icon_id;
|
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;
|
ICON_ID icon_id;
|
||||||
|
|
||||||
|
@ -911,7 +915,7 @@ StartMenuEntry& StartMenu::AddEntry(const ShellFolder folder, ShellEntry* entry)
|
||||||
return AddEntry(folder.get_name(entry->_pidl), icon_id, entry);
|
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;
|
ICON_ID icon_id;
|
||||||
|
|
||||||
|
@ -1004,12 +1008,12 @@ bool StartMenu::CloseOtherSubmenus(int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 {
|
try {
|
||||||
SpecialFolderPath folder(folder_id, _hwnd);
|
SpecialFolderPath folder(folder_id, _hwnd);
|
||||||
|
@ -1017,7 +1021,7 @@ bool StartMenu::CreateSubmenu(int id, int folder_id, LPCTSTR title, CREATORFUNC_
|
||||||
StartMenuFolders new_folders;
|
StartMenuFolders new_folders;
|
||||||
new_folders.push_back(folder);
|
new_folders.push_back(folder);
|
||||||
|
|
||||||
CreateSubmenu(id, new_folders, title, creator);
|
CreateSubmenu(id, new_folders, title, creator, info);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch(COMException&) {
|
} catch(COMException&) {
|
||||||
|
@ -1028,7 +1032,7 @@ bool StartMenu::CreateSubmenu(int id, int folder_id, LPCTSTR title, CREATORFUNC_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
StartMenuFolders new_folders;
|
||||||
|
|
||||||
|
@ -1043,7 +1047,7 @@ bool StartMenu::CreateSubmenu(int id, int folder_id1, int folder_id2, LPCTSTR ti
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new_folders.empty()) {
|
if (!new_folders.empty()) {
|
||||||
CreateSubmenu(id, new_folders, title, creator);
|
CreateSubmenu(id, new_folders, title, creator, info);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
CloseOtherSubmenus(id);
|
CloseOtherSubmenus(id);
|
||||||
|
@ -1052,7 +1056,7 @@ bool StartMenu::CreateSubmenu(int id, int folder_id1, int folder_id2, LPCTSTR ti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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.
|
// Only open one submenu at a time.
|
||||||
if (!CloseOtherSubmenus(id))
|
if (!CloseOtherSubmenus(id))
|
||||||
|
@ -1074,7 +1078,7 @@ void StartMenu::CreateSubmenu(int id, const StartMenuFolders& new_folders, LPCTS
|
||||||
}
|
}
|
||||||
|
|
||||||
_submenu_id = id;
|
_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 @@ void StartMenu::ActivateEntry(int id, const ShellEntrySet& entries)
|
||||||
HWND hparent = GetParent(_hwnd);
|
HWND hparent = GetParent(_hwnd);
|
||||||
ShellPath shell_path = entry->create_absolute_pidl();
|
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);
|
CloseStartMenu(id);
|
||||||
|
|
||||||
///@todo launch in the background; specify correct HWND for error message box titles
|
///@todo launch in the background; specify correct HWND for error message box titles
|
||||||
|
@ -1616,7 +1620,11 @@ int StartMenuHandler::Command(int id, int code)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_FAVORITES:
|
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));
|
CreateSubmenu(id, CSIDL_COMMON_FAVORITES, CSIDL_FAVORITES, ResString(IDS_FAVORITES));
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_BROWSE:
|
case IDC_BROWSE:
|
||||||
|
@ -1805,13 +1813,13 @@ void SettingsMenu::AddEntries()
|
||||||
AddButton(ResString(IDS_CONTROL_PANEL), ICID_CONFIG, false, IDC_CONTROL_PANEL);
|
AddButton(ResString(IDS_CONTROL_PANEL), ICID_CONFIG, false, IDC_CONTROL_PANEL);
|
||||||
|
|
||||||
#ifdef _ROS_ // to be removed when printer/network will be implemented
|
#ifdef _ROS_ // to be removed when printer/network will be implemented
|
||||||
AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, false, IDC_PRINTERS);
|
AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, false, IDC_PRINTERS);
|
||||||
AddButton(ResString(IDS_CONNECTIONS), ICID_NETWORK, false, IDC_CONNECTIONS);
|
AddButton(ResString(IDS_CONNECTIONS), ICID_NETWORK, false, IDC_CONNECTIONS);
|
||||||
#else
|
#else
|
||||||
AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, true, IDC_PRINTERS);
|
AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, true, IDC_PRINTERS);
|
||||||
AddButton(ResString(IDS_CONNECTIONS), ICID_NETWORK, true, IDC_CONNECTIONS);
|
AddButton(ResString(IDS_CONNECTIONS), ICID_NETWORK, true, IDC_CONNECTIONS);
|
||||||
#endif
|
#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)
|
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
|
||||||
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
|
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
|
||||||
|
@ -1829,26 +1837,26 @@ void BrowseMenu::AddEntries()
|
||||||
if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD)) // or REST_NOENTIRENETWORK ?
|
if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD)) // or REST_NOENTIRENETWORK ?
|
||||||
#endif
|
#endif
|
||||||
#ifdef _ROS_ // to be removed when printer/network will be implemented
|
#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
|
#else
|
||||||
AddButton(ResString(IDS_NETWORK), ICID_NETWORK, true, IDC_NETWORK);
|
AddButton(ResString(IDS_NETWORK), ICID_NETWORK, true, IDC_NETWORK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AddButton(ResString(IDS_DRIVES), ICID_FOLDER, true, IDC_DRIVES);
|
AddButton(ResString(IDS_DRIVES), ICID_FOLDER, true, IDC_DRIVES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchMenu::AddEntries()
|
void SearchMenu::AddEntries()
|
||||||
{
|
{
|
||||||
super::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)
|
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
|
||||||
if (!g_Globals._SHRestricted || !SHRestricted(REST_HASFINDCOMPUTERS))
|
if (!g_Globals._SHRestricted || !SHRestricted(REST_HASFINDCOMPUTERS))
|
||||||
#endif
|
#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 @@ void RecentStartMenu::AddEntries()
|
||||||
AddShellEntries(dir, RECENT_DOCS_COUNT, smd._subfolders);
|
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
|
||||||
|
|
|
@ -138,7 +138,7 @@ struct StartMenuSeparator : public Static
|
||||||
|
|
||||||
typedef list<ShellPath> StartMenuFolders;
|
typedef list<ShellPath> StartMenuFolders;
|
||||||
|
|
||||||
/// structor containing information for creating start menus
|
/// structor containing information for creating of start menus
|
||||||
struct StartMenuCreateInfo
|
struct StartMenuCreateInfo
|
||||||
{
|
{
|
||||||
StartMenuCreateInfo() : _border_top(0) {}
|
StartMenuCreateInfo() : _border_top(0) {}
|
||||||
|
@ -147,6 +147,7 @@ struct StartMenuCreateInfo
|
||||||
int _border_top;
|
int _border_top;
|
||||||
String _title;
|
String _title;
|
||||||
Window::CREATORFUNC_INFO _creator;
|
Window::CREATORFUNC_INFO _creator;
|
||||||
|
void* _info;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STARTMENU_CREATOR(WND_CLASS) WINDOW_CREATOR_INFO(WND_CLASS, StartMenuCreateInfo)
|
#define STARTMENU_CREATOR(WND_CLASS) WINDOW_CREATOR_INFO(WND_CLASS, StartMenuCreateInfo)
|
||||||
|
@ -216,7 +217,8 @@ struct StartMenu :
|
||||||
StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info);
|
StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info);
|
||||||
~StartMenu();
|
~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;
|
static CREATORFUNC_INFO s_def_creator;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -266,10 +268,10 @@ protected:
|
||||||
|
|
||||||
virtual void AddEntries();
|
virtual void AddEntries();
|
||||||
|
|
||||||
StartMenuEntry& AddEntry(const String& title, ICON_ID icon_id, Entry* entry);
|
ShellEntryMap::iterator AddEntry(const String& title, ICON_ID icon_id, Entry* entry);
|
||||||
StartMenuEntry& AddEntry(const String& title, ICON_ID icon_id=ICID_NONE, int id=-1);
|
ShellEntryMap::iterator AddEntry(const String& title, ICON_ID icon_id=ICID_NONE, int id=-1);
|
||||||
StartMenuEntry& AddEntry(const ShellFolder folder, ShellEntry* entry);
|
ShellEntryMap::iterator AddEntry(const ShellFolder folder, ShellEntry* entry);
|
||||||
StartMenuEntry& AddEntry(const ShellFolder folder, Entry* entry);
|
ShellEntryMap::iterator AddEntry(const ShellFolder folder, Entry* entry);
|
||||||
|
|
||||||
void AddShellEntries(const ShellDirectory& dir, int max=-1, bool subfolders=true);
|
void AddShellEntries(const ShellDirectory& dir, int max=-1, bool subfolders=true);
|
||||||
|
|
||||||
|
@ -278,10 +280,10 @@ protected:
|
||||||
|
|
||||||
bool CloseSubmenus() {return CloseOtherSubmenus();}
|
bool CloseSubmenus() {return CloseOtherSubmenus();}
|
||||||
bool CloseOtherSubmenus(int id=0);
|
bool CloseOtherSubmenus(int id=0);
|
||||||
void CreateSubmenu(int id, 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);
|
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);
|
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 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);
|
void ActivateEntry(int id, const ShellEntrySet& entries);
|
||||||
virtual void CloseStartMenu(int id=0);
|
virtual void CloseStartMenu(int id=0);
|
||||||
|
|
||||||
|
@ -357,10 +359,11 @@ protected:
|
||||||
|
|
||||||
SIZE _logo_size;
|
SIZE _logo_size;
|
||||||
|
|
||||||
void AddEntries();
|
virtual void AddEntries();
|
||||||
|
virtual void ProcessKey(int vk);
|
||||||
|
|
||||||
void Paint(PaintCanvas& canvas);
|
void Paint(PaintCanvas& canvas);
|
||||||
void CloseStartMenu(int id=0);
|
void CloseStartMenu(int id=0);
|
||||||
virtual void ProcessKey(int vk);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -375,7 +378,7 @@ struct SettingsMenu : public StartMenuHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddEntries();
|
virtual void AddEntries();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -390,7 +393,7 @@ struct BrowseMenu : public StartMenuHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddEntries();
|
virtual void AddEntries();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -405,7 +408,7 @@ struct SearchMenu : public StartMenuHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddEntries();
|
virtual void AddEntries();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -424,3 +427,29 @@ struct RecentStartMenu : public StartMenu
|
||||||
protected:
|
protected:
|
||||||
virtual void AddEntries();
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue