From d8738e130bee8fa3464b86ba958a1cd23a3d5660 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 24 Oct 2012 15:31:49 +0200 Subject: [PATCH] CComponentsText: add member clearCCText() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5c5805d0eaa189ba304ef77bab231ffca1c72c87 Author: Thilo Graf Date: 2012-10-24 (Wed, 24 Oct 2012) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc.h | 3 ++- src/gui/components/components.cpp | 35 +++++++++++++------------------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 88458eb83..91371e9ce 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -224,6 +224,7 @@ class CComponentsText : public CComponentsItem Font * ct_font; void initVarText(); + void clearCCText(); private: const char* ct_text; int ct_text_mode; //see textbox.h for possible modes @@ -231,7 +232,7 @@ class CComponentsText : public CComponentsItem bool ct_text_sended; - void initText(); + void initCCText(); public: CComponentsText(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index da70b4902..7ed996d9a 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -274,15 +274,7 @@ CComponentsText::~CComponentsText() { hide(); clearSavedScreen(); - - if (ct_box) - delete ct_box; - ct_box = NULL; - - if (ct_textbox) - delete ct_textbox; - ct_textbox = NULL; - + clearCCText(); clear(); } @@ -303,7 +295,7 @@ void CComponentsText::initVarText() } -void CComponentsText::initText() +void CComponentsText::initCCText() { //set default font, if is no font definied if (ct_font == NULL) @@ -338,9 +330,20 @@ void CComponentsText::initText() ct_text_sended = ct_textbox->setText(&new_text, width); } +void CComponentsText::clearCCText() +{ + if (ct_box) + delete ct_box; + ct_box = NULL; + + if (ct_textbox) + delete ct_textbox; + ct_textbox = NULL; +} + void CComponentsText::paint(bool do_save_bg) { - initText(); + initCCText(); paintInit(do_save_bg); if (ct_text_sended) ct_textbox->paint(); @@ -397,15 +400,7 @@ CComponentsInfoBox::~CComponentsInfoBox() { hide(); clearSavedScreen(); - - if (ct_textbox) - delete ct_textbox; - ct_textbox = NULL; - - if (ct_box) - delete ct_box; - ct_box = NULL; - + clearCCText(); delete pic; clear(); }