no message

svn path=/trunk/boinc/; revision=1229
This commit is contained in:
Dan Werthimer 2003-05-20 23:55:52 +00:00
parent d24d07ba3d
commit fef7faf5b5
4 changed files with 81 additions and 8 deletions

View File

@ -298,6 +298,7 @@ int CProgressListCtrl::InsertItem(int nItem, LPCTSTR lpszItem)
{
m_ItemColors.InsertAt(nItem, RGB(0, 0, 0));
CString StrEmpty;
m_ProjectURLs.InsertAt(nItem, StrEmpty);
return CListCtrl::InsertItem(nItem, lpszItem);
}
@ -374,9 +375,8 @@ BOOL CProgressListCtrl::DeleteItem(int nItem)
// remove array info
m_ItemColors.RemoveAt(nItem);
CString empty;
CString strbuf;
m_ProjectURLs.RemoveAt(nItem);
CString empty, strbuf;
CProgressBarCtrl* pProgCtrl = NULL;
// go through all the subitems and see if they have a progess control
@ -663,6 +663,29 @@ void CProgressListCtrl::SetItemColor(int nItem, COLORREF newclr)
}
}
//////////
// CProgressListCtrl::SetProjectURL
// arguments: nItem: the item to set the url for
// szUrl: the url for the link
// returns: void
// function: sets the project's master url
void CProgressListCtrl::SetProjectURL(int nItem, char* szUrl)
{
CString StrUrl;
StrUrl.Format("%s", szUrl);
m_ProjectURLs.SetAtGrow(nItem, StrUrl);
}
//////////
// CProgressListCtrl::GetProjectURL
// arguments: nItem: the item to set the url for
// returns: CString of project URL
// function: gets the master url for a project's link
CString CProgressListCtrl::GetProjectURL(int nItem)
{
return m_ProjectURLs.GetAt(nItem);
}
//////////
// CProgressListCtrl::GetTextRect
// arguments: nItem: item to get the rect of
@ -728,6 +751,8 @@ void CProgressListCtrl::SaveInactive(char* szFile, char* szSection)
strValue = GetItemText(i, si);
WritePrivateProfileString(strSection, strKey, strValue, szFile);
}
strValue = GetProjectURL(i);
WritePrivateProfileString(strSection, "proj_url", strValue, szFile);
nMax ++;
}
@ -757,6 +782,8 @@ void CProgressListCtrl::LoadInactive(char* szFile, char* szSection)
GetPrivateProfileString(strSection, strKey, "", szValue, 512, szFile);
SetItemText(GetItemCount() - 1, si, szValue);
}
GetPrivateProfileString(strSection, "proj_url", "", szValue, 512, szFile);
SetProjectURL(i, szValue);
}
}

View File

@ -98,6 +98,8 @@ public:
void SetMenuItems(char**, int);
void SaveInactive(char*, char*);
void LoadInactive(char*, char*);
void SetProjectURL(int, char*);
CString GetProjectURL(int);
protected:
CMenu m_PopupMenu; // context menu for header
@ -106,7 +108,8 @@ protected:
CArray<int,int> m_ColWidths; // column widths for hiding and unhiding; a[i] > 0: col i shown; a[i] < 0: col i hidden, previous width -(a[i] - 1)
int m_nSort; // column and order of last sort: i = 0: no sort; i > 0: sorted ascending by col i - 1; < 0 sorted descending by col -(i-1)
CFont* m_OldFont; // old font for setting subitem font
CArray<COLORREF,COLORREF> m_ItemColors; // special colors of items
CArray<COLORREF,COLORREF> m_ItemColors; // special colors of items
CArray<CString,CString> m_ProjectURLs; // urls for project links
void SwapItems(int, int);
void QSort(int, int, int, int);

View File

@ -135,6 +135,42 @@ COLORREF CMainWindow::GetPieColor(int nPiece)
return RGB(0, 0, 0);
}
//////////
// CMainWindow::ClearProjectItems
// arguments: proj_url: master url of the project
// returns: void
// function: removes all active and inactive projects, transfers,
// and workunits associated with the project
void CMainWindow::ClearProjectItems(char *proj_url) {
int i;
CString ItemURL;
for(i = 0; i < m_ProjectListCtrl.GetItemCount();) {
ItemURL = m_ProjectListCtrl.GetProjectURL(i);
if(!ItemURL.Compare(proj_url)) {
m_ProjectListCtrl.DeleteItem(i);
} else {
i ++;
}
}
for(i = 0; i < m_ResultListCtrl.GetItemCount();) {
ItemURL = m_ResultListCtrl.GetProjectURL(i);
if(!ItemURL.Compare(proj_url)) {
m_ResultListCtrl.DeleteItem(i);
} else {
i ++;
}
}
for(i = 0; i < m_XferListCtrl.GetItemCount();) {
ItemURL = m_XferListCtrl.GetProjectURL(i);
if(!ItemURL.Compare(proj_url)) {
m_XferListCtrl.DeleteItem(i);
} else {
i ++;
}
}
}
//////////
// CMainWindow::UpdateGUI
// arguments: pcs: pointer to the client state for the gui to display
@ -150,10 +186,6 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
m_ProjectListCtrl.SetRedraw(FALSE);
float totalres = 0;
Syncronize(&m_ProjectListCtrl, (vector<void*>*)(&pcs->projects));
for(i = 0; i < m_ProjectListCtrl.GetItemCount();) {
if(!m_ProjectListCtrl.GetItemData(i)) m_ProjectListCtrl.DeleteItem(i);
else i ++;
}
for(i = 0; i < pcs->projects.size(); i ++) {
totalres += pcs->projects[i]->resource_share;
}
@ -165,6 +197,9 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
continue;
}
// Set the master URL for this object
m_ProjectListCtrl.SetProjectURL(i, pr->master_url);
// project
m_ProjectListCtrl.SetItemText(i, 0, pr->get_project_name());
@ -200,6 +235,9 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
continue;
}
// Set the master URL for this object
m_ResultListCtrl.SetProjectURL(i, re->project->master_url);
// project
m_ResultListCtrl.SetItemText(i, 0, re->project->project_name);
@ -281,6 +319,9 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
continue;
}
// Set the master URL for this object
m_XferListCtrl.SetProjectURL(i, pfx->fip->project->master_url);
// project
m_XferListCtrl.SetItemText(i, 0, pfx->fip->project->project_name);
@ -1085,6 +1126,7 @@ void CMainWindow::OnCommandProjectDetach()
strBuf.Format("Are you sure you want to detach from the project %s?",
proj->get_project_name());
if(AfxMessageBox(strBuf, MB_YESNO, 0) == IDYES) {
ClearProjectItems(proj->master_url);
gstate.detach_project(proj);
}
}

View File

@ -124,6 +124,7 @@ protected:
void LoadLanguage();
PROJECT* GetProjectFromContextMenu();
DWORD GetUserIdleTime();
void ClearProjectItems(char *);
void Syncronize(CProgressListCtrl*, vector<void*>*);
virtual void PostNcDestroy();
LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);