Author Topic: wxFlatNotebook update + Patch  (Read 21180 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
wxFlatNotebook update + Patch
« on: May 05, 2006, 08:31:21 am »
Dear devs,
since I'm using wxFlatNotebook in a project myself I realised that C::B uses a rather old version (0.90) of the library. I've updated my C::B to the current version (1.30) for quite some time now and I've also adopted the patch for C::B to the new version which I provide with this message.
So basically I'd like to say: On my machine wxFlatNotebook v1.30 works very well, the required patch is attached.
With regards, Morten.
Edit: Removed patch to save forum space. It has been applied already.
« Last Edit: May 10, 2006, 11:02:42 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxFlatNotebook update + Patch
« Reply #1 on: May 05, 2006, 09:36:58 am »
Could you provide another patch please? :)

I tried applying this one with TortoiseMerge, which did not work.
Then I tried gnu patch, and all I got was:
patch: **** Only garbage was found in the patch input.
Editing patchfiles by hand is nasty business, especially when there are several files with several chunks each.

Just cd to the wxFlatNotebook folder and type svn diff > patchname.patch, that works out fine (or even easier, right-click onto the folder if you have Tortoise installed, and select "create patch").
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: wxFlatNotebook update + Patch
« Reply #2 on: May 05, 2006, 11:13:22 am »
Could you provide another patch please? :)
Well, I guess I didn't made myself clear enough. The patch is not to be applied to the sources of C::B. This patch has to be applied to the sources of wxFlatNotebook, version 1.30. So to update C::B you would have to do the following:
1.) Download wxFlatNotebook v1.30
2.) Copy the sources into C::B overwriting the onces there (which are v0.90)
3.) Apply my patch to these sources.
Why did I do this? Because that's the way how the patch for v0.90 is provided in C::B SVN.
If I provide a file to patch the sources fom C::B SVN (v0.90) directly to v1.30_patched that this would be a huge file and noone could understand what changes actually were made to the original v1.30 version.
With regards, Morten.

Edit: Of course I could do that, too... give me some time... ;-)
« Last Edit: May 05, 2006, 11:15:53 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: wxFlatNotebook update + Patch
« Reply #3 on: May 05, 2006, 11:28:32 am »
...here it comes: This patch should update the current SVN head to wxFlatNotebook v1.30_patched. This will also update the patch file so that in the end C::B is updated to v1.30, patched and the C::B patch from SVN is updated accordingly. This also updates the readme files in wxFlatNoteBook.
With regards, Morten.
Edit: Removed patch to save forum space. It has been applied already.
« Last Edit: May 10, 2006, 11:03:02 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxFlatNotebook update + Patch
« Reply #4 on: May 05, 2006, 12:26:03 pm »
Applies cleanly, and works fine under Windows, thanks.

Let's see what the Don finds out under Linux :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline tiger683

  • Multiple posting newcomer
  • *
  • Posts: 20
  • o_0
Re: wxFlatNotebook update + Patch
« Reply #5 on: May 05, 2006, 12:54:09 pm »
It fixed a nasty bug for me, when accidentally dragging a notebook-panel or a marked text itself inside the notebook area
would freeze the mouse pointer on button-release (could move it, but rendering it unable to click anything, even outside C::B window) :D
Thanks!

