mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=10578
This commit is contained in:
parent
3277734284
commit
20ca43f0db
|
@ -7219,3 +7219,22 @@ Charlie 4 July 2006
|
|||
BOINCGUIApp.cpp
|
||||
mac/
|
||||
SetupSecurity.cpp
|
||||
|
||||
Rom 5 July 2006
|
||||
- Add Suspend a Disconnect icons to the taskbar for when the client is
|
||||
snoozing and disconnected.
|
||||
- Refreshed Simple GUI
|
||||
|
||||
clientgui/
|
||||
AdvancedFrame.cpp
|
||||
BOINCBaseFrame.cpp
|
||||
BOINCGUIApp.cpp, .h
|
||||
BOINCTaskBar.cpp, .h
|
||||
sg_BoincSimpleGUI.cpp, .h
|
||||
sg_StatImageLoader.cpp, .h
|
||||
clientgui/res/
|
||||
boincdisconnect.xpm (Added)
|
||||
boincsnooze.xpm (Added)
|
||||
clientgui/res/templates/
|
||||
icondisconnect.ico (Added)
|
||||
iconsnooze.ico (Added)
|
||||
|
|
|
@ -850,7 +850,7 @@ void CAdvancedFrame::OnActivitySelection(wxCommandEvent& event) {
|
|||
wxASSERT(pTaskbar);
|
||||
wxASSERT(wxDynamicCast(pTaskbar, CTaskBarIcon));
|
||||
|
||||
pTaskbar->ResetSuspendState();
|
||||
pTaskbar->ResetSnoozeState();
|
||||
|
||||
switch(event.GetId()) {
|
||||
case ID_FILEACTIVITYRUNALWAYS:
|
||||
|
@ -881,7 +881,7 @@ void CAdvancedFrame::OnNetworkSelection(wxCommandEvent& event) {
|
|||
wxASSERT(pTaskbar);
|
||||
wxASSERT(wxDynamicCast(pTaskbar, CTaskBarIcon));
|
||||
|
||||
pTaskbar->ResetSuspendState();
|
||||
pTaskbar->ResetSnoozeState();
|
||||
|
||||
switch(event.GetId()) {
|
||||
case ID_FILENETWORKRUNALWAYS:
|
||||
|
|
|
@ -218,7 +218,7 @@ void CBOINCBaseFrame::OnAlert(CFrameAlertEvent& event) {
|
|||
}
|
||||
|
||||
pTaskbar->SetBalloon(
|
||||
pTaskbar->m_iconTaskBarIcon,
|
||||
pTaskbar->m_iconTaskBarNormal,
|
||||
event.m_title,
|
||||
event.m_message,
|
||||
5000,
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
#include "res/gridrepublic_mac.xpm"
|
||||
#else
|
||||
#include "res/boinc.xpm"
|
||||
#include "res/boincdisconnect.xpm"
|
||||
#include "res/boincsnooze.xpm"
|
||||
#include "res/gridrepublic16.xpm"
|
||||
#include "res/gridrepublic32.xpm"
|
||||
#include "res/cpdnbbc16.xpm"
|
||||
|
@ -227,6 +229,8 @@ bool CBrandingScheme::OnInit( wxConfigBase *pConfig ) {
|
|||
// Running in native mode without any branding
|
||||
m_strApplicationName = wxT("BOINC Manager");
|
||||
m_iconApplicationIcon = wxIcon(boinc_xpm);
|
||||
m_iconApplicationDisconnectedIcon = wxIcon(boincdisconnect_xpm);
|
||||
m_iconApplicationSnoozeIcon = wxIcon(boincsnooze_xpm);
|
||||
m_bitmapApplicationLogo = wxBitmap(boincsm_xpm);
|
||||
m_strCompanyName = wxT("Space Sciences Laboratory, U.C. Berkeley");
|
||||
m_strCompanyWebsite = wxT("http://boinc.berkeley.edu/");
|
||||
|
@ -437,7 +441,9 @@ bool CBOINCGUIApp::OnInit() {
|
|||
// Initialize the task bar icon
|
||||
m_pTaskBarIcon = new CTaskBarIcon(
|
||||
m_pBranding->GetApplicationName(),
|
||||
m_pBranding->GetApplicationIcon()
|
||||
m_pBranding->GetApplicationIcon(),
|
||||
m_pBranding->GetApplicationDisconnectedIcon(),
|
||||
m_pBranding->GetApplicationSnoozeIcon()
|
||||
);
|
||||
wxASSERT(m_pTaskBarIcon);
|
||||
#ifdef __WXMAC__
|
||||
|
|
|
@ -33,10 +33,9 @@
|
|||
#include "BOINCBaseFrame.h"
|
||||
#include "MainDocument.h"
|
||||
|
||||
|
||||
#define BOINC_ADVANCEDGUI 1
|
||||
#ifdef SIMPLEGUI
|
||||
#define BOINC_SIMPLEGUI 2
|
||||
#endif
|
||||
|
||||
|
||||
class CBrandingScheme : public wxObject {
|
||||
|
@ -44,6 +43,8 @@ private:
|
|||
bool m_bIsBranded;
|
||||
wxString m_strApplicationName;
|
||||
wxIcon m_iconApplicationIcon;
|
||||
wxIcon m_iconApplicationDisconnectedIcon;
|
||||
wxIcon m_iconApplicationSnoozeIcon;
|
||||
wxBitmap m_bitmapApplicationLogo;
|
||||
wxString m_strCompanyName;
|
||||
wxString m_strCompanyWebsite;
|
||||
|
@ -66,6 +67,8 @@ public:
|
|||
bool IsBranded() { return m_bIsBranded; }
|
||||
wxString GetApplicationName() { return m_strApplicationName; }
|
||||
wxIcon* GetApplicationIcon() { return &m_iconApplicationIcon; }
|
||||
wxIcon* GetApplicationDisconnectedIcon() { return &m_iconApplicationDisconnectedIcon; }
|
||||
wxIcon* GetApplicationSnoozeIcon() { return &m_iconApplicationSnoozeIcon; }
|
||||
wxBitmap* GetApplicationLogo() { return &m_bitmapApplicationLogo; }
|
||||
wxString GetCompanyName() { return m_strCompanyName; }
|
||||
wxString GetCompanyWebsite() { return m_strCompanyWebsite; }
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
BEGIN_EVENT_TABLE (CTaskBarIcon, wxTaskBarIconEx)
|
||||
EVT_IDLE(CTaskBarIcon::OnIdle)
|
||||
EVT_CLOSE(CTaskBarIcon::OnClose)
|
||||
EVT_TIMER(ID_TB_TIMER, CTaskBarIcon::OnTimer)
|
||||
EVT_TIMER(ID_TB_TIMER, CTaskBarIcon::OnRefresh)
|
||||
EVT_TASKBAR_LEFT_DCLICK(CTaskBarIcon::OnLButtonDClick)
|
||||
EVT_MENU(wxID_OPEN, CTaskBarIcon::OnOpen)
|
||||
EVT_MENU(ID_OPENWEBSITE, CTaskBarIcon::OnOpenWebsite)
|
||||
|
@ -55,7 +55,7 @@ BEGIN_EVENT_TABLE (CTaskBarIcon, wxTaskBarIconEx)
|
|||
END_EVENT_TABLE ()
|
||||
|
||||
|
||||
CTaskBarIcon::CTaskBarIcon(wxString title, wxIcon* icon) :
|
||||
CTaskBarIcon::CTaskBarIcon(wxString title, wxIcon* icon, wxIcon* iconDisconnected, wxIcon* iconSnooze) :
|
||||
#if defined(__WXMAC__)
|
||||
wxTaskBarIcon(DOCK)
|
||||
#elif defined(__WXMSW__)
|
||||
|
@ -64,17 +64,26 @@ CTaskBarIcon::CTaskBarIcon(wxString title, wxIcon* icon) :
|
|||
wxTaskBarIcon()
|
||||
#endif
|
||||
{
|
||||
m_iconTaskBarIcon = *icon;
|
||||
m_iconTaskBarNormal = *icon;
|
||||
m_iconTaskBarDisconnected = *iconDisconnected;
|
||||
m_iconTaskBarSnooze = *iconSnooze;
|
||||
m_strDefaultTitle = title;
|
||||
|
||||
m_dtLastHoverDetected = wxDateTime((time_t)0);
|
||||
m_dtLastBalloonDisplayed = wxDateTime((time_t)0);
|
||||
m_dtSnoozeStartTime = wxDateTime((time_t)0);
|
||||
|
||||
m_bMouseButtonPressed = false;
|
||||
m_bResetSnooze = false;
|
||||
|
||||
m_iPreviousActivityMode = RUN_MODE_AUTO;
|
||||
m_iPreviousNetworkMode = RUN_MODE_AUTO;
|
||||
|
||||
m_pTimer = new wxTimer(this, ID_TB_TIMER);
|
||||
m_pRefreshTimer = new wxTimer(this, ID_TB_TIMER);
|
||||
m_pRefreshTimer->Start(1000); // Send event every second
|
||||
|
||||
#ifndef __WXMAC__
|
||||
SetIcon(m_iconTaskBarIcon, title);
|
||||
SetIcon(m_iconTaskBarNormal, m_strDefaultTitle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -82,9 +91,9 @@ CTaskBarIcon::CTaskBarIcon(wxString title, wxIcon* icon) :
|
|||
CTaskBarIcon::~CTaskBarIcon() {
|
||||
RemoveIcon();
|
||||
|
||||
if (m_pTimer) {
|
||||
m_pTimer->Stop();
|
||||
delete m_pTimer;
|
||||
if (m_pRefreshTimer) {
|
||||
m_pRefreshTimer->Stop();
|
||||
delete m_pRefreshTimer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,19 +121,54 @@ void CTaskBarIcon::OnClose(wxCloseEvent& event) {
|
|||
}
|
||||
|
||||
|
||||
void CTaskBarIcon::OnTimer(wxTimerEvent& event) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CTaskBarIcon::OnTimer - Function Begin"));
|
||||
void CTaskBarIcon::OnRefresh(wxTimerEvent& event) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CTaskBarIcon::OnRefresh - Function Begin"));
|
||||
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
bool bResetSnooze = false;
|
||||
wxInt32 iActivityMode = -1;
|
||||
wxInt32 iNetworkMode = -1;
|
||||
|
||||
wxASSERT(pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
|
||||
m_pTimer->Stop();
|
||||
pDoc->SetActivityRunMode(m_iPreviousActivityMode);
|
||||
pDoc->SetNetworkRunMode(m_iPreviousNetworkMode);
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CTaskBarIcon::OnTimer - Function End"));
|
||||
// If we are done snoozing, change our settings back to their original settings
|
||||
if (m_bResetSnooze) {
|
||||
bResetSnooze = true;
|
||||
}
|
||||
if (wxDateTime((time_t)0) != m_dtSnoozeStartTime) {
|
||||
wxTimeSpan ts(wxDateTime::Now() - m_dtSnoozeStartTime);
|
||||
if (ts.GetMinutes() >= 60) {
|
||||
bResetSnooze = true;
|
||||
}
|
||||
}
|
||||
if (bResetSnooze) {
|
||||
pDoc->SetActivityRunMode(m_iPreviousActivityMode);
|
||||
pDoc->SetNetworkRunMode(m_iPreviousNetworkMode);
|
||||
|
||||
m_dtSnoozeStartTime = wxDateTime((time_t)0);
|
||||
}
|
||||
|
||||
|
||||
// What is the current status of the client?
|
||||
pDoc->GetActivityRunMode(iActivityMode);
|
||||
pDoc->GetNetworkRunMode(iNetworkMode);
|
||||
|
||||
|
||||
// Which icon should be displayed?
|
||||
if (!pDoc->IsConnected()) {
|
||||
SetIcon(m_iconTaskBarDisconnected, m_strDefaultTitle);
|
||||
} else {
|
||||
if (RUN_MODE_NEVER == iActivityMode) {
|
||||
SetIcon(m_iconTaskBarSnooze, m_strDefaultTitle);
|
||||
} else {
|
||||
SetIcon(m_iconTaskBarNormal, m_strDefaultTitle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CTaskBarIcon::OnRefresh - Function End"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -203,25 +247,25 @@ void CTaskBarIcon::OnSuspend(wxCommandEvent& event) {
|
|||
if ((RUN_MODE_NEVER == iActivityMode) && (RUN_MODE_NEVER == iNetworkMode) &&
|
||||
(RUN_MODE_NEVER == m_iPreviousActivityMode) && (RUN_MODE_NEVER == m_iPreviousActivityMode)) {
|
||||
|
||||
m_pTimer->Stop();
|
||||
ResetSnoozeState();
|
||||
|
||||
pDoc->SetActivityRunMode(RUN_MODE_AUTO);
|
||||
pDoc->SetNetworkRunMode(RUN_MODE_AUTO);
|
||||
|
||||
} else if ((RUN_MODE_NEVER == iActivityMode) && (RUN_MODE_NEVER == iNetworkMode)) {
|
||||
|
||||
m_pTimer->Stop();
|
||||
ResetSnoozeState();
|
||||
|
||||
pDoc->SetActivityRunMode(m_iPreviousActivityMode);
|
||||
pDoc->SetNetworkRunMode(m_iPreviousNetworkMode);
|
||||
|
||||
} else {
|
||||
|
||||
m_pTimer->Start(60*60*1000); // Send event every 60 minutes
|
||||
|
||||
m_iPreviousActivityMode = iActivityMode;
|
||||
m_iPreviousNetworkMode = iNetworkMode;
|
||||
|
||||
m_dtSnoozeStartTime = wxDateTime::Now();
|
||||
|
||||
pDoc->SetActivityRunMode(RUN_MODE_NEVER);
|
||||
pDoc->SetNetworkRunMode(RUN_MODE_NEVER);
|
||||
|
||||
|
@ -285,8 +329,9 @@ void CTaskBarIcon::OnShutdown(wxTaskBarIconExEvent& event) {
|
|||
|
||||
void CTaskBarIcon::OnMouseMove(wxTaskBarIconEvent& WXUNUSED(event)) {
|
||||
wxTimeSpan ts(wxDateTime::Now() - m_dtLastHoverDetected);
|
||||
if (ts.GetSeconds() >= 10)
|
||||
if (ts.GetSeconds() >= 10) {
|
||||
m_dtLastHoverDetected = wxDateTime::Now();
|
||||
}
|
||||
|
||||
wxTimeSpan tsLastHover(wxDateTime::Now() - m_dtLastHoverDetected);
|
||||
wxTimeSpan tsLastBalloon(wxDateTime::Now() - m_dtLastBalloonDisplayed);
|
||||
|
@ -306,6 +351,7 @@ void CTaskBarIcon::OnMouseMove(wxTaskBarIconEvent& WXUNUSED(event)) {
|
|||
wxInt32 iIndex = 0;
|
||||
bool bActivitiesSuspended = false;
|
||||
bool bNetworkSuspended = false;
|
||||
wxIcon iconIcon = wxNullIcon;
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
|
||||
wxASSERT(pDoc);
|
||||
|
@ -324,6 +370,7 @@ void CTaskBarIcon::OnMouseMove(wxTaskBarIconEvent& WXUNUSED(event)) {
|
|||
_("%s is currently suspended...\n"),
|
||||
wxGetApp().GetBrand()->GetProjectName().c_str()
|
||||
);
|
||||
iconIcon = m_iconTaskBarSnooze;
|
||||
strMessage += strBuffer;
|
||||
}
|
||||
|
||||
|
@ -388,10 +435,11 @@ void CTaskBarIcon::OnMouseMove(wxTaskBarIconEvent& WXUNUSED(event)) {
|
|||
wxGetApp().GetBrand()->GetApplicationName().c_str(),
|
||||
wxGetApp().GetBrand()->GetProjectName().c_str()
|
||||
);
|
||||
iconIcon = m_iconTaskBarDisconnected;
|
||||
strMessage += strBuffer;
|
||||
}
|
||||
|
||||
SetBalloon(m_iconTaskBarIcon, strTitle, strMessage);
|
||||
SetBalloon(iconIcon, strTitle, strMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,16 +461,16 @@ void CTaskBarIcon::OnContextMenu(wxTaskBarIconEvent& WXUNUSED(event)) {
|
|||
#ifdef __WXMSW__
|
||||
void CTaskBarIcon::OnRButtonDown(wxTaskBarIconEvent& WXUNUSED(event)) {
|
||||
if (!IsBalloonsSupported()) {
|
||||
m_bButtonPressed = true;
|
||||
m_bMouseButtonPressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CTaskBarIcon::OnRButtonUp(wxTaskBarIconEvent& WXUNUSED(event)) {
|
||||
if (!IsBalloonsSupported()) {
|
||||
if (m_bButtonPressed) {
|
||||
if (m_bMouseButtonPressed) {
|
||||
CreateContextMenu();
|
||||
m_bButtonPressed = false;
|
||||
m_bMouseButtonPressed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -430,17 +478,17 @@ void CTaskBarIcon::OnRButtonUp(wxTaskBarIconEvent& WXUNUSED(event)) {
|
|||
#endif // !__WXMAC__
|
||||
|
||||
|
||||
void CTaskBarIcon::ResetSuspendState() {
|
||||
m_pTimer->Stop();
|
||||
void CTaskBarIcon::ResetSnoozeState() {
|
||||
m_bResetSnooze = true;
|
||||
}
|
||||
|
||||
|
||||
void CTaskBarIcon::ResetTaskBar() {
|
||||
#ifdef __WXMSW___
|
||||
SetBalloon(m_iconTaskBarIcon, wxT(""), wxT(""));
|
||||
SetBalloon(m_iconTaskBarNormal, wxT(""), wxT(""));
|
||||
#else
|
||||
#ifndef __WXMAC__
|
||||
SetIcon(m_iconTaskBarIcon, wxT(""));
|
||||
SetIcon(m_iconTaskBarNormal, wxT(""));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
class CTaskBarIcon : public wxTaskBarIconEx {
|
||||
public:
|
||||
CTaskBarIcon(wxString title, wxIcon* icon);
|
||||
CTaskBarIcon(wxString title, wxIcon* icon, wxIcon* iconDisconnected, wxIcon* iconSnooze);
|
||||
~CTaskBarIcon();
|
||||
|
||||
void OnOpenWebsite(wxCommandEvent& event);
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnTimer(wxTimerEvent& event);
|
||||
void OnRefresh(wxTimerEvent& event);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
void OnMouseMove(wxTaskBarIconEvent& event);
|
||||
|
@ -70,6 +70,7 @@ public:
|
|||
|
||||
wxMenu *BuildContextMenu();
|
||||
void AdjustMenuItems(wxMenu* menu);
|
||||
void ResetSnoozeState();
|
||||
|
||||
#ifdef __APPLE__
|
||||
wxMenu *CreatePopupMenu();
|
||||
|
@ -81,16 +82,20 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
wxIcon m_iconTaskBarIcon;
|
||||
void ResetSuspendState();
|
||||
wxIcon m_iconTaskBarNormal;
|
||||
wxIcon m_iconTaskBarDisconnected;
|
||||
wxIcon m_iconTaskBarSnooze;
|
||||
wxString m_strDefaultTitle;
|
||||
|
||||
private:
|
||||
wxDateTime m_dtLastHoverDetected;
|
||||
wxDateTime m_dtLastBalloonDisplayed;
|
||||
wxDateTime m_dtSnoozeStartTime;
|
||||
|
||||
wxTimer* m_pTimer;
|
||||
wxTimer* m_pRefreshTimer;
|
||||
|
||||
bool m_bButtonPressed;
|
||||
bool m_bMouseButtonPressed;
|
||||
bool m_bResetSnooze;
|
||||
|
||||
int m_iPreviousActivityMode;
|
||||
int m_iPreviousNetworkMode;
|
||||
|
|
|
@ -1,963 +0,0 @@
|
|||
// 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_BoincSimpleGUI.h"
|
||||
#endif
|
||||
|
||||
#include "stdwx.h"
|
||||
#include "BOINCGUIApp.h"
|
||||
#include "BOINCBaseFrame.h"
|
||||
#include "Events.h"
|
||||
#include "common/wxAnimate.h"
|
||||
#include "common/wxFlatNotebook.h"
|
||||
#include "sg_ImageLoader.h"
|
||||
#include "sg_StatImageLoader.h"
|
||||
#include "sg_DlgPreferences.h"
|
||||
#include "sg_SkinClass.h"
|
||||
#include "sg_BoincSimpleGUI.h"
|
||||
#include "error_numbers.h"
|
||||
#include "parse.h"
|
||||
#include <string>
|
||||
#include "wizardex.h"
|
||||
#include "BOINCWizards.h"
|
||||
#include "BOINCBaseWizard.h"
|
||||
#include "WizardAttachProject.h"
|
||||
#include "WizardAccountManager.h"
|
||||
|
||||
#include "res/boinc.xpm"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CSimpleFrame, CBOINCBaseFrame)
|
||||
|
||||
BEGIN_EVENT_TABLE(CSimpleFrame, CBOINCBaseFrame)
|
||||
EVT_BUTTON(-1,CSimpleFrame::OnBtnClick)
|
||||
EVT_SIZE(CSimpleFrame::OnSize)
|
||||
EVT_ERASE_BACKGROUND(CSimpleFrame::OnEraseBackground)
|
||||
EVT_FRAME_CONNECT(CSimpleFrame::OnConnect)
|
||||
EVT_TIMER(ID_SIMPLEFRAMERENDERTIMER, CSimpleFrame::OnFrameRender)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
CSimpleFrame::CSimpleFrame() {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Default Constructor Function Begin"));
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Default Constructor Function End"));
|
||||
}
|
||||
|
||||
|
||||
CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon) :
|
||||
CBOINCBaseFrame((wxFrame *)NULL, ID_SIMPLEFRAME, title, wxDefaultPosition, wxSize(416, 581),
|
||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
// Initialize Application
|
||||
SetIcon(*icon);
|
||||
|
||||
skinName = _T("default");
|
||||
skinsFolder = _T("skins");
|
||||
skinPath = skinsFolder+_T("/")+skinName+_T("/")+_T("skin.xml");
|
||||
midAppCollapsed = false;
|
||||
btmAppCollapsed = false;
|
||||
clientGUIInitialized = false;
|
||||
// load skin xml and parse it
|
||||
LoadSkinXML();
|
||||
// load images from skin file
|
||||
LoadSkinImages();
|
||||
//set polling timer for interface
|
||||
m_pFrameRenderTimer = new wxTimer(this, ID_SIMPLEFRAMERENDERTIMER);
|
||||
wxASSERT(m_pFrameRenderTimer);
|
||||
m_pFrameRenderTimer->Start(1000); // Send event every 1 second
|
||||
//Create client
|
||||
InitEmptyState();
|
||||
//InitSimpleClient(); moved to timer function
|
||||
// center application
|
||||
//initAfter();
|
||||
}
|
||||
|
||||
CSimpleFrame::~CSimpleFrame()
|
||||
{
|
||||
wxASSERT(m_pFrameRenderTimer);
|
||||
|
||||
if (m_pFrameRenderTimer) {
|
||||
m_pFrameRenderTimer->Stop();
|
||||
delete m_pFrameRenderTimer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CSimpleFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function Begin"));
|
||||
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
CWizardAccountManager* pAMWizard = NULL;
|
||||
CWizardAttachProject* pAPWizard = NULL;
|
||||
wxString strComputer = wxEmptyString;
|
||||
wxString strName = wxEmptyString;
|
||||
wxString strURL = wxEmptyString;
|
||||
bool bCachedCredentials = false;
|
||||
ACCT_MGR_INFO ami;
|
||||
PROJECT_INIT_STATUS pis;
|
||||
|
||||
wxASSERT(pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
|
||||
// If we are connected to the localhost, run a really quick screensaver
|
||||
// test to trigger a firewall popup.
|
||||
pDoc->GetConnectedComputerName(strComputer);
|
||||
if (pDoc->IsComputerNameLocal(strComputer)) {
|
||||
wxGetApp().StartBOINCScreensaverTest();
|
||||
}
|
||||
|
||||
|
||||
pDoc->rpc.acct_mgr_info(ami);
|
||||
if (ami.acct_mgr_url.size() && !ami.have_credentials) {
|
||||
pAMWizard = new CWizardAccountManager(this);
|
||||
|
||||
if (!IsShown()) {
|
||||
Show();
|
||||
}
|
||||
|
||||
if (pAMWizard->Run()) {
|
||||
// If successful, hide the main window
|
||||
Hide();
|
||||
}
|
||||
} else if (0 >= pDoc->GetProjectCount()) {
|
||||
pAPWizard = new CWizardAttachProject(this);
|
||||
|
||||
if (!IsShown()) {
|
||||
Show();
|
||||
}
|
||||
|
||||
pDoc->rpc.get_project_init_status(pis);
|
||||
strName = wxString(pis.name.c_str(), wxConvUTF8);
|
||||
strURL = wxString(pis.url.c_str(), wxConvUTF8);
|
||||
bCachedCredentials = pis.url.length() && pis.has_account_key;
|
||||
|
||||
pAPWizard->Run(strName, strURL, bCachedCredentials);
|
||||
}
|
||||
|
||||
if (pAMWizard)
|
||||
pAMWizard->Destroy();
|
||||
if (pAPWizard)
|
||||
pAPWizard->Destroy();
|
||||
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function End"));
|
||||
}
|
||||
|
||||
void CSimpleFrame::OnFrameRender(wxTimerEvent &event) {
|
||||
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
int retValue;
|
||||
//Update data
|
||||
if(pDoc->IsConnected()){
|
||||
retValue = pDoc->CachedSimpleGUIUpdate();
|
||||
if(retValue==0){
|
||||
if(!clientGUIInitialized){
|
||||
//Freeze();
|
||||
InitSimpleClient();
|
||||
initAfter();
|
||||
// Thaw();
|
||||
//Update();
|
||||
clientGUIInitialized = true;
|
||||
Show(true);
|
||||
}//else check for changes in the interface
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxPoint& CSimpleFrame::SetwxPoint(long x,long y){
|
||||
m_tmppoint.x=x;
|
||||
m_tmppoint.y=y;
|
||||
return m_tmppoint;
|
||||
}
|
||||
|
||||
wxSize& CSimpleFrame::SetwxSize(long w,long h){
|
||||
m_tmpsize.SetWidth(w);
|
||||
m_tmpsize.SetHeight(h);
|
||||
return m_tmpsize;
|
||||
}
|
||||
wxWindow* CSimpleFrame::CreateNotebookPage()
|
||||
{
|
||||
static int newPageCounter = 0;
|
||||
wxString caption;
|
||||
caption.Printf(_("Work Unit"));
|
||||
return new wxWindow(this,-1,wxDefaultPosition,SetwxSize(370,330),wxNO_BORDER);
|
||||
}
|
||||
void CSimpleFrame::InitEmptyState()
|
||||
{
|
||||
Show(false);
|
||||
Centre();
|
||||
}
|
||||
void CSimpleFrame::InitSimpleClient()
|
||||
{
|
||||
//Set Background color
|
||||
SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
// Flex Grid Sizer
|
||||
mainSizer = new wxFlexGridSizer(3,2);
|
||||
//mainSizer->SetFlexibleDirection(wxHORIZONTAL);
|
||||
SetSizer(mainSizer);
|
||||
// FlatNotebook
|
||||
wrkUnitNB = new wxFlatNotebook(this, -1, wxDefaultPosition, SetwxSize(370,330), wxFNB_TABS_BORDER_SIMPLE | wxFNB_NO_X_BUTTON | wxFNB_NO_NAV_BUTTONS | wxFNB_FANCY_TABS);
|
||||
wrkUnitNB->SetBackgroundColour(wxColour(255,255,255));
|
||||
wrkUnitNB->SetTabAreaColour(appSkin->GetAppBgCol());
|
||||
wrkUnitNB->SetGradientColors(appSkin->GetTabFromColAc(),appSkin->GetTabToColAc(),appSkin->GetTabBrdColAc());
|
||||
wrkUnitNB->SetActiveTabTextColour(wxColour(157,165,171));
|
||||
wrkUnitNB->SetGradientColorsInactive(appSkin->GetTabFromColIn(),appSkin->GetTabToColIn(),appSkin->GetTabBrdColIn());
|
||||
wrkUnitNB->SetNonActiveTabTextColour(wxColour(186,184,200));
|
||||
wrkUnitNB->SetImageList(&m_ImageList);
|
||||
//create work unit tabs
|
||||
int resultCnt = pDoc->results.results.size();
|
||||
|
||||
for(int i = 0; i < resultCnt; i++){
|
||||
RESULT* result = pDoc->results.results[i];
|
||||
RESULT* resState = pDoc->state.lookup_result(result->project_url, result->name);
|
||||
wxString friendlyName;
|
||||
|
||||
if(resState!=0){
|
||||
friendlyName = wxString(resState->app->name.c_str(), wxConvUTF8 );
|
||||
}else{
|
||||
friendlyName = wxString(resState->app->name.c_str(), wxConvUTF8 );
|
||||
}
|
||||
std::string index = " ";
|
||||
//index += i;
|
||||
friendlyName += wxString(index.c_str(), wxConvUTF8 );
|
||||
wxWindow *wTab = this->CreateNotebookPage();
|
||||
wrkUnitNB->AddPage(wTab, wxT(friendlyName, true));
|
||||
if(result->active_task){
|
||||
wrkUnitNB->SetPageImageIndex(i, 0); // this is working process
|
||||
}else{
|
||||
wrkUnitNB->SetPageImageIndex(i, 1); // this is sleeping process
|
||||
}
|
||||
///////////////////////Build Tab Page///////////////////////////////
|
||||
//Prj Icon
|
||||
w_iconPT1=new wxWindow(wTab,-1,SetwxPoint(2,2),SetwxSize(22,22));
|
||||
i_prjIcnPT1 = new ImageLoader(w_iconPT1);
|
||||
i_prjIcnPT1->LoadImage(g_prjIcnWCG);
|
||||
//Project Name
|
||||
lblProjectName=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(25,2),SetwxSize(289,18),wxST_NO_AUTORESIZE);
|
||||
lblProjectName->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
wxString projName;
|
||||
projName = wxString(resState->project->project_name.c_str(), wxConvUTF8 ) + wxT(" - ") + wxString(resState->app->user_friendly_name.c_str(), wxConvUTF8);
|
||||
lblProjectName->SetLabel(projName);
|
||||
lblProjectName->SetFont(wxFont(11,74,90,90,0,wxT("Tahoma")));
|
||||
//Line Proj Name
|
||||
lnProjName=new wxStaticLine(wTab,-1,SetwxPoint(9,25),SetwxSize(353,2));
|
||||
//My Progress
|
||||
lblMyProgress=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(15,32),SetwxSize(89,18),wxST_NO_AUTORESIZE);
|
||||
lblMyProgress->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
lblMyProgress->SetLabel(wxT("My Progress:"));
|
||||
lblMyProgress->SetFont(wxFont(10,74,90,92,0,wxT("Tahoma")));
|
||||
//Main Gauge
|
||||
gaugeWuP1=new wxGauge(wTab,-1,100,SetwxPoint(15,60),SetwxSize(340,30),wxGA_SMOOTH);
|
||||
gaugeWuP1->SetForegroundColour(appSkin->GetGaugeFgCol());
|
||||
gaugeWuP1->SetBackgroundColour(appSkin->GetGaugeBgCol());
|
||||
gaugeWuP1->SetValue(floor(result->fraction_done * 100000)/1000);
|
||||
//Work Unit Name
|
||||
lblWrkUnitName=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(110,34),SetwxSize(79,13),wxST_NO_AUTORESIZE);
|
||||
lblWrkUnitName->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
lblWrkUnitName->SetLabel(wxString(result->name.c_str(),wxConvUTF8));
|
||||
//Elapsed Time
|
||||
lblElapsedTime=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(15,97),SetwxSize(84,18),wxST_NO_AUTORESIZE);
|
||||
lblElapsedTime->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
lblElapsedTime->SetLabel(wxT("Elapsed Time:"));
|
||||
lblElapsedTime->SetFont(wxFont(10,74,90,90,0,wxT("Tahoma")));
|
||||
//Elapsed time Value
|
||||
wxString strBuffer = wxEmptyString;
|
||||
lblElapsedTimeValue=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(102,97),SetwxSize(364,18),wxST_NO_AUTORESIZE);
|
||||
lblElapsedTimeValue->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
FormatCPUTime(result, strBuffer);
|
||||
lblElapsedTimeValue->SetLabel(strBuffer);
|
||||
lblElapsedTimeValue->SetFont(wxFont(10,74,90,90,0,wxT("Tahoma")));
|
||||
//Time Remaining
|
||||
lblTimeRemaining=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(15,119),SetwxSize(154,18),wxST_NO_AUTORESIZE);
|
||||
lblTimeRemaining->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
lblTimeRemaining->SetLabel(wxT("Time remaining:"));
|
||||
lblTimeRemaining->SetFont(wxFont(10,74,90,90,0,wxT("Tahoma")));
|
||||
//Time Remaining Value
|
||||
lblTimeRemainingValue=new wxStaticText(wTab,-1,wxT(""),SetwxPoint(115,119),SetwxSize(294,18),wxST_NO_AUTORESIZE);
|
||||
lblTimeRemainingValue->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
FormatTimeToCompletion(result, strBuffer);
|
||||
lblTimeRemainingValue->SetLabel(strBuffer);
|
||||
lblTimeRemainingValue->SetFont(wxFont(10,74,90,90,0,wxT("Tahoma")));
|
||||
// project image behind graphic <><><>
|
||||
imgBgAnim=new wxStaticBitmap(wTab,-1,*btmpBgAnim,SetwxPoint(0,146),SetwxSize(370,182));
|
||||
//// Animation Window
|
||||
wAnimWk1=new wxWindow(wTab,-1,SetwxPoint(85,146),SetwxSize(184,182),wxNO_BORDER);
|
||||
// media control
|
||||
/////////////
|
||||
m_canvas = new MyCanvas(wAnimWk1, SetwxPoint(0,0), SetwxSize(184,182));
|
||||
#if 0
|
||||
m_player.SetDestroyAnimation(false);
|
||||
m_player.SetWindow(m_canvas);
|
||||
m_player.SetPosition(SetwxPoint(0, 0));
|
||||
#endif
|
||||
m_animationCtrl = new wxGIFAnimationCtrl(m_canvas, -1, wxEmptyString,
|
||||
SetwxPoint(0, 0), wxSize(184, 184));
|
||||
m_animationCtrl->Stop();
|
||||
if (m_animationCtrl->LoadFile(wxT("skins/default/graphic/molecule.gif")))
|
||||
{
|
||||
m_animationCtrl->Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_T("Sorry, this animation was not a valid animated GIF."));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
wrkUnitNB->SetSelection(0);
|
||||
// Put Grid in the sizer
|
||||
mainSizer->Add(20, 70,0);
|
||||
mainSizer->Add(362, 70,0);
|
||||
mainSizer->Add(20, 70,0);
|
||||
mainSizer->Add(0, 0,1);
|
||||
mainSizer->Add(wrkUnitNB);
|
||||
|
||||
//Static content in my Projects section
|
||||
// My Projects
|
||||
stMyProj=new wxStaticText(this,-1,wxT(""),SetwxPoint(20,434),SetwxSize(84,18),wxST_NO_AUTORESIZE);
|
||||
stMyProj->SetLabel(wxT("My Projects:"));
|
||||
stMyProj->SetFont(wxFont(10,74,90,92,0,wxT("Tahoma")));
|
||||
// Attach Project <><><>
|
||||
btnAttProj=new wxBitmapButton(this,-1,*btmpBtnAttProjL,SetwxPoint(250,431),SetwxSize(109,20));
|
||||
// Collapse button mid
|
||||
btnCollapseMid=new wxBitmapButton(this,-1,btmpCol,SetwxPoint(366,429),SetwxSize(24,24),wxSIMPLE_BORDER);
|
||||
btnCollapseMid->SetBitmapSelected(btmpColClick);
|
||||
//expand buttons
|
||||
btnExpandMid=new wxBitmapButton(this,-1,btmpExp,SetwxPoint(336,429),SetwxSize(24,24),wxSIMPLE_BORDER);
|
||||
btnExpandMid->SetBitmapSelected(btmpExpClick);
|
||||
btnExpandMid->Show(false); // at initial build there is no need to show
|
||||
/// Line
|
||||
lnMyProjTop=new wxStaticLine(this,-1,SetwxPoint(20,454),SetwxSize(370,2));
|
||||
///////
|
||||
int projCnt = pDoc->state.projects.size();
|
||||
|
||||
for(int j = 0; j < projCnt; j++){
|
||||
PROJECT* project = pDoc->state.projects[j];
|
||||
wxString toolTipTxt;
|
||||
wxString userCredit;
|
||||
userCredit.Printf(wxT("%0.2f"), project->user_total_credit);
|
||||
toolTipTxt = wxString(project->project_name.c_str(), wxConvUTF8 ) +wxT(". User ") + wxString(project->user_name.c_str(), wxConvUTF8) + wxT(" has ") + userCredit + wxT(" points.");
|
||||
// Project button
|
||||
wxWindow *w_statW = new wxWindow(this,-1,SetwxPoint(60 + 52*j,460),SetwxSize(52,52));
|
||||
wxToolTip *statWCGtip = new wxToolTip(toolTipTxt);
|
||||
StatImageLoader *i_statW = new StatImageLoader(w_statW,project->master_url);
|
||||
if(project->project_name == "World Community Grid"){
|
||||
i_statW->LoadImage(g_statWCG);
|
||||
}else if(project->project_name == "Predictor @ Home"){
|
||||
i_statW->LoadImage(g_statPred);
|
||||
}else{
|
||||
i_statW->LoadImage(g_statWCG);
|
||||
}
|
||||
i_statW->SetToolTip(statWCGtip);
|
||||
}
|
||||
|
||||
//// Arrow Btns
|
||||
btnArwLeft=new wxBitmapButton(this,-1,btmpArwL,SetwxPoint(25,473),SetwxSize(24,24),wxSIMPLE_BORDER);
|
||||
btnArwLeft->SetBitmapSelected(btmpArwLC);
|
||||
btnArwRight=new wxBitmapButton(this,-1,btmpArwR,SetwxPoint(360,473),SetwxSize(24,24),wxNO_BORDER);
|
||||
btnArwRight->SetBitmapSelected(btmpArwRC);
|
||||
///////////
|
||||
lnMyProjBtm=new wxStaticLine(this,-1,SetwxPoint(20,516),SetwxSize(370,2));
|
||||
//// Messages Play Pause Btns
|
||||
btnMessages=new wxBitmapButton(this,-1,*btmpMessagesBtnL,SetwxPoint(28,522),SetwxSize(20,20));
|
||||
// play pause btn
|
||||
btnPause=new wxBitmapButton(this,-1,*btmpBtnPauseL,SetwxPoint(55,522),SetwxSize(20,20));
|
||||
btnPlay=new wxBitmapButton(this,-1,*btmpBtnPlayL,SetwxPoint(55,522),SetwxSize(20,20));
|
||||
btnPlay->Show(false);
|
||||
// Class View ,Pref Btns
|
||||
btnPreferences=new wxBitmapButton(this,-1,*btmpBtnPrefL,SetwxPoint(183,522),SetwxSize(86,20));
|
||||
btnAdvancedView=new wxBitmapButton(this,-1,*btmpBtnAdvViewL,SetwxPoint(273,522),SetwxSize(116,20));
|
||||
|
||||
Refresh();
|
||||
}
|
||||
void CSimpleFrame::initAfter(){
|
||||
//add your code here
|
||||
//Centre();
|
||||
Show(true);
|
||||
}
|
||||
//
|
||||
void CSimpleFrame::LoadSkinImages(){
|
||||
|
||||
wxString dirPref = skinsFolder+_T("/")+skinName+_T("/");
|
||||
|
||||
fileImgBuf[0].LoadFile(dirPref + appSkin->GetAppBg(),wxBITMAP_TYPE_BMP);
|
||||
// prj icons will be removed
|
||||
g_prjIcnWCG = new wxImage(dirPref + appSkin->GetIcnPrjWCG(), wxBITMAP_TYPE_PNG);
|
||||
g_prjIcnPDRC = new wxImage(dirPref + appSkin->GetIcnPrjPRED(), wxBITMAP_TYPE_PNG);
|
||||
// work unit icons
|
||||
g_icoSleepWU = new wxImage(dirPref + appSkin->GetIcnSleepingWkUnit(), wxBITMAP_TYPE_PNG);
|
||||
g_icoWorkWU = new wxImage(dirPref + appSkin->GetIcnWorkingWkUnit(), wxBITMAP_TYPE_PNG);
|
||||
// stat icons
|
||||
g_statWCG = new wxImage(_T("skins/default/graphic/statWCG.png"), wxBITMAP_TYPE_PNG);
|
||||
g_statSeti = new wxImage(_T("skins/default/graphic/statSeti.png"), wxBITMAP_TYPE_PNG);
|
||||
g_statPred = new wxImage(_T("skins/default/graphic/statPred.png"), wxBITMAP_TYPE_PNG);
|
||||
// arrows
|
||||
g_arwLeft = new wxImage(dirPref + appSkin->GetBtnLeftArr(), wxBITMAP_TYPE_PNG);
|
||||
g_arwRight = new wxImage(dirPref + appSkin->GetBtnRightArr(), wxBITMAP_TYPE_PNG);
|
||||
g_arwLeftClick = new wxImage(dirPref + appSkin->GetBtnLeftArrClick(), wxBITMAP_TYPE_PNG);
|
||||
g_arwRightClick = new wxImage(dirPref + appSkin->GetBtnRightArrClick(), wxBITMAP_TYPE_PNG);
|
||||
btmpArwL= wxBitmap(g_arwLeft);
|
||||
btmpArwR= wxBitmap(g_arwRight);
|
||||
btmpArwLC= wxBitmap(g_arwLeftClick);
|
||||
btmpArwRC= wxBitmap(g_arwRightClick);
|
||||
// collapse
|
||||
g_collapse = new wxImage(dirPref + appSkin->GetBtnCollapse(), wxBITMAP_TYPE_PNG);
|
||||
g_collapseClick = new wxImage(dirPref + appSkin->GetBtnCollapseClick(), wxBITMAP_TYPE_PNG);
|
||||
btmpCol= wxBitmap(g_collapse);
|
||||
btmpColClick= wxBitmap(g_collapseClick);
|
||||
// expand
|
||||
g_expand = new wxImage(dirPref + appSkin->GetBtnExpand(), wxBITMAP_TYPE_PNG);
|
||||
g_expandClick = new wxImage(dirPref + appSkin->GetBtnExpandClick(), wxBITMAP_TYPE_PNG);
|
||||
btmpExp= wxBitmap(g_expand);
|
||||
btmpExpClick= wxBitmap(g_expandClick);
|
||||
//////////////////////////////
|
||||
fileImgBuf[2].LoadFile(dirPref + appSkin->GetBtnPrefer(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[3].LoadFile(dirPref + appSkin->GetBtnAttProj(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[4].LoadFile(dirPref + appSkin->GetIcnWorking(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[5].LoadFile(dirPref + appSkin->GetBtnMessages(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[6].LoadFile(dirPref + appSkin->GetBtnPause(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[7].LoadFile(dirPref + appSkin->GetBtnPlay(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[8].LoadFile(dirPref + appSkin->GetBtnAdvView(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[9].LoadFile(dirPref + appSkin->GetAnimationBG(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[10].LoadFile(dirPref + appSkin->GetIcnSleeping(),wxBITMAP_TYPE_BMP);
|
||||
CSimpleFrameImg0=&fileImgBuf[0];
|
||||
btmpBtnPrefL=&fileImgBuf[2];
|
||||
btmpBtnAttProjL=&fileImgBuf[3];
|
||||
btmpIcnWorking=&fileImgBuf[4];
|
||||
btmpBtnPauseL=&fileImgBuf[6];
|
||||
btmpBtnPlayL=&fileImgBuf[7];
|
||||
btmpMessagesBtnL=&fileImgBuf[5];
|
||||
btmpBtnAdvViewL=&fileImgBuf[8];
|
||||
btmpBgAnim=&fileImgBuf[9];
|
||||
btmpIcnSleeping=&fileImgBuf[10];
|
||||
/// work unit tabs icons
|
||||
wxBitmap const workWUico = wxBitmap(g_icoWorkWU);
|
||||
wxBitmap const sleepWUico = wxBitmap(g_icoSleepWU);
|
||||
// push them in image list
|
||||
m_ImageList.push_back(workWUico);
|
||||
m_ImageList.push_back(sleepWUico);
|
||||
}
|
||||
///
|
||||
int CSimpleFrame::LoadSkinXML(){
|
||||
//app skin class
|
||||
appSkin = SkinClass::Instance();
|
||||
// parse xml file
|
||||
FILE* f;
|
||||
f = fopen(skinPath, "r");
|
||||
if (!f) return ERR_FOPEN;
|
||||
MIOFILE mf;
|
||||
mf.init_file(f);
|
||||
// parse
|
||||
char buf[256];
|
||||
std::string val;
|
||||
|
||||
while (mf.fgets(buf, 256)) {
|
||||
if (match_tag(buf, "<clientskin")) {
|
||||
continue;
|
||||
}else if (match_tag(buf, "<background")) {
|
||||
mf.fgets(buf, 256);
|
||||
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetAppBg(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<bgcol>", val)) {
|
||||
appSkin->SetAppBgCol(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if (match_tag(buf, "<dlgpreferences")) {
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetDlgPrefBg(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if (match_tag(buf, "<gauge")) {
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<fgcol>", val)) {
|
||||
appSkin->SetGaugeFgCol(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<bgcol>", val)) {
|
||||
appSkin->SetGaugeBgCol(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if (match_tag(buf, "<buttons")) {
|
||||
while (mf.fgets(buf, 256)) {
|
||||
std::string val;
|
||||
if(match_tag(buf, "</buttons>")){
|
||||
//end of the buttons elements break out of while loop
|
||||
break;
|
||||
}
|
||||
if(match_tag(buf, "<preferences>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnPrefer(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<attchproj>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnAttProj(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<advancedview>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnAdvView(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<play>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnPlay(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<pause>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnPause(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<messages>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnMessages(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<open>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnOpen(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<save>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnSave(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<cancel>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnCancel(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<leftArr>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnLeftArr(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrcclick>", val)) {
|
||||
appSkin->SetBtnLeftArrClick(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<rightArr>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnRightArr(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrcclick>", val)) {
|
||||
appSkin->SetBtnRightArrClick(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<expand>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnExpand(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrcclick>", val)) {
|
||||
appSkin->SetBtnExpandClick(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<collapse>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetBtnCollapse(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrcclick>", val)) {
|
||||
appSkin->SetBtnCollapseClick(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}
|
||||
}//end of while
|
||||
}else if (match_tag(buf, "<icons")) {
|
||||
while (mf.fgets(buf, 256)) {
|
||||
std::string val;
|
||||
if(match_tag(buf, "</icons>")){
|
||||
//end of the buttons elements break out of while loop
|
||||
break;
|
||||
}
|
||||
if(match_tag(buf, "<working>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetIcnWorking(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<sleeping>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetIcnSleeping(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<workingWkUnit>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetIcnWorkingWkUnit(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<frcol>", val)) {
|
||||
appSkin->SetTabFromColAc(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<tocol>", val)) {
|
||||
appSkin->SetTabToColAc(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<brdcol>", val)) {
|
||||
appSkin->SetTabBrdColAc(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<sleepingWkUnit>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetIcnSleepingWkUnit(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<frcol>", val)) {
|
||||
appSkin->SetTabFromColIn(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<tocol>", val)) {
|
||||
appSkin->SetTabToColIn(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<brdcol>", val)) {
|
||||
appSkin->SetTabBrdColIn(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<prjWCGicon>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetIcnPrjWCG(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}else if(match_tag(buf, "<prjPREDicon>")){
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<imgsrc>", val)) {
|
||||
appSkin->SetIcnPrjPRED(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}
|
||||
}// end of while loop
|
||||
}else if (match_tag(buf, "<animation")) {
|
||||
mf.fgets(buf, 256);
|
||||
std::string val;
|
||||
if (parse_str(buf, "<background>", val)) {
|
||||
appSkin->SetAnimationBg(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
mf.fgets(buf, 256);
|
||||
if (parse_str(buf, "<animation>", val)) {
|
||||
appSkin->SetAnimationFile(wxString( val.c_str(), wxConvUTF8 ));
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
///
|
||||
void CSimpleFrame::ReskinAppGUI(){
|
||||
LoadSkinXML();
|
||||
LoadSkinImages();
|
||||
// reskin GUI
|
||||
//bg color
|
||||
SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
// notebook tab color
|
||||
wrkUnitNB->SetTabAreaColour(appSkin->GetAppBgCol());
|
||||
wrkUnitNB->SetGradientColors(appSkin->GetTabFromColAc(),appSkin->GetTabToColAc(),appSkin->GetTabBrdColAc());
|
||||
wrkUnitNB->SetGradientColorsInactive(appSkin->GetTabFromColIn(),appSkin->GetTabToColIn(),appSkin->GetTabBrdColIn());
|
||||
// btns
|
||||
btnMessages->SetBitmapLabel(*btmpMessagesBtnL);
|
||||
btnPlay->SetBitmapLabel(*btmpBtnPlayL);
|
||||
btnPause->SetBitmapLabel(*btmpBtnPauseL);
|
||||
btnAttProj->SetBitmapLabel(*btmpBtnAttProjL);
|
||||
btnPreferences->SetBitmapLabel(*btmpBtnPrefL);
|
||||
btnAdvancedView->SetBitmapLabel(*btmpBtnAdvViewL);
|
||||
//arrows
|
||||
btnArwLeft->SetBitmapLabel(btmpArwL);
|
||||
btnArwLeft->SetBitmapSelected(btmpArwLC);
|
||||
btnArwRight->SetBitmapLabel(btmpArwR);
|
||||
btnArwRight->SetBitmapSelected(btmpArwRC);
|
||||
//collapse
|
||||
btnCollapseMid->SetBitmapLabel(btmpCol);
|
||||
btnCollapseMid->SetBitmapSelected(btmpColClick);
|
||||
//expand buttons
|
||||
btnExpandMid->SetBitmapLabel(btmpExp);
|
||||
btnExpandMid->SetBitmapSelected(btmpExpClick);
|
||||
//gauges
|
||||
gaugeWuP1->SetForegroundColour(appSkin->GetGaugeFgCol());
|
||||
gaugeWuP1->SetBackgroundColour(appSkin->GetGaugeBgCol());
|
||||
btnExpandMid->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
btnCollapseMid->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
btnArwLeft->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
btnArwRight->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
wxInt32 CSimpleFrame::FormatCPUTime(RESULT* rslt, wxString& strBuffer) const {
|
||||
float fBuffer = 0;
|
||||
RESULT* result = rslt;
|
||||
|
||||
if (result) {
|
||||
if (result->active_task) {
|
||||
fBuffer = result->current_cpu_time;
|
||||
} else {
|
||||
if(result->state < RESULT_COMPUTE_ERROR) {
|
||||
fBuffer = 0;
|
||||
} else {
|
||||
fBuffer = result->final_cpu_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == fBuffer) {
|
||||
strBuffer = wxT("---");
|
||||
} else {
|
||||
SGUITimeFormat(fBuffer,strBuffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxInt32 CSimpleFrame::FormatTimeToCompletion(RESULT* rslt, wxString& strBuffer) const {
|
||||
float fBuffer = 0;
|
||||
wxInt32 iHour = 0;
|
||||
wxInt32 iMin = 0;
|
||||
wxInt32 iSec = 0;
|
||||
wxTimeSpan ts;
|
||||
RESULT* result = rslt;
|
||||
|
||||
if (result) {
|
||||
fBuffer = result->estimated_cpu_time_remaining;
|
||||
}
|
||||
|
||||
if (0 >= fBuffer) {
|
||||
strBuffer = wxT("---");
|
||||
} else {
|
||||
SGUITimeFormat(fBuffer,strBuffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CSimpleFrame::SGUITimeFormat(float fBuff, wxString& strBuffer) const{
|
||||
float fBuffer = fBuff;
|
||||
wxInt32 iDay = 0;
|
||||
wxInt32 iHour = 0;
|
||||
wxInt32 iMin = 0;
|
||||
wxInt32 iSec = 0;
|
||||
std::string timeFormat;
|
||||
std::string formatedUnit; // string to recive the number when doing conversion
|
||||
char b[50]; // buffer of chars
|
||||
int radix=10; // 2:bin, 8:octal, 10:dec, 16:hex
|
||||
|
||||
iDay = (wxInt32)(fBuffer / (60 * 60 * 60));
|
||||
iHour = (wxInt32)(fBuffer / (60 * 60));
|
||||
iMin = (wxInt32)(fBuffer / 60) % 60;
|
||||
iSec = (wxInt32)(fBuffer) % 60;
|
||||
|
||||
if(iDay !=0){
|
||||
formatedUnit = itoa(iDay,b,radix);
|
||||
timeFormat = formatedUnit + " days ";
|
||||
}//else if(iHour !=0){
|
||||
formatedUnit = itoa(iHour,b,radix);
|
||||
timeFormat += formatedUnit + " hours ";
|
||||
//}else if(iMin !=0){
|
||||
formatedUnit = itoa(iMin,b,radix);
|
||||
timeFormat += formatedUnit + " minutes ";
|
||||
//}
|
||||
formatedUnit = itoa(iSec,b,radix);
|
||||
timeFormat += formatedUnit + " seconds";
|
||||
strBuffer = wxString(timeFormat.c_str(), wxConvUTF8);
|
||||
}
|
||||
void CSimpleFrame::OnBtnClick(wxCommandEvent& event){ //init function
|
||||
wxObject *m_wxBtnObj = event.GetEventObject();
|
||||
if(m_wxBtnObj==btnPreferences){
|
||||
CDlgPreferences* pDlg = new CDlgPreferences(NULL,skinsFolder+_T("/")+skinName+_T("/"));
|
||||
wxASSERT(pDlg);
|
||||
pDlg->ShowModal();
|
||||
if (pDlg) {
|
||||
skinName = pDlg->GetSkinName();
|
||||
skinPath = skinsFolder+_T("/")+skinName+_T("/")+_T("skin.xml");
|
||||
if(skinPath.Length() > 0){
|
||||
ReskinAppGUI();
|
||||
}
|
||||
pDlg->Destroy();
|
||||
}
|
||||
}else if(m_wxBtnObj==btnArwLeft){
|
||||
//refresh btn
|
||||
btnArwLeft->Refresh();
|
||||
}else if(m_wxBtnObj==btnArwRight){
|
||||
//refresh btn
|
||||
btnArwRight->Refresh();
|
||||
}else if(m_wxBtnObj==btnCollapseMid){
|
||||
//refresh btn
|
||||
wxNotebookSize = SetwxSize(370, 170); //fix
|
||||
if((!midAppCollapsed) && (!btmAppCollapsed)){
|
||||
m_canvas->Show(false);
|
||||
imgBgAnim->Show(false);
|
||||
btnCollapseMid->Show(false);
|
||||
btnExpandMid->Show(true);
|
||||
this->SetSize(-1, -1, 416, 398);
|
||||
wTab1->SetSize(-1, -1, 370, 170);
|
||||
wTab2->SetSize(-1, -1, 370, 170);
|
||||
wrkUnitNB->SetSize(-1, -1, 370, 170);
|
||||
//move controls up
|
||||
MoveControlsUp();
|
||||
midAppCollapsed = true;
|
||||
}else{
|
||||
this->SetSize(-1, -1, 416, 305);
|
||||
wTab1->SetSize(-1, -1, 370, 170);
|
||||
wTab2->SetSize(-1, -1, 370, 170);
|
||||
wrkUnitNB->SetSize(-1, -1, 370, 170);
|
||||
btnExpandMid->Move(366,247);
|
||||
midAppCollapsed = true;
|
||||
}
|
||||
Refresh();
|
||||
}else if(m_wxBtnObj==btnExpandMid){
|
||||
if((btmAppCollapsed) && (midAppCollapsed)){ // in this case open up bottom first
|
||||
this->SetSize(-1, -1, 416, 398);
|
||||
wrkUnitNB->SetSize(-1, -1, 370, 170);
|
||||
stMyProj->Show(true);
|
||||
btnAttProj->Show(true);
|
||||
stMyProj->Move(20,252);//(20,434)
|
||||
//move controls up
|
||||
MoveControlsUp();
|
||||
btmAppCollapsed = false;
|
||||
}else if(midAppCollapsed){ //open up mid section
|
||||
wxNotebookSize = SetwxSize(370, 330); //fix
|
||||
this->SetSize(-1, -1, 416, 581);
|
||||
MoveControlsDown();
|
||||
m_canvas->Show(true);
|
||||
imgBgAnim->Show(true);
|
||||
btnExpandMid->Show(false);
|
||||
btnCollapseMid->Show(true);
|
||||
btnAttProj->Show(true);
|
||||
midAppCollapsed = false;
|
||||
wrkUnitNB->SetSize(-1, -1, 370, 353); // fix
|
||||
}else if((!midAppCollapsed) && (btmAppCollapsed)){
|
||||
this->SetSize(-1, -1, 416, 581);
|
||||
stMyProj->Show(true);
|
||||
btnExpandMid->Show(false);
|
||||
btnCollapseMid->Move(366,429);
|
||||
btnAttProj->Move(250,431);
|
||||
//midAppCollapsed = false;
|
||||
btmAppCollapsed = false;
|
||||
}
|
||||
Refresh();
|
||||
}else if(m_wxBtnObj==btnAdvancedView) {
|
||||
wxGetApp().SetActiveGUI(BOINC_ADVANCEDGUI, true);
|
||||
}else{
|
||||
//wxMessageBox("OnBtnClick - else");
|
||||
}
|
||||
}
|
||||
//end function
|
||||
void CSimpleFrame::MoveControlsUp(){
|
||||
stMyProj->Move(20,252);//(20,434)
|
||||
btnAttProj->Move(250,249);//(250,431)
|
||||
btnExpandMid->Move(366,247);//(366,429)
|
||||
lnMyProjTop->Move(20,272);//(20,454)
|
||||
w_statWCG->Move(60,278);//(60,460)
|
||||
w_statSeti->Move(112,278);//(112,460)
|
||||
w_statPred->Move(164,278);//(164,460)
|
||||
btnArwLeft->Move(25,291);//(25,483)
|
||||
btnArwRight->Move(360,291);//(360,483)
|
||||
lnMyProjBtm->Move(20,334);//(20,516)
|
||||
btnMessages->Move(28,340);//(28,522)
|
||||
btnPause->Move(55,340);//(55,522)
|
||||
btnPreferences->Move(183,340);//(183,522)
|
||||
btnAdvancedView->Move(273,340);//(273,522)
|
||||
}
|
||||
|
||||
void CSimpleFrame::MoveControlsDown(){
|
||||
stMyProj->Move(20,434);
|
||||
btnAttProj->Move(250,431);
|
||||
btnExpandMid->Move(366,429);
|
||||
lnMyProjTop->Move(20,454);
|
||||
w_statWCG->Move(60,460);
|
||||
w_statSeti->Move(112,460);
|
||||
w_statPred->Move(164,460);
|
||||
btnArwLeft->Move(25,473);
|
||||
btnArwRight->Move(360,473);
|
||||
lnMyProjBtm->Move(20,516);
|
||||
btnMessages->Move(28,522);
|
||||
btnPause->Move(55,522);
|
||||
btnPreferences->Move(183,522);
|
||||
btnAdvancedView->Move(273,522);
|
||||
}
|
||||
void CSimpleFrame::OnEraseBackground(wxEraseEvent& event){
|
||||
wxObject *m_wxWin = event.GetEventObject();
|
||||
if(m_wxWin==this){event.Skip(true);DrawBackImg(event,this,*CSimpleFrameImg0,0);return;}
|
||||
event.Skip(true);
|
||||
}
|
||||
void CSimpleFrame::DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz){
|
||||
if(midAppCollapsed){
|
||||
wrkUnitNB->SetSize(-1, -1, wxNotebookSize.x, wxNotebookSize.y); // fix
|
||||
}
|
||||
|
||||
event.Skip(false);
|
||||
wxDC *dc;
|
||||
dc=event.GetDC();
|
||||
dc->SetBackground(wxBrush(win->GetBackgroundColour(),wxSOLID));
|
||||
dc->Clear();
|
||||
switch (opz) {
|
||||
case 0:{
|
||||
dc->DrawBitmap(bitMap, 0, 0);
|
||||
break;}
|
||||
case 1:{
|
||||
wxRect rec=win->GetClientRect();
|
||||
rec.SetLeft((rec.GetWidth()-bitMap.GetWidth()) / 2);
|
||||
rec.SetTop ((rec.GetHeight()-bitMap.GetHeight()) / 2);
|
||||
dc->DrawBitmap(bitMap,rec.GetLeft(),rec.GetTop(),0);
|
||||
break;}
|
||||
case 2:{
|
||||
wxRect rec=win->GetClientRect();
|
||||
for(int y=0;y < rec.GetHeight();y+=bitMap.GetHeight()){
|
||||
for(int x=0;x < rec.GetWidth();x+=bitMap.GetWidth()){
|
||||
dc->DrawBitmap(bitMap,x,y,0);
|
||||
}
|
||||
}
|
||||
break;}
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// MyCanvas
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||
EVT_PAINT(MyCanvas::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Define a constructor for my canvas
|
||||
MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
|
||||
: wxScrolledWindow(parent, -1, pos, size,
|
||||
wxNO_BORDER |
|
||||
wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
SetBackgroundColour(wxColour(_T("BLACK")));
|
||||
}
|
||||
|
||||
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
#if 0
|
||||
CSimpleFrame* frame = (CSimpleFrame*) GetParent();
|
||||
if (frame->GetPlayer().IsPlaying())
|
||||
{
|
||||
frame->GetPlayer().Draw(dc);
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -1,214 +0,0 @@
|
|||
// 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
|
||||
|
||||
|
||||
#ifndef _SIMPLEFRAME_H_
|
||||
#define _SIMPLEFRAME_H_
|
||||
|
||||
|
||||
class MyCanvas : public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
private:
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Define a new frame
|
||||
class CSimpleFrame : public CBOINCBaseFrame
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(CSimpleFrame)
|
||||
|
||||
public:
|
||||
CSimpleFrame();
|
||||
CSimpleFrame(wxString title, wxIcon* icon);
|
||||
|
||||
~CSimpleFrame();
|
||||
|
||||
|
||||
|
||||
// Images
|
||||
wxImage *g_prjIcnWCG;
|
||||
wxImage *g_prjIcnPDRC;
|
||||
wxImage *g_icoSleepWU;
|
||||
wxImage *g_icoWorkWU;
|
||||
//
|
||||
ImageLoader *i_prjIcnPT1;
|
||||
wxWindow *w_iconPT1;
|
||||
//
|
||||
ImageLoader *i_prjIcnP1;
|
||||
wxWindow *w_iconP1;
|
||||
///
|
||||
ImageLoader *i_prjIcnP2;
|
||||
wxWindow *w_iconP2;
|
||||
// Flat Neotebook
|
||||
wxWindow *wTab1;
|
||||
wxWindow *wTab2;
|
||||
wxFlatNotebookImageList m_ImageList;
|
||||
wxFlatNotebook *wrkUnitNB;
|
||||
//wxBitmap const sleepWUico;
|
||||
wxBitmap const workWUico;
|
||||
////// Skin variables //////
|
||||
//XML doc
|
||||
wxXmlDocument *skinXML;
|
||||
//Skin Class
|
||||
SkinClass *appSkin;
|
||||
wxString skinPath;
|
||||
wxString skinName;
|
||||
wxString skinsFolder;
|
||||
// My projects area
|
||||
wxImage *g_statWCG;
|
||||
StatImageLoader *i_statWCG;
|
||||
wxWindow *w_statWCG;
|
||||
|
||||
//
|
||||
wxImage *g_statSeti;
|
||||
StatImageLoader *i_statSeti;
|
||||
wxWindow *w_statSeti;
|
||||
//
|
||||
wxImage *g_statPred;
|
||||
StatImageLoader *i_statPred;
|
||||
wxWindow *w_statPred;
|
||||
// arrows
|
||||
wxImage *g_arwLeft;
|
||||
wxImage *g_arwRight;
|
||||
wxImage *g_arwLeftClick;
|
||||
wxImage *g_arwRightClick;
|
||||
wxBitmap btmpArwL;
|
||||
wxBitmap btmpArwR;
|
||||
wxBitmap btmpArwLC;
|
||||
wxBitmap btmpArwRC;
|
||||
wxBitmapButton *btnArwLeft;
|
||||
wxBitmapButton *btnArwRight;
|
||||
//Collapse buttons
|
||||
bool midAppCollapsed;
|
||||
bool btmAppCollapsed;
|
||||
wxImage *g_collapse;
|
||||
wxImage *g_collapseClick;
|
||||
wxBitmap btmpCol;
|
||||
wxBitmap btmpColClick;
|
||||
wxBitmapButton *btnCollapseMid;
|
||||
//wxBitmapButton *btnCollapseBtm;
|
||||
//Expand buttons
|
||||
wxImage *g_expand;
|
||||
wxImage *g_expandClick;
|
||||
wxBitmap btmpExp;
|
||||
wxBitmap btmpExpClick;
|
||||
wxBitmapButton *btnExpandMid;
|
||||
////////////////////////////
|
||||
wxStaticText *st9c;
|
||||
wxWindow *w11c;
|
||||
wxStaticText *lblProjectName;
|
||||
wxStaticLine *lnProjName;
|
||||
wxStaticText *lblMyProgress;
|
||||
wxStaticText *lblWrkUnitName;
|
||||
wxGauge *gaugeWuP1;
|
||||
wxStaticText *lblElapsedTime;
|
||||
wxStaticText *lblElapsedTimeValue;
|
||||
wxStaticText *lblTimeRemaining;
|
||||
wxStaticText *lblTimeRemainingValue;
|
||||
wxStaticText *st22c;
|
||||
wxStaticText *st23c;
|
||||
wxStaticText *stMyProj;
|
||||
wxStaticText *st27c;
|
||||
wxStaticLine *lnMyProjTop;
|
||||
wxStaticBitmap *bm29c;
|
||||
wxGauge *gaugeProjP1;
|
||||
wxBitmapButton *btnPreferences;
|
||||
wxBitmapButton *btnAttProj;
|
||||
wxStaticBitmap *icnProjWork;
|
||||
wxStaticBitmap *bm39c;
|
||||
wxGauge *gaugeProjP2;
|
||||
wxStaticText *st41c;
|
||||
wxStaticBitmap *icnProjSleep;
|
||||
wxBitmapButton *btnPause;
|
||||
wxBitmapButton *btnPlay;
|
||||
wxBitmapButton *btnMessages;
|
||||
wxBitmapButton *btnAdvancedView;
|
||||
wxStaticBitmap *imgBgAnim;
|
||||
wxStaticLine *lnMyProjBtm;
|
||||
bool clientGUIInitialized;
|
||||
|
||||
void InitEmptyState();
|
||||
void InitSimpleClient();
|
||||
int LoadSkinXML();
|
||||
void LoadSkinImages();
|
||||
void ReskinAppGUI();
|
||||
void initAfter();
|
||||
void MoveControlsUp();
|
||||
void MoveControlsDown();
|
||||
//////////
|
||||
wxFlexGridSizer *mainSizer;
|
||||
wxSize wxNotebookSize;
|
||||
wxWindow* CreateNotebookPage();
|
||||
//////////
|
||||
wxBitmap *CSimpleFrameImg0;
|
||||
wxBitmap *bm13cImg0;
|
||||
wxBitmap *btmpBtnPrefL;
|
||||
wxBitmap *btmpBtnAttProjL;
|
||||
wxBitmap *btmpIcnWorking;
|
||||
wxBitmap *bm39cImg0;
|
||||
wxBitmap *btmpBtnPauseL;
|
||||
wxBitmap *btmpBtnPlayL;
|
||||
wxBitmap *btmpMessagesBtnL;
|
||||
wxBitmap *btmpBtnAdvViewL;
|
||||
wxBitmap *btmpBgAnim;
|
||||
wxBitmap *btmpIcnSleeping;
|
||||
wxBitmap fileImgBuf[11];
|
||||
wxWindow *wAnimWk1;
|
||||
// Animation
|
||||
MyCanvas* GetCanvas() const { return m_canvas; }
|
||||
wxGIFAnimationCtrl* GetAnimationCtrl() const { return m_animationCtrl; }
|
||||
|
||||
#if 0
|
||||
wxAnimationPlayer& GetPlayer() { return m_player; }
|
||||
wxAnimationBase& GetAnimation() { return m_animation; }
|
||||
#endif
|
||||
|
||||
wxTimer* m_pFrameRenderTimer;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
void OnBtnClick(wxCommandEvent& event);
|
||||
void OnConnect( CFrameEvent& event );
|
||||
void OnFrameRender( wxTimerEvent& event );
|
||||
wxInt32 FormatCPUTime( RESULT* rslt, wxString& strBuffer ) const;
|
||||
wxInt32 FormatTimeToCompletion( RESULT* rslt, wxString& strBuffer ) const;
|
||||
void SGUITimeFormat( float fBuffer, wxString& strBuffer) const;
|
||||
void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz);
|
||||
wxPoint m_tmppoint;
|
||||
wxSize m_tmpsize;
|
||||
wxPoint& SetwxPoint(long x,long y);
|
||||
wxSize& SetwxSize(long w,long h);
|
||||
/////////////////////////////////////////////////////
|
||||
MyCanvas* m_canvas;
|
||||
wxGIFAnimationCtrl* m_animationCtrl;
|
||||
#if 0
|
||||
wxAnimationPlayer m_player;
|
||||
wxGIFAnimation m_animation;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
#include "stdwx.h"
|
||||
|
||||
// Don't modify comment
|
||||
#include "sg_DlgPreferences.h"
|
||||
#include "sg_SkinClass.h"
|
||||
//[inc]add your include files here
|
||||
|
||||
//[inc]end your include
|
||||
enum
|
||||
{
|
||||
ID_OPENBUTTON = 10001,
|
||||
ID_SAVEBUTTON = 10002,
|
||||
ID_CANCELBUTTON = 10003,
|
||||
ID_SKINPICKERCMBBOX = 10004,
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE( CDlgPreferences,wxDialog)
|
||||
EVT_COMBOBOX(-1,CDlgPreferences::OnCmbSelected)
|
||||
EVT_BUTTON(-1,CDlgPreferences::OnBtnClick)
|
||||
EVT_ERASE_BACKGROUND(CDlgPreferences::OnEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
// end events
|
||||
|
||||
CDlgPreferences::CDlgPreferences(wxWindow* parent, wxString dirPref,wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style,const wxString& name)
|
||||
{
|
||||
m_SkinDirPrefix = dirPref;
|
||||
OnPreCreate();
|
||||
Create(parent,id,title,pos,size,style,name);
|
||||
|
||||
if((pos==wxDefaultPosition)&&(size==wxDefaultSize)){
|
||||
SetSize(0,0,400,450);
|
||||
}
|
||||
|
||||
if((pos!=wxDefaultPosition)&&(size==wxDefaultSize)){
|
||||
SetSize(400,450);
|
||||
}
|
||||
initBefore();
|
||||
// load images from skin file
|
||||
LoadSkinImages();
|
||||
//Create dialog
|
||||
InitDialog();
|
||||
initAfter();
|
||||
}
|
||||
CDlgPreferences::~CDlgPreferences()
|
||||
{
|
||||
|
||||
}
|
||||
wxPoint& CDlgPreferences::SetwxPoint(long x,long y){
|
||||
m_tmppoint.x=x;
|
||||
m_tmppoint.y=y;
|
||||
return m_tmppoint;
|
||||
}
|
||||
|
||||
wxSize& CDlgPreferences::SetwxSize(long w,long h){
|
||||
m_tmpsize.SetWidth(w);
|
||||
m_tmpsize.SetHeight(h);
|
||||
return m_tmpsize;
|
||||
}
|
||||
|
||||
void CDlgPreferences::InitDialog()
|
||||
{
|
||||
SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
|
||||
lblPref=new wxStaticText(this,-1,wxT(""),SetwxPoint(10,10),SetwxSize(84,18),wxST_NO_AUTORESIZE);
|
||||
lblPref->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblPref->SetLabel(wxT("Preferences"));
|
||||
lblPref->SetFont(wxFont(12,74,90,90,0,wxT("Tahoma")));
|
||||
// Modify settings for this computer
|
||||
lblModifySett=new wxStaticText(this,-1,wxT(""),SetwxPoint(15,60),SetwxSize(164,13),wxST_NO_AUTORESIZE);
|
||||
lblModifySett->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblModifySett->SetLabel(wxT("Modify settings for this computer:"));
|
||||
// Do work only between
|
||||
lblDoWorkBtwn=new wxStaticText(this,-1,wxT(""),SetwxPoint(65,95),SetwxSize(114,13),wxST_NO_AUTORESIZE);
|
||||
lblDoWorkBtwn->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblDoWorkBtwn->SetLabel(wxT("Do work only between:"));
|
||||
wxString itmsHourIntervals[]={wxT("Always"),wxT("12:00 AM"),wxT("1:00 AM"),wxT("2:00 AM"),wxT("3:00 AM"),wxT("4:00 AM"),wxT("5:00 AM"),wxT("6:00 AM"),wxT("7:00 AM"),wxT("8:00 AM"),wxT("9:00 AM"),wxT("10:00 AM"),wxT("11:00 AM"),wxT("12:00 PM"),
|
||||
wxT("13:00 PM"),wxT("14:00 PM"),wxT("15:00 PM"),wxT("16:00 PM"),wxT("17:00 PM"),wxT("18:00 PM"),wxT("19:00 PM"),wxT("20:00 PM"),wxT("21:00 PM"),wxT("22:00 PM"),wxT("23:00 PM")};
|
||||
cmbDWBtwnBgn=new wxComboBox(this,-1,wxT(""),SetwxPoint(180,90),SetwxSize(85,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
||||
cmbDWBtwnBgn->SetValue(wxT("Always"));
|
||||
lblAnd1=new wxStaticText(this,-1,wxT(""),SetwxPoint(270,95),SetwxSize(19,13),wxST_NO_AUTORESIZE);
|
||||
lblAnd1->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblAnd1->SetLabel(wxT("and"));
|
||||
lblAnd1->Show(false);
|
||||
cmbDWBtwnEnd=new wxComboBox(this,-1,wxT(""),SetwxPoint(295,90),SetwxSize(85,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
||||
cmbDWBtwnEnd->SetValue(wxT("Always"));
|
||||
cmbDWBtwnEnd->Show(false);
|
||||
///Connect to internet only between
|
||||
lblConnToIntBtwn=new wxStaticText(this,-1,wxT(""),SetwxPoint(10,130),SetwxSize(169,13),wxST_NO_AUTORESIZE);
|
||||
lblConnToIntBtwn->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblConnToIntBtwn->SetLabel(wxT("Connect to internet only between:"));
|
||||
cmbCTIBtwnBgn=new wxComboBox(this,-1,wxT(""),SetwxPoint(180,125),SetwxSize(85,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
||||
cmbCTIBtwnBgn->SetValue(wxT("Always"));
|
||||
lblAnd2=new wxStaticText(this,-1,wxT(""),SetwxPoint(270,130),SetwxSize(19,13),wxST_NO_AUTORESIZE);
|
||||
lblAnd2->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblAnd2->SetLabel(wxT("and"));
|
||||
lblAnd2->Show(false);
|
||||
cmbCTIBtwnEnd=new wxComboBox(this,-1,wxT(""),SetwxPoint(295,125),SetwxSize(85,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
||||
cmbCTIBtwnEnd->SetValue(wxT("Always"));
|
||||
cmbCTIBtwnEnd->Show(false);
|
||||
///Use no more than
|
||||
lblUseNoMoreGB=new wxStaticText(this,-1,wxT(""),SetwxPoint(85,165),SetwxSize(94,13),wxST_NO_AUTORESIZE);
|
||||
lblUseNoMoreGB->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblUseNoMoreGB->SetLabel(wxT("Use no more than:"));
|
||||
wxString itmsUseNoMoreGB[]={wxT("100MB"),wxT("200MB"),wxT("500MB"),wxT("1GB"),wxT("2GB"),wxT("5GB")};
|
||||
cmbUseNoMoreGB=new wxComboBox(this,-1,wxT(""),SetwxPoint(180,160),SetwxSize(85,21),5,itmsUseNoMoreGB,wxNO_BORDER | wxCB_READONLY);
|
||||
cmbUseNoMoreGB->SetValue(wxT("500MB"));
|
||||
lblGB=new wxStaticText(this,-1,wxT(""),SetwxPoint(270,165),SetwxSize(14,13),wxST_NO_AUTORESIZE);
|
||||
lblGB->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblGB->SetLabel(wxT("GB"));
|
||||
/// Do work while computer is in use
|
||||
lblDWWCInUse=new wxStaticText(this,-1,wxT(""),SetwxPoint(15,200),SetwxSize(164,13),wxST_NO_AUTORESIZE);
|
||||
lblDWWCInUse->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblDWWCInUse->SetLabel(wxT("Do work while computer is in use?"));
|
||||
wxString itmsDWWCInUse[]={wxT("Yes"),wxT("No")};
|
||||
cmbDWWCInUse=new wxComboBox(this,-1,wxT(""),SetwxPoint(180,195),SetwxSize(45,21),2,itmsDWWCInUse,wxNO_BORDER | wxCB_READONLY);
|
||||
cmbDWWCInUse->SetValue(wxT("Yes"));
|
||||
///Do work after computer is idle for
|
||||
lblDWACIdleFor=new wxStaticText(this,-1,wxT(""),SetwxPoint(15,235),SetwxSize(164,13),wxST_NO_AUTORESIZE);
|
||||
lblDWACIdleFor->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblDWACIdleFor->SetLabel(wxT("Do work after computer is idle for:"));
|
||||
wxString itmsDWACIdleFor[]={wxT("1"),wxT("5"),wxT("10"),wxT("15"),wxT("30"),wxT("60")};
|
||||
cmbDWACIdleFor=new wxComboBox(this,-1,wxT(""),SetwxPoint(180,230),SetwxSize(85,21),5,itmsDWACIdleFor,wxNO_BORDER | wxCB_READONLY);
|
||||
cmbDWACIdleFor->SetValue(wxT("5"));
|
||||
lblMinutes=new wxStaticText(this,-1,wxT(""),SetwxPoint(270,235),SetwxSize(39,13),wxST_NO_AUTORESIZE);
|
||||
lblMinutes->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblMinutes->SetLabel(wxT("minutes"));
|
||||
////Skin XML file
|
||||
lblSkinXML=new wxStaticText(this,-1,wxT(""),SetwxPoint(115,270),SetwxSize(64,13),wxST_NO_AUTORESIZE);
|
||||
lblSkinXML->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
||||
lblSkinXML->SetLabel(wxT("Skin XML file:"));
|
||||
//skin picker control
|
||||
wxString itmsSkinPicker[]={wxT("Default"),wxT("WorldCommunityGrid")};
|
||||
cmbSkinPicker=new wxComboBox(this,ID_SKINPICKERCMBBOX,wxT(""),SetwxPoint(180,265),SetwxSize(140,21),2,itmsSkinPicker,wxNO_BORDER | wxCB_READONLY);
|
||||
cmbSkinPicker->SetValue(wxT("Default"));
|
||||
//tx30c=new wxTextCtrl(this,-1,wxT(""),SetwxPoint(180,265),SetwxSize(148,21),wxSIMPLE_BORDER);
|
||||
//btnOpen=new wxBitmapButton(this,ID_OPENBUTTON,*btmpBtnAttProjL,SetwxPoint(331,265),SetwxSize(59,20));
|
||||
// Btn Save and Cancel
|
||||
btnSave=new wxBitmapButton(this,ID_SAVEBUTTON,*bti26cImg1,SetwxPoint(115,325),SetwxSize(59,20));
|
||||
btnCancel=new wxBitmapButton(this,ID_CANCELBUTTON,*bti27cImg1,SetwxPoint(190,325),SetwxSize(59,20));
|
||||
|
||||
Refresh();
|
||||
}
|
||||
void CDlgPreferences::LoadSkinImages(){
|
||||
//get skin class
|
||||
appSkin = SkinClass::Instance();
|
||||
wxString str1 = m_SkinDirPrefix + appSkin->GetDlgPrefBg();
|
||||
fileImgBuf[0].LoadFile(m_SkinDirPrefix + appSkin->GetDlgPrefBg(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[1].LoadFile(m_SkinDirPrefix + appSkin->GetBtnSave(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[2].LoadFile(m_SkinDirPrefix + appSkin->GetBtnCancel(),wxBITMAP_TYPE_BMP);
|
||||
fileImgBuf[3].LoadFile(m_SkinDirPrefix + appSkin->GetBtnOpen(),wxBITMAP_TYPE_BMP);
|
||||
dlg10484fImg0=&fileImgBuf[0];
|
||||
bti26cImg1=&fileImgBuf[1];
|
||||
bti27cImg1=&fileImgBuf[2];
|
||||
btmpBtnAttProjL=&fileImgBuf[3];
|
||||
}
|
||||
void CDlgPreferences::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz){
|
||||
event.Skip(false);wxDC *dc;
|
||||
dc=event.GetDC();
|
||||
dc->SetBackground(wxBrush(win->GetBackgroundColour(),wxSOLID));
|
||||
dc->Clear();
|
||||
switch (opz) {
|
||||
case 0:{
|
||||
dc->DrawBitmap(bitMap, 0, 0);
|
||||
break;}
|
||||
case 1:{
|
||||
wxRect rec=win->GetClientRect();
|
||||
rec.SetLeft((rec.GetWidth()-bitMap.GetWidth()) / 2);
|
||||
rec.SetTop ((rec.GetHeight()-bitMap.GetHeight()) / 2);
|
||||
dc->DrawBitmap(bitMap,rec.GetLeft(),rec.GetTop(),0);
|
||||
break;}
|
||||
case 2:{
|
||||
wxRect rec=win->GetClientRect();
|
||||
for(int y=0;y < rec.GetHeight();y+=bitMap.GetHeight()){
|
||||
for(int x=0;x < rec.GetWidth();x+=bitMap.GetWidth()){
|
||||
dc->DrawBitmap(bitMap,x,y,0);
|
||||
}
|
||||
}
|
||||
break;}
|
||||
}
|
||||
}
|
||||
void CDlgPreferences::OnEraseBackground(wxEraseEvent& event){
|
||||
wxObject *m_wxWin = event.GetEventObject();
|
||||
if(m_wxWin==this){event.Skip(true);VwXDrawBackImg(event,this,*dlg10484fImg0,0);VwXEvOnEraseBackground(event) ;return;}
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
void CDlgPreferences::OnBtnClick(wxCommandEvent& event){ //init function
|
||||
wxObject *m_wxDlgBtnObj = event.GetEventObject();
|
||||
int btnID = event.GetId();
|
||||
if(btnID==ID_SAVEBUTTON){
|
||||
//wxMessageBox("OnBtnClick - btnSave");
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
else if(btnID==ID_OPENBUTTON){
|
||||
wxString fileName = wxFileSelector(_("Choose a file to open"), _(""), _(""), _("*.xml*"), _("*.xml*"), wxOPEN);
|
||||
if(!fileName.IsEmpty()){
|
||||
//tx30c->SetLabel(fileName);
|
||||
//tx30c->Disable();
|
||||
//tx30c->SetEditable(false);
|
||||
//set the path value
|
||||
//this->SetSkinPath(fileName); REPLACED WITH DROPDOWN
|
||||
}
|
||||
}else{
|
||||
//wxMessageBox("OnBtnClick - btnCancel");
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
} //end function
|
||||
|
||||
void CDlgPreferences::OnCmbSelected(wxCommandEvent& event){ //init function
|
||||
wxObject *m_wxDlgCmbObj = event.GetEventObject();
|
||||
int cmbID = event.GetId();
|
||||
if(cmbID==ID_SKINPICKERCMBBOX){
|
||||
m_SkinName = event.GetString();
|
||||
}
|
||||
} //end function
|
||||
|
||||
void CDlgPreferences::VwXEvOnEraseBackground(wxEraseEvent& event){ //init function
|
||||
//[29b]Code event VwX...Don't modify[29b]//
|
||||
//add your code here
|
||||
|
||||
} //end function
|
||||
|
||||
void CDlgPreferences::OnPreCreate(){
|
||||
//add your code here
|
||||
|
||||
}
|
||||
|
||||
void CDlgPreferences::initBefore(){
|
||||
//add your code here
|
||||
|
||||
}
|
||||
|
||||
void CDlgPreferences::initAfter(){
|
||||
//add your code here
|
||||
Centre();
|
||||
}
|
||||
|
||||
//[evtFunc]end your code
|
|
@ -1,71 +0,0 @@
|
|||
|
||||
#include "sg_SkinClass.h"
|
||||
|
||||
class CDlgPreferences:public wxDialog
|
||||
{
|
||||
public:
|
||||
CDlgPreferences(wxWindow* parent, wxString dirPref,wxWindowID id = -1, const wxString& title = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("dialogBox"));
|
||||
//Skin Class
|
||||
SkinClass *appSkin;
|
||||
// Pointer control
|
||||
wxStaticText *lblPref;
|
||||
wxStaticText *lblModifySett;
|
||||
wxStaticText *lblDoWorkBtwn;
|
||||
wxStaticText *lblAnd1;
|
||||
wxStaticText *lblConnToIntBtwn;
|
||||
wxComboBox *cmbDWBtwnBgn;
|
||||
wxComboBox *cmbDWBtwnEnd;
|
||||
wxComboBox *cmbCTIBtwnBgn;
|
||||
wxComboBox *cmbCTIBtwnEnd;
|
||||
wxStaticText *lblAnd2;
|
||||
wxStaticText *lblUseNoMoreGB;
|
||||
wxComboBox *cmbUseNoMoreGB;
|
||||
wxStaticText *lblGB;
|
||||
wxStaticText *lblDWWCInUse;
|
||||
wxStaticText *lblDWACIdleFor;
|
||||
wxComboBox *cmbDWACIdleFor;
|
||||
wxStaticText *lblMinutes;
|
||||
wxComboBox *cmbDWWCInUse;
|
||||
wxBitmapButton *btnSave;
|
||||
wxBitmapButton *btnCancel;
|
||||
wxStaticText *lblSkinXML;
|
||||
wxComboBox *cmbSkinPicker;
|
||||
//wxTextCtrl *tx30c;
|
||||
wxBitmapButton *btnOpen;
|
||||
wxBitmap *dlg10484fImg0;
|
||||
wxBitmap *bti26cImg1;
|
||||
wxBitmap *bti27cImg1;
|
||||
wxBitmap *btmpBtnAttProjL;
|
||||
wxBitmap fileImgBuf[4];
|
||||
virtual ~CDlgPreferences();
|
||||
void initBefore();
|
||||
void OnPreCreate();
|
||||
void InitDialog();
|
||||
void LoadSkinImages();
|
||||
wxString GetSkinDirPrefix() const { return m_SkinDirPrefix; }
|
||||
wxString GetSkinName() const { return m_SkinName; }
|
||||
void SetSkinDirPrefix(const wxString& pref) { m_SkinDirPrefix = pref; }
|
||||
void SetSkinName(const wxString& skinName) { m_SkinName = skinName; }
|
||||
|
||||
void initAfter();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
wxPoint m_tmppoint;
|
||||
wxSize m_tmpsize;
|
||||
wxString m_SkinName;
|
||||
wxString m_SkinDirPrefix;
|
||||
wxPoint& SetwxPoint(long x,long y);
|
||||
wxSize& SetwxSize(long w,long h);
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
void OnBtnClick(wxCommandEvent& event);
|
||||
void OnCmbSelected(wxCommandEvent& event);
|
||||
void VwXEvOnEraseBackground(wxEraseEvent& event);
|
||||
void VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz);
|
||||
|
||||
//[win]end your code
|
||||
};
|
||||
// end CDlgPreferences
|
||||
|
||||
//#endif
|
|
@ -1,35 +0,0 @@
|
|||
#include "stdwx.h"
|
||||
|
||||
#include "sg_ImageLoader.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(ImageLoader, wxWindow)
|
||||
EVT_PAINT(ImageLoader::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ImageLoader::ImageLoader(wxWindow* parent) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER)
|
||||
{
|
||||
}
|
||||
void ImageLoader::LoadImage(const wxImage& image)
|
||||
{
|
||||
Bitmap = wxBitmap();//delete existing bitmap since we are loading newone
|
||||
|
||||
int width = image.GetWidth();
|
||||
int height = image.GetHeight();
|
||||
//double X_Ratio = (double) MaxWidth / (double) width;
|
||||
//double Y_Ratio = (double) MaxHeight / (double) height;
|
||||
//double Ratio = X_Ratio < Y_Ratio ? X_Ratio : Y_Ratio;
|
||||
//wxImage Image = image.Scale((int)(Ratio * width), (int)(Ratio * height));
|
||||
Bitmap = wxBitmap(image);
|
||||
//width = imageGetWidth();
|
||||
//height = image.GetHeight();
|
||||
SetSize(width, height);
|
||||
}
|
||||
|
||||
void ImageLoader::OnPaint(wxPaintEvent& event)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
if(Bitmap.Ok())
|
||||
{
|
||||
dc.DrawBitmap(Bitmap, 0, 0);
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef _IMAGELOADER_H_
|
||||
#define _IMAGELOADER_H_
|
||||
|
||||
class ImageLoader : public wxWindow
|
||||
{
|
||||
public:
|
||||
/// Constructors
|
||||
ImageLoader(wxWindow* parent);
|
||||
void LoadImage(const wxImage& image);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
private:
|
||||
//static const int MaxWidth = 320;
|
||||
//static const int MaxHeight = 240;
|
||||
wxBitmap Bitmap;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
#include "stdwx.h"
|
||||
|
||||
#include "sg_SkinClass.h"
|
||||
|
||||
|
||||
SkinClass::SkinClass()
|
||||
{
|
||||
}
|
||||
SkinClass* SkinClass::Instance()
|
||||
{
|
||||
static SkinClass inst;
|
||||
return &inst;
|
||||
}
|
||||
wxColour SkinClass::GetColorFromStr(wxString col){
|
||||
// create color
|
||||
int delPos = col.Find(":");
|
||||
wxString rcol = col.Mid(0,delPos);
|
||||
col = col.Mid(delPos+1, col.Length() - delPos);
|
||||
delPos = col.Find(":");
|
||||
wxString gcol = col.Mid(0,delPos);
|
||||
wxString bcol = col.Mid(delPos+1, col.Length()- delPos);
|
||||
|
||||
unsigned char r_ch = atoi(rcol.c_str());
|
||||
unsigned char g_ch = atoi(gcol.c_str());
|
||||
unsigned char b_ch = atoi(bcol.c_str());
|
||||
|
||||
return wxColour(r_ch,g_ch,b_ch);
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
#ifndef _SKIN_CLASS
|
||||
#define _SKIN_CLASS
|
||||
|
||||
#include <string>
|
||||
|
||||
class SkinClass
|
||||
{
|
||||
public:
|
||||
static SkinClass* Instance();
|
||||
|
||||
// Getters
|
||||
wxString GetAppBg() { return m_appBg; }
|
||||
wxColour GetAppBgCol() { return GetColorFromStr(m_appBgCol); }
|
||||
wxString GetBtnPrefer() const { return m_btnPrefer; }
|
||||
wxString GetBtnAttProj() const { return m_btnAttProj; }
|
||||
wxString GetBtnAdvView() const { return m_btnAdvView; }
|
||||
wxString GetBtnPlay() const { return m_btnPlay; }
|
||||
wxString GetBtnPause() const { return m_btnPause; }
|
||||
wxString GetBtnMessages() const { return m_btnMessages; }
|
||||
wxString GetBtnOpen() const { return m_btnOpen; }
|
||||
wxString GetBtnSave() const { return m_btnSave; }
|
||||
wxString GetBtnCancel() const { return m_btnCancel; }
|
||||
wxString GetBtnLeftArr() const { return m_btnLeftArr; }
|
||||
wxString GetBtnRightArr() const { return m_btnRightArr; }
|
||||
wxString GetBtnLeftArrClick() const { return m_btnLeftArrClick; }
|
||||
wxString GetBtnRightArrClick() const { return m_btnRightArrClick; }
|
||||
wxString GetBtnExpand() const { return m_btnExpand; }
|
||||
wxString GetBtnCollapse() const { return m_btnCollapse; }
|
||||
wxString GetBtnExpandClick() const { return m_btnExpandClick; }
|
||||
wxString GetBtnCollapseClick() const { return m_btnCollapseClick; }
|
||||
|
||||
wxString GetDlgPrefBg() { return m_dlgPrefBg; }
|
||||
|
||||
wxColour GetGaugeFgCol() { return GetColorFromStr(m_gaugeFgCol); }
|
||||
wxColour GetGaugeBgCol() { return GetColorFromStr(m_gaugeBgCol); }
|
||||
|
||||
|
||||
wxColour GetTabFromColAc() { return GetColorFromStr(m_tabFromColAc); }
|
||||
wxColour GetTabToColAc() { return GetColorFromStr(m_tabToColAc); }
|
||||
wxColour GetTabBrdColAc() { return GetColorFromStr(m_tabBrdColAc); }
|
||||
wxColour GetTabFromColIn() { return GetColorFromStr(m_tabFromColIn); }
|
||||
wxColour GetTabToColIn() { return GetColorFromStr(m_tabToColIn); }
|
||||
wxColour GetTabBrdColIn() { return GetColorFromStr(m_tabBrdColIn); }
|
||||
|
||||
wxString GetIcnWorking() const { return m_icnWorking; }
|
||||
wxString GetIcnSleeping() const { return m_icnSleeping; }
|
||||
wxString GetIcnWorkingWkUnit() const { return m_icnWorkingWkUnit; }
|
||||
wxString GetIcnSleepingWkUnit() const { return m_icnSleepingWkUnit; }
|
||||
wxString GetIcnPrjWCG() const { return m_icnPrjWCG; }
|
||||
wxString GetIcnPrjPRED() const { return m_icnPrjPRED; }
|
||||
wxString GetAnimationBG() const { return m_animBg; }
|
||||
wxString GetAnimationFile() const { return m_animFile; }
|
||||
|
||||
// Setters
|
||||
void SetAppBg(const wxString imgsrc) { m_appBg = imgsrc; }
|
||||
void SetAppBgCol(const wxString& clr) { m_appBgCol = clr; }
|
||||
void SetBtnPrefer(const wxString& imgsrc) { m_btnPrefer = imgsrc; }
|
||||
void SetBtnAttProj(const wxString& imgsrc) { m_btnAttProj = imgsrc; }
|
||||
void SetBtnAdvView(const wxString& imgsrc) { m_btnAdvView = imgsrc; }
|
||||
void SetBtnPlay(const wxString& imgsrc) { m_btnPlay = imgsrc; }
|
||||
void SetBtnPause(const wxString& imgsrc) { m_btnPause = imgsrc; }
|
||||
void SetBtnMessages(const wxString& imgsrc) { m_btnMessages = imgsrc; }
|
||||
void SetBtnOpen(const wxString& imgsrc) { m_btnOpen = imgsrc; }
|
||||
void SetBtnSave(const wxString& imgsrc) { m_btnSave = imgsrc; }
|
||||
void SetBtnCancel(const wxString& imgsrc) { m_btnCancel = imgsrc; }
|
||||
void SetBtnLeftArr(const wxString& imgsrc) { m_btnLeftArr = imgsrc; }
|
||||
void SetBtnRightArr(const wxString& imgsrc) { m_btnRightArr = imgsrc; }
|
||||
void SetBtnLeftArrClick(const wxString& imgsrc) { m_btnLeftArrClick = imgsrc; }
|
||||
void SetBtnRightArrClick(const wxString& imgsrc) { m_btnRightArrClick = imgsrc; }
|
||||
void SetBtnExpand(const wxString& imgsrc) { m_btnExpand = imgsrc; }
|
||||
void SetBtnCollapse(const wxString& imgsrc) { m_btnCollapse = imgsrc; }
|
||||
void SetBtnExpandClick(const wxString& imgsrc) { m_btnExpandClick = imgsrc; }
|
||||
void SetBtnCollapseClick(const wxString& imgsrc) { m_btnCollapseClick = imgsrc; }
|
||||
|
||||
void SetDlgPrefBg(const wxString& imgsrc) { m_dlgPrefBg = imgsrc; }
|
||||
|
||||
void SetGaugeFgCol(const wxString& clr) { m_gaugeFgCol = clr; }
|
||||
void SetGaugeBgCol(const wxString& clr) { m_gaugeBgCol = clr; }
|
||||
|
||||
void SetTabFromColAc(const wxString& clr) { m_tabFromColAc = clr; }
|
||||
void SetTabToColAc(const wxString& clr) { m_tabToColAc = clr; }
|
||||
void SetTabBrdColAc(const wxString& clr) { m_tabBrdColAc = clr; }
|
||||
void SetTabFromColIn(const wxString& clr) { m_tabFromColIn = clr; }
|
||||
void SetTabToColIn(const wxString& clr) { m_tabToColIn = clr; }
|
||||
void SetTabBrdColIn(const wxString& clr) { m_tabBrdColIn = clr; }
|
||||
|
||||
void SetIcnWorking(const wxString& imgsrc) { m_icnWorking = imgsrc; }
|
||||
void SetIcnSleeping(const wxString& imgsrc) { m_icnSleeping = imgsrc; }
|
||||
void SetIcnWorkingWkUnit(const wxString& imgsrc) { m_icnWorkingWkUnit = imgsrc; }
|
||||
void SetIcnSleepingWkUnit(const wxString& imgsrc) { m_icnSleepingWkUnit = imgsrc; }
|
||||
void SetIcnPrjWCG(const wxString& imgsrc) { m_icnPrjWCG = imgsrc; }
|
||||
void SetIcnPrjPRED(const wxString& imgsrc) { m_icnPrjPRED = imgsrc; }
|
||||
void SetAnimationBg(const wxString& imgsrc) { m_animBg = imgsrc; }
|
||||
void SetAnimationFile(const wxString& imgsrc) { m_animFile = imgsrc; }
|
||||
|
||||
private:
|
||||
/// Constructors
|
||||
SkinClass();
|
||||
wxColour GetColorFromStr(wxString col);
|
||||
// Bg
|
||||
wxString m_appBg;
|
||||
wxString m_appBgCol;
|
||||
//Dialogs
|
||||
wxString m_dlgPrefBg;
|
||||
//gauge colors
|
||||
wxString m_gaugeFgCol;
|
||||
wxString m_gaugeBgCol;
|
||||
//notebook colors
|
||||
//active tab
|
||||
wxString m_tabFromColAc;
|
||||
wxString m_tabToColAc;
|
||||
wxString m_tabBrdColAc;
|
||||
//inactive tab
|
||||
wxString m_tabFromColIn;
|
||||
wxString m_tabToColIn;
|
||||
wxString m_tabBrdColIn;
|
||||
// Btns
|
||||
wxString m_btnPrefer;
|
||||
wxString m_btnAttProj;
|
||||
wxString m_btnAdvView;
|
||||
wxString m_btnPlay;
|
||||
wxString m_btnPause;
|
||||
wxString m_btnMessages;
|
||||
wxString m_btnOpen;
|
||||
wxString m_btnSave;
|
||||
wxString m_btnCancel;
|
||||
wxString m_btnLeftArr;
|
||||
wxString m_btnRightArr;
|
||||
wxString m_btnLeftArrClick;
|
||||
wxString m_btnRightArrClick;
|
||||
wxString m_btnExpand;
|
||||
wxString m_btnCollapse;
|
||||
wxString m_btnExpandClick;
|
||||
wxString m_btnCollapseClick;
|
||||
// Icons
|
||||
wxString m_icnWorking;
|
||||
wxString m_icnSleeping;
|
||||
wxString m_icnWorkingWkUnit;
|
||||
wxString m_icnSleepingWkUnit;
|
||||
wxString m_icnPrjWCG;
|
||||
wxString m_icnPrjPRED;
|
||||
// animation
|
||||
wxString m_animBg;
|
||||
wxString m_animFile;
|
||||
};
|
||||
#endif /* _SKIN_CLASS */
|
|
@ -1,66 +0,0 @@
|
|||
#include "stdwx.h"
|
||||
#include <vector>
|
||||
#include "BOINCGUIApp.h"
|
||||
#include "sg_StatImageLoader.h"
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(StatImageLoader, wxWindow)
|
||||
EVT_PAINT(StatImageLoader::OnPaint)
|
||||
EVT_LEFT_DOWN(StatImageLoader::PopUpMenu)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
StatImageLoader::StatImageLoader(wxWindow* parent, std::string url) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER)
|
||||
{
|
||||
appSkin = SkinClass::Instance();
|
||||
prjUrl = url;
|
||||
CreateMenu();
|
||||
}
|
||||
|
||||
void StatImageLoader::PopUpMenu(wxMouseEvent& event)
|
||||
{
|
||||
// pop up menu
|
||||
bool menuPoped = PopupMenu(statPopUpMenu);
|
||||
}
|
||||
|
||||
void StatImageLoader::CreateMenu()
|
||||
{
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
wxASSERT(pDoc);
|
||||
|
||||
PROJECT* project = pDoc->state.lookup_project(prjUrl);
|
||||
int urlCount = project->gui_urls.size();
|
||||
|
||||
// create pop up menu
|
||||
statPopUpMenu = new wxMenu(wxSIMPLE_BORDER);
|
||||
|
||||
for(int i = 0; i < urlCount; i++){
|
||||
wxMenuItem *urlItem = new wxMenuItem(statPopUpMenu, -1,wxString(project->gui_urls[i].name.c_str(), wxConvUTF8));
|
||||
#ifdef __WXMSW__
|
||||
urlItem->SetBackgroundColour(appSkin->GetAppBgCol());
|
||||
#endif
|
||||
statPopUpMenu->Append(urlItem);
|
||||
}
|
||||
//
|
||||
/*
|
||||
wxBitmap *btmTellFriend = new wxBitmap();
|
||||
btmTellFriend->LoadFile("skins/default/graphic/micnTellFriend.png",wxBITMAP_TYPE_PNG);
|
||||
itmTellFriend->SetBitmap(*btmTellFriend);
|
||||
*/
|
||||
}
|
||||
void StatImageLoader::LoadImage(const wxImage& image)
|
||||
{
|
||||
Bitmap = wxBitmap();//delete existing bitmap since we are loading new one
|
||||
int width = image.GetWidth();
|
||||
int height = image.GetHeight();
|
||||
Bitmap = wxBitmap(image);
|
||||
SetSize(width, height);
|
||||
}
|
||||
|
||||
void StatImageLoader::OnPaint(wxPaintEvent& event)
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
if(Bitmap.Ok())
|
||||
{
|
||||
dc.DrawBitmap(Bitmap, 0, 0);
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef _STATIMAGELOADER_H_
|
||||
#define _STATIMAGELOADER_H_
|
||||
|
||||
|
||||
#include "sg_SkinClass.h"
|
||||
|
||||
class StatImageLoader : public wxWindow
|
||||
{
|
||||
public:
|
||||
//members
|
||||
wxMenu *statPopUpMenu;
|
||||
//Skin Class
|
||||
SkinClass *appSkin;
|
||||
std::string prjUrl;
|
||||
/// Constructors
|
||||
StatImageLoader(wxWindow* parent, std::string url);
|
||||
void LoadImage(const wxImage& image);
|
||||
void CreateMenu();
|
||||
void PopUpMenu(wxMouseEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
private:
|
||||
//private memb
|
||||
wxWindow *m_parent;
|
||||
wxBitmap Bitmap;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -283,6 +283,9 @@
|
|||
<File
|
||||
RelativePath="..\clientgui\res\boinc.xpm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\clientgui\res\boincdisconnect.xpm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\clientgui\res\BOINCGUIApp.ico">
|
||||
</File>
|
||||
|
@ -307,6 +310,9 @@
|
|||
<File
|
||||
RelativePath="..\clientgui\res\boincsm.xpm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\clientgui\res\boincsnooze.xpm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\clientgui\res\cpdnbbc16.xpm">
|
||||
</File>
|
||||
|
|
Loading…
Reference in New Issue