Commit graph

1547 commits

Author SHA1 Message Date
Corantin H 96e4c5f7cd Add editor undo/redo feature 2023-12-04 22:44:20 +01:00
Robert Müller 7e8c2aa4be Fix incorrect sound index usage for editor sound preview
The invalid sound index is `-1` but the check in the editor for the sound preview assumed it was `0`. We should use a type-safe wrapper to avoid this in the future, like for texture handles.
2023-12-04 22:21:53 +01:00
furo daa0609252 Hide "Allow unused" button when not using "DDNet" entities. 2023-11-24 16:55:36 +01:00
Robert Müller 29a32b7acc Use const char * instead of char const * consistently
Both are equivalent. Seems to already be used consistently for all other types.
2023-11-20 22:26:19 +01:00
Chairn d6c7bcdbdc Init vec2 members to 0 following #6256 2023-11-19 17:36:16 +01:00
Axel Vestin 1b7cee3888 Fixes duplicate images when appending maps in the editor 2023-11-19 00:07:31 +01:00
Robert Müller dd907ab016 Fix map grid factor always being shown as 1 2023-11-17 21:52:39 +01:00
Robert Müller f54fc2e441 Fix parent folder not being shown in editor file browser, fix typo
The check for multiple storage locations was using the base path from the previous invocation of the file dialog instead of using the new base path.

Closes #7463.
2023-11-15 22:28:50 +01:00
dobrykafe 08a00cff6b update m_FileDialogFileNameInput when deleting a file 2023-11-15 18:24:20 +01:00
Axel Vestin 7c15514696 Use Escape to cancel OP_SCALE envelope 2023-11-14 21:17:07 +01:00
Dennis Felsing e74e6770c3
Merge pull request #7325 from Robyt3/Browser-Community-Filter
Add community server filter and icons, remove DDNet and KoG tabs
2023-11-12 00:00:05 +00:00
Dennis Felsing d716210e31
Merge pull request #7408 from Jupeyy/pr_tile_border_shader
Switch to a fragment shader solution for border tile rendering
2023-11-11 23:02:34 +00:00
Dennis Felsing 79e244f166
Merge pull request #7433 from Robyt3/Editor-Color-Picker-Refactoring
Show color picker button for color envelope points
2023-11-11 22:14:41 +00:00
Robert Müller bd4c138107 Show color picker button for color envelope points
Simplify selecting envelope point colors by showing a color picker button that opens a color picker popup to change the color of the selected envelope point. The existing editbox to change only the selected channel's value is kept, as the color picker popup does not support the same precision to specify the individual color channel values.

Closes #7317.
2023-11-11 20:45:22 +01:00
Robert Müller d8452ad02c Extract ShowPopupEnvPoint local function 2023-11-11 20:45:22 +01:00
Robert Müller c48623de8f Extract CEditor::DoColorPickerButton function
Fix color not being updated while shift key is pressed, due to use of `else if`.
2023-11-11 20:45:22 +01:00
Robert Müller 4a00332f59
Merge pull request #7434 from ChillerDragon/pr_ctrl_s_scale
Do not scale envelopes on ctrl+s
2023-11-11 18:22:56 +00:00
ChillerDragon e090d73784 Do not scale envelopes on ctrl+s
When using ctrl+s to test the current envelope it should not activate
the scale mode. This causes unexpected envelope changes on ctrl+s based
envelope fine tuning testing.
2023-11-11 18:56:09 +01:00
dobrykafe ca6b518383 remove ShowingRoot check 2023-11-11 14:08:41 +01:00
dobrykafe 73fac0c8d4 check StorageType instead of SelectedIndex 2023-11-10 21:45:45 +01:00
dobrykafe 41b63843ce hide "Show directory" when "All combined" selected 2023-11-09 22:16:07 +01:00
heinrich5991 962379d64d
Merge pull request #7428 from Robyt3/Editor-Entities-Explain-Assertion-Fix
Fix editor crash when showing explanation for custom entities
2023-11-09 18:41:53 +00:00
Robert Müller df664261bb Fix editor crash when showing explanation for custom entities
The failing assertion is removed because users can add custom entities images besides the predefined ones.

