- Implemented graph printing
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 14 Dec 2006 19:12:03 +0000 (19:12 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 14 Dec 2006 19:12:03 +0000 (19:12 +0000)
- Implemented "copy to clipboard" function for graphs

16 files changed:
ChangeLog
include/netxms-version.h
src/console/win32/Graph.cpp
src/console/win32/Graph.h
src/console/win32/GraphFrame.cpp
src/console/win32/GraphFrame.h
src/console/win32/ObjectBrowser.cpp
src/console/win32/ObjectBrowser.h
src/console/win32/ObjectView.cpp
src/console/win32/globals.h
src/console/win32/nxcon.clw
src/console/win32/nxcon.cpp
src/console/win32/nxcon.h
src/console/win32/nxcon.rc
src/console/win32/resource.h
src/console/win32/tools.cpp

index 52535e4..a3ee60a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
 - UPS subagent: added support for MICRODOWELL UPS devices
 - Windows console:
        - Object browser improved
+       - Graphs improved: implemented printing and "copy to clipboard"
+         function
 
 
 *
index dab81d4..9ee18d6 100644 (file)
@@ -31,7 +31,7 @@
 #define NETXMS_VERSION_MAJOR        0
 #define NETXMS_VERSION_MINOR        2
 #define NETXMS_VERSION_BUILD        15
-#define NETXMS_VERSION_STRING       _T("0.2.15-dev")
+#define NETXMS_VERSION_STRING       _T("0.2.15-rc1")
 
 
 //
index f73e6c3..12798ff 100644 (file)
@@ -138,7 +138,7 @@ BOOL CGraph::PreCreateWindow(CREATESTRUCT& cs)
 // WM_PAINT message handler
 //
 
-void CGraph::OnPaint() 
+void CGraph::OnPaint(void
 {
        CPaintDC sdc(this);  // original device context for painting
    CDC dc;              // In-memory dc
@@ -483,14 +483,13 @@ void CGraph::OnKillFocus(CWnd* pNewWnd)
       } \
    }
 
-void CGraph::DrawGraphOnBitmap()
+void CGraph::DrawGraphOnBitmap(CBitmap &bmpGraph, RECT &rect)
 {
    CDC *pdc, dc;           // Window dc and in-memory dc
    CBitmap *pOldBitmap;
    CPen pen, *pOldPen;
    CFont font, *pOldFont;
    CBrush brush, *pOldBrush;
-   RECT rect;
    CSize textSize;
    DWORD i, dwTimeStamp;
    int iLeftMargin, iBottomMargin, iRightMargin = 5, iTopMargin = 5;
@@ -504,17 +503,15 @@ void CGraph::DrawGraphOnBitmap()
                                       2678400, 2592000, 2678400, 2678400,
                                       2592000, 2678400, 2592000, 2678400 };
 
-   GetClientRect(&rect);
-
    // Create compatible DC and bitmap for painting
    pdc = GetDC();
    dc.CreateCompatibleDC(pdc);
-   m_bmpGraph.DeleteObject();
-   m_bmpGraph.CreateCompatibleBitmap(pdc, rect.right, rect.bottom);
+   bmpGraph.DeleteObject();
+   bmpGraph.CreateCompatibleBitmap(pdc, rect.right, rect.bottom);
    ReleaseDC(pdc);
 
    // Initial DC setup
-   pOldBitmap = dc.SelectObject(&m_bmpGraph);
+   pOldBitmap = dc.SelectObject(&bmpGraph);
    dc.SetBkColor(m_rgbBkColor);
 
    // Fill background
@@ -818,7 +815,10 @@ void CGraph::DrawGraphOnBitmap()
 
 void CGraph::Update()
 {
-   DrawGraphOnBitmap();
+   RECT rect;
+
+   GetClientRect(&rect);
+   DrawGraphOnBitmap(m_bmpGraph, rect);
    Invalidate(FALSE);
 }
 
@@ -829,7 +829,10 @@ void CGraph::Update()
 
 void CGraph::OnSize(UINT nType, int cx, int cy) 
 {
-   DrawGraphOnBitmap();
+   RECT rect;
+
+   GetClientRect(&rect);
+   DrawGraphOnBitmap(m_bmpGraph, rect);
        CWnd::OnSize(nType, cx, cy);
 }
 
index 01f4448..73adb1e 100644 (file)
@@ -54,6 +54,7 @@ public:
 
 // Implementation
 public:
+       void DrawGraphOnBitmap(CBitmap &bmpGraph, RECT &rect);
        void Update(void);
        BOOL m_bShowRuler;
        void SetData(DWORD dwIndex, NXC_DCI_DATA *pData);
@@ -70,7 +71,6 @@ protected:
        RECT m_rcSelection;
        int NextMonthOffset(DWORD dwTimeStamp);
        BOOL m_bIsActive;
-       void DrawGraphOnBitmap(void);
        CBitmap m_bmpGraph;
        CPoint m_ptCurrMousePos;
        //{{AFX_MSG(CGraph)
@@ -106,6 +106,7 @@ public:
        void ZoomOut(void);
        void ZoomIn(RECT &rect);
    void SetDCIInfo(DCIInfo **ppInfo) { m_ppItems = ppInfo; }
+   CBitmap *GetBitmap(void) { return &m_bmpGraph; }
 };
 
 /////////////////////////////////////////////////////////////////////////////
index e991b93..0c1f66b 100644 (file)
@@ -98,6 +98,8 @@ BEGIN_MESSAGE_MAP(CGraphFrame, CMDIChildWnd)
        ON_COMMAND(ID_GRAPH_PRESETS_LASTYEAR, OnGraphPresetsLastyear)
        ON_UPDATE_COMMAND_UI(ID_GRAPH_ZOOMOUT, OnUpdateGraphZoomout)
        ON_COMMAND(ID_GRAPH_ZOOMOUT, OnGraphZoomout)
+       ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
+       ON_COMMAND(ID_GRAPH_COPYTOCLIPBOARD, OnGraphCopytoclipboard)
        //}}AFX_MSG_MAP
    ON_MESSAGE(NXCM_GET_SAVE_INFO, OnGetSaveInfo)
    ON_MESSAGE(NXCM_UPDATE_GRAPH_POINT, OnUpdateGraphPoint)
@@ -720,3 +722,110 @@ void CGraphFrame::OnGraphZoomChange(WPARAM nZoomLevel, LPARAM lParam)
       m_wndStatusBar.SetIcon(2, NULL);
    }
 }
