Commit graph

150 commits

Author SHA1 Message Date
Markus Sauermann
390aa2a565 Fix ButtonGroup unpressing
It was possible to unpress a button group that had `allow_unpress = false`
using shortcuts.
Adjust `BaseButton::shortcut_input` to use the same logic as
`BaseButton::on_action_event`.
2023-06-16 00:15:37 +02:00
TheSecondReal0
d829b43ab5 Add option for ButtonGroups to be unpressed
Add an option for ButtonGroups to be unpressed

Apply suggestions from code review

Co-Authored-By: Tomek <kobewi4e@gmail.com>
Co-Authored-By: Yuri Rubinsky <chaosus89@gmail.com>
Co-Authored-By: kleonc <9283098+kleonc@users.noreply.github.com>
2023-04-20 17:09:39 -06:00
VolTer
7d14c44025 Add more sections to Button and BaseButton 2023-01-25 15:39:02 +01:00
Juan Linietsky
51777a2914 Fix constant editor redraw after shortcut
Introduced by me by mistake on #71328. Fixes #71652.
2023-01-21 10:54:45 +01:00
Juan Linietsky
dd3a1b08a9 Button shortcuts no longer "press" the Button.
* Button shortcuts were treated as generic input events on buttons. This means that to activate a button shortcut you had to press and release.
* This logic is removed and now shortcuts always activate on press.
* This makes the editor feel more responsive and solves problems related to this behavior.

Fixes #45033 and possibly others.
2023-01-13 18:43:02 +01:00
Juan Linietsky
2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Markus Sauermann
e4e13a404d Add configuration warning when ButtonGroup is used with non-toggleable buttons
Also fix ambiguous documentation of ButtonGroup.
2022-12-22 06:59:47 +01:00
Rémi Verschelde
4e47324b3f
Merge pull request #68097 from KoBeWi/no_signal🔕
Add `set_value_no_signal()` to Range
2022-11-04 10:48:47 +01:00
kobewi
4aa1efb0fe Add set_value_no_signal() to Range 2022-10-31 23:59:01 +01:00
George L. Albany
d846dd6e91
Make BaseButton Shortcut feedback togglable 2022-10-20 02:02:12 -04:00
Rémi Verschelde
2ffb609658 Merge pull request #66337 from EricEzaM/sprite-frames
Ensure control built-in shortcuts are matched exactly & add shortcuts for SpriteFrames editor
2022-10-13 15:24:39 +02:00
Eric M
a3ed9e6f2c Move Shortcut Context to Control and ensure that shortcut_input adheres to contexts. Also ensure that controls with no context are only triggered AFTER nodes which do have a context. 2022-10-13 21:07:19 +10:00
Rémi Verschelde
7ab01450cf Fix MSVC warning C4702: unreachable code
Part of #66537.
2022-09-28 16:46:48 +02:00
Eric M
2eda77c682 Ensure all checks of is_action in the editor which are for 'shortcut' use, check the action exactly. 2022-09-24 18:01:02 +10:00
RedMser
a12c71fff1 Fix #66062: editing shortcut_context in inspector 2022-09-19 19:13:52 +02:00
Micky
e31bb5ffeb Rename CanvasItem.update() to queue_redraw()
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +02:00
Michael Alexsander
221344b9e2 Fix some corner cases in the Menu/OptionButton item auto-highlight 2022-08-28 01:15:03 -03:00
Rémi Verschelde
b7d2ba12c8
Merge pull request #64635 from YeldhamDev/menu_buttons_popup_fix
Make `Menu/OptionButton` item auto-highlight behave better
2022-08-24 19:07:25 +02:00
kobewi
8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
Michael Alexsander
1da50698fc Make Menu/OptionButton item auto-highlight behave better 2022-08-19 14:54:53 -03:00
Aaron Record
900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
bruvzg
d1207a0504
[Input] Add extra shortcut_input input processing step to process Unicode character input with Alt / Ctrl modifiers, after processing of shortcuts. 2022-04-05 13:46:45 +03:00
Hugo Locurcio
be5116c4a4
Fix typo in BaseButton shortcut context methods 2022-03-07 22:36:12 +01:00
Rémi Verschelde
0f5455230c
Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
Gilles Roudière
73e784de1e Remove get_focus_owner() from Control, replaced by get_viewport()->gui_get_focus_owner() 2022-02-03 11:59:32 +01:00
Rémi Verschelde
7c3003fcbe
Improve some signal bindings to use specific Object subtypes 2022-01-28 15:35:40 +01:00
bruvzg
306b98638e
Allow unsetting shortcut_context. 2022-01-25 14:17:45 +02:00
Rémi Verschelde
bd4d57ede2
BaseButton: Rename pressed property to button_pressed
This fixes a conflict with the `pressed` signal.

