- More commands added to the map
authorVictor Kirhenshtein <victor@netxms.org>
Sun, 23 Apr 2006 21:57:19 +0000 (21:57 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Sun, 23 Apr 2006 21:57:19 +0000 (21:57 +0000)
- Fixed some map drawing bugs
- Background image selection dialog implemented

12 files changed:
src/console/win32/MapFrame.cpp
src/console/win32/MapFrame.h
src/console/win32/MapView.cpp
src/console/win32/MapView.h
src/console/win32/SubmapBkgndDlg.cpp
src/console/win32/SubmapBkgndDlg.h
src/console/win32/globals.h
src/console/win32/nxcon.clw
src/console/win32/nxcon.cpp
src/console/win32/nxcon.rc
src/console/win32/resource.h
src/console/win32/tools.cpp

index 20be7ca..6347fea 100644 (file)
@@ -69,6 +69,16 @@ BEGIN_MESSAGE_MAP(CMapFrame, CMDIChildWnd)
        ON_COMMAND(ID_OBJECT_LASTDCIVALUES, OnObjectLastdcivalues)
        ON_UPDATE_COMMAND_UI(ID_OBJECT_LASTDCIVALUES, OnUpdateObjectLastdcivalues)
        ON_COMMAND(ID_MAP_SETBACKGROUND, OnMapSetbackground)
+       ON_COMMAND(ID_OBJECT_DATACOLLECTION, OnObjectDatacollection)
+       ON_UPDATE_COMMAND_UI(ID_OBJECT_DATACOLLECTION, OnUpdateObjectDatacollection)
+       ON_COMMAND(ID_OBJECT_MANAGE, OnObjectManage)
+       ON_UPDATE_COMMAND_UI(ID_OBJECT_MANAGE, OnUpdateObjectManage)
+       ON_COMMAND(ID_OBJECT_UNBIND, OnObjectUnbind)
+       ON_UPDATE_COMMAND_UI(ID_OBJECT_UNBIND, OnUpdateObjectUnbind)
+       ON_COMMAND(ID_OBJECT_UNMANAGE, OnObjectUnmanage)
+       ON_UPDATE_COMMAND_UI(ID_OBJECT_UNMANAGE, OnUpdateObjectUnmanage)
+       ON_COMMAND(ID_OBJECT_BIND, OnObjectBind)
+       ON_UPDATE_COMMAND_UI(ID_OBJECT_BIND, OnUpdateObjectBind)
        //}}AFX_MSG_MAP
    ON_MESSAGE(NXCM_OBJECT_CHANGE, OnObjectChange)
 END_MESSAGE_MAP()
@@ -567,29 +577,195 @@ void CMapFrame::OnMapSetbackground()
 {
    CSubmapBkgndDlg dlg;
    DWORD dwResult;
-   
+   HBITMAP hBitmap;
+
+   dlg.m_nBkType = 0;
+   dlg.m_nScaleMethod = 0;
    if (dlg.DoModal() == IDOK)
    {
-      dwResult = DoRequestArg4(NXCUploadSubmapBkImage, g_hSession,
-                               (void *)m_wndMapView.GetMap()->MapId(),
-                               (void *)m_wndMapView.GetSubmap()->Id(),
-                               (void *)((LPCTSTR)dlg.m_strFileName),
-                               _T("Uploading new background image to server..."));
-      if (dwResult == RCC_SUCCESS)
+      if (dlg.m_nBkType == 0)
       {
-         HBITMAP hBitmap;
-
-         hBitmap = LoadPicture((TCHAR *)((LPCTSTR)dlg.m_strFileName));
+         m_wndMapView.SetBkImage(NULL);
+      }
+      else
+      {
+         hBitmap = LoadPicture((TCHAR *)((LPCTSTR)dlg.m_strFileName), m_wndMapView.GetScaleFactor());
          if (hBitmap != NULL)
          {
+            dwResult = DoRequestArg4(NXCUploadSubmapBkImage, g_hSession,
+                                     (void *)m_wndMapView.GetMap()->MapId(),
+                                     (void *)m_wndMapView.GetSubmap()->Id(),
+                                     (void *)((LPCTSTR)dlg.m_strFileName),
+                                     _T("Uploading new background image to server..."));
+            if (dwResult == RCC_SUCCESS)
+            {
+               m_wndMapView.SetBkImage(hBitmap);
+            }
+            else
+            {
+               theApp.ErrorBox(dwResult, _T("Cannot upload background image to server: %s"));
+               DeleteObject(hBitmap);
+            }
          }
          else
          {
+            MessageBox(_T("Cannot load image file (possibly unsupported file format)"),
+                       _T("Error"), MB_OK | MB_ICONSTOP);
          }
       }
-      else
-      {
-         theApp.ErrorBox(dwResult, _T("Cannot upload background image to server: %s"));
-      }
    }
 }
+
+
+//
+// WM_COMMAND::ID_OBJECT_DATACOLLECTION message handlers
+//
+
+void CMapFrame::OnObjectDatacollection() 
+{
+   DWORD i, dwCount, *pdwList;
+   NXC_OBJECT *pObject;
+
+   pdwList = m_wndMapView.GetSelectedObjects(&dwCount);
+   for(i = 0; i < dwCount; i++)
+   {
+      pObject = NXCFindObjectById(g_hSession, pdwList[i]);
+      if ((pObject != NULL) && (pObject->iClass == OBJECT_NODE))
+         theApp.StartObjectDCEditor(pObject);
+   }
+   safe_free(pdwList);
+}
+
+void CMapFrame::OnUpdateObjectDatacollection(CCmdUI* pCmdUI) 
+{
+   pCmdUI->Enable(CurrObjectIsNode());
+}
+
+
+//
+// WM_COMMAND::ID_OBJECT_MANAGE message handlers
+//
+
+void CMapFrame::OnObjectManage() 
+{
+   DWORD i, dwCount, *pdwList;
+   NXC_OBJECT *pObject;
+
+   pdwList = m_wndMapView.GetSelectedObjects(&dwCount);
+   for(i = 0; i < dwCount; i++)
+   {
+      pObject = NXCFindObjectById(g_hSession, pdwList[i]);
+      if (pObject != NULL)
+         theApp.SetObjectMgmtStatus(pObject, TRUE);
+   }
+   safe_free(pdwList);
+}
+
+void CMapFrame::OnUpdateObjectManage(CCmdUI* pCmdUI) 
+{
+   pCmdUI->Enable(m_wndMapView.GetSelectionCount() > 0);
+}
+
+
+//
+// WM_COMMAND::ID_OBJECT_UNMANAGE message handlers
+//
+
+void CMapFrame::OnObjectUnmanage() 
+{
+   DWORD i, dwCount, *pdwList;
+   NXC_OBJECT *pObject;
+
+   pdwList = m_wndMapView.GetSelectedObjects(&dwCount);
+   for(i = 0; i < dwCount; i++)
+   {
+      pObject = NXCFindObjectById(g_hSession, pdwList[i]);
+      if (pObject != NULL)
+         theApp.SetObjectMgmtStatus(pObject, FALSE);
+   }
+   safe_free(pdwList);
+}
+
+void CMapFrame::OnUpdateObjectUnmanage(CCmdUI* pCmdUI) 
+{
+   pCmdUI->Enable(m_wndMapView.GetSelectionCount() > 0);
+}
+
+
+//
+// WM_COMMAND::ID_OBJECT_BIND message handlers
+//
+
+void CMapFrame::OnObjectBind() 
+{
+   NXC_OBJECT *pObject;
+
+   pObject = GetFirstSelectedObject();
+   if (pObject != NULL)
+      theApp.BindObject(pObject);
+}
+
+void CMapFrame::OnUpdateObjectBind(CCmdUI* pCmdUI) 
+{
+   if (m_wndMapView.GetSelectionCount() != 1)
+   {
+      pCmdUI->Enable(FALSE);
+   }
+   else
+   {
+      NXC_OBJECT *pObject;
+
+      pObject = GetFirstSelectedObject();
+      pCmdUI->Enable((pObject->iClass == OBJECT_CONTAINER) ||
+                     (pObject->iClass == OBJECT_SERVICEROOT));
+   }
+}
+
+
+//
+// WM_COMMAND::ID_OBJECT_UNBIND message handlers
+//
+
+void CMapFrame::OnObjectUnbind() 
+{
+   NXC_OBJECT *pObject;
+
+   pObject = GetFirstSelectedObject();
+   if (pObject != NULL)
+      theApp.UnbindObject(pObject);
+}
+
+void CMapFrame::OnUpdateObjectUnbind(CCmdUI* pCmdUI) 
+{
+   if (m_wndMapView.GetSelectionCount() != 1)
+   {
+      pCmdUI->Enable(FALSE);
+   }
+   else
+   {
+      NXC_OBJECT *pObject;
+
+      pObject = GetFirstSelectedObject();
+      pCmdUI->Enable((pObject->iClass == OBJECT_CONTAINER) ||
+                     (pObject->iClass == OBJECT_SERVICEROOT));
+   }
+}
+
+
+//
+// Get first selected object
+//
+
+NXC_OBJECT * CMapFrame::GetFirstSelectedObject()
+{
+   DWORD dwCount, *pdwList;
+   NXC_OBJECT *pObject = NULL;
+
+   pdwList = m_wndMapView.GetSelectedObjects(&dwCount);
+   if (dwCount > 0)
+   {
+      pObject = NXCFindObjectById(g_hSession, *pdwList);
+   }
+   safe_free(pdwList);
+   return pObject;
+}
index 48c52de..3626ae5 100644 (file)
@@ -38,6 +38,7 @@ public:
 
 // Implementation
 protected:
+       NXC_OBJECT * GetFirstSelectedObject(void);
        CStatusBarCtrl m_wndStatusBar;
        BOOL CurrObjectIsNode(void);
        void RedoLayout(void);
@@ -82,6 +83,16 @@ protected:
        afx_msg void OnObjectLastdcivalues();
        afx_msg void OnUpdateObjectLastdcivalues(CCmdUI* pCmdUI);
        afx_msg void OnMapSetbackground();
+       afx_msg void OnObjectDatacollection();
+       afx_msg void OnUpdateObjectDatacollection(CCmdUI* pCmdUI);
+       afx_msg void OnObjectManage();
+       afx_msg void OnUpdateObjectManage(CCmdUI* pCmdUI);
+       afx_msg void OnObjectUnbind();
+       afx_msg void OnUpdateObjectUnbind(CCmdUI* pCmdUI);
+       afx_msg void OnObjectUnmanage();
+       afx_msg void OnUpdateObjectUnmanage(CCmdUI* pCmdUI);
+       afx_msg void OnObjectBind();
+       afx_msg void OnUpdateObjectBind(CCmdUI* pCmdUI);
        //}}AFX_MSG
    afx_msg void OnObjectChange(WPARAM wParam, NXC_OBJECT *pObject);
        DECLARE_MESSAGE_MAP()
index f153008..1ea6887 100644 (file)
@@ -48,12 +48,15 @@ CMapView::CMapView()
    m_ptOrg.y = 0;
    m_dwHistoryPos = 0;
    m_dwHistorySize = 0;
+   m_hBkImage = NULL;
 }
 
 CMapView::~CMapView()
 {
    safe_free(m_pObjectInfo);
    delete m_pDragImageList;
+   if (m_hBkImage != NULL)
+      DeleteObject(m_hBkImage);
 }
 
 
@@ -217,7 +220,7 @@ void CMapView::OnPaint()
 
 void CMapView::DrawOnBitmap(CBitmap &bitmap, BOOL bSelectionOnly, RECT *prcSel)
 {
-   CDC *pdc, dc;           // Window dc and in-memory dc
+   CDC *pdc, dc, dcBmp;           // Window dc and in-memory dc
    CBitmap *pOldBitmap;
    CBrush brush;
    RECT rcClient, rcBitmap;
@@ -249,18 +252,32 @@ void CMapView::DrawOnBitmap(CBitmap &bitmap, BOOL bSelectionOnly, RECT *prcSel)
       ptOffset.y = 0;
    }
    bitmap.CreateCompatibleBitmap(pdc, rcBitmap.right, rcBitmap.bottom);
-   //ReleaseDC(pdc);
 
    // Initial DC setup
    pOldBitmap = dc.SelectObject(&bitmap);
    dc.SetBkColor(m_rgbBkColor);
    brush.CreateSolidBrush(m_rgbBkColor);
-   dc.FillRect(&rcBitmap, &brush);
    if (m_scaleInfo[m_nScale].nFontIndex != -1)
       pOldFont = dc.SelectObject(&m_fontList[m_scaleInfo[m_nScale].nFontIndex]);
    else
       pOldFont = NULL;
 
