📄 mainfrm.cpp
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "Programa.h"
#include "MainFrm.h"
#include "Posicion.h"
#include "ProgramaDoc.h"
#include "DatosView.h"
#include "GraficoView.h"
#include "MyPropertySheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_HERRAMIENTA_POSICIN, OnHerramientaPosicion)
ON_COMMAND(ID_ARCHIVO_PROPIEDADESDELPROYECTO, OnArchivoPropiedades)
ON_COMMAND(ID_SIMULACIN_DURACIN_TIEMPOUSUARIO, OnSimulacinDuracinTiempousuario)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
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(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect rect;
GetClientRect(&rect);
rect.NormalizeRect();
if (!m_wndSplitter.CreateStatic(this, 2, 1))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
if (!m_wndSegundoSplitter.CreateStatic(&m_wndSplitter, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplitter.IdFromRowCol(0, 0)))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndSegundoSplitter.CreateView(0, 0, RUNTIME_CLASS(CDatosView), CSize(rect.Width()/3,0), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSegundoSplitter.CreateView(0, 1, RUNTIME_CLASS(CGraficoView),CSize(0, 0), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(1, 0, pContext->m_pNewViewClass,CSize(0,50), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
m_wndSplitter.SetRowInfo(0, rect.Height()*6/5, rect.Height()*6/5);
return TRUE;
}
void CMainFrame::OnHerramientaPosicion()
{
CPosicion dlg;
dlg.m_dPosX = 0;
dlg.m_dPosY = 0;
dlg.DoModal();
}
void CMainFrame::OnProperties()
{
// TODO: The property sheet attached to your project
// via this function is not hooked up to any message
// handler. In order to actually use the property sheet,
// you will need to associate this function with a control
// in your project such as a menu item or tool bar button.
CMyPropertySheet propSheet;
propSheet.DoModal();
// This is where you would retrieve information from the property
// sheet if propSheet.DoModal() returned IDOK. We aren't doing
// anything for simplicity.
}
void CMainFrame::OnArchivoPropiedades()
{
CMyPropertySheet dlg;
dlg.m_Page1;
dlg.m_Page2;
dlg.DoModal();
}
void CMainFrame::OnSimulacinDuracinTiempousuario()
{
// TODO: Add your command handler code here
}
void CMainFrame::OnProperties1()
{
// TODO: The property sheet attached to your project
// via this function is not hooked up to any message
// handler. In order to actually use the property sheet,
// you will need to associate this function with a control
// in your project such as a menu item or tool bar button.
// CCuchilla propSheet;
// propSheet.DoModal();
// This is where you would retrieve information from the property
// sheet if propSheet.DoModal() returned IDOK. We aren't doing
// anything for simplicity.
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -