?? rightdownsplitter.cpp
字號:
/*
右下的splitter,單獨做是因為它包含了變化的元素,便于處理
*/
#include "rightdownsplitter.h"
#include "threadinfowindow.h" //顯示線程信息的窗口,右邊
#include "showtablewindow.h" //顯示圖表的窗口,右邊
#include "taskdetailreport.h" //任務詳細信息窗口,右邊
#include "righttree.h" //左邊的選擇控件
#include "mainframe.h"
#include <iostream>
using namespace std;
extern std::vector<_tasklog> gTaskLog;
void CRightDownSplitter::ShowTask( _TaskAttr* task )
{
if ( task == NULL )
{
GetWindow2() ->Show( false );
ReplaceWindow( GetWindow2(), m_pEmptyWin );
m_pEmptyWin->Show( true );
}
//當它選擇root時,沒有消息返上來,奇怪?
m_pRightTreeWin->ShowTask( task ); //讓它來決定右邊怎么顯示
return ;
}
CRightDownSplitter::CRightDownSplitter( wxWindow* parent )
: wxSplitterWindow(
parent,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
wxSP_LIVE_UPDATE,
wxT( "rds" )
)
{
m_pThreadInfoWin = new CThreadInfoWindow( this );
m_pShowTableWin = new CShowTableWindow( this ); //這個構造函數可能導致對話框有問題
m_pRightTreeWin = new CRightTree( this );
m_pEmptyWin = new wxListView( this, -1 );
m_pEmptyWin->SetSingleStyle( wxLC_NO_HEADER );
m_pEmptyWin->SetBackgroundStyle( wxBG_STYLE_CUSTOM );
m_pEmptyWin->SetBackgroundColour( wxColour( 255, 255, 255 ) );
m_pTaskDetailWin = new CTaskDetailReport( this );
assert( m_pThreadInfoWin != NULL );
assert( m_pShowTableWin != NULL );
assert( m_pRightTreeWin != NULL );
assert( m_pEmptyWin != NULL );
assert( m_pTaskDetailWin != NULL );
m_pThreadInfoWin->Show( false );
m_pShowTableWin->Show( false ); //如果沒有這個對話框顯示就會出問題
m_pEmptyWin->Show( false );
m_pTaskDetailWin->Show( false );
m_pRightTreeWin->Show( false );
SetSashGravity( 0 );
SetMinimumPaneSize( 140 );
SplitVertically( m_pRightTreeWin, m_pEmptyWin, 140 );
m_pRightTreeWin->Show( true );
}
//ok
CRightDownSplitter::~CRightDownSplitter()
{
//切換到Splitter中用于顯示的窗口可以不管,但沒顯示的窗口需要刪除
//將來右邊的窗口種類增加時,這個要變
ReplaceWindow( GetWindow2(), m_pEmptyWin );
m_pShowTableWin->Destroy();
m_pThreadInfoWin->Destroy();
m_pTaskDetailWin->Destroy();
}
//上層調用這個函數來在右邊顯示任務的詳細信息,如果這時右邊的顯示模式不是
//任務的詳細信息模式,那么報告一個不一致的錯誤
void CRightDownSplitter::ShowTaskDetailReport( _TaskAttr& task )
{
m_pTaskDetailWin->ShowTaskDetail( task );
}
//當右邊的樹控件選擇了一個條目時,把條目中的數據傳到這里來處理,
//可能需要右邊進行相應的顯示變化
void CRightDownSplitter::OnRightTreeSelectItem( int nodedata )
{
//0是根,右邊切換空白
//-1是信息提取器
//-2是文件管理器
//-3是圖表,右邊切換成圖表
//1-19是線程信息
//20是詳細信息
//21是日志記錄
if ( !nodedata ) //root
{
GetWindow2() ->Show( false );
ReplaceWindow( GetWindow2(), m_pEmptyWin );
m_pEmptyWin->Show();
//下面兩句作用不明??
MainFrame* pmainframe = ( MainFrame* ) ( GetParent() ->GetParent() ->GetParent() );
pmainframe->OnShowModeSwitch( nodedata );
return ;
}
//一個是信息提取,一個是文件管理,都用線程信息顯示
if ( -1 == nodedata || -2 == nodedata )
{
GetWindow2() ->Show( false );
ReplaceWindow( GetWindow2(), m_pThreadInfoWin );
m_pThreadInfoWin->DeleteAllItems(); //??
m_pThreadInfoWin->Show( true );
//向上層通報
MainFrame* pmainframe = ( MainFrame* ) ( GetParent() ->GetParent() ->GetParent() );
pmainframe->OnShowModeSwitch( nodedata );
return ;
}
if ( -3 == nodedata )
{
GetWindow2() ->Show( false );
ReplaceWindow( GetWindow2(), m_pShowTableWin );
m_pShowTableWin->Show( true );
MainFrame* pmainframe = ( MainFrame* ) ( GetParent() ->GetParent() ->GetParent() );
pmainframe->OnShowModeSwitch( nodedata );
return ;
}
if ( nodedata >= 1 && nodedata <= 19 )
{
GetWindow2() ->Show( false );
ReplaceWindow( GetWindow2(), m_pThreadInfoWin );
m_pThreadInfoWin->DeleteAllItems(); //??
m_pThreadInfoWin->Show( true );
MainFrame* pmainframe = ( MainFrame* ) ( GetParent() ->GetParent() ->GetParent() );
pmainframe->OnShowModeSwitch( nodedata );
return ;
}
if ( nodedata == 20 )
{
GetWindow2() ->Show( false );
ReplaceWindow( GetWindow2(), m_pTaskDetailWin );
m_pTaskDetailWin->Show( true );
//找到當前選擇的任務,顯示任務詳細信息
MainFrame* pmainframe = ( MainFrame* ) ( GetParent() ->GetParent() ->GetParent() );
_TaskAttr* curtask = pmainframe->GetCurrentTask();
ShowTaskDetailReport( *curtask );
pmainframe->OnShowModeSwitch( nodedata );
return ;
}
if ( nodedata == 21 ) //log info
{
GetWindow2() ->Show( false );
ReplaceWindow( GetWindow2(), m_pThreadInfoWin );
m_pThreadInfoWin->DeleteAllItems(); //??
m_pThreadInfoWin->Show( true );
//添加日志數據
MainFrame* pmainframe = ( MainFrame* ) ( GetParent() ->GetParent() ->GetParent() );
_TaskAttr* curtask = pmainframe->GetCurrentTask();
//提取curtask->nID日志并顯示
std::vector<_tasklog>::const_iterator it;
for ( it = gTaskLog.begin();it != gTaskLog.end();it++ )
{
if ( it->ntaskid == curtask->nID )
{
m_pThreadInfoWin->AddInfo( it->ntype, it->info, it->ntime );
}
}
pmainframe->OnShowModeSwitch( nodedata );
return ;
}
}
void CRightDownSplitter::DynamicLang()
{
m_pRightTreeWin->DynamicLang();
m_pTaskDetailWin->DynamicLang();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -