diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-09-19 00:15:19 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-09-19 00:15:19 +0200 |
commit | 36315d4f3ed507bcc613eb92155d561b78e81af6 (patch) | |
tree | f641c9cf2ac4bf35053ee57033c2294375c2ed59 | |
parent | face4c4bed68ae0d97d53cb0ebec6f1e02bbfbea (diff) | |
download | graphlcd-base-36315d4f3ed507bcc613eb92155d561b78e81af6.tar.gz graphlcd-base-36315d4f3ed507bcc613eb92155d561b78e81af6.tar.bz2 |
deactivated static method cSkinString::Reparse + static cSkinString::mStrings (wasn't used anyways, but caused big problems when using more than one display thread); beauty fixes: initialisation of static cColor-colour constants now moved to .c-file, type fix
-rw-r--r-- | glcdgraphics/bitmap.c | 20 | ||||
-rw-r--r-- | glcdgraphics/bitmap.h | 30 | ||||
-rw-r--r-- | glcdskin/object.c | 2 | ||||
-rw-r--r-- | glcdskin/string.c | 8 | ||||
-rw-r--r-- | glcdskin/string.h | 4 |
5 files changed, 44 insertions, 20 deletions
diff --git a/glcdgraphics/bitmap.c b/glcdgraphics/bitmap.c index 0ab27b6..b96fe6d 100644 --- a/glcdgraphics/bitmap.c +++ b/glcdgraphics/bitmap.c @@ -27,6 +27,17 @@ namespace GLCD { +const uint32_t cColor::Black = GRAPHLCD_Black; +const uint32_t cColor::White = GRAPHLCD_White; +const uint32_t cColor::Red = 0xFFFF0000; +const uint32_t cColor::Green = 0xFF00FF00; +const uint32_t cColor::Blue = 0xFF0000FF; +const uint32_t cColor::Magenta = 0xFFFF00FF; +const uint32_t cColor::Cyan = 0xFF00FFFF; +const uint32_t cColor::Yellow = 0xFFFFFF00; +const uint32_t cColor::Transparent = GRAPHLCD_Transparent; +const uint32_t cColor::ERRCOL = GRAPHLCD_ERRCOL; + cColor cColor::ParseColor(std::string col) { if (col == "black") return cColor(cColor::Black); @@ -61,6 +72,15 @@ cColor cColor::Invert(void) return cColor( (uint32_t)(color ^ 0x00FFFFFF) ) ; } +uint32_t cColor::AlignAlpha (uint32_t col) { + switch (col) { + case Transparent: + case ERRCOL: + return col; + default: + return (col & 0xFF000000) ? col : (col | 0xFF000000); + } +} const unsigned char bitmask[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; const unsigned char bitmaskl[8] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; diff --git a/glcdgraphics/bitmap.h b/glcdgraphics/bitmap.h index c3442e2..5710a78 100644 --- a/glcdgraphics/bitmap.h +++ b/glcdgraphics/bitmap.h @@ -60,16 +60,16 @@ public: cColor(uint32_t col) { color = col; } cColor(const cColor & col) { color = col.color; } - static const uint32_t Black = GRAPHLCD_Black; - static const uint32_t White = GRAPHLCD_White; - static const uint32_t Red = 0xFFFF0000; - static const uint32_t Green = 0xFF00FF00; - static const uint32_t Blue = 0xFF0000FF; - static const uint32_t Magenta = 0xFFFF00FF; - static const uint32_t Cyan = 0xFF00FFFF; - static const uint32_t Yellow = 0xFFFFFF00; - static const uint32_t Transparent = GRAPHLCD_Transparent; - static const uint32_t ERRCOL = GRAPHLCD_ERRCOL; + static const uint32_t Black; + static const uint32_t White; + static const uint32_t Red; + static const uint32_t Green; + static const uint32_t Blue; + static const uint32_t Magenta; + static const uint32_t Cyan; + static const uint32_t Yellow; + static const uint32_t Transparent; + static const uint32_t ERRCOL; uint32_t GetColor (void) { return color; } void SetColor (uint32_t col) { color = col; } @@ -79,15 +79,7 @@ public: operator uint32_t(void) { return GetColor(); } static cColor ParseColor (std::string col); - static uint32_t AlignAlpha (uint32_t col) { - switch (col) { - case Transparent: - case ERRCOL: - return col; - default: - return (col & 0xFF000000) ? col : (col | 0xFF000000); - } - } + static uint32_t AlignAlpha (uint32_t col); }; diff --git a/glcdskin/object.c b/glcdskin/object.c index 4fda5bb..5c1e514 100644 --- a/glcdskin/object.c +++ b/glcdskin/object.c @@ -647,7 +647,7 @@ void cSkinObject::Render(GLCD::cBitmap * screen) std::vector <std::string> lines; font->WrapText(Size().w, 0/*Size().h*/, text, lines); - int amount_lines = Size().h / font->LineHeight(); + size_t amount_lines = Size().h / font->LineHeight(); if (amount_lines < lines.size()) { int multilineRelScroll = mMultilineRelScroll.Evaluate(); diff --git a/glcdskin/string.c b/glcdskin/string.c index bc3070d..1db3f1a 100644 --- a/glcdskin/string.c +++ b/glcdskin/string.c @@ -55,18 +55,23 @@ std::string tSkinToken::Token(const tSkinToken & Token) return result; } +#if 0 cSkinString::tStringList cSkinString::mStrings; +#endif cSkinString::cSkinString(cSkinObject *Parent, bool Translate) : mObject(Parent), mSkin(Parent->Skin()), mTranslate(Translate) { +#if 0 mStrings.push_back(this); +#endif } cSkinString::~cSkinString() { +#if 0 tStringList::iterator it = mStrings.begin(); for (; it != mStrings.end(); ++it) { if ((*it) == this) { @@ -74,8 +79,10 @@ cSkinString::~cSkinString() break; } } +#endif } +#if 0 void cSkinString::Reparse(void) { tStringList::iterator it = mStrings.begin(); @@ -84,6 +91,7 @@ void cSkinString::Reparse(void) (*it)->Parse((*it)->mOriginal, true); } } +#endif // copied from xml.c (should be valid for parsing variable names too ...) diff --git a/glcdskin/string.h b/glcdskin/string.h index b75fa11..20c517c 100644 --- a/glcdskin/string.h +++ b/glcdskin/string.h @@ -86,8 +86,10 @@ class cSkin; class cSkinString { private: +#if 0 typedef std::vector<cSkinString*> tStringList; static tStringList mStrings; +#endif cSkinObject * mObject; cSkin * mSkin; @@ -97,7 +99,9 @@ private: bool mTranslate; public: +#if 0 static void Reparse(void); +#endif cSkinString(cSkinObject *Parent, bool Translate); ~cSkinString(); |