| | |
| | | /* 创建终端的定时器 */ |
| | | #define TIMER_ID_CREATE_TERMINAL 1 |
| | | |
| | | /* 运行时间定时器 */ |
| | | #define TIMER_ID_UPDATE_RUMTIME 2 |
| | | |
| | | |
| | | |
| | | // 用于应用程序“关于”菜单项的 CAboutDlg 对话框 |
| | | |
| | |
| | | m_pPageLog = nullptr; |
| | | m_pPageRecipe = nullptr; |
| | | m_pTopToolbar = nullptr; |
| | | m_pMyStatusbar = nullptr; |
| | | } |
| | | |
| | | void CServoDlg::DoDataExchange(CDataExchange* pDX) |
| | |
| | | m_pPanelEquipment->Create(IDD_PANEL_EQUIPMENT, this); |
| | | m_pPanelAttributes = new CPanelAttributes(); |
| | | m_pPanelAttributes->Create(IDD_PANEL_ATTRIBUTES, this); |
| | | |
| | | |
| | | // statusbar |
| | | m_pMyStatusbar = new CMyStatusbar(); |
| | | m_pMyStatusbar->Create(IDD_STATUSBAR, this); |
| | | m_pMyStatusbar->ShowWindow(SW_SHOW); |
| | | |
| | | |
| | | |
| | | // 调整初始窗口位置 |
| | |
| | | m_pTopToolbar = nullptr; |
| | | } |
| | | |
| | | if (m_pMyStatusbar != nullptr) { |
| | | m_pMyStatusbar->DestroyWindow(); |
| | | delete m_pMyStatusbar; |
| | | m_pMyStatusbar = nullptr; |
| | | } |
| | | |
| | | if (m_pTerminalDisplayDlg != nullptr) { |
| | | m_pTerminalDisplayDlg->DestroyWindow(); |
| | | delete m_pTerminalDisplayDlg; |
| | |
| | | } |
| | | |
| | | #define TOOLBAR_HEIGHT 78 |
| | | #define STATUSBAR_HEIGHT 38 |
| | | void CServoDlg::Resize() |
| | | { |
| | | CRect rcClient, rcItem; |
| | | CWnd* pItem = nullptr; |
| | | int x, y; |
| | | int x, y, y2; |
| | | GetClientRect(&rcClient); |
| | | |
| | | x = 0; |
| | | y = 0; |
| | | y2 = rcClient.bottom - STATUSBAR_HEIGHT; |
| | | m_pTopToolbar->MoveWindow(0, 0, rcClient.Width(), TOOLBAR_HEIGHT); |
| | | y += TOOLBAR_HEIGHT; |
| | | |
| | | |
| | | |
| | | |
| | | int nPanelWidth = 0; |
| | | if (m_pPanelMaster != nullptr) { |
| | | nPanelWidth = m_pPanelMaster->getPanelWidth(); |
| | | m_pPanelMaster->MoveWindow(x, y, nPanelWidth, rcClient.Height()); |
| | | m_pPanelMaster->MoveWindow(x, y, nPanelWidth, y2 - y); |
| | | x += nPanelWidth; |
| | | } |
| | | |
| | | if (m_pPanelEquipment != nullptr && m_pPanelEquipment->IsWindowVisible()) { |
| | | nPanelWidth = m_pPanelEquipment->getPanelWidth(); |
| | | m_pPanelEquipment->MoveWindow(x, y, nPanelWidth, rcClient.Height()); |
| | | m_pPanelEquipment->MoveWindow(x, y, nPanelWidth, y2 - y); |
| | | x += nPanelWidth; |
| | | } |
| | | |
| | | if (m_pPanelAttributes != nullptr && m_pPanelAttributes->IsWindowVisible()) { |
| | | nPanelWidth = m_pPanelAttributes->getPanelWidth(); |
| | | m_pPanelAttributes->MoveWindow(x, y, nPanelWidth, rcClient.Height()); |
| | | m_pPanelAttributes->MoveWindow(x, y, nPanelWidth, y2 - y); |
| | | x += nPanelWidth; |
| | | } |
| | | |
| | |
| | | y += rcItem.Height(); |
| | | |
| | | |
| | | m_pPageGraph1->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y); |
| | | m_pPageGraph2->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y); |
| | | m_pPageRecipe->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y); |
| | | m_pPageAlarm->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y); |
| | | m_pPageLog->MoveWindow(x, y, rcClient.Width() - x, rcClient.Height() - y); |
| | | m_pPageGraph1->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageGraph2->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageRecipe->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageAlarm->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | m_pPageLog->MoveWindow(x, y, rcClient.Width() - x, y2 - y); |
| | | |
| | | |
| | | m_pMyStatusbar->MoveWindow(0, y2, rcClient.Width(), STATUSBAR_HEIGHT); |
| | | } |
| | | |
| | | void CServoDlg::OnClose() |
| | |
| | | m_pTerminalDisplayDlg->Create(IDD_DIALOG_TERMINAL_DISPLAY, this); |
| | | } |
| | | |
| | | if (TIMER_ID_UPDATE_RUMTIME == nIDEvent) { |
| | | static int index = 0; index++; |
| | | if (index >= 4) index = 0; |
| | | static char* status[] = {"|", "/", "--", "\\"}; |
| | | |
| | | CTime time = CTime::GetCurrentTime(); |
| | | CString strText; |
| | | strText.Format(_T("已运行:%d-%02d-%02d %02d:%02d:%02d %s"), |
| | | time.GetYear(), time.GetMonth(), time.GetDay(), |
| | | time.GetHour(), time.GetMinute(), time.GetSecond(), |
| | | status[index]); |
| | | m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText); |
| | | } |
| | | |
| | | |
| | | CDialogEx::OnTimer(nIDEvent); |
| | | } |
| | | |
| | |
| | | theApp.m_model.getMaster().start(); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(TRUE); |
| | | m_pMyStatusbar->setBkgnd(STATUSBAR_BK_RUNNING); |
| | | SetTimer(TIMER_ID_UPDATE_RUMTIME, 1000, nullptr); |
| | | |
| | | } |
| | | else if (id == IDC_BUTTON_STOP) { |
| | | theApp.m_model.getMaster().stop(); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE); |
| | | m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE); |
| | | m_pMyStatusbar->setBkgnd(STATUSBAR_BK_ALARM); |
| | | KillTimer(TIMER_ID_UPDATE_RUMTIME); |
| | | } |
| | | else if (id == IDC_BUTTON_ROBOT) { |
| | | SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)theApp.m_model.getMaster().getEquipment(EQ_ID_EFEM); |