mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:35:47 +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));
|
||||
if (Node)
|
||||
{
|
||||
Node->CanDisable();
|
||||
return Node->CanDisable();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -348,9 +348,11 @@ CDeviceView::AddRootDevice()
|
|||
}
|
||||
|
||||
bool
|
||||
CDeviceView::GetNextClass(_In_ ULONG ClassIndex,
|
||||
_Out_ LPGUID ClassGuid,
|
||||
_Out_ HDEVINFO *hDevInfo)
|
||||
CDeviceView::GetNextClass(
|
||||
_In_ ULONG ClassIndex,
|
||||
_Out_ LPGUID ClassGuid,
|
||||
_Out_ HDEVINFO *hDevInfo
|
||||
)
|
||||
{
|
||||
CONFIGRET cr;
|
||||
|
||||
|
@ -644,28 +646,24 @@ CDeviceView::RecurseChildDevices(
|
|||
ATLASSERT(FALSE);
|
||||
}
|
||||
|
||||
// Check if this is a hidden device
|
||||
if (DeviceNode->IsHidden())
|
||||
// Don't show hidden devices if not requested
|
||||
if ((m_ShowHidden == TRUE) || (!(DeviceNode->IsHidden())))
|
||||
{
|
||||
if (m_ShowHidden == FALSE)
|
||||
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))
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
(void)TreeView_SortChildren(m_hTreeView,
|
||||
|
@ -816,7 +814,9 @@ CDeviceView::EmptyDeviceView()
|
|||
|
||||
|
||||
CClassNode*
|
||||
CDeviceView::GetClassNode(_In_ LPGUID ClassGuid)
|
||||
CDeviceView::GetClassNode(
|
||||
_In_ LPGUID ClassGuid
|
||||
)
|
||||
{
|
||||
POSITION Pos;
|
||||
CClassNode *Node;
|
||||
|
@ -840,7 +840,9 @@ CDeviceView::GetClassNode(_In_ LPGUID ClassGuid)
|
|||
}
|
||||
|
||||
CDeviceNode*
|
||||
CDeviceView::GetDeviceNode(_In_ DEVINST Device)
|
||||
CDeviceView::GetDeviceNode(
|
||||
_In_ DEVINST Device
|
||||
)
|
||||
{
|
||||
POSITION Pos;
|
||||
CDeviceNode *Node;
|
||||
|
@ -863,7 +865,9 @@ CDeviceView::GetDeviceNode(_In_ DEVINST Device)
|
|||
return Node;
|
||||
}
|
||||
|
||||
CNode* CDeviceView::GetNode(LPTV_ITEMW TvItem)
|
||||
CNode* CDeviceView::GetNode(
|
||||
_In_ LPTV_ITEMW TvItem
|
||||
)
|
||||
{
|
||||
TvItem->mask = TVIF_PARAM;
|
||||
if (TreeView_GetItem(m_hTreeView, TvItem))
|
||||
|
@ -883,19 +887,18 @@ CNode* CDeviceView::GetSelectedNode()
|
|||
void
|
||||
CDeviceView::EmptyLists()
|
||||
{
|
||||
CClassNode *ClassNode;
|
||||
CDeviceNode *DeviceNode;
|
||||
CNode *Node;
|
||||
|
||||
while (!m_ClassNodeList.IsEmpty())
|
||||
{
|
||||
ClassNode = m_ClassNodeList.RemoveTail();
|
||||
delete ClassNode;
|
||||
Node = m_ClassNodeList.RemoveTail();
|
||||
delete Node;
|
||||
}
|
||||
|
||||
while (!m_DeviceNodeList.IsEmpty())
|
||||
{
|
||||
DeviceNode = m_DeviceNodeList.RemoveTail();
|
||||
delete DeviceNode;
|
||||
Node = m_DeviceNodeList.RemoveTail();
|
||||
delete Node;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,19 +15,15 @@ class CDeviceView
|
|||
{
|
||||
CAtlList<CClassNode *> m_ClassNodeList;
|
||||
CAtlList<CDeviceNode *> m_DeviceNodeList;
|
||||
|
||||
SP_CLASSIMAGELIST_DATA m_ImageListData;
|
||||
|
||||
HWND m_hMainWnd;
|
||||
HWND m_hTreeView;
|
||||
HWND m_hPropertyDialog;
|
||||
HMENU m_hMenu;
|
||||
HMENU m_hContextMenu;
|
||||
ViewType m_ViewType;
|
||||
|
||||
HTREEITEM m_hTreeRoot;
|
||||
DEVINST m_RootDevInst;
|
||||
|
||||
bool m_ShowHidden;
|
||||
int m_RootClassImage;
|
||||
|
||||
|
@ -72,10 +68,16 @@ public:
|
|||
|
||||
ViewType GetCurrentView() { return m_ViewType; }
|
||||
|
||||
bool HasProperties(_In_ LPTV_ITEMW TvItem);
|
||||
bool HasProperties(
|
||||
_In_ LPTV_ITEMW TvItem
|
||||
);
|
||||
//bool SelDeviceIsHidden();
|
||||
bool CanDisable(_In_ LPTV_ITEMW TvItem);
|
||||
bool IsDisabled(_In_ LPTV_ITEMW TvItem);
|
||||
bool CanDisable(
|
||||
_In_ LPTV_ITEMW TvItem
|
||||
);
|
||||
bool IsDisabled(
|
||||
_In_ LPTV_ITEMW TvItem
|
||||
);
|
||||
bool SelDeviceIsStarted();
|
||||
bool SelDeviceIsInstalled();
|
||||
|
||||
|
@ -126,11 +128,17 @@ private:
|
|||
VOID EmptyDeviceView(
|
||||
);
|
||||
|
||||
CNode* GetNode(_In_ LPTV_ITEMW TvItem);
|
||||
CNode* GetNode(
|
||||
_In_ LPTV_ITEMW TvItem
|
||||
);
|
||||
CNode* GetSelectedNode();
|
||||
|
||||
CClassNode* GetClassNode(_In_ LPGUID ClassGuid);
|
||||
CDeviceNode* GetDeviceNode(_In_ DEVINST Device);
|
||||
CClassNode* GetClassNode(
|
||||
_In_ LPGUID ClassGuid
|
||||
);
|
||||
CDeviceNode* GetDeviceNode(
|
||||
_In_ DEVINST Device
|
||||
);
|
||||
void EmptyLists();
|
||||
};
|
||||
|
||||
|
|
|
@ -502,6 +502,35 @@ CMainWindow::OnNotify(LPARAM lParam)
|
|||
m_DeviceView->DisplayPropertySheet();
|
||||
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;
|
||||
|
@ -657,12 +686,12 @@ CMainWindow::MainWndProc(HWND hwnd,
|
|||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
CMainWindow *pThis;
|
||||
CMainWindow *This;
|
||||
LRESULT RetCode = 0;
|
||||
|
||||
// Get the object pointer from window context
|
||||
pThis = (CMainWindow *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if (pThis == NULL)
|
||||
This = (CMainWindow *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if (This == NULL)
|
||||
{
|
||||
// Check that this isn't a create message
|
||||
if (msg != WM_CREATE)
|
||||
|
@ -677,47 +706,47 @@ CMainWindow::MainWndProc(HWND hwnd,
|
|||
case WM_CREATE:
|
||||
{
|
||||
// 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
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pThis);
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)This);
|
||||
|
||||
// Call the create handler
|
||||
RetCode = pThis->OnCreate(hwnd);
|
||||
RetCode = This->OnCreate(hwnd);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
RetCode = pThis->OnSize();
|
||||
RetCode = This->OnSize();
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
RetCode = pThis->OnNotify(lParam);
|
||||
RetCode = This->OnNotify(lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
RetCode = pThis->OnContext(lParam);
|
||||
RetCode = This->OnContext(lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_MENUSELECT:
|
||||
{
|
||||
if (pThis->m_hStatusBar != NULL)
|
||||
if (This->m_hStatusBar != NULL)
|
||||
{
|
||||
if (!pThis->MainWndMenuHint(LOWORD(wParam),
|
||||
MainMenuHintTable,
|
||||
sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
|
||||
IDS_HINT_BLANK))
|
||||
if (!This->MainWndMenuHint(LOWORD(wParam),
|
||||
MainMenuHintTable,
|
||||
sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
|
||||
IDS_HINT_BLANK))
|
||||
{
|
||||
pThis->MainWndMenuHint(LOWORD(wParam),
|
||||
SystemMenuHintTable,
|
||||
sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
|
||||
IDS_HINT_BLANK);
|
||||
This->MainWndMenuHint(LOWORD(wParam),
|
||||
SystemMenuHintTable,
|
||||
sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
|
||||
IDS_HINT_BLANK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -727,7 +756,7 @@ CMainWindow::MainWndProc(HWND hwnd,
|
|||
case WM_COMMAND:
|
||||
{
|
||||
// Handle the command message
|
||||
RetCode = pThis->OnCommand(wParam, lParam);
|
||||
RetCode = This->OnCommand(wParam, lParam);
|
||||
if (RetCode == -1)
|
||||
{
|
||||
// Hand it off to the default message handler
|
||||
|
@ -738,13 +767,13 @@ CMainWindow::MainWndProc(HWND hwnd,
|
|||
|
||||
case WM_ENTERMENULOOP:
|
||||
{
|
||||
pThis->UpdateStatusBar(true);
|
||||
This->UpdateStatusBar(true);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_EXITMENULOOP:
|
||||
{
|
||||
pThis->UpdateStatusBar(false);
|
||||
This->UpdateStatusBar(false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -759,7 +788,7 @@ CMainWindow::MainWndProc(HWND hwnd,
|
|||
case WM_DESTROY:
|
||||
{
|
||||
// Call the destroy handler
|
||||
RetCode = pThis->OnDestroy();
|
||||
RetCode = This->OnDestroy();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,14 @@
|
|||
#define IDS_LICENSE 303
|
||||
|
||||
/* tooltips */
|
||||
#define IDS_TOOLTIP_PROP 6000
|
||||
#define IDS_TOOLTIP_REFRESH 6001
|
||||
#define IDS_TOOLTIP_HELP 6002
|
||||
#define IDS_TOOLTIP_PROPERTIES 6000
|
||||
#define IDS_TOOLTIP_SCAN 6001
|
||||
#define IDS_TOOLTIP_ENABLE 6002
|
||||
#define IDS_TOOLTIP_DIABLE 6003
|
||||
#define IDS_TOOLTIP_UPDATE 6004
|
||||
#define IDS_TOOLTIP_UNINSTALL 6005
|
||||
|
||||
|
||||
|
||||
/* menu hints */
|
||||
#define IDS_HINT_BLANK 20000
|
||||
|
|
|
@ -49,11 +49,21 @@ BEGIN
|
|||
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
|
||||
BEGIN
|
||||
IDS_TOOLTIP_PROP "Properties"
|
||||
IDS_TOOLTIP_REFRESH "Scan for hardware changes"
|
||||
IDS_TOOLTIP_HELP "Help"
|
||||
IDS_TOOLTIP_PROPERTIES "Properties"
|
||||
IDS_TOOLTIP_SCAN "Scan for hardware changes"
|
||||
IDS_TOOLTIP_ENABLE "Enable"
|
||||
IDS_TOOLTIP_DIABLE "Disable"
|
||||
IDS_TOOLTIP_UPDATE "Update Driver Software"
|
||||
IDS_TOOLTIP_UNINSTALL "Uninstall"
|
||||
END
|
||||
|
||||
/* Hints */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue