From af8c8f2c10113a65e97e73924997a5ea73d53e5c Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 20 Aug 2012 22:21:28 +0200 Subject: [PATCH] * CComponentsInfoBox: Add removeLineBreaks() --- src/gui/components/cc.h | 3 ++- src/gui/components/components.cpp | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index c450635ff..5b964ed2e 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -221,7 +221,8 @@ class CComponentsInfoBox : public CComponentsContainer void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; void setSpaceOffset(const int offset){x_offset = offset;}; void setPicture(const std::string& picture_name){pic_name = picture_name;}; - + void removeLineBreaks(std::string& str); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index aa406ef01..e95e103aa 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -390,6 +390,15 @@ void CComponentsInfoBox::paint(bool do_save_bg) text = NULL; } +void CComponentsInfoBox::removeLineBreaks(std::string& str) +{ + std::string::size_type spos = str.find_first_of("\r\n"); + while (spos != std::string::npos) { + str.replace(spos, 1, " "); + spos = str.find_first_of("\r\n"); + } +} + //------------------------------------------------------------------------------------------------------- //sub class CComponentsShapeSquare from CComponentsContainer CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)