+
+
+//
+// WM_COMMAND::ID_FILE_PRINT message handler
+//
+
+void CGraphFrame::OnFilePrint() 
+{
+   CPrintDialog dlg(FALSE);
+   CDC dc;
+   HDC hdc;
+   DOCINFO docinfo;
+   RECT rect, rcGraph;
+   TCHAR szBuffer[1024];
+   int nLen, xmargin, ymargin;
+   double scale;
+   CBitmap bmp;
+
+   dlg.m_pd.hDevMode = CopyGlobalMem(theApp.GetDevMode());
+   dlg.m_pd.hDevNames = CopyGlobalMem(theApp.GetDevNames());
+   if (dlg.DoModal() == IDOK)
+   {
+      hdc = dlg.GetPrinterDC();
+      if (hdc == NULL)
+         return;
+
+      dc.Attach(hdc);
+      memset(&docinfo, 0, sizeof(DOCINFO));
+      docinfo.cbSize = sizeof(DOCINFO);
+      docinfo.lpszDocName = _T("NetXMS Graph");
+
+      if (dc.StartDoc(&docinfo) >= 0)
+      {
+         rect.left = 0;
+         rect.top = 0;
+         rect.right = dc.GetDeviceCaps(HORZRES);
+         rect.bottom = dc.GetDeviceCaps(VERTRES);
+         xmargin = rect.right * 10 / dc.GetDeviceCaps(HORZSIZE);  // 10mm margin
+         ymargin = rect.bottom * 10 / dc.GetDeviceCaps(VERTSIZE);  // 10mm margin
+         InflateRect(&rect, -xmargin * 2, -ymargin * 2);
+         if (dc.StartPage() >= 0)
+         {
+            // Print header
+            _sntprintf(szBuffer, 1024, _T("NetXMS History Graph - %s"), m_szSubTitle);
+            nLen = _tcslen(szBuffer);
+            dc.DrawText(szBuffer, nLen, &rect,
+                        DT_CENTER | DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_TOP);
+            rect.top += ymargin / 2 + dc.GetTextExtent(szBuffer, nLen).cy;
+
+            // Draw graph on in-memory bitmap and print it
+            memcpy(&rcGraph, &rect, sizeof(RECT));
+            OffsetRect(&rcGraph, -rcGraph.left, -rcGraph.top);
+            scale = max((double)rcGraph.right / 1024.0, (double)rcGraph.bottom / 1024.0);
+            if (scale > 0)
+            {
+               rcGraph.right = (LONG)((double)rcGraph.right / scale);
+               rcGraph.bottom = (LONG)((double)rcGraph.bottom / scale);
+            }
+            m_wndGraph.DrawGraphOnBitmap(bmp, rcGraph);
+            PrintBitmap(dc, bmp, &rect);
+
+            // Draw black frame around graph
+            InflateRect(&rect, xmargin / 4, ymargin / 4);
+            ::FrameRect(dc.m_hDC, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH));
+
+            dc.EndPage();
+         }
+         else
+         {
+            MessageBox(_T("Print error: cannot start page"), _T("Error"), MB_OK | MB_ICONSTOP);
+         }
+         dc.EndDoc();
+      }
+      else
+      {
+         MessageBox(_T("Print error: cannot start document"), _T("Error"), MB_OK | MB_ICONSTOP);
+      }
+   }
+
+   SafeGlobalFree(dlg.m_pd.hDevMode);
+   SafeGlobalFree(dlg.m_pd.hDevNames);
+}
+
+
+//
+// Handler for "Copy to clipboard" menu
+//
+
+void CGraphFrame::OnGraphCopytoclipboard() 
+{
+   if (OpenClipboard())
+   {
+      if (EmptyClipboard())
+      {
+         SetClipboardData(CF_BITMAP, m_wndGraph.GetBitmap()->GetSafeHandle());
+      }
+      else
+      {
+         MessageBox(_T("Cannot empty clipboard"), _T("Error"), MB_OK | MB_ICONSTOP);
+      }
+      CloseClipboard();
+   }
+   else
+   {
+      MessageBox(_T("Cannot open clipboard"), _T("Error"), MB_OK | MB_ICONSTOP);
+   }
+}
index 628a006..169853f 100644 (file)
@@ -100,6 +100,8 @@ protected:
        afx_msg void OnGraphPresetsLastyear();
        afx_msg void OnUpdateGraphZoomout(CCmdUI* pCmdUI);
        afx_msg void OnGraphZoomout();
+       afx_msg void OnFilePrint();
+       afx_msg void OnGraphCopytoclipboard();
        //}}AFX_MSG
    afx_msg LRESULT OnGetSaveInfo(WPARAM wParam, WINDOW_SAVE_INFO *pInfo);
    afx_msg void OnUpdateGraphPoint(DWORD dwTimeStamp, double *pdValue);
index fecc016..1bff922 100644 (file)
@@ -102,6 +102,7 @@ BEGIN_MESSAGE_MAP(CObjectBrowser, CMDIChildWnd)
    ON_NOTIFY(TVN_GETDISPINFO, AFX_IDW_PANE_FIRST, OnTreeViewGetDispInfo)
    ON_NOTIFY(TVN_ITEMEXPANDING, AFX_IDW_PANE_FIRST, OnTreeViewItemExpanding)
    ON_MESSAGE(NXCM_OBJECT_CHANGE, OnObjectChange)
+   ON_COMMAND_RANGE(OBJTOOL_MENU_FIRST_ID, OBJTOOL_MENU_LAST_ID, OnObjectTool)
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
@@ -1227,3 +1228,14 @@ void CObjectBrowser::OnAlarmUpdate(DWORD dwCode, NXC_ALARM *pAlarm)
 {
    m_wndObjectView.OnAlarmUpdate(dwCode, pAlarm);
 }
+
+
+//
+// Handler for object tools
+//
+
+void CObjectBrowser::OnObjectTool(UINT nID)
+{
+   if (m_pCurrentObject != NULL)
+      theApp.ExecuteObjectTool(m_pCurrentObject, nID - OBJTOOL_MENU_FIRST_ID);
+}
index 88adb48..fac530b 100644 (file)
@@ -125,6 +125,7 @@ protected:
    afx_msg void OnTreeViewGetDispInfo(LPNMTVDISPINFO lpdi, LRESULT *pResult);
    afx_msg void OnTreeViewItemExpanding(LPNMTREEVIEW lpnmt, LRESULT *pResult);
    afx_msg void OnObjectChange(WPARAM wParam, LPARAM lParam);
+   afx_msg void OnObjectTool(UINT nID);
        DECLARE_MESSAGE_MAP()
 };
 
index 2037fb7..76850da 100644 (file)
@@ -196,6 +196,7 @@ void CObjectView::SetCurrentObject(NXC_OBJECT *pObject)
          case OBJECT_CONTAINER:
          case OBJECT_SERVICEROOT:
             CreateTab(1, _T("Alarms"), 1, &m_wndAlarms);
+         case OBJECT_CONDITION:
             CreateTab(2, _T("Dependants"), 2, &m_wndDepView);
             break;
          default:
index 1c063c2..f7eabd6 100644 (file)
@@ -284,6 +284,13 @@ void DrawHeading(CDC &dc, TCHAR *pszText, CFont *pFont, RECT *pRect,
                  COLORREF rgbColor1, COLORREF rgbColor2);
 
 
+//
+// Printing functions
+//
+
+void PrintBitmap(CDC &dc, CBitmap &bitmap, RECT *pRect);
+
+
 //
 // Image and image list functions
 //
@@ -326,6 +333,7 @@ HTREEITEM FindTreeCtrlItem(CTreeCtrl &ctrl, HTREEITEM hRoot, TCHAR *pszText);
 HTREEITEM FindTreeCtrlItemEx(CTreeCtrl &ctrl, HTREEITEM hRoot, DWORD dwData);
 void SaveListCtrlColumns(CListCtrl &wndListCtrl, TCHAR *pszSection, TCHAR *pszPrefix);
 void LoadListCtrlColumns(CListCtrl &wndListCtrl, TCHAR *pszSection, TCHAR *pszPrefix);
+HGLOBAL CopyGlobalMem(HGLOBAL hSrc);
 
 
 //
@@ -412,4 +420,16 @@ inline void UnlockActions(void)
    ReleaseMutex(g_mutexActionListAccess);
 }
 
+
+//
+// Utility inline functions
+//
+
+inline void SafeGlobalFree(HGLOBAL hMem)
+{
+   if (hMem != NULL)
+      GlobalFree(hMem);
+}
+
+
 #endif
index 9dbfc21..45b961c 100644 (file)
@@ -17,20 +17,20 @@ Class9=CMapView
 
 ResourceCount=185
 Resource1=IDD_CP_GENERAL (English (U.S.))
