2006-07-20 22:15:29 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
|
|
|
//
|
|
|
|
// This 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 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This software 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.
|
|
|
|
//
|
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "sg_ProjectsComponent.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "diagnostics.h"
|
2007-02-21 17:06:11 +00:00
|
|
|
#include "str_util.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "mfile.h"
|
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
|
|
|
#include "error_numbers.h"
|
2006-10-25 14:09:47 +00:00
|
|
|
#include "Events.h"
|
2007-01-05 23:31:38 +00:00
|
|
|
#include "hyperlink.h"
|
2006-07-20 22:15:29 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "SkinManager.h"
|
|
|
|
#include "MainDocument.h"
|
|
|
|
#include "BOINCBaseFrame.h"
|
2006-08-07 15:33:03 +00:00
|
|
|
#include "sg_BoincSimpleGUI.h"
|
|
|
|
#include "sg_ImageLoader.h"
|
2006-10-28 09:02:46 +00:00
|
|
|
#include "sg_CustomControls.h"
|
2006-07-20 22:15:29 +00:00
|
|
|
#include "sg_StatImageLoader.h"
|
2006-08-07 15:33:03 +00:00
|
|
|
#include "sg_DlgMessages.h"
|
|
|
|
#include "sg_DlgPreferences.h"
|
|
|
|
#include "sg_ProjectsComponent.h"
|
2007-08-07 20:10:36 +00:00
|
|
|
#include "wizardex.h"
|
|
|
|
#include "BOINCWizards.h"
|
|
|
|
#include "BOINCBaseWizard.h"
|
|
|
|
#include "WizardAttachProject.h"
|
|
|
|
#include "WizardAccountManager.h"
|
2006-07-20 22:15:29 +00:00
|
|
|
#include "app_ipc.h"
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CProjectsComponent, wxPanel)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CProjectsComponent, wxPanel)
|
2007-01-05 23:31:38 +00:00
|
|
|
EVT_BUTTON(ID_SIMPLE_HELP, CProjectsComponent::OnHelp)
|
2006-11-22 09:51:59 +00:00
|
|
|
EVT_BUTTON(ID_SIMPLE_MESSAGES, CProjectsComponent::OnMessages)
|
|
|
|
EVT_BUTTON(ID_SIMPLE_MESSAGES_ALERT, CProjectsComponent::OnMessages)
|
|
|
|
EVT_BUTTON(ID_SIMPLE_SUSPEND, CProjectsComponent::OnSuspend)
|
|
|
|
EVT_BUTTON(ID_SIMPLE_RESUME, CProjectsComponent::OnResume)
|
2006-10-25 14:09:47 +00:00
|
|
|
EVT_BUTTON(ID_SIMPLE_PREFERENCES, CProjectsComponent::OnPreferences)
|
2007-08-07 20:10:36 +00:00
|
|
|
EVT_BUTTON(ID_SIMPLE_ATTACHTOPROJECT, CProjectsComponent::OnAttachToProject)
|
2007-08-15 18:06:18 +00:00
|
|
|
EVT_BUTTON(ID_SIMPLE_SYNCHRONIZE, CProjectsComponent::OnSynchronize)
|
2006-08-07 17:44:46 +00:00
|
|
|
EVT_PAINT(CProjectsComponent::OnPaint)
|
2006-07-20 22:15:29 +00:00
|
|
|
EVT_BUTTON(-1,CProjectsComponent::OnBtnClick)
|
2006-08-07 15:33:03 +00:00
|
|
|
EVT_ERASE_BACKGROUND(CProjectsComponent::OnEraseBackground)
|
2006-10-25 14:09:47 +00:00
|
|
|
EVT_TIMER(ID_SIMPLEMESSAGECHECKTIMER, CProjectsComponent::OnMessageCheck)
|
2006-07-20 22:15:29 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2006-09-15 16:47:04 +00:00
|
|
|
CProjectsComponent::CProjectsComponent() {
|
|
|
|
}
|
2006-07-20 22:15:29 +00:00
|
|
|
|
2006-08-07 17:44:46 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
CProjectsComponent::CProjectsComponent(CSimplePanel* parent,wxPoint coord) :
|
2006-08-07 15:33:03 +00:00
|
|
|
wxPanel(parent, -1, coord, wxSize(343,113), wxNO_BORDER)
|
2006-07-20 22:15:29 +00:00
|
|
|
{
|
|
|
|
wxASSERT(parent);
|
|
|
|
m_maxNumOfIcons = 6; // max number of icons in component
|
2006-07-21 18:05:43 +00:00
|
|
|
m_leftIndex = 0;
|
2006-11-22 21:26:21 +00:00
|
|
|
lastMessageId = 0;
|
2006-07-20 22:15:29 +00:00
|
|
|
CreateComponent();
|
|
|
|
|
2006-08-24 17:54:54 +00:00
|
|
|
receivedErrorMessage = false;
|
|
|
|
alertMessageDisplayed = false;
|
2006-10-25 14:09:47 +00:00
|
|
|
checkForMessagesTimer = new wxTimer(this, ID_SIMPLEMESSAGECHECKTIMER);
|
2006-08-24 17:54:54 +00:00
|
|
|
checkForMessagesTimer->Start(5000);
|
|
|
|
|
2006-07-20 22:15:29 +00:00
|
|
|
}
|
|
|
|
|
2006-08-24 17:54:54 +00:00
|
|
|
CProjectsComponent::~CProjectsComponent() {
|
|
|
|
delete checkForMessagesTimer;
|
|
|
|
}
|
2006-07-20 22:15:29 +00:00
|
|
|
|
|
|
|
void CProjectsComponent::CreateComponent()
|
|
|
|
{
|
2006-10-31 15:27:00 +00:00
|
|
|
Freeze();
|
2006-10-23 06:48:48 +00:00
|
|
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
|
|
|
|
|
|
|
wxASSERT(pSkinSimple);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
|
|
|
|
2006-07-20 22:15:29 +00:00
|
|
|
//Set Background color
|
2006-10-23 06:48:48 +00:00
|
|
|
SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
|
2006-08-07 15:33:03 +00:00
|
|
|
//Static content in my Projects section
|
|
|
|
// add project button
|
2006-11-09 22:22:54 +00:00
|
|
|
wxToolTip *ttAddProject = new wxToolTip(_("Attach to an additional project"));
|
2006-10-23 06:48:48 +00:00
|
|
|
btnAddProj=new wxBitmapButton(
|
|
|
|
this,
|
2007-08-07 20:10:36 +00:00
|
|
|
ID_SIMPLE_ATTACHTOPROJECT,
|
2006-10-23 06:48:48 +00:00
|
|
|
*pSkinSimple->GetAttachProjectButton()->GetBitmap(),
|
2006-12-22 04:25:36 +00:00
|
|
|
wxPoint(214,7),
|
2006-10-23 06:48:48 +00:00
|
|
|
wxSize(81,18),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-10-31 16:35:21 +00:00
|
|
|
if ( pSkinSimple->GetAttachProjectButton()->GetBitmapClicked() != NULL ) {
|
|
|
|
btnAddProj->SetBitmapSelected(
|
|
|
|
*pSkinSimple->GetAttachProjectButton()->GetBitmapClicked()
|
|
|
|
);
|
|
|
|
}
|
2006-08-07 15:33:03 +00:00
|
|
|
btnAddProj->SetToolTip(ttAddProject);
|
2006-12-22 04:25:36 +00:00
|
|
|
|
2007-08-07 20:10:36 +00:00
|
|
|
// syncronize button, hidden by default.
|
2007-08-15 18:06:18 +00:00
|
|
|
wxToolTip *ttSynchronize = new wxToolTip(_("Synchronize projects with account manager system"));
|
|
|
|
btnSynchronize=new wxBitmapButton(
|
2007-08-07 20:10:36 +00:00
|
|
|
this,
|
2007-08-15 18:06:18 +00:00
|
|
|
ID_SIMPLE_SYNCHRONIZE,
|
|
|
|
*pSkinSimple->GetSynchronizeButton()->GetBitmap(),
|
2007-08-07 20:10:36 +00:00
|
|
|
wxPoint(214,7),
|
|
|
|
wxSize(81,18),
|
|
|
|
wxBU_AUTODRAW
|
|
|
|
);
|
2007-08-15 18:06:18 +00:00
|
|
|
if ( pSkinSimple->GetSynchronizeButton()->GetBitmapClicked() != NULL ) {
|
|
|
|
btnSynchronize->SetBitmapSelected(
|
|
|
|
*pSkinSimple->GetSynchronizeButton()->GetBitmapClicked()
|
2007-08-07 20:10:36 +00:00
|
|
|
);
|
|
|
|
}
|
2007-08-15 18:06:18 +00:00
|
|
|
btnSynchronize->SetToolTip(ttSynchronize);
|
|
|
|
btnSynchronize->Show(false);
|
2007-08-07 20:10:36 +00:00
|
|
|
|
2006-12-22 04:25:36 +00:00
|
|
|
/// Help
|
2007-01-05 23:31:38 +00:00
|
|
|
wxToolTip *ttHelp = new wxToolTip(_("Get help with BOINC"));
|
|
|
|
btnHelp=new wxBitmapButton(
|
2006-12-22 04:25:36 +00:00
|
|
|
this,
|
2007-01-05 23:31:38 +00:00
|
|
|
ID_SIMPLE_HELP,
|
|
|
|
*pSkinSimple->GetHelpButton()->GetBitmap(),
|
2006-12-22 04:25:36 +00:00
|
|
|
wxPoint(300,7),
|
2007-01-05 23:31:38 +00:00
|
|
|
wxSize(
|
|
|
|
(*pSkinSimple->GetHelpButton()->GetBitmap()).GetWidth(),
|
|
|
|
(*pSkinSimple->GetHelpButton()->GetBitmap()).GetHeight()
|
|
|
|
),
|
2006-12-22 04:25:36 +00:00
|
|
|
wxBU_AUTODRAW
|
|
|
|
);
|
2007-01-05 23:31:38 +00:00
|
|
|
if ( pSkinSimple->GetHelpButton()->GetBitmapClicked() != NULL ) {
|
|
|
|
btnHelp->SetBitmapSelected(
|
|
|
|
*pSkinSimple->GetHelpButton()->GetBitmapClicked()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
btnHelp->SetToolTip(ttHelp);
|
2006-12-22 04:25:36 +00:00
|
|
|
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
/// Line
|
2006-10-28 09:02:46 +00:00
|
|
|
lnMyProjTop = new CTransparentStaticLine(this, wxID_ANY, wxPoint(29,29),wxSize(292,1));
|
2006-10-23 06:48:48 +00:00
|
|
|
lnMyProjTop->SetLineColor(pSkinSimple->GetStaticLineColor());
|
|
|
|
|
2006-07-20 22:15:29 +00:00
|
|
|
//// Arrow Btns
|
2006-10-23 06:48:48 +00:00
|
|
|
btnArwLeft = new wxBitmapButton(
|
|
|
|
this,
|
|
|
|
-1,
|
2006-10-31 16:35:21 +00:00
|
|
|
*pSkinSimple->GetLeftArrowButton()->GetBitmap(),
|
2006-10-23 06:48:48 +00:00
|
|
|
wxPoint(29,47),
|
|
|
|
wxSize(20,20),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-10-31 16:35:21 +00:00
|
|
|
if ( pSkinSimple->GetLeftArrowButton()->GetBitmapClicked() != NULL ) {
|
|
|
|
btnArwLeft->SetBitmapSelected(*pSkinSimple->GetLeftArrowButton()->GetBitmapClicked());
|
|
|
|
}
|
2006-07-20 22:15:29 +00:00
|
|
|
btnArwLeft->Show(false);//on creation this one is always false
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
btnArwRight = new wxBitmapButton(
|
|
|
|
this,
|
|
|
|
-1,
|
2006-10-31 16:35:21 +00:00
|
|
|
*pSkinSimple->GetRightArrowButton()->GetBitmap(),
|
2006-10-23 06:48:48 +00:00
|
|
|
wxPoint(301,47),
|
|
|
|
wxSize(20,20),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-10-31 16:35:21 +00:00
|
|
|
if ( pSkinSimple->GetRightArrowButton()->GetBitmapClicked() != NULL ) {
|
|
|
|
btnArwRight->SetBitmapSelected(*pSkinSimple->GetRightArrowButton()->GetBitmapClicked());
|
|
|
|
}
|
2006-10-31 15:27:00 +00:00
|
|
|
btnArwRight->Show(false);
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
//
|
2006-08-07 15:33:03 +00:00
|
|
|
//// Messages Play Pause Btns
|
2006-11-09 22:22:54 +00:00
|
|
|
wxToolTip *ttMessages = new wxToolTip(_("Open a window to view messages"));
|
2006-11-20 21:59:03 +00:00
|
|
|
btnMessages = new CLinkButton(
|
2006-10-23 06:48:48 +00:00
|
|
|
this,
|
2006-11-22 11:53:17 +00:00
|
|
|
ID_SIMPLE_MESSAGES,
|
2006-10-31 16:35:21 +00:00
|
|
|
*pSkinSimple->GetMessagesLink()->GetBitmap(),
|
2006-10-23 06:48:48 +00:00
|
|
|
wxPoint(11,86),
|
|
|
|
wxSize(70,20),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-08-07 15:33:03 +00:00
|
|
|
btnMessages->SetToolTip(ttMessages);
|
2006-10-23 06:48:48 +00:00
|
|
|
|
2006-11-09 22:22:54 +00:00
|
|
|
wxToolTip *ttAlertMessages = new wxToolTip(_("Open a window to view messages"));
|
2006-11-20 21:59:03 +00:00
|
|
|
btnAlertMessages = new CLinkButton(
|
2006-10-23 06:48:48 +00:00
|
|
|
this,
|
2006-11-22 11:53:17 +00:00
|
|
|
ID_SIMPLE_MESSAGES_ALERT,
|
2006-10-23 06:48:48 +00:00
|
|
|
*(pSkinSimple->GetMessagesAlertLink()->GetBitmap()),
|
|
|
|
wxPoint(11,86),
|
|
|
|
wxSize(70,20),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-08-24 17:54:54 +00:00
|
|
|
btnAlertMessages->SetToolTip(ttAlertMessages);
|
|
|
|
btnAlertMessages->Show(false);
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
//spacer
|
2007-05-07 20:02:03 +00:00
|
|
|
w_sp1 = new wxWindow(this,-1,wxPoint(83,91),wxSize(2,11));
|
|
|
|
i_spacer1 = new ImageLoader(w_sp1);
|
|
|
|
i_spacer1->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap()));
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
// pause btn
|
2006-11-09 22:22:54 +00:00
|
|
|
wxToolTip *ttPause = new wxToolTip(_("Stop all activity"));
|
2006-11-20 21:59:03 +00:00
|
|
|
btnPause = new CLinkButton(
|
2006-10-23 06:48:48 +00:00
|
|
|
this,
|
2006-11-22 11:53:17 +00:00
|
|
|
ID_SIMPLE_SUSPEND,
|
2006-10-31 16:35:21 +00:00
|
|
|
*pSkinSimple->GetSuspendLink()->GetBitmap(),
|
2006-10-23 06:48:48 +00:00
|
|
|
wxPoint(85,86),
|
|
|
|
wxSize(59,20),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-08-07 15:33:03 +00:00
|
|
|
btnPause->SetToolTip(ttPause);
|
2006-10-23 06:48:48 +00:00
|
|
|
|
2006-08-07 15:33:03 +00:00
|
|
|
// resume btn
|
2006-11-09 22:22:54 +00:00
|
|
|
wxToolTip *ttResume = new wxToolTip(_("Resume activity"));
|
2006-11-20 21:59:03 +00:00
|
|
|
btnResume = new CLinkButton(
|
2006-10-23 06:48:48 +00:00
|
|
|
this,
|
2006-11-22 11:53:17 +00:00
|
|
|
ID_SIMPLE_RESUME,
|
2006-10-23 06:48:48 +00:00
|
|
|
*(pSkinSimple->GetResumeLink()->GetBitmap()),
|
|
|
|
wxPoint(85,86),
|
|
|
|
wxSize(59,20),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-08-07 15:33:03 +00:00
|
|
|
btnResume->SetToolTip(ttResume);
|
2006-10-23 06:48:48 +00:00
|
|
|
|
2006-08-07 15:33:03 +00:00
|
|
|
//spacer
|
2007-05-07 20:02:03 +00:00
|
|
|
w_sp2 = new wxWindow(this,-1,wxPoint(144,91),wxSize(2,11));
|
|
|
|
i_spacer2 = new ImageLoader(w_sp2);
|
|
|
|
i_spacer2->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap()));
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
// Pref Btn
|
2006-11-09 22:22:54 +00:00
|
|
|
wxToolTip *ttPreferences = new wxToolTip(_("Open a window to set your preferences"));
|
2006-11-20 21:59:03 +00:00
|
|
|
btnPreferences = new CLinkButton(
|
2006-10-23 06:48:48 +00:00
|
|
|
this,
|
2006-10-25 14:09:47 +00:00
|
|
|
ID_SIMPLE_PREFERENCES,
|
2006-10-23 06:48:48 +00:00
|
|
|
*(pSkinSimple->GetPreferencesLink()->GetBitmap()),
|
|
|
|
wxPoint(149,86),
|
|
|
|
wxSize(81,20),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-08-07 15:33:03 +00:00
|
|
|
btnPreferences->SetToolTip(ttPreferences);
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
//spacer
|
2007-05-07 20:02:03 +00:00
|
|
|
w_sp3 = new wxWindow(this,-1,wxPoint(230,91),wxSize(2,11));
|
|
|
|
i_spacer3 = new ImageLoader(w_sp3);
|
|
|
|
i_spacer3->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap()));
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
// Advanced View
|
2006-11-09 22:22:54 +00:00
|
|
|
wxToolTip *ttAdvView = new wxToolTip(_("Switch to the BOINC advanced view"));
|
2006-11-20 21:59:03 +00:00
|
|
|
btnAdvancedView = new CLinkButton(
|
2006-10-23 06:48:48 +00:00
|
|
|
this,
|
|
|
|
-1,
|
|
|
|
*(pSkinSimple->GetAdvancedLink()->GetBitmap()),
|
|
|
|
wxPoint(233,86),
|
|
|
|
wxSize(101,20),
|
2006-10-31 16:35:21 +00:00
|
|
|
wxBU_AUTODRAW
|
2006-10-23 06:48:48 +00:00
|
|
|
);
|
2006-08-07 15:33:03 +00:00
|
|
|
btnAdvancedView->SetToolTip(ttAdvView);
|
2006-10-23 06:48:48 +00:00
|
|
|
|
|
|
|
/// Line
|
2006-10-28 09:02:46 +00:00
|
|
|
lnMyProjBtm = new CTransparentStaticLine(this, wxID_ANY, wxPoint(29,83),wxSize(292,1));
|
2006-10-23 06:48:48 +00:00
|
|
|
lnMyProjBtm->SetLineColor(pSkinSimple->GetStaticLineColor());
|
2006-10-31 15:27:00 +00:00
|
|
|
|
|
|
|
Thaw();
|
2006-07-24 22:10:28 +00:00
|
|
|
}
|
2006-10-23 06:48:48 +00:00
|
|
|
|
2006-08-07 17:44:46 +00:00
|
|
|
void CProjectsComponent::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
wxPaintDC dc(this);
|
|
|
|
//My Projects
|
2006-11-02 11:59:42 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
dc.SetFont(wxFont(12,74,90,92,0,wxT("Arial")));
|
|
|
|
#else
|
2006-08-07 17:44:46 +00:00
|
|
|
dc.SetFont(wxFont(10,74,90,92,0,wxT("Arial")));
|
2006-11-02 11:59:42 +00:00
|
|
|
#endif
|
2007-05-27 13:57:46 +00:00
|
|
|
dc.DrawText(_("My Projects:"), wxPoint(32,9));
|
2006-08-07 17:44:46 +00:00
|
|
|
}
|
2006-10-23 06:48:48 +00:00
|
|
|
|
2006-10-31 15:27:00 +00:00
|
|
|
// Check to see if the # of projects
|
|
|
|
void CProjectsComponent::UpdateProjectArray() {
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if ( pDoc->IsConnected() ) {
|
|
|
|
int m_projCnt = pDoc->GetProjectCount();
|
|
|
|
|
|
|
|
// If a new project has been added, figure out which one and then add it;
|
|
|
|
if ( m_projCnt > (int) m_statProjects.size() ) {
|
|
|
|
PROJECT* project;
|
|
|
|
for(int i=0; i < m_projCnt; i++) {
|
|
|
|
project = pDoc->state.projects[i];
|
|
|
|
bool found = false;
|
|
|
|
std::vector<StatImageLoader*>::iterator j;
|
|
|
|
for(j=m_statProjects.begin(); j < m_statProjects.end(); j++) {
|
|
|
|
if ( project->master_url == (*j)->m_prjUrl ) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !found ) {
|
|
|
|
StatImageLoader *i_statW = new StatImageLoader(this,project->master_url);
|
|
|
|
i_statW->LoadImage();
|
|
|
|
m_statProjects.push_back(i_statW);
|
|
|
|
// recurse in case there is more then one change
|
|
|
|
UpdateProjectArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if ( m_projCnt < (int) m_statProjects.size() ) {
|
|
|
|
PROJECT* project = NULL;
|
|
|
|
std::vector<StatImageLoader*>::iterator i;
|
|
|
|
for(i=m_statProjects.begin(); i < m_statProjects.end(); i++) {
|
|
|
|
project = pDoc->state.lookup_project((*i)->m_prjUrl);
|
|
|
|
if ( project == NULL ) {
|
|
|
|
(*i)->Show(false);
|
|
|
|
delete (*i);
|
|
|
|
m_statProjects.erase(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
UpdateDisplayedProjects();
|
|
|
|
} else {
|
|
|
|
std::vector<StatImageLoader*>::iterator i;
|
|
|
|
for(i=m_statProjects.end(); i >= m_statProjects.begin(); i--) {
|
|
|
|
(*i)->Show(false);
|
|
|
|
delete (*i);
|
|
|
|
}
|
|
|
|
m_statProjects.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CProjectsComponent::UpdateDisplayedProjects() {
|
|
|
|
int size = 7;
|
|
|
|
if ( (int) m_statProjects.size() > size ) {
|
|
|
|
size = 6;
|
|
|
|
if ( m_leftIndex + size >= (int) m_statProjects.size() ) {
|
|
|
|
m_leftIndex = (int) m_statProjects.size() - size;
|
|
|
|
}
|
|
|
|
if ( m_leftIndex == 0 ) {
|
|
|
|
btnArwLeft->Show(false);
|
|
|
|
btnArwRight->Show(true);
|
|
|
|
} else {
|
|
|
|
btnArwLeft->Show(true);
|
|
|
|
if ( m_leftIndex + size < (int) m_statProjects.size() ) {
|
|
|
|
btnArwRight->Show(true);
|
|
|
|
} else {
|
|
|
|
btnArwRight->Show(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
m_leftIndex = 0;
|
|
|
|
btnArwLeft->Show(false);
|
|
|
|
btnArwRight->Show(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
int numProjects = (int) m_statProjects.size();
|
|
|
|
for(int i=0; i < numProjects; i++) {
|
|
|
|
if ( i < m_leftIndex || i >= m_leftIndex + size) {
|
|
|
|
m_statProjects.at(i)->Show(false);
|
|
|
|
} else {
|
|
|
|
StatImageLoader* projIcon = m_statProjects.at(i);
|
|
|
|
projIcon->Show(true);
|
|
|
|
int base = -5;
|
|
|
|
if ( size == 6 ) {
|
|
|
|
base = 15;
|
|
|
|
}
|
|
|
|
projIcon->Move(wxPoint(base + 40*(i+1-m_leftIndex),37));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Refresh(true);
|
|
|
|
Update();
|
|
|
|
}
|
2006-10-25 14:09:47 +00:00
|
|
|
|
2006-11-22 09:51:59 +00:00
|
|
|
|
2007-01-05 23:31:38 +00:00
|
|
|
void CProjectsComponent::OnHelp(wxCommandEvent& /*event*/) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnHelp - Function Begin"));
|
|
|
|
|
|
|
|
std::string url;
|
2007-08-16 18:53:42 +00:00
|
|
|
url = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationWebsite().mb_str();
|
2007-01-05 23:31:38 +00:00
|
|
|
canonicalize_master_url(url);
|
|
|
|
|
|
|
|
wxString wxurl;
|
|
|
|
wxurl.Printf(wxT("%smanager_links.php?target=simple"), url.c_str());
|
|
|
|
wxHyperLink::ExecuteLink(wxurl);
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnHelp - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-22 09:51:59 +00:00
|
|
|
void CProjectsComponent::OnMessages(wxCommandEvent& /*event*/) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnMessages - Function Begin"));
|
|
|
|
|
|
|
|
CSimplePanel* pPanel = wxDynamicCast(GetParent(), CSimplePanel);
|
|
|
|
wxASSERT(pPanel);
|
|
|
|
|
|
|
|
MessagesViewed();
|
|
|
|
|
|
|
|
pPanel->SetDlgOpen(true);
|
|
|
|
|
|
|
|
CDlgMessages dlg(GetParent());
|
|
|
|
dlg.ShowModal();
|
|
|
|
|
|
|
|
pPanel->SetDlgOpen(false);
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnMessages - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CProjectsComponent::OnSuspend(wxCommandEvent& /*event*/) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnSuspend - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-12-21 17:05:58 +00:00
|
|
|
|
2006-11-22 09:51:59 +00:00
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2006-11-23 19:47:35 +00:00
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_NEVER, 3600);
|
2006-11-22 09:51:59 +00:00
|
|
|
|
|
|
|
btnPause->Show(false);
|
|
|
|
btnResume->Show(true);
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnSuspend - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CProjectsComponent::OnResume(wxCommandEvent& /*event*/) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnResume - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-12-21 17:05:58 +00:00
|
|
|
CC_STATUS ccs;
|
2006-11-22 09:51:59 +00:00
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2006-12-21 17:05:58 +00:00
|
|
|
pDoc->GetCoreClientStatus(ccs);
|
|
|
|
if ((RUN_MODE_NEVER == ccs.task_mode) && (0 >= ccs.task_mode_delay)) {
|
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_AUTO, 0);
|
|
|
|
} else {
|
|
|
|
pDoc->SetActivityRunMode(RUN_MODE_RESTORE, 0);
|
2006-11-22 09:51:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
btnResume->Show(false);
|
|
|
|
btnPause->Show(true);
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnResume - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
void CProjectsComponent::OnPreferences(wxCommandEvent& /*event*/) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnPreferences - Function Begin"));
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
CSimplePanel* pPanel = wxDynamicCast(GetParent(), CSimplePanel);
|
2006-10-25 14:09:47 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
wxASSERT(pPanel);
|
2006-10-25 14:09:47 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
pPanel->SetDlgOpen(true);
|
2006-10-25 14:09:47 +00:00
|
|
|
|
2006-11-22 09:51:59 +00:00
|
|
|
CDlgPreferences dlg(GetParent());
|
|
|
|
dlg.ShowModal();
|
2006-10-25 14:09:47 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
pPanel->SetDlgOpen(false);
|
2006-10-25 14:09:47 +00:00
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnPreferences - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-07 20:10:36 +00:00
|
|
|
void CProjectsComponent::OnAttachToProject(wxCommandEvent& /*event*/) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnAttachToProject - Function Begin"));
|
|
|
|
|
|
|
|
CSimplePanel* pPanel = wxDynamicCast(GetParent(), CSimplePanel);
|
|
|
|
|
|
|
|
wxASSERT(pPanel);
|
|
|
|
|
|
|
|
pPanel->SetDlgOpen(true);
|
|
|
|
|
|
|
|
pPanel->OnProjectsAttachToProject();
|
|
|
|
btnAddProj->Refresh();
|
|
|
|
|
|
|
|
pPanel->SetDlgOpen(false);
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnAttachToProject - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-15 18:06:18 +00:00
|
|
|
void CProjectsComponent::OnSynchronize(wxCommandEvent& /*event*/) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnSynchronize - Function Begin"));
|
2007-08-07 20:10:36 +00:00
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CSimplePanel* pPanel = wxDynamicCast(GetParent(), CSimplePanel);
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(pPanel);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
if (!pDoc->IsUserAuthorized())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (pDoc->IsConnected()) {
|
|
|
|
|
|
|
|
pPanel->SetDlgOpen(true);
|
|
|
|
|
|
|
|
CWizardAccountManager* pWizard = new CWizardAccountManager(this);
|
|
|
|
|
|
|
|
pWizard->Run(ACCOUNTMANAGER_UPDATE);
|
|
|
|
|
|
|
|
if (pWizard)
|
|
|
|
pWizard->Destroy();
|
|
|
|
|
2007-08-15 18:06:18 +00:00
|
|
|
btnSynchronize->Refresh();
|
2007-08-07 20:10:36 +00:00
|
|
|
|
|
|
|
pPanel->SetDlgOpen(false);
|
|
|
|
}
|
|
|
|
|
2007-08-15 18:06:18 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CProjectsComponent::OnSynchronize - Function End"));
|
2007-08-07 20:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-31 13:59:21 +00:00
|
|
|
void CProjectsComponent::UpdateInterface()
|
|
|
|
{
|
2006-10-23 06:48:48 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
2006-08-24 17:54:54 +00:00
|
|
|
// Check to see if error messages have been received
|
|
|
|
if ( receivedErrorMessage ) {
|
|
|
|
Freeze();
|
|
|
|
if ( alertMessageDisplayed ) {
|
|
|
|
btnAlertMessages->Show(false);
|
|
|
|
btnMessages->Show(true);
|
|
|
|
alertMessageDisplayed = false;
|
|
|
|
} else {
|
|
|
|
btnAlertMessages->Show(true);
|
|
|
|
btnMessages->Show(false);
|
|
|
|
alertMessageDisplayed = true;
|
|
|
|
}
|
|
|
|
Thaw();
|
|
|
|
} else {
|
|
|
|
if ( alertMessageDisplayed ) {
|
|
|
|
Freeze();
|
|
|
|
btnAlertMessages->Show(false);
|
|
|
|
btnMessages->Show(true);
|
|
|
|
alertMessageDisplayed = false;
|
|
|
|
Thaw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-07 20:10:36 +00:00
|
|
|
// Should we display the syncronize button instead of the
|
|
|
|
// attach to project button?
|
|
|
|
ACCT_MGR_INFO ami;
|
|
|
|
CC_STATUS status;
|
|
|
|
bool is_acct_mgr_detected = false;
|
|
|
|
|
2006-10-19 03:24:31 +00:00
|
|
|
pDoc->GetCoreClientStatus(status);
|
2007-08-07 20:10:36 +00:00
|
|
|
pDoc->rpc.acct_mgr_info(ami);
|
|
|
|
|
|
|
|
is_acct_mgr_detected = ami.acct_mgr_url.size() ? true : false;
|
|
|
|
|
|
|
|
if (is_acct_mgr_detected) {
|
|
|
|
btnAddProj->Show(false);
|
2007-08-15 18:06:18 +00:00
|
|
|
btnSynchronize->Show(true);
|
2007-08-07 20:10:36 +00:00
|
|
|
} else {
|
|
|
|
if (!status.disallow_attach) {
|
|
|
|
btnAddProj->Show(true);
|
|
|
|
}
|
2007-08-15 18:06:18 +00:00
|
|
|
btnSynchronize->Show(false);
|
2007-08-07 20:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Show resume or pause as appropriate
|
2006-12-21 17:05:58 +00:00
|
|
|
if (RUN_MODE_NEVER == status.task_mode) {
|
2006-10-19 03:24:31 +00:00
|
|
|
btnPause->Show(false);
|
|
|
|
btnResume->Show(true);
|
|
|
|
} else {
|
|
|
|
btnPause->Show(true);
|
|
|
|
btnResume->Show(false);
|
|
|
|
}
|
|
|
|
|
2007-08-07 20:10:36 +00:00
|
|
|
// Should we disable the attach to project button?
|
|
|
|
if (status.disallow_attach || is_acct_mgr_detected) {
|
|
|
|
btnAddProj->Show(false);
|
|
|
|
} else {
|
|
|
|
btnAddProj->Show(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Should we only be able to see the simple gui?
|
|
|
|
if (status.simple_gui_only) {
|
|
|
|
btnAdvancedView->Show(false);
|
|
|
|
} else {
|
|
|
|
btnAdvancedView->Show(true);
|
|
|
|
}
|
|
|
|
|
2006-10-31 15:27:00 +00:00
|
|
|
// Check number of projects
|
|
|
|
UpdateProjectArray();
|
|
|
|
|
2006-10-16 20:46:57 +00:00
|
|
|
// Update stat icons
|
|
|
|
for(int m = 0; m < (int)m_statProjects.size(); m++){
|
|
|
|
StatImageLoader *i_statIcon = m_statProjects.at(m);
|
|
|
|
i_statIcon->UpdateInterface();
|
|
|
|
}
|
|
|
|
|
2006-07-20 22:15:29 +00:00
|
|
|
}
|
|
|
|
|
2006-07-24 22:10:28 +00:00
|
|
|
void CProjectsComponent::ReskinInterface()
|
|
|
|
{
|
2006-10-23 06:48:48 +00:00
|
|
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
|
|
|
|
|
|
|
wxASSERT(pSkinSimple);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
|
|
|
|
|
|
|
//Set Background color only
|
|
|
|
SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
|
2006-07-24 22:10:28 +00:00
|
|
|
//right button
|
2006-10-23 06:48:48 +00:00
|
|
|
btnArwRight->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnArwRight->SetBitmapLabel(*(pSkinSimple->GetRightArrowButton()->GetBitmap()));
|
|
|
|
btnArwRight->SetBitmapSelected(*(pSkinSimple->GetRightArrowButton()->GetBitmapClicked()));
|
|
|
|
|
|
|
|
//left button
|
|
|
|
btnArwLeft->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnArwLeft->SetBitmapLabel(*(pSkinSimple->GetLeftArrowButton()->GetBitmap()));
|
|
|
|
btnArwLeft->SetBitmapSelected(*(pSkinSimple->GetLeftArrowButton()->GetBitmapClicked()));
|
|
|
|
|
|
|
|
// add project btn
|
|
|
|
btnAddProj->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnAddProj->SetBitmapLabel(*(pSkinSimple->GetAttachProjectButton()->GetBitmap()));
|
|
|
|
btnAddProj->SetBitmapSelected(*(pSkinSimple->GetAttachProjectButton()->GetBitmapClicked()));
|
|
|
|
|
2007-08-15 18:06:18 +00:00
|
|
|
// synchronize btn
|
|
|
|
btnSynchronize->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnSynchronize->SetBitmapLabel(*(pSkinSimple->GetSynchronizeButton()->GetBitmap()));
|
|
|
|
btnSynchronize->SetBitmapSelected(*(pSkinSimple->GetSynchronizeButton()->GetBitmapClicked()));
|
2007-08-07 20:10:36 +00:00
|
|
|
|
2007-01-16 21:52:47 +00:00
|
|
|
// help btn
|
|
|
|
btnHelp->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnHelp->SetBitmapLabel(*(pSkinSimple->GetHelpButton()->GetBitmap()));
|
|
|
|
btnHelp->SetBitmapSelected(*(pSkinSimple->GetHelpButton()->GetBitmapClicked()));
|
|
|
|
|
2006-10-23 06:48:48 +00:00
|
|
|
// messages btn
|
|
|
|
btnMessages->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnMessages->SetBitmapLabel(*(pSkinSimple->GetMessagesLink()->GetBitmap()));
|
|
|
|
btnMessages->SetBitmapSelected(*(pSkinSimple->GetMessagesLink()->GetBitmap()));
|
|
|
|
|
|
|
|
// alert messages btn
|
|
|
|
btnAlertMessages->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnAlertMessages->SetBitmapLabel(*(pSkinSimple->GetMessagesAlertLink()->GetBitmap()));
|
|
|
|
btnAlertMessages->SetBitmapSelected(*(pSkinSimple->GetMessagesAlertLink()->GetBitmap()));
|
|
|
|
|
|
|
|
// pause btn
|
|
|
|
btnPause->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnPause->SetBitmapLabel(*(pSkinSimple->GetSuspendLink()->GetBitmap()));
|
|
|
|
btnPause->SetBitmapSelected(*(pSkinSimple->GetSuspendLink()->GetBitmap()));
|
|
|
|
|
|
|
|
// resume btn
|
|
|
|
btnResume->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnResume->SetBitmapLabel(*(pSkinSimple->GetResumeLink()->GetBitmap()));
|
|
|
|
btnResume->SetBitmapSelected(*(pSkinSimple->GetResumeLink()->GetBitmap()));
|
|
|
|
|
|
|
|
// preferences btn
|
|
|
|
btnPreferences->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnPreferences->SetBitmapLabel(*(pSkinSimple->GetPreferencesLink()->GetBitmap()));
|
|
|
|
btnPreferences->SetBitmapSelected(*(pSkinSimple->GetPreferencesLink()->GetBitmap()));
|
|
|
|
|
|
|
|
// advance view btn
|
|
|
|
btnAdvancedView->SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
|
|
|
|
btnAdvancedView->SetBitmapLabel(*(pSkinSimple->GetAdvancedLink()->GetBitmap()));
|
|
|
|
btnAdvancedView->SetBitmapSelected(*(pSkinSimple->GetAdvancedLink()->GetBitmap()));
|
|
|
|
|
|
|
|
//set line colors
|
|
|
|
lnMyProjTop->SetLineColor(pSkinSimple->GetStaticLineColor());
|
|
|
|
lnMyProjBtm->SetLineColor(pSkinSimple->GetStaticLineColor());
|
2006-08-10 19:32:47 +00:00
|
|
|
|
2007-05-07 20:02:03 +00:00
|
|
|
// spacers
|
|
|
|
i_spacer1->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap()));
|
|
|
|
i_spacer2->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap()));
|
|
|
|
i_spacer2->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap()));
|
|
|
|
|
2006-10-27 02:08:55 +00:00
|
|
|
// Rebuild stat menus and reload icons
|
2006-09-08 21:48:06 +00:00
|
|
|
for(int m = 0; m < (int)m_statProjects.size(); m++){
|
2006-10-27 02:08:55 +00:00
|
|
|
StatImageLoader *i_statImage = m_statProjects.at(m);
|
|
|
|
i_statImage->LoadImage();
|
|
|
|
i_statImage->RebuildMenu();
|
2006-09-08 21:48:06 +00:00
|
|
|
}
|
2006-07-24 22:10:28 +00:00
|
|
|
}
|
|
|
|
|
2006-07-20 22:15:29 +00:00
|
|
|
void CProjectsComponent::OnBtnClick(wxCommandEvent& event){ //init function
|
|
|
|
wxObject *m_wxBtnObj = event.GetEventObject();
|
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
if (m_wxBtnObj==btnArwLeft){
|
2006-10-31 15:27:00 +00:00
|
|
|
m_leftIndex--;
|
|
|
|
UpdateDisplayedProjects();
|
2006-08-10 19:32:47 +00:00
|
|
|
Refresh();
|
2006-10-25 14:09:47 +00:00
|
|
|
} else if(m_wxBtnObj==btnArwRight){
|
2006-10-31 15:27:00 +00:00
|
|
|
m_leftIndex++;
|
|
|
|
UpdateDisplayedProjects();
|
2006-08-10 19:32:47 +00:00
|
|
|
Refresh();
|
2006-11-22 09:51:59 +00:00
|
|
|
} else if(m_wxBtnObj==btnAdvancedView) {
|
2006-08-07 15:33:03 +00:00
|
|
|
wxGetApp().SetActiveGUI(BOINC_ADVANCEDGUI, true);
|
|
|
|
}
|
|
|
|
}
|
2006-10-25 14:09:47 +00:00
|
|
|
|
|
|
|
|
2006-08-07 15:33:03 +00:00
|
|
|
void CProjectsComponent::OnEraseBackground(wxEraseEvent& event){
|
2006-10-23 06:48:48 +00:00
|
|
|
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
|
|
|
|
|
|
|
|
wxASSERT(pSkinSimple);
|
|
|
|
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
|
|
|
|
|
2006-10-30 03:41:32 +00:00
|
|
|
wxDC* dc = event.GetDC();
|
|
|
|
dc->DrawBitmap(*pSkinSimple->GetProjectAreaBackgroundImage()->GetBitmap(), 0, 0);
|
2006-08-24 17:54:54 +00:00
|
|
|
}
|
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
|
|
|
|
void CProjectsComponent::OnMessageCheck(wxTimerEvent& WXUNUSED(event)) {
|
2006-08-24 17:54:54 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
MESSAGE* message;
|
|
|
|
// Only look at the messages recieved since the last time we looked
|
2006-09-08 21:48:06 +00:00
|
|
|
if ( pDoc->GetMessageCount() > (int) lastMessageId ) {
|
2006-08-24 17:54:54 +00:00
|
|
|
// Loop through and check for any messages recieved that are error messages
|
2006-09-08 21:48:06 +00:00
|
|
|
for(size_t i=lastMessageId; i < pDoc->messages.messages.size(); i++) {
|
2006-08-24 17:54:54 +00:00
|
|
|
lastMessageId = i+1;
|
2006-09-08 21:48:06 +00:00
|
|
|
message = pDoc->message((unsigned int) i);
|
2007-01-25 23:39:06 +00:00
|
|
|
if ( message != NULL && message->priority == MSG_USER_ERROR ) {
|
2006-08-24 17:54:54 +00:00
|
|
|
receivedErrorMessage = true;
|
|
|
|
checkForMessagesTimer->Stop();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
|
2006-08-24 17:54:54 +00:00
|
|
|
void CProjectsComponent::MessagesViewed() {
|
|
|
|
receivedErrorMessage = false;
|
2006-11-22 21:26:21 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-10-18 16:06:29 +00:00
|
|
|
lastMessageId = pDoc->GetMessageCount();
|
2006-08-24 17:54:54 +00:00
|
|
|
checkForMessagesTimer->Start();
|
2007-01-25 23:39:06 +00:00
|
|
|
}
|