Commit Graph

1274 Commits

Author SHA1 Message Date
Francisco Vallarino
51ce06f613
Add Monomer logo and badges to README.md (#186)
* Add new Monomer logo and badges to README.md

* Fix sub-title styling

* Add support for loading any image format to use as application icon

* Update Monomer icon image

* Update examples and tutorials to use new icon image

* Adjust logo background color
2022-06-27 16:25:03 -03:00
Francisco Vallarino
84e37dcbfa
Fix Composite's onDispose event handler (#176)
* Add minNumericValue helper. Add attribution note

* Process Composite's onDispose events in its own dispose handler, since RaiseEvent will not have a handler after the Composite's disposal
2022-06-18 20:41:01 -03:00
Francisco Vallarino
353b4977fb
Use stderr for diagnostic and error messages (#172) 2022-06-17 00:13:54 -03:00
Francisco Vallarino
fa526493c1
Hide tooltip when a button action is detected on its child widget (#170) 2022-06-15 21:42:16 -03:00
Francisco Vallarino
69f68ff6e2
Consider padding, border and sizeReqs in addition to textStyle when checking if resize is needed for label (#169) 2022-06-14 17:47:31 -03:00
Francisco Vallarino
f41edd8d6f
Do not exit application if icon image is missing or fails to load (#171) 2022-06-13 18:12:39 -03:00
Gareth Smith
e7ea45f5bb
Fix compatibility with GHC 9.2.2 (issue #159) (#162)
* Fix compatibility with GHC 9.2.2 (issue #159)

I'm not sure what the compilation error really meant... but this seems to fix it.

* Shuffle the types around a bit to reduce the number of type variables.
2022-05-30 18:05:59 -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
55ae7f88f1
Bump version (#151) 2022-05-14 12:00:22 -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
Camden Kuwahara
853573ebaf
Fix bug where imageMem widgets will not render their new state after a merge. (#147)
Co-authored-by: Camden <camdenkuwahara@gmail.com>
2022-05-11 18:55:40 -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
fe8bdb8bc4
Fix several WidgetTypes' Haddock issues (#145)
* Fix several WidgetTypes' Haddock issues

* Mention button also supports ignoreTheme
2022-05-10 11:57:37 -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
4b62c28b09
Add drawing and theme utility functions (#138)
* Fix WidgetEnv's Haddocks, improve Composite's and label's

* Add triangle drawing utilities

* Add theme customization utility functions
2022-05-07 11:55:23 -03:00
Francisco Vallarino
2ebfd9443f
Fix Haddock links. Rename upload utility. (#142)
* Fix several Haddock links. Fix widgetKeyMap Haddock (missing '-')

* Fix Haddock issues. Rename haddock .sh helper to indicate it only generates and does not upload the updated docs
2022-05-07 11:42:30 -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
f693af6059
Improve Haddocks (#129)
* Improve Haddocks of single widgets

* Improve Haddocks of container widgets

* Fix Haddock links between modules
2022-04-30 11:10:53 -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
d2b56c430a
Fix space leak in StyleUtil's mergeNodeStyleState (#132) 2022-04-28 14:36:56 -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
add5a31560
Improve inputField and textArea selection (#127)
* Improve caret and selection rect size for inputField

* Improve caret and selection rect size for textArea

* Minor reorganization of base theme. Reduce default vertical text spacing from 4 to 2 pixels
2022-04-22 13:06:26 -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
f98c3e3900
Improve Grid and Stack docs. Link to widget's Haddocks from Tutorials (#119)
* Improve Haddocks for Grid and Stack

* Link to widget's Haddocks from tutorials

* Fix typo
2022-04-14 13:40:14 -03:00
Francisco Vallarino
0e464c5bb6
Add clarification notes about layouts and styling to tutorials (#118)
* Add improved note regarding secondary axis for hstack/vstack. Mention hgrid/vgrid

* Remark that styles belong to individual widgets and are not cascade down to its children

* Fix typo
2022-04-13 10:28:45 -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
2cdcb12823
Make nodeInfoFromKey rely on nodeInfoFromPath instead of getting the information from WidgetEnv, which may be stale (#111) 2022-04-05 12:26:27 -03:00
Francisco Vallarino
e49a793576
Add missing instances to Millisecond type (#109)
* Add Generic instance to Millisecond type

* Add Read instance to Millisecond type

* Add Default instance. Use newtype deriving whenever possible
2022-04-02 14:04:53 -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
1962586e44
Add more sizeReq utility functions (#106) 2022-04-01 23:26:58 -03:00
Francisco Vallarino
f76cae7b81
Align ColorPicker's numericFields using the ascender as reference (#108) 2022-03-31 23:58:29 -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
Clindbergh
17bd6bcb11
Fix optics tutorial sample code (2) (#98)
Rename `_address` to `_workAddress` so the Prism sample code works.
2022-03-13 14:21:50 -03:00
Clindbergh
34fa63792d
Fix optics tutorial sample code (#95) 2022-03-11 14:43:34 -03:00
Gareth Smith
2ad5012732
Give various widgets a readOnly mode (#93)
* Give various widgets a readOnly mode

This mode allows text to be selected (and copied), but does not allow
editing. See issue #87

* Use a neater readOnly to editable conversion.
2022-03-07 16:30:28 -03:00
Francisco Vallarino
bb7a1710c8
Do not detect Fixed fields as Integral in numericField. If decimals config is set, make it take precedence over detected type (#94) 2022-03-07 14:21:17 -03:00
Francisco Vallarino
cd8d3f4a6f
Check if a dragHandler exists before applying fromJust in inputField (#92)
* Check if a dragHandler exists before applying fromJust in inputField

* Do not change cursor when pressing shift if input widget does not implement dragging
2022-03-05 13:02:49 -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
Hiroki Tokunaga
7c6777decd
Add the lineBreak option (#86)
* feat: add the `lineBreak` option

This commit adds `lineBreak` option to specify how to break texts into
lines. `OnSpaces` is the default and breaks texts at spaces. `OnCharacters`
breaks texts at characters, even in the middle of a word. This is useful
for handling CJK texts, though it does not follow [the line breaking
rules](https://en.wikipedia.org/wiki/Line_breaking_rules_in_East_Asian_languages).

* fix: implement for `TextStyle`

Not to create instance of each widget.

* test: add for `OnCharacters`

* perf: make `fitLineToW` faster
2022-02-24 14:37:31 -03:00
Francisco Vallarino
510de85d5c
When the scroll widget receives focus because of SetFocus/MoveFocus, forward focus to the next widget. (#81) 2022-02-13 17:15:39 -03:00
Gareth Smith
9bc252cbe7
Allow setting the window icon via AppConfig (#79) 2022-02-13 14:12:32 -03:00