Commit Graph

34 Commits (99d57c83fa45348d92d00210ad67a0d00c8e8eac)

Author SHA1 Message Date
David Dormagen 8418da86d6 custom GUIs: fixed scrollbar offset with active upper board (#1612)
I guess the UI elements expect their position to already be corrected by cgo.X/Y. Or they never cared because they were in front of the upper board.
I am not sure, maybe the correct solution would be to actually position all elements lower (instead of adjusting for it when passing mouse input or drawing)? Currently the position is relative to the upper board's edge.

Anyway, this works for now.
2016-01-21 22:17:47 +01:00
David Dormagen 8ba1e042a0 script GUIs: fixed clipping with active upper board
I know that the issue was noticable starting from https://git.openclonk.org/openclonk.git/commit/cd57e474935b283e58c7ae7edd137c049f87f90c
I don't know WHY it was not noticable before, though. It had probably always been a defect.
2016-01-20 22:30:35 +01:00
David Dormagen 9292718ca5 script GUIs: fix auto-height window size with pure text windows
Otherwise, if a window was GUI_FitChildren and the text would NOT trigger a scrollbar, the window height was set to 0 (because the text height was only taken into account when rawTextHeight - 1 > rcBounds.Hgt).
2016-01-20 10:33:11 +01:00
David Dormagen cd57e47493 script GUIs: fixed text clipping and scrolling (#1605, related to #1612)
Previously, text windows would just change their own size and leave cropping and scrolling to their parent. This made the code easier, but was apparently unintuitive for scripters.
Now text windows do not change their size but show a scrollbar themselves (unless GUI_FitChildren or GUI_NoCrop of course).

This implied some other changes, because now parents without a scroll bar need to clip, too. (Or the clipping needs to be moved to the child window. But then it would have to be made sure that menu decoration can still go out of the bounds.)
And this also needed some script fixes where scripters assumed the text windows would not scroll (and thus made them smaller than 1em).

related to https://git.openclonk.org/openclonk.git/commit/46ad28ea652fad34814a866f3b9c305aa7cc6faa
2016-01-18 21:39:54 +01:00
David Dormagen ba2cf8f096 fix incorrect clipping in script GUI windows (#1592)
I am not sure why the 'isMainWindow' was there. It wasn't there in 7319f7b3cc and got introduced in the major rework in 049088be78 - I guess it was just an oversight that was not noticed because usually the UI windows have the text or other things that need to scroll on a deeper level.

Anyway, checking whether the window is a script-root window does not make any sense as far as I can see now.
2016-01-12 22:18:57 +01:00
Nicolas Hake 3c625a00dd C4Game: Turn some owned pointers into std::unique_ptr
Using std::unique_ptr instead of raw pointers makes ownership clear and
avoids leaks.
2015-12-28 11:43:37 +01:00
David Dormagen 65dc58c77d fixed wrong positioning of script GUI windows with the GUI_Multiple flag on startup (#1477)
GUI_Multiple windows are supposed to be updated from the root window in a full refresh. However, they also had the "dirty" flag set (that is only used for non GUI_Multiple windows after the initial startup), but they did not unset it when updating.
So they were first updated with the correct parent width (full screen) and then, because of the dirty flag, were updated again like a non GUI_Multiple window with the parent's size. That was incorrect. Only another update would then fix it again (because the "dirty" flag would then have been unset).
2015-12-27 15:48:32 +01:00
David Dormagen a6d11d67f5 custom GUI: grid layout now checks remaining row length before adding another element
Previously it was checked after adding an element. Long elements would thus be in the same row as the other elements even if they wouldn't fit. Not long elements get their own row.
2015-10-13 07:35:04 +02:00
Sven Eberhardt f5a0ff3d8f Script GUI: Process double click as second single click. 2015-10-03 22:43:06 -04:00
Julius Michaelis 2ad045f8d6 Replace strtod with stringstreams in C4ScriptGuiWindow::SetPositionStringProperties to avoid locale problems (second attempt)
Also added warnings and fixed a few whitespacing errors.
2015-10-03 13:17:17 +02:00
Nicolas Hake c8e1a38950 Revert "Replace strtod with strtof_l ..."
This reverts commit 139dee9874.

The commit introduced a memory leak on glibc, and broke the build on all
other platforms.
2015-10-01 20:50:40 +02:00
Julius Michaelis 139dee9874 Replace strtod with strtof_l in C4ScriptGuiWindow::SetPositionStringProperties to avoid locale problems
(That function could still use some more love, though: Error messages and not accepting ridiculous things when parsing.)
2015-10-01 19:50:05 +02:00
David Dormagen 6756db2768 C4ScriptGuiWindow: fix copyright header
The remaining old header has now been adjusted to the new one.
See e0dc30c59a for details.
2015-09-29 19:13:12 +02:00
David Dormagen 439cfac129 custom GUIs: do not break text when style flag NoCrop is set and set NoCrop for HP display 2015-09-25 15:01:24 +02:00
Sven Eberhardt 5b19294d76 Use ANY_OWNER instead of INT_MAX to label GUI elements shown to everyone.
Mostly to make the code more readable because there's no way to know that INT_MAX means "anyone".
2015-09-23 18:08:44 -04:00
David Dormagen f4f9afa477 custom guis: for the Player property, distinguish between NO_OWNER and nil
NO_OWNER means the message will be visible for noone (can f.e. be used to hide a ui window). nil means the message won't have visibility restrictions. This is probably what the scripter expects.
Previously, a value of "nil" would have been read as 0. So not setting the Player property and setting it to nil would mean two different things.
2015-09-23 22:03:29 +02:00
David Dormagen cc3452bd0d custom guis: properly scale with font size now
Previously, the em <-> pixels conversion was a hardcoded value. Now the GUI scales with the font size that can be selected in the options.
Sadly, all scales were off since the hardcoded value was too low.
2015-09-06 19:02:31 +02:00
Sven Eberhardt ec0b9a0dd1 Fix deleted object usage when script gui close call is issued in response to deleted parent object. 2015-09-05 20:37:12 -04:00
David Dormagen 4682b6c668 script GUIs: fixed a fistful of memory leaks
There are some ownership rules (PropList::GetProperties, Ui::Element..) which are not very clear imo. But there also was at least one clear oversight (name retaining, that is).
The only issue would be an assertion firing at game exit.
2015-09-05 11:01:58 +02:00
Sven Eberhardt cb995eb158 Fix several memory leaks in script gui. 2015-09-04 21:08:28 -04:00
Sven Eberhardt 8f4494745d Fix C4ScriptGuiWindow MouseInput/MouseEnter/MouseLeave overloads.
MouseInput silently shadowed the variant in C4GUI::Element and MouseEnter/MouseLeave were never called without parameters.
2015-09-03 23:27:20 -04:00
Sven Eberhardt 36fbbb34a4 Change deactivated MenuDebugLogF to a definition that does not evaluate its parameters. 2015-09-03 22:50:58 -04:00
Sven Eberhardt 20d3de46cd Fix some unused variables. 2015-09-03 21:26:49 -04:00
David Dormagen f05345375c fixed wrong offset in scripted GUIs when upper-board is active 2015-08-02 23:19:28 +02:00
David Dormagen d5f4805f18 fixed desync
The desync was caused by PropList->GetProperties returning the properties in an arbitrary order. They are now sorted first.
The debug logs are left in place, because I assume that I will need them again and they prove to be helpful.
2015-08-02 19:12:09 +02:00
David Dormagen 9968b0000c custom GUIs: restrict the maximum size of a menu window to 100em x ~62em
Fullscreen GUIs on wide-screen monitors look stupid. This patch tackles this by restricting the maximum size to something that can still be seen with a glance.
For very high-DPI or low-DPI screens, the user would most likely adjust the font size in the options (todo) anyway and thus also change the maximum menu size.
2015-03-27 11:33:57 +01:00
David Dormagen dae7f11a70 custom GUIs: added property GraphicsName to specify graphics of Symbol (if Symbol is a definition)
f.e. {Symbol = Icon_Number, GraphicsName = "Inf"}
2015-03-23 15:34:09 +01:00
David Dormagen ebcc397221 add proper support (inventory & interaction-menu contents) for extra slot library
Also fix bug with GuiScriptWindow where scrollbars would not be hidden in some cases (f.e. no-crop parent and negative-top child).
2015-03-19 16:22:06 +01:00
David Dormagen 4c69e19219 custom guis: correctly respect margins in grid layout and vertical layout 2015-01-20 20:44:13 +01:00
David Dormagen c42d94e3cf Script GUI: fixed a bug where a GUI's rectangle was incorrect 2015-01-03 15:30:30 +01:00
David Dormagen 64e092cd3e custom guis: fixed text alignment
C4ScriptGuiWindowStyleFlag should probably be a class enum. Or at least put in a separate namespace. This is TODO to prevent further name collisions. However, it's not completely trivial.
2014-12-26 12:18:17 +01:00
David Dormagen c2c80b94db custom gui: fixed FitChildren style flag 2014-12-26 11:50:40 +01:00
David Dormagen 6476b0b026 Script GUIs: fixed saving & loading 2014-10-23 23:29:14 +02:00
David Dormagen 2a78b77bda renamed C4GuiWindow to C4ScriptGuiWindow to increase expressivness and reduce similarity with C4Gui* 2014-10-13 18:48:03 +02:00