Commit Graph

46 Commits

Author SHA1 Message Date
David Capello 09538f9a1a clang-format all files 2024-12-16 14:52:19 -03:00
David Capello 70f2cd9559 Remove duplicated code checking if mnemonic+modifiers are pressed 2024-12-10 10:16:20 -03:00
David Capello cfc92e7cdb Add { } in switch-case to define vars inside
This is required if a new case is added below in the future to avoid
compiler errors. It's better to always use { } if we're going to
define local variables for the case.
2024-12-10 09:31:32 -03:00
Martín Capello 9ca6368088 Fix button's kKeyUpMessage handling
Now the checkbox button skips the kKeyUpMessage when the key being
depressed is not the space key and is not the associated mnemonic key.
Before this change, for instance, if a checkbox received the focus by
using the Tab key, the kKeyUpMessage (of the Tab key) was intercepted by
the checkbox and triggered the onClick() event.
2024-12-10 09:30:29 -03:00
Christian Kaiser e0ff51947a
Add new frame menu to status bar button (#4582) 2024-08-08 17:23:41 -03:00
David Capello bd91a6430f Process os::Event::MouseEnter/Leave in correct order
When we received a MouseEnter/Leave, we were processing those laf-os
events immediately without taking care of all the MouseMove/Down/Up
events in the middle. Now we enqueue all the events as
messages (MouseEnter -> MouseMove/Down/Up -> MouseLeave).

This is important because when we process MouseLeave we are calling
setMouse(nullptr), which resets the mouse widget HAS_MOUSE flag, and
some widgets needs to know if they have the mouse above before the
MouseUp event. With this change we can remove the
Widget::hasMouseOver() function (that was checking the global
ui::get_mouse_position() instead of the HAS_MOUSE flag directly).

Another change was introduced to keep the old behavior now that
hasMouseOver() is not available: the ui::Manager doesn't assign the
HAS_MOUSE flag if the mouse is captured (it only assign the HAS_MOUSE
to the widget with the mouse captured, or to no widget, at least until
the capture is released).
2023-07-10 10:54:37 -03:00
David Capello 11abe10c20 Add ability to use mnemonic without modifiers in alerts
Requested in https://community.aseprite.org/t/16845
2023-03-23 16:15:51 -03:00
David Capello 39d1fb56d4 Remove ui::Event& args from ui::Button::Click signal
This is to simplify code and to match ui::MenuItem::Click and
ui::Button::Click signals (so then we can write some generic code
using Button::Click or MenuItem::Click).
2023-01-12 11:00:16 -03:00
David Capello 89fcd44394 Select the initial ColorButton color when we go back to the button
If start dragging from the ColorButton, we go outside the button, and
then we go back to the same button, we should select the original
color when the whole drag-and-drop process started.

We have also improved the look of the button in that case: the
original color is displayed (instead of the inverted color, which is
when the button is selected, in this way is less confusing).
2021-05-20 15:42:09 -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 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 bccd3f1bf8 lua: add Dialog() 2018-10-11 12:01:21 -03:00
David Capello 76df15d3c3 Add mnemonics to Extensions section in Preferences
Also fixed a problem using Alt+mnemonic on hidden buttons.
2017-06-13 12:04:40 -03:00
David Capello 60970b8eae Remove unused code from ui::Button
Removed IButtonIcon interface and Button::m_drawType field.
2017-03-17 16:13:47 -03:00
David Capello bc01f16a4e Move painting code for checkbox & radio button to theme styles 2017-03-17 15:43:42 -03:00
David Capello 7cb41729ab Convert label and view into new styles
In this way the WidgetLoader looks for new styles only.
2017-02-14 14:55:45 -03:00
David Capello 17151cddcd Move mnemonic key as a property of ui::Widget
In this was we can process the text string just one time to remove the
character preceded by '&' that will be finally acts as a mnemonic. This
simplifies the rendering and text measure code too.
2017-02-14 14:16:37 -03:00
David Capello bb4faca1d1 New Style class in "ui" layer to paint widgets (only button at this moment)
This new ui::Style should finally replace the old app::skin::SkinStyle
class. At this moment both implementations are working to avoid an
huge refactor in just one commit.

- Added new ui::Style property in ui::Widget.
- Removed old code to set the button "bevel" (removed
  app::setup_bevels() functions).
- Removed setup_look() function and Left/RightButtonLooks.
- Removed check_button_new() function.
- Removed ui::Theme::paintButton/ComboBoxButton() functions.
2017-02-13 18:34:23 -03:00
David Capello 74248cf33c Cmd+mnemonic on macOS now can press a button 2016-11-24 19:26:52 -03:00
David Capello 701170d85e Fix alt+mnemonic on macOS 2016-11-24 19:26:21 -03:00
David Capello 4119962ee6 Remove Widget::onDisable/onDeselect() member functions
Replaced with an argument in onEnable/onSelect().
2016-09-08 15:53:10 -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 cdd955441a Rename PreferredSize -> SizeHint 2015-12-03 21:50:05 -03:00
David Capello 78ba213471 Rename ui::Widget::getChildren() -> children()
Extra changes:
* Removed UI_FOREACH_WIDGET(), replaced with range-based for-loops
2015-12-03 19:46:13 -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 a2538628c7 Convert ui::Widget::border_width/child_spacing to private fields 2015-06-23 19:20:49 -03:00
David Capello 325e9245bf Rename ui::Widget::type -> m_type and make it private 2015-06-23 14:37:22 -03:00
David Capello f01b816fb5 Remove JI_ prefix from ui/base.h constants 2015-06-23 14:00:00 -03:00
David Capello c5a568cd15 Generate mouse/key events from polling in she module instead of ui module 2014-09-19 10:12:05 -03:00
David Capello 51ab478f49 Fix order of members initialization detected by clang 2014-08-17 20:38:55 -03:00
David Capello b37ec489f6 Remove ui::Widget::isScancodeMnemonic() member function 2014-06-28 11:14:03 -03:00
David Capello b33357ed46 Remove base::string (std::string is good enough for utf8 strings) 2014-04-20 19:53:27 -03:00
David Capello af4e714360 More painting code from ji_screen to ui::Graphics
We planned to migrate everything to ui::Graphics to port the program to
other back-end (e.g. SDL or Allegro5). This is one step forward to that
direction.

Changes:
- Delete a lot of deprecated functions from src/ui/draw.h/cpp and SkinTheme
  that used BITMAP/ji_screen.
- Rename ui::ji_move_region to ui::_move_region
- Move ui::jwidget_get_texticon_info to ui::Widget::getTextIconInfo.
  Now the member function returns client coordinate instead of absolute
  ones.
- ui::drawTextBox() now receives a ui::Graphics instead of a BITMAP
- Add ui::Graphics::drawChar/measureChar() member functions.
- Replace ui::jrectexclude() with with ui::Graphics::fillAreaBetweenRects()
2014-04-19 15:18:16 -03:00
David Capello 78ce233756 Fix header of files distributed under the terms of the MIT license 2014-03-29 20:08:05 -03:00
David Capello dbf4d0d490 Replace JRect/jrect struct with gfx::Rect
- Replaced Widget::rc -> Widget::m_bounds private member.
- Added Widget::offsetWidgets() method.
- Removed View::displaceWidgets().
2013-10-26 12:50:55 -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
David Capello 1614786408 Convert ui::Message union to a class hierarchy
+ Add ui::KeyScancode enum and ui::KeyModifiers flags.
+ Add ui::MouseButtons enum.
2013-07-28 21:17:07 -03:00
David Capello 3dbf6518f9 Replace all JM_ macros with ui::MessageType enum and add ui::RegisterMessage class to register new UI messages 2013-04-04 21:53:29 -03:00
David Capello 6e62bcb82f Add ui::WidgetType enum to replace JI_WIDGET macros 2013-04-03 22:07:24 -03:00
David Capello 9b8e87da10 Update copyright year to 2013 2013-01-27 12:13:13 -03:00
David Capello 0496f38ed3 Fix a typo in all files distributed under BSD-like and Allegro licenses
Thanks to Tobias Hansen.
2012-09-23 23:24:43 -03:00
David Capello 14f24b1181 Refactor: replace JList with std::vector<> or std::list<>. 2012-07-17 21:42:02 -03:00
David Capello 91bf74350e Rename ui::Frame to ui::Window. 2012-07-08 23:24:42 -03:00
David Capello 55aca8567c Move src/gui/ to src/ui/ 2012-06-17 22:49:58 -03:00