News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

wxFlatNotebook 2.2

Started by killerbot, July 23, 2007, 07:29:54 PM

Previous topic - Next topic

SharkCZ

Quote from: stahta01 on July 30, 2007, 03:18:10 AM
Since wxFlatNotebook 2.2 requires wxWidgets 2.8, have we dropped support for using 2.6 to build C::B?
I wish to verify before updating some patches.

It looks like that wxFlatNotebook can be compiled on wxGTK 2.6 when you change the Contains(wxPoint) method of wxRect back to Inside(wxPoint) - 6 occurences in wxFlatNotebook.cpp
Code::Blocks package maintainer for Fedora and EPEL

SharkCZ

Quote from: Der Meister on July 31, 2007, 08:26:08 PM
In wxWidgets 2.8 the wxRect class got an additional member-function: wxRect::Contains. wxFNB 2.2 uses this function and therefore does not build with wxWidgets 2.6 anymore.

Contains() from wx2.8 == Inside() from wx2.6, there is an compatibility #define in the code of wx2.8 (gdicmn.h)
Code::Blocks package maintainer for Fedora and EPEL

killerbot

Quote from: SharkCZ on July 31, 2007, 08:28:36 PM
Quote from: Der Meister on July 31, 2007, 08:26:08 PM
In wxWidgets 2.8 the wxRect class got an additional member-function: wxRect::Contains. wxFNB 2.2 uses this function and therefore does not build with wxWidgets 2.6 anymore.

Contains() from wx2.8 == Inside() from wx2.6, there is an compatibility #define in the code of wx2.8 (gdicmn.h)
meaning it should build on wx26 ?

SharkCZ

Quote from: killerbot on July 31, 2007, 08:44:18 PM
Quote from: SharkCZ on July 31, 2007, 08:28:36 PM
Quote from: Der Meister on July 31, 2007, 08:26:08 PM
In wxWidgets 2.8 the wxRect class got an additional member-function: wxRect::Contains. wxFNB 2.2 uses this function and therefore does not build with wxWidgets 2.6 anymore.

Contains() from wx2.8 == Inside() from wx2.6, there is an compatibility #define in the code of wx2.8 (gdicmn.h)
meaning it should build on wx26 ?

Sure, I have just built it.
Code::Blocks package maintainer for Fedora and EPEL

killerbot

so although we do not support wx26x (officially anymore : more or less) : it still works ;-)

SharkCZ

The patch is here

Index: wxFlatNotebook.cpp
===================================================================
--- wxFlatNotebook.cpp (revision 4338)
+++ wxFlatNotebook.cpp (working copy)
@@ -1122,7 +1122,11 @@
}

rect = wxRect(btnXPos, 8, 16, 16);
+#if wxCHECK_VERSION(2, 8, 0)
if(rect.Contains(pt))
+#else
+ if(rect.Inside(pt))
+#endif
{
return (style & wxFNB_NO_X_BUTTON) ? wxFNB_NOWHERE : wxFNB_X;
}
@@ -1131,18 +1135,30 @@
if( style & wxFNB_DROPDOWN_TABS_LIST )
{
rect = wxRect(render->GetDropArrowButtonPos( this ), 8, 16, 16);
+#if wxCHECK_VERSION(2, 8, 0)
if( rect.Contains(pt) )
+#else
+ if( rect.Inside(pt) )
+#endif
return wxFNB_DROP_DOWN_ARROW;
}

+#if wxCHECK_VERSION(2, 8, 0)
if(rect.Contains(pt))
+#else
+ if(rect.Inside(pt))
+#endif
{
return (style & wxFNB_NO_NAV_BUTTONS) ? wxFNB_NOWHERE : wxFNB_RIGHT_ARROW;
}


rect = wxRect(btnLeftPos, 8, 16, 16);
+#if wxCHECK_VERSION(2, 8, 0)
if(rect.Contains(pt))
+#else
+ if(rect.Inside(pt))
+#endif
{
return (style & wxFNB_NO_NAV_BUTTONS) ? wxFNB_NOWHERE : wxFNB_LEFT_ARROW;
}
@@ -1159,7 +1175,11 @@
if(style & wxFNB_X_ON_TAB && (int)cur == GetSelection())
{
// 'x' button exists on a tab
+#if wxCHECK_VERSION(2, 8, 0)
if(m_pagesInfoVec[cur].GetXRect().Contains(pt))
+#else
+ if(m_pagesInfoVec[cur].GetXRect().Inside(pt))
+#endif
{
pageInfo = pgInfo;
tabIdx = (int)cur;
@@ -1187,7 +1207,11 @@

wxRect tabRect = wxRect(pgInfo.GetPosition().x, pgInfo.GetPosition().y,
pgInfo.GetSize().x, pgInfo.GetSize().y);
+#if wxCHECK_VERSION(2, 8, 0)
if(tabRect.Contains(pt))
+#else
+ if(tabRect.Inside(pt))
+#endif
{
// We have a match
pageInfo = pgInfo;

Code::Blocks package maintainer for Fedora and EPEL

killerbot

so it does not build without manual patch. I prefer to not to apply this patch, so our sources are the same as eranif's. Unless he would do a similar thing, but my opinion : wx26 is old ....

SharkCZ

Quote from: killerbot on July 31, 2007, 09:09:46 PM
so it does not build without manual patch. I prefer to not to apply this patch, so our sources are the same as eranif's. Unless he would do a similar thing, but my opinion : wx26 is old ....

I agree, it was published only for "archive" purposes. And I will use it locally for official FC-6 builds during then next few months until the Fedora 8 is published.
Code::Blocks package maintainer for Fedora and EPEL

eranif

I fixed this portability issue with 2.6.x in SVN
wxFlatNotebook.cpp:
static bool InsideRect(const wxRect &rect, const wxPoint &pt)
{
#if wxCHECK_VERSION(2, 8, 0)
return rect.Contains(pt);
#else
return rect.Inside(pt);
#endif
}


and replaced all calls for wxRect::Contains to it.
I dont have 2.6 - but I think it should compile now (can anyone confirm this?)

Eran

killerbot

I will upgrade our sources tomorrow accordingly