Author: gedmurphy
Date: Thu Jun 18 13:08:11 2015
New Revision: 68185

URL: http://svn.reactos.org/svn/reactos?rev=68185&view=rev
Log:
[DEVMGR]
- Add tooltips for the toolbar
- Fix the 'disable' button not showing for devices that be disabled
- Some code cleanup / noise

Modified:
    trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp
    trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.h
    trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp
    trunk/reactos/dll/win32/devmgr/devmgmt/Resource.h
    trunk/reactos/dll/win32/devmgr/devmgmt/lang/en-US.rc

Modified: trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp?rev=68185&r1=68184&r2=68185&view=diff
==============================================================================
--- trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp       [iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp       [iso-8859-1] 
Thu Jun 18 13:08:11 2015
@@ -286,7 +286,7 @@
     CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetNode(TvItem));
     if (Node)
     {
-        Node->CanDisable();
+        return Node->CanDisable();
     }
     return false;
 }
@@ -348,9 +348,11 @@
 }
 
 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 @@
             ATLASSERT(FALSE);
         }
 
-        // Check if this is a hidden device 
-        if (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))
+        // Don't show hidden devices if not requested
+        if ((m_ShowHidden == TRUE) || (!(DeviceNode->IsHidden())))
+        {
+            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 @@
 
 
 CClassNode*
-CDeviceView::GetClassNode(_In_ LPGUID ClassGuid)
+CDeviceView::GetClassNode(
+    _In_ LPGUID ClassGuid
+    )
 {
     POSITION Pos;
     CClassNode *Node;
@@ -840,7 +840,9 @@
 }
 
 CDeviceNode*
-CDeviceView::GetDeviceNode(_In_ DEVINST Device)
+CDeviceView::GetDeviceNode(
+    _In_ DEVINST Device
+    )
 {
     POSITION Pos;
     CDeviceNode *Node;
@@ -863,7 +865,9 @@
     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 @@
 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;
     }
 }
 

Modified: trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.h?rev=68185&r1=68184&r2=68185&view=diff
==============================================================================
--- trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.h [iso-8859-1] Thu Jun 18 
13:08:11 2015
@@ -15,19 +15,15 @@
 {
     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 @@
 
     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 @@
     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();
 };
 

Modified: trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp?rev=68185&r1=68184&r2=68185&view=diff
==============================================================================
--- trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp       [iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp       [iso-8859-1] 
Thu Jun 18 13:08:11 2015
@@ -500,6 +500,35 @@
         case NM_RETURN:
         {
             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;
         }
     }
@@ -657,12 +686,12 @@
                          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 @@
         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 @@
         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 @@
 
         case WM_ENTERMENULOOP:
         {
-            pThis->UpdateStatusBar(true);
+            This->UpdateStatusBar(true);
             break;
         }
 
         case WM_EXITMENULOOP:
         {
-            pThis->UpdateStatusBar(false);
+            This->UpdateStatusBar(false);
             break;
         }
 
@@ -759,7 +788,7 @@
         case WM_DESTROY:
         {
             // Call the destroy handler
-            RetCode = pThis->OnDestroy();
+            RetCode = This->OnDestroy();
             break;
         }
 

Modified: trunk/reactos/dll/win32/devmgr/devmgmt/Resource.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/Resource.h?rev=68185&r1=68184&r2=68185&view=diff
==============================================================================
--- trunk/reactos/dll/win32/devmgr/devmgmt/Resource.h   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/devmgmt/Resource.h   [iso-8859-1] Thu Jun 18 
13:08:11 2015
@@ -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

Modified: trunk/reactos/dll/win32/devmgr/devmgmt/lang/en-US.rc
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/lang/en-US.rc?rev=68185&r1=68184&r2=68185&view=diff
==============================================================================
--- trunk/reactos/dll/win32/devmgr/devmgmt/lang/en-US.rc        [iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/devmgr/devmgmt/lang/en-US.rc        [iso-8859-1] 
Thu Jun 18 13:08:11 2015
@@ -49,11 +49,21 @@
   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 */


Reply via email to