Commit Graph

2546 Commits

Author SHA1 Message Date
Albrecht Schlosser 05a95e146b Fix Fl_Terminal::handle_unknown_char() for plot_char() (#948)
- Add 'int Fl_Terminal::handle_unknown_char(int drow, int dcol)'
  to write the "unknown" character to the intended display position.

- Define Fl_Terminal::unknown_char as a static variable to avoid
  redundancy. In the future this might be overridden by users.
2024-04-09 12:53:12 +02:00
Greg Ercolano 31170c4731 Rename putchar() to plot_char() (#944)
Some old platforms (NetBSD, AIX) implement the common stdio "putchar()"
function as a global macro which poisons the global namespace, preventing
all C and C++ programs from using "putchar()" as a function or method.

There was a long thread about this in fltk.coredev during the period
Mar 25 2024 ~ Apr 4 2024, subject "RFC: Fl_Terminal::putchar() in public API"
as to why we have no choice but to not use putchar() as a method name.
2024-04-06 23:36:04 -07:00
ManoloFLTK fe6ab4ebc2 Fix documentation example of the FL_FUNCTION_CALLBACK_#() macro 2024-04-05 10:57:46 +02:00
Albrecht Schlosser 9d9646fb12 Fix compiler warning, part 2 of #946 2024-04-04 23:40:29 +02:00
Albrecht Schlosser 3ac16f1dc4 Fix compiler warning, part 1 of #946 2024-04-04 22:59:08 +02:00
Albrecht Schlosser 7a879568b3 Improve support for NetBSD (#944)
- fix gcc version check for FL_DEPRECATED macro

- fix #include for select() on NetBSD < 3.0 (#944)

For more info please see GitHub Issue #944
2024-04-02 16:03:00 +02:00
ManoloFLTK 0fa49f0ab4 Use type cairo_region_t* for Fl_Region under Wayland platform 2024-03-20 15:20:31 +01:00
Albrecht Schlosser af90841fbc Update dependencies, whitespace, and Fl_File_Chooser.cxx
Rewrite src/Fl_File_Chooser.cxx from its .fl source file
2024-03-19 15:39:18 +01:00
Albrecht Schlosser 5af2d77b84 Add more public accessor methods to Fl_Grid (#937)
Some of these accessor methods should be private so they can't be used
by user code but - due to compiler issues - they must be public for
HP-UX 11.11 (for details see GitHub Issue #937).
2024-03-18 23:23:49 +01:00
Albrecht Schlosser 8b094e8af3 Fix a bunch of compiler warnings, particularly for old compilers
Works now much better with old C99 and C++98 standard compilers.
Fixed: C++ comments in C files and headers included by C files.

There are still some warnings with C90 though but these would be
hard to fix and left as-is for now.

test/fractals.cxx: some arrays were too small by 1, or the compiler
  warned at least (false positive?). Anyway, it's fixed now.
2024-03-15 20:42:42 +01:00
Greg Ercolano 13526f04ab Make Fl_Terminal selection_text() methods public
As per Albrecht's request on fltk.coredev..
2024-03-12 13:18:54 -07:00
Albrecht Schlosser c8960dd4e2 Add key name FL_Alt_Gr for AltGr on international keyboards 2024-03-09 13:53:34 +01:00
Albrecht Schlosser 3ac007541e
Add horizontal scrollbar to Terminal widget (#928)
* Checkpoint. Basic functionality seems to be working.

* Code cleanup

* Added horizontal scrollbar to Terminal widget

* Fix hscrollbar_size operation

* Applied erco-terminal-mods_v5_final.patch.txt
Final patch relating to PR 918

* Remove trailing whitespace, update copyright year

---------

Co-authored-by: Jonathan Griffitts <jonathan.griffitts@gmail.com>
Co-authored-by: Greg Ercolano <erco@seriss.com>
Co-authored-by: Albrecht Schlosser <albrechts.fltk@online.de>
2024-03-06 21:16:11 -08:00
ManoloFLTK 4db9391525 Update doc about Ctrl/+/-/0/ zoom shortcuts 2024-03-03 08:15:42 +01:00
Greg Ercolano 257e20e929 Added Fl_Terminal::text() and docs 2024-03-02 22:47:45 -08:00
Matthias Melcher f1c9b198bb Promote fl_strlcpy to <FL/fl_string_functions.h> 2024-03-02 23:49:35 +01:00
ManoloFLTK b74099c5fd Add OPTION_SIMPLE_ZOOM_SHORTCUT to fine tune zoom-in shortcut 2024-03-02 17:25:10 +01:00
ManoloFLTK fc46e771cd Improve prioritization of event handlers added at open display time 2024-02-27 16:20:25 +01:00
ManoloFLTK 957becbe28 Fix: fl_height(int, int) decreases the font size after each call (#915) 2024-02-21 09:38:24 +01:00
Matthias Melcher 2f343ad64d
Fix Terminal character position and add word selection (#906)
* Improve horizontal interactive selection
* Using half-character positions to implement selection
  similar to Fl_Input.
* Add word and line selection
* Fix vertical position of text
2024-02-18 13:29:37 +01:00
Greg Ercolano eb4916344b Clear screen also clears attributes/xterm modes (#911)
Clear was setting characters to a space using the current style,
but if the style left Dim/Bold/Inverse (etc) enabled, that was being
used to affect the clear character, and thus affected clearing screen.

Seems weird tho; what if one wants to do a cleol (\033[K) on a screen
that is all inverted text; is there no way to use inverse mode for
clearing to the end of line? Or to delete a character?
2024-02-17 07:59:42 -08:00
Greg Ercolano 58a1496389 Fixed Fl_Terminal xterm color 39/49 handling, and other mods.
Fixed a bug in the handling of xterm color 39 + 49, which avoids
applying Dim/Bold if default color is the special "see through" color
0xffffff00. A test will be added to test/terminal to excercise this
in a follow up commit.

Renamed CharStyle::?gcolor_uchar() -> CharStyle::?gcolor_xterm()
for a consistent naming convention.

Changed fltk_fg_color() from a static func to a CharStyle method
because it needs to access the defaultcolor for the special cases
for xterm colors 39 and 49.

Made CharStyle::attr_color() private, as per Jonathan Griffitts request
in issue #909.

Improved docs regarding effects of Dim/Bold for xterm and non-xterm color
methods.

Fl_Terminal::text?gcolor_xterm() methods now use CharStyle::?gcolor_xterm()
methods, removing the duplicate code logic.
2024-02-16 13:10:06 -08:00
Greg Ercolano 1069ebc1b6 Fix Fl_Terminal xterm CharStyle charflags (#909) 2024-02-16 04:46:05 -08:00
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