The new name is temporary and only intended to solve the conflict for upcoming
alpha builds. Discussions are still ongoing regarding the BaseButton API and
how to rename and refactor more of its properties, signals and methods to have
a clearer API in 4.0.
2022-01-23 22:15:09 +01:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Zae
e957f7aeb0 Fix BaseButton's localization for tooltip with shortcut 2021-12-21 01:08:37 +08:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Aaron Franke
3c0fdcc8ac
Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
reduz
5cecdfa8af Entirely removes BIND_VMETHOD in favor of GDVIRTUAL
* `_gui_input`, `_input`, `_unhandled_input` and `_unhandled_key_input` are now regular C++ virutal functions.
* Everything else converted to GDVIRTUAL
* BIND_VMETHOD is gone, always use the new syntax from now on.

Creating `_gui_input` method and using the binder to register events will no longer work, simply override the virtual function now.
2021-08-23 08:10:13 -03:00
reduz
3682978aee Replace BIND_VMETHOD by new GDVIRTUAL syntax
* New syntax is type safe.
* New syntax allows for type safe virtuals in native extensions.
* New syntax permits extremely fast calling.

Note: Everything was replaced where possible except for `_gui_input` `_input` and `_unhandled_input`.
These will require API rework on a separate PR as they work different than the rest of the functions.

Added a new method flag METHOD_FLAG_OBJECT_CORE, used internally. Allows to not dump the core virtuals like `_notification` to the json API, since each language will implement those as it is best fits.
2021-08-22 08:23:58 -03:00
Bhuvan Vemula
a0205e4f34 command palette improvements 2021-08-15 11:40:44 +05:30
Bhuvan Vemula
a0a019a998 Added EditorCommandPalette 2021-08-09 17:41:50 +05:30
Rémi Verschelde
de2c2be19b
Shortcut: Rename shortcut property to event
Having a property which has the same name as its class leads to confusing
situations (e.g. `BaseButton` has a `shortcut` property of type `Shortcut`
which has a `shortcut` property of type `InputEvent`).

Also renames `is_event` to `matches_event`, and `is_valid` to `has_valid_event`
to better reflect what the methods check.
2021-08-05 13:48:43 +02:00
reduz
6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
kobewi
50c63bdc4c Add set_pressed_no_signal method to BaseButton 2021-07-13 13:57:26 +02:00
Lightning_A
899e5f8685 Rename is_a_parent_of() to is_ancestor_of() 2021-06-21 08:39:28 -06:00
Rémi Verschelde
fbe53a7064
Merge pull request #49155 from winterpixelgames/button-pressed-during-button-up-signal
Emit button_up signal after setting pressed to false.
2021-06-09 13:46:39 +02:00
Rémi Verschelde
0cbb19a246
Merge pull request #47280 from winterpixelgames/focus_doesnt_change_hover
Dont Change Hovering during Control Focus Events
2021-06-09 09:18:26 +02:00
Jason Knight
4c6ad8abcd Emit button_up signal after setting pressed to false. 2021-05-27 15:06:53 -06:00
Gilles Roudière
323f176915 Adds a pressed signal to ButtonGroup 2021-05-06 12:16:27 +02:00
Rafał Mikrut
504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
Jason Knight
edcbe88389 Removed the alteration of status.hovering during Focus Enter and Focus Exit events. This is incorrect and not fully implemented, and results in inconsistency in the UI and in the hovering variable. 2021-03-22 18:47:59 -06:00
reduz
1aa2823fa3 Removed _change_notify
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap.
-For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed()
-Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-10 19:31:24 -03:00
Rafał Mikrut
7961a1dea3 Initialize class variables with default values in scene/ [2/2] 2021-02-09 18:24:36 +01:00