mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=4455
This commit is contained in:
parent
ceb54d0178
commit
b12f8b062f
|
@ -29,23 +29,24 @@
|
|||
#define ID_STATUSBAR 6000
|
||||
#define ID_TOOLSOPTIONS 6001
|
||||
#define ID_FRAMENOTEBOOK 6002
|
||||
#define ID_FRAMETASKRENDERTIMER 6003
|
||||
#define ID_FRAMELISTRENDERTIMER 6004
|
||||
#define ID_HIDE 6005
|
||||
#define ID_ACTIVITYRUNALWAYS 6006
|
||||
#define ID_ACTIVITYRUNBASEDONPREPERENCES 6007
|
||||
#define ID_ACTIVITYSUSPEND 6008
|
||||
#define ID_NETWORKRUNALWAYS 6009
|
||||
#define ID_NETWORKRUNBASEDONPREPERENCES 6010
|
||||
#define ID_NETWORKSUSPEND 6011
|
||||
#define ID_RUNBENCHMARKS 6012
|
||||
#define ID_SELECTCOMPUTER 6013
|
||||
#define ID_TB_ACTIVITYRUNALWAYS 6014
|
||||
#define ID_TB_ACTIVITYRUNBASEDONPREPERENCES 6015
|
||||
#define ID_TB_ACTIVITYSUSPEND 6016
|
||||
#define ID_TB_NETWORKRUNALWAYS 6017
|
||||
#define ID_TB_NETWORKRUNBASEDONPREPERENCES 6018
|
||||
#define ID_TB_NETWORKSUSPEND 6019
|
||||
#define ID_FRAMERENDERTIMER 6003
|
||||
#define ID_FRAMETASKRENDERTIMER 6004
|
||||
#define ID_FRAMELISTRENDERTIMER 6005
|
||||
#define ID_HIDE 6006
|
||||
#define ID_ACTIVITYRUNALWAYS 6007
|
||||
#define ID_ACTIVITYRUNBASEDONPREPERENCES 6008
|
||||
#define ID_ACTIVITYSUSPEND 6009
|
||||
#define ID_NETWORKRUNALWAYS 6010
|
||||
#define ID_NETWORKRUNBASEDONPREPERENCES 6011
|
||||
#define ID_NETWORKSUSPEND 6012
|
||||
#define ID_RUNBENCHMARKS 6013
|
||||
#define ID_SELECTCOMPUTER 6014
|
||||
#define ID_TB_ACTIVITYRUNALWAYS 6015
|
||||
#define ID_TB_ACTIVITYRUNBASEDONPREPERENCES 6016
|
||||
#define ID_TB_ACTIVITYSUSPEND 6017
|
||||
#define ID_TB_NETWORKRUNALWAYS 6018
|
||||
#define ID_TB_NETWORKRUNBASEDONPREPERENCES 6019
|
||||
#define ID_TB_NETWORKSUSPEND 6020
|
||||
#define ID_LIST_BASE 7000
|
||||
#define ID_LIST_PROJECTSVIEW 7000
|
||||
#define ID_LIST_WORKVIEW 7001
|
||||
|
|
|
@ -48,7 +48,7 @@ CMainDocument::CMainDocument()
|
|||
#endif
|
||||
|
||||
m_bIsConnected = false;
|
||||
m_strConnectedComputer = wxEmptyString;
|
||||
m_strConnectedComputerName = wxEmptyString;
|
||||
|
||||
m_iCachedActivityRunMode = 0;
|
||||
m_iCachedNetworkRunMode = 0;
|
||||
|
@ -80,7 +80,7 @@ CMainDocument::~CMainDocument()
|
|||
m_iCachedActivityRunMode = 0;
|
||||
m_iCachedNetworkRunMode = 0;
|
||||
|
||||
m_strConnectedComputer = wxEmptyString;
|
||||
m_strConnectedComputerName = wxEmptyString;
|
||||
m_bIsConnected = false;
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
@ -108,7 +108,7 @@ wxInt32 CMainDocument::CachedStateUpdate()
|
|||
if (retval)
|
||||
{
|
||||
wxLogTrace("CMainDocument::CachedStateUpdate - Get State Failed '%d'", retval);
|
||||
state.clear();
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
pFrame->UpdateStatusbar( _("Retrieving the BOINC host information. Please wait...") );
|
||||
|
@ -116,7 +116,7 @@ wxInt32 CMainDocument::CachedStateUpdate()
|
|||
if (retval)
|
||||
{
|
||||
wxLogTrace("CMainDocument::CachedStateUpdate - Get Host Information Failed '%d'", retval);
|
||||
host.clear();
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
pFrame->UpdateStatusbar( strEmpty );
|
||||
|
@ -168,8 +168,8 @@ wxInt32 CMainDocument::Connect( wxString& strMachine )
|
|||
|
||||
str.clear();
|
||||
|
||||
if ( strMachine.empty() && !m_strConnectedComputer.empty() )
|
||||
str = m_strConnectedComputer.c_str();
|
||||
if ( strMachine.empty() && !m_strConnectedComputerName.empty() )
|
||||
str = m_strConnectedComputerName.c_str();
|
||||
else
|
||||
str = strMachine.c_str();
|
||||
|
||||
|
@ -179,7 +179,10 @@ wxInt32 CMainDocument::Connect( wxString& strMachine )
|
|||
iRetVal = rpc.init( str.c_str() );
|
||||
|
||||
if ( 0 == iRetVal )
|
||||
m_strConnectedComputer = strMachine;
|
||||
{
|
||||
m_bIsConnected = true;
|
||||
m_strConnectedComputerName = strMachine;
|
||||
}
|
||||
else
|
||||
wxLogTrace("CMainDocument::Connect - RPC Initialization Failed '%d'", iRetVal);
|
||||
|
||||
|
@ -211,6 +214,13 @@ wxInt32 CMainDocument::Disconnect()
|
|||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::GetConnectedComputerName( wxString& strMachine )
|
||||
{
|
||||
strMachine = m_strConnectedComputerName;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool CMainDocument::IsConnected()
|
||||
{
|
||||
return m_bIsConnected;
|
||||
|
@ -234,7 +244,8 @@ wxInt32 CMainDocument::CachedStateUnlock()
|
|||
|
||||
wxInt32 CMainDocument::GetActivityRunMode( wxInt32& iMode )
|
||||
{
|
||||
wxInt32 iRetVal = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
wxTimeSpan ts(wxDateTime::Now() - m_dtCachedActivityRunModeTimestamp);
|
||||
if ( ts.GetSeconds() > 10 )
|
||||
|
@ -246,6 +257,8 @@ wxInt32 CMainDocument::GetActivityRunMode( wxInt32& iMode )
|
|||
{
|
||||
m_iCachedActivityRunMode = iMode;
|
||||
}
|
||||
else
|
||||
Connect( strEmpty );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -258,7 +271,8 @@ wxInt32 CMainDocument::GetActivityRunMode( wxInt32& iMode )
|
|||
|
||||
wxInt32 CMainDocument::SetActivityRunMode( wxInt32 iMode )
|
||||
{
|
||||
wxInt32 iRetVal = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
iRetVal = rpc.set_run_mode( iMode );
|
||||
if ( 0 == iRetVal )
|
||||
|
@ -266,6 +280,9 @@ wxInt32 CMainDocument::SetActivityRunMode( wxInt32 iMode )
|
|||
m_dtCachedActivityRunModeTimestamp = wxDateTime::Now();
|
||||
m_iCachedActivityRunMode = iMode;
|
||||
}
|
||||
else
|
||||
Connect( strEmpty );
|
||||
|
||||
|
||||
return iRetVal;
|
||||
}
|
||||
|
@ -273,7 +290,8 @@ wxInt32 CMainDocument::SetActivityRunMode( wxInt32 iMode )
|
|||
|
||||
wxInt32 CMainDocument::GetNetworkRunMode( wxInt32& iMode )
|
||||
{
|
||||
wxInt32 iRetVal = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
wxTimeSpan ts(wxDateTime::Now() - m_dtCachedNetworkRunModeTimestamp);
|
||||
if ( ts.GetSeconds() > 10 )
|
||||
|
@ -285,6 +303,8 @@ wxInt32 CMainDocument::GetNetworkRunMode( wxInt32& iMode )
|
|||
{
|
||||
m_iCachedNetworkRunMode = iMode;
|
||||
}
|
||||
else
|
||||
Connect( strEmpty );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -297,7 +317,8 @@ wxInt32 CMainDocument::GetNetworkRunMode( wxInt32& iMode )
|
|||
|
||||
wxInt32 CMainDocument::SetNetworkRunMode( wxInt32 iMode )
|
||||
{
|
||||
wxInt32 iRetVal = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
iRetVal = rpc.set_network_mode( iMode );
|
||||
if ( 0 == iRetVal )
|
||||
|
@ -305,6 +326,8 @@ wxInt32 CMainDocument::SetNetworkRunMode( wxInt32 iMode )
|
|||
m_dtCachedNetworkRunModeTimestamp = wxDateTime::Now();
|
||||
m_iCachedNetworkRunMode = iMode;
|
||||
}
|
||||
else
|
||||
Connect( strEmpty );
|
||||
|
||||
return iRetVal;
|
||||
}
|
||||
|
@ -318,14 +341,15 @@ wxInt32 CMainDocument::RunBenchmarks()
|
|||
|
||||
wxInt32 CMainDocument::CachedProjectStatusUpdate()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
wxInt32 i = 0;
|
||||
|
||||
retval = rpc.get_project_status(project_status);
|
||||
if (retval)
|
||||
iRetVal = rpc.get_project_status(project_status);
|
||||
if (iRetVal)
|
||||
{
|
||||
wxLogTrace("CMainDocument::CachedProjectStatusUpdate - Get Project Status Failed '%d'", retval);
|
||||
project_status.clear();
|
||||
wxLogTrace("CMainDocument::CachedProjectStatusUpdate - Get Project Status Failed '%d'", iRetVal);
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
m_fProjectTotalResourceShare = 0.0;
|
||||
|
@ -333,7 +357,7 @@ wxInt32 CMainDocument::CachedProjectStatusUpdate()
|
|||
m_fProjectTotalResourceShare += project_status.projects.at( i )->resource_share;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
|
@ -692,16 +716,17 @@ wxInt32 CMainDocument::ProjectResume( wxInt32 iIndex )
|
|||
|
||||
wxInt32 CMainDocument::CachedResultsStatusUpdate()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
retval = rpc.get_results(results);
|
||||
if (retval)
|
||||
iRetVal = rpc.get_results(results);
|
||||
if (iRetVal)
|
||||
{
|
||||
wxLogTrace("CMainDocument::CachedResultsStatusUpdate - Get Result Status Failed '%d'", retval);
|
||||
results.clear();
|
||||
wxLogTrace("CMainDocument::CachedResultsStatusUpdate - Get Result Status Failed '%d'", iRetVal);
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1103,19 +1128,20 @@ wxInt32 CMainDocument::WorkAbort( wxInt32 iIndex )
|
|||
|
||||
wxInt32 CMainDocument::CachedMessageUpdate()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
retval = rpc.get_messages( m_iMessageSequenceNumber, messages );
|
||||
if (retval)
|
||||
iRetVal = rpc.get_messages( m_iMessageSequenceNumber, messages );
|
||||
if (iRetVal)
|
||||
{
|
||||
wxLogTrace("CMainDocument::CachedMessageUpdate - Get Messages Failed '%d'", retval);
|
||||
messages.clear();
|
||||
wxLogTrace("CMainDocument::CachedMessageUpdate - Get Messages Failed '%d'", iRetVal);
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
if ( messages.messages.size() != 0 )
|
||||
m_iMessageSequenceNumber = messages.messages.at( messages.messages.size()-1 )->seqno;
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1194,16 +1220,17 @@ wxInt32 CMainDocument::GetMessageMessage( wxInt32 iIndex, wxString& strBuffer )
|
|||
|
||||
wxInt32 CMainDocument::CachedFileTransfersUpdate()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
retval = rpc.get_file_transfers( ft );
|
||||
if (retval)
|
||||
iRetVal = rpc.get_file_transfers( ft );
|
||||
if (iRetVal)
|
||||
{
|
||||
wxLogTrace("CMainDocument::CachedFileTransfersUpdate - Get File Transfers Failed '%d'", retval);
|
||||
ft.clear();
|
||||
wxLogTrace("CMainDocument::CachedFileTransfersUpdate - Get File Transfers Failed '%d'", iRetVal);
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1394,16 +1421,17 @@ wxInt32 CMainDocument::TransferAbort( wxInt32 iIndex )
|
|||
|
||||
wxInt32 CMainDocument::CachedResourceStatusUpdate()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
retval = rpc.get_disk_usage(resource_status);
|
||||
if (retval)
|
||||
iRetVal = rpc.get_disk_usage(resource_status);
|
||||
if (iRetVal)
|
||||
{
|
||||
wxLogTrace("CMainDocument::CachedResourceStatusUpdate - Get Disk Usage Failed '%d'", retval);
|
||||
resource_status.clear();
|
||||
wxLogTrace("CMainDocument::CachedResourceStatusUpdate - Get Disk Usage Failed '%d'", iRetVal);
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1458,16 +1486,17 @@ wxInt32 CMainDocument::GetResourceDiskspace( wxInt32 iIndex, float& fBuffer )
|
|||
|
||||
wxInt32 CMainDocument::GetProxyConfiguration()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
retval = rpc.get_proxy_settings(proxy_info);
|
||||
if (retval)
|
||||
iRetVal = rpc.get_proxy_settings(proxy_info);
|
||||
if (iRetVal)
|
||||
{
|
||||
wxLogTrace("CMainDocument::GetProxyInfo - Get Proxy Info Failed '%d'", retval);
|
||||
proxy_info.clear();
|
||||
wxLogTrace("CMainDocument::GetProxyInfo - Get Proxy Info Failed '%d'", iRetVal);
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1549,7 +1578,8 @@ wxInt32 CMainDocument::GetProxySOCKSPassword( wxString& strPassword )
|
|||
|
||||
wxInt32 CMainDocument::SetProxyConfiguration()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
wxString strEmpty = wxEmptyString;
|
||||
|
||||
if ( !proxy_info.http_user_name.empty() || !proxy_info.http_user_passwd.empty() )
|
||||
proxy_info.use_http_authentication = true;
|
||||
|
@ -1558,14 +1588,14 @@ wxInt32 CMainDocument::SetProxyConfiguration()
|
|||
if ( !proxy_info.socks5_user_name.empty() || !proxy_info.socks5_user_passwd.empty() )
|
||||
proxy_info.socks_version = 5;
|
||||
|
||||
retval = rpc.set_proxy_settings( proxy_info );
|
||||
if (retval)
|
||||
iRetVal = rpc.set_proxy_settings( proxy_info );
|
||||
if (iRetVal)
|
||||
{
|
||||
wxLogTrace("CMainDocument::SetProxyInfo - Set Proxy Info Failed '%d'", retval);
|
||||
proxy_info.clear();
|
||||
wxLogTrace("CMainDocument::SetProxyInfo - Set Proxy Info Failed '%d'", iRetVal);
|
||||
Connect( strEmpty );
|
||||
}
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ private:
|
|||
bool m_bCachedStateLocked;
|
||||
|
||||
bool m_bIsConnected;
|
||||
wxString m_strConnectedComputer;
|
||||
wxString m_strConnectedComputerName;
|
||||
|
||||
wxInt32 m_iCachedActivityRunMode;
|
||||
wxInt32 m_iCachedNetworkRunMode;
|
||||
|
@ -94,6 +94,7 @@ public:
|
|||
|
||||
wxInt32 Connect( wxString& strMachine );
|
||||
wxInt32 Disconnect();
|
||||
wxInt32 GetConnectedComputerName( wxString& strMachine );
|
||||
bool IsConnected();
|
||||
|
||||
wxInt32 CachedStateLock();
|
||||
|
|
|
@ -43,6 +43,13 @@
|
|||
#include "res/disconnect.xpm"
|
||||
|
||||
|
||||
enum STATUSBARFIELDS
|
||||
{
|
||||
STATUS_TEXT,
|
||||
STATUS_CONNECTION_STATUS
|
||||
};
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CMainFrame, wxFrame)
|
||||
|
||||
BEGIN_EVENT_TABLE (CMainFrame, wxFrame)
|
||||
|
@ -54,14 +61,16 @@ BEGIN_EVENT_TABLE (CMainFrame, wxFrame)
|
|||
EVT_MENU(wxID_EXIT, CMainFrame::OnExit)
|
||||
EVT_MENU(ID_TOOLSOPTIONS, CMainFrame::OnToolsOptions)
|
||||
EVT_MENU(wxID_ABOUT, CMainFrame::OnAbout)
|
||||
EVT_UPDATE_UI_RANGE(ID_ACTIVITYRUNALWAYS, ID_ACTIVITYSUSPEND, CMainFrame::OnUpdateActivitySelection)
|
||||
EVT_UPDATE_UI_RANGE(ID_NETWORKRUNALWAYS, ID_NETWORKSUSPEND, CMainFrame::OnUpdateNetworkSelection)
|
||||
EVT_IDLE(CMainFrame::OnIdle)
|
||||
EVT_CLOSE(CMainFrame::OnClose)
|
||||
EVT_SIZE(CMainFrame::OnSize)
|
||||
EVT_UPDATE_UI_RANGE(ID_ACTIVITYRUNALWAYS, ID_ACTIVITYSUSPEND, CMainFrame::OnUpdateActivitySelection)
|
||||
EVT_UPDATE_UI_RANGE(ID_NETWORKRUNALWAYS, ID_NETWORKSUSPEND, CMainFrame::OnUpdateNetworkSelection)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CMainFrame::OnNotebookSelectionChanged)
|
||||
EVT_LIST_CACHE_HINT(wxID_ANY, CMainFrame::OnListCacheHint)
|
||||
EVT_LIST_ITEM_SELECTED(wxID_ANY, CMainFrame::OnListSelected)
|
||||
EVT_LIST_ITEM_DESELECTED(wxID_ANY, CMainFrame::OnListDeselected)
|
||||
EVT_TIMER(ID_FRAMERENDERTIMER, CMainFrame::OnFrameRender)
|
||||
EVT_TIMER(ID_FRAMELISTRENDERTIMER, CMainFrame::OnListPanelRender)
|
||||
EVT_TIMER(ID_FRAMETASKRENDERTIMER, CMainFrame::OnTaskPanelRender)
|
||||
END_EVENT_TABLE ()
|
||||
|
@ -79,6 +88,10 @@ CMainFrame::CMainFrame(wxString strTitle) :
|
|||
m_pMenubar = NULL;
|
||||
m_pNotebook = NULL;
|
||||
m_pStatusbar = NULL;
|
||||
m_pbmpConnected = NULL;
|
||||
m_pbmpDisconnect = NULL;
|
||||
|
||||
m_strBaseTitle = strTitle;
|
||||
|
||||
|
||||
SetIcon(wxICON(APP_ICON));
|
||||
|
@ -89,12 +102,16 @@ CMainFrame::CMainFrame(wxString strTitle) :
|
|||
wxCHECK_RET(CreateStatusbar(), _T("Failed to create status bar."));
|
||||
|
||||
|
||||
m_pFrameRenderTimer = new wxTimer(this, ID_FRAMERENDERTIMER);
|
||||
wxASSERT(NULL != m_pFrameRenderTimer);
|
||||
|
||||
m_pFrameTaskPanelRenderTimer = new wxTimer(this, ID_FRAMETASKRENDERTIMER);
|
||||
wxASSERT(NULL != m_pFrameTaskPanelRenderTimer);
|
||||
|
||||
m_pFrameListPanelRenderTimer = new wxTimer(this, ID_FRAMELISTRENDERTIMER);
|
||||
wxASSERT(NULL != m_pFrameListPanelRenderTimer);
|
||||
|
||||
m_pFrameRenderTimer->Start(1000); // Send event every 1 second
|
||||
m_pFrameTaskPanelRenderTimer->Start(1000); // Send event every 1 second
|
||||
m_pFrameListPanelRenderTimer->Start(5000); // Send event every 5 seconds
|
||||
|
||||
|
@ -106,6 +123,7 @@ CMainFrame::CMainFrame(wxString strTitle) :
|
|||
|
||||
CMainFrame::~CMainFrame()
|
||||
{
|
||||
wxASSERT(NULL != m_pFrameRenderTimer);
|
||||
wxASSERT(NULL != m_pFrameTaskPanelRenderTimer);
|
||||
wxASSERT(NULL != m_pFrameListPanelRenderTimer);
|
||||
wxASSERT(NULL != m_pMenubar);
|
||||
|
@ -116,6 +134,11 @@ CMainFrame::~CMainFrame()
|
|||
SaveState();
|
||||
|
||||
|
||||
if (m_pFrameRenderTimer) {
|
||||
m_pFrameRenderTimer->Stop();
|
||||
delete m_pFrameRenderTimer;
|
||||
}
|
||||
|
||||
if (m_pFrameTaskPanelRenderTimer) {
|
||||
m_pFrameTaskPanelRenderTimer->Stop();
|
||||
delete m_pFrameTaskPanelRenderTimer;
|
||||
|
@ -296,9 +319,7 @@ bool CMainFrame::CreateStatusbar()
|
|||
if (m_pStatusbar)
|
||||
return true;
|
||||
|
||||
wxInt32 ch = GetCharWidth();
|
||||
|
||||
const wxInt32 widths[] = {-1, 16, 15};
|
||||
const wxInt32 widths[] = {-1, 20, 20};
|
||||
|
||||
m_pStatusbar = CreateStatusBar(WXSIZEOF(widths), wxST_SIZEGRIP, ID_STATUSBAR);
|
||||
wxASSERT(NULL != m_pStatusbar);
|
||||
|
@ -306,10 +327,14 @@ bool CMainFrame::CreateStatusbar()
|
|||
m_pStatusbar->SetStatusWidths(WXSIZEOF(widths), widths);
|
||||
|
||||
SetStatusBar(m_pStatusbar);
|
||||
SendSizeEvent();
|
||||
|
||||
m_pbmpConnected = new wxStaticBitmap(m_pStatusbar, -1, wxIcon(connect_xpm));
|
||||
m_pbmpDisconnected = new wxStaticBitmap(m_pStatusbar, -1, wxIcon(disconnect_xpm));
|
||||
m_pbmpConnected->Hide();
|
||||
|
||||
m_pbmpDisconnect = new wxStaticBitmap(m_pStatusbar, -1, wxIcon(disconnect_xpm));
|
||||
m_pbmpDisconnect->Hide();
|
||||
|
||||
SendSizeEvent();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -346,8 +371,8 @@ bool CMainFrame::DeleteStatusbar()
|
|||
SetStatusBar(NULL);
|
||||
|
||||
delete m_pStatusbar;
|
||||
|
||||
m_pStatusbar = NULL;
|
||||
|
||||
SendSizeEvent();
|
||||
|
||||
return true;
|
||||
|
@ -361,9 +386,9 @@ bool CMainFrame::UpdateStatusbar( const wxString& strStatusbarText )
|
|||
|
||||
if ( NULL != m_pStatusbar )
|
||||
{
|
||||
if ( m_pStatusbar->GetStatusText(0) != strStatusbarText )
|
||||
if ( m_pStatusbar->GetStatusText(STATUS_TEXT) != strStatusbarText )
|
||||
{
|
||||
SetStatusText(strStatusbarText, 0);
|
||||
SetStatusText(strStatusbarText, STATUS_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -757,6 +782,35 @@ void CMainFrame::OnClose( wxCloseEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void CMainFrame::OnSize( wxSizeEvent& event )
|
||||
{
|
||||
if ( IsShown() )
|
||||
{
|
||||
wxRect rect;
|
||||
wxSize size;
|
||||
|
||||
wxASSERT(NULL != m_pStatusbar);
|
||||
m_pStatusbar->GetFieldRect(STATUS_CONNECTION_STATUS, rect);
|
||||
|
||||
if ( m_pbmpConnected )
|
||||
{
|
||||
size = m_pbmpConnected->GetSize();
|
||||
m_pbmpConnected->Move(rect.x + (rect.width - size.x) / 2,
|
||||
rect.y + (rect.height - size.y) / 2);
|
||||
}
|
||||
|
||||
if ( m_pbmpDisconnect )
|
||||
{
|
||||
size = m_pbmpConnected->GetSize();
|
||||
m_pbmpDisconnect->Move(rect.x + (rect.width - size.x) / 2,
|
||||
rect.y + (rect.height - size.y) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void CMainFrame::OnNotebookSelectionChanged( wxNotebookEvent& event )
|
||||
{
|
||||
if ( (-1 != event.GetSelection()) && IsShown() )
|
||||
|
@ -847,6 +901,45 @@ void CMainFrame::OnListDeselected( wxListEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void CMainFrame::OnFrameRender ( wxTimerEvent &event )
|
||||
{
|
||||
if ( IsShown() )
|
||||
{
|
||||
wxString strConnectedMachine = wxEmptyString;
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
if ( NULL != pDoc )
|
||||
{
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
|
||||
wxASSERT(wxDynamicCast(m_pbmpConnected, wxStaticBitmap));
|
||||
wxASSERT(wxDynamicCast(m_pbmpDisconnect, wxStaticBitmap));
|
||||
if ( pDoc->IsConnected() )
|
||||
{
|
||||
m_pbmpConnected->Show();
|
||||
m_pbmpDisconnect->Hide();
|
||||
|
||||
pDoc->GetConnectedComputerName( strConnectedMachine );
|
||||
if ( strConnectedMachine.empty() )
|
||||
strConnectedMachine = m_strBaseTitle + wxT(" - (localhost)");
|
||||
else
|
||||
strConnectedMachine = m_strBaseTitle + wxT(" - (") + strConnectedMachine + wxT(")");
|
||||
|
||||
SetTitle( strConnectedMachine );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pbmpConnected->Hide();
|
||||
m_pbmpDisconnect->Show();
|
||||
|
||||
SetTitle( m_strBaseTitle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void CMainFrame::OnListPanelRender ( wxTimerEvent &event )
|
||||
{
|
||||
if ( IsShown() )
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
|
||||
void OnIdle ( wxIdleEvent& event );
|
||||
void OnClose( wxCloseEvent& event );
|
||||
void OnSize( wxSizeEvent& event );
|
||||
|
||||
void OnNotebookSelectionChanged( wxNotebookEvent& event );
|
||||
|
||||
|
@ -64,6 +65,7 @@ public:
|
|||
void OnListSelected( wxListEvent& event );
|
||||
void OnListDeselected( wxListEvent& event );
|
||||
|
||||
void OnFrameRender( wxTimerEvent& event );
|
||||
void OnListPanelRender( wxTimerEvent& event );
|
||||
void OnTaskPanelRender( wxTimerEvent& event );
|
||||
|
||||
|
@ -72,11 +74,14 @@ private:
|
|||
wxMenuBar* m_pMenubar;
|
||||
wxNotebook* m_pNotebook;
|
||||
wxStatusBar* m_pStatusbar;
|
||||
wxTimer* m_pFrameRenderTimer;
|
||||
wxTimer* m_pFrameTaskPanelRenderTimer;
|
||||
wxTimer* m_pFrameListPanelRenderTimer;
|
||||
|
||||
wxStaticBitmap* m_pbmpConnected;
|
||||
wxStaticBitmap* m_pbmpDisconnected;
|
||||
wxStaticBitmap* m_pbmpDisconnect;
|
||||
|
||||
wxString m_strBaseTitle;
|
||||
|
||||
|
||||
bool CreateMenu();
|
||||
|
|
Loading…
Reference in New Issue