From 78e91efc666606328e3fc63fbd54eb2da4442799 Mon Sep 17 00:00:00 2001 From: QuakeGod <quakegod@sina.com> Date: 星期二, 12 九月 2023 20:07:08 +0800 Subject: [PATCH] update mterm1doc.h with comment --- MTerm1/MainFrm.cpp | 647 +++++++++++++++++++++++++++++++--------------------------- 1 files changed, 348 insertions(+), 299 deletions(-) diff --git a/MTerm1/MainFrm.cpp b/MTerm1/MainFrm.cpp index 025ac29..bdd1f4b 100644 --- a/MTerm1/MainFrm.cpp +++ b/MTerm1/MainFrm.cpp @@ -5,8 +5,15 @@ #include "pch.h" #include "framework.h" #include "MTerm1.h" - #include "MainFrm.h" +#include "ChildFrm.h" + +#include "MTerm1Doc.h" +#include "MTerm1View.h" +#include "MTerm1CtrlView.h" +#include "MTerm1TestView.h" +#include "MTerm1ProgTxt.h" +#include <windows.h> #ifdef _DEBUG #define new DEBUG_NEW @@ -14,25 +21,36 @@ // CMainFrame -IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx) -const int iMaxUserToolbars = 10; -const UINT uiFirstUserToolBarId = AFX_IDW_CONTROLBAR_FIRST + 40; -const UINT uiLastUserToolBarId = uiFirstUserToolBarId + iMaxUserToolbars - 1; +IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx) ON_WM_CREATE() - ON_COMMAND(ID_WINDOW_MANAGER, &CMainFrame::OnWindowManager) - ON_COMMAND(ID_VIEW_CUSTOMIZE, &CMainFrame::OnViewCustomize) - ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR, &CMainFrame::OnToolbarCreateNew) - ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_WINDOWS_7, &CMainFrame::OnApplicationLook) - ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_WINDOWS_7, &CMainFrame::OnUpdateApplicationLook) - ON_WM_SETTINGCHANGE() + ON_COMMAND(ID_UPLOAD_FROM_PLC, &CMainFrame::OnUploadFromPlc) + ON_COMMAND(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnViewFunckeyBar) + ON_UPDATE_COMMAND_UI(ID_VIEW_FUNCKEY_BAR, &CMainFrame::OnUpdateViewFunckeyBar) + ON_COMMAND(ID_VIEW_INPUT_BAR, &CMainFrame::OnViewInputBar) + ON_UPDATE_COMMAND_UI(ID_VIEW_INPUT_BAR, &CMainFrame::OnUpdateViewInputBar) + ON_COMMAND(ID_VIEW_NUMKEY_BAR, &CMainFrame::OnViewNumkeyBar) + ON_UPDATE_COMMAND_UI(ID_VIEW_NUMKEY_BAR, &CMainFrame::OnUpdateViewNumkeyBar) + ON_COMMAND(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnViewInputsegBar) + ON_UPDATE_COMMAND_UI(ID_VIEW_INPUTSEG_BAR, &CMainFrame::OnUpdateViewInputsegBar) + ON_COMMAND(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnViewCommentsBar) + ON_UPDATE_COMMAND_UI(ID_VIEW_COMMENTS_BAR, &CMainFrame::OnUpdateViewCommentsBar) + +// ON_COMMAND(ID_MENU_VIEW_LDS, &CMainFrame::OnMenuViewLds) +// ON_COMMAND(ID_MENU_VIEW_BLD, &CMainFrame::OnMenuViewBld) +// ON_COMMAND(ID_MENU_VIEW_BNL, &CMainFrame::OnMenuViewBnl) + +ON_COMMAND(ID_MENU_SHOW_LOG, &CMainFrame::OnMenuShowLog) +ON_COMMAND(ID_MENU_SHOW_DEV, &CMainFrame::OnMenuShowDev) +ON_COMMAND(ID_MENU_SHOWNAV, &CMainFrame::OnMenuShownav) END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // 鐘舵�佽鎸囩ず鍣� + ID_INDICATOR_SEL_TYPE, ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, @@ -43,58 +61,141 @@ CMainFrame::CMainFrame() noexcept { // TODO: 鍦ㄦ娣诲姞鎴愬憳鍒濆鍖栦唬鐮� - theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_WIN_2000); // ID_VIEW_APPLOOK_VS_2008); } CMainFrame::~CMainFrame() { } +BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) +{ + // TODO: 鍦ㄦ娣诲姞涓撶敤浠g爜鍜�/鎴栬皟鐢ㄥ熀绫� +// if (m_wndDlgBar_Func_Key.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) return TRUE; + + return CMDIFrameWndEx::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); +} + int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; +// m_dlgMyLog.Create(m_dlgMyLog.IDD, GetParent()); +// m_dlgMyLog.ShowWindow(SW_SHOW); - BOOL bNameValid; +// BOOL bNameValid; - CMDITabInfo mdiTabParams; - mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 鍏朵粬鍙敤鏍峰紡... - mdiTabParams.m_bActiveTabCloseButton = TRUE; // 璁剧疆涓� FALSE 浼氬皢鍏抽棴鎸夐挳鏀剧疆鍦ㄩ�夐」鍗″尯鍩熺殑鍙充晶 - mdiTabParams.m_bTabIcons = FALSE; // 璁剧疆涓� TRUE 灏嗗湪 MDI 閫夐」鍗′笂鍚敤鏂囨。鍥炬爣 - mdiTabParams.m_bAutoColor = TRUE; // 璁剧疆涓� FALSE 灏嗙鐢� MDI 閫夐」鍗$殑鑷姩鐫�鑹� - mdiTabParams.m_bDocumentMenu = TRUE; // 鍦ㄩ�夐」鍗″尯鍩熺殑鍙宠竟缂樺惎鐢ㄦ枃妗h彍鍗� -// EnableMDITabbedGroups(TRUE, mdiTabParams); - - if (!m_wndMenuBar.Create(this)) + // 鍒涘缓绫昏鍥� + CString strNavView; +// bNameValid = strNavView.LoadString(IDS_CLASS_VIEW); +// ASSERT(bNameValid); +///* + strNavView = _T("瀵艰埅瑙嗗浘"); + if (!m_wndNavView.Create(strNavView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_NAVVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) { - TRACE0("鏈兘鍒涘缓鑿滃崟鏍廫n"); - return -1; // 鏈兘鍒涘缓 + TRACE0("鏈兘鍒涘缓鈥滃鑸鍥锯�濈獥鍙n"); + return FALSE; // 鏈兘鍒涘缓 } - - m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); - - // 闃叉鑿滃崟鏍忓湪婵�娲绘椂鑾峰緱鐒︾偣 - CMFCPopupMenu::SetForceMenuFocus(FALSE); - + m_wndNavView.EnableDocking(CBRS_ALIGN_LEFT); + DockPane(&m_wndNavView); + //DockControlBar(&m_wndNavView); +//*/ if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || - !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("鏈兘鍒涘缓宸ュ叿鏍廫n"); return -1; // 鏈兘鍒涘缓 } - CString strToolBarName; - bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); - ASSERT(bNameValid); - m_wndToolBar.SetWindowText(strToolBarName); + /* 杈撳叆鏍� + if (!m_wndTBar_InputShow.CreateEx(this, TBSTYLE_FLAT, + WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, + CRect(1, 1, 1, 1), IDW_TOOL_BAR2) || + !m_wndTBar_InputShow.LoadToolBar(IDR_TOOLBAR_INPUT_SHOW)) + { + TRACE0("鏈兘鍒涘缓鏁板瓧宸ュ叿鏍廫n"); + return -1; // 鏈兘鍒涘缓 + } + CRect rect1; + int index = m_wndTBar_InputShow.CommandToIndex(ID_BUTTON_INPUT_SHOW); + UINT nID,nStyle; + int iImage; + m_wndTBar_InputShow.GetButtonInfo(0, nID, nStyle, iImage); + m_wndTBar_InputShow.SetButtonInfo(index, ID_BUTTON_INPUT_SHOW, TBBS_SEPARATOR, 100); + m_wndTBar_InputShow.GetItemRect(index, &rect1); + rect1.left = 1; + rect1.top = 2; + rect1.right = rect1.left + 100; + rect1.bottom = rect1.top + 20; + //*/ +/* + if (!m_InputShowEdit.Create(WS_CHILD | WS_VISIBLE | WS_BORDER, rect1, \ + &m_wndTBar_InputShow, ID_BUTTON_INPUT_SHOW)) + { + TRACE(_T("Failed to create CEdit\n")); + return FALSE; + } - CString strCustomize; - bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); - ASSERT(bNameValid); - m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); + if (!m_InputShowStatic.Create(_T("Test1"),WS_CHILD | WS_VISIBLE |WS_EX_CLIENTEDGE, rect1, \ + &m_wndTBar_InputShow, ID_BUTTON_INPUT_SHOW)) + { + TRACE(_T("Failed to create CStaticEx\n")); + return FALSE; + } + m_InputShowStatic.SetBkColor(RGB(255, 255, 255)); + m_InputShowStatic.SetTextColor(RGB(255, 128, 128)); + m_InputShowStatic.SetTextSize(20); +//*/ + //m_InputShowEdit.SetReadOnly(true); +/* + if (!m_wndTBar_Num_Key.CreateEx(this, TBSTYLE_FLAT, + WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, + CRect(1,1,1,1),IDW_TOOL_BAR2) || + !m_wndTBar_Num_Key.LoadToolBar(IDR_TOOLBAR_NUM_KEY)) + { + TRACE0("鏈兘鍒涘缓鏁板瓧閿伐鍏锋爮\n"); + return -1; // 鏈兘鍒涘缓 + } +//*/ - // 鍏佽鐢ㄦ埛瀹氫箟鐨勫伐鍏锋爮鎿嶄綔: - InitUserToolbars(nullptr, uiFirstUserToolBarId, uiLastUserToolBarId); +/* + if (!m_wndTBar_Edit_Key.CreateEx(this, TBSTYLE_FLAT, + WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, + CRect(1, 1, 1, 1), IDR_TOOLBAR_EDIT_KEY) || + !m_wndTBar_Edit_Key.LoadToolBar(IDR_TOOLBAR_EDIT_KEY)) + { + TRACE0("鏈兘鍒涘缓缂栬緫閿伐鍏锋爮\n"); + return -1; // 鏈兘鍒涘缓 + } + //*/ +/* + if (!m_wndToolBar_Func_Key.CreateEx(this, TBSTYLE_FLAT, + WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, + CRect(1, 1, 1, 1), IDW_TOOL_BAR_FUNC_KEY) || + !m_wndToolBar_Func_Key.LoadToolBar(IDR_TOOLBAR_FUNC_KEY2)) + { + TRACE0("鏈兘鍒涘缓鍔熻兘閿伐鍏锋爮\n"); + return -1; // 鏈兘鍒涘缓 + } + //m_wndToolBar_Func_Key.SetTwoRowsWithSibling(); +//*/ +/* + if (!m_wndDlgBar_InputShow.Create(this, IDD_DIALOGBAR_INPUT_SHOW, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, + IDD_DIALOGBAR_INPUT_SHOW)) + { + TRACE0("鏈兘鍒涘缓鍔熻兘閿�2宸ュ叿鏍廫n"); + return -1; // 鏈兘鍒涘缓 + } +//*/ + /* + if (!m_wndDlgBar_Func_Key.Create(this, IDD_DIALOGBAR_FUNC_KEYS,WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, + IDD_DIALOGBAR_FUNC_KEYS)) + { + TRACE0("鏈兘鍒涘缓鍔熻兘閿�2宸ュ叿鏍廫n"); + return -1; // 鏈兘鍒涘缓 + } +// ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, TRUE); +// m_wndDlgBar_Func_Key.MoveWindow(100, 100, 200, 200); + //*/ if (!m_wndStatusBar.Create(this)) { @@ -102,96 +203,74 @@ return -1; // 鏈兘鍒涘缓 } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); + m_wndStatusBar.SetPaneStyle(0, SBPS_STRETCH); + //m_wndStatusBar.OnCtlColor(); +///* + if (!m_wndMyPaneLog.Create(_T("鏃ュ織绐楀彛"), this, CRect(0, 0, 200, 200), TRUE, 1235, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS + | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) + { + TRACE0("鏈兘鍒涘缓鈥淢yPaneLog绐楀彛\n"); + return FALSE; + } + m_wndMyPaneLog.EnableDocking(CBRS_ALIGN_ANY); +//*/ +// // +///* + + if (!m_wndMyPaneInputShow.Create(_T("杈撳叆绐楀彛"), this, CRect(2, 2, 20, 20), TRUE, 1236, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS + | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI)) + { + TRACE0("鏈兘鍒涘缓鈥淢yPaneInputShow绐楀彛\n"); + return FALSE; + } + m_wndMyPaneInputShow.EnableDocking(CBRS_ALIGN_BOTTOM); - // TODO: 濡傛灉鎮ㄤ笉甯屾湜宸ュ叿鏍忓拰鑿滃崟鏍忓彲鍋滈潬锛岃鍒犻櫎杩欎簲琛� - m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); +//*/ +// m_dlgMyLog.Create(m_dlgMyLog.IDD, this); +// m_dlgMyLog.ModifyStyle(0, WS_POPUPWINDOW); +// m_dlgMyLog.ShowWindow(SW_SHOW); + + // TODO: 濡傛灉涓嶉渶瑕佸彲鍋滈潬宸ュ叿鏍忥紝鍒欏垹闄よ繖涓夎 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); - DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); +// DockControlBar(&m_wndToolBar); + +// EnableDocking(CBRS_ALIGN_ANY); - // 鍚敤 Visual Studio 2005 鏍峰紡鍋滈潬绐楀彛琛屼负 - CDockingManager::SetDockingMode(DT_SMART); - // 鍚敤 Visual Studio 2005 鏍峰紡鍋滈潬绐楀彛鑷姩闅愯棌琛屼负 - EnableAutoHidePanes(CBRS_ALIGN_ANY); - // 鍔犺浇鑿滃崟椤瑰浘鍍�(涓嶅湪浠讳綍鏍囧噯宸ュ叿鏍忎笂): - CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); +// CDockablePane* pTabbedBar = nullptr; +// m_wndNavView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); - // 鍒涘缓鍋滈潬绐楀彛 - if (!CreateDockingWindows()) - { - TRACE0("鏈兘鍒涘缓鍋滈潬绐楀彛\n"); - return -1; - } - m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); - m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); - DockPane(&m_wndFileView); - CDockablePane* pTabbedBar = nullptr; - m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); - m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); - DockPane(&m_wndOutput); - m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); - DockPane(&m_wndProperties); +///* +// m_wndDlgBar_InputShow.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM); +// m_wndTBar_Num_Key.EnableDocking(CBRS_ALIGN_ANY); +// m_wndTBar_Edit_Key.EnableDocking(CBRS_ALIGN_ANY); +// m_wndToolBar_Func_Key.EnableDocking(CBRS_ALIGN_ANY); +// m_wndDlgBar_Func_Key.EnableDocking(CBRS_ALIGN_TOP| CBRS_ALIGN_BOTTOM); - // 鍩轰簬鎸佷箙鍊艰缃瑙夌鐞嗗櫒鍜屾牱寮� - OnApplicationLook(theApp.m_nAppLook); +// EnableDocking(CBRS_ALIGN_ANY); - // 鍚敤澧炲己鐨勭獥鍙g鐞嗗璇濇 - EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); +// DockPane(&m_wndToolBar); - // 鍚敤宸ュ叿鏍忓拰鍋滈潬绐楀彛鑿滃崟鏇挎崲 - EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); +// DockControlBar(&m_wndDlgBar_InputShow); +// DockControlBar(&m_wndTBar_Num_Key); +// DockControlBar(&m_wndTBar_Edit_Key); +// DockPane(&m_wndToolBar_Func_Key); +// DockPane(&m_wndDlgBar_Func_Key); +// DockControlBar(&m_wndDlgBar_Func_Key); + DockPane(&m_wndMyPaneInputShow); + DockPane(&m_wndNavView); + DockPane(&m_wndMyPaneLog); - // 鍚敤蹇��(鎸変綇 Alt 鎷栧姩)宸ュ叿鏍忚嚜瀹氫箟 - CMFCToolBar::EnableQuickCustomization(); +// m_wndMyPaneInputShow.m_pMyFormInputShow->SetBtnDisplayESC(1); - if (CMFCToolBar::GetUserImages() == nullptr) - { - // 鍔犺浇鐢ㄦ埛瀹氫箟鐨勫伐鍏锋爮鍥惧儚 - if (m_UserImages.Load(_T(".\\UserImages.bmp"))) - { - CMFCToolBar::SetUserImages(&m_UserImages); - } - } - - // 鍚敤鑿滃崟涓�у寲(鏈�杩戜娇鐢ㄧ殑鍛戒护) - // TODO: 瀹氫箟鎮ㄨ嚜宸辩殑鍩烘湰鍛戒护锛岀‘淇濇瘡涓笅鎷夎彍鍗曡嚦灏戞湁涓�涓熀鏈懡浠ゃ�� - CList<UINT, UINT> lstBasicCommands; - - lstBasicCommands.AddTail(ID_FILE_NEW); - lstBasicCommands.AddTail(ID_FILE_OPEN); - lstBasicCommands.AddTail(ID_FILE_SAVE); - lstBasicCommands.AddTail(ID_FILE_PRINT); - lstBasicCommands.AddTail(ID_APP_EXIT); - lstBasicCommands.AddTail(ID_EDIT_CUT); - lstBasicCommands.AddTail(ID_EDIT_PASTE); - lstBasicCommands.AddTail(ID_EDIT_UNDO); - lstBasicCommands.AddTail(ID_APP_ABOUT); - lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR); - lstBasicCommands.AddTail(ID_VIEW_TOOLBAR); - lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003); - lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005); - lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE); - lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER); - lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK); - lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA); - lstBasicCommands.AddTail(ID_VIEW_APPLOOK_WINDOWS_7); - lstBasicCommands.AddTail(ID_SORTING_SORTALPHABETIC); - lstBasicCommands.AddTail(ID_SORTING_SORTBYTYPE); - lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS); - lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE); - -// CMFCToolBar::SetBasicCommands(lstBasicCommands); - - // 灏嗘枃妗e悕鍜屽簲鐢ㄧ▼搴忓悕绉板湪绐楀彛鏍囬鏍忎笂鐨勯『搴忚繘琛屼氦鎹€�傝繖 - // 灏嗘敼杩涗换鍔℃爮鐨勫彲鐢ㄦ�э紝鍥犱负鏄剧ず鐨勬枃妗e悕甯︽湁缂╃暐鍥俱�� - ModifyStyle(0, FWS_PREFIXTITLE); - +//*/ return 0; } + BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { @@ -201,71 +280,6 @@ // CREATESTRUCT cs 鏉ヤ慨鏀圭獥鍙g被鎴栨牱寮� return TRUE; -} - -BOOL CMainFrame::CreateDockingWindows() -{ - BOOL bNameValid; - - // 鍒涘缓绫昏鍥� - CString strClassView; - bNameValid = strClassView.LoadString(IDS_CLASS_VIEW); - ASSERT(bNameValid); - if (!m_wndClassView.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_CLASSVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) - { - TRACE0("鏈兘鍒涘缓鈥滅被瑙嗗浘鈥濈獥鍙n"); - return FALSE; // 鏈兘鍒涘缓 - } - - // 鍒涘缓鏂囦欢瑙嗗浘 - CString strFileView; - bNameValid = strFileView.LoadString(IDS_FILE_VIEW); - ASSERT(bNameValid); - if (!m_wndFileView.Create(strFileView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_FILEVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI)) - { - TRACE0("鏈兘鍒涘缓鈥滄枃浠惰鍥锯�濈獥鍙n"); - return FALSE; // 鏈兘鍒涘缓 - } - - // 鍒涘缓杈撳嚭绐楀彛 - CString strOutputWnd; - bNameValid = strOutputWnd.LoadString(IDS_OUTPUT_WND); - ASSERT(bNameValid); - if (!m_wndOutput.Create(strOutputWnd, this, CRect(0, 0, 100, 100), TRUE, ID_VIEW_OUTPUTWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI)) - { - TRACE0("鏈兘鍒涘缓杈撳嚭绐楀彛\n"); - return FALSE; // 鏈兘鍒涘缓 - } - - // 鍒涘缓灞炴�х獥鍙� - CString strPropertiesWnd; - bNameValid = strPropertiesWnd.LoadString(IDS_PROPERTIES_WND); - ASSERT(bNameValid); - if (!m_wndProperties.Create(strPropertiesWnd, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PROPERTIESWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) - { - TRACE0("鏈兘鍒涘缓鈥滃睘鎬р�濈獥鍙n"); - return FALSE; // 鏈兘鍒涘缓 - } - - SetDockingWindowIcons(theApp.m_bHiColorIcons); - return TRUE; -} - -void CMainFrame::SetDockingWindowIcons(BOOL bHiColorIcons) -{ - HICON hFileViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_FILE_VIEW_HC : IDI_FILE_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); - m_wndFileView.SetIcon(hFileViewIcon, FALSE); - - HICON hClassViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_CLASS_VIEW_HC : IDI_CLASS_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); - m_wndClassView.SetIcon(hClassViewIcon, FALSE); - - HICON hOutputBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_OUTPUT_WND_HC : IDI_OUTPUT_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); - m_wndOutput.SetIcon(hOutputBarIcon, FALSE); - - HICON hPropertiesBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_PROPERTIES_WND_HC : IDI_PROPERTIES_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); - m_wndProperties.SetIcon(hPropertiesBarIcon, FALSE); - - UpdateMDITabbedBarsIcons(); } // CMainFrame 璇婃柇 @@ -285,146 +299,181 @@ // CMainFrame 娑堟伅澶勭悊绋嬪簭 -void CMainFrame::OnWindowManager() -{ - ShowWindowsDialog(); -} -void CMainFrame::OnViewCustomize() -{ - CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog(this, TRUE /* 鎵弿鑿滃崟*/); - pDlgCust->EnableUserDefinedToolbars(); - pDlgCust->Create(); -} -LRESULT CMainFrame::OnToolbarCreateNew(WPARAM wp,LPARAM lp) +void CMainFrame::OnUploadFromPlc() { - LRESULT lres = CMDIFrameWndEx::OnToolbarCreateNew(wp,lp); - if (lres == 0) + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + SysLog(_T("Upload from PLC, (From mainframe)")); + CWinAppEx* pApp = &theApp; + + POSITION curTemplatePos = theApp.m_pDocManager->GetFirstDocTemplatePosition(); + if (curTemplatePos != NULL) { - return 0; + CDocTemplate* curTemplate = theApp.m_pDocManager->GetNextDocTemplate(curTemplatePos); + CMTerm1Doc* pDoc = (CMTerm1Doc* ) curTemplate->OpenDocumentFile(NULL); + if (pDoc) pDoc->OnUploadFromPlc(); } - CMFCToolBar* pUserToolbar = (CMFCToolBar*)lres; - ASSERT_VALID(pUserToolbar); - - BOOL bNameValid; - CString strCustomize; - bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); - ASSERT(bNameValid); - - pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); - return lres; } -void CMainFrame::OnApplicationLook(UINT id) +void CMainFrame::OnMenuShowLog() { - CWaitCursor wait; + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndMyPaneLog.ShowWindow(SW_SHOW); +// m_wndNavView.ShowWindow(SW_SHOW); +} - theApp.m_nAppLook = id; - switch (theApp.m_nAppLook) +void CMainFrame::OnViewFunckeyBar() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + CString s1; + s1.Format(_T("鏄剧ず鍔熻兘閿爮")); + SysLog(s1); +// m_wndDlgBar_Func_Key.ShowWindow(SW_HIDE); +// m_wndDlgBar_Func_Key.ShowWindow(SW_SHOW); +// ShowControlBar(&m_wndDlgBar_Func_Key, TRUE, FALSE); + +} + + +void CMainFrame::OnUpdateViewFunckeyBar(CCmdUI *pCmdUI) +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护鏇存柊鐢ㄦ埛鐣岄潰澶勭悊绋嬪簭浠g爜 + +} + + +void CMainFrame::OnViewInputBar() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 +} + + +void CMainFrame::OnUpdateViewInputBar(CCmdUI *pCmdUI) +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护鏇存柊鐢ㄦ埛鐣岄潰澶勭悊绋嬪簭浠g爜 +} + + +void CMainFrame::OnViewNumkeyBar() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + CString s1; + s1.Format(_T("鏄剧ず鏁板瓧閿爮")); + SysLog(s1); +// m_wndTBar_Num_Key.ShowWindow(SW_HIDE); +// m_wndTBar_Num_Key.ShowWindow(SW_SHOW); + +} + + +void CMainFrame::OnUpdateViewNumkeyBar(CCmdUI *pCmdUI) +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护鏇存柊鐢ㄦ埛鐣岄潰澶勭悊绋嬪簭浠g爜 +} + + +void CMainFrame::OnViewInputsegBar() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 +} + + +void CMainFrame::OnUpdateViewInputsegBar(CCmdUI *pCmdUI) +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护鏇存柊鐢ㄦ埛鐣岄潰澶勭悊绋嬪簭浠g爜 +} + + +void CMainFrame::OnViewCommentsBar() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 +} + + +void CMainFrame::OnUpdateViewCommentsBar(CCmdUI *pCmdUI) +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护鏇存柊鐢ㄦ埛鐣岄潰澶勭悊绋嬪簭浠g爜 +} +/* +CView * FindView(CDocument * pDoc, CRuntimeClass * pClass) +{ + CView* pView = NULL; + POSITION pos = pDoc->GetFirstViewPosition(); + while (pos != NULL) { - case ID_VIEW_APPLOOK_WIN_2000: - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager)); - break; - - case ID_VIEW_APPLOOK_OFF_XP: - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP)); - break; - - case ID_VIEW_APPLOOK_WIN_XP: - CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE; - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); - break; - - case ID_VIEW_APPLOOK_OFF_2003: - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003)); - CDockingManager::SetDockingMode(DT_SMART); - break; - - case ID_VIEW_APPLOOK_VS_2005: - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005)); - CDockingManager::SetDockingMode(DT_SMART); - break; - - case ID_VIEW_APPLOOK_VS_2008: - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008)); - CDockingManager::SetDockingMode(DT_SMART); - break; - - case ID_VIEW_APPLOOK_WINDOWS_7: - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7)); - CDockingManager::SetDockingMode(DT_SMART); - break; - - default: - switch (theApp.m_nAppLook) - { - case ID_VIEW_APPLOOK_OFF_2007_BLUE: - CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); + pView = pDoc->GetNextView(pos); + if (pView->IsKindOf(pClass)) break; - - case ID_VIEW_APPLOOK_OFF_2007_BLACK: - CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack); - break; - - case ID_VIEW_APPLOOK_OFF_2007_SILVER: - CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); - break; - - case ID_VIEW_APPLOOK_OFF_2007_AQUA: - CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua); - break; - } - - CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager)); - CDockingManager::SetDockingMode(DT_SMART); } - - m_wndOutput.UpdateFonts(); - RedrawWindow(nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE); - - theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook); -} - -void CMainFrame::OnUpdateApplicationLook(CCmdUI* pCmdUI) -{ - pCmdUI->SetRadio(theApp.m_nAppLook == pCmdUI->m_nID); -} - - -BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext) -{ - // 鍩虹被灏嗘墽琛岀湡姝g殑宸ヤ綔 - - if (!CMDIFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext)) + if (!pView->IsKindOf(pClass)) { - return FALSE; + //AfxMessageBox("Connt Locate the View."); + return NULL; } + return pView; +} +*/ +int CMainFrame::GetInputInfo(int inputInfo) +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + CString m_InputInfo; - // 涓烘墍鏈夌敤鎴峰伐鍏锋爮鍚敤鑷畾涔夋寜閽� - BOOL bNameValid; - CString strCustomize; - bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); - ASSERT(bNameValid); + CString s1; + s1.Format(_T("From MainFrame , input %s"), m_InputInfo); + SysLog(s1); - for (int i = 0; i < iMaxUserToolbars; i ++) - { - CMFCToolBar* pUserToolbar = GetUserToolBarByIndex(i); - if (pUserToolbar != nullptr) - { - pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); - } - } + // m_wndDlgBar_InputShow.SetDisplay(inputInfo); - return TRUE; + return 0; } - -void CMainFrame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection) +int CMainFrame::SetDisplayInfo(int Info) { - CMDIFrameWndEx::OnSettingChange(uFlags, lpszSection); - m_wndOutput.UpdateFonts(); + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + CString m_InputInfo; + + CString s1; + s1.Format(_T("From MainFrame , SetDisplayInfo %x"), Info); + SysLog(s1); + + // m_wndDlgBar_InputShow.SetDisplay(inputInfo); + m_wndMyPaneInputShow.m_pMyFormInputShow->SetDisplay(Info); + return 0; +} + +int CMainFrame::SetCellInfo(int info) +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + CString m_InputInfo; + + CString s1; + s1.Format(_T("From MainFrame , SetCellInfo %x"), info); + SysLog(s1); + +// m_wndDlgBar_InputShow.SetDisplay(inputInfo); + + return 0; +} + +int CMainFrame::GetInputCell(tagInputCell inputCell) +{ + + // localInputCell = inputCell; + return 0; +} + +void CMainFrame::OnMenuShowDev() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + +} + +void CMainFrame::OnMenuShownav() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + m_wndNavView.ShowWindow(SW_SHOW); } -- Gitblit v1.9.1