Move global FLTK options into new app fltk-admin (#560)

This commit is contained in:
Matthias Melcher 2023-01-21 17:14:41 +01:00 committed by GitHub
parent 4ddcbc81de
commit 1fc269b0d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 1465 additions and 828 deletions

View File

@ -125,6 +125,9 @@ if (UNIX OR MSYS OR MINGW)
if (FLTK_BUILD_FLUID)
INSTALL_MAN (fluid 1)
endif (FLTK_BUILD_FLUID)
if (FLTK_BUILD_FLTK_OPTIONS)
INSTALL_MAN (fltk-options 1)
endif (FLTK_BUILD_FLTK_OPTIONS)
INSTALL_MAN (fltk-config 1)
INSTALL_MAN (fltk 3)

View File

@ -360,9 +360,10 @@ option (OPTION_BUILD_SHARED_LIBS
option (OPTION_PRINT_SUPPORT "allow print support" ON)
option (OPTION_FILESYSTEM_SUPPORT "allow file system support" ON)
option (FLTK_BUILD_FLUID "Build FLUID" ON)
option (FLTK_BUILD_TEST "Build test/demo programs" ON)
option (FLTK_BUILD_EXAMPLES "Build example programs" OFF)
option (FLTK_BUILD_FLUID "Build FLUID" ON)
option (FLTK_BUILD_FLTK_OPTIONS "Build fltk-options" ON)
option (FLTK_BUILD_TEST "Build test/demo programs" ON)
option (FLTK_BUILD_EXAMPLES "Build example programs" OFF)
if (DEFINED OPTION_BUILD_EXAMPLES)
message (WARNING

View File

@ -115,6 +115,14 @@ if (FLTK_BUILD_FLUID)
add_subdirectory (fluid)
endif (FLTK_BUILD_FLUID)
#######################################################################
# build fltk-options
#######################################################################
if (FLTK_BUILD_FLTK_OPTIONS)
add_subdirectory (fltk-options)
endif (FLTK_BUILD_FLTK_OPTIONS)
#######################################################################
# variables shared by export and install
# export.cmake creates configuration files for direct use in a built but uninstalled FLTK
@ -214,9 +222,15 @@ endif ()
if (FLTK_BUILD_FLUID)
message (STATUS "FLUID will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fluid")
else ()
else ()
message (STATUS "FLUID will not be built (set FLTK_BUILD_FLUID=ON to build)")
endif ()
endif ()
if (FLTK_BUILD_FLTK_OPTIONS)
message (STATUS "fltk-options will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-options")
else ()
message (STATUS "fltk-options will not be built (set FLTK_BUILD_FLTK_OPTIONS=ON to build)")
endif ()
if (FLTK_BUILD_TEST)
message (STATUS "Test programs will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/test")

View File

@ -16,7 +16,7 @@
include makeinclude
DIRS = $(IMAGEDIRS) $(LIBDECORDIR) src $(CAIRODIR) fluid test documentation
DIRS = $(IMAGEDIRS) $(LIBDECORDIR) src $(CAIRODIR) fluid fltk-options test documentation
all: makeinclude fltk-config
for dir in $(DIRS); do\
@ -36,6 +36,7 @@ install: makeinclude
install-desktop: makeinclude
cd documentation; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
cd fluid; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
cd fltk-options; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
cd test; $(MAKE) $(MFLAGS) $(INSTALL_DESKTOP)
uninstall: makeinclude
@ -48,6 +49,7 @@ uninstall: makeinclude
uninstall-desktop: makeinclude
cd documentation; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
cd fluid; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
cd fltk-options; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
cd test; $(MAKE) $(MFLAGS) $(UNINSTALL_DESKTOP)
depend: makeinclude
@ -111,7 +113,7 @@ native-dist:
epm -v -f native fltk
etags:
etags FL/*.H FL/*.h src/*.cxx src/*.c src/*.h src/xutf8/*.h src/xutf8/*.c cairo/*.cxx fluid/*.h fluid/*.cxx test/*.h test/*.cxx
etags FL/*.H FL/*.h src/*.cxx src/*.c src/*.h src/xutf8/*.h src/xutf8/*.c cairo/*.cxx fluid/*.h fluid/*.cxx fltk-options/*.cxx test/*.h test/*.cxx
#
# Run the clang.llvm.org static code analysis tool on the C sources.

View File

@ -122,6 +122,9 @@ OPTION_BUILD_SHARED_LIBS - default OFF
FLTK_BUILD_FLUID - default ON
Builds the Fast Light User-Interface Designer ("FLUID").
FLTK_BUILD_FLTK_OPTIONS - default ON
Builds the FLTK options editor ("fltk-options").
FLTK_BUILD_TEST - default ON
Builds the test and demo programs in the 'test' directory.

View File

@ -292,6 +292,7 @@ AS_IF([test "x$enable_shared" = xyes], [
PICFLAG=1
SHAREDSUFFIX=""
FLUID="fluid-shared"
FLTK_OPTIONS="fltk-options-shared"
AS_CASE([$host_os], [darwin*], [
DSONAME="libfltk.$FL_DSO_VERSION.dylib"
@ -441,6 +442,7 @@ AS_IF([test "x$enable_shared" = xyes], [
PICFLAG=0
SHAREDSUFFIX=""
FLUID="fluid"
FLTK_OPTIONS="fltk-options"
LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a"
])
@ -467,6 +469,7 @@ AC_SUBST([SHAREDSUFFIX])
AC_SUBST([LINKSHARED])
AC_SUBST([FLUID])
AC_SUBST([FLUID_BUILD])
AC_SUBST([FLTK_OPTIONS])
dnl Find commands...

View File

@ -565,6 +565,7 @@ INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/events.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/subclassing.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/opengl.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/fluid.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/fltk-options.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/advanced.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/unicode.dox
INPUT += @FLTK_SOURCE_DIR@/FL

View File

@ -37,6 +37,7 @@ HTMLFILES = \
$(SRC_DOCDIR)/subclassing.dox \
$(SRC_DOCDIR)/opengl.dox \
$(SRC_DOCDIR)/fluid.dox \
$(SRC_DOCDIR)/fltk-options.dox \
$(SRC_DOCDIR)/advanced.dox \
$(SRC_DOCDIR)/unicode.dox \
$(SRC_DOCDIR)/enumerations.dox \
@ -51,7 +52,8 @@ HTMLFILES = \
MANPAGES = $(SRC_DOCDIR)/fltk.$(CAT3EXT) $(SRC_DOCDIR)/fltk-config.$(CAT1EXT) \
$(SRC_DOCDIR)/fluid.$(CAT1EXT) $(SRC_DOCDIR)/blocks.$(CAT6EXT) \
$(SRC_DOCDIR)/checkers.$(CAT6EXT) $(SRC_DOCDIR)/sudoku.$(CAT6EXT)
$(SRC_DOCDIR)/checkers.$(CAT6EXT) $(SRC_DOCDIR)/sudoku.$(CAT6EXT) \
$(SRC_DOCDIR)/fltk-options.$(CAT1EXT)
all: $(MANPAGES)
@ -91,11 +93,13 @@ install: $(MANPAGES)
-$(INSTALL_DIR) $(DESTDIR)$(mandir)/cat1
$(INSTALL_MAN) $(SRC_DOCDIR)/fluid.$(CAT1EXT) $(DESTDIR)$(mandir)/cat1
$(INSTALL_MAN) $(SRC_DOCDIR)/fltk-config.$(CAT1EXT) $(DESTDIR)$(mandir)/cat1
$(INSTALL_MAN) $(SRC_DOCDIR)/fltk-options.$(CAT1EXT) $(DESTDIR)$(mandir)/cat1
-$(INSTALL_DIR) $(DESTDIR)$(mandir)/cat3
$(INSTALL_MAN) $(SRC_DOCDIR)/fltk.$(CAT3EXT) $(DESTDIR)$(mandir)/cat3
-$(INSTALL_DIR) $(DESTDIR)$(mandir)/man1
$(INSTALL_MAN) $(SRC_DOCDIR)/fluid.man $(DESTDIR)$(mandir)/man1/fluid.1
$(INSTALL_MAN) $(SRC_DOCDIR)/fltk-config.man $(DESTDIR)$(mandir)/man1/fltk-config.1
$(INSTALL_MAN) $(SRC_DOCDIR)/fltk-options.man $(DESTDIR)$(mandir)/man1/fltk-options.1
-$(INSTALL_DIR) $(DESTDIR)$(mandir)/man3
$(INSTALL_MAN) $(SRC_DOCDIR)/fltk.man $(DESTDIR)$(mandir)/man3/fltk.3
@ -116,6 +120,8 @@ uninstall:
$(RM) $(DESTDIR)$(mandir)/man1/fluid.1
$(RM) $(DESTDIR)$(mandir)/cat1/fltk-config.$(CAT1EXT)
$(RM) $(DESTDIR)$(mandir)/man1/fltk-config.1
$(RM) $(DESTDIR)$(mandir)/cat1/fltk-options.$(CAT1EXT)
$(RM) $(DESTDIR)$(mandir)/man1/fltk-options.1
$(RM) $(DESTDIR)$(mandir)/cat3/fltk.$(CAT3EXT)
$(RM) $(DESTDIR)$(mandir)/man3/fltk.3

View File

@ -425,9 +425,9 @@ Fl::thread_message().
<table summary="navigation bar" width="100%" border="0">
<tr>
<td width="45%" align="LEFT">
<a class="el" href="fluid.html">
<a class="el" href="fltk-options.html">
[Prev]
Programming with FLUID
FLTK Runtime Options
</a>
</td>
<td width="10%" align="CENTER">

View File

@ -81,7 +81,7 @@ Enables image file support.
.br
Displays the current FLTK version number, e.g. "1.1.0".
.SH SEE ALSO
fluid(1), fltk(3)
fluid(1), fltk-options(1), fltk(3)
.br
FLTK Programming Manual
.br

View File

@ -0,0 +1,85 @@
/**
\page fltk-options FLTK Runtime Options
In this chapter, we will cover how to access and alter settings for
applications created using FLTK, both as an administrator and as
a regular user.
Subchapters:
\li \ref fltk-options_basics
\li \ref fltk-options_access
\li \ref fltk-options_app
\li \ref fltk-options_options
\section fltk-options_basics Runtime Options
FLTK keeps track of various aspects of the user interface in a system-wide
database. Users have the ability to set their own preferences and override
default or system settings. For instance, FLTK will display a dotted
rectangle around the widget with current focus. This might not be desirable
for users who do not use keyboard navigation and do not need the rectangle.
This can be turned off by setting the OPTION_VISIBLE_FOCUS option to 'off'
for that user, which will disable the focus rectangle in all FLTK-based
applications.
\section fltk-options_access Obtaining Current Settings
Options are kept in preference files using the signature
`Fl_Preferences::CORE_SYSTEM, "fltk.org", "fltk"` for system-wide settings
and `Fl_Preferences::CORE_USER, "fltk.org", "fltk"` for individual users.
They can be accessed by using the function `bool Fl::option(Fl_Option opt)`.
If an application needs to temporarily override user or system settings,
it can use the function `void option(Fl_Option opt, bool val)`.
To make changes to options permanently, FLTK provides an administrative
tool called fltk-options.
\section fltk-options_app Administrative Tool
`fltk-options` is a hybrid app that is part of FLTK and can be installed on
the target system. It includes an up-to-date man page.
When fltk-options is called without any command-line arguments, it opens in
interactive mode and provides a user interface to view and alter all
system and current user options.
Starting the tool from a shell, the command-line options `-S` and `-U` can be
used to display or change system or user options. On MS-Windows, `fltk-options`
is also available as `fltk-options-cmd.exe`.
\section fltk-options_options List of Options
Calling `fltk-options --help` gives a list of all available commands, and
options and their values. `fltk-options --help OPTION` prints more detailed
information for OPTION if available. In interactive mode, tooltips provide
this additional information.
A full list of options can be found in the maunal at \ref Fl_Option .
\htmlonly
<hr>
<table summary="navigation bar" width="100%" border="0">
<tr>
<td width="45%" align="LEFT">
<a class="el" href="fluid.html">
[Prev]
Programming with FLUID
</a>
</td>
<td width="10%" align="CENTER">
<a class="el" href="index.html">[Index]</a>
</td>
<td width="45%" align="RIGHT">
<a class="el" href="advanced.html">
Advanced FLTK
[Next]
</a>
</td>
</tr>
</table>
\endhtmlonly
*/

View File

@ -0,0 +1,98 @@
.TH fltk\-options 1 "Fast Light Tool Kit" "13. January 2023"
.SH NAME
fltk\-options \- application to get and modify FLTK runtime options.
.sp
.SH SYNOPSIS
fltk\-options
[ \-S\fIoption[=value]\fR ]
[ \-U\fIoption[=value]\fR ]
[ \-L ]
[ \-LS ]
[ \-LU ]
[ \-f ]
[ \-v ] [ \-\-verbose ]
[ \-h[option] ] [ \-\-help [option] ]
.SH DESCRIPTION
\fIfltk\-options\fR is a tool that allows you to access and change settings
related to the user interface in applications built with FLTK. These settings
will be applied when the program is launched. They can be set at the system
level or by the individual user. User settings take precedence
over system settings.
.LP
The following command line arguments are supported:
.TP 5
\-S\fIoption[=value]\fR
.br
Change or print system wide option.
.TP 5
\-U\fIoption[=value]\fR
.br
Change or print user option. Values can be "0" or "OFF" to clear,
or "1" or "ON" to set the option. The value "-1" or "DEFAULT" sets
the option to its default value.
If no value is given, the current setting is returned as "-1", "0", or "1".
.TP 5
\-L
.br
List the value of all options.
.TP 5
\-LS
.br
List the value of all system options.
.TP 5
\-LU
.br
List the value of all user options.
.TP 5
\-f
.br
Suppress error messages concerning file access permissions.
.TP 5
\-v, \-\-verbose
.br
Print additional information in command line mode.
.TP 5
\-h[option], \-\-help [option]
.br
Prints a help page. If an option is give, print detailed information
for that option.
.LP
The following FLTK options are supported:
.TP 5
OPTION_VISIBLE_FOCUS
.br
Draw a dotted rectangle in widget with keyboard focus.
.TP 5
OPTION_ARROW_FOCUS
.br
Arrow keys will move focus beyond text input field.
.TP 5
OPTION_SHOW_TOOLTIPS
.br
Show or hide tooltips.
.TP 5
OPTION_DND_TEXT
.br
User can drag text from FLTK into other apps.
.TP 5
OPTION_FNFC_USES_GTK
.br
Use GTK file chooser instead of FLTK if available.
.TP 5
OPTION_PRINTER_USES_GTK
.br
Use GTK printer dialog instead of FLTK if available.
.TP 5
OPTION_SHOW_SCALING
.br
Show the zoom factor in a transient popup window.
.LP
Calling fltk-options without options will launch fltk-options interactive mode.
.SH SEE ALSO
fluid(1), fltk-config(1), fltk(3)
.br
FLTK Programming Manual
.br
FLTK Web Site, https://www.fltk.org/
.SH AUTHORS
Bill Spitzak and others.

View File

@ -1694,8 +1694,8 @@ On Apple computers, use the Apple Command key instead of Ctrl.
<a class="el" href="index.html">[Index]</a>
</td>
<td width="45%" align="RIGHT">
<a class="el" href="advanced.html">
Advanced FLTK
<a class="el" href="fltk-options.html">
FLTK Runtime Options
[Next]
</a>
</td>

View File

@ -72,6 +72,8 @@
- \ref fluid_selecting_moving
- \ref fluid_images
\subpage fltk-options
\subpage advanced
\subpage unicode

View File

@ -31,6 +31,7 @@ This manual is organized into the following chapters and appendices:
\li \ref subclassing
\li \ref opengl
\li \ref fluid
\li \ref fltk-options
\li \ref advanced
\li \ref unicode
\li \ref enumerations

141
fltk-options/CMakeLists.txt Normal file
View File

@ -0,0 +1,141 @@
#
# CMakeLists.txt to build fltk-options for the FLTK project using CMake (www.cmake.org)
#
# Copyright 2023 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
# file is missing or damaged, see the license at:
#
# https://www.fltk.org/COPYING.php
#
# Please see the following page on how to report bugs and issues:
#
# https://www.fltk.org/bugs.php
#
set (CPPFILES
fltk-options.cxx
)
set (HEADERFILES
)
set (FLTK_OPTIONS_TARGETS fltk-options) # fltk-options and optional fltk-options-cmd target
set (FLTK_OPTIONS_LIBS fltk) # libraries used to link fltk-options executables
if (APPLE AND (NOT OPTION_APPLE_X11))
# macOS
set (ICON_NAME fltk-options.icns)
set (ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/icons/${ICON_NAME}")
add_executable (fltk-options MACOSX_BUNDLE ${CPPFILES} ${HEADERFILES} ${ICON_PATH})
# create macOS bundle wrapper script
set (WRAPPER "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/fltk-options")
add_custom_command (
TARGET fltk-options POST_BUILD
COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/../CMake/macOS-bundle-wrapper.in ${WRAPPER}
COMMAND chmod u+x,g+x,o+x ${WRAPPER}
BYPRODUCTS ${WRAPPER}
VERBATIM
)
unset (WRAPPER)
else ()
# option WIN32 builds a Windows GUI program, ignored on other platforms
add_executable (fltk-options WIN32 ${CPPFILES} ${HEADERFILES})
endif ()
# we must link all programs with fltk_cairo if option CAIROEXT is enabled
if (FLTK_HAVE_CAIROEXT)
list (APPEND FLTK_OPTIONS_LIBS fltk_cairo cairo)
endif (FLTK_HAVE_CAIROEXT)
if (FLTK_HAVE_CAIRO)
fl_target_link_directories (fltk-options PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
endif (FLTK_HAVE_CAIRO)
if (USE_GDIPLUS) # can only be true on Windows
list (APPEND FLTK_OPTIONS_LIBS gdiplus)
endif (USE_GDIPLUS)
target_link_libraries (fltk-options ${FLTK_OPTIONS_LIBS})
# Add fltk-options-cmd console app (Windows only) for editing FLTK options.
# This is done for all Windows targets, even if cross-compiling.
if (WIN32)
list (APPEND FLTK_OPTIONS_TARGETS fltk-options-cmd)
add_executable (fltk-options-cmd ${CPPFILES} ${HEADERFILES})
target_link_libraries (fltk-options-cmd ${FLTK_OPTIONS_LIBS})
if (FLTK_HAVE_CAIRO)
fl_target_link_directories (fltk-options-cmd PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
endif (FLTK_HAVE_CAIRO)
endif ()
# install fltk-options GUI and commandline tool
if (APPLE AND (NOT OPTION_APPLE_X11))
# On macOS, fltk-options must be installed twice. The bundled version of
# fltk-options needs to go into the /Applications folder to make it visible
# as a user App with full GUI.
# The binary without bundle should go into ${FLTK_BINDIR}, usually
# /usr/local/bin, so it will be picked up as a command line tool by
# the build process of other apps.
# On macOS the command line tool is the same target ('fltk-options') as the
# one included in the bundle.
# create bundle
set_target_properties (fltk-options PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/fltk-options.plist")
set_target_properties (fltk-options PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
# The line below would wrongly install /Applications/fltk-options.icns
# ## set_target_properties (fltk-options PROPERTIES RESOURCE ${ICON_PATH})
# install fltk-options GUI and commandline tools
#install (TARGETS fltk-options DESTINATION "/Applications")
# install command line tool
install (PROGRAMS $<TARGET_FILE:fltk-options> DESTINATION ${FLTK_BINDIR})
else()
# install fltk-options GUI and optional commandline tool 'fltk-options-cmd'
# (only on Windows)
install (TARGETS ${FLTK_OPTIONS_TARGETS}
EXPORT FLTK-Targets
RUNTIME DESTINATION ${FLTK_BINDIR}
LIBRARY DESTINATION ${FLTK_LIBDIR}
ARCHIVE DESTINATION ${FLTK_LIBDIR}
)
endif (APPLE AND (NOT OPTION_APPLE_X11))
# install desktop files
if (UNIX)
install (FILES fltk-options.desktop
DESTINATION ${FLTK_DATADIR}/applications
)
# Install mime-type file (x-fltk-options.desktop method is deprecated)
install (FILES fltk-options.xml
DESTINATION ${FLTK_DATADIR}/mime/packages
)
# Install desktop icons
foreach (icon 32 48 64 128)
install (FILES icons/fltk-options-${icon}.png
DESTINATION ${FLTK_DATADIR}/icons/hicolor/${icon}x${icon}/apps
RENAME fltk-options.png
)
endforeach()
endif (UNIX)

93
fltk-options/Makefile Normal file
View File

@ -0,0 +1,93 @@
#
# fltk-options Makefile for the Fast Light Tool Kit (FLTK).
#
# Copyright 2023 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
# file is missing or damaged, see the license at:
#
# https://www.fltk.org/COPYING.php
#
# Please see the following page on how to report bugs and issues:
#
# https://www.fltk.org/bugs.php
#
include ../makeinclude
CPPFILES = \
fltk-options.cxx
################################################################
OBJECTS = $(CPPFILES:.cxx=.o)
all: $(FLTK_OPTIONS) fltk-options$(EXEEXT)
fltk-options$(EXEEXT): $(OBJECTS) $(LIBNAME) $(FLLIBNAME)
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKFLTKIMG) $(LDFLAGS) $(LDLIBS)
$(OSX_ONLY) $(RM) -r -f fltk-options.app
$(OSX_ONLY) mkdir -p fltk-options.app/Contents/MacOS fltk-options.app/Contents/Resources
$(OSX_ONLY) $(INSTALL_BIN) fltk-options fltk-options.app/Contents/MacOS
$(OSX_ONLY) $(INSTALL) icons/fltk-options.icns fltk-options.app/Contents/Resources
$(OSX_ONLY) $(INSTALL) fltk-options.plist fltk-options.app/Contents/Info.plist
fltk-options-shared$(EXEEXT): $(OBJECTS) ../src/$(DSONAME) ../src/$(FLDSONAME)
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKSHARED) $(LDFLAGS) $(LDLIBS)
clean:
-$(RM) *.o core.* *~ *.bck *.bak
-$(RM) core fltk-options$(EXEEXT) fltk-options-shared$(EXEEXT)
$(OSX_ONLY) -$(RMDIR) fltk-options.app
depend: $(CPPFILES)
makedepend -Y -I.. -f makedepend -w 20 $(CPPFILES)
echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > makedepend.tmp
echo "" >> makedepend.tmp
grep '^[a-zA-Z]' makedepend | ( LC_ALL=C sort -u -f >> makedepend.tmp; )
mv makedepend.tmp makedepend
# Automatically generated dependencies...
include makedepend
install: all
echo "Installing fltk-options in $(DESTDIR)$(bindir)..."
-$(INSTALL_DIR) $(DESTDIR)$(bindir)
$(INSTALL_BIN) $(FLTK_OPTIONS) $(DESTDIR)$(bindir)/fltk-options$(EXEEXT)
install-linux:
-$(INSTALL_DIR) $(DESTDIR)/usr/share/applications
$(INSTALL_DATA) fltk-options.desktop $(DESTDIR)/usr/share/applications
for size in 16 32 48 64 128; do \
if test ! -d $(DESTDIR)/usr/share/icons/hicolor/$${size}x$${size}/apps; then \
$(INSTALL_DIR) $(DESTDIR)/usr/share/icons/hicolor/$${size}x$${size}/apps; \
fi; \
$(INSTALL_DATA) icons/fltk-options-$$size.png $(DESTDIR)/usr/share/icons/hicolor/$${size}x$${size}/apps/fltk-options.png; \
done
-$(INSTALL_DIR) $(DESTDIR)/usr/share/mimelnk/application
$(INSTALL_DATA) x-fltk-options.desktop $(DESTDIR)/usr/share/mimelnk/application
install-osx:
echo Installing fltk-options in $(DESTDIR)/Applications...
-$(INSTALL_DIR) $(DESTDIR)/Applications/fltk-options.app
-$(INSTALL_DIR) $(DESTDIR)/Applications/fltk-options.app/Contents
$(INSTALL_DATA) fltk-options.app/Contents/Info.plist $(DESTDIR)/Applications/fltk-options.app/Contents/Info.plist
-$(INSTALL_DIR) $(DESTDIR)/Applications/fltk-options.app/Contents/MacOS
$(RM) $(DESTDIR)/Applications/fltk-options.app/Contents/MacOS/fltk-options
$(LN) $(bindir)/fltk-options $(DESTDIR)/Applications/fltk-options.app/Contents/MacOS/fltk-options
-$(INSTALL_DIR) $(DESTDIR)/Applications/fltk-options.app/Contents/Resources
$(INSTALL_DATA) fltk-options.app/Contents/Resources/fltk-options.icns $(DESTDIR)/Applications/fltk-options.app/Contents/Resources
uninstall:
$(RM) $(DESTDIR)$(bindir)/fltk-options$(EXEEXT)
uninstall-linux:
$(RM) $(DESTDIR)/usr/share/applications/fltk-options.desktop
$(RM) $(DESTDIR)/usr/share/icons/hicolor/*/fltk-options.png
$(RM) $(DESTDIR)/usr/share/mimelnk/application/x-fltk-options.desktop
uninstall-osx:
$(RM) -r $(DESTDIR)/Applications/fltk-options.app

View File

@ -0,0 +1,689 @@
//
// fltk-options for the Fast Light Tool Kit (FLTK).
//
// Copyright 2022-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
#include <FL/Fl_Preferences.H>
#include <FL/Fl.H>
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Pack.H>
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Hold_Browser.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Choice.H>
#include <FL/filename.H>
#include <FL/fl_draw.H>
#include "../src/flstring.h"
#include <stdlib.h>
#include <stdio.h>
// user interface sizes
// |<->|<- group browser ->|<->|<- options ->|<->|
const int FO_GAP = 10;
const int FO_BROWSER_W = 200;
const int FO_SCROLL_W = 16 + 4; //Fl::scrollbar_size() + Fl::box_dw(FL_DOWN_BOX);
const int FO_CHOICE_W = 75;
const int FO_OPTIONS_W = 380;
const int FO_BUTTON_W = 75;
const int FO_WINDOW_W = FO_GAP + FO_BROWSER_W + FO_GAP + FO_SCROLL_W + FO_OPTIONS_W + FO_SCROLL_W + FO_GAP;
const int FO_SYSTEM_X = FO_OPTIONS_W - 2*FO_GAP - 2*FO_CHOICE_W;
const int FO_USER_X = FO_OPTIONS_W - FO_GAP - FO_CHOICE_W;
const int FO_TITLE_H = 20;
const int FO_BROWSER_H = 340;
const int FO_BUTTON_H = 25;
const int FO_CHOICE_H = 22;
const int FO_WINDOW_H = FO_GAP + FO_BROWSER_H + FO_GAP + FO_BUTTON_H + FO_GAP;
Fl_Window* g_window = NULL;
Fl_Hold_Browser* g_headline_browser = NULL;
Fl_Scroll* g_option_scroll = NULL;
// command line options
int g_verbose = 0;
int g_batch_mode = 0;
int g_system_write_ok = 0;
int g_user_write_ok = 0;
// Magic value when calling the handle function.
const int FO_PRINT_VALUE = -999;
// User or system setting
typedef enum {
FO_SYSTEM,
FO_USER
} Fo_Context;
// Avalable option types.
// We can add more types later as needed.
// See: Fl_Group* add_option( Fo_Option_Descr* opt)
// See: Fl_Group* add_option_bool(Fo_Option_Descr* opt)
typedef enum {
FO_END_OF_LIST = 0,
FO_HEADLINE,
FO_OPTION_BOOL,
// FO_OPTION_INT, // not yet implemented
// FO_OPTION_TEXT, // not yet implemented
// FO_OPTION_SCHEME, // not yet implemented
} Fo_Type;
// Record holding the information for headlines and options.
typedef struct {
Fo_Type type;
const char* text;
Fl::Fl_Option id;
const char* name;
bool bool_default;
const char* brief;
const char* tooltip;
Fl_Group* ui;
} Fo_Option_Descr;
// List of all entries in the user interface, including headlines and options.
// This list can be arbitrarily extended. The app will generate a scrollable
// area if the list does not fit the app window.
Fo_Option_Descr g_option_list[] = {
{ FO_HEADLINE, "Keyboard Focus Options" },
{ FO_OPTION_BOOL, "Visible Keyboard Focus:",
Fl::OPTION_VISIBLE_FOCUS, "OPTION_VISIBLE_FOCUS", true,
"Draw a dotted rectangle in widget with keyboard focus.",
"If visible focus is switched on, FLTK will draw a dotted rectangle inside "
"the widget that will receive the next keystroke. If switched off, no such "
"indicator will be drawn and keyboard navigation is disabled." },
{ FO_OPTION_BOOL, "Arrow Keys move Focus:",
Fl::OPTION_ARROW_FOCUS, "OPTION_ARROW_FOCUS", false,
"Arrow keys will move focus beyond text input field.",
"When switched on, moving the text cursor beyond the start or end of the "
"text in a text widget will change focus to the next widget. When switched "
"off, the cursor will stop at the end of the text. Pressing Tab or Ctrl-Tab "
"will advance the keyboard focus. Switch this on, if you want the old "
"behavior of FLTK 1.1." },
{ FO_HEADLINE, "Tooltip Options" },
{ FO_OPTION_BOOL, "Show Tooltips:",
Fl::OPTION_SHOW_TOOLTIPS, "OPTION_SHOW_TOOLTIPS", true,
"Show or hide tooltips.",
"If tooltips are enabled, hovering the mouse over a widget with a tooltip "
"text will open a little tooltip window until the mouse leaves the widget. "
"If disabled, no tooltip is shown." },
{ FO_HEADLINE, "Drag And Drop Options" },
{ FO_OPTION_BOOL, "Allow dragging Text:",
Fl::OPTION_DND_TEXT, "OPTION_DND_TEXT", true,
"User can drag text from FLTK into other apps.",
"If text drag-and-drop is enabled, the user can select and drag text from "
"any text widget. If disabled, no dragging is possible, however dropping "
"text from other applications still works." },
{ FO_HEADLINE, "Native File Chooser Options" },
{ FO_OPTION_BOOL, "Native File Chooser uses GTK:",
Fl::OPTION_FNFC_USES_GTK, "OPTION_FNFC_USES_GTK", true,
"Use GTK file chooser instead of FLTK if available.",
"If 'Native File Chooser uses GTK' is enabled, the Fl_Native_File_Chooser "
"class calls the GTK open/save file dialogs when they are available on the "
"platfom. If disabled, the Fl_Native_File_Chooser class always uses FLTK's "
"own file dialog (i.e., Fl_File_Chooser) even if GTK is available." },
{ FO_OPTION_BOOL, "Native File Chooser uses Zenity:",
Fl::OPTION_FNFC_USES_ZENITY, "OPTION_FNFC_USES_ZENITY", true,
"Use Zenity file chooser instead of FLTK if available.",
"Meaningful for the Wayland/X11 platform only. When switched on (default),"
"the library uses a Zenity-based file dialog. When switched off, the GTK"
"file dialog is used instead." },
{ FO_HEADLINE, "Print dialog Options" },
{ FO_OPTION_BOOL, "Print dialog uses GTK:",
Fl::OPTION_PRINTER_USES_GTK, "OPTION_PRINTER_USES_GTK", true,
"Use GTK printer dialog instead of FLTK if available.",
"If 'Print dialog uses GTK' is enabled, the Fl_Printer class calls the "
"GTK print dialog when it's available on the platfom. If disabled, the "
"Fl_Printer class always uses FLTK's own print dialog even "
"if GTK is available." },
{ FO_HEADLINE, "Scaling Factor Options" },
{ FO_OPTION_BOOL, "Transiently show scaling factor:",
Fl::OPTION_SHOW_SCALING, "OPTION_SHOW_SCALING", true,
"Show the zoom factor in a transient popup window.",
"If 'Transiently show scaling factor' is enabled, the library shows in a "
"transient popup window the display scaling factor value when it is "
"changed. If disabled, no such transient window is used." },
// -- When adding new options here, please make sure that you also update
// -- documentation.src/fltk-options.dox
// -- and
// -- documentation.src/fltk-options.man
{ FO_END_OF_LIST }
};
/** Check for write permission.
\param[in] ctx settings context
\return true if writing to the requested preferences is ok
*/
bool write_permission(Fo_Context ctx) {
if (ctx == FO_SYSTEM)
return g_system_write_ok;
else
return g_user_write_ok;
}
/** Write an option into the system or user preferences file.
\param[in] ctx settings context
\param[in] name the name of the option
\param[in] value 0 or 1, or -1 to remove the entry, so it will be reset to
its default value
*/
void set_option(Fo_Context ctx, const char *name, int value) {
enum Fl_Preferences::Root context =
(ctx==FO_SYSTEM) ? Fl_Preferences::SYSTEM_L : Fl_Preferences::USER_L;
Fl_Preferences prefs(context, "fltk.org", "fltk");
Fl_Preferences options(prefs, "options");
if (value==-1)
options.deleteEntry(name);
else
options.set(name, value);
}
/** Read an option from the system or user preferences file.
\param[in] ctx settings context
\param[in] name the name of the option
\return 0 or 1, or -1 if the value is not set
*/
int get_option(Fo_Context ctx, const char *name) {
int value = -1;
enum Fl_Preferences::Root context =
(ctx==FO_SYSTEM) ? Fl_Preferences::SYSTEM_L : Fl_Preferences::USER_L;
Fl_Preferences prefs(context, "fltk.org", "fltk");
Fl_Preferences options(prefs, "options");
options.get(name, value, -1);
return value;
}
/** Delete an option in the system or user preferences file.
\param[in] ctx settings context
\param[in] name the name of the option
*/
void clear_option(Fo_Context ctx, const char *name) {
set_option(ctx, name, -1);
}
/** Print the Usage: text and list all system and user options.
\param[in] argv application name when called from the shell
*/
void print_usage(const char *argv0) {
const char *app_name = NULL;
if (argv0 && argv0[0])
app_name = fl_filename_name(argv0);
if (!app_name || !app_name[0])
app_name = "fltk-options";
fprintf(stdout, "FLTK %d.%d.%d. Usage:\n", FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION);
fprintf(stdout, "%s [-Soption[=val]] [-Uoption[=val]] [-L] [-LS] [-LU] [-f] [-v] [-h[option]]\n", app_name);
fprintf(stdout, " -Soption[=value] change or print system wide option\n");
fprintf(stdout, " -Uoption[=value] change or print user option\n");
fprintf(stdout, " Values can be 0 or OFF to clear, or 1 or ON to set the option.\n"
" The value -1 or DEFAULT sets the option to its default value.\n"
" If no value is given, the current setting is returned as -1, 0, or 1.\n");
fprintf(stdout, " -L, -LS, -LU list the value of all options, of all system settings, \n"
" or of all user setting\n");
fprintf(stdout, " -f suppresses error messages concerning file access permissions\n");
fprintf(stdout, " -v, --verbose prints additional information in command line mode\n");
fprintf(stdout, " -h[option], --help [option] general help, or info for the given option\n\n");
fprintf(stdout, " This version of %s supports the following options:\n", app_name);
Fo_Option_Descr *opt;
for (opt = g_option_list; opt->type!=FO_END_OF_LIST; ++opt) {
if (opt->name) {
if (opt->brief)
fprintf(stdout, " %-24s %s\n", opt->name, opt->brief);
else
fprintf(stdout, " %s\n", opt->name);
}
}
fprintf(stdout, "\n Calling %s without options will launch %s interactive mode.\n", app_name, app_name);
}
/** Print more information for a given options.
\param[in] options the name of the option, case insensitive
*/
void print_info(const char *option) {
Fo_Option_Descr *opt;
for (opt = g_option_list; opt->type!=FO_END_OF_LIST; ++opt) {
if ( opt->name && (fl_ascii_strcasecmp(opt->name, option) == 0) ) {
if (opt->brief)
fprintf(stdout, "%s: %s\n", opt->name, opt->brief);
else
fprintf(stdout, "%s: see FLTK manual for details\n", opt->name);
if (opt->tooltip)
fprintf(stdout, "\n%s\n", opt->tooltip);
fprintf(stdout, "\nDefault is %s.\n", opt->bool_default ? "on" : "off");
break;
}
}
if (opt->type == FO_END_OF_LIST)
fprintf(stderr, "Warning: Unrecognized option \"%s\".\n", option);
}
/** List the current value of all options.
\param[in] cmd 'S' lists system options, 'U' lists user options, 0 lists both
*/
void list_options(char cmd) {
Fo_Option_Descr *opt;
for (opt = g_option_list; opt->type!=FO_END_OF_LIST; ++opt) {
if (opt->name) {
printf("%-24s", opt->name);
if (cmd == 'S' || cmd == 0) {
int value = get_option(FO_SYSTEM, opt->name);
printf(" system:%2d", value);
}
if (cmd == 0)
printf(",");
if (cmd == 'U' || cmd == 0) {
int value = get_option(FO_USER, opt->name);
printf(" user:%2d", value);
}
printf("\n");
}
}
}
/** Handle a commmand line argument for system or user options.
\param[in] ctx settings context
\param[in] name the name of the option
\param ival 0 or 1 to set, -1 to reset to default, and FO_PRINT_VALUE to
print the current value
*/
void handle_option(Fo_Context ctx, const char *name, int ival) {
const char *ctx_name = (ctx==FO_SYSTEM) ? "system" : "user";
Fo_Option_Descr *opt;
for (opt = g_option_list; opt->type!=FO_END_OF_LIST; ++opt) {
if ( opt->name && (fl_ascii_strcasecmp(opt->name, name) == 0) ) {
if (ival == FO_PRINT_VALUE) {
int value = get_option(ctx, opt->name);
if (g_verbose)
printf("Current value for %s option %s is %d\n", ctx_name, name, value);
else
printf("%d\n", value);
} else if (ival ==-1) {
if (g_verbose) printf("Reset %s option %s to default\n", ctx_name, name);
clear_option(ctx, opt->name);
} else {
if (g_verbose) printf("Set %s option %s to %d\n", ctx_name, name, ival);
set_option(ctx, opt->name, ival);
}
if ( (ival != FO_PRINT_VALUE) && !write_permission(ctx) ) {
fprintf(stderr, "ERROR: No write permission for %s options\n", ctx_name);
exit(1);
}
break;
}
}
if (opt->type == FO_END_OF_LIST)
fprintf(stderr, "Warning: Unrecognized %s option \"%s\".\n", ctx_name, name);
}
/** FLTK callback for every item in the command line.
Command line arguments start with "-S" for system wide settings or "-U" for
user settings, followed by the option name, followed by a value "=0", "=1",
"=ON", or "=OFF". If no value is give, we will print a "0" or "1" to stdout.
\param[in] argc number of arguments in the list
\param[in] argv pointer to the list of arguments
\param[inout] index into current argument, increment for every used entry
\return 1 if the entry was correct, 0 if it was not understood
*/
static int read_command_line_args(int argc, char** argv, int& i) {
char cmd = 0;
char opt[64] = "";
char val[32] = "";
int ival = FO_PRINT_VALUE;
const char *arg = argv[i++];
if ( (strcmp(arg, "--help") == 0)) {
if (argv[i] && argv[i][0]) {
print_info(argv[i]);
i++;
} else {
print_usage(argv[0]);
}
g_batch_mode = 1;
return 1;
}
if ( (strncmp(arg, "-h", 2) == 0) ) {
if (arg[2]) {
print_info(arg+2);
i++;
} else {
print_usage(argv[0]);
}
g_batch_mode = 1;
return 1;
}
if ( (strcmp(arg, "--help") == 0) || (strcmp(arg, "-h") == 0) ) {
print_usage(argv[0]);
g_batch_mode = 1;
return 1;
}
if ( (strcmp(arg, "--verbose") == 0) || (strcmp(arg, "-v") == 0) ) {
g_verbose = 1;
return 1;
}
if (strcmp(arg, "-f") == 0) { // suppress write access error
g_system_write_ok = g_user_write_ok = 1;
return 1;
}
if (arg[0] == '-') {
cmd = arg[1];
if (cmd == 'U' || cmd == 'S') {
const char *eq = strchr(arg+2, '=');
if (eq) {
size_t n = (eq - (arg+2));
if (n==0) {
i--;
return 0;
}
if (n > sizeof(opt)-1) n = sizeof(opt)-1;
strlcpy(opt, arg+2, n+1);
strlcpy(val, eq+1, sizeof(val));
if (fl_ascii_strcasecmp(val, "ON")==0)
ival = 1;
else if (fl_ascii_strcasecmp(val, "OFF")==0)
ival = 0;
else if (fl_ascii_strcasecmp(val, "DEFAULT")==0)
ival = -1;
else if (strcmp(val, "1")==0)
ival = 1;
else if (strcmp(val, "0")==0)
ival = 0;
else if (strcmp(val, "-1")==0)
ival = -1;
else {
fprintf(stderr, "Warning: Unrecognized value \"%s\" for option \"%s\".\n", val, opt);
g_batch_mode = 1;
return 1;
}
} else {
strlcpy(opt, arg+2, sizeof(opt));
}
}
}
if (cmd == 'S') { // system setting
handle_option(FO_SYSTEM, opt, ival);
g_batch_mode = 1;
return 1;
}
if (cmd == 'U') { // user setting
handle_option(FO_USER, opt, ival);
g_batch_mode = 1;
return 1;
}
// check for -L, -LS, or -LU
if (strcmp(arg, "-L")==0 || strcmp(arg, "-LS")==0 || strcmp(arg, "-LU")==0) {
list_options(arg[2]);
g_batch_mode = 1;
return 1;
}
i--;
return 0;
}
/** Check if we have write permission for either database.
If there is no write permission for a set of options, the UI will show
them grayed out.
\param[out] sys system preferences write permission
\param[out] user user preferences write permission
*/
void check_write_permissions(int &sys, int &user) {
char path[FL_PATH_MAX+1];
sys = 0;
Fl_Preferences sys_prefs(Fl_Preferences::SYSTEM_L, "fltk.org", "fltk");
if (sys_prefs.file_access() & Fl_Preferences::SYSTEM_WRITE_OK) {
path[0] = 0;
sys_prefs.filename(path, FL_PATH_MAX);
if ( path[0] && (fl_access(path, 2) == 0) ) // W_OK
sys = 1;
}
user = 0;
Fl_Preferences user_prefs(Fl_Preferences::USER_L, "fltk.org", "fltk");
if (user_prefs.file_access() & Fl_Preferences::USER_WRITE_OK) {
path[0] = 0;
user_prefs.filename(path, FL_PATH_MAX);
if ( path[0] && (fl_access(path, 2) == 0) ) // W_OK
user = 1;
}
}
/** Called when the UI Close button is clicked.
*/
static void close_cb(Fl_Widget*, void*) {
Fl::hide_all_windows();
}
/** Called when a boolenan system option is changed.
*/
void set_system_option_cb(Fl_Widget* w, void* user_data) {
Fl_Choice* choice = (Fl_Choice*)w;
Fo_Option_Descr* opt = (Fo_Option_Descr*)user_data;
const Fl_Menu_Item* mi = choice->mvalue();
if (!mi) return;
int value = (int)mi->argument();
set_option(FO_SYSTEM, opt->name, value);
}
/** Called when a boolenan user option is changed.
*/
void set_user_option_cb(Fl_Widget* w, void* user_data) {
Fl_Choice* choice = (Fl_Choice*)w;
Fo_Option_Descr* opt = (Fo_Option_Descr*)user_data;
const Fl_Menu_Item* mi = choice->mvalue();
if (!mi) return;
int value = (int)mi->argument();
set_option(FO_USER, opt->name, value);
}
/** Add an option group to the pack group.
*/
void add_option(Fl_Pack* pack, Fo_Option_Descr* opt) {
static Fl_Menu_Item bool_option_menu[] = {
{ "off", 0, 0, (void*)(0), 0},
{ "on", 0, 0, (void*)(1), FL_MENU_DIVIDER},
{ "default", 0, 0, (void*)(-1), 0},
{ NULL }
};
// -- get the height of the tooltip text, so we can create the correct group size
int tooltip_h = 0;
if (opt->tooltip) {
int ww = FO_OPTIONS_W - 2*FO_GAP - 6; // 6 is the FL_ALIGN_LEFT margin
int hh = 100;
fl_font(FL_HELVETICA, 11);
fl_measure(opt->tooltip, ww, hh);
tooltip_h = hh+5;
}
// -- create a group that contains all the UI elements for the option
int yy = 0;
Fl_Group* option_group = new Fl_Group(0, 0,
FO_OPTIONS_W,
2*FO_GAP + FO_BUTTON_H + tooltip_h + 2*FO_GAP + FO_CHOICE_H +17);
opt->ui = option_group;
yy += FO_GAP;
// -- name of the options
Fl_Box* name = new Fl_Box(0, yy, FO_OPTIONS_W, 21);
name->copy_label(opt->name);
name->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
name->labelfont(FL_HELVETICA_BOLD);
yy += name->h();
// -- description
Fl_Box* brief = new Fl_Box(FO_GAP, yy,
FO_OPTIONS_W - 2*FO_GAP, tooltip_h,
opt->brief);
brief->labelsize(11);
brief->labelcolor(fl_lighter(FL_FOREGROUND_COLOR));
brief->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
yy += 17;
// -- tooltip, if one exists
Fl_Box* tooltip = new Fl_Box(FO_GAP, yy,
FO_OPTIONS_W - 2*FO_GAP, tooltip_h,
opt->tooltip);
tooltip->labelfont(FL_HELVETICA);
tooltip->labelsize(11);
tooltip->labelcolor(fl_lighter(FL_FOREGROUND_COLOR));
tooltip->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
yy += tooltip_h;
// -- default setting
Fl_Box* default_setting = new Fl_Box(FO_GAP, yy, FO_SYSTEM_X - FO_GAP, 14);
char buf[64];
fl_snprintf(buf, 64, "Default is %s.",opt->bool_default ? "on" : "off"); // -- label the pulldown menus
default_setting->copy_label(buf);
default_setting->labelsize(11);
default_setting->labelcolor(fl_lighter(FL_FOREGROUND_COLOR));
default_setting->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
yy += 18;
// -- option text
Fl_Box* text = new Fl_Box(0, yy, FO_SYSTEM_X, FO_CHOICE_H);
text->copy_label(opt->text);
text->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
// -- system choice
Fl_Choice* system_choice = new Fl_Choice(FO_SYSTEM_X, yy, FO_CHOICE_W, FO_CHOICE_H, "System:");
system_choice->down_box(FL_BORDER_BOX);
system_choice->labelsize(11);
system_choice->align(FL_ALIGN_TOP);
system_choice->callback((Fl_Callback*)set_system_option_cb, (void*)opt);
system_choice->menu(bool_option_menu);
switch (get_option(FO_SYSTEM, opt->name)) {
case 0: system_choice->value(0); break;
case 1: system_choice->value(1); break;
default: system_choice->value(2); break;
}
if (!g_system_write_ok) system_choice->deactivate();
// -- user choice
Fl_Choice* user_choice = new Fl_Choice(FO_USER_X, yy, FO_CHOICE_W, FO_CHOICE_H, "User:");
user_choice->down_box(FL_BORDER_BOX);
user_choice->labelsize(11);
user_choice->align(FL_ALIGN_TOP);
user_choice->callback((Fl_Callback*)set_user_option_cb, (void*)opt);
user_choice->menu(bool_option_menu);
switch (get_option(FO_USER, opt->name)) {
case 0: user_choice->value(0); break;
case 1: user_choice->value(1); break;
default: user_choice->value(2); break;
}
if (!g_user_write_ok) user_choice->deactivate();
option_group->end();
}
/** Fill the options list and make the unused options invisible.
*/
void add_options(Fl_Pack* pack) {
Fo_Option_Descr *opt;
for (opt = g_option_list; opt->type!=FO_END_OF_LIST; ++opt) {
if (opt->type != FO_HEADLINE)
add_option(pack, opt);
}
}
void select_headline_cb(Fl_Widget*, void*) {
int line = g_headline_browser->value();
if (line) {
Fo_Option_Descr* sel = (Fo_Option_Descr*)g_headline_browser->data(line);
Fo_Option_Descr *opt;
bool show = false;
for (opt = g_option_list; opt->type!=FO_END_OF_LIST; ++opt) {
if (opt->type == FO_HEADLINE) show = false;
if (opt == sel) {
show = true;
g_option_scroll->label(opt->text);
}
if (opt->ui) {
if (show)
opt->ui->show();
else
opt->ui->hide();
}
}
} else {
Fo_Option_Descr *opt;
for (opt = g_option_list; opt->type!=FO_END_OF_LIST; ++opt) {
if (opt->ui)
opt->ui->show();
}
g_option_scroll->label("All Options");
}
g_window->redraw();
}
/** Fill the headline browser and set callbacks.
*/
void add_headlines(Fl_Hold_Browser* browser) {
Fo_Option_Descr *opt;
for (opt = g_option_list; opt->type!=FO_END_OF_LIST; ++opt) {
if (opt->type == FO_HEADLINE)
browser->add(opt->text, (void*)opt);
}
browser->callback(select_headline_cb, NULL);
}
/** Build the modular user interface (ALT VERSION).
*/
Fl_Window* build_ui() {
Fl_Tooltip::size(11);
// -- the main application window
g_window = new Fl_Double_Window(FO_WINDOW_W, FO_WINDOW_H,
"FLTK Options");
// -- a clickable browser for all headlines
g_headline_browser = new Fl_Hold_Browser(FO_GAP, FO_GAP + FO_TITLE_H,
FO_BROWSER_W, FO_BROWSER_H - FO_TITLE_H,
"Groups");
g_headline_browser->align(FL_ALIGN_TOP);
g_headline_browser->textsize(FL_NORMAL_SIZE+1);
add_headlines(g_headline_browser);
// -- scrollable area for all options inside a group
g_option_scroll = new Fl_Scroll(FO_GAP + FO_BROWSER_W + FO_GAP, FO_GAP + FO_TITLE_H,
FO_OPTIONS_W +2*FO_SCROLL_W, FO_BROWSER_H - FO_TITLE_H,
"All Options");
g_option_scroll->box(FL_DOWN_BOX);
g_option_scroll->type(Fl_Scroll::VERTICAL);
Fl_Pack* option_list = new Fl_Pack(g_option_scroll->x() + FO_SCROLL_W,
g_option_scroll->y() + Fl::box_dy(FL_DOWN_BOX),
FO_OPTIONS_W, 10);
add_options(option_list);
// -- end all groups
g_option_scroll->end();
g_window->resizable(g_option_scroll);
// -- close button
Fl_Button* close = new Fl_Button(FO_WINDOW_W - 2*FO_GAP-FO_BUTTON_W,
FO_WINDOW_H - FO_GAP - FO_BUTTON_H,
FO_BUTTON_W, FO_BUTTON_H,
"Close");
close->callback(close_cb);
g_window->end();
g_window->size_range(FO_WINDOW_W, 200, FO_WINDOW_W, 32767);
return g_window;
}
/** This is where it all begins.
*/
int main(int argc,char **argv) {
check_write_permissions(g_system_write_ok, g_user_write_ok);
int i = 1;
int args_processed = Fl::args(argc, argv, i, read_command_line_args);
if (args_processed < argc) {
fprintf(stderr, "ERROR: Unrecognized command line option \"%s\".\n", argv[i]);
return 1;
}
if (g_batch_mode)
return 0;
Fl_Window *win = build_ui();
win->show(argc, argv);
Fl::run();
return 0;
}

View File

@ -0,0 +1,10 @@
[Desktop Entry]
Name=fltk-options
Comment=FLTK Options Editor
TryExec=fltk-options
Exec=fltk-options %F
Icon=fltk-options
Terminal=false
Type=Application
MimeType=application/x-fltk-options;
Categories=Development;Settings;

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>fltk-options</string>
<key>CFBundleIdentifier</key>
<string>org.fltk.fltk-options</string>
<key>CFBundleVersion</key>
<string>1.4.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2023 by Bill Spitzak and others</string>
<key>CFAppleHelpAnchor</key>
<string>help</string>
<key>CFBundleName</key>
<string>fltk-options</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>FLOP</string>
<key>CFBundleIconFile</key>
<string>fltk-options.icns</string>
<key>CFBundleShortVersionString</key>
<string>1.4.0</string>
<key>CFBundleGetInfoString</key>
<string>1.4.0, Copyright 2023 by Bill Spitzak and others</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-fltk-options">
<comment>FLTK Options Editor</comment>
</mime-type>
</mime-info>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,70 @@
/* XPM */
static char *_bae769a99384303e21a66e415de0b1aBvKpx6NXTDEGsJa6[] = {
/* columns rows colors chars-per-pixel */
"32 32 32 1 ",
" c #1A1C1C",
". c #2D3746",
"X c #393B38",
"o c #334E74",
"O c #595C5C",
"+ c #6A6135",
"@ c #4D6D9E",
"# c #6A7891",
"$ c #777976",
"% c #5885C6",
"& c #7F817F",
"* c #948539",
"= c #598ED7",
"- c #6D8BBB",
"; c #888A87",
": c #5D97E7",
"> c #90928F",
", c #999C99",
"< c #60A6FF",
"1 c #9EA19E",
"2 c #AAA27A",
"3 c #BAA63E",
"4 c #C4B367",
"5 c #D9C351",
"6 c #C9CBC6",
"7 c #F7E14C",
"8 c black",
"9 c black",
"0 c black",
"q c black",
"w c black",
"e c black",
/* pixels */
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$&$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$::#$$$-:#$$$$$$$$$$$$$",
"$$$$$$$$$#<<=$$-<<-$$$$$$$$$$$$$",
"$$$$$#$$$#<<:$$:<<-$$$$$$$$$$$$$",
"&&&&-<:-&&:<<-#:<<#&&--#&&&&&&&&",
"&&&&-<<<##:<<<<<<:&&=<<=&&&&&&&&",
"&&&&$:<<<<<<<<<<<<:=<<<#&&&&&&&&",
"&&&&&#:<<<<<<<<<<<<<<<%$&&&&&&&&",
"&&&&&&%<<<<<<:<<<<<<<%$&&&&&&&&&",
"&-:<:-<<<<<%#O@:<<<<<=&##&&&&&&&",
";=<<<<<<<<:#;;;$@<<<<<:<<<-;;;;;",
";$=<<<<<<<#;;;;;&%<<<<<1<<-;;;;;",
";;$O@<<<<=;;;;;;;#:<:577-@&;;;;;",
";;;;;<<<<-;;;;245776<5772;;;;;;;",
";;--:<<<<-;257777774<4774;;;;;;;",
";-<<<<<<<:;&77777774<6775>;;;;;;",
";<<<<<<<<<-;57752-:<<:7776>>>>>>",
">#%%@@<<<<<:4774::1<<:7776,>>>>>",
">>;;>;:<<<<<6777777<<#5774;>>>>>",
">>>>>=<<<<<<:7777776<-4775>>>>2>",
">>>>-<<<:<<<<5777751<<,77745775>",
">>>><<<%$%<<<4774%@:<<=77777777>",
">>>>:=@;>-<<:2774->#:<<57777775>",
",,,,&&,,,:<<-2777-,,$@@47753*O$>",
",,,,,,,,,:<:>>7771,,,,>&+O$;>,,,",
",,,,,,,,,:<-,,5772,,,,,,,,,,,,,,",
",,,,,,,,,&#>,,2*O&,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,>,,,,,,,,,,,,,,,,,",
"11111111111111111111111111111111",
"11111111111111111111111111111111"
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,134 @@
/* XPM */
static char *_e101498a8b740e7b97aa74122d70714MqWFs5PhLjx31lZ1[] = {
/* columns rows colors chars-per-pixel */
"96 96 32 1 ",
" c #1A1C1C",
". c #2D3746",
"X c #393B38",
"o c #334E74",
"O c #595C5C",
"+ c #6A6135",
"@ c #4D6D9E",
"# c #6A7891",
"$ c #777976",
"% c #5885C6",
"& c #7F817F",
"* c #948539",
"= c #598ED7",
"- c #6D8BBB",
"; c #888A87",
": c #5D97E7",
"> c #90928F",
", c #999C99",
"< c #60A6FF",
"1 c #9EA19E",
"2 c #AAA27A",
"3 c #BAA63E",
"4 c #C4B367",
"5 c #D9C351",
"6 c #C9CBC6",
"7 c #F7E14C",
"8 c black",
"9 c black",
"0 c black",
"q c black",
"w c black",
"e c black",
/* pixels */
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#-#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#:<<:#$$$$$$$$$$$$$$-:-#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%<<<<:#$$$$$$$$$$$$-<<<<-$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$:<<<<<=$$$$$$$$$$$-<<<<<=$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#<<<<<<<-$$$$$$$$$#<<<<<<:$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#<<<<<<<:$$$$$$$$$:<<<<<<<#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-<<<<<<<<-$$$$$$$-<<<<<<<<#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-<<<<<<<<%$$$$$$$:<<<<<<<<#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@<<<<<<<<=$$$$$$$<<<<<<<<<#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$%%-$$$$$$$$$$$#<<<<<<<<=$$$$$$#<<<<<<<<:#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"&&&&&&&&&&&&&$=<<<:-#$&&&&&&&O=<<<<<<<:$&&&&&#<<<<<<<<=$&&&&&&&&&&&&$&&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&$%<<<<<<<-&&&&&&&$@<<<<<<<<-$&&&&%<<<<<<<<o$&&&&&&&&&#-%:#&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&$@<<<<<<<<=&&&&&&&.<<<<<<<<<=%%-=<<<<<<<<:X&&&&&&&&#=<<<<<#&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&o<<<<<<<<<-&&&&&&O<<<<<<<<<<<<<<<<<<<<<<@$&&&&&&#=<<<<<<<:$&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&O:<<<<<<<<<#&&&&&%<<<<<<<<<<<<<<<<<<<<<<@&&&&&&#:<<<<<<<<:O&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&$%<<<<<<<<<:#&&-:<<<<<<<<<<<<<<<<<<<<<<<:#&&&&$=<<<<<<<<<%$&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&$o<<<<<<<<<<:%:<<<<<<<<<<<<<<<<<<<<<<<<<<<-&&&%<<<<<<<<<<o&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&O=<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:-=<<<<<<<<<<=O&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&$.:<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<o$&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&&Oo:<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<%O&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&&&X.=<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:.$&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&&&&O =<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<%.O&&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&&&&&Oo<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:o O&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&&&&&&-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<oX$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&&&&&#:<<<<<<<<<<<<<<<<<<<:=@:<<<<<<<<<<<<<<<<<<<<:O&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&#-%=:::=-#&&&&%<<<<<<<<<<<<<<<<:%@o %<<<<<<<<<<<<<<<<<<<<<#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&&:<<<<<<<<<%#&-<<<<<<<<<<<<<<<<o XOO$.@%:<<<<<<<<<<<<<<<<<<=&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&&&#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@O$$&;&&O @=<<<<<<<<<<<<<<<<<#&&&&-%==%-#&&&&&&&&&&&&&&&&&&&",
";;;-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<=#;;;;;;;;&$OX @<<<<<<<<<<<<<<<<:-#-:<<<<<<<:%&;;;;;;;;;;;;;;;;",
";;;@<<<<<<<<<<<<<<<<<<<<<<<<<<<<%.O;;;;;;;;;;;&O o:<<<<<<<<<<<<<<<<<<<<<<<<<<<<#;;;;;;;;;;;;;;;;",
";;;X@<<<<<<<<<<<<<<<<<<<<<<<<<<% O;;;;;;;;;;;;;;$Xo<<<<<<<<<<<<<<<<<<<<<<<<<<<<%;;;;;;;;;;;;;;;;",
";;;$X@<<<<<<<<<<<<<<<<<<<<<<<<:.$;;;;;;;;;;;;;;;;&O@<<<<<<<<<<<<<<<<<<<<<<<<<<<=&;;;;;;;;;;;;;;;",
";;;;$X@:<<<<<<<<<<<<<<<<<<<<<<oO;;;;;;;;;;;;;;;;;;&X=<<<<<<<<<<<<<<<<<::<<<<<<<@&;;;;;;;;;;;;;;;",
";;;;;$X.%:<<<<<<<<<<<<<<<<<<<%O;;;;;;;;;;;;;;;;;;;;$o<<<<<<<<<<<<<:-6474<<<<<:oX&;;;;;;;;;;;;;;;",
";;;;;;&O .o@%:<<<<<<<<<<<<<<<o&;;;;;;;;;;;;;;;;;;;;;O=<<<<<<<<:125777777:<<<=oX&;;;;;;;;;;;;;;;;",
";;;;;;;;$OX =<<<<<<<<<<<<<:O;;;;;;;;;;;;;;;;;;;;;;&@<<<:<<<<,777777777-<:@ O&;;;;;;;;;;;;;;;;;",
";;;;;;;;;;;&$O@<<<<<<<<<<<<<=$;;;;;;;;;;;;;;;;;;;;;;;O1245:<<<%7777777772o X$;;;;;;;;;;;;;;;;;;;",
";;;;;;;;;;;;;;#<<<<<<<<<<<<<@;;;;;;;;;;;;;;;;;;;&223577777-<<<:5777777773XO&;;;;;;;;;;;;;;;;;;;;",
";;;;;;;;;;;;;;#<<<<<<<<<<<<<@;;;;;;;;;;;;;;;;24577777777771<<<<4777777775&;;;;;;;;;;;;;;;;;;;;;;",
";;;;;;;;;;;;;;-<<<<<<<<<<<<<-;;;;;;;;;;;;245777777777777774<<<<1777777777;;;;;;;;;;;;;;;;;;;;;;;",
";;;;;;;;;;;;;&:<<<<<<<<<<<<<-;;;;;;&22357777777777777777775:<<<-7777777772;;;;;;;;;;;;;;;;;;;;;;",
";;;;;;;;&--%%:<<<<<<<<<<<<<<%;;;;;&577777777777777777777777-<<<=7777777774;;;;;;;;;;;;;;;;;;;;;;",
";;;;;;&%<<<<<<<<<<<<<<<<<<<<:&;;;;;3777777777777777777777771<<<:5777777775&;;;;;;;;;;;;;;;;;;;;;",
";;;;;-<<<<<<<<<<<<<<<<<<<<<<<#;;;;;*777777777777777777777772<<<<2777777777;;;;;;;;;;;;;;;;;;;;;;",
";;;;%<<<<<<<<<<<<<<<<<<<<<<<<%;;;;;O777777777777777777777775<<<<#7777777772;;;;;;;;;;;;;;;;;;;;;",
";;;=<<<<<<<<<<<<<<<<<<<<<<<<<<#;;;;O5777777777777777777753+#<<<<=77777777726;;;;;;;;;;;;;;;;;;;;",
";;#<<<<<<<<<<<<<<<<<<<<<<<<<<<=;;;;$37777777777777753*$@%:<<<<<<:577777777566>;;;;;;;;;;;;;;;;;;",
">>O<<<<<<<<<<<<<<<<<<<<<<<<<<<<%;>>;*777777777753*O@=:<<<<<<<<<<<2777777775666;>>>>>>>>>>>>>>>>>",
">>$:<<<<<<<<<<<<<<<<<<<<<<<<<<<<%;>>+777777777* o:<<<<<<<<<<<<<<,7777777776666;>>>>>>>>>>>>>>>>",
">>;@=:<<<<<<<=@o%<<<<<<<<<<<<<<<<:&>O7777777773 @<<<<<<<<<<<<<<<<%7777777772666$>>>>>>>>>>>>>>>>",
">>>X .o@%=%@o X =<<<<<<<<<<<<<<<<<-#5777777775=<<<<<<:--<<<<<<<<:5777777774666$>>>>>>>>>>>>>>>>",
">>>;$O X$;>$o<<<<<<<<<<<<<<<<<<<2777777777=<<:-14574<<<<<<<:o377777777566>;>>>>>>>>>>>>>>>>",
">>>>>>;&$$$;>>>>>O%<<<<<<<<<<<<<<<<<<-7777777771257777775<<<<<<<oX*777777777>$O>>>>>>>>>>>>>>>>>",
">>>>>>>>>>>>>>>>>&@<<<<<<<<<<<<<<<<<<=7777777777777777777=<<<<<%O>+777777777*X$>>>>>>>>>>>>>>>>>",
">>>>>>>>>>>>>>>>>>%<<<<<<<<<<<<<<<<<<:57777777777777777771<<<<:.;>O7777777774;>>>>>>>>>>>>>>>>>>",
">>>>>>>>>>>>>>>>;%<<<<<<<<<<<<<<<<<<<<27777777777777777772<<<<:$>>$5777777775;>>>>>>>>>>>>>>>>>>",
">>>>>>>>>>>>>>>#:<<<<<<<<<<<<<<<<<<<<<,7777777777777777775<<<<<#>>;3777777777;>>>>>>>>>>>>>>>>>>",
">>>>>>>>>>>>>>-<<<<<<<<<<<<<<<<<<<<<<<%7777777777777777777:<<<<<->>+7777777772>>>>>>>>;;2454>>>>",
">>>>>>>>>>>>>&<<<<<<<<<<<<<<<<<<<<<<<<:5777777777777777777-<<<<<<->O7777777774>>>>;243577775;>>>",
">>>>>>>>>>>>>=<<<<<<<<<<<<<<<<<<<<<<<<<4777777777777777777,<<<<<<<-$5777777775>2457777777777>>>>",
">>>>>>>>>>>>#<<<<<<<<<<<%%<<<<<<<<<<<<<,777777777777753*O@=<<<<<<<<#3777777777777777777777772>>>",
">>>>>>>>>>>>%<<<<<<<<<<o o=<<<<<<<<<<<-77777777753+o@%%=<<<<<<<<<<=*777777777777777777777774>>>",
">>>>>>>>>>>&<<<<<<<<<<@O&&O @<<<<<<<<<<:7777777774:<<%. @<<<<<<<<<<O777777777777777777777775>>>",
">>>>>>>>>>>-<<<<<<<<<%X>>>>$X:<<<<<<<<<:3777777775<:o O$$X=<<<<<<<<<@577777777777777777777777;>>",
">>>>>>>>>>>-<<<<<<<:@X;>>>>>&:<<<<<<<<<<2777777777:%O&>>>&.:<<<<<<<<=3777777777777777777777772>>",
">>>>>>>>>>>O%<<<<:@.X&>>>>>>#<<<<<<<<<%@$777777777-%>>>>>>Oo:<<<<<<<:*777777777777777777777774>>",
",,,,,,,,,,,&.%=@o O;,,,,,,>=<<<<<<<<o X7777777771:>,,,,,>Xo=<<<<<<<$777777777777777777775*+O>,",
",,,,,,,,,,,,$ XO;,,,,,,,,#<<<<<<<<:O&;$5777777774<#,,,,,,>O o=<<<:o 77777777777777753*+ O>,",
",,,,,,,,,,,,,&$;>,,,,,,,,,,-<<<<<<<<=;,,;3777777777:=>,,,,,,>$X o@=oX$5777777777753*+ XO$;,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,%<<<<<<<<%>,,>*777777777-:;,,,,,,,,>$X O>;*7777753*+X XO$;>,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,%<<<<<<<<#,,,,O7777777771<;,,,,,,,,,,,>$>,>+753*+ XOO&>,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,%<<<<<<<:O,,,,$5777777774:;,,,,,,,,,,,,,,,,OX XO$;>,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,-<<<<<<<@&,,,,&3777777775=;,,,,,,,,,,,,,,,,$ XO$;,,,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,@<<<<<<=X,,,,,>*777777777#>,,,,,,,,,,,,,,,,>&>,,,,,,,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,#<<<<<:.;,,,,,,+777777777*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,$:<<<:.$,,,,,,,$777777753+,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,;.@==.O,,,,,,,,&57753*$&$O,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,>O $,,,,,,,,,>++X $OX $,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,>&$,,,,,,,,,,,X X O$,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,$$;,,>,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
};

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

1
fltk-options/makedepend Normal file
View File

@ -0,0 +1 @@

View File

@ -48,6 +48,7 @@ $FLLIBNAME=@FLLIBNAME@
$GLDSONAME=@GLDSONAME@
$GLLIBNAME=@GLLIBNAME@
$FLUID=@FLUID@
$FLTK_OPTIONS=@FLTK_OPTIONS@
$JPEG=@JPEG@
$PNG=@PNG@
$ZLIB=@ZLIB@
@ -114,6 +115,16 @@ f 0444 root sys /Applications/fluid.app/Contents/Resources/fluid.icns fluid/flui
%postinstall $bindir/fltk-config --post $bindir/fluid
%postremove /bin/rm -rf /Applications/fluid.app
d 0555 root sys /Applications/fltk-options.app -
d 0555 root sys /Applications/fltk-options.app/Contents -
f 0444 root sys /Applications/fltk-options.app/Contents/Info.plist fltk-options/fltk-options.app/Contents/Info.plist
d 0555 root sys /Applications/fltk-options.app/Contents/MacOS -
l 0555 root sys /Applications/fltk-options.app/Contents/MacOS/fltk-options $bindir/fltk-options
d 0555 root sys /Applications/fltk-options.app/Contents/Resources -
f 0444 root sys /Applications/fltk-options.app/Contents/Resources/fltk-options.icns fltk-options/fltk-options.app/Contents/Resources/fltk-options.icns
%postinstall $bindir/fltk-config --post $bindir/fltk-options
%postremove /bin/rm -rf /Applications/fltk-options.app
%system !darwin
f 0444 root sys /usr/share/applications/fluid.desktop fluid/fluid.desktop
f 0444 root sys /usr/share/icons/hicolor/16x16/apps/fluid.png fluid/icons/fluid-16.png
@ -123,17 +134,28 @@ f 0444 root sys /usr/share/icons/hicolor/64x64/apps/fluid.png fluid/icons/fluid-
f 0444 root sys /usr/share/icons/hicolor/128x128/apps/fluid.png fluid/icons/fluid-128.png
f 0444 root sys /usr/share/mimelnk/application/x-fluid.desktop fluid/fluid.desktop
f 0444 root sys /usr/share/applications/fltk-options.desktop fltk-options/fltk-options.desktop
f 0444 root sys /usr/share/icons/hicolor/16x16/apps/fltk-options.png fltk-options/icons/fltk-options-16.png
f 0444 root sys /usr/share/icons/hicolor/32x32/apps/fltk-options.png fltk-options/icons/fltk-options-32.png
f 0444 root sys /usr/share/icons/hicolor/48x48/apps/fltk-options.png fltk-options/icons/fltk-options-48.png
f 0444 root sys /usr/share/icons/hicolor/64x64/apps/fltk-options.png fltk-options/icons/fltk-options-64.png
f 0444 root sys /usr/share/icons/hicolor/128x128/apps/fltk-options.png fltk-options/icons/fltk-options-128.png
f 0444 root sys /usr/share/mimelnk/application/x-fltk-options.desktop fltk-options/fltk-options.desktop
%system all
# FLUID
# Applications
f 0555 root sys $bindir/fluid fluid/$FLUID
f 0555 root sys $bindir/fltk-options fltk-options/$FLTK_OPTIONS
f 0555 root sys $bindir/fltk-config fltk-config
# Man pages
f 0444 root sys $mandir/cat1/fluid.$CAT1EXT documentation/src/fluid.$CAT1EXT
f 0444 root sys $mandir/cat1/fltk-options.$CAT1EXT documentation/src/fltk-options.$CAT1EXT
f 0444 root sys $mandir/cat1/fltk-config.$CAT1EXT documentation/src/fltk-config.$CAT1EXT
f 0444 root sys $mandir/cat3/fltk.$CAT3EXT documentation/src/fltk.$CAT3EXT
f 0444 root sys $mandir/man1/fluid.1 documentation/src/fluid.man
f 0444 root sys $mandir/man1/fltk-options.1 documentation/src/fltk-options.man
f 0444 root sys $mandir/man1/fltk-config.1 documentation/src/fltk-config.man
f 0444 root sys $mandir/man3/fltk.3 documentation/src/fltk.man

View File

@ -257,11 +257,6 @@ void show_settings_cb(Fl_Widget *, void *) {
settings_window->show();
}
void show_global_settings_cb(Fl_Widget *, void *) {
global_settings_window->hotspot(global_settings_window);
show_global_settings_window();
}
void header_input_cb(Fl_Input* i, void*) {
if (strcmp(g_project.header_file_name, i->value()))
set_modflag(1);

View File

@ -31,7 +31,6 @@ void toggle_overlays(Fl_Widget *,void *);
void show_project_cb(Fl_Widget *, void *);
void show_grid_cb(Fl_Widget *, void *);
void show_settings_cb(Fl_Widget *, void *);
void show_global_settings_cb(Fl_Widget *, void *);
class Fl_Window_Type : public Fl_Widget_Type {
protected:

View File

@ -610,383 +610,3 @@ Fl_Double_Window* make_layout_window() {
} // Fl_Double_Window* grid_window
return grid_window;
}
/**
Copy of all options in user and system mode
*/
static int opt[10][2];
/**
Update the UI using the values in the opt array
*/
static void refreshUI() {
int mode = wUserOrSystem->value();
wVisibleFocus->value(opt[Fl::OPTION_VISIBLE_FOCUS][mode]);
wArrowFocus->value(opt[Fl::OPTION_ARROW_FOCUS][mode]);
wShowTooltips->value(opt[Fl::OPTION_SHOW_TOOLTIPS][mode]);
wDNDText->value(opt[Fl::OPTION_DND_TEXT][mode]);
wGTKText->value(opt[Fl::OPTION_FNFC_USES_GTK][mode]);
wPrintGTKText->value(opt[Fl::OPTION_PRINTER_USES_GTK][mode]);
wShowZoomFactor->value(opt[Fl::OPTION_SHOW_SCALING][mode]);
wUseZenity->value(opt[Fl::OPTION_FNFC_USES_ZENITY][mode]);
}
/**
read all preferences and refresh the GUI
*/
static void readPrefs() {
// read all preferences and refresh the GUI
{
Fl_Preferences prefs(Fl_Preferences::SYSTEM_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1], 2);
opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1], 2);
opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][1], 2);
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK ][1], 2);
opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][1], 2);
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][1], 2);
opt_prefs.get("UseZenity", opt[Fl::OPTION_FNFC_USES_ZENITY ][1], 2);
}
{
Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0], 2);
opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0], 2);
opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][0], 2);
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK ][0], 2);
opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][0], 2);
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][0], 2);
opt_prefs.get("UseZenity", opt[Fl::OPTION_FNFC_USES_ZENITY ][0], 2);
}
refreshUI();
}
/**
write all preferences using the array
*/
static void writePrefs() {
// write all preferences using the array
{
Fl_Preferences prefs(Fl_Preferences::SYSTEM_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
if (opt[Fl::OPTION_ARROW_FOCUS][1]==2) opt_prefs.deleteEntry("ArrowFocus");
else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1]);
if (opt[Fl::OPTION_VISIBLE_FOCUS][1]==2) opt_prefs.deleteEntry("VisibleFocus");
else opt_prefs.set("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1]);
if (opt[Fl::OPTION_DND_TEXT][1]==2) opt_prefs.deleteEntry("DNDText");
else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][1]);
if (opt[Fl::OPTION_SHOW_TOOLTIPS][1]==2) opt_prefs.deleteEntry("ShowTooltips");
else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1]);
if (opt[Fl::OPTION_FNFC_USES_GTK][1]==2) opt_prefs.deleteEntry("FNFCUsesGTK");
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][1]);
if (opt[Fl::OPTION_PRINTER_USES_GTK][1]==2) opt_prefs.deleteEntry("PrintUsesGTK");
else opt_prefs.set("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK][1]);
if (opt[Fl::OPTION_SHOW_SCALING][1]==2) opt_prefs.deleteEntry("ShowZoomFactor");
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][1]);
if (opt[Fl::OPTION_FNFC_USES_ZENITY][1]==2) opt_prefs.deleteEntry("UseZenity");
else opt_prefs.set("UseZenity", opt[Fl::OPTION_FNFC_USES_ZENITY][1]);
}
{
Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
if (opt[Fl::OPTION_ARROW_FOCUS][0]==2) opt_prefs.deleteEntry("ArrowFocus");
else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0]);
if (opt[Fl::OPTION_VISIBLE_FOCUS][0]==2) opt_prefs.deleteEntry("VisibleFocus");
else opt_prefs.set("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0]);
if (opt[Fl::OPTION_DND_TEXT][0]==2) opt_prefs.deleteEntry("DNDText");
else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][0]);
if (opt[Fl::OPTION_SHOW_TOOLTIPS][0]==2) opt_prefs.deleteEntry("ShowTooltips");
else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0]);
if (opt[Fl::OPTION_FNFC_USES_GTK][0]==2) opt_prefs.deleteEntry("FNFCUsesGTK");
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][0]);
if (opt[Fl::OPTION_PRINTER_USES_GTK][0]==2) opt_prefs.deleteEntry("PrintUsesGTK");
else opt_prefs.set("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK][0]);
if (opt[Fl::OPTION_SHOW_SCALING][0]==2) opt_prefs.deleteEntry("ShowZoomFactor");
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][0]);
if (opt[Fl::OPTION_FNFC_USES_ZENITY][0]==2) opt_prefs.deleteEntry("UseZenity");
else opt_prefs.set("UseZenity", opt[Fl::OPTION_FNFC_USES_ZENITY][0]);
}
}
void show_global_settings_window() {
if (!global_settings_window)
make_global_settings_window();
readPrefs();
refreshUI();
fl_message(
"WARNING!\n\n"
"The following dialog changes the user interface behavior\n"
"of ALL FLTK applications, for the current user, or for \n"
"ALL users on this machine.\n\n"
"Please choose these settings carefully, or reset\n"
"user and system settings to \"default\".");
global_settings_window->show();
}
Fl_Double_Window *global_settings_window=(Fl_Double_Window *)0;
Fl_Choice *wVisibleFocus=(Fl_Choice *)0;
static void cb_wVisibleFocus(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_VISIBLE_FOCUS][mode] = wVisibleFocus->value();
}
Fl_Menu_Item menu_wVisibleFocus[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wArrowFocus=(Fl_Choice *)0;
static void cb_wArrowFocus(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_ARROW_FOCUS][mode] = wArrowFocus->value();
}
Fl_Menu_Item menu_wArrowFocus[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wShowTooltips=(Fl_Choice *)0;
static void cb_wShowTooltips(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_SHOW_TOOLTIPS][mode] = wShowTooltips->value();
}
Fl_Menu_Item menu_wShowTooltips[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wDNDText=(Fl_Choice *)0;
static void cb_wDNDText(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_DND_TEXT][mode] = wDNDText->value();
}
Fl_Menu_Item menu_wDNDText[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wGTKText=(Fl_Choice *)0;
static void cb_wGTKText(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_FNFC_USES_GTK ][mode] = wGTKText->value();
}
Fl_Menu_Item menu_wGTKText[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wUseZenity=(Fl_Choice *)0;
static void cb_wUseZenity(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_FNFC_USES_ZENITY ][mode] = wUseZenity->value();
}
Fl_Menu_Item menu_wUseZenity[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wPrintGTKText=(Fl_Choice *)0;
static void cb_wPrintGTKText(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_PRINTER_USES_GTK ][mode] = wPrintGTKText->value();
}
Fl_Menu_Item menu_wPrintGTKText[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wShowZoomFactor=(Fl_Choice *)0;
static void cb_wShowZoomFactor(Fl_Choice*, void*) {
int mode = wUserOrSystem->value();
opt[Fl::OPTION_SHOW_SCALING ][mode] = wShowZoomFactor->value();
}
Fl_Menu_Item menu_wShowZoomFactor[] = {
{"off", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"on", 0, 0, (void*)(1), 128, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"default", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Choice *wUserOrSystem=(Fl_Choice *)0;
static void cb_wUserOrSystem(Fl_Choice*, void*) {
refreshUI();
}
Fl_Menu_Item menu_wUserOrSystem[] = {
{"User Settings", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{"System Settings", 0, 0, (void*)(1), 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0}
};
static void cb_Cancel1(Fl_Button*, void*) {
global_settings_window->hide();
}
static void cb_OK(Fl_Button*, void*) {
writePrefs();
global_settings_window->hide();
}
Fl_Double_Window* make_global_settings_window() {
{ global_settings_window = new Fl_Double_Window(400, 572, "FLTK Preferences");
global_settings_window->color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(10, 10, 380, 100, "Keyboard Focus Options");
o->box(FL_GTK_DOWN_BOX);
o->labelfont(2);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ wVisibleFocus = new Fl_Choice(245, 40, 100, 25, "Visible Keyboard Focus:");
wVisibleFocus->tooltip("OPTION_VISIBLE_FOCUS\n\nIf visible focus is switched on, FLTK will draw a dot\
ted rectangle inside the widget that will receive the next keystroke. If switc\
hed off, no such indicator will be drawn and keyboard navigation is disabled.\
\n\nDefault is on.");
wVisibleFocus->down_box(FL_BORDER_BOX);
wVisibleFocus->callback((Fl_Callback*)cb_wVisibleFocus);
wVisibleFocus->menu(menu_wVisibleFocus);
} // Fl_Choice* wVisibleFocus
{ wArrowFocus = new Fl_Choice(245, 75, 100, 25, "Arrow Keys move Focus:");
wArrowFocus->tooltip("OPTION_ARROW_FOCUS\n\nWhen switched on, moving the text cursor beyond the sta\
rt or end of the text in a text widget will change focus to the next widget. W\
hen switched off, the cursor will stop at the end of the text. Pressing Tab or\
Ctrl-Tab will advance the keyboard focus. Switch this on, if you want the old\
behavior of FLTK 1.1.\n\nDefault is off.");
wArrowFocus->down_box(FL_BORDER_BOX);
wArrowFocus->callback((Fl_Callback*)cb_wArrowFocus);
wArrowFocus->menu(menu_wArrowFocus);
} // Fl_Choice* wArrowFocus
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(10, 120, 380, 65, "Tooltip Options");
o->box(FL_GTK_DOWN_BOX);
o->labelfont(2);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ wShowTooltips = new Fl_Choice(245, 150, 100, 25, "Show Tooltips:");
wShowTooltips->tooltip("OPTION_SHOW_TOOLTIPS\n\nIf tooltips are enabled, hovering the mouse over a wi\
dget with a tooltip text will open a little tooltip window until the mouse lea\
ves the widget. If disabled, no tooltip is shown.\n\nDefault is on.");
wShowTooltips->down_box(FL_BORDER_BOX);
wShowTooltips->callback((Fl_Callback*)cb_wShowTooltips);
wShowTooltips->menu(menu_wShowTooltips);
} // Fl_Choice* wShowTooltips
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(10, 194, 380, 66, "Drag And Drop Options");
o->box(FL_GTK_DOWN_BOX);
o->labelfont(2);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ wDNDText = new Fl_Choice(245, 225, 100, 25, "Allow dragging Text:");
wDNDText->tooltip("OPTION_DND_TEXT\n\nIf text drag-and-drop is enabled, the user can select and \
drag text from any text widget. If disabled, no dragging is possible, however \
dropping text from other applications still works.\n\nDefault is on.");
wDNDText->down_box(FL_BORDER_BOX);
wDNDText->callback((Fl_Callback*)cb_wDNDText);
wDNDText->menu(menu_wDNDText);
} // Fl_Choice* wDNDText
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(10, 269, 380, 104, "Native File Chooser Options");
o->box(FL_GTK_DOWN_BOX);
o->labelfont(2);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ wGTKText = new Fl_Choice(245, 300, 100, 25, "Native File Chooser uses GTK:");
wGTKText->tooltip("OPTION_FNFC_USES_GTK\n\nIf \'Native File Chooser uses GTK\' is enabled, the F\
l_Native_File_Chooser class\ncalls the GTK open/save file dialogs when they ar\
e available on the platfom. If disabled, the Fl_Native_File_Chooser class\nalw\
ays uses FLTK\'s own file dialog (i.e., Fl_File_Chooser) even if GTK is availa\
ble.\n\nDefault is on.");
wGTKText->down_box(FL_BORDER_BOX);
wGTKText->callback((Fl_Callback*)cb_wGTKText);
wGTKText->menu(menu_wGTKText);
} // Fl_Choice* wGTKText
{ wUseZenity = new Fl_Choice(245, 334, 100, 26, "Native File Chooser uses Zenity:");
wUseZenity->tooltip("OPTION_FNFC_USES_ZENITY\n\nIf \'Native File Chooser uses Zenity\' is enabled,\
the library uses a Zenity-based file dialog to open/save files when possible.\
If disabled, the GTK-based dialog is used. Default is on. Meaningful only wit\
h Wayland/X11 platforms.");
wUseZenity->down_box(FL_BORDER_BOX);
wUseZenity->callback((Fl_Callback*)cb_wUseZenity);
wUseZenity->menu(menu_wUseZenity);
} // Fl_Choice* wUseZenity
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(10, 384, 380, 66, "Print dialog Options");
o->box(FL_GTK_DOWN_BOX);
o->labelfont(2);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ wPrintGTKText = new Fl_Choice(245, 405, 100, 25, "Print dialog uses GTK:");
wPrintGTKText->tooltip("OPTION_PRINTER_USES_GTK\n\nIf \'Print dialog uses GTK\' is enabled, the Fl_Pr\
inter class\ncalls the GTK print dialog when it\'s available on the platfom. I\
f disabled, the Fl_Printer class\nalways uses FLTK\'s own print dialog even if\
GTK is available.\n\nDefault is on.");
wPrintGTKText->down_box(FL_BORDER_BOX);
wPrintGTKText->callback((Fl_Callback*)cb_wPrintGTKText);
wPrintGTKText->menu(menu_wPrintGTKText);
} // Fl_Choice* wPrintGTKText
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(10, 459, 380, 66, "Scaling Factor Options");
o->box(FL_GTK_DOWN_BOX);
o->labelfont(2);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ wShowZoomFactor = new Fl_Choice(245, 483, 100, 25, "Transiently show scaling factor:");
wShowZoomFactor->tooltip("OPTION_SHOW_SCALING\n\nIf \'Transiently show scaling factor\' is enabled, the\
library shows in a transient yellow window the display\nscaling factor value \
when it is changed. If disabled, no such transient window is used.\n\nDefault \
is on.");
wShowZoomFactor->down_box(FL_BORDER_BOX);
wShowZoomFactor->callback((Fl_Callback*)cb_wShowZoomFactor);
wShowZoomFactor->menu(menu_wShowZoomFactor);
} // Fl_Choice* wShowZoomFactor
o->end();
} // Fl_Group* o
{ wUserOrSystem = new Fl_Choice(10, 535, 141, 25);
wUserOrSystem->tooltip("Change settings for the current user, or default values for all users of this\
computer. Individual users can override system options, if they set their opt\
ions to specific values (not \'default\').");
wUserOrSystem->down_box(FL_BORDER_BOX);
wUserOrSystem->callback((Fl_Callback*)cb_wUserOrSystem);
wUserOrSystem->menu(menu_wUserOrSystem);
} // Fl_Choice* wUserOrSystem
{ Fl_Button* o = new Fl_Button(230, 535, 75, 25, "Cancel");
o->callback((Fl_Callback*)cb_Cancel1);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(315, 535, 75, 25, "OK");
o->callback((Fl_Callback*)cb_OK);
} // Fl_Button* o
global_settings_window->end();
} // Fl_Double_Window* global_settings_window
readPrefs();
Fl::option(Fl::OPTION_SHOW_TOOLTIPS,1); // make sure tooltips are on !
return global_settings_window;
}

