Manager: don't call GetWorkCount() repeatedly in CViewTransfersGrid and CViewMessagesGrid.

svn path=/trunk/boinc/; revision=13242
This commit is contained in:
Charlie Fenton 2007-07-31 02:54:56 +00:00
parent 14933d01f6
commit 5a581cffe8
3 changed files with 22 additions and 12 deletions

View File

@ -7563,3 +7563,11 @@ David 28 July 2007
client/
client_types.h
cs_scheduler.C
Charlie 30 July 2007
- Manager: don't call GetWorkCount() repeatedly in CViewTransfersGrid
and CViewMessagesGrid.
clientgui/
ViewMessagesGrid.cpp
ViewTransfersGrid.cpp

View File

@ -272,11 +272,12 @@ bool CViewMessagesGrid::OnRestoreState(wxConfigBase* pConfig) {
}
void CViewMessagesGrid::OnListRender (wxTimerEvent& WXUNUSED(event)) {
wxInt32 docCount = GetDocCount();
wxASSERT(m_pGridPane);
// We haven't connected up to the CC yet, there is nothing to display, make sure
// everything is deleted.
if ( GetDocCount() <= 0 ) {
if ( docCount <= 0 ) {
if ( m_pGridPane->GetNumberRows() ) {
m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows());
}
@ -285,13 +286,13 @@ void CViewMessagesGrid::OnListRender (wxTimerEvent& WXUNUSED(event)) {
// Right-size the grid so that the number of rows matches
// the document state.
if(GetDocCount() != m_pGridPane->GetNumberRows()) {
if (GetDocCount() > m_pGridPane->GetNumberRows()) {
m_pGridPane->AppendRows(GetDocCount() - m_pGridPane->GetNumberRows());
if(docCount != m_pGridPane->GetNumberRows()) {
if (docCount > m_pGridPane->GetNumberRows()) {
m_pGridPane->AppendRows(docCount - m_pGridPane->GetNumberRows());
} else {
m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows() - GetDocCount());
m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows() - docCount);
}
wxASSERT(GetDocCount() == m_pGridPane->GetNumberRows());
wxASSERT(docCount == m_pGridPane->GetNumberRows());
}
//update cell values (unsorted, like delivered from core client)

View File

@ -468,10 +468,11 @@ bool CViewTransfersGrid::OnRestoreState(wxConfigBase* pConfig) {
}
void CViewTransfersGrid::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
wxInt32 docCount = GetDocCount();
// We haven't connected up to the CC yet, there is nothing to display, make sure
// everything is deleted.
if ( GetDocCount() <= 0 ) {
if ( docCount <= 0 ) {
if ( m_pGridPane->GetNumberRows() ) {
m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows());
}
@ -480,13 +481,13 @@ void CViewTransfersGrid::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
// Right-size the grid so that the number of rows matches
// the document state.
if(GetDocCount() != m_pGridPane->GetNumberRows()) {
if (GetDocCount() > m_pGridPane->GetNumberRows()) {
m_pGridPane->AppendRows(GetDocCount() - m_pGridPane->GetNumberRows());
if(docCount != m_pGridPane->GetNumberRows()) {
if (docCount > m_pGridPane->GetNumberRows()) {
m_pGridPane->AppendRows(docCount - m_pGridPane->GetNumberRows());
} else {
m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows() - GetDocCount());
m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows() - docCount);
}
wxASSERT(GetDocCount() == m_pGridPane->GetNumberRows());
wxASSERT(docCount == m_pGridPane->GetNumberRows());
}
//update cell values