GUI Improvements

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
mel_o
Space Floater
Posts: 26
Joined: Tue Mar 10, 2015 8:23 am

GUI Improvements

#1 Post by mel_o »

I've come across some fixes for minor problems while working on the GUI code and I'd like to put them up for discussion. I originally implemented these fixes in the GraphicalSummaryWnd but they could be useful for all windows derived from CUIWnd.
  1. Adjusting CUIWnd::SizeMove to allow parentless windows to (optionally) constrain themselves to the application window. Currently, CUIWnd::LDrag tries to keep windows fully visible but that a) only responds to mouse events, not calls to SizeMove, Resize, et al and b) doesn't prevent the window becoming larger than the app window, only repositions it.
  2. Connecting GG::SDLGUI::WindowResizedSignal to a (private) CUIWnd member function to give all parentless windows a chance to reposition themselves if the app window changes size. This would be helpful when switching from fullscreen to windowed mode where windows can be lost off the side of the screen. Also that signal isn't fired when switching to fullscreen mode / changing fullscreen resolution, apparently to avoid sending extra signals in response to bogus resize events. Anyone know if that's worth looking into?
What would be the best way to implement the "option" from the first point? The solutions I can see are adding a new WndFlag or passing a new bool parameter to the constructor (defaults to false to preserve existing behaviour).

Does anyone notice any conflicts with what I've suggested, alternate solutions etc? Anything else I could work on while I'm knee-deep in GG::Pts? I'm already eyeing off the fleets window suggestions on the programming work wiki page...
Unless stated otherwise, code and scripts provided by me are released under GNU GPL 2.0 (or later) and other content is released under CC BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: GUI Improvements

#2 Post by Geoff the Medio »

I don't think making it optional is necessary...

Another would-be-nice CUIWnd feature is docking to the edges of the parent window, or to other Wnd, so that if the parent or other Wnd moves its docked-to-edge, the docked CUIWnd would reposition itself automatically. This would be useful to keep (by default) the system sidepanel at the right side of the screen instead of floating in place when the window resizes.

Docking to multiple edges / in positions like covering the whole bottom / side of the docked-to-Wnd would be nice as well.

Having CUIWnd remember their positions, particularly if the remembering is docking-aware, between executions of the program would also be nice. Would need to set up some OptionsDB stuff to remember this and use it when initializing the GUI.

mel_o
Space Floater
Posts: 26
Joined: Tue Mar 10, 2015 8:23 am

Re: GUI Improvements

#3 Post by mel_o »

Geoff the Medio wrote:I don't think making it optional is necessary...
I can't think of any examples where we wouldn't want this behaviour to tell you the truth, it was mainly conservativeness on my part.
Geoff the Medio wrote:Another would-be-nice CUIWnd feature is docking to the edges of the parent window, [...]
You've read my mind :wink:

I've wanted this for a while and I saw the potential for this once I made the CombatReportWnd respond to window size changes, but I wanted to get the more basic features working first. Plus, I didn't want to put my hand up for it just yet :twisted:
Geoff the Medio wrote:Having CUIWnd remember their positions, [...]
I haven't looked too closely at the OptionsDB or initialization/config-parsing code yet so I can't really comment on that. I can have a go at it if and when I get the corresponding features finished, at least.

ETA: I noticed that the floating galaxy-map windows (sitreps, fleets, combat report etc.) can overlap with the toolbar at the top and I'm considering putting them all in a container Wnd to prevent this. I find it annoying when the system side panel changes height after switching between the galaxy map and production window (the side panel in the production window can't overlap the toolbar, the one in the galaxy map can).

ETA: Another idea: double-clicking on a resize tab to make the window expand rightwards & downwards as far as it can go. No idea how to intuitively show users that it's possible in the first place though.
Unless stated otherwise, code and scripts provided by me are released under GNU GPL 2.0 (or later) and other content is released under CC BY-SA 3.0.

mel_o
Space Floater
Posts: 26
Joined: Tue Mar 10, 2015 8:23 am

Re: GUI Improvements

#4 Post by mel_o »

PR is up for review.

It adds checks to make sure that CUIWnds are contained entirely within their parents or the app window if they're parentless and makes the HumanClientApp instance validate all of the modal CUIWnds when the app window size is changed.

Preventing the map view popups (sitreps, pedia etc.) from overlapping with the toolbar is proving to be a pain: adding a sub-window container that doesn't cover the toolbar and attaching the popups to it causes a bunch of issues with those windows intercepting mouse events even when invisible... and it stops GG's feature of bringing parentless windows to the top of the z-order when clicked on. Could add a 'bounding rectange' member to CUIWnd instead but it doesn't seem worth it right now.

Things like docking and remembering positions would be next, I think.
Unless stated otherwise, code and scripts provided by me are released under GNU GPL 2.0 (or later) and other content is released under CC BY-SA 3.0.

mel_o
Space Floater
Posts: 26
Joined: Tue Mar 10, 2015 8:23 am

Re: GUI Improvements

#5 Post by mel_o »

Making progress on having CUIWnds save their properties to the OptionsDB, I have a PR on my fork for review & comments.
Unless stated otherwise, code and scripts provided by me are released under GNU GPL 2.0 (or later) and other content is released under CC BY-SA 3.0.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: GUI Improvements

#6 Post by Dilvish »

Looks like you're making a lot of good progress there. *cheer*
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply