MGR: Allow skin to specify the (simulated) opacity of Simple View task and project panels

svn path=/trunk/boinc/; revision=24479
This commit is contained in:
Charlie Fenton 2011-10-25 12:11:26 +00:00
parent 98b653bc88
commit d948cd3382
4 changed files with 34 additions and 10 deletions

View File

@ -7747,7 +7747,6 @@ David 24 Oct 2011
parse.h
Charlie 25 Oct 2011
Charlie 23 Oct 2011
- MGR: Sort Simple View task selection control alphabetically.
Subclassed CBOINCBitmapComboBox from wxBitmapComboBox to work
around clientData bug in wxBitmapComboBox::Insert().
@ -7760,3 +7759,11 @@ Charlie 23 Oct 2011
sg_TaskPanel.cpp,.h
win_build/
boincmgr.vcproj
Charlie 25 Oct 2011
- MGR: Allow skin to specify the (simulated) opacity of Simple View
task and project panels.
clientgui/
sg_PanelBase.cpp
SkinManager.cpp,.h

View File

@ -279,6 +279,7 @@ void CSkinSimple::Clear() {
m_WorkunitRunningImage.Clear();
m_WorkunitSuspendedImage.Clear();
m_WorkunitWaitingImage.Clear();
m_iPanelOpacity = DEFAULT_OPACITY;
}
@ -312,6 +313,8 @@ int CSkinSimple::Parse(MIOFILE& in) {
} else if (match_tag(buf, "<workunit_waiting_image>")) {
m_WorkunitWaitingImage.Parse(in);
continue;
} else if (parse_int(buf, "<panel_opacity>", m_iPanelOpacity)) {
continue;
}
}

View File

@ -102,6 +102,11 @@ private:
};
// Default opacity for Simple View white panels
// is 60% (153 on a scale of 0 - 255).
#define MAX_OPACITY 255
#define DEFAULT_OPACITY 153
class CSkinSimple : public CSkinItem
{
DECLARE_DYNAMIC_CLASS( CSkinSimple )
@ -123,6 +128,7 @@ public:
CSkinImage* GetWorkunitRunningImage() { return &m_WorkunitRunningImage; }
CSkinImage* GetWorkunitSuspendedImage() { return &m_WorkunitSuspendedImage; }
CSkinImage* GetWorkunitWaitingImage() { return &m_WorkunitWaitingImage; }
int GetPanelOpacity() { return m_iPanelOpacity; }
private:
CSkinImage m_BackgroundImage;
@ -133,6 +139,7 @@ private:
CSkinImage m_WorkunitRunningImage;
CSkinImage m_WorkunitSuspendedImage;
CSkinImage m_WorkunitWaitingImage;
int m_iPanelOpacity;
};

View File

@ -16,6 +16,9 @@
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#include "stdwx.h"
#include "BOINCGUIApp.h"
#include "miofile.h"
#include "SkinManager.h"
#include "sg_PanelBase.h"
#define RECTANGLERADIUS 15.0
@ -54,9 +57,6 @@ void CSimplePanelBase::ReskinInterface() {
m_GotBGBitMap = false;
}
#define WHITE_WEIGHT 60
#define IMAGE_WEIGHT (100-WHITE_WEIGHT)
// Create a background bitmap simulating partial transparency
void CSimplePanelBase::MakeBGBitMap() {
wxRect r;
@ -70,6 +70,13 @@ void CSimplePanelBase::MakeBGBitMap() {
CSimpleGUIPanel* backgroundPanel = (CSimpleGUIPanel*)GetParent();
wxPen bgPen(*wxWHITE, 1, wxTRANSPARENT);
wxBrush bgBrush(*wxWHITE);
CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
wxASSERT(pSkinSimple);
wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
int white_weight = pSkinSimple->GetPanelOpacity();
int image_weight = MAX_OPACITY - white_weight;
// Workaround for CSimpleGUIPanel not reliably getting
// Paint or EraseBackground events under Linux
@ -110,12 +117,12 @@ void CSimplePanelBase::MakeBGBitMap() {
for (i=0; i<r.width; ++i) {
for (j=0; j<r.height; ++j) {
if (*whitePixels) {
k = (((unsigned int)*bgImagePixels * IMAGE_WEIGHT) + ((unsigned int)*whitePixels++ * WHITE_WEIGHT));
*bgImagePixels++ = k / 100;
k = (((unsigned int)*bgImagePixels * IMAGE_WEIGHT) + ((unsigned int)*whitePixels++ * WHITE_WEIGHT));
*bgImagePixels++ = k / 100;
k = (((unsigned int)*bgImagePixels * IMAGE_WEIGHT) + ((unsigned int)*whitePixels++ * WHITE_WEIGHT));
*bgImagePixels++ = k / 100;
k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight));
*bgImagePixels++ = k / MAX_OPACITY;
k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight));
*bgImagePixels++ = k / MAX_OPACITY;
k = (((unsigned int)*bgImagePixels * image_weight) + ((unsigned int)*whitePixels++ * white_weight));
*bgImagePixels++ = k / MAX_OPACITY;
} else {
bgImagePixels += 3;
whitePixels += 3;