When dragging the tabs of a wxAuiNotebook into a split state, multiple behaviours are possible:
A. There is only one pane (ie, no split), the new pane will take up half of the total width. The old pane shrinks to take the remaining half.
B. There are multiple panes, the new pane will take up a small amount of width. The rightmost pane shrinks enough to allow this. If the rightmost pane is not large enough, the one to the left of it will also shrink, etc.
C. There are multiple panes, the new pane will take up the same amount of width as the destination pane. Existing panes shrink like (B) above.
The above is mostly okay, but there are unexpected details:
1. If the rightmost pane is not large enough to yield sufficient space, it gets resized to zero. The user might think they lost their tabs. Ideally, there should be some minimum size (perhaps configurable).
1a. If then one starts resizing a pane, suddenly things snap into a new arrangement of widths. Perhaps the widths are calculated differently in multiple places? In some cases the result is reminiscent of behaviour (A), so maybe there is overlap with that too?
2. It is not intuitive to me why some drag destinations allow only behaviour (B), others allow only (C), and still others allow both (B) and (C).
2a. I'm not sure if behaviour (C) can make sense if the destination is larger than 50%. Currently it is allowed regardless.
3. Behaviour (A) seems generally useful: perhaps it should be possible to split a pane halfway even if there are multiple ones already.
Here is a screen capture showing some of the above:
https://github.com/user-attachments/assets/d312ee95-28b6-4a43-a999-a9a6565eac37
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for reporting this, the problem (1) is indeed pretty bad so I'll fix at least this.
For the rest, I'm not really sure what the correct/best behaviour would be. Do you already know this, by chance, e.g. do we have anything (MSVS, VS Code, ...) to compare with?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
the problem (1) is indeed pretty bad so I'll fix at least this
Yeah, (1) is what one of my users actually stumbled on. The rest is what I saw while reproducing their report.
do we have anything (MSVS, VS Code, ...) to compare with?
I briefly checked MSVS, VSCode, and IntelliJ. Here is what I saw:
So it seems like they all do different things.
I can see advantages and disadvantages in each of them:
Note also that none of these apps allow the user to choose between two different behaviours for the same operation, like wx does with the modes (B) and (C) that I described originally. Overall, I feel like the extra flexibility allowed by wx is a good thing, but it should be more intuitive and consistent. For example, the two modes could be to either take global space contributed by all panes, or to take half of the destination pane.
Other people might have different opinions.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I've spent a lot of time on this but I just don't know how to fix this without major changes in wxAUI :-(
I can improve the code determining the new pane size, e.g. it's simple to do something like IntelliJ and just divide the size by 2 for every new pane — and this definitely works better than the current code in practice, although I suspect there may be some cases when it's not very intuitive because the panes are not arranged into a grid and we could have some weird layouts when the new split is much smaller than you might expect.
But this is not the worst problem. The real problem is that currently in wxAUI:
Note that both are problems at wxAUI level and are not specific to wxAuiNotebook, they can just be seen much more easily with it as new panes can be created interactively.
So whatever size we use for the new split, sooner or later (and, in practice, pretty soon), you can create enough new panes to make one of them completely invisible. And hence we need to fix these problems, but wxAUI layout relies on using sizers with manually set minimum sizes for the sizers containing docks (not panes) and the code in wxBoxSizer trying to ensure that as many items as possible are visible even when there is not enough space for all of them doesn't work when item min size (and not best size) is explicitly set.
I'm afraid I'm going to have to abandon the idea of fixing this before 3.3.2 because there are several other things to do it before it as well and I still have no idea how to do this, which is a pretty good indicator that it will take me a lot of time to finish it... I'll sleep on this and hope that maybe I have some bright idea tomorrow, but right now I think I'll push just the code improving the new split size calculation, but it will do nothing to fix the problem (1).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Unfortunate that the AUI code is inflexible in this regard, but understandable. No worries.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
This has taken a very long time because I hoped to find a better solution but, finally, I've convinced myself that the very simple approach of #26233 is not that bad — and definitely better than nothing, so I'd like to merge it before the release.
Please test this PR until we make it if you can (sorry for asking for this so late...), as I said this is clearly not perfect, but I'd like to at least check that it doesn't break anything that I've missed. TIA!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I tested your changes, and found no new issues.
There is still a case where one can make a pane disappear, when using "mode (C)", but at least now it only happens when trying to make a 4th pane (previously one could do it for the 3rd), and even then it's lower probability. See the screen capture below.
That said, I'm happy with this for now. From my side, you can feel free to postpone further improvements until after 3.3.2 is done. Or, if you decide to close this as good enough, I'm ok with that too.
https://github.com/user-attachments/assets/a4e85762-274b-4872-8d26-ff3eadb0380d
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for testing this! I do see the problem you found and while debugging it, I've realized that this still doesn't work as intended because I don't adjust the size of the newly created dock in the code I added because it's not created just yet. The following trivial diff
diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index b300433641..9f96cf9354 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -1237,6 +1237,7 @@ wxAuiManager::SplitPane(wxWindow* window, AddPane(newWindow, paneInfo, dropPos != wxDefaultPosition ? dropPos : defaultDropPos); + Update(); // The direction specified in the pane info may be overridden by the drop // position, so get the real direction of the new pane now.
makes this work as expected, but maybe there is some way of avoiding calling Update() twice, I'll look at this more tomorrow...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()