#include "stdafx.h" #include #include "cwxHistoryPanel.h" #include "ToolData.h" #include "RTCutSceneMakerFrame.h" #include "CmdProcessor.h" #include "CommandSet.h" BEGIN_EVENT_TABLE( cwxHistoryPanel, wxPanel ) EVT_LISTBOX( LIST_HISTORY_ID, cwxHistoryPanel::OnSelChangeHistory ) END_EVENT_TABLE() cwxHistoryPanel::cwxHistoryPanel( wxWindow* pParent, wxWindowID id ) : wxPanel( pParent, id ) { m_pTopSizer = new wxBoxSizer( wxVERTICAL ); m_pHistoryListBox = new wxListBox( this, LIST_HISTORY_ID ); m_pTopSizer->Add( m_pHistoryListBox, 1, wxALL|wxALIGN_CENTER|wxEXPAND, 3 ); this->SetSizer( m_pTopSizer ); m_pTopSizer->Fit( this ); m_pTopSizer->SetSizeHints( this ); // ¸¶¿ì½º ÈÙ ¸Þ½ÃÁö´Â 3D ÆÐ³Î·Î °¡µµ·Ï ÇÑ´Ù. CRTCutSceneMakerFrame* pMainFrame = static_cast( TOOL_DATA.GetMainFrame() ); pMainFrame->ConnectMouseWheelEventToRenderPanel( m_pHistoryListBox ); } cwxHistoryPanel::~cwxHistoryPanel(void) { } void cwxHistoryPanel::_UpdateHistorySelection( void ) { CCmdProcessor* pCmdProcessor = TOOL_DATA.GetCmdProcessor(); int iNumCmdHistory = pCmdProcessor->GetNumCmdHistory(); int iNowCmdIndex = pCmdProcessor->GetNowCmdHistoryIndex(); if( -1 != iNowCmdIndex ) m_pHistoryListBox->SetSelection( iNumCmdHistory-iNowCmdIndex-1 ); else m_pHistoryListBox->SetSelection( -1 ); } void cwxHistoryPanel::OnSelChangeHistory( wxCommandEvent& ListEvent ) { int iSelection = ListEvent.GetSelection(); // ÀÛ¾÷ È÷½ºÅ丮°¡ °»½Å µÇ¾úÀ¸¹Ç·Î ¸ðµç ºäµéÀ» °»½Å. TOOL_DATA.UpdateToThisHistory( iSelection ); _UpdateHistorySelection(); } void cwxHistoryPanel::CommandPerformed( ICommand* pCommand ) { CCmdProcessor* pCmdProcessor = TOOL_DATA.GetCmdProcessor(); if( pCmdProcessor->IsCommandUpdate() ) { m_pHistoryListBox->Hide(); m_pHistoryListBox->Clear(); int iNumCmdHistory = pCmdProcessor->GetNumCmdHistory(); for( int iCommand = 0; iCommand < iNumCmdHistory; ++iCommand ) { pCommand = pCmdProcessor->GetCmdHistory( iCommand ); m_pHistoryListBox->Insert( pCommand->GetDesc(), 0 ); } m_pHistoryListBox->Show(); _UpdateHistorySelection(); } }