Commit Graph

180 Commits

Author SHA1 Message Date
David Capello
81d10f1c4f Add DEBUG_PAINT_EVENTS to manager.cpp 2014-05-04 21:17:45 -03:00
David Capello
6414e37f9a Use IntersectClip when possible 2014-05-04 16:59:11 -03:00
David Capello
df3cb694ae Add she::Display::setMousePosition() 2014-05-04 16:05:35 -03:00
David Capello
02a8ea779a Add missing *jguiscale() in Entry and ColorButton widgets 2014-05-02 20:08:59 -03:00
David Capello
bee4dff5a8 Merge branch 'dev' of git@github.com:aseprite/aseprite.git into dev 2014-04-29 23:08:20 -03:00
David Capello
6edf02765a Fix Graphics::fillAreaBetweenRects() 2014-04-29 23:07:25 -03:00
David Capello
e363577e65 Better double-click: remove DoubleClickeable and make ui::Widget default behavior to convert double-clicks into mouse downs 2014-04-29 23:02:27 -03:00
David Capello
17e59bc9e5 And fix mouse wheel from Allegro 4.4 data 2014-04-28 22:07:01 -03:00
David Capello
a21febf6e8 Merge branch 'dev' of git@github.com:aseprite/aseprite.git into dev 2014-04-28 22:03:25 -03:00
David Capello
ec61c6b972 Add support for horizontal mouse wheel and scroll bar notifications (better support for trackpads)
WM_HSCROLL/WM_VSCROLL messages are used by some trackpads drivers to
notify about horizontal/vertical pan gestures.
2014-04-28 22:02:56 -03:00
David Capello
58720851c4 Update MiniEditor scroll properly when EditorView scroll changes 2014-04-28 01:45:22 -03:00
David Capello
5584424b79 Adjust windows position when ui::Manager (the main windows/display) is resized 2014-04-26 16:04:25 -03:00
David Capello
99ca9f175e Add View::attachedWidget() member function 2014-04-26 11:33:29 -03:00
David Capello
15a3b6ac2c Fix double-click issues
- Fix double-click behavior when double-clicks are generated from
  Manager::generateMouseMessages().
- Add Widget::setDoubleClickeable/isDoubleClickeable() member functions
  for widgets that accept double-clicks.
2014-04-26 11:09:59 -03:00
David Capello
af299eecc8 Hide mouse when it leaves the display 2014-04-25 08:58:19 -03:00
David Capello
3c4bbbe30c Replace jwidget_set_min/max_size() with Width::setMin/MaxSize() 2014-04-21 22:15:29 -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
a35cb0d34d Fix compilation errors (gcc) 2014-04-19 21:06:58 -03:00
David Capello
bf03d10b03 Remove extra elements in #endif directives 2014-04-19 21:03:20 -03:00
David Capello
4c706afb90 New zoom tool 2014-04-19 20:08:21 -03:00
David Capello
3738774efc Do not apply jguiscale() to Splitter layouts that are handled ByPercentage 2014-04-19 18:57:42 -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
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
dd2ce20e25 Win32: Add support to convert mouse messages (WM_) to ui::Messages (using she::Events)
On Windows, instead of polling Allegro mouse position/buttons we can use
the mouse messages (WM_*) directly to generate she::Events. Those events
are received by the ui::Manager and converted to ui::Messages.
Maybe this is a possible fix for issue #133 (Wacom tablets don't work
properly).

Changes:
- Don't use jmouse_z() directly (new ui::MouseMessage::wheelDelta() member)
- Add ui::_internal_set_mouse_position() to change the jmouse_x/y(0)
  from the new mouse position received in she::Events. The same for
  ui::_internal_set_mouse_buttons().
- Modify the ui::Manager to generate mouse events in any case: using old
  Allegro 4 polling method, or from she::Events.
