Some code optimizations

This commit is contained in:
Markus Gans 2015-09-22 04:18:20 +02:00
parent 461882ac8e
commit a5197c6c64
65 changed files with 1504 additions and 1173 deletions

View File

@ -1,4 +1,4 @@
2015-09-20 Markus Gans <guru.mail@muenster.de>
2015-09-22 Markus Gans <guru.mail@muenster.de>
* Some code optimizations
2015-09-18 Markus Gans <guru.mail@muenster.de>

View File

@ -88,10 +88,10 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/config.h.in AUTHORS COPYING ChangeLog config.guess \
config.sub depcomp install-sh missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prefix_config_h.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \

211
aclocal.m4 vendored
View File

@ -20,216 +20,6 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prefix_config_h.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])]
#
# DESCRIPTION
#
# This is a new variant from ac_prefix_config_ this one will use a
# lowercase-prefix if the config-define was starting with a
# lowercase-char, e.g. "#define const", "#define restrict", or "#define
# off_t", (and this one can live in another directory, e.g.
# testpkg/config.h therefore I decided to move the output-header to be the
# first arg)
#
# takes the usual config.h generated header file; looks for each of the
# generated "#define SOMEDEF" lines, and prefixes the defined name (ie.
# makes it "#define PREFIX_SOMEDEF". The result is written to the output
# config.header file. The PREFIX is converted to uppercase for the
# conversions.
#
# Defaults:
#
# OUTPUT-HEADER = $PACKAGE-config.h
# PREFIX = $PACKAGE
# ORIG-HEADER, from AM_CONFIG_HEADER(config.h)
#
# Your configure.ac script should contain both macros in this order, and
# unlike the earlier variations of this prefix-macro it is okay to place
# the AX_PREFIX_CONFIG_H call before the AC_OUTPUT invokation.
#
# Example:
#
# AC_INIT(config.h.in) # config.h.in as created by "autoheader"
# AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE
# AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in
# AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it..
# AC_MEMORY_H # makes "#undef NEED_MEMORY_H"
# AC_C_CONST_H # makes "#undef const"
# AC_OUTPUT(Makefile) # creates the "config.h" now
# # and also mylib/_config.h
#
# if the argument to AX_PREFIX_CONFIG_H would have been omitted then the
# default outputfile would have been called simply "testpkg-config.h", but
# even under the name "mylib/_config.h" it contains prefix-defines like
#
# #ifndef TESTPKG_VERSION
# #define TESTPKG_VERSION "0.1.1"
# #endif
# #ifndef TESTPKG_NEED_MEMORY_H
# #define TESTPKG_NEED_MEMORY_H 1
# #endif
# #ifndef _testpkg_const
# #define _testpkg_const _const
# #endif
#
# and this "mylib/_config.h" can be installed along with other
# header-files, which is most convenient when creating a shared library
# (that has some headers) where some functionality is dependent on the
# OS-features detected at compile-time. No need to invent some
# "mylib-confdefs.h.in" manually. :-)
#
# Note that some AC_DEFINEs that end up in the config.h file are actually
# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T
# say that they "will define inline|const|off_t if the system does not do
# it by itself". You might want to clean up about these - consider an
# extra mylib/conf.h that reads something like:
#
# #include <mylib/_config.h>
# #ifndef _testpkg_const
# #define _testpkg_const const
# #endif
#
# and then start using _testpkg_const in the header files. That is also a
# good thing to differentiate whether some library-user has starting to
# take up with a different compiler, so perhaps it could read something
# like this:
#
# #ifdef _MSC_VER
# #include <mylib/_msvc.h>
# #else
# #include <mylib/_config.h>
# #endif
# #ifndef _testpkg_const
# #define _testpkg_const const
# #endif
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2008 Marten Svantesson
# Copyright (c) 2008 Gerald Point <Gerald.Point@labri.fr>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 11
AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl
AC_PREREQ([2.62])
AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl
AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
m4_pushdef([_script],[conftest.prefix])dnl
m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
_PKG=`echo ifelse($2, , $PACKAGE, $2)`
_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
_INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'`
if test ".$_INP" = "."; then
for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
case "$ac_file" in
*.h) _INP=$ac_file ;;
*)
esac
test ".$_INP" != "." && break
done
fi
if test ".$_INP" = "."; then
case "$_OUT" in
*/*) _INP=`basename "$_OUT"`
;;
*-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
;;
*) _INP=config.h
;;
esac
fi
if test -z "$_PKG" ; then
AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
else
if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
_INP="$srcdir/$_INP"
fi fi
AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
if test -f $_INP ; then
AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/"]) > _script
AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/"]) >> _script
AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1\\"]) >> _script
AS_ECHO(["@%:@def[]ine $_UPP""_\\1\\2\\"]) >> _script
AS_ECHO(["@%:@endif/"]) >> _script
AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1\\"]) >> _script
AS_ECHO(["@%:@define $_LOW""_\\1\\2\\"]) >> _script
AS_ECHO(["@%:@endif/"]) >> _script
# now executing _script on _DEF input to create _OUT output file
echo "@%:@ifndef $_DEF" >$tmp/pconfig.h
echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
echo ' ' >>$tmp/pconfig.h
echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
sed -f _script $_INP >>$tmp/pconfig.h
echo ' ' >>$tmp/pconfig.h
echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h
echo "@%:@endif" >>$tmp/pconfig.h
if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
AC_MSG_NOTICE([$_OUT is unchanged])
else
ac_dir=`AS_DIRNAME(["$_OUT"])`
AS_MKDIR_P(["$ac_dir"])
rm -f "$_OUT"
mv $tmp/pconfig.h "$_OUT"
fi
cp _script _configs.sed
else
AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
fi
rm -f conftest.*
fi
m4_popdef([_symbol])dnl
m4_popdef([_script])dnl
AS_VAR_POPDEF([_INP])dnl
AS_VAR_POPDEF([_UPP])dnl
AS_VAR_POPDEF([_LOW])dnl
AS_VAR_POPDEF([_PKG])dnl
AS_VAR_POPDEF([_DEF])dnl
AS_VAR_POPDEF([_OUT])dnl
],[PACKAGE="$PACKAGE"])])
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@ -1247,6 +1037,7 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/ax_prefix_config_h.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])

View File

@ -10,6 +10,9 @@ case "$1" in
"--debug"|"debug")
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic"
;;
"--fulldebug"|"fulldebug")
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy"
;;
"--profile"|"profile")
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-pg -O0 -DDEBUG -W -Wall -pedantic"
;;

View File

@ -85,10 +85,10 @@ host_triplet = @host@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am TODO
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prefix_config_h.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -16,7 +16,6 @@ Url: https://github.com/gansm/finalcut/
Group: System/Libraries
Source: finalcut-%{version}.tar.gz
BuildRequires: automake
BuildRequires: autoconf-archive
BuildRequires: libtool
BuildRequires: gcc-c++
BuildRequires: glib2-devel
@ -28,9 +27,7 @@ BuildRequires: gpm-devel
%else
BuildRequires: gpm
%endif
%endif
%if %{defined fedora}
%else
BuildRequires: gpm-devel
%endif
@ -41,6 +38,7 @@ Requires: tr
Requires: grep
Requires: gzip
Requires: bdftopcf
Requires: autoconf-archive
Requires: gcc-c++
Prefix: %_prefix
@ -108,6 +106,7 @@ export CPPFLAGS="$RPM_OPT_FLAGS %{warn_flags}"
%configure
make %{?_smp_mflags} V=1
%install
make install libdir=${RPM_BUILD_ROOT}%{_libdir}/ \
includedir=${RPM_BUILD_ROOT}%{_includedir} \

209
m4/ax_prefix_config_h.m4 Normal file
View File

@ -0,0 +1,209 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prefix_config_h.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])]
#
# DESCRIPTION
#
# This is a new variant from ac_prefix_config_ this one will use a
# lowercase-prefix if the config-define was starting with a
# lowercase-char, e.g. "#define const", "#define restrict", or "#define
# off_t", (and this one can live in another directory, e.g.
# testpkg/config.h therefore I decided to move the output-header to be the
# first arg)
#
# takes the usual config.h generated header file; looks for each of the
# generated "#define SOMEDEF" lines, and prefixes the defined name (ie.
# makes it "#define PREFIX_SOMEDEF". The result is written to the output
# config.header file. The PREFIX is converted to uppercase for the
# conversions.
#
# Defaults:
#
# OUTPUT-HEADER = $PACKAGE-config.h
# PREFIX = $PACKAGE
# ORIG-HEADER, from AM_CONFIG_HEADER(config.h)
#
# Your configure.ac script should contain both macros in this order, and
# unlike the earlier variations of this prefix-macro it is okay to place
# the AX_PREFIX_CONFIG_H call before the AC_OUTPUT invokation.
#
# Example:
#
# AC_INIT(config.h.in) # config.h.in as created by "autoheader"
# AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE
# AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in
# AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it..
# AC_MEMORY_H # makes "#undef NEED_MEMORY_H"
# AC_C_CONST_H # makes "#undef const"
# AC_OUTPUT(Makefile) # creates the "config.h" now
# # and also mylib/_config.h
#
# if the argument to AX_PREFIX_CONFIG_H would have been omitted then the
# default outputfile would have been called simply "testpkg-config.h", but
# even under the name "mylib/_config.h" it contains prefix-defines like
#
# #ifndef TESTPKG_VERSION
# #define TESTPKG_VERSION "0.1.1"
# #endif
# #ifndef TESTPKG_NEED_MEMORY_H
# #define TESTPKG_NEED_MEMORY_H 1
# #endif
# #ifndef _testpkg_const
# #define _testpkg_const _const
# #endif
#
# and this "mylib/_config.h" can be installed along with other
# header-files, which is most convenient when creating a shared library
# (that has some headers) where some functionality is dependent on the
# OS-features detected at compile-time. No need to invent some
# "mylib-confdefs.h.in" manually. :-)
#
# Note that some AC_DEFINEs that end up in the config.h file are actually
# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T
# say that they "will define inline|const|off_t if the system does not do
# it by itself". You might want to clean up about these - consider an
# extra mylib/conf.h that reads something like:
#
# #include <mylib/_config.h>
# #ifndef _testpkg_const
# #define _testpkg_const const
# #endif
#
# and then start using _testpkg_const in the header files. That is also a
# good thing to differentiate whether some library-user has starting to
# take up with a different compiler, so perhaps it could read something
# like this:
#
# #ifdef _MSC_VER
# #include <mylib/_msvc.h>
# #else
# #include <mylib/_config.h>
# #endif
# #ifndef _testpkg_const
# #define _testpkg_const const
# #endif
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2008 Marten Svantesson
# Copyright (c) 2008 Gerald Point <Gerald.Point@labri.fr>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 11
AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl
AC_PREREQ([2.62])
AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl
AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
m4_pushdef([_script],[conftest.prefix])dnl
m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
_PKG=`echo ifelse($2, , $PACKAGE, $2)`
_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
_INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'`
if test ".$_INP" = "."; then
for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
case "$ac_file" in
*.h) _INP=$ac_file ;;
*)
esac
test ".$_INP" != "." && break
done
fi
if test ".$_INP" = "."; then
case "$_OUT" in
*/*) _INP=`basename "$_OUT"`
;;
*-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
;;
*) _INP=config.h
;;
esac
fi
if test -z "$_PKG" ; then
AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
else
if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
_INP="$srcdir/$_INP"
fi fi
AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
if test -f $_INP ; then
AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/"]) > _script
AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/"]) >> _script
AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1\\"]) >> _script
AS_ECHO(["@%:@def[]ine $_UPP""_\\1\\2\\"]) >> _script
AS_ECHO(["@%:@endif/"]) >> _script
AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1\\"]) >> _script
AS_ECHO(["@%:@define $_LOW""_\\1\\2\\"]) >> _script
AS_ECHO(["@%:@endif/"]) >> _script
# now executing _script on _DEF input to create _OUT output file
echo "@%:@ifndef $_DEF" >$tmp/pconfig.h
echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
echo ' ' >>$tmp/pconfig.h
echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
sed -f _script $_INP >>$tmp/pconfig.h
echo ' ' >>$tmp/pconfig.h
echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h
echo "@%:@endif" >>$tmp/pconfig.h
if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
AC_MSG_NOTICE([$_OUT is unchanged])
else
ac_dir=`AS_DIRNAME(["$_OUT"])`
AS_MKDIR_P(["$ac_dir"])
rm -f "$_OUT"
mv $tmp/pconfig.h "$_OUT"
fi
cp _script _configs.sed
else
AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
fi
rm -f conftest.*
fi
m4_popdef([_symbol])dnl
m4_popdef([_script])dnl
AS_VAR_POPDEF([_INP])dnl
AS_VAR_POPDEF([_UPP])dnl
AS_VAR_POPDEF([_LOW])dnl
AS_VAR_POPDEF([_PKG])dnl
AS_VAR_POPDEF([_DEF])dnl
AS_VAR_POPDEF([_OUT])dnl
],[PACKAGE="$PACKAGE"])])

View File