-Resource2=IDD_OBJECT_COND_GENERAL
+Resource2=IDD_NEW_OBJECT_TOOL
 Resource3=IDD_DCI_DATA_EXPORT (English (U.S.))
-Resource4=IDA_PACKAGE_MGR
-Resource5=IDD_DISCOVERY_RANGES
+Resource4=IDA_MDI_DEFAULT
+Resource5=IDD_OBJECT_COND_GENERAL
 Class2=CChildView
 Class5=CAboutDlg
 Class6=CControlPanel
 Class8=CMapFrame
 Class10=CLoginDialog
-Resource6=IDD_OBJECT_NODE_POLL
+Resource6=IDD_CREATE_TEMPLATE
 Class11=CProgressDialog
-Resource7=IDD_ACTION_PROPERTIES
+Resource7=IDD_MIB_BROWSER
 Class12=CAddrEntryDlg
-Resource8=IDD_CHANGE_PASSWORD
+Resource8=IDD_OBJTOOL_GENERAL
 Class13=CObjectPropDlg
 Resource9=IDD_THRESHOLD (English (U.S.))
 Resource10=IDD_SELECT_OBJECT (English (U.S.))
@@ -46,45 +46,45 @@ Resource17=IDD_NEW_USER (English (U.S.))
 Class16=CDebugFrame
 Resource18=IDD_NEW_ACTION (English (U.S.))
 Resource19=IDD_OBJECT_PROPERTIES (English (U.S.))