2014-04-17 22:23:12 -03:00
David Capello
138d2f1db8 Fix mouse buttons on kMouseDown/UpMessages
This fixes a problem reported on issue #388 where a tool loop couldn't
be canceled pressing left button when it was iniciated with right button.
2014-04-17 17:06:15 -03:00
David Capello
d3591ffdf7 Merge branch 'dev' of git@github.com:aseprite/aseprite.git into dev 2014-04-17 16:24:53 -03:00
David Capello
3dfc07b724 Remove ui::jwidget_set_border() function 2014-04-17 15:55:55 -03:00
David Capello
ff277dccf7 Add Widget::onSetColor() 2014-04-17 15:46:01 -03:00
David Capello
ed5a2d9570 Replace jwidget_noborders() with Widget::noBorderNoChildSpacing() 2014-04-17 15:44:33 -03:00
David Capello
c16ea3e8a2 Use Graphics object in ImageView::onPaint() 2014-04-17 15:27:45 -03:00
David Capello
defc703208 Fix Splitter::onLoad/SaveLayout() to support jguiscale() changes 2014-04-17 14:44:21 -03:00
David Capello
17adf56337 Fix issue 356: tooltips cause selecting tools require 1 or more extra mouse clicks
This is an old bug in the ui::Manager. We don't need to "free" (release)
the mouse widget when we re-stack windows order (e.g. because the user
clicked the non top-most window).
2014-04-13 22:47:40 -03:00
David Capello
4e7a084ced Remove unnecessary calls in TipWindow 2014-04-13 22:17:36 -03:00
David Capello
b00a187fba Free the right widget in removeChild() (we've to free "child" instead of "this") 2014-04-13 22:17:00 -03:00
David Capello
39e6f2dbe6 Report Manager::setMouse() calls if REPORT_EVENTS is defined 2014-04-13 22:16:20 -03:00
David Capello
0274e13075 Improve REPORT_EVENTS in manager.cpp to show the Widget type (using typeid) 2014-04-13 21:33:09 -03:00
David Capello
31e1b4e387 Close all TipWindow automatically on click 2014-04-13 20:40:44 -03:00
David Capello
47c92fb755 Fix REPORT_EVENTS in manager.cpp 2014-04-13 20:39:59 -03:00
David Capello
c9bda7b329 Implement TipWindow in terms of PopupWindow 2014-04-13 19:35:15 -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
896fb27fd5 Move copy/paste of clipboard text from "ui" to "she" library 2014-03-29 22:12:01 -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
f4b2b47a2c Add #pragma once 2014-03-29 19:40:17 -03:00
David Capello
6ed35b733c FileSelector: fix combobox behavior as now ComboBox::onChange() event is generated when the combobox is open 2014-03-29 18:42:17 -03:00
David Capello
7253fa59c5 Fix combobox widget: fire Change signal when the combobox is selected with the keyboard 2014-03-29 17:17:06 -03:00
David Capello
04f3c522ba Replace jwidget_get_text_length/height with Widget::getTextWidth/Height
Renamed Widget::getTextSize to Widget::getTextLength as now getTextSize
returns a gfx::Size() (not the strlen() of the text)
2014-03-21 19:45:35 -03:00
David Capello
1212906d5a Move drop files event to she library 2014-03-20 07:31:19 -03:00
David Capello
be6b98995e Add she::EventQueue to she::Display to get events from she library 2014-03-20 00:01:00 -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
d72a7a4dee Fix compilations errors on gcc 2014-02-24 08:30:43 -03:00
David Capello
3b23184c15 Fix compilation error in ui/clipboard_none.h 2014-02-24 08:23:04 -03:00
David Capello
3cbf3e122f Now you can press a mouse button in a ComboBoxEntry and drag the mouse to the ComboBoxListBox (issue 339) 2014-02-08 20:09:42 -03:00
David Capello
7251f4b70a Now you can press a mouse button in a IntEntry and drag the mouse to the slider (issue 339) 2014-02-08 19:39:36 -03:00
David Capello
bb32f1fbf2 slider.cpp: Remove commented code 2014-02-08 19:26:13 -03:00
David Capello
7eb41c73e9 IntEntry: select all text when the value is changed with the slider 2014-02-08 18:58:28 -03:00
David Capello
721734d26c Don't scroll Entry text if it isn't needed 2014-02-08 18:46:27 -03:00
David Capello
f954556683 Fix crash in Entry::getCaretFromMouse() 2014-02-08 18:31:15 -03:00
David Capello
51f70a170a Move code to handle Windows clipboard (text) to ui/clipboard_win.h 2014-02-08 00:41:16 -03:00
David Capello
9b2f5399e9 Add ui::Graphics::fillRegion() 2014-02-06 20:01:32 -03:00
David Capello
9050861d78 Add ui::Widget::getGraphics() and GraphicsPtr 2014-02-06 20:00:59 -03:00
David Capello
936b741f90 Stop propagation of keyboard messages if a child use it
This fix a new bug with the new EditorView's scroll-bars. As 1,2,3,4,5,6
keys change the zoom, they will change the viewport size, and scroll-bars
will be removed/added. We cannot continue iterating the View::m_children
collection after m_children is modified (scroll-bars are removed/added).
2014-02-03 00:22:24 -03:00
David Capello
0a01828ffe Don't eat all keystrokes on ui::TextBox::onProcessMessage() 2014-02-02 20:13:52 -03:00
David Capello
e671508d85 Change infinite scroll implementation
Remove necessity of jmouse_x(1) and jmouse_y(1) calls.

- Renamed jmouse_control_infinite_scroll() -> ui::control_infinite_scroll()
- Renamed jmouse_set_position() -> ui::set_mouse_position()
- Added ui::get_delta_outside_box()
2014-02-02 18:46:19 -03:00
David Capello
78fbf07fc7 Fix scroll bar thumb size calculation 2014-01-28 23:46:04 -03:00
David Capello
eee1719109 Implemented issue 260: Scroll-bars for sprite editor 2014-01-26 13:28:11 -03:00
David Capello
f8e8657093 Move kPaintMessage code to onPaint() event for some widgets
The affected widgets are: ColorBar::ScrollableView, ColorButton, and
StatusBar.

* Added Graphics::drawLine()
* Moved rectgrid and draw_color to modules/gfx.cpp
2013-12-29 21:12:23 -03:00
David Capello
20fb1317a3 Fix bug in Graphics::drawStringAlgorithm() painting invalid background color 2013-12-09 22:58:07 -03:00
David Capello
40fd251c39 Add support for vertical text alignment in Graphics::drawStringAlgorithm() 2013-12-09 22:57:43 -03:00
David Capello
61d5693727 Merge branch 'dev' of git@github.com:dacap/aseprite.git into dev 2013-12-01 22:09:11 -03:00
Joel Madigan
838382791e Tweaked IntEntry behavior
Changed behavior of IntEntry to stop it from continously selecting all
text as long as the mouse is over the input box.  It appears that
something continues to send kMouseEnterMessage messages while use is
typing, even if the mouse is still.  This caused the IntEntry select-all
multiple times and as the user typed would replace what they had already
written.

Also force value to be set within min >= value >= max when focus is lost.
This will get rid of bad values from the entry, such as 10q goes to 10,
40000 goes to 255, etc.
2013-11-30 18:36:22 -05:00
David Capello
3a2ef4644e Move Manager::getDefault() to .h so it can be inlined 2013-11-30 20:02:45 -03:00
David Capello
ad0b28bd63 Change Window() ctor to avoid ambiguity (DesktopWindow, WithoutTitleBar, or WithTitleBar)
In this way we know at the moment of the creation of the window if it
will need the close button.

Issue #280.
https://github.com/aseprite/aseprite/pull/6
2013-11-23 17:47:57 -03:00
David Capello
7dc8e548be Fix issue #280 - Close button doesn't appear in some windows
Thanks to @DocHoncho for the help.
See https://github.com/aseprite/aseprite/pull/6
2013-11-23 17:25:21 -03:00
David Capello
e6450877bb Minor change: Make Splitter::getPosition() inlined 2013-11-10 18:02:20 -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
d91b05667b Fix compilation errors detected with gcc 2013-08-20 00:51:37 -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
6022278260 Remove (unused) MessageSetPos struct 2013-06-02 19:19:01 -03:00
David Capello
e90f86727b Remove jwidget_get_rect() and jwidget_get_child_rect() functions
+ Added Widget::getClientChildrenBounds()
+ Replaced all member functions in Theme::draw_x() to Theme::paintX()
+ Move code to draw tabs from Tabs::onProcessMessage() to Tabs::onPaint().
2013-05-20 20:40:18 -03:00
David Capello
01dfe4d52e Replace kResizeMessage message with ResizeEvent and Widget::onResize()
- Remove jwidget_set_rect() function.
2013-05-11 17:56:27 -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
fd6e4ccc21 Add support for transparent background color for ui::Slider to draw ui::IntEntry popup window without background 2013-04-03 21:17:12 -03:00
David Capello
b45dcf7d0d Use ui::ListItem in ui::ComboBox widget 2013-04-03 20:31:02 -03:00
David Capello
1d76e0d545 When a widget is removed (through Widget::removeChild) we've to remove it from its ui::Manager
A widget without parent, cannot be part of the Manager (e.g. cannot be
the capture widget, or focused, or the widget with mouse).
2013-04-03 19:54:40 -03:00
David Capello
dcd8627406 Separate ui::ListBox::Item into ui::ListItem class 2013-04-02 21:34:30 -03:00
David Capello
1bf84bac41 Fix IntEntry's popup if it's beyond the screen border 2013-03-30 20:53:50 -03:00
David Capello
9076ee13ea Don't close IntEntry's popup in case of FOCUSLEAVE message 2013-03-30 20:50:43 -03:00
David Capello
cbb5809c10 Bigger hot region for IntEntry's popup window 2013-03-30 20:50:24 -03:00
David Capello
cb0cdb3197 Rename old _ji_* functions 2013-03-30 13:38:24 -03:00
David Capello
a437a954f2 Sort #includes in ui/entry.cpp file 2013-03-30 13:11:49 -03:00
David Capello
4adc9f8489 Add ui::IntEntry widget 2013-03-30 13:11:35 -03:00
David Capello
fe6209ed52 Fix bug in ui::Entry::m_caret, after changing the widget's text we've to adjust the caret
This is to avoid "out of range" situations, where the caret is outdated
and doesn't correspond to the new widget's text length.
2013-03-30 00:35:25 -03:00
David Capello
1d6be62ae7 Fix ui::Entry::onEntryChange: must be a virtual member function 2013-03-29 23:40:12 -03:00
David Capello
c2664b6aac ADd Entry::set/getSuffix() property 2013-03-29 16:20:32 -03:00
David Capello
c5a0acf7c6 Add ComboBox::onChange() member function 2013-03-29 16:16:24 -03:00
David Capello
da946ed90c Add Widget::getFirstChild() member function 2013-03-27 21:44:21 -03:00