EDIT: It's gentoo Linux unicode build, wxGTK 2.6.3_p2, C::B revision 2411, gcc-4.1/glibc-2.4
« Last Edit: May 05, 2006, 01:01:08 pm by tiger683 »
Where I work :P

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxFlatNotebook update + Patch
« Reply #6 on: May 05, 2006, 01:04:37 pm »
Update: It does not work so nicely after all.  :(
When closing the application without having a project open, I get a null pointer exception...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxFlatNotebook update + Patch
« Reply #7 on: May 05, 2006, 01:22:01 pm »
The reason for this is that EditorManager destroys its notebook page on exit. wxFNB 1.3 destroys the notebook page again, which causes the crash.

The modification for EditorManager is in svn.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline tiger683

  • Multiple posting newcomer
  • *
  • Posts: 20
  • o_0
Re: wxFlatNotebook update + Patch
« Reply #8 on: May 05, 2006, 01:59:47 pm »
The modification for EditorManager is in svn.

Thanks!  :D

Didn't notice since the "Something went wrong inside C::B" window disappeared so fast
Where I work :P

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: wxFlatNotebook update + Patch
« Reply #9 on: May 05, 2006, 02:16:25 pm »
When closing the application without having a project open, I get a null pointer exception...
I obvoisly never did that... which is surpising me... :shock: - but I can confirm this issue. It also happens when you just close the start page after a fresh startup of C::B.
The modification for EditorManager is in svn.
Luckily I can confirm this, too. Thanks, Thomas!
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5514
Re: wxFlatNotebook update + Patch
« Reply #10 on: May 05, 2006, 03:23:36 pm »
editormanager adjust is in svn, should wxFNB also not be updated then in svn ?
We might have a leak without the destroy and the old wxFNB ?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: wxFlatNotebook update + Patch
« Reply #11 on: May 05, 2006, 03:25:48 pm »
editormanager adjust is in svn, should wxFNB also not be updated then in svn ?

Not until I test it under Linux...

We might have a leak without the destroy and the old wxFNB ?

We can live with it for a few hours, I guess ;)
Be patient!
This bug will be fixed soon...

sethjackson

  • Guest
Re: wxFlatNotebook update + Patch
« Reply #12 on: May 05, 2006, 05:41:04 pm »
Umm wouldn't this be more appropriate in the EditorManager destructor?

Code: cpp
if (m_pNotebook)
    m_pNotebook->Destroy();

Please pardon my ignorance if this is bad code......  :lol:

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: wxFlatNotebook update + Patch
« Reply #13 on: May 05, 2006, 06:13:24 pm »
If I understand thomas correctly this would not solve the problem because the editormagager would destroy the notebook as the pointer is valid (and it should be valid as the old line didn't crash) and *after that* wxFND would try to destroy this notebook again and this will crash - no matter if you check the m_pNotebook pointer in editormanager or not.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: wxFlatNotebook update + Patch
« Reply #14 on: May 05, 2006, 06:20:08 pm »
Also it's totaly legal to "delete" a null pointer. All the problems arise from the fact that including myself many forget to set the pointer to null after deletion.
From: http://www.cplusplus.com/doc/tutorial/dynamic.html
Quote
The value passed as argument to delete must be either a pointer to a memory block previously allocated with new, or a null pointer (in the case of a null pointer, delete produces no effect).
Life would be so much easier if we could just look at the source code.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: wxFlatNotebook update + Patch
« Reply #15 on: May 05, 2006, 06:22:10 pm »
As I expected, the patch doesn't work correctly. That's why I wanted to test it myself.
Steps to reproduce the bug:

1) Right-click on "Build messages".
2) Select "Show/hide->Build log".

The build log hides.

3) Right-click on "Build messages".
4) Select "Show/hide->Build log".

The build log shows again and, seemingly, gets the focus. But still the "Build messages" is displayed.

5) Left-click on "Build messages" and enjoy.
Be patient!
This bug will be fixed soon...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxFlatNotebook update + Patch
« Reply #16 on: May 05, 2006, 07:26:24 pm »
Also it's totaly legal to "delete" a null pointer. All the problems arise from the fact that including myself many forget to set the pointer to null after deletion.
Right. Actually everybody should use something like this all the time:
Code
template<typename T> void Delete(T *p) {delete p; p = 0;};

Hmm... I really wonder why nobody does that. Something must be fundamentally wrong with this, that would be just too simple...  :?:

