Commit Graph

9066 Commits

Author SHA1 Message Date
ManoloFLTK e5b5189870 Add support of macOS 11.0 "Big Sur". 2020-08-10 07:31:50 +02:00
Greg Ercolano 0da41da713 Allow unix style paths for windows native filechooser
Allows and preserves unix style paths if user specifies them,
otherwise uses Windows style. This allows end users to use either
style path and get behavior they expect in cross-platform environments.

Addresses problems raised by issue #122
2020-08-08 19:10:57 -07:00
Greg Ercolano b105dd726f Error string that was created is now saved with errmsg() 2020-08-07 16:29:52 -07:00
Albrecht Schlosser 91e8a0282c Remove useless 'if (...)'
- dasharray_ can never be NULL unless if memory allocation failed
  previously
- if dasharray_ was NULL, the previous strcmp() would have crashed
  anyway (but it can't be NULL, see above)
2020-08-05 14:34:45 +02:00
ManoloFLTK 5b1c7249a5 Remove memory leak. 2020-08-04 11:06:59 +02:00
ManoloFLTK 81941c5597 Remove useless Fl_GDI_Graphics_Driver::reset_spot() 2020-08-03 17:32:09 +02:00
Albrecht Schlosser 4d0b04456e Update dependencies + fluid/generated files 2020-08-03 13:03:14 +02:00
Greg Ercolano 3d18d325f6 Commiting fluid generated template_panel.h as per issue #116
Regarding this comment thread:
https://github.com/fltk/fltk/pull/116#discussion_r458517450
2020-08-02 10:56:40 -07:00
erco77 7abc09ad89
Merge pull request #116 from erco77/fl_strdup
fl_strdup() implemented + deployed
2020-08-01 14:35:44 -07:00
Greg Ercolano e9688822ec Convert example from strdup -> std::string 2020-08-01 14:19:40 -07:00
Greg Ercolano b409588012 Remove unneeded strdup from example, fold tabs 2020-08-01 14:19:40 -07:00
Greg Ercolano 2141c63628 Implement + deploy fl_strdup() 2020-08-01 14:19:40 -07:00
Greg Ercolano 7514a73ba7 Solves issue #117, memcmp -> strncmp
Closes #117.
2020-07-31 07:00:46 -07:00
ManoloFLTK 889acc7d74 Fix use of an SVG image in Fl_Tiled_Image when display is rescaled. 2020-07-30 17:41:35 +02:00
ManoloFLTK f9bdb5a4db Documentation: complete the inheritance diagram from class Fl_Surface_Device. 2020-07-29 19:54:57 +02:00
ManoloFLTK 41a6ade72b Fix for issue #119. Drawing artefacts for SVG images without XRender.
Xlib: Drawing SVG images in scaled mode without XRender has drawing artefacts.
2020-07-28 17:57:39 +02:00
ManoloFLTK b40e218c01 Fix for "Crashing regression in MacOS code" in fltk.coredev. 2020-07-27 17:04:27 +02:00
ManoloFLTK e3270a6032 Simpler macOS-specific code in main(). 2020-07-25 12:43:43 +02:00
Albrecht Schlosser bfb3b3abd8 Remove typedefs Fl_String and Fl_CString
These unused typedefs are not used anywhere and should not be defined
at all.

Remove typedef 'Fl_String' as decided in fltk.coredev.
Remove typedef 'Fl_CString' as well for the same reason.
2020-07-24 20:12:06 +02:00
ManoloFLTK 5839817c51 Fix problem when calling Fl_Window::fullscreen_off() in certain circumstances.
The problem was discovered in fltk.coredev "Crashing regression in MacOS code"
2020-07-24 18:41:53 +02:00
Albrecht Schlosser 118c67c804 Git-ignore resize-example* test programs 2020-07-23 12:46:02 +02:00
ManoloFLTK e2d3b03899 Simpler macOS-specific code. 2020-07-23 09:24:29 +02:00
ManoloFLTK 5fa367c2cf Fix for issue #50: usage in plugins on Linux. 2020-07-23 09:07:55 +02:00
Albrecht Schlosser 332003cd13 Create macOS "bundle wrapper" scripts (#115)
These scripts must be installed side by side with the bundle with the
same name and run the executable inside the bundle when executed.
2020-07-23 02:07:43 +02:00
Albrecht Schlosser f357f4311c Use local images in test/help_dialog(.html)
- create subdir test/images
- copy images used by test/help_dialog to this subdir
- fix image URL's in test/help_dialog.html accordingly

CMake: copy the entire test/images folder to the <build>/data folder

This enables the demo test/help_dialog.cxx to find its images.
2020-07-23 01:53:24 +02:00
Albrecht Schlosser 0015e64671 macOS: don't add resource files to demo.app
Resources like demo.menu and help_dialog.html are no longer read
from the bundle directory on macOS. They are read from the build
folder build/data or in case of classic autoconf/make builds from
the source directory. We don't need to copy the files into the
bundle folder, they are copied to the build/data folder on all
platforms anyway.
2020-07-22 23:36:20 +02:00
Albrecht Schlosser b2ad5e4cfd
Merge pull request #111 - refactor test/demo.cxx
Simplify, clarify and fix bugs in test/demo.cxx

As discussed and confirmed test/demo.cxx works now in all known and
supported build systems.
2020-07-21 22:46:48 +02:00
Albrecht Schlosser 4957dd48c2 Fix macOS code + remove obsolete code
Albrecht:

- move fl_chdir(data_path) up before fl_getcwd() prints it
- add statements to open the argument (i.e. file) with data_path
- update comments, remove obsolete code

Greg:

- on Mac we need absolute path for child filename parameters
2020-07-21 11:41:37 +02:00
Greg Ercolano 889ab64962 Add Fl_Simple_Terminal for cross platform debugging 2020-07-21 11:11:03 +02:00
Albrecht Schlosser af7f485e06 Consolidate test/demo for all build systems
This is an attempt to unify the code for all build systems (CMake,
autotools with make), platforms (operating systems) and toolchains
(make + gcc/clang, Visual Studio IDE, Xcode ...) to avoid duplicate
code and clarify the differences for future devs and to simplify
maintenance.

The goal is to minimize the platform specific code.

Much of the new code are comments to describe the different situations.
The main program does now all the "hard work" to construct the paths
necessary to access the other applications and data files.

Use macOS specific code to determine the application path (app_path)
in main() instead of function dobut(), when test apps are activated.

Remove obsolete comments and dead code.

Tested on Windows and Linux with both autotools/configure/make
and CMake with make (Linux + MinGW), Visual Studio.
2020-07-21 11:11:03 +02:00
Albrecht Schlosser 11dec24ccf Add missing driver folder to Makefile (clean) 2020-07-20 14:23:17 +02:00
Duncan Gibson c132ac564e add resize examples as per STR3433
add example code for creating images for resize.dox
based on Article #415: How does resizing work?
https://www.fltk.org/articles.php?L415

see also https://www.fltk.org/str.php?L3433
2020-07-20 14:08:47 +02:00
Albrecht Schlosser 4858882e1e CMake: simplify create_example macro
- move target (demo) specific code from macro to CMakeLists.txt
- refactor macOS specific code for a cleaner structure
- improve documentation

Note: CMake ignores platform specific code like creating bundles on
other platforms, hence the entire code could be simplified (less
conditional code)
2020-07-20 11:02:01 +02:00
Albrecht Schlosser df683013d2 Restore tabs in html test file
These tabs were intentional and had been replaced with spaces
in the big whitespace fix.

This file is an exception!
2020-07-20 10:32:59 +02:00
Albrecht Schlosser 1657654377 CMake: fix FLTK_RUN_FLUID macro
The target variable should be set outside of the loop.
2020-07-20 10:19:47 +02:00
Albrecht Schlosser 956a3bb160 CMake: simplify copying of test and demo files 2020-07-18 16:07:30 +02:00
ManoloFLTK 3bb3429670 Restore use of virtual Fl_Window::resize() to be notified when window moves.
A previous commit c66caf5dce
"Simpler implementation of Fl_Cocoa_Window_Driver::resize()"
made that Fl_Window::resize() was no longer called by FLTK when a
window is moved. This prevented the undocumented practice of
re-implementing the virtual function Fl_Window::resize() and use it
as a way to get a notification that a window was moved.
2020-07-17 15:08:33 +02:00
Albrecht Schlosser a0638273c8 Documentation: update clock demo images
One of the images was cut off at the top or bottom.
Added window decoration with title, used a bright blue background.
2020-07-16 14:27:44 +02:00
Albrecht Schlosser c380a91361 Windows: add icon to sudoku.exe (PR #36)
The changes proposed by Tadej Panjtar (tpanj) were obsolete WRT
current Git repo. Thanks to tpanj anyway, I did also apply the
simplifications of sudoku.rc.
2020-07-16 12:25:51 +02:00
Duncan Gibson 46c1500bf3 fix doxygen links in Fl_Group.H
fix dead links to Fl_Group::resizable(Fl_Box *box)
reorder paragraphs to highlight different behaviour
add link to new "How does resizing work?" chapter in dox
2020-07-15 19:43:21 +02:00
ManoloFLTK 13c1923b2a Restore file icons to 3 macOS test apps who have one 2020-07-15 17:06:05 +02:00
Albrecht Schlosser 720b84ef9d CMake: refactor and reformat CMake files
- raise minimum CMake version from 2.6.3 to 3.2.3 (Jun 01, 2015)
- indent all CMake files according to the CMP (2 col.)
- refactor FLTK version number definitions and usage
- unify CMake and autoconf/configure variable names:
  - FL_VERSION -> FLTK_VERSION
  - FL_MAJOR_VERSION -> FLTK_VERSION_MAJOR
  - etc. for _MINOR_ and _PATCH_, respectively
  - note: this does not affect FL_VERSION etc. in source code
- generate "export headers" for all libraries (experimental: OFF)
- port some forgotten goodies from branch-1.3 to master
- merge and improve macro 'create_example' (WIP)
- remove "temporary" options and code for older CMake versions
- include and use 'GenerateExportHeader' (experimental, WIP: OFF)
  - note: created header files are not yet used
- build only *one* DLL with Visual Studio (tested, works)
  - similar to the bundled IDE projects in 1.3.x
- add some dynamically linked test/demo programs ('*-shared')
  if shared libraries are built (WIP)
- split 'macros.cmake': use one file per macro
2020-07-15 00:34:53 +02:00
Greg Ercolano 5442503077 Merge branch 'issue-99a': add OS error messages to Fl_File_Chooser
Pulling in Greg & Albrecht's work on PR #99 and PR #103.

This includes supporting operating system error messages
in the user's local language, which took some extra effort.
2020-07-14 11:34:18 -07:00
Albrecht Schlosser 58296c373a Fix old URL's and forum/newsgroup names
- fltk.development has been renamed to fltk.coredev
- all FLTK URL's are now of the form https://www.fltk.org/
2020-07-14 15:16:05 +02:00
Greg Ercolano da76085fe7 Import Albrecht's utf8 mods for FormatMessage() to fluid
Amended by Albrecht:
 - fix comments
 - add setlocale() to fluid

Note: the latter is also necessary to honor locale in GTK filechooser.
2020-07-14 13:14:37 +02:00
Albrecht Schlosser 845224f475 Windows: convert error message to UTF-8
We need to get the error message in "wide character" format and
convert it to UTF-8. The conversion would truncate it if the
buffer was too small, hence we don't need to check for overflow.

Tested on Windows 10 with VS 2010, including (faked) error codes with
non-ASCII characters (German).
2020-07-14 12:52:56 +02:00
Greg Ercolano 7426e762a4 setlocale() added to Fl_File_Chooser demos
This change ensures errors in local language.
See issue #99 for discussion on why this is needed.
2020-07-14 12:52:56 +02:00
Greg Ercolano 4471166f59 Extra fool-proofing, and suggested use of strerror_r()
strerror_r() sounds like the better thing to use, but if you
read the man page carefully, there are pitfalls of competing
GNU vs POSIX versions of the same function, with different
return values.

GNU version returns a pointer to the error string, which may
or may not use the error string supplied to use. Makes no sense.
Why not use the buffer the user prepared? Makes returning errors hard.
One thing GNU does underline is the string is always NUL terminated.

POSIX version doesn't return a string at all, it returns an int,
making handling the GNU cases impossible. POSIX /doesn't/ say
one way or the other about the string being NUL terminated, so
you have to make sure when you use it.

I trawled the net, seems this is a big annoying issue.
For now, leaving the code with strerror(), but we should change it.
2020-07-14 12:52:56 +02:00
Greg Ercolano 0693c70f57 First pass at fixing issue 99
A lot of code touched because low level functions needed to pass up
error messages reliably, and this had to propagate up the entire
driver hierarchy.

Tested OK *in English* on:
     > Linux
     > OSX 10.10.x
     > Windows VS2017
     > Windows mingw64
I have no way to test on Android, but it might work.

TODO: Needs testing in other languages to verify proper UTF8 error messages,
      esp. with Windows VS, due to complexities with FormatMessage() -- see get_ms_errmsg()
2020-07-14 12:52:56 +02:00
Duncan Gibson 7038559338 add resize documentation as per STR3433
add resize chapter to documentation, plus images,
based on Article #415: How does resizing work?
https://www.fltk.org/articles.php?L415

see also https://www.fltk.org/str.php?L3433
2020-07-13 23:12:54 +02:00