Commit Graph

648 Commits

Author SHA1 Message Date
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
David Capello
56ec9f113c Avoid crash if the theme package doesn't contain a sheet.png file 2018-06-25 14:05:57 -03:00
David Capello
511752fea7 New render engine to use bicubic interpolation when zoom < %100 (fix #1671)
This only works with Skia back-end.
2018-06-22 15:41:22 -03:00
David Capello
ddff5d559c Keep focus of layer name when right-click a layer > Properties (fix #1466) 2018-06-19 15:25:49 -03:00
David Capello
867b42d7ed Minor change in listbox.cpp to avoid gcc warnings 2018-06-06 16:36:59 -03:00
David Capello
7a35eb26a1 Add new pref="" attribute to <check> widgets to bind check boxes with bool preference options automatically
With this change we've moved the propagateToChildren/propagateToParent
flags from ui::KeyMessage to ui::Message so anykind of
message (e.g. user defined messages like kSavePreferencesMessage) can
use these flags (processed by ui::Widget::onProcessMessage()).
2018-06-06 16:35:02 -03:00
David Capello
0f51467768 Fix my common typo "completelly" instead of "completely" 2018-05-24 14:21:00 -03:00
David Capello
a845b098d9 Minor changes in ui/system.cpp 2018-05-24 13:12:01 -03:00
David Capello
40968891f2 Add option to disable native clipboard
This is related to #1100, as the Linux port is not well tested and may
fail, it's good to have an option to disable the native clipboard code
just in case.
2018-05-24 12:56:07 -03:00
David Capello
7b49bf295f Add extra check in ListBox::selectChild() 2018-03-16 12:17:12 -03:00
yuxshao
afdb6d22db Stop mnemonic processing from truncating multibyte characters (#1661) 2018-02-22 11:50:03 -03:00
David Capello
dee6ff6c7e Refactor: Use new base::paths type for list of filenames/extensions 2018-02-21 11:06:58 -03:00
David Capello
d247e28e17 Make the first button as the default one
So Enter key just accept the message box and Esc cancels it.
2018-02-07 17:28:37 -03:00
David Capello
d4244fed48 Add options to avoid showing dialogs saving files (#917) 2018-02-07 17:28:01 -03:00
David Capello
9520dee00a Avoid random crashes changing Color Mode with a TTF font in the theme
This is a weird combination of things:
1. StatusBar::onPixelFormatChanged() is being called in a non-UI thread
   because ChangePixelFormatCommand changes the color mode from a
   Job (background thread).
2. The UI layer is not prepared to work on multithreading, so all UI
   stuff should be used in the main UI thread (anyway, generally, the UI
   layer doesn't crash if it's used by multiple threads).
3. The harfbuzz library (used for TTF fonts) crashes if it is used by
   multiple threads, so that was the trigger of this crash.
2017-12-13 17:11:53 -03:00
David Capello
2ccbf44a55 Fix crosshair glitches on Editor when brush size popup is open 2017-12-05 13:31:34 -03:00
David Capello
848ce5972d win8: Add support to double tap with pen
Discussion:
https://community.aseprite.org/t/surface-pro-3-file-navigation/696
2017-11-23 17:03:24 -03:00
David Capello
f2a2510cea Use a obs::safe_list() for ui::Timers to avoid data races between threads 2017-11-03 10:51:45 -03:00
David Capello
73605749e6 Improve Graphics::dirty() to avoid flipping unnecessary she::Display areas 2017-11-03 09:36:12 -03:00
David Capello
f07359d71c Minor TODO item on Widget::setBoundsQuietly() for the future 2017-11-03 09:35:00 -03:00
David Capello
7becbc09b8 Update window title label size to show the entire text when it's changed 2017-10-26 21:59:19 -03:00
David Capello
d748cc7582 Add DEBUG_UI_THREADS to debug functions called from a non-main thread 2017-10-26 21:38:27 -03:00
David Capello
0ee5dbea7a Improve keyboard shortcuts list with resizable headers 2017-10-24 10:20:21 -03:00
David Capello
a9b183729f Translate all alerts to the en.ini file (#124) 2017-10-17 18:00:45 -03:00
David Capello
dede3610f3 Fix bug inserting the first char in a text entry
If a text field (ui::Entry) contains text with length=1 (e.g. the number
"8"), and we focus and press that same char ("8"), the caret will be in
the position 0 with text "8" (the caret should be in position 1). this
patch fix this behavior.
2017-10-03 14:45:53 -03:00
David Capello
c3bc7acb4d Fix crash using a theme with an undefined <style>
Related to: https://community.aseprite.org/t/498
2017-09-28 15:27:27 -03:00
David Capello
7dc7bf09e2 Windows: fix last gray background when the main window is closed 2017-09-28 12:41:19 -03:00
David Capello
c5c964bfcd Update Skia to chrome/m62 (our aseprite-m62 branch) 2017-09-19 13:41:28 -03:00
David Capello
7b7b12b593 Fix bug "Rewind on Stop" increments start frame randomly (fix #1569) 2017-09-08 11:20:55 -03:00
David Capello
f223d157fd Fix crash dragging the mouse in the toolbar
If we pressed the mouse button in the toolbar and start moving the mouse
like crazy just to create/destroy the toolbar popup multiple times, it
reached a situation where the Manager's mouse_widget was equal to a
deleted widget (and mouse_widgets_list contained that widget too),
producing a crash when we tried to access it.
2017-09-04 18:10:02 -03:00
David Capello
0154a73d36 Add native macOS menus (fix #135)
* This implements the Cmd+H and Cmd+M keys too:
  https://community.aseprite.org/t/279
* Also Cmd+, has more priority on macOS than Cmd+K to open the
  preferences (so macOS menu shows Cmd+,)
2017-09-01 13:32:23 -03:00
David Capello
a9c1b26db3 Fix reposition of windows when Screen/UI scaling is changed 2017-08-17 09:16:11 -03:00
David Capello
2bee243c39 Replace INT_MAX with std::numeric_limits<int>::max() 2017-08-15 11:25:23 -03:00