mirror of https://github.com/aseprite/aseprite.git
Compare commits
139 Commits
cef280218a
...
f6d47f8005
Author | SHA1 | Date |
---|---|---|
|
f6d47f8005 | |
|
7e4f9ad078 | |
|
af349ce7ee | |
|
3bc4ac0838 | |
|
1774d86939 | |
|
dce1dfd06b | |
|
6283d69707 | |
|
27da1b03d0 | |
|
834a94855f | |
|
21ad78cdbb | |
|
20b11a0fd3 | |
|
8d4c4857ee | |
|
70c8924719 | |
|
286dd1c755 | |
|
3a14ac72a4 | |
|
2db193b8e3 | |
|
002356ce19 | |
|
9a1e92da35 | |
|
07803ff361 | |
|
8e07617a9d | |
|
9c5ca6bcc6 | |
|
e193891df3 | |
|
bb8547d004 | |
|
85997a08cf | |
|
0995e72a6f | |
|
f61c2c3950 | |
|
0c49f2d7ad | |
|
5f7cc42333 | |
|
8e75cfc4c7 | |
|
983b07383f | |
|
c57554646b | |
|
74953174d6 | |
|
49fa35237a | |
|
0ccf9dcc4f | |
|
194f8424a8 | |
|
debab653fa | |
|
6e9024d54d | |
|
1fa7fd0831 | |
|
ab6b040e83 | |
|
bc312a37b3 | |
|
1ac451de03 | |
|
3129fda977 | |
|
6cb61fb41e | |
|
aa817a8d2a | |
|
40031f83d8 | |
|
ed3c8c510b | |
|
f23e3255bb | |
|
90282dbc40 | |
|
1227f9c49c | |
|
d61ae919ad | |
|
58a5a64cd2 | |
|
b2b2583176 | |
|
b535212642 | |
|
2dbfaf746b | |
|
23d4543272 | |
|
229a3cdf65 | |
|
b3814ec912 | |
|
e88f3bb413 | |
|
366751d1f2 | |
|
7434db6882 | |
|
5e12a5d3d8 | |
|
60112cd929 | |
|
a1fb751323 | |
|
24046600ec | |
|
34aae80eab | |
|
c8ae1017b3 | |
|
9c5d1feaf5 | |
|
aa66d260ad | |
|
86c7fae42c | |
|
778e62a411 | |
|
b08662eeca | |
|
d6c5ac6786 | |
|
e0226d95d9 | |
|
7eb2df6965 | |
|
c445075a79 | |
|
f556052fc6 | |
|
c8e9b33ad3 | |
|
37d2be7668 | |
|
43140e71ec | |
|
eecc14153d | |
|
131aa8b3df | |
|
ab69421096 | |
|
0e4e776bc0 | |
|
78b9f340f7 | |
|
92a039a619 | |
|
dc040e81e7 | |
|
465574e2db | |
|
544f711adc | |
|
ec95323856 | |
|
9b56d5ba3d | |
|
2c0920f514 | |
|
ba39b56096 | |
|
ad4d00ced2 | |
|
6df6037fdc | |
|
bb65296a1a | |
|
eaa2bdf0af | |
|
57309e5aa5 | |
|
4bb9239f50 | |
|
cef92c1a38 | |
|
22e72ab5cb | |
|
80fa065bd5 | |
|
de1ccb24dd | |
|
7d91c4b9d9 | |
|
6d89a6bc15 | |
|
d4e97b5a96 | |
|
205b18dc0f | |
|
2ba051b59b | |
|
3fcb000eb1 | |
|
af9dc3c817 | |
|
250dfdc86a | |
|
c904c41b39 | |
|
9e941e9a8b | |
|
bbab4d5875 | |
|
5c4daff128 | |
|
11a7b061ff | |
|
283bedf77e | |
|
2eeb6f04a7 | |
|
706d0b8a7a | |
|
2f3a7f5dec | |
|
d5de74b715 | |
|
2d87a7b184 | |
|
2f22804fe8 | |
|
bf1b4c6f50 | |
|
250244c777 | |
|
b4555fc098 | |
|
8783135bf7 | |
|
1a6a39700e | |
|
ce742bcbc1 | |
|
3c350c3e67 | |
|
7d78f4f5d1 | |
|
58011d9f87 | |
|
f612e48966 | |
|
2322cd02ee | |
|
4d239f089f | |
|
156cf0cfcf | |
|
14b64f341e | |
|
0a18e5ffc6 | |
|
94ddd406af | |
|
35fb6597d4 |
|
@ -1,9 +0,0 @@
|
|||
Describe your bug report or feature request here
|
||||
...
|
||||
...
|
||||
...
|
||||
|
||||
### Aseprite and System version
|
||||
|
||||
* Aseprite version: version number, installer/portable/Steam/beta/dev/commit-hash
|
||||
* System: Windows/macOS/Linux, version, distribution
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug, triage
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots or a screen recording to help explain your problem.
|
||||
|
||||
**Aseprite & System (please complete the following information):**
|
||||
- Aseprite: [version number, installer/portable/Steam/beta/dev/commit-hash]
|
||||
- System: [Windows/macOS/Linux, version, distribution]
|
||||
- Extensions: [List the extensions you have installed]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for Aseprite
|
||||
title: ''
|
||||
labels: feature, triage
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Did other user suggested a similar idea?**
|
||||
- [ ] No
|
||||
- [ ] Yes/Links to similar ideas
|
||||
> You can try to find a similar feature requests before in:
|
||||
> - GitHub issues: https://github.com/aseprite/aseprite/issues?q=label%3Afeature
|
||||
> - Community site: https://community.aseprite.org/c/features/7
|
||||
> - Steam community: https://steamcommunity.com/app/431730/discussions/1/
|
||||
> In case you find a similar feature request, making a comment there will be useful to give some traction and show interest in the feature.
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
|
@ -4,7 +4,7 @@ Aseprite is being developed and maintained currently by [Igara Studio](https://i
|
|||
The active team of developers is:
|
||||
|
||||
* [David Capello](https://github.com/dacap)
|
||||
* [Gaspar Capello](https://github.com/Gsparoken)
|
||||
* [Gaspar Capello](https://github.com/Gasparoken)
|
||||
* [Martín Capello](https://github.com/martincapello)
|
||||
* [Christian Kaiser](https://github.com/ckaiser)
|
||||
* [Dante Paola](https://github.com/Liebranca)
|
||||
|
|
8
build.sh
8
build.sh
|
@ -428,9 +428,17 @@ if [ ! -d "$skia_library_dir" ] ; then
|
|||
skia_url=$(bash laf/misc/skia-url.sh $skia_build)
|
||||
skia_file=$(basename $skia_url)
|
||||
if [ ! -f "$skia_dir/$skia_file" ] ; then
|
||||
if ! command -v curl >/dev/null 2>&1 ; then
|
||||
echo "Error: 'curl' command line tool is not available in PATH"
|
||||
exit 1
|
||||
fi
|
||||
curl --ssl-revoke-best-effort -L -o "$skia_dir/$skia_file" "$skia_url"
|
||||
fi
|
||||
if [ ! -d "$skia_library_dir" ] ; then
|
||||
if ! command -v unzip >/dev/null 2>&1 ; then
|
||||
echo "Error: 'unzip' command line tool is not available in PATH"
|
||||
exit 1
|
||||
fi
|
||||
unzip -n -d "$skia_dir" "$skia_dir/$skia_file"
|
||||
fi
|
||||
else
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
File diff suppressed because it is too large
Load Diff
11
data/gui.xml
11
data/gui.xml
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Aseprite -->
|
||||
<!-- Copyright (C) 2018-2024 Igara Studio S.A. -->
|
||||
<!-- Copyright (C) 2018-2025 Igara Studio S.A. -->
|
||||
<!-- Copyright (C) 2001-2018 David Capello -->
|
||||
<gui>
|
||||
<!-- Keyboard shortcuts -->
|
||||
|
@ -175,6 +175,7 @@
|
|||
<param name="popup" value="background" />
|
||||
</key>
|
||||
<key command="ShowExtras" shortcut="Ctrl+H" />
|
||||
<key command="ToggleWorkspaceLayout" shortcut="Shift+W" />
|
||||
<!-- Tabs -->
|
||||
<key command="GotoNextTab" shortcut="Ctrl+Tab" />
|
||||
<key command="GotoPreviousTab" shortcut="Ctrl+Shift+Tab" />
|
||||
|
@ -371,6 +372,12 @@
|
|||
<param name="quantity" value="1" />
|
||||
</key>
|
||||
|
||||
<!-- Main selection actions (apply transformation / undo) -->
|
||||
<key command="DeselectMask" shortcut="Esc" context="Transformation" />
|
||||
<key command="Apply" shortcut="Enter" context="Transformation" />
|
||||
<key command="Apply" shortcut="Enter Pad" context="Transformation" />
|
||||
<key command="Undo" shortcut="Ctrl+Z" mac="Cmd+Z" context="Transformation" />
|
||||
|
||||
<!-- Move selection with arrows -->
|
||||
<key command="MoveMask" shortcut="Left" context="Selection">
|
||||
<param name="target" value="content" />
|
||||
|
@ -1002,6 +1009,7 @@
|
|||
</menu>
|
||||
<menu text="@.view" id="view_menu">
|
||||
<item command="DuplicateView" text="@.view_duplicate_view" group="view_new" />
|
||||
<item command="ToggleWorkspaceLayout" text="@.view_workspace_layout" />
|
||||
<separator />
|
||||
<item command="ShowExtras" text="@.view_show_extras" />
|
||||
<menu text="@.view_show" group="view_extras">
|
||||
|
@ -1203,6 +1211,7 @@
|
|||
|
||||
<menu id="slice_popup_menu">
|
||||
<item command="SliceProperties" text="@.properties" group="slice_popup_properties" />
|
||||
<item command="DuplicateSlice" text="@.duplicate" group="slice_popup_duplicate" />
|
||||
<item command="RemoveSlice" text="@.delete" group="slice_popup_delete" />
|
||||
</menu>
|
||||
|
||||
|
|
|
@ -167,6 +167,7 @@
|
|||
<option id="keep_closed_sprite_on_memory_for" type="double" default="15.0" />
|
||||
<option id="show_full_path" type="bool" default="true" />
|
||||
<option id="edit_full_path" type="bool" default="false" />
|
||||
<option id="workspace_layout" type="std::string" />
|
||||
<option id="timeline_position" type="TimelinePosition" default="TimelinePosition::BOTTOM" />
|
||||
<option id="timeline_layer_panel_width" type="int" default="100" />
|
||||
<option id="show_menu_bar" type="bool" default="true" />
|
||||
|
@ -255,6 +256,7 @@
|
|||
<option id="one_finger_as_mouse_movement" type="bool" default="true" />
|
||||
<option id="load_wintab_driver" type="bool" default="false" />
|
||||
<option id="flash_layer" type="bool" default="false" />
|
||||
<option id="use_selection_tool_loop" type="bool" default="false" />
|
||||
<option id="nonactive_layers_opacity" type="int" default="255" />
|
||||
<option id="nonactive_layers_opacity_preview" type="int" default="255" />
|
||||
</section>
|
||||
|
@ -356,6 +358,7 @@
|
|||
<section id="file_selector">
|
||||
<option id="current_folder" type="std::string" default=""<empty>"" />
|
||||
<option id="zoom" type="double" default="1.0" />
|
||||
<option id="show_hidden" type="bool" default="false" />
|
||||
</section>
|
||||
<section id="text_tool">
|
||||
<option id="font_face" type="std::string" />
|
||||
|
@ -526,6 +529,7 @@
|
|||
<section id="grid" canforce="true">
|
||||
<option id="snap" type="bool" default="false" />
|
||||
<option id="bounds" type="gfx::Rect" default="doc::Sprite::DefaultGridBounds()" />
|
||||
<option id="type" type="doc::Grid::Type" default="doc::Sprite::DefaultGridType()" />
|
||||
<option id="color" type="app::Color" default="app::Color::fromRgb(0, 0, 255)" />
|
||||
<option id="opacity" type="int" default="160" />
|
||||
<option id="auto_opacity" type="bool" default="true" />
|
||||
|
|
|
@ -206,6 +206,7 @@ AddColor_Background = Background
|
|||
AddColor_Foreground = Foreground
|
||||
AddColor_Specific = Specific
|
||||
AdvancedMode = Advanced Mode
|
||||
Apply = Apply
|
||||
AutocropSprite = Trim Sprite
|
||||
AutocropSprite_ByGrid = Trim Sprite by Grid
|
||||
BackgroundFromLayer = Background from Layer
|
||||
|
@ -265,6 +266,7 @@ Despeckle = Despeckle
|
|||
DeveloperConsole = Developer Console
|
||||
DiscardBrush = Discard Brush
|
||||
DuplicateLayer = Duplicate Layer
|
||||
DuplicateSlice = Duplicate Slice
|
||||
DuplicateSprite = Duplicate Sprite
|
||||
DuplicateView = Duplicate View
|
||||
Exit = Exit
|
||||
|
@ -488,6 +490,7 @@ TilesetDuplicate = Duplicate Tileset
|
|||
Undo = Undo
|
||||
UndoHistory = Undo History
|
||||
UnlinkCel = Unlink Cel
|
||||
ToggleWorkspaceLayout = Toggle Workspace Layout
|
||||
Zoom = Zoom
|
||||
Zoom_In = Zoom In
|
||||
Zoom_Out = Zoom Out
|
||||
|
@ -581,8 +584,9 @@ rotsprite = RotSprite
|
|||
pixel_perfect = Pixel-perfect
|
||||
linear_gradient = Linear Gradient
|
||||
radial_gradient = Radial Gradient
|
||||
drop_pixel = Drop pixels here (Enter)
|
||||
cancel_drag = Cancel drag and drop (Esc)
|
||||
drop_pixel_and_deselect = Apply transformation and deselect
|
||||
drop_pixel = Apply transformation and keep selection
|
||||
cancel_drag = Cancel transformation and undo/discard changes
|
||||
auto_select_layer = Auto Select Layer
|
||||
all = All
|
||||
none = None
|
||||
|
@ -621,6 +625,14 @@ current_layer = Current Layer
|
|||
first_ref_layer = First Reference Layer
|
||||
pick = Pick:
|
||||
sample = Sample:
|
||||
position_label = P:
|
||||
rotation_label = R:
|
||||
position_x = X Position
|
||||
position_y = Y Position
|
||||
size_width = Width
|
||||
size_height = Height
|
||||
rotation_angle = Angle
|
||||
rotation_skew = Skew
|
||||
|
||||
[convolution_matrix]
|
||||
reload_stock = &Reload Stock
|
||||
|
@ -765,6 +777,7 @@ pinned_folders = Pinned Folders
|
|||
recent_folders = Recent Folders
|
||||
all_formats = All formats
|
||||
all_files = All files
|
||||
show_hidden = Show hidden
|
||||
|
||||
[filters]
|
||||
selected_cels = Selected
|
||||
|
@ -788,7 +801,22 @@ empty_fonts = No system fonts were found
|
|||
[font_style]
|
||||
antialias = Antialias
|
||||
hinting = Hinting
|
||||
hinting_none = No Hinting
|
||||
hinting_slight = Slight Hinting
|
||||
hinting_full = Full Hinting
|
||||
ligatures = Ligatures
|
||||
font_weight = Font Weight
|
||||
italic = Italic
|
||||
font_weight_100 = Thin
|
||||
font_weight_200 = Extra Light
|
||||
font_weight_300 = Light
|
||||
font_weight_400 = Normal
|
||||
font_weight_500 = Medium
|
||||
font_weight_600 = Semi Bold
|
||||
font_weight_700 = Bold
|
||||
font_weight_800 = Extra Bold
|
||||
font_weight_900 = Black
|
||||
font_weight_1000 = Extra Black
|
||||
|
||||
[frame_combo]
|
||||
all_frames = All frames
|
||||
|
@ -816,6 +844,8 @@ same_in_all_tools = Same in all Tools
|
|||
opacity = Opacity:
|
||||
tolerance = Tolerance:
|
||||
show_more = Show more...
|
||||
search = Search
|
||||
copy_of = {} Copy
|
||||
|
||||
[general_text]
|
||||
copy = &Copy
|
||||
|
@ -842,6 +872,9 @@ x = X:
|
|||
y = Y:
|
||||
width = Width:
|
||||
height = Height:
|
||||
type_orthogonal = Orthogonal
|
||||
type_isometric_shared = Isometric (Shared Edges)
|
||||
type_isometric_thick = Isometric (Thick Edges)
|
||||
|
||||
[home_view]
|
||||
title = Home
|
||||
|
@ -956,6 +989,7 @@ key_context_move_tool = Move Tool
|
|||
key_context_freehand_tool = Freehand Tool
|
||||
key_context_shape_tool = Shape Tool
|
||||
key_context_frames_selection = Frames Selection
|
||||
key_context_transformation = Transformation
|
||||
copy_selection = Copy Selection
|
||||
snap_to_grid = Snap To Grid
|
||||
lock_axis = Lock Axis
|
||||
|
@ -1163,6 +1197,7 @@ select_load_from_file = &Load from MSK file
|
|||
select_save_to_file = &Save to MSK file
|
||||
view = &View
|
||||
view_duplicate_view = Duplicate &View
|
||||
view_workspace_layout = Workspace &Layout
|
||||
view_show_extras = &Extras
|
||||
view_show = &Show
|
||||
view_show_layer_edges = &Layer Edges
|
||||
|
@ -1204,6 +1239,14 @@ help_twitter = Twitter
|
|||
help_enter_license = Enter &License
|
||||
help_about = &About
|
||||
|
||||
[main_window]
|
||||
layout = Workspace Layout
|
||||
default_layout = Default
|
||||
mirrored_default_layout = Mirrored Default
|
||||
timeline = Timeline
|
||||
user_layouts = User Layouts
|
||||
new_layout = New Layout...
|
||||
|
||||
[mask_by_color]
|
||||
title = Select Color
|
||||
label_color = Color:
|
||||
|
@ -1232,6 +1275,20 @@ name = Name:
|
|||
tileset = Tileset:
|
||||
default_new_layer_name = New Layer
|
||||
|
||||
[new_layout]
|
||||
title = New Workspace Layout
|
||||
name = Name:
|
||||
deleting_layout = Deleting Layout
|
||||
deleting_layout_confirmation = Are you sure you want to delete the '{}' layout?
|
||||
restoring_layout = Restoring Layout
|
||||
restoring_layout_confirmation = Are you sure you want to restore the '{}' layout?
|
||||
|
||||
[dock]
|
||||
left = Dock Left
|
||||
right = Dock Right
|
||||
top = Dock Top
|
||||
bottom = Dock Bottom
|
||||
|
||||
[news_listbox]
|
||||
more = More...
|
||||
problem_loading = Problems loading news. Please retry.
|
||||
|
@ -1467,6 +1524,9 @@ grid_x = X:
|
|||
grid_y = Y:
|
||||
grid_width = Width:
|
||||
grid_height = Height:
|
||||
grid_type_orthogonal = Orthogonal
|
||||
grid_type_isometric_shared = Isometric (Shared Edges)
|
||||
grid_type_isometric_thick = Isometric (Thick Edges)
|
||||
grid_color = Color:
|
||||
grid_opacity = Opacity:
|
||||
grid_auto = Auto
|
||||
|
@ -1561,6 +1621,7 @@ set_cursor_fix = Set cursor position from stylus location
|
|||
set_cursor_fix_tooltip = Sets the mouse position to the pen location when\nyou have two pointers available (e.g. mouse and pen)\n\nUseful to zoom in/out from the pen position and to get the\ncorrect cursor location when screencasting/live streaming.
|
||||
wintab_more_info = (More Information)
|
||||
flash_selected_layer = Flash layer when it is selected
|
||||
use_selection_tool_loop = New selection tools implementation
|
||||
non_active_layer_opacity = Opacity for non-active layers:
|
||||
cel_content_format = Cel content format:
|
||||
cel_format_compressed = Compressed
|
||||
|
@ -1663,6 +1724,10 @@ from = From:
|
|||
to = To:
|
||||
tolerance = Tolerance:
|
||||
|
||||
[duplicate_slice]
|
||||
x_duplicated = Slice "{}" duplicated
|
||||
n_slices_duplicated = {} slice(s) duplicated
|
||||
|
||||
[remove_slice]
|
||||
x_removed = Slice "{}" removed
|
||||
n_slices_removed = {} slice(s) removed
|
||||
|
@ -1747,6 +1812,7 @@ delete_file = Delete file, I've already sent it
|
|||
|
||||
[slice_popup_menu]
|
||||
properties = Slice &Properties...
|
||||
duplicate = D&uplicate Slice
|
||||
delete = &Delete Slice
|
||||
|
||||
[slice_properties]
|
||||
|
@ -1834,11 +1900,20 @@ pixel_scale = Pixel Scale
|
|||
with_vars = Use CSS3 Variables
|
||||
generate_html = Generate Sample HTML File
|
||||
|
||||
[shape]
|
||||
fill = Fill
|
||||
stroke = Stroke
|
||||
stroke_width = Stroke Width
|
||||
|
||||
[text_tool]
|
||||
font_family = Font Family
|
||||
font_size = Font Size
|
||||
bold = Bold
|
||||
italic = Italic
|
||||
more_options = More Options
|
||||
|
||||
[timeline_conf]
|
||||
position = Position:
|
||||
left = &Left
|
||||
right = &Right
|
||||
bottom = &Bottom
|
||||
frame_header = Frame Header:
|
||||
first_frame = First Frame:
|
||||
thumbnails = Thumbnails
|
||||
|
@ -1896,6 +1971,7 @@ timeline_show = Show Timeline
|
|||
|
||||
[undo_history]
|
||||
title = Undo History
|
||||
initial_state = Initial State
|
||||
|
||||
[user_data]
|
||||
user_data = User Data:
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<combobox id="location" expansive="true" />
|
||||
<button text="" id="refresh_button" style="refresh_button"
|
||||
tooltip="@.refresh_button_tooltip" tooltip_dir="bottom" />
|
||||
<check id="show_hidden_check" text="@.show_hidden" />
|
||||
</box>
|
||||
<vbox id="file_view_placeholder" expansive="true" />
|
||||
<grid columns="2">
|
||||
|
|
|
@ -16,6 +16,13 @@
|
|||
<label text="@.height" />
|
||||
<expr id="grid_h" text="" />
|
||||
|
||||
<boxfiller />
|
||||
<combobox id="grid_type" expansive="true" cell_hspan="3">
|
||||
<listitem text="@.type_orthogonal" />
|
||||
<listitem text="@.type_isometric_shared" />
|
||||
<listitem text="@.type_isometric_thick" />
|
||||
</combobox>
|
||||
|
||||
<separator horizontal="true" cell_hspan="4" />
|
||||
|
||||
<box horizontal="true" homogeneous="true" cell_hspan="4" cell_align="right">
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<!-- Aseprite -->
|
||||
<!-- Copyright (C) 2001-2017 by David Capello -->
|
||||
<gui>
|
||||
<window id="main_window" noborders="true" desktop="true">
|
||||
<vbox noborders="true" expansive="true">
|
||||
<hbox noborders="true" id="menu_bar_placeholder" />
|
||||
<hbox noborders="true" id="tabs_placeholder" />
|
||||
<splitter id="color_bar_splitter"
|
||||
horizontal="true" expansive="true"
|
||||
by="pixel"
|
||||
style="workspace_splitter">
|
||||
<vbox noborders="true" id="color_bar_placeholder" />
|
||||
<vbox noborders="true" expansive="true">
|
||||
<vbox noborders="true" id="context_bar_placeholder" />
|
||||
<hbox noborders="true" expansive="true">
|
||||
<splitter id="timeline_splitter"
|
||||
vertical="true" expansive="true"
|
||||
by="percetage" position="100"
|
||||
style="workspace_splitter">
|
||||
<hbox noborders="true" id="workspace_placeholder" expansive="true" />
|
||||
<vbox noborders="true" id="timeline_placeholder" expansive="true" />
|
||||
</splitter>
|
||||
<vbox noborders="true" id="tool_bar_placeholder" />
|
||||
</hbox>
|
||||
</vbox>
|
||||
</splitter>
|
||||
<hbox noborders="true" id="status_bar_placeholder" />
|
||||
</vbox>
|
||||
</window>
|
||||
</gui>
|
|
@ -0,0 +1,19 @@
|
|||
<!-- Aseprite -->
|
||||
<!-- Copyright (C) 2025 by Igara Studio S.A. -->
|
||||
<gui>
|
||||
<window id="new_layout" text="@.title">
|
||||
<vbox>
|
||||
<hbox>
|
||||
<label text="@.name" />
|
||||
<entry maxsize="128" id="name" magnet="true" expansive="true" />
|
||||
</hbox>
|
||||
|
||||
<separator horizontal="true" />
|
||||
|
||||
<hbox homogeneous="true" cell_align="right">
|
||||
<button text="@general.ok" closewindow="true" id="ok" disabled="true" minwidth="60" magnet="true" />
|
||||
<button text="@general.cancel" closewindow="true" />
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
</gui>
|
|
@ -426,6 +426,14 @@
|
|||
<expr id="grid_h" text="" />
|
||||
<hbox />
|
||||
|
||||
<label text="" />
|
||||
<combobox id="grid_type" expansive="true" cell_hspan="3">
|
||||
<listitem text="@.grid_type_orthogonal" />
|
||||
<listitem text="@.grid_type_isometric_shared" />
|
||||
<listitem text="@.grid_type_isometric_thick" />
|
||||
</combobox>
|
||||
<hbox />
|
||||
|
||||
<label text="@.grid_color" />
|
||||
<colorpicker id="grid_color" rgba="true" cell_hspan="3" />
|
||||
<hbox />
|
||||
|
@ -624,6 +632,7 @@
|
|||
text="@.hue_with_sat_value"
|
||||
pref="experimental.hue_with_sat_value_for_color_selector" />
|
||||
<check id="flash_layer" text="@.flash_selected_layer" />
|
||||
<check id="use_selection_tool_loop" text="@.use_selection_tool_loop" />
|
||||
<hbox>
|
||||
<label text="@.non_active_layer_opacity" />
|
||||
<slider id="nonactive_layers_opacity" min="0" max="255" width="128" />
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Aseprite -->
|
||||
<!-- Copyright (C) 2019-2024 Igara Studio S.A. -->
|
||||
<!-- Copyright (C) 2019-2025 Igara Studio S.A. -->
|
||||
<!-- Copyright (C) 2017-2018 David Capello -->
|
||||
<gui>
|
||||
<window id="slice_properties" text="@.title" help="slices#slice-properties">
|
||||
<vbox>
|
||||
<vbox expansive="true">
|
||||
<grid id="properties_grid" columns="3">
|
||||
<label id="label1" text="@.name" />
|
||||
<entry id="name" maxsize="256" magnet="true" cell_align="horizontal" expansive="true" />
|
||||
<button id="user_data" icon="icon_user_data" maxsize="32" tooltip="@.user_data_tooltip" />
|
||||
</grid>
|
||||
<grid columns="2">
|
||||
<separator horizontal="true" cell_hspan="2" />
|
||||
<grid columns="3" expansive="true">
|
||||
<separator horizontal="true" cell_hspan="3" />
|
||||
|
||||
<box />
|
||||
<hbox homogeneous="true">
|
||||
|
@ -20,6 +20,7 @@
|
|||
<label text="@.width" />
|
||||
<label text="@.height" />
|
||||
</hbox>
|
||||
<boxfiller cell_align="horizontal" />
|
||||
|
||||
<label text="@.bounds" />
|
||||
<hbox homogeneous="true">
|
||||
|
@ -28,6 +29,7 @@
|
|||
<expr id="bounds_w" />
|
||||
<expr id="bounds_h" />
|
||||
</hbox>
|
||||
<boxfiller />
|
||||
|
||||
<check text="@.center" id="center" />
|
||||
<hbox homogeneous="true">
|
||||
|
@ -36,16 +38,18 @@
|
|||
<expr id="center_w" />
|
||||
<expr id="center_h" />
|
||||
</hbox>
|
||||
<boxfiller />
|
||||
|
||||
<check text="@.pivot" id="pivot" />
|
||||
<hbox>
|
||||
<expr id="pivot_x" />
|
||||
<expr id="pivot_y" />
|
||||
</hbox>
|
||||
<boxfiller />
|
||||
|
||||
<separator horizontal="true" cell_hspan="2" />
|
||||
|
||||
<hbox cell_hspan="2">
|
||||
<boxfiller cell_align="vertical" cell_hspan="3" />
|
||||
<separator horizontal="true" cell_hspan="3" cell_align="horizontal" />
|
||||
<hbox cell_hspan="3">
|
||||
<boxfiller />
|
||||
<hbox homogeneous="true">
|
||||
<button text="@general.ok" closewindow="true" id="ok" magnet="true" minwidth="60" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Aseprite -->
|
||||
<!-- Copyright (C) 2019-2021 Igara Studio S.A. -->
|
||||
<!-- Copyright (C) 2019-2025 Igara Studio S.A. -->
|
||||
<!-- Copyright (C) 2015-2018 David Capello -->
|
||||
<gui>
|
||||
<window id="tag_properties" text="@.title">
|
||||
|
@ -23,13 +23,14 @@
|
|||
<check text="@.repeat" id="limit_repeat" />
|
||||
<vbox id="repeat_placeholder" cell_hspan="2" />
|
||||
</grid>
|
||||
<boxfiller />
|
||||
<grid columns="2">
|
||||
<separator horizontal="true" cell_hspan="2" minwidth="180" />
|
||||
<separator horizontal="true" cell_align="horizontal" cell_hspan="2" minwidth="180" />
|
||||
|
||||
<box horizontal="true" homogeneous="true" cell_hspan="2" cell_align="right">
|
||||
<hbox homogeneous="true" cell_hspan="2" cell_align="right">
|
||||
<button text="@general.ok" closewindow="true" id="ok" magnet="true" minwidth="60" />
|
||||
<button text="@general.cancel" closewindow="true" />
|
||||
</box>
|
||||
</hbox>
|
||||
</grid>
|
||||
</vbox>
|
||||
</window>
|
||||
|
|
|
@ -6,13 +6,7 @@
|
|||
<hbox>
|
||||
<vbox>
|
||||
<separator cell_hspan="2" text="@.position" left="true" horizontal="true" />
|
||||
<hbox>
|
||||
<buttonset columns="2" id="position">
|
||||
<item text="@.left" />
|
||||
<item text="@.right" />
|
||||
<item text="@.bottom" hspan="2" />
|
||||
</buttonset>
|
||||
</hbox>
|
||||
<button id="layout" icon="icon_layout" />
|
||||
</vbox>
|
||||
<vbox>
|
||||
<separator text="@.frame_header" left="true" horizontal="true" />
|
||||
|
|
2
laf
2
laf
|
@ -1 +1 @@
|
|||
Subproject commit 7873e82be7828d1c22255a4b06d1d3d34586f12f
|
||||
Subproject commit 3f1f86cc734443ba5c72d25c72cdf41ca208e9fe
|
|
@ -180,8 +180,8 @@ if(ENABLE_ASEPRITE_EXE)
|
|||
|
||||
if(WIN32)
|
||||
set(main_resources
|
||||
main/resources_win32.rc
|
||||
main/settings.manifest)
|
||||
main/win/resources_win32.rc
|
||||
main/win/settings.manifest)
|
||||
endif()
|
||||
|
||||
add_executable(${main_target}
|
||||
|
|
|
@ -74,7 +74,7 @@ add_custom_command(
|
|||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${output_fn}.tmp ${output_fn}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
MAIN_DEPENDENCY ${strings_en_ini}
|
||||
DEPENDS ${GEN_DEP})
|
||||
DEPENDS ${GEN_DEP} commands/commands_list.h)
|
||||
list(APPEND generated_files ${output_fn})
|
||||
|
||||
# Check translations
|
||||
|
@ -320,6 +320,7 @@ target_sources(app-lib PRIVATE
|
|||
cmd/set_cel_zindex.cpp
|
||||
cmd/set_frame_duration.cpp
|
||||
cmd/set_grid_bounds.cpp
|
||||
cmd/set_grid_type.cpp
|
||||
cmd/set_last_point.cpp
|
||||
cmd/set_layer_blend_mode.cpp
|
||||
cmd/set_layer_flags.cpp
|
||||
|
@ -368,6 +369,7 @@ target_sources(app-lib PRIVATE
|
|||
color_picker.cpp
|
||||
color_spaces.cpp
|
||||
color_utils.cpp
|
||||
commands/apply.cpp
|
||||
commands/cmd_about.cpp
|
||||
commands/cmd_add_color.cpp
|
||||
commands/cmd_advanced_mode.cpp
|
||||
|
@ -393,6 +395,7 @@ target_sources(app-lib PRIVATE
|
|||
commands/cmd_deselect_mask.cpp
|
||||
commands/cmd_discard_brush.cpp
|
||||
commands/cmd_duplicate_layer.cpp
|
||||
commands/cmd_duplicate_slice.cpp
|
||||
commands/cmd_duplicate_sprite.cpp
|
||||
commands/cmd_duplicate_view.cpp
|
||||
commands/cmd_enter_license.cpp
|
||||
|
@ -520,6 +523,7 @@ target_sources(app-lib PRIVATE
|
|||
commands/tileset_mode.cpp
|
||||
commands/toggle_other_layers_opacity.cpp
|
||||
commands/toggle_play_option.cpp
|
||||
commands/toggle_workspace_layout.cpp
|
||||
console.cpp
|
||||
context.cpp
|
||||
context_flags.cpp
|
||||
|
@ -609,6 +613,7 @@ target_sources(app-lib PRIVATE
|
|||
ui/context_bar.cpp
|
||||
ui/dithering_selector.cpp
|
||||
ui/doc_view.cpp
|
||||
ui/dock.cpp
|
||||
ui/drop_down_button.cpp
|
||||
ui/dynamics_popup.cpp
|
||||
ui/editor/brush_preview.cpp
|
||||
|
@ -651,8 +656,12 @@ target_sources(app-lib PRIVATE
|
|||
ui/icon_button.cpp
|
||||
ui/incompat_file_window.cpp
|
||||
ui/input_chain.cpp
|
||||
ui/key.cpp
|
||||
ui/keyboard_shortcuts.cpp
|
||||
ui/layer_frame_comboboxes.cpp
|
||||
ui/layout.cpp
|
||||
ui/layouts.cpp
|
||||
ui/layout_selector.cpp
|
||||
ui/main_menu_bar.cpp
|
||||
ui/main_window.cpp
|
||||
ui/mini_help_button.cpp
|
||||
|
@ -715,6 +724,7 @@ target_sources(app-lib PRIVATE
|
|||
util/render_text.cpp
|
||||
util/resize_image.cpp
|
||||
util/shader_helpers.cpp
|
||||
util/slice_utils.cpp
|
||||
util/tile_flags_utils.cpp
|
||||
util/tileset_utils.cpp
|
||||
util/wrap_point.cpp
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/cmd/set_grid_type.h"
|
||||
|
||||
#include "base/exception.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app { namespace cmd {
|
||||
|
||||
using namespace doc;
|
||||
|
||||
SetGridType::SetGridType(Sprite* sprite, const doc::Grid::Type type)
|
||||
: WithSprite(sprite)
|
||||
, m_oldType(sprite->gridType())
|
||||
, m_newType(type)
|
||||
{
|
||||
}
|
||||
|
||||
void SetGridType::onExecute()
|
||||
{
|
||||
setGrid(m_newType);
|
||||
}
|
||||
|
||||
void SetGridType::onUndo()
|
||||
{
|
||||
setGrid(m_oldType);
|
||||
}
|
||||
|
||||
void SetGridType::setGrid(const doc::Grid::Type type)
|
||||
{
|
||||
Sprite* spr = sprite();
|
||||
spr->setGridType(type);
|
||||
|
||||
Doc* doc = static_cast<Doc*>(spr->document());
|
||||
auto& docPref = Preferences::instance().document(doc);
|
||||
docPref.grid.type(type);
|
||||
spr->incrementVersion();
|
||||
}
|
||||
|
||||
} // namespace cmd
|
||||
|
||||
std::string grid_type_to_string(const doc::Grid::Type t)
|
||||
{
|
||||
if (t == doc::Grid::Type::Orthogonal)
|
||||
return app::Strings::grid_settings_type_orthogonal();
|
||||
if (t == doc::Grid::Type::IsometricSharedEdges)
|
||||
return app::Strings::grid_settings_type_isometric_shared();
|
||||
if (t == doc::Grid::Type::IsometricThickEdges)
|
||||
return app::Strings::grid_settings_type_isometric_thick();
|
||||
|
||||
throw base::Exception("Invalid grid type index: " + std::to_string(int(t)));
|
||||
}
|
||||
|
||||
doc::Grid::Type string_to_grid_type(const std::string& s)
|
||||
{
|
||||
if (s == app::Strings::grid_settings_type_orthogonal())
|
||||
return doc::Grid::Type::Orthogonal;
|
||||
if (s == app::Strings::grid_settings_type_isometric_shared())
|
||||
return doc::Grid::Type::IsometricSharedEdges;
|
||||
if (s == app::Strings::grid_settings_type_isometric_thick())
|
||||
return doc::Grid::Type::IsometricThickEdges;
|
||||
|
||||
throw base::Exception("Invalid string for grid type: " + s);
|
||||
}
|
||||
|
||||
} // namespace app
|
|
@ -0,0 +1,45 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifndef APP_CMD_SET_GRID_TYPE_H_INCLUDED
|
||||
#define APP_CMD_SET_GRID_TYPE_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "app/cmd.h"
|
||||
#include "app/cmd/with_sprite.h"
|
||||
#include "doc/grid.h"
|
||||
|
||||
namespace doc {
|
||||
class Sprite;
|
||||
}
|
||||
|
||||
namespace app { namespace cmd {
|
||||
|
||||
class SetGridType : public Cmd,
|
||||
public WithSprite {
|
||||
public:
|
||||
SetGridType(doc::Sprite* sprite, doc::Grid::Type type);
|
||||
|
||||
protected:
|
||||
void onExecute() override;
|
||||
void onUndo() override;
|
||||
size_t onMemSize() const override { return sizeof(*this); }
|
||||
|
||||
private:
|
||||
void setGrid(doc::Grid::Type type);
|
||||
|
||||
doc::Grid::Type m_oldType;
|
||||
doc::Grid::Type m_newType;
|
||||
};
|
||||
|
||||
} // namespace cmd
|
||||
|
||||
std::string grid_type_to_string(const doc::Grid::Type t);
|
||||
doc::Grid::Type string_to_grid_type(const std::string& s);
|
||||
|
||||
} // namespace app
|
||||
|
||||
#endif
|
|
@ -0,0 +1,46 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2025 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
// Depends on the current context/state, used to apply the current
|
||||
// transformation (drop pixels).
|
||||
class ApplyCommand : public Command {
|
||||
public:
|
||||
ApplyCommand();
|
||||
|
||||
protected:
|
||||
void onExecute(Context* ctx) override;
|
||||
};
|
||||
|
||||
ApplyCommand::ApplyCommand() : Command(CommandId::Apply())
|
||||
{
|
||||
}
|
||||
|
||||
void ApplyCommand::onExecute(Context* ctx)
|
||||
{
|
||||
if (!ctx->isUIAvailable())
|
||||
return;
|
||||
|
||||
auto* editor = Editor::activeEditor();
|
||||
if (editor && editor->isMovingPixels())
|
||||
editor->dropMovingPixels();
|
||||
}
|
||||
|
||||
Command* CommandFactory::createApplyCommand()
|
||||
{
|
||||
return new ApplyCommand;
|
||||
}
|
||||
|
||||
} // namespace app
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "fmt/format.h"
|
||||
#include "ver/info.h"
|
||||
|
||||
#include "about.xml.h"
|
||||
#include "app/context.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -27,13 +27,19 @@ public:
|
|||
AboutCommand();
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
AboutCommand::AboutCommand() : Command(CommandId::About(), CmdUIOnlyFlag)
|
||||
AboutCommand::AboutCommand() : Command(CommandId::About())
|
||||
{
|
||||
}
|
||||
|
||||
bool AboutCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->isUIAvailable();
|
||||
}
|
||||
|
||||
void AboutCommand::onExecute(Context* context)
|
||||
{
|
||||
gen::About window;
|
||||
|
|
|
@ -63,8 +63,7 @@ protected:
|
|||
std::string onGetFriendlyName() const override;
|
||||
};
|
||||
|
||||
AddColorCommand::AddColorCommand()
|
||||
: CommandWithNewParams<AddColorParams>(CommandId::AddColor(), CmdUIOnlyFlag)
|
||||
AddColorCommand::AddColorCommand() : CommandWithNewParams<AddColorParams>(CommandId::AddColor())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
#include "ui/ui.h"
|
||||
|
||||
#include "advanced_mode.xml.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include "app/context.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -29,13 +28,19 @@ public:
|
|||
AdvancedModeCommand();
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
AdvancedModeCommand::AdvancedModeCommand() : Command(CommandId::AdvancedMode(), CmdUIOnlyFlag)
|
||||
AdvancedModeCommand::AdvancedModeCommand() : Command(CommandId::AdvancedMode())
|
||||
{
|
||||
}
|
||||
|
||||
bool AdvancedModeCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->isUIAvailable();
|
||||
}
|
||||
|
||||
void AdvancedModeCommand::onExecute(Context* context)
|
||||
{
|
||||
// Switch advanced mode.
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "app/modules/gui.h"
|
||||
#include "app/tx.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -28,8 +27,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
BackgroundFromLayerCommand::BackgroundFromLayerCommand()
|
||||
: Command(CommandId::BackgroundFromLayer(), CmdRecordableFlag)
|
||||
BackgroundFromLayerCommand::BackgroundFromLayerCommand() : Command(CommandId::BackgroundFromLayer())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
Type m_type;
|
||||
};
|
||||
|
||||
CancelCommand::CancelCommand() : Command(CommandId::Cancel(), CmdUIOnlyFlag), m_type(NoOp)
|
||||
CancelCommand::CancelCommand() : Command(CommandId::Cancel()), m_type(NoOp)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
|
@ -282,8 +281,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
CanvasSizeCommand::CanvasSizeCommand()
|
||||
: CommandWithNewParams(CommandId::CanvasSize(), CmdRecordableFlag)
|
||||
CanvasSizeCommand::CanvasSizeCommand() : CommandWithNewParams(CommandId::CanvasSize())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include "app/tx.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "doc/cel.h"
|
||||
#include "doc/cels_range.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -42,7 +40,7 @@ private:
|
|||
int m_opacity;
|
||||
};
|
||||
|
||||
CelOpacityCommand::CelOpacityCommand() : Command(CommandId::CelOpacity(), CmdUIOnlyFlag)
|
||||
CelOpacityCommand::CelOpacityCommand() : Command(CommandId::CelOpacity())
|
||||
{
|
||||
m_opacity = 255;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2020-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2020-2025 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
|
@ -23,7 +23,6 @@
|
|||
#include "app/ui/timeline/timeline.h"
|
||||
#include "app/ui/user_data_view.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/mem_utils.h"
|
||||
#include "base/scoped_value.h"
|
||||
#include "doc/cel.h"
|
||||
#include "doc/cels_range.h"
|
||||
|
@ -101,12 +100,12 @@ public:
|
|||
|
||||
if (countCels() > 0) {
|
||||
m_userDataView.configureAndSet((m_cel ? m_cel->data()->userData() : UserData()),
|
||||
g_window->propertiesGrid());
|
||||
propertiesGrid());
|
||||
}
|
||||
else if (!m_cel)
|
||||
m_userDataView.setVisible(false, false);
|
||||
|
||||
g_window->expandWindow(gfx::Size(g_window->bounds().w, g_window->sizeHint().h));
|
||||
expandWindow(gfx::Size(bounds().w, sizeHint().h));
|
||||
updateFromCel();
|
||||
}
|
||||
|
||||
|
@ -281,7 +280,7 @@ private:
|
|||
{
|
||||
if (countCels() > 0) {
|
||||
m_userDataView.toggleVisibility();
|
||||
g_window->expandWindow(gfx::Size(g_window->bounds().w, g_window->sizeHint().h));
|
||||
expandWindow(gfx::Size(bounds().w, sizeHint().h));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -385,14 +384,14 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
CelPropertiesCommand::CelPropertiesCommand() : Command(CommandId::CelProperties(), CmdUIOnlyFlag)
|
||||
CelPropertiesCommand::CelPropertiesCommand() : Command(CommandId::CelProperties())
|
||||
{
|
||||
}
|
||||
|
||||
bool CelPropertiesCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
||||
ContextFlags::ActiveLayerIsImage);
|
||||
return context->isUIAvailable() && context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
||||
ContextFlags::ActiveLayerIsImage);
|
||||
}
|
||||
|
||||
void CelPropertiesCommand::onExecute(Context* context)
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "app/tools/tool.h"
|
||||
#include "app/ui/context_bar.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "doc/algorithm/flip_image.h"
|
||||
#include "doc/brush.h"
|
||||
#include "doc/image_ref.h"
|
||||
|
@ -64,7 +63,7 @@ private:
|
|||
int m_slot;
|
||||
};
|
||||
|
||||
ChangeBrushCommand::ChangeBrushCommand() : Command(CommandId::ChangeBrush(), CmdUIOnlyFlag)
|
||||
ChangeBrushCommand::ChangeBrushCommand() : Command(CommandId::ChangeBrush())
|
||||
{
|
||||
m_change = None;
|
||||
m_slot = 0;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
|
@ -39,18 +40,24 @@ public:
|
|||
ChangeColorCommand();
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
bool onNeedsParams() const override { return true; }
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
std::string onGetFriendlyName() const override;
|
||||
};
|
||||
|
||||
ChangeColorCommand::ChangeColorCommand() : Command(CommandId::ChangeColor(), CmdUIOnlyFlag)
|
||||
ChangeColorCommand::ChangeColorCommand() : Command(CommandId::ChangeColor())
|
||||
{
|
||||
m_background = false;
|
||||
m_change = None;
|
||||
}
|
||||
|
||||
bool ChangeColorCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->isUIAvailable();
|
||||
}
|
||||
|
||||
void ChangeColorCommand::onLoadParams(const Params& params)
|
||||
{
|
||||
std::string target = params.get("target");
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
#include "app/i18n/strings.h"
|
||||
#include "app/load_matrix.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/sprite_job.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/best_fit_criteria_selector.h"
|
||||
#include "app/ui/dithering_selector.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
|
@ -37,12 +35,10 @@
|
|||
#include "fmt/format.h"
|
||||
#include "render/dithering.h"
|
||||
#include "render/dithering_algorithm.h"
|
||||
#include "render/ordered_dither.h"
|
||||
#include "render/quantization.h"
|
||||
#include "render/render.h"
|
||||
#include "render/task_delegate.h"
|
||||
#include "ui/listitem.h"
|
||||
#include "ui/paint_event.h"
|
||||
#include "ui/size_hint_event.h"
|
||||
|
||||
#include "color_mode.xml.h"
|
||||
|
@ -507,7 +503,7 @@ private:
|
|||
};
|
||||
|
||||
ChangePixelFormatCommand::ChangePixelFormatCommand()
|
||||
: CommandWithNewParams(CommandId::ChangePixelFormat(), CmdUIOnlyFlag)
|
||||
: CommandWithNewParams(CommandId::ChangePixelFormat())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ protected:
|
|||
void onExecute(Context* ctx) override;
|
||||
};
|
||||
|
||||
ClearCommand::ClearCommand() : Command(CommandId::Clear(), CmdUIOnlyFlag)
|
||||
ClearCommand::ClearCommand() : Command(CommandId::Clear())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "app/ui/status_bar.h"
|
||||
#include "doc/cel.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -32,7 +31,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
ClearCelCommand::ClearCelCommand() : Command(CommandId::ClearCel(), CmdRecordableFlag)
|
||||
ClearCelCommand::ClearCelCommand() : Command(CommandId::ClearCel())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -76,7 +75,7 @@ void ClearCelCommand::onExecute(Context* context)
|
|||
tx.commit();
|
||||
}
|
||||
|
||||
if (nonEditableLayers)
|
||||
if (context->isUIAvailable() && nonEditableLayers)
|
||||
StatusBar::instance()->showTip(1000, Strings::statusbar_tips_locked_layers());
|
||||
|
||||
update_screen_for_document(document);
|
||||
|
|
|
@ -23,8 +23,7 @@ protected:
|
|||
void onExecute(Context* ctx) override;
|
||||
};
|
||||
|
||||
ClearRecentFilesCommand::ClearRecentFilesCommand()
|
||||
: Command(CommandId::ClearRecentFiles(), CmdUIOnlyFlag)
|
||||
ClearRecentFilesCommand::ClearRecentFilesCommand() : Command(CommandId::ClearRecentFiles())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,15 +12,9 @@
|
|||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/commands.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/ui/doc_view.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui/workspace.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -28,7 +22,7 @@ using namespace ui;
|
|||
|
||||
class CloseFileCommand : public Command {
|
||||
public:
|
||||
CloseFileCommand() : Command(CommandId::CloseFile(), CmdUIOnlyFlag) {}
|
||||
CloseFileCommand() : Command(CommandId::CloseFile()) {}
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override
|
||||
|
@ -51,12 +45,15 @@ protected:
|
|||
|
||||
class CloseAllFilesCommand : public Command {
|
||||
public:
|
||||
CloseAllFilesCommand() : Command(CommandId::CloseAllFiles(), CmdRecordableFlag)
|
||||
{
|
||||
m_quitting = false;
|
||||
}
|
||||
CloseAllFilesCommand() : Command(CommandId::CloseAllFiles()) { m_quitting = false; }
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override
|
||||
{
|
||||
// Null if we are in --batch mode
|
||||
return App::instance()->workspace() != nullptr;
|
||||
}
|
||||
|
||||
void onLoadParams(const Params& params) override { m_quitting = params.get_as<bool>("quitting"); }
|
||||
|
||||
void onExecute(Context* context) override
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "app/transaction.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "app/ui/rgbmap_algorithm_selector.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "doc/palette.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "render/quantization.h"
|
||||
|
@ -71,7 +70,7 @@ protected:
|
|||
};
|
||||
|
||||
ColorQuantizationCommand::ColorQuantizationCommand()
|
||||
: CommandWithNewParams<ColorQuantizationParams>(CommandId::ColorQuantization(), CmdRecordableFlag)
|
||||
: CommandWithNewParams<ColorQuantizationParams>(CommandId::ColorQuantization())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
ContiguousFillCommand::ContiguousFillCommand() : Command(CommandId::ContiguousFill(), CmdUIOnlyFlag)
|
||||
ContiguousFillCommand::ContiguousFillCommand() : Command(CommandId::ContiguousFill())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ protected:
|
|||
void onExecute(Context* ctx) override;
|
||||
};
|
||||
|
||||
CopyCommand::CopyCommand() : Command(CommandId::Copy(), CmdUIOnlyFlag)
|
||||
CopyCommand::CopyCommand() : Command(CommandId::Copy())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "ui/base.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -25,13 +23,13 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
CopyCelCommand::CopyCelCommand() : Command(CommandId::CopyCel(), CmdUIOnlyFlag)
|
||||
CopyCelCommand::CopyCelCommand() : Command(CommandId::CopyCel())
|
||||
{
|
||||
}
|
||||
|
||||
bool CopyCelCommand::onEnabled(Context* context)
|
||||
{
|
||||
return App::instance()->timeline()->isMovingCel();
|
||||
return App::instance()->timeline() && App::instance()->timeline()->isMovingCel();
|
||||
}
|
||||
|
||||
void CopyCelCommand::onExecute(Context* context)
|
||||
|
|
|
@ -24,7 +24,7 @@ protected:
|
|||
void onExecute(Context* ctx) override;
|
||||
};
|
||||
|
||||
CopyMergedCommand::CopyMergedCommand() : Command(CommandId::CopyMerged(), CmdUIOnlyFlag)
|
||||
CopyMergedCommand::CopyMergedCommand() : Command(CommandId::CopyMerged())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -16,11 +16,7 @@
|
|||
#include "app/modules/gui.h"
|
||||
#include "app/tx.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "app/util/autocrop.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -37,7 +33,7 @@ private:
|
|||
gfx::Rect m_bounds;
|
||||
};
|
||||
|
||||
CropSpriteCommand::CropSpriteCommand() : Command(CommandId::CropSprite(), CmdRecordableFlag)
|
||||
CropSpriteCommand::CropSpriteCommand() : Command(CommandId::CropSprite())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -95,8 +91,7 @@ private:
|
|||
bool m_byGrid = false;
|
||||
};
|
||||
|
||||
AutocropSpriteCommand::AutocropSpriteCommand()
|
||||
: Command(CommandId::AutocropSprite(), CmdRecordableFlag)
|
||||
AutocropSpriteCommand::AutocropSpriteCommand() : Command(CommandId::AutocropSprite())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ protected:
|
|||
void onExecute(Context* ctx) override;
|
||||
};
|
||||
|
||||
CutCommand::CutCommand() : Command(CommandId::Cut(), CmdUIOnlyFlag)
|
||||
CutCommand::CutCommand() : Command(CommandId::Cut())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "app/context_access.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/tx.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -28,7 +26,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
DeselectMaskCommand::DeselectMaskCommand() : Command(CommandId::DeselectMask(), CmdRecordableFlag)
|
||||
DeselectMaskCommand::DeselectMaskCommand() : Command(CommandId::DeselectMask())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ protected:
|
|||
void onExecute(Context* context);
|
||||
};
|
||||
|
||||
DeveloperConsoleCommand::DeveloperConsoleCommand()
|
||||
: Command(CommandId::DeveloperConsole(), CmdUIOnlyFlag)
|
||||
DeveloperConsoleCommand::DeveloperConsoleCommand() : Command(CommandId::DeveloperConsole())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/commands.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/tools/tool_box.h"
|
||||
#include "app/ui/context_bar.h"
|
||||
#include "app/ui_context.h"
|
||||
|
||||
|
@ -28,12 +26,15 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
DiscardBrushCommand::DiscardBrushCommand() : Command(CommandId::DiscardBrush(), CmdUIOnlyFlag)
|
||||
DiscardBrushCommand::DiscardBrushCommand() : Command(CommandId::DiscardBrush())
|
||||
{
|
||||
}
|
||||
|
||||
bool DiscardBrushCommand::onEnabled(Context* context)
|
||||
{
|
||||
if (!context->isUIAvailable())
|
||||
return false;
|
||||
|
||||
ContextBar* ctxBar = App::instance()->contextBar();
|
||||
return (ctxBar->activeBrush()->type() == kImageBrushType);
|
||||
}
|
||||
|
|
|
@ -10,16 +10,11 @@
|
|||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/tx.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -32,8 +27,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
DuplicateLayerCommand::DuplicateLayerCommand()
|
||||
: Command(CommandId::DuplicateLayer(), CmdRecordableFlag)
|
||||
DuplicateLayerCommand::DuplicateLayerCommand() : Command(CommandId::DuplicateLayer())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2025 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/cmd/add_slice.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/context_flags.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/site.h"
|
||||
#include "app/tx.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/util/slice_utils.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "doc/object_id.h"
|
||||
#include "doc/slice.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
// Moves the given slice by the dx and dy values
|
||||
void offset(Slice* slice, int dx, int dy)
|
||||
{
|
||||
for (auto it = slice->begin(); it != slice->end(); ++it) {
|
||||
auto* sk = (*it).value();
|
||||
gfx::Rect bounds = sk->bounds();
|
||||
bounds.offset(gfx::Point{ dx, dy });
|
||||
sk->setBounds(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
class DuplicateSliceCommand : public Command {
|
||||
public:
|
||||
DuplicateSliceCommand();
|
||||
|
||||
protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
|
||||
private:
|
||||
ObjectId m_sliceId;
|
||||
};
|
||||
|
||||
DuplicateSliceCommand::DuplicateSliceCommand() : Command(CommandId::DuplicateSlice())
|
||||
{
|
||||
}
|
||||
|
||||
void DuplicateSliceCommand::onLoadParams(const Params& params)
|
||||
{
|
||||
std::string id = params.get("id");
|
||||
if (!id.empty())
|
||||
m_sliceId = ObjectId(base::convert_to<doc::ObjectId>(id));
|
||||
else
|
||||
m_sliceId = NullId;
|
||||
}
|
||||
|
||||
bool DuplicateSliceCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
||||
ContextFlags::HasActiveSprite | ContextFlags::HasActiveLayer);
|
||||
}
|
||||
|
||||
void DuplicateSliceCommand::onExecute(Context* context)
|
||||
{
|
||||
std::vector<Slice*> selectedSlices;
|
||||
{
|
||||
const ContextReader reader(context);
|
||||
if (m_sliceId == NullId) {
|
||||
selectedSlices = get_selected_slices(reader.site());
|
||||
if (selectedSlices.empty())
|
||||
return;
|
||||
}
|
||||
else
|
||||
selectedSlices.push_back(reader.sprite()->slices().getById(m_sliceId));
|
||||
}
|
||||
|
||||
ContextWriter writer(context);
|
||||
Tx tx(writer, "Duplicate Slice");
|
||||
Sprite* sprite = writer.site().sprite();
|
||||
|
||||
Doc* doc = static_cast<Doc*>(sprite->document());
|
||||
doc->notifyBeforeSlicesDuplication();
|
||||
for (auto* s : selectedSlices) {
|
||||
Slice* slice = new Slice(*s);
|
||||
slice->setName(Strings::general_copy_of(slice->name()));
|
||||
// Offset a bit the duplicated slice to avoid overlapping
|
||||
offset(slice, 2, 2);
|
||||
|
||||
tx(new cmd::AddSlice(sprite, slice));
|
||||
doc->notifySliceDuplicated(slice);
|
||||
}
|
||||
tx.commit();
|
||||
|
||||
std::string sliceName;
|
||||
if (selectedSlices.size() == 1)
|
||||
sliceName = selectedSlices[0]->name();
|
||||
|
||||
StatusBar::instance()->invalidate();
|
||||
if (!sliceName.empty()) {
|
||||
StatusBar::instance()->showTip(1000, Strings::duplicate_slice_x_duplicated(sliceName));
|
||||
}
|
||||
else {
|
||||
StatusBar::instance()->showTip(
|
||||
1000,
|
||||
Strings::duplicate_slice_n_slices_duplicated(selectedSlices.size()));
|
||||
}
|
||||
}
|
||||
|
||||
Command* CommandFactory::createDuplicateSliceCommand()
|
||||
{
|
||||
return new DuplicateSliceCommand;
|
||||
}
|
||||
|
||||
} // namespace app
|
|
@ -16,13 +16,10 @@
|
|||
#include "app/ini_file.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/fs.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include "duplicate_sprite.xml.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace app {
|
||||
|
||||
using namespace ui;
|
||||
|
@ -43,7 +40,7 @@ protected:
|
|||
};
|
||||
|
||||
DuplicateSpriteCommand::DuplicateSpriteCommand()
|
||||
: CommandWithNewParams<DuplicateSpriteParams>(CommandId::DuplicateSprite(), CmdRecordableFlag)
|
||||
: CommandWithNewParams<DuplicateSpriteParams>(CommandId::DuplicateSprite())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#include "app/commands/command.h"
|
||||
#include "app/ui/workspace.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace app {
|
||||
|
||||
// using namespace ui;
|
||||
|
@ -28,7 +26,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
DuplicateViewCommand::DuplicateViewCommand() : Command(CommandId::DuplicateView(), CmdUIOnlyFlag)
|
||||
DuplicateViewCommand::DuplicateViewCommand() : Command(CommandId::DuplicateView())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context.h"
|
||||
|
||||
#ifdef ENABLE_DRM
|
||||
#include "app/ui/enter_license.h"
|
||||
|
@ -24,7 +23,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
EnterLicenseCommand::EnterLicenseCommand() : Command(CommandId::EnterLicense(), CmdUIOnlyFlag)
|
||||
EnterLicenseCommand::EnterLicenseCommand() : Command(CommandId::EnterLicense())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "app/doc.h"
|
||||
#include "app/job.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "ui/alert.h"
|
||||
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
#include "app/commands/debugger.h"
|
||||
|
@ -32,7 +31,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
ExitCommand::ExitCommand() : Command(CommandId::Exit(), CmdUIOnlyFlag)
|
||||
ExitCommand::ExitCommand() : Command(CommandId::Exit())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -33,15 +33,12 @@
|
|||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "app/util/layer_utils.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/string.h"
|
||||
#include "base/thread.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/layer_tilemap.h"
|
||||
#include "doc/tag.h"
|
||||
#include "doc/tileset.h"
|
||||
#include "doc/tilesets.h"
|
||||
#include "fmt/format.h"
|
||||
#include "ui/message.h"
|
||||
#include "ui/system.h"
|
||||
|
@ -1187,8 +1184,7 @@ private:
|
|||
|
||||
} // anonymous namespace
|
||||
|
||||
ExportSpriteSheetCommand::ExportSpriteSheetCommand(const char* id)
|
||||
: CommandWithNewParams(id, CmdRecordableFlag)
|
||||
ExportSpriteSheetCommand::ExportSpriteSheetCommand(const char* id) : CommandWithNewParams(id)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "app/context.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/site.h"
|
||||
#include "app/tools/tool.h"
|
||||
#include "app/tools/tool_box.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
|
@ -28,7 +27,7 @@ namespace app {
|
|||
|
||||
using namespace ui;
|
||||
|
||||
EyedropperCommand::EyedropperCommand() : Command(CommandId::Eyedropper(), CmdUIOnlyFlag)
|
||||
EyedropperCommand::EyedropperCommand() : Command(CommandId::Eyedropper())
|
||||
{
|
||||
m_background = false;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
};
|
||||
|
||||
FillCommand::FillCommand(Type type)
|
||||
: Command(type == Stroke ? CommandId::Stroke() : CommandId::Fill(), CmdUIOnlyFlag)
|
||||
: Command(type == Stroke ? CommandId::Stroke() : CommandId::Fill())
|
||||
, m_type(type)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
|
||||
namespace app {
|
||||
|
@ -25,7 +24,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
FitScreenCommand::FitScreenCommand() : Command(CommandId::FitScreen(), CmdUIOnlyFlag)
|
||||
FitScreenCommand::FitScreenCommand() : Command(CommandId::FitScreen())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ protected:
|
|||
bool m_visibleOnly;
|
||||
};
|
||||
|
||||
FlattenLayersCommand::FlattenLayersCommand() : Command(CommandId::FlattenLayers(), CmdUIOnlyFlag)
|
||||
FlattenLayersCommand::FlattenLayersCommand() : Command(CommandId::FlattenLayers())
|
||||
{
|
||||
m_visibleOnly = false;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/doc_range.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/tools/tool_box.h"
|
||||
|
@ -38,11 +37,10 @@
|
|||
#include "doc/layer.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "gfx/size.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
FlipCommand::FlipCommand() : Command(CommandId::Flip(), CmdRecordableFlag)
|
||||
FlipCommand::FlipCommand() : Command(CommandId::Flip())
|
||||
{
|
||||
m_flipMask = false;
|
||||
m_flipType = doc::algorithm::FlipHorizontal;
|
||||
|
|
|
@ -44,12 +44,11 @@ private:
|
|||
|
||||
// Frame to be shown. It can be ALL_FRAMES, CURRENT_RANGE, or a
|
||||
// number indicating a specific frame (1 is the first frame).
|
||||
Target m_target;
|
||||
frame_t m_frame;
|
||||
Target m_target = CURRENT_RANGE;
|
||||
frame_t m_frame = 1;
|
||||
};
|
||||
|
||||
FramePropertiesCommand::FramePropertiesCommand()
|
||||
: Command(CommandId::FrameProperties(), CmdUIOnlyFlag)
|
||||
FramePropertiesCommand::FramePropertiesCommand() : Command(CommandId::FrameProperties())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -59,7 +58,7 @@ void FramePropertiesCommand::onLoadParams(const Params& params)
|
|||
if (frame == "all") {
|
||||
m_target = ALL_FRAMES;
|
||||
}
|
||||
else if (frame == "current") {
|
||||
else if (frame == "current" || !params.has_param("frame")) {
|
||||
m_target = CURRENT_RANGE;
|
||||
}
|
||||
else {
|
||||
|
@ -70,7 +69,7 @@ void FramePropertiesCommand::onLoadParams(const Params& params)
|
|||
|
||||
bool FramePropertiesCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable);
|
||||
return context->isUIAvailable() && context->checkFlags(ContextFlags::ActiveDocumentIsWritable);
|
||||
}
|
||||
|
||||
void FramePropertiesCommand::onExecute(Context* context)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "app/cmd/set_tag_range.h"
|
||||
#include "app/cmd/set_tag_repeat.h"
|
||||
#include "app/cmd/set_user_data.h"
|
||||
#include "app/color.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
|
@ -48,7 +47,7 @@ private:
|
|||
};
|
||||
|
||||
FrameTagPropertiesCommand::FrameTagPropertiesCommand()
|
||||
: Command(CommandId::FrameTagProperties(), CmdUIOnlyFlag)
|
||||
: Command(CommandId::FrameTagProperties())
|
||||
, m_tagId(NullId)
|
||||
{
|
||||
}
|
||||
|
@ -66,7 +65,7 @@ void FrameTagPropertiesCommand::onLoadParams(const Params& params)
|
|||
|
||||
bool FrameTagPropertiesCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable);
|
||||
return context->isUIAvailable() && context->checkFlags(ContextFlags::ActiveDocumentIsWritable);
|
||||
}
|
||||
|
||||
void FrameTagPropertiesCommand::onExecute(Context* context)
|
||||
|
|
|
@ -27,7 +27,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
FullscreenModeCommand::FullscreenModeCommand() : Command(CommandId::FullscreenMode(), CmdUIOnlyFlag)
|
||||
FullscreenModeCommand::FullscreenModeCommand() : Command(CommandId::FullscreenMode())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/preview_editor.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/util/conversion_to_surface.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/palette.h"
|
||||
#include "doc/primitives.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "gfx/matrix.h"
|
||||
#include "os/surface.h"
|
||||
|
@ -308,8 +305,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
FullscreenPreviewCommand::FullscreenPreviewCommand()
|
||||
: Command(CommandId::FullscreenPreview(), CmdUIOnlyFlag)
|
||||
FullscreenPreviewCommand::FullscreenPreviewCommand() : Command(CommandId::FullscreenPreview())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ using namespace doc;
|
|||
|
||||
class GotoCommand : public Command {
|
||||
protected:
|
||||
GotoCommand(const char* id) : Command(id, CmdRecordableFlag) {}
|
||||
GotoCommand(const char* id) : Command(id) {}
|
||||
|
||||
bool onEnabled(Context* context) override { return (Editor::activeEditor() != nullptr); }
|
||||
|
||||
|
|
|
@ -24,11 +24,7 @@ namespace app {
|
|||
|
||||
class GotoLayerCommand : public Command {
|
||||
public:
|
||||
GotoLayerCommand(int offset, const char* id, CommandFlags flags)
|
||||
: Command(id, flags)
|
||||
, m_offset(offset)
|
||||
{
|
||||
}
|
||||
GotoLayerCommand(int offset, const char* id) : Command(id), m_offset(offset) {}
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override
|
||||
|
@ -88,12 +84,12 @@ private:
|
|||
|
||||
class GotoPreviousLayerCommand : public GotoLayerCommand {
|
||||
public:
|
||||
GotoPreviousLayerCommand() : GotoLayerCommand(-1, "GotoPreviousLayer", CmdUIOnlyFlag) {}
|
||||
GotoPreviousLayerCommand() : GotoLayerCommand(-1, CommandId::GotoPreviousLayer()) {}
|
||||
};
|
||||
|
||||
class GotoNextLayerCommand : public GotoLayerCommand {
|
||||
public:
|
||||
GotoNextLayerCommand() : GotoLayerCommand(+1, "GotoNextLayer", CmdUIOnlyFlag) {}
|
||||
GotoNextLayerCommand() : GotoLayerCommand(+1, CommandId::GotoNextLayer()) {}
|
||||
};
|
||||
|
||||
Command* CommandFactory::createGotoPreviousLayerCommand()
|
||||
|
|
|
@ -24,7 +24,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
GotoNextTabCommand::GotoNextTabCommand() : Command(CommandId::GotoNextTab(), CmdUIOnlyFlag)
|
||||
GotoNextTabCommand::GotoNextTabCommand() : Command(CommandId::GotoNextTab())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
GotoPreviousTabCommand::GotoPreviousTabCommand()
|
||||
: Command(CommandId::GotoPreviousTab(), CmdRecordableFlag)
|
||||
GotoPreviousTabCommand::GotoPreviousTabCommand() : Command(CommandId::GotoPreviousTab())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -11,17 +11,14 @@
|
|||
|
||||
#include "app/app.h"
|
||||
#include "app/cmd/set_grid_bounds.h"
|
||||
#include "app/cmd/set_grid_type.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/find_widget.h"
|
||||
#include "app/load_widget.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/tx.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "doc/document.h"
|
||||
#include "doc/mask.h"
|
||||
#include "ui/window.h"
|
||||
|
||||
|
@ -36,7 +33,7 @@ using namespace gfx;
|
|||
|
||||
class SnapToGridCommand : public Command {
|
||||
public:
|
||||
SnapToGridCommand() : Command(CommandId::SnapToGrid(), CmdUIOnlyFlag) {}
|
||||
SnapToGridCommand() : Command(CommandId::SnapToGrid()) {}
|
||||
|
||||
protected:
|
||||
bool onChecked(Context* ctx) override
|
||||
|
@ -51,13 +48,14 @@ protected:
|
|||
bool newValue = !docPref.grid.snap();
|
||||
docPref.grid.snap(newValue);
|
||||
|
||||
StatusBar::instance()->showSnapToGridWarning(newValue);
|
||||
if (ctx->isUIAvailable())
|
||||
StatusBar::instance()->showSnapToGridWarning(newValue);
|
||||
}
|
||||
};
|
||||
|
||||
class SelectionAsGridCommand : public Command {
|
||||
public:
|
||||
SelectionAsGridCommand() : Command(CommandId::SelectionAsGrid(), CmdUIOnlyFlag) {}
|
||||
SelectionAsGridCommand() : Command(CommandId::SelectionAsGrid()) {}
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* ctx) override
|
||||
|
@ -92,13 +90,13 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
GridSettingsCommand::GridSettingsCommand() : Command(CommandId::GridSettings(), CmdUIOnlyFlag)
|
||||
GridSettingsCommand::GridSettingsCommand() : Command(CommandId::GridSettings())
|
||||
{
|
||||
}
|
||||
|
||||
bool GridSettingsCommand::onEnabled(Context* context)
|
||||
{
|
||||
return true;
|
||||
return context->isUIAvailable();
|
||||
}
|
||||
|
||||
void GridSettingsCommand::onExecute(Context* context)
|
||||
|
@ -107,6 +105,7 @@ void GridSettingsCommand::onExecute(Context* context)
|
|||
|
||||
Site site = context->activeSite();
|
||||
Rect bounds = site.gridBounds();
|
||||
doc::Grid::Type type = site.gridType();
|
||||
|
||||
window.gridX()->setTextf("%d", bounds.x);
|
||||
window.gridY()->setTextf("%d", bounds.y);
|
||||
|
@ -122,9 +121,12 @@ void GridSettingsCommand::onExecute(Context* context)
|
|||
if (window.gridH()->textInt() <= 0)
|
||||
window.gridH()->setText("1");
|
||||
});
|
||||
int typeIndex = window.gridType()->findItemIndex(grid_type_to_string(type));
|
||||
window.gridType()->setSelectedItemIndex(typeIndex);
|
||||
window.openWindowInForeground();
|
||||
|
||||
if (window.closer() == window.ok()) {
|
||||
const gfx::Rect oldBounds(bounds);
|
||||
bounds.x = window.gridX()->textInt();
|
||||
bounds.y = window.gridY()->textInt();
|
||||
bounds.w = window.gridW()->textInt();
|
||||
|
@ -132,10 +134,20 @@ void GridSettingsCommand::onExecute(Context* context)
|
|||
bounds.w = std::max(bounds.w, 1);
|
||||
bounds.h = std::max(bounds.h, 1);
|
||||
|
||||
ContextWriter writer(context);
|
||||
Tx tx(writer, friendlyName(), ModifyDocument);
|
||||
tx(new cmd::SetGridBounds(site.sprite(), bounds));
|
||||
tx.commit();
|
||||
const doc::Grid::Type oldType = type;
|
||||
typeIndex = window.gridType()->getSelectedItemIndex();
|
||||
type = string_to_grid_type(window.gridType()->getItemText(typeIndex));
|
||||
|
||||
if (bounds != oldBounds || type != oldType) {
|
||||
ContextWriter writer(context);
|
||||
Tx tx(writer, friendlyName(), ModifyDocument);
|
||||
if (bounds != oldBounds)
|
||||
tx(new cmd::SetGridBounds(site.sprite(), bounds));
|
||||
if (type != oldType)
|
||||
tx(new cmd::SetGridType(site.sprite(), type));
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
|
||||
auto& docPref = Preferences::instance().document(site.document());
|
||||
if (!docPref.show.grid()) // Make grid visible
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context.h"
|
||||
#include "app/ui/main_window.h"
|
||||
|
||||
namespace app {
|
||||
|
@ -26,7 +27,7 @@ protected:
|
|||
bool onEnabled(Context* context) override;
|
||||
};
|
||||
|
||||
HomeCommand::HomeCommand() : Command(CommandId::Home(), CmdUIOnlyFlag)
|
||||
HomeCommand::HomeCommand() : Command(CommandId::Home())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,7 @@ void HomeCommand::onExecute(Context* context)
|
|||
|
||||
bool HomeCommand::onEnabled(Context* context)
|
||||
{
|
||||
return !App::instance()->mainWindow()->isHomeSelected();
|
||||
return context->isUIAvailable() && !App::instance()->mainWindow()->isHomeSelected();
|
||||
}
|
||||
|
||||
Command* CommandFactory::createHomeCommand()
|
||||
|
|
|
@ -20,20 +20,14 @@
|
|||
#include "app/doc_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/tx.h"
|
||||
#include "app/ui/drop_down_button.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/editor/editor_decorator.h"
|
||||
#include "app/ui/editor/select_box_state.h"
|
||||
#include "app/ui/editor/standby_state.h"
|
||||
#include "app/ui/workspace.h"
|
||||
#include "doc/cel.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/palette.h"
|
||||
#include "doc/primitives.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "render/render.h"
|
||||
#include "ui/ui.h"
|
||||
|
@ -518,7 +512,7 @@ protected:
|
|||
};
|
||||
|
||||
ImportSpriteSheetCommand::ImportSpriteSheetCommand()
|
||||
: CommandWithNewParams(CommandId::ImportSpriteSheet(), CmdRecordableFlag)
|
||||
: CommandWithNewParams(CommandId::ImportSpriteSheet())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
InvertMaskCommand::InvertMaskCommand() : Command(CommandId::InvertMask(), CmdRecordableFlag)
|
||||
InvertMaskCommand::InvertMaskCommand() : Command(CommandId::InvertMask())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -26,22 +26,17 @@
|
|||
#include "app/ui/select_shortcut.h"
|
||||
#include "app/ui/separator_in_view.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/pi.h"
|
||||
#include "base/scoped_value.h"
|
||||
#include "base/split_string.h"
|
||||
#include "base/string.h"
|
||||
#include "ui/alert.h"
|
||||
#include "ui/fit_bounds.h"
|
||||
#include "ui/graphics.h"
|
||||
#include "ui/listitem.h"
|
||||
#include "ui/message.h"
|
||||
#include "ui/paint_event.h"
|
||||
#include "ui/resize_event.h"
|
||||
#include "ui/separator.h"
|
||||
#include "ui/size_hint_event.h"
|
||||
#include "ui/splitter.h"
|
||||
#include "ui/system.h"
|
||||
|
||||
#include "keyboard_shortcuts.xml.h"
|
||||
|
||||
|
@ -269,7 +264,7 @@ private:
|
|||
|
||||
if (m_key && m_key->keycontext() != KeyContext::Any) {
|
||||
int w = m_headerItem->contextXPos() +
|
||||
font()->textLength(convertKeyContextToUserFriendlyString(m_key->keycontext()));
|
||||
font()->textLength(convert_keycontext_to_user_friendly_string(m_key->keycontext()));
|
||||
size.w = std::max(size.w, w);
|
||||
}
|
||||
|
||||
|
@ -317,7 +312,7 @@ private:
|
|||
|
||||
if (m_key && !m_key->shortcuts().empty()) {
|
||||
if (m_key->keycontext() != KeyContext::Any) {
|
||||
g->drawText(convertKeyContextToUserFriendlyString(m_key->keycontext()),
|
||||
g->drawText(convert_keycontext_to_user_friendly_string(m_key->keycontext()),
|
||||
fg,
|
||||
bg,
|
||||
gfx::Point(contextXPos, y));
|
||||
|
@ -595,7 +590,7 @@ private:
|
|||
case KeyContext::MoveTool:
|
||||
case KeyContext::FreehandTool:
|
||||
case KeyContext::ShapeTool:
|
||||
text = convertKeyContextToUserFriendlyString(key->keycontext()) + ": " + text;
|
||||
text = convert_keycontext_to_user_friendly_string(key->keycontext()) + ": " + text;
|
||||
break;
|
||||
}
|
||||
KeyItem* keyItem = new KeyItem(m_keys, m_menuKeys, text, key, nullptr, 0, &m_headerItem);
|
||||
|
@ -977,6 +972,7 @@ public:
|
|||
KeyboardShortcutsCommand();
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
|
||||
|
@ -986,11 +982,15 @@ private:
|
|||
std::string m_search;
|
||||
};
|
||||
|
||||
KeyboardShortcutsCommand::KeyboardShortcutsCommand()
|
||||
: Command(CommandId::KeyboardShortcuts(), CmdUIOnlyFlag)
|
||||
KeyboardShortcutsCommand::KeyboardShortcutsCommand() : Command(CommandId::KeyboardShortcuts())
|
||||
{
|
||||
}
|
||||
|
||||
bool KeyboardShortcutsCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->isUIAvailable();
|
||||
}
|
||||
|
||||
void KeyboardShortcutsCommand::onLoadParams(const Params& params)
|
||||
{
|
||||
m_search = params.get("search");
|
||||
|
|
|
@ -34,10 +34,7 @@ private:
|
|||
std::string m_path;
|
||||
};
|
||||
|
||||
LaunchCommand::LaunchCommand()
|
||||
: Command(CommandId::Launch(), CmdUIOnlyFlag)
|
||||
, m_type(Url)
|
||||
, m_path("")
|
||||
LaunchCommand::LaunchCommand() : Command(CommandId::Launch()), m_type(Url), m_path("")
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "app/context_access.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/tx.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -28,8 +26,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
LayerFromBackgroundCommand::LayerFromBackgroundCommand()
|
||||
: Command(CommandId::LayerFromBackground(), CmdRecordableFlag)
|
||||
LayerFromBackgroundCommand::LayerFromBackgroundCommand() : Command(CommandId::LayerFromBackground())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,9 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/layer.h"
|
||||
|
||||
namespace app {
|
||||
|
@ -30,7 +28,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
LayerLockCommand::LayerLockCommand() : Command(CommandId::LayerLock(), CmdRecordableFlag)
|
||||
LayerLockCommand::LayerLockCommand() : Command(CommandId::LayerLock())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/cmd/set_layer_opacity.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
|
@ -40,7 +39,7 @@ private:
|
|||
int m_opacity;
|
||||
};
|
||||
|
||||
LayerOpacityCommand::LayerOpacityCommand() : Command(CommandId::LayerOpacity(), CmdUIOnlyFlag)
|
||||
LayerOpacityCommand::LayerOpacityCommand() : Command(CommandId::LayerOpacity())
|
||||
{
|
||||
m_opacity = 255;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2020-2024 Igara Studio S.A.
|
||||
// Copyright (C) 2020-2025 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
|
@ -34,7 +34,6 @@
|
|||
#include "app/ui_context.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "base/scoped_value.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/layer_tilemap.h"
|
||||
#include "doc/sprite.h"
|
||||
|
@ -166,7 +165,7 @@ public:
|
|||
m_document->add_observer(this);
|
||||
|
||||
if (countLayers() > 0) {
|
||||
m_userDataView.configureAndSet(m_layer->userData(), g_window->propertiesGrid());
|
||||
m_userDataView.configureAndSet(m_layer->userData(), propertiesGrid());
|
||||
if (m_remapAfterConfigure) {
|
||||
remapWindow();
|
||||
centerWindow();
|
||||
|
@ -368,8 +367,7 @@ private:
|
|||
{
|
||||
if (m_layer) {
|
||||
m_userDataView.toggleVisibility();
|
||||
g_window->remapWindow();
|
||||
manager()->invalidate();
|
||||
expandWindow(gfx::Size(bounds().w, sizeHint().h));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,14 +498,14 @@ private:
|
|||
bool m_remapAfterConfigure = false;
|
||||
};
|
||||
|
||||
LayerPropertiesCommand::LayerPropertiesCommand()
|
||||
: Command(CommandId::LayerProperties(), CmdRecordableFlag)
|
||||
LayerPropertiesCommand::LayerPropertiesCommand() : Command(CommandId::LayerProperties())
|
||||
{
|
||||
}
|
||||
|
||||
bool LayerPropertiesCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable | ContextFlags::HasActiveLayer);
|
||||
return context->isUIAvailable() &&
|
||||
context->checkFlags(ContextFlags::ActiveDocumentIsWritable | ContextFlags::HasActiveLayer);
|
||||
}
|
||||
|
||||
void LayerPropertiesCommand::onExecute(Context* context)
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/layer.h"
|
||||
|
||||
namespace app {
|
||||
|
@ -29,8 +28,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
LayerVisibilityCommand::LayerVisibilityCommand()
|
||||
: Command(CommandId::LayerVisibility(), CmdRecordableFlag)
|
||||
LayerVisibilityCommand::LayerVisibilityCommand() : Command(CommandId::LayerVisibility())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "app/ui/status_bar.h"
|
||||
#include "doc/cel.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -31,7 +30,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
LinkCelsCommand::LinkCelsCommand() : Command(CommandId::LinkCels(), CmdRecordableFlag)
|
||||
LinkCelsCommand::LinkCelsCommand() : Command(CommandId::LinkCels())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -88,7 +87,7 @@ void LinkCelsCommand::onExecute(Context* context)
|
|||
tx.commit();
|
||||
}
|
||||
|
||||
if (nonEditableLayers)
|
||||
if (context->isUIAvailable() && nonEditableLayers)
|
||||
StatusBar::instance()->showTip(1000, Strings::statusbar_tips_locked_layers());
|
||||
|
||||
update_screen_for_document(document);
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace app {
|
|||
|
||||
class LoadMaskCommand : public Command {
|
||||
std::string m_filename;
|
||||
bool m_ui = true;
|
||||
|
||||
public:
|
||||
LoadMaskCommand();
|
||||
|
@ -36,13 +37,16 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
LoadMaskCommand::LoadMaskCommand() : Command(CommandId::LoadMask(), CmdRecordableFlag)
|
||||
LoadMaskCommand::LoadMaskCommand() : Command(CommandId::LoadMask())
|
||||
{
|
||||
m_filename = "";
|
||||
}
|
||||
|
||||
void LoadMaskCommand::onLoadParams(const Params& params)
|
||||
{
|
||||
if (params.has_param("ui"))
|
||||
m_ui = params.get_as<bool>("ui");
|
||||
else
|
||||
m_ui = true;
|
||||
m_filename = params.get("filename");
|
||||
}
|
||||
|
||||
|
@ -55,7 +59,7 @@ void LoadMaskCommand::onExecute(Context* context)
|
|||
{
|
||||
const ContextReader reader(context);
|
||||
|
||||
if (context->isUIAvailable()) {
|
||||
if (context->isUIAvailable() && m_ui) {
|
||||
base::paths exts = { "msk" };
|
||||
base::paths selectedFilename;
|
||||
if (!app::show_file_selector(Strings::load_selection_title(),
|
||||
|
@ -70,7 +74,8 @@ void LoadMaskCommand::onExecute(Context* context)
|
|||
|
||||
std::unique_ptr<Mask> mask(load_msk_file(m_filename.c_str()));
|
||||
if (!mask) {
|
||||
ui::Alert::show(Strings::alerts_error_loading_file(m_filename));
|
||||
if (context->isUIAvailable())
|
||||
ui::Alert::show(Strings::alerts_error_loading_file(m_filename));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,14 +37,19 @@ protected:
|
|||
private:
|
||||
std::string m_preset;
|
||||
std::string m_filename;
|
||||
bool m_ui = true;
|
||||
};
|
||||
|
||||
LoadPaletteCommand::LoadPaletteCommand() : Command(CommandId::LoadPalette(), CmdRecordableFlag)
|
||||
LoadPaletteCommand::LoadPaletteCommand() : Command(CommandId::LoadPalette())
|
||||
{
|
||||
}
|
||||
|
||||
void LoadPaletteCommand::onLoadParams(const Params& params)
|
||||
{
|
||||
if (params.has_param("ui"))
|
||||
m_ui = params.get_as<bool>("ui");
|
||||
else
|
||||
m_ui = true;
|
||||
m_preset = params.get("preset");
|
||||
m_filename = params.get("filename");
|
||||
}
|
||||
|
@ -58,20 +63,20 @@ void LoadPaletteCommand::onExecute(Context* context)
|
|||
if (!base::is_file(filename))
|
||||
filename = get_preset_palette_filename(m_preset, ".gpl");
|
||||
}
|
||||
else if (!m_filename.empty()) {
|
||||
filename = m_filename;
|
||||
}
|
||||
else if (context->isUIAvailable()) {
|
||||
base::paths exts = get_readable_palette_extensions();
|
||||
else if (context->isUIAvailable() && m_ui) {
|
||||
const base::paths exts = get_readable_palette_extensions();
|
||||
base::paths filenames;
|
||||
if (app::show_file_selector(Strings::load_palette_title(),
|
||||
"",
|
||||
m_filename,
|
||||
exts,
|
||||
FileSelectorType::Open,
|
||||
filenames)) {
|
||||
filename = filenames.front();
|
||||
}
|
||||
}
|
||||
else if (!m_filename.empty()) {
|
||||
filename = m_filename;
|
||||
}
|
||||
|
||||
// Do nothing
|
||||
if (filename.empty())
|
||||
|
|
|
@ -29,7 +29,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
MaskAllCommand::MaskAllCommand() : Command(CommandId::MaskAll(), CmdRecordableFlag)
|
||||
MaskAllCommand::MaskAllCommand() : Command(CommandId::MaskAll())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "app/color_utils.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/new_params.h"
|
||||
#include "app/console.h"
|
||||
#include "app/context.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc.h"
|
||||
|
@ -26,9 +25,6 @@
|
|||
#include "app/ui/color_bar.h"
|
||||
#include "app/ui/color_button.h"
|
||||
#include "app/ui/selection_mode_field.h"
|
||||
#include "base/chrono.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "base/scoped_value.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
|
@ -203,8 +199,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
MaskByColorCommand::MaskByColorCommand()
|
||||
: CommandWithNewParams(CommandId::MaskByColor(), CmdUIOnlyFlag)
|
||||
MaskByColorCommand::MaskByColorCommand() : CommandWithNewParams(CommandId::MaskByColor())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "doc/image.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -38,7 +37,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
MaskContentCommand::MaskContentCommand() : Command(CommandId::MaskContent(), CmdRecordableFlag)
|
||||
MaskContentCommand::MaskContentCommand() : Command(CommandId::MaskContent())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -87,9 +86,11 @@ void MaskContentCommand::onExecute(Context* context)
|
|||
}
|
||||
|
||||
// Select marquee tool
|
||||
if (tools::Tool* tool = App::instance()->toolBox()->getToolById(
|
||||
tools::WellKnownTools::RectangularMarquee)) {
|
||||
ToolBar::instance()->selectTool(tool);
|
||||
if (context->isUIAvailable()) {
|
||||
if (tools::Tool* tool = App::instance()->toolBox()->getToolById(
|
||||
tools::WellKnownTools::RectangularMarquee)) {
|
||||
ToolBar::instance()->selectTool(tool);
|
||||
}
|
||||
}
|
||||
|
||||
update_screen_for_document(document);
|
||||
|
|
|
@ -13,16 +13,12 @@
|
|||
#include "app/cmd/flatten_layers.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/doc_range.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/tx.h"
|
||||
#include "doc/blend_internals.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -35,8 +31,7 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
MergeDownLayerCommand::MergeDownLayerCommand()
|
||||
: Command(CommandId::MergeDownLayer(), CmdRecordableFlag)
|
||||
MergeDownLayerCommand::MergeDownLayerCommand() : Command(CommandId::MergeDownLayer())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -18,16 +18,12 @@
|
|||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/tx.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "doc/algorithm/modify_selection.h"
|
||||
#include "doc/brush_type.h"
|
||||
#include "doc/mask.h"
|
||||
#include "filters/neighboring_pixels.h"
|
||||
|
||||
#include "modify_selection.xml.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace app {
|
||||
|
||||
using namespace doc;
|
||||
|
@ -52,13 +48,15 @@ private:
|
|||
Modifier m_modifier;
|
||||
int m_quantity;
|
||||
doc::BrushType m_brushType;
|
||||
bool m_ui;
|
||||
};
|
||||
|
||||
ModifySelectionCommand::ModifySelectionCommand()
|
||||
: Command(CommandId::ModifySelection(), CmdRecordableFlag)
|
||||
: Command(CommandId::ModifySelection())
|
||||
, m_modifier(Modifier::Expand)
|
||||
, m_quantity(0)
|
||||
, m_brushType(doc::kCircleBrushType)
|
||||
, m_ui(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -80,6 +78,11 @@ void ModifySelectionCommand::onLoadParams(const Params& params)
|
|||
m_brushType = doc::kCircleBrushType;
|
||||
else if (brush == "square")
|
||||
m_brushType = doc::kSquareBrushType;
|
||||
|
||||
if (params.has_param("ui"))
|
||||
m_ui = params.get_as<bool>("ui");
|
||||
else
|
||||
m_ui = true;
|
||||
}
|
||||
|
||||
bool ModifySelectionCommand::onEnabled(Context* context)
|
||||
|
@ -92,7 +95,7 @@ void ModifySelectionCommand::onExecute(Context* context)
|
|||
int quantity = m_quantity;
|
||||
doc::BrushType brush = m_brushType;
|
||||
|
||||
if (quantity == 0) {
|
||||
if (quantity == 0 && m_ui && context->isUIAvailable()) {
|
||||
Preferences& pref = Preferences::instance();
|
||||
ModifySelectionWindow window;
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "ui/base.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -25,13 +24,13 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
MoveCelCommand::MoveCelCommand() : Command(CommandId::MoveCel(), CmdUIOnlyFlag)
|
||||
MoveCelCommand::MoveCelCommand() : Command(CommandId::MoveCel())
|
||||
{
|
||||
}
|
||||
|
||||
bool MoveCelCommand::onEnabled(Context* context)
|
||||
{
|
||||
return App::instance()->timeline()->isMovingCel();
|
||||
return context->isUIAvailable() && App::instance()->timeline()->isMovingCel();
|
||||
}
|
||||
|
||||
void MoveCelCommand::onExecute(Context* context)
|
||||
|
|
|
@ -18,19 +18,15 @@
|
|||
#include "app/doc_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/tx.h"
|
||||
#include "app/ui/doc_view.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/view.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
MoveMaskCommand::MoveMaskCommand() : Command(CommandId::MoveMask(), CmdRecordableFlag)
|
||||
MoveMaskCommand::MoveMaskCommand() : Command(CommandId::MoveMask())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -52,13 +52,13 @@ private:
|
|||
void selectPencilTool();
|
||||
};
|
||||
|
||||
NewBrushCommand::NewBrushCommand() : Command(CommandId::NewBrush(), CmdUIOnlyFlag)
|
||||
NewBrushCommand::NewBrushCommand() : Command(CommandId::NewBrush())
|
||||
{
|
||||
}
|
||||
|
||||
bool NewBrushCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable);
|
||||
return context->isUIAvailable() && context->checkFlags(ContextFlags::ActiveDocumentIsWritable);
|
||||
}
|
||||
|
||||
void NewBrushCommand::onExecute(Context* context)
|
||||
|
|
|
@ -64,7 +64,7 @@ protected:
|
|||
// static
|
||||
int NewFileCommand::g_spriteCounter = 0;
|
||||
|
||||
NewFileCommand::NewFileCommand() : CommandWithNewParams(CommandId::NewFile(), CmdRecordableFlag)
|
||||
NewFileCommand::NewFileCommand() : CommandWithNewParams(CommandId::NewFile())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -10,28 +10,18 @@
|
|||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/color.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/tx.h"
|
||||
#include "app/ui/doc_view.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "doc/cel.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -57,7 +47,7 @@ private:
|
|||
Content m_content;
|
||||
};
|
||||
|
||||
NewFrameCommand::NewFrameCommand() : Command(CommandId::NewFrame(), CmdRecordableFlag)
|
||||
NewFrameCommand::NewFrameCommand() : Command(CommandId::NewFrame())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/cmd/add_tag.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context.h"
|
||||
|
@ -18,8 +17,6 @@
|
|||
#include "app/ui/tag_window.h"
|
||||
#include "doc/tag.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace app {
|
||||
|
||||
using namespace doc;
|
||||
|
@ -33,14 +30,14 @@ protected:
|
|||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
NewFrameTagCommand::NewFrameTagCommand() : Command(CommandId::NewFrameTag(), CmdRecordableFlag)
|
||||
NewFrameTagCommand::NewFrameTagCommand() : Command(CommandId::NewFrameTag())
|
||||
{
|
||||
}
|
||||
|
||||
bool NewFrameTagCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
||||
ContextFlags::HasActiveSprite);
|
||||
return context->isUIAvailable() && context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
||||
ContextFlags::HasActiveSprite);
|
||||
}
|
||||
|
||||
void NewFrameTagCommand::onExecute(Context* context)
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/find_widget.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/load_widget.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/restore_visible_layers.h"
|
||||
|
@ -48,7 +46,6 @@
|
|||
#include "new_layer.xml.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
|
@ -99,7 +96,7 @@ private:
|
|||
Place m_place;
|
||||
};
|
||||
|
||||
NewLayerCommand::NewLayerCommand() : CommandWithNewParams(CommandId::NewLayer(), CmdRecordableFlag)
|
||||
NewLayerCommand::NewLayerCommand() : CommandWithNewParams(CommandId::NewLayer())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -267,16 +264,8 @@ void NewLayerCommand::onExecute(Context* context)
|
|||
bool afterBackground = false;
|
||||
|
||||
switch (m_type) {
|
||||
case Type::Layer:
|
||||
|
||||
if (m_place == Place::BeforeActiveLayer) {
|
||||
layer = api.newLayer(parent, name);
|
||||
api.restackLayerBefore(layer, parent, activeLayer);
|
||||
}
|
||||
else
|
||||
layer = api.newLayerAfter(parent, name, activeLayer);
|
||||
break;
|
||||
case Type::Group: layer = api.newGroupAfter(parent, name, activeLayer); break;
|
||||
case Type::Layer: layer = api.newLayer(parent, name); break;
|
||||
case Type::Group: layer = api.newGroup(parent, name); break;
|
||||
case Type::ReferenceLayer:
|
||||
layer = api.newLayer(parent, name);
|
||||
if (layer)
|
||||
|
@ -311,6 +300,15 @@ void NewLayerCommand::onExecute(Context* context)
|
|||
|
||||
ASSERT(layer->parent());
|
||||
|
||||
// Reorder the resulting layer.
|
||||
switch (m_place) {
|
||||
case Place::AfterActiveLayer: api.restackLayerAfter(layer, parent, activeLayer); break;
|
||||
case Place::BeforeActiveLayer: api.restackLayerBefore(layer, parent, activeLayer); break;
|
||||
case Place::Top:
|
||||
api.restackLayerAfter(layer, sprite->root(), sprite->root()->lastLayer());
|
||||
break;
|
||||
}
|
||||
|
||||
// Put new layer as an overlay of the background or in the first
|
||||
// layer in case the sprite is transparent.
|
||||
if (afterBackground) {
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "doc/sprite.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace app {
|
||||
|
||||
using namespace doc;
|
||||
|
@ -39,7 +37,7 @@ protected:
|
|||
};
|
||||
|
||||
NewSpriteFromSelectionCommand::NewSpriteFromSelectionCommand()
|
||||
: Command(CommandId::NewSpriteFromSelection(), CmdUIOnlyFlag)
|
||||
: Command(CommandId::NewSpriteFromSelection())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context.h"
|
||||
#include "app/doc.h"
|
||||
|
@ -20,7 +19,7 @@ using namespace gfx;
|
|||
|
||||
class ShowOnionSkinCommand : public Command {
|
||||
public:
|
||||
ShowOnionSkinCommand() : Command(CommandId::ShowOnionSkin(), CmdUIOnlyFlag) {}
|
||||
ShowOnionSkinCommand() : Command(CommandId::ShowOnionSkin()) {}
|
||||
|
||||
protected:
|
||||
bool onChecked(Context* context) override
|
||||
|
|
|
@ -22,6 +22,7 @@ public:
|
|||
OpenBrowserCommand();
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
std::string onGetFriendlyName() const override;
|
||||
|
@ -31,10 +32,15 @@ private:
|
|||
std::string m_filename;
|
||||
};
|
||||
|
||||
OpenBrowserCommand::OpenBrowserCommand() : Command(CommandId::OpenBrowser(), CmdUIOnlyFlag)
|
||||
OpenBrowserCommand::OpenBrowserCommand() : Command(CommandId::OpenBrowser())
|
||||
{
|
||||
}
|
||||
|
||||
bool OpenBrowserCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->isUIAvailable();
|
||||
}
|
||||
|
||||
void OpenBrowserCommand::onLoadParams(const Params& params)
|
||||
{
|
||||
m_filename = params.get("filename");
|
||||
|
|
|
@ -19,14 +19,12 @@
|
|||
#include "app/file/file.h"
|
||||
#include "app/file_selector.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/recent_files.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "app/util/open_file_job.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/thread.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
|
@ -35,7 +33,7 @@
|
|||
namespace app {
|
||||
|
||||
OpenFileCommand::OpenFileCommand()
|
||||
: Command(CommandId::OpenFile(), CmdRecordableFlag)
|
||||
: Command(CommandId::OpenFile())
|
||||
, m_ui(true)
|
||||
, m_repeatCheckbox(false)
|
||||
, m_oneFrame(false)
|
||||
|
@ -194,10 +192,12 @@ void OpenFileCommand::onExecute(Context* context)
|
|||
// interact with old versions of Aseprite saving the grid
|
||||
// bounds in the aseprite.ini file)
|
||||
docPref.grid.bounds(doc->sprite()->gridBounds());
|
||||
docPref.grid.type(doc->sprite()->gridType());
|
||||
}
|
||||
else {
|
||||
// Get grid bounds from preferences
|
||||
doc->sprite()->setGridBounds(docPref.grid.bounds());
|
||||
doc->sprite()->setGridType(docPref.grid.type());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue