Commit graph

159 commits

Author SHA1 Message Date
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Michael Alexsander 96fa719026 Fix various small issues with PopupMenu 2021-02-16 01:12:08 -03:00
Eric M 26c29cc0d7 Improved PopupMenu visuals. Removed x-y margin, made it 'padding' instead. 2021-02-15 15:45:25 +10:00
bruvzg d78336c65e
[CTL] Add missing font outline drawing routines and theme constants. 2021-02-14 14:11:44 +02:00
Rafał Mikrut 7961a1dea3 Initialize class variables with default values in scene/ [2/2] 2021-02-09 18:24:36 +01:00
Marcel Admiraal 8eb39f4e8b Change themes *_color_* to *_*_color
Changed:
font_color_accel -> font_accelerator_color
font_color_bg -> font_unselected_color
font_color_disabled -> font_disabled_color
font_color_fg -> font_selected_color
font_color_hover -> font_hover_color
font_color_hover_pressed -> font_hover_pressed_color
font_color_pressed -> font_pressed_color
font_color_readonly -> font_readonly_color
font_color_selected -> font_selected_color
font_color_shadow -> font_shadow_color
font_color_uneditable -> font_uneditable_color
icon_color_disabled -> icon_disabled_color
icon_color_hover -> icon_hover_color
icon_color_hover_pressed -> icon_hover_pressed_color
icon_color_normal -> icon_normal_color
icon_color_pressed -> icon_pressed_color

Also includes:
font_outline_modulate -> font_outline_color
tab_fg -> tab_selected
tab_bg -> tab_unselected
2021-01-24 06:28:49 +00:00
Rémi Verschelde 321a4d5e79
Merge pull request #44906 from EricEzaM/PR/popup-menu-fix-not-matching-button-size
Fixed PopupMenu not matching parent MenuButton/OptionButton width
2021-01-04 14:47:32 +01:00
Eric M 056fcf3d75 Fixed PopupMenu not matching parent MenuButton/OptionButton width 2021-01-04 18:47:09 +10:00
Eric M e5aaa7d890 Fixed hover highlight style rect of items being cut off.
This was caused by an incorrect calculation of the height of each item when determining the minimum size, plus a few things which were leftover after the PopupMenu rework.
2021-01-04 18:35:40 +10:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Yuri Roubinsky ca8c794d04 Added optional id parameter to PopupMenu::add_separator 2020-12-27 15:18:47 +03:00
Marcel Admiraal 4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
Michael Alexsander bb39088201 Allow to circle back in 'PopupMenu' even if the first/last item is non-selectable 2020-12-10 09:32:02 -03:00
Rémi Verschelde 2a325f3888
Merge pull request #44233 from YeldhamDev/popupmenu_circle_back
Re-add circle back scrolling to 'PopupMenu'
2020-12-10 11:16:38 +01:00
Michael Alexsander e8e0abc331 Re-add circle back scrolling to 'PopupMenu' 2020-12-09 13:25:00 -03:00
Michael Alexsander 383e8919e0 Add "font_color_separator" theme property to 'PopupMenu' 2020-12-03 11:36:03 -03:00
bruvzg 99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
Rémi Verschelde 94875f5f48
Merge pull request #41851 from EricEzaM/PR/popup-menu-hysteresis
Added hysteresis for popup sub-menus
2020-11-16 09:34:28 +01:00
Eric M c482e8ec85 Added hysteresis for popup sub-menus
This adds a small lag effect when opening submenus which allow the user to move directly to an item on the submenu without worrying about avoiding the autohide regions.
2020-11-08 13:28:23 +10:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
PouleyKetchoupp 54eaaf456f Fix popup menu item selected when opening the menu
In order to allow selecting items by either holding left click, or click
to open and click again to select, mouse button release was invalidated
based on the amount of mouse motion.

This was causing issues in some scenarios where an item could be
selected while opening the menu if the mouse moved enough between button
press and release.

This case could happen in the language selection of the project manager,
especially on linux, because of the order and timing of the mouse
events on x11.