@ -87,10 +87,10 @@ subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(finalcutinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prefix_config_h.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -28,6 +28,22 @@ std::deque<FApplication::eventPair>* FApplication::event_queue = 0;
// constructors and destructor
//----------------------------------------------------------------------
FApplication::FApplication (int &_argc, char* _argv[])
: app_argc(0)
, app_argv(0)
, key(0)
#ifdef F_HAVE_LIBGPM
, gpm_ev()
, gpmMouseEvent(false)
#endif
, b_state()
, fifo_offset(0)
, fifo_in_use(false)
, fifo_buf_size(sizeof(fifo_buf))
, key_timeout(100000) // 100 ms
, dblclick_interval(500000) // 500 ms
, time_keypressed()
, time_mousepressed()
, newMousePosition()
{
assert ( ! rootObj
&& "FApplication: There should be only one application object" );
@ -63,19 +79,12 @@ void FApplication::init (int _argc, char* _argv[])
app_argv = _argv;
// init keyboard values
key = 0;
key_timeout = 100000; // 100 ms
dblclick_interval = 500000; // 500 ms
time_keypressed.tv_sec = 0;
time_keypressed.tv_usec = 0;
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
fifo_offset = 0;
fifo_in_use = false;
fifo_buf_size = sizeof(fifo_buf);
x11_button_state = 0x23;
#ifdef F_HAVE_LIBGPM
gpmMouseEvent = false;
gpm_ev.x = -1;
#endif
zero_point = new FPoint(0,0);
@ -106,8 +115,8 @@ void FApplication::cmd_options ()
{0, 0, 0, 0 }
};
opterr = 0;
c = getopt_long ( app_argc, app_argv, "",
long_options, &idx );
c = getopt_long ( app_argc, app_argv, ""
, long_options, &idx );
if ( c == -1 )
break;
if ( c == 0 )
@ -267,7 +276,7 @@ void FApplication::processKeyboardEvent()
if ( key != NEED_MORE_DATA )
{
if ( key == 0x0c ) // Ctrl-L (redraw the screen)
this->redraw();
redraw();
if ( key == fc::Fkey_mouse )
{

View File

@ -12,16 +12,40 @@
// constructors and destructor
//----------------------------------------------------------------------
FButton::FButton(FWidget* parent) : FWidget(parent)
FButton::FButton(FWidget* parent)
: FWidget(parent)
, text()
, button_down(false)
, click_animation(true)
, click_time(150)
, button_fg(wc.button_active_fg)
, button_bg(wc.button_active_bg)
, button_hotkey_fg(wc.button_hotkey_fg)
, button_focus_fg(wc.button_active_focus_fg)
, button_focus_bg(wc.button_active_focus_bg)
, button_inactive_fg(wc.button_inactive_fg)
, button_inactive_bg(wc.button_inactive_bg)
{
this->init();
init();
}
//----------------------------------------------------------------------
FButton::FButton (const FString& txt, FWidget* parent) : FWidget(parent)
FButton::FButton (const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, button_down(false)
, click_animation(true)
, click_time(150)
, button_fg(wc.button_active_fg)
, button_bg(wc.button_active_bg)
, button_hotkey_fg(wc.button_hotkey_fg)
, button_focus_fg(wc.button_active_focus_fg)
, button_focus_bg(wc.button_active_focus_bg)
, button_inactive_fg(wc.button_inactive_fg)
, button_inactive_bg(wc.button_inactive_bg)
{
this->init();
setText(txt);
init();
detectHotkey();
}
//----------------------------------------------------------------------
@ -36,27 +60,14 @@ FButton::~FButton() // destructor
//----------------------------------------------------------------------
void FButton::init()
{
flags = 0;
button_down = false;
click_animation = true;
click_time = 150;
this->text = "";
setForegroundColor (wc.button_active_fg);
setBackgroundColor (wc.button_active_bg);
setHotkeyForegroundColor (wc.button_hotkey_fg);
setFocusForegroundColor (wc.button_active_focus_fg);
setFocusBackgroundColor (wc.button_active_focus_bg);
setInactiveForegroundColor (wc.button_inactive_fg);
setInactiveBackgroundColor (wc.button_inactive_bg);
if ( hasFocus() )
this->flags = FOCUS;
flags = FOCUS;
if ( isEnabled() )
this->flags |= ACTIVE;
updateButtonColor();
flags |= ACTIVE;
}
//----------------------------------------------------------------------
@ -95,6 +106,16 @@ void FButton::setHotkeyAccelerator()
delAccelerator(this);
}
//----------------------------------------------------------------------
void FButton::detectHotkey()
{
if ( isEnabled() )
{
delAccelerator (this);
setHotkeyAccelerator();
}
}
//----------------------------------------------------------------------
void FButton::draw()
{
@ -120,7 +141,7 @@ void FButton::draw()
else
ButtonText = new wchar_t[length+1];
txt = this->text;
txt = text;
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(ButtonText);
@ -207,7 +228,7 @@ void FButton::draw()
for (int y=1; y <= height; y++)
{
// Cygwin terminal use IBM Codepage 850
if ( this->isCygwinTerminal() )
if ( isCygwinTerminal() )
print (fc::FullBlock); // █
else
print (fc::RightHalfBlock); // ▐
@ -439,9 +460,9 @@ void FButton::hide()
bool FButton::setNoUnderline (bool on)
{
if ( on )
this->flags |= NO_UNDERLINE;
flags |= NO_UNDERLINE;
else
this->flags &= ~NO_UNDERLINE;
flags &= ~NO_UNDERLINE;
return on;
}
@ -452,12 +473,12 @@ bool FButton::setEnable (bool on)
if ( on )
{
this->flags |= ACTIVE;
flags |= ACTIVE;
setHotkeyAccelerator();
}
else
{
this->flags &= ~ACTIVE;
flags &= ~ACTIVE;
delAccelerator (this);
}
updateButtonColor();
@ -471,7 +492,7 @@ bool FButton::setFocus (bool on)
if ( on )
{
this->flags |= FOCUS;
flags |= FOCUS;
if ( isEnabled() )
{
@ -486,7 +507,7 @@ bool FButton::setFocus (bool on)
}
else
{
this->flags &= ~FOCUS;
flags &= ~FOCUS;
if ( isEnabled() && statusBar() )
statusBar()->clearMessage();
@ -499,9 +520,9 @@ bool FButton::setFocus (bool on)
bool FButton::setFlat (bool on)
{
if ( on )
this->flags |= FLAT;
flags |= FLAT;
else
this->flags &= ~FLAT;
flags &= ~FLAT;
return on;
}
@ -509,9 +530,9 @@ bool FButton::setFlat (bool on)
bool FButton::setShadow (bool on)
{
if ( on && Encoding != fc::VT100 && Encoding != fc::ASCII )
this->flags |= SHADOW;
flags |= SHADOW;
else
this->flags &= ~SHADOW;
flags &= ~SHADOW;
return on;
}
@ -569,7 +590,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
this->setFocus();
setFocus();
if ( focused_widget )
focused_widget->redraw();
if ( statusBar() )
@ -667,10 +688,6 @@ void FButton::onFocusOut (FFocusEvent*)
//----------------------------------------------------------------------
void FButton::setText (const FString& txt)
{
this->text = txt;
if ( isEnabled() )
{
delAccelerator (this);
setHotkeyAccelerator();
}
text = txt;
detectHotkey();
}

View File

@ -35,6 +35,7 @@ class FButton : public FWidget
void init();
uChar getHotkey();
void setHotkeyAccelerator();
void detectHotkey();
void draw();
void updateButtonColor();
void processClick();
@ -185,6 +186,6 @@ inline bool FButton::hasClickAnimation()
//----------------------------------------------------------------------
inline FString& FButton::getText()
{ return this->text; }
{ return text; }
#endif // _FBUTTON_H

View File

@ -13,17 +13,23 @@
// constructor and destructor
//----------------------------------------------------------------------
FButtonGroup::FButtonGroup(FWidget* parent) : FWidget(parent)
FButtonGroup::FButtonGroup(FWidget* parent)
: FWidget(parent)
, text()
, border(true)
, buttonlist()
{
this->init();
text = "";
init();
}
//----------------------------------------------------------------------
FButtonGroup::FButtonGroup ( const FString& txt,
FWidget* parent ) : FWidget(parent)
FButtonGroup::FButtonGroup (const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, border(true)
, buttonlist()
{
this->init();
init();
setText(txt);
}
@ -48,15 +54,13 @@ FButtonGroup::~FButtonGroup() // destructor
//----------------------------------------------------------------------
void FButtonGroup::init()
{
flags = 0;
border = true;
top_padding = 1;
left_padding = 1;
bottom_padding = 1;
right_padding = 1;
if ( isEnabled() )
this->flags |= ACTIVE;
flags |= ACTIVE;
foregroundColor = wc.label_fg;
backgroundColor = wc.label_bg;
@ -188,7 +192,7 @@ void FButtonGroup::drawLabel()
if ( text.isNull() || text.isEmpty() )
return;
txt = " " + this->text + " ";
txt = " " + text + " ";
length = txt.getLength();
hotkeypos = -1;
LabelText = new wchar_t[length+1];
@ -498,8 +502,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
//----------------------------------------------------------------------
void FButtonGroup::onFocusOut (FFocusEvent*)
{
}
{ }
//----------------------------------------------------------------------
bool FButtonGroup::setEnable (bool on)
@ -508,12 +511,12 @@ bool FButtonGroup::setEnable (bool on)
if ( on )
{
this->flags |= ACTIVE;
flags |= ACTIVE;
setHotkeyAccelerator();
}
else
{
this->flags &= ~ACTIVE;
flags &= ~ACTIVE;
delAccelerator (this);
}
return on;
@ -532,7 +535,7 @@ bool FButtonGroup::setBorder(bool on)
//----------------------------------------------------------------------
void FButtonGroup::setText (const FString& txt)
{
this->text = txt;
text = txt;
if ( isEnabled() )
{
delAccelerator (this);

View File

@ -99,6 +99,6 @@ inline bool FButtonGroup::unsetBorder()
//----------------------------------------------------------------------
inline FString& FButtonGroup::getText()
{ return this->text; }
{ return text; }
#endif // _FBUTTONGROUP_H

View File

@ -154,8 +154,8 @@ static int vt100_key_to_utf8[][2] =
{fc::vt100_key_diamond , fc::Bullet} // ◆
};
const int lastKeyItem = int ( sizeof(vt100_key_to_utf8) /
sizeof(vt100_key_to_utf8[0]) ) - 1;
const int lastKeyItem = int ( sizeof(vt100_key_to_utf8)
/ sizeof(vt100_key_to_utf8[0]) ) - 1;
static uInt cp437_to_ucs[][2] =
@ -290,8 +290,8 @@ static uInt cp437_to_ucs[][2] =
{0xff, 0x00a0} // no-break space
};
const uInt lastCP437Item = uInt ( sizeof(cp437_to_ucs) /
sizeof(cp437_to_ucs[0]) ) - 1;
const uInt lastCP437Item = uInt ( sizeof(cp437_to_ucs)
/ sizeof(cp437_to_ucs[0]) ) - 1;
#endif // _FCHARMAP_H

View File

@ -24,8 +24,7 @@ FCheckBox::FCheckBox ( const FString& txt,
//----------------------------------------------------------------------
FCheckBox::~FCheckBox() // destructor
{
}
{ }
// private methods of FCheckBox

View File

@ -1,6 +1,6 @@
#ifndef _SRC_FCONFIG_H
#define _SRC_FCONFIG_H 1
/* src/fconfig.h. Generated automatically at end of configure. */
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
@ -171,6 +171,6 @@
#ifndef F_VERSION
#define F_VERSION "0.1.1"
#endif
/* once: _SRC_FCONFIG_H */
#endif

View File

@ -12,16 +12,29 @@
// constructor and destructor
//----------------------------------------------------------------------
FDialog::FDialog(FWidget* parent) : FWindow(parent)
FDialog::FDialog(FWidget* parent)
: FWindow(parent)
, tb_text()
, result_code(FDialog::Reject)
, maximized(false)
, TitleBarClickPos()
, oldGeometry()
, focus_widget(0)
{
this->init();
init();
}
//----------------------------------------------------------------------
FDialog::FDialog (const FString& txt, FWidget* parent) : FWindow(parent)
FDialog::FDialog (const FString& txt, FWidget* parent)
: FWindow(parent)
, tb_text(txt)
, result_code(FDialog::Reject)
, maximized(false)
, TitleBarClickPos()
, oldGeometry()
, focus_widget(0)
{
this->init();
setText(txt);
init();
}
//----------------------------------------------------------------------
@ -75,8 +88,6 @@ FDialog::~FDialog() // destructor
//----------------------------------------------------------------------
void FDialog::init()
{
flags = 0;
result_code = FDialog::Reject;
width = 10;
height = 10;
xmin = 1;
@ -93,9 +104,6 @@ void FDialog::init()
right_padding = 1;
createArea (vwin);
setGeometry (1, 1, 10, 10, false); // initialize geometry values
focus_widget = 0;
this->tb_text = "";
maximized = false;
ignore_padding = true;
window_object = true;
addWindow(this);
@ -105,9 +113,9 @@ void FDialog::init()
backgroundColor = wc.dialog_bg;
if ( hasFocus() )
this->flags |= FOCUS;
flags |= FOCUS;
if ( isEnabled() )
this->flags |= ACTIVE;
flags |= ACTIVE;
FWidget* old_focus = FWidget::getFocusWidget();
if ( old_focus )
@ -360,13 +368,11 @@ void FDialog::draw()
//----------------------------------------------------------------------
void FDialog::onShow (FShowEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FDialog::onHide (FHideEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FDialog::onClose (FCloseEvent* ev)
@ -812,9 +818,9 @@ bool FDialog::setFocus (bool on)
FWidget::setFocus(on);
if ( on )
this->flags |= FOCUS;
flags |= FOCUS;
else
this->flags &= ~FOCUS;
flags &= ~FOCUS;
return on;
}
@ -826,12 +832,12 @@ bool FDialog::setModal (bool on)
if ( on )
{
this->flags |= MODAL;
flags |= MODAL;
modal_dialogs++;
}
else
{
this->flags &= ~MODAL;
flags &= ~MODAL;
modal_dialogs--;
}
return on;
@ -842,16 +848,16 @@ bool FDialog::setTransparentShadow (bool on)
{
if ( on )
{
this->flags |= SHADOW;
this->flags |= TRANS_SHADOW;
flags |= SHADOW;
flags |= TRANS_SHADOW;
shadow.setPoint(2,1);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
}
else
{
this->flags &= ~SHADOW;
this->flags &= ~TRANS_SHADOW;
flags &= ~SHADOW;
flags &= ~TRANS_SHADOW;
shadow.setPoint(0,0);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
@ -865,16 +871,16 @@ bool FDialog::setShadow (bool on)
{
if ( on )
{
this->flags |= SHADOW;
this->flags &= ~TRANS_SHADOW;
flags |= SHADOW;
flags &= ~TRANS_SHADOW;
shadow.setPoint(1,1);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
}
else
{
this->flags &= ~SHADOW;
this->flags &= ~TRANS_SHADOW;
flags &= ~SHADOW;
flags &= ~TRANS_SHADOW;
shadow.setPoint(0,0);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
@ -887,9 +893,9 @@ bool FDialog::setShadow (bool on)
bool FDialog::setScrollable (bool on)
{
if ( on )
this->flags |= SCROLLABLE;
flags |= SCROLLABLE;
else
this->flags &= ~SCROLLABLE;
flags &= ~SCROLLABLE;
return on;
}
@ -897,9 +903,9 @@ bool FDialog::setScrollable (bool on)
bool FDialog::setResizeable (bool on)
{
if ( on )
this->flags |= RESIZEABLE;
flags |= RESIZEABLE;
else
this->flags &= ~RESIZEABLE;
flags &= ~RESIZEABLE;
return on;
}

View File

@ -24,11 +24,11 @@ class FDialog : public FWindow
};
private:
FString tb_text;
FString tb_text; // title bar text
int result_code;
bool maximized;
FPoint TitleBarClickPos;
FRect oldGeometry; // required by move()
FRect oldGeometry; // required by move()
FWidget* focus_widget;
private:
@ -69,6 +69,8 @@ class FDialog : public FWindow
void move (int, int);
void setWidth (int, bool adjust=true);
void setHeight (int, bool adjust=true);
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
FWidget* getFocusWidget() const;
void setFocusWidget (FWidget*);
@ -97,8 +99,8 @@ class FDialog : public FWindow
bool setShadow();
bool unsetShadow();
bool hasShadow();
void setText (const FString);
FString getText() const;
void setText (const FString&);
};
#pragma pack(pop)
@ -180,11 +182,12 @@ inline bool FDialog::hasShadow()
{ return ((flags & SHADOW) != 0); }
//----------------------------------------------------------------------
inline void FDialog::setText (FString txt)
{ this->tb_text = txt; }
inline FString FDialog::getText() const
{ return tb_text; }
//----------------------------------------------------------------------
inline FString FDialog::getText() const
{ return this->tb_text; }
inline void FDialog::setText (const FString& txt)
{ tb_text = txt; }
#endif // _FDIALOG_H

View File

@ -6,11 +6,28 @@
#include "fevent.h"
//----------------------------------------------------------------------
// class FEvent
//----------------------------------------------------------------------
FEvent::FEvent(int ev_type) // constructor
: t(ev_type)
{ }
//----------------------------------------------------------------------
FEvent::~FEvent() // destructor
{ }
//----------------------------------------------------------------------
int FEvent::type() const
{ return t; }
//----------------------------------------------------------------------
// class FKeyEvent
//----------------------------------------------------------------------
FKeyEvent::FKeyEvent(int ev_type, int key_num) // constructor
FKeyEvent::FKeyEvent (int ev_type, int key_num) // constructor
: FEvent(ev_type)
, k(key_num)
, accpt(false)
@ -41,19 +58,20 @@ void FKeyEvent::ignore()
// class FMouseEvent
//----------------------------------------------------------------------
FMouseEvent::FMouseEvent ( int ev_type, // constructor
const FPoint& pos,
int button )
FMouseEvent::FMouseEvent ( int ev_type // constructor
, const FPoint& pos
, int button )
: FEvent(ev_type)
, p(pos)
, g()
, b(button)
{ }
//----------------------------------------------------------------------
FMouseEvent::FMouseEvent ( int ev_type, // constructor
const FPoint& pos,
const FPoint& globalPos,
int button )
FMouseEvent::FMouseEvent ( int ev_type // constructor
, const FPoint& pos
, const FPoint& globalPos
, int button )
: FEvent(ev_type)
, p(pos)
, g(globalPos)
@ -97,19 +115,20 @@ int FMouseEvent::getButton() const
// class FWheelEvent
//----------------------------------------------------------------------
FWheelEvent::FWheelEvent ( int ev_type, // constructor
const FPoint& pos,
int wheel )
FWheelEvent::FWheelEvent ( int ev_type // constructor
, const FPoint& pos
, int wheel )
: FEvent(ev_type)
, p(pos)
, g()
, w(wheel)
{ }
//----------------------------------------------------------------------
FWheelEvent::FWheelEvent (int ev_type, // constructor
const FPoint& pos,
const FPoint& globalPos,
int wheel)
FWheelEvent::FWheelEvent ( int ev_type // constructor
, const FPoint& pos
, const FPoint& globalPos
, int wheel )
: FEvent(ev_type)
, p(pos)
, g(globalPos)

View File

@ -41,7 +41,7 @@ class FEvent // event base class
{
public:
explicit FEvent(int);
~FEvent();
virtual ~FEvent();
int type() const;
protected:
@ -51,21 +51,6 @@ class FEvent // event base class
#pragma pack(pop)
// FEvent inline functions
//----------------------------------------------------------------------
inline FEvent::FEvent(int ev_type) // constructor
: t(ev_type)
{ }
//----------------------------------------------------------------------
inline FEvent::~FEvent() // destructor
{ }
//----------------------------------------------------------------------
inline int FEvent::type() const
{ return t; }
//----------------------------------------------------------------------
// class FKeyEvent
//----------------------------------------------------------------------
@ -89,7 +74,6 @@ class FKeyEvent : public FEvent // keyboard event
bool accpt;
};
#define F_KEY_EVENT(x) ((FKeyEvent*)x)
#pragma pack(pop)
@ -134,10 +118,9 @@ class FMouseEvent : public FEvent // mouse event
int b;
};
#define F_MOUSE_EVENT(x) ((FMouseEvent*)x)
#pragma pack(pop)
//----------------------------------------------------------------------
// class FWheelEvent
//----------------------------------------------------------------------
@ -174,7 +157,6 @@ class FWheelEvent : public FEvent // wheel event
int w;
};
#define F_WHEEL_EVENT(x) ((FWheelEvent*)x)
#pragma pack(pop)
@ -210,7 +192,6 @@ class FFocusEvent : public FEvent // focus event
FocusTypes focus_type;
};
#define F_FOCUS_EVENT(x) ((FFocusEvent*)x)
#pragma pack(pop)
@ -223,6 +204,10 @@ class FFocusEvent : public FEvent // focus event
class FAccelEvent : public FEvent // focus event
{
private:
FAccelEvent (const FAccelEvent&); // Disabled copy constructor
FAccelEvent& operator = (const FAccelEvent&); // and operator '='
public:
FAccelEvent (int, void*);
~FAccelEvent();
@ -237,7 +222,6 @@ class FAccelEvent : public FEvent // focus event
void* focus_widget;
};
#define F_ACCEL_EVENT(x) ((FAccelEvent*)x)
#pragma pack(pop)
@ -259,7 +243,6 @@ class FResizeEvent : public FEvent // resize event
bool accpt;
};
#define F_RESIZE_EVENT(x) ((FResizeEvent*)x)
//----------------------------------------------------------------------
@ -273,7 +256,6 @@ class FShowEvent : public FEvent // show event
~FShowEvent();
};
#define F_SHOW_EVENT(x) ((FShowEvent*)x)
//----------------------------------------------------------------------
@ -287,7 +269,6 @@ class FHideEvent : public FEvent // hide event
~FHideEvent();
};
#define F_HIDE_EVENT(x) ((FHideEvent*)x)
//----------------------------------------------------------------------
@ -308,7 +289,6 @@ class FCloseEvent : public FEvent // close event
bool accpt;
};
#define F_CLOSE_EVENT(x) ((FCloseEvent*)x)
//----------------------------------------------------------------------
@ -330,7 +310,6 @@ class FTimerEvent : public FEvent // timer event
int id;
};
#define F_TIMER_EVENT(x) ((FTimerEvent*)x)
#pragma pack(pop)
#endif // _FEVENT_H

View File

@ -27,23 +27,63 @@ static bool sortDirFirst (const dir_entry &lhs, const dir_entry &rhs)
// constructors and destructor
//----------------------------------------------------------------------
FFileDialog::FFileDialog(FWidget* parent) : FDialog(parent)
FFileDialog::FFileDialog(FWidget* parent)
: FDialog(parent)
, directory_stream(0)
, dir_entries()
, directory()
, filter_pattern()
, filebrowser()
, filename()
, hidden()
, cancel()
, open()
, dlg_type(FFileDialog::Open)
, show_hidden(false)
{
dlg_type = FFileDialog::Open;
init();
}
//----------------------------------------------------------------------
FFileDialog::FFileDialog ( const FString& dirname,
const FString& filter,
DialogType type,
FWidget* parent ) : FDialog(parent)
FFileDialog::FFileDialog (const FFileDialog& fdlg)
: FDialog(fdlg.parentWidget())
, directory_stream(0)
, dir_entries()
, directory(fdlg.directory)
, filter_pattern(fdlg.filter_pattern)
, filebrowser()
, filename()
, hidden()
, cancel()
, open()
, dlg_type(fdlg.dlg_type)
, show_hidden(fdlg.show_hidden)
{
if ( directory )
setPath(directory);
init();
}
//----------------------------------------------------------------------
FFileDialog::FFileDialog ( const FString& dirname
, const FString& filter
, DialogType type
, FWidget* parent )
: FDialog(parent)
, directory_stream(0)
, dir_entries()
, directory()
, filter_pattern(filter)
, filebrowser()
, filename()
, hidden()
, cancel()
, open()
, dlg_type(type)
, show_hidden(false)
{
if ( dirname )
setPath(dirname);
if ( filter )
setFilter(filter);
dlg_type = type;
init();
}
@ -64,7 +104,6 @@ FFileDialog::~FFileDialog() // destructor
void FFileDialog::init()
{
int x, y;
show_hidden = false;
height = 15;
width = 42;
if ( width < 15 )
@ -184,8 +223,8 @@ void FFileDialog::draw()
}
//----------------------------------------------------------------------
inline bool FFileDialog::pattern_match ( const char* pattern,
const char* fname )
inline bool FFileDialog::pattern_match ( const char* pattern
, const char* fname )
{
char search[128];
if ( show_hidden && fname[0] == '.' && fname[1] != '\0' ) // hidden files
@ -445,6 +484,35 @@ void FFileDialog::adjustSize()
// public methods of FFileDialog
//----------------------------------------------------------------------
FFileDialog& FFileDialog::operator = (const FFileDialog& fdlg)
{
if ( &fdlg == this )
return *this;
else
{
delete open;
delete cancel;
delete hidden;
delete filebrowser;
delete filename;
clear();
fdlg.parentWidget()->addChild (this);
directory = fdlg.directory;
filter_pattern = fdlg.filter_pattern;
dlg_type = fdlg.dlg_type;
show_hidden = fdlg.show_hidden;
if ( directory )
setPath(directory);
init();
return *this;
}
}
//----------------------------------------------------------------------
void FFileDialog::onKeyPress (FKeyEvent* ev)
{
@ -639,9 +707,9 @@ bool FFileDialog::setShowHiddenFiles (bool on)
}
//----------------------------------------------------------------------
FString FFileDialog::fileOpenChooser ( FWidget* parent,
const FString& dirname,
const FString& filter )
FString FFileDialog::fileOpenChooser ( FWidget* parent
, const FString& dirname
, const FString& filter )
{
FString ret;
FString path = dirname;
@ -650,22 +718,23 @@ FString FFileDialog::fileOpenChooser ( FWidget* parent,
path = getHomeDir();
if ( file_filter.isNull() )
file_filter = FString("*");
FFileDialog* fileopen = new FFileDialog ( path,
file_filter,
FFileDialog::Open,
parent );
FFileDialog* fileopen = new FFileDialog ( path
, file_filter
, FFileDialog::Open
, parent );
if ( fileopen->exec() == FDialog::Accept )
ret = fileopen->getPath() + fileopen->getSelectedFile();
else
ret = FString();
delete fileopen;
return ret;
}
//----------------------------------------------------------------------
FString FFileDialog::fileSaveChooser ( FWidget* parent,
const FString& dirname,
const FString& filter )
FString FFileDialog::fileSaveChooser ( FWidget* parent
, const FString& dirname
, const FString& filter )
{
FString ret;
FString path = dirname;
@ -674,10 +743,10 @@ FString FFileDialog::fileSaveChooser ( FWidget* parent,
path = getHomeDir();
if ( file_filter.isNull() )
file_filter = FString("*");
FFileDialog* fileopen = new FFileDialog ( path,
file_filter,
FFileDialog::Save,
parent );
FFileDialog* fileopen = new FFileDialog ( path
, file_filter
, FFileDialog::Save
, parent );
if ( fileopen->exec() == FDialog::Accept )
ret = fileopen->getPath() + fileopen->getSelectedFile();
else

View File

@ -64,52 +64,54 @@ class FFileDialog : public FDialog
bool show_hidden;
private:
void init();
static char* getHomeDir();
virtual void draw();
inline bool pattern_match (const char*, const char*);
void clear();
int numOfDirs();
int changeDir (const FString&);
void printPath (const FString&);
void cb_processActivate (FWidget*, void*);
void cb_processRowChanged (FWidget*, void*);
void cb_processClicked (FWidget*, void*);
void cb_processCancel (FWidget*, void*);
void cb_processOpen (FWidget*, void*);
void cb_processShowHidden (FWidget*, void*);
void init();
static char* getHomeDir();
virtual void draw();
inline bool pattern_match (const char*, const char*);
void clear();
int numOfDirs();
int changeDir (const FString&);
void printPath (const FString&);
void cb_processActivate (FWidget*, void*);
void cb_processRowChanged (FWidget*, void*);
void cb_processClicked (FWidget*, void*);
void cb_processCancel (FWidget*, void*);
void cb_processOpen (FWidget*, void*);
void cb_processShowHidden (FWidget*, void*);
protected:
void adjustSize();
public:
explicit FFileDialog (FWidget* parent=0);
FFileDialog (const FString&,
const FString&,
DialogType type = FFileDialog::Open,
FWidget* parent=0);
FFileDialog (const FFileDialog&); // copy constructor
FFileDialog ( const FString&
, const FString&
, DialogType type = FFileDialog::Open
, FWidget* parent=0 );
~FFileDialog();
const char* getClassName() const;
FFileDialog& operator = (const FFileDialog&); // assignment
const char* getClassName() const;
void onKeyPress (FKeyEvent*);
void onKeyPress (FKeyEvent*);
const FString getPath() const;
void setPath (const FString&);
void setPath (const FString&);
const FString getFilter() const;
void setFilter (const FString&);
void setFilter (const FString&);
const FString getSelectedFile() const;
int readDir();
bool setShowHiddenFiles(bool);
bool setShowHiddenFiles();
bool unsetShowHiddenFiles();
bool getShowHiddenFiles();
int readDir();
bool setShowHiddenFiles(bool);
bool setShowHiddenFiles();
bool unsetShowHiddenFiles();
bool getShowHiddenFiles();
static FString fileOpenChooser (FWidget*,
const FString& = FString(),
const FString& = FString());
static FString fileSaveChooser (FWidget*,
const FString& = FString(),
const FString& = FString());
static FString fileOpenChooser ( FWidget*
, const FString& = FString()
, const FString& = FString() );
static FString fileSaveChooser ( FWidget*
, const FString& = FString()
, const FString& = FString() );
};
#pragma pack(pop)

View File

@ -12,15 +12,35 @@
// constructors and destructor
//----------------------------------------------------------------------
FLabel::FLabel(FWidget* parent) : FWidget(parent)
FLabel::FLabel(FWidget* parent)
: FWidget(parent)
, multiline_text()
, multiline(false)
, text()
, emphasis(0)
, alignment(fc::alignLeft)
, emphasis_color(wc.label_emphasis_fg)
, ellipsis_color(wc.label_ellipsis_fg)
, reverse_mode(false)
, accel_widget(0)
{
this->init();
init();
}
//----------------------------------------------------------------------
FLabel::FLabel (const FString& txt, FWidget* parent) : FWidget(parent)
FLabel::FLabel (const FString& txt, FWidget* parent)
: FWidget(parent)
, multiline_text()
, multiline(false)
, text(txt)
, emphasis(0)
, alignment(fc::alignLeft)
, emphasis_color(wc.label_emphasis_fg)
, ellipsis_color(wc.label_ellipsis_fg)
, reverse_mode(false)
, accel_widget(0)
{
this->init();
init();
setText(txt);
}
@ -35,23 +55,13 @@ FLabel::~FLabel() // destructor
//----------------------------------------------------------------------
void FLabel::init()
{
flags = 0;
emphasis = 0;
alignment = fc::alignLeft;
multiline = false;
this->text = "";
accel_widget = 0;
if ( isEnabled() )
this->flags |= ACTIVE;
flags |= ACTIVE;
unsetFocusable();
foregroundColor = parentWidget()->getForegroundColor();
backgroundColor = parentWidget()->getBackgroundColor();
emphasis_color = wc.label_emphasis_fg;
ellipsis_color = wc.label_ellipsis_fg;
reverse_mode = false;
}
//----------------------------------------------------------------------
@ -137,10 +147,10 @@ int FLabel::getXOffset(int length)
}
//----------------------------------------------------------------------
void FLabel::printLine ( wchar_t*& line,
uInt length,
int hotkeypos,
int xoffset )
void FLabel::printLine ( wchar_t*& line
, uInt length
, int hotkeypos
, int xoffset )
{
int to_char;
bool isActive, isNoUnderline;
@ -388,9 +398,9 @@ void FLabel::setAlignment (uInt align)
bool FLabel::setEmphasis (bool on)
{
if ( on )
this->emphasis |= EMPHASIS;
emphasis |= EMPHASIS;
else
this->emphasis &= ~EMPHASIS;
emphasis &= ~EMPHASIS;
return on;
}
@ -409,12 +419,12 @@ bool FLabel::setEnable (bool on)
if ( on )
{
this->flags |= ACTIVE;
flags |= ACTIVE;
setHotkeyAccelerator();
}
else
{
this->flags &= ~ACTIVE;
flags &= ~ACTIVE;
delAccelerator (this);
}
return on;
@ -429,8 +439,8 @@ void FLabel::setNumber (long num)
//----------------------------------------------------------------------
void FLabel::setText (const FString& txt)
{
this->text = txt;
this->multiline_text = text.split("\r\n");
text = txt;
multiline_text = text.split("\r\n");
if ( int(multiline_text.size()) > 1 )
multiline = true;
else

View File

@ -64,6 +64,7 @@ class FLabel : public FWidget
bool setReverseMode();
bool unsetReverseMode();
bool hasReverseMode();
using FWidget::setEnable;
bool setEnable (bool);
void setNumber(long);
void setText (const FString&);
@ -111,6 +112,6 @@ inline bool FLabel::hasReverseMode()
//----------------------------------------------------------------------
inline FString& FLabel::getText()
{ return this->text; }
{ return text; }
#endif // _FLABEL_H

View File

@ -12,15 +12,37 @@
// constructor and destructor
//----------------------------------------------------------------------
FLineEdit::FLineEdit(FWidget* parent) : FWidget(parent)
FLineEdit::FLineEdit(FWidget* parent)
: FWidget(parent)
, text("")
, label_text("")
, label(new FLabel("", parent))
, dragScroll(FLineEdit::noScroll)
, scrollTimer(false)
, scrollRepeat(100)
, insert_mode(true)
, cursor_pos(0)
, offset(0)
, label_orientation(FLineEdit::label_left)
{
this->init();
init();
}
//----------------------------------------------------------------------
FLineEdit::FLineEdit (const FString& txt, FWidget* parent) : FWidget(parent)
FLineEdit::FLineEdit (const FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, label_text("")
, label(new FLabel("", parent))
, dragScroll(FLineEdit::noScroll)
, scrollTimer(false)
, scrollRepeat(100)
, insert_mode(true)
, cursor_pos(0)
, offset(0)
, label_orientation(FLineEdit::label_left)
{
this->init();
init();
setText(txt);
}
@ -43,26 +65,15 @@ FLineEdit::~FLineEdit() // destructor
//----------------------------------------------------------------------
void FLineEdit::init()
{
flags = 0;
scrollTimer = false;
scrollRepeat = 100;
dragScroll = FLineEdit::noScroll;
insert_mode = true;
cursor_pos = 0;
offset = 0;
this->text = "";
this->label_text = "";
this->label = new FLabel(label_text, parentWidget());
label->setAccelWidget(this);
label_orientation = FLineEdit::label_left;
setVisibleCursor();
if ( hasFocus() )
this->flags |= FOCUS;
flags |= FOCUS;
if ( isEnabled() )
{
this->flags |= ACTIVE;
flags |= ACTIVE;
if ( hasFocus() )
{
@ -133,7 +144,7 @@ void FLineEdit::drawInputField()
else if ( isActiveFocus )
{
setColor (wc.inputfield_active_focus_bg, wc.dialog_bg);
if ( this->isCygwinTerminal() ) // IBM Codepage 850
if ( isCygwinTerminal() ) // IBM Codepage 850
print (fc::FullBlock); // █
else
print (fc::RightHalfBlock); // ▐
@ -141,7 +152,7 @@ void FLineEdit::drawInputField()
else if ( isActive )
{
setColor (wc.inputfield_active_bg, wc.dialog_bg);
if ( this->isCygwinTerminal() ) // IBM Codepage 850
if ( isCygwinTerminal() ) // IBM Codepage 850
print (fc::FullBlock); // █
else
print (fc::RightHalfBlock); // ▐
@ -149,7 +160,7 @@ void FLineEdit::drawInputField()
else // isInactive
{
setColor (wc.inputfield_inactive_bg, wc.dialog_bg);
if ( this->isCygwinTerminal() ) // IBM Codepage 850
if ( isCygwinTerminal() ) // IBM Codepage 850
print (fc::FullBlock); // █
else
print (fc::RightHalfBlock); // ▐
@ -296,7 +307,7 @@ bool FLineEdit::setEnable (bool on)
if ( on )
{
this->flags |= ACTIVE;
flags |= ACTIVE;
if ( hasFocus() )
{
foregroundColor = wc.inputfield_active_focus_fg;
@ -310,7 +321,7 @@ bool FLineEdit::setEnable (bool on)
}
else
{
this->flags &= ~ACTIVE;
flags &= ~ACTIVE;
foregroundColor = wc.inputfield_inactive_fg;
backgroundColor = wc.inputfield_inactive_bg;
}
@ -324,7 +335,7 @@ bool FLineEdit::setFocus (bool on)
if ( on )
{
this->flags |= FOCUS;
flags |= FOCUS;
if ( isEnabled() )
{
@ -342,7 +353,7 @@ bool FLineEdit::setFocus (bool on)
}
else
{
this->flags &= ~FOCUS;
flags &= ~FOCUS;
if ( isEnabled() )
{
@ -359,9 +370,9 @@ bool FLineEdit::setFocus (bool on)
bool FLineEdit::setShadow (bool on)
{
if ( on )
this->flags |= SHADOW;
flags |= SHADOW;
else
this->flags &= ~SHADOW;
flags &= ~SHADOW;
return on;
}
@ -516,10 +527,10 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
this->setFocus();
setFocus();
if ( focused_widget )
focused_widget->redraw();
this->redraw();
redraw();
if ( statusBar() )
statusBar()->drawMessage();
}
@ -667,10 +678,10 @@ void FLineEdit::onAccel (FAccelEvent* ev)
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
FFocusEvent out (FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
this->setFocus();
setFocus();
if ( focused_widget )
focused_widget->redraw();
this->redraw();
redraw();
if ( statusBar() )
{
statusBar()->drawMessage();
@ -753,7 +764,7 @@ void FLineEdit::setText (FString txt)
{
offset = 0;
cursor_pos = 0;
this->text = txt;
text = txt;
}
//----------------------------------------------------------------------

View File

@ -133,7 +133,7 @@ inline bool FLineEdit::hasShadow()
//----------------------------------------------------------------------
inline FString FLineEdit::getText() const
{ return this->text; }
{ return text; }
//----------------------------------------------------------------------
inline int FLineEdit::getLabelOrientation()

View File

@ -15,39 +15,35 @@
// constructor and destructor
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem()
{
this->selected = false;
this->brackets = fc::NoBrackets;
}
: text()
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (FString& txt)
{
this->selected = false;
this->brackets = fc::NoBrackets;
setText(txt);
}
: text(txt)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const std::string& txt)
{
this->selected = false;
this->brackets = fc::NoBrackets;
setText(txt);
}
: text(txt)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const char* txt)
{
this->selected = false;
this->brackets = fc::NoBrackets;
setText(txt);
}
: text(txt)
, brackets(fc::NoBrackets)
, selected(false)
{ }
//----------------------------------------------------------------------
FListBoxItem::~FListBoxItem()
{
}
{ }
//----------------------------------------------------------------------
@ -56,9 +52,29 @@ FListBoxItem::~FListBoxItem()
// constructor and destructor
//----------------------------------------------------------------------
FListBox::FListBox(FWidget* parent) : FWidget(parent)
FListBox::FListBox(FWidget* parent)
: FWidget(parent)
, data()
, VBar(0)
, HBar(0)
, text()
, inc_search()
, multiSelect(false)
, mouseSelect(false)
, dragScroll(FListBox::noScroll)
, scrollTimer(false)
, scrollRepeat(100)
, scrollDistance(1)
, current(0)
, last_current(-1)
, secect_from_item(-1)
, xoffset(0)
, yoffset(0)
, last_yoffset(-1)
, nf_offset(0)
, maxLineWidth(0)
{
this->init();
init();
}
//----------------------------------------------------------------------
@ -74,26 +90,12 @@ FListBox::~FListBox() // destructor
//----------------------------------------------------------------------
void FListBox::init()
{
multiSelect = false;
mouseSelect = false;
dragScroll = FListBox::noScroll;
scrollDistance = 1;
scrollTimer = false;
scrollRepeat = 100;
flags = 0;
current = 0;
last_current = -1;
xoffset = 0;
yoffset = 0;
last_yoffset = -1;
maxLineWidth = 0;
text = "";
nf_offset = isNewFont() ? 1 : 0;
if ( hasFocus() )
this->flags = FOCUS;
flags = FOCUS;
if ( isEnabled() )
this->flags |= ACTIVE;
flags |= ACTIVE;
nf_offset = isNewFont() ? 1 : 0;
foregroundColor = wc.dialog_fg;
backgroundColor = wc.dialog_bg;
@ -188,7 +190,7 @@ void FListBox::drawLabel()
if ( Encoding == fc::VT100 )
unsetVT100altChar();
txt = " " + this->text + " ";
txt = " " + text + " ";
length = txt.getLength();
gotoxy (xpos+xmin, ypos+ymin-1);
@ -266,8 +268,8 @@ void FListBox::drawList()
if ( isMonochron() )
setBold();
else
setColor ( wc.selected_current_element_fg,
wc.selected_current_element_bg );
setColor ( wc.selected_current_element_fg
, wc.selected_current_element_bg );
}
else
{
@ -275,22 +277,22 @@ void FListBox::drawList()
unsetBold();
else if ( isFocus )
{
setColor ( wc.current_element_focus_fg,
wc.current_element_focus_bg );
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
if ( inc_len > 0 )
{
serach_mark = true;
int b = ( lineHasBrackets ) ? 1: 0;
setCursorPos ( xpos+xmin+int(inc_len)+b,
ypos+ymin+int(y) ); // last found character
setCursorPos ( xpos+xmin+int(inc_len)+b
, ypos+ymin+int(y) ); // last found character
}
else
setCursorPos ( xpos+xmin+1,
ypos+ymin+int(y) ); // first character
setCursorPos ( xpos+xmin+1
, ypos+ymin+int(y) ); // first character
}
else
setColor ( wc.current_element_fg,
wc.current_element_bg );
setColor ( wc.current_element_fg
, wc.current_element_bg );
}
if ( isMonochron() )
setReverse(true);
@ -332,32 +334,32 @@ void FListBox::drawList()
break;
}
element = data[y+uInt(yoffset)].getText()
.mid ( uInt(1+xoffset),
uInt(width-nf_offset-5) );
.mid ( uInt(1+xoffset)
, uInt(width-nf_offset-5) );
}
else
element = data[y+uInt(yoffset)].getText()
.mid( uInt(xoffset),
uInt(width-nf_offset-4) );
.mid ( uInt(xoffset)
, uInt(width-nf_offset-4) );
element_str = element.wc_str();
len = element.getLength();
for (; i < len; i++)
{
if ( serach_mark && i == 0 )
setColor ( wc.current_inc_search_element_fg,
wc.current_element_focus_bg );
setColor ( wc.current_inc_search_element_fg
, wc.current_element_focus_bg );
if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg,
wc.current_element_focus_bg );
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
print (element_str[i]);
}
full_length = int(data[y+uInt(yoffset)].getText().getLength());
if ( b+i < uInt(width-nf_offset-4) && xoffset <= full_length+1 )
{
if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg,
wc.current_element_focus_bg );
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
switch ( data[y+uInt(yoffset)].brackets )
{
case fc::NoBrackets:
@ -396,13 +398,13 @@ void FListBox::drawList()
len = element.getLength();
if ( serach_mark )
setColor ( wc.current_inc_search_element_fg,
wc.current_element_focus_bg );
setColor ( wc.current_inc_search_element_fg
, wc.current_element_focus_bg );
for (i=0; i < len; i++)
{
if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg,
wc.current_element_focus_bg );
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
print (element_str[i]);
}
@ -546,8 +548,8 @@ void FListBox::hide()
}
//----------------------------------------------------------------------
void FListBox::showInsideBrackets ( int index,
fc::brackets_type b )
void FListBox::showInsideBrackets ( int index
, fc::brackets_type b )
{
data[uInt(index-1)].brackets = b;
@ -592,9 +594,9 @@ bool FListBox::setEnable (bool on)
FWidget::setEnable(on);
if ( on )
this->flags |= ACTIVE;
flags |= ACTIVE;
else
this->flags &= ~ACTIVE;
flags &= ~ACTIVE;
return on;
}
@ -605,7 +607,7 @@ bool FListBox::setFocus (bool on)
if ( on )
{
this->flags |= FOCUS;
flags |= FOCUS;
if ( statusBar() )
{
@ -617,7 +619,7 @@ bool FListBox::setFocus (bool on)
}
else
{
this->flags &= ~FOCUS;
flags &= ~FOCUS;
if ( statusBar() )
statusBar()->clearMessage();
@ -629,9 +631,9 @@ bool FListBox::setFocus (bool on)
bool FListBox::setShadow (bool on)
{
if ( on )
this->flags |= SHADOW;
flags |= SHADOW;
else
this->flags &= ~SHADOW;
flags &= ~SHADOW;
return on;
}
@ -907,7 +909,7 @@ void FListBox::onMouseDown (FMouseEvent* ev)
FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
this->setFocus();
setFocus();
if ( focused_widget )
focused_widget->redraw();
if ( statusBar() )
@ -1471,9 +1473,9 @@ void FListBox::cb_HBarChange (FWidget*, void*)
}
//----------------------------------------------------------------------
void FListBox::insert ( FString item,
fc::brackets_type b,
bool s )
void FListBox::insert ( FString item
, fc::brackets_type b
, bool s )
{
int len, element_count;
@ -1507,9 +1509,9 @@ void FListBox::insert ( FString item,
}
//----------------------------------------------------------------------
void FListBox::insert ( long item,
fc::brackets_type b,
bool s )
void FListBox::insert ( long item
, fc::brackets_type b
, bool s )
{
insert (FString().setNumber(item), b, s);
}
@ -1594,5 +1596,5 @@ void FListBox::clear()
//----------------------------------------------------------------------
void FListBox::setText (FString txt)
{
this->text = txt;
text = txt;
}

View File

@ -42,19 +42,19 @@ class FListBoxItem
// FListBoxItem inline functions
//----------------------------------------------------------------------
inline FString FListBoxItem::getText() const
{ return this->text; }
{ return text; }
//----------------------------------------------------------------------
inline void FListBoxItem::setText (FString& txt)
{ this->text = txt; }
{ text = txt; }
//----------------------------------------------------------------------
inline void FListBoxItem::setText (const std::string& txt)
{ this->text = txt; }
{ text = txt; }
//----------------------------------------------------------------------
inline void FListBoxItem::setText (const char* txt)
{ this->text = txt; }
{ text = txt; }
//----------------------------------------------------------------------
@ -67,13 +67,6 @@ inline void FListBoxItem::setText (const char* txt)
class FListBox : public FWidget
{
private:
std::vector<FListBoxItem> data;
FScrollbar* VBar;
FScrollbar* HBar;
FString text;
FString inc_search;
bool multiSelect;
bool mouseSelect;
enum drag_scroll
{
noScroll = 0,
@ -82,18 +75,25 @@ class FListBox : public FWidget
scrollUpSelect = 3,
scrollDownSelect = 4
};
int dragScroll;
bool scrollTimer;
int scrollRepeat;
int scrollDistance;
int current;
int last_current;
int secect_from_item;
int xoffset;
int yoffset;
int last_yoffset;
int nf_offset;
int maxLineWidth;
std::vector<FListBoxItem> data;
FScrollbar* VBar;
FScrollbar* HBar;
FString text;
FString inc_search;
bool multiSelect;
bool mouseSelect;
int dragScroll;
bool scrollTimer;
int scrollRepeat;
int scrollDistance;
int current;
int last_current;
int secect_from_item;
int xoffset;
int yoffset;
int last_yoffset;
int nf_offset;
int maxLineWidth;
private:
FListBox (const FListBox&);
@ -139,6 +139,8 @@ class FListBox : public FWidget
void showInsideBrackets(int, fc::brackets_type);
void showNoBrackets(int);
bool hasBrackets(int) const;
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
void setMultiSelection (bool);
@ -157,12 +159,12 @@ class FListBox : public FWidget
bool unsetShadow();
bool hasShadow();
void insert ( FString,
fc::brackets_type b = fc::NoBrackets,
bool s = false );
void insert ( long,
fc::brackets_type b = fc::NoBrackets,
bool s = false );
void insert ( FString
, fc::brackets_type b = fc::NoBrackets
, bool s = false );
void insert ( long
, fc::brackets_type b = fc::NoBrackets
, bool s = false );
void remove ( int);
void clear();
@ -211,7 +213,7 @@ inline bool FListBox::hasBrackets(int index) const
//----------------------------------------------------------------------
inline void FListBox::setMultiSelection (bool on)
{ this->multiSelect = on; }
{ multiSelect = on; }
//----------------------------------------------------------------------
inline void FListBox::setMultiSelection()
@ -259,6 +261,6 @@ inline bool FListBox::hasShadow()
//----------------------------------------------------------------------
inline FString& FListBox::getText()
{ return this->text; }
{ return text; }
#endif // _FLISTBOX_H

View File

@ -9,31 +9,54 @@
// constructor and destructor
//----------------------------------------------------------------------
FMenu::FMenu(FWidget* parent) : FWindow(parent)
FMenu::FMenu(FWidget* parent)
: FWindow(parent)
, item(0)
, super_menu(0)
, maxItemWidth(0)
, current(0)
, mouse_down(false)
{
item = 0;
this->init();
init();
}
//----------------------------------------------------------------------
FMenu::FMenu (FString& txt, FWidget* parent) : FWindow(parent)
FMenu::FMenu (FString& txt, FWidget* parent)
: FWindow(parent)
, item(0)
, super_menu(0)
, maxItemWidth(0)
, current(0)
, mouse_down(false)
{
item = new FMenuItem(txt, parent);
this->init();
init();
}
//----------------------------------------------------------------------
FMenu::FMenu (const std::string& txt, FWidget* parent) : FWindow(parent)
FMenu::FMenu (const std::string& txt, FWidget* parent)
: FWindow(parent)
, item(0)
, super_menu(0)
, maxItemWidth(0)
, current(0)
, mouse_down(false)
{
item = new FMenuItem(txt, parent);
this->init();
init();
}
//----------------------------------------------------------------------
FMenu::FMenu (const char* txt, FWidget* parent) : FWindow(parent)
FMenu::FMenu (const char* txt, FWidget* parent)
: FWindow(parent)
, item(0)
, super_menu(0)
, maxItemWidth(0)
, current(0)
, mouse_down(false)
{
item = new FMenuItem(txt, parent);
this->init();
init();
}
//----------------------------------------------------------------------
@ -60,7 +83,6 @@ FMenu::~FMenu()
//----------------------------------------------------------------------
void FMenu::init()
{
current = 0;
width = 10;
height = 2;
xmin = 1;
@ -121,8 +143,8 @@ void FMenu::menu_dimension()
//----------------------------------------------------------------------
bool FMenu::isMenuBar (FWidget* w) const
{
return bool ( strcmp ( w->getClassName(),
const_cast<char*>("FMenuBar") ) == 0 );
return bool ( strcmp ( w->getClassName()
, const_cast<char*>("FMenuBar") ) == 0 );
}
//----------------------------------------------------------------------
@ -362,7 +384,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
++iter;
}
}
this->redraw();
redraw();
return;
}
if ( mouse_down )
@ -393,7 +415,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
&& ! (*iter)->isSelected() )
{
(*iter)->setSelected();
this->redraw();
redraw();
}
X = x2 + 2;
++iter;
@ -430,7 +452,7 @@ void FMenu::onMouseUp (FMouseEvent* ev)
int mouse_y = ev->getY();
if ( mouse_x < x1 || mouse_x > x2 || mouse_y != 1 )
(*iter)->unsetSelected();
this->redraw();
redraw();
}
X = x2 + 2;
++iter;
@ -484,14 +506,13 @@ void FMenu::onMouseMove (FMouseEvent* ev)
++iter;
}
if ( focus_changed )
this->redraw();
redraw();
}
}
//----------------------------------------------------------------------
void FMenu::hide()
{
}
{ }
//----------------------------------------------------------------------
void FMenu::setGeometry (int xx, int yy, int ww, int hh, bool adjust)

View File

@ -51,6 +51,8 @@ class FMenu : public FWindow, public FMenuList
void onMouseUp (FMouseEvent*);
void onMouseMove (FMouseEvent*);
void hide();
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
FMenuItem* getItem() const;

View File

@ -9,9 +9,12 @@
// constructor and destructor
//----------------------------------------------------------------------
FMenuBar::FMenuBar(FWidget* parent) : FWindow(parent)
FMenuBar::FMenuBar(FWidget* parent)
: FWindow(parent)
, mouse_down(false)
, x(-1)
{
this->init();
init();
}
//----------------------------------------------------------------------
@ -40,12 +43,10 @@ void FMenuBar::init()
// initialize geometry values
setGeometry (1, 1, getColumnNumber(), 1, false);
getRootWidget()->setTopPadding(1, true);
x = -1;
setMenuBar(this);
foregroundColor = wc.menu_active_fg;
backgroundColor = wc.menu_active_bg;
window_object = true;
mouse_down = false;
ignore_padding = true;
unsetFocusable();
}
@ -238,7 +239,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
++iter;
}
}
this->redraw();
redraw();
return;
}
if ( mouse_down )
@ -271,12 +272,12 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
&& ! (*iter)->isSelected() )
{
(*iter)->setSelected();
this->redraw();
redraw();
}
else
{
(*iter)->unsetSelected();
this->redraw();
redraw();
}
X = x2 + 1;
++iter;
@ -319,7 +320,7 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
{
(*iter)->processClicked();
}
this->redraw();
redraw();
}
X = x2 + 1;
++iter;
@ -375,7 +376,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
++iter;
}
if ( focus_changed )
this->redraw();
redraw();
}
}

View File

@ -39,6 +39,8 @@ class FMenuBar : public FWindow, public FMenuList
void onMouseUp (FMouseEvent*);
void onMouseMove (FMouseEvent*);
void hide();
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
void cb_item_activated (FWidget*, void*);
};

View File

@ -12,48 +12,79 @@
// constructor and destructor
//----------------------------------------------------------------------
FMenuItem::FMenuItem (FWidget* parent) : FWidget(parent)
FMenuItem::FMenuItem (FWidget* parent)
: FWidget(parent)
, text()
, active(true)
, selected(false)
, separator(false)
, checked(false)
, hotkey(0)
//, accel_key(0)
, menu(0)
, super_menu(0)
{
init (parent);
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (FString& txt, FWidget* parent) : FWidget(parent)
FMenuItem::FMenuItem (FString& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, active(true)
, selected(false)
, separator(false)
, checked(false)
, hotkey(0)
//, accel_key(0)
, menu(0)
, super_menu(0)
{
setText(txt);
init (parent);
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (const std::string& txt, FWidget* parent) : FWidget(parent)
FMenuItem::FMenuItem (const std::string& txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, active(true)
, selected(false)
, separator(false)
, checked(false)
, hotkey(0)
//, accel_key(0)
, menu(0)
, super_menu(0)
{
setText(txt);
init (parent);
}
//----------------------------------------------------------------------
FMenuItem::FMenuItem (const char* txt, FWidget* parent) : FWidget(parent)
FMenuItem::FMenuItem (const char* txt, FWidget* parent)
: FWidget(parent)
, text(txt)
, active(true)
, selected(false)
, separator(false)
, checked(false)
, hotkey(0)
//, accel_key(0)
, menu(0)
, super_menu(0)
{
setText(txt);
init (parent);
}
//----------------------------------------------------------------------
FMenuItem::~FMenuItem() // destructor
{
}
{ }
// private methods of FMenuItem
//----------------------------------------------------------------------
void FMenuItem::init (FWidget* parent)
{
active = true;
selected = false;
separator = false;
checked = false;
hotkey = 0;
menu = 0;
hotkey = getHotkey();
setGeometry (1,1,1,1);
if ( parent )
@ -110,15 +141,15 @@ uChar FMenuItem::getHotkey()
//----------------------------------------------------------------------
bool FMenuItem::isMenuBar (FWidget* w) const
{
return bool ( strcmp ( w->getClassName(),
const_cast<char*>("FMenuBar") ) == 0 );
return bool ( strcmp ( w->getClassName()
, const_cast<char*>("FMenuBar") ) == 0 );
}
//----------------------------------------------------------------------
bool FMenuItem::isMenu (FWidget* w) const
{
return bool ( strcmp ( w->getClassName(),
const_cast<char*>("FMenu") ) == 0 );
return bool ( strcmp ( w->getClassName()
, const_cast<char*>("FMenu") ) == 0 );
}
//----------------------------------------------------------------------
@ -164,7 +195,7 @@ void FMenuItem::setSelected()
{
if ( isActivated() )
{
this->selected = true;
selected = true;
processActivate();
}
}
@ -172,20 +203,20 @@ void FMenuItem::setSelected()
//----------------------------------------------------------------------
inline void FMenuItem::setText (FString& txt)
{
this->text = txt;
this->hotkey = getHotkey();
text = txt;
hotkey = getHotkey();
}
//----------------------------------------------------------------------
inline void FMenuItem::setText (const std::string& txt)
{
this->text = txt;
this->hotkey = getHotkey();
text = txt;
hotkey = getHotkey();
}
//----------------------------------------------------------------------
inline void FMenuItem::setText (const char* txt)
{
this->text = txt;
this->hotkey = getHotkey();
text = txt;
hotkey = getHotkey();
}

View File

@ -79,15 +79,15 @@ class FMenuItem : public FWidget
// FMenuItem inline functions
//----------------------------------------------------------------------
inline FString FMenuItem::getText() const
{ return this->text; }
{ return text; }
//----------------------------------------------------------------------
inline void FMenuItem::setActive()
{ this->active = true; }
{ active = true; }
//----------------------------------------------------------------------
inline void FMenuItem::unsetActive()
{ this->active = false; }
{ active = false; }
//----------------------------------------------------------------------
inline bool FMenuItem::isActivated() const
@ -95,7 +95,7 @@ inline bool FMenuItem::isActivated() const
//----------------------------------------------------------------------
inline void FMenuItem::unsetSelected()
{ this->selected = false; }
{ selected = false; }
//----------------------------------------------------------------------
inline bool FMenuItem::isSelected() const
@ -103,11 +103,11 @@ inline bool FMenuItem::isSelected() const
//----------------------------------------------------------------------
inline void FMenuItem::setSeparator()
{ this->separator = true; }
{ separator = true; }
//----------------------------------------------------------------------
inline void FMenuItem::unsetSeparator()
{ this->separator = false; }
{ separator = false; }
//----------------------------------------------------------------------
inline bool FMenuItem::isSeparator() const
@ -115,11 +115,11 @@ inline bool FMenuItem::isSeparator() const
//----------------------------------------------------------------------
inline void FMenuItem::setChecked()
{ this->checked = true; }
{ checked = true; }
//----------------------------------------------------------------------
inline void FMenuItem::unsetChecked()
{ this->checked = false; }
{ checked = false; }
//----------------------------------------------------------------------
inline bool FMenuItem::isChecked() const

View File

@ -10,8 +10,8 @@
// constructor and destructor
//----------------------------------------------------------------------
FMenuList::FMenuList()
{
}
: itemlist()
{ }
//----------------------------------------------------------------------
FMenuList::~FMenuList() // destructor

View File

@ -24,23 +24,67 @@ static const char* button_text[] =
// constructors and destructor
//----------------------------------------------------------------------
FMessageBox::FMessageBox(FWidget* parent) : FDialog(parent)
FMessageBox::FMessageBox(FWidget* parent)
: FDialog(parent)
, headline_text()
, text()
, text_components(0)
, text_split()
, maxLineWidth(0)
, center_text(false)
, emphasis_color(wc.dialog_emphasis_fg)
, numButtons(0)
, text_num_lines(0)
, button_digit()
, button()
{
FDialog::setText ("Message for you");
this->init(FMessageBox::Ok, 0, 0);
setTitlebarText("Message for you");
init(FMessageBox::Ok, 0, 0);
}
//----------------------------------------------------------------------
FMessageBox::FMessageBox(const FString& caption,
const FString& message,
int button0,
int button1,
int button2,
FWidget* parent) : FDialog(parent)
FMessageBox::FMessageBox (const FMessageBox& mbox)
: FDialog(mbox.parentWidget())
, headline_text(mbox.headline_text)
, text(mbox.text)
, text_components(mbox.text_components)
, text_split(mbox.text_split)
, maxLineWidth(mbox.maxLineWidth)
, center_text(mbox.center_text)
, emphasis_color(mbox.emphasis_color)
, numButtons(mbox.numButtons)
, text_num_lines(mbox.text_num_lines)
, button_digit()
, button()
{
FDialog::setText(caption);
this->text = message;
this->init(button0, button1, button2);
setTitlebarText (mbox.getTitlebarText());
init ( *mbox.button_digit[0]
, *mbox.button_digit[1]
, *mbox.button_digit[2] );
}
//----------------------------------------------------------------------
FMessageBox::FMessageBox ( const FString& caption
, const FString& message
, int button0
, int button1
, int button2
, FWidget* parent )
: FDialog(parent)
, headline_text()
, text(message)
, text_components(0)
, text_split()
, maxLineWidth(0)
, center_text(false)
, emphasis_color(wc.dialog_emphasis_fg)
, numButtons(0)
, text_num_lines(0)
, button_digit()
, button()
{
setTitlebarText(caption);
init(button0, button1, button2);
}
//----------------------------------------------------------------------
@ -59,8 +103,6 @@ FMessageBox::~FMessageBox() // destructor
//----------------------------------------------------------------------
void FMessageBox::init(int button0, int button1, int button2)
{
emphasis_color = wc.dialog_emphasis_fg;
msg_dimension();
if ( (button2 && ! button1) || (button1 && ! button0) )
@ -155,7 +197,6 @@ void FMessageBox::msg_dimension()
text_num_lines = uInt(text_split.size());
text_components = &text_split[0];
maxLineWidth = 0;
center_text = false;
if ( ! headline_text.isNull() )
headline_height = 2;
@ -280,6 +321,7 @@ void FMessageBox::cb_processClick (FWidget*, void* data_ptr)
done (*reply);
}
// protected methods of FMessageBox
//----------------------------------------------------------------------
void FMessageBox::adjustSize()
@ -294,12 +336,48 @@ void FMessageBox::adjustSize()
FDialog::adjustSize();
}
// public methods of FMessageBox
//----------------------------------------------------------------------
FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
{
if ( &mbox == this )
return *this;
else
{
for (uInt n=0; n < numButtons; n++)
delete button[n];
delete button_digit[2];
delete button_digit[1];
delete button_digit[0];
mbox.parentWidget()->addChild (this);
headline_text = mbox.headline_text;
text = mbox.text;
text_components = mbox.text_components;
text_split = mbox.text_split;
maxLineWidth = mbox.maxLineWidth;
center_text = mbox.center_text;
emphasis_color = mbox.emphasis_color;
numButtons = mbox.numButtons;
text_num_lines = mbox.text_num_lines;
setTitlebarText (mbox.getTitlebarText());
init ( *mbox.button_digit[0]
, *mbox.button_digit[1]
, *mbox.button_digit[2] );
return *this;
}
}
//----------------------------------------------------------------------
void FMessageBox::setHeadline (const FString& headline)
{
int old_height = height;
this->headline_text = headline;
headline_text = headline;
setHeight(height + 2, true);
for (uInt n=0; n < numButtons; n++)
button[n]->setY(height-4, false);
@ -327,7 +405,7 @@ void FMessageBox::setHeadline (const char* headline)
//----------------------------------------------------------------------
void FMessageBox::setText (const FString& txt)
{
this->text = txt;
text = txt;
msg_dimension();
button[0]->setY(height-4, false);
if ( *button_digit[1] != 0 )
@ -352,52 +430,52 @@ void FMessageBox::setText (const char* txt)
}
//----------------------------------------------------------------------
int FMessageBox::info ( FWidget* parent,
const FString& caption,
const FString& message,
int button0,
int button1,
int button2 )
int FMessageBox::info ( FWidget* parent
, const FString& caption
, const FString& message
, int button0
, int button1
, int button2 )
{
int reply;
FMessageBox* mbox = new FMessageBox ( caption, message,
button0, button1, button2,
parent );
FMessageBox* mbox = new FMessageBox ( caption, message
, button0, button1, button2
, parent );
reply = mbox->exec();
delete mbox;
return reply;
}
//----------------------------------------------------------------------
int FMessageBox::info ( FWidget* parent,
const FString& caption,
int num,
int button0,
int button1,
int button2 )
int FMessageBox::info ( FWidget* parent
, const FString& caption
, int num
, int button0
, int button1
, int button2 )
{
int reply;
FMessageBox* mbox = new FMessageBox ( caption,
FString().setNumber(num),
button0, button1, button2,
parent );
FMessageBox* mbox = new FMessageBox ( caption
, FString().setNumber(num)
, button0, button1, button2
, parent );
reply = mbox->exec();
delete mbox;
return reply;
}
//----------------------------------------------------------------------
int FMessageBox::error ( FWidget* parent,
const FString& message,
int button0,
int button1,
int button2 )
int FMessageBox::error ( FWidget* parent
, const FString& message
, int button0
, int button1
, int button2 )
{
int reply;
const FString caption = "Error message";
FMessageBox* mbox = new FMessageBox ( caption, message,
button0, button1, button2,
parent );
FMessageBox* mbox = new FMessageBox ( caption, message
, button0, button1, button2
, parent );
mbox->beep();
mbox->setHeadline("Warning:");
mbox->setCenterText();

View File

@ -59,12 +59,17 @@ class FMessageBox : public FDialog
public:
explicit FMessageBox (FWidget* parent=0);
FMessageBox (const FString&, const FString&,
int, int, int,
FWidget* parent=0);
FMessageBox (const FMessageBox&); // copy constructor
FMessageBox ( const FString&, const FString&
, int, int, int
, FWidget* parent=0 );
~FMessageBox();
FMessageBox& operator = (const FMessageBox&); // assignment
const char* getClassName() const;
const FString getTitlebarText() const;
void setTitlebarText (const FString&);
const FString getHeadline() const;
void setHeadline (const FString&);
void setHeadline (const std::string&);
@ -79,25 +84,25 @@ class FMessageBox : public FDialog
bool setCenterText();
bool unsetCenterText();
static int info ( FWidget*,
const FString&,
const FString&,
int button0 = FMessageBox::Ok,
int button1=0,
int button2=0 );
static int info ( FWidget*
, const FString&
, const FString&
, int button0 = FMessageBox::Ok
, int button1=0
, int button2=0 );
static int info ( FWidget*,
const FString&,
int,
int button0 = FMessageBox::Ok,
int button1=0,
int button2=0 );
static int info ( FWidget*
, const FString&
, int
, int button0 = FMessageBox::Ok
, int button1=0
, int button2=0 );
static int error ( FWidget*,
const FString&,
int button0 = FMessageBox::Ok,
int button1=0,
int button2=0 );
static int error ( FWidget*
, const FString&
, int button0 = FMessageBox::Ok
, int button1=0
, int button2=0 );
};
#pragma pack(pop)
@ -107,6 +112,14 @@ class FMessageBox : public FDialog
inline const char* FMessageBox::getClassName() const
{ return "FMessageBox"; }
//----------------------------------------------------------------------
inline const FString FMessageBox::getTitlebarText() const
{ return FDialog::getText(); }
//----------------------------------------------------------------------
inline void FMessageBox::setTitlebarText (const FString& txt)
{ return FDialog::setText(txt); }
//----------------------------------------------------------------------
inline const FString FMessageBox::getHeadline() const
{ return headline_text; }
@ -117,7 +130,7 @@ inline const FString FMessageBox::getText() const
//----------------------------------------------------------------------
inline bool FMessageBox::setCenterText(bool on)
{ return this->center_text = on; }
{ return center_text = on; }
//----------------------------------------------------------------------
inline bool FMessageBox::setCenterText()

View File

@ -15,8 +15,10 @@ FObject::TimerList* FObject::timer_list = 0;
// constructors and destructor
//----------------------------------------------------------------------
FObject::FObject (FObject* parent)
: parentObj(parent)
, children_list()
, has_parent(false)
{
parentObj = parent;
children_list.clear(); // no children yet
if ( parentObj ) // add object to parent
@ -24,7 +26,6 @@ FObject::FObject (FObject* parent)
if ( parent == 0 )
{
has_parent = false;
modify_timer = false;
timer_list = new TimerList;
}
@ -70,7 +71,7 @@ void FObject::addChild (FObject* obj)
obj->parentObj = this;
this->children_list.push_back(obj);
children_list.push_back(obj);
}
//----------------------------------------------------------------------
@ -79,7 +80,7 @@ void FObject::delChild (FObject* obj)
if ( ! children_list.empty() )
{
obj->removeParent();
this->children_list.remove(obj);
children_list.remove(obj);
}
}
@ -218,5 +219,4 @@ bool FObject::delAllTimer()
// protected methods of FObject
//----------------------------------------------------------------------
void FObject::onTimer (FTimerEvent*)
{
}
{ }

View File

@ -84,10 +84,10 @@ host_triplet = @host@
subdir = src/fonts
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prefix_config_h.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -10,40 +10,38 @@
// constructors and destructor
//----------------------------------------------------------------------
FOptiMove::FOptiMove (int baud)
: F_cursor_home()
, F_carriage_return()
, F_cursor_to_ll()
, F_tab()
, F_back_tab()
, F_cursor_up()
, F_cursor_down()
, F_cursor_left()
, F_cursor_right()
, F_cursor_address()
, F_column_address()
, F_row_address()
, F_parm_up_cursor()
, F_parm_down_cursor()
, F_parm_left_cursor()
, F_parm_right_cursor()
, automatic_left_margin(false)
, eat_nl_glitch(false)
, char_duration(1)
, baudrate(baud)
, tabstop(0)
, screen_width(80)
, screen_height(24)
{
assert ( baud >= 0 );
baudrate = baud;
tabstop = 0;
move_buf[0] = '\0';
// init structs with 0
memset(&F_cursor_home, 0x00, sizeof(capability));
memset(&F_carriage_return, 0x00, sizeof(capability));
memset(&F_cursor_to_ll, 0x00, sizeof(capability));
memset(&F_tab, 0x00, sizeof(capability));
memset(&F_back_tab, 0x00, sizeof(capability));
memset(&F_cursor_up, 0x00, sizeof(capability));
memset(&F_cursor_down, 0x00, sizeof(capability));
memset(&F_cursor_left, 0x00, sizeof(capability));
memset(&F_cursor_right, 0x00, sizeof(capability));
memset(&F_cursor_address, 0x00, sizeof(capability));
memset(&F_column_address, 0x00, sizeof(capability));
memset(&F_row_address, 0x00, sizeof(capability));
memset(&F_parm_up_cursor, 0x00, sizeof(capability));
memset(&F_parm_down_cursor, 0x00, sizeof(capability));
memset(&F_parm_left_cursor, 0x00, sizeof(capability));
memset(&F_parm_right_cursor, 0x00, sizeof(capability));
automatic_left_margin = false;
eat_nl_glitch = false;
calculateCharDuration();
}
//----------------------------------------------------------------------
FOptiMove::~FOptiMove() // destructor
{
}
{ }
// private methods of FApplication
@ -294,9 +292,9 @@ int FOptiMove::repeated_append (capability& o, int count, char* dst)
}
//----------------------------------------------------------------------
int FOptiMove::relative_move ( char*& move,
int from_x, int from_y,
int to_x, int to_y )
int FOptiMove::relative_move ( char*& move
, int from_x, int from_y
, int to_x, int to_y )
{
int num;
int vtime = 0;
@ -469,8 +467,8 @@ int FOptiMove::relative_move ( char*& move,
}
//----------------------------------------------------------------------
inline bool FOptiMove::isTwoDirectionMove ( int xold, int yold,
int xnew, int ynew )
inline bool FOptiMove::isTwoDirectionMove ( int xold, int yold
, int xnew, int ynew )
{
return bool ( (xold != xnew || ! F_row_address.cap)
&& (yold != ynew || ! F_column_address.cap) );

View File

@ -9,8 +9,7 @@
//----------------------------------------------------------------------
FPoint::~FPoint() // destructor
{
}
{ }
// public methods of FPoint
//----------------------------------------------------------------------

View File

@ -9,31 +9,24 @@
// constructors and destructor
//----------------------------------------------------------------------
FProgressbar::FProgressbar(FWidget* parent) : FWidget(parent)
FProgressbar::FProgressbar(FWidget* parent)
: FWidget(parent)
, percentage(-1)
, BarLength(width)
{
this->init();
}
//----------------------------------------------------------------------
FProgressbar::~FProgressbar()
{
}
// private methods of FProgressbar
//----------------------------------------------------------------------
void FProgressbar::init()
{
percentage = -1;
flags = 0;
BarLength = width;
unsetFocusable();
}
//----------------------------------------------------------------------
FProgressbar::~FProgressbar()
{ }
// private methods of FProgressbar
//----------------------------------------------------------------------
void FProgressbar::drawPercentage()
{
setColor ( parentWidget()->getForegroundColor(),
parentWidget()->getBackgroundColor() );
setColor ( parentWidget()->getForegroundColor()
, parentWidget()->getBackgroundColor() );
gotoxy (xpos+xmin+width-5, ypos+ymin-2);
if ( percentage < 0 || percentage > 100 )
print ("--- %");
@ -79,7 +72,7 @@ void FProgressbar::drawBar()
if ( ! isMonochron() && getMaxColor() >= 16 )
{
// Cygwin terminal use IBM Codepage 850
if ( this->isCygwinTerminal() )
if ( isCygwinTerminal() )
print (fc::FullBlock); // █
else
print (fc::RightHalfBlock); // ▐
@ -97,7 +90,7 @@ void FProgressbar::drawBar()
if ( trunc(length) >= 1 && trunc(length) < BarLength )
{
if ( round(length) > trunc(length)
|| this->isCygwinTerminal()
|| isCygwinTerminal()
|| getMaxColor() < 16 )
{
if ( isMonochron() )
@ -228,9 +221,9 @@ bool FProgressbar::setEnable (bool on)
FWidget::setEnable(on);
if ( on )
this->flags |= ACTIVE;
flags |= ACTIVE;
else
this->flags &= ~ACTIVE;
flags &= ~ACTIVE;
return on;
}
@ -238,8 +231,8 @@ bool FProgressbar::setEnable (bool on)
bool FProgressbar::setShadow (bool on)
{
if ( on )
this->flags |= SHADOW;
flags |= SHADOW;
else
this->flags &= ~SHADOW;
flags &= ~SHADOW;
return on;
}

View File

@ -21,7 +21,6 @@ class FProgressbar : public FWidget
int BarLength;
private:
void init();
void drawPercentage();
void drawBar();
@ -38,6 +37,8 @@ class FProgressbar : public FWidget
int getPercentage();
void setPercentage (int);
void reset();
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
bool setEnable (bool);
bool setEnable();

View File

@ -17,16 +17,15 @@ FRadioButton::FRadioButton(FWidget* parent) : FToggleButton(parent)
}
//----------------------------------------------------------------------
FRadioButton::FRadioButton ( const FString& txt,
FWidget* parent ) : FToggleButton(txt, parent)
FRadioButton::FRadioButton ( const FString& txt, FWidget* parent )
: FToggleButton(txt, parent)
{
init();
}
//----------------------------------------------------------------------
FRadioButton::~FRadioButton() // destructor
{
}
{ }
// private methods of FRadioButton

View File

@ -18,8 +18,7 @@ FRect::FRect (const FPoint& p1, const FPoint& p2)
//----------------------------------------------------------------------
FRect::~FRect() // destructor
{
}
{ }
// public methods of FRect
//----------------------------------------------------------------------

View File

@ -9,16 +9,57 @@
// constructors and destructor
//----------------------------------------------------------------------
FScrollbar::FScrollbar(FWidget* parent) : FWidget(parent)
FScrollbar::FScrollbar(FWidget* parent)
: FWidget(parent)
, scrollType(FScrollbar::noScroll)
, thresholdReached(false)
, thresholdTime(500)
, repeatTime(10)
, SliderClickPos(-1)
, SliderClickStopPos(-1)
, currentSliderPos(-1)
, SliderPos(0)
, SliderLength(18) // = BarLength
, BarLength(18) // = length - 2
, val(0)
, min(0)
, max(99)
, steps(1)
, pageSize(0)
, length(20)
, bar_orientation(fc::vertical)
, max_color(getMaxColor())
{
this->init();
// The default scrollbar orientation is vertical
width = 1;
height = length;
init();
}
//----------------------------------------------------------------------
FScrollbar::FScrollbar(int o, FWidget* parent) : FWidget(parent)
FScrollbar::FScrollbar(int o, FWidget* parent)
: FWidget(parent)
, scrollType(FScrollbar::noScroll)
, thresholdReached(false)
, thresholdTime(500)
, repeatTime(10)
, SliderClickPos(-1)
, SliderClickStopPos(-1)
, currentSliderPos(-1)
, SliderPos(0)
, SliderLength(18) // = BarLength
, BarLength(18) // = length - 2
, val(0)
, min(0)
, max(99)
, steps(1)
, pageSize(0)
, length(20)
, bar_orientation(fc::vertical)
, max_color(getMaxColor())
{
this->init();
setOrientation (o);
init();
}
//----------------------------------------------------------------------
@ -31,23 +72,7 @@ FScrollbar::~FScrollbar()
//----------------------------------------------------------------------
void FScrollbar::init()
{
SliderPos = 0;
SliderClickPos = -1;
currentSliderPos = -1;
min = val = 0;
max = 99;
steps = 1;
pageSize = 0;
bar_orientation = fc::vertical;
width = 1;
length = height = 20;
BarLength = length - 2;
SliderLength = BarLength = 20-2;
setGeometry(1, 1, 1, 20);
scrollType = FScrollbar::noScroll;
thresholdTime = 500;
repeatTime = 10;
max_color = getMaxColor();
setGeometry(1, 1, width, height);
ignore_padding = true;
unsetFocusable();
}
@ -391,29 +416,29 @@ void FScrollbar::redraw()
//----------------------------------------------------------------------
void FScrollbar::setMinimum (int minimum)
{
this->min = minimum;
min = minimum;
calculateSliderValues();
}
//----------------------------------------------------------------------
void FScrollbar::setMaximum (int maximum)
{
this->max = maximum;
max = maximum;
calculateSliderValues();
}
//----------------------------------------------------------------------
void FScrollbar::setRange(int minimum, int maximum)
{
this->min = minimum;
this->max = maximum;
min = minimum;
max = maximum;
calculateSliderValues();
}
//----------------------------------------------------------------------
void FScrollbar::setValue (int value)
{
this->val = value;
val = value;
calculateSliderValues();
}
@ -434,12 +459,12 @@ void FScrollbar::setPageSize (int document_size, int page_size)
if ( page_size == 0 )
{
pageSize = document_size;
this->steps = 1.0;
steps = 1.0;
}
else
{
pageSize = page_size;
this->steps = float(float(document_size) / float(page_size));
steps = float(float(document_size) / float(page_size));
}
}

View File

@ -81,6 +81,8 @@ class FScrollbar : public FWidget
void setPageSize (int, int);
void calculateSliderValues();
void setOrientation (int);
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
void drawButtons();
void drawBar();

View File

@ -10,38 +10,50 @@
// constructor and destructor
//----------------------------------------------------------------------
FStatusKey::FStatusKey(FWidget* parent) : FWidget(parent)
FStatusKey::FStatusKey(FWidget* parent)
: FWidget(parent)
, key(0)
, text()
, active(false)
, mouse_focus(false)
, bar(0)
{
init (parent);
}
//----------------------------------------------------------------------
FStatusKey::FStatusKey ( int k,
FString& txt,
FWidget* parent ) : FWidget(parent)
FStatusKey::FStatusKey (int k, FString& txt, FWidget* parent)
: FWidget(parent)
, key(k)
, text(txt)
, active(false)
, mouse_focus(false)
, bar(0)
{
setKey(k);
setText(txt);
init (parent);
}
//----------------------------------------------------------------------
FStatusKey::FStatusKey ( int k,
const std::string& txt,
FWidget* parent) : FWidget(parent)
FStatusKey::FStatusKey (int k, const std::string& txt, FWidget* parent)
: FWidget(parent)
, key(k)
, text(txt)
, active(false)
, mouse_focus(false)
, bar(0)
{
setKey(k);
setText(txt);
init (parent);
}
//----------------------------------------------------------------------
FStatusKey::FStatusKey ( int k,
const char* txt,
FWidget* parent ) : FWidget(parent)
FStatusKey::FStatusKey (int k, const char* txt, FWidget* parent)
: FWidget(parent)
, key(k)
, text(txt)
, active(false)
, mouse_focus(false)
, bar(0)
{
setKey(k);
setText(txt);
init (parent);
}
@ -58,12 +70,10 @@ FStatusKey::~FStatusKey() // destructor
//----------------------------------------------------------------------
void FStatusKey::init (FWidget* parent)
{
this->active = false;
this->mouse_focus = false;
setGeometry (1,1,1,1);
if ( parent && strcmp ( parent->getClassName(),
const_cast<char*>("FStatusBar") ) == 0 )
if ( parent && strcmp ( parent->getClassName()
, const_cast<char*>("FStatusBar") ) == 0 )
{
setStatusbar( static_cast<FStatusBar*>(parent) );
statusbar()->insert(this);
@ -103,7 +113,7 @@ void FStatusKey::setStatusbar (FStatusBar* sb)
//----------------------------------------------------------------------
inline void FStatusKey::setActive()
{
this->active = true;
active = true;
processActivate();
}
@ -123,9 +133,15 @@ bool FStatusKey::setMouseFocus(bool on)
// constructor and destructor
//----------------------------------------------------------------------
FStatusBar::FStatusBar(FWidget* parent) : FWindow(parent)
FStatusBar::FStatusBar(FWidget* parent)
: FWindow(parent)
, keylist()
, text("")
, mouse_down()
, x(-1)
, x_msg(-1)
{
this->init();
init();
}
//----------------------------------------------------------------------
@ -168,8 +184,6 @@ void FStatusBar::init()
// initialize geometry values
setGeometry (1, ypos, getColumnNumber(), 1, false);
getRootWidget()->setBottomPadding(1, true);
text = "";
x = x_msg = -1;
setStatusBar(this);
foregroundColor = wc.statusbar_fg;
backgroundColor = wc.statusbar_bg;
@ -221,8 +235,8 @@ void FStatusBar::drawKeys()
{
if ( isMonochron() )
setReverse(false);
setColor ( wc.statusbar_active_hotkey_fg,
wc.statusbar_active_hotkey_bg );
setColor ( wc.statusbar_active_hotkey_fg
, wc.statusbar_active_hotkey_bg );
x++;
print (vstatusbar, ' ');
x += kname_len;
@ -272,8 +286,8 @@ void FStatusBar::drawKeys()
print (vstatusbar, (*iter)->getText());
else
{
print ( vstatusbar,
(*iter)->getText()
print ( vstatusbar
, (*iter)->getText()
.left(uInt(txt_length+screenWidth-x-1)) );
print ( vstatusbar, ".." );
}
@ -348,7 +362,7 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
++iter;
}
}
this->redraw();
redraw();
return;
}
if ( mouse_down )
@ -380,7 +394,7 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
&& ! (*iter)->hasMouseFocus() )
{
(*iter)->setMouseFocus();
this->redraw();
redraw();
}
X = x2 + 2;
++iter;
@ -421,7 +435,7 @@ void FStatusBar::onMouseUp (FMouseEvent* ev)
int mouse_y = ev->getY();
if ( mouse_x >= x1 && mouse_x <= x2 && mouse_y == 1 )
(*iter)->setActive();
this->redraw();
redraw();
}
X = x2 + 2;
++iter;
@ -478,7 +492,7 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
++iter;
}
if ( focus_changed )
this->redraw();
redraw();
}
}
@ -569,7 +583,7 @@ void FStatusBar::drawMessage()
setReverse(true);
if ( x+space_offset+3 < termWidth )
{
if ( this->text )
if ( text )
{
x += 2;
if ( ! isLastActiveFocus )

View File

@ -19,10 +19,10 @@ class FStatusBar;
class FStatusKey : public FWidget
{
private:
int key;
FString text;
bool active;
bool mouse_focus;
int key;
FString text;
bool active;
bool mouse_focus;
FStatusBar* bar;
private:
@ -66,7 +66,7 @@ class FStatusKey : public FWidget
// FStatusKey inline functions
//----------------------------------------------------------------------
inline void FStatusKey::unsetActive()
{ this->active = false; }
{ active = false; }
//----------------------------------------------------------------------
inline bool FStatusKey::isActivated() const
@ -86,27 +86,27 @@ inline bool FStatusKey::hasMouseFocus() const
//----------------------------------------------------------------------
inline int FStatusKey::getKey() const
{ return this->key; }
{ return key; }
//----------------------------------------------------------------------
inline FString FStatusKey::getText() const
{ return this->text; }
{ return text; }
//----------------------------------------------------------------------
inline void FStatusKey::setKey (int k)
{ this->key = k; }
{ key = k; }
//----------------------------------------------------------------------
inline void FStatusKey::setText (FString& txt)
{ this->text = txt; }
{ text = txt; }
//----------------------------------------------------------------------
inline void FStatusKey::setText (const std::string& txt)
{ this->text = txt; }
{ text = txt; }
//----------------------------------------------------------------------
inline void FStatusKey::setText (const char* txt)
{ this->text = txt; }
{ text = txt; }
//----------------------------------------------------------------------
@ -121,9 +121,9 @@ class FStatusBar : public FWindow
private:
std::vector<FStatusKey*> keylist;
FString text;
bool mouse_down;
int x;
int x_msg;
bool mouse_down;
int x;
int x_msg;
private:
FStatusBar (const FStatusBar&);
@ -142,6 +142,8 @@ class FStatusBar : public FWindow
void onMouseUp (FMouseEvent*);
void onMouseMove (FMouseEvent*);
void hide();
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
uInt count() const;

View File

@ -402,7 +402,7 @@ inline wchar_t* FString::c_to_wc_str (const char* s) const
const char* src;
wchar_t* dest;
if ( ! s ) // handle NULL string
if ( ! s ) // handle NULL string
return 0;
if ( ! *s ) // handle empty string
return const_cast<wchar_t*>(L"");
@ -450,9 +450,9 @@ inline wchar_t* FString::c_to_wc_str (const char* s) const
}
//----------------------------------------------------------------------
inline wchar_t* FString::extractToken ( wchar_t** rest,
const wchar_t* s,
const wchar_t* delim )
inline wchar_t* FString::extractToken ( wchar_t** rest
, const wchar_t* s
, const wchar_t* delim )
{
register wchar_t* token;
token = ( s ) ? const_cast<wchar_t*>(s) : *rest;
@ -745,9 +745,9 @@ const FString operator + (const FString& s, const wchar_t c)
const FString operator + (const std::wstring& s1, const FString& s2)
{
FString tmp(s1);
tmp._insert ( uInt(wcslen(s1.c_str())),
uInt(wcslen(s2.wc_str())),
s2.wc_str() );
tmp._insert ( uInt(wcslen(s1.c_str()))
, uInt(wcslen(s2.wc_str()))
, s2.wc_str() );
return (tmp);
}
@ -755,9 +755,9 @@ const FString operator + (const std::wstring& s1, const FString& s2)
const FString operator + (const wchar_t* s1, const FString& s2)
{
FString tmp(s1);
tmp._insert ( uInt(wcslen(s1)),
uInt(wcslen(s2.wc_str())),
s2.wc_str() );
tmp._insert ( uInt(wcslen(s1))
, uInt(wcslen(s2.wc_str()))
, s2.wc_str() );
return (tmp);
}
@ -765,9 +765,9 @@ const FString operator + (const wchar_t* s1, const FString& s2)
const FString operator + (const std::string& s1, const FString& s2)
{
FString tmp(s1);
tmp._insert ( tmp.getLength(),
uInt(wcslen(s2.wc_str())),
s2.wc_str() );
tmp._insert ( tmp.getLength()
, uInt(wcslen(s2.wc_str()))
, s2.wc_str() );
return (tmp);
}
@ -775,9 +775,9 @@ const FString operator + (const std::string& s1, const FString& s2)
const FString operator + (const char* s1, const FString& s2)
{
FString tmp(s1);
tmp._insert ( tmp.getLength(),
uInt(wcslen(s2.wc_str())),
s2.wc_str() );
tmp._insert ( tmp.getLength()
, uInt(wcslen(s2.wc_str()))
, s2.wc_str() );
return (tmp);
}
@ -859,7 +859,7 @@ FString& FString::sprintf (const wchar_t* format, ...)
vswprintf (buffer, buf_size, format, args);
va_end (args);
this->_replace (buffer);
_replace (buffer);
return (*this);
}
@ -888,7 +888,7 @@ FString& FString::sprintf (const char* format, ...)
wc_string = c_to_wc_str(buffer);
if ( wc_string )
{
this->_replace(wc_string);
_replace(wc_string);
if ( *wc_string )
delete[] wc_string;
}
@ -925,14 +925,14 @@ const char* FString::c_str() const
//----------------------------------------------------------------------
const std::string FString::toString() const
{
return std::string(this->c_str(), length+1);
return std::string(c_str(), length+1);
}
//----------------------------------------------------------------------
FString FString::toLower() const
{
register wchar_t* p;
FString s(this->string);
FString s(string);
p = s.string;
if ( p )
@ -950,7 +950,7 @@ FString FString::toLower() const
FString FString::toUpper() const
{
register wchar_t* p;
FString s(this->string);
FString s(string);
p = s.string;
if ( p )
@ -968,7 +968,7 @@ FString FString::toUpper() const
sInt16 FString::toShort() const
{
register long num;
num = this->toLong();
num = toLong();
if ( num > SHRT_MAX || num < SHRT_MIN )
throw std::overflow_error ("overflow");
@ -980,7 +980,7 @@ sInt16 FString::toShort() const
uInt16 FString::toUShort() const
{
register uLong num;
num = uLong(this->toLong());
num = uLong(toLong());
if ( num > USHRT_MAX )
throw std::overflow_error ("overflow");
@ -992,7 +992,7 @@ uInt16 FString::toUShort() const
int FString::toInt() const
{
register long num;
num = this->toLong();
num = toLong();
if ( num > INT_MAX || num < INT_MIN )
throw std::overflow_error ("overflow");
@ -1004,7 +1004,7 @@ int FString::toInt() const
uInt FString::toUInt() const
{
register uLong num;
num = uLong(this->toLong());
num = uLong(toLong());
if ( num > UINT_MAX )
throw std::overflow_error ("overflow");
@ -1024,7 +1024,7 @@ long FString::toLong() const
num = 0;
tenth_limit = LONG_MAX / 10;
tenth_limit_digit = LONG_MAX % 10;
s = this->trim();
s = trim();
p = s.string;
if ( ! p )
@ -1074,7 +1074,7 @@ uLong FString::toULong() const
num = 0;
tenth_limit = ULONG_MAX / 10;
tenth_limit_digit = ULONG_MAX % 10;
s = this->trim();
s = trim();
p = s.string;
if ( ! p )
@ -1110,7 +1110,7 @@ uLong FString::toULong() const
float FString::toFloat() const
{
register double num;
num = this->toDouble();
num = toDouble();
if ( num > FLT_MAX || num < FLT_MIN )
throw std::overflow_error ("overflow");
@ -1124,13 +1124,13 @@ double FString::toDouble() const
wchar_t* p;
register double ret;
if ( ! this->string )
if ( ! string )
throw std::invalid_argument ("null value");
if ( ! *this->string )
if ( ! *string )
throw std::invalid_argument ("empty value");
ret = wcstod(this->string, &p);
ret = wcstod(string, &p);
if ( p != 0 && *p != '\0' )
throw std::invalid_argument ("no valid floating point value");
@ -1149,10 +1149,10 @@ double FString::toDouble() const
FString FString::ltrim() const
{
register wchar_t* p;
FString s(this->string);
FString s(string);
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return s;
p = s.string;
while ( iswspace(uInt(*p)) )
@ -1165,10 +1165,10 @@ FString FString::rtrim() const
{
register wchar_t* p;
register wchar_t* last;
FString s(this->string);
FString s(string);
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return s;
p = s.string;
last = p + length;
@ -1185,9 +1185,9 @@ FString FString::rtrim() const
FString FString::trim() const
{
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return (*this);
FString s(this->ltrim());
FString s(ltrim());
return s.rtrim();
}
@ -1195,10 +1195,10 @@ FString FString::trim() const
FString FString::left(uInt len) const
{
register wchar_t* p;
FString s(this->string);
FString s(string);
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return s;
if ( len > length )
return s;
@ -1211,10 +1211,10 @@ FString FString::left(uInt len) const
FString FString::right(uInt len) const
{
register wchar_t* p;
FString s(this->string);
FString s(string);
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return s;
if ( len > length )
return s;
@ -1228,10 +1228,10 @@ FString FString::mid(uInt pos, uInt len) const
{
register wchar_t* p;
register wchar_t* first;
FString s(this->string);
FString s(string);
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return s;
if ( pos == 0 )
pos = 1;
@ -1251,11 +1251,11 @@ std::vector<FString> FString::split (const FString& delimiter)
{
wchar_t* rest;
wchar_t* token;
FString s(this->string);
FString s(string);
std::vector<FString> stringList;
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return stringList;
rest = 0;
@ -1552,10 +1552,10 @@ FString FString::replace (const FString& from, const FString& to)
{
register wchar_t* p;
uInt from_length, to_length, pos;
FString s(this->string);
FString s(string);
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return s;
if ( from.isNull() || to.isNull() )
return s;
@ -1833,10 +1833,10 @@ FString FString::replace (const char* from, const char to)
FString FString::replace (const wchar_t from, const FString& to)
{
register wchar_t* p;
FString s(this->string);
FString s(string);
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return s;
if ( to.isNull() )
return s;
@ -1947,10 +1947,10 @@ FString FString::replace (const char from, const wchar_t to)
FString FString::replace (const char from, const char to)
{
register wchar_t* p;
FString s(this->string);
FString s(string);
// handle NULL and empty string
if ( ! this->string || ! *this->string )
if ( ! string || ! *string )
return s;
p = s.string;
@ -1967,7 +1967,7 @@ FString FString::replace (const char from, const char to)
FString FString::replaceControlCodes() const
{
register wchar_t* p;
FString s(this->string);
FString s(string);
p = s.string;
@ -1999,7 +1999,7 @@ FString FString::replaceControlCodes() const
FString FString::expandTabs (uInt tabstop) const
{
uLong last;
FString instr(this->string);
FString instr(string);
FString outstr("");
std::vector<FString> tab_split = instr.split("\t");
@ -2017,7 +2017,7 @@ FString FString::removeDel() const
{
register wchar_t* p;
FString s(this->string);
FString s(string);
p = s.string;
if ( p )
@ -2053,7 +2053,7 @@ FString FString::removeBackspaces() const
{
register wchar_t* p;
FString s(this->string);
FString s(string);
p = s.string;
if ( p )

View File

@ -290,11 +290,11 @@ class FString
// FString inline functions
//----------------------------------------------------------------------
inline bool FString::isNull() const
{ return ( ! this->string ); }
{ return ( ! string ); }
//----------------------------------------------------------------------
inline bool FString::isEmpty() const
{ return (! this->string ) || (! *this->string); }
{ return (! string ) || (! *string); }
//----------------------------------------------------------------------
inline uInt FString::getLength() const

View File

@ -10,34 +10,30 @@
// constructor and destructor
//----------------------------------------------------------------------
FSwitch::FSwitch(FWidget* parent) : FToggleButton(parent)
FSwitch::FSwitch(FWidget* parent)
: FToggleButton(parent)
, switch_offset_pos(0)
, button_pressed(false)
{
switch_offset_pos = 0;
init();
button_width = 11;
}
//----------------------------------------------------------------------
FSwitch::FSwitch ( const FString& txt,
FWidget* parent ) : FToggleButton(txt, parent)
FSwitch::FSwitch ( const FString& txt, FWidget* parent )
: FToggleButton(txt, parent)
, switch_offset_pos(0)
, button_pressed(false)
{
switch_offset_pos = int(txt.getLength()) + 1;
init();
button_width = 11;
}
//----------------------------------------------------------------------
FSwitch::~FSwitch() // destructor
{
}
{ }
// private methods of FSwitch
//----------------------------------------------------------------------
void FSwitch::init()
{
button_width = 11;
button_pressed = false;
}
//----------------------------------------------------------------------
void FSwitch::draw()
{

View File

@ -23,7 +23,6 @@ class FSwitch : public FToggleButton
private:
FSwitch (const FSwitch&);
FSwitch& operator = (const FSwitch&);
void init();
void draw();
void drawCheckButton();

View File

@ -120,6 +120,8 @@ fc::console_cursor_style FTerm::consoleCursorStyle;
// constructors and destructor
//----------------------------------------------------------------------
FTerm::FTerm()
: map()
, vwin(0)
{
terminal_updates = false;
vterm_updates = true;
@ -683,7 +685,7 @@ void FTerm::init_termcaps()
<< "Check the TERM environment variable\n"
<< "Also make sure that the terminal"
<< "is defined in the terminfo database.\n";
exit(EXIT_FAILURE);
std::abort();
}
// duration precalculation of the cursor movement strings
@ -730,9 +732,9 @@ bool FTerm::isKeyTimeout (timeval* time, register long timeout)
}
//----------------------------------------------------------------------
int FTerm::parseKeyString ( char* buffer,
int buf_size,
timeval* time_keypressed )
int FTerm::parseKeyString ( char* buffer
, int buf_size
, timeval* time_keypressed )
{
register uChar firstchar = uChar(buffer[0]);
register size_t buf_len = strlen(buffer);
@ -864,9 +866,9 @@ void FTerm::init_vt100altChar()
uChar altChar = uChar((*vt100_alt_char)[ keyChar ]);
uInt utf8char = uInt(vt100_key_to_utf8[n][utf8_char]);
uInt* p = std::find ( character[0],
character[lastCharItem] + fc::NUM_OF_ENCODINGS,
utf8char );
uInt* p = std::find ( character[0]
, character[lastCharItem] + fc::NUM_OF_ENCODINGS
, utf8char );
if ( p != character[lastCharItem] + fc::NUM_OF_ENCODINGS ) // found in character
{
int item = int(std::distance(character[0], p) / fc::NUM_OF_ENCODINGS);
@ -921,11 +923,11 @@ void FTerm::signal_handler (int signum)
case SIGSEGV:
term_object->finish();
fflush (stderr); fflush (stdout);
fprintf ( stderr,
"\nProgram stopped: signal %d (%s)\n",
signum,
strsignal(signum) );
exit (EXIT_FAILURE);
fprintf ( stderr
, "\nProgram stopped: signal %d (%s)\n"
, signum
, strsignal(signum) );
std::terminate();
}
}
@ -947,7 +949,7 @@ void FTerm::init()
stdout_no = fileno(stdout);
stdin_status_flags = fcntl(stdin_no, F_GETFL);
this->term_name = ttyname(stdout_no);
term_name = ttyname(stdout_no);
// look into /etc/ttytype for the type
fd_tty = -1;
@ -968,7 +970,7 @@ void FTerm::init()
else
{
std::cerr << "can not open the console.\n";
exit(EXIT_FAILURE);
std::abort();
}
// create virtual terminal
@ -1349,8 +1351,8 @@ void FTerm::init()
setXTermHighlightBackground("rgb:b1b1/b1b1/b1b1");
}
this->setRawMode();
this->hideCursor();
setRawMode();
hideCursor();
if ( (xterm || urxvt_terminal) && ! rxvt_terminal )
{
@ -1421,8 +1423,8 @@ void FTerm::finish()
if ( xterm && ! rxvt_terminal )
setXTermTitle (*xterm_title);
this->showCursor();
this->setCookedMode(); // leave raw mode
showCursor();
setCookedMode(); // leave raw mode
if ( tcap[t_exit_attribute_mode].string )
{
@ -1550,9 +1552,9 @@ void FTerm::finish()
uInt FTerm::charEncode (uInt c)
{
register uInt* p;
p = std::find ( character[0],
character[lastCharItem] + fc::NUM_OF_ENCODINGS,
c );
p = std::find ( character[0]
, character[lastCharItem] + fc::NUM_OF_ENCODINGS
, c );
if ( p != character[lastCharItem] + fc::NUM_OF_ENCODINGS ) // found
{
register uInt item = uInt( std::distance(character[0], p)
@ -1662,10 +1664,10 @@ void FTerm::resizeArea (term_area* area)
//----------------------------------------------------------------------
void FTerm::restoreVTerm (const FRect& box)
{
restoreVTerm ( box.getX(),
box.getY(),
box.getWidth(),
box.getHeight() );
restoreVTerm ( box.getX()
, box.getY()
, box.getWidth()
, box.getHeight() );
}
//----------------------------------------------------------------------
@ -1965,11 +1967,11 @@ void FTerm::getArea (int ax, int ay, FTerm::term_area* area)
//----------------------------------------------------------------------
void FTerm::getArea (const FRect& box, FTerm::term_area* area)
{
getArea ( box.getX(),
box.getY(),
box.getWidth(),
box.getHeight(),
area );
getArea ( box.getX()
, box.getY()
, box.getWidth()
, box.getHeight()
, area );
}
//----------------------------------------------------------------------
@ -2180,8 +2182,8 @@ bool FTerm::setVGAFont()
VGAFont = false;
// unicode character mapping
struct unimapdesc unimap;
unimap.entry_ct = uChar ( sizeof(unicode_cp437_pairs) /
sizeof(unipair) );
unimap.entry_ct = uChar ( sizeof(unicode_cp437_pairs)
/ sizeof(unipair) );
unimap.entries = &unicode_cp437_pairs[0];
setUnicodeMap(&unimap);
}
@ -2235,8 +2237,8 @@ bool FTerm::setNewFont()
if ( ret != 0 )
NewFont = false;
// unicode character mapping
unimap.entry_ct = uInt16 ( sizeof(unicode_cp437_pairs) /
sizeof(unipair) );
unimap.entry_ct = uInt16 ( sizeof(unicode_cp437_pairs)
/ sizeof(unipair) );
unimap.entries = &unicode_cp437_pairs[0];
setUnicodeMap(&unimap);
}
@ -3589,10 +3591,10 @@ int FTerm::print (FTerm::term_area* area, FString& s)
case '\t':
cursor->x_ref() = short ( uInt(cursor->x_ref())
+ tabstop
- uInt(cursor->x_ref())
+ 1
% tabstop );
+ tabstop
- uInt(cursor->x_ref())
+ 1
% tabstop );
break;
case '\b':

View File

@ -11,9 +11,17 @@
// constructor and destructor
//----------------------------------------------------------------------
FTextView::FTextView(FWidget* parent) : FWidget(parent)
FTextView::FTextView(FWidget* parent)
: FWidget(parent)
, data()
, VBar(0)
, HBar(0)
, xoffset(0)
, yoffset(0)
, nf_offset(0)
, maxLineWidth(0)
{
this->init();
init();
}
//----------------------------------------------------------------------
@ -27,9 +35,6 @@ FTextView::~FTextView() // destructor
//----------------------------------------------------------------------
void FTextView::init()
{
xoffset = 0;
yoffset = 0;
maxLineWidth = 0;
nf_offset = isNewFont() ? 1 : 0;
foregroundColor = wc.dialog_fg;
@ -107,8 +112,8 @@ void FTextView::drawText()
{
gotoxy (xpos+xmin, ypos+ymin-nf_offset+int(y));
uInt i;
FString line = data[y+uInt(yoffset)].mid ( uInt(1+xoffset),
uInt(width-nf_offset-2) );
FString line = data[y+uInt(yoffset)].mid ( uInt(1+xoffset)
, uInt(width-nf_offset-2) );
const wchar_t* line_str = line.wc_str();
uInt len = line.getLength();
@ -277,7 +282,7 @@ void FTextView::onMouseDown (FMouseEvent* ev)
FWidget* focused_widget = getFocusWidget();
FFocusEvent out (FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
this->setFocus();
setFocus();
if ( focused_widget )
focused_widget->redraw();
if ( statusBar() )

View File

@ -56,7 +56,8 @@ class FTextView : public FWidget
void onWheel (FWheelEvent*);
void onFocusIn (FFocusEvent*);
void onFocusOut (FFocusEvent*);
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
uInt getColumns() const;
uInt getRows() const;

View File

@ -13,12 +13,19 @@
// constructor and destructor
//----------------------------------------------------------------------
FToggleButton::FToggleButton(FWidget* parent) : FWidget(parent)
FToggleButton::FToggleButton(FWidget* parent)
: FWidget(parent)
, focus_inside_group(true)
, text()
, checked(false)
, label_offset_pos(0)
, button_width(0)
, button_group(0)
{
this->init();
init();
if ( parent && strcmp ( parent->getClassName(),
const_cast<char*>("FButtonGroup") ) == 0 )
if ( parent && strcmp ( parent->getClassName()
, const_cast<char*>("FButtonGroup") ) == 0 )
{
setGroup( static_cast<FButtonGroup*>(parent) );
group()->insert(this); // insert into button group
@ -26,14 +33,20 @@ FToggleButton::FToggleButton(FWidget* parent) : FWidget(parent)
}
//----------------------------------------------------------------------
FToggleButton::FToggleButton ( const FString& txt,
FWidget* parent ) : FWidget(parent)
FToggleButton::FToggleButton ( const FString& txt, FWidget* parent )
: FWidget(parent)
, focus_inside_group(true)
, text()
, checked(false)
, label_offset_pos(0)
, button_width(0)
, button_group(0)
{
this->init();
init();
setText(txt);
if ( parent && strcmp ( parent->getClassName(),
const_cast<char*>("FButtonGroup") ) == 0 )
if ( parent && strcmp ( parent->getClassName()
, const_cast<char*>("FButtonGroup") ) == 0 )
{
setGroup( static_cast<FButtonGroup*>(parent) );
group()->insert( this ); // insert into button group
@ -55,22 +68,14 @@ FToggleButton::~FToggleButton() // destructor
//----------------------------------------------------------------------
void FToggleButton::init()
{
flags = 0;
checked = false;
focus_inside_group = true;
label_offset_pos = 0;
button_group = 0;
button_width = 0;
this->text = "";
setGeometry (1, 1, 4, 1, false); // initialize geometry values
if ( hasFocus() )
this->flags = FOCUS;
flags = FOCUS;
if ( isEnabled() )
{
this->flags |= ACTIVE;
flags |= ACTIVE;
if ( hasFocus() )
{
@ -185,7 +190,7 @@ void FToggleButton::drawLabel()
hotkeypos = -1;
LabelText = new wchar_t[length+1];
txt = this->text;
txt = text;
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(LabelText);
isActive = ((flags & ACTIVE) != 0);
@ -252,15 +257,15 @@ FButtonGroup* FToggleButton::group() const
//----------------------------------------------------------------------
bool FToggleButton::isRadioButton() const
{
return ( strcmp (getClassName(),
const_cast<char*>("FRadioButton") ) == 0 );
return ( strcmp ( getClassName()
, const_cast<char*>("FRadioButton") ) == 0 );
}
//----------------------------------------------------------------------
bool FToggleButton::isCheckboxButton() const
{
return ( strcmp (getClassName(),
const_cast<char*>("FCheckBox") ) == 0 );
return ( strcmp ( getClassName()
, const_cast<char*>("FCheckBox") ) == 0 );
}
//----------------------------------------------------------------------
@ -356,9 +361,9 @@ void FToggleButton::setGeometry (int x, int y, int w, int h, bool adjust)
bool FToggleButton::setNoUnderline(bool on)
{
if ( on )
this->flags |= NO_UNDERLINE;
flags |= NO_UNDERLINE;
else
this->flags &= ~NO_UNDERLINE;
flags &= ~NO_UNDERLINE;
return on;
}
@ -369,7 +374,7 @@ bool FToggleButton::setEnable(bool on)
if ( on )
{
this->flags |= ACTIVE;
flags |= ACTIVE;
setHotkeyAccelerator();
if ( hasFocus() )
{
@ -384,7 +389,7 @@ bool FToggleButton::setEnable(bool on)
}
else
{
this->flags &= ~ACTIVE;
flags &= ~ACTIVE;
delAccelerator (this);
foregroundColor = wc.toggle_button_inactive_fg;
backgroundColor = wc.toggle_button_inactive_bg;
@ -399,7 +404,7 @@ bool FToggleButton::setFocus(bool on)
if ( on )
{
this->flags |= FOCUS;
flags |= FOCUS;
if ( isEnabled() )
{
@ -423,7 +428,7 @@ bool FToggleButton::setFocus(bool on)
}
else
{
this->flags &= ~FOCUS;
flags &= ~FOCUS;
if ( isEnabled() )
{
@ -483,7 +488,7 @@ void FToggleButton::onMouseUp (FMouseEvent* ev)
checked = not checked;
processToggle();
}
this->redraw();
redraw();
processClick();
}
}
@ -516,7 +521,7 @@ void FToggleButton::onAccel (FAccelEvent* ev)
checked = not checked;
processToggle();
}
this->redraw();
redraw();
if ( statusBar() )
{
statusBar()->drawMessage();
@ -599,7 +604,7 @@ bool FToggleButton::setChecked(bool on)
//----------------------------------------------------------------------
void FToggleButton::setText (FString txt)
{
this->text = txt;
text = txt;
setWidth(button_width + int(text.getLength()));
if ( isEnabled() )
{

View File

@ -10,7 +10,7 @@
class FButtonGroup;
//----------------------------------------------------------------------
// class FToggleButton - abstract class for FToggleButton + FCheckBox
// class FToggleButton - abstract class for FRadioButton, FCheckBox, ...
//----------------------------------------------------------------------
#pragma pack(push)
@ -54,6 +54,8 @@ class FToggleButton : public FWidget
virtual const char* getClassName() const;
void hide();
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true);
void onMouseDown (FMouseEvent*);
@ -132,6 +134,6 @@ inline bool FToggleButton::isChecked()
//----------------------------------------------------------------------
inline FString& FToggleButton::getText()
{ return this->text; }
{ return text; }
#endif // _FTOGGLEBUTTON_H

View File

@ -27,20 +27,49 @@ FWidget::widget_colors FWidget::wc;
// constructors and destructor
//----------------------------------------------------------------------
FWidget::FWidget (FWidget* parent) : FObject(parent)
FWidget::FWidget (FWidget* parent)
: FObject(parent)
, callbackObjects()
, memberCallbackObjects()
, accelerator_list()
, double_flatline_mask()
, xpos(1)
, ypos(1)
, width(1)
, height(1)
, xmin(1)
, ymin(1)
, xmax(1)
, ymax(1)
, top_padding(0)
, left_padding(0)
, bottom_padding(0)
, right_padding(0)
, client_xmin(0)
, client_ymin(0)
, client_xmax(0)
, client_ymax(0)
, shadow()
, adjustWidgetSizeShadow()
, adjustWidgetSizeGlobalShadow()
, ignore_padding(false)
, window_object(false)
, flags(0)
, foregroundColor()
, backgroundColor()
, enable(true)
, visible(true)
, shown(false)
, focus(false)
, focusable(true)
, visibleCursor(false)
, widgetCursorPosition(-1,-1)
, widgetSize(1,1,1,1)
, adjustWidgetSize(1,1,1,1)
, adjustWidgetSizeGlobal(1,1,1,1)
, statusbar_message()
{
vwin = 0;
widgetCursorPosition.setPoint(-1,-1);
resize_term = false;
enable = true;
visible = true;
shown = false;
focus = false;
focusable = true;
ignore_padding = false;
visibleCursor = false;
window_object = false;
resize_term = false;
if ( parent == 0 )
{
@ -56,24 +85,10 @@ FWidget::FWidget (FWidget* parent) : FObject(parent)
}
else
{
accelerator_list = 0;
flags = 0;
xpos = 1;
ypos = 1;
width = 1;
height = 1;
top_padding = 0;
left_padding = 0;
bottom_padding = 0;
right_padding = 0;
client_xmin = 0;
client_ymin = 0;
client_xmax = 0;
client_ymax = 0;
this->xmin = parent->client_xmin;
this->ymin = parent->client_ymin;
this->xmax = parent->client_xmax;
this->ymax = parent->client_ymax;
xmin = parent->client_xmin;
ymin = parent->client_ymin;
xmax = parent->client_xmax;
ymax = parent->client_ymax;
double_flatline_mask.top.resize (uLong(width), false);
double_flatline_mask.right.resize (uLong(height), false);
double_flatline_mask.bottom.resize (uLong(width), false);
@ -111,27 +126,25 @@ void FWidget::init()
window_list = new widgetList;
close_widget = new widgetList;
getTermGeometry();
xpos = xmin;
ypos = ymin;
width = xmax;
getTermGeometry(); // <-----.
// |
xpos = xmin; // xmin, ymin, xmax and ymax
ypos = ymin; // were determined with
width = xmax; // getTermGeometry()
height = ymax;
top_padding = 0;
left_padding = 0;
bottom_padding = 0;
right_padding = 0;
client_xmin = xmin;
client_ymin = ymin;
client_xmax = xmax;
client_ymax = ymax;
// xpos and ypos are initialized with the value 1
// width and height were determined with getTermGeometry()
widgetSize.setRect(xpos, ypos, width, height);
adjustWidgetSize.setRect(xpos, ypos, width, height);
adjustWidgetSizeShadow = adjustWidgetSize;
adjustWidgetSizeGlobal.setRect ( xpos + xmin - 1,
ypos + ymin - 1,
width, height );
adjustWidgetSizeGlobal.setRect ( xpos + xmin - 1
, ypos + ymin - 1
, width, height );
adjustWidgetSizeGlobalShadow = adjustWidgetSizeGlobal;
double_flatline_mask.top.resize (uLong(width), false);
@ -175,8 +188,7 @@ void FWidget::processDestroy()
//----------------------------------------------------------------------
void FWidget::draw()
{
}
{ }
//----------------------------------------------------------------------
void FWidget::setColorTheme()
@ -413,9 +425,9 @@ void FWidget::adjustSize()
adjustWidgetSize.setRect(xpos, ypos, width, height);
adjustWidgetSizeShadow = adjustWidgetSize + shadow;
adjustWidgetSizeGlobal.setRect ( xpos + xmin - 1,
ypos + ymin - 1,
width, height );
adjustWidgetSizeGlobal.setRect ( xpos + xmin - 1
, ypos + ymin - 1
, width, height );
adjustWidgetSizeGlobalShadow = adjustWidgetSizeGlobal + shadow;
client_xmin = xpos + xmin - 1 + left_padding;
@ -579,58 +591,47 @@ bool FWidget::event (FEvent* ev)
//----------------------------------------------------------------------
void FWidget::onKeyPress (FKeyEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onKeyUp (FKeyEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onKeyDown (FKeyEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onMouseDown (FMouseEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onMouseUp (FMouseEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onMouseDoubleClick (FMouseEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onWheel (FWheelEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onMouseMove (FMouseEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onFocusIn (FFocusEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onFocusOut (FFocusEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onAccel (FAccelEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onResize (FResizeEvent* ev)
@ -647,13 +648,11 @@ void FWidget::onResize (FResizeEvent* ev)
//----------------------------------------------------------------------
void FWidget::onShow (FShowEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onHide (FHideEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWidget::onClose (FCloseEvent* ev)
@ -939,24 +938,24 @@ FMenuBar* FWidget::menuBar()
}
//----------------------------------------------------------------------
void FWidget::addCallback ( FString cb_signal,
FWidget::FCallback cb_handler,
data_ptr data )
void FWidget::addCallback ( FString cb_signal
, FWidget::FCallback cb_handler
, data_ptr data )
{
// add a (normal) function pointer as callback
callback_data obj = { cb_signal, cb_handler, data };
this->callbackObjects.push_back(obj);
callbackObjects.push_back(obj);
}
//----------------------------------------------------------------------
void FWidget::addCallback ( FString cb_signal,
FWidget* cb_instance,
FWidget::FMemberCallback cb_handler,
data_ptr data )
void FWidget::addCallback ( FString cb_signal
, FWidget* cb_instance
, FWidget::FMemberCallback cb_handler
, data_ptr data )
{
// add a member function pointer as callback
member_callback_data obj = { cb_signal, cb_instance, cb_handler, data };
this->memberCallbackObjects.push_back(obj);
memberCallbackObjects.push_back(obj);
}
//----------------------------------------------------------------------
@ -973,7 +972,7 @@ void FWidget::delCallback (FWidget::FCallback cb_handler)
while ( iter != callbackObjects.end() )
{
if ( iter->cb_handler == cb_handler )
iter = this->callbackObjects.erase(iter);
iter = callbackObjects.erase(iter);
else
++iter;
}
@ -1420,8 +1419,8 @@ bool FWidget::setFocus(bool on)
//----------------------------------------------------------------------
FPoint FWidget::globalToLocalPos (const FPoint& gPos)
{
return FPoint ( gPos.getX() - xpos - xmin + 2,
gPos.getY() - ypos - ymin + 2 );
return FPoint ( gPos.getX() - xpos - xmin + 2
, gPos.getY() - ypos - ymin + 2 );
}
//----------------------------------------------------------------------
@ -1606,11 +1605,11 @@ void FWidget::setTermGeometry (int w, int h)
//----------------------------------------------------------------------
void FWidget::setGeometry (const FRect& box, bool adjust)
{
setGeometry ( box.getX(),
box.getY(),
box.getWidth(),
box.getHeight(),
adjust );
setGeometry ( box.getX()
, box.getY()
, box.getWidth()
, box.getHeight()
, adjust );
}
//----------------------------------------------------------------------
@ -1640,8 +1639,8 @@ void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
widgetSize.setRect(xpos, ypos, width, height);
adjustWidgetSize.setRect(xpos, ypos, width, height);
adjustWidgetSizeShadow = adjustWidgetSize + shadow;
adjustWidgetSizeGlobal.setRect ( xpos + xmin - 1,
ypos + ymin - 1,
adjustWidgetSizeGlobal.setRect ( xpos + xmin - 1
, ypos + ymin - 1,
width, height );
adjustWidgetSizeGlobalShadow = adjustWidgetSizeGlobal + shadow;

View File

@ -152,7 +152,10 @@ class FWidget : public FObject, public FTerm
struct dbl_line_mask
{
~dbl_line_mask() {}
dbl_line_mask() : top(), right(), bottom(), left()
{ }
~dbl_line_mask()
{ }
std::vector<bool> top;
std::vector<bool> right;
std::vector<bool> bottom;

View File

@ -12,15 +12,14 @@
// constructors and destructor
//----------------------------------------------------------------------
FWindow::FWindow(FWidget* parent) : FWidget(parent)
{
window_active = false;
}
FWindow::FWindow(FWidget* parent)
: FWidget(parent)
, window_active(false)
{ }
//----------------------------------------------------------------------
FWindow::~FWindow() // destructor
{
}
{ }
// protected methods of FWindow
//----------------------------------------------------------------------
@ -52,23 +51,19 @@ bool FWindow::event (FEvent* ev)
//----------------------------------------------------------------------
void FWindow::onWindowActive (FEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWindow::onWindowInactive (FEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWindow::onWindowRaised (FEvent*)
{
}
{ }
//----------------------------------------------------------------------
void FWindow::onWindowLowered (FEvent*)
{
}
{ }
// public methods of FWindow
//----------------------------------------------------------------------

View File

@ -89,10 +89,10 @@ subdir = test
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prefix_config_h.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

View File

@ -210,9 +210,9 @@ int main (int, char**)
FString index(5); // a string with five characters
index = "index";
index[0] = L'I'; // write a wide character at position 0
printf ( " index: [0] = %c ; [4] = %c\n",
char(index[0]),
char(index[4]) );
printf ( " index: [0] = %c ; [4] = %c\n"
, char(index[0])
, char(index[4]) );
FString stringIterator = "iterator";
FString::iterator iter;

View File

@ -35,8 +35,7 @@ Mandelbrot::Mandelbrot (FWidget* parent) : FDialog(parent)
//----------------------------------------------------------------------
Mandelbrot::~Mandelbrot()
{
}
{ }
//----------------------------------------------------------------------
void Mandelbrot::draw()
@ -105,11 +104,11 @@ void Mandelbrot::onAccel (FAccelEvent* ev)
//----------------------------------------------------------------------
void Mandelbrot::onClose (FCloseEvent* ev)
{
int ret = FMessageBox::info ( this, "Quit",
"Do you really want\n"
"to quit the program ?",
FMessageBox::Yes,
FMessageBox::No );
int ret = FMessageBox::info ( this, "Quit"
, "Do you really want\n"
"to quit the program ?"
, FMessageBox::Yes
, FMessageBox::No );
if ( ret == FMessageBox::Yes )
ev->accept();
else

View File

@ -26,6 +26,10 @@ class watch : public FDialog
FSwitch* clock_sw;
FSwitch* seconds_sw;
private:
watch (const watch&); // Disabled copy constructor
watch& operator = (const watch&); // and operator '='
public:
explicit watch (FWidget* parent=0); // constructor
~watch(); // destructor
@ -42,7 +46,13 @@ class watch : public FDialog
#pragma pack(pop)
//----------------------------------------------------------------------
watch::watch (FWidget* parent) : FDialog(parent)
watch::watch (FWidget* parent)
: FDialog(parent)
, sec(true)
, time_label(0)
, time_str(0)
, clock_sw(0)
, seconds_sw(0)
{
setText ("Watch");
setShadow();
@ -131,11 +141,11 @@ void watch::onTimer (FTimerEvent*)
//----------------------------------------------------------------------
void watch::onClose (FCloseEvent* ev)
{
int ret = FMessageBox::info ( this, "Quit",
"Do you really want\n"
"to quit the program ?",
FMessageBox::Yes,
FMessageBox::No );
int ret = FMessageBox::info ( this, "Quit"
, "Do you really want\n"
"to quit the program ?"
, FMessageBox::Yes
, FMessageBox::No );
if ( ret == FMessageBox::Yes )
ev->accept();
else