-Resource20=IDD_ADD_DCI
+Resource20=IDD_REMOVE_TEMPLATE
 Class17=CObjectPreview
 Resource21=IDA_OBJECT_BROWSER (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDA_SCRIPT_MANAGER
+Resource22=IDA_ACTION_EDITOR
 Class21=CEditBox
 Class22=COPGeneral
 Class23=CNodePropsGeneral
 Resource23=IDD_GRAPH_PROPERTIES (English (U.S.))
 Class24=CObjectPropCaps
 Class25=CObjectPropSheet
-Resource24=IDD_AGENT_CONFIG
+Resource24=IDD_SNMP_WALK
 Class26=CRequestProcessingDlg
 Resource25=IDD_SELECT_USER (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
-Resource27=IDA_OBJECT_TOOLS_EDITOR
+Resource27=IDA_EVENT_EDITOR
 Resource28=IDD_DCI_COLLECTION (English (U.S.))
 Class27=CObjectPropsGeneral
 Resource29=IDR_MAINFRAME (English (U.S.))
 Class28=CObjectPropsSecurity
 Resource30=IDD_SAVE_AGENT_CFG (English (U.S.))
-Resource31=IDD_SELECT_OBJECT
-Resource32=IDA_LAST_VALUES
+Resource31=IDD_SELECT_USER
+Resource32=IDA_OBJECT_BROWSER
 Class29=CUserSelectDlg
-Resource33=IDA_EVENT_EDITOR
+Resource33=IDD_DISCOVERY_TARGETS
 Class30=CUserEditor
 Resource34=IDD_DCI_PROPERTIES
 Class31=CNewUserDlg
-Resource35=IDD_EDIT_RULE_SCRIPT
-Resource36=IDA_DC_EDITOR
+Resource35=IDD_SUBMAP_BKGND
+Resource36=IDA_NETMAP
 Class32=CUserPropDlg
 Resource37=IDD_EDIT_VARIABLE (English (U.S.))
-Resource38=IDA_AGENT_CFG_EDITOR
+Resource38=IDA_ALARM_BROWSER
 Class33=CGroupPropDlg
-Resource39=IDD_OBJECT_GENERAL
-Resource40=IDD_CREATE_NODE
-Resource41=IDD_GROUP_PROPERTIES
+Resource39=IDA_OBJECT_TOOLS_EDITOR
+Resource40=IDD_SELECT_EVENT
+Resource41=IDD_EDIT_EVENT
 Resource42=IDA_ACTION_EDITOR (English (U.S.))
 Class34=CPasswordChangeDlg
 Class35=CNodeSummary
@@ -100,55 +100,55 @@ Class41=CGraphFrame
 Class42=CDCIThresholdsPage
 Resource46=IDA_OBJECT_TOOLS_EDITOR (English (U.S.))
 Resource47=IDM_CONTEXT (English (U.S.))
-Resource48=IDA_EPP
+Resource48=IDD_AGENT_CONFIG
 Class43=CThresholdDlg
 Resource49=IDD_DESKTOP_SAVE_AS (English (U.S.))
-Resource50=IDD_DESKTOP_SAVE_AS
+Resource50=IDD_EDIT_TRAP
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
 Resource51=IDD_SELECT_AGENT_PARAM (English (U.S.))
-Resource52=IDD_CREATE_NETSRV
+Resource52=IDD_DCI_TRANSFORM
 Class48=CObjectSelDlg
-Resource53=IDA_ALARM_BROWSER
-Resource54=IDD_DCI_SCHEDULE
+Resource53=IDD_EDIT_RULE_SCRIPT
+Resource54=IDD_GRAPH_PROP_SETTINGS
 Class49=CRuleCommentDlg
-Resource55=IDD_DCI_THRESHOLDS
+Resource55=IDD_REQUEST_PROCESSING
 Class50=CEventSelDlg
-Resource56=IDD_OBJTOOL_OPTIONS
+Resource56=IDD_EDIT_VARIABLE
 Resource57=IDA_EPP (English (U.S.))
-Resource58=IDD_GRAPH_PROP_SETTINGS
+Resource58=IDD_EDIT_TRAP_ARG
 Resource59=IDA_PACKAGE_MGR (English (U.S.))
 Resource60=IDD_OBJTOOL_GENERAL (English (U.S.))
 Class51=CObjectPropsPresentation
 Resource61=IDD_CREATE_TEMPLATE (English (U.S.))
-Resource62=IDA_TRAP_EDITOR
+Resource62=IDD_ADDR_ENTRY
 Class52=CRuleSeverityDlg
-Resource63=IDD_REQUEST_PROCESSING
+Resource63=IDA_DC_EDITOR
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
 Resource64=IDA_MDI_DEFAULT (English (U.S.))
-Resource65=IDD_OBJECT_NETSRV_GENERAL
+Resource65=IDD_CREATE_TG
 Resource66=IDD_EDIT_IP_SUBNET (English (U.S.))
 Resource67=IDD_EDIT_RULE_SEVERITY (English (U.S.))
 Resource68=IDD_ACTION_PROPERTIES (English (U.S.))
 Class55=CConsolePropsGeneral
 Class56=CActionEditor
-Resource69=IDD_GRAPH_PROP_DATA
-Resource70=IDD_DCI_DATA_EXPORT
+Resource69=IDD_SELECT_INTERNAL_ITEM
+Resource70=IDD_INPUT_BOX
 Class57=CNewActionDlg
-Resource71=IDD_SELECT_AGENT_PARAM
+Resource71=IDD_CREATE_CONTAINER
 Class58=CEditActionDlg
-Resource72=IDD_NEW_OBJECT_TOOL
+Resource72=IDD_DCI_DATA_EXPORT
 Class59=CActionSelDlg
-Resource73=IDD_OBJECT_RELATIONS
+Resource73=IDD_DATA_QUERY
 Resource74=IDD_EDIT_TRAP (English (U.S.))
 Resource75=IDD_USER_PROPERTIES (English (U.S.))
-Resource76=IDD_SELECT_INTERNAL_ITEM
+Resource76=IDD_SELECT_ACTION
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
-Resource77=IDA_ACTION_EDITOR
+Resource77=IDD_DISCOVERY_RANGES
 Class62=CCreateNodeDlg
 Resource78=IDD_OBJECT_NODE_GENERAL (English (U.S.))
 Resource79=IDT_MAP (English (U.S.))
@@ -158,31 +158,31 @@ Resource81=IDD_LASTVAL_PROP (English (U.S.))
 Class64=CPollNodeDlg
 Resource82=IDD_POLL_NODE (English (U.S.))
 Class65=CNodePoller
-Resource83=IDD_OBJECT_CAPS
-Resource84=IDD_DISCOVERY_GENERAL
+Resource83=IDA_AGENT_CFG_EDITOR
+Resource84=IDD_CHANGE_PASSWORD
 Class66=CCreateTemplateDlg
 Class67=CCreateTGDlg
-Resource85=IDD_LASTVAL_PROP
-Resource86=IDD_DCI_COLLECTION
+Resource85=IDD_SELECT_AGENT_PARAM
+Resource86=IDD_OBJECT_CAPS
 Class68=CTrapEditor
-Resource87=IDD_OBJECT_COND_SCRIPT
-Resource88=IDD_SNMP_WALK
-Resource89=IDD_OBJECT_STATUS
+Resource87=IDD_OBJTOOL_OPTIONS
+Resource88=IDD_SAVE_AGENT_CFG
+Resource89=IDD_GRAPH_PROP_DATA
 Class69=CDataQueryDlg
-Resource90=IDD_OBJTOOL_GENERAL
+Resource90=IDD_LASTVAL_PROP
 Class70=CTrapEditDlg
 Resource91=IDM_VIEW_SPECIFIC (English (U.S.))
 Class71=CTrapParamDlg
-Resource92=IDD_SAVE_AGENT_CFG
-Resource93=IDD_EDIT_TRAP
+Resource92=IDD_DESKTOP_SAVE_AS
+Resource93=IDD_NEW_ACTION
 Class72=CGraphPropDlg
 Class73=CColorSelector
 Class74=CPackageMgr
-Resource94=IDD_SUBMAP_BKGND
+Resource94=IDD_DCI_SCHEDULE
 Resource95=IDA_SCRIPT_MANAGER (English (U.S.))
 Resource96=IDD_SET_PASSWORD (English (U.S.))
 Resource97=IDD_DCI_TRANSFORM (English (U.S.))
-Resource98=IDD_EDIT_RULE_COMMENT
+Resource98=IDD_NEW_USER
 Resource99=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
 Resource100=IDD_OBJTOOL_OPTIONS (English (U.S.))
 Resource101=IDA_LAST_VALUES (English (U.S.))
@@ -244,7 +244,7 @@ Class102=CWaitView
 Class103=CWebBrowser
 Class104=CSyslogBrowser
 Class105=CLPPList
-Resource129=IDD_OBJECT_COND_DATA
+Resource129=IDD_CHANGE_IP
 Class106=CDCISchedulePage
 Resource130=IDD_OBJECT_CAPS (English (U.S.))
 Class107=CObjectPropsStatus
@@ -270,71 +270,71 @@ Class119=CMapControlBox
 Resource138=IDD_OBJECT_GENERAL (English (U.S.))
 Class120=CSubmapBkgndDlg
 Resource139=IDD_SUBMAP_BKGND (English (U.S.))
-Resource140=IDD_CREATE_CONTAINER
-Resource141=IDD_THRESHOLD
-Resource142=IDA_MDI_DEFAULT
+Resource140=IDD_EDIT_RULE_COMMENT
+Resource141=IDD_OBJECT_GENERAL
+Resource142=IDD_ADD_DCI
 Resource143=IDM_CONTEXT
-Resource144=IDA_AGENT_CONFIG_MANAGER
-Resource145=IDA_SERVER_CFG_EDITOR
-Resource146=IDD_CREATE_TG
-Resource147=IDD_EDIT_TRAP_ARG
-Resource148=IDM_VIEW_SPECIFIC
-Resource149=IDD_DATA_QUERY
-Resource150=IDD_EDIT_RULE_SEVERITY
-Resource151=IDD_CP_GENERAL
-Resource152=IDD_INPUT_BOX
-Resource153=IDA_NETMAP
-Resource154=IDD_OBJECT_VPNC_GENERAL
-Resource155=IDD_DISCOVERY_TARGETS
-Resource156=IDD_NEW_USER
-Resource157=IDD_CREATE_TEMPLATE
+Resource144=IDA_GRAPH
+Resource145=IDA_EPP
+Resource146=IDD_EDIT_RULE_SEVERITY
+Resource147=IDD_ACTION_PROPERTIES
+Resource148=IDD_OBJECT_STATUS
+Resource149=IDD_CP_GENERAL
+Resource150=IDD_SET_PASSWORD
+Resource151=IDD_DCI_THRESHOLDS
+Resource152=IDD_CREATE_NODE
+Resource153=IDD_DISCOVERY_GENERAL
+Resource154=IDD_OBJECT_NODE_POLL
+Resource155=IDD_CREATE_CONDITION
+Resource156=IDA_AGENT_CONFIG_MANAGER
+Resource157=IDD_EDIT_RULE_ALARM
 Resource158=IDD_USER_PROPERTIES
-Resource159=IDD_CREATE_CONDITION
-Resource160=IDR_MAINFRAME
-Resource161=IDD_EDIT_VARIABLE
-Resource162=IDD_EDIT_RULE_ALARM
-Resource163=IDD_CHANGE_IP
-Resource164=IDD_OBJECT_NODE_GENERAL
-Resource165=IDD_EDIT_EVENT
-Resource166=IDD_SELECT_USER
-Resource167=IDD_REMOVE_TEMPLATE
-Resource168=IDD_MIB_BROWSER
-Resource169=IDD_SELECT_ACTION
-Resource170=IDA_OBJECT_BROWSER
-Resource171=IDD_DCI_TRANSFORM
+Resource159=IDM_VIEW_SPECIFIC
+Resource160=IDD_OBJECT_COND_DATA
+Resource161=IDD_CREATE_NETSRV
+Resource162=IDD_DCI_COLLECTION
+Resource163=IDD_CREATE_VPNC
+Resource164=IDA_SERVER_CFG_EDITOR
+Resource165=IDA_LAST_VALUES
+Resource166=IDA_DATA_VIEW
+Resource167=IDD_OBJECT_VPNC_GENERAL
+Resource168=IDD_OBJECT_SECURITY
+Resource169=IDD_SELECT_OBJECT
+Resource170=IDD_COND_DCI_PROP
+Resource171=IDD_OBJECT_PRESENTATION
 Class121=CModuleManager
 Class122=CDesktopManager
-Resource172=IDD_CREATE_VPNC
-Resource173=IDD_SET_PASSWORD
+Resource172=IDD_OBJECT_NETSRV_GENERAL
+Resource173=IDD_OBJECT_NODE_GENERAL
 Class123=CCreateCondDlg
 Class124=CCondPropsGeneral
 Class125=CCondPropsScript
 Class126=CCondPropsData
-Resource174=IDA_GRAPH
+Resource174=IDR_MAINFRAME
 Class127=CAddDCIDlg
-Resource175=IDD_NEW_ACTION
+Resource175=IDD_THRESHOLD
 Class128=CCondDCIPropDlg
-Resource176=IDD_OBJECT_PRESENTATION
+Resource176=IDD_GROUP_PROPERTIES
 Class129=CAgentConfigMgr
-Resource177=IDD_COND_DCI_PROP
-Resource178=IDD_ABOUTBOX
+Resource177=IDD_OBJTOOL_COLUMNS
+Resource178=IDA_PACKAGE_MGR
 Class130=CAgentCfgDlg
 Class131=CObjectCommentsEditor
-Resource179=IDA_DATA_VIEW
+Resource179=IDA_TRAP_EDITOR
 Class132=CRuleScriptDlg
 Class133=CDetailsView
-Resource180=IDD_SELECT_EVENT
+Resource180=IDD_ABOUTBOX
 Class134=CDiscoveryPropGeneral
-Resource181=IDD_ADDR_ENTRY
+Resource181=IDD_OBJECT_COND_SCRIPT
 Class135=CDiscoveryPropTargets
-Resource182=IDD_OBJECT_SECURITY
+Resource182=IDA_SCRIPT_MANAGER
 Class136=CDiscoveryPropAddrList
-Resource183=IDD_EDIT_IP_SUBNET
+Resource183=IDD_OBJECT_RELATIONS
 Class138=CObjectView
 Class139=CObjectOverview
 Class140=CAlarmView
 Class141=CObjectDepView
-Resource184=IDD_OBJTOOL_COLUMNS
+Resource184=IDD_EDIT_IP_SUBNET
 Class137=CObjectBrowser
 Class142=CCreateMPDlg
 Resource185=IDD_CREATE_MP
@@ -417,19 +417,9 @@ Command24=ID_TOOLS_MIBBROWSER
 Command25=ID_TOOLS_SNMPWALK
 Command26=ID_TOOLS_CHANGEPASSWORD
 Command27=ID_TOOLS_CREATEMP
-Command28=ID_APP_ABOUT
-CommandCount=28
-
-[TB:IDR_MAINFRAME]
-Type=1
-Class=CMainFrame
-Command1=ID_FILE_NEW
-Command2=ID_EDIT_CUT
-Command3=ID_EDIT_COPY
-Command4=ID_EDIT_PASTE
-Command5=ID_FILE_PRINT
-Command6=ID_APP_ABOUT
-CommandCount=6
+Command28=ID_TOOLS_IMPORTMP
+Command29=ID_APP_ABOUT
+CommandCount=29
 
 [ACL:IDR_MAINFRAME]
 Type=1
@@ -870,65 +860,67 @@ Command130=ID_GRAPH_PRESETS_LASTYEAR
 Command131=ID_GRAPH_AUTOSCALE
 Command132=ID_GRAPH_LEGEND
 Command133=ID_GRAPH_RULER
-Command134=ID_GRAPH_ZOOMOUT
-Command135=ID_GRAPH_PROPERTIES
-Command136=ID_PACKAGE_INSTALL
-Command137=ID_PACKAGE_REMOVE
-Command138=ID_PACKAGE_DEPLOY
-Command139=ID_ITEM_SHOWDATA
-Command140=ID_ITEM_GRAPH
-Command141=ID_ITEM_EXPORTDATA
-Command142=ID_LASTVALUES_PROPERTIES
-Command143=ID_VARIABLE_NEW
-Command144=ID_VARIABLE_EDIT
-Command145=ID_VARIABLE_DELETE
-Command146=ID_EDIT_UNDO
-Command147=ID_EDIT_REDO
-Command148=ID_EDIT_CUT
-Command149=ID_EDIT_COPY
-Command150=ID_EDIT_PASTE
-Command151=ID_EDIT_DELETE
-Command152=ID_EDIT_SELECT_ALL
-Command153=ID_CONFIG_SAVE
-Command154=ID_CONFIG_SAVEANDAPPLY
-Command155=ID_OBJECTTOOLS_NEW
-Command156=ID_OBJECTTOOLS_EDIT
-Command157=ID_OBJECTTOOLS_DELETE
-Command158=ID_SCRIPT_NEW
-Command159=ID_SCRIPT_EDIT
-Command160=ID_SCRIPT_SAVE
-Command161=ID_SCRIPT_RENAME
-Command162=ID_SCRIPT_DELETE
-Command163=ID_SCRIPT_VIEWASLIST
-Command164=ID_SCRIPT_VIEWASTREE
-Command165=ID_MAP_BACK
-Command166=ID_MAP_FORWARD
-Command167=ID_MAP_HOME
-Command168=ID_MAP_PARENT
-Command169=ID_MAP_ZOOMIN
-Command170=ID_MAP_ZOOMOUT
-Command171=ID_MAP_SHOW_TOOLBOX
-Command172=ID_MAP_SHOW_TOOLBAR
-Command173=ID_MAP_SHOW_STATUSBAR
-Command174=ID_MAP_SAVE
-Command175=ID_MAP_REDOLAYOUT
-Command176=ID_MAP_SETBACKGROUND
-Command177=ID_DATA_SCALEVALUE
-Command178=ID_DATA_SCALE_NORMAL
-Command179=ID_DATA_SCALE_KBYTES
-Command180=ID_DATA_SCALE_KILO
-Command181=ID_DATA_SCALE_MBYTES
-Command182=ID_DATA_SCALE_MEGA
-Command183=ID_DATA_SCALE_GBYTES
-Command184=ID_DATA_SCALE_GIGA
-Command185=ID_DATA_COPYTOCLIPBOARD
-Command186=ID_CONFIG_NEW
-Command187=ID_CONFIG_EDIT
-Command188=ID_CONFIG_DELETE
-Command189=ID_CONFIG_MOVEUP
-Command190=ID_CONFIG_MOVEDOWN
-Command191=ID_COMMENTS_SAVE
-CommandCount=191
+Command134=ID_FILE_PRINT
+Command135=ID_GRAPH_COPYTOCLIPBOARD
+Command136=ID_GRAPH_ZOOMOUT
+Command137=ID_GRAPH_PROPERTIES
+Command138=ID_PACKAGE_INSTALL
+Command139=ID_PACKAGE_REMOVE
+Command140=ID_PACKAGE_DEPLOY
+Command141=ID_ITEM_SHOWDATA
+Command142=ID_ITEM_GRAPH
+Command143=ID_ITEM_EXPORTDATA
+Command144=ID_LASTVALUES_PROPERTIES
+Command145=ID_VARIABLE_NEW
+Command146=ID_VARIABLE_EDIT
+Command147=ID_VARIABLE_DELETE
+Command148=ID_EDIT_UNDO
+Command149=ID_EDIT_REDO
+Command150=ID_EDIT_CUT
+Command151=ID_EDIT_COPY
+Command152=ID_EDIT_PASTE
+Command153=ID_EDIT_DELETE
+Command154=ID_EDIT_SELECT_ALL
+Command155=ID_CONFIG_SAVE
+Command156=ID_CONFIG_SAVEANDAPPLY
+Command157=ID_OBJECTTOOLS_NEW
+Command158=ID_OBJECTTOOLS_EDIT
+Command159=ID_OBJECTTOOLS_DELETE
+Command160=ID_SCRIPT_NEW
+Command161=ID_SCRIPT_EDIT
+Command162=ID_SCRIPT_SAVE
+Command163=ID_SCRIPT_RENAME
+Command164=ID_SCRIPT_DELETE
+Command165=ID_SCRIPT_VIEWASLIST
+Command166=ID_SCRIPT_VIEWASTREE
+Command167=ID_MAP_BACK
+Command168=ID_MAP_FORWARD
+Command169=ID_MAP_HOME
+Command170=ID_MAP_PARENT
+Command171=ID_MAP_ZOOMIN
+Command172=ID_MAP_ZOOMOUT
+Command173=ID_MAP_SHOW_TOOLBOX
+Command174=ID_MAP_SHOW_TOOLBAR
+Command175=ID_MAP_SHOW_STATUSBAR
+Command176=ID_MAP_SAVE
+Command177=ID_MAP_REDOLAYOUT
+Command178=ID_MAP_SETBACKGROUND
+Command179=ID_DATA_SCALEVALUE
+Command180=ID_DATA_SCALE_NORMAL
+Command181=ID_DATA_SCALE_KBYTES
+Command182=ID_DATA_SCALE_KILO
+Command183=ID_DATA_SCALE_MBYTES
+Command184=ID_DATA_SCALE_MEGA
+Command185=ID_DATA_SCALE_GBYTES
+Command186=ID_DATA_SCALE_GIGA
+Command187=ID_DATA_COPYTOCLIPBOARD
+Command188=ID_CONFIG_NEW
+Command189=ID_CONFIG_EDIT
+Command190=ID_CONFIG_DELETE
+Command191=ID_CONFIG_MOVEUP
+Command192=ID_CONFIG_MOVEDOWN
+Command193=ID_COMMENTS_SAVE
+CommandCount=193
 
 [ACL:IDA_MDI_DEFAULT]
 Type=1
@@ -1748,55 +1740,57 @@ Command117=ID_GRAPH_PRESETS_LASTYEAR
 Command118=ID_GRAPH_AUTOSCALE
 Command119=ID_GRAPH_LEGEND
 Command120=ID_GRAPH_RULER
-Command121=ID_GRAPH_ZOOMOUT
-Command122=ID_GRAPH_PROPERTIES
-Command123=ID_PACKAGE_INSTALL
-Command124=ID_PACKAGE_REMOVE
-Command125=ID_PACKAGE_DEPLOY
-Command126=ID_ITEM_SHOWDATA
-Command127=ID_ITEM_GRAPH
-Command128=ID_ITEM_EXPORTDATA
-Command129=ID_LASTVALUES_PROPERTIES
-Command130=ID_VARIABLE_NEW
-Command131=ID_VARIABLE_EDIT
-Command132=ID_VARIABLE_DELETE
-Command133=ID_EDIT_UNDO
-Command134=ID_EDIT_REDO
-Command135=ID_EDIT_CUT
-Command136=ID_EDIT_COPY
-Command137=ID_EDIT_PASTE
-Command138=ID_EDIT_DELETE
-Command139=ID_EDIT_SELECT_ALL
-Command140=ID_CONFIG_SAVE
-Command141=ID_CONFIG_SAVEANDAPPLY
-Command142=ID_OBJECTTOOLS_NEW
-Command143=ID_OBJECTTOOLS_EDIT
-Command144=ID_OBJECTTOOLS_DELETE
-Command145=ID_SCRIPT_NEW
-Command146=ID_SCRIPT_EDIT
-Command147=ID_SCRIPT_SAVE
-Command148=ID_SCRIPT_RENAME
-Command149=ID_SCRIPT_DELETE
-Command150=ID_SCRIPT_VIEWASLIST
-Command151=ID_SCRIPT_VIEWASTREE
-Command152=ID_DESKTOP_COPY
-Command153=ID_DESKTOP_MOVE
-Command154=ID_DESKTOP_DELETE
-Command155=ID_DATA_SCALEVALUE
-Command156=ID_DATA_SCALE_NORMAL
-Command157=ID_DATA_SCALE_KBYTES
-Command158=ID_DATA_SCALE_KILO
-Command159=ID_DATA_SCALE_MBYTES
-Command160=ID_DATA_SCALE_MEGA
-Command161=ID_DATA_SCALE_GBYTES
-Command162=ID_DATA_SCALE_GIGA
-Command163=ID_DATA_COPYTOCLIPBOARD
-Command164=ID_CONFIG_NEW
-Command165=ID_CONFIG_EDIT
-Command166=ID_CONFIG_DELETE
-Command167=ID_CONFIG_MOVEUP
-Command168=ID_CONFIG_MOVEDOWN
-CommandCount=168
+Command121=ID_FILE_PRINT
+Command122=ID_GRAPH_COPYTOCLIPBOARD
+Command123=ID_GRAPH_ZOOMOUT
+Command124=ID_GRAPH_PROPERTIES
+Command125=ID_PACKAGE_INSTALL
+Command126=ID_PACKAGE_REMOVE
+Command127=ID_PACKAGE_DEPLOY
+Command128=ID_ITEM_SHOWDATA
+Command129=ID_ITEM_GRAPH
+Command130=ID_ITEM_EXPORTDATA
+Command131=ID_LASTVALUES_PROPERTIES
+Command132=ID_VARIABLE_NEW
+Command133=ID_VARIABLE_EDIT
+Command134=ID_VARIABLE_DELETE
+Command135=ID_EDIT_UNDO
+Command136=ID_EDIT_REDO
+Command137=ID_EDIT_CUT
+Command138=ID_EDIT_COPY
+Command139=ID_EDIT_PASTE
+Command140=ID_EDIT_DELETE
+Command141=ID_EDIT_SELECT_ALL
+Command142=ID_CONFIG_SAVE
+Command143=ID_CONFIG_SAVEANDAPPLY
+Command144=ID_OBJECTTOOLS_NEW
+Command145=ID_OBJECTTOOLS_EDIT
+Command146=ID_OBJECTTOOLS_DELETE
+Command147=ID_SCRIPT_NEW
+Command148=ID_SCRIPT_EDIT
+Command149=ID_SCRIPT_SAVE
+Command150=ID_SCRIPT_RENAME
+Command151=ID_SCRIPT_DELETE
+Command152=ID_SCRIPT_VIEWASLIST
+Command153=ID_SCRIPT_VIEWASTREE
+Command154=ID_DESKTOP_COPY
+Command155=ID_DESKTOP_MOVE
+Command156=ID_DESKTOP_DELETE
+Command157=ID_DATA_SCALEVALUE
+Command158=ID_DATA_SCALE_NORMAL
+Command159=ID_DATA_SCALE_KBYTES
+Command160=ID_DATA_SCALE_KILO
+Command161=ID_DATA_SCALE_MBYTES
+Command162=ID_DATA_SCALE_MEGA
+Command163=ID_DATA_SCALE_GBYTES
+Command164=ID_DATA_SCALE_GIGA
+Command165=ID_DATA_COPYTOCLIPBOARD
+Command166=ID_CONFIG_NEW
+Command167=ID_CONFIG_EDIT
+Command168=ID_CONFIG_DELETE
+Command169=ID_CONFIG_MOVEUP
+Command170=ID_CONFIG_MOVEDOWN
+CommandCount=170
 
 [MNU:IDM_CONTEXT (English (U.S.))]
 Type=1
@@ -3009,10 +3003,11 @@ VirtualFilter=dWC
 Type=1
 Class=?
 Command1=ID_GRAPH_AUTOSCALE
-Command2=ID_GRAPH_PROPERTIES
-Command3=ID_GRAPH_RULER
-Command4=ID_GRAPH_ZOOMOUT
-CommandCount=4
+Command2=ID_GRAPH_COPYTOCLIPBOARD
+Command3=ID_GRAPH_PROPERTIES
+Command4=ID_GRAPH_RULER
+Command5=ID_GRAPH_ZOOMOUT
+CommandCount=5
 
 [CLS:CGraphPropDlg]
 Type=0
index 0ae7ab1..76861bc 100644 (file)
@@ -122,6 +122,7 @@ BEGIN_MESSAGE_MAP(CConsoleApp, CWinApp)
        ON_COMMAND(ID_CONTROLPANEL_AGENTCONFIGS, OnControlpanelAgentconfigs)
        ON_COMMAND(ID_CONTROLPANEL_NETWORKDISCOVERY, OnControlpanelNetworkdiscovery)
        ON_COMMAND(ID_TOOLS_CREATEMP, OnToolsCreatemp)
+       ON_COMMAND(ID_FILE_PAGESETUP, OnFilePagesetup)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
@@ -139,6 +140,8 @@ CConsoleApp::CConsoleApp()
    m_dwNumAlarms = 0;
    m_pAlarmList = NULL;
    m_mutexAlarmList = MutexCreate();
+   m_hDevMode = NULL;
+   m_hDevNames = NULL;
 }
 
 
@@ -150,6 +153,8 @@ CConsoleApp::~CConsoleApp()
 {
    safe_free(m_pAlarmList);
    MutexDestroy(m_mutexAlarmList);
+   SafeGlobalFree(m_hDevMode);
+   SafeGlobalFree(m_hDevNames);
 }
 
 
@@ -279,6 +284,8 @@ BOOL CConsoleApp::InitInstance()
    _tcscpy(g_szServer, (LPCTSTR)GetProfileString(_T("Connection"), _T("Server"), _T("localhost")));
    _tcscpy(g_szLogin, (LPCTSTR)GetProfileString(_T("Connection"), _T("Login"), NULL));
    LoadAlarmSoundCfg(&g_soundCfg, NXCON_ALARM_SOUND_KEY);
+   m_hDevMode = GetProfileGMem(_T("Printer"), _T("DevMode"));
+   m_hDevNames = GetProfileGMem(_T("Printer"), _T("DevNames"));
 
    // Check if we are upgrading
    nVer = GetProfileInt(_T("General"), _T("CfgVersion"), 0);
@@ -3257,3 +3264,68 @@ void CConsoleApp::OnToolsCreatemp()
       ErrorBox(dwResult, _T("Cannot create management pack: %s"));
    }
 }
