Commit graph

741 commits

Author SHA1 Message Date
bruvzg 4c3f7d1290 Makes FontData importable resource.
Adds multi-channel SDF font texture generation and rendering support.
Adds per-font oversampling support.
Adds FontData import plugins (for dynamic fonts, BMFonts and monospaced image fonts), font texture cache pre-generation and loading.
Adds BMFont binary format and outline support.
2021-08-27 15:43:18 +03:00
Michael Alexsander 88db541705
Merge pull request #51947 from AnilBK/redundant-assignments
[cppcheck] Remove some redundant assignments.
2021-08-23 13:23:45 +00: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
Anilforextra c86db8b710 Remove redundant assignments.
Use used_in_transfer instead of used_in_compute twice.
2021-08-21 19:20:07 +05:45
Haoyu Qiu 16c2d4ef22 Improve Undo/Redo menu items
* Make Undo/Redo menu items disabled when clicking it does nothing.
    * Context menu of `TextEdit`
    * Context menu of `LineEdit`
    * Editor's Scene menu
    * Script editor's Edit menu and context menu (for Script and Text)
* Make editor undo/redo log messages translatable.
* Mark `UndoRedo`'s `has_{un,re}do()` methods as `const`.
* Expose `TextEdit`'s `has_{un,re}do()` to scripts since `{un,re}do()` are already available.
2021-08-17 21:11:10 +08:00
requizm 37ad82a7f7 We can delete all text on TextEdit
While all text of TextEdit was selected, deletion with backspace did not occur. It can now be deleted.
2021-08-17 02:30:14 +03:00
Vignesh1-art eb5b0d013f
Fixed crash executing TextEdit.new().set_draw_control_chars(true)
Fixes #51613.
2021-08-16 12:36:14 +02:00
Rémi Verschelde 761eb7e06a
Merge pull request #51585 from Paulb23/theme-update-optimisation 2021-08-13 21:33:36 +02:00
Paulb23 273374957b Only update TextEdit text cache when dirty 2021-08-13 17:47:53 +01:00
bruvzg 00381db2e7 [TextEdit] Improve block/insert caret drawing. 2021-08-13 19:28:47 +03:00
Paulb23 a736fb8ce9 Fix breakpoint toggle signal not firing when expected 2021-08-12 14:47:10 +01:00
Paulb23 a4606c2806 Cleanup and complete TextEdit inspector and docs 2021-08-12 11:43:35 +01:00
Paulb23 ae4dcb8918 Cleanup and bind remaing methods in TextEdit 2021-08-12 11:43:35 +01:00
Paulb23 0a32a6907b Cleanup and expose viewport / scrolling methods 2021-08-12 09:29:58 +01:00
Paulb23 7dbb0f3233 Rename readonly to editable 2021-08-12 09:29:58 +01:00
Paulb23 b799e5583a Rename insert mode to overtype mode 2021-08-12 09:29:58 +01:00
Paulb23 b700011314 Protect internal CodeEdit --> TextEdit API 2021-08-12 09:29:58 +01:00
Paulb23 9ec3e7f3d7 Cleanup TextEdit selection methods 2021-08-12 09:29:56 +01:00
Paulb23 7e70f9e0b9 Expose and cleanup TextEdit line wrap API 2021-08-12 09:29:16 +01:00
Paulb23 d5dcaee4c5 Cleanup and rename caret operations 2021-08-12 09:29:13 +01:00
Paulb23 e60900a353 Make TextEdit cut, copy and paste overridable 2021-08-12 09:27:10 +01:00
Paulb23 abbf14e7f5 Remove dead code from TextEdit 2021-08-12 09:27:10 +01:00
Rémi Verschelde fba0c8e2e2
Merge pull request #51502 from codecat/fix-caret-selection
Move cursor to edge of selection when moving caret left/right
2021-08-12 10:07:12 +02:00
Melissa Geels 408401a642 Triple click in text editor now uses last mouse position for validity
Previously, you would be able to double click a word, followed by
single-clicking another word on the same line, which would select the
entire line. Now, it will only select the whole line if the mouse
position has remained the same after the double click. This mimicks the
behavior in most third party text editors.

