Commit Graph

2523 Commits

Author SHA1 Message Date
Albrecht Schlosser fd5cd80935 Introduce "Modern CMake" in FLTK
This is a big commit and there are too many changes to list them all.
The main changes are:

- rename all CMake build options to 'FLTK_*'
- export library targets with namespace (prefix) 'fltk::'
- standardize shared library target names with suffix '-shared'
- set public build properties on libraries for consumers
- document library names and aliases in README.CMake.txt
- document changes in "Migrating Code from FLTK 1.3 to 1.4"
- partial backwards compatibility for old user projects

Included but not directly related changes:

- fix Windows (Visual Studio) DLL build
- add CMake function fl_debug_target() to show target properties
- don't build test programs if FLTK is a subproject
- internal: reformat CMake code: remove space before '('

Thanks to Matthias and Manolo for their help, testing, and feeback.
2024-02-07 18:37:34 +01:00
ManoloFLTK 676e976cb6 Fl_Window_Driver::set_popup_window(), Fl_Screen_Driver::screen_boundaries_known()
Fl_Window_Driver::set_popup_window() is to be used to declare a window should be
positioned relatively to a previously mapped other window.  This allows a platform
to process such windows differently from other windows if needed.
Menu and tooltip windows are so declared.

A call to Fl_Window_Driver::set_popup_window() also allows to distinguish a real
menu or tooltip window from a window marked by Fl_Window::set_menu_window()
or by Fl_Window::set_tooltip_window() but that's not a real menu or tooltip.

New member function bool Fl_Screen_Driver::screen_boundaries_known() returns
true by default. A platform where the position of windows inside a screen is hidden
(e.g., Wayland) returns false. This allows FLTK to refrain from trying to make sure
a computed position is inside a screen.
2024-02-05 12:39:10 +01:00
Albrecht Schlosser b21a3910a9 Improve documentation of Fl_Native_File_Chooser
Document restrictions imposed by the new system file chooser dialogs,
particularly by 'kdialog' and 'zenity' (Unix/X11/Wayland only).
2024-01-31 18:50:25 +01:00
Greg Ercolano 3142eb2fda Small code fixups
> Enabled -Wall -Wextra -Wpedantic to catch errors
    - Silenced resulting "unused parameters" warnings
    - Fixed char omission in protected Fl_Terminal::insert_char() methods
> Self doc code and better comments in RingBuffer::resize()
> Changed private RingBuffer::clear_disp_row() -> clear_disp_rows()
> Added private RingBuffer::hist_rows()/disp_rows() setter methods
> Added private RingBuffer::offset_adjust() method for adjusting RingBuffer offset_
> Fixed comment typos
> Remove white space inside outer parens of while()/if()/etc
2024-01-15 14:33:17 -08:00
Matthias Melcher 5c90938aa3 #887: Fixes FLTK file chooser not releasing preview image.
...when hidden
2024-01-14 01:42:05 +01:00
Matthias Melcher 332a87aa43 #887: Fixes Fl_Shared_Image reference counting
- adds documentation to all calls
- changes implementation details on ::copy()
and copy(w,h)
2024-01-13 19:32:32 +01:00
Greg Ercolano 08e64283aa Add textattrib() get method+docs
Requested by Jonathan Griffitts during rust bindings.
2024-01-10 09:10:07 -08:00
Albrecht Schlosser b4697c33ff Remove Fl_Simple_Terminal (replaced by Fl_Terminal)
... as discussed previously.
2024-01-06 18:29:25 +01:00
Albrecht Schlosser c8112003ca Fix typo 2024-01-06 17:56:04 +01:00
Albrecht Schlosser 1d73c0195c Improve docs and add two new Fl_Menu_Item methods (#875)
This addresses some issues pointed out by GitHub Issue #875.

Documentation lacked details about Fl_Multi_Label assignment and
correct memory handling.

The new methods
 - Fl_Menu_Item::image_label(const Fl_Image *) and
 - Fl_Menu_Item::multi_label(const Fl_Multi_Label *)
provide a cleaner interface to assign images and Fl_Multi_Label's
to menu items.

examples/howto-menu-with-images.cxx: carify some issues, fix leak,
  and use new Fl_Menu_Item::multi_label(const Fl_Multi_Label *).
2023-12-23 20:08:18 +01:00
ManoloFLTK f59702e290 A more cross-platform way to fix issue #876 2023-12-22 09:16:48 +01:00
Albrecht Schlosser 76a2c95f07 Fix a typo, trailing whitespace, and dependencies 2023-12-21 14:03:04 +01:00
Albrecht Schlosser 5df5daf78e Make the 'Forms' compatibility library 'fltk_forms' optional
This library is no longer needed in FLTK itself. There is only one
demo program (test/forms.cxx) that uses it if it is built. The demo
program displays a message if fltk_forms is not available.

The default is 'enabled' for backwards compatibility but this may
be changed to 'disabled' in a future version.
2023-12-20 17:33:37 +01:00
ManoloFLTK bc5d7e77aa Remove typos in the documentation of fl_x11_use_display() 2023-12-19 19:36:07 +01:00
ManoloFLTK 96bacd3f9d Procedure to instruct FLTK to use given X11 connexion (#149) 2023-12-19 15:48:26 +01:00
Matthias Melcher 41dd84016d #862: Removes default shortcut from Fl_Shortcut_Button
- the current UI for fallback/default/original shortcut was
confusing, so I remove it until we find something better. I
kept the values so we can reinstate a better interface without
changing the API.
2023-12-13 16:55:16 +01:00
Albrecht Schlosser 3c6fed2dd7 Improve Fl_Tabs documentation (minor wording issue) 2023-12-13 16:11:16 +01:00
Matthias Melcher c10183379f #188: Fixes Fl_Shared_Image ref count and find op
- ported froward from 1.3.9
- fixes ref count for original and other images
- fixes binary search issues
2023-12-12 22:44:49 +01:00
ManoloFLTK 28c7c584fa Improve documentation of fl_strdup()
and add example of value of fl_mac_os_version.
2023-12-12 11:58:00 +01:00
Greg Ercolano 3fb9bae040 Fl_Grid: Added show_grid(1) screenshot 2023-12-09 08:20:31 -08:00
Greg Ercolano 2571f20111 Solve issue 856: manolo's parameter names 2023-12-06 12:14:45 -08:00
Matthias Melcher 7a69c22bd7 #856: FLUID: improved Declaration dialog
Also makes enum comment in Fl_File_Chooser.fl manageable.
Not backward compatible: don't try to recreate the
File Chooser with older FLUID versions.
2023-12-05 17:54:13 +01:00
ManoloFLTK 3e61ec7044 New member function Fl_Image_Surface::mask(Fl_RGB_Image*) 2023-12-04 12:34:44 +01:00
Greg Ercolano b9ac6bd728 Solves issue #856: improve Fl_File_Chooser enum docs 2023-12-03 18:10:33 -08:00
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
Greg Ercolano 38aff7d9b4 solve issue 853: make scrollbar public 2023-11-29 08:29:24 -08:00
Albrecht Schlosser 727bd94560 Add commandline conversion for Windows (no-op on other platforms)
- add Fl::args_to_utf8() to convert commandline arguments to UTF-8

This new function closes the gap that previously only Visual Studio
applications converted their commandlines to UTF-8.

Tested with MinGW, MSYS2/MinGW-w64, and Visual Studio (2019).
2023-11-29 16:29:54 +01:00
ManoloFLTK 44b845cc42 Change type of member variables Fl_Graphics_Driver::ascent + descent
Type short is too small for Fl_Cairo_Graphics_Driver and font sizes ≥ 110.
2023-11-29 10:03:14 +01:00
Albrecht Schlosser 57371365d8 Fix compiler warning, dependencies, and trailing whitespace
The benign warning was:
  ‘Fl_Browser_::hscrollbar’ will be initialized after [-Wreorder]
  ‘int Fl_Browser_::linespacing_’ ...
2023-11-27 15:33:53 +01:00
ManoloFLTK f6d2ba651b Cairo graphics driver: Improve drawing of Fl_Pixmap and Fl_Bitmap 2023-11-27 10:02:59 +01:00
Matthias Melcher 6817e821af STR 1373: adds vsync control to OpenGL contexts on macOS
Windows and X11 to follow, no idea about Wayland.
2023-11-26 12:37:59 +01:00
Matthias Melcher 39a3212fc3 Adds pulldown menu to Fl_Text_Display and ..._Editor 2023-11-25 22:52:00 +01:00
Matthias Melcher c097f63ff8 Cleans up Fl_Input right mouse button menu 2023-11-25 22:08:05 +01:00
Matthias Melcher 7bef4ebf78 STR 749: Adds cut/copy/paste popup menu to Fl_Input 2023-11-25 21:42:27 +01:00
Matthias Melcher 34ed30fe1a Adds `linespacing()` to `Fl_Browser_` and all derived widgets 2023-11-25 18:20:08 +01:00
Greg Ercolano 0080850092 Fl_Terminal better name for flags -> charflags 2023-11-25 06:56:38 -08:00
Matthias Melcher b6be421a1f Added safety when calling Text_Display methods
- before assigning a buffer (Github #845)
- also fixed a warning form unused arg in Fl_Terminal
2023-11-23 15:16:34 +01:00
Greg Ercolano 9894812644 Make new handle_lf/cr methods private 2023-11-22 06:34:24 -08:00
Matthias Melcher 81e26b9089 Adding size range settings to Fl_Tile, initial commit.
- some documentation missing
- Fl_Tile::resize() not satisfying yet
- minimums work, maximums currently ignored
- 0 size children may make program hang
2023-11-22 14:45:13 +01:00
Greg Ercolano 9383f172a8 Fl_Terminal docs: Added some tables 2023-11-21 14:41:15 -08:00
Greg Ercolano c568056244 Added output_translate(): controls lf -> crlf translation 2023-11-21 11:24:27 -08:00
Greg Ercolano 56e85e8522 Fl_Terminal docs for fg/bg colors 2023-11-21 09:06:46 -08:00
Greg Ercolano 6252131017 Solve issue 837, doc some protected methods. 2023-11-20 09:26:40 -08:00
Greg Ercolano bc8b186398 Doc all pub/prot members, remove unused, add todo
- Made sure all public+protected members are documented.

- Reclassified some private -> protected:
   > vscroll_width()

- Removed signatures for unimplemented (non-existant) methods:
   > u8c_cursor(void)
   > history_use(int,bool)
   > cursor_h()

- Reclassified some protected -> private:
   > x_to_glob_col()
   > xy_to_glob_rowcol()
   > is_hist_ring_row()
   > is_disp_ring_row()
   > handle_ctrl()
   > is_printable()
   > is_ctrl()
   ..etc..
   > handle_selection_autoscroll()
   > handle_selection()
   > is_redraw_style

- Add todo for ESC 7 and ESC 8
- Small code formatting mods
- Small typos
2023-11-19 22:46:04 -08:00
Albrecht Schlosser a72eff7588 Fix compiler warnings in Fl_Terminal on Windows
- missing FL_EXPORT: Visual Studio (dll)
- missing include <stdarg.h>: MinGW
2023-11-19 17:58:57 +01:00
Albrecht Schlosser 367d302b5f Apply two patches provided by user 'Andre' via mail
1. add missing FL_EXPORT to class Fl_Terminal
2. add missing test/wizard demo to test/Makefile
2023-11-17 19:27:00 +01:00
Albrecht Schlosser 44bb080c0f Remove friend declaration from Fl_Window.H (see STR 3354)
Although this was not strictly necessary I decided to implement the
proposed patch, but in a slightly different way.

This adds a static public method for internal use only but it wouldn't
do any harm if a user called it.
2023-11-17 16:55:37 +01:00
Albrecht Schlosser 6f7e1f4fb7 Enhance documentation of event processing 2023-11-17 15:25:21 +01:00
Greg Ercolano 38fc08c15f Added clear(), some methods protected->public
New public methods:

    void clear(void);
    void clear(Fl_Color val);

old protected methods made public:

    void clear_screen(bool scroll_to_hist=true);      // ESC [ 2 J
    void clear_screen_home(bool scroll_to_hist=true); // ESC [ H ESC [ 2 J
    void cursor_home(void);                           // ESC [ 0 H

test/terminal modified to test these, and added separate tests
for both the API and ANSI code ways to do these ops.
2023-11-16 15:45:29 -08:00
Matthias Melcher d1d38090fb Fixes return type of Fl_Input_::dvalue() 2023-11-15 22:45:20 +01:00