Reconstructing a wxAuiNotebook layout

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
sparhawk
Experienced Solver
Experienced Solver
Posts: 81
Joined: Tue May 21, 2013 8:08 am

Re: Reconstructing a wxAuiNotebook layout

Post by sparhawk »

So I have now implemented a de-/serialize function for the wxAuiNotebook. However, I have to do some changes in the wxAuiNotebook class as well, because it has several bugs in the Split() function. I'm going to add this now to the wxWidgets library.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Reconstructing a wxAuiNotebook layout

Post by ONEEYEMAN »

Hi
The easiest way is to submit the PR at github.com/wxwidgets/wxwidgets.git

Thank you.
sparhawk
Experienced Solver
Experienced Solver
Posts: 81
Joined: Tue May 21, 2013 8:08 am

Re: Reconstructing a wxAuiNotebook layout

Post by sparhawk »

ONEEYEMAN wrote: Sat Mar 20, 2021 2:01 pm The easiest way is to submit the PR at github.com/wxwidgets/wxwidgets.git
Yes, that's what I currently working on. :)
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Reconstructing a wxAuiNotebook layout

Post by ONEEYEMAN »

Hi,
Let us know if you need help doing that. 😀

Thank you.
sparhawk
Experienced Solver
Experienced Solver
Posts: 81
Joined: Tue May 21, 2013 8:08 am

Re: Reconstructing a wxAuiNotebook layout

Post by sparhawk »

After spending so much time with this, I decided to drop it. I thought I'm close to finish, but the deeper I look the more problems I find. The wxAui doesn't provide any usefull interface for giving the programmer control, and I tried to implement soe missing stuff, but when I investigated it, I noticed that there are many problems that are so deep that I would have to refactor much more then I wanted to spend time on.
So I will keep my extension in the state as it is, and continue work on my actual project. I was thinking about implementing my own docking system, but this takes a lot of time, so I rather focus on my main goal first and visit this issue again after that.
If I'm lucky, there is an update, and if not, I still can create a new docking handling later on.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Reconstructing a wxAuiNotebook layout

Post by ONEEYEMAN »

Hi,
Good luck with that. Hopefully you will be able to create something better.

At one point of time Vadim (main wx developer) expressed regret for including AUI in the main wx tree, because as soon as it happened Kyrix (who developed it) dropped support for it and all those tickets made against it are now in limbo.

There was a competitor and the decision had to be made. wx went with AUI code and Kyrix dropped support almost immediately. I think by now the main developer left Kyrix Software and so they won't do anything about it. Any request - they say "Talk to wxWidgets team".

But at this point it is too late to do anything about it - a lot of projects depend on the wxAUI. ;(

Thank you.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Reconstructing a wxAuiNotebook layout

Post by PB »

There was an attempt to improve the notebook:
https://trac.wxwidgets.org/ticket/14756

It was worked on for many years, IIRC by several people.

However, it was never finished. One of the biggest complications was maintaining backwards compatibility.

As (many) people are reluctant to upgrade a library when its part basically stops working and they would have spend a lot of time adapting their code instead of working what they deem important on their product.
User avatar
doublemax
Moderator
Moderator
Posts: 19159
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Reconstructing a wxAuiNotebook layout

Post by doublemax »

They should just have renamed all classes and put in a separate library.
Use the source, Luke!
sparhawk
Experienced Solver
Experienced Solver
Posts: 81
Joined: Tue May 21, 2013 8:08 am

Re: Reconstructing a wxAuiNotebook layout

Post by sparhawk »

I can understand that people don't want to upgrade if it is a lot of effort. However, I have the feeling that the current code is not very well suited for a general purpose library like wxWidgets, because it doesn't give the programmer enough flexibillity.
When I look at the code, I can see that even the original developers seemed to work around that. An example: In the wxAuiNotebook, we have a function Split() which is supposed to split in a given direction. I thought that this coiuld be used to recreate the layout and I was almost done with it. But when I got into the details, I realized that this function doesn't have an interface how to achieve this, because there exists no such interface. The user can do it with the mouse (more or less) but you can't code it. So what they did is simulating a mouse press by using coordinates (that the mouse would have produced) to achieve this effect. Really? That's pretty bad design IMO.
However, when I found some wrong behavior I started to investigate the manager a bit more, and realized that it can not even reliably do what the current interface suggests. You simply can not split to the left a single cell, because it always goes somewhere else, where you don't really expect it to. So it works more or less from the user perspective, but you have almost no control as a developer without a big refactoring, which certainly will break existing code, which in turn means probably that such a change wouldn't be accepted.

I was expecting something like this already, when I first looked at the code, because for such a class, there are way to little internal functions. The wxAuiNotebook has a rather small number of functions which are way to big because they do to much in a single function. Which is a major sign, that it lacks functionality for a general purpose library. The same goes for the wxAuiManager class.

Not sure how to proceed. I was thinking about several approaches how to implement such a functionality from scratch, but this is a lot of work, which distracts me from the my real project. So maybe I will look into it, but I don't know how long this will take. I thought about starting with a splitter and see how far I can go with that. My initial thought was to base it on a gridbagsizer, because the functionality is pretty similar, but I'm not sure if the sizer offers enough control, as it has a different purpose. I will definitely look into it if this would be a good starting point, but this all will take time.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Reconstructing a wxAuiNotebook layout

Post by PB »

doublemax wrote: Mon Mar 22, 2021 8:55 pm They should just have renamed all classes and put in a separate library.
IIRC, there were also a lot of unresolved bugs, and not just small visual glitches but hard crashes.

IMO, writing a docking library working on all wxWidgets platforms would be quite a challenge. I also do not think that extending a sizer for this would be the best option.
sparhawk
Experienced Solver
Experienced Solver
Posts: 81
Joined: Tue May 21, 2013 8:08 am

Re: Reconstructing a wxAuiNotebook layout

Post by sparhawk »

PB wrote: Tue Mar 23, 2021 8:05 am IMO, writing a docking library working on all wxWidgets platforms would be quite a challenge. I also do not think that extending a sizer for this would be the best option.
Well, I don't intend to write it on all platforms. :? My primary target is Windows, which I'm currently working on now. You were right, that a sizer is not such a good idea after all. I started basing it on splitters right now and I'm experimenting with it. With my current approach, I hope that it natively integrates into wxWidgets.
sparhawk
Experienced Solver
Experienced Solver
Posts: 81
Joined: Tue May 21, 2013 8:08 am

Re: Reconstructing a wxAuiNotebook layout

Post by sparhawk »

Just to give an update to this thread, I started to write my own docking module after this discussion. I wanted something like that for more than ten years and always thought it to hard to do. If I had known that it's not such a big deal after all, I would have done it much earlier.:)

Well, so far I already have an API which can be used to create and deconstruct a layout, and right now I'm working on the mouse controls. I already have a limited prototype working, and I hope to get some first version soon. However, I don't work all the time on it, so it still may take a while to finish.

So far my module uses only stock wxWidgets objects, so I would expect it to work on all platforms supported by wxWidgets. From the client code, it should basically work without any changes, except to replace the main frame by the new wxDockingFrame.
Post Reply