diff options
-rw-r--r-- | HISTORY | 6 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | display.c | 101 | ||||
-rw-r--r-- | render.c | 335 | ||||
-rw-r--r-- | render.h | 11 | ||||
-rw-r--r-- | xml/display.h | 2 | ||||
-rw-r--r-- | xml/object.c | 23 | ||||
-rw-r--r-- | xml/object.h | 10 |
8 files changed, 297 insertions, 193 deletions
@@ -1,6 +1,12 @@ VDR Plugin 'text2skin' Revision History --------------------------------------- +2007-05-06: Version 1.1-cvs_ext-0.10a (text2skin-1.1-cvs_ext-0.10a.diff) + +- increased efficiency in drawing list items in the main menu +- introduce relative Pos and Size of objects to given BasePos, BaseSize + (used to draw list items) + 2006-12-03: Version 1.1-cvs_ext-0.10 (vdr-text2skin-1.1-cvs_ext-0.10.diff) - set EditableWidth. This is important for plugins like 'rotor' or @@ -100,7 +100,7 @@ ifdef DEBUG CXXFLAGS += -g -fno-inline DEFINES += -DDEBUG else - CXXFLAGS += -O2 -g + CXXFLAGS += -O3 ifdef BENCH DEFINES += -DBENCH endif @@ -962,11 +962,8 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) switch (Token.Type) { case tMenuItem: case tMenuGroup: - if (Token.Index < 0) return false; case tMenuCurrent: - if (Token.Index >= 0 && Token.Tab == -1) return false; break; - default: if (Token.Tab >= 0) return false; break; @@ -977,38 +974,63 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token) return mTitle; case tMenuItem: - return mItems.size() > (uint)Token.Index && mItems[Token.Index].sel - && mCurrentItem != (uint)Token.Index - ? (cxType)mItems[Token.Index].tabs[Token.Tab] - : (cxType)false; + if (Token.Index < 0) return false; + + if( mItems.size() <= (uint)Token.Index || !mItems[Token.Index].sel || + mCurrentItem == (uint)Token.Index ) + return false; + + if (Token.Tab < 0) { + return Token.Attrib.Type == aNumber + ? (cxType)mItems[Token.Index].tabs[Token.Attrib.Number] + : (cxType)mItems[Token.Index].text; + } + + return (cxType)mItems[Token.Index].tabs[Token.Tab]; case tIsMenuItem: return mItems.size() > (uint)Token.Index && mItems[Token.Index].sel && mCurrentItem != (uint)Token.Index; case tMenuCurrent: + if(mItems.size() <= mCurrentItem) + return false; + if (Token.Index < 0) { - if (mItems.size() > mCurrentItem) - return Token.Attrib.Type == aNumber - ? (cxType)mItems[mCurrentItem].tabs[Token.Attrib.Number] - : (cxType)mItems[mCurrentItem].text; - else - return false; + return Token.Attrib.Type == aNumber + ? (cxType)mItems[mCurrentItem].tabs[Token.Attrib.Number] + : (cxType)mItems[mCurrentItem].text; } - return mItems.size() > (uint)Token.Index && mItems[Token.Index].sel - && mCurrentItem == (uint)Token.Index - ? (cxType)mItems[Token.Index].tabs[Token.Tab] - : (cxType)false; + if( mItems.size() <= (uint)Token.Index || !mItems[Token.Index].sel || + mCurrentItem != (uint)Token.Index ) + return false; + + if (Token.Tab < 0) { + return Token.Attrib.Type == aNumber + ? (cxType)mItems[Token.Index].tabs[Token.Attrib.Number] + : (cxType)mItems[Token.Index].text; + } + + return (cxType)mItems[Token.Index].tabs[Token.Tab]; case tIsMenuCurrent: return mItems.size() > (uint)Token.Index && mItems[Token.Index].sel && mCurrentItem == (uint)Token.Index; case tMenuGroup: - return mItems.size() > (uint)Token.Index && !mItems[Token.Index].sel - ? (cxType)mItems[Token.Index].tabs[Token.Tab] - : (cxType)false; + if (Token.Index < 0) return false; + + if( mItems.size() <= (uint)Token.Index || mItems[Token.Index].sel) + return false; + + if (Token.Tab < 0) { + return Token.Attrib.Type == aNumber + ? (cxType)mItems[Token.Index].tabs[Token.Attrib.Number] + : (cxType)mItems[Token.Index].text; + } + + return (cxType)mItems[Token.Index].tabs[Token.Tab]; case tIsMenuGroup: return mItems.size() > (uint)Token.Index && !mItems[Token.Index].sel; @@ -1417,17 +1439,7 @@ void cText2SkinDisplayTracks::SetAudioChannel(int AudioChannel) cxType cText2SkinDisplayTracks::GetTokenData(const txToken &Token) { - switch (Token.Type) { - case tMenuItem: - if (Token.Index < 0) return false; - case tMenuCurrent: - if (Token.Index >= 0 && Token.Tab == -1) return false; - break; - - default: - if (Token.Tab >= 0) return false; - break; - } + if (Token.Tab >= 0) return false; int index = Token.Index; if (index >= 0 && mCurrentItem >= (uint)mMaxItems) { @@ -1440,17 +1452,28 @@ cxType cText2SkinDisplayTracks::GetTokenData(const txToken &Token) return mTitle; case tMenuItem: - return mItems.size() > (uint)index && mCurrentItem != (uint)index - ? (cxType)mItems[index] - : (cxType)false; - + if (index < 0) return false; + + if( mItems.size() <= (uint)index || mCurrentItem == (uint)index ) + return false; + + return (cxType)mItems[index]; + case tIsMenuItem: return mItems.size() > (uint)index && mCurrentItem != (uint)index; - + case tMenuCurrent: - return mItems.size() > (uint)index && mCurrentItem == (uint)index - ? (cxType)mItems[index] - : (cxType)false; + if(mItems.size() <= mCurrentItem) + return false; + + if (index < 0) { + return (cxType)mItems[mCurrentItem]; + } + + if( mItems.size() <= (uint)index || mCurrentItem != (uint)index ) + return false; + + return (cxType)mItems[index]; case tIsMenuCurrent: return mItems.size() > (uint)index && mCurrentItem == (uint)index; @@ -37,7 +37,9 @@ cText2SkinRender::cText2SkinRender(cText2SkinLoader *Loader, cxDisplay::eType Di mStarted(), mUpdateIn(0), mNow(0), - mBaseSize() + mBaseSize(), + mTabScale(1.0), + mTabScaleSet(false) { if (mDisplay == NULL) { esyslog("ERROR: text2skin: display for %s missing", cxDisplay::GetType(Display).c_str()); @@ -163,188 +165,113 @@ void cText2SkinRender::Update(void) //printf("====\t%d\n", mDisplay->Objects()); } -void cText2SkinRender::DrawObject(const cxObject *Object) +void cText2SkinRender::DrawObject( cxObject *Object, + const txPoint &BaseOffset /*=txPoint(-1,-1)*/, + const txSize &BaseSize /*=txPoint(-1,-1)*/, + int ListItem /*=-1*/ ) { if (Object->Condition() != NULL && !Object->Condition()->Evaluate()) return; + txPoint pos; + txSize size; + + pos = Object->Pos(BaseOffset, BaseSize); + + size = Object->Size(BaseOffset, BaseSize); + + switch (Object->Type()) { case cxObject::image: - DrawImage(Object->Pos(), Object->Size(), Object->Bg(), Object->Fg(), Object->Mask(), + DrawImage(pos, size, Object->Bg(), Object->Fg(), Object->Mask(), Object->Alpha(), Object->Colors(), Object->Path()); break; case cxObject::text: - DrawText(Object->Pos(), Object->Size(), Object->Fg(), Object->Text(), Object->Font(), - Object->Align()); + if( ListItem >= 0 && Object->Display()->Type() == cxDisplay::menu ) + DrawItemText( Object, ListItem, pos, BaseSize ); + else + DrawText(pos, size, Object->Fg(), Object->Text(), Object->Font(), + Object->Align()); break; case cxObject::marquee: - DrawMarquee(Object->Pos(), Object->Size(), Object->Fg(), Object->Text(), Object->Font(), - Object->Align(), Object->Delay(), Object->Index()); + if( ListItem >= 0 && Object->Display()->Type() == cxDisplay::menu ) + DrawItemText( Object, ListItem, pos, BaseSize ); + else + DrawMarquee(pos, size, Object->Fg(), Object->Text(), Object->Font(), + Object->Align(), Object->Delay(), Object->Index()); break; case cxObject::blink: - DrawBlink(Object->Pos(), Object->Size(), Object->Fg(), Object->Bg(), Object->Text(), - Object->Font(), Object->Align(), Object->Delay(), Object->Index()); + if( ListItem >= 0 && Object->Display()->Type() == cxDisplay::menu ) + DrawItemText( Object, ListItem, pos, BaseSize ); + else + DrawBlink(pos, size, Object->Fg(), Object->Bg(), Object->Text(), + Object->Font(), Object->Align(), Object->Delay(), + Object->Index()); break; case cxObject::rectangle: - DrawRectangle(Object->Pos(), Object->Size(), Object->Fg()); + DrawRectangle(pos, size, Object->Fg()); break; case cxObject::ellipse: - DrawEllipse(Object->Pos(), Object->Size(), Object->Fg(), Object->Arc()); + DrawEllipse(pos, size, Object->Fg(), Object->Arc()); break; case cxObject::slope: - DrawSlope(Object->Pos(), Object->Size(), Object->Fg(), Object->Arc()); + DrawSlope(pos, size, Object->Fg(), Object->Arc()); break; case cxObject::progress: - DrawProgressbar(Object->Pos(), Object->Size(), Object->Current(), Object->Total(), + DrawProgressbar(pos, size, Object->Current(), Object->Total(), Object->Bg(), Object->Fg(), Object->Keep(), Object->Mark(), Object->Active(), GetMarks()); break; case cxObject::scrolltext: - DrawScrolltext(Object->Pos(), Object->Size(), Object->Fg(), Object->Text(), Object->Font(), + DrawScrolltext(pos, size, Object->Fg(), Object->Text(), Object->Font(), Object->Align()); break; case cxObject::scrollbar: - DrawScrollbar(Object->Pos(), Object->Size(), Object->Bg(), Object->Fg()); + DrawScrollbar(pos, size, Object->Bg(), Object->Fg()); case cxObject::block: for (uint i = 0; i < Object->Objects(); ++i) - DrawObject(Object->GetObject(i)); + DrawObject(Object->GetObject(i), pos, size, ListItem ); break; - case cxObject::list: { - const cxObject *item = Object->GetObject(0); - if (item && item->Type() == cxObject::item) { - txSize areasize = Object->Size(); - uint itemheight = item->Size().h; - uint maxitems = areasize.h / itemheight; - uint yoffset = 0; - bool initialEditableWidthSet = false; - - mMenuScrollbar.maxItems = maxitems; - SetMaxItems(maxitems); //Dprintf("setmaxitems %d\n", maxitems); - for (uint i = 0; i < maxitems; ++i, yoffset += itemheight) { - for (uint j = 1; j < Object->Objects(); ++j) { - const cxObject *o = Object->GetObject(j); - int maxtabs = 1; - - if (o->Display()->Type() == cxDisplay::menu) - maxtabs = cSkinDisplayMenu::MaxTabs; - - for (int t = -1; t < maxtabs; ++t) { - if (!HasTabText(i, t)) - continue; - - int thistab = GetTab(t); - int nexttab = GetTab(t + 1); - - cxObject obj(*o); - obj.SetListIndex(i, t); - if (obj.Condition() != NULL && !obj.Condition()->Evaluate()) - continue; - - obj.mPos1.x += Object->mPos1.x + (t >= 0 ? thistab : 0); - obj.mPos1.y += Object->mPos1.y + yoffset; - - // get end position - if (t >= 0 && nexttab > 0) { - // there is a "next tab".. see if it contains text - int n = t + 1; - while (n < cSkinDisplayMenu::MaxTabs && !HasTabText(i, n)) - ++n; - nexttab = GetTab(n); - } - - // set initial EditableWidth - // this is for plugins like 'extrecmenu' and 'rotor' - if ((obj.Type() == cxObject::text || obj.Type() == cxObject::marquee || obj.Type() == cxObject::blink) && !initialEditableWidthSet) { - initialEditableWidthSet = true; - SetEditableWidth(obj.Size().w); - } - - if (t >= 0 && nexttab > 0 && nexttab < obj.mPos1.x + obj.Size().w - 1) - // there is a "next tab" with text - obj.mPos2.x = Object->mPos1.x + o->mPos1.x + nexttab; - else { - // there is no "next tab", use the rightmost edge - obj.mPos2.x += Object->mPos1.x; - /* not used anymore due to change to fontOsd - but could be usefull if someone uses a differnt font - - if ((obj.Type() == cxObject::text || obj.Type() == cxObject::marquee || obj.Type() == cxObject::blink) && t == 1) { - // VDR assumes, that the font in the menu is fontOsd, - // so the EditableWidth is not necessarily correct - // for TTF - const cFont *defFont = cFont::GetFont(fontOsd); - const char *dummy = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "; - int editableWidth = obj.Size().w; - if (defFont != obj.Font()) - editableWidth = (int)(editableWidth * defFont->Width(dummy) / (1.1 * obj.Font()->Width(dummy))); - SetEditableWidth(editableWidth); - } */ - if ((obj.Type() == cxObject::text || obj.Type() == cxObject::marquee || obj.Type() == cxObject::blink) && t == 1) - SetEditableWidth(obj.Size().w); - } - - obj.mPos2.y += Object->mPos1.y + yoffset; - - std::string text = obj.Text(); - bool isprogress = false; - if (text.length() > 5 - && text[0] == '[' && text[text.length() - 1] == ']') { - const char *p = text.c_str() + 1; - isprogress = true; - for (; *p != ']'; ++p) { - if (*p != ' ' && *p != '|') { - isprogress = false; - break; - } - } - } - - if (isprogress) { - //Dprintf("detected progress bar tab\n"); - if (obj.Condition() == NULL || obj.Condition()->Evaluate()) { - int total = text.length() - 2; - int current = 0; - const char *p = text.c_str() + 1; - while (*p == '|') - (++current, ++p); - - txPoint pos = obj.Pos(); - txSize size = obj.Size(); - - DrawRectangle(txPoint(pos.x, pos.y + 4), - txSize(size.w, 2), obj.Fg()); - DrawRectangle(txPoint(pos.x, pos.y + 4), - txSize(2, size.h - 8), obj.Fg()); - DrawRectangle(txPoint(pos.x, pos.y + size.h - 6), - txSize(size.w, 2), obj.Fg()); - DrawRectangle(txPoint(pos.x + size.w - 2, pos.y + 4), - txSize(2, size.h - 8), obj.Fg()); - - pos.x += 4; - pos.y += 8; - size.w -= 8; - size.h -= 16; - DrawProgressbar(pos, size, current, total, obj.Bg(), - obj.Fg(), NULL, NULL, NULL, NULL); - } - } else - DrawObject(&obj); - } - } + case cxObject::list:{ + cxObject *item = Object->GetObject(0); + if (item && item->Type() == cxObject::item) { + txSize itemsize = item->Size(pos, size); + txPoint itempos = pos; + itemsize.w = size.w; + uint maxitems = size.h / itemsize.h; + mMenuScrollbar.maxItems = maxitems; + SetMaxItems(maxitems); //Dprintf("setmaxitems %d\n", maxitems); + uint index = 0; + + // draw list items + for (uint i = 0; i < maxitems; ++i) { + if (!HasTabText(i, -1)) + continue; + + Dbench(item); + index = i; + + itempos.y = pos.y + index * itemsize.h; + for (uint j = 1; j < Object->Objects(); ++j) { + item = Object->GetObject(j); + item->SetListIndex( index, -1 ); + DrawObject( item, itempos, itemsize, index ); } + Ddiff( "draw item", item ); } } + } break; case cxObject::item: @@ -354,6 +281,138 @@ void cText2SkinRender::DrawObject(const cxObject *Object) } } + + + + + + + +void cText2SkinRender::DrawItemText(cxObject *Object, int i, const txPoint &ListOffset, const txSize &ListSize) +{ + bool initialEditableWidthSet = false; + int maxtabs = cSkinDisplayMenu::MaxTabs; + txPoint Pos = ListOffset; + txSize BaseSize = Object->Size(ListOffset, ListSize); + txSize Size = BaseSize; + + if( !mTabScaleSet ) { + // VDR assumes, that the font in the menu is fontOsd, + // so the tab width is not necessarily correct + // for TTF + const cFont *defFont = cFont::GetFont(fontOsd); + const char *dummy = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "; + if( defFont != Object->Font() ) + mTabScale = 1.05 * (float)Object->Font()->Width(dummy) / (float)defFont->Width(dummy); + mTabScaleSet = true; + } + + // loop over tabs + for (int t = 0; t < maxtabs; ++t) { + if (!HasTabText(i, t)) + continue; + + int thistab = (int)(mTabScale * GetTab(t)); + int nexttab = (int)(mTabScale * GetTab(t + 1)); + + Object->SetListIndex(i, t); + //if (Object.Condition() != NULL && !Object.Condition()->Evaluate()) + // continue; + + // set initial EditableWidth + // this is for plugins like 'extrecmenu' and 'rotor' + if ( !initialEditableWidthSet ) { + initialEditableWidthSet = true; + SetEditableWidth((int)(Size.w / mTabScale)); + } + + // Start position of the tab + Pos.x = ListOffset.x + (t >= 0 ? thistab : 0); + + // get end position + if (t >= 0 && nexttab > 0) { + // there is a "next tab".. see if it contains text + int n = t + 1; + while (n < cSkinDisplayMenu::MaxTabs && !HasTabText(i, n)) + ++n; + nexttab = (int)(mTabScale * GetTab(n)); + } + + if (t >= 0 && nexttab > 0 && nexttab < BaseSize.w - 1) + // there is a "next tab" with text + Size.w = nexttab - thistab; + else { + // there is no "next tab", use the rightmost edge + Size.w = BaseSize.w - thistab; + if ( t == 1) + SetEditableWidth((int)(Size.w / mTabScale)); + } + + // Does the current tab contain a text-progress bar? + std::string text = Object->Text(); + bool isprogress = false; + if (text.length() > 5 && text[0] == '[' && text[text.length() - 1] == ']') { + const char *p = text.c_str() + 1; + isprogress = true; + for (; *p != ']'; ++p) { + if (*p != ' ' && *p != '|') { + isprogress = false; + break; + } + } + } + + if (isprogress) { + //Dprintf("detected progress bar tab\n"); + int total = text.length() - 2; + int current = 0; + const char *p = text.c_str() + 1; + while (*p == '|') + (++current, ++p); + + txPoint prog_pos = Pos; + txSize prog_size = Size; + + DrawRectangle(txPoint(prog_pos.x, prog_pos.y + 4), + txSize(prog_size.w, 2), Object->Fg()); + DrawRectangle(txPoint(prog_pos.x, prog_pos.y + 4), + txSize(2, prog_size.h - 8), Object->Fg()); + DrawRectangle(txPoint(prog_pos.x, prog_pos.y + prog_size.h - 6), + txSize(prog_size.w, 2), Object->Fg()); + DrawRectangle(txPoint(prog_pos.x + prog_size.w - 2, prog_pos.y + 4), + txSize(2, prog_size.h - 8), Object->Fg()); + + prog_pos.x += 4; + prog_pos.y += 8; + prog_size.w -= 8; + prog_size.h -= 16; + DrawProgressbar(prog_pos, prog_size, current, total, Object->Bg(), + Object->Fg(), NULL, NULL, NULL, NULL); + } else { + switch (Object->Type()) { + case cxObject::text: + DrawText(Pos, Size, Object->Fg(), Object->Text(), Object->Font(), + Object->Align()); + break; + + case cxObject::marquee: + DrawMarquee(Pos, Size, Object->Fg(), Object->Text(), Object->Font(), + Object->Align(), Object->Delay(), Object->Index()); + break; + + case cxObject::blink: + DrawBlink(Pos, Size, Object->Fg(), Object->Bg(), Object->Text(), + Object->Font(), Object->Align(), Object->Delay(), Object->Index()); + break; + default: + break; + } + + } + } +} + + void cText2SkinRender::DrawImage(const txPoint &Pos, const txSize &Size, const tColor *Bg, const tColor *Fg, const tColor *Mask, int Alpha, int Colors, const std::string &Path) @@ -27,6 +27,7 @@ class cText2SkinRender: public cThread { friend class cText2SkinDisplayReplay; friend class cText2SkinDisplayMessage; friend class cText2SkinDisplayMenu; + friend class cText2SkinDisplayTracks; friend class cText2SkinStatus; @@ -75,6 +76,10 @@ private: }; typedef std::map<uint,tState> tStates; tStates mStates; + + // scalefactor for tabs in the menu list + float mTabScale; + bool mTabScaleSet; protected: // Update thread @@ -83,7 +88,11 @@ protected: virtual void Action(void); // Drawing operations - void DrawObject(const cxObject *Object); + void DrawObject(cxObject *Object, const txPoint &BaseOffset=txPoint(-1,-1), + const txSize &BaseSize=txSize(-1,-1), + int ListItem=-1 ); + void DrawItemText(cxObject *o, int i, const txPoint &ListOffset, const txSize &ListSize); + void DrawBackground(const txPoint &Pos, const txSize &Size, const tColor *Bg, const tColor *Fg, int Alpha, const std::string &Path); void DrawImage(const txPoint &Pos, const txSize &Size, const tColor *Bg, const tColor *Fg, diff --git a/xml/display.h b/xml/display.h index 319cc7e..a9b2080 100644 --- a/xml/display.h +++ b/xml/display.h @@ -48,7 +48,7 @@ public: cxSkin *Skin(void) const { return mSkin; } uint Objects(void) const { return mObjects.size(); } - const cxObject *GetObject(int n) const { return mObjects[n]; } + cxObject *GetObject(int n) const { return mObjects[n]; } }; class cxDisplays: public std::map<cxDisplay::eType,cxDisplay*> { diff --git a/xml/object.c b/xml/object.c index c63c2ea..81dc854 100644 --- a/xml/object.c +++ b/xml/object.c @@ -155,18 +155,25 @@ const cFont *cxObject::Font(void) const return cFont::GetFont(fontOsd); } -txPoint cxObject::Pos(void) const +txPoint cxObject::Pos(const txPoint &BaseOffset, const txSize &BaseSize) const { - return txPoint(mSkin->BaseOffset().x + (mPos1.x < 0 ? Skin()->BaseSize().w + mPos1.x : mPos1.x), - mSkin->BaseOffset().y + (mPos1.y < 0 ? Skin()->BaseSize().h + mPos1.y : mPos1.y)); + txPoint bOffset = BaseOffset.x < 0 ? mSkin->BaseOffset() : BaseOffset; + txSize bSize = BaseSize.w < 0 ? mSkin->BaseSize() : BaseSize; + + return txPoint(bOffset.x + (mPos1.x < 0 ? bSize.w + mPos1.x : mPos1.x), + bOffset.y + (mPos1.y < 0 ? bSize.h + mPos1.y : mPos1.y)); } -txSize cxObject::Size(void) const +txSize cxObject::Size(const txPoint &BaseOffset, const txSize &BaseSize) const { - txPoint p1(mSkin->BaseOffset().x + (mPos1.x < 0 ? Skin()->BaseSize().w + mPos1.x : mPos1.x), - mSkin->BaseOffset().y + (mPos1.y < 0 ? Skin()->BaseSize().h + mPos1.y : mPos1.y)); - txPoint p2(mSkin->BaseOffset().x + (mPos2.x < 0 ? Skin()->BaseSize().w + mPos2.x : mPos2.x), - mSkin->BaseOffset().y + (mPos2.y < 0 ? Skin()->BaseSize().h + mPos2.y : mPos2.y)); + txPoint bOffset = BaseOffset.x < 0 ? mSkin->BaseOffset() : BaseOffset; + txSize bSize = BaseSize.w < 0 ? mSkin->BaseSize() : BaseSize; + + txPoint p1(bOffset.x + (mPos1.x < 0 ? bSize.w + mPos1.x : mPos1.x), + bOffset.y + (mPos1.y < 0 ? bSize.h + mPos1.y : mPos1.y)); + txPoint p2(bOffset.x + (mPos2.x < 0 ? bSize.w + mPos2.x : mPos2.x), + bOffset.y + (mPos2.y < 0 ? bSize.h + mPos2.y : mPos2.y)); + return txSize(p2.x - p1.x + 1, p2.y - p1.y + 1); } diff --git a/xml/object.h b/xml/object.h index bbc37a0..603019f 100644 --- a/xml/object.h +++ b/xml/object.h @@ -61,7 +61,7 @@ public: item, #define __COUNT_OBJECT__ (item + 1) }; - + private: cxDisplay *mDisplay; cxSkin *mSkin; @@ -118,8 +118,8 @@ public: cxSkin *Skin(void) const { return mSkin; } const std::string &TypeName(void) const; - txPoint Pos(void) const; - txSize Size(void) const; + txPoint Pos(const txPoint &BaseOffset=txPoint(-1,-1), const txSize &BaseSize=txSize(-1,-1)) const; + txSize Size(const txPoint &BaseOffset=txPoint(-1,-1), const txSize &BaseSize=txSize(-1,-1)) const; const cFont *Font(void) const; const tColor *Fg(void) const; const tColor *Bg(void) const; @@ -129,7 +129,7 @@ public: const tColor *Keep(void) const; uint Objects(void) const; - const cxObject *GetObject(uint Index) const; + cxObject *GetObject(uint Index) const; }; class cxObjects: public std::vector<cxObject*> { @@ -144,7 +144,7 @@ inline uint cxObject::Objects(void) const return mObjects ? mObjects->size() : 0; } -inline const cxObject *cxObject::GetObject(uint Index) const +inline cxObject *cxObject::GetObject(uint Index) const { return mObjects ? (*mObjects)[Index] : NULL; } |