+
+
+//
+// "File -> Page Setup..." menu handler
+//
+
+void CConsoleApp::OnFilePagesetup() 
+{
+   CPrintDialog dlg(TRUE);
+
+   dlg.m_pd.hDevMode = CopyGlobalMem(m_hDevMode);
+   dlg.m_pd.hDevNames = CopyGlobalMem(m_hDevNames);
+
+   if (dlg.DoModal() == IDOK)
+   {
+      SafeGlobalFree(m_hDevMode);
+      SafeGlobalFree(m_hDevNames);
+      m_hDevMode = CopyGlobalMem(dlg.m_pd.hDevMode);
+      m_hDevNames = CopyGlobalMem(dlg.m_pd.hDevNames);
+      WriteProfileGMem(_T("Printer"), _T("DevMode"), m_hDevMode);
+      WriteProfileGMem(_T("Printer"), _T("DevNames"), m_hDevNames);
+   }
+
+   SafeGlobalFree(dlg.m_pd.hDevMode);
+   SafeGlobalFree(dlg.m_pd.hDevNames);
+}
+
+
+//
+// Write global memory block to registry
+//
+
+void CConsoleApp::WriteProfileGMem(TCHAR *pszSection, TCHAR *pszKey, HGLOBAL hMem)
+{
+   void *p;
+
+   p = GlobalLock(hMem);
+   WriteProfileBinary(pszSection, pszKey, (BYTE *)p, GlobalSize(hMem));
+   GlobalUnlock(hMem);
+}
+
+
+//
+// Read global memory block from registry
+//
+
+HGLOBAL CConsoleApp::GetProfileGMem(TCHAR *pszSection, TCHAR *pszKey)
+{
+   BYTE *pData, *pMem;
+   UINT nSize;
+   HGLOBAL hMem = NULL;
+
+   if (GetProfileBinary(pszSection, pszKey, &pData, &nSize))
+   {
+      hMem = GlobalAlloc(GMEM_MOVEABLE, nSize);
+      if (hMem != NULL)
+      {
+         pMem = (BYTE *)GlobalLock(hMem);
+         CopyMemory(pMem, pData, nSize);
+         GlobalUnlock(hMem);
+      }
+      delete pData;
+   }
+   return hMem;
+}
index f3ccaa9..95725ea 100644 (file)
@@ -156,6 +156,8 @@ public:
 
 // Implementation
 protected:
