Commit Graph

95 Commits

Author SHA1 Message Date
David Capello a09b00dba8 Fix synchronization of different UI elements depending on the active tool
With this patch now the context bar shows the real active tool
preferences. For example, if we choose the option to use the Eraser
tool with right-click, now right-clicking will draw with the Eraser
brush size (instead of using the selected tool/left-click tool brush
size).

Changes:
* Removed the toolBox.activeTool() field from preferences
  (as the option isn't persisted between sessions)
* Added an observable app::tools::ActiveToolManager class to sync all
  UI elements that depend on the active tool and ink.
* Moved a lot of "active tool" logic from app::Editor to the
  new ActiveToolManager
* Moved app::tools::ToolLoopManager::Pointer as an indepedent
  app::tools::Pointer class
2016-04-25 15:20:53 -03:00
David Capello 5f90ef7c9b Add properties in App to access directly to timeline/contextBar/workspace 2016-04-22 13:19:06 -03:00
David Capello 33003fb6f9 Show current grid tile in status bar when the grid is visible (fix #1075) 2016-04-19 15:51:34 -03:00
David Capello 065188aea3 Include <cstring> needed in standby_state.cpp 2016-04-19 14:24:27 -03:00
David Capello 87ef48b50b Improve status bar with icons/automatically generated and re-used parts (fix #752) 2016-04-19 13:45:23 -03:00
David Capello 2ce09c53dd Add customization for square aspect, draw from center, and move origin keys (fix #1028)
Some changes:
- Now ui::Keys aren't processed in app::tools side, they are processed
  in Editor side and converted to ToolLoopModifiers flags.
- Replace ToolLoop::getSelectionMode -> ToolLoop::getModifiers()
2016-04-04 18:46:48 -03:00
David Capello 417e431a32 Add different selection modes to SelectTile command
Now we can add a tile using Shift+double click or substract one with
Shift+Alt+double click.
2016-03-19 12:09:03 -03:00
David Capello e62f80842c Avoid enter to tool loop after we select the tile 2016-03-19 12:04:39 -03:00
David Capello 30f4e995a3 Select a tile by double clicking over it (fix #939) 2016-03-19 11:33:05 -03:00
David Capello ef4a4822da Call onEnterState() from base class in SelectBoxState and StandbyState 2016-02-18 11:40:11 -03:00
David Capello c49ec61fa0 Minor refactor: rename DocumentView::getEditor/Document() -> editor/document() 2016-02-13 01:33:43 -03:00
David Capello 6e6ee10872 Merge branch 'snapSymmetryHandlesToViewportEdge' of https://github.com/TheKK/aseprite into TheKK-snapSymmetryHandlesToViewportEdge 2015-12-08 15:27:17 -03:00
David Capello 562106c6f0 Add EditorDecorator::getInvalidDecoratoredRegion() needed in #873 2015-12-07 15:25:10 -03:00
Ying Ruei Liang (KK) 2537b76cda Now the handles snap to the edge of viewport 2015-12-06 21:56:53 +08:00
David Capello e944ce0052 Move Bind, Connection, Signal, Slot, etc. to base namespace 2015-12-04 15:17:42 -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
Ying Ruei Liang (KK) 7e09f79285 Show preview correctly when moving multiple cels
Now you can see all the selected cels move synchronously while you drag
them with moving tool.
2015-12-04 01:05:28 +08:00
David Capello a3deb2063e Add MovingSymmetryState to modify symmetry axis position 2015-10-28 20:00:18 -03:00
David Capello 74e642d997 Add extra KeyContexts for each selection transformation 2015-09-11 20:04:02 -03:00
David Capello 0645a66521 Fix pressing multiple KeyAction modifiers at the same time (fix #778) 2015-08-25 13:29:19 -03:00
David Capello 1bee62ce8a Call eyedropper with right-click only when we have the mouse capture (fix #706) 2015-08-19 18:05:03 -03:00
David Capello 9966b48139 Add support to drag the selection in other editor when the active one is in MovingPixels state 2015-08-14 13:06:26 -03:00
David Capello 75a743f141 Separate pivot visibility and location options 2015-08-14 10:09:15 -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 7cfdf76b0e Add rotation pivot options in context bar (fix #370)
With these options we can configure to show the pivot and the default
location when we select a sprite area.
2015-07-29 16:35:34 -03:00
David Capello 35229e99a6 Add opaque/transparent mode in context bar for transformations (fix #546)
With this change now we add a "mask" image/parameter in rotation
functions. In this way we can identify which specific pixels are
inside the original mask/selection, and in opaque mode we can
include/scale/rotate all those pixels inside the mask, whatever
value they are, even if they are the mask color.

Fixes #730
2015-07-23 22:42:14 -03:00
David Capello be6779631b Modify eyedropper tool to pick colors with alpha and support several modes
Issue #286
2015-07-02 18:13:47 -03:00
David Capello 710e640174 Fix preview of transformations (PixelsMovement) 2015-06-25 14:54:06 -03:00
David Capello f571e4ceb2 Add BrushPreview class to wrap all code related to brush preview/editor cursor 2015-06-25 12:44:47 -03:00
David Capello 3c60136631 Move PI constant to base/pi.h file 2015-06-16 15:04:00 -03:00
David Capello f9b76e0f3e Fix crash destroying PixelsMovement's extra cel from Editor::clearBrushPreview()
If Ctrl key isn't mapped to Move tool (or any tool without brush preview),
when we use Ctrl+V to paste clipboard content, the extra cel created
by PixelsMovement will be destroyed by Editor::clearBrushPreview()
when the Editor state changes.

This bug only happened when the brush preview was visible and Ctrl+V was
used. Also it could happen if we mapped any other key (e.g. "A") to
paste the clipboard content directly when we were using a drawing tool
(like the Pencil tool).
2015-06-08 12:13: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 00ff89529c Replace ISettings::get/setGrabAlpha() with Preferences class 2015-05-13 11:46:49 -03:00
David Capello cd1f764d85 Rename EditorState::onBefore/AfterChangeState to onLeave/EnterState()
This is to avoid confusion about the meaning of these callbacks.
2015-05-10 19:32:42 -03:00
David Capello 20120f432a Fix crash trying to move an empty cel with Move tool 2015-04-30 17:26:46 -03:00
David Capello ceb469339d Draw transformation handles only in active editor (fix #82, fix #632) 2015-04-27 10:08:48 -03:00
David Capello 21c4fd51d9 Move app::DocumentLocation to doc::Site
This is a first step to include the current selected range of layers
and frames inside the doc::Site structure. So in the future we'll not need
to know about the Timeline in commands that handle those ranges.
2015-04-20 16:27:09 -03:00
David Capello 849e40b0f9 Fix crash when PixelsMovement() wants to create an extra cel without enough memory 2015-04-15 13:59:41 -03:00
David Capello 294ff0e4f6 Rename src/app/util/misc.[cpp/h] -> new_image_from_mask.[cpp/h] 2015-04-02 09:55:18 -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 b23194dfae Fix several warnings in MSVC, clang, and gcc 2015-03-05 15:19:00 -03:00
David Capello e85c63aa93 Merge branch '1.0'
Conflicts:
	src/app/ui/editor/editor.cpp
	src/app/ui/editor/moving_pixels_state.h
	src/app/ui/editor/pixels_movement.cpp
	src/app/ui/editor/pixels_movement.h
	src/app/ui/editor/standby_state.cpp
	src/app/ui/editor/tool_loop_impl.cpp
	src/app/util/expand_cel_canvas.cpp
	src/app/util/expand_cel_canvas.h
2015-02-15 18:12:03 -03:00
David Capello 02ad6b9b78 Fix several bugs dropping pixels in the invalid editor 2015-02-15 17:08:21 -03:00
David Capello 2c6067f7e4 Update license of app/ module to GPLv2 2015-02-12 12:16:25 -03:00
David Capello 22f35ab249 Independent scroll/zoom in Preview window (part of issue #407) 2015-02-10 12:59:43 -03:00
David Capello 06636fd16e Merge branch '1.0'
Conflicts:
	src/app/file/gif_format.cpp
	src/app/file/gif_options.h
	src/app/ui/editor/moving_cel_state.cpp
	src/app/ui/editor/standby_state.cpp
	src/app/util/range_utils.cpp
2015-01-29 12:18:13 -03:00
David Capello 2a582638ec Fix crash trying to move pixels and the current layer is nullptr
This fix was found thanks to a user provided memory dump. We don't know
why the layer can be nullptr, but there are some conditions preventing
this situation already in other places of the StandbyState::onMouseDown()
member function.
2015-01-28 11:04:07 -03:00
David Capello 06d18f1e8a Replace doc::FrameNumber with doc::frame_t 2014-12-28 20:39:11 -03:00
David Capello da1358c5dc Unify all render code in one library
Changes:
* Create render library (move util/render.cpp to render/render.cpp)
* Move app::Zoom class to render::Zoom
* Remove doc::Image::merge() member function
* Add gfx::Clip helper class (to clip dst/src rectangles before a blit)
* Move doc::composite_image() to render::composite_image()
* Remove doc::Sprite::render()
* Replace Sprite::getPixel() with render::get_sprite_pixel()
* Remove doc::layer_render() function
* Convert DitheringMethod to a enum class
* Add AppRender to configure a render::Render with the app configuration
* Move checked background preferences as document-specific configuration
* Add doc::Sprite::layer() and palette() member functions
* Add doc::Layer::cel() member function
* Add doc::Palette::entry() member function()
* Add doc::frame_t type
* Move create_palette_from_rgb/convert_pixel_format to render library
* ExportSpriteSheet doesn't need a temporary image now that we can specify
  the source rectangle in the render routine
2014-12-28 11:06:11 -03:00
David Capello afbd3b2d96 Optimize ToolLoop with modified regions of pixels
Here we avoid copying and clearing pixels that will not be used
in the whole tool loop process.
Changes:
* Add several member functions in ToolLoop to validate/invalidate regions
  of source/destination images so we know what regions are safe to use
  by inks and can be shown in the editor
* Add new DocumentObserver::onExposeSpritePixels() member to validate
  pixels that will be displayed in the editor
* Add Ink::needs/createSpecialSourceArea() member functions to validate
  extra areas for inks like blur or jumble
* Add undoers::ModifiedRegion to save the undo information about the
  modified region
* Add ShowHideDrawingCursor class
* Change "blur" tool policy from overlap to accumulate

(This is a real fix for issue #239)
2014-12-08 14:57:56 -03:00