| SourceCode/Bond/Servo/CPageGraph2.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/Servo/CPagePortStatus.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/Servo/CPagePortStatus.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/Servo/JobSlotGrid.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/Servo/JobSlotGrid.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/Servo/Servo.rc | 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/Servo/Servo.vcxproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/Servo/Servo.vcxproj.filters | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| SourceCode/Bond/Servo/resource.h | 补丁 | 查看 | 原始文档 | blame | 历史 |
SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -126,7 +126,7 @@ ASSERT(pItem); SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData; CHMPropertyDlg dlg(pEquipment->getName().c_str(), 600, 680); CHMPropertyDlg dlg(pEquipment->getName().c_str(), 658, 788); if (_strcmpi(pEquipment->getClassName(), "CLoadPort") == 0) { CPagePortProperty* pPageA = new CPagePortProperty(); SourceCode/Bond/Servo/CPagePortStatus.cpp
@@ -97,6 +97,16 @@ pComboBox->SetCurSel(cassetteStatus - 1); } // å建Job Existence Slotsæ§ä»¶ m_ctrlJobSlotGrid.Create(AfxRegisterWndClass(0), _T("JobSlotGrid"), WS_CHILD | WS_VISIBLE, CRect(0, 0, 100, 100), this, 1001); m_ctrlJobSlotGrid.SetGridSize(12, 16); m_ctrlJobSlotGrid.SetColors(RGB(34, 177, 76), RGB(200, 200, 200)); m_ctrlJobSlotGrid.SetSlotStatus(0, 1, true); m_ctrlJobSlotGrid.SetSlotStatus(1, 9, true); m_ctrlJobSlotGrid.SetSlotStatus(4, 9, false); m_ctrlJobSlotGrid.SetSlotStatus(4, 10, true, TRUE); return TRUE; // return TRUE unless you set the focus to a control // å¼å¸¸: OCX 屿§é¡µåºè¿å FALSE @@ -122,6 +132,17 @@ void CPagePortStatus::OnSize(UINT nType, int cx, int cy) { CHMPropertyPage::OnSize(nType, cx, cy); if (GetDlgItem(IDC_COMBO_PORT_STATUS) == nullptr) return; // TODO: 卿¤å¤æ·»å æ¶æ¯å¤çç¨åºä»£ç // å建Job Existence Slotsæ§ä»¶ CRect rcLabel, rcComboBox, rcClient; GetDlgItem(IDC_LABEL_JOB_EXISTENCE_SLOTS)->GetWindowRect(&rcLabel); ScreenToClient(rcLabel); GetDlgItem(IDC_COMBO_CASSETTE_STATUS)->GetWindowRect(&rcComboBox); ScreenToClient(rcComboBox); GetClientRect(rcClient); m_ctrlJobSlotGrid.MoveWindow(rcComboBox.left, rcLabel.top, rcClient.right - 22 - rcComboBox.left, rcClient.bottom - 12 - rcLabel.top); } SourceCode/Bond/Servo/CPagePortStatus.h
@@ -1,5 +1,6 @@ #pragma once #include "CHMPropertyPage.h" #include "JobSlotGrid.h" // CPagePortStatus å¯¹è¯æ¡ @@ -17,6 +18,8 @@ private: SERVO::CLoadPort* m_pPort; CJobSlotGrid m_ctrlJobSlotGrid; // å¯¹è¯æ¡æ°æ® #ifdef AFX_DESIGN_TIME SourceCode/Bond/Servo/JobSlotGrid.cpp
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,170 @@ #include "stdafx.h" #include "JobSlotGrid.h" #ifdef _DEBUG #define new DEBUG_NEW #endif IMPLEMENT_DYNAMIC(CJobSlotGrid, CWnd) BEGIN_MESSAGE_MAP(CJobSlotGrid, CWnd) ON_WM_PAINT() ON_WM_ERASEBKGND() END_MESSAGE_MAP() CJobSlotGrid::CJobSlotGrid() { // åå§åé»è®¤è¡åæ° int m_nRows = 12; int m_nCols = 16; // åå§åé»è®¤åä½ m_fontText.CreatePointFont(60, _T("Arial")); // åå§åé»è®¤é¢è² COLORREF m_colorHasJob = RGB(0, 200, 0); // é»è®¤ç»¿è² COLORREF m_colorNoJob = RGB(220, 220, 220); // é»è®¤ç°è² // åå§åé»è®¤ç»å· m_brushHasJob.CreateSolidBrush(m_colorHasJob); m_brushNoJob.CreateSolidBrush(m_colorNoJob); } CJobSlotGrid::~CJobSlotGrid() { if (m_fontText.GetSafeHandle()) { m_fontText.DeleteObject(); } if (m_brushHasJob.GetSafeHandle()) { m_brushHasJob.DeleteObject(); } if (m_brushNoJob.GetSafeHandle()) { m_brushNoJob.DeleteObject(); } } void CJobSlotGrid::SetGridSize(int nRows, int nCols) { m_nRows = nRows; m_nCols = nCols; m_vSlotStatus.assign(nRows, std::vector<bool>(nCols, false)); // åå§åææ¬æ°ç» m_vSlotText.assign(nRows, std::vector<CString>(nCols)); for (int i = 0; i < nRows; ++i) { for (int j = 0; j < nCols; ++j) { if (i == 0) { m_vSlotText[i][j].Format(_T("%d"), j + 1); } else if (j == 0) { m_vSlotText[i][j].Format(_T("%d"), i + 1); } } } Invalidate(); } void CJobSlotGrid::SetColors(COLORREF colorHasJob, COLORREF colorNoJob) { m_colorHasJob = colorHasJob; m_colorNoJob = colorNoJob; if (m_brushHasJob.GetSafeHandle()) { m_brushHasJob.DeleteObject(); } if (m_brushNoJob.GetSafeHandle()) { m_brushNoJob.DeleteObject(); } m_brushHasJob.CreateSolidBrush(m_colorHasJob); m_brushNoJob.CreateSolidBrush(m_colorNoJob); Invalidate(); } void CJobSlotGrid::SetSlotStatus(int nRow, int nCol, bool bHasJob, BOOL bInvalidate/* = TRUE*/) { if (nRow >= 0 && nRow < m_nRows && nCol >= 0 && nCol < m_nCols) { m_vSlotStatus[nRow][nCol] = bHasJob; if (bInvalidate) { Invalidate(); } } } void CJobSlotGrid::SetSlotText(int nRow, int nCol, const CString& strText) { if (nRow >= 0 && nRow < m_nRows && nCol >= 0 && nCol < m_nCols) { m_vSlotText[nRow][nCol] = strText; Invalidate(); } } void CJobSlotGrid::SetTextFont(const CString& strFontName, int nPointSize) { // å 餿§åä½ if (m_fontText.GetSafeHandle()) { m_fontText.DeleteObject(); } // CreatePointFont expects size in 1/10 pt m_fontText.CreatePointFont(nPointSize * 10, strFontName); Invalidate(); } void CJobSlotGrid::ClearAll() { if (m_vSlotStatus.empty()) { return; } for (int i = 0; i < m_nRows; ++i) { if (i < (int)m_vSlotStatus.size()) { std::fill(m_vSlotStatus[i].begin(), m_vSlotStatus[i].end(), false); } } Invalidate(); } BOOL CJobSlotGrid::OnEraseBkgnd(CDC* pDC) { return TRUE; } void CJobSlotGrid::OnPaint() { CPaintDC dc(this); DrawGrid(&dc); } void CJobSlotGrid::DrawGrid(CDC* pDC) { CRect rect; GetClientRect(&rect); int nCellWidth = rect.Width() / m_nCols; int nCellHeight = rect.Height() / m_nRows; CFont* pOldFont = pDC->SelectObject(&m_fontText); for (int i = 0; i < m_nRows; ++i) { for (int j = 0; j < m_nCols; ++j) { CRect cellRect(j * nCellWidth, i * nCellHeight, (j + 1) * nCellWidth, (i + 1) * nCellHeight); // èæ¯ CBrush* pBrush = m_vSlotStatus[i][j] ? &m_brushHasJob : &m_brushNoJob; pDC->FillRect(&cellRect, pBrush); // è¾¹æ¡ pDC->DrawEdge(&cellRect, EDGE_SUNKEN, BF_RECT); // æåï¼å± ä¸ï¼ pDC->SetBkMode(TRANSPARENT); pDC->SetTextColor(RGB(0, 0, 0)); pDC->DrawText(m_vSlotText[i][j], &cellRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); } } pDC->SelectObject(pOldFont); } SourceCode/Bond/Servo/JobSlotGrid.h
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,37 @@ #pragma once #include <afxwin.h> #include <vector> class CJobSlotGrid : public CWnd { DECLARE_DYNAMIC(CJobSlotGrid) public: CJobSlotGrid(); virtual ~CJobSlotGrid(); void SetGridSize(int nRows, int nCols); void SetColors(COLORREF colorHasJob, COLORREF colorNoJob); void SetSlotStatus(int nRow, int nCol, bool bHasJob, BOOL bInvalidate = TRUE); void SetSlotText(int nRow, int nCol, const CString& strText); void SetTextFont(const CString& strFontName, int nPointSize); void ClearAll(); protected: afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC* pDC); DECLARE_MESSAGE_MAP() private: int m_nRows; int m_nCols; CFont m_fontText; COLORREF m_colorHasJob; COLORREF m_colorNoJob; CBrush m_brushHasJob; CBrush m_brushNoJob; std::vector<std::vector<bool>> m_vSlotStatus; std::vector<std::vector<CString>> m_vSlotText; void DrawGrid(CDC* pDC); }; SourceCode/Bond/Servo/Servo.rcBinary files differ
SourceCode/Bond/Servo/Servo.vcxproj
@@ -202,6 +202,7 @@ <ClInclude Include="CGlassPool.h" /> <ClInclude Include="CPagePortStatus.h" /> <ClInclude Include="CPortStatusReport.h" /> <ClInclude Include="JobSlotGrid.h" /> <ClInclude Include="MsgDlg.h" /> <ClInclude Include="PageRecipe.h" /> <ClInclude Include="CDoubleGlass.h" /> @@ -305,6 +306,7 @@ <ClCompile Include="CGlassPool.cpp" /> <ClCompile Include="CPagePortStatus.cpp" /> <ClCompile Include="CPortStatusReport.cpp" /> <ClCompile Include="JobSlotGrid.cpp" /> <ClCompile Include="MsgDlg.cpp" /> <ClCompile Include="PageRecipe.cpp" /> <ClCompile Include="CDoubleGlass.cpp" /> SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -108,6 +108,7 @@ <ClCompile Include="CPortStatusReport.cpp" /> <ClCompile Include="MsgDlg.cpp" /> <ClCompile Include="CPagePortStatus.cpp" /> <ClCompile Include="JobSlotGrid.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="AlarmManager.h" /> @@ -215,6 +216,7 @@ <ClInclude Include="MsgDlg.h" /> <ClInclude Include="CPagePortStatus.h" /> <ClInclude Include="ServoCommo.h" /> <ClInclude Include="JobSlotGrid.h" /> </ItemGroup> <ItemGroup> <ResourceCompile Include="Servo.rc" /> SourceCode/Bond/Servo/resource.hBinary files differ