List view mode in object browser completely working
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 12 May 2004 21:05:47 +0000 (21:05 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 12 May 2004 21:05:47 +0000 (21:05 +0000)
src/console/win32/ObjectBrowser.cpp
src/console/win32/ObjectBrowser.h
src/console/win32/ObjectSearchBox.cpp
src/console/win32/ObjectSearchBox.h
src/console/win32/nxcon.clw

index 30bb181..0bfafd3 100644 (file)
@@ -149,6 +149,7 @@ BEGIN_MESSAGE_MAP(CObjectBrowser, CMDIChildWnd)
        ON_NOTIFY(NM_RCLICK, IDC_TREE_VIEW, OnRclickTreeView)
    ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_VIEW, OnTreeViewSelChange)
        ON_NOTIFY(LVN_COLUMNCLICK, IDC_LIST_VIEW, OnListViewColumnClick)
+       ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_VIEW, OnListViewItemChange)
    ON_MESSAGE(WM_OBJECT_CHANGE, OnObjectChange)
 END_MESSAGE_MAP()
 
@@ -413,10 +414,10 @@ void CObjectBrowser::OnObjectViewShowpreviewpane()
 
 void CObjectBrowser::OnTreeViewSelChange(LPNMTREEVIEW lpnmt)
 {
-   NXC_OBJECT *pObject;
-
    if (m_dwFlags & VIEW_OBJECTS_AS_TREE)
    {
+      NXC_OBJECT *pObject;
+
       pObject = NXCFindObjectById(lpnmt->itemNew.lParam);
       m_wndPreviewPane.SetCurrentObject(pObject);
    }
@@ -725,9 +726,16 @@ void CObjectBrowser::AddObjectToList(NXC_OBJECT *pObject)
 
 void CObjectBrowser::OnObjectViewViewaslist() 
 {
+   int iItem;
+
    m_dwFlags &= ~VIEW_OBJECTS_AS_TREE;
    m_wndListCtrl.ShowWindow(SW_SHOW);
    m_wndTreeCtrl.ShowWindow(SW_HIDE);
+
+   // Display currenly selected item in preview pane
+   iItem = m_wndListCtrl.GetNextItem(-1, LVNI_FOCUSED);
+   m_wndPreviewPane.SetCurrentObject(iItem == -1 ? NULL :
+                                       (NXC_OBJECT *)m_wndListCtrl.GetItemData(iItem));
 }
 
 
@@ -737,9 +745,17 @@ void CObjectBrowser::OnObjectViewViewaslist()
 
 void CObjectBrowser::OnObjectViewViewastree() 
 {
+   HTREEITEM hItem;
+   NXC_OBJECT *pObject;
+
    m_dwFlags |= VIEW_OBJECTS_AS_TREE;
    m_wndTreeCtrl.ShowWindow(SW_SHOW);
    m_wndListCtrl.ShowWindow(SW_HIDE);
+
+   // Display currenly selected item in preview pane
+   hItem = m_wndTreeCtrl.GetSelectedItem();
+   pObject = (hItem == NULL) ? NULL : NXCFindObjectById(m_wndTreeCtrl.GetItemData(hItem));
+   m_wndPreviewPane.SetCurrentObject(pObject);
 }
 
 
@@ -780,3 +796,24 @@ void CObjectBrowser::OnListViewColumnClick(LPNMLISTVIEW pNMHDR, LRESULT *pResult
    
    *pResult = 0;
 }
+
+
+//
+// WM_NOTIFY::LVN_ITEMACTIVATE message handler
+//
+
+void CObjectBrowser::OnListViewItemChange(LPNMLISTVIEW pNMHDR, LRESULT *pResult)
+{
+   if (!(m_dwFlags & VIEW_OBJECTS_AS_TREE))
+   {
+      NXC_OBJECT *pObject;
+
+      if (pNMHDR->iItem != -1)
+         if ((pNMHDR->uChanged & LVIF_STATE) && (pNMHDR->uNewState & LVIS_FOCUSED))
+         {
+            pObject = (NXC_OBJECT *)m_wndListCtrl.GetItemData(pNMHDR->iItem);
+            m_wndPreviewPane.SetCurrentObject(pObject);
+         }
+   }   
+   *pResult = 0;
+}
index b60aa36..42ab2d6 100644 (file)
@@ -121,6 +121,7 @@ protected:
        afx_msg void OnObjectViewViewaslist();
        afx_msg void OnObjectViewViewastree();
        afx_msg void OnListViewColumnClick(LPNMLISTVIEW pNMHDR, LRESULT* pResult);
+   afx_msg void OnListViewItemChange(LPNMLISTVIEW pNMHDR, LRESULT *pResult);
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 private:
index 8deeffe..77fc8d4 100644 (file)
@@ -37,6 +37,7 @@ BEGIN_MESSAGE_MAP(CObjectSearchBox, CToolBox)
        ON_WM_CREATE()
        ON_WM_CTLCOLOR()
        //}}AFX_MSG_MAP
+       ON_COMMAND(ID_FIND_OBJECT, OnFindObject)
 END_MESSAGE_MAP()
 
 
@@ -102,3 +103,13 @@ HBRUSH CObjectSearchBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
        
        return hbr;
 }
+
+
+//
+// WM_COMMAND::ID_FIND_OBJECT
+//
+
+void CObjectSearchBox::OnFindObject()
+{
+   MessageBox("FIND");
+}
index b20f2ce..069549f 100644 (file)
@@ -43,6 +43,7 @@ protected:
        //{{AFX_MSG(CObjectSearchBox)
        afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
        afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+       afx_msg void OnFindObject();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };
index 84f781c..c5baae9 100644 (file)
@@ -17,20 +17,20 @@ Class9=CMapView
 
 ResourceCount=23
 Resource1=IDM_VIEW_SPECIFIC (English (U.S.))
-Resource2=IDD_ABOUTBOX
-Resource3=IDA_OBJECT_BROWSER
-Resource4=IDD_OBJECT_PROPERTIES
+Resource2=IDR_MAINFRAME
+Resource3=IDD_OBJECT_PROPERTIES
+Resource4=IDD_ABOUTBOX
 Resource5=IDD_ABOUTBOX (English (U.S.))
 Class2=CChildView
 Class5=CAboutDlg
 Class6=CControlPanel
 Class8=CMapFrame
 Class10=CLoginDialog
-Resource6=IDD_LOGIN
+Resource6=IDA_MDI_DEFAULT
 Class11=CProgressDialog
 Resource7=IDD_OBJECT_PROPERTIES (English (U.S.))
 Class12=CObjectBrowser
-Resource8=IDA_MDI_DEFAULT
+Resource8=IDD_PROGRESS
 Class13=CObjectPropDlg
 Resource9=IDM_VIEW_SPECIFIC
 Resource10=IDA_OBJECT_BROWSER (English (U.S.))
@@ -42,9 +42,9 @@ Resource15=IDR_OBJECTS (English (U.S.))
 Resource16=IDD_DUMMY (English (U.S.))
 Class14=CEventEditor
 Class15=CEditEventDlg
-Resource17=IDR_MAINFRAME
+Resource17=IDD_EDIT_EVENT (English (U.S.))
 Class16=CDebugFrame
-Resource18=IDD_PROGRESS
+Resource18=IDA_OBJECT_BROWSER
 Resource19=IDD_LOGIN (English (U.S.))
 Resource20=IDR_MAINFRAME (English (U.S.))
 Class17=CObjectPreview
@@ -52,8 +52,8 @@ Resource21=IDD_PROGRESS (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDD_EDIT_EVENT
-Resource23=IDD_EDIT_EVENT (English (U.S.))
+Resource22=IDD_LOGIN
+Resource23=IDD_EDIT_EVENT
 
 [CLS:CConsoleApp]
 Type=0