mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:02:59 +00:00
[DEVMGR]
- Add tooltips for the toolbar - Fix the 'disable' button not showing for devices that be disabled - Some code cleanup / noise svn path=/trunk/; revision=68185
This commit is contained in:
parent
9f2ae55de0
commit
1a053ef99c
5 changed files with 125 additions and 70 deletions
|
@ -286,7 +286,7 @@ CDeviceView::CanDisable(
|
||||||
CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetNode(TvItem));
|
CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetNode(TvItem));
|
||||||
if (Node)
|
if (Node)
|
||||||
{
|
{
|
||||||
Node->CanDisable();
|
return Node->CanDisable();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -348,9 +348,11 @@ CDeviceView::AddRootDevice()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CDeviceView::GetNextClass(_In_ ULONG ClassIndex,
|
CDeviceView::GetNextClass(
|
||||||
_Out_ LPGUID ClassGuid,
|
_In_ ULONG ClassIndex,
|
||||||
_Out_ HDEVINFO *hDevInfo)
|
_Out_ LPGUID ClassGuid,
|
||||||
|
_Out_ HDEVINFO *hDevInfo
|
||||||
|
)
|
||||||
{
|
{
|
||||||
CONFIGRET cr;
|
CONFIGRET cr;
|
||||||
|
|
||||||
|
@ -644,28 +646,24 @@ CDeviceView::RecurseChildDevices(
|
||||||
ATLASSERT(FALSE);
|
ATLASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this is a hidden device
|
// Don't show hidden devices if not requested
|
||||||
if (DeviceNode->IsHidden())
|
if ((m_ShowHidden == TRUE) || (!(DeviceNode->IsHidden())))
|
||||||
{
|
{
|
||||||
if (m_ShowHidden == FALSE)
|
if (DeviceNode->HasProblem())
|
||||||
continue;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
if (DeviceNode->HasProblem())
|
|
||||||
{
|
|
||||||
HasProblem = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add this device to the tree under its parent
|
|
||||||
hDevItem = InsertIntoTreeView(hParentTreeItem,
|
|
||||||
DeviceNode);
|
|
||||||
if (hDevItem)
|
|
||||||
{
|
|
||||||
// Check if this child has any children itself
|
|
||||||
if (!RecurseChildDevices(Device, hDevItem))
|
|
||||||
HasProblem = true;
|
HasProblem = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add this device to the tree under its parent
|
||||||
|
hDevItem = InsertIntoTreeView(hParentTreeItem,
|
||||||
|
DeviceNode);
|
||||||
|
if (hDevItem)
|
||||||
|
{
|
||||||
|
// Check if this child has any children itself
|
||||||
|
if (!RecurseChildDevices(Device, hDevItem))
|
||||||
|
HasProblem = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)TreeView_SortChildren(m_hTreeView,
|
(void)TreeView_SortChildren(m_hTreeView,
|
||||||
|
@ -816,7 +814,9 @@ CDeviceView::EmptyDeviceView()
|
||||||
|
|
||||||
|
|
||||||
CClassNode*
|
CClassNode*
|
||||||
CDeviceView::GetClassNode(_In_ LPGUID ClassGuid)
|
CDeviceView::GetClassNode(
|
||||||
|
_In_ LPGUID ClassGuid
|
||||||
|
)
|
||||||
{
|
{
|
||||||
POSITION Pos;
|
POSITION Pos;
|
||||||
CClassNode *Node;
|
CClassNode *Node;
|
||||||
|
@ -840,7 +840,9 @@ CDeviceView::GetClassNode(_In_ LPGUID ClassGuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
CDeviceNode*
|
CDeviceNode*
|
||||||
CDeviceView::GetDeviceNode(_In_ DEVINST Device)
|
CDeviceView::GetDeviceNode(
|
||||||
|
_In_ DEVINST Device
|
||||||
|
)
|
||||||
{
|
{
|
||||||
POSITION Pos;
|
POSITION Pos;
|
||||||
CDeviceNode *Node;
|
CDeviceNode *Node;
|
||||||
|
@ -863,7 +865,9 @@ CDeviceView::GetDeviceNode(_In_ DEVINST Device)
|
||||||
return Node;
|
return Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
CNode* CDeviceView::GetNode(LPTV_ITEMW TvItem)
|
CNode* CDeviceView::GetNode(
|
||||||
|
_In_ LPTV_ITEMW TvItem
|
||||||
|
)
|
||||||
{
|
{
|
||||||
TvItem->mask = TVIF_PARAM;
|
TvItem->mask = TVIF_PARAM;
|
||||||
if (TreeView_GetItem(m_hTreeView, TvItem))
|
if (TreeView_GetItem(m_hTreeView, TvItem))
|
||||||
|
@ -883,19 +887,18 @@ CNode* CDeviceView::GetSelectedNode()
|
||||||
void
|
void
|
||||||
CDeviceView::EmptyLists()
|
CDeviceView::EmptyLists()
|
||||||
{
|
{
|
||||||
CClassNode *ClassNode;
|
CNode *Node;
|
||||||
CDeviceNode *DeviceNode;
|
|
||||||
|
|
||||||
while (!m_ClassNodeList.IsEmpty())
|
while (!m_ClassNodeList.IsEmpty())
|
||||||
{
|
{
|
||||||
ClassNode = m_ClassNodeList.RemoveTail();
|
Node = m_ClassNodeList.RemoveTail();
|
||||||
delete ClassNode;
|
delete Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!m_DeviceNodeList.IsEmpty())
|
while (!m_DeviceNodeList.IsEmpty())
|
||||||
{
|
{
|
||||||
DeviceNode = m_DeviceNodeList.RemoveTail();
|
Node = m_DeviceNodeList.RemoveTail();
|
||||||
delete DeviceNode;
|
delete Node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,19 +15,15 @@ class CDeviceView
|
||||||
{
|
{
|
||||||
CAtlList<CClassNode *> m_ClassNodeList;
|
CAtlList<CClassNode *> m_ClassNodeList;
|
||||||
CAtlList<CDeviceNode *> m_DeviceNodeList;
|
CAtlList<CDeviceNode *> m_DeviceNodeList;
|
||||||
|
|
||||||
SP_CLASSIMAGELIST_DATA m_ImageListData;
|
SP_CLASSIMAGELIST_DATA m_ImageListData;
|
||||||
|
|
||||||
HWND m_hMainWnd;
|
HWND m_hMainWnd;
|
||||||
HWND m_hTreeView;
|
HWND m_hTreeView;
|
||||||
HWND m_hPropertyDialog;
|
HWND m_hPropertyDialog;
|
||||||
HMENU m_hMenu;
|
HMENU m_hMenu;
|
||||||
HMENU m_hContextMenu;
|
HMENU m_hContextMenu;
|
||||||
ViewType m_ViewType;
|
ViewType m_ViewType;
|
||||||
|
|
||||||
HTREEITEM m_hTreeRoot;
|
HTREEITEM m_hTreeRoot;
|
||||||
DEVINST m_RootDevInst;
|
DEVINST m_RootDevInst;
|
||||||
|
|
||||||
bool m_ShowHidden;
|
bool m_ShowHidden;
|
||||||
int m_RootClassImage;
|
int m_RootClassImage;
|
||||||
|
|
||||||
|
@ -72,10 +68,16 @@ public:
|
||||||
|
|
||||||
ViewType GetCurrentView() { return m_ViewType; }
|
ViewType GetCurrentView() { return m_ViewType; }
|
||||||
|
|
||||||
bool HasProperties(_In_ LPTV_ITEMW TvItem);
|
bool HasProperties(
|
||||||
|
_In_ LPTV_ITEMW TvItem
|
||||||
|
);
|
||||||
//bool SelDeviceIsHidden();
|
//bool SelDeviceIsHidden();
|
||||||
bool CanDisable(_In_ LPTV_ITEMW TvItem);
|
bool CanDisable(
|
||||||
bool IsDisabled(_In_ LPTV_ITEMW TvItem);
|
_In_ LPTV_ITEMW TvItem
|
||||||
|
);
|
||||||
|
bool IsDisabled(
|
||||||
|
_In_ LPTV_ITEMW TvItem
|
||||||
|
);
|
||||||
bool SelDeviceIsStarted();
|
bool SelDeviceIsStarted();
|
||||||
bool SelDeviceIsInstalled();
|
bool SelDeviceIsInstalled();
|
||||||
|
|
||||||
|
@ -126,11 +128,17 @@ private:
|
||||||
VOID EmptyDeviceView(
|
VOID EmptyDeviceView(
|
||||||
);
|
);
|
||||||
|
|
||||||
CNode* GetNode(_In_ LPTV_ITEMW TvItem);
|
CNode* GetNode(
|
||||||
|
_In_ LPTV_ITEMW TvItem
|
||||||
|
);
|
||||||
CNode* GetSelectedNode();
|
CNode* GetSelectedNode();
|
||||||
|
|
||||||
CClassNode* GetClassNode(_In_ LPGUID ClassGuid);
|
CClassNode* GetClassNode(
|
||||||
CDeviceNode* GetDeviceNode(_In_ DEVINST Device);
|
_In_ LPGUID ClassGuid
|
||||||
|
);
|
||||||
|
CDeviceNode* GetDeviceNode(
|
||||||
|
_In_ DEVINST Device
|
||||||
|
);
|
||||||
void EmptyLists();
|
void EmptyLists();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -502,6 +502,35 @@ CMainWindow::OnNotify(LPARAM lParam)
|
||||||
m_DeviceView->DisplayPropertySheet();
|
m_DeviceView->DisplayPropertySheet();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TTN_GETDISPINFO:
|
||||||
|
{
|
||||||
|
LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT)lParam;
|
||||||
|
|
||||||
|
UINT_PTR idButton = (UINT)lpttt->hdr.idFrom;
|
||||||
|
switch (idButton)
|
||||||
|
{
|
||||||
|
case IDC_PROPERTIES:
|
||||||
|
lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_PROPERTIES);
|
||||||
|
break;
|
||||||
|
case IDC_SCAN_HARDWARE:
|
||||||
|
lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_SCAN);
|
||||||
|
break;
|
||||||
|
case IDC_ENABLE_DRV:
|
||||||
|
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_ENABLE);
|
||||||
|
break;
|
||||||
|
case IDC_DISABLE_DRV:
|
||||||
|
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_DIABLE);
|
||||||
|
break;
|
||||||
|
case IDC_UPDATE_DRV:
|
||||||
|
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_UPDATE);
|
||||||
|
break;
|
||||||
|
case IDC_UNINSTALL_DRV:
|
||||||
|
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_UNINSTALL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -657,12 +686,12 @@ CMainWindow::MainWndProc(HWND hwnd,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
CMainWindow *pThis;
|
CMainWindow *This;
|
||||||
LRESULT RetCode = 0;
|
LRESULT RetCode = 0;
|
||||||
|
|
||||||
// Get the object pointer from window context
|
// Get the object pointer from window context
|
||||||
pThis = (CMainWindow *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
This = (CMainWindow *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||||
if (pThis == NULL)
|
if (This == NULL)
|
||||||
{
|
{
|
||||||
// Check that this isn't a create message
|
// Check that this isn't a create message
|
||||||
if (msg != WM_CREATE)
|
if (msg != WM_CREATE)
|
||||||
|
@ -677,47 +706,47 @@ CMainWindow::MainWndProc(HWND hwnd,
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
// Get the object pointer from the create param
|
// Get the object pointer from the create param
|
||||||
pThis = (CMainWindow *)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
This = (CMainWindow *)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||||
|
|
||||||
// Store the pointer in the window's global user data
|
// Store the pointer in the window's global user data
|
||||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pThis);
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)This);
|
||||||
|
|
||||||
// Call the create handler
|
// Call the create handler
|
||||||
RetCode = pThis->OnCreate(hwnd);
|
RetCode = This->OnCreate(hwnd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
RetCode = pThis->OnSize();
|
RetCode = This->OnSize();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
RetCode = pThis->OnNotify(lParam);
|
RetCode = This->OnNotify(lParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_CONTEXTMENU:
|
case WM_CONTEXTMENU:
|
||||||
{
|
{
|
||||||
RetCode = pThis->OnContext(lParam);
|
RetCode = This->OnContext(lParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_MENUSELECT:
|
case WM_MENUSELECT:
|
||||||
{
|
{
|
||||||
if (pThis->m_hStatusBar != NULL)
|
if (This->m_hStatusBar != NULL)
|
||||||
{
|
{
|
||||||
if (!pThis->MainWndMenuHint(LOWORD(wParam),
|
if (!This->MainWndMenuHint(LOWORD(wParam),
|
||||||
MainMenuHintTable,
|
MainMenuHintTable,
|
||||||
sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
|
sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
|
||||||
IDS_HINT_BLANK))
|
IDS_HINT_BLANK))
|
||||||
{
|
{
|
||||||
pThis->MainWndMenuHint(LOWORD(wParam),
|
This->MainWndMenuHint(LOWORD(wParam),
|
||||||
SystemMenuHintTable,
|
SystemMenuHintTable,
|
||||||
sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
|
sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
|
||||||
IDS_HINT_BLANK);
|
IDS_HINT_BLANK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,7 +756,7 @@ CMainWindow::MainWndProc(HWND hwnd,
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
// Handle the command message
|
// Handle the command message
|
||||||
RetCode = pThis->OnCommand(wParam, lParam);
|
RetCode = This->OnCommand(wParam, lParam);
|
||||||
if (RetCode == -1)
|
if (RetCode == -1)
|
||||||
{
|
{
|
||||||
// Hand it off to the default message handler
|
// Hand it off to the default message handler
|
||||||
|
@ -738,13 +767,13 @@ CMainWindow::MainWndProc(HWND hwnd,
|
||||||
|
|
||||||
case WM_ENTERMENULOOP:
|
case WM_ENTERMENULOOP:
|
||||||
{
|
{
|
||||||
pThis->UpdateStatusBar(true);
|
This->UpdateStatusBar(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_EXITMENULOOP:
|
case WM_EXITMENULOOP:
|
||||||
{
|
{
|
||||||
pThis->UpdateStatusBar(false);
|
This->UpdateStatusBar(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +788,7 @@ CMainWindow::MainWndProc(HWND hwnd,
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
// Call the destroy handler
|
// Call the destroy handler
|
||||||
RetCode = pThis->OnDestroy();
|
RetCode = This->OnDestroy();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,14 @@
|
||||||
#define IDS_LICENSE 303
|
#define IDS_LICENSE 303
|
||||||
|
|
||||||
/* tooltips */
|
/* tooltips */
|
||||||
#define IDS_TOOLTIP_PROP 6000
|
#define IDS_TOOLTIP_PROPERTIES 6000
|
||||||
#define IDS_TOOLTIP_REFRESH 6001
|
#define IDS_TOOLTIP_SCAN 6001
|
||||||
#define IDS_TOOLTIP_HELP 6002
|
#define IDS_TOOLTIP_ENABLE 6002
|
||||||
|
#define IDS_TOOLTIP_DIABLE 6003
|
||||||
|
#define IDS_TOOLTIP_UPDATE 6004
|
||||||
|
#define IDS_TOOLTIP_UNINSTALL 6005
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* menu hints */
|
/* menu hints */
|
||||||
#define IDS_HINT_BLANK 20000
|
#define IDS_HINT_BLANK 20000
|
||||||
|
|
|
@ -49,11 +49,21 @@ BEGIN
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
|
#define IDS_HINT_PROPERTIES 20001
|
||||||
|
#define IDS_HINT_SCAN 20002
|
||||||
|
#define IDS_HINT_ENABLE 20003
|
||||||
|
#define IDS_HINT_DISABLE 20004
|
||||||
|
#define IDS_HINT_UPDATE 20005
|
||||||
|
#define IDS_HINT_UNINSTALL 20006
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_TOOLTIP_PROP "Properties"
|
IDS_TOOLTIP_PROPERTIES "Properties"
|
||||||
IDS_TOOLTIP_REFRESH "Scan for hardware changes"
|
IDS_TOOLTIP_SCAN "Scan for hardware changes"
|
||||||
IDS_TOOLTIP_HELP "Help"
|
IDS_TOOLTIP_ENABLE "Enable"
|
||||||
|
IDS_TOOLTIP_DIABLE "Disable"
|
||||||
|
IDS_TOOLTIP_UPDATE "Update Driver Software"
|
||||||
|
IDS_TOOLTIP_UNINSTALL "Uninstall"
|
||||||
END
|
END
|
||||||
|
|
||||||
/* Hints */
|
/* Hints */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue