Commit Graph

1325 Commits

Author SHA1 Message Date
Albrecht Schlosser
62d85333bd Improve handling of events in test/handle_keys.cxx
(1) Ensure that the terminal widgets doesn't use keyboard events.
  Advantage: keyboard navigation and selection doesn't interfere
    with the display.
  Drawback: Contents of the terminal can no longer be copied.
    This will be addressed in a later update.

(2) Thanks to Manolo for his addition of the "GUI scaling" button.
  Although GUI scaling can be useful, it can also be annoying while
  testing shortcuts.

(3) Changed all light buttons to check buttons.
2024-03-11 17:07:56 +01:00
Albrecht Schlosser
7bbe75c84e Add another keyboard event test program test/handle_keys.cxx
This program logs all keyboard events to a built-in Fl_Terminal widget.

WIP: version 0.80
2024-03-09 15:17:34 +01:00
Albrecht Schlosser
290e95eaef Use FL_Alt_Gr key definition in test/keyboard
... and reformat key definition table
2024-03-09 14:03:51 +01:00
Albrecht Schlosser
602cd7a990 Use fixed font in test/clipboard for text display
This is more like a text editor would display text.

Todo: make the font selection optional (later).
2024-03-09 13:56:09 +01:00
Albrecht Schlosser
4c0a2ffb81 Fix shortcut (Esc) handling in test/keyboard.cxx
Esc is intentionally consumed by the test program (see comment) but
other keystrokes (shortcuts) must pass to allow zooming with ctrl/+/-/0.
The old code filtered all shortcuts which turned out to be wrong.

