Commit Graph

132 Commits

Author SHA1 Message Date
Albrecht Schlosser 9950c8e082 Improve contrast of check marks and radio buttons (#443)
- add fl_draw_radio(...) to standardize radio button drawing
- src/Fl_Light_Button.cxx: use fl_contrast() to determine color of
  radio button and check (light) button check marks, and use
  new fl_draw_radio() method
- src/Fl_Menu.cxx: same as src/Fl_Light_Button.cxx and use
  fl_draw_check() instead of "manually" drawing the check mark
  (forgotten in an earlier update)
2023-12-02 19:34:29 +01:00
Albrecht Schlosser 27a779b235 Fix trailing whitespace 2023-10-18 15:00:37 +02:00
ManoloFLTK ae4ed35229 Add virtual void Fl_Graphics_Driver::draw_circle() 2023-10-16 20:53:55 +02:00
ManoloFLTK 52f5653545 Doxygen-only: warn when current color is changed
Also, remove the statement that rectangles are drawn with 1-pixel lines
which is wrong with HighDPI displays.
2023-10-16 11:24:17 +02:00
Matthias Melcher 94a75b012f Fixes a bunch of typos in comments. 2023-08-26 15:17:28 +02:00
ManoloFLTK 57a87f7053 Fix "\todo provide user documentation for fl_set_status function" 2023-02-06 11:17:31 +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
Matthias Melcher bf825f8ebd
Add a unit test for drawing complex shapes (#565) 2022-11-30 22:40:52 +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
ManoloFLTK 761e24b17d Document fl_circle() with and w/o complex drawing API (#511) 2022-10-13 10:16:06 +02:00
ManoloFLTK d096ec48d0 Documentation: add missing mentions of the Wayland platform. 2022-07-05 10:13:31 +02:00
Albrecht Schlosser ab58971bcf Improve focus box drawing and documentation
Add new method
  Fl_Widget::draw_focus(Fl_Boxtype t, int x, int y, int w, int h, Fl_Color bg)

  ... with background color for correct contrast testing (in Fl_Tabs)

Draw the focus box of the "tabs" of Fl_Tabs widgets with the correct
  boxtype and background color.

Make 'unsigned int visible_focus()' const so it can be used in 'const'
  methods.

Do not draw the focus box if the per-widget focus box option is off.
2022-01-14 17:17:09 +01:00
ManoloFLTK 5bab46940c Re-organize cross-platform support for text input methods.
FLTK 1.3 supports complex text input methods (TIMs) for the 3 platforms
(X11, Windows, macOS). This support has an interface with FLTK that is
common for X11 and Windows, via (undocumented) functions fl_set_spot(),
fl_set_status() and fl_reset_spot().
In contrast, and because it's been developed independently, the
interface between the macOS TIM and FLTK 1.3 is completely different :
static functions FL::insertion_point_location() and Fl::reset_marked_text().

The present change implements a single TIM/FLTK interface
used by all platforms based on functions fl_set_spot() and
fl_reset_spot().

The previous macOS-specific functions FL::insertion_point_location() and
Fl::reset_marked_text() are maintained only for compatibility with 1.3
and deprecated.
2022-01-07 16:34:54 +01:00
ManoloFLTK 397226b75d Add use of fl_capture_window() by test/device
Also, rename fl_capture_window_part() to fl_capture_window().
2021-11-16 15:03:36 +01:00
Albrecht Schlosser af0bb7e6c9 Add rectangle drawing functions with Fl_Rect 2021-11-16 00:30:34 +01:00
Albrecht Schlosser b2979b6425 Reformat to FLTK style, improve documentation
No code changes.

Replace '#define fl_clip ..' with an inline method.
2021-11-16 00:02:16 +01:00
Albrecht Schlosser e4d8b94102 Add fl_draw_check() to draw better check marks (issue #68)
This new function can and should be used to draw check marks
in widgets that need it, e.g. Fl_Check_Browser (issue #68) and
Fl_Check_Button.
2021-11-15 14:41:31 +01:00
ManoloFLTK b027d2ba57 Windows platform: use GDI+ to antialias oblique lines and curves. 2021-05-31 08:28:06 +02:00
ManoloFLTK d95dd7acc4 New virtual member function Fl_Graphics_Driver::colored_rectf(). 2021-05-28 13:30:59 +02:00
ManoloFLTK 88a3f7b7be Rename fl_remove_scale() to fl_override_scale() as discussed in fltk.general
Re: Can custom box type functions handle their own high-DPI screen scaling?
2021-02-27 08:18:01 +01:00
ManoloFLTK 5bd467fa17 Add fl_remove_scale()/fl_restore_scale() to transiently draw without scaling factor.
This new API is a response to this message in fltk.general :
Can custom box type functions handle their own high-DPI screen scaling?
2021-02-25 11:07:07 +01:00
Albrecht Schlosser f09e17c3c5 Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files

The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
2020-07-06 20:28:20 +02:00
ManoloFLTK 4b94485efd Doc: more detail about fl_clip_region() when drawing elsewhere than on the display 2020-04-26 11:31:31 +02:00
Albrecht Schlosser 97554a88cc Move fl_font(face, size) to fl_draw.cxx
I believe this is a better place.

Also: add FL_EXPORT since it's no longer inline.
2020-02-03 17:30:54 +01:00
Albrecht Schlosser dd3485c57a Fix regression calling fl_font() w/o draw context
According to the documentation fl_font(face, size) may be called
"outside a draw context if necessary to call fl_width()".

This worked in 1.3.5 but did not in 1.4 (so far). I reworded the
docs to make clear that other measurement functions can be called
as well and refactored the code to make sure that fl_font(face, size)
will open the display if necessary.
2020-02-03 16:35:28 +01:00
Albrecht Schlosser fc36bfd88b Improve documentation of clipping functions
Clarify functionality of fl_not_clipped() and fl_clip_box().

Add developer documentation for Fl_Graphics_Driver::clip_box().

Documentation only, no code changes in this commit.
2020-01-20 12:51:47 +01:00
ManoloFLTK 8286e37b18 Add public function Fl_RGB_Image *fl_capture_window_part()
In the context of HighDPI screens, the API of function fl_read_image()
is inadequate because a rectangle of size WxH drawing units
of a window may contain many more than W*H pixels.

Function fl_capture_window_part() returns an Fl_RGB_Image
object whose drawing size matches the size of the rectangle
and whose data size matches the, possibly larger, size in pixels
of the corresponding area of the mapped window.
2019-04-09 18:50:18 +02:00
Manolo Gouy a4194a40ab Have the Doxygen doc of fl_draw_pixmap() show the default value of the last argument.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13005 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-08-04 16:42:32 +00:00
Greg Ercolano b721f519ac Added separate diagram for fl_arc(x,y,r,a1,a2) (very different from fl_arc(x,y,w,h,a1,a2))
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12935 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-24 19:48:41 +00:00
Greg Ercolano 2694217d76 Extra refs for fl_pie/fl_arc diagrams..
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12934 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-24 18:02:55 +00:00
Manolo Gouy 4ede9cec29 New Fl_Image_Surface::rescale() class function and document equivalence between Fl_Offscreen-based and Fl_Image_Surface-based approaches.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12907 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-07 13:43:28 +00:00
Matthias Melcher c0cbf0fbde Android: crude graphics clipping
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12726 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-03-10 00:46:12 +00:00
Albrecht Schlosser 52ae3582a2 Replace "WIN32" with "_WIN32" or "Windows".
Replace compiler/preprocessor/platform macro "WIN32" with "_WIN32".
Replace "WIN32" in text and documentation with "Windows".
Replace "MSWindows" with "Windows".

To do: README.Windows.txt (and maybe other documentation as well)
needs updates.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12655 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-09 14:39:42 +00:00
Greg Ercolano f47c0e9e51 fl_text_extents(): added example, included reference to fl_font() and fl_measure().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12543 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-11-05 04:18:44 +00:00
Manolo Gouy f2c27b5090 Add void fl_scale_offscreen(Fl_Offscreen &ctx) to support the rescaling of an offscreen buffer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12240 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-05-18 17:26:34 +00:00
Manolo Gouy f48750b0f4 Introduce HiDPI + rescaling support for the X11 platform (+ partial support for WIN32)
Corresponds to STR #3320
1) HiDPI support consists in detecting the adequate scaling factor for the screen on which
FLTK maps a window, and scaling all FLTK units by this factor. FLTK tries to detect the correct
value of this factor at startup (see more details below). Environment variable
FLTK_SCALING_FACTOR can also be used to set this value.
2) Rescaling support consists in changing the scaling factor of all FLTK windows
in reply to ctrl/+/-/0/ keystrokes.

More details for the various platforms :

- X11: Support is very advanced. Some details need still to be improved.
Automatic detection of the correct starting value of the scaling factor works well
with the gnome desktop. The present code contains no support for this on
other desktops.  FLTK_SCALING_FACTOR provides a workaround.

-WIN32: Support is incomplete at this point, although many test
applications have partial or complete HiDPI and scaling support.
The current value of the system's scaling factor is correctly detected
at application startup. Apps respond to changes of this value in real time.
Support needs to define the FLTK_HIDPI_SUPPORT preprocessor variable
at compile time. This way, standard builds produce a code with the
default WIN32 HiDPI support, that is, where all graphics goes to an internal
buffer that gets enlarged by the system and then mapped to the HiDPI
display. To experiment with (or develop) the new HiDPI support requires
a modified build procedure in which  FLTK_HIDPI_SUPPORT is defined
at compile time. When the support will be complete, the requirement for the
definition of this preprocessor variable will be removed. The present commit
contains support for a single scaling factor. Eventually, per-screen scaling
factors should be implemented, as done for X11.

- MacOS: this commit does not give new HiDPI for this platform.
Eventually, window rescaling in reply to command/+/-/0/ is desirable.
Per-screen scaling factor makes no sense on this platform because
the OS itself takes care of the difference between the resolutions of
traditional and retina displays.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12239 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-05-17 11:54:18 +00:00
Manolo Gouy c530cdeda6 Use Fl_Graphics_Driver::default_driver() when convenient.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12088 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-11-09 09:49:48 +00:00
Albrecht Schlosser 34f5e4f752 X11: More explicit warning when using rotated text w/o Xft.
The warning is issued to stderr only once (previously: every time rotated
text was used).



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11978 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-09-25 11:23:27 +00:00
Manolo Gouy f1ffe2f1fe Rewrite fl_read_image.cxx under the driver model.
Files fl_read_image_mac.cxx and fl_read_image_win32.cxx are no longer used;
their content is now in Fl_XXX_Screen_Driver.cxx

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11516 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-03 06:51:09 +00:00
Manolo Gouy 01e991840c Remove a bunch of useless #include <FL/x.H> directives.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11422 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-25 16:06:00 +00:00
Manolo Gouy d4768073fa Implement non-rectangular windows using the Window Driver mechanism.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11336 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-10 17:19:34 +00:00
Manolo Gouy 0b406baa0f Rewrite all fl_XXX_offscreen() functions so they use an Fl_Image_Surface object.
These functions become therefore platform-independent.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11241 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-27 13:52:27 +00:00
Matthias Melcher 41e22f2f39 Move ifdef's in RGB_Image into driver system.
- change image caching variable types to uintptr_t
- added driver function to uncache image data
- cleaning up (Xlib and GDI will likely throw syntax errors. Trying to fix ASAP)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11138 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-09 18:25:02 +00:00
Matthias Melcher 6e16d033ae Add fl_focus_rect function to driver.
Focus rectangles are dotted lines. The default implementation uses the dotted line style, However, for systems without line stye, we draw many dots instead.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11110 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-01 23:06:14 +00:00
Greg Ercolano d5698e8ed9 Documentation: clarification of fl_width()'s dependence on the current font face/size.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10320 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-09-18 15:25:55 +00:00
Pierre Ossman 332dc1b7ac Add method to set any custom cursor, based on a Fl_RGB_Image object.
Also change our fallback cursors to use this method, so that fallback
cursors are handled in a platform independent manner. STR #2660.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10196 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-06-16 11:17:57 +00:00
Greg Ercolano 0aba84051a Include code examples for use of path form of fl_arc()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9937 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-06-22 12:01:11 +00:00
Greg Ercolano ebf71d633b Documentation improvements:
o Added fl_text_extents() to the 'Drawing things in FLTK' section
	o Added 'see also' sections to all the text measuring functions in that section
	o Added detail to fl_text_extents() docs regarding it not handling FLTK symbols,
	  as non-public comment for that method indicates.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9463 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-05-08 16:15:34 +00:00
Matthias Melcher c1caad3e62 STR 2714: remove lint (variables that have the same name as a function in the same scope).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9116 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-10-02 06:25:13 +00:00