Commit Graph

30 Commits

Author SHA1 Message Date
David Capello
8722c8ec16 Lock document in Tx() ctor (part of #2430)
This already fixes a lot of possible problems that can happen when a
script is running and modifying some part of a sprite that is being
backed up in a background thread.

We still need some work to being able to lock a sprite two or more
times in the same thread to write it. E.g. an app.transaction() should
lock the sprite for write access, but the script transaction function
could call a command, and that command could use a ContextWriter to
lock the sprite again. At the moment this is not possible because we
need a re-entrant RWLock implementation.
2023-12-27 11:05:15 -03:00
David Capello
e78e1e9a54 Remove current_editor, replace with Editor::activeEditor()
Finally removed src/app/modules/editors.h file.
2022-10-20 12:31:22 -03:00
David Capello
6e0394b7dc Fix using MoveMask command without visible selection
Issue found testing #2796 without selection/without calling SelectTile
command.
2022-07-07 16:33:39 -03:00
David Capello
7594ebf25b Generate selection boundaries automatically after transactions
Now Transaction::commit() will regenerate mask boundaries
automatically if in the middle of the transaction the document
selection was modified. This is the first step to finally remove
update_screen_for_document() and any kind of manual screen
refresh.

This will be useful for scripting functions that modify the selection
too, because we wouldn't need to regenerate the selection boundaries
automatically from the script or from app.refresh() Lua function.

Related to #378
2019-02-15 17:14:44 -03:00
David Capello
70629d6f89 Use Tx instead of Transaction in commands 2018-08-20 16:00:59 -03:00
David Capello
b3c89cd110 Rename DocumentView -> DocView 2018-07-14 23:24:49 -03:00
David Capello
9c79ea2b77 Rename app::Document -> Doc 2018-07-07 11:54:44 -03:00
David Capello
ee5842cde3 Rename DocumentApi -> DocApi 2018-07-07 03:07:16 -03:00
David Capello
48fc0cbcb4 Don't allow shift pixels on locked layer
Discussion: https://community.aseprite.org/t/750
2017-12-01 17:18:23 -03:00
David Capello
e0a60b6748 Generate the list of command IDs from en.ini file 2017-12-01 15:10:21 -03:00
David Capello
ccee49c02b Move command friendly names to the strings file
Related to #124
2017-11-30 23:41:45 -03:00
David Capello
5ecc356a41 Replace GPL license with the new EULA 2016-08-29 13:08:21 -03:00
David Capello
591b3b19ac Add MoveMaskCommand::getDelta member function 2016-05-18 12:03:28 -03:00
David Capello
34ebf07118 Fix warning ptr <-> bool conversion in MoveMaskCommand::onEnabled() 2016-05-06 16:52:56 -03:00
David Capello
ccabc9ad01 Fix arrow keys to move selection (fix #1120) 2016-05-05 23:20:34 -03:00
David Capello
1aaeacc460 Refactor several "getNoun()" getters to "noun()"
This is a work-in-progress to create a consistent API and finally
separate the whole Aseprite base/gfx/ui libs into a reusable C++ library.

Classes:
app::IFileItem, app::AppMenuItem, app::skin::SkinPart,
gfx::Rect, gfx::Border, she::FileDialog,
ui::IButtonIcon, ui::Graphics, ui::Overlay, ui::Widget,
ui::ScrollableViewDelegate, and UI events
2015-12-04 14:39:04 -03:00
David Capello
462f1f395e Add support to rotate the selection/moving pixels (fix #161) 2015-08-13 21:47:30 -03:00
David Capello
8fd756c32a Add Edit > Shift commands (fix #681) 2015-07-06 18:48:55 -03:00
David Capello
f6be0c3be6 Replace ISettings with Preferences
Changes:
* Move FreehandAlgorithm/InkType/RotationAlgorithm/SelectionMode to
  app::tools namespace
* Removed ISettings, IToolSettings, IBrushSettings, ISelectionSettings,
  and IColorSwatchesStore (and implementations from UISettingsImpl)
* Added app::tools::PreferenceGlue to do some adjustments that
  UIToolSettingsImpl was doing
* Remove signals from App related to brush size/angle changes, and current
  tool change (there events can be observed directly from Preferences)
* Remove ColorBar::FgColor/BgColor, these options can be observed from
  Preferences::colorBar.fg/bgColor
2015-05-18 16:53:25 -03:00
David Capello
0cb4b2234d Always load params when a command is executed
This is to avoid leaving commands with old params (a problem with
keyboard shortcuts). To make sure, we've changed arguments from Params*
to Params&, so we always have params to load.

Also, in this change we introduce a new way to give parameters to executed
commands from menu items using AppMenuItem::setContextParams(). Before
showing a popup, we can call setContextParams() to give extra params to
the command (e.g. the specific FrameTag to remove or change properties).
In this way "contextparams" attribute for <item> in gui.xml is not
available anymore.
2015-03-11 15:40:22 -03:00
David Capello
69ac11eea2 Remove IDocumentSettings and DocumentSettingsObserver
Document user options are completely replaced with DocumentPreferences.
2015-02-15 09:48:38 -03:00
David Capello
2c6067f7e4 Update license of app/ module to GPLv2 2015-02-12 12:16:25 -03:00
David Capello
e55865843e Replace undo impl: replace undoers with cmds
Undoers were little objects to swap/revert an action. They didn't
execute the action itself, they just revert its previous state. Now
undoers were replaced with cmds: A cmd is an object that
executes/undoes/redoes just one action.

Changes:
* Remove old undo library and app/objects_container_impl.cpp
  (now we use the doc::ObjectId directly to store undo info)
* Remove all Undoers from app/undoers/
* Replace DocumentApi impl with little Cmds in app/cmd/, these
  cmds handle execute/undo/redo of each action at the logic layer
* Remove doc::Dirty object
* Remove doc::Settings: all undo configuration is in the app side
* Move undo options from app:ISettings to app::Preferences
* Rename UndoTransaction to Transaction
* Create a CmdSequence to store a sequence of Cmds (as now the new
  undo library doesn't support open/close groups)
* Add doc::get<T>(ObjectId) function to get any kind of object
  from the doc library by its ID
* Add Cel::document() and Sprite::document() members
* Add Sprite::cels(frame_t) to get all cels in the given frame
* Add Layer::displaceFrames() member function
* Move the "allow non-linear history" flag from undo2::UndoHistory
  to app::DocumentUndo
2015-01-18 22:05:33 -03:00
David Capello
4fc28d5639 Add zoom out (related to issue #33)
Before the zoom was handle as a bits shift (scaled = value << zoom),
now the zoom is a fraction (scaled = value * zoom.num / zoom.den).

Changes:
* Add Zoom class to apply/remove zoom factor
* Split merge_zoomed_image template function into
  merge_zoomed_image_scale_down and merge_zoomed_image_scale_up
  to handle the special case where zoom.num/zoom.den < 1.0
2014-11-24 17:18:30 -03:00
David Capello
39b8e034b5 Merge branch '1.0'
Conflicts:
	.gitmodules
	CMakeLists.txt
	src/CMakeLists.txt
	src/app/app.h
	src/app/app_menus.cpp
	src/app/commands/cmd_move_mask.cpp
	src/app/commands/cmd_rotate.cpp
	src/app/modules/gui.cpp
	src/doc/resize_image_tests.cpp
	src/ui/accelerator.cpp
	third_party/CMakeLists.txt
2014-10-30 01:06:27 -03:00
David Capello
f939ef5f02 Add keyboard shortcuts customization (close #253)
Changes:
* Add KeyboardShortcutsCommand and window
* Add SelectAccelerator window
* Replace modules/gui.cpp functions with app::KeyboardShortcuts and
  app::Key with the logic to load/save/handle keyboard shortcuts
* Change ui::Accelerator concept: now it represent just one keyboard
  shortcut, not a set of shortcuts
* Remove ui::Accelerator from ui::MenuItem, now the key is associated
  in app::AppMenuItem and it's a app::Key
* Add Command::onGetFriendlyName() to get a user friendly name of the
  command depending on its parameters
2014-10-29 11:58:03 -03:00
David Capello
63995c6f0a Merge "raster" namespace into "doc" library 2014-10-20 22:21:31 -03:00
David Capello
16ba5920a1 Change "outline" to "boundaries" in MoveMaskCommand 2014-08-24 23:33:13 -03:00
David Capello
5075c1f86f Remove unused variables/code 2014-08-17 20:37:12 -03:00
David Capello
626ec1d2ba Add MoveTaskCommand: now you can move the selection with Shift+arrow keys 2014-08-08 01:00:02 -03:00