Commit graph

179 commits

Author SHA1 Message Date
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
Rémi Verschelde 69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Rémi Verschelde d7b85fbaa1
Merge pull request #31086 from volzhs/underline
Use underline position and thickness value in font file
2020-05-07 21:18:41 +02:00
Darenn b4e3042cba Fixed bbcode parsing for built-in RichTextEffects in RichTextLabel
RichTextEffect can now have a bbcode string starting like one of the built-in.
It was impossible before as the built-in would take precedence over the custom effect that has the same bbcode start.

Example : [fade] would take precedence over [fade_in]
2020-04-30 11:56:40 +02:00
volzhs 9f1de2cfdd Use underline position and thickness value in font file 2020-04-29 21:56:15 +09:00
janglee 5e64c146bc Fixed 0 width issue of rich text label
Fixes #37746
2020-04-13 14:59:38 +05:30
janglee 9c2c2ab2b0 Fixed underlines and striketrough not respecting visible character 2020-04-07 19:04:13 +05:30
Dominik 'dreamsComeTrue' Jasiński 06a79f260c Calculate strike-through position correctly
Fixes: #37637
2020-04-06 22:26:58 +02:00
Rémi Verschelde de1d021574
Merge pull request #37397 from Eoin-ONeill-Yokai/Bug37081
Correction to RichTextLabel Tabulation (Bug 37081)
2020-04-05 10:07:47 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Eoin O'Neill 2000e110a9 Correction to RichTextLabel Tabulation
Correct backtrack assignment to prevent excessive tabulation. Worth
noting that tabulation is treated differently in RichTextLabel because
of custom user-asignable tab variable which creates problems with
dynamic fonts specifically.
2020-03-29 14:33:17 -07:00
Juan Linietsky a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Juan Linietsky 047e0b7de5 Reworked tooltips to use the popup system. 2020-03-26 15:49:45 +01:00
Juan Linietsky 441f1a5fe9 Popups are now windows also (broken!) 2020-03-26 15:49:42 +01:00
Juan Linietsky f8a79a97c7 Effective DisplayServer separation, rename X11 -> LinuxBSD 2020-03-26 15:49:34 +01:00
Tomasz Chabora b3f83ac115 Make search in RichTextLabel case-insensitive 2020-03-24 20:03:09 +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 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
Rémi Verschelde c92c434299
Merge pull request #36229 from dreamsComeTrue/rich-text-label-key-events
RichTextLabel: proper handling of internal key events
2020-02-17 09:56:38 +01:00
Juan Linietsky 867d073b98 Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr. 2020-02-15 08:36:04 -03:00
Dominik 'dreamsComeTrue' Jasiński ff030afc93 RichTextLabel: proper handling of internal key events
Fixes #36211
2020-02-14 23:15:38 +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
Rémi Verschelde ad2ceaade2 Merge pull request #35768 from Eoin-ONeill-Yokai/hiddenRichText
Fix to RichTextEffect `visibility` - Label Now Accounts for Skipped Characters.
2020-02-09 12:57:04 +01:00
Rémi Verschelde f3726ee994 Use modules_enabled.gen.h to improve inter dependency checks
- Fix build with gdscript module disabled. Fixes #31011.
- Remove unused `gdscript` compile option.
- Fix build with regex module disabled.
- Fix ImageLoaderSVG to forward declare thirdparty structs.
2020-02-07 11:50:40 +01:00
Eoin O'Neill b3fd4884d7 Fix RichTextEffect visibility to Account for Skipped Characters.
A picture is easier to describe this issue than words. Basically, rich
text effects allowed for character visibility changes. While doing so
would work properly, the rich text label would render the next `word` in
an offset accounting for the hidden characters (leaving a huge space.)

This patch fixes this issue by keeping track of the amount of
`backtrack` necessary per line.
2020-01-30 21:05:52 -08:00
Haoyu Qiu 4293f76cf1 Emits meta_hover_ended when mouse exit RichTextLabel 2020-01-08 21:01:08 +08:00
Haoyu Qiu d17a4efc43 Fixes RichTextLabel click issue when cell text wraps 2020-01-08 09:08:03 +08:00
Kanabenki d79f0e7d40 Check if cursor is inside meta when getting cursor shape 2020-01-07 15:46:11 +01: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
Haoyu Qiu 776ae18d64 Fixes crash after remove_line in RichTextLabel
`ItemFrame` always have a line.
2019-12-12 16:35:50 +08:00
Rémi Verschelde c39238c7d2
Merge pull request #32870 from bergmannf/27850_rtl_bold_italic
Add push_* methods for fonts in rich_text_label
2019-10-25 23:17:59 +02:00
Eoin O'Neill 601b216605 Shadows Now Properly Translate by RichTextEffect offset.
Bugfix 32981.
2019-10-22 22:15:36 -07:00
Rémi Verschelde b365dc3441
Merge pull request #32965 from volzhs/richtextlabel-scroll-active
Fix scrolling RichTextLabel with scroll_active=false
2019-10-22 20:39:12 +02:00
volzhs 3e738b1798 Fix scrolling RichTextLabel with scroll_active=false 2019-10-22 06:05:10 +09:00
Florian Bergmann 47000f8860 Add push_* methods for fonts in rich_text_label
Provides method to push different font styles.

If no fonts are set nothing will happen, when the methods are used.

Fixes #27850
2019-10-16 15:22:56 +02:00
PouleyKetchoupp 9f8ffd4146 Support for resized images in RichTextLabel
BBCode Tag:
[img=<width>x<height>]{path}[/img]
2019-10-16 12:00:15 +02:00
qarmin 17344337a9 Fix crash in Control functions 2019-10-05 19:17:07 +02:00
Relintai 25704e81fa Implement #32347 - RichTextLabel's Item and Item* structs should not inherit Object, it's too expensive 2019-09-26 01:26:02 +02:00
Eoin O'Neill ebc6fb9869 Fix Sanitization Bug
From issue #32089 -- I messed up the property hints by putting them
in the wrong location. Should be working as intended now.
2019-09-11 16:39:24 -07:00
Eoin O'Neill feedd6c615 Update RichTextLabel to support real time effects and custom BBCodes.
Added a new ItemFX type to RichTextLabel which supports dynamic text
effects.

RichTextEffect Resource Type was added which can be extended for more
real time text effects.
2019-09-03 15:36:19 -07:00
Rémi Verschelde 58e7cbccc0
Merge pull request #30927 from mahubu/console-multi-selection-cursor
Change cursor to multi-selection cursor when selecting text in RichTextLabel
2019-08-30 15:05:54 +02:00
Cameron Reikes c123a8c4f5 Same method when redrawing as when theme changed 2019-08-01 19:50:14 -07:00
Teto b1dbd114c4 Change cursor to multi-selection cursor when selecting text in RichTextLabel.
Fix for #27545 : returns 'CURSOR_IBEAM' shape when selection is clicked.
2019-07-29 16:22:54 +02:00
Hugo Locurcio 28d3a6051c
Use base Color() constructors instead of Color::html()
This results in slightly smaller binaries (-17 KB for an editor binary)
as no strings need to be allocated.
2019-07-08 21:17:10 +02:00