📄 frame.cpp
字号:
#include "pch.h"
#include "main.h"
#include "frame.h"
#include "import.h"
#include "export.h"
#include "message.h"
#include "doc.h"
#include "debug.h"
CNotifySplitter::CNotifySplitter ( )
{
m_pFrame = NULL ;
}
CNotifySplitter::~CNotifySplitter ( )
{
}
void CNotifySplitter::AttachTo ( CDancerFrame* pFrame )
{
m_pFrame = pFrame ;
}
void CNotifySplitter::StopTracking ( BOOL bAccept )
{
CSplitterWnd::StopTracking ( bAccept );
if ( m_pFrame != NULL && bAccept == TRUE )
{
m_pFrame->SaveSize ( ) ;
}
}
IMPLEMENT_DYNCREATE ( CDancerFrame , CMDIChildWnd )
BEGIN_MESSAGE_MAP ( CDancerFrame , CMDIChildWnd )
ON_WM_SIZE ( )
ON_WM_CREATE ( )
ON_WM_CLOSE ( )
END_MESSAGE_MAP ( )
CDancerFrame::CDancerFrame ( )
{
m_bReady = FALSE ;
m_fVRatio = 0.70f ;
m_fHRatio = 0.35f ;
m_wndVSplitter.AttachTo ( this ) ;
m_wndHSplitter.AttachTo ( this ) ;
}
CDancerFrame::~CDancerFrame ( )
{
}
BOOL CDancerFrame::PreCreateWindow ( CREATESTRUCT& CreateStruct )
{
if ( !CMDIChildWnd::PreCreateWindow ( CreateStruct ) )
return FALSE ;
return TRUE ;
}
int CDancerFrame::OnCreate ( LPCREATESTRUCT lpCreateStruct )
{
if ( CMDIChildWnd::OnCreate ( lpCreateStruct ) == -1 )
return -1 ;
return 0 ;
}
BOOL CDancerFrame::OnCreateClient ( LPCREATESTRUCT lpCreateStruct ,
CCreateContext* pContext )
{
// create splitters
m_wndVSplitter.CreateStatic ( this , 2 , 1 ) ;
m_wndHSplitter.CreateStatic (
&m_wndVSplitter ,
1 ,
2 ,
WS_CHILD | WS_VISIBLE ,
m_wndVSplitter.IdFromRowCol ( 0 , 0 ) ) ;
m_wndHSplitter.CreateView (
0 ,
0 ,
RUNTIME_CLASS ( CImportView ) ,
CSize ( 0 , 0 ) ,
pContext ) ;
m_wndHSplitter.CreateView (
0 ,
1 ,
RUNTIME_CLASS ( CExportView ) ,
CSize ( 0 , 0 ) ,
pContext ) ;
m_wndVSplitter.CreateView (
1 ,
0 ,
RUNTIME_CLASS ( CMessageView ) ,
CSize ( 0 , 0 ) ,
pContext ) ;
m_bReady = TRUE ;
// resize views
CRect rc ; GetClientRect ( &rc ) ;
ResizeViews ( rc.Width ( ) , rc.Height ( ) ) ;
return TRUE ;
}
void CDancerFrame::SaveSize ( )
{
int c , m ;
CRect rc ;
GetClientRect ( &rc ) ;
m_wndVSplitter.GetRowInfo ( 0 , c , m ) ;
m_fVRatio = ( FLOAT ) c / rc.Height ( ) ;
m_wndHSplitter.GetColumnInfo ( 0 , c , m ) ;
m_fHRatio = ( FLOAT ) c / rc.Width ( ) ;
}
void CDancerFrame::ResizeViews ( int cx , int cy )
{
if ( m_bReady == FALSE ) return ;
RecalcLayout ( ) ;
m_wndVSplitter.SetRowInfo (
0 ,
( int ) ( cy * m_fVRatio ) ,
10 ) ;
m_wndVSplitter.RecalcLayout ( ) ;
m_wndHSplitter.SetColumnInfo (
0 ,
( int ) ( cx * m_fHRatio ) ,
10 ) ;
m_wndHSplitter.RecalcLayout ( ) ;
}
void CDancerFrame::OnSize ( UINT nType , int cx , int cy )
{
CMDIChildWnd::OnSize ( nType , cx , cy ) ;
ResizeViews ( cx , cy ) ;
}
void CDancerFrame::OnClose ( )
{
CDancerDoc* pDoc = ( CDancerDoc* ) GetActiveDocument ( ) ;
if ( !pDoc->m_pDebugControl->IsDebugging ( ) ) CMDIChildWnd::OnClose ( ) ;
else AfxMessageBox ( IDS_INFO_DEBUGGING , MB_OK | MB_ICONINFORMATION ) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -