From ebd0111d3721fd23cea0c03627dec29a32a36f15 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 8 Mar 2014 22:39:23 +0100 Subject: [PATCH] CComponents: use neutrino debug mode for debug output Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/750691fbbf4f467f9ba45d9dcb4105e9f1ec537a Author: Thilo Graf Date: 2014-03-08 (Sat, 08 Mar 2014) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_base.cpp | 18 +++++----- src/gui/components/cc_frm.cpp | 48 +++++++++----------------- src/gui/components/cc_frm_header.cpp | 23 ++++-------- src/gui/components/cc_frm_window.cpp | 13 ++++--- src/gui/components/cc_item.cpp | 14 ++++---- src/gui/components/cc_item_picture.cpp | 21 ++++------- src/gui/components/cc_item_text.cpp | 12 +++---- src/gui/components/cc_types.h | 2 +- 8 files changed, 58 insertions(+), 93 deletions(-) diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 3d913b920..d704dfb43 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -31,7 +31,7 @@ #include #include #include "cc_base.h" -#include +#include using namespace std; //abstract basic class CComponents @@ -86,14 +86,14 @@ bool CComponents::CheckFbData(const comp_fbdata_t& fbdata, const char* func, con if ( (fbdata.x < 0 || fbdata.y < 0) || (end >= (int32_t)frameBuffer->getScreenWidth(true)*(int32_t)frameBuffer->getScreenHeight(true)) ) { - printf("\33[31m\t[CComponents] ERROR! Position < 0 or > FB end [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n\33[0m", + dprintf(DEBUG_NORMAL, "[CComponents] ERROR! Position < 0 or > FB end [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n", func, line, fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); return false; } if (fbdata.dx == 0 || fbdata.dy == 0) { - printf("\33[33m\t[CComponents] WARNING! dx and/or dy = 0 [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n\33[0m", + dprintf(DEBUG_DEBUG,"[CComponents] INFO! dx and/or dy = 0 [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n", func, line, fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); @@ -111,8 +111,8 @@ void CComponents::paintFbItems(bool do_save_bg) if (!CheckFbData(v_fbdata[i], __func__, __LINE__)){ break; } -#ifdef DEBUG_CC - printf("\t[CComponents]\n\t[%s - %d] firstPaint->save screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", + + dprintf(DEBUG_DEBUG, "[CComponents]\n\t[%s - %d] firstPaint->save screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", __func__, __LINE__, firstPaint, @@ -121,7 +121,7 @@ void CComponents::paintFbItems(bool do_save_bg) v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); -#endif + saved_screen.x = v_fbdata[i].x; saved_screen.y = v_fbdata[i].y; saved_screen.dx = v_fbdata[i].dx; @@ -139,8 +139,8 @@ void CComponents::paintFbItems(bool do_save_bg) continue; } int fbtype = v_fbdata[i].fbdata_type; -#ifdef DEBUG_CC - printf("\t[CComponents]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", + + dprintf(DEBUG_DEBUG, "[CComponents]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", __func__, __LINE__, (int)i, @@ -148,7 +148,7 @@ void CComponents::paintFbItems(bool do_save_bg) v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); -#endif + //some elements can be assembled from lines and must be handled as one unit (see details line), //so all individual backgrounds of boxes must be saved and painted in "firstpaint mode" if (firstPaint){ diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 25ed839a4..11cfcd13d 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -31,7 +31,7 @@ #include "cc_frm.h" #include #include - +#include using namespace std; //------------------------------------------------------------------------------------------------------- @@ -79,15 +79,12 @@ void CComponentsForm::clear() { if (v_cc_items.empty()) return; -#ifdef DEBUG_CC - printf(" [CComponentsForm] %s... delete %d cc-item(s) \n", __func__, (int)v_cc_items.size()); -#endif for(size_t i=0; igetItemType()); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\n", __func__, (int)i+1, (int)v_cc_items.size(), v_cc_items[i]->getItemType()); + delete v_cc_items[i]; v_cc_items[i] = NULL; } @@ -99,26 +96,22 @@ void CComponentsForm::clear() void CComponentsForm::addCCItem(CComponentsItem* cc_Item) { if (cc_Item){ -#ifdef DEBUG_CC - printf(" [CComponentsForm] %s-%d try to add cc_Item [type %d] to form [current index=%d] \n", __func__, __LINE__, cc_Item->getItemType(), cc_item_index); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s-%d try to add cc_Item [type %d] to form [current index=%d] \n", __func__, __LINE__, cc_Item->getItemType(), cc_item_index); + cc_Item->setParent(this); v_cc_items.push_back(cc_Item); -#ifdef DEBUG_CC - printf(" added cc_Item [type %d] to form [current index=%d] \n", cc_Item->getItemType(), cc_item_index); -#endif + + dprintf(DEBUG_DEBUG, "\tadded cc_Item [type %d] to form [current index=%d] \n", cc_Item->getItemType(), cc_item_index); //assign item index int new_index = genIndex(); cc_Item->setIndex(new_index); -#ifdef DEBUG_CC - printf(" %s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index); -#endif + + dprintf(DEBUG_DEBUG, "\t%s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index); + } -#ifdef DEBUG_CC else - printf(" [CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__); -#endif + dprintf(DEBUG_NORMAL, "[CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__); } void CComponentsForm::addCCItem(const std::vector &cc_Items) @@ -167,11 +160,8 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new v_cc_items[cc_item_id] = new_cc_Item; } } -#ifdef DEBUG_CC else - printf("[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __func__); -#endif - + dprintf(DEBUG_NORMAL, "[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __func__); } void CComponentsForm::replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item) @@ -183,17 +173,13 @@ void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_I { if (cc_Item == NULL){ -#ifdef DEBUG_CC - printf("[CComponentsForm] %s parameter: cc_Item = %p...\n", __func__, cc_Item); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s parameter: cc_Item = %p...\n", __func__, cc_Item); return; } if (v_cc_items.empty()){ addCCItem(cc_Item); -#ifdef DEBUG_CC - printf("[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __func__); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __func__); }else{ v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); cc_Item->setParent(this); @@ -212,10 +198,8 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id) v_cc_items.erase(v_cc_items.begin()+cc_item_id); } } -#ifdef DEBUG_CC else - printf("[CComponentsForm] %s removing cc_Item not possible, v_cc_items is empty...\n", __func__); -#endif + dprintf(DEBUG_NORMAL, "[CComponentsForm] %s removing cc_Item not possible, v_cc_items is empty...\n", __func__); } void CComponentsForm::removeCCItem(CComponentsItem* cc_Item) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 8152c37ac..705f3b47f 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -29,7 +29,7 @@ #include #include #include "cc_frm_header.h" - +#include using namespace std; //------------------------------------------------------------------------------------------------------- @@ -126,9 +126,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const CComponentsHeader::~CComponentsHeader() { -#ifdef DEBUG_CC - printf("[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__); -#endif + dprintf(DEBUG_DEBUG, "[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__); v_cch_btn.clear(); } @@ -198,9 +196,7 @@ void CComponentsHeader::initIcon() //create instance for cch_icon_obj if (cch_icon_obj == NULL){ -#ifdef DEBUG_CC - printf(" [CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str()); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str()); cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); } @@ -263,9 +259,8 @@ void CComponentsHeader::initDefaultButtons() v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO); if (cch_buttons & CC_BTN_MENU) v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU); -#ifdef DEBUG_CC - printf("[CComponentsHeader] %s added %d default buttons...\n", __func__, (int)v_cch_btn.size()); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsHeader] %s added %d default buttons...\n", __func__, (int)v_cch_btn.size()); } void CComponentsHeader::setDefaultButtons(const int buttons) @@ -307,9 +302,7 @@ void CComponentsHeader::initButtons() if (cch_btn_obj == NULL){ cch_btn_obj = new CComponentsIconForm(); -#ifdef DEBUG_CC - printf(" [CComponentsHeader]\n [%s - %d] init header buttons...\n", __func__, __LINE__); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header buttons...\n", __func__, __LINE__); } //add button form only one time @@ -360,9 +353,7 @@ void CComponentsHeader::initCaption() //create cch_text_obj and add to collection if (cch_text_obj == NULL){ -#ifdef DEBUG_CC - printf(" [CComponentsHeader]\n [%s - %d] init header text: %s [ x %d w %d ]\n", __func__, __LINE__, cch_text.c_str(), cch_text_x, cc_text_w); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header text: %s [ x %d w %d ]\n", __func__, __LINE__, cch_text.c_str(), cch_text_x, cc_text_w); cch_text_obj = new CComponentsText(); } diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 013315ff8..2c92230a7 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -29,7 +29,7 @@ #include #include #include "cc_frm_window.h" - +#include using namespace std; //------------------------------------------------------------------------------------------------------- @@ -108,9 +108,9 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const ccw_caption = caption; ccw_icon_name = iconname; -#ifdef DEBUG_CC - printf("[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str()); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str()); + shadow = has_shadow; col_frame = color_frame; col_body = color_body; @@ -209,9 +209,8 @@ void CComponentsWindow::initBody() void CComponentsWindow::initCCWItems() { -#ifdef DEBUG_CC - printf("[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__); + //add/remove header if required if (ccw_show_header){ initHeader(); diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index b88c43165..a35b2e33c 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -32,7 +32,7 @@ #include #include "cc_base.h" #include - +#include using namespace std; // y @@ -100,9 +100,9 @@ void CComponentsItem::paintInit(bool do_save_bg) continue; v_fbdata.push_back(fbdata[i]); } -#ifdef DEBUG_CC - printf("[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __func__, cc_item_type, cc_item_index, height, width); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __func__, cc_item_type, cc_item_index, height, width); + paintFbItems(do_save_bg); } @@ -150,9 +150,9 @@ int CComponentsItem::getItemType() if (i == cc_item_type) return i; } -#ifdef DEBUG_CC - printf("[CComponentsItem] %s: unknown item type requested...\n", __func__); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsItem] %s: unknown item type requested...\n", __func__); + return -1; } diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index af793f0a7..ecf5d1cc8 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -32,7 +32,7 @@ #include #include "cc_item_picture.h" #include - +#include extern CPictureViewer * g_PicViewer; using namespace std; @@ -148,10 +148,8 @@ void CComponentsPicture::initCCItem() g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, pic_max_w, pic_max_h); } -#ifdef DEBUG_CC if (pic_width == 0 || pic_height == 0) - printf("[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __func__, pic_name.c_str(), pic_width, pic_height); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __func__, pic_name.c_str(), pic_width, pic_height); initPosition(); @@ -159,10 +157,8 @@ void CComponentsPicture::initCCItem() width = max(max(pic_width, pic_max_w), width) + sw ; height = max(max(pic_height, pic_max_h), height) + sw ; -#ifdef DEBUG_CC - printf("[CComponentsPicture] %s initialized Image: ====>> %s\n\titem x = %d\n\tdx = %d (image dx = %d)\n\titem y = %d\n\titem dy = %d (image dy = %d)\n", + dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s initialized Image: ====>> %s\n\titem x = %d\n\tdx = %d (image dx = %d)\n\titem y = %d\n\titem dy = %d (image dy = %d)\n", __func__, pic_name.c_str(), x, width, pic_width, y, height, pic_height); -#endif } void CComponentsPicture::initPosition() @@ -197,9 +193,8 @@ void CComponentsPicture::paintPicture() pic_painted = false; if (do_paint && cc_allow_paint){ -#ifdef DEBUG_CC - printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d) with mode %d\n", __func__, pic_name.c_str(), do_paint, pic_paint_mode); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s: paint image: %s (do_paint=%d) with mode %d\n", __func__, pic_name.c_str(), do_paint, pic_paint_mode); + if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF) pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0 /*pic_max_h*/, pic_offset, pic_paint, pic_paintBg, col_body); else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) @@ -274,10 +269,8 @@ void CComponentsChannelLogo::initVarPictureChannellLogo() if (!has_logo) pic_name = tmp_logo; -#ifdef DEBUG_CC - printf("\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id); -#endif - + dprintf(DEBUG_DEBUG, "\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id); + initCCItem(); } diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index f8aeb48de..3c90597ec 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -34,7 +34,7 @@ #include #include #include - +#include using namespace std; //sub class CComponentsText from CComponentsItem @@ -164,9 +164,8 @@ void CComponentsText::initCCText() ct_old_text = ct_text; ct_old_col_text = ct_col_text; } -#ifdef DEBUG_CC - printf(" [CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __func__, __LINE__, ct_text.c_str(), this->iX, this->iY, this->iWidth, this->iHeight); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __func__, __LINE__, ct_text.c_str(), this->iX, this->iY, this->iWidth, this->iHeight); } void CComponentsText::clearCCText() @@ -182,9 +181,8 @@ void CComponentsText::setText(const std::string& stext, const int mode, Font* fo ct_text = stext; ct_text_mode = mode; ct_font = font_text; -#ifdef DEBUG_CC - printf(" [CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str()); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str()); } void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text) diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 520fa5f79..c8f23b386 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -30,7 +30,7 @@ #include #include -// #define DEBUG_CC + class CComponentsForm;