One could use reference counted smart pointers to avoid above problem, too, of course.
If fact, I believe an object having a Destroy() function should necessarily be reference counted - if it only wraps around a plain normal delete, then it is actually not of much use to have such a function.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: wxFlatNotebook update + Patch
« Reply #17 on: May 05, 2006, 08:04:52 pm »
...Something must be fundamentally wrong with this, that would be just too simple...  :?:
Well there is http://public.research.att.com/~bs/bs_faq2.html#delete-zero but still deleting and setting to 0 should cover 99.99% of the cases.
Life would be so much easier if we could just look at the source code.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: wxFlatNotebook update + Patch
« Reply #18 on: May 06, 2006, 05:33:53 pm »
Steps to reproduce the bug:
...confirmed. But: How strange is that? I don't even understand what's happening (to be honest) - where is this space coming from suddenly? :shock:
Anyway: I expected that testing is required - that's why I did not file a patch to BerliOS in the first place. Forgive me, but for my "daily work" it really works properly. But I have to admit that the only thing I'm closing/opening are code files - the lower layout I keep as it is normally.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: wxFlatNotebook update + Patch
« Reply #19 on: May 06, 2006, 11:19:04 pm »
...alright, I've tried to track down this issue nearly the whole day without success. In my humble opinion this is a very weird bug and from the changes done from 0.90 to 1.30 I really don't understand why and where this bug was introduced. Anyway, I'm not an expert in wxWidgets which makes things for me even worse. If anybody could at least give me a hint... that would be really helpful. I'm closing for today (tonight ;-)), maybe I seee more clear tomorrow... :|
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: wxFlatNotebook update + Patch
« Reply #20 on: May 07, 2006, 11:18:23 am »
As I expected, the patch doesn't work correctly. That's why I wanted to test it myself.
mandrav: Correct me, if I'm wrong, but could it be that this bug also appears in the nightlys? Starting from v0.90 (C::B pathhed as from SVN) I tried to apply the changes done up to revision 1.30 to see when the issue appears. But when I compiled C::B again using the SVN version the bug did already appear. I thought it might have been a missing deletion of any file, did a re-build... again. Then I downloaded the latest nightly available and renamed "my" C::B folder. But when I run the nightly and do the steps you described the same thing happens. Are you aware of that?
If so I got you wrong because I thought this issue was introduced somewhere in between v0.90 and v1.30...?!
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

PChris

  • Guest
Re: wxFlatNotebook update + Patch
« Reply #21 on: May 07, 2006, 11:29:11 am »
As I expected, the patch doesn't work correctly. That's why I wanted to test it myself.
mandrav: Correct me, if I'm wrong, but could it be that this bug also appears in the nightlys? Starting from v0.90 (C::B pathhed as from SVN) I tried to apply the changes done up to revision 1.30 to see when the issue appears. But when I compiled C::B again using the SVN version the bug did already appear. I thought it might have been a missing deletion of any file, did a re-build... again. Then I downloaded the latest nightly available and renamed "my" C::B folder. But when I run the nightly and do the steps you described the same thing happens. Are you aware of that?
If so I got you wrong because I thought this issue was introduced somewhere in between v0.90 and v1.30...?!
With regards, Morten.
I can confirm this too...
This bug is also present on the old version.

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: wxFlatNotebook update + Patch
« Reply #22 on: May 07, 2006, 11:31:37 am »
Confirmed even on Linux. Revision 2417, compiled with gcc 3.4.5 and wxGTK 2.6.2 (unicode).
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline TheTuxKeeper

  • Regular
  • ***
  • Posts: 293
  • daniel2000
Re: wxFlatNotebook update + Patch
« Reply #23 on: May 07, 2006, 12:12:56 pm »
Same with rev2411 on Fedora (wxGTK 2.6.2 unicode + gcc 4.02). If you repeat these steps more than once the space is getting few pixels larger with each repetition of these steps until only few pixels of the headline are visible. Even the vertical scrollbar is gone  :shock:

