display notification icon change times

svn path=/trunk/; revision=11721
This commit is contained in:
Martin Fuchs 2004-11-20 19:30:41 +00:00
parent ba5522cda3
commit a4efd45e84
8 changed files with 92 additions and 40 deletions

View file

@ -89,3 +89,4 @@ If you search for more information, look into the CVS repository.
15.09.2004 m. fuchs remove direct version output from desktop; instead store the activation flag into the registry
17.09.2004 m. fuchs handle "." and ".." as special direcory names and move them at the very first beginning of directory listings
23.09.2004 m. fuchs configuration dialog to choose between MDI and SDI mode with persistent storage
20.11.2004 m. fuchs display notification icon change times

View file

@ -438,7 +438,7 @@ const Icon& IconCache::extract(IExtractIcon* pExtract, LPCTSTR path, int idx)
HRESULT hr = pExtract->Extract(path, idx, &hIconLarge, &hIcon, MAKELONG(0/*GetSystemMetrics(SM_CXICON)*/,GetSystemMetrics(SM_CXSMICON)));
if (hr == NOERROR) {
if (hr == NOERROR) { //@@ oder SUCCEEDED(hr) ?
if (hIconLarge)
DestroyIcon(hIconLarge);

View file

@ -137,7 +137,9 @@
#define IDC_LABEL3 1011
#define IDC_ICON_ALIGN_10 1012
#define IDC_WWW 1012
#define IDC_LABEL6 1012
#define IDC_ICON_ALIGN_11 1013
#define IDC_LAST_CHANGE 1013
#define IDC_FILTER 1017
#define IDC_PROGRAMS_FOUND 1018
#define IDC_PICTURE 1019
@ -191,6 +193,7 @@
#define ID_VIEW_MDI 40019
#define ID_VIEW_SDI 40020
#define ID_TOOLS_OPTIONS 40021
#define ID_SHOW_ICON_BUTTON 40023
#define ID_SWITCH_DESKTOP_1 50000
#define ID_WINDOW_NEW 0xE130
#define ID_WINDOW_ARRANGE 0xE131
@ -209,7 +212,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 166
#define _APS_NEXT_COMMAND_VALUE 40022
#define _APS_NEXT_COMMAND_VALUE 40024
#define _APS_NEXT_CONTROL_VALUE 1033
#define _APS_NEXT_SYMED_VALUE 101
#endif

View file

@ -821,6 +821,7 @@ BEGIN
POPUP ""
BEGIN
MENUITEM "&Show hidden icons", ID_SHOW_HIDDEN_ICONS
MENUITEM "Show Icon &Button", ID_SHOW_ICON_BUTTON
MENUITEM "&Configure Notifications...", ID_CONFIG_NOTIFYAREA
MENUITEM "Adjust Date/&Time...", ID_CONFIG_TIME
MENUITEM SEPARATOR
@ -948,33 +949,36 @@ FONT 8, "MS Sans Serif"
BEGIN
END
IDD_NOTIFYAREA DIALOGEX 0, 0, 207, 150
IDD_NOTIFYAREA DIALOGEX 0, 0, 208, 174
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "Configure Notification Icons"
FONT 8, "MS Sans Serif", 0, 0, 0x1
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES |
TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,193,31
TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31
LTEXT "&Tooltip Text:",IDC_LABEL1,7,44,40,8
EDITTEXT IDC_NOTIFY_TOOLTIP,55,42,145,14,ES_AUTOHSCROLL
EDITTEXT IDC_NOTIFY_TOOLTIP,58,42,143,14,ES_AUTOHSCROLL
LTEXT "W&indow Title:",IDC_LABEL2,7,63,44,8
EDITTEXT IDC_NOTIFY_TITLE,55,60,145,14,ES_AUTOHSCROLL
EDITTEXT IDC_NOTIFY_TITLE,58,60,143,14,ES_AUTOHSCROLL
LTEXT "&Module Path:",IDC_LABEL3,7,81,43,8
EDITTEXT IDC_NOTIFY_MODULE,55,78,145,14,ES_AUTOHSCROLL
GROUPBOX "&Display Mode",IDC_LABEL4,7,95,157,28
EDITTEXT IDC_NOTIFY_MODULE,58,78,143,14,ES_AUTOHSCROLL
GROUPBOX "&Display Mode",IDC_LABEL4,7,96,157,28
CONTROL "&show",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON |
WS_TABSTOP,15,107,33,10
WS_TABSTOP,15,108,33,10
CONTROL "&hide",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66,
107,29,10
108,29,10
CONTROL "a&utohide",IDC_NOTIFY_AUTOHIDE,"Button",
BS_AUTORADIOBUTTON,112,107,43,10
ICON "",IDC_PICTURE,173,100,20,20
BS_AUTORADIOBUTTON,112,108,43,10
ICON "",IDC_PICTURE,173,101,21,20
LTEXT "&Last Change:",IDC_LABEL6,7,132,43,8
EDITTEXT IDC_LAST_CHANGE,59,129,105,14,ES_AUTOHSCROLL |
ES_READONLY
CONTROL "sho&w hidden",ID_SHOW_HIDDEN_ICONS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,131,56,10
DEFPUSHBUTTON "&OK",IDOK,91,129,50,14,WS_GROUP
PUSHBUTTON "&Cancel",IDCANCEL,150,129,50,14
BS_AUTOCHECKBOX | WS_TABSTOP,7,154,56,10
DEFPUSHBUTTON "&OK",IDOK,91,153,50,14,WS_GROUP
PUSHBUTTON "&Cancel",IDCANCEL,151,153,50,14
END
IDD_MDI_SDI DIALOGEX 0, 0, 188, 126
@ -1039,9 +1043,9 @@ BEGIN
IDD_NOTIFYAREA, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 200
RIGHTMARGIN, 201
TOPMARGIN, 7
BOTTOMMARGIN, 143
BOTTOMMARGIN, 167
END
IDD_MDI_SDI, DIALOG
@ -1304,6 +1308,7 @@ BEGIN
POPUP ""
BEGIN
MENUITEM "&Mostrar iconos ocultos", ID_SHOW_HIDDEN_ICONS
MENUITEM "Show Icon &Button", ID_SHOW_ICON_BUTTON
MENUITEM "&Configurar Notificaciones...", ID_CONFIG_NOTIFYAREA
MENUITEM "Ajustar Fecha/&Hora...", ID_CONFIG_TIME
MENUITEM SEPARATOR
@ -1431,33 +1436,36 @@ FONT 8, "MS Sans Serif"
BEGIN
END
IDD_NOTIFYAREA DIALOGEX 0, 0, 207, 150
IDD_NOTIFYAREA DIALOGEX 0, 0, 208, 174
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "Configure Notification Icons"
FONT 8, "MS Sans Serif", 0, 0, 0x1
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES |
TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,193,31
LTEXT "&Texto de Info de herramientas:",IDC_LABEL1,7,44,40,8
EDITTEXT IDC_NOTIFY_TOOLTIP,55,42,145,14,ES_AUTOHSCROLL
LTEXT "Titulo de la V&entana:",IDC_LABEL2,7,63,44,8
EDITTEXT IDC_NOTIFY_TITLE,55,60,145,14,ES_AUTOHSCROLL
LTEXT "Parche del &Modulo:",IDC_LABEL3,7,81,43,8
EDITTEXT IDC_NOTIFY_MODULE,55,78,145,14,ES_AUTOHSCROLL
TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31
LTEXT "&Texto de Info:",IDC_LABEL1,7,44,45,8
EDITTEXT IDC_NOTIFY_TOOLTIP,84,42,117,14,ES_AUTOHSCROLL
LTEXT "Titulo de la V&entana:",IDC_LABEL2,7,63,66,8
EDITTEXT IDC_NOTIFY_TITLE,84,60,117,14,ES_AUTOHSCROLL
LTEXT "&Parche del Modulo:",IDC_LABEL3,7,81,62,8
EDITTEXT IDC_NOTIFY_MODULE,84,78,117,14,ES_AUTOHSCROLL
GROUPBOX "Modo de &Display",IDC_LABEL4,7,95,157,28
CONTROL "&Mostrar",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON |
WS_TABSTOP,15,107,33,10
CONTROL "&Ocultar",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,
66,107,29,10
63,107,29,10
CONTROL "A&utoocultar",IDC_NOTIFY_AUTOHIDE,"Button",
BS_AUTORADIOBUTTON,112,107,43,10
BS_AUTORADIOBUTTON,104,107,51,10
ICON "",IDC_PICTURE,173,100,20,20
CONTROL "Mostrar Ocultos",ID_SHOW_HIDDEN_ICONS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,131,56,10
DEFPUSHBUTTON "&Aceptar",IDOK,91,129,50,14,WS_GROUP
PUSHBUTTON "&Cancelar",IDCANCEL,150,129,50,14
LTEXT "&Last Change:",IDC_LABEL6,7,132,43,8
EDITTEXT IDC_LAST_CHANGE,59,129,105,14,ES_AUTOHSCROLL |
ES_READONLY
CONTROL "Mostrar Ocu&ltos",ID_SHOW_HIDDEN_ICONS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,153,65,10
DEFPUSHBUTTON "&Aceptar",IDOK,91,153,50,14,WS_GROUP
PUSHBUTTON "&Cancelar",IDCANCEL,151,153,50,14
END
@ -1504,9 +1512,9 @@ BEGIN
IDD_NOTIFYAREA, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 200
RIGHTMARGIN, 201
TOPMARGIN, 7
BOTTOMMARGIN, 143
BOTTOMMARGIN, 167
END
END
#endif // APSTUDIO_INVOKED

View file

@ -540,19 +540,23 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
if (visible_cols & COL_INDEX) {
_stprintf(buffer, TEXT("%") LONGLONGARG TEXT("X"), index);
if (calcWidthCol == -1)
_out_wrkr.output_text(dis, _positions, col, buffer, DT_RIGHT);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(dis, col, buffer);
++col;
}
if (visible_cols & COL_LINKS) {
wsprintf(buffer, TEXT("%d"), entry->_bhfi.nNumberOfLinks);
if (calcWidthCol == -1)
_out_wrkr.output_text(dis, _positions, col, buffer, DT_RIGHT);
else if (calcWidthCol==col || calcWidthCol==COLUMNS)
calc_width(dis, col, buffer);
++col;
}
} else

View file

@ -175,6 +175,7 @@ NotifyArea::NotifyArea(HWND hwnd)
_last_icon_count = 0;
_show_hidden = false;
_hide_inactive = true;
_show_button = true;
}
NotifyArea::~NotifyArea()
@ -379,6 +380,7 @@ LRESULT NotifyArea::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
PopupMenu menu(IDM_NOTIFYAREA);
SetMenuDefaultItem(menu, 0, MF_BYPOSITION);
CheckMenuItem(menu, ID_SHOW_HIDDEN_ICONS, MF_BYCOMMAND|(_show_hidden?MF_CHECKED:MF_UNCHECKED));
CheckMenuItem(menu, ID_SHOW_ICON_BUTTON, MF_BYCOMMAND|(_show_button?MF_CHECKED:MF_UNCHECKED));
menu.TrackPopupMenu(_hwnd, MAKEPOINTS(lparam));
}
break;}
@ -461,6 +463,11 @@ int NotifyArea::Command(int id, int code)
UpdateIcons();
break;
case ID_SHOW_ICON_BUTTON:
_show_button = !_show_button;
UpdateIcons();
break;
case ID_CONFIG_NOTIFYAREA:
Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), GetParent(_hwnd));
break;
@ -804,6 +811,9 @@ TrayNotifyDlg::TrayNotifyDlg(HWND hwnd)
_resize_mgr.Add(IDC_PICTURE, MOVE);
_resize_mgr.Add(ID_SHOW_HIDDEN_ICONS,MOVE_Y);
_resize_mgr.Add(IDC_LABEL6, MOVE_Y);
_resize_mgr.Add(IDC_LAST_CHANGE, MOVE_Y);
_resize_mgr.Add(IDOK, MOVE);
_resize_mgr.Add(IDCANCEL, MOVE);
@ -861,6 +871,8 @@ void TrayNotifyDlg::Refresh()
_hitemCurrent_hidden = TreeView_InsertItem(_tree_ctrl, &tvi);
if (_pNotifyArea) {
_info.clear();
tv.mask |= TVIF_PARAM;
WindowCanvas canvas(_hwnd);
@ -913,9 +925,12 @@ void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyI
InsertItem(hparent, after, entry, hdc, entry._hIcon, entry._mode);
}
void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyIconConfig& entry,
void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyIconDlgInfo& entry,
HDC hdc, HICON hicon, NOTIFYICONMODE mode)
{
int idx = _info.size();
_info[idx] = entry;
String mode_str = string_from_mode(mode);
switch(mode) {
@ -934,7 +949,7 @@ void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyI
TV_ITEM& tv = tvi.item;
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tv.lParam = (LPARAM)&entry;
tv.lParam = (LPARAM)idx;
tv.pszText = (LPTSTR)txt.c_str();
tv.iSelectedImage = tv.iImage = ImageList_AddAlphaIcon(_himl, hicon, GetStockBrush(WHITE_BRUSH), hdc);
TreeView_InsertItem(_tree_ctrl, &tvi);
@ -1026,7 +1041,7 @@ int TrayNotifyDlg::Notify(int id, NMHDR* pnmh)
LPARAM lparam = pnmtv->itemNew.lParam;
if (lparam) {
const NotifyIconConfig& entry = *(NotifyIconConfig*)lparam;
const NotifyIconDlgInfo& entry = _info[lparam];
SetDlgItemText(_hwnd, IDC_NOTIFY_TOOLTIP, entry._tipText);
SetDlgItemText(_hwnd, IDC_NOTIFY_TITLE, entry._windowTitle);
@ -1034,6 +1049,11 @@ int TrayNotifyDlg::Notify(int id, NMHDR* pnmh)
CheckRadioButton(_hwnd, IDC_NOTIFY_SHOW, IDC_NOTIFY_AUTOHIDE, IDC_NOTIFY_SHOW+entry._mode);
String change_str;
if (entry._lastChange)
change_str.printf(TEXT("before %d s"), (GetTickCount()-entry._lastChange+500)/1000);
SetDlgItemText(_hwnd, IDC_LAST_CHANGE, change_str);
HICON hicon = 0; //get_window_icon_big(entry._hWnd, false);
// If we could not find an icon associated with the owner window, try to load one from the owning module.

View file

@ -144,6 +144,7 @@ protected:
bool _show_hidden;
bool _hide_inactive;
bool _show_button;
LRESULT Init(LPCREATESTRUCT pcs);
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
@ -176,6 +177,20 @@ protected:
};
struct NotifyIconDlgInfo : public NotifyIconConfig
{
typedef NotifyIconConfig super;
NotifyIconDlgInfo(const NotifyInfo& info) : super(info), _lastChange(info._lastChange) {}
NotifyIconDlgInfo(const NotifyIconConfig& cfg) : super(cfg), _lastChange(0) {}
NotifyIconDlgInfo() : _lastChange(0) {}
DWORD _lastChange;
};
typedef map<int, NotifyIconDlgInfo> NotifyIconDlgInfoMap;
/// configuration dialog for notification icons
struct TrayNotifyDlg : public ResizeController<Dialog>
{
@ -189,6 +204,7 @@ protected:
HACCEL _haccel;
HIMAGELIST _himl;
NotifyArea* _pNotifyArea;
NotifyIconDlgInfoMap _info;
typedef pair<NOTIFYICONMODE, DWORD> IconStatePair;
typedef map<NotifyIconIndex, IconStatePair> IconStateMap;
@ -209,7 +225,7 @@ protected:
void Refresh();
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo&, HDC);
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyIconConfig&, HDC, HICON, NOTIFYICONMODE);
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyIconDlgInfo&, HDC, HICON, NOTIFYICONMODE);
void SetIconMode(NOTIFYICONMODE mode);
};

View file

@ -1018,7 +1018,7 @@ protected:
#define CONTEXT_OBJ __ctx__._obj
#define CONTEXT(c) Context __ctx__(c)
#define CURRENT_CONTEXT Context::current()
#define OBJ_CONTEXT(c, o) Context __ctx__(c, o);
#define OBJ_CONTEXT(c, o) Context __ctx__(c, o)
extern bool SplitFileSysURL(LPCTSTR url, String& dir_out, String& fname_out);