wxString CViewProjects::GetKeyValue1(int iRowIndex) { CProject* project; if (GetProjectCacheAtIndex(project, m_iSortedIndexes[iRowIndex])) { return wxEmptyString; } return project->m_strProjectURL; }
void CViewProjects::OnProjectDetach( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectDetach - Function Begin")); wxInt32 iAnswer = 0; wxString strMessage = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); CProject* pProject = NULL; int row; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); wxASSERT(m_pListPane); if (!pDoc->IsUserAuthorized()) return; pFrame->UpdateStatusText(_("Removing project...")); row = -1; while (1) { // Step through all selected items row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (row < 0) break; if (GetProjectCacheAtIndex(pProject, m_iSortedIndexes[row])) { return; } strMessage.Printf( _("Are you sure you want to remove project '%s'?"), pProject->m_strProjectName.c_str() ); iAnswer = wxGetApp().SafeMessageBox( strMessage, _("Remove Project"), wxYES_NO | wxICON_QUESTION, this ); if (wxYES == iAnswer) { pDoc->ProjectDetach(m_iSortedIndexes[row]); } } pFrame->UpdateStatusText(wxT("")); m_bForceUpdateSelection = true; UpdateSelection(); pFrame->FireRefreshView(); wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectDetach - Function End")); }
int CViewProjects::FindRowIndexByKeyValues(wxString& key1, wxString&) { CProject* project; unsigned int iRowIndex, n = GetCacheCount(); for(iRowIndex=0; iRowIndex < n; iRowIndex++) { if (GetProjectCacheAtIndex(project, m_iSortedIndexes[iRowIndex])) { continue; } if((project->m_strProjectURL).IsSameAs(key1)) return iRowIndex; } return -1; }
wxString CViewProjects::GetKeyValue1(int iRowIndex) { CProject* project; if (GetProjectCacheAtIndex(project, m_iSortedIndexes[iRowIndex])) { return wxEmptyString; } if (m_iColumnIDToColumnIndex[COLUMN_PROJECT] < 0) { // Column is hidden, so SynchronizeCacheItem() did not set its value GetDocProjectURL(m_iSortedIndexes[iRowIndex], project->m_strProjectURL); } return project->m_strProjectURL; }
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; }