Commit Graph

255 Commits

Author SHA1 Message Date
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 cdd955441a Rename PreferredSize -> SizeHint 2015-12-03 21:50:05 -03:00
David Capello f9b249fba7 Add option to switch auto-opaque/transparent option in ContextBar popup menu 2015-12-01 16:37:46 -03:00
David Capello e8dd1526f6 Convert ink menu into a popup menu specified in gui.xml 2015-11-27 11:36:27 -03:00
David Capello aaf49be654 Add commands to change ink type (#787)
By default there are no shortcuts to change the ink type.
2015-11-27 01:35:31 -03:00
David Capello c33e63bed7 Fix bug destroying ShadeWidgets of Select type
We don't need to listen the ColorBar in shade widgets that are used
in the menu popup.
2015-11-26 20:09:53 -03:00
David Capello 8a7a585362 Load/save shades in user preferences (close #85) 2015-11-25 15:17:34 -03:00
David Capello 0f8997b3df Add drag-and-drop of colors in shade widget (#85) 2015-11-25 12:29:19 -03:00
David Capello cf7c4754cc Convert InkShadesField in a combobox-like widget to store several shades (#85)
Changes:
* Added new ui::IconButton widget to create widgets with one skin icon
  that is colored depending on the button state.
* ContextBar::InkShadesField was divided into a couple widgets (ShadeWidget
  and IconButton to drop-down a little menu with saved shades)
* Fixed CommonLockedSurface::drawColoredRgbaSurface() impl.
* Removed invalid gfx::setr/g/b/a() functions.
2015-11-24 18:37:13 -03:00
David Capello 25a331c43a Fix shades field preferred size when UI scaling > 100% 2015-11-23 15:05:35 -03:00
David Capello e683b8fb1a Switch shading colors with X key
Related to #85 and #854
2015-11-20 18:44:08 -03:00
David Capello 6cbb1882d4 Add shortcut to switch pixel-perfect mode (fix #858) 2015-11-18 16:15:25 -03:00
David Capello c29fd79796 Remove commented code in context_bar.cpp to select dots freehand algorithm 2015-11-18 15:32:48 -03:00
David Capello e5397d9ad3 Don't show symmetry controls on tools like eyedropper/move/zoom 2015-10-29 12:52:22 -03:00
David Capello 56854cdb9f Add symmetry mode (fix #208)
This is a first iteration of the feature, it doesn’t have handles to
move the symmetry line and it only contains two symmetry modes:
horizontal or vertical.

As an extra change, we have added the new Stroke type to wrap a vector
of gfx::Points and simplify some existing code in the ToolLoop.
2015-10-26 17:51:32 -03:00
David Capello 460d4b47c9 Add missing "override" modifier on some member functions
These ones were detected by clang-700.0.72
2015-09-30 16:34:43 -03:00
David Capello 984059e1bc Avoid selecting all RGBA+Index buttons in FilterTargetButtons 2015-08-28 15:41:02 -03:00
David Capello d994d67a2a Fix crash using Shading mode with sprites with different palette sizes 2015-08-28 12:22:32 -03:00
David Capello 62f90a1a76 Fix wording in empty ContextBar::InkShadesField widget 2015-08-27 08:10:09 -03:00
David Capello f3ac563e33 Add shading ink (fix #85) 2015-08-26 16:48:01 -03:00
David Capello 75a743f141 Separate pivot visibility and location options 2015-08-14 10:09:15 -03:00
David Capello 32bf3314e6 Add a new simple/default ink
This ink behaves as alpha compositing but doesn't use the opacity slider
(opacity is used from current color's alpha channel). Also, in case that
we pick the mask color, it behaves as the eraser tool.
2015-08-13 13:26:52 -03:00
David Capello e76d25283a Remove unused variable in ContextBar::BrushTypeField class 2015-08-06 17:37:16 -03:00
David Capello 53a925e86d Remove SkinParts enum
Now we generate the list of SkinTheme parts from the skin.xml file using
the gen utility.

Several refactors included in SkinTheme class to simplify code.
2015-08-04 19:38:52 -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 0898d685c2 Fix minor UI bug in the initial ContextBar::TransparentColorField state 2015-07-28 11:14:12 -03:00
David Capello 41bb23f1f1 Change opaque/transparent selection by default depending on the layer 2015-07-27 11:43:48 -03:00
David Capello bc29cd4bc5 Set alpha compositing as default
And "replace pixel" and "set alpha" were merged into "copy color" ink.
2015-07-27 11:24:00 -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 6aeee0b8fa Show opacity when brush is an image (ignoring the ink type) 2015-07-23 10:43:16 -03:00
David Capello 66ddc62a76 Add an option to share ink/opacity parameters between all tools 2015-07-23 10:07:07 -03:00
David Capello c6de475556 Add ContextBar::BrushChange signal 2015-07-06 13:05:06 -03:00
David Capello 17e1c22a65 Hide brush angle when it's not necessary 2015-07-03 13:41:50 -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 d80b984f00 Adjust default ink to be more pixel-art friendly (just replace RGBA values)
Now that we have alpha channel in color selector and palette entries, it's
nice to have as a default ink a more pixel-art friendly, i.e.
an ink that just replace RGBA values instead of doing alpha compositing.

Issue #286
2015-07-02 13:16:06 -03:00
David Capello a2538628c7 Convert ui::Widget::border_width/child_spacing to private fields 2015-06-23 19:20:49 -03:00
David Capello f01b816fb5 Remove JI_ prefix from ui/base.h constants 2015-06-23 14:00:00 -03:00
David Capello 90f988d928 Add option to ignore grid limits in paint bucket or magic wand tools (fix 564) 2015-06-17 13:22:46 -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 41ed14f036 Replace ISettings::get/setAutoSelectLayer() with Preferences class 2015-05-13 11:57:13 -03:00
David Capello 00ff89529c Replace ISettings::get/setGrabAlpha() with Preferences class 2015-05-13 11:46:49 -03:00
David Capello cff735a7c8 Remove unused variables 2015-05-11 10:40:23 -03:00
David Capello 35c8cc893b Add some help text in ContextBar when SelectBoxState is running 2015-05-07 13:11:44 -03:00
David Capello 18b067ee77 Add ContextBar::updateForCurrentTool() which is a common thing to do 2015-05-07 12:32:08 -03:00
David Capello 9f39f4384c Add a menu option to lock/unlock each brush
This is an alternative to lock brushes using its keyboard shortcut.
2015-05-06 17:39:40 -03:00
David Capello eeb6d6e1b5 Fix problem resetting fonts after F5 for widgets with "mini font" (after theme is reloaded)
There are some widgets (e.g. fg/bg color buttons in the ColorBar, and
ContextBar's check-boxes) that use a "mini font". We could setup the mini
font in onInitTheme(), but the whole program is not ready to do something
like that (there are too much child_spacing/borders values that are set
outside onInitTheme).

A better way is to ask to the theme itself (Theme::getWidgetFont())
about what font to use for each specific widget. And the Widget::m_font
field can act as a cache of this requested font. So now the "mini font"
is specified in a SkinProperty's flag.
2015-05-05 19:14:33 -03:00
David Capello f1d522f548 Replace brush slots until the user presses the shortcut
We replace brush slots until the user presses its keyboard shortcut, which
means he is interested in reusing the brush. In this way, if we want to
keep a brush, we can press Ctrl+B, select the brush area, and then Alt+1
to keep the first brush, then the next brush slot will be used/replaced
until Alt+2 is pressed, etc.
2015-04-30 11:59:47 -03:00
David Capello 03faee9ce4 Add option to delete all brushes 2015-04-29 17:26:25 -03:00
David Capello f5b7fd84dc Connect to BrushPopup::BrushChange just one time 2015-04-29 16:34:21 -03:00
David Capello edbff42dc8 We can delete brushes right-clicking them and selecting "Delete" 2015-04-29 15:00:05 -03:00
David Capello 1b25c4e9e9 Add slots in the ContextBar to select brushes with Alt+1, Alt+2, etc.
Now the ContextBar contains a set of brushes. The ChangeBrushCommand
supports a new "slot" parameter and "change" = "custom" to select a
specific custom brush from the ContextBar. Alt+1, Alt+2, etc. are mapped
to this ChangeBrushCommand (see changes in gui.xml).

Also, as the ButtonSet that represent different brushes in the ContextBar
uses icons generated from the brush, we don't need the skin parts that
represent each brush type (we can generate those icons from some standard
brushes). Those skin parts were removed.
2015-04-29 12:32:44 -03:00
David Capello b08b226aef Move active brush information to ContextBar 2015-04-28 18:21:33 -03:00
David Capello 303bd120dc Keep one instance of BrushPopup in memory 2015-04-28 12:53:02 -03:00
David Capello f09db4d9aa Add new BrushPopup (now the image brush is previewed)
This is the first step to create a bigger BrushPopup to select brushes
from an history of brushes. The general idea is to use Alt+1, Alt+2, etc.
to select different brushes from a stock.

Also the "discard brush" was removed. As the brush can be discarded
changing the brush type.
2015-04-28 12:38:15 -03:00
David Capello 51b6def023 Remove the "New Brush" button from the ContextBar 2015-04-27 12:07:23 -03:00
David Capello 96769d061e Rename BrushPattern::ALIGNED_FROM_SRC to ALIGNED_TO_SRC 2015-04-27 11:45:00 -03:00
David Capello dfeff22b2f Add possibility to create brushes from selection
Changes:
* Add doc::kImageBrushType
* Add doc::BrushPattern enum
* Add pattern and pattern origin properties to doc::Brush
* Add NewBrush and DiscardBrush commands (new Ctrl+B shortcut to create
  brushes)
* Add BrushInkProcessing
2015-04-27 00:08:04 -03:00
David Capello e725bf93a0 Fix tooltips in ContextBar about selection modifiers 2015-04-10 10:35:45 -03:00
David Capello 881667f01b Replaced app::skin::ThemeColor with app::gen::SkinTheme::Colors
Generate app::gen::SkinFile class from skin.xml to automate creation
of ID references.
2015-02-15 15:29:16 -03:00
David Capello 2c6067f7e4 Update license of app/ module to GPLv2 2015-02-12 12:16:25 -03:00
David Capello 06d18f1e8a Replace doc::FrameNumber with doc::frame_t 2014-12-28 20:39:11 -03:00
David Capello 07c7756638 Add Brush::kMax/MinBrushSize constants 2014-12-07 20:50:26 -03:00
David Capello ca9df1a05e Rename ui::jguiscale() to ui::guiscale()
* Change Theme::guiscale member to Theme::m_guiscale
2014-11-25 22:33:45 -03:00
David Capello acfe155b24 Merge branch '1.0'
Conflicts:
	src/app/color_picker.cpp
	src/raster/sprite.h
2014-11-16 18:59:30 -03:00
David Capello c64ee5729b Add "Auto Select Layer" check box to Move Tool (close #527) 2014-11-16 18:33:31 -03:00
David Capello 736f08099b Merge branch '1.0' 2014-10-25 16:20:33 -03:00
David Capello 0e7f424406 Fix #472 - Undo and redo change the size of spray tool 2014-10-25 12:10:52 -03:00
David Capello 63995c6f0a Merge "raster" namespace into "doc" library 2014-10-20 22:21:31 -03:00
David Capello d14a0fe075 Add "Size" options in CanvasSizeCommand to specify width/height
- Added canvas icons to change the expansion direction in CanvasSizeCommand
- Added Widget::at() and Widget::offerCapture() member functions
- Improved ButtonSet widget
2014-09-08 02:27:41 -03:00
David Capello 522e9a0337 Add Shift/Alt modifiers to selection tools to change Union/Subtract modes (fix #217) 2014-08-24 19:19:38 -03:00
David Capello 6824570c4b Remove base/override.h (use override keyword directly) 2014-08-14 23:07:47 -03:00
David Capello 2c675bfc4f Fix crash in PreviewCommand
We cannot use the ui::Graphics internal surface directly when we use
raster::convert_image_to_surface() (it expects an Rgba surface).
2014-08-09 21:33:38 -03:00
David Capello 7db6ea53c3 Add "Contiguous" option/checkbox for the paint bucket tool (true by default) 2014-08-07 00:07:24 -03:00
David Capello 91b0c2d071 Refactor: Remove "get" part for member functions that act like a simple getter
Additional change:
- Added Cel::image() to get the related image of the cel directly
2014-07-30 01:28:15 -03:00
David Capello 81ffb0c5bd Refactor: Create doc::Context and move some logic from app::Document to doc::Document
The objective of these changes is to create a more testable doc/logic API.

Included changes:
- Added doc::Context, doc::Documents (the old app::Documents),
  and doc::Sprites (and observers for each)
- Added raster::Sprite::createBasicSprite()
- Added doc::ColorMode (equal to raster::PixelFormat)
- Added some methods to doc::Document: context(), sprites(), sprite()
  (to replace app::Document::getSprite()), width/height(), colorMode(),
  name(), and close()
- Moved app::DocumentObserver/Event to doc::DocumentObserver/Event
- Replaced app::ContextObserver with doc::DocumentsObserver and a couple
  of signals.
- Renamed app::Context::getActiveDocument() with
  doc::Context::activeDocument()
- Renamed app::Context::getActiveLocation() with
  app::Context::activeLocation()
- Removed app::ContextObserverList
- Removed app::DocumentId (now we can use doc::ObjectId)
- Removed app::Context::getSettings()
2014-07-29 00:53:24 -03:00
David Capello b9a1fa8e17 Put batck the "Pixel perfect" checkbox in the contextbar
The new UI will be available in v1.1, and it's better if we don't modify
the v1.0 interface too much at this moment.
2014-07-17 09:54:04 -03:00
David Capello 4b7bf5b835 Merge she::Color and ui::Color types in gfx::Color 2014-06-28 16:10:39 -03:00
David Capello 5bbff161b9 Now ui::Graphics uses she::Surface instead of Allegro BITMAP 2014-06-26 22:14:39 -03:00
David Capello dbad153698 Add she::Font class (wrapper of Allegro FONT)
This is an huge refactor to avoid handling Allegro FONT directly. Some
changes:
* Add she::System::defaultDisplay/Font, createRgbaSurface, loadSurface,
  and loadRgbaSurface.
* Rename she::CreateSystem/Instance to she::create_system/instance.
* Remove ui/font.cpp and move ui/fontbmp.cpp to she library.
* ui::IButtonIcon uses she::Surface instead of BITMAP.
* Rename she::LockedSurface::drawAlphaSurface -> drawRgbaSurface
* Rename ui::SetDisplay -> set_display
* Rename _ji_font_text_len -> ui::Graphics::measureUIStringLength
2014-06-22 18:53:14 -03:00
David Capello c639b4dba3 Add "dots" freehand algorithm (change to ButtonSet the selection of FreehandAlgorithm) 2014-06-15 04:14:53 -03:00
David Capello 9ac51fd0be Rename raster::Pen -> raster::Brush 2014-06-14 15:09:43 -03:00
David Capello 153071f082 Fix issue 406: persist ISelectionSettings 2014-06-14 01:35:04 -03:00
David Capello dc5a019c13 ContextBar: Add buttons to drop the selection or cancel the whole operation
- Add ContextBarObserver (and MovingPixelsState implements this interface)
- PixelMovements::discardImage() receives a "commit" flag to do a rollback
  of the operation if the user needs it.
2014-05-26 00:20:16 -03:00
David Capello cd4e3aa122 Rename "Put Alpha" to "Set Alpha" 2014-05-04 22:20:33 -03:00
David Capello ce7bb1b9dc Add "Lock Alpha" ink (issue #155) 2014-05-04 22:16:30 -03:00
David Capello 6634c12ad2 Fix problem selecting Default Ink each time we want to show other ink type 2014-04-21 22:23:22 -03:00
David Capello a34d181530 Add Widget::is/setTransparent property to paint a widget merged with its background
This fixes problems with tooltips, toolbar popups and context bar popups.
It fixes issue #297 (undo notifications rendering problems).
2014-04-19 18:51:42 -03:00
David Capello 312aca755e Fix issue 333: Tool Selection Icons Flicker
- Add PopupWindow::ClickBehavior
2014-04-13 19:25:06 -03:00
David Capello 30e26e2a3a Select correct ink type in InkTypeField 2014-03-08 21:00:14 -03:00
David Capello d780e90784 Fix issue 367: Put alpha drawing mode isn't working 2014-03-08 20:37:43 -03:00
David Capello f107dd3cbc Fix issue 352: Context Bar Eats Hotkey Input
Avoid capturing keyboard focus in context bar widgets.
2014-03-08 20:31:55 -03:00
David Capello 1d7b51d8f9 Disable inks as they are confusing and shading mode is not done yet 2014-02-24 08:53:46 -03:00
David Capello 44c6a9d91a Fix bug where ContextBar was completely hidden 2014-02-02 21:07:12 -03:00
David Capello c8c099864c Added "Grab Alpha" option to eye dropper (issue 134) 2014-01-28 23:56:44 -03:00
David Capello 5ccae8c0bb Remove some labels from ContextBar, modify tooltips look, and use mini font 2014-01-26 08:40:16 -03:00
David Capello 9423b967ab Change selection behavior: left-click replace the selection
With this patch we replace the "unique/odd" behavior of Aseprite where
you add selection regions with left-click and remove with right-click.
Now by default you replace the selection with left-click (as in regular
gfx programs). Also you can change the selection tool behavior with
buttons/icons at the context bar (to select between replace/add/subtract).
2014-01-25 17:58:29 -03:00
David Capello 2d7db879a3 ContextBar: Move m_freehandBox to the last position to improve context bar for selection tools 2014-01-25 16:37:38 -03:00
David Capello 1554875618 Add pixel-perfect drawing mode for freehand tools (issue 315)
* Added new app::tools::IntertwineAsPixelPerfect intertwiner
* Added app::tools::FreehandAlgorithm enum
* Added app::tools::WellKnownIntertwiners constants
2014-01-25 16:26:49 -03:00
David Capello 02597dcdec Add RotSprite algorithm for PixelsMovement (issue 121)
* Added app::RotationAlgorithm enum.
* Added app::ISelectionSettings::get/setRotationAlgorithm.
* Added app::SelectionSettingsObserver::onSetRotationAlgorithm.
* Added raster::image_rotsprite() function.
* Added ContextBar::RotAlgorithmField class to select the rotation algorithm.
* Now the mask isn't updated constantly on PixelsMovement::moveImage8),
  in this way when the user release the mouse button is when we recalculate
  the mask (to get better performance when the user is scaling/rotating
  the image).
2013-12-29 17:11:56 -03:00
Joel Madigan 3ce805f63d Moved Transparent Color button to ContextBar
Implemented SelectionSettings class

Transparent Color button for moving pixels moved from status bar to
context bar.  Current Transparent Color stored by new SelectionSettings
class, retrievable from ISettings.

Also implemented Observer classes for existing Settings interfaces for
future use.

StatusBarObserver interface and supporting code removed from StatusBar.
2013-12-10 12:44:00 -05:00
David Capello 033aad9d28 Fix Unicode characters encoding (we've to use utf-8) in Color::toHumanReadableString() and BrushAngleField() 2013-11-23 18:01:42 -03:00
David Capello e5ba8e0922 Encapsulate Image implementation (private members, accessors, iterators, etc.)
- Rename _rgba/_graya to raster::rgba()/graya()
- Add raster::color_t type (alias for uint32_t)
- Rename raster::GfxObj to Object. And GfxObj::getType() to Object::type()
- Move conversion from raster::Image/Palette to Allegro BITMAP/RGB
  to raster/conversion_alleg.h file
- Add raster/color_scales.h
- Rename image_* functions to raster/primitives.h
- Reimplement ink processing with templates instead of macros
2013-11-09 19:59:05 -03:00
David Capello 5b252c30f5 Add support for Unicode file names on Windows
- Fixed issue #46: open .png files with Unicode chars
- Fixed issue #150: ability to uncompress program in folders w/Unicode chars
- Added base::utf8_iterator
- Added base::FileHandle
- Added base::get_app_path()
- Modified ui::KeyMessage::ascii() -> unicodeChar()
- Removed JI_NOTEXT flag
- Added app::XmlDocumentRef class and app::open_xml() function
- Added support for Unicode text exchange with Win32 clipboard
2013-10-14 19:58:11 -03:00
David Capello cde54f3682 Change BSD license to MIT in sublibraries and fix headers 2013-08-08 21:01:20 -03:00
David Capello c88f9b172b Refactor: Move app files to src/app subdirectory inside app namespace
- Add HAVE_CONFIG_H wrapper to #include "config.h"
- Removed widgets namespace (it's in app now)
- Move some functions from src/file/file.h to src/base/cfile.h
- Move Vector2d to base library
- Rename MenuItem2 to AppMenuItem
2013-08-05 21:20:19 -03:00