CComponents: use neutrino debug mode for debug output

This commit is contained in:
2014-03-08 22:39:23 +01:00
parent 8a8748c5e7
commit 750691fbbf
8 changed files with 58 additions and 93 deletions

View File

@@ -31,7 +31,7 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include "cc_base.h" #include "cc_base.h"
#include <gui/widget/messagebox.h> #include <system/debug.h>
using namespace std; using namespace std;
//abstract basic class CComponents //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) || if ( (fbdata.x < 0 || fbdata.y < 0) ||
(end >= (int32_t)frameBuffer->getScreenWidth(true)*(int32_t)frameBuffer->getScreenHeight(true)) (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, func, line,
fbdata.x, fbdata.y, fbdata.x, fbdata.y,
fbdata.dx, fbdata.dy); fbdata.dx, fbdata.dy);
return false; return false;
} }
if (fbdata.dx == 0 || fbdata.dy == 0) { 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, func, line,
fbdata.x, fbdata.y, fbdata.x, fbdata.y,
fbdata.dx, fbdata.dy); fbdata.dx, fbdata.dy);
@@ -111,8 +111,8 @@ void CComponents::paintFbItems(bool do_save_bg)
if (!CheckFbData(v_fbdata[i], __func__, __LINE__)){ if (!CheckFbData(v_fbdata[i], __func__, __LINE__)){
break; 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__, __func__,
__LINE__, __LINE__,
firstPaint, firstPaint,
@@ -121,7 +121,7 @@ void CComponents::paintFbItems(bool do_save_bg)
v_fbdata[i].y, v_fbdata[i].y,
v_fbdata[i].dx, v_fbdata[i].dx,
v_fbdata[i].dy); v_fbdata[i].dy);
#endif
saved_screen.x = v_fbdata[i].x; saved_screen.x = v_fbdata[i].x;
saved_screen.y = v_fbdata[i].y; saved_screen.y = v_fbdata[i].y;
saved_screen.dx = v_fbdata[i].dx; saved_screen.dx = v_fbdata[i].dx;
@@ -139,8 +139,8 @@ void CComponents::paintFbItems(bool do_save_bg)
continue; continue;
} }
int fbtype = v_fbdata[i].fbdata_type; 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__, __func__,
__LINE__, __LINE__,
(int)i, (int)i,
@@ -148,7 +148,7 @@ void CComponents::paintFbItems(bool do_save_bg)
v_fbdata[i].y, v_fbdata[i].y,
v_fbdata[i].dx, v_fbdata[i].dx,
v_fbdata[i].dy); v_fbdata[i].dy);
#endif
//some elements can be assembled from lines and must be handled as one unit (see details line), //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" //so all individual backgrounds of boxes must be saved and painted in "firstpaint mode"
if (firstPaint){ if (firstPaint){

View File

@@ -31,7 +31,7 @@
#include "cc_frm.h" #include "cc_frm.h"
#include <stdlib.h> #include <stdlib.h>
#include <algorithm> #include <algorithm>
#include <system/debug.h>
using namespace std; using namespace std;
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
@@ -79,15 +79,12 @@ void CComponentsForm::clear()
{ {
if (v_cc_items.empty()) if (v_cc_items.empty())
return; 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; i<v_cc_items.size(); i++) { for(size_t i=0; i<v_cc_items.size(); i++) {
if (v_cc_items[i]){ if (v_cc_items[i]){
#ifdef DEBUG_CC
printf(" [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()); 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());
#endif
delete v_cc_items[i]; delete v_cc_items[i];
v_cc_items[i] = NULL; v_cc_items[i] = NULL;
} }
@@ -99,26 +96,22 @@ void CComponentsForm::clear()
void CComponentsForm::addCCItem(CComponentsItem* cc_Item) void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
{ {
if (cc_Item){ if (cc_Item){
#ifdef DEBUG_CC 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);
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
cc_Item->setParent(this); cc_Item->setParent(this);
v_cc_items.push_back(cc_Item); 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); dprintf(DEBUG_DEBUG, "\tadded cc_Item [type %d] to form [current index=%d] \n", cc_Item->getItemType(), cc_item_index);
#endif
//assign item index //assign item index
int new_index = genIndex(); int new_index = genIndex();
cc_Item->setIndex(new_index); 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); dprintf(DEBUG_DEBUG, "\t%s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index);
#endif
} }
#ifdef DEBUG_CC
else else
printf(" [CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__); dprintf(DEBUG_NORMAL, "[CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__);
#endif
} }
void CComponentsForm::addCCItem(const std::vector<CComponentsItem*> &cc_Items) void CComponentsForm::addCCItem(const std::vector<CComponentsItem*> &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; v_cc_items[cc_item_id] = new_cc_Item;
} }
} }
#ifdef DEBUG_CC
else else
printf("[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __func__); dprintf(DEBUG_NORMAL, "[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __func__);
#endif
} }
void CComponentsForm::replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item) 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){ if (cc_Item == NULL){
#ifdef DEBUG_CC dprintf(DEBUG_DEBUG, "[CComponentsForm] %s parameter: cc_Item = %p...\n", __func__, cc_Item);
printf("[CComponentsForm] %s parameter: cc_Item = %p...\n", __func__, cc_Item);
#endif
return; return;
} }
if (v_cc_items.empty()){ if (v_cc_items.empty()){
addCCItem(cc_Item); addCCItem(cc_Item);
#ifdef DEBUG_CC dprintf(DEBUG_DEBUG, "[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __func__);
printf("[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __func__);
#endif
}else{ }else{
v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item);
cc_Item->setParent(this); 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); v_cc_items.erase(v_cc_items.begin()+cc_item_id);
} }
} }
#ifdef DEBUG_CC
else else
printf("[CComponentsForm] %s removing cc_Item not possible, v_cc_items is empty...\n", __func__); dprintf(DEBUG_NORMAL, "[CComponentsForm] %s removing cc_Item not possible, v_cc_items is empty...\n", __func__);
#endif
} }
void CComponentsForm::removeCCItem(CComponentsItem* cc_Item) void CComponentsForm::removeCCItem(CComponentsItem* cc_Item)

View File

@@ -29,7 +29,7 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include "cc_frm_header.h" #include "cc_frm_header.h"
#include <system/debug.h>
using namespace std; using namespace std;
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
@@ -126,9 +126,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
CComponentsHeader::~CComponentsHeader() CComponentsHeader::~CComponentsHeader()
{ {
#ifdef DEBUG_CC dprintf(DEBUG_DEBUG, "[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__);
printf("[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__);
#endif
v_cch_btn.clear(); v_cch_btn.clear();
} }
@@ -198,9 +196,7 @@ void CComponentsHeader::initIcon()
//create instance for cch_icon_obj //create instance for cch_icon_obj
if (cch_icon_obj == NULL){ if (cch_icon_obj == NULL){
#ifdef DEBUG_CC dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str());
printf(" [CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str());
#endif
cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); 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); v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO);
if (cch_buttons & CC_BTN_MENU) if (cch_buttons & CC_BTN_MENU)
v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_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()); dprintf(DEBUG_DEBUG, "[CComponentsHeader] %s added %d default buttons...\n", __func__, (int)v_cch_btn.size());
#endif
} }
void CComponentsHeader::setDefaultButtons(const int buttons) void CComponentsHeader::setDefaultButtons(const int buttons)
@@ -307,9 +302,7 @@ void CComponentsHeader::initButtons()
if (cch_btn_obj == NULL){ if (cch_btn_obj == NULL){
cch_btn_obj = new CComponentsIconForm(); cch_btn_obj = new CComponentsIconForm();
#ifdef DEBUG_CC dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header buttons...\n", __func__, __LINE__);
printf(" [CComponentsHeader]\n [%s - %d] init header buttons...\n", __func__, __LINE__);
#endif
} }
//add button form only one time //add button form only one time
@@ -360,9 +353,7 @@ void CComponentsHeader::initCaption()
//create cch_text_obj and add to collection //create cch_text_obj and add to collection
if (cch_text_obj == NULL){ if (cch_text_obj == NULL){
#ifdef DEBUG_CC 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);
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
cch_text_obj = new CComponentsText(); cch_text_obj = new CComponentsText();
} }

View File

@@ -29,7 +29,7 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include "cc_frm_window.h" #include "cc_frm_window.h"
#include <system/debug.h>
using namespace std; using namespace std;
//------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------
@@ -108,9 +108,9 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
ccw_caption = caption; ccw_caption = caption;
ccw_icon_name = iconname; ccw_icon_name = iconname;
#ifdef DEBUG_CC
printf("[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str()); dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str());
#endif
shadow = has_shadow; shadow = has_shadow;
col_frame = color_frame; col_frame = color_frame;
col_body = color_body; col_body = color_body;
@@ -209,9 +209,8 @@ void CComponentsWindow::initBody()
void CComponentsWindow::initCCWItems() void CComponentsWindow::initCCWItems()
{ {
#ifdef DEBUG_CC dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__);
printf("[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__);
#endif
//add/remove header if required //add/remove header if required
if (ccw_show_header){ if (ccw_show_header){
initHeader(); initHeader();

View File

@@ -32,7 +32,7 @@
#include <neutrino.h> #include <neutrino.h>
#include "cc_base.h" #include "cc_base.h"
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <system/debug.h>
using namespace std; using namespace std;
// y // y
@@ -100,9 +100,9 @@ void CComponentsItem::paintInit(bool do_save_bg)
continue; continue;
v_fbdata.push_back(fbdata[i]); 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); 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);
#endif
paintFbItems(do_save_bg); paintFbItems(do_save_bg);
} }
@@ -150,9 +150,9 @@ int CComponentsItem::getItemType()
if (i == cc_item_type) if (i == cc_item_type)
return i; return i;
} }
#ifdef DEBUG_CC
printf("[CComponentsItem] %s: unknown item type requested...\n", __func__); dprintf(DEBUG_DEBUG, "[CComponentsItem] %s: unknown item type requested...\n", __func__);
#endif
return -1; return -1;
} }

View File

@@ -32,7 +32,7 @@
#include <neutrino.h> #include <neutrino.h>
#include "cc_item_picture.h" #include "cc_item_picture.h"
#include <unistd.h> #include <unistd.h>
#include <system/debug.h>
extern CPictureViewer * g_PicViewer; extern CPictureViewer * g_PicViewer;
using namespace std; using namespace std;
@@ -148,10 +148,8 @@ void CComponentsPicture::initCCItem()
g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, pic_max_w, pic_max_h); g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, pic_max_w, pic_max_h);
} }
#ifdef DEBUG_CC
if (pic_width == 0 || pic_height == 0) 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); 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);
#endif
initPosition(); initPosition();
@@ -159,10 +157,8 @@ void CComponentsPicture::initCCItem()
width = max(max(pic_width, pic_max_w), width) + sw ; width = max(max(pic_width, pic_max_w), width) + sw ;
height = max(max(pic_height, pic_max_h), height) + sw ; height = max(max(pic_height, pic_max_h), height) + sw ;
#ifdef DEBUG_CC 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",
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",
__func__, pic_name.c_str(), x, width, pic_width, y, height, pic_height); __func__, pic_name.c_str(), x, width, pic_width, y, height, pic_height);
#endif
} }
void CComponentsPicture::initPosition() void CComponentsPicture::initPosition()
@@ -197,9 +193,8 @@ void CComponentsPicture::paintPicture()
pic_painted = false; pic_painted = false;
if (do_paint && cc_allow_paint){ if (do_paint && cc_allow_paint){
#ifdef DEBUG_CC 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);
printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d) with mode %d\n", __func__, pic_name.c_str(), do_paint, pic_paint_mode);
#endif
if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF) 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); 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) else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON)
@@ -274,10 +269,8 @@ void CComponentsChannelLogo::initVarPictureChannellLogo()
if (!has_logo) if (!has_logo)
pic_name = tmp_logo; pic_name = tmp_logo;
#ifdef DEBUG_CC 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);
printf("\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id);
#endif
initCCItem(); initCCItem();
} }

View File

@@ -34,7 +34,7 @@
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include <errno.h> #include <errno.h>
#include <system/debug.h>
using namespace std; using namespace std;
//sub class CComponentsText from CComponentsItem //sub class CComponentsText from CComponentsItem
@@ -164,9 +164,8 @@ void CComponentsText::initCCText()
ct_old_text = ct_text; ct_old_text = ct_text;
ct_old_col_text = ct_col_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); 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);
#endif
} }
void CComponentsText::clearCCText() void CComponentsText::clearCCText()
@@ -182,9 +181,8 @@ void CComponentsText::setText(const std::string& stext, const int mode, Font* fo
ct_text = stext; ct_text = stext;
ct_text_mode = mode; ct_text_mode = mode;
ct_font = font_text; ct_font = font_text;
#ifdef DEBUG_CC
printf(" [CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str()); dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str());
#endif
} }
void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text) void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text)

View File

@@ -30,7 +30,7 @@
#include <system/localize.h> #include <system/localize.h>
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
// #define DEBUG_CC
class CComponentsForm; class CComponentsForm;