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 * Some code optimizations
2015-09-18 Markus Gans <guru.mail@muenster.de> 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 \ $(srcdir)/config.h.in AUTHORS COPYING ChangeLog config.guess \
config.sub depcomp install-sh missing ltmain.sh config.sub depcomp install-sh missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prefix_config_h.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ 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. 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'.])]) 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. # Copyright (C) 2002-2013 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
@ -1247,6 +1037,7 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar]) AC_SUBST([am__untar])
]) # _AM_PROG_TAR ]) # _AM_PROG_TAR
m4_include([m4/ax_prefix_config_h.m4])
m4_include([m4/libtool.m4]) m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4]) m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4]) m4_include([m4/ltsugar.m4])

View File

@ -10,6 +10,9 @@ case "$1" in
"--debug"|"debug") "--debug"|"debug")
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic" ./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") "--profile"|"profile")
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-pg -O0 -DDEBUG -W -Wall -pedantic" ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-pg -O0 -DDEBUG -W -Wall -pedantic"
;; ;;

View File

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

View File

@ -16,7 +16,6 @@ Url: https://github.com/gansm/finalcut/
Group: System/Libraries Group: System/Libraries
Source: finalcut-%{version}.tar.gz Source: finalcut-%{version}.tar.gz
BuildRequires: automake BuildRequires: automake
BuildRequires: autoconf-archive
BuildRequires: libtool BuildRequires: libtool
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: glib2-devel BuildRequires: glib2-devel
@ -28,9 +27,7 @@ BuildRequires: gpm-devel
%else %else
BuildRequires: gpm BuildRequires: gpm
%endif %endif
%endif %else
%if %{defined fedora}
BuildRequires: gpm-devel BuildRequires: gpm-devel
%endif %endif
@ -41,6 +38,7 @@ Requires: tr
Requires: grep Requires: grep
Requires: gzip Requires: gzip
Requires: bdftopcf Requires: bdftopcf
Requires: autoconf-archive
Requires: gcc-c++ Requires: gcc-c++
Prefix: %_prefix Prefix: %_prefix
@ -108,6 +106,7 @@ export CPPFLAGS="$RPM_OPT_FLAGS %{warn_flags}"
%configure %configure
make %{?_smp_mflags} V=1 make %{?_smp_mflags} V=1
%install %install
make install libdir=${RPM_BUILD_ROOT}%{_libdir}/ \ make install libdir=${RPM_BUILD_ROOT}%{_libdir}/ \
includedir=${RPM_BUILD_ROOT}%{_includedir} \ 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 \ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(finalcutinclude_HEADERS) $(top_srcdir)/depcomp $(finalcutinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prefix_config_h.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d mkinstalldirs = $(install_sh) -d

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,11 +6,28 @@
#include "fevent.h" #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 // class FKeyEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FKeyEvent::FKeyEvent(int ev_type, int key_num) // constructor FKeyEvent::FKeyEvent (int ev_type, int key_num) // constructor
: FEvent(ev_type) : FEvent(ev_type)
, k(key_num) , k(key_num)
, accpt(false) , accpt(false)
@ -41,19 +58,20 @@ void FKeyEvent::ignore()
// class FMouseEvent // class FMouseEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseEvent::FMouseEvent ( int ev_type, // constructor FMouseEvent::FMouseEvent ( int ev_type // constructor
const FPoint& pos, , const FPoint& pos
int button ) , int button )
: FEvent(ev_type) : FEvent(ev_type)
, p(pos) , p(pos)
, g()
, b(button) , b(button)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseEvent::FMouseEvent ( int ev_type, // constructor FMouseEvent::FMouseEvent ( int ev_type // constructor
const FPoint& pos, , const FPoint& pos
const FPoint& globalPos, , const FPoint& globalPos
int button ) , int button )
: FEvent(ev_type) : FEvent(ev_type)
, p(pos) , p(pos)
, g(globalPos) , g(globalPos)
@ -97,19 +115,20 @@ int FMouseEvent::getButton() const
// class FWheelEvent // class FWheelEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWheelEvent::FWheelEvent ( int ev_type, // constructor FWheelEvent::FWheelEvent ( int ev_type // constructor
const FPoint& pos, , const FPoint& pos
int wheel ) , int wheel )
: FEvent(ev_type) : FEvent(ev_type)
, p(pos) , p(pos)
, g()
, w(wheel) , w(wheel)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWheelEvent::FWheelEvent (int ev_type, // constructor FWheelEvent::FWheelEvent ( int ev_type // constructor
const FPoint& pos, , const FPoint& pos
const FPoint& globalPos, , const FPoint& globalPos
int wheel) , int wheel )
: FEvent(ev_type) : FEvent(ev_type)
, p(pos) , p(pos)
, g(globalPos) , g(globalPos)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,40 +10,38 @@
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FOptiMove::FOptiMove (int baud) 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 ); assert ( baud >= 0 );
baudrate = baud;
tabstop = 0;
move_buf[0] = '\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(); calculateCharDuration();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FOptiMove::~FOptiMove() // destructor FOptiMove::~FOptiMove() // destructor
{ { }
}
// private methods of FApplication // 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 FOptiMove::relative_move ( char*& move
int from_x, int from_y, , int from_x, int from_y
int to_x, int to_y ) , int to_x, int to_y )
{ {
int num; int num;
int vtime = 0; int vtime = 0;
@ -469,8 +467,8 @@ int FOptiMove::relative_move ( char*& move,
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FOptiMove::isTwoDirectionMove ( int xold, int yold, inline bool FOptiMove::isTwoDirectionMove ( int xold, int yold
int xnew, int ynew ) , int xnew, int ynew )
{ {
return bool ( (xold != xnew || ! F_row_address.cap) return bool ( (xold != xnew || ! F_row_address.cap)
&& (yold != ynew || ! F_column_address.cap) ); && (yold != ynew || ! F_column_address.cap) );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,16 +9,57 @@
// constructors and destructor // 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); setOrientation (o);
init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -31,23 +72,7 @@ FScrollbar::~FScrollbar()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::init() void FScrollbar::init()
{ {
SliderPos = 0; setGeometry(1, 1, width, height);
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();
ignore_padding = true; ignore_padding = true;
unsetFocusable(); unsetFocusable();
} }
@ -391,29 +416,29 @@ void FScrollbar::redraw()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::setMinimum (int minimum) void FScrollbar::setMinimum (int minimum)
{ {
this->min = minimum; min = minimum;
calculateSliderValues(); calculateSliderValues();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::setMaximum (int maximum) void FScrollbar::setMaximum (int maximum)
{ {
this->max = maximum; max = maximum;
calculateSliderValues(); calculateSliderValues();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::setRange(int minimum, int maximum) void FScrollbar::setRange(int minimum, int maximum)
{ {
this->min = minimum; min = minimum;
this->max = maximum; max = maximum;
calculateSliderValues(); calculateSliderValues();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::setValue (int value) void FScrollbar::setValue (int value)
{ {
this->val = value; val = value;
calculateSliderValues(); calculateSliderValues();
} }
@ -434,12 +459,12 @@ void FScrollbar::setPageSize (int document_size, int page_size)
if ( page_size == 0 ) if ( page_size == 0 )
{ {
pageSize = document_size; pageSize = document_size;
this->steps = 1.0; steps = 1.0;
} }
else else
{ {
pageSize = page_size; 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 setPageSize (int, int);
void calculateSliderValues(); void calculateSliderValues();
void setOrientation (int); void setOrientation (int);
// make every setGeometry from FWidget available
using FWidget::setGeometry;
void setGeometry (int, int, int, int, bool adjust=true); void setGeometry (int, int, int, int, bool adjust=true);
void drawButtons(); void drawButtons();
void drawBar(); void drawBar();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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