This change invalidates mouse release based on a timing condition rather
than moved distance to handle any case from the display server properly.
2020-09-18 20:45:59 +02:00
Hugo Locurcio 3e0226515e
Rename ShortCut to Shortcut which is more grammatically correct
See https://github.com/godotengine/godot/issues/16863#issuecomment-685236980.
2020-09-09 21:54:54 +02:00
Eric M 13fd60572b Fixed get_usable_parent_rect() errors when initialising popup menus. 2020-09-06 13:59:40 +10:00
Nathan Franke 034e123c1d
Fix PopupMenu unresponsive on right side of menu 2020-09-02 01:24:10 -05:00
EricEzaM 73c7fb2118 PopupMenu rework and enhancements
Many scrolling behaviour improvements and the ability to limit popup size.
2020-09-01 17:56:38 +10:00
Hugo Locurcio c9abc63108
Allow searching with keyboard input by default in PopupMenu
See discussion in https://github.com/godotengine/godot-proposals/issues/43.
2020-05-17 23:28:24 +02:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
nobuyuki_nyuu 35f30086de PopupMenu.get_current_index() bound to ClassDB 2020-05-06 15:27:35 -05:00
Rémi Verschelde fdf58a5858 Rename InputFilter back to Input
It changed name as part of the DisplayServer and input refactoring
in #37317, with the rationale that input no longer goes through the
main loop, so the previous Input singleton now only does filtering.

But the gains in consistency are quite limited in the renaming, and
it breaks compatibility for all scripts and tutorials that access
the Input singleton via the scripting language. A temporary option
was suggested to keep the scripting singleton named `Input` even if
its type is `InputFilter`, but that adds inconsistency and breaks C#.

Fixes godotengine/godot-proposals#639.
Fixes #37319.
Fixes #37690.
2020-04-28 15:19:49 +02:00
Rémi Verschelde 5f11e15571
Merge pull request #37504 from qarmin/out_of_bound_cursor
Fix array out of bounds access caused by uninitialised variables
2020-04-02 13:07:55 +02:00
Rafał Mikrut 359bebd8c0 Fix out of bound array access caused by unassigned variable 2020-04-01 19:29:35 +02:00
Leleat 8a5660f3d1 fixed PopupMenus letterjumping on any InputEvent 2020-03-30 21:45:56 +02:00
Juan Linietsky b3080bc2f4 Popups have also been converted to windows
Controls using the old modal API have been replaced to use popups.
2020-03-26 15:49:44 +01:00
Juan Linietsky c7b4dcae2f Open sub-windows as embedded if the OS does not support them 2020-03-26 15:49:43 +01:00
Juan Linietsky 441f1a5fe9 Popups are now windows also (broken!) 2020-03-26 15:49:42 +01:00
Juan Linietsky 8e6960a69e Refactored input, goes all via windows now.
Also renamed Input to InputFilter because all it does is filter events.
2020-03-26 15:49:39 +01:00
Juan Linietsky 4396e98834 Refactored Input, create DisplayServer and DisplayServerX11 2020-03-26 15:49:32 +01:00
Rémi Verschelde e2b66cacf7
Merge pull request #18020 from bruvzg/input_fix_non_latin_and_add_hw_scancodes
Fix non-latin layout scancodes on Linux, adds access to physical scancodes.
2020-03-01 23:00:42 +01:00
Rémi Verschelde f742dabafe Signals: Manually port most of remaining connect_compat uses
It's tedious work...

Some can't be ported as they depend on private or protected methods
of different classes, which is not supported by callable_mp (even if
it's a class inherited by the current one).
2020-02-28 14:24:09 +01:00
Rémi Verschelde 01afc442c7 Signals: Port connect calls to use callable_mp
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.

No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
2020-02-28 14:24:09 +01:00
Juan Linietsky 33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
bruvzg 1af06d3d46
Rename scancode to keycode.
Add `physical_keycode` (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2020-02-25 12:30:33 +02:00
Juan Linietsky 69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky 3f335ce3d4 Texture refactor
-Texture renamed to Texture2D
-TextureLayered as base now inherits 2Darray, cubemap and cubemap array
-Removed all references to flags in textures (they will go in the shader)
-Texture3D gone for now (will come back later done properly)
-Create base rasterizer for RenderDevice, RasterizerRD
2020-02-11 11:53:26 +01:00
Haoyu Qiu e539b187a5 Clears button mask before activating menu item 2020-01-03 09:35:00 +08:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Rémi Verschelde 9f68626fb2 doc: Sync classref with current source
Also apply clang-format.
2019-12-13 10:41:06 +01:00
Haoyu Qiu 5bf8e1e426 Fixes long popup menu scroll behavior
Popup menus longer than the viewport have stange behaviors before this
fix:

* They always have one pixel outside the viewport.
* You can scroll down the long menu even if bottom outside screen and
top inside the screen. (Only menus one pixel above the screen is limited
to scroll down.)
2019-12-10 09:49:02 +08:00