+       HGLOBAL m_hDevNames;
+       HGLOBAL m_hDevMode;
        MUTEX m_mutexAlarmList;
    void AddAlarmToList(NXC_ALARM *pAlarm);
    NXC_ALARM *FindAlarmInList(DWORD dwAlarmId);
@@ -258,6 +260,7 @@ public:
        afx_msg void OnControlpanelAgentconfigs();
        afx_msg void OnControlpanelNetworkdiscovery();
        afx_msg void OnToolsCreatemp();
+       afx_msg void OnFilePagesetup();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 private:
@@ -265,6 +268,8 @@ private:
    OBJECT_VIEW m_openObjectViews[MAX_OBJECT_VIEWS];
 
 public:
+       HGLOBAL GetProfileGMem(TCHAR *pszSection, TCHAR *pszKey);
+       void WriteProfileGMem(TCHAR *pszSection, TCHAR *pszKey, HGLOBAL hMem);
        DWORD OpenAlarmList(NXC_ALARM **ppList);
        void CloseAlarmList(void);
        DWORD LoadAlarms(void);
@@ -317,6 +322,9 @@ public:
    }
    CAlarmBrowser *GetAlarmBrowser(void) { return m_viewState[VIEW_ALARMS].bActive ? (CAlarmBrowser *)m_viewState[VIEW_ALARMS].pWnd : NULL; }
    CObjectBrowser *GetObjectBrowser(void) { return m_viewState[VIEW_OBJECTS].bActive ? (CObjectBrowser *)m_viewState[VIEW_OBJECTS].pWnd : NULL; }
+
+   HGLOBAL GetDevMode(void) { return m_hDevMode; }
+   HGLOBAL GetDevNames(void) { return m_hDevNames; }
 };
 
 
index f0bf1a2..5391637 100644 (file)
@@ -144,31 +144,11 @@ IDI_TEMPLATE_ROOT       ICON    DISCARDABLE     "icons\\template_root.ico"
 // Bitmap
 //
 
-IDR_MAINFRAME           BITMAP  MOVEABLE PURE   "res\\Toolbar.bmp"
 IDB_UP_ARROW            BITMAP  DISCARDABLE     "res\\up_arrow.bmp"
 IDB_DOWN_ARROW          BITMAP  DISCARDABLE     "res\\down_arrow.bmp"
 IDB_ANY                 BITMAP  DISCARDABLE     "res\\any.bmp"
 IDB_NONE                BITMAP  DISCARDABLE     "res\\none.bmp"
 
-/////////////////////////////////////////////////////////////////////////////
-//
-// Toolbar
-//
-
-IDR_MAINFRAME TOOLBAR DISCARDABLE  16, 15
-BEGIN
-    BUTTON      ID_FILE_NEW
-    SEPARATOR
-    BUTTON      ID_EDIT_CUT
-    BUTTON      ID_EDIT_COPY
-    BUTTON      ID_EDIT_PASTE
-    SEPARATOR
-    BUTTON      ID_FILE_PRINT
-    SEPARATOR
-    BUTTON      ID_APP_ABOUT
-END
-
-
 /////////////////////////////////////////////////////////////////////////////
 //
 // Menu
@@ -222,6 +202,7 @@ BEGIN
         MENUITEM "&Change password...",         ID_TOOLS_CHANGEPASSWORD
         MENUITEM SEPARATOR
         MENUITEM "Create management &pack...",  ID_TOOLS_CREATEMP
