Commit Graph

2341 Commits

Author SHA1 Message Date
Greg Ercolano
1324c623fe Add new Fl_Rect::inset(lt,top,rt,bot) method 2023-01-08 09:42:58 -08:00
ManoloFLTK
09db3a6dea Fix "Xrender blurs adjacent images with bilinear scaling" (#633)
Many thanks to @wcout for providing this fix.

Xrender now draws images in the same way when tiling images
or not when FL_RGB_SCALING_BILINEAR is on.
This allows to remove static bool Fl_Tiled_Image::drawing_tiled_image()
which becomes unused.
2023-01-08 11:17:03 +01:00
Matthias Melcher
6ada45f1f2 Fix missing parameter documentation 2023-01-08 01:07:04 +01:00
Albrecht Schlosser
8dd3ff8e12 X11: Optionally copy selection buffer to clipboard (STR 3229)
The new method Fl::selection_to_clipboard(int) enables copying
selection data to the clipboard on X11 if it is set to 1.

This feature was requested by STR 3229 and the implementation was
inspired by an `xterm` feature named "Select to Clipboard" which can
be enabled by 'ctrl + middle mouse button + "Select to Clipboard"'
in an xterm window.
2023-01-06 16:45:22 +01:00
Matthias Melcher
4bff15278e Adding Fl::hide_all_windows() 2023-01-05 15:20:13 +01:00
Matthias Melcher
8826dca106
Add close buttons for individual tabs in Fl_Tabs (#628)
Add close buttons for Fl_Tabs
Introducing callback reasons
FLUID shows all FL_WHEN_... options
Adding Fl_Tabs overflow types
Improved test/tabs to show new features
2023-01-05 13:51:30 +01:00
Albrecht Schlosser
4d1a508c7e Refactor drawing small circles: add fl_draw_circle()
This method can be used to draw small circles as part of the GUI.
It is independent of the current scheme.

Very small circles are approximated by drawing several rectangles.
2023-01-05 01:06:25 +01:00
Albrecht Schlosser
9aa7cab532 Clarify and improve Fl::scheme() related documentation 2023-01-03 17:11:00 +01:00
Albrecht Schlosser
a1ebe027be Fix a doxygen warning and improve "file list" contents
FL/Fl_Group.H: add `\brief` keyword
src/Fl_Group.cxx: fix warning: the '#' in '#include' must be escaped
2023-01-02 15:56:56 +01:00
Matthias Melcher
44c874b731
Use FL_OVERRIDE for all overridden virtual methods (#611)
FL_OVERRIDE is defined as `override` for C++11 and higher
FL_OVERRIDE is defined as `override` for VisualC 2015 and newer
Don't interfere with Fl_Widget::override()
2022-12-30 19:14:36 +01:00
Albrecht Schlosser
78cf29ba29 Improve and extend fl_contrast() (#370)
- Add internal fl_contrast_cielab() as the new default.
- Keep old function as internal fl_contrast_legacy().
- Add fl_contrast_mode() to switch between fl_contrast() functions.
- Add fl_contrast_level() to fine tune fl_contrast() per mode.
- Add option to register and use a custom contrast function.
- Add test/contrast.cxx test program.
- Move all fl_contrast() related code to a new file src/fl_contrast.cxx.
- Add fl_lightness() convenience function for perceived lightness.
- Add fl_luminance() convenience function for physical luminance.
2022-12-28 18:16:23 +01:00
Matthias Melcher
d98c663893
Fix compilation on old gcc (#606)
* Fixing char* use in FLUID
* Fixing const cast
2022-12-22 00:18:01 +01:00
Albrecht Schlosser
1d212b7a03 Clean up class Fl_String (part of issue #601)
- remove static variable 'string_count'
- improve and document methods debug() and hexdump()

This commit does not resolve issue 601 but removes some development
leftovers.

Methods debug() and hexdump() left for debugging as requested.
2022-12-20 20:05:15 +01:00
Albrecht Schlosser
004ea67203 Update dependencies, remove trailing whitespace 2022-12-19 15:23:20 +01:00
Greg Ercolano
e7630e045a Added ansi_show_unknown(bool) (default off)
It may be useful to some to have the terminal emit an error character
to show unknown escape sequences. Off by default, unknown escape sequences
are silently ignored. If enabled, '¿' is inserted instead.
2022-12-18 13:21:22 -08:00
Greg Ercolano
993b7da3b5 ESC sequences can traverse append(), unicode support for backspace
This is basically a rewrite of the ESC handler, keeping state
in the class, so ESC sequences can continued between called
to append() (such as when reading data from a pipe in blocks).

New private class 'Fl_Escape_Seq' handles parsing and state info.
It also has careful bounds checking during parsing.

Backspace supports Unicode, and the unicode chars can straddle
across append() operations as well.

Private variables in Fl_Simple_Terminal renamed _xxx to xxx_
to improve CMP compliance.
2022-12-17 20:53:54 -08:00
ManoloFLTK
b9852ff58f Add cross-platform fl_close_fd(int fd) to close a file descriptor 2022-12-17 19:13:30 +01:00
Matthias Melcher
12da87ba0c
Adding length checks for in-memory image data (see #542) (#592)
SVG is now decompressed in memory
Bitmap invalid array length handling to return an error
RGB Image data reader to return error if image data is too short
FLUID: Add size argument to bitmap and JPEG data
2022-12-17 16:01:35 +01:00
Greg Ercolano
118bf55c38 Added backspace handling to simple terminal ansi() mode
This addresses a comment from MoAlyousef in issue #577
	on 12/15/2022 requesting backspace processing.
2022-12-16 10:48:32 -08:00
ManoloFLTK
41f37613ec Derive Fl_Zenity_Native_File_Chooser_Driver from Fl_Kdialog_Native_…
Also add Fl::option(OPTION_FNFC_USES_ZENITY)
2022-12-16 16:21:23 +01:00
Albrecht Schlosser
44a2547394
Rename some Fl_Flex methods for FLTK compliance (#594)
Change some method names to comply with FLTK style as discussed
in fltk.coredev, thread "Fl_Flex method name question".

* Rename Fl_Flex::margins(...) to Fl_Flex::margin(...)
  (use singular form for all margin related methods)

* Remove Fl_Flex::setSize() and isSetSize() "backwards compatibility" methods

* Rename Fl_Flex::set_size(...) to fixed(...)

Note: the latter affects existing (pre-release) fluid (.fl) files: you may
  want to edit and replace "set_size_tuples" with "fixed_size_tuples"
2022-12-15 16:46:40 +01:00
Albrecht Schlosser
64d8c913be Fix trailing whitespace and dependencies 2022-12-13 15:58:56 +01:00
ManoloFLTK
19c1ab504f Use correct syntax to befriend a class 2022-12-11 08:50:59 +01:00
Matthias Melcher
a5adbd99ca
Add option to bind images to a widget (#589)
Adding image binding to FLUID as well
2022-12-10 23:22:24 +01:00
Greg Ercolano
234a33c12f Docs: add widget screenshot for Fl_Hor_Nice_Slider 2022-12-10 07:53:28 -08:00
ManoloFLTK
df059de37e "Public members Fl::awake_ring_*_ should be private" (#559) - cont'd 2022-12-10 10:19:54 +01:00
Albrecht Schlosser
e72fa007e7 Make Fl_ICO_Image::idcount() const
... and fix docs and alignment
2022-12-09 22:51:37 +01:00
ManoloFLTK
59be6a7ef9 Fix for "Public members Fl::awake_ring_*_ should be private" (#559) 2022-12-09 18:50:04 +01:00
ManoloFLTK
eb2572deaf Add new Wayland-specific fl_wl_compositor() function 2022-12-09 17:06:35 +01:00
ManoloFLTK
36cd0a397c New Fl_ICO_Image class to read Windows .ico icon files
Many thanks to @darealshinji for contributing all the code
for this new FLTK image class (see branch Fl_ICO_Image of https://github.com/darealshinji/fltk).
2022-12-09 10:43:20 +01:00
Matthias Melcher
9f92972729
Implement fl_complex_polygon() for OpenGL (#570) 2022-12-05 19:27:12 +01:00
Matthias Melcher
bf825f8ebd
Add a unit test for drawing complex shapes (#565) 2022-11-30 22:40:52 +01:00
ManoloFLTK
bc3bbb7ca0 Remove useless fl_matrix member variable of class Fl_Graphics_Driver 2022-11-30 18:57:39 +01:00
ManoloFLTK
b7ce83c02b Remove superfluous friend declarations from class Fl_Graphics_Driver 2022-11-30 16:11:32 +01:00
ManoloFLTK
00884f28e2 Fix for issue [Cairo]: Arrows have a "gap" (#561)
The problem to fix is that the arrow drawn by draw_arrow1() in src/fl_symbols.cxx
displays a faint clear line between the stem and head of the arrow with the Cairo
graphics driver.

This occurs because draw_arrow1() draws the arrow in 2 steps (a rectangle +
a triangle) and the Cairo driver is configured to use antialiasing when filling
polygons. The antialiasing produces the faint line between stem and head.

Why does draw_arrow1() draw a rectangle + a triangle rather than a
7-vertex polygon? That's because the X11 graphics driver fails with its polygon-
drawing function when the polygon is also rotated: the polygon is drawn
empty.

We want to keep using antialiasing under Cairo for polygons because
the result is better with non horizontal/vertical polygon edges.

This implementation changes function draw_arrow1() which draws
the arrow as a 7-vertex filled polygon except when the graphics driver
returns false for its virtual member function can_fill_non_convex_polygon().
In that situation, draw_arrow1() draws, as before, a rectangle + a triangle.
The new, virtual member function can_fill_non_convex_polygon() returns
true except for the X11 graphics driver. Therefore, draw_arrow1() is effectively
unchanged under the X11 driver.
2022-11-29 12:28:31 +01:00
ManoloFLTK
acf7254fe8 macOS+OpenGL3: remove "warning: gl.h and gl3.h are both included" 2022-11-27 08:06:33 +01:00
Matthias Melcher
87fe29372c
Local undo per Fl_Text_Buffer and Fl_Input_ (#557) 2022-11-26 20:28:12 +01:00
Albrecht Schlosser
191aeefc4a Make the value box size of Fl_Value_Slider user settable (STR 3222)
For a very simple test program see STR 3222, File 2:
https://www.fltk.org/strfiles/3222/value_slider.cxx

Known issues:
 - range checking of the value box size is very limited
 - resizing the widget does not change the value box size
 - drawing issues are possible if the value box size and the widget
   size are not compatible (e.g. value box too large)
2022-11-26 19:56:32 +01:00
Albrecht Schlosser
b1ba37c5ba Add "Oxy" scheme (STR 2675, STR 3477)
This commit is similar to the patch given in STR 3477, oxy_v5.diff:
https://www.fltk.org/strfiles/3477/oxy_v5.diff

... with modifications, and updated to current FLTK code.
2022-11-25 00:00:48 +01:00
Matthias Melcher
b16309f13e
Refactor code to make rounded rectangles accessible (#553)
This adds fl_rounded_rect and fl_rounded_rectf so the
user can draw rounded rectangles. This uses existing and
optimised code that is rearranged.
2022-11-24 12:47:49 +01:00
Albrecht Schlosser
ecc47d0cc3 Refactor and simplify "arrow drawing" in widgets
"Arrows" in widgets are those GUI elements mostly represented by
triangles pointing in a particular direction as in scrollbars,
choice widgets, some menus, valuators and Fl_Counter widgets.

The code has been simplified and standardized such that all these
GUI elements are drawn identically per FLTK scheme.

Widget authors no longer need to write code to calculate arrow sizes
and draw polygons etc.

Different schemes can and do implement different drawing functions.

Todo: see comments "FIXME_ARROW" in src/Fl_Menu_Button.cxx and
      src/Fl_Menu.cxx
2022-11-22 19:32:54 +01:00
Albrecht Schlosser
fa6d95a793 Enhance Fl_Rect: add inset() and new constructor
These new features can be used by widgets that draw inside a rectangle
taking the border width into account.
2022-11-22 19:01:39 +01:00
Matthias Melcher
495b2395c1
Fix selection extension in Fl_Text_*, issue 196 (#550)
Selecting a text range programmatically would not sync
some variables with the actual selection. This also fixes
a crash bug in macOS when dragging text that was
selected by buffer()->select() only.
2022-11-22 16:18:56 +01:00
ManoloFLTK
8a53fc9611 Replace #if FLTK_USE_X11 by #ifdef FLTK_USE_X11 2022-11-20 07:33:08 +01:00
Matthias Melcher
72415b534d
Fix rearranging children in Fl_Scroll (#546)
Implement Fl_Scroll::on_move()
Fix indexing in Fl_Group::on_move()
2022-11-17 08:34:06 +01:00
ManoloFLTK
7f8f7c5b85 Add support of .svgz image files to fluid
The  prototype of the public Fl_SVG_Image constructor is expanded
to allow construction from in-memory, gzip'ed binary data.
2022-11-15 10:09:01 +01:00
Albrecht Schlosser
a3a60ed27c Improve and clarify documentation of fl_beep() 2022-11-11 16:43:33 +01:00
Greg Ercolano
d68f927a13 Document Fl_Multiline_Output keynav and caret cursor 2022-11-07 17:08:14 -08:00
Greg Ercolano
9605b82e08 Added missing const on some methods 2022-11-07 10:59:19 -08:00
Greg Ercolano
6f24175e64 Added assignment by index example, doc clarifications. 2022-11-07 10:33:35 -08:00