CDBoxInfoWidget: remove superfluous paint of header

This commit is contained in:
2016-03-22 11:35:02 +01:00
parent 65f4b82f62
commit d8e3ecfa1d
2 changed files with 16 additions and 5 deletions

View File

@@ -39,7 +39,7 @@
#include <libgen.h> #include <libgen.h>
#include <gui/dboxinfo.h> #include <gui/dboxinfo.h>
#include <gui/components/cc.h>
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
@@ -74,7 +74,7 @@ CDBoxInfoWidget::CDBoxInfoWidget()
height = 0; height = 0;
x = 0; x = 0;
y = 0; y = 0;
header = NULL;
fontWidth = fm->getWidth(); fontWidth = fm->getWidth();
sizeWidth = 6 * fm->getMaxDigitWidth() sizeWidth = 6 * fm->getMaxDigitWidth()
+ fm->getRenderWidth(std::string(" MiB") + g_Locale->getText(LOCALE_UNIT_DECIMAL)); ;//9999.99 MiB + fm->getRenderWidth(std::string(" MiB") + g_Locale->getText(LOCALE_UNIT_DECIMAL)); ;//9999.99 MiB
@@ -83,6 +83,12 @@ CDBoxInfoWidget::CDBoxInfoWidget()
nameWidth = fontWidth * 17; nameWidth = fontWidth * 17;
} }
CDBoxInfoWidget::~CDBoxInfoWidget()
{
delete header;
header = NULL;
}
int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
{ {
if (parent) if (parent)
@@ -166,6 +172,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &)
void CDBoxInfoWidget::hide() void CDBoxInfoWidget::hide()
{ {
header->kill();
frameBuffer->paintBackgroundBoxRel(x,y, width,height); frameBuffer->paintBackgroundBoxRel(x,y, width,height);
frameBuffer->blit(); frameBuffer->blit();
} }
@@ -360,8 +367,10 @@ void CDBoxInfoWidget::paint()
width = max(width, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(title, true) + 50); width = max(width, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(title, true) + 50);
x = getScreenStartX(width); x = getScreenStartX(width);
CComponentsHeader header(x, ypos, width, hheight, title, NEUTRINO_ICON_SHELL); if (!header)
header.paint(CC_SAVE_SCREEN_NO); header = new CComponentsHeader(x, ypos, width, hheight, title, NEUTRINO_ICON_SHELL);
if (!header->isPainted())
header->paint(CC_SAVE_SCREEN_NO);
//paint body //paint body
frameBuffer->paintBoxRel(x, ypos+ hheight, width, height- hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); frameBuffer->paintBoxRel(x, ypos+ hheight, width, height- hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);

View File

@@ -36,6 +36,7 @@
#include <gui/widget/menue.h> #include <gui/widget/menue.h>
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <gui/components/cc.h>
#include <string> #include <string>
class CDBoxInfoWidget : public CMenuTarget class CDBoxInfoWidget : public CMenuTarget
@@ -54,12 +55,13 @@ class CDBoxInfoWidget : public CMenuTarget
int nameWidth; int nameWidth;
void paint(); void paint();
CComponentsHeader *header;
Font *fm, *ft; Font *fm, *ft;
public: public:
CDBoxInfoWidget(); CDBoxInfoWidget();
~CDBoxInfoWidget();
void hide(); void hide();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);