2011-01-27 14:36:49 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#ifndef __sg_TaskPanel__
|
|
|
|
#define __sg_TaskPanel__
|
|
|
|
|
2011-10-14 02:24:02 +00:00
|
|
|
// Comment???
|
|
|
|
//
|
2011-01-27 14:36:49 +00:00
|
|
|
#define SELECTBYRESULTNAME 0
|
|
|
|
|
|
|
|
#include "sg_PanelBase.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
RESULT * result;
|
|
|
|
char result_name[256];
|
|
|
|
char project_url[256];
|
|
|
|
int dotColor;
|
2011-07-18 11:29:41 +00:00
|
|
|
wxArrayString slideShowFileNames;
|
2011-01-27 14:36:49 +00:00
|
|
|
int lastSlideShown;
|
2011-07-18 11:29:41 +00:00
|
|
|
double project_files_downloaded_time;
|
2011-01-27 14:36:49 +00:00
|
|
|
} TaskSelectionData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
2011-11-29 02:45:05 +00:00
|
|
|
/// Class CScrolledTextBox
|
2011-11-28 13:34:15 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2011-11-29 02:45:05 +00:00
|
|
|
class CScrolledTextBox : public wxScrolledWindow
|
2011-11-28 13:34:15 +00:00
|
|
|
{
|
2011-11-29 02:45:05 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS( CScrolledTextBox )
|
2011-11-29 13:31:28 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2011-11-28 13:34:15 +00:00
|
|
|
public:
|
2011-11-29 02:45:05 +00:00
|
|
|
CScrolledTextBox();
|
|
|
|
CScrolledTextBox( wxWindow* parent);
|
2011-11-29 13:31:28 +00:00
|
|
|
~CScrolledTextBox();
|
2011-11-28 13:34:15 +00:00
|
|
|
|
2011-11-29 02:45:05 +00:00
|
|
|
void SetValue(const wxString& s);
|
2011-11-29 13:31:28 +00:00
|
|
|
virtual void OnEraseBackground(wxEraseEvent& event);
|
2011-11-29 02:45:05 +00:00
|
|
|
|
|
|
|
private:
|
2011-11-29 13:31:28 +00:00
|
|
|
int Wrap(const wxString& text, int widthMax, int *lineHeight);
|
|
|
|
bool IsStartOfNewLine();
|
|
|
|
void OnOutputLine(const wxString& line);
|
|
|
|
|
|
|
|
wxBoxSizer* m_TextSizer;
|
2011-11-29 02:45:05 +00:00
|
|
|
int m_iAvailableWidth;
|
2011-11-29 13:31:28 +00:00
|
|
|
bool m_eol;
|
|
|
|
wxString m_text;
|
|
|
|
int m_hLine;
|
2011-11-28 13:34:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
/// Class CSlideShowPanel
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2011-01-27 14:36:49 +00:00
|
|
|
|
|
|
|
class CSlideShowPanel : public wxPanel
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( CSlideShowPanel )
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
public:
|
|
|
|
CSlideShowPanel();
|
|
|
|
CSlideShowPanel( wxWindow* parent);
|
|
|
|
~CSlideShowPanel();
|
|
|
|
|
|
|
|
void OnSlideShowTimer(wxTimerEvent& WXUNUSED(event));
|
2011-11-24 02:04:21 +00:00
|
|
|
void AdvanceSlideShow(bool changeSlide, bool reload);
|
2011-01-27 14:36:49 +00:00
|
|
|
void OnPaint(wxPaintEvent& WXUNUSED(event));
|
2011-11-28 13:34:15 +00:00
|
|
|
void OnEraseBackground(wxEraseEvent& event);
|
2011-01-30 10:19:06 +00:00
|
|
|
|
2011-01-27 14:36:49 +00:00
|
|
|
private:
|
2011-11-28 13:34:15 +00:00
|
|
|
CTransparentStaticText* m_institution;
|
|
|
|
CTransparentStaticText* m_scienceArea;
|
2011-11-29 02:45:05 +00:00
|
|
|
CScrolledTextBox* m_description;
|
2011-01-27 14:36:49 +00:00
|
|
|
wxTimer* m_ChangeSlideTimer;
|
|
|
|
wxBitmap m_SlideBitmap;
|
|
|
|
bool m_bCurrentSlideIsDefault;
|
2011-11-28 13:34:15 +00:00
|
|
|
bool m_bGotAllProjectsList;
|
|
|
|
ALL_PROJECTS_LIST m_AllProjectsList;
|
2011-01-27 14:36:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
/// Class CSimpleTaskPanel
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
#include "MacBitmapComboBox.h"
|
|
|
|
#else
|
|
|
|
#define CBOINCBitmapComboBox wxBitmapComboBox
|
|
|
|
#define EVT_BOINCBITMAPCOMBOBOX EVT_COMBOBOX
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class CSimpleTaskPanel : public CSimplePanelBase
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( CSimpleTaskPanel )
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
public:
|
|
|
|
CSimpleTaskPanel();
|
|
|
|
CSimpleTaskPanel( wxWindow* parent);
|
|
|
|
~CSimpleTaskPanel();
|
|
|
|
|
|
|
|
TaskSelectionData* GetTaskSelectionData();
|
|
|
|
wxString GetSelectedTaskString() { return m_TaskSelectionCtrl->GetValue(); }
|
2011-11-15 00:48:49 +00:00
|
|
|
void UpdatePanel(bool delayShow=false);
|
2011-01-27 14:36:49 +00:00
|
|
|
wxRect GetProgressRect() { return m_ProgressRect; }
|
|
|
|
void ReskinInterface();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnTaskSelection(wxCommandEvent &event);
|
|
|
|
void GetApplicationAndProjectNames(RESULT* result, wxString* appName, wxString* projName);
|
|
|
|
wxString GetElapsedTimeString(double f);
|
|
|
|
wxString GetTimeRemainingString(double f);
|
|
|
|
wxString GetStatusString(RESULT* result);
|
|
|
|
wxString FormatTime(float fBuffer);
|
2011-07-18 11:29:41 +00:00
|
|
|
void FindSlideShowFiles(TaskSelectionData *selData);
|
2011-10-20 12:16:48 +00:00
|
|
|
void UpdateTaskSelectionList(bool reskin);
|
2011-01-27 14:36:49 +00:00
|
|
|
bool isRunning(RESULT* result);
|
|
|
|
bool DownloadingResults();
|
|
|
|
bool Suspended();
|
|
|
|
bool ProjectUpdateScheduled();
|
|
|
|
void DisplayIdleState();
|
|
|
|
void OnPulseProgressIndicator(wxTimerEvent& event);
|
|
|
|
|
|
|
|
protected:
|
2011-01-30 10:19:06 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
void OnEraseBackground(wxEraseEvent& event);
|
|
|
|
#endif
|
|
|
|
wxRect* m_progressBarRect;
|
2011-10-25 11:19:42 +00:00
|
|
|
CTransparentStaticText* m_myTasksLabel;
|
2011-01-27 14:36:49 +00:00
|
|
|
CBOINCBitmapComboBox* m_TaskSelectionCtrl;
|
2011-10-25 11:19:42 +00:00
|
|
|
CTransparentStaticText* m_TaskProjectLabel;
|
|
|
|
CTransparentStaticText* m_TaskProjectName;
|
2011-01-27 14:36:49 +00:00
|
|
|
#if SELECTBYRESULTNAME
|
2011-10-25 11:19:42 +00:00
|
|
|
CTransparentStaticText* m_TaskApplicationName;
|
2011-01-27 14:36:49 +00:00
|
|
|
#endif
|
|
|
|
CSlideShowPanel* m_SlideShowArea;
|
2011-10-25 11:19:42 +00:00
|
|
|
CTransparentStaticText* m_ElapsedTimeValue;
|
|
|
|
CTransparentStaticText* m_TimeRemainingValue;
|
2011-01-27 14:36:49 +00:00
|
|
|
wxGauge* m_ProgressBar;
|
2011-10-25 11:19:42 +00:00
|
|
|
CTransparentStaticText* m_ProgressValueText;
|
|
|
|
CTransparentStaticText* m_StatusValueText;
|
2011-01-27 14:36:49 +00:00
|
|
|
wxButton* m_TaskCommandsButton;
|
|
|
|
wxRect m_ProgressRect;
|
|
|
|
int m_oldWorkCount;
|
2011-01-31 09:58:34 +00:00
|
|
|
int m_iPctDoneX10;
|
2011-01-27 14:36:49 +00:00
|
|
|
time_t error_time;
|
|
|
|
wxTimer* m_pulseTimer;
|
|
|
|
bool m_bStableTaskInfoChanged;
|
|
|
|
int m_CurrentTaskSelection;
|
|
|
|
wxString m_sNotAvailableString;
|
|
|
|
wxString m_sNoProjectsString;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__sg_TaskPanel__
|