Commit Graph

680 Commits

Author SHA1 Message Date
David Capello
b1b201a22c Minor change in ui::Widget to check current manager 2021-01-15 13:16:40 -03:00
David Capello
81d9e8afec Fix bug with Console when the UI Screen Scaling is changed 2020-12-11 15:52:14 -03:00
David Capello
661f4897b2 Check that we're in the UI thread when modifying the widgets collection 2020-10-20 12:54:56 -03:00
David Capello
6862bb8ab0 Fix opening several times the "save changes" alert (fix #2467)
This could happen if we clicked the cross icon in tabs without moving
the mouse.
2020-08-04 15:09:33 -03:00
David Capello
d75c9c443a Use LOG() with the printf-like interface (the only way to be thread safe) 2020-06-17 17:05:43 -03:00
David Capello
f0c9db7041 Don't show the notification flag on Advanced Mode 2020-06-17 12:40:11 -03:00
David Capello
3d2013b33c Draw mask boundaries with a gfx::Path
The path is also cached so on each re-paint we can re-use it while
it's still valid.
2020-05-18 17:58:22 -03:00
David Capello
f491a2a506 Add ui::Entry::Range to simplify code 2020-05-15 18:24:35 -03:00
David Capello
fa187b35a8 Don't delete extra char using Ctrl+backspace to delete words in ui::Entry 2020-05-15 18:15:59 -03:00
David Capello
7cde901047 Alt+backspace deletes a word too on ui::Entry fields 2020-05-12 15:11:15 -03:00
David Capello
263236deb3 Several fixed for Dynamics
* Now the max value in dynamics is equal to the brush size, so changing
  the brush size (e.g. switching between pencil/eraser tools) will
  change the max brush size (which is the most common parameter to
  change)
* Added mini_slider style for min/max brush/angle values
* Fixed some issues clicking outside the dynamics popup
2020-05-02 11:59:34 -03:00
David Capello
cc7bdbcec4 Add a slider style in theme
We've added some code to handle backward compatibility with themes. In
this way we can still load old themes in the latest version but should
look as in previous versions (this will not be done with previous
properties or parts migrated to styles, so we start from now on).
2020-05-01 23:31:10 -03:00
David Capello
b989b46ff2 Log warnings about widget styles only on debug build 2020-04-30 08:45:34 -03:00
David Capello
79f9e28ce8 Added pen pressure sensitivity (fix #710)
- Added support to detect eraser tip on Linux (#610)
- Related to #139
- Still needs works for gradients and better brush interpolations
  between stroke points
- Requested several times, e.g. https://community.aseprite.org/t/1077
  https://community.aseprite.org/t/1881, steam forum, etc.
2020-04-21 22:27:49 -03:00
David Capello
5affdbbae1 Shox extensions in different categories in the Preferences dialog 2020-04-20 14:20:07 -03:00
David Capello
85af3ce735 Fix Widget::previousSibling() impl 2020-04-08 17:48:26 -03:00
David Capello
8b1b624320 Replace NULL to nullptr in ui library 2020-04-08 17:48:06 -03:00
David Capello
9da4b76976 Possibility to scroll menus (fix #2263) 2020-04-03 17:56:35 -03:00
David Capello
09ea577a08 Match ui::MouseButton values to os::Event::MouseButton 2020-03-27 15:40:43 -03:00
David Capello
a0882ba443 Move PACKAGE/VERSION, etc. to new ver-lib
* As we moved the VERSION macro to a .c file, we don't have to
  recompile the whole project when we change the version number.
* Removed the version number from gui.xml
* Removed the invalid first menu item that might appear in the root
  menu when the gui.xml version is outdated in debug mode.
2020-03-16 10:31:32 -03:00
David Capello
95b655168c Use new laf + skia m81 branch
* Some minor refactors due laf changes.
* Updated the instructions to compile Aseprite linking to external
  skia instructions and pre-built packages.
2020-03-01 23:42:08 -03:00
David Capello
d5f0e3189c Fix bug drawing and zooming with the mouse wheel or pinch gesture
The mouse position jumps from one side to other when we zoom because
there were an intermediate scroll change event where the mouse
position is converted using the old zoom.

Fixed regressiong from 951fb7c357
Fixed bug https://community.aseprite.org/t/4587
2020-01-13 15:01:45 -03:00
David Capello
c1d5f8eb0a Move AnimatedWidget from app to ui 2019-12-23 11:14:23 -03:00
David Capello
78353199bb Remove UI_FOREACH_WIDGET_*() macros 2019-12-20 15:24:41 -03:00
David Capello
34ec123ecc Remove MIN/MAX/MID macros from ui library 2019-12-20 15:08:34 -03:00
David Capello
6777c2f34b Add ui::Widget::kCutTopWindowsAndUseChildArea flag 2019-11-15 16:22:44 -03:00
David Capello
5ac07c0823 Fix pressing buttons with Alt+mnemonic or Cmd+mnemonic (regression introduced in 536a4c5d3a) 2019-11-05 10:46:47 -03:00
David Capello
c2acc973ee Add support to show multiple sections in Export Sprite Sheet 2019-10-29 16:37:06 -03:00
David Capello
536a4c5d3a Simplify Export Sprite Sheet with preview + changes to the UI
These changes include an option to split layers and tags
by rows (fix #1118)
2019-10-18 17:00:35 -03:00
David Capello
c25c67733b Include ui/scroll_helper.h in ui/ui.h 2019-10-01 14:35:47 -03:00
Gaspar Capello
7c92fe207a Fix caret position when click on a text entry (#2160) 2019-09-30 16:22:01 -03:00
David Capello
d43ff9b32b Check missing theme styles to avoid crashes w/broken themes 2019-09-23 09:03:10 -03:00
David Capello
8e1f98a45f Fix ColorShades() painting of default text
Regression introduced in 9a75d01efe
2019-08-26 16:11:37 -03:00
David Capello
d32fd97da5 Replace base::SharedPtr with std::shared_ptr
We can remove our smart pointer (base::SharedPtr) as we're already
using C++11 compilers on all platforms.
2019-08-01 19:16:16 -03:00
David Capello
bcf6899793 Update display immediately after and undo/redo command is executed from the native macOS menu (fix #2069)
Replaced ui::kFunctionMessage with os::Event::Callback.
2019-05-27 23:53:57 -03:00
David Capello
54883012bb Put "Reopen Closed File" and "Clear Recent Files" options inside "File > Open Recent" menu 2019-05-27 23:53:57 -03:00
David Capello
38abac8b79 Fix crash on Windows using Manager::enqueueMessage() from non-UI thread
From time to time the app::BackupObserver::backgroundThread() will use
ui::execute_from_ui_thread() to show/hide the backup notification icon
in the StatusBar (see SwitchBackupIcon class). This
ui::execute_from_ui_thread() function enqueues a ui::FunctionMessage
calling the Manager::enqueueMessage(). The issue here is that
enqueueMessage() uses ui::is_ui_thread() to check if the thread that
wants to enqueue the message is the UI thread or other thread, and
depending on this decission the message will be directly added to
msg_queue or enqueued into concurrent_msg_queue.

The issue was that ui::is_ui_thread() was not working correctly on
Windows because GetCurrentThread() is not useful to check the current
thread with a previous call of GetCurrentThread() from other
thread (the function always return the same value, a special generic
value that identifies the current thread whatever it is).
2019-05-11 13:53:31 -03:00
David Capello
e8716cbb6e Improve context bar for slice tool (combobox of slices + action buttons) 2019-05-07 10:28:37 -03:00
David Capello
4004f7be65 Update to new gfx::Region API 2019-05-03 10:03:39 -03:00
David Capello
73de6c8b1d Add ability to edit multiple slices
Related to #721 and #1651, still need more work to give a better UX to
edit static and animated slices.
2019-05-02 16:26:13 -03:00
David Capello
951fb7c357 Fix invalid scroll on ui::View after changing required size of attached widget (regressiong introduced in b4eb7a0ccd) 2019-04-30 13:51:41 -03:00
David Capello
eed5f98b75 Minor changes in ui::View 2019-04-30 09:54:01 -03:00
David Capello
be74710067 Fix flicker issues on Windows moving the BrushPreview 2019-04-16 14:22:42 -03:00
David Capello
43d6867f98 Remove ASSERT() that can fail in Graphics::doUIStringAlgorithm() 2019-04-12 16:03:24 -03:00
David Capello
84b44a36ea Improve ui::Theme::drawSlices() performance using os::Surface::drawSurfaceNine() 2019-04-11 22:54:47 -03:00
David Capello
f3bb1ecdf1 Fix regression introduced in ed0f4c3023 2019-04-01 19:57:53 -03:00
David Capello
ed0f4c3023 Don't access Preferences to do color conversion from bg threads
Continuation of 673e1955fa
2019-04-01 15:44:49 -03:00
David Capello
9a75d01efe Improve the File Selector adding new view types: list, small icons, big icons (fix #451) 2019-03-25 22:09:22 -03:00
David Capello
b4eb7a0ccd Add support to continue drawing while we're scrolling
This change also avoids three scroll events when we zoom in/out, so
there are no two extra scroll events with invalid mouse position <->
editor position conversions.
2019-02-20 15:57:20 -03:00
David Capello
0f150b249d Add possibility to debug the UI garbage collection 2018-12-22 23:58:15 -03:00
David Capello
eca3080d24 Fix bug counting two consecutive Timer::start() calls as two different timers 2018-12-22 23:56:35 -03:00
David Capello
72313e1c48 Add possibility to pin/unpin recent items 2018-12-22 00:14:31 -03:00
David Capello
b6d9156013 Add support to drag and drop recent file items
The items are still not persisted/synchronized with the .ini file.
2018-12-21 12:22:25 -03:00
David Capello
3fdde68bdb ui::Timers must be called from the UI thread only now
This simplifies the code about timers: we can use a std::vector
instead of a obs::safe_list, and use ui::execute_from_ui_thread() to
avoid using mutexes, etc.
2018-12-21 09:37:47 -03:00
David Capello
027c19783e Simplify Timer::haveRunningTimers() function
As it's called on each UI message generation loop, we can avoid
iterating all timers on each message loop.
2018-12-21 08:46:02 -03:00
David Capello
c6e321b55c Fix crash using deferDelete() rebuilding the RecentListBox items 2018-12-19 15:32:33 -03:00
David Capello
8407f05434 Remove ui::Manager::removeWidgetFromRecipients() 2018-12-15 10:08:47 -03:00
David Capello
9e3c6dc5f4 Remove unused iterator from ui::Message 2018-12-15 10:08:03 -03:00
David Capello
7e638cddcc Fix keyboard shortcuts dialog items: don't create/dsetroy children widgets continuously inside KeyItem
Don't send a leave message (e.g. kMouseLeaveMessage) if the old
focused widget (mouse_widget) if an ancestor of the new focused
widget.
2018-12-13 14:47:19 -03:00
David Capello
c0fcef0240 Unify ToolTipManagers in MainWindow
In this way we avoid having too many message filters in the ui::Manager.
2018-12-13 14:08:56 -03:00
David Capello
3ccd09dd8d Replace internal macro with an inlined function 2018-12-13 11:00:22 -03:00
David Capello
06352f79e8 Add ui::IGNORE_MOUSE flag for static widgets
This avoids some MouseEnter/Leave messages between widgets that don't
need them.
2018-12-13 10:48:12 -03:00
David Capello
105d389fdc Remove list of recipients from ui::Message 2018-12-13 10:11:56 -03:00
David Capello
ab9883e260 Avoid running ui::Entry timer when it's not needed 2018-12-12 13:27:24 -03:00
David Capello
3b810701ce Minor change in Timer::stop() to avoid calling removeMessagesForTimer() when it's not necessary 2018-12-12 13:26:35 -03:00
David Capello
92330adc30 Avoid busy-waiting when a menu item is clicked
When a menu item is clicked a kExecuteMenuItemMessage is enqueued, so
the msg_queue will not be empty until we exit the menu item
callback (MenuItem::onClick()). This will prevent us to use a
os::Event::getEvent() where we can wait the OS for the event (see that
Manager::generateMessagesFromOSEvents() checks that msg_queue must be
empty to block the thread for OS events).
2018-12-12 00:40:39 -03:00
David Capello
21544bb666 Remove unused function Manager::removeMessage() 2018-12-12 00:27:54 -03:00
David Capello
53f2b4a121 Don't go to sleep if there are delayed painting messages 2018-12-12 00:26:28 -03:00
David Capello
e0b246dd87 Remove unused function Message::prependRecipient() 2018-12-12 00:24:27 -03:00
David Capello
f6a2090ed9 Fix bug losing the ui::DIRTY flag from the ui::Manager after closing a fullscreen ui::Window 2018-12-04 17:44:21 -03:00
David Capello
0a179acc90 Minor change in Widget::invalidate*() funcs to use onInvalidateRegion() 2018-12-04 17:32:01 -03:00
David Capello
4790e3845a Fix regression introduced in 767897d665
In some cases we have to enable the DIRTY flag in the hierarchy.
Reproducible case: right-click a tab with an image, open in a folder,
then right-click the tab again.
2018-12-04 12:54:40 -03:00
David Capello
e3dc8fa3a6 Minor change 2018-12-04 12:51:56 -03:00
David Capello
2ffb708be8 Move Manager::invalidateDisplayRegion() to Manager::onInvalidateRegion() 2018-12-03 23:59:42 -03:00
David Capello
767897d665 Set DIRTY flag on Widgets without going to all parents 2018-12-03 22:16:00 -03:00
David Capello
e516d26fa8 Fix glitch showing/hiding Preview window with the toolbar button on sprites with canvas size > Preview window viewport 2018-11-28 12:02:57 -03:00
David Capello
9af7366662 Fix bug redrawing the area occupied by the window when it's destroyed 2018-11-28 10:35:13 -03:00
David Capello
0ab7f45c35 Update ui/README file 2018-11-28 10:34:35 -03:00
David Capello
aea8e9cd83 Fix combobox size hint when using some user themes
From: https://community.aseprite.org/t/2276
2018-11-26 16:46:02 -03:00
David Capello
9b2889ef66 Fix issue with overlays on macOS w/the new async painting (fix #1931)
Fixed regression introduced in d20436f957.
Now overlays are kept on the screen and the overlapped area is restored
just in time when we have to re-paint some widget on that area.
2018-11-15 15:42:50 -03:00
David Capello
d32d8bf938 Fix color problems with overlays (fix #1914)
There were two problems:
1) Overlays weren't using the screen color space, so restoring the
   pixels were modifying the original saved area
2) A custom cursor (when "Use native cursors" option were enabled) was
   using overlays, when we could use a native custom cursor
   anyway (without overlays)
2018-10-31 11:10:44 -03:00
David Capello
4487c3d35f Check that we're calling the Widget::invalidate() from the ui thread 2018-10-25 17:29:07 -03:00
David Capello
bccd3f1bf8 lua: add Dialog() 2018-10-11 12:01:21 -03:00
David Capello
f604ac95dd lua: add app.alert() function 2018-09-07 16:42:58 -03:00
David Capello
798d6df5ff Add File > Scripts menu 2018-09-05 13:35:13 -03:00
David Capello
039e064d6b ui library doesn't depend on pixman directly
ui-lib depends on laf-gfx which already depends on pixman.
2018-08-29 10:23:15 -03:00
David Capello
efffde5673 Wait for OS messages when is possible
With this change we will reduce the CPU and energy consumption levels
as now we can go to sleep when there is no OS messages left and no
timers running.
2018-08-17 22:09:34 -03:00
David Capello
c6a5982c26 Don't call flushRedraw() when moving scroll
It looks like we don't need this call anymore (maybe it was there for
the Allegro port).
2018-08-17 16:45:57 -03:00
David Capello
4fb66b6a10 Use drawSurface() instead of drawRgbaSurface() to draw the render 2018-08-17 16:30:03 -03:00
David Capello
6b7aec27b7 Improve ui::move_region() performance for regions with more than 1 rectangle 2018-08-16 20:46:36 -03:00
David Capello
72fb45aede Minor change (auto& -> const auto&) 2018-08-16 20:45:14 -03:00
David Capello
220d043873 Discard enqueued kWinMoveMessage messages (fix #1006)
When we're moving or resizing a window, sending several
kWinMoveMessage doesn't make sense. So we discard all kWinMoveMessage
and re-enqueue a new one with the latest window bounds.
2018-08-16 15:55:46 -03:00
David Capello
a6fab8d1d9 Move os/ft/gfx libraries to laf 2018-08-09 16:36:11 -03:00
David Capello
5cb2d984f0 Rename she -> os 2018-08-09 12:58:43 -03:00
David Capello
f9c1c68012 Remove Allegro back-end (#139) 2018-08-09 11:43:35 -03:00
David Capello
f2ed45e795 Replace base::UniquePtr -> std::unique_ptr 2018-08-08 17:27:26 -03:00
David Capello
7c19744798 Add some checks in ui/manager.cpp to report messages correctly 2018-07-04 14:27:13 -03:00
David Capello
6b1c884eb5 Add code to check integrity of backups 2018-07-04 12:35:15 -03:00
David Capello
3e0ebd34c9 Fix macOS bug executing commands from other native menu instead of the open aseprite menubox when we use mnemonics 2018-06-29 12:14:54 -03:00
David Capello
f595ceea7f Add possibility to write math expression in number textboxes (fix #1762) 2018-06-28 13:33:13 -03:00