Not being able to zoom was caused by a previous commit that lowered
the priority of the zoom key handler - which alone was not wrong.
2024-03-05 03:08:30 +01:00
ManoloFLTK
72840ea2c1 Fix: Filechooser preview of XML file shows it as a corrupt image (#926) 2024-03-04 21:15:47 +01:00
ManoloFLTK
2e315e5424 native-filechooser: add call to fl_register_images() and explain why 2024-03-03 08:33:27 +01:00
Matthias Melcher
f1c9b198bb Promote fl_strlcpy to <FL/fl_string_functions.h> 2024-03-02 23:49:35 +01:00
Matthias Melcher
4ccadff4b9 Fix test/editor use of strncy to strlcpy 2024-03-02 23:14:07 +01:00
ManoloFLTK
0818d4ec5b Fix: Fl_Window::fullscreen() does not work correctly on Mac (#920) 2024-02-26 12:15:47 +01:00
ManoloFLTK
ba5ed296e9 Improve implementation of the macOS Window menu
The macOS Window menu is connected to the item array of the  macOS menubar
via FL_SUBMENU_POINTER. This facilitates memorization of pointers
to items of the macOS menubar because the item array no longer changes
each time a window opens of gets closed.
2024-02-20 16:00:01 +01:00
Greg Ercolano
00cdb1757f Added attribute checks to test/terminal for recent changes. 2024-02-16 13:14:15 -08:00
Albrecht Schlosser
809ceea075 Fix Cairo related build issues (missing Cairo lib)
... particularly for shared libs
2024-02-09 19:41:45 +01:00
Albrecht Schlosser
ede53b8a50 Fix cairo_test-shared build as well (#902) 2024-02-09 17:35:26 +01:00
ManoloFLTK
ffeaeec5bd Move FLTK_USE_SVG from config.h to FL/fl_config.h 2024-02-09 13:36:16 +01:00
Albrecht Schlosser
3895068aa1 Fix "cairo_test fails to link due to undefined's" (#902)
Restore "too much optimized" CMake code.

The issue would only be visible if neither FLTK_GRAPHICS_CAIRO nor
FLTK_BACKEND_WAYLAND was active.
2024-02-09 12:38:14 +01: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
Matthias Melcher
f0c1eff069 Fix typo in function name in editor. 2024-02-06 22:00:11 +01:00
Matthias Melcher
78ae78b118 Add dynamic title to test/editor 2024-02-06 21:25:43 +01:00
ManoloFLTK
6d98c6a8b1
Restore 3-way close window dialog (#900) 2024-02-06 20:27:18 +01:00
Matthias Melcher
d9612e3cc7
RFC: Different approach to Editor tutorial (see #189) (#883)
Update test/editor code and tutorial (#189, #883)

Different, sequential approach to Editor tutorial
Co-authored-by: Albrecht Schlosser <albrechts.fltk@online.de>
2024-01-29 11:43:34 +01:00
Matthias Melcher
554bccbecd Synchronize mouse and keyboard callbacks for Fl_Button (#877)
Keyboard behavior for button types was not consistent with mouse
click behavior. This change avoids callbacks when pressed radio buttons
are pressed again.
2024-01-17 20:24:47 +01:00
ManoloFLTK
8679be8561 Restore correct copyright window for checkers demo 2024-01-15 17:28:25 +01:00
Greg Ercolano
dc70a04100 Add Fl_String not-equal test 2024-01-10 21:32:02 -08:00
Albrecht Schlosser
b4697c33ff Remove Fl_Simple_Terminal (replaced by Fl_Terminal)
... as discussed previously.
2024-01-06 18:29:25 +01:00
Greg Ercolano
04bf5c5a34 Limit test/terminal window size
Prevents window from squishing buttons horizontally.
Allows tty height to shrink to no less than a single line.
2024-01-03 23:08:18 -08:00
Matthias Melcher
a09c75e9bc Adds Fl_Input RMB menu translation to test/preferences
This also updates the RMB menu labels before every popup so
that changing the labels after creating the widgets still reflects
that change correctly.
2023-12-28 15:43:21 +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
Albrecht Schlosser
05687d1cb4 Fix typos, formatting, and text alignment in test/forms.cxx
no real code changes
2023-12-19 19:21:39 +01:00
Albrecht Schlosser
855a50a5f6 Fix MSVC compiler warning 2023-12-17 18:05:36 +01:00
Matthias Melcher
469d3ef3d5 #842: Enables command line color arguments on macOS 2023-12-16 21:59:43 +01:00
Matthias Melcher
04a5098a58 #840: Generously adds Fl::args_to_utf8() for MinGW support. 2023-12-15 13:04:57 +01:00
Matthias Melcher
33d0718756 FLUID: option to show terminal, clear terminal, and clear history 2023-12-14 19:40:34 +01:00
ManoloFLTK
3e61ec7044 New member function Fl_Image_Surface::mask(Fl_RGB_Image*) 2023-12-04 12:34:44 +01: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
Albrecht Schlosser
a0e4a3fd5d Minor fixes and window size_range in new test/tile.cxx
Also add comments to clarify what "old" and "new" code is,respectively.
2023-11-29 14:42:06 +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
Matthias Melcher
34ed30fe1a Adds linespacing() to Fl_Browser_ and all derived widgets 2023-11-25 18:20:08 +01:00
Matthias Melcher
0beab855a0 Stabilizes Fl_Tile size_range mode.
- improved documentation
- new tile resize strategy
- robust against zero sized children
2023-11-23 17:19:20 +01: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
c568056244 Added output_translate(): controls lf -> crlf translation 2023-11-21 11:24:27 -08:00
Albrecht Schlosser
8b352987f6 Fix compiler warning
"extended initializer lists only available with ‘-std=c++11’ ..."
2023-11-19 19:46:36 +01:00
Albrecht Schlosser
9eaf40dd13 Small improvements of test/grid_dialog.cxx 2023-11-18 19:38:18 +01:00
Albrecht Schlosser
f19f94d284 Add Fl_Grid based dialog demo program - part 2
Add forgotten source file.
2023-11-18 18:43:54 +01:00
Albrecht Schlosser
efe3ea7115 Add Fl_Grid based dialog demo program
This is a new test program for Fl_Grid based layout and a proof of
concept for a future dialog class based on Fl_Grid.
2023-11-18 18:37:55 +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
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
ed7c2f1464 Fixes test/terminal box type 2023-11-15 16:46:10 +01:00
Matthias Melcher
d5a9be6b5e Uses the correct Fl_Terminal type in terminal.fl as well 2023-11-15 15:59:34 +01:00
Matthias Melcher
fc03d304e7 FLUID: fixing test/valuator.fl and test/tree.fl
Using Fl_Terminal widget instead of subclassing from Fl_Group
2023-11-15 15:48:22 +01:00
Greg Ercolano
605328e045 Added textcolor() and color(), doc fixes.
textcolor() needed for consistency, color() behavior documented.

Both added to the test/terminal app.

Elaborated on the special background "see through" color value + behavior,
tested with color() in test/terminal app.
2023-11-14 12:23:23 -08:00
Albrecht Schlosser
155909ec30 Fix compiler warning (suggest-override) 2023-11-14 19:02:08 +01:00
Albrecht Schlosser
4b315d190c Fix dependencies and whitespace issues 2023-11-14 18:14:48 +01:00
erco77
6842a43a31
Fl_Terminal widget (#800)
Pull Fl_Terminal widget from Greg's fork
2023-11-14 07:01:52 -08:00
ManoloFLTK
0ae927a00e Add Fl_Window::maximize() and Fl_Window::un_maximize() 2023-11-05 19:42:55 +01:00
Albrecht Schlosser
d9798d2840 CMake: Refactor building OpenGL and "shared" demo programs
Define GLDEMO_LIBS and GLDEMO_SHARED: these definitions can be used
  to build OpenGL demo programs that can also be built w/o OpenGL

Examples: fullscreen, handle_events, unittests
2023-11-03 15:40:58 +01:00
Albrecht Schlosser
566f3634f9 Fix compiler warning when fullscreen demo is built w/o OpenGL
Warning: -Wsuggest-override
2023-11-03 15:34:23 +01:00
Albrecht Schlosser
1209e9dcd7 Make Fl_String and Fl_Int_Vector private (#789)
- add CMake option 'OPTION_USE_STD'
- add configure option '--enable-use_std'
- move FL/Fl_String.H to src/Fl_String.H
- move FL/Fl_Int_Vector.H to src/Fl_Int_Vector.H
- remove Fl_String from demo program examples/callbacks.cxx
- remove Fl_Int_Vector from public header FL/Fl_Table.H
- some methods of Fl_Table are no longer inline
- add CMake option OPTION_USE_STD to allow std::string in some
  selected functions and methods

Experimental, may be removed before release:

- use either Fl_Int_Vector or std::vector in Fl_Table depending
  on CMake OPTION_USE_STD or configure --enable-use_std

Move all fl_filename* functions that use Fl_String to fluid

Main changes in fluid:
 - add fluid_filename.h and .cxx
 - include "fluid_filename.h" rather than <FL/filename.H>

Update fl_input(), fl_password() and test/ask

- add maxchar parameter to fl_input() and fl_password()
- fl_input_str() and fl_password_str() are optional and return
  std::string if enabled (FLTK_USE_STD)
2023-10-22 19:35:17 +02:00
Matthias Melcher
bbf0ea664d Removes dependency on Fl_Preferences::get/set(.., Fl_String, ...) 2023-10-21 18:41:57 +02:00
Albrecht Schlosser
757b5c1227 Fix ctrl/+/- in cube demo
- Fl_Grid: force layout() on resize() - needed for GL subwindows

- test/cube.cxx:
  - use end() in constructor of class cube_box
  - ensure not to change the current group when adding a button
2023-10-20 11:28:08 +02:00
Albrecht Schlosser
38871c5b31 Add Fl_Grid widget and test and demo programs
- FL/Fl_Grid.H: header file
- src/Fl_Grid.cxx: implementation

- examples/grid-simple.cxx: simple example program
- test/cube.cxx:            use Fl_Grid for layout
- test/grid_alignment.cxx:  test cell alignment and other functions
- test/grid_buttons.cxx:    demo program as discussed in fltk.general
- test/grid_login.cxx:      like test/flex_login.cxx but with Fl_Grid
- test/flex_login.cxx:      modified to match test/grid_login.cxx
2023-10-16 22:18:24 +02:00
Albrecht Schlosser
7e71cea54a Update .gitignore files
Add missing executables
2023-10-16 21:10:27 +02:00
Albrecht Schlosser
6ba7b49baf Improve subclassing cababilities of Fl_Tile (STR 2791)
- remove static variables and functions
- make move_intersection() virtual
- add (protected) cursor access methods

These changes were inspired by STR 2791 where the user proposing an
enhancement was not able to subclass Fl_Tile properly. This commit
fixes the mentioned issues and enables subclassing without copying
internal code.
2023-10-16 13:33:40 +02:00
Albrecht Schlosser
01038e832a Fix trailing whitespace and dependencies 2023-10-13 19:08:30 +02:00
Matthias Melcher
0af27f6fda test/menubar: use popup menu default boxtype 2023-10-13 12:11:16 +02:00
Albrecht Schlosser
1fd6f0dd3a Fix STR 3458: "GLUT compatibility mode segfaults"
... "when there's no current window".

Silently ignore GLUT function calls that need a current window if the
current window is NULL, return 0 from functions that return an 'int'.

Check if window is shown in Fl_X11_Gl_Window_Driver::swap_buffers().
This would issue "XRequest.nnn: GLXBadDrawable 0x0" on X11 otherwise.

Note: the chosen implementation to ignore GLUT calls silently appears
to be compatible with GLUT (3.7) whereas FreeGLUT 3.0 would issue error
messages and exit. The latter could be implemented as well but would
be much more work.
2023-10-07 17:14:11 +02:00
Matthias Melcher
f3eae58c52 Draw parent window backdrop on Fl_Tabs (#718) 2023-09-29 14:12:39 +02:00
Matthias Melcher
71b8e77935
FLUID: adds greatly enhanced Shell Commands (#774)
The user can add an arbitrary number of highly configurable 
shell commands through the setting panel. The commands can
be saved as user preferences, inside the .fl file, or exported
to an external file. Shell scripts can be limited to individual 
platforms, can have shortcut keys, etc. .

* documentation will follow
* support to call `fltk-config` will follow
2023-09-26 16:01:03 +02:00
Matthias Melcher
0a2f05a2fe FLUID: Fixes regression #777
Wrote wrong path in #inlude statement under certain
conditions. Also removed 'snap' tag if not needed.
2023-09-26 00:29:26 +02:00
Albrecht Schlosser
226a4ea784 Fix potential invalid stack variable access in test code
This code was (and is still) commented out but it *would* trigger
a "stack buffer overflow" error *if* uncommented.

The new code demonstrates how a binary object (Fl_Preferences 'bed')
can be dumped to a preferences file in binary format (if activated).
2023-09-22 14:03:34 +02:00
Albrecht Schlosser
43ff6f0c32 Update dependencies 2023-09-22 14:03:34 +02:00
Albrecht Schlosser
ede381c005 Fix Visual Studio shared library build
Todo: fluid-shared can't (yet) be built agains the shared fltk lib
  because of some linker errors. Needs investigation.

Note: fluid-shared is basically a test program to demonstrate linking
  against the shared FLTK libs but doesn't work yet using VS (MSVC).
  This is no problem for the functionality.
2023-09-12 23:18:46 +02:00
Albrecht Schlosser
e44a988c4a Fix unittest object file list in test/Makefile (#683) 2023-09-08 15:30:06 +02:00
Matthias Melcher
6bb5a81cee Adds some convenience methods.
fl_filename_absolute can no generate a path using arbitrary source paths.
Fl_Menu_ adds find_item_with_user_data and find_item_with_argument
Fl_String adds find(string, start)
2023-09-05 14:45:57 +02:00
Matthias Melcher
5e8adebac2 Adds compact buttons feature to create keypads.
See test/buttons for an example.
2023-09-03 00:09:40 +02:00
Matthias Melcher
92ac709b7e Adds safe versions of fl_filename_*, returning Fl_String 2023-08-26 16:48:28 +02:00
ManoloFLTK
754340e101 macOS audio is usable with XQuartz 2023-08-16 11:18:19 +02:00
ManoloFLTK
4aae2d1224 Allow build of sudoku app with macOS + XQuartz 2023-08-16 10:27:41 +02:00
Matthias Melcher
e8b378302c Undoing previous changes 2023-08-15 22:59:07 +02:00
Matthias Melcher
3b093e895b Lot's of changes, must rethink UI. 2023-08-15 17:09:51 +02:00
Matthias Melcher
af22676abf Missing includes 2023-08-15 17:09:51 +02:00
Matthias Melcher
0de186e614 Sudoku into smaller pieces. 2023-08-15 17:09:51 +02:00
Matthias Melcher
a1b55385e3 Random testing and fixing. 2023-08-15 17:09:51 +02:00
Matthias Melcher
d27188198a Removed unused code 2023-08-15 17:09:51 +02:00
Matthias Melcher
0c8083a06d Adding generator 2023-08-15 17:09:51 +02:00
Matthias Melcher
10d9010ed9
Improved, yet compatible, widget callback system using macros (#729)
* adds FL/fl_callback.macros.H
* adds FL_FUNCTION_CALLBACK_n(widget, function, [type, data])
* adds FL_METHOD_CALLBACK_n(widget, class, instance, method, [type, data])
* adds FL_INLINE_CALLBACK_n(widget, [type, name, data], callback_body)
* adds `examples/callback`
* full documentation
2023-08-15 11:36:58 +02:00
Matthias Melcher
5e484524c8 Fl_Tabs now supports horizontal mouse wheel events. 2023-08-13 14:32:41 +02:00
Albrecht Schlosser
5bcd6ca8f2 Revert "#733 partial: Adds rotation gesture event on MacOS"
This reverts commit 3049e6394a
as agreed upon in GitHub Issue #733.
2023-08-05 16:37:38 +02:00
Matthias Melcher
3049e6394a #733 partial: Adds rotation gesture event on MacOS 2023-08-05 12:19:42 +02:00
Albrecht Schlosser
4ec02555ef Fix missing (new) source file in fluid and dependencies
New file: Fl_Button_Type.cxx
2023-07-19 23:42:50 +02:00
Matthias Melcher
e8eccde8db FLUID: RTTI improvements, 'is_a90' now const, apply RTTI 2023-07-19 20:42:08 +02:00
Matthias Melcher
5d69828ed0 FLUID: fixes all overlapping widgets in all .fl files
Also fixes an issue with multiple use of the same variable
for different types of i18n.
2023-07-14 23:42:17 +02:00
Albrecht Schlosser
03913f32e0 Display mouse button state in test/handle_events.cxx demo
See fltk.general, thread "Is handling simultaneous Left-click and
  Right-click drags supported?" from Jul 12, 2023

Status: FL_DRAG operation is terminated when one mouse button is
  released, even if more than one button is actually down. Subsequent
  mouse movement is reported as FL_MOVE rather than FL_DRAG, this is
  under investigation.
2023-07-12 19:32:02 +02:00
ManoloFLTK
4fb18ffbdd Fix "Provide --without-fluid configure option" - cont'd (#725) 2023-05-10 14:41:48 +02:00
ManoloFLTK
fe0fcecd61 Fix "Provide --without-fluid configure option " (#725)
Add new --disable-fluid configure option.
2023-05-09 16:19:12 +02:00
Albrecht Schlosser
ac7b55d8bb Fix some but not all memory leaks in test/utf8 demo
Note: Fl_Input::value() copies the string to an internal buffer,
  fl_strdup() before value() is not necessary.
2023-05-08 16:26:07 +02:00
ManoloFLTK
4768ebaf8b test/utf8: improve use of Fl::set_fonts(const char *) across platforms 2023-04-14 08:58:16 +02:00
Albrecht Schlosser
4769e0085d Fix more compiler warnings (comma at end of enum)
These warnings are benign but ... I fixed them nevertheless.
2023-04-13 22:55:18 +02:00
ManoloFLTK
00b82b287c Add usage example of Fl_Window::cursor(const Fl_RGB_Image *, int, int) 2023-04-08 21:23:43 +02:00