Reported by Mr.Gh0s7 on Discord.
2023-11-09 19:02:54 +01:00
Robert Müller fa8640bd35
Merge pull request #7425 from furo321/editor-correct-corners
Use correct corners for brush rotation buttons.
2023-11-08 19:13:34 +00:00
furo 3ebf0ef85d Use correct corners for brush rotation buttons. 2023-11-08 19:57:37 +01:00
furo 36bf22f1c4 Add button to rename images and sounds in editor. 2023-11-08 18:01:32 +01:00
Robert Müller 78217c44d7 Add mode selection to color picker popups (RGBA, HSVA, HSLA)
Add buttons for selecting the color mode (RGBA, HSVA, HSLA) in color picker popups in menu and editor. Previously, the color picker popups always showed the color components in HSVA. Now the mode can be switched so the components are shown in either RGBA or HSLA. The hex color code is always RGBA, same as before.

In the editor, the RGBA mode is used per default, to prevent any loss of information due to color conversions, as the map format stores RGBA values. In the menus, the HSVA mode is the default, same as before, although the config actually stores HSLA values.

The HSVA color picker controls (1D slider for hue, 2D picker for saturation and value) are still shown for all modes.

As many color conversions as possible are avoided by only converting between color formats when necessary. Switching between color modes should not change the selected color. Changing the RGBA hex value in the editor will set the exact value also when another color mode is selected. However, changing the color with the other controls in HSVA/HSLA mode will cause a conversion and possible loss of information. The conversion directly from RGBA to HSVA and vice versa is also explicitly avoided, as this internally converts to HSLA first, which is done separately already.

Closes #7409.
2023-11-05 13:46:01 +01:00
Robert Müller d39247f726 Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.

The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.

Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.

The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.

The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.

Closes #5654.
2023-11-04 15:32:27 +01:00
Jupeyy 639a8c3c8b Switch to a fragment shader solution for border tile rendering 2023-11-04 14:51:39 +01:00
Dennis Felsing 911880a982
Merge pull request #7390 from Patiga/remove-parallax-zoom-from-map
Remove Parallax Zoom from map file
2023-10-29 23:11:32 +00:00
Patiga a9fc2207ac Remove Parallax Zoom from map file
Parallax Zoom improves the appearance of maps visually when zooming.
Contrary to initial tests, it does not interfere with certain map
locations such as the shop on the map Timeshop.
The default value appears to be correct for all existing maps.

The value in the map file is non-trivial to manage, and provides little
benefit. See https://github.com/ddnet/ddnet/issues/6196 for further
discussion.
2023-10-29 23:43:19 +01:00
Robert Müller 751343c846 Fix client crash on maps with invalid image and sound indices
Limit number of sounds being loaded in the client to 64, instead of writing sample indices out of bounds.

Check if sound indices are out of bounds. It was only checked whether the sound index is -1 but no other bounds checking was performed.

Check if image indices are out of bounds. It was not checked for all negative image indices, only -1 was considered.

Add popup message in the editor when trying to add more than 64 sounds, same as for images.