+   // Draw background
+   dc.FillRect(&rcBitmap, &brush);
+   if ((m_hBkImage != NULL) && (!bSelectionOnly))
+   {
+      CBitmap bmpBkImage, *pOldBkImage;
+
+      dcBmp.CreateCompatibleDC(pdc);
+      bmpBkImage.Attach(m_hBkImage);
+      pOldBkImage = dcBmp.SelectObject(&bmpBkImage);
+      dc.BitBlt(0, 0, rcBitmap.right, rcBitmap.bottom, &dcBmp, 0, 0, SRCCOPY);
+      dcBmp.SelectObject(pOldBkImage);
+      bmpBkImage.Detach();
+      dcBmp.DeleteDC();
+   }
+   ReleaseDC(pdc);
+
    if (m_pSubmap != NULL)
    {
       if (m_scaleInfo[m_nScale].nImageList == 0)
@@ -387,12 +404,7 @@ void CMapView::SetMap(nxMap *pMap)
    m_dwHistoryPos = 0;
    delete m_pMap;
    m_pMap = pMap;
-   m_pSubmap = m_pMap->GetSubmap(m_pMap->ObjectId());
-   if (!m_pSubmap->IsLayoutCompleted())
-      DoSubmapLayout();
-   m_ptMapSize = m_pSubmap->GetMinSize();
-   ScalePosMapToScreen(&m_ptMapSize);
-   Update();
+   OpenSubmap(m_pMap->ObjectId(), FALSE);
 }
 
 
@@ -873,14 +885,33 @@ void CMapView::OpenSubmap(DWORD dwId, BOOL bAddToHistory)
    pSubmap = m_pMap->GetSubmap(dwId);
    if (pSubmap != NULL)
    {
-      if (bAddToHistory)
+      // Update history and change current submap
+      if ((bAddToHistory) && (m_pSubmap != NULL))
          AddToHistory(m_pSubmap->Id());
       m_pSubmap = pSubmap;
+
+      // Prepare objects on submap
       if (!m_pSubmap->IsLayoutCompleted())
          DoSubmapLayout();
       ClearSelection(FALSE);
+
+      // Change background image
+      if (m_hBkImage != NULL)
+         DeleteObject(m_hBkImage);
+      if (m_pSubmap->GetBkImageFlag())
+      {
+         m_hBkImage = GetBkImage(m_pMap->MapId(), dwId, m_scaleInfo[m_nScale].nFactor);
+      }
+      else
+      {
+         m_hBkImage = NULL;
+      }
+
+      // Update map size in pixels
       m_ptMapSize = m_pSubmap->GetMinSize();
       ScalePosMapToScreen(&m_ptMapSize);
+      
+      // Redraw everything
       Update();
    }
    else
@@ -1113,6 +1144,11 @@ void CMapView::ZoomIn()
       ScalePosScreenToMap(&m_ptOrg);
       m_nScale++;
       ScalePosMapToScreen(&m_ptOrg);
+      if (m_hBkImage != NULL)
+      {
+         DeleteObject(m_hBkImage);
+         m_hBkImage = GetBkImage(m_pMap->MapId(), m_pSubmap->Id(), m_scaleInfo[m_nScale].nFactor);
+      }
       m_ptMapSize = m_pSubmap->GetMinSize();
       ScalePosMapToScreen(&m_ptMapSize);
       Update();
@@ -1141,6 +1177,11 @@ void CMapView::ZoomOut()
       ScalePosScreenToMap(&m_ptOrg);
       m_nScale--;
       ScalePosMapToScreen(&m_ptOrg);
+      if (m_hBkImage != NULL)
+      {
+         DeleteObject(m_hBkImage);
+         m_hBkImage = GetBkImage(m_pMap->MapId(), m_pSubmap->Id(), m_scaleInfo[m_nScale].nFactor);
+      }
       m_ptMapSize = m_pSubmap->GetMinSize();
       ScalePosMapToScreen(&m_ptMapSize);
       Update();
@@ -1345,3 +1386,77 @@ DWORD *CMapView::GetSelectedObjects(DWORD *pdwNumObjects)
    }
    return pdwList;
 }
+
+
+//
+// Set new background image for current submap
+// To clear background image, hBitmap must be set to NULL
+//
+
+void CMapView::SetBkImage(HBITMAP hBitmap)
+{
+   TCHAR szFileName[MAX_PATH], szServerId[32];
+   BYTE bsId[8];
+   
+   if (m_pSubmap != NULL)
+   {
+      // Delete cached file, if any
+      NXCGetServerID(g_hSession, bsId);
+      BinToStr(bsId, 8, szServerId);
+      _sntprintf(szFileName, MAX_PATH, _T("%s") WORKDIR_BKIMAGECACHE _T("\\%s.%08X.%08X"),
+                 g_szWorkDir, szServerId, m_pMap->MapId(), m_pSubmap->Id());
+      DeleteFile(szFileName);
+
+      // Replace in-memory image
+      if (m_hBkImage != NULL)
+         DeleteObject(m_hBkImage);
+      m_hBkImage = hBitmap;
+      m_pSubmap->SetBkImageFlag(hBitmap != NULL);
+      Update();
+   }
+   else
+   {
+      DeleteObject(hBitmap);
+   }
+}
+
+
+//
+// Get background image for submap (from local cache or server)
+//
+
+HBITMAP CMapView::GetBkImage(DWORD dwMapId, DWORD dwSubmapId, int nScaleFactor)
+{
+   TCHAR szFileName[MAX_PATH], szServerId[32];
+   BYTE bsId[8];
+   DWORD dwResult;
+
+   NXCGetServerID(g_hSession, bsId);
+   BinToStr(bsId, 8, szServerId);
+   _sntprintf(szFileName, MAX_PATH, _T("%s") WORKDIR_BKIMAGECACHE _T("\\%s.%08X.%08X"),
+              g_szWorkDir, szServerId, dwMapId, dwSubmapId);
+   
+   // Download file if needed
+   if (access(szFileName, 4) != 0)
+   {
+      dwResult = DoRequestArg4(NXCDownloadSubmapBkImage, g_hSession, (void *)dwMapId,
+                               (void *)dwSubmapId, szFileName,
+                               _T("Downloading background image from server..."));
+      if (dwResult != RCC_SUCCESS)
+      {
+         theApp.ErrorBox(dwResult, _T("Cannot download background image: %s"));
+      }
+   }
+
+   return LoadPicture(szFileName, nScaleFactor);
+}
+
+
+//
+// Returns current scale factor
+//
+
+int CMapView::GetScaleFactor(void)
+{
+   return m_scaleInfo[m_nScale].nFactor;
+}
index 4e1c689..af05fdb 100644 (file)
@@ -109,6 +109,8 @@ public:
 
        // Generated message map functions
 protected:
+       HBITMAP GetBkImage(DWORD dwMapId, DWORD dwSubmapId, int nScaleFactor);
+       HBITMAP m_hBkImage;
        void OnMouseButtonDown(UINT nFlags, POINT point);
        void OnMouseButtonUp(UINT nFlags, POINT point);
        void AddToHistory(DWORD dwId);
@@ -163,6 +165,8 @@ protected:
        DECLARE_MESSAGE_MAP()
 
 public:
+   int GetScaleFactor(void);
+       void SetBkImage(HBITMAP hBitmap);
        DWORD * GetSelectedObjects(DWORD *pdwNumObjects);
    nxMap *GetMap(void) { return m_pMap; }
    nxSubmap *GetSubmap(void) { return m_pSubmap; }
index f185267..1034f2e 100644 (file)
@@ -40,9 +40,71 @@ void CSubmapBkgndDlg::DoDataExchange(CDataExchange* pDX)
 
 BEGIN_MESSAGE_MAP(CSubmapBkgndDlg, CDialog)
        //{{AFX_MSG_MAP(CSubmapBkgndDlg)
-               // NOTE: the ClassWizard will add message map macros here
+       ON_BN_CLICKED(IDC_RADIO_BITMAP, OnRadioBitmap)
+       ON_BN_CLICKED(IDC_RADIO_NBK, OnRadioNbk)
+       ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
 // CSubmapBkgndDlg message handlers
+
+BOOL CSubmapBkgndDlg::OnInitDialog() 
+{
+       CDialog::OnInitDialog();
+       
+   EnableItems();
+       
+       return TRUE;
+}
+
+
+//
+// Enable/disable items based on current selection
+//
+
+void CSubmapBkgndDlg::EnableItems()
+{
+   BOOL bEnable;
+
+   bEnable = IsButtonChecked(this, IDC_RADIO_BITMAP);
+   EnableDlgItem(this, IDC_STATIC_FRAME, bEnable);
+   EnableDlgItem(this, IDC_STATIC_FILE, bEnable);
+   EnableDlgItem(this, IDC_EDIT_FILE, bEnable);
+   EnableDlgItem(this, IDC_BROWSE, bEnable);
+   EnableDlgItem(this, IDC_RADIO_NO_SCALE, bEnable);
+   EnableDlgItem(this, IDC_RADIO_SCALE, bEnable);
+}
+
+
+//
+// Handlers for radio buttons
+//
+
+void CSubmapBkgndDlg::OnRadioBitmap() 
+{
+   EnableItems();
+}
+
+void CSubmapBkgndDlg::OnRadioNbk() 
+{
+   EnableItems();
+}
+
+
+//
+// "Browse" button handler
+//
+
+void CSubmapBkgndDlg::OnBrowse() 
+{
+   TCHAR szBuffer[MAX_PATH];
+
+   GetDlgItemText(IDC_EDIT_FILE, szBuffer, MAX_PATH);
+   CFileDialog dlg(TRUE, NULL, szBuffer, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST,
+                   _T("Image Files (*.jpg;*.jpeg;*.gif;*.bmp)|*.jpg;*.jpeg;*.gif;*.bmp|All Files (*.*)|*.*||"));
+   if (dlg.DoModal() == IDOK)
+   {
+      SetDlgItemText(IDC_EDIT_FILE, dlg.m_ofn.lpstrFile);
+   }
+}
index 6b817c9..bc9d398 100644 (file)
@@ -34,10 +34,14 @@ public:
 
 // Implementation
 protected:
+       void EnableItems(void);
 
        // Generated message map functions
        //{{AFX_MSG(CSubmapBkgndDlg)
-               // NOTE: the ClassWizard will add member functions here
+       virtual BOOL OnInitDialog();
+       afx_msg void OnRadioBitmap();
+       afx_msg void OnRadioNbk();
+       afx_msg void OnBrowse();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };
index e6255c0..26f317d 100644 (file)
@@ -135,6 +135,7 @@ extern CConsoleApp theApp;
 
 #define WORKDIR_MIBCACHE      _T("\\MIBCache")
 #define WORKDIR_IMAGECACHE    _T("\\ImageCache")
+#define WORKDIR_BKIMAGECACHE  _T("\\BkImageCache")
 #define WORKFILE_OBJECTCACHE  _T("\\objects.cache.")
 
 
@@ -277,7 +278,7 @@ int GetObjectImageIndex(NXC_OBJECT *pObject);
 int GetClassDefaultImageIndex(int iClass);
 CImageList *CreateEventImageList(void);
 void LoadBitmapIntoList(CImageList *pImageList, UINT nIDResource, COLORREF rgbMaskColor);
-HBITMAP LoadPicture(TCHAR *pszFile);
+HBITMAP LoadPicture(TCHAR *pszFile, int nScaleFactor);
 
 
 //
index a5ecffb..7e9e86c 100644 (file)
@@ -16,9 +16,9 @@ Class7=CEventBrowser
 Class9=CMapView
 
 ResourceCount=139
-Resource1=IDD_GROUP_PROPERTIES (English (U.S.))
+Resource1=IDD_SELECT_AGENT_PARAM (English (U.S.))
 Resource2=IDD_OBJECT_NODE_GENERAL
-Resource3=IDD_EDIT_TRAP_ARG (English (U.S.))
+Resource3=IDD_OBJTOOL_COLUMNS
 Resource4=IDD_SELECT_OBJECT
 Resource5=IDD_SELECT_ACTION
 Class2=CChildView
@@ -32,9 +32,9 @@ Resource7=IDD_NEW_USER
 Class12=CObjectBrowser
 Resource8=IDD_CREATE_CONTAINER
 Class13=CObjectPropDlg
-Resource9=IDD_OBJECT_NODE_GENERAL (English (U.S.))
-Resource10=IDD_REQUEST_PROCESSING (English (U.S.))
-Resource11=IDA_OBJECT_BROWSER (English (U.S.))
+Resource9=IDD_CREATE_NODE (English (U.S.))
+Resource10=IDD_CREATE_TG (English (U.S.))
+Resource11=IDD_GROUP_PROPERTIES (English (U.S.))
 Resource12=IDR_CTRLPANEL (English (U.S.))
 Resource13=IDR_EVENTS (English (U.S.))
 Resource14=IDR_MAPFRAME (English (U.S.))
@@ -42,17 +42,17 @@ Resource15=IDR_OBJECTS (English (U.S.))
 Resource16=IDD_DUMMY (English (U.S.))
 Class14=CEventEditor
 Class15=CEditEventDlg
-Resource17=IDA_AGENT_CFG_EDITOR (English (U.S.))
+Resource17=IDD_EDIT_RULE_ALARM (English (U.S.))
 Class16=CDebugFrame
-Resource18=IDD_SET_PASSWORD (English (U.S.))
+Resource18=IDD_INPUT_BOX (English (U.S.))
 Resource19=IDD_OBJECT_PROPERTIES (English (U.S.))
 Resource20=IDD_SELECT_EVENT
 Class17=CObjectPreview
