bool CViewTransfers::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) { wxString strDocumentText = wxEmptyString; wxString strDocumentText2 = wxEmptyString; float fDocumentFloat = 0.0; double fDocumentDouble = 0.0, fDocumentDouble2 = 0.0; CTransfer* transfer; bool bNeedRefresh = false; strDocumentText.Empty(); if (GetTransferCacheAtIndex(transfer, m_iSortedIndexes[iRowIndex])) { return false; } switch(iColumnIndex) { case COLUMN_PROJECT: GetDocProjectName(m_iSortedIndexes[iRowIndex], strDocumentText); GetDocProjectURL(m_iSortedIndexes[iRowIndex], strDocumentText2); if (!strDocumentText.IsSameAs(transfer->m_strProjectName) || !strDocumentText2.IsSameAs(transfer->m_strProjectURL)) { transfer->m_strProjectName = strDocumentText; transfer->m_strProjectURL = strDocumentText2; bNeedRefresh = true; } break; case COLUMN_FILE: GetDocFileName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(transfer->m_strFileName)) { transfer->m_strFileName = strDocumentText; bNeedRefresh = true; } break; case COLUMN_PROGRESS: GetDocProgress(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != transfer->m_fProgress) { transfer->m_fProgress = fDocumentFloat; FormatProgress(fDocumentFloat, transfer->m_strProgress); bNeedRefresh = true; } break; case COLUMN_SIZE: GetDocBytesXferred(m_iSortedIndexes[iRowIndex], fDocumentDouble); GetDocTotalBytes(m_iSortedIndexes[iRowIndex], fDocumentDouble2); if (( fDocumentDouble != transfer->m_fBytesXferred) || (fDocumentDouble2 != transfer->m_fTotalBytes) ) { transfer->m_fBytesXferred = fDocumentDouble; transfer->m_fTotalBytes = fDocumentDouble2; FormatSize(fDocumentDouble, fDocumentDouble2, transfer->m_strSize); bNeedRefresh = true; } break; case COLUMN_TIME: GetDocTime(m_iSortedIndexes[iRowIndex], fDocumentDouble); if (fDocumentDouble != transfer->m_dTime) { transfer->m_dTime = fDocumentDouble; FormatTime(fDocumentDouble, transfer->m_strTime); bNeedRefresh = true; } break; case COLUMN_SPEED: GetDocSpeed(m_iSortedIndexes[iRowIndex], fDocumentDouble); if (fDocumentDouble != transfer->m_dSpeed) { transfer->m_dSpeed = fDocumentDouble; FormatSpeed(fDocumentDouble, transfer->m_strSpeed); bNeedRefresh = true; } break; case COLUMN_STATUS: GetDocStatus(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(transfer->m_strStatus)) { transfer->m_strStatus = strDocumentText; return true; } break; } return bNeedRefresh; }
bool CViewWork::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) { wxString strDocumentText = wxEmptyString; wxString strDocumentText2 = wxEmptyString; float fDocumentFloat = 0.0; time_t tDocumentTime = (time_t)0; CWork* work; strDocumentText.Empty(); if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) { return false; } switch (iColumnIndex) { case COLUMN_PROJECT: GetDocProjectName(m_iSortedIndexes[iRowIndex], strDocumentText); GetDocProjectURL(m_iSortedIndexes[iRowIndex], strDocumentText2); if (!strDocumentText.IsSameAs(work->m_strProjectName) || !strDocumentText2.IsSameAs(work->m_strProjectURL)) { work->m_strProjectName = strDocumentText; work->m_strProjectURL = strDocumentText2; return true; } break; case COLUMN_APPLICATION: GetDocApplicationName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(work->m_strApplicationName)) { work->m_strApplicationName = strDocumentText; return true; } break; case COLUMN_NAME: GetDocName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(work->m_strName)) { work->m_strName = strDocumentText; return true; } break; case COLUMN_CPUTIME: GetDocCPUTime(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != work->m_fCPUTime) { work->m_fCPUTime = fDocumentFloat; FormatCPUTime(fDocumentFloat, work->m_strCPUTime); return true; } break; case COLUMN_PROGRESS: GetDocProgress(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != work->m_fProgress) { work->m_fProgress = fDocumentFloat; FormatProgress(fDocumentFloat, work->m_strProgress); return true; } break; case COLUMN_TOCOMPLETION: GetDocTimeToCompletion(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != work->m_fTimeToCompletion) { work->m_fTimeToCompletion = fDocumentFloat; FormatTimeToCompletion(fDocumentFloat, work->m_strTimeToCompletion); return true; } break; case COLUMN_REPORTDEADLINE: GetDocReportDeadline(m_iSortedIndexes[iRowIndex], tDocumentTime); if (tDocumentTime != work->m_tReportDeadline) { work->m_tReportDeadline = tDocumentTime; FormatReportDeadline(tDocumentTime, work->m_strReportDeadline); return true; } break; case COLUMN_STATUS: int i = m_iSortedIndexes[iRowIndex]; RESULT* result = wxGetApp().GetDocument()->result(i); strDocumentText = result_description(result); if (!strDocumentText.IsSameAs(work->m_strStatus)) { work->m_strStatus = strDocumentText; return true; } break; } return false; }
bool CViewProjects::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) { wxString strDocumentText = wxEmptyString; wxString strDocumentText2 = wxEmptyString; float fDocumentFloat = 0.0; float fDocumentPercent = 0.0; CProject* project; bool dirty = false; if (GetProjectCacheAtIndex(project, m_iSortedIndexes[iRowIndex])) { return false; } strDocumentText.Empty(); switch (iColumnIndex) { case COLUMN_PROJECT: GetDocProjectName(m_iSortedIndexes[iRowIndex], strDocumentText); GetDocProjectURL(m_iSortedIndexes[iRowIndex], strDocumentText2); if (!strDocumentText.IsSameAs(project->m_strProjectName) || !strDocumentText2.IsSameAs(project->m_strProjectURL)) { project->m_strProjectName = strDocumentText; project->m_strProjectURL = strDocumentText2; return true; } break; case COLUMN_ACCOUNTNAME: GetDocAccountName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(project->m_strAccountName)) { project->m_strAccountName = strDocumentText; return true; } break; case COLUMN_TEAMNAME: GetDocTeamName(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(project->m_strTeamName)) { project->m_strTeamName = strDocumentText; return true; } break; case COLUMN_TOTALCREDIT: GetDocTotalCredit(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != project->m_fTotalCredit) { project->m_fTotalCredit = fDocumentFloat; FormatTotalCredit(fDocumentFloat, project->m_strTotalCredit); return true; } break; case COLUMN_AVGCREDIT: GetDocAVGCredit(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != project->m_fAVGCredit) { project->m_fAVGCredit = fDocumentFloat; FormatAVGCredit(fDocumentFloat, project->m_strAVGCredit); return true; } break; case COLUMN_RESOURCESHARE: GetDocResourceShare(m_iSortedIndexes[iRowIndex], fDocumentFloat); if (fDocumentFloat != project->m_fResourceShare) { project->m_fResourceShare = fDocumentFloat; dirty = true; } GetDocResourcePercent(m_iSortedIndexes[iRowIndex], fDocumentPercent); if (fDocumentPercent != project->m_fResourcePercent) { project->m_fResourcePercent = fDocumentPercent; dirty = true; } if (dirty) { FormatResourceShare(fDocumentFloat, fDocumentPercent, project->m_strResourceShare); return true; } break; case COLUMN_STATUS: GetDocStatus(m_iSortedIndexes[iRowIndex], strDocumentText); if (!strDocumentText.IsSameAs(project->m_strStatus)) { project->m_strStatus = strDocumentText; return true; } break; } return false; }