From ba7524f6bbbcdfdb2ec3e80db6f7583246dd9aff Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 7 Jan 2014 09:41:06 +0100 Subject: [PATCH] CComponents: replace clear() with clearFbData(), remove cleanCCForm() clear() replaces now clearCCItems() and cleanCCForm() is superfluous. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ed7a2fd625723a1232ead22826f07d2760124315 Author: Thilo Graf Date: 2014-01-07 (Tue, 07 Jan 2014) --- src/gui/components/cc_base.cpp | 8 ++++---- src/gui/components/cc_base.h | 2 +- src/gui/components/cc_detailsline.cpp | 2 +- src/gui/components/cc_frm.cpp | 14 ++------------ src/gui/components/cc_frm.h | 6 +++--- src/gui/components/cc_frm_clock.cpp | 2 +- src/gui/components/cc_frm_icons.cpp | 2 +- src/gui/components/cc_item.cpp | 2 +- 8 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 4684ceb28..8b30596b9 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -44,7 +44,7 @@ CComponents::~CComponents() { hide(); clearSavedScreen(); - clear(); + clearFbData(); } void CComponents::clearSavedScreen() @@ -196,7 +196,7 @@ inline void CComponents::hide() } } - clear(); + clearFbData(); is_painted = false; } @@ -205,13 +205,13 @@ void CComponents::kill() { for(size_t i =0; i< v_fbdata.size() ;i++) frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); - clear(); + clearFbData(); firstPaint = true; is_painted = false; } //clean old screen buffer -inline void CComponents::clear() +inline void CComponents::clearFbData() { for(size_t i =0; i< v_fbdata.size() ;i++) if (v_fbdata[i].pixbuf) diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index bf2eeb5cd..37c38a71f 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -105,7 +105,7 @@ class CComponents void paintFbItems(bool do_save_bg = true); ///clean up old screen buffer saved in v_fbdata - virtual void clear(); + virtual void clearFbData(); ///container: contains saved pixel buffer with position and dimensions comp_screen_data_t saved_screen; diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 8eab8b047..6a032d454 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -85,7 +85,7 @@ CComponentsDetailLine::~CComponentsDetailLine() //paint details line with current parameters void CComponentsDetailLine::paint(bool do_save_bg) { - clear(); + clearFbData(); int y_mark_top = y-h_mark_top/2+thickness/2; int y_mark_down = y_down-h_mark_down/2+thickness/2; diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 10296634b..7ae3f9490 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -64,21 +64,11 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, CComponentsForm::~CComponentsForm() { - cleanCCForm(); -} - -void CComponentsForm::cleanCCForm() -{ -#ifdef DEBUG_CC - printf("[CComponentsForm] [%s - %d] clean up...\n", __func__, __LINE__); -#endif - - clearCCItems(); + clear(); } - -void CComponentsForm::clearCCItems() +void CComponentsForm::clear() { if (v_cc_items.empty()) return; diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 8f9fbabef..7e37a6698 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -34,7 +34,7 @@ class CComponentsForm : public CComponentsItem private: void initVarForm(); protected: - std::vector v_cc_items; + std::vector v_cc_items; void paintForm(bool do_save_bg); ///generates next possible index for an item, see also cc_item_index, getIndex(), setIndex() int genIndex(); @@ -62,8 +62,8 @@ class CComponentsForm : public CComponentsItem virtual int getCCItemId(CComponentsItem* cc_Item); virtual CComponentsItem* getCCItem(const uint& cc_item_id); virtual void paintCCItems(); - virtual void clearCCItems(); - virtual void cleanCCForm(); + ///clean up and deallocate existant items from v_cc_items at once + virtual void clear(); virtual void setAppendOffset(const int &h_offset, const int& v_offset){append_h_offset = h_offset; append_v_offset = v_offset;}; }; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 6802476d3..b921ee47b 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -135,7 +135,7 @@ void CComponentsFrmClock::initCCLockItems() if (v_cc_items.size() != s_time.size()){ //clean up possible old items before add new items - clearCCItems(); + clear(); //create new empty label objects, set some general properties and add to container for (size_t i = 0; i < s_time.size(); i++){ diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index e83707320..1092491f2 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -108,7 +108,7 @@ int CComponentsIconForm::getIconId(const std::string& icon_name) //to remove old items before add new icons, otherwise icons will be appended. void CComponentsIconForm::removeAllIcons() { - clearCCItems(); + clear(); v_icons.clear(); } diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 9a3ecdb86..08902596b 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -63,7 +63,7 @@ void CComponentsItem::initVarItem() // If backround is not required, it's possible to override this with variable paint_bg=false, use doPaintBg(true/false) to set this! void CComponentsItem::paintInit(bool do_save_bg) { - clear(); + clearFbData(); int th = fr_thickness; fb_pixel_t col_frame_cur = col_frame;