I forgot to save the last screenshot, but this one is only few times before the space isn't getting bigger anymore.
Nightly builds for openSUSE

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: wxFlatNotebook update + Patch
« Reply #24 on: May 07, 2006, 12:36:21 pm »
I'm not quite sure what behaviour is intended. But this problem can be fixed with this little patch:
Code
Index: src/sdk/messagemanager.cpp
===================================================================
--- src/sdk/messagemanager.cpp  (revision 2417)
+++ src/sdk/messagemanager.cpp  (working copy)
@@ -332,7 +332,7 @@
     if (show && !ls->visible)
     {
         // show
-        m_pNotebook->InsertPage(id, log, ls->title, false);
+        m_pNotebook->InsertPage(id, log, ls->title, true);
 
         SetLogImage(id, ls->bitmap);
         ls->visible = true;
This way the tab that will be shown again gets selected. I think this is not the originally intended behaviour but it at least works without the problem described here.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxFlatNotebook update + Patch
« Reply #25 on: May 07, 2006, 02:54:29 pm »
Is "selected" synonymous to "given focus"?

I guess if "selected" only means "becomes topmost tab" then it is quite harmless (and even intuitive).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: wxFlatNotebook update + Patch
« Reply #26 on: May 07, 2006, 04:33:07 pm »
Yes, it has the focus, it is displayed and is the topmost tab. Whether this is intuitive or not is another question. I would even prefer that the tab that was selected before stays selected and the "new one" is only placed between the other inactive tabs. I guess that was the originally intended behaviour.
But with a quick look at the roadmap I would say we should apply this little patch (even if the behaviour is not as intuitive than before - that is my opionion, maybe the others think different) as a workaround for this problem rather than spending hours or even days on searching and fixing the real problem.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: wxFlatNotebook update + Patch
« Reply #27 on: May 08, 2006, 10:36:21 pm »
HEAD updated to wxFNB 1.30.
Be patient!
This bug will be fixed soon...

sethjackson

  • Guest
Re: wxFlatNotebook update + Patch
« Reply #28 on: May 08, 2006, 10:40:44 pm »
HEAD updated to wxFNB 1.30.

Yay!  8)

Aww bugs.... :P

Do this.

1. Right click on a messages tab.
2. Show/Hide a visible tab.
3. Show/Hide the same tab (making it visible).
4. Not good. :P

Fix.

Code: diff
Index: src/sdk/messagemanager.cpp
===================================================================
--- src/sdk/messagemanager.cpp (revision 2421)
+++ src/sdk/messagemanager.cpp (working copy)
@@ -337,8 +337,6 @@
         SetLogImage(id, ls->bitmap);
         ls->visible = true;
 
-        log->Show(false);
-
         if (id == m_DebugLog)
             cfg->Write(_T("/has_debug_log"), (bool)true);
     }
@@ -350,8 +348,6 @@
             m_pNotebook->RemovePage(id);
         ls->visible = false;
 
-        log->Show(false);
-
         if (id == m_DebugLog)
             cfg->Write(_T("/has_debug_log"), (bool)false);
     }


Posted to the tracker.

https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1038&group_id=5358
« Last Edit: May 08, 2006, 10:57:20 pm by sethjackson »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: wxFlatNotebook update + Patch
« Reply #29 on: May 09, 2006, 11:20:27 am »
Well... there is something wrong with how this is applied in SVN. Currently the cb_wxfn.patch holds the patch how to update the C::B sources to wxFlatNotebook 1.30-patched. My intention was to provide the patch how to change the original wxFNB sources (v1.30) to the way they are used in SVN.
I've attached a patch to this post (to be applied to the SVN sources) that will:
1.) Update the cb_wxfn.patch file to really have the changes applied within C::B in comparision to wxFNB v1.30
2.) Update the readme file
3.) Apply one minor change to wxFlatNotebook I've missed
With regards, Morten.
Edit: Removed patch to save forum space. It has been applied already.
« Last Edit: May 10, 2006, 11:03:32 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: wxFlatNotebook update + Patch
« Reply #30 on: May 09, 2006, 01:43:13 pm »
Thanks, commited.
Be patient!
This bug will be fixed soon...