Fixes #51312.
2021-08-11 21:49:26 +02:00
Melissa Geels ed4c3eb7b3 Move cursor to edge of selection when moving caret left/right
This is to mimic the behavior of many third party text editors. The
reason it's not doing it when moving by word is due to that behavior
being mostly the same on other editors.
2021-08-11 13:27:12 +02:00
Paulb23 dd5a37f556 Move symbol lookup into CodeEdit 2021-08-01 12:06:33 +01:00
Paulb23 8f900ac178 Move line length guidelines into CodeEdit 2021-08-01 12:06:33 +01:00
Paulb23 d1a1ad127e Move brace matching into CodeEdit 2021-08-01 12:06:33 +01:00
Paulb23 12f0053555 Move auto brace completion to CodeEdit 2021-08-01 12:06:33 +01:00
Rémi Verschelde a0bc2f359d
Merge pull request #50588 from bruvzg/menu_gen
Optimize LineEdit and TextEdit menu item generation.
2021-07-19 22:56:53 +02:00
Rémi Verschelde dfc1ec7fb9
Merge pull request #50606 from Chaosus/textedit_fix_guttertype
Fixed typos in `TextEdit::GutterType` enum
2021-07-19 16:40:42 +02:00
Yuri Roubinsky 1597045b09 Fixed typos in TextEdit::GutterType enum 2021-07-19 11:18:54 +03:00
bruvzg 1ac7a126f1 Optimize LineEdit and TextEdit menu item generation. 2021-07-19 08:19:09 +03: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
reduz a3fb76cd45 Create many types of popups on demand
* LineEdit popups created on demand.
* TextEdit popups created on demand.
* SpinSlider popups created on demand.
* ResourcePicker popups created on demand.

Improves editor responsiveness.
2021-07-17 10:57:14 -03:00
Rémi Verschelde 9a1ce8e6c3
LineEdit: Respect max_length by truncating text to append
When appending text (either via `set_text()` or by pasting from clipboard),
if the input would make the `LineEdit` exceed its configured `max_length`,
the input text is truncated to fit. The discard part is passed as a parameter
in the `text_change_rejected` signal.

Fixes #33321.
Fixes #41278.

Also cleaned up unimplemented `max_chars` property in `TextEdit`.

Co-authored-by: Tony-Goat <70238376+Tony-Goat@users.noreply.github.com>
2021-07-06 18:03:03 +02:00
Paulb23 1a0cfc219b Move indent management to CodeEdit 2021-06-20 20:00:54 +01:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Paulb23 ab49ea032c Remove redundant keywords from TextEdit 2021-06-19 13:56:54 +01:00
Paulb23 5c618dd03d Move code folding into CodeEdit and hide line hiding API 2021-06-01 17:07:01 +01:00
Rémi Verschelde c5f237eaf8
Merge pull request #45393 from Paulb23/code_edit_autocomplete 2021-06-01 17:58:19 +02:00
Paulb23 c1b9971ad8 Move and expose Code Hint in CodeEdit 2021-06-01 15:38:45 +01:00
Paulb23 1c16673798 Move and expose AutoComplete in CodeEdit 2021-06-01 15:38:45 +01:00
Paulb23 5f66dfa371 Fix TextEdit selection drawing behing minimap 2021-06-01 13:09:39 +01:00
Rémi Verschelde 9bc2ba3b64
Merge pull request #48955 from Calinou/editor-tweak-property-hints
Tweak dozens of editor property hints for consistency
2021-05-25 11:44:43 +02:00
Hugo Locurcio 87f503310b
Tweak dozens of editor property hints for consistency
- Update Viewport MSAA property hints to match the currently
  exposed values.
- Add some performance hints to property hints.
2021-05-25 02:50:35 +02:00
Hugo Locurcio 80f4e407b2
Add a keyboard shortcut to select the word under cursor in TextEdit
This also acts as a general-purpose "deselect" shortcut since pressing
it a second time will deselect text.

This is available both in the script editor and in TextEdit fields
in use, both in the editor and projects.

The Duplicate Line script editor shortcut was moved to Ctrl + Shift + D
since it conflicts with the new shortcut (Ctrl + D). The rationale for
doing so is that Duplicate Line is a less commonly used action, and
its behavior can be replicated by copying and pasting the current line
anyway. (With no selection active, the whole line will be copied.)
2021-05-22 23:47:43 +02:00
Paulb23 00e10a842f Add custom background line colour to TextEdit and remove marked lines 2021-05-22 14:41:55 +01:00
Rémi Verschelde 510030fedc
Merge pull request #48528 from sent44/textedit
Expose get_total_visible_rows method to GDScript
2021-05-18 09:06:24 +02:00