Minor changes
[public/netxms.git] / src / console / win32 / nxcon.cpp
CommitLineData
3bf7e95e
VK
1// nxcon.cpp : Defines the class behaviors for the application.
2//
3
4#include "stdafx.h"
5#include "nxcon.h"
6
7#include "MainFrm.h"
8#include "LoginDialog.h"
9
10#ifdef _DEBUG
11#define new DEBUG_NEW
12#undef THIS_FILE
13static char THIS_FILE[] = __FILE__;
14#endif
15
16
17//
18// Wrapper for client library event handler
19//
20
21static void ClientEventHandler(DWORD dwEvent, DWORD dwCode, void *pArg)
22{
23 theApp.EventHandler(dwEvent, dwCode, pArg);
24}
25
26
8e748b3e
VK
27//
28// Wrapper for client library debug callback
29//
30
31static void ClientDebugCallback(char *pszMsg)
32{
33 theApp.DebugCallback(pszMsg);
34}
35
36
3bf7e95e
VK
37//
38// CConsoleApp
39//
40
41BEGIN_MESSAGE_MAP(CConsoleApp, CWinApp)
42 //{{AFX_MSG_MAP(CConsoleApp)
43 ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
44 ON_COMMAND(ID_VIEW_CONTROLPANEL, OnViewControlpanel)
45 ON_COMMAND(ID_VIEW_EVENTS, OnViewEvents)
46 ON_COMMAND(ID_VIEW_MAP, OnViewMap)
47 ON_COMMAND(ID_CONNECT_TO_SERVER, OnConnectToServer)
48 ON_COMMAND(ID_VIEW_OBJECTBROWSER, OnViewObjectbrowser)
a5f8f9b0 49 ON_COMMAND(ID_CONTROLPANEL_EVENTS, OnControlpanelEvents)
8e748b3e 50 ON_COMMAND(ID_VIEW_DEBUG, OnViewDebug)
417924d6 51 ON_COMMAND(ID_CONTROLPANEL_USERS, OnControlpanelUsers)
946d48b3 52 ON_COMMAND(ID_VIEW_NETWORKSUMMARY, OnViewNetworksummary)
3bf7e95e
VK
53 //}}AFX_MSG_MAP
54END_MESSAGE_MAP()
55
56
57//
58// CConsoleApp construction
59//
60
61CConsoleApp::CConsoleApp()
62{
63 m_bCtrlPanelActive = FALSE;
64 m_bEventBrowserActive = FALSE;
a5f8f9b0 65 m_bEventEditorActive = FALSE;
417924d6 66 m_bUserEditorActive = FALSE;
3bf7e95e 67 m_bObjectBrowserActive = FALSE;
8e748b3e 68 m_bDebugWindowActive = FALSE;
946d48b3 69 m_bNetSummaryActive = FALSE;
3bf7e95e
VK
70 m_dwClientState = STATE_DISCONNECTED;
71}
72
999bd324
VK
73
74//
75// CConsoleApp destruction
76//
77
78CConsoleApp::~CConsoleApp()
79{
999bd324
VK
80}
81
82
3bf7e95e
VK
83//
84// The one and only CConsoleApp object
85//
86
87CConsoleApp theApp;
88
89
90//
91// CConsoleApp initialization
92//
93
94BOOL CConsoleApp::InitInstance()
95{
96 BOOL bSetWindowPos;
97 DWORD dwBytes;
98 BYTE *pData;
8e748b3e 99 HMENU hMenu;
3bf7e95e
VK
100
101 if (!AfxSocketInit())
102 {
103 AfxMessageBox(IDP_SOCKETS_INIT_FAILED, MB_OK | MB_ICONSTOP);
104 return FALSE;
105 }
106
107 if (!NXCInitialize())
108 {
109 AfxMessageBox(IDS_NXC_INIT_FAILED, MB_OK | MB_ICONSTOP);
110 return FALSE;
111 }
112 NXCSetEventHandler(ClientEventHandler);
113
114 AfxEnableControlContainer();
115
116 // Standard initialization
117 // If you are not using these features and wish to reduce the size
118 // of your final executable, you should remove from the following
119 // the specific initialization routines you do not need.
120
121#ifdef _AFXDLL
122 Enable3dControls(); // Call this when using MFC in a shared DLL
123#else
124 Enable3dControlsStatic(); // Call this when linking to MFC statically
125#endif
126
127 // Change the registry key under which our settings are stored.
128 SetRegistryKey(_T("NetXMS"));
129
130 // To create the main window, this code creates a new frame window
131 // object and then sets it as the application's main window object.
132
133 CMDIFrameWnd* pFrame = new CMainFrame;
134 m_pMainWnd = pFrame;
135
136 // create main MDI frame window
137 if (!pFrame->LoadFrame(IDR_MAINFRAME))
138 return FALSE;
139
790cd256
VK
140 // Load context menus
141 if (!m_ctxMenu.LoadMenu(IDM_CONTEXT))
142 MessageBox(NULL, "FAILED", "", 0);
143
8e748b3e
VK
144 // Load shared MDI menus and accelerator table
145 HINSTANCE hInstance = AfxGetResourceHandle();
146
147 hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDM_VIEW_SPECIFIC));
148
149 m_hMDIMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MAINFRAME));
150 InsertMenu(m_hMDIMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)GetSubMenu(hMenu, 0), "&Window");
151
152 m_hEventBrowserMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MAINFRAME));
153 InsertMenu(m_hEventBrowserMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)GetSubMenu(hMenu, 0), "&Window");
154 InsertMenu(m_hEventBrowserMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)GetSubMenu(hMenu, 1), "&Event");
155
2060ba91
VK
156 m_hObjectBrowserMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MAINFRAME));
157 InsertMenu(m_hObjectBrowserMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)GetSubMenu(hMenu, 0), "&Window");
158 InsertMenu(m_hObjectBrowserMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)GetSubMenu(hMenu, 2), "&Object");
159
cad81e33
VK
160 m_hUserEditorMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MAINFRAME));
161 InsertMenu(m_hUserEditorMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)GetSubMenu(hMenu, 0), "&Window");
162 InsertMenu(m_hUserEditorMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)GetSubMenu(hMenu, 3), "&User");
163
8e748b3e
VK
164 m_hMDIAccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(IDA_MDI_DEFAULT));
165 m_hEventBrowserAccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(IDA_MDI_DEFAULT));
2060ba91 166 m_hObjectBrowserAccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(IDA_OBJECT_BROWSER));
cad81e33 167 m_hUserEditorAccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(IDA_MDI_DEFAULT));
3bf7e95e
VK
168
169 // Load configuration from registry
170 dwBytes = sizeof(WINDOWPLACEMENT);
171 bSetWindowPos = GetProfileBinary(_T("General"), _T("WindowPlacement"),
172 &pData, (UINT *)&dwBytes);
173 strcpy(g_szServer, (LPCTSTR)GetProfileString(_T("Connection"), _T("Server"), _T("localhost")));
174 strcpy(g_szLogin, (LPCTSTR)GetProfileString(_T("Connection"), _T("Login"), NULL));
175
176 // The main window has been initialized, so show and update it.
177 if (bSetWindowPos)
178 {
179 pFrame->SetWindowPlacement((WINDOWPLACEMENT *)pData);
180 if (pFrame->IsIconic())
181 pFrame->ShowWindow(SW_RESTORE);
182 }
183 else
184 {
185 pFrame->ShowWindow(m_nCmdShow);
186 }
187 pFrame->UpdateWindow();
188 pFrame->PostMessage(WM_COMMAND, ID_CONNECT_TO_SERVER, 0);
189
190 return TRUE;
191}
192
193/////////////////////////////////////////////////////////////////////////////
194// CConsoleApp message handlers
195
196int CConsoleApp::ExitInstance()
197{
8e748b3e
VK
198 NXCSetDebugCallback(NULL);
199 NXCDisconnect();
200
3bf7e95e 201 // Free resources
8e748b3e
VK
202 SafeFreeResource(m_hMDIMenu);
203 SafeFreeResource(m_hMDIAccel);
204 SafeFreeResource(m_hEventBrowserMenu);
205 SafeFreeResource(m_hEventBrowserAccel);
3bf7e95e
VK
206
207 return CWinApp::ExitInstance();
208}
209
210
211/////////////////////////////////////////////////////////////////////////////
212// CAboutDlg dialog used for App About
213
214class CAboutDlg : public CDialog
215{
216public:
217 CAboutDlg();
218
219// Dialog Data
220 //{{AFX_DATA(CAboutDlg)
221 enum { IDD = IDD_ABOUTBOX };
222 //}}AFX_DATA
223
224 // ClassWizard generated virtual function overrides
225 //{{AFX_VIRTUAL(CAboutDlg)
226 protected:
227 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
228 //}}AFX_VIRTUAL
229
230// Implementation
231protected:
232 //{{AFX_MSG(CAboutDlg)
233 // No message handlers
234 //}}AFX_MSG
235 DECLARE_MESSAGE_MAP()
236};
237
238CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
239{
240 //{{AFX_DATA_INIT(CAboutDlg)
241 //}}AFX_DATA_INIT
242}
243
244void CAboutDlg::DoDataExchange(CDataExchange* pDX)
245{
246 CDialog::DoDataExchange(pDX);
247 //{{AFX_DATA_MAP(CAboutDlg)
248 //}}AFX_DATA_MAP
249}
250
251BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
252 //{{AFX_MSG_MAP(CAboutDlg)
253 // No message handlers
254 //}}AFX_MSG_MAP
255END_MESSAGE_MAP()
256
257// App command to run the dialog
258void CConsoleApp::OnAppAbout()
259{
260 CAboutDlg aboutDlg;
261 aboutDlg.DoModal();
262}
263
264/////////////////////////////////////////////////////////////////////////////
265// CConsoleApp message handlers
266
267
268void CConsoleApp::OnViewControlpanel()
269{
270 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
271
272 // create a new MDI child window or open existing
273 if (m_bCtrlPanelActive)
274 m_pwndCtrlPanel->BringWindowToTop();
275 else
276 pFrame->CreateNewChild(
8e748b3e 277 RUNTIME_CLASS(CControlPanel), IDR_CTRLPANEL, m_hMDIMenu, m_hMDIAccel);
3bf7e95e
VK
278}
279
280
281//
282// This method called when new view is created
283//
284
285void CConsoleApp::OnViewCreate(DWORD dwView, CWnd *pWnd)
286{
287 switch(dwView)
288 {
289 case IDR_CTRLPANEL:
290 m_bCtrlPanelActive = TRUE;
291 m_pwndCtrlPanel = pWnd;
292 break;
293 case IDR_EVENTS:
294 m_bEventBrowserActive = TRUE;
295 m_pwndEventBrowser = (CEventBrowser *)pWnd;
296 break;
297 case IDR_OBJECTS:
298 m_bObjectBrowserActive = TRUE;
299 m_pwndObjectBrowser = pWnd;
300 break;
a5f8f9b0
VK
301 case IDR_EVENT_EDITOR:
302 m_bEventEditorActive = TRUE;
303 m_pwndEventEditor = (CEventEditor *)pWnd;
304 break;
417924d6
VK
305 case IDR_USER_EDITOR:
306 m_bUserEditorActive = TRUE;
307 m_pwndUserEditor = (CUserEditor *)pWnd;
308 break;
8e748b3e
VK
309 case IDR_DEBUG_WINDOW:
310 m_bDebugWindowActive = TRUE;
311 m_pwndDebugWindow = (CDebugFrame *)pWnd;
312 NXCSetDebugCallback(ClientDebugCallback);
313 break;
946d48b3
VK
314 case IDR_NETWORK_SUMMARY:
315 m_bNetSummaryActive = TRUE;
316 m_pwndNetSummary = (CNetSummaryFrame *)pWnd;
317 break;
3bf7e95e
VK
318 default:
319 break;
320 }
321}
322
323
324//
325// This method called when view is destroyed
326//
327
328void CConsoleApp::OnViewDestroy(DWORD dwView, CWnd *pWnd)
329{
330 switch(dwView)
331 {
332 case IDR_CTRLPANEL:
333 m_bCtrlPanelActive = FALSE;
334 break;
335 case IDR_EVENTS:
336 m_bEventBrowserActive = FALSE;
337 break;
338 case IDR_OBJECTS:
339 m_bObjectBrowserActive = FALSE;
340 break;
a5f8f9b0
VK
341 case IDR_EVENT_EDITOR:
342 m_bEventEditorActive = FALSE;
343 break;
417924d6
VK
344 case IDR_USER_EDITOR:
345 m_bUserEditorActive = FALSE;
346 break;
8e748b3e
VK
347 case IDR_DEBUG_WINDOW:
348 m_bDebugWindowActive = FALSE;
349 NXCSetDebugCallback(NULL);
350 break;
946d48b3
VK
351 case IDR_NETWORK_SUMMARY:
352 m_bNetSummaryActive = FALSE;
353 break;
3bf7e95e
VK
354 default:
355 break;
356 }
357}
358
359void CConsoleApp::OnViewEvents()
360{
361 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
362
363 // create a new MDI child window or open existing
364 if (m_bEventBrowserActive)
365 m_pwndEventBrowser->BringWindowToTop();
366 else
367 pFrame->CreateNewChild(
8e748b3e 368 RUNTIME_CLASS(CEventBrowser), IDR_EVENTS, m_hEventBrowserMenu, m_hEventBrowserAccel);
3bf7e95e
VK
369}
370
371void CConsoleApp::OnViewMap()
372{
373 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
374
375 // create a new MDI child window
f7a7f8e4 376 pFrame->CreateNewChild(RUNTIME_CLASS(CMapFrame), IDR_MAPFRAME, m_hMDIMenu, m_hMDIAccel);
3bf7e95e
VK
377}
378
379void CConsoleApp::OnConnectToServer()
380{
381 CLoginDialog dlgLogin;
f7a7f8e4 382 DWORD dwResult;
3bf7e95e
VK
383
384 dlgLogin.m_szServer = g_szServer;
385 dlgLogin.m_szLogin = g_szLogin;
f7a7f8e4 386 do
3bf7e95e
VK
387 {
388 if (dlgLogin.DoModal() != IDOK)
389 {
390 PostQuitMessage(1);
391 break;
392 }
393 strcpy(g_szServer, (LPCTSTR)dlgLogin.m_szServer);
394 strcpy(g_szLogin, (LPCTSTR)dlgLogin.m_szLogin);
395 strcpy(g_szPassword, (LPCTSTR)dlgLogin.m_szPassword);
396
397 // Save last connection parameters
398 WriteProfileString(_T("Connection"), _T("Server"), g_szServer);
399 WriteProfileString(_T("Connection"), _T("Login"), g_szLogin);
400
401 // Initiate connection
f7a7f8e4
VK
402 dwResult = DoLogin();
403 if (dwResult != RCC_SUCCESS)
3bf7e95e 404 {
f7a7f8e4
VK
405 char szBuffer[256];
406
407 sprintf(szBuffer, "Unable to connect: %s", NXCGetErrorText(dwResult));
408 m_pMainWnd->MessageBox(szBuffer, "Connection error", MB_OK | MB_ICONSTOP);
3bf7e95e
VK
409 }
410 }
f7a7f8e4 411 while(dwResult != RCC_SUCCESS);
3bf7e95e
VK
412}
413
414void CConsoleApp::OnViewObjectbrowser()
415{
416 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
417
418 // create a new MDI child window or open existing
419 if (m_bObjectBrowserActive)
420 m_pwndObjectBrowser->BringWindowToTop();
421 else
422 pFrame->CreateNewChild(
2060ba91 423 RUNTIME_CLASS(CObjectBrowser), IDR_OBJECTS, m_hObjectBrowserMenu, m_hObjectBrowserAccel);
3bf7e95e
VK
424}
425
426
427//
428// Event handler for client libray events
429//
430
431void CConsoleApp::EventHandler(DWORD dwEvent, DWORD dwCode, void *pArg)
432{
3bf7e95e
VK
433 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
434
435 switch(dwEvent)
436 {
437 case NXC_EVENT_STATE_CHANGED:
438 switch(dwCode)
439 {
440 case STATE_CONNECTING:
3bf7e95e
VK
441 break;
442 case STATE_IDLE:
3bf7e95e
VK
443 if ((m_bEventBrowserActive) && (m_dwClientState == STATE_SYNC_EVENTS))
444 m_pwndEventBrowser->EnableDisplay(TRUE);
445 break;
446 case STATE_DISCONNECTED:
3bf7e95e
VK
447 break;
448 case STATE_SYNC_EVENTS:
449 if (m_bEventBrowserActive)
450 m_pwndEventBrowser->EnableDisplay(FALSE);
451 break;
452 default:
453 break;
454 }
455 m_dwClientState = dwCode;
456 break;
3bf7e95e
VK
457 case NXC_EVENT_NEW_ELOG_RECORD:
458 if (m_bEventBrowserActive)
459 m_pwndEventBrowser->AddEvent((NXC_EVENT *)pArg);
460 MemFree(pArg);
3bf7e95e 461 break;
89d4d2a2
VK
462 case NXC_EVENT_OBJECT_CHANGED:
463 ((CMainFrame *)m_pMainWnd)->PostMessage(WM_OBJECT_CHANGE, dwCode, (LPARAM)pArg);
464 break;
fadbdf37
VK
465 case NXC_EVENT_USER_DB_CHANGED:
466 ((CMainFrame *)m_pMainWnd)->PostMessage(WM_USERDB_CHANGE, dwCode, (LPARAM)pArg);
467 break;
3bf7e95e
VK
468 default:
469 break;
470 }
471}
a5f8f9b0 472
999bd324
VK
473
474//
475// Handler for WM_COMMAND(ID_CONTROLPANEL_EVENTS) message
476//
477
a5f8f9b0
VK
478void CConsoleApp::OnControlpanelEvents()
479{
480 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
481
482 // create a new MDI child window or open existing
483 if (m_bEventEditorActive)
484 m_pwndEventEditor->BringWindowToTop();
485 else
417924d6
VK
486 {
487 DWORD dwResult;
488
f7a7f8e4 489 dwResult = DoRequest(NXCOpenEventDB, "Opening event configuration database...");
417924d6
VK
490 if (dwResult == RCC_SUCCESS)
491 {
492 pFrame->CreateNewChild(
493 RUNTIME_CLASS(CEventEditor), IDR_EVENT_EDITOR, m_hMDIMenu, m_hMDIAccel);
494 }
495 else
496 {
497 char szBuffer[256];
498
499 sprintf(szBuffer, "Unable to open event configuration database:\n%s", NXCGetErrorText(dwResult));
500 GetMainWnd()->MessageBox(szBuffer, "Error", MB_ICONSTOP);
501 }
502 }
503}
504
505
506//
507// Handler for WM_COMMAND(ID_CONTROLPANEL_USERS) message
508//
509
510void CConsoleApp::OnControlpanelUsers()
511{
512 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
513
514 // create a new MDI child window or open existing
515 if (m_bUserEditorActive)
516 m_pwndUserEditor->BringWindowToTop();
517 else
518 {
519 DWORD dwResult;
520
f7a7f8e4 521 dwResult = DoRequest(NXCLockUserDB, "Locking user database...");
417924d6
VK
522 if (dwResult == RCC_SUCCESS)
523 {
524 pFrame->CreateNewChild(
cad81e33 525 RUNTIME_CLASS(CUserEditor), IDR_USER_EDITOR, m_hUserEditorMenu, m_hUserEditorAccel);
417924d6
VK
526 }
527 else
528 {
529 char szBuffer[256];
530
531 sprintf(szBuffer, "Unable to lock user database:\n%s", NXCGetErrorText(dwResult));
532 GetMainWnd()->MessageBox(szBuffer, "Error", MB_ICONSTOP);
533 }
534 }
a5f8f9b0
VK
535}
536
537
8e748b3e
VK
538//
539// Handler for WM_COMMAND::ID_VIEW_DEBUG message
540//
541
542void CConsoleApp::OnViewDebug()
543{
544 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
545
546 // create a new MDI child window or open existing
547 if (m_bDebugWindowActive)
548 m_pwndDebugWindow->BringWindowToTop();
549 else
550 pFrame->CreateNewChild(
551 RUNTIME_CLASS(CDebugFrame), IDR_DEBUG_WINDOW, m_hMDIMenu, m_hMDIAccel);
552}
89d4d2a2
VK
553
554
555//
556// Print debug information
557//
558
559void CConsoleApp::DebugPrintf(char *szFormat, ...)
560{
561 if (m_bDebugWindowActive)
562 {
563 char szBuffer[1024];
564 va_list args;
565
566 va_start(args, szFormat);
567 vsprintf(szBuffer, szFormat, args);
568 va_end(args);
569
570 m_pwndDebugWindow->AddMessage(szBuffer);
571 }
572}
2057008d
VK
573
574
575//
576// Edit properties of specific object
577//
578
579void CConsoleApp::ObjectProperties(DWORD dwObjectId)
580{
581 CObjectPropSheet wndPropSheet("Object Properties", GetMainWnd(), 0);
582 CNodePropsGeneral wndNodeGeneral;
8e2809bb 583 CObjectPropsGeneral wndObjectGeneral;
2057008d 584 CObjectPropCaps wndObjectCaps;
8e2809bb 585 CObjectPropsSecurity wndObjectSecurity;
2057008d
VK
586 NXC_OBJECT *pObject;
587 char szBuffer[32];
588
589 pObject = NXCFindObjectById(dwObjectId);
590 if (pObject != NULL)
591 {
592 // Create "General" tab
8e2809bb 593 if (pObject->iClass == OBJECT_NODE)
2057008d 594 {
8e2809bb
VK
595 wndNodeGeneral.m_dwObjectId = dwObjectId;
596 wndNodeGeneral.m_strName = pObject->szName;
597 wndNodeGeneral.m_strOID = pObject->node.szObjectId;
598 wndNodeGeneral.m_strPrimaryIp = IpToStr(pObject->dwIpAddr, szBuffer);
599 wndNodeGeneral.m_iAgentPort = (int)pObject->node.wAgentPort;
600 wndNodeGeneral.m_strCommunity = pObject->node.szCommunityString;
601 wndNodeGeneral.m_iAuthType = pObject->node.wAuthMethod;
602 wndNodeGeneral.m_strSecret = pObject->node.szSharedSecret;
603 wndPropSheet.AddPage(&wndNodeGeneral);
604 }
605 else
606 {
607 wndObjectGeneral.m_dwObjectId = dwObjectId;
608 wndObjectGeneral.m_strClass = g_szObjectClass[pObject->iClass];
609 wndObjectGeneral.m_strName = pObject->szName;
610 wndPropSheet.AddPage(&wndObjectGeneral);
2057008d
VK
611 }
612
613 // Create tabs specific for node objects
614 if (pObject->iClass == OBJECT_NODE)
615 {
616 // Create "Capabilities" tab
617 wndObjectCaps.m_pObject = pObject;
618 wndPropSheet.AddPage(&wndObjectCaps);
619 }
620
f6d9527a 621 // Create "Security" tab
8e2809bb
VK
622 wndObjectSecurity.m_pObject = pObject;
623 wndObjectSecurity.m_bInheritRights = pObject->bInheritRights;
624 wndPropSheet.AddPage(&wndObjectSecurity);
f6d9527a
VK
625
626 wndPropSheet.SetObject(pObject);
627 if (wndPropSheet.DoModal() == IDOK)
628 wndPropSheet.SaveObjectChanges();
2057008d
VK
629 }
630}
790cd256
VK
631
632
633//
634// Get context menu
635//
636
637CMenu *CConsoleApp::GetContextMenu(int iIndex)
638{
639 return m_ctxMenu.GetSubMenu(iIndex);
640}
946d48b3
VK
641
642
643//
644// Start data collection editor for specific object
645//
646
647void CConsoleApp::StartObjectDCEditor(NXC_OBJECT *pObject)
648{
649
650}
651
652
653//
654// Show network summary view
655//
656
657void CConsoleApp::OnViewNetworksummary()
658{
659 CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
660
661 // create a new MDI child window or open existing
662 if (m_bNetSummaryActive)
663 m_pwndNetSummary->BringWindowToTop();
664 else
665 pFrame->CreateNewChild(
666 RUNTIME_CLASS(CNetSummaryFrame), IDR_NETWORK_SUMMARY, m_hMDIMenu, m_hMDIAccel);
667}