Commit Graph

62 Commits

Author SHA1 Message Date
Francisco Vallarino
a16e8599df
Prepare release 1.6.0.1 (#314)
* Relax upper bounds for several packages

* Update Changelog
2024-01-08 02:35:36 +01:00
Francisco Vallarino
58b08083e3
Prepare release 1.6.0.0 (#310)
* Upgrade Stackage nightly

* Update Changelog

* Bump version

* Add 'Project status' section to README
2023-12-05 12:58:01 +01:00
Francisco Vallarino
ef4f10a07e
Prepare release 1.5.1.0 (#256)
* Bump version

* Update Changelog
2023-02-05 00:30:57 +01:00
Francisco Vallarino
d1ddcc2d40
Fix rendering artifacts (#215)
* Consider SDL.TextEditingEvent as an action event

* When a frame requires rendering, make sure the next one is also rendered to avoid artifacts. It still does not render every frame

* Fix lint

* Fix typo

* Update Changelog
2022-10-31 11:57:39 +01:00
Francisco Vallarino
484fff1043
Release 1.5.0.0 version (#209)
* Update Changelog

* Bump version
2022-10-09 18:22:01 -03:00
Francisco Vallarino
22cf451853
Add conditional helpers for lists of widgets, styles and configuration options (#185)
* Add widgetIf, widgetMaybe, and related style/config helper functions

* Update examples and tutorial

* Fix Haddocks

* Update Changelog
2022-10-09 22:38:07 +02:00
Francisco Vallarino
7b1d59d754
Add popup widget (#191)
* Import popup widget

* Add popupOffset configuration option

* Add popupDisableClose config option

* Add alignment options to popup widget

* Improve Haddocks

* Add window compensation offset directly to node; remove related code, simplify

* Improve Haddocks

* Add popup unit tests

* Generate onChange events when opened/closed status changes

* Replace fdescribe with describe

* Update Changelog

* Delegate visibility check to each widget

* Consider scroll offset when aligning to widget

* Request a non zero size to avoid having an invisible node

* Add note to Container's init and merge documentation

* Add support for an anchor widget

* Do not apply active style if widget is not in the active overlay

* Add popupAlignToOuter option

* Add separate horizontal/vertical alignToOuter options

* Make sure BtnReleased is sent to overlay in case findWidgetByPoint returns Nothing

* Block events happening at the same instant the popup is closed, to avoid widgets below it being activated accidentally

* Use cursor location when validating if popup should be closed

* Increase timestamp on each group of events for nodeHandleEvents_. Add helper

* Fix unit tests

* Add anchor alignment options

* Attempt to position popup in the opposite border when using outer, if it does not fit in the main border

* Always Attempt to position popup in the opposite border, both for inner and outer border alignment

* Compensate offset when calculating border alignment

* Fix regression in window alignment. Haddock fixes
2022-08-09 23:27:43 -03:00
Francisco Vallarino
cb17cb553c
Catch exception when trying to write to stderr and try stdout instead (#190)
* Catch exception when trying to write to stderr and try stdout instead

* Update Changelog
2022-06-28 20:49:13 -03:00
Francisco Vallarino
f460068b4a
Do not disable screensaver unless explicitly requested; add configuration flag (#189)
* Do not disable screensaver unless explicitly requested; add configuration flag

* Update Changelog
2022-06-28 19:37:44 -03:00
Francisco Vallarino
66db43f71c
Do not discard previous WidgetRequests during selectList's postMerge call (#157)
* Call widgetResize on children of widget which requested resize, even if viewport did not change

* Simplify makeResizeCheckFn

* Request ResizeWidgets from SelectList when items change

* Always use newTextLines when resizing label

* Do not ignore parent requests when containerMergeChildrenReq returns True

* Restore previous logic in Handlers and SelectList

* Reorganize merge lines to reflect dependency order. Resize new widgets remaining after merge exhausted old versions

* Keep requests made in previous steps during SelectList's postMerge

* Update Changelog

* Export mergeRequired from dropdown. Improve related documentation in selectList and dropdown
2022-05-28 16:44:52 -03:00
Francisco Vallarino
cb22e45d01
Minor improvements before fix release (#150)
* Add pointToLineDistance utility function

* Force the option type in ToggleButtonCfg to be the Bool implied by the asssociated Lens

* Do not draw borders when width == 0

* Improve BaseTheme's tooltip styles

* Update tooltip's Haddock

* Update Changelog
2022-05-14 11:43:59 -03:00
Francisco Vallarino
dc848e8ddb
Fix memory leak in NanoVGRenderer's image initialization. Dispose unused images in image widget (#149)
* Initialize new images with count = 1; they were not released if extra references were added

* Dispose previous version of an image if it was not memory based

* Use strict versions of Map

* Update unit tests

* Update Changelog
2022-05-12 10:59:34 -03:00
Francisco Vallarino
d6def462d1
Add boxFilterEvent config option, exposing Container's filterEvent functionality (#146)
* Add boxFilterEvent to box, exposing Container's filterEvent functionality

* Add unit tests

* Update Changelog
2022-05-10 22:43:08 -03:00
Francisco Vallarino
80fa65831e
Add support for switching vertical wheel scrolling to horizontal in scroll widget by pressing the shift key (#137)
* Add support for switching vertical wheel scrolling to horizontal scrolling by pressing the shift key

* Update Changelog

* Update Changelog
2022-05-07 12:06:20 -03:00
Francisco Vallarino
dc3b889ad0
Release 1.4.0.0 (#135)
* Make ColorPicker's sample color use rounded corners

* Bump version to 1.4.0.0

* Fix Haddock links
2022-04-30 15:16:24 -03:00
Francisco Vallarino
90153a32b9
Make radio and optionButton only trigger onChange when the value changes (#134)
* Make optionButton's onChange trigger only once if value did not change. Add onClick to keep previous behavior

* Make radios's onChange trigger only once if value did not change. Add onClick to keep previous behavior

* Update Changelog
2022-04-30 12:53:08 -03:00
Francisco Vallarino
dbb603a4a7
Fall back to main thread rendering when secondary setup fails (#131)
* Attempt to recover from SDL_GL_MakeCurrent error, and fallback to rendering on the main thread

* Check if -threaded flag was used before setting up rendering thread. Add notes to appRenderingOnMainThread

* Remove reference to the error from Setup page

* Update Changelog

* Fix typo

* Fix issues with RunInRenderThread when running on single threaded mode. Improve handling of initialization, simplify Core's state variables

* Update Changelog

* Add note about threaded rendering in 'Running the examples' section. Fix typo.
2022-04-30 11:00:17 -03:00
Francisco Vallarino
1ab5971bef
Allow disabling scale detection (#128)
* Allow disabling scale factor detection. Do not use factors higher than 2 on Linux

* Add note about window size

* Move scale detection comment to appDisableAutoScale

* Attempt to use SDL_GetDisplayDPI when detecting scale factor on Linux

* Minor changes to appDisableAutoScale documentation

* Update Changelog

* Remove duplicate documentation related to Linux scale factor detection

* Add safeguard to Windows dpi detection
2022-04-25 13:40:52 -03:00
Francisco Vallarino
574c08ac9a
Fix text scaling and positioning problems in FontManager (#125)
* Remove scaling logic from FontManager (rely on also existing one in .c file). This fixes the weird positioning issues also seen previously

* Store x coordinate of the glyph, which should be used for rendering operations instead of posMinX

* Do not reset glyph position size

* Set correct field in inputField/textArea when calculating selection

* Fix unit tests

* Update Changelog
2022-04-19 10:26:48 -03:00
Francisco Vallarino
d4445105c4
Button widget improvements (#123)
* Add D_ option to button without the requirement of an explicit event

* Add ignoreParentEvts to button widget

* Add new note to keystroke widget

* Add unit tests for keystroke's/button's options for ignoring child/parent events respectively

* Update Changelog
2022-04-17 16:03:51 -03:00
Francisco Vallarino
af0456ccf1
Add extra argument to mergeRequired; in most cases, it will be WidgetEnv (#122)
* Add extra argument to mergeRequired; in most cases, it will be WidgetEnv

* Update Changelog
2022-04-17 15:06:55 -03:00
Francisco Vallarino
1972e8cce3
Allow using symbols for keystroke definitions (#117)
* Allow using symbols for keystroke definitions. Add Dash to allow using the - character as part of a combination

* Log when an invalid sequence is provided

* Revert test changes to Tutorial02

* Be more explicit about restrictions

* Add missing keyCode definitions

* Handle Dash as text and add support for KpEnter

* Update Changelog
2022-04-14 13:51:34 -03:00
Francisco Vallarino
fc40e2e4df
Standardize names and arguments for Composite's mergeReqs and mergeModel (#114)
* Export missing SizeReq functions

* Standardize names and arguments for Composite's mergeReqs and mergeModel

* Add compositeMergeEvents

* Update Changelog

* Add notes in exposed functions
2022-04-11 19:47:19 -03:00
Francisco Vallarino
2d47c0aa3d
Add documentation notes related to recent issues/questions (#113)
* Add section in tutorials about 'No instance for (Typeable s)' compilation error

* Add note about WidgetEnv's widgetKeyMap usage

* Update Changelog
2022-04-06 11:56:14 -03:00
Francisco Vallarino
b80e2ca036
Fix differences in glyphs positions used by FontManager and nanovg (#105)
* Use ignored dpr argument in makeFontManager

* Add scaling factor to FontManager initialization to attempt to match that of nanovg's nvg__getFontScale

* Set adjustedDpr to 4; it was the only possible outcome from the previous formula

* Update Changelog
2022-04-02 10:37:48 -03:00
Francisco Vallarino
4b32da8dff
Rename Timestamp type to Millisecond (#107)
* Rename Timestamp type to Millisecond

* Update Changelog
2022-04-02 00:19:58 -03:00
Francisco Vallarino
c1a15f6959
Make style... family of functions combine styles instead of replacing them. Add style...Set family of functions. (#104)
* Adds style...Set family of functions for replacing a Style/WidgetNode StyleState. The existing style... family of functions now merge with the previous StyleState

* Add style...Set to tutorials and improve styling section. Make several small improvements

* Improve StyleState documentation

* Improve naming of Core's utility function

* Update Changelog
2022-03-26 18:13:57 -03:00
Francisco Vallarino
b6f1ad2e8d
Add appStartTs to WidgetEnv. Make Timestamp a newtype (#103)
* Add _weAppStartTs to WidgetEnv, indicating the time in ms when the application started

* Use Timestamp type instead of Int to make signatures clearer

* Retrieve correct startup timestamp

* Use newtype instead of type for Timestamp

* Update Changelog

* Add utility function currentTimeMs, returning the absolute current timestamp (not from app start)

* Use currentTimeMs in examples

* Replace SDL.ticks call with utcTimeToPOSIXSeconds

* Restore nodeKey of description field in Tutorial 03
2022-03-26 17:23:53 -03:00
Francisco Vallarino
187ad94b78
Allow setting minimum thumb size in scroll widget (#100)
* Remove unneded liftIO calls from Ticker example

* Allow setting minimum thumb size in scroll widget. Improve thumb handling.

* Consider secondary axis' thumb width when calculating thumb size ratio if both vertical and horizontal bars need to be shown

* Add test cases for thumb drag

* Update Changelog

* Remove unneeded variables
2022-03-17 13:46:40 -03:00
Francisco Vallarino
5f0bed361f
Update documentation and Changelog (#89)
* Update Changelog

* Use clearer names in Container's merge

* Add an extra note for Windows builds

* Use latest GHC 8.10.7 Stack LTS
2022-03-04 15:09:21 -03:00
Francisco Vallarino
5f551d6213
Rename utility functions for retrieving WidgetNode information (#75)
* Improve naming of utility functions that retrieve WidgetNode information

* Update Changelog

* Add deprecation notice on renamed functions
2022-02-04 11:23:58 -03:00
Francisco Vallarino
8af45ca777
Make Composite's onChange event part of its event queue (#71)
* Send Composite's onChange event to its own handleEvent, not to its parent. Widgets can use Report/RequestParent if needed (check ColorPicker)

* Update Changelog

* Generalize onInit and onDispose to also support WidgetRequests

* Add Composite's onInit and onDispose unit tests

* Pass oldModel to Composite's onChange event

* Update Changelog
2022-01-23 19:18:34 -03:00
Francisco Vallarino
f4e4dddd99
Relax upper bounds for packages (#69)
* Relax upper bounds for packages mentioned in https://packdeps.haskellers.com/feed?needle=monomer

* Update Changelog

* Bump version
2022-01-23 12:45:06 -03:00
Francisco Vallarino
cb4bf89245
Call pumpEvents before pollEvents. Solves freeze issue with SDL2 2.0.20 (#68)
* Call pumpEvents before pollEvents. Solves freeze issue on SDL2 2.0.20

* Update Changelog

* Update Changelog format
2022-01-18 19:37:12 -03:00
Francisco Vallarino
4e0f8fadab
Generate click events for mouse middle button (#64) 2022-01-14 20:31:55 -03:00
Francisco Vallarino
a9a7bf33f9
Add onChange event to scroll widget (#51)
* Add onChange event to scroll widget

* Generalize helper test functions

* Add unit tests for scroll's onChange event

* Update Changelog
2022-01-08 17:09:15 -03:00
Francisco Vallarino
1f4fb932be
Initialize new widget if widgetType changed when model is updated in Composite (#53)
* Initialize new widget if widgetType changed when model is updated in Composite

* Add test cases
2021-12-28 16:22:14 -03:00
Francisco Vallarino
1caf361f20
Append handled type name to widgetType in polymorphic widgets to allow switching to different model types (#49)
* Append underlying type name to widgetType in polymorphic widgets to allow switching to different model types

* Add tests for polymorphic widgetTypes

* Make the widgetType of selectList and dropdown consider the contained type

* Update Changelog.md
2021-12-27 18:25:18 -03:00
Francisco Vallarino
376e37217c
Keep state on resize for scroll and split (#39)
* Keep state when resizing a container that is not visible

* Improve documentation for Container's resize function
2021-11-05 20:46:41 -03:00
Francisco Vallarino
afadfbb60a
Add SetFocusOnKey/MoveFocusFromKey to Composite (#37)
* Add SetFocusOnKey/MoveFocusFromKey to Composite. This makes setting focus from user event handlers more predictable

* Bump version. Update Changelog
2021-10-28 16:33:39 -03:00
Francisco Vallarino
188e621d93
Add optionButton and toggleButton widgets (#36)
* Add optionButton and toggleButton widgets

* Improve colors for buttons in base themes

* Update themes for new widgets

* Highlight focused row buttons on Todo and Ticker examples

* Add missing docs
2021-10-28 15:23:42 -03:00
Francisco Vallarino
9f02be85ca
Generate IgnoreParentEvents request from widgets that handle Wheel event (avoids issues with scroll widget moving the content) (#34) 2021-10-27 14:06:11 -03:00
Francisco Vallarino
bb77f4256d
Filter following TextInput event if a single letter binding matched previously on keystroke (#33) 2021-10-26 09:06:03 -03:00
Francisco Vallarino
7b397a5cd6 Add containerCreateContainerFromModel to workaround issue when updating offset during merge 2021-10-25 20:03:53 -03:00
Francisco Vallarino
b219be4230 Change _weFindByPath to _weFindBranchByPath, and return complete branch until path 2021-10-25 14:47:12 -03:00
Francisco Vallarino
f53d140706 Update Changelog 2021-10-25 14:47:12 -03:00
Francisco Vallarino
f0934b476d
Replace composite model with user model only on init and merge (#29)
* Use previous model version when calling dispose (current model may make prisms/indexed invalid, causing issues when using singular)

* Only replace composite model with user model on init and merge

* Add new unit test to composite

* Update/improve Changelog

* Bump version
2021-10-06 18:19:15 -03:00
Francisco Vallarino
6fab35c929
Fix mouse wheel/trackpad handling (#27)
* Do not force scroll direction based on Wheel direction argument (axis movement arguments already have that information applied)

* Bump version

* Handle wheel movement at event conversion level. Apply adjustments based on platform

* Restore old naming convention

* Update changelog
2021-10-04 20:06:50 -03:00
Francisco Vallarino
332529a67a Add singleDrawDecorations. Make it consistent with Container. 2021-09-24 16:01:58 -03:00
Francisco Vallarino
42e5f5798c Add ThemeState entries for optionButton and toggleButton widgets 2021-09-24 00:50:50 -03:00