Callback messages were not being handled and since MouseEnter and
MouseLeave events were wrapped into CallbackMessages they were lost
and so never got called
Added REPORT_MOUSE/PAINT/TIMER_MESSAGES macros, and change _EVENTS to
_MESSAGES to avoid confusion with the current terminology.
The output string for each message was also simplified.
We're compiling Lua as C++, but it seems that target_compile_options()
doesn't work for Visual Studio solutions (only for Ninja/makefiles).
The proper cmake solution to this issue is using
set_source_files_properties() to specify C++ as the language to use to
compile all Lua C files. This generates a valid Visual Studio solution.
Prior to this fix, the following particular conditions caused
an incorrect conversion of an opaque color to a transparent color
during RGBA->Indexed conversion:
- RGBA image with black color (#000000 a=255) painted on the canvas
- The black color is absent from the palette.
- The mask color is present in the palette
- Converts the sprite to indexed color mode using
Sprite > Color Mode > More Options
- Select Advanced Options, select a Color Best Fit Criteria other than
Default (for example CIELAB) and press OK
- The original black color becomes the mask color.
Now we lazily initialize the description of each backup on each
session. This means that only when we have to display the item on the
screen (onPaint) we'll ask for the description/doc
info (width/height/color mode, etc.). We've also removed the check of
all magic numbers of every single object in the backup when we only
need the doc description.
It's now possible to get/set the selected foreground/background tile
index. Example of use:
app.fgTile = 1 -- the primary tile is '1'
print(app.fgTile) -- this will show '1'
app.fgTile = 0 -- the primery tile is 'no tile'
print(app.fgTile) -- this will show '0'
app.bgTile = 2 -- the secondary tile is '2'
Introduced Key::isListed() and Command::isListed() to customize when a
command should be displayed in the list of shortcuts.
Removed commands:
'Launch'
'OpenBrowser'
And removed unnecessary commands:
'Change Color Mode: Indexed'
'Contract Selection'
'Export Sprite Sheet'
'Flip Canvas Horizontally'
'Frame Properties'
'Load Palette'
'Open Sprite'
'Playback Speed 1x'
'Run Script'
'Save Palette'
'Select Used Colors'
'Set Palette Entry Size'
'Tileset Mode: Auto'
This was changed to reset_position_to_center in
d4c9a2fb36f44576db2dee76613525623d8b5b06 but it's better if we keep
the string ID as it is so we can use the existent i18n.
This regression came from 09bb5cc3d3676e88048d5cd845b075ea30ca8e66 as
now we don't Sprite::setTransparentColor() on each undo/redo and only
when needed. This brought a new kind of error where the mask color for
images was set to -1 after convert_pixel_format().
This also fixes a conversion from Indexed -> RGB where the transparent
color was not set back to 0. And the transparent color is always set
when we are in indexed mode to avoid any assert in debug mode.
When we are in Indexed mode we can have a specific index as the
transparent color, if we convert the sprite to RGB, that transparent
color is lost, so we have to save it (in a cmd::SetTransparentColor)
to restore it correctly when we undo the ChangePixelFormatCommand.
Original issue title: When using a background layer, switching to
Indexed Color Mode fills all layer bounding rectangles with
Color 0.
Conditions to reproduce the original issue:
- Opaque RGBA sprite, i.e. the bottom layer is 'Background'.
- There is a second layer with an ellipse (for example).
- There is a mask color #000000 alpha=0 is in the palette.
- The mask color index is greater and not equal than 0.
- Go to Sprite > Color Mode > Indexed.
Result: the transparent color of the second layer will change to
index color = 0 (usually black).
Also added test for RGBA->INDEXED conversion
Before this fix, the lua command:
app.command.ExportSpriteSheet
could not process a layer within a group when the layer name
was expressed using the layer hierarchy path, for example:
layer = "Group1/Layer1"
We can select the default color or tile from preferences depending if
we're going to paint pixels or tiles
Fixes a confusing logic from 4a91d150af97e70e588e82d698dc8c5e0db8e6fe
where the bg color was obtained from preferences only when the fg
color type (rgb/gray/index/hsv/tile/etc.) was equal to the bg color
type from the preferences (rgb/gray/index/hsv/tile/etc.).