Commit Graph

2311 Commits

Author SHA1 Message Date
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
Greg Ercolano
2a43a12b7b Added empty(), ensure size() enlarges new vals = 0 2022-11-07 10:33:35 -08:00
Greg Ercolano
8b72f0c668 Add doxygen docs for Fl_Int_Vector.
While adding the docs, noticed some things that need modification
for proper public use. These are highlighted as \todo items and
\warning items, which will be fixed in a separate commit forthcoming. -erco
2022-11-06 20:21:46 -08:00
Albrecht Schlosser
f904f4c4ec Fix Fl_Help_View <OL> numbers (Issue #153, STR 3290)
Started with @wcout's patch (see Issue #153, STR 3290), modified
patch for CMP conformance, restructured methods, and finally:

- used Fl_Int_Vector instead of 'fl_data_container'
- removed fl_data_container

Thanks for the working patch to @wcout.
2022-11-06 16:40:17 +01:00
Albrecht Schlosser
bb7129dae2 Use the new Fl_Int_Vector class in Fl_Table
Replace local IntVector with Fl_Int_Vector
2022-11-06 16:32:29 +01:00
Albrecht Schlosser
8b92935b1e Add Fl_Int_Vector: "an STL-ish vector without templates"
Code copied from Fl_Table and reformatted.

Thanks to Greg for the original code.
2022-11-06 16:32:29 +01:00
ManoloFLTK
4b945a3086 Wayland/X11 hybrid: use "bool fl_disable_wayland;" declaration. 2022-11-05 19:47:37 +01:00
Albrecht Schlosser
b426a3d7c0 Fix two rare potential bugs (NULL pointer dereferencing)
Both bugs can happen if a widget doesn't have an associated window()
or in similar situations. These fixes returns NULL to prevent crashes.

Bugs observed in special test scenarios, not real-life programs.
2022-11-05 19:31:59 +01:00
Albrecht Schlosser
2446ec5d62 Implement Fl_Scroll::on_insert()
This fixes the scrollbar order when children are inserted rather than
at some indefinite time later, for instance in draw().

This commit will very likely make Fl_Scroll::fix_scrollbar_order()
obsolete but this method is kept as is for tests and verification.
2022-11-03 19:11:59 +01:00
Albrecht Schlosser
0ebb113584 Implement destructor of Fl_Scroll and fix inconsistencies 2022-11-03 18:58:28 +01:00
Matthias Melcher
33f01ecb83
Added Fl_Group::on_insert/on_remove/on_move (#527) 2022-11-01 20:45:31 +01:00
Albrecht Schlosser
c570bd8f96 Fix trailing whitespace 2022-11-01 20:06:22 +01:00
Albrecht Schlosser
a918292547 Fix removal and deletion of the resizable() of Fl_Group
If the resizable() of an Fl_Group is deleted it is automatically
removed from the group.

New: to avoid dangling resizable() pointers the resizable widget
is set to the group itself.
2022-10-28 17:37:18 +02:00
Greg Ercolano
c7ffd8e72a Doc proper removal/destruction of a widget from its group.
This modification as per small thread on fltk.coredev:
Sep 19, 2022, Subject: Addition to Fl_Group docs
2022-10-21 23:44:08 -07:00
Albrecht Schlosser
da11526bb8 Improve and clarify documentation of timeout functions
Some functions didn't document the handling of arguments properly,
particularly Fl::has_timeout() and Fl::remove_timeout().

This is now fixed by documenting the correct behavior that was
preserved (re-implemented) from FLTK 1.3.x in the new class Fl_Timeout.

Unfortunately there have been some inconsistencies (likely unexpected
behavior) which have been preserved and which are now documented.
2022-10-20 19:36:03 +02:00
ManoloFLTK
761e24b17d Document fl_circle() with and w/o complex drawing API (#511) 2022-10-13 10:16:06 +02:00
ManoloFLTK
1df79078b7 Remove duplications between Fl_Graphics_Driver and derived classes. 2022-10-10 16:58:48 +02:00
Albrecht Schlosser
2a856dafd4 Remove superfluous center alignment from images
Doxygen uses a <div> with center alignment for images, hence
adding HTML center alignment for image is not only superfluous
but was also inconsistent.

Also removed some more unnecessary HTML tags, updated copyright year.
2022-10-09 19:35:20 +02:00
ManoloFLTK
f2532964cc Class Fl_Single_Window declares but doesn't implement method make_current().
Also, add missing doc for methods Fl_XXX_Window::show(int, char**).
2022-10-07 09:21:37 +02:00
ManoloFLTK
5f189aa213 Make Windows-specific HICON-using functions visible in doc. 2022-10-06 13:15:16 +02:00
ManoloFLTK
da66e21e1d Support of FLTK widgets in OpenGL 3 windows - cont'd.
This commit allows to switch between FL_DOUBLE / FL_SINGLE modes
in widget-containing GL3 windows.
Demo program examples/OpenGL3test is modified to show FLTK widgets
even if the platform does not support OpenGL 3.
2022-09-29 09:39:21 +02:00
ManoloFLTK
59fc60ea4c Simpler code to support FLTK widgets in macOS OpenGL 3 windows.
Also, the application-level code to add widgets to a GL3 window becomes
platform-independent.
2022-09-27 14:12:39 +02:00
ManoloFLTK
89f9671b40 Add cross-platform support for adding widgets to an OpenGL3-based Fl_Gl_Window.
Under non-macOS platforms, the key is to call glUseProgram(0); after having used OpenGL 3
which allows to then use OpenGL 1 and draw FLTK widgets over the OpenGL3 scene.

Under macOS, this is impossible because macOS GL3 contexts are not compatible
with GL1. The solution implemented here is to create an additional Fl_Gl_Window
placed above and sized as the GL3-based window, to give it a non opaque,
GL1-based context, and to put the FLTK widgets in that additional window.
2022-09-25 16:39:40 +02:00
ManoloFLTK
8bbedd65a8 Fix issue #501: build error under macOS 10.10 2022-09-22 20:12:40 +02:00
ManoloFLTK
debbba19ec Improve docs of Fl_Copy_Surface and use of OpenGL 3. 2022-09-21 15:15:55 +02:00
ManoloFLTK
add3f0566c Add Doxygen description of FL_FREE_COLOR. 2022-09-18 11:57:15 +02:00
ManoloFLTK
d028f0b37d Fix fl_read_image() under hybrid Wayland/X11 platform.
Function fl_read_image() obliges to keep a minimal use of global variable fl_window
also under the Wayland platform, even if its type (Window) makes little sense for
the hybrid library because it has its X11 value (given by X11/X.h) which is not
meaningful for the Wayland leg of the hybrid platform.

Virtual member function Fl_Surface_Device::as_image_surface() becomes useless.
2022-09-11 19:45:48 +02:00
ManoloFLTK
203e7b7098 New OPTION_WAYLAND_ONLY for CMake to build pure Wayland platform. 2022-09-09 15:19:15 +02:00
ManoloFLTK
71069b8570 Add necessary virtual qualifier to ~Fl_Font_Descriptor() and derived. 2022-09-08 16:04:09 +02:00
ManoloFLTK
13e05f4204 Improve support of child windows that may leak outside their parent window.
1) add Wayland code that prevent subwindows from leaking outside their parent.
This does not cover GL subwindows.

2) add macOS code that prevent GL subwindows from leaking outside their parent.
This fixes issue #494 for the macOS platform.

N.B.: Wayland GL subwindows are not prevented from leaking because no solution
that would not require any change in client applications was found. Code that
would cover Wayland GL subwindows but would require client applications to always
use the FL_ALPHA flag is included in this commit in commented out form.
2022-09-07 14:40:16 +02:00
ManoloFLTK
07fd2628fe Hybrid Wayland/X11 platform: improve control of chosen backend. 2022-08-30 17:37:55 +02:00