View File

@ -59,7 +59,7 @@ decl {extern struct Fl_Menu_Item *dbmanager_item;} {public local
Function {make_project_window()} {} {
Fl_Window project_window {
label {Project Settings} open
label {Project Settings}
xywh {472 246 399 298} type Double hide
code0 {\#include <FL/Fl_Preferences.H>}
code1 {\#include <FL/Fl_Tooltip.H>} modal
@ -291,7 +291,7 @@ Examples:
Function {make_shell_window()} {open
} {
Fl_Window shell_window {
label {Shell Command} open
label {Shell Command}
xywh {544 751 365 200} type Double hide modal size_range {365 200 365 200}
} {
Fl_Group {} {open
@ -488,391 +488,3 @@ Function {make_layout_window()} {open
}
}
}
decl {int opt[10][2];} {
comment {Copy of all options in user and system mode} private local
}
Function {refreshUI()} {
comment {Update the UI using the values in the opt array} private return_type void
} {
code {int mode = wUserOrSystem->value();
wVisibleFocus->value(opt[Fl::OPTION_VISIBLE_FOCUS][mode]);
wArrowFocus->value(opt[Fl::OPTION_ARROW_FOCUS][mode]);
wShowTooltips->value(opt[Fl::OPTION_SHOW_TOOLTIPS][mode]);
wDNDText->value(opt[Fl::OPTION_DND_TEXT][mode]);
wGTKText->value(opt[Fl::OPTION_FNFC_USES_GTK][mode]);
wPrintGTKText->value(opt[Fl::OPTION_PRINTER_USES_GTK][mode]);
wShowZoomFactor->value(opt[Fl::OPTION_SHOW_SCALING][mode]);
wUseZenity->value(opt[Fl::OPTION_FNFC_USES_ZENITY][mode]);} {}
}
Function {readPrefs()} {
comment {read all preferences and refresh the GUI} open private return_type void
} {
code {// read all preferences and refresh the GUI
{
Fl_Preferences prefs(Fl_Preferences::SYSTEM_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1], 2);
opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1], 2);
opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][1], 2);
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK ][1], 2);
opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][1], 2);
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][1], 2);
opt_prefs.get("UseZenity", opt[Fl::OPTION_FNFC_USES_ZENITY ][1], 2);
}
{
Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
opt_prefs.get("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0], 2);
opt_prefs.get("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0], 2);
opt_prefs.get("DNDText", opt[Fl::OPTION_DND_TEXT][0], 2);
opt_prefs.get("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0], 2);
opt_prefs.get("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK ][0], 2);
opt_prefs.get("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK ][0], 2);
opt_prefs.get("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING ][0], 2);
opt_prefs.get("UseZenity", opt[Fl::OPTION_FNFC_USES_ZENITY ][0], 2);
}
refreshUI();} {}
}
Function {writePrefs()} {
comment {write all preferences using the array} open private return_type void
} {
code {// write all preferences using the array
{
Fl_Preferences prefs(Fl_Preferences::SYSTEM_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
if (opt[Fl::OPTION_ARROW_FOCUS][1]==2) opt_prefs.deleteEntry("ArrowFocus");
else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][1]);
if (opt[Fl::OPTION_VISIBLE_FOCUS][1]==2) opt_prefs.deleteEntry("VisibleFocus");
else opt_prefs.set("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][1]);
if (opt[Fl::OPTION_DND_TEXT][1]==2) opt_prefs.deleteEntry("DNDText");
else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][1]);
if (opt[Fl::OPTION_SHOW_TOOLTIPS][1]==2) opt_prefs.deleteEntry("ShowTooltips");
else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][1]);
if (opt[Fl::OPTION_FNFC_USES_GTK][1]==2) opt_prefs.deleteEntry("FNFCUsesGTK");
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][1]);
if (opt[Fl::OPTION_PRINTER_USES_GTK][1]==2) opt_prefs.deleteEntry("PrintUsesGTK");
else opt_prefs.set("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK][1]);
if (opt[Fl::OPTION_SHOW_SCALING][1]==2) opt_prefs.deleteEntry("ShowZoomFactor");
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][1]);
if (opt[Fl::OPTION_FNFC_USES_ZENITY][1]==2) opt_prefs.deleteEntry("UseZenity");
else opt_prefs.set("UseZenity", opt[Fl::OPTION_FNFC_USES_ZENITY][1]);
}
{
Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "fltk");
Fl_Preferences opt_prefs(prefs, "options");
if (opt[Fl::OPTION_ARROW_FOCUS][0]==2) opt_prefs.deleteEntry("ArrowFocus");
else opt_prefs.set("ArrowFocus", opt[Fl::OPTION_ARROW_FOCUS][0]);
if (opt[Fl::OPTION_VISIBLE_FOCUS][0]==2) opt_prefs.deleteEntry("VisibleFocus");
else opt_prefs.set("VisibleFocus", opt[Fl::OPTION_VISIBLE_FOCUS][0]);
if (opt[Fl::OPTION_DND_TEXT][0]==2) opt_prefs.deleteEntry("DNDText");
else opt_prefs.set("DNDText", opt[Fl::OPTION_DND_TEXT][0]);
if (opt[Fl::OPTION_SHOW_TOOLTIPS][0]==2) opt_prefs.deleteEntry("ShowTooltips");
else opt_prefs.set("ShowTooltips", opt[Fl::OPTION_SHOW_TOOLTIPS][0]);
if (opt[Fl::OPTION_FNFC_USES_GTK][0]==2) opt_prefs.deleteEntry("FNFCUsesGTK");
else opt_prefs.set("FNFCUsesGTK", opt[Fl::OPTION_FNFC_USES_GTK][0]);
if (opt[Fl::OPTION_PRINTER_USES_GTK][0]==2) opt_prefs.deleteEntry("PrintUsesGTK");
else opt_prefs.set("PrintUsesGTK", opt[Fl::OPTION_PRINTER_USES_GTK][0]);
if (opt[Fl::OPTION_SHOW_SCALING][0]==2) opt_prefs.deleteEntry("ShowZoomFactor");
else opt_prefs.set("ShowZoomFactor", opt[Fl::OPTION_SHOW_SCALING][0]);
if (opt[Fl::OPTION_FNFC_USES_ZENITY][0]==2) opt_prefs.deleteEntry("UseZenity");
else opt_prefs.set("UseZenity", opt[Fl::OPTION_FNFC_USES_ZENITY][0]);
}} {}
}
Function {show_global_settings_window()} {open return_type void
} {
code {if (!global_settings_window)
make_global_settings_window();
readPrefs();
refreshUI();
fl_message(
"WARNING!\\n\\n"
"The following dialog changes the user interface behavior\\n"
"of ALL FLTK applications, for the current user, or for \\n"
"ALL users on this machine.\\n\\n"
"Please choose these settings carefully, or reset\\n"
"user and system settings to \\"default\\".");
global_settings_window->show();} {}
}
Function {make_global_settings_window()} {} {
Fl_Window global_settings_window {
label {FLTK Preferences} open
xywh {817 110 400 572} type Double color 50 hide
} {
Fl_Group {} {
label {Keyboard Focus Options} open
xywh {10 10 380 100} box GTK_DOWN_BOX labelfont 2 align 21
} {
Fl_Choice wVisibleFocus {
label {Visible Keyboard Focus:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_VISIBLE_FOCUS][mode] = wVisibleFocus->value();} open
tooltip {OPTION_VISIBLE_FOCUS
If visible focus is switched on, FLTK will draw a dotted rectangle inside the widget that will receive the next keystroke. If switched off, no such indicator will be drawn and keyboard navigation is disabled.
Default is on.} xywh {245 40 100 25} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long
xywh {10 10 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {10 10 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {10 10 31 20}
}
}
Fl_Choice wArrowFocus {
label {Arrow Keys move Focus:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_ARROW_FOCUS][mode] = wArrowFocus->value();} open
tooltip {OPTION_ARROW_FOCUS
When switched on, moving the text cursor beyond the start or end of the text in a text widget will change focus to the next widget. When switched off, the cursor will stop at the end of the text. Pressing Tab or Ctrl-Tab will advance the keyboard focus. Switch this on, if you want the old behavior of FLTK 1.1.
Default is off.} xywh {245 75 100 25} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long
xywh {0 0 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {0 0 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {0 0 31 20}
}
}
}
Fl_Group {} {
label {Tooltip Options} open
xywh {10 120 380 65} box GTK_DOWN_BOX labelfont 2 align 21
} {
Fl_Choice wShowTooltips {
label {Show Tooltips:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_SHOW_TOOLTIPS][mode] = wShowTooltips->value();} open
tooltip {OPTION_SHOW_TOOLTIPS
If tooltips are enabled, hovering the mouse over a widget with a tooltip text will open a little tooltip window until the mouse leaves the widget. If disabled, no tooltip is shown.
Default is on.} xywh {245 150 100 25} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long
xywh {10 10 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {10 10 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {10 10 31 20}
}
}
}
Fl_Group {} {
label {Drag And Drop Options} open
xywh {10 194 380 66} box GTK_DOWN_BOX labelfont 2 align 21
} {
Fl_Choice wDNDText {
label {Allow dragging Text:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_DND_TEXT][mode] = wDNDText->value();} open
tooltip {OPTION_DND_TEXT
If text drag-and-drop is enabled, the user can select and drag text from any text widget. If disabled, no dragging is possible, however dropping text from other applications still works.
Default is on.} xywh {245 225 100 25} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long
xywh {30 30 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {30 30 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {30 30 31 20}
}
}
}
Fl_Group {} {
label {Native File Chooser Options} open
xywh {10 269 380 104} box GTK_DOWN_BOX labelfont 2 align 21
} {
Fl_Choice wGTKText {
label {Native File Chooser uses GTK:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_FNFC_USES_GTK ][mode] = wGTKText->value();} open
tooltip {OPTION_FNFC_USES_GTK
If 'Native File Chooser uses GTK' is enabled, the Fl_Native_File_Chooser class
calls the GTK open/save file dialogs when they are available on the platfom. If disabled, the Fl_Native_File_Chooser class
always uses FLTK's own file dialog (i.e., Fl_File_Chooser) even if GTK is available.
Default is on.} xywh {245 300 100 25} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long
xywh {30 30 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {30 30 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {30 30 31 20}
}
}
Fl_Choice wUseZenity {
label {Native File Chooser uses Zenity:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_FNFC_USES_ZENITY ][mode] = wUseZenity->value();}
tooltip {OPTION_FNFC_USES_ZENITY
If 'Native File Chooser uses Zenity' is enabled, the library uses a Zenity-based file dialog to open/save files when possible. If disabled, the GTK-based dialog is used. Default is on. Meaningful only with Wayland/X11 platforms.} xywh {245 334 100 26} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long
xywh {545 545 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {545 545 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {545 545 31 20}
}
}
}
Fl_Group {} {
label {Print dialog Options} open
xywh {10 384 380 66} box GTK_DOWN_BOX labelfont 2 align 21
} {
Fl_Choice wPrintGTKText {
label {Print dialog uses GTK:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_PRINTER_USES_GTK ][mode] = wPrintGTKText->value();} open
tooltip {OPTION_PRINTER_USES_GTK
If 'Print dialog uses GTK' is enabled, the Fl_Printer class
calls the GTK print dialog when it's available on the platfom. If disabled, the Fl_Printer class
always uses FLTK's own print dialog even if GTK is available.
Default is on.} xywh {245 405 100 25} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long
xywh {30 30 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {30 30 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {30 30 31 20}
}
}
}
Fl_Group {} {
label {Scaling Factor Options} open
xywh {10 459 380 66} box GTK_DOWN_BOX labelfont 2 align 21
} {
Fl_Choice wShowZoomFactor {
label {Transiently show scaling factor:}
callback {int mode = wUserOrSystem->value();
opt[Fl::OPTION_SHOW_SCALING ][mode] = wShowZoomFactor->value();} open
tooltip {OPTION_SHOW_SCALING
If 'Transiently show scaling factor' is enabled, the library shows in a transient yellow window the display
scaling factor value when it is changed. If disabled, no such transient window is used.
Default is on.} xywh {245 483 100 25} down_box BORDER_BOX
} {
MenuItem {} {
label off
user_data 0 user_data_type long
xywh {30 30 31 20}
}
MenuItem {} {
label on
user_data 1 user_data_type long
xywh {30 30 31 20} divider
}
MenuItem {} {
label default
user_data 2 user_data_type long
xywh {30 30 31 20}
}
}
}
Fl_Choice wUserOrSystem {
callback {refreshUI();} open
tooltip {Change settings for the current user, or default values for all users of this computer. Individual users can override system options, if they set their options to specific values (not 'default').} xywh {10 535 141 25} down_box BORDER_BOX
} {
MenuItem {} {
label {User Settings}
user_data 0 user_data_type long
xywh {0 0 31 20}
}
MenuItem {} {
label {System Settings}
user_data 1 user_data_type long
xywh {0 0 31 20}
}
}
Fl_Button {} {
label Cancel
callback {global_settings_window->hide();}
xywh {230 535 75 25}
}
Fl_Button {} {
label OK
callback {writePrefs();
global_settings_window->hide();}
xywh {315 535 75 25}
}
}
code {readPrefs();
Fl::option(Fl::OPTION_SHOW_TOOLTIPS,1); // make sure tooltips are on !} {}
}

View File

@ -105,25 +105,4 @@ extern Fl_Check_Button *guides_toggle;
extern void default_widget_size_cb(Fl_Round_Button*, long);
extern Fl_Round_Button *def_widget_size[6];
Fl_Double_Window* make_layout_window();
void show_global_settings_window();
extern Fl_Double_Window *global_settings_window;
extern Fl_Choice *wVisibleFocus;
extern Fl_Choice *wArrowFocus;
extern Fl_Choice *wShowTooltips;
extern Fl_Choice *wDNDText;
extern Fl_Choice *wGTKText;
extern Fl_Choice *wUseZenity;
extern Fl_Choice *wPrintGTKText;
extern Fl_Choice *wShowZoomFactor;
extern Fl_Choice *wUserOrSystem;
Fl_Double_Window* make_global_settings_window();
extern Fl_Menu_Item menu_wVisibleFocus[];
extern Fl_Menu_Item menu_wArrowFocus[];
extern Fl_Menu_Item menu_wShowTooltips[];
extern Fl_Menu_Item menu_wDNDText[];
extern Fl_Menu_Item menu_wGTKText[];
extern Fl_Menu_Item menu_wUseZenity[];
extern Fl_Menu_Item menu_wPrintGTKText[];
extern Fl_Menu_Item menu_wShowZoomFactor[];
extern Fl_Menu_Item menu_wUserOrSystem[];
#endif

View File

@ -1426,8 +1426,7 @@ Fl_Menu_Item Main_Menu[] = {
{"Show Widget &Bin...",FL_ALT+'b',toggle_widgetbin_cb},
{"Show Source Code...",FL_ALT+FL_SHIFT+'s', (Fl_Callback*)toggle_sourceview_cb, 0, FL_MENU_DIVIDER},
{"Pro&ject Settings...",FL_ALT+'p',show_project_cb},
{"GU&I Settings...",FL_ALT+FL_SHIFT+'p',show_settings_cb,0,FL_MENU_DIVIDER},
{"Global &FLTK Settings...",FL_ALT+FL_SHIFT+'g',show_global_settings_cb},
{"GU&I Settings...",FL_ALT+FL_SHIFT+'p',show_settings_cb},
{0},
{"&New", 0, 0, (void *)New_Menu, FL_SUBMENU_POINTER},
{"&Layout",0,0,0,FL_SUBMENU},
@ -1650,7 +1649,6 @@ void make_main_window() {
if (!batch_mode) {
load_history();
make_settings_window();
make_global_settings_window();
}
}

View File

@ -129,6 +129,9 @@ FLUID = @FLUID@$(EXEEXT)
# depends on the build type (native or cross-compiler)
FLUID_BUILD = @FLUID_BUILD@
# Name of fltk-options executable we install
FLTK_OPTIONS = @FLTK_OPTIONS@$(EXEEXT)
# Possible steps for OS X build only
OSX_ONLY = @OSX_ONLY@

View File

@ -1,7 +1,7 @@
//
// Main demo program for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2022 by Bill Spitzak and others.
// Copyright 1998-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@ -112,10 +112,11 @@ char params[256]; // commandline arguments
// Global path variables for all platforms and build systems
// to avoid duplication and dynamic allocation
char app_path [FL_PATH_MAX]; // directory of all demo binaries
char fluid_path [FL_PATH_MAX]; // binary directory of fluid
char data_path [FL_PATH_MAX]; // working directory of all demos
char command [2 * FL_PATH_MAX + 40]; // command to be executed
char app_path [FL_PATH_MAX]; // directory of all demo binaries
char fluid_path [FL_PATH_MAX]; // binary directory of fluid
char options_path [FL_PATH_MAX]; // binary directory of fltk-options
char data_path [FL_PATH_MAX]; // working directory of all demos
char command [2 * FL_PATH_MAX + 40]; // command to be executed
// platform specific suffix for executable files
@ -387,6 +388,8 @@ void dobut(Fl_Widget *, long arg) {
const char *path = app_path;
if (!strncmp(cmdbuf, "fluid", 5))
path = fluid_path;
else if (!strncmp(cmdbuf, "fltk-options", 5))
path = options_path;
// format commandline with optional parameters
@ -543,19 +546,25 @@ int main(int argc, char **argv) {
// - "../../$CMAKE_INTDIR" for multi-config (Visual Studio or Xcode) CMake builds
strcpy(fluid_path, app_path);
strcpy(options_path, app_path);
if (cmake_intdir)
if (cmake_intdir) {
fix_path(fluid_path); // remove intermediate (build type) folder, e.g. "/Debug"
fix_path(options_path);
}
fix_path(fluid_path); // remove folder name ("test")
fix_path(options_path);
#if !defined(GENERATED_BY_CMAKE)
strcat(fluid_path, "/fluid");
strcat(options_path, "/fltk-options");
#else
// CMake: potentially Visual Studio or Xcode (multi config)
if (cmake_intdir)
if (cmake_intdir) {
strcat(fluid_path, cmake_intdir); // append e.g. "/Debug"
strcat(options_path, cmake_intdir);
}
#endif // GENERATED_BY_CMAKE
// construct data_path for the menu file and all resources (data files)
@ -607,11 +616,12 @@ int main(int argc, char **argv) {
fl_getcwd(cwd, sizeof(cwd));
fix_path(cwd, 0);
debug_var("app_path", app_path);
debug_var("fluid_path", fluid_path);
debug_var("data_path", data_path);
debug_var("menu file", menu);
debug_var("cwd", cwd);
debug_var("app_path", app_path);
debug_var("fluid_path", fluid_path);
debug_var("options_path", options_path);
debug_var("data_path", data_path);
debug_var("menu file", menu);
debug_var("cwd", cwd);
tty->printf("\n");
}

View File

@ -58,7 +58,9 @@
@u:fast && slow widgets:fast_slow
@u:inactive:inactive
@main:Fluid\n(UI design tool):fluid valuators.fl
@main:Tools...:@t
@t:Fluid\n(UI design tool):fluid valuators.fl
@t:FLTK\nRuntime\nOptions:fltk-options
@main:Cool\nDemos...:@e
@e:Mandelbrot:mandelbrot