Limit number of images in `map_convert_07` tool, instead of writing out of bounds.
2023-10-29 17:55:20 +01:00
Dennis Felsing 92206044d1
Merge pull request #7366 from furo321/SoundsDetail
Remove "Detail" from sound layers.
2023-10-25 09:21:05 +00:00
furo 18f389fb17 Remove "Detail" from sound layers. 2023-10-24 19:34:09 +02:00
dobrykafe 35e5c114ba stop sound preview in more places 2023-10-23 12:50:59 +02:00
dobrykafe c304b3eef8 extract CEditor::OnDialogClose 2023-10-23 12:48:53 +02:00
dobrykafe 697bd8980d stop sound preview in more places 2023-10-18 14:47:47 +02:00
dobrykafe aafee689ca stop/pause sound previews 2023-10-18 13:27:31 +02:00
Robert Müller 97ae362bd6 Fix names of external images not being loaded in editor
The entire `CEditorImage` was being overwritten when loading external images, which was causing the already loaded image name to be cleared, due to the changed order of operations (regression from #7008). This is fixed by using `CImageInfo` to load the image and only copying the relevant members to the `CEditorImage`.
2023-10-08 11:38:13 +02:00
Robert Müller d4fed2360e
Merge pull request #7208 from dobrykafe/pr-editor-toolbar-sounds
Enhance editor toolbar sounds
2023-10-08 09:06:15 +00:00
Dennis Felsing e4ccd79851
Merge pull request #7318 from furo321/editor-mode-icons
Use icons for editor mode switching.
2023-10-08 08:17:07 +00:00
furo e1979d9c9b Use icons for editor mode switching.
Make the icons bigger.

Make it the same size as "group"
2023-10-08 01:17:20 +02:00
dobrykafe 8adbbc433c fix requested changes 2023-10-07 14:49:51 +02:00
Robert Müller 093edb7803
Merge pull request #7308 from Marmare314/add-editor-object
Add `CEditorObject` class
2023-10-07 10:26:28 +00:00
marmare314 719b2bdadd add editor object class
This class is slightly more light-weight than a CEditorComponent
and its naming makes it more natural to inherit for envelope points,
proof-mode positions etc.
2023-10-07 00:46:47 +02:00
dobrykafe 5b609c8e06 extract CEditor::DoAudioPreview, also use in file dialog 2023-10-06 17:10:43 +02:00
dobrykafe ca517f27b8 enhance editor toolbar sounds 2023-10-06 17:09:19 +02:00
Robert Müller 5a10ef049a Fix clang-tidy readability-static-accessed-through-instance
The crash that was occurring with this check was fixed in clang 15.
2023-10-06 14:07:02 +02:00
Robert Müller 4e31052821 Fix clang-tidy clang-analyzer-deadcode.DeadStores 2023-10-06 14:06:55 +02:00
Robert Müller 48a92f1eac
Merge pull request #7303 from Marmare314/refactor-env-editor
Refactor `CEnvelope` class
2023-10-06 11:29:08 +00:00
marmare314 73914b3cae store only pointer to editor in CEditorComponent 2023-10-06 12:46:56 +02:00
marmare314 c2adfc5628 make CEnvelope::m_PointsAccess private 2023-10-06 11:39:26 +02:00
marmare314 855ae8885c make CEnvelope::Resort private 2023-10-06 11:39:26 +02:00
marmare314 95528ca0b9 refactor CEnvelope::FindTopBottom
- rename to GetValueRange
- return pair of floats instead of storing them as members
2023-10-06 11:39:26 +02:00
marmare314 283226ef59 init member variables of CEnvelope on declaration 2023-10-06 11:39:26 +02:00
marmare314 08b825439e use type enum in CEnvelope 2023-10-06 11:39:22 +02:00
marmare314 073f208808 split implementations from CEnvelope class 2023-10-06 00:32:12 +02:00
marmare314 1bd3e65c2a extract CEnvelope into seperate header 2023-10-05 22:42:24 +02:00
Dennis Felsing d1cd0aeb20
Merge pull request #7287 from Marmare314/string-tooltip
store editor tooltip in optional string
2023-10-05 10:01:01 +00:00
marmare314 25da78a00e store editor tooltip in optional string 2023-10-04 23:48:14 +02:00
Dennis Felsing a07679d33a
Merge pull request #6990 from Marmare314/project-onto
implement project-onto operation for envelopes
2023-10-04 14:30:01 +00:00
Robert Müller 7acf2c1573 Add functions for reading/writing strings from/to datafile
Simplify the usage of datafile reader and writer by adding utility functions to read and write zero-terminated UTF-8 strings.

Improve validation of string data read from datafiles. It is ensure that string data is null-terminated, has no internal NUL-characters and is valid UTF-8.

Fix loading of external sounds in the editor. The wrong path variable was being used, so the sound files would not be loaded from correct folder.

Add tests for new datafile reader/writer functions.
2023-10-03 16:07:15 +02:00
Dennis Felsing dbd9da3c7b
Merge pull request #7289 from Robyt3/Map-Version-Check
Ensure current map is not corrupted when loading another fails
2023-10-03 13:17:03 +00:00
Dennis Felsing 1a8e8f4638
Merge pull request #7291 from Robyt3/Dilate-PixelSize-Cleanup
Remove redundant argument of `Dilate` function
2023-10-03 12:28:41 +00:00
Robert Müller 2d56676f17 Improve editor map version check, reduce code indentation
Add error message in editor when loading a map that has an unsupported version.

Ensure error messages are not closed immediately when loading a map fails.

Remove unnecessary indentation by returning early.
2023-10-03 14:27:09 +02:00
Robert Müller b7e1e61988 Remove redundant argument of Dilate function
The pixel size (bytes per pixel) always has to be 4 for the `Dilate` function to work correctly. This is already checked before calling the function, so the redundant argument which is always `4` can be removed.
2023-10-03 13:52:37 +02:00
marmare314 227d074254 implement project-onto operation for envelopes 2023-10-02 23:45:08 +02:00
marmare314 ac6f6bd28e take pointer to editor in CLayer constructor 2023-10-02 23:15:31 +02:00
marmare314 d400687876 extract editor layers into seperate headers 2023-10-02 23:07:08 +02:00
marmare314 a7748ba87e revert quad selection correctly fixes #7248 2023-09-30 23:43:21 +02:00
furo f07e7fef76 Add export button to sounds 2023-09-30 17:28:47 +02:00
Dennis Felsing 359d9ab00b
Merge pull request #7176 from Marmare314/export-image
add export image button
2023-09-30 11:01:26 +00:00
furo 57ad88d6ee Add numpad shortcuts and button for zooming in envelope editor 2023-09-23 14:45:56 +02:00
marmare314 3f21597b6c check if quadpoint is selected and not if quad is selected
fixes #7199 (partially?)
2023-09-18 10:24:16 +02:00
Dennis Felsing 6b8997b64a
Merge pull request #7185 from furo321/editor-use-pack-functions
Use colour pack functions for editor
2023-09-15 22:37:03 +00:00
furo 25c3e1616e Use colour pack functions for editor 2023-09-15 22:30:25 +02:00
furo 321622b66b Prevent editor shortcuts when a dialog is open 2023-09-15 11:15:22 +02:00
marmare314 e4ddbaff49 add export image button 2023-09-14 17:51:10 +02:00
Robert Müller e19a96d0e5 Render editor brush selection size with instead of ,
For example, `20⨯10` instead of `20,10`.

This is the "vector" symbol, which makes the most sense in this context.
2023-09-10 11:59:27 +02:00
Robert Müller f3eaa10d7a
Merge pull request #7102 from Marmare314/revert-6844
revert change to quad selection (resolves #7025)
2023-09-08 15:21:53 +00:00
marmare314 ae7eda1628 revert change to quad selection (resolves 7025)
Some refactorings are kept and rotation being bound to `R` is also
not reverted.
2023-09-06 19:30:06 +02:00
furo f71a2e017a Add CTRL+F in load map prompt 2023-09-06 15:29:07 +02:00
heinrich5991 d2a12e01c1
Merge pull request #7126 from Robyt3/Graphics-Format-PixelSize
Add `CImageInfo::PixelSize` function, use `enum EImageFormat`
2023-09-06 09:57:59 +00:00
Harri Nieminen 4d9ff1d904 Fix typos
Found by codespell
2023-09-05 22:32:09 +03:00
Robert Müller dde45f7a40 Add CImageInfo::PixelSize function, use enum EImageFormat
Use `enum EImageFormat` type for image format literals and variables.

Add `PixelSize` function to get the number of bytes/color channels per pixel for a specified image format.

Remove unused store format argument of texture loading functions. All textures are automatically being stored as RGBA, so the argument was unused. Also remove the therefore unused `FORMAT_AUTO`.

Rename variables consistently to `PixelSize` and use `size_t`, instead of mixing different names like `BPP` and `ColorChannelCount`.

Validate image format loaded from maps using `CImageInfo::ImageFormatFromInt`. Add `FORMAT_ERROR` to represent invalid formats.

Remove redundant `PixelSize` parameter from graphics backends and commands, which can be derived from the texture format.

Fix memory leak when RGB image data is being converted to RGBA format when saving map in editor.
2023-09-03 20:40:28 +02:00
Robert Müller 16bc489afb Move editor automap .rules files to separate subfolder
For better organization of the `data/editor` folder.
2023-09-02 11:41:46 +02:00
Dennis Felsing 54134d6d38
Merge pull request #7119 from Robyt3/UI-Progress-Spinner-Editor
Add progress spinner to UI, show progress spinner while saving map in editor
2023-09-01 23:43:16 +02:00
Robert Müller eac1dc4533 Show progress spinner while saving map in editor 2023-09-01 19:26:34 +02:00
marmare314 59df1d86d4 move CEditorMap::HandleMapDrop to CEditor 2023-09-01 18:57:36 +02:00
marmare314 12d0608dfd let CEditorImage inherit CEditorComponent 2023-09-01 18:57:35 +02:00
marmare314 07fd8e6712 let CAutoMapper inherit CEditorComponent 2023-09-01 18:57:13 +02:00
marmare314 c3a07dd977 let CEditorSound inherit CEditorComponent 2023-08-29 22:28:07 +02:00
marmare314 d68029a252 extract CEditorSound into separate header file 2023-08-29 22:08:12 +02:00
marmare314 5f60d68e8b extract CEditorImage into separate header 2023-08-29 22:08:12 +02:00
marmare314 a1ea2f1ff1 Split up io.cpp 2023-08-29 22:08:07 +02:00
heinrich5991 812231449b
Merge pull request #7093 from HiRavie/master
Fix all envelopes being saved as bezier
2023-08-28 14:51:49 +00:00
Ravie 6705cccb72 Fix all envelopes being saved as bezier 2023-08-28 16:19:41 +02:00
Dennis Felsing ff1a2a44d3
Merge pull request #7076 from dobrykafe/pr-fix-map-drag-and-drop
Add warning for unsaved editor changes when dragging a map file into the game
2023-08-28 13:49:58 +00:00
Dennis Felsing c7f3be7d75
Merge pull request #7082 from Marmare314/editor-seperate-mapitems
extract code from editor mapitems into separate files
2023-08-28 10:23:17 +00:00
Robert Müller 3988877e8e
Merge pull request #7002 from Marmare314/pixelart
Add pixelart tool to editor
2023-08-27 18:42:35 +00:00
marmare314 946be50807 Add tileart tool to editor 2023-08-27 16:07:56 +02:00
marmare314 e19b1e4da6 extract code from editor mapitems into separate files 2023-08-27 16:04:53 +02:00
marmare314 605a93787e improve code style in proofmode, mapgrid and mapview 2023-08-27 11:38:15 +02:00
dobrykafe 758601c310 remove duplicate code 2023-08-26 22:28:19 +02:00
dobrykafe cb29ad2b4f dont switch to editor if loading fails 2023-08-26 22:13:13 +02:00
Robert Müller 8effc201bd
Merge pull request #7075 from Marmare314/issue-7053
clamp value-range for color envelopes in popups
2023-08-26 18:14:06 +00:00
dobrykafe 8957ae99bd remove whitespace 2023-08-26 19:44:53 +02:00
dobrykafe 5e923adcc9 fix map drag and drop 2023-08-26 18:14:13 +02:00
marmare314 c5282682f7 clamp value-range for color envelopes in popups
fixes #7053
2023-08-26 17:23:37 +02:00
marmare314 c68350a08a reset operation status after creating envelope context menu
fixes #7050
2023-08-26 17:14:57 +02:00
Robert Müller 6b6ee21338
Merge pull request #7017 from Marmare314/mapview
Add `CProofMode` and `CMapGrid` component
2023-08-26 08:54:38 +00:00
marmare314 467de92377 Add CProofMode and CMapGrid component
Also extract more code into `CMapView` and extend the `CEditorComponent`
interface.
2023-08-25 20:40:27 +02:00
Robert Müller b6f0c59b26 Refactor editor entities layer explanations
Use `enum`. Organize explanations in separate functions for DDNet, FNG and Vanilla.
2023-08-25 17:49:13 +02:00
Robert Müller d2c9750c65 Add str_from_int function
Add more efficient function for formatting integer values as strings.

A benchmark shows that using this function is significantly faster than using `str_format`. It is faster by a factor of 220 with Clang 15.0 O2 (https://quick-bench.com/q/BlNoLnlyqxipf4jvsFTUxKMHDJU) and by a factor of 11 with GCC 12.2 O2 (https://quick-bench.com/q/Fxf9lDCTqXBF4pIa_IyZ5R0IqYg).

This increases FPS in the editor by ~25% when many numbers are rendered for switch/tele/speedup/tune layers or with "Show Info" being enabled.

The additional static analysis for `std::to_chars` revealed that the wrong size was used in `CHud` for `aScoreTeam[TEAM_RED]` and `aScoreTeam[TEAM_BLUE]`.

This requires incrementing the macOS deployment target from 10.13 to 10.15.
2023-08-24 20:54:17 +02:00
Robert Müller a325245397 Don't clear saved brushes when loading another map
It was not actually necessary to clear the brushes to prevent the crashes. The crashes were fixed by not storing the texture handles for the layers anymore.

Closes #7024.
2023-08-19 20:46:14 +02:00
Robert Müller db1452d0a8
Merge pull request #6988 from Marmare314/envelope-scale
implement scaling for envelope editor
2023-08-19 09:49:17 +00:00
marmare314 23e2d9377d implement scaling for envelope editor 2023-08-16 15:06:41 +02:00
marmare314 fded5013eb Do not activate box selection when panning (fixes #7031 and #7030)
And do not pan while any other operation is in progress.
2023-08-16 12:17:06 +02:00
Robert Müller 7168fb15d2 Move OnWindowResize listener to engine, handle editor
Register the `OnWindowResize` listener in the engine client instead of the game client and properly dispatch the event also to the editor, so text containers in the editor are cleared when the window is resized.

Closes #7018.
2023-08-15 20:17:27 +02:00
marmare314 77e36c5062 change interface and fix scalelength 2023-08-14 10:12:06 +02:00
marmare314 a46f320d24 remove unnecessary include 2023-08-14 09:03:03 +02:00
marmare314 7925f9fd45 format 2023-08-14 08:59:01 +02:00
marmare314 72b0fbfada format 2023-08-14 08:53:59 +02:00
marmare314 2bcfbae841 Add CEditorComponent to moduralize editor
Refactor CSmoothZoom and introduce CMapView
2023-08-14 08:36:02 +02:00
Dennis Felsing 8eab94bcac
Merge pull request #6992 from Marmare314/selection-order-bug
Switch order in which envelope points are selected
2023-08-10 20:22:53 +00:00
Dennis Felsing 7f636329b2
Merge pull request #6993 from Marmare314/hidden-channel-bug
Ignore hidden channels when selecting envelopes
2023-08-10 20:22:07 +00:00
marmare314 93332af243 Disallow adding overlapping envelope points
Also now round is used to convert the mouse position to fixed
precision time which places the added point closer to the mouse position.
2023-08-10 08:38:10 +02:00
marmare314 3d400b13b5 Ignore hidden channels when selecting envelopes
When two envelope points overlap it can happen that the hidden
one will be marked as hot. Then neither can be selected.
2023-08-10 08:27:17 +02:00
marmare314 e1931d216a Switch order in which envelope points are selected
When multiple envelope points could be selected, switch the order
such that the one that is visible is selected first.
2023-08-10 08:16:15 +02:00
Edgar 8c49c2ea4b
Merge pull request #6952 from Robyt3/TextRender-Font-Index-File
Add font index, support font family variants depending on language
2023-08-05 15:49:12 +00:00
Robert Müller d642abd722 Add font index, support font family variants depending on language
Add `fonts/index.json` which specifies:

- List of all font files that should be loaded (filenames).
- Default font (specified by family name or by family and style name).
- Font variants for different languages, using the name of the language file as key.
- Fallback fonts.
- Icon font.

There are characters (e.g. all in `刃直海角骨入`) that look different depending on the language of the content being Japanese, Simplified Chinese, Traditional Chinese and Hangul, because Unicode uses the same codepoint for characters regardless of the language. To render these characters correctly, the active variant font is switched depending on the selected language.

The `ITextRender` interface is changed so the current language variant can be set using `SetFontLanguageVariant` and the default and icon fonts can be toggled using `SetFontPreset`. The class `CFont` is removed entirely.

The text render is restructured: The font faces and font atlas are now managed by a separate class `CGlyphMap` like on upstream. As the text fill and outline textures always have the same size, the texture skyline only needs to be stored once and free positions in the atlas only need to be calculated once for each glyph instead of separately for the fill and outline textures.

The font files and their licenses are also updated:

- Update Source Han Sans to version 2.001.
- Update Glow Sans Japanese Compressed to version 0.93.
- Update Deja Vu Sans to version 2.37.
- Update Font Awesome icons font to March 2023 version.

Closes #6881.
2023-08-01 19:30:25 +02:00
Edgar b909cfadd8
Merge pull request #6943 from Robyt3/Editor-shared_ptr-Refactoring
Use `std::shared_ptr` for editor resources, fix crashes with brush
2023-08-01 09:13:59 +00:00
marmare314 93e95bbd38 add box selection to envelope editor 2023-07-29 15:10:14 +02:00
Robert Müller 6f03aabb34 Use std::shared_ptr for editor resources, fix crashes with brush
Simplify memory management of groups, layers, images, sounds and envelopes by using `std::shared_ptr` for all of them.

Clear brush when creating a new map to prevent crash due to unloaded textures being used in tile layer. Closes #6935.

Also fix crash when restoring a saved brush after removing an image that is being used by it.
2023-07-28 21:17:19 +02:00
marmare314 862c0ca2fc make point hitbox bigger 2023-07-28 17:47:28 +02:00
marmare314 babdbc4b17 add grid to envelope editor 2023-07-28 16:18:56 +02:00
Robert Müller b33c9ca977
Merge pull request #6934 from Marmare314/zoom-reset-big-values
handle big value ranges on envelope zoom reset
2023-07-28 13:25:46 +00:00
Robert Müller c2379591e0
Merge pull request #6941 from Marmare314/zoom-adaption
improve offset adaption for envelope zoom
2023-07-28 12:16:56 +00:00
marmare314 f3353e8062 improve offset adaption for envelope zoom
The offset adaption was not correct. Close to the origin it was not really noticeable,
but further away the points shifted offscreen when zooming.
2023-07-28 12:50:12 +02:00
marmare314 62ee646283 allow multiple selection in envelope editor 2023-07-28 12:41:25 +02:00
marmare314 d964a3d327 handle big value ranges on envelope zoom reset 2023-07-27 19:47:06 +02:00
marmare314 873a8543df calculate zoom factor correctly for target zoom 2023-07-27 18:36:58 +02:00
Robert Müller 22bd19be06
Merge pull request #6920 from Marmare314/layer-drag-bug
reset layer dragging status if no buttons were pressed
2023-07-26 09:01:38 +00:00
marmare314 be861664bc reset layer dragging status if no buttons were pressed 2023-07-26 09:34:36 +02:00
marmare314 3010633099 improve envelope y offset on reset for small value ranges 2023-07-26 00:10:15 +02:00
Robert Müller 71500fd60c Improve server settings editor and status bar
Use icons for all server settings buttons. Rearrange and group buttons.

Show buttons in disabled state when they are not useable instead of hiding them.

Remove checker background from server settings list.

Overhaul hotkeys, also show hotkeys in the tooltips:
- Enter: add command
- Alt+Enter: update command (previously M)
- Alt+Up/Down: move command up/down (previously no hotkey)
- Delete: delete command

Don't activate command lineinput when selecting, moving or deleting elements, as this prevents the listbox from accepting the delete hotkey.

Fix server settings listbox being active while file dialog is open.

Ensure extra editor dragbar area matches the respective toolbar size.

Remove spacing on the left side of extra editors to improve alignment.

Increase status bar button sizes and make them consistent.

Use `enum` to track active extra editor instead of using multiple `bool`s.

Disable extra editor buttons when tile picker is shown, as the extra editors are not rendered in this case.
2023-07-25 21:21:54 +02:00
Robert Müller 177f7485c2 Render editor status bar except tooltip behind popups
So that buttons in the status bar cannot be used while a popup or the file dialog is open.

The tooltip still has to be rendered after popup menus, as popup menus can set the tooltip, which would otherwise not be shown.
2023-07-25 20:17:36 +02:00
Robert Müller d8c05115c9 Add constructor for CSetting and use emplace_back 2023-07-25 20:17:27 +02:00
marmare314 d4110529e4 implement zoom and drag in envelope editor 2023-07-24 22:58:26 +02:00
Robert Müller eb8619e104 Set default name when saving map under new name or as copy
When using "Save as" and "Save copy" set the default map name in the file dialog to the name of the current map.
2023-07-24 19:02:43 +02:00