diff --git a/clientgui/sg_ImageButton.cpp b/clientgui/sg_ImageButton.cpp index 310676c8df..60cdc90282 100644 --- a/clientgui/sg_ImageButton.cpp +++ b/clientgui/sg_ImageButton.cpp @@ -44,8 +44,12 @@ void CImageButton::OnPaint(wxPaintEvent& WXUNUSED(event)) { dc.SetTextForeground(wxColour(*wxWHITE)); dc.SetFont(wxFont(7,74,90,90,0,wxT("Arial"))); - dc.DrawText(wxT("> Show real-time"), wxPoint(220,120)); - dc.DrawText(wxT("graphics"), wxPoint(230,130)); + wxString text = wxString(wxT("> Show real-time graphics")); + wxCoord width, height; + dc.GetTextExtent(text, &width, &height); + int x, y; + GetSize(&x,&y); + dc.DrawText(text, wxPoint(x-width-7,y-height-4)); } } void CImageButton::SetImage(wxBitmap bg) diff --git a/clientgui/sg_ImageLoader.cpp b/clientgui/sg_ImageLoader.cpp index 80be6eaa6c..849318aa24 100644 --- a/clientgui/sg_ImageLoader.cpp +++ b/clientgui/sg_ImageLoader.cpp @@ -28,8 +28,9 @@ BEGIN_EVENT_TABLE(ImageLoader, wxWindow) EVT_PAINT(ImageLoader::OnPaint) END_EVENT_TABLE() -ImageLoader::ImageLoader(wxWindow* parent) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) +ImageLoader::ImageLoader(wxWindow* parent, bool center) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) { + centerOnParent = center; } void ImageLoader::LoadImage(wxBitmap image) { @@ -37,6 +38,9 @@ void ImageLoader::LoadImage(wxBitmap image) int height = image.GetHeight(); Bitmap = image; SetSize(width, height); + if ( centerOnParent ) { + CentreOnParent(); + } } void ImageLoader::OnPaint(wxPaintEvent& WXUNUSED(event)) diff --git a/clientgui/sg_ImageLoader.h b/clientgui/sg_ImageLoader.h index a5efb9e8d2..31e4150bc4 100644 --- a/clientgui/sg_ImageLoader.h +++ b/clientgui/sg_ImageLoader.h @@ -28,13 +28,14 @@ class ImageLoader : public wxWindow { public: /// Constructors - ImageLoader(wxWindow* parent); + ImageLoader(wxWindow* parent, bool center = false); void LoadImage(wxBitmap image); void OnPaint(wxPaintEvent& event); private: //static const int MaxWidth = 320; //static const int MaxHeight = 240; wxBitmap Bitmap; + bool centerOnParent; DECLARE_EVENT_TABLE() }; diff --git a/clientgui/sg_SkinClass.cpp b/clientgui/sg_SkinClass.cpp index eaaa13a841..e08db91c3a 100644 --- a/clientgui/sg_SkinClass.cpp +++ b/clientgui/sg_SkinClass.cpp @@ -60,7 +60,7 @@ bool SkinClass::CheckSkin() return false;//skin xml file is not available } - if ( skinImageNames.size() != 35 ) { + if ( skinImageNames.size() != 36 ) { return false; } @@ -174,8 +174,7 @@ int SkinClass::LoadSkinXML(){ } else if (GetImageName(buf, "right_arrow_button")){ } else if (GetImageName(buf, "right_arrow_clicked_button")){ } else if (GetImageName(buf, "animation_background")){ - } else if (parse_str(buf, "<><> btnAminBg = new CImageButton(this,*(appSkin->GetAnimationBg()),wxPoint(28,154),wxSize(294,146),m_hasGraphic); - //// Animation Window - wAnimWk1=new wxWindow(this,-1,wxPoint(98,156),wxSize(148,142),wxNO_BORDER); - // media control - ///////////// - m_canvas = new MyCanvas(wAnimWk1, wxPoint(0,0), wxSize(148,142)); - #if 0 - m_player.SetDestroyAnimation(false); - m_player.SetWindow(m_canvas); - m_player.SetPosition(wxPoint(0, 0)); - #endif - m_animationCtrl = new wxGIFAnimationCtrl(m_canvas, -1, wxEmptyString, - wxPoint(0, 0), wxSize(148, 142)); - m_animationCtrl->GetPlayer().UseBackgroundColour(true); - m_animationCtrl->Stop(); - if (m_animationCtrl->LoadFile(appSkin->ComputeSkinDir() + wxString(_T("/")) + appSkin->GetAnimationFile())) - { - m_animationCtrl->Play(); - } - else - { - wxMessageBox(_T("Sorry, this animation was not a valid animated GIF.")); - } + CreateSlideShowWindow(); +} + +std::vector CViewTabPage::GetSlideShow() { + std::vector vSlideShow; + vSlideShow.push_back(*(appSkin->GetDefaultWorkunitImage())); + return vSlideShow; } void CViewTabPage::UpdateInterface() { @@ -145,13 +130,33 @@ void CViewTabPage::UpdateInterface() DrawText(); // check to see if we can display graphics + bool changed = false; if (resultWU->supports_graphics && resultWU->active_task_state == 1) { + if ( !m_hasGraphic ) { + changed = true; + } m_hasGraphic = true; } else { + if ( m_hasGraphic ) { + changed = true; + } m_hasGraphic = false; } btnAminBg->SetShowText(m_hasGraphic); - + if ( changed ) { + btnAminBg->Update(); + m_canvas->Refresh(); + m_canvas->Update(); + } +} +void CViewTabPage::CreateSlideShowWindow() { +// wAnimWk1=new wxWindow(this,-1,wxPoint(98,156),wxSize(148,142),wxNO_BORDER); + if ( wSlideShow <= NULL ) { + delete wSlideShow; + } + wSlideShow=new wxWindow(this,-1,wxPoint(32,158),wxSize(286,128),wxNO_BORDER); +// m_canvas = new MyCanvas(wAnimWk1, wxPoint(0,0), wxSize(148,142), GetSlideShow()); + m_canvas = new MyCanvas(wSlideShow, wxPoint(0,0), wxSize(286,128), GetSlideShow()); } void CViewTabPage::ReskinInterface() { @@ -161,6 +166,7 @@ void CViewTabPage::ReskinInterface() lnProjName->SetLineColor(appSkin->GetStaticLineCol()); // gauge gaugeWUMain->ReskinInterface(); + CreateSlideShowWindow(); } @@ -356,24 +362,49 @@ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) END_EVENT_TABLE() // Define a constructor for my canvas -MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size) +MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size, std::vector images) : wxScrolledWindow(parent, -1, pos, size, wxNO_BORDER | wxNO_FULL_REPAINT_ON_RESIZE) { SetBackgroundColour(wxColour(_T("BLACK"))); + wxBitmap* image; + ImageLoader* il; + double xRatio, yRatio, ratio; + for(unsigned int i=0; i < images.size(); i++) { + image = &(images.at(i)); + + // Check to see if they need to be rescaled to fit in the window + ratio = 1.0; + xRatio = ((double) size.GetWidth())/((double) image->GetWidth()); + yRatio = ((double) size.GetHeight())/((double) image->GetHeight()); + if ( xRatio < ratio ) { + ratio = xRatio; + } + if ( yRatio < ratio ) { + ratio = yRatio; + } + if ( ratio < 1.0 ) { + wxImage img = image->ConvertToImage(); + img.Rescale((int) image->GetWidth()*ratio, (int) image->GetHeight()*ratio); + image = new wxBitmap(img); + } + il = new ImageLoader(this, true); + il->LoadImage(*image); + if ( ratio < 1.0 ) { + delete image; + } + il->Show(true); + vSlideShow.push_back(il); + } } void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("MyCanvas::OnPaint - Begin")); wxPaintDC dc(this); -#if 0 - CSimpleFrame* frame = (CSimpleFrame*) GetParent(); - if (frame->GetPlayer().IsPlaying()) - { - frame->GetPlayer().Draw(dc); - } -#endif +// if ( vSlideShow.size() > 0 && vSlideShow.at(0).Ok() ) { +// dc.DrawBitmap(vSlideShow.at(0),0,0,false); +// } wxLogTrace(wxT("Function Start/End"), wxT("MyCanvas::OnPaint - End")); } \ No newline at end of file diff --git a/clientgui/sg_ViewTabPage.h b/clientgui/sg_ViewTabPage.h index cc2dddf24e..cea7c6a99d 100644 --- a/clientgui/sg_ViewTabPage.h +++ b/clientgui/sg_ViewTabPage.h @@ -24,13 +24,20 @@ #pragma interface "sg_ViewTabPage.cpp" #endif +#include +#include "common/wxFlatNotebook.h" +#include "BOINCGUIApp.h" +#include "sg_ImageLoader.h" + + class MyCanvas : public wxScrolledWindow { public: - MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size); + MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size, std::vector images); void OnPaint(wxPaintEvent& event); private: + std::vector vSlideShow; DECLARE_EVENT_TABLE() }; @@ -40,10 +47,6 @@ class CStaticLine; class CStaticLine; class CImageButton; -#include "BOINCGUIApp.h" -#include "common/wxAnimate.h" -#include "common/wxFlatNotebook.h" - class CViewTabPage : public wxPanel { DECLARE_DYNAMIC_CLASS( CViewTabPage ) @@ -56,7 +59,6 @@ public: //////////////////// // animation wxBitmap* btmpBgAnim; - wxWindow* wAnimWk1; CImageButton * btnAminBg; //line CStaticLine *lnProjName; @@ -98,7 +100,6 @@ public: // Animation MyCanvas* GetCanvas() const { return m_canvas; } - wxGIFAnimationCtrl* GetAnimationCtrl() const { return m_animationCtrl; } DECLARE_EVENT_TABLE() @@ -116,12 +117,13 @@ protected: void OnEraseBackground(wxEraseEvent& event); void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap bitMap,int opz); - MyCanvas* m_canvas; - wxGIFAnimationCtrl* m_animationCtrl; -#if 0 - wxAnimationPlayer m_player; - wxGIFAnimation m_animation; -#endif + +private: + + void CreateSlideShowWindow(); + std::vector GetSlideShow(); + wxWindow* wSlideShow; + MyCanvas* m_canvas; }; diff --git a/clientgui/skins/WorldCommunityGrid/graphic/molecule.gif b/clientgui/skins/WorldCommunityGrid/graphic/molecule.gif deleted file mode 100644 index 97125d8ed2..0000000000 Binary files a/clientgui/skins/WorldCommunityGrid/graphic/molecule.gif and /dev/null differ diff --git a/clientgui/skins/WorldCommunityGrid/graphic/wcg_black_bacground.png b/clientgui/skins/WorldCommunityGrid/graphic/wcg_black_bacground.png new file mode 100644 index 0000000000..66d134d955 Binary files /dev/null and b/clientgui/skins/WorldCommunityGrid/graphic/wcg_black_bacground.png differ diff --git a/clientgui/skins/WorldCommunityGrid/skin.xml b/clientgui/skins/WorldCommunityGrid/skin.xml index 49672a98b7..80bacc2ebe 100644 --- a/clientgui/skins/WorldCommunityGrid/skin.xml +++ b/clientgui/skins/WorldCommunityGrid/skin.xml @@ -35,7 +35,7 @@ graphic/arwRight.png graphic/arwRightClick.png graphic/project_image.png - graphic/molecule.gif + graphic/wcg_black_bacground.png graphic/ico_workWU.png diff --git a/clientgui/skins/default/graphic/boinc_black_background.png b/clientgui/skins/default/graphic/boinc_black_background.png new file mode 100644 index 0000000000..e994fe5bc4 Binary files /dev/null and b/clientgui/skins/default/graphic/boinc_black_background.png differ diff --git a/clientgui/skins/default/graphic/molecule.gif b/clientgui/skins/default/graphic/molecule.gif deleted file mode 100644 index 97125d8ed2..0000000000 Binary files a/clientgui/skins/default/graphic/molecule.gif and /dev/null differ diff --git a/clientgui/skins/default/skin.xml b/clientgui/skins/default/skin.xml index 49672a98b7..a0d333dda0 100644 --- a/clientgui/skins/default/skin.xml +++ b/clientgui/skins/default/skin.xml @@ -35,7 +35,7 @@ graphic/arwRight.png graphic/arwRightClick.png graphic/project_image.png - graphic/molecule.gif + graphic/boinc_black_background.png graphic/ico_workWU.png