+        MENUITEM "&Import management pack...",  ID_TOOLS_IMPORTMP
     END
     POPUP "&Help"
     BEGIN
@@ -489,6 +470,9 @@ BEGIN
         MENUITEM "&Legend\tAlt+L",              ID_GRAPH_LEGEND
         MENUITEM "R&uler\tAlt+R",               ID_GRAPH_RULER
         MENUITEM SEPARATOR
+        MENUITEM "Pr&int...",                   ID_FILE_PRINT
+        MENUITEM "&Copy to clipboard\tCtrl+C",  ID_GRAPH_COPYTOCLIPBOARD
+        MENUITEM SEPARATOR
         MENUITEM "&Zoom out\tBksp",             ID_GRAPH_ZOOMOUT
         MENUITEM SEPARATOR
         MENUITEM "&Properties...\tAlt+P",       ID_GRAPH_PROPERTIES
@@ -847,6 +831,9 @@ BEGIN
         MENUITEM "&Legend",                     ID_GRAPH_LEGEND
         MENUITEM "R&uler",                      ID_GRAPH_RULER
         MENUITEM SEPARATOR
+        MENUITEM "Pr&int...",                   ID_FILE_PRINT
+        MENUITEM "&Copy to clipboard",          ID_GRAPH_COPYTOCLIPBOARD
+        MENUITEM SEPARATOR
         MENUITEM "&Zoom out",                   ID_GRAPH_ZOOMOUT
         MENUITEM SEPARATOR
         MENUITEM "&Properties...",              ID_GRAPH_PROPERTIES
@@ -1071,6 +1058,7 @@ END
 IDA_GRAPH ACCELERATORS DISCARDABLE 
 BEGIN
     "A",            ID_GRAPH_AUTOSCALE,     VIRTKEY, ALT, NOINVERT
+    "C",            ID_GRAPH_COPYTOCLIPBOARD, VIRTKEY, CONTROL, NOINVERT
     "P",            ID_GRAPH_PROPERTIES,    VIRTKEY, ALT, NOINVERT
     "R",            ID_GRAPH_RULER,         VIRTKEY, ALT, NOINVERT
     VK_BACK,        ID_GRAPH_ZOOMOUT,       VIRTKEY, NOINVERT
index f1ca92c..59e3cb4 100644 (file)
 #define ID_ALARM_DETAILS                33044
 #define ID_CONTROLPANEL_NETWORKDISCOVERY 33046
 #define ID_TOOLS_CREATEMP               33047
+#define ID_TOOLS_IMPORTMP               33048
+#define ID_GRAPH_COPYTOCLIPBOARD        33049
 #define IDS_GETFOLDERPATH_FAILED        61216
 #define IDS_WORKDIR_CREATION_FAILED     61217
 #define IDS_SCINTILLA_INIT_FAILED       61218
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        344
-#define _APS_NEXT_COMMAND_VALUE         33048
+#define _APS_NEXT_COMMAND_VALUE         33050
 #define _APS_NEXT_CONTROL_VALUE         1426
 #define _APS_NEXT_SYMED_VALUE           129
 #endif
index 2d7fc14..766617f 100644 (file)
@@ -886,3 +886,101 @@ void DrawHeading(CDC &dc, TCHAR *pszText, CFont *pFont, RECT *pRect,
 
    GradientFill(dc.m_hDC, vtx, 2, &gr, 1, GRADIENT_FILL_RECT_H);
 }
+
+
+//
+// Print bitmap
+//
+
+void PrintBitmap(CDC &dc, CBitmap &bitmap, RECT *pRect)
+{
+   LPBITMAPINFO info;
+   BITMAP bm;
+   int i, nColors  = 0;
+   RGBQUAD rgb[256];
+
+   // Obtain information about 'hbit' and store it in 'bm'
+   GetObject(bitmap.GetSafeHandle(), sizeof(BITMAP), (LPVOID)&bm);
+
+   nColors = (1 << bm.bmBitsPixel);
+   if(nColors > 256)
+      nColors=0;           // This is when DIB is 24 bit.
+                           // In this case there is not any color table information
+
+   info = (LPBITMAPINFO) malloc(sizeof(BITMAPINFO) + (nColors * sizeof(RGBQUAD)));
+
+   // Before 'StretchDIBits()' we have to fill some "info" fields.
+   // This information was stored in 'bm'.
+   info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+   info->bmiHeader.biWidth = bm.bmWidth;
+   info->bmiHeader.biHeight = bm.bmHeight;
+   info->bmiHeader.biPlanes = 1;
+   info->bmiHeader.biBitCount = bm.bmBitsPixel * bm.bmPlanes;
+   info->bmiHeader.biCompression = BI_RGB;
+   info->bmiHeader.biSizeImage = bm.bmWidthBytes * bm.bmHeight;
+   info->bmiHeader.biXPelsPerMeter = 0;
+   info->bmiHeader.biYPelsPerMeter = 0;
+   info->bmiHeader.biClrUsed = 0;
+   info->bmiHeader.biClrImportant = 0;
+
+   // Now for 256 or less color DIB we have to fill the "info" color table parameter
+   if(nColors <= 256)
+   {
+      HBITMAP hOldBitmap;
+      HDC hMemDC = CreateCompatibleDC(NULL);
+
+      hOldBitmap = (HBITMAP)SelectObject(hMemDC, bitmap.GetSafeHandle());
+      GetDIBColorTable(hMemDC, 0, nColors, rgb);
+
+      // Now we pass this color information to "info"
+      for(i = 0; i < nColors; i++)
+      {
+         info->bmiColors[i].rgbRed = rgb[i].rgbRed;
+         info->bmiColors[i].rgbGreen = rgb[i].rgbGreen;
+         info->bmiColors[i].rgbBlue = rgb[i].rgbBlue;
+      }
+
+      SelectObject(hMemDC, hOldBitmap);
+      DeleteDC(hMemDC);
+   }
+
+   bm.bmBits = malloc((info->bmiHeader.biBitCount / 8 + ((info->bmiHeader.biBitCount % 8) > 0 ? 1 : 0)) * bm.bmWidth * bm.bmHeight);
+   GetDIBits(dc.GetSafeHdc(), (HBITMAP)bitmap.GetSafeHandle(), 0, bm.bmHeight,
+             bm.bmBits, info, DIB_RGB_COLORS);
+
+   // Stretching all the bitmap on a destination rectangle of size (size_x, size_y)
+   // and upper left corner at (initial_pos_x, initial_pos_y)
+   StretchDIBits(dc.GetSafeHdc(), pRect->left, pRect->top,
+                 pRect->right - pRect->left, pRect->bottom - pRect->top,
+                 0, 0, bm.bmWidth, bm.bmHeight, bm.bmBits, info,
+                 DIB_RGB_COLORS, SRCCOPY);
+   free(bm.bmBits);
+   free(info);
+}
+
+
+//
+// Create a copy of global memory block
+//
+
+HGLOBAL CopyGlobalMem(HGLOBAL hSrc)
+{
+   DWORD dwLen;
+   HANDLE hDst;
+   void *pSrc, *pDst;
+
+   if (hSrc == NULL)
+      return NULL;
+
+   dwLen = GlobalSize(hSrc);
+   hDst = GlobalAlloc(GMEM_MOVEABLE, dwLen);
+   if(hDst != NULL)
+   {
+      pSrc = GlobalLock(hSrc);
+      pDst = GlobalLock(hDst);
+      CopyMemory(pDst, pSrc, dwLen);
+      GlobalUnlock(hSrc);
+      GlobalUnlock(hDst);
+   }
+   return hDst;
+}