-Resource21=IDD_SAVE_AGENT_CFG (English (U.S.))
+Resource21=IDA_OBJECT_TOOLS_EDITOR (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDD_CREATE_VPNC (English (U.S.))
+Resource22=IDA_SERVER_CFG_EDITOR (English (U.S.))
 Class21=CEditBox
 Class22=COPGeneral
 Class23=CNodePropsGeneral
@@ -61,14 +61,14 @@ Class24=CObjectPropCaps
 Class25=CObjectPropSheet
 Resource24=IDA_MDI_DEFAULT
 Class26=CRequestProcessingDlg
-Resource25=IDA_SERVER_CFG_EDITOR (English (U.S.))
+Resource25=IDD_EDIT_RULE_SEVERITY (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
 Resource27=IDD_EDIT_RULE_ALARM
-Resource28=IDD_ABOUTBOX (English (U.S.))
+Resource28=IDD_SELECT_ACTION (English (U.S.))
 Class27=CObjectPropsGeneral
-Resource29=IDD_OBJECT_VPNC_GENERAL (English (U.S.))
+Resource29=IDA_AGENT_CFG_EDITOR (English (U.S.))
 Class28=CObjectPropsSecurity
-Resource30=IDD_GRAPH_PROP_DATA (English (U.S.))
+Resource30=IDA_TRAP_EDITOR (English (U.S.))
 Resource31=IDD_SELECT_USER
 Resource32=IDD_OBJECT_SECURITY
 Class29=CUserSelectDlg
@@ -79,36 +79,36 @@ Class31=CNewUserDlg
 Resource35=IDD_THRESHOLD
 Resource36=IDA_EPP
 Class32=CUserPropDlg
-Resource37=IDD_SELECT_INTERNAL_ITEM (English (U.S.))
+Resource37=IDD_SNMP_WALK
 Resource38=IDD_ABOUTBOX
 Class33=CGroupPropDlg
 Resource39=IDD_CP_GENERAL
 Resource40=IDA_TRAP_EDITOR
 Resource41=IDM_VIEW_SPECIFIC
-Resource42=IDD_OBJTOOL_OPTIONS (English (U.S.))
+Resource42=IDD_OBJECT_CAPS (English (U.S.))
 Class34=CPasswordChangeDlg
 Class35=CNodeSummary
 Class36=CNetSummaryFrame
 Class37=CDataCollectionEditor
-Resource43=IDD_DATA_QUERY (English (U.S.))
+Resource43=IDD_CHANGE_IP (English (U.S.))
 Class38=CDCIPropPage
-Resource44=IDD_DCI_TRANSFORM (English (U.S.))
+Resource44=IDD_OBJTOOL_GENERAL (English (U.S.))
 Class39=CDCIDataView
-Resource45=IDD_NEW_OBJECT_TOOL (English (U.S.))
+Resource45=IDD_OBJECT_NODE_GENERAL (English (U.S.))
 Class40=CGraph
 Class41=CGraphFrame
 Class42=CDCIThresholdsPage
-Resource46=IDA_EPP (English (U.S.))
-Resource47=IDD_SELECT_AGENT_PARAM (English (U.S.))
+Resource46=IDD_SET_PASSWORD (English (U.S.))
+Resource47=IDR_MAINFRAME (English (U.S.))
 Resource48=IDM_CONTEXT
 Class43=CThresholdDlg
-Resource49=IDD_CREATE_TG (English (U.S.))
+Resource49=IDD_NEW_OBJECT_TOOL (English (U.S.))
 Resource50=IDD_EDIT_TRAP_ARG
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
-Resource51=IDD_NEW_ACTION (English (U.S.))
+Resource51=IDD_OBJECT_VPNC_GENERAL (English (U.S.))
 Resource52=IDD_CREATE_NODE
 Class48=CObjectSelDlg
 Resource53=IDD_OBJECT_CAPS
@@ -117,22 +117,22 @@ Class49=CRuleCommentDlg
 Resource55=IDD_DCI_COLLECTION
 Class50=CEventSelDlg
 Resource56=IDD_DATA_QUERY
-Resource57=IDD_DCI_SCHEDULE (English (U.S.))
+Resource57=IDA_SCRIPT_MANAGER (English (U.S.))
 Resource58=IDD_CREATE_TG
-Resource59=IDD_OBJTOOL_COLUMNS
-Resource60=IDD_DESKTOP_SAVE_AS (English (U.S.))
+Resource59=IDD_OBJECT_SECURITY (English (U.S.))
+Resource60=IDA_EVENT_EDITOR (English (U.S.))
 Class51=CObjectPropsPresentation
-Resource61=IDD_SELECT_EVENT (English (U.S.))
+Resource61=IDD_GRAPH_PROP_DATA (English (U.S.))
 Resource62=IDD_EDIT_RULE_COMMENT
 Class52=CRuleSeverityDlg
 Resource63=IDD_ACTION_PROPERTIES
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
-Resource64=IDD_EDIT_IP_SUBNET (English (U.S.))
+Resource64=IDA_DC_EDITOR (English (U.S.))
 Resource65=IDD_DCI_TRANSFORM
-Resource66=IDD_INPUT_BOX (English (U.S.))
-Resource67=IDD_NEW_USER (English (U.S.))
-Resource68=IDD_DCI_COLLECTION (English (U.S.))
+Resource66=IDA_MDI_DEFAULT (English (U.S.))
+Resource67=IDD_EDIT_TRAP_ARG (English (U.S.))
+Resource68=IDD_CREATE_NETSRV (English (U.S.))
 Class55=CConsolePropsGeneral
 Class56=CActionEditor
 Resource69=IDA_ACTION_EDITOR
@@ -143,18 +143,18 @@ Class58=CEditActionDlg
 Resource72=IDA_NETMAP
 Class59=CActionSelDlg
 Resource73=IDD_MIB_BROWSER
-Resource74=IDD_EDIT_RULE_SEVERITY (English (U.S.))
-Resource75=IDA_DC_EDITOR (English (U.S.))
+Resource74=IDD_DCI_DATA_EXPORT (English (U.S.))
+Resource75=IDD_CP_GENERAL (English (U.S.))
 Resource76=IDD_USER_PROPERTIES
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
 Resource77=IDR_MAINFRAME
 Class62=CCreateNodeDlg
-Resource78=IDA_ACTION_EDITOR (English (U.S.))
+Resource78=IDD_MIB_BROWSER (English (U.S.))
 Resource79=IDT_MAP (English (U.S.))
-Resource80=IDD_LASTVAL_PROP (English (U.S.))
+Resource80=IDA_GRAPH (English (U.S.))
 Class63=CDCITransformPage
-Resource81=IDD_EDIT_TRAP (English (U.S.))
+Resource81=IDD_REMOVE_TEMPLATE
 Class64=CPollNodeDlg
 Resource82=IDD_POLL_NODE (English (U.S.))
 Class65=CNodePoller
@@ -171,7 +171,7 @@ Resource89=IDA_ALARM_BROWSER
 Class69=CDataQueryDlg
 Resource90=IDD_EDIT_RULE_SEVERITY
 Class70=CTrapEditDlg
-Resource91=IDD_CREATE_NETSRV (English (U.S.))
+Resource91=IDA_OBJECT_BROWSER (English (U.S.))
 Class71=CTrapParamDlg
 Resource92=IDD_EDIT_EVENT
 Resource93=IDD_CREATE_TEMPLATE
@@ -179,95 +179,95 @@ Class72=CGraphPropDlg
 Class73=CColorSelector
 Class74=CPackageMgr
 Resource94=IDD_GROUP_PROPERTIES
-Resource95=IDA_ALARM_BROWSER (English (U.S.))
-Resource96=IDA_SCRIPT_MANAGER (English (U.S.))
-Resource97=IDD_SELECT_OBJECT (English (U.S.))
-Resource98=IDD_DCI_DATA_EXPORT (English (U.S.))
-Resource99=IDD_CREATE_CONTAINER (English (U.S.))
-Resource100=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
-Resource101=IDD_SNMP_WALK
-Resource102=IDD_OBJECT_SECURITY (English (U.S.))
-Resource103=IDD_USER_PROPERTIES (English (U.S.))
-Resource104=IDD_CHANGE_IP (English (U.S.))
-Resource105=IDD_OBJECT_GENERAL (English (U.S.))
-Resource106=IDD_ACTION_PROPERTIES (English (U.S.))
-Resource107=IDD_DCI_THRESHOLDS (English (U.S.))
+Resource95=IDD_DCI_COLLECTION (English (U.S.))
+Resource96=IDD_ACTION_PROPERTIES (English (U.S.))
+Resource97=IDD_DESKTOP_SAVE_AS (English (U.S.))
+Resource98=IDA_PACKAGE_MGR (English (U.S.))
+Resource99=IDD_DCI_SCHEDULE (English (U.S.))
+Resource100=IDA_EPP (English (U.S.))
+Resource101=IDD_SELECT_USER (English (U.S.))
+Resource102=IDD_DATA_QUERY (English (U.S.))
+Resource103=IDD_SELECT_INTERNAL_ITEM (English (U.S.))
+Resource104=IDD_REQUEST_PROCESSING (English (U.S.))
+Resource105=IDD_CREATE_TEMPLATE (English (U.S.))
+Resource106=IDD_EDIT_IP_SUBNET (English (U.S.))
+Resource107=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
 Class75=CInternalItemSelDlg
-Resource108=IDM_VIEW_SPECIFIC (English (U.S.))
+Resource108=IDM_CONTEXT (English (U.S.))
 Class76=CAgentParamSelDlg
-Resource109=IDA_OBJECT_TOOLS_EDITOR (English (U.S.))
+Resource109=IDD_NEW_ACTION (English (U.S.))
 Class77=CInputBox
-Resource110=IDA_GRAPH (English (U.S.))
+Resource110=IDD_EDIT_RULE_COMMENT (English (U.S.))
 Class78=CCreateNetSrvDlg
-Resource111=IDA_LAST_VALUES (English (U.S.))
+Resource111=IDD_OBJECT_PRESENTATION (English (U.S.))
 Class79=CNetSrvPropsGeneral
 Resource112=IDD_LOGIN (English (U.S.))
 Class80=CNodePropsPolling
 Class81=CDeploymentView
 Class82=CLastValuesView
 Class83=CValueList
-Resource113=IDD_OBJECT_NODE_POLL (English (U.S.))
+Resource113=IDA_ALARM_BROWSER (English (U.S.))
 Class84=CObjectPropsRelations
-Resource114=IDR_MAINFRAME (English (U.S.))
+Resource114=IDD_NEW_USER (English (U.S.))
 Class85=CSaveDesktopDlg
-Resource115=IDD_REMOVE_TEMPLATE
+Resource115=IDD_OBJECT_GENERAL (English (U.S.))
 Class86=CGraphSettingsPage
-Resource116=IDD_OBJTOOL_GENERAL (English (U.S.))
+Resource116=IDD_EDIT_EVENT (English (U.S.))
 Class87=CGraphDataPage
-Resource117=IDD_GRAPH_PROP_SETTINGS (English (U.S.))
+Resource117=IDA_ACTION_EDITOR (English (U.S.))
 Class88=CRemoveTemplateDlg
-Resource118=IDD_THRESHOLD (English (U.S.))
+Resource118=IDD_OBJECT_NODE_POLL (English (U.S.))
 Class89=CAddrChangeDlg
-Resource119=IDD_SELECT_ACTION (English (U.S.))
+Resource119=IDD_SAVE_AGENT_CFG (English (U.S.))
 Class90=CLastValuesPropDlg
 Class91=CAgentCfgEditor
-Resource120=IDM_CONTEXT (English (U.S.))
+Resource120=IDM_VIEW_SPECIFIC (English (U.S.))
 Class92=CDataExportDlg
 Class93=CServerCfgEditor
-Resource121=IDD_OBJECT_CAPS (English (U.S.))
-Resource122=IDD_CREATE_NODE (English (U.S.))
+Resource121=IDD_DCI_TRANSFORM (English (U.S.))
+Resource122=IDD_OBJECT_STATUS (English (U.S.))
 Class94=CEditVariableDlg
-Resource123=IDD_OBJECT_RELATIONS (English (U.S.))
+Resource123=IDA_NETMAP (English (U.S.))
 Class95=CCreateVPNConnDlg
-Resource124=IDD_EDIT_RULE_ALARM (English (U.S.))
+Resource124=IDD_EDIT_VARIABLE (English (U.S.))
 Class96=CVPNCPropsGeneral
-Resource125=IDD_SELECT_USER (English (U.S.))
+Resource125=IDD_EDIT_TRAP (English (U.S.))
 Class97=CEditSubnetDlg
-Resource126=IDD_CREATE_TEMPLATE (English (U.S.))
-Resource127=IDD_EDIT_RULE_COMMENT (English (U.S.))
+Resource126=IDD_OBJTOOL_OPTIONS (English (U.S.))
+Resource127=IDD_GRAPH_PROP_SETTINGS (English (U.S.))
 Class98=CModifiedAgentCfgDlg
 Class99=CSimpleSplitter
 Class100=CAdvSplitter
-Resource128=IDA_NETMAP (English (U.S.))
+Resource128=IDD_DCI_THRESHOLDS (English (U.S.))
 Class101=CTableView
 Class102=CWaitView
 Class103=CWebBrowser
 Class104=CSyslogBrowser
 Class105=CLPPList
-Resource129=IDD_EDIT_VARIABLE (English (U.S.))
+Resource129=IDA_LAST_VALUES (English (U.S.))
 Class106=CDCISchedulePage
-Resource130=IDA_TRAP_EDITOR (English (U.S.))
+Resource130=IDD_SELECT_OBJECT (English (U.S.))
 Class107=CObjectPropsStatus
 Class108=CObjectToolsEditor
-Resource131=IDA_EVENT_EDITOR (English (U.S.))
-Resource132=IDD_OBJECT_PRESENTATION (English (U.S.))
+Resource131=IDD_THRESHOLD (English (U.S.))
+Resource132=IDD_LASTVAL_PROP (English (U.S.))
 Class109=CObjToolPropGeneral
-Resource133=IDD_MIB_BROWSER (English (U.S.))
+Resource133=IDD_OBJECT_RELATIONS (English (U.S.))
 Class110=CObjToolPropColumns
-Resource134=IDD_OBJECT_STATUS (English (U.S.))
+Resource134=IDD_ABOUTBOX (English (U.S.))
 Class111=CNewObjectToolDlg
 Class112=CObjToolPropOptions
 Class113=CScriptManager
 Class114=CScriptView
-Resource135=IDD_CP_GENERAL (English (U.S.))
+Resource135=IDD_CREATE_VPNC (English (U.S.))
 Class115=CTrapLogBrowser
 Class116=CViewEditor
-Resource136=IDA_MDI_DEFAULT (English (U.S.))
-Resource137=IDD_EDIT_EVENT (English (U.S.))
+Resource136=IDD_USER_PROPERTIES (English (U.S.))
+Resource137=IDD_CREATE_CONTAINER (English (U.S.))
 Class117=CSNMPWalkDlg
 Class118=CMapToolbox
 Class119=CMapControlBox
-Resource138=IDA_PACKAGE_MGR (English (U.S.))
+Resource138=IDD_SELECT_EVENT (English (U.S.))
 Class120=CSubmapBkgndDlg
 Resource139=IDD_SUBMAP_BKGND (English (U.S.))
 
@@ -3859,8 +3859,8 @@ Control5=IDC_RADIO_NO_SCALE,button,1342373897
 Control6=IDC_RADIO_SCALE,button,1342177289
 Control7=IDOK,button,1342242817
 Control8=IDCANCEL,button,1342242816
-Control9=IDC_STATIC,static,1342308352
-Control10=IDC_STATIC,button,1342177287
+Control9=IDC_STATIC_FILE,static,1342308352
+Control10=IDC_STATIC_FRAME,button,1342177287
 
 [CLS:CSubmapBkgndDlg]
 Type=0
index 47cadc8..1041c15 100644 (file)
@@ -175,6 +175,15 @@ BOOL CConsoleApp::SetupWorkDir()
          return FALSE;
       }
 
+   // Create background image cache directory
+   strcpy(&g_szWorkDir[iLastChar], WORKDIR_BKIMAGECACHE);
+   if (!CreateDirectory(g_szWorkDir, NULL))
+      if (GetLastError() != ERROR_ALREADY_EXISTS)
+      {
+         AfxMessageBox(IDS_WORKDIR_CREATION_FAILED, MB_OK | MB_ICONSTOP);
+         return FALSE;
+      }
+
    // Success
    g_szWorkDir[iLastChar] = 0;
    return TRUE;
index b426ce0..7232e06 100644 (file)
@@ -2340,8 +2340,8 @@ BEGIN
                     "Button",BS_AUTORADIOBUTTON,13,85,125,10
     DEFPUSHBUTTON   "OK",IDOK,184,7,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,184,24,50,14
-    LTEXT           "File name:",IDC_STATIC,13,42,33,8
-    GROUPBOX        "Bitmap",IDC_STATIC,7,32,170,68
+    LTEXT           "File name:",IDC_STATIC_FILE,13,42,33,8
+    GROUPBOX        "Bitmap",IDC_STATIC_FRAME,7,32,170,68
 END
 
 
index ddb2f5f..d2dd560 100644 (file)
 #define IDC_RADIO_NBK                   1343
 #define IDC_RADIO_BITMAP                1344
 #define IDC_RADIO_NO_SCALE              1346
+#define IDC_STATIC_FRAME                1348
+#define IDC_STATIC_FILE                 1349
 #define IDR_WEB_BROWSER                 8100
 #define IDR_SYSLOG_BROWSER              8101
 #define IDR_LPP_EDITOR                  8102
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        313
 #define _APS_NEXT_COMMAND_VALUE         33009
-#define _APS_NEXT_CONTROL_VALUE         1348
+#define _APS_NEXT_CONTROL_VALUE         1350
 #define _APS_NEXT_SYMED_VALUE           127
 #endif
 #endif
index 9f667d1..cebd4b7 100644 (file)
@@ -737,7 +737,7 @@ HTREEITEM FindTreeCtrlItemEx(CTreeCtrl &ctrl, HTREEITEM hRoot, DWORD dwData)
 
 #define HIMETRIC_INCH   2540
 
-HBITMAP LoadPicture(TCHAR *pszFile)
+HBITMAP LoadPicture(TCHAR *pszFile, int nScaleFactor)
 {
        IPicture *pPicture = NULL;
        HBITMAP hBitmap = NULL;
@@ -770,6 +770,16 @@ HBITMAP LoadPicture(TCHAR *pszFile)
                   
                   int nWidth = MulDiv(hmWidth, pDC->GetDeviceCaps(LOGPIXELSX), HIMETRIC_INCH);
                   int nHeight = MulDiv(hmHeight, pDC->GetDeviceCaps(LOGPIXELSY), HIMETRIC_INCH);
+         if (nScaleFactor < 0)
+         {
+            nWidth /= -nScaleFactor;
+            nHeight /= -nScaleFactor;
+         }
+         else if (nScaleFactor > 0)
+         {
+            nWidth *= nScaleFactor;
+            nHeight *= nScaleFactor;
+         }
 
                   if (bmMem.CreateCompatibleBitmap(pDC, nWidth, nHeight))
                   {