DragonNest/Client/EtEffect2Tool/MainFrm.cpp

251 lines
6.3 KiB
C++
Raw Normal View History

2024-12-19 09:48:26 +08:00
// MainFrm.cpp : CMainFrame Ŭ<><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
//
#include "stdafx.h"
#include "EtEffect2Tool.h"
#include "ParticlePaneView.h"
#include "FXPaneView.h"
#include "KeyframePropPaneView.h"
#include "PropertyPaneView.h"
#include "KeyControlPaneView.h"
#include "SequenceView.h"
#include "InputDevice.h"
#include "PreviewPaneView.h"
#include "MainFrm.h"
#include "../../Common/BugReporter/BugReporter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
CInputDevice g_InputDevice;
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CXTPFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CXTPFrameWnd)
ON_WM_CREATE()
ON_MESSAGE(XTPWM_DOCKINGPANE_NOTIFY, OnDockingPaneNotify)
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // <20><><EFBFBD><EFBFBD> <20><> ǥ<>ñ<EFBFBD>
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
// CMainFrame <20><><EFBFBD><EFBFBD>/<2F>Ҹ<EFBFBD>
CMainFrame::CMainFrame()
{
// TODO: <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ <20>ڵ带 <20>߰<EFBFBD><DFB0>մϴ<D5B4>.
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CXTPFrameWnd::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("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.\n");
// return -1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.
//}
//if (!m_wndStatusBar.Create(this) ||
// !m_wndStatusBar.SetIndicators(indicators,
// sizeof(indicators)/sizeof(UINT)))
//{
// TRACE0("<22><><EFBFBD><EFBFBD> ǥ<><C7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.\n");
// return -1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.
//}
//// TODO: <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ŷ<EFBFBD><C5B7> <20><> <20><><EFBFBD><EFBFBD> <20>Ϸ<EFBFBD><CFB7><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻʽÿ<CABD>.
//m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
//EnableDocking(CBRS_ALIGN_ANY);
//DockControlBar(&m_wndToolBar);
/*BugReporter::ReportingServerInfo info;
info.szServerURL = "http://192.168.0.20/bugreport/bugprocess.aspx";
char buff[512] = {0,};
gs_BugReporter.SetBuildVersion(std::string(buff));
gs_BugReporter.SetReportingServerInfo(info);
gs_BugReporter.Enable();*/
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
}
if (!InitCommandBars())
return -1;
CXTPPaintManager::SetTheme(xtpThemeOffice2003);
CXTPCommandBars* pCommandBars = GetCommandBars();
pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
CXTPToolBar* pStandardBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
if (!pStandardBar ||
!pStandardBar->LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1;
}
// Load the previous state for command bars.
LoadCommandBars(_T("CommandBars"));
m_paneManager.InstallDockingPanes(this);
CreatePanes();
m_paneManager.SetTheme(xtpPaneThemeOffice);
int nIDIcons[] = {1, 2, 3, 4, 5, 6};
m_paneManager.SetIcons(IDB_BITMAP_ICONS, nIDIcons, 7, RGB(255, 0, 255));
XTPPaintManager()->RefreshMetrics();
CInputDevice::GetInstance().Initialize( m_hWnd, CInputDevice::MOUSE );
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CXTPFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: CREATESTRUCT cs<63><73> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD> <20><><EFBFBD><EFBFBD><E2BFA1>
// Window Ŭ<><C5AC><EFBFBD><EFBFBD> <20>Ǵ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
return TRUE;
}
// CMainFrame <20><><EFBFBD><EFBFBD>
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CXTPFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CXTPFrameWnd::Dump(dc);
}
#endif //_DEBUG
// CMainFrame <20>޽<EFBFBD><DEBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD>
void CMainFrame::CreatePanes()
{
CXTPDockingPane *pane0 = CreatePane(RUNTIME_CLASS(CSequenceView), _T("Frame Control"), xtpPaneDockBottom);
CXTPDockingPane *pane1 = CreatePane(RUNTIME_CLASS(CParticlePaneView), _T("Particle Edit"), xtpPaneDockLeft);
CXTPDockingPane *pane2 = CreatePane(RUNTIME_CLASS(CFXPaneView), _T("FX Edit"), xtpPaneDockLeft);
CXTPDockingPane *pane3 = CreatePane(RUNTIME_CLASS(CPropertyPaneView), _T("Properties"), xtpPaneDockBottom, pane1, 300, 300);
CXTPDockingPane *pane4 = CreatePane(RUNTIME_CLASS(CKeyframePropPaneView), _T("Curve Properties"), xtpPaneDockBottom, pane1);
CXTPDockingPane *pane5 = CreatePane(RUNTIME_CLASS(CKeyControlPaneView), _T("Keyframe Control"), xtpPaneDockBottom );
CXTPDockingPane *pane6 = CreatePane(RUNTIME_CLASS(CPreviewPaneView), _T("Preview List"), xtpPaneDockLeft);
m_vecPanes.push_back(pane0);
m_vecPanes.push_back(pane1);
m_vecPanes.push_back(pane2);
m_vecPanes.push_back(pane3);
m_vecPanes.push_back(pane4);
m_vecPanes.push_back(pane5);
m_vecPanes.push_back(pane6);
m_paneManager.AttachPane( pane5, pane0);
m_paneManager.AttachPane( pane2, pane1);
m_paneManager.AttachPane( pane6, pane2);
m_paneManager.AttachPane( pane4, pane3);
m_paneManager.ShowPane( pane1 );
m_paneManager.ShowPane( pane3 );
m_paneManager.ShowPane( pane0 );
}
void CMainFrame::ShowPane( int nIndex )
{
m_paneManager.ShowPane( m_vecPanes[nIndex] );
}
LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
{
if (wParam == XTP_DPN_SHOWWINDOW)
{
// get a pointer to the docking pane being shown.
CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
if (!pPane->IsValid())
{
CWnd* pWnd = NULL;
if (m_mapPanes.Lookup(pPane->GetID(), pWnd))
{
pPane->Attach(pWnd);
}
}
return TRUE; // handled
}
if (wParam == XTP_DPN_CLOSEPANE)
{
CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
CWnd* pWnd =NULL;
if (!m_mapPanes.Lookup(pPane->GetID(), pWnd))
return FALSE;
return TRUE;
}
return FALSE;
}
CXTPDockingPane* CMainFrame::CreatePane(CRuntimeClass* pNewViewClass, CString strFormat, XTPDockingPaneDirection direction, CXTPDockingPane* pNeighbour, int width, int height)
{
int nID = ++m_nCount;
CXTPDockingPane* pwndPane = m_paneManager.CreatePane(
nID, CRect(0, 0,width, height), direction, pNeighbour);
CString strTitle;
strTitle.Format(strFormat, nID);
pwndPane->SetTitle(strTitle);
pwndPane->SetIconID(nID % 6 + 1);
CFrameWnd* pFrame = new CFrameWnd;
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = NULL;//GetActiveView()->GetDocument();
pFrame->Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, CRect(0, 0, 0, 0), this, NULL, 0, &context);
pFrame->ModifyStyleEx(WS_EX_CLIENTEDGE, 0);
pFrame->SendMessageToDescendants(WM_INITIALUPDATE, 0, 0, TRUE, TRUE);
m_mapPanes.SetAt(nID, pFrame);
return pwndPane;
}