mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
more FILMagain stuff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@808 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6bba977f42
commit
6d678c927c
@ -4,6 +4,7 @@ config.status
|
||||
Makefile
|
||||
Makefile.in
|
||||
configure
|
||||
acinclude.m4
|
||||
aclocal.m4
|
||||
lyx.1
|
||||
libtool
|
||||
|
@ -1,6 +1,7 @@
|
||||
dnl Some useful functions for LyXs configure.in -*- sh -*-
|
||||
dnl Author: Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr)
|
||||
dnl Lars Gullik Bjønnes (larsbj@lyx.org)
|
||||
dnl Allan Rae (rae@lyx.org)
|
||||
|
||||
|
||||
dnl Usage LYX_GET_VERSION Sets "lyx_version" to the version of LyX being
|
||||
@ -735,21 +736,29 @@ AC_SUBST(INCLUDED_SIGC)
|
||||
## actual header _is_ found though and the cache variable is set however
|
||||
## the reported setting (on screen) is equal to $ac_safe for some unknown
|
||||
## reason.
|
||||
## Additionally, autoheader can't figure out what to use as the name in
|
||||
## the config.h.in file so we need to write our own entries there -- one for
|
||||
## each header in the form PATH_HEADER_NAME_H
|
||||
##
|
||||
AC_DEFUN(LYX_PATH_HEADER,
|
||||
[ AC_CHECK_HEADER($1,[
|
||||
ac_tr_safe=PATH_`echo $ac_safe | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
|
||||
AC_CACHE_CHECK([path to $1],lyx_cv_path_$ac_safe,
|
||||
### the only remaining problem is getting the second parameter to this
|
||||
### AC_CACHE_CACHE to print correctly. Currently it just results in value
|
||||
### of $ac_safe being printed.
|
||||
AC_CACHE_CHECK([path to $1],[lyx_cv_path2_$ac_safe],
|
||||
[ cat > conftest.$ac_ext <<EOF
|
||||
#line __oline__ "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <$1>
|
||||
EOF
|
||||
lyx_cv_path_$ac_safe=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
|
||||
lyx_path_header_path=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
|
||||
grep $1 2>/dev/null | \
|
||||
sed -e 's/.*\(".*$1"\).*/\1/' -e "1q"`
|
||||
eval "lyx_cv_path2_${ac_safe}=\$lyx_path_header_path"
|
||||
rm -f conftest*])
|
||||
AC_DEFINE_UNQUOTED(${ac_tr_safe},${lyx_cv_path_$ac_safe})])
|
||||
AC_DEFINE_UNQUOTED($ac_tr_safe, $lyx_path_header_path)])
|
||||
])
|
||||
### end of LYX_PATH_HEADER
|
||||
|
||||
|
@ -253,6 +253,7 @@ AC_OUTPUT([Makefile \
|
||||
src/mathed/Makefile \
|
||||
src/insets/Makefile \
|
||||
src/support/Makefile \
|
||||
src/xtl/Makefile \
|
||||
src/frontends/Makefile \
|
||||
src/frontends/xforms/Makefile \
|
||||
src/frontends/kde/Makefile \
|
||||
|
87
development/tools/lxtl.sh
Executable file
87
development/tools/lxtl.sh
Executable file
@ -0,0 +1,87 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Author: Allan Rae <rae@lyx.org>
|
||||
#
|
||||
# Copy xtl files ready for internal use.
|
||||
|
||||
usage () {
|
||||
echo "usage: lxtl.sh <version-number>">&2
|
||||
echo " <version-number> is required and should be of the form" >&2
|
||||
echo " 'XTL-x.y.pl.z' where x, y and z are digits." >&2
|
||||
echo "" >&2
|
||||
echo "Run this from the root of the xtl source tree." >&2
|
||||
echo "Everything LyX needs will be moved into lxtl/" >&2
|
||||
echo "you then 'cp lxtl/* /path-to-lyx/src/xtl/'" >&2
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
if [ ! -d ./include/xtl ] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -d ./lxtl ]; then
|
||||
echo "Uh oh! There's a directory called lxtl here already." >&2
|
||||
echo "I'm going to delete it unless you press <Ctrl><C> right now!" >&2
|
||||
read aline
|
||||
rm -rf lxtl
|
||||
fi
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
mkdir lxtl
|
||||
|
||||
cp COPYING.LIB lxtl
|
||||
cat > lxtl/README <<EOF
|
||||
$1
|
||||
This directory contains the subset of XTL required by LyX.
|
||||
The full distribution includes extensive tests and documentation.
|
||||
If you encounter compiler errors in xtl code when compiling LyX please
|
||||
get a copy of the full distribution and run the regression tests on your
|
||||
system. Report any problems found to the xtl mailing list.
|
||||
|
||||
See: http://gsd.di.uminho.pt/jop/xtl/
|
||||
|
||||
-------------------------===========================----------------------
|
||||
|
||||
EOF
|
||||
|
||||
cat README >> lxtl/README
|
||||
|
||||
cat > lxtl/Makefile.am <<\EOF
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
DISTCLEANFILES= *.orig *.rej *~ *.bak core
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
EXTRA_DIST = README COPYING.LIB
|
||||
ETAGS_ARGS = --lang=c++
|
||||
SOURCES = \
|
||||
autobuf.h \
|
||||
autoio.h \
|
||||
config.h \
|
||||
giop.h \
|
||||
graphio.h \
|
||||
macros.h \
|
||||
objio.h \
|
||||
text.h \
|
||||
vobjio.h \
|
||||
xdr.h
|
||||
EOF
|
||||
|
||||
cat > lxtl/.cvsignore <<EOF
|
||||
Makefile
|
||||
Makefile.in
|
||||
EOF
|
||||
|
||||
# strip the Id info otherwise it gets replaced with the CVS version instead
|
||||
# making it even more confusing.
|
||||
#
|
||||
(
|
||||
cd include/xtl;
|
||||
for hfile in `ls`; do
|
||||
sed < $hfile > ../../lxtl/$hfile \
|
||||
-e '/Id:/s/\$//g'
|
||||
done
|
||||
)
|
||||
|
@ -783,13 +783,13 @@ boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
label: Family:|#F
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name:
|
||||
name: choice_family
|
||||
callback:
|
||||
argument:
|
||||
|
||||
@ -801,6 +801,78 @@ boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Series:|#S
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_series
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 94 95 191 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Shape:|#H
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_shape
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 94 50 191 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Color:|#C
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_color
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 94 85 191 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Toggle on all these|#T
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: check_toggle_all
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 320 280 45
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
@ -812,56 +884,20 @@ callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 94 15 191 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 260 280 45
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_BLACK FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Family:|#F
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_family
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 94 50 191 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Series:|#S
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_series
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHOICE
|
||||
type: NORMAL_CHOICE
|
||||
box: 94 85 191 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_BLACK
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Shape:|#H
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name: choice_shape
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
@ -981,7 +1017,7 @@ boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_BOLD_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: These are never toggled
|
||||
shortcut:
|
||||
@ -999,7 +1035,7 @@ boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_BOLD_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: These are always toggled
|
||||
shortcut:
|
||||
@ -1009,6 +1045,24 @@ name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: FRAME_BOX
|
||||
box: 95 175 190 30
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Language:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NorthWest FL_NoGravity
|
||||
name: choice_language
|
||||
callback:
|
||||
argument:
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_paragraph
|
||||
Width: 490
|
||||
|
@ -1,6 +1,7 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
POTFILES
|
||||
POTFILES.in
|
||||
*.gmo
|
||||
*.mo
|
||||
cat-id-tbl.c
|
||||
|
28
sigc++/.cvsignore
Normal file
28
sigc++/.cvsignore
Normal file
@ -0,0 +1,28 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
stamp-h*
|
||||
.libs
|
||||
.deps
|
||||
*.lo
|
||||
*.la
|
||||
config.h
|
||||
signal.h
|
||||
slot.h
|
||||
object_slot.h
|
||||
func_slot.h
|
||||
basic_signal.h
|
||||
class_slot.h
|
||||
signals.h
|
||||
bind.h
|
||||
convert.h
|
||||
rettype.h
|
||||
retbind.h
|
||||
aclocal.m4
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
libtool
|
||||
sigc-config
|
||||
stamp*
|
||||
sigc++config.h
|
||||
sigc++config.h.in
|
12
sigc++/DO_NOT_MODIFY_THESE_FILES
Normal file
12
sigc++/DO_NOT_MODIFY_THESE_FILES
Normal file
@ -0,0 +1,12 @@
|
||||
These files are all collected together from a checked out copy of the
|
||||
libsigc++ CVS repository by the ../development/tools/makeLyXsigc.sh file.
|
||||
Some of these files are modified by that script. If you need to fix a bug in
|
||||
the code then you should try to get the latest CVS libsigc++ and regenerate
|
||||
this entire subpackage. If the problem still persists it may be necessary to
|
||||
modify the generation script.
|
||||
|
||||
If an error is found while porting to a new platform read the doc/requirements
|
||||
file.
|
||||
|
||||
Remember to contact the LyX developers list if you are having problems.
|
||||
Allan. (ARRae)
|
33
sigc++/Makefile.am
Normal file
33
sigc++/Makefile.am
Normal file
@ -0,0 +1,33 @@
|
||||
SUBDIRS = macros
|
||||
DISTCLEANFILES= *.orig *.rej *~ *.bak core
|
||||
MAINTAINERCLEANFILES= $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/sigc++config* $(srcdir)/stamp* $(srcdir)/aclocal.m4 $(srcdir)/acinclude.m4
|
||||
ETAGS_ARGS = --lang=c++
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/.. -I$(top_builddir)/..
|
||||
M4_DIR = $(top_srcdir)/macros
|
||||
M4_INCLUDES = -I$(M4_DIR)
|
||||
|
||||
BUILT_SOURCES = slot.h object_slot.h func_slot.h class_slot.h \
|
||||
basic_signal.h \
|
||||
convert.h bind.h rettype.h retbind.h
|
||||
|
||||
libsigc_la_SOURCES= \
|
||||
object.cc scope.cc marshal.cc slot.cc\
|
||||
basic_signal.cc adaptor.cc thread.cc
|
||||
|
||||
libsigc_la_LDFLAGS = \
|
||||
-no-undefined
|
||||
|
||||
noinst_LTLIBRARIES = libsigc.la
|
||||
|
||||
noinst_HEADERS = \
|
||||
marshal.h handle_system.h signal_system.h \
|
||||
$(BUILT_SOURCES) type.h\
|
||||
handle.h object.h scope.h adaptor.h thread.h
|
||||
|
||||
|
||||
%.h: $(M4_DIR)/%.h.m4 $(M4_DIR)/template.macros.m4
|
||||
$(M4) $(M4_INCLUDES) $(DEFINES) $< > $@
|
||||
|
||||
all-local: $(noinst_LTLIBRARIES)
|
||||
|
91
sigc++/acconfig.h
Normal file
91
sigc++/acconfig.h
Normal file
@ -0,0 +1,91 @@
|
||||
#ifndef _SIGC_CONFIG_H_
|
||||
#define _SIGC_CONFIG_H_
|
||||
|
||||
#if 0
|
||||
@TOP@
|
||||
@BOTTOM@
|
||||
#undef PACKAGE
|
||||
#endif /* 0 */
|
||||
|
||||
#undef SIGC_MAJOR_VERSION
|
||||
#undef SIGC_MINOR_VERSION
|
||||
#undef SIGC_MICRO_VERSION
|
||||
|
||||
// detect common platforms
|
||||
#if defined(_WIN32)
|
||||
// Win32 compilers have a lot of varation
|
||||
#if defined(__BORLANDC__)
|
||||
#define LIBSIGC_BC
|
||||
#define LIBSIGC_WIN32
|
||||
#elif defined(_MSC_VER)
|
||||
#define LIBSIGC_MSC
|
||||
#define LIBSIGC_WIN32
|
||||
#elif defined(__CYGWIN__)
|
||||
#define LIBSIGC_UNIX
|
||||
#else
|
||||
#error "Unknown architecture (send me gcc --dumpspecs)"
|
||||
#endif
|
||||
#else
|
||||
#define LIBSIGC_UNIX
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
#ifdef LIBSIGC_UNIX
|
||||
#undef SIGC_CXX_NAMESPACES
|
||||
#undef SIGC_CXX_PARTIAL_SPEC
|
||||
#undef SIGC_CXX_MEMBER_FUNC_TEMPLATES
|
||||
#undef SIGC_CXX_MEMBER_CLASS_TEMPLATES
|
||||
#undef SIGC_CXX_MUTABLE
|
||||
#undef SIGC_CXX_FRIEND_TEMPLATES
|
||||
#undef SIGC_CXX_TEMPLATE_CCTOR
|
||||
#undef SIGC_CXX_INT_CTOR
|
||||
#undef SIGC_CXX_VOID_RETURN
|
||||
#undef SIGC_CXX_SPECIALIZE_REFERENCES
|
||||
#undef SIGC_PTHREADS
|
||||
#undef SIGC_PTHREAD_DCE
|
||||
#ifdef SIGC_PTHREADS
|
||||
#undef SIGC_PTHREAD_COND_ATTR
|
||||
#undef SIGC_PTHREAD_COND_IMPL
|
||||
#undef SIGC_PTHREAD_MUTEX_ATTR
|
||||
#undef SIGC_PTHREAD_MUTEX_IMPL
|
||||
#undef SIGC_PTHREAD_THREAD_ATTR
|
||||
#undef SIGC_PTHREAD_THREAD_IMPL
|
||||
#undef SIGC_PTHREAD_KEY_IMPL
|
||||
#endif /* SIGC_PTHREADS */
|
||||
#endif /* LIBSIGC_UNIX */
|
||||
|
||||
#ifdef LIBSIGC_BC
|
||||
#define SIGC_CXX_NAMESPACES 1
|
||||
#define SIGC_CXX_PARTIAL_SPEC 1
|
||||
#define SIGC_CXX_MEMBER_FUNC_TEMPLATES 1
|
||||
#define SIGC_CXX_MEMBER_CLASS_TEMPLATES 1
|
||||
#define SIGC_CXX_MUTABLE 1
|
||||
#define SIGC_CXX_FRIEND_TEMPLATES 1
|
||||
#define SIGC_CXX_INT_CTOR 1
|
||||
#define SIGC_CXX_VOID_RETURN 1
|
||||
#define SIGC_CXX_SPECIALIZE_REFERENCES 1
|
||||
#endif /* LIBSIGC_BC */
|
||||
|
||||
#ifdef LIBSIGC_MSC
|
||||
#define SIGC_CXX_NAMESPACES 1
|
||||
#define SIGC_CXX_MEMBER_FUNC_TEMPLATES 1
|
||||
#define SIGC_CXX_MEMBER_CLASS_TEMPLATES 1
|
||||
#define SIGC_CXX_MUTABLE 1
|
||||
#define SIGC_CXX_TEMPLATE_CCTOR 1
|
||||
#define SIGC_CXX_INT_CTOR 1
|
||||
#endif /* LIBSIGC_MSC */
|
||||
|
||||
#ifdef LIBSIGC_WIN32
|
||||
#ifdef LIBSIGC_EXPORTS
|
||||
#define LIBSIGC_API __declspec(dllexport)
|
||||
#define LIBSIGC_TMPL
|
||||
#else
|
||||
#define LIBSIGC_API __declspec(dllimport)
|
||||
#define LIBSIGC_TMPL extern
|
||||
#endif /* LIBSIGC_EXPORTS */
|
||||
#else
|
||||
#define LIBSIGC_API
|
||||
#endif /* LIBSIGC_WIN32 */
|
||||
|
||||
|
||||
#endif /* _SIGC_CONFIG_H_ */
|
430
sigc++/acinclude.m4
Normal file
430
sigc++/acinclude.m4
Normal file
@ -0,0 +1,430 @@
|
||||
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
|
||||
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
|
||||
## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
##
|
||||
## 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 2 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, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## As a special exception to the GNU General Public License, if you
|
||||
## distribute this file as part of a program that contains a
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
38
sigc++/adaptor.cc
Normal file
38
sigc++/adaptor.cc
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif //SIGC_CXX_NAMESPACES
|
||||
|
||||
void AdaptorSlot_::copy_callback(SlotData* sdata,AdaptorNode* node)
|
||||
{
|
||||
sdata->list_.insert_direct(sdata->list_.begin(),node);
|
||||
|
||||
int i;
|
||||
char *p1=(char*)&(node->data_),*p2=(char*)&(sdata->data_);
|
||||
for (i=0;i<sizeof(Callback_)/sizeof(char);i++)
|
||||
{ *p1=*p2; p1++; p2++; }
|
||||
}
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
43
sigc++/adaptor.h
Normal file
43
sigc++/adaptor.h
Normal file
@ -0,0 +1,43 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#ifndef _SIGC_ADAPTOR_H_
|
||||
#define _SIGC_ADAPTOR_H_
|
||||
#include <sigc++/slot.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
struct LIBSIGC_API AdaptorNode : public SlotNode
|
||||
{
|
||||
Callback_ data_;
|
||||
};
|
||||
|
||||
struct LIBSIGC_API AdaptorSlot_
|
||||
{
|
||||
static void copy_callback(SlotData* sdata,AdaptorNode* node);
|
||||
};
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
71
sigc++/basic_signal.cc
Normal file
71
sigc++/basic_signal.cc
Normal file
@ -0,0 +1,71 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <sigc++/basic_signal.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif //SIGC_CXX_NAMESPACES
|
||||
|
||||
Signal_::Impl::Impl():incoming_(),outgoing_() {}
|
||||
Signal_::Impl::~Impl() {}
|
||||
|
||||
|
||||
Signal_::Signal_()
|
||||
:impl(0)
|
||||
{}
|
||||
|
||||
Signal_::~Signal_()
|
||||
{
|
||||
delete impl;
|
||||
}
|
||||
|
||||
bool Signal_::empty() const
|
||||
{
|
||||
return (!impl||impl->outgoing_.empty());
|
||||
}
|
||||
|
||||
void Signal_::clear()
|
||||
{
|
||||
if (impl)
|
||||
impl->outgoing_.clear();
|
||||
}
|
||||
|
||||
SlotData* Signal_::out_connect(SlotData *sd)
|
||||
{
|
||||
// we now reference the object
|
||||
sd->connect();
|
||||
|
||||
// insert in list
|
||||
if (!impl) impl=new Impl();
|
||||
impl->outgoing_.insert_direct(impl->outgoing_.begin(),sd->sender());
|
||||
return sd;
|
||||
}
|
||||
|
||||
SlotData* Signal_::in_connect()
|
||||
{
|
||||
SlotData* sd=manage(new SlotData());
|
||||
if (!impl) impl=new Impl();
|
||||
impl->incoming_.insert_direct(impl->incoming_.end(),sd->receiver());
|
||||
return sd;
|
||||
}
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
641
sigc++/configure.in
Normal file
641
sigc++/configure.in
Normal file
@ -0,0 +1,641 @@
|
||||
## (C) 1998 Stephan Kulow
|
||||
## Modified by Tero Pulkkinen
|
||||
## Modified by Karl Nelson
|
||||
## Modified by makeLyXsigc.sh (Allan Rae)
|
||||
|
||||
AC_INIT(slot.cc)
|
||||
|
||||
AC_DEFUN(LYX_FIX_MAKEFILE_IN,[
|
||||
## modify Makefile.in if need be -- since we still use automake
|
||||
for dir in $srcdir $srcdir/macros ; do
|
||||
( cd $dir ;
|
||||
sed < Makefile.in > Makefile_tmp \
|
||||
-e 's/all: all-redirect/all: all-@USE_INCLUDED_SIGC@\
|
||||
all-yes: all-redirect\
|
||||
all-no:/' ;
|
||||
mv Makefile_tmp Makefile.in )
|
||||
done
|
||||
])
|
||||
|
||||
LYX_FIX_MAKEFILE_IN
|
||||
|
||||
define(AC_PUSH_LIB,[dnl
|
||||
ifdef([__LIB__],,[define([__LIB__],0)])dnl
|
||||
ac_save_LIBS[]__LIB__="$LIBS"
|
||||
define([__LIB__],builtin(eval,(__LIB__ + 1)))dnl
|
||||
LIBS="$1"])
|
||||
define(AC_POP_LIB,[dnl
|
||||
define([__LIB__],builtin(eval,(__LIB__ - 1)))dnl
|
||||
LIBS="$ac_save_LIBS[]__LIB__"])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Source packaging numbers
|
||||
SIGC_MAJOR_VERSION=1
|
||||
SIGC_MINOR_VERSION=0
|
||||
SIGC_MICRO_VERSION=0
|
||||
|
||||
dnl Library extension
|
||||
SIGC_RELEASE=1.0
|
||||
|
||||
SIGC_VERSION=$SIGC_MAJOR_VERSION.$SIGC_MINOR_VERSION.$SIGC_MICRO_VERSION
|
||||
|
||||
#
|
||||
# +1 : ? : +1 == new interface that does not break old one
|
||||
# +1 : ? : 0 == new interface that breaks old one
|
||||
# ? : ? : 0 == no new interfaces, but breaks apps
|
||||
# ? :+1 : ? == just some internal changes, nothing breaks but might work
|
||||
# better
|
||||
# CURRENT : REVISION : AGE
|
||||
LIBSIGC_SO_VERSION=0:0:0
|
||||
AC_SUBST(LIBSIGC_SO_VERSION, $LIBSIGC_SO_VERSION)
|
||||
|
||||
AC_SUBST(SIGC_RELEASE, $SIGC_RELEASE)
|
||||
AC_SUBST(SIGC_VERSION)
|
||||
|
||||
AC_DEFINE_UNQUOTED(SIGC_MAJOR_VERSION, $SIGC_MAJOR_VERSION)
|
||||
AC_DEFINE_UNQUOTED(SIGC_MINOR_VERSION, $SIGC_MINOR_VERSION)
|
||||
AC_DEFINE_UNQUOTED(SIGC_MICRO_VERSION, $SIGC_MICRO_VERSION)
|
||||
|
||||
AC_CONFIG_AUX_DIR(../config)
|
||||
|
||||
dnl For automake.
|
||||
VERSION=$SIGC_VERSION
|
||||
PACKAGE=libsigc++
|
||||
|
||||
dnl Initialize automake stuff
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||
|
||||
dnl Specify a configuration file
|
||||
AM_CONFIG_HEADER(sigc++config.h)
|
||||
|
||||
AC_ARG_WITH([included-libsigc],
|
||||
[ --without-included-libsigc
|
||||
Use the libsigc++ installed on the system
|
||||
Used when libsigc++ is bundled with applications],
|
||||
[sigc_use_included_libsigc=$withval],
|
||||
[sigc_use_included_libsigc=yes])
|
||||
if test x$sigc_use_included_libsigc = xno; then
|
||||
## just change the setting for the Makefile
|
||||
USE_INCLUDED_SIGC=no
|
||||
AC_SUBST(USE_INCLUDED_SIGC)
|
||||
else
|
||||
###
|
||||
### This else..fi goes till the end of the file!
|
||||
###
|
||||
USE_INCLUDED_SIGC=yes
|
||||
AC_SUBST(USE_INCLUDED_SIGC)
|
||||
|
||||
AC_ARG_ENABLE(threads,
|
||||
[ --disable-threads disables support threading.],
|
||||
enable_threads=$enableval,enable_threads="yes")
|
||||
AC_ARG_ENABLE(checks,
|
||||
[ --disable-checks disables unnecessary tests needed for bug reports.],
|
||||
enable_checks=$enableval,enable_checks="yes"
|
||||
)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
|
||||
|
||||
AM_DISABLE_SHARED
|
||||
|
||||
dnl Instruct build of dll for cygwin (libtool 1.3)
|
||||
dnl Exports screw up badly on libtool 1.3, backing off to 1.2f
|
||||
dnl A C_LIBTOOL_WIN32_DLL
|
||||
|
||||
dnl libtool does all checks with $CC, not with $CXX
|
||||
dnl maybe this should be fixed in libtool, not here
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl On FreeBSD 3.0 (and perhaps some other systems) GNU m4 is
|
||||
dnl called `gm4' where `m4' is the system's own m4.
|
||||
AC_CHECK_PROGS(M4, gm4 m4, m4)
|
||||
|
||||
AC_PROG_CXX
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
dnl Checking if linker supports global constructors
|
||||
dnl This is largely information for me if someone files a bug report
|
||||
if test "X$enable_checks" = "Xyes"; then
|
||||
AC_MSG_CHECKING([if linker supports global constructors])
|
||||
cat > mylib.$ac_ext <<EOF
|
||||
#include <stdio.h>
|
||||
|
||||
struct A
|
||||
{A() {printf("PASS\n");}
|
||||
};
|
||||
|
||||
A a;
|
||||
|
||||
int foo()
|
||||
{return 1;}
|
||||
|
||||
EOF
|
||||
cat > mytest.$ac_ext <<EOF
|
||||
#include <stdio.h>
|
||||
|
||||
extern int foo();
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
int i=foo();
|
||||
if (i!=1) printf("FAIL\n");
|
||||
}
|
||||
|
||||
EOF
|
||||
sh libtool --mode=compile $CXX -c mylib.$ac_ext >&5
|
||||
sh libtool --mode=link $CXX -o libtest.la -rpath / -version-info 0 mylib.lo >&5
|
||||
$CXX -c $CFLAGS $CPPFLAGS mytest.$ac_ext >&5
|
||||
sh libtool --mode=link $CXX -o mytest mytest.o libtest.la >&5 2>/dev/null
|
||||
if test -x mytest; then
|
||||
myresult=`./mytest`
|
||||
if test "X$myresult" = "XPASS"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN([
|
||||
===================================================================
|
||||
WARNING: This platform lacks support of construction of global
|
||||
objects in shared librarys. Although not required by this library,
|
||||
this is a serious problem for building C++ libraries. You will not
|
||||
be able to use any shared libraries that contain global objects with
|
||||
contructors.
|
||||
|
||||
See ftp://rtfm.mit.edu/pub/usenet/news.answers/g++-FAQ/plain
|
||||
for details about this problem. Also for possible solutions
|
||||
http://www.informatik.uni-frankfurt.de/~fp/Tcl/tcl-c++/tcl-c++.html
|
||||
===================================================================
|
||||
])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(unknown)
|
||||
fi
|
||||
rm -f mylib.* mytest.* libtest.la .libs/libtest* mytest .libs/mytest >&5
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(if C++ compiler uses std namespace )
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <iostream>
|
||||
namespace std{ void kludge(); }
|
||||
using namespace std;
|
||||
],[
|
||||
cout << "test" << endl;
|
||||
],[
|
||||
ac_std_namespace=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
],[
|
||||
ac_std_namespace=maybe
|
||||
])
|
||||
if test "x$ac_std_namespace" = xmaybe ; then
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <iostream.h>
|
||||
namespace std{ void kludge(); }
|
||||
using namespace std;
|
||||
],[
|
||||
cout << "test" << endl;
|
||||
],[
|
||||
ac_std_namespace=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_WARN([
|
||||
===================================================================
|
||||
WARNING: This compiler platform does not have the iostream library
|
||||
in the std namespace. This presents a problem for writing portable
|
||||
STL code. To run the demos, you will need to place a file with the
|
||||
following in a file called "iostream" in your include directory.
|
||||
|
||||
---------------------------iostream--------------------------------
|
||||
#ifndef IOSTREAM_KLUDGE
|
||||
#define IOSTREAM_KLUDGE
|
||||
#include <iostream.h>
|
||||
namespace std { void iostream_kludge(); };
|
||||
#endif
|
||||
===================================================================
|
||||
])
|
||||
],[
|
||||
ac_std_namespace=no
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([
|
||||
===================================================================
|
||||
WARNING: This compiler platform does not support iostream
|
||||
or namespaces. You will not be able to run the demos as they
|
||||
use STL. This does not affect use of the library, only the demos.
|
||||
===================================================================
|
||||
])
|
||||
])
|
||||
fi
|
||||
|
||||
|
||||
|
||||
dnl
|
||||
dnl C++ compiler feature check start here
|
||||
|
||||
AC_MSG_CHECKING(if C++ compiler supports bool (required))
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
],[
|
||||
bool b=true;
|
||||
bool b1=false;
|
||||
],[
|
||||
ac_bool=yes
|
||||
AC_MSG_RESULT([$ac_bool])
|
||||
],[
|
||||
config_error=yes
|
||||
AC_MSG_RESULT([$ac_bool])
|
||||
AC_WARN(bool type is not supported by your compiler)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([if C++ compiler supports const_cast<> (required)])
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
class foo;
|
||||
],[
|
||||
const foo *c=0;
|
||||
foo *c1=const_cast<foo*>(c);
|
||||
],[
|
||||
ac_const_cast=yes
|
||||
AC_MSG_RESULT([$ac_const_cast])
|
||||
],[
|
||||
AC_MSG_RESULT([$ac_const_cast])
|
||||
AC_WARN(C++ compiler const_cast<> does not work)
|
||||
config_error=yes
|
||||
])
|
||||
|
||||
# Member function templates
|
||||
AC_MSG_CHECKING(if C++ compiler supports member function templates)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
class foo
|
||||
{
|
||||
public:
|
||||
template <class T> void method(T t);
|
||||
};
|
||||
|
||||
template <class T> void foo::method(T t) {t = 0;}
|
||||
],[
|
||||
],[
|
||||
ac_member_func_templates=yes
|
||||
AC_DEFINE(SIGC_CXX_MEMBER_FUNC_TEMPLATES)
|
||||
AC_MSG_RESULT([$ac_member_func_templates])
|
||||
],[
|
||||
ac_member_func_templates=no
|
||||
AC_MSG_RESULT([$ac_member_func_templates])
|
||||
config_error=yes
|
||||
AC_MSG_WARN([Test for member templates failed. This disables some methods that requires member template support. If your compiler should support member templates, see config.log to figure out why the test failed.])
|
||||
])
|
||||
|
||||
|
||||
|
||||
# Member class templates
|
||||
AC_MSG_CHECKING(if C++ compiler supports member class templates)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
struct S
|
||||
{
|
||||
template <class T> struct A {};
|
||||
template <class T> struct B {};
|
||||
};
|
||||
],[
|
||||
],[
|
||||
ac_member_class_templates=yes
|
||||
AC_DEFINE(SIGC_CXX_MEMBER_CLASS_TEMPLATES)
|
||||
AC_MSG_RESULT([$ac_member_class_templates])
|
||||
],[
|
||||
ac_member_class_templates=no
|
||||
AC_MSG_RESULT([$ac_member_class_templates])
|
||||
AC_MSG_WARN([Test for member templates failed. This disables some methods that requires member template support. If your compiler should support member templates, see config.log to figure out why the test failed.])
|
||||
])
|
||||
|
||||
|
||||
|
||||
# Mutable
|
||||
AC_MSG_CHECKING(if C++ compiler supports mutable)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
class k {
|
||||
mutable char *c;
|
||||
public:
|
||||
void foo() const { c=0; }
|
||||
};
|
||||
],[
|
||||
],[
|
||||
ac_cxx_mutable=yes
|
||||
AC_DEFINE(SIGC_CXX_MUTABLE)
|
||||
],[
|
||||
ac_cxx_mutable=no
|
||||
])
|
||||
AC_MSG_RESULT([$ac_cxx_mutable])
|
||||
|
||||
|
||||
# Partial Specialization
|
||||
AC_MSG_CHECKING([if C++ compiler supports partial specialization(required)])
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
template<class T, class K>
|
||||
class k {
|
||||
public:
|
||||
};
|
||||
template<class T> class k<void,T> { };
|
||||
],[
|
||||
k<float, float> b;
|
||||
k<void,void> a;
|
||||
],[
|
||||
ac_cxx_partial_specialization=yes
|
||||
AC_MSG_RESULT([$ac_cxx_partial_specialization])
|
||||
AC_DEFINE(SIGC_CXX_PARTIAL_SPEC)
|
||||
],[
|
||||
config_error=yes
|
||||
ac_cxx_partial_specialization=no
|
||||
AC_MSG_RESULT([$ac_cxx_partial_specialization])
|
||||
AC_MSG_WARN([Partial specialization is needed for signal templates.])
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(if C++ compiler supports name spaces)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
namespace Check
|
||||
{
|
||||
int i;
|
||||
}
|
||||
],[
|
||||
Check::i=1;
|
||||
],[
|
||||
ac_cxx_namespaces=yes
|
||||
AC_MSG_RESULT([$ac_cxx_namespaces])
|
||||
AC_DEFINE(SIGC_CXX_NAMESPACES)
|
||||
],[
|
||||
ac_cxx_namespaces=no
|
||||
AC_MSG_RESULT([$ac_cxx_namespaces])
|
||||
AC_MSG_WARN([Without namespaces all classes will be global.])
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(if C++ compiler supports friend template)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
struct A
|
||||
{
|
||||
template <class T>
|
||||
friend T* gen();
|
||||
};
|
||||
],[
|
||||
],[
|
||||
ac_cxx_friend_templates=yes
|
||||
AC_MSG_RESULT([$ac_cxx_friend_templates])
|
||||
AC_DEFINE(SIGC_CXX_FRIEND_TEMPLATES)
|
||||
],[
|
||||
ac_cxx_friend_templates=no
|
||||
AC_MSG_RESULT([$ac_cxx_friend_templates])
|
||||
AC_MSG_WARN([Access to dynamic will not be controlled.])
|
||||
])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(if C++ compiler has intrinsic constructors)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
template<class T>
|
||||
struct A
|
||||
{ T t;
|
||||
A(): t() {}
|
||||
};
|
||||
|
||||
A<int> i;
|
||||
],[
|
||||
],[
|
||||
AC_DEFINE(SIGC_CXX_INT_CTOR)
|
||||
ac_cxx_tmpl_intctor=yes
|
||||
],[
|
||||
ac_cxx_tmpl_intctor=no
|
||||
])
|
||||
AC_MSG_RESULT([$ac_cxx_tmpl_intctor])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(if C++ compiler uses template copy ctor)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
template <class T>
|
||||
struct A
|
||||
{
|
||||
A(const A&) {}
|
||||
template <class T1>
|
||||
A(const T1&) {}
|
||||
};
|
||||
],[
|
||||
],[
|
||||
ac_cxx_template_cctor=no
|
||||
],[
|
||||
AC_DEFINE(SIGC_CXX_TEMPLATE_CCTOR)
|
||||
ac_cxx_template_cctor=yes
|
||||
])
|
||||
AC_MSG_RESULT([$ac_cxx_template_cctor])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(if C++ compiler allows void returns)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
|
||||
void g(int *p)
|
||||
{}
|
||||
|
||||
void h(int *p)
|
||||
{return g(p);}
|
||||
|
||||
],[
|
||||
],[
|
||||
ac_cxx_void_return=yes
|
||||
AC_DEFINE(SIGC_CXX_VOID_RETURN)
|
||||
],[
|
||||
ac_cxx_void_return=no
|
||||
])
|
||||
AC_MSG_RESULT([$ac_cxx_void_return])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(if C++ compiler allows specialization of references)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
struct A {};
|
||||
struct B {};
|
||||
|
||||
template <class T>
|
||||
struct P
|
||||
{
|
||||
typedef A* ptr;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct P<T&>
|
||||
{
|
||||
typedef B* ptr;
|
||||
};
|
||||
|
||||
],[
|
||||
A* a;
|
||||
B* b;
|
||||
P<int>::ptr p=a;
|
||||
P<int&>::ptr q=b;
|
||||
],[
|
||||
ac_cxx_specialize_references=yes
|
||||
AC_DEFINE(SIGC_CXX_SPECIALIZE_REFERENCES)
|
||||
],[
|
||||
ac_cxx_specialize_references=no
|
||||
])
|
||||
AC_MSG_RESULT([$ac_cxx_specialize_references])
|
||||
|
||||
|
||||
dnl unused at the moment, disabled
|
||||
dnl mirko, 99/1/15
|
||||
dnl AC_MSG_CHECKING(if C++ compiler supports qualification of return types with templates)
|
||||
dnl AC_TRY_COMPILE(
|
||||
dnl [
|
||||
dnl template<class T>
|
||||
dnl class foo {
|
||||
dnl public:
|
||||
dnl typedef int iterator;
|
||||
dnl iterator begin();
|
||||
dnl };
|
||||
dnl template<class T> foo<T>::iterator foo<T>::begin() { }
|
||||
dnl ],[
|
||||
dnl foo<int> f;
|
||||
dnl f.begin();
|
||||
dnl ],[
|
||||
dnl ac_template_qualification=yes
|
||||
dnl ],[
|
||||
dnl AC_DEFINE(SIGC_CXX_NO_TEMPLATE_QUALIFICATION)
|
||||
dnl ac_template_qualification=no
|
||||
dnl ])
|
||||
dnl AC_MSG_RESULT([$ac_template_qualification])
|
||||
|
||||
dnl unused at the moment, disabled
|
||||
dnl mirko, 99/1/15
|
||||
dnl AC_MSG_CHECKING(if C++ compiler supports static data inside templates)
|
||||
dnl AC_TRY_LINK(
|
||||
dnl [
|
||||
dnl template<class T>
|
||||
dnl class foo { public: static T a; };
|
||||
dnl template<class T>
|
||||
dnl static T foo<T>::a=0;
|
||||
dnl ],[
|
||||
dnl foo<int> b;
|
||||
dnl ],[
|
||||
dnl ac_static_templates=yes
|
||||
dnl ],[
|
||||
dnl AC_DEFINE(SIGC_CXX_NO_STATIC_TEMPLATES)
|
||||
dnl ac_static_templates=no
|
||||
dnl ])
|
||||
dnl AC_MSG_RESULT([$ac_static_templates])
|
||||
|
||||
AC_MSG_CHECKING(if C++ environment provides all required features)
|
||||
if test "x$config_error" = xyes ; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Your compiler is not powerful enough to compile libsigc++. If it should be, see config.log for more information of why it failed.])
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
dnl
|
||||
dnl PTHREADS
|
||||
dnl
|
||||
AC_CHECK_HEADER(pthread.h,,[enable_threads="no"])
|
||||
if test "x$enable_threads" = "xyes" ; then
|
||||
enable_threads="no"
|
||||
AC_CHECK_LIB(pthread,pthread_self,[enable_threads="yes";THREAD_LIB="-lpthread"])
|
||||
AC_CHECK_LIB(cma,pthread_self,[enable_threads="yes";THREAD_LIB="-lcma"])
|
||||
AC_PUSH_LIB($THREAD_LIB)
|
||||
AC_CHECK_FUNC(pthread_keycreate,[AC_DEFINE(SIGC_PTHREAD_DCE)])
|
||||
AC_POP_LIB()
|
||||
AC_SUBST(THREAD_LIB)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(if should compile with pthreads)
|
||||
if test "x$enable_threads" = "xyes" ; then
|
||||
AC_DEFINE(SIGC_PTHREADS)
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_CHECKING([sizes of threading elements])
|
||||
|
||||
# Check for size of threading elements so that we don't expose
|
||||
# the implementation
|
||||
AC_TRY_RUN([
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef SIGC_PTHREAD_DCE
|
||||
typedef pthread_condattr_t CondAttr;
|
||||
typedef pthread_mutexattr_t MutexAttr;
|
||||
typedef pthread_attr_t ThreadAttr;
|
||||
#else
|
||||
typedef pthread_condattr_t* CondAttr;
|
||||
typedef pthread_mutexattr_t* MutexAttr;
|
||||
typedef pthread_attr_t* ThreadAttr;
|
||||
#endif
|
||||
typedef pthread_mutex_t MutexImpl;
|
||||
typedef pthread_cond_t CondImpl;
|
||||
typedef pthread_key_t KeyImpl;
|
||||
typedef pthread_t ThreadImpl;
|
||||
|
||||
int main()
|
||||
{
|
||||
FILE *fptr;
|
||||
fptr=fopen("ac_thread.sh","w");
|
||||
fprintf(fptr,"ac_thread_cond_attr_size=%d\n",sizeof(CondAttr));
|
||||
fprintf(fptr,"ac_thread_cond_impl_size=%d\n",sizeof(CondImpl));
|
||||
fprintf(fptr,"ac_thread_mutex_attr_size=%d\n",sizeof(MutexAttr));
|
||||
fprintf(fptr,"ac_thread_mutex_impl_size=%d\n",sizeof(MutexImpl));
|
||||
fprintf(fptr,"ac_thread_thread_attr_size=%d\n",sizeof(ThreadAttr));
|
||||
fprintf(fptr,"ac_thread_thread_impl_size=%d\n",sizeof(ThreadImpl));
|
||||
fprintf(fptr,"ac_thread_key_impl_size=%d\n",sizeof(KeyImpl));
|
||||
return 0;
|
||||
}
|
||||
],[
|
||||
. ac_thread.sh
|
||||
rm ac_thread.sh
|
||||
AC_MSG_RESULT(found)
|
||||
],[
|
||||
AC_MSG_RESULT(failed)
|
||||
AC_ERROR(
|
||||
[Could not compile a program with threads, please see config.log for details.
|
||||
])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(cross)
|
||||
if test ! -f ac_thread.h; then
|
||||
echo '
|
||||
ac_thread_cond_attr_size=
|
||||
ac_thread_cond_impl_size=
|
||||
ac_thread_mutex_attr_size=
|
||||
ac_thread_mutex_impl_size=
|
||||
ac_thread_thread_attr_size=
|
||||
ac_thread_thread_impl_size=
|
||||
ac_thread_key_impl_size=
|
||||
' > ac_thread.sh
|
||||
AC_MSG_ERROR(
|
||||
[You are attempting a cross compile, but the necessary information regarding
|
||||
your thread library is not available. Please fill out the ac_thread.sh file.
|
||||
])
|
||||
else
|
||||
. ac_thread.sh
|
||||
fi
|
||||
])
|
||||
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_COND_ATTR,$ac_thread_cond_attr_size)
|
||||
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_COND_IMPL,$ac_thread_cond_impl_size)
|
||||
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_MUTEX_ATTR,$ac_thread_mutex_attr_size)
|
||||
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_MUTEX_IMPL,$ac_thread_mutex_impl_size)
|
||||
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_THREAD_ATTR,$ac_thread_thread_attr_size)
|
||||
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_THREAD_IMPL,$ac_thread_thread_impl_size)
|
||||
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_KEY_IMPL,$ac_thread_key_impl_size)
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
|
||||
###
|
||||
### This is the end of the massive if..then..else..fi
|
||||
###
|
||||
fi
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
sigc-config
|
||||
macros/Makefile
|
||||
],[chmod a+x sigc-config])
|
2
sigc++/doc/.cvsignore
Normal file
2
sigc++/doc/.cvsignore
Normal file
@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
141
sigc++/doc/API
Normal file
141
sigc++/doc/API
Normal file
@ -0,0 +1,141 @@
|
||||
|
||||
Object & Handles
|
||||
=================
|
||||
In order for a signal to be connected to object, the object must
|
||||
have Object somewhere in its inheritence tree.
|
||||
|
||||
class virtual Object
|
||||
{
|
||||
public:
|
||||
bool is_dynamic();
|
||||
bool is_floating();
|
||||
Object();
|
||||
virtual ~Object();
|
||||
};
|
||||
|
||||
Objects are
|
||||
- Reference counted
|
||||
- Capable of deleting self if told to be managed.
|
||||
|
||||
|
||||
Handles are used for internal memory management. They are a signature not
|
||||
a real class so they can incapsulate any class that has the necessary
|
||||
functions.
|
||||
|
||||
signature class Handle<ObjType,Policy>
|
||||
{
|
||||
public:
|
||||
operator ObjType*();
|
||||
ObjType operator *();
|
||||
ObjType* operator ->();
|
||||
|
||||
bool connected();
|
||||
|
||||
Handle& operator =(ObjType*);
|
||||
Handle& operator =(ObjType&);
|
||||
Handle& operator =(const Handle<O,P> &);
|
||||
|
||||
Handle(ObjType*);
|
||||
Handle(ObjType&);
|
||||
Handle(const Handle<O,P>&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Slots
|
||||
======
|
||||
Slots are an encapsulation of a callable object. A factory called slot()
|
||||
builds Slots from object/methods, static functions and signals.
|
||||
|
||||
class Slot#<rettype,ARGS>: public Object
|
||||
{
|
||||
public:
|
||||
rettype call(ARGS);
|
||||
Slot#()
|
||||
virtual ~Slot#()
|
||||
};
|
||||
|
||||
Slots build up in a tree to contain a wide number of connection types.
|
||||
|
||||
There is a class of functions call Adaptors. Adaptors take a slot
|
||||
and alter it to a different profile.
|
||||
|
||||
Planned adaptors
|
||||
bind - bind callback data starting from the end.
|
||||
extend - add dummy arguments to the end of a slot.
|
||||
convert - convert the calling arguments with a function.
|
||||
|
||||
Internally slots are just handles to an internal abstract slot
|
||||
type called Slot#_, which is a pimple on SlotData.
|
||||
|
||||
Slots can not be duplicated as they may have a large list of internal
|
||||
data. You should not reuse a slot in multiple lists.
|
||||
|
||||
|
||||
Signals
|
||||
=======
|
||||
A list of slots can be called with a signal. A signal is considered a
|
||||
slot container.
|
||||
|
||||
class Signal#<RETURN,ARGS,Policy>
|
||||
{
|
||||
public:
|
||||
typedef Slot#<RETURN,ARGS> InSlotType;
|
||||
typedef Slot#<MARSH_RETURN,ARGS> OutSlotType;
|
||||
|
||||
OutSlotType slot();
|
||||
Connection connect(InSlotType& s);
|
||||
MARSH_RETURN emit(ARGS);
|
||||
MARSH_RETURN operator()(ARGS); // alias for emit
|
||||
Signal();
|
||||
Signal(InSlotType& );
|
||||
~Signal();
|
||||
};
|
||||
|
||||
Two typedefs are specified InSlotType and OutSlotType. InSlotType
|
||||
is the type taken by this signal for connections. OutSlotType
|
||||
is the type of slot this function returns and is determented by
|
||||
the Marshaller. In most cases InSlotType and OutSlotType match,
|
||||
but this is not necessarily the case. Signals do not need to
|
||||
have these typedefs, but it eases building new Signal classes from
|
||||
them.
|
||||
|
||||
The basic methods shown there are
|
||||
emit - call all slots contained within.
|
||||
slot - give away a slot that receive incoming calls.
|
||||
connect - insert a slot into the call list.
|
||||
|
||||
Slots are removed by calling disconnect on their connections.
|
||||
|
||||
There is also the ablity to have a marshaller that takes care of handling
|
||||
signal callbacks. This functionality is dependent on the implementation
|
||||
of the signal. For the basic signal type, the marshaller is a hidden
|
||||
template parameter.
|
||||
|
||||
Connect() may also take optional implementation dependent arguments
|
||||
for specifying behavior. For example, timeout.connect(slot(&foo),10)
|
||||
where the second argument it a time in seconds is a good use of
|
||||
optional connect flags.
|
||||
|
||||
Additional functionality may optionally be defined such as
|
||||
ablity to check if there are any signals attached (empty()) or
|
||||
remove all connected signals (clear()). However these are
|
||||
not a requirement and are implementation dependent.
|
||||
|
||||
|
||||
Connections
|
||||
=============
|
||||
Connections are given to the user on each connect to allow individual
|
||||
connections to be broken or altered.
|
||||
|
||||
class Connection
|
||||
{
|
||||
public:
|
||||
void disconnect();
|
||||
Connection();
|
||||
};
|
||||
|
||||
They are a handle to the data, so when the last connection goes away and
|
||||
the slot is not yet properly held in a Signal the slot will go away.
|
||||
|
||||
|
4
sigc++/doc/AUTHORS
Normal file
4
sigc++/doc/AUTHORS
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
Karl E. Nelson <kenelson@ece.ucdavis.edu>
|
||||
Tero Pulkkinen <terop@students.cc.tut.fi>
|
||||
|
340
sigc++/doc/COPYING
Normal file
340
sigc++/doc/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
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 2 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, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
481
sigc++/doc/COPYING.LIB
Normal file
481
sigc++/doc/COPYING.LIB
Normal file
@ -0,0 +1,481 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
44
sigc++/doc/FAQ
Normal file
44
sigc++/doc/FAQ
Normal file
@ -0,0 +1,44 @@
|
||||
This is a list of questions and answers that I have collected from
|
||||
messages to my mailbox
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Q: Why isn't sigc++config.h installed with the rest of the headers?
|
||||
|
||||
A: Traditionally include files that are dependent on the compiler
|
||||
or srchitecture belong under lib trees and not the include tree.
|
||||
This allows machines to share include directories on large multiuser
|
||||
systems.
|
||||
|
||||
Examples:
|
||||
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.57/include
|
||||
/usr/lib/glib/include
|
||||
/usr/lib/qt/include
|
||||
|
||||
To access that file you should include a -I PREFIX/lib/sigc++/include
|
||||
in your compiler switchs.
|
||||
|
||||
This can be done for you automatically through the use of
|
||||
the sigc-config script.
|
||||
|
||||
c++ myfile.cc `sigc-config --cflags --libs`
|
||||
|
||||
Last, if you really don't like this just symlink the file into
|
||||
PREFIX/include. (Don't copy or the next version of libsigc++
|
||||
very likely won't work right!)
|
||||
|
||||
Q: Why on Visual C++ can do I get piles of errors when trying to
|
||||
use classes which contain Signals?
|
||||
|
||||
A: Visual C++ requires all classes which are parameterized to be
|
||||
explicitely exported. This is the same problem encountered
|
||||
when using STL classes in VC++. Microsoft Knowledge Base
|
||||
article Q168958 contains the solution.
|
||||
|
||||
(http://support.microsoft.com/support/kb/articles/Q168/9/58.ASP)
|
||||
|
||||
You will need to create an export file with all the signals,
|
||||
slots, and parameterized functions explicitely instantiated
|
||||
and include it in your library source. (Anyone have an example
|
||||
of this?)
|
||||
|
25
sigc++/doc/FEATURES
Normal file
25
sigc++/doc/FEATURES
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Libsigc++ - A Signal Framework for C++
|
||||
|
||||
Provides following features:
|
||||
* compile time typesafe callbacks (faster than run time checks)
|
||||
* typesafty violations line number reports correctly with
|
||||
template names (no tracing template failures into headers)
|
||||
* no compiler extensions or meta compilers required
|
||||
* proper handling of dynamic objects and signals
|
||||
(deleted objects will not cause seg faults)
|
||||
|
||||
* extendable API at any level
|
||||
Slot, Connection, Object, and Signal
|
||||
* extensions do not require alteration of basic components
|
||||
to allow use of extensions
|
||||
* User definable marshallers
|
||||
|
||||
* provides headers for up to 7 arguments and 2 callback data
|
||||
* M4 Macros for building templates with various numbers
|
||||
of arguements and callback data
|
||||
* Easily build support for templates with number of arguments
|
||||
and callback data not defined in library headers
|
||||
|
||||
|
||||
|
8
sigc++/doc/TODO
Normal file
8
sigc++/doc/TODO
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
Add back functionality for slot(Obj&,func) and slot(Obj*,func).
|
||||
Get advanced signal code going. (with recursion checks and rest)
|
||||
Get mapped signal code going. (anonymous union mapping to a class)
|
||||
Add a cache to the Scope code so that it can be used for a
|
||||
weak reference.
|
||||
|
||||
|
119
sigc++/doc/UML
Normal file
119
sigc++/doc/UML
Normal file
@ -0,0 +1,119 @@
|
||||
Here is a reference to the UML class diagram symbols:
|
||||
(Taken from a number of sources.)
|
||||
|
||||
Class
|
||||
-----
|
||||
A Class description containing a
|
||||
____________
|
||||
| Class Name |
|
||||
|------------|
|
||||
| Attributes |
|
||||
|------------|
|
||||
| Operations |
|
||||
|____________|
|
||||
|
||||
Association
|
||||
-----------
|
||||
An association represents a physical or conceptual connection
|
||||
betwen objects. This is represented by a line between the two objects.
|
||||
If the association has a name it would often be written on top.
|
||||
|
||||
AssocName
|
||||
Class1 ----------- Class2
|
||||
|
||||
There is a possiblity of a multidirectional association that would be
|
||||
represented by a diamond connecting the related sets.
|
||||
|
||||
|
||||
Class1 -----<O>---- Class3
|
||||
|
|
||||
Class2
|
||||
|
||||
Arrows can be used to indicate the navigablity of a association.
|
||||
So an arrow from one class to another would indicate that Class1
|
||||
uses the services of Class2 but Class2 is not aware of Class1.
|
||||
It also indicates that nature of Class2 scope. Since there
|
||||
is no aggregation relationship here, Class2 may outlive Class1
|
||||
instances. This would be used to indicate a pointer or reference
|
||||
relationship.
|
||||
|
||||
Class1 -------> Class2
|
||||
|
||||
In some places it is necessary to represent that a Class can
|
||||
be associated with a set instead of a single instance. This
|
||||
will be represented by a star at the end of the association.
|
||||
|
||||
Class1 ------->* Class2
|
||||
|
||||
Composition (Strong Aggregation)
|
||||
---------
|
||||
This means that Class2 is a part of Class1. It is a strong form
|
||||
of aggregation in that when Class1 is destroyed Class2 goes with it.
|
||||
|
||||
The symbol for a composition relationship is a diamond filled to an arrow.
|
||||
|
||||
Class1 <*>-----> Class2
|
||||
|
||||
Aggregation
|
||||
-----------
|
||||
A weaker form of aggregation than composition is represented with
|
||||
an unfilled diamond. It still demotes the life time of Class2 is
|
||||
restricted to Class1, but Class2 is not part of Class1. This may
|
||||
be implemented by a pointer in Class1 to Class2 with the dtor
|
||||
destroying Class2.
|
||||
|
||||
Class1 <>------> Class2
|
||||
|
||||
|
||||
Inheritance
|
||||
-----------
|
||||
|
||||
Inheratance is indicated with an triangle pointing up to the
|
||||
class form which the other derives. (Having no triangles a
|
||||
A will do.)
|
||||
|
||||
Class1
|
||||
A
|
||||
|
|
||||
Class2
|
||||
|
||||
|
||||
So now a quick example:
|
||||
|
||||
+--> Shape
|
||||
| A
|
||||
parent_ | |
|
||||
| | points_
|
||||
+--- Polygon <>------------->* Point
|
||||
|
||||
This would indicate that a Polygon is derived from a Shape. It also
|
||||
indicates that Polygon can have a reference to a Shape. Further,
|
||||
Polygon contains a set of Points that it is responsible for.
|
||||
|
||||
This might be implemented like
|
||||
|
||||
class Shape
|
||||
{//...
|
||||
};
|
||||
|
||||
class Polygon: public Shape
|
||||
{
|
||||
private:
|
||||
Shape* parent_;
|
||||
list<auto_ptr<Point>> points_;
|
||||
public:
|
||||
//...
|
||||
};
|
||||
|
||||
|
||||
References:
|
||||
UML Class Diagrams
|
||||
Robert C. Martin
|
||||
Engineering Notebook Column
|
||||
C++ Report, August, 1997
|
||||
http://www.oma.com/PDF/umlClassDiagrams.pdf
|
||||
|
||||
OML Object Model
|
||||
http://wwwis.cs.utwente.nl:8080/dmrg/MEE/misop007/
|
||||
|
||||
|
25
sigc++/doc/conventions
Normal file
25
sigc++/doc/conventions
Normal file
@ -0,0 +1,25 @@
|
||||
Okay here are the conventions for this project.
|
||||
|
||||
macros - all caps (MY_MACRO)
|
||||
enum - same as macros
|
||||
|
||||
classes - cap each word lower others (Signal)
|
||||
private classes - same as class with underscore or trailing _ (BasicSignal_Impl)
|
||||
|
||||
function - lowercase with underscore (foo_bar())
|
||||
methods - lowercase with underscore (m.foo_bar())
|
||||
data - lowercase (m.mydata)
|
||||
private data - lowercase with trailing underscore (m.mydata_)
|
||||
|
||||
|
||||
Namespaces are used where possible.
|
||||
If namespaces are not available use a class to fake it unless
|
||||
that is not allowed.
|
||||
|
||||
Format is GNU or modified GNU (indent first bracket)
|
||||
|
||||
class MyClass
|
||||
{
|
||||
MyClass();
|
||||
}
|
||||
|
80
sigc++/doc/diagrams
Normal file
80
sigc++/doc/diagrams
Normal file
@ -0,0 +1,80 @@
|
||||
|
||||
Here are some UML diagrams of the relationships in Libsigc++:
|
||||
|
||||
Scopes, Handles, Objects:
|
||||
------------------------
|
||||
|
||||
_________ scope_ _____________
|
||||
| Scope |*<-------<> | Object_Impl |
|
||||
| | obj_ | |
|
||||
|_________|----------> | |
|
||||
A (obj) | |
|
||||
| +----> | |
|
||||
| | |_____________|
|
||||
| | A
|
||||
__________ | |
|
||||
________ scope_ | Limit |<>--+ *
|
||||
|Handle |<*>------>| | _____________
|
||||
| <Limit>| |__________| | Object |
|
||||
| | | |
|
||||
| | (obj) | |
|
||||
| | (<>----------------------->) | |
|
||||
|________| |_____________|
|
||||
|
||||
|
||||
Okay here is what you are supposed to get out of this.
|
||||
Object comes from Object_Impl with multiplicity (VI).
|
||||
Handle<Limit> in this case forms a virtual aggregate relationship
|
||||
with the Object it points to.
|
||||
|
||||
For future diagrams I would reduce this to
|
||||
|
||||
Handle<Limit> <>--------> Object
|
||||
|
||||
Other handle relationships are formed with different types of
|
||||
scopes. Reference Count for example would have the same
|
||||
diagram (but very different behavior.)
|
||||
|
||||
There is also a relation when the pointed to
|
||||
object deletes itself when the object is removed. This is
|
||||
a dependency that will be written as
|
||||
|
||||
A -----><> B
|
||||
|
||||
|
||||
BasicSignal:
|
||||
-----------
|
||||
|
||||
____________________ incoming_
|
||||
| BasicSignal_::InOut| <>----------->* Slot
|
||||
| |
|
||||
| | outgoing_
|
||||
|____________________| <>----------->* Slot
|
||||
A
|
||||
|
|
||||
|
|
||||
---------------------
|
||||
| BasicSignal# |
|
||||
| |
|
||||
|_____________________|
|
||||
|
||||
It is clear from here that a BasicSignal is formed from a number of different
|
||||
objects.
|
||||
|
||||
|
||||
Connections between a BasicSignal and a Object method:
|
||||
|
||||
---------- ________
|
||||
| SlotData | | Object |
|
||||
|__________| |________|
|
||||
A A
|
||||
| |
|
||||
| |
|
||||
___________ _____________ |
|
||||
|BasicSignal| outgoing_ | ObjectSlot# | ----------
|
||||
|___________|<>-------->*| | | MyObject |
|
||||
| |-------><>| |
|
||||
___________ | | |__________|
|
||||
|Connection |----------> |_____________|
|
||||
|___________|
|
||||
|
95
sigc++/doc/marshal
Normal file
95
sigc++/doc/marshal
Normal file
@ -0,0 +1,95 @@
|
||||
|
||||
1.0 Marshallers
|
||||
===============
|
||||
|
||||
Marshallers offer the opportunity to control the emittion process, and
|
||||
collate return values. By default signals have a marshaller which does
|
||||
nothing, and throws away all but the last return value.
|
||||
|
||||
A marshaller can be any class with:
|
||||
struct SomeMarshal
|
||||
{
|
||||
// both typedefs must be defined.
|
||||
typedef Type1 InType;
|
||||
typedef Type2 OutType;
|
||||
|
||||
// Return final return code.
|
||||
OutType value();
|
||||
|
||||
// Return value if marshaller does not get built
|
||||
static OutType default_value();
|
||||
|
||||
// Captures return codes and returns TRUE to stop emittion.
|
||||
bool marshal(const InType&);
|
||||
|
||||
SomeMarshal();
|
||||
};
|
||||
|
||||
The function marshal() will be called with the return value of each slot
|
||||
connected to the signal as they are called. The emittion process can be
|
||||
stopped by marshal() returning true.
|
||||
|
||||
Once all the slots have been called, value() is called to determine what
|
||||
to return to the emitter. If the signal gets called and there is
|
||||
nothing attached the default_value() is used.
|
||||
|
||||
2.0 Possible uses
|
||||
=================
|
||||
A marshaller could stop emittion when the signal had been handled:
|
||||
struct StopOnTrue
|
||||
{
|
||||
typedef bool InType;
|
||||
typedef bool OutType;
|
||||
OutType return_value_;
|
||||
|
||||
OutType value() { return return_value_; }
|
||||
static OutType default_value() { return false; }
|
||||
bool marshal(const InType& val) { return_value_ = val; return val; }
|
||||
|
||||
StopOnTrue() : return_value_(false) {}
|
||||
};
|
||||
|
||||
marshal() here returns true as soon as one of the things connected to the
|
||||
signal returns true. It also keeps track of whether anything stopped the
|
||||
emittion in the return_value_ member. This way when something emits the
|
||||
signal, it can tell whether the signal was dealt with (signal.emit()
|
||||
returns true) or not (signal.emit() returns false).
|
||||
|
||||
Now, if OutType was a list or a vector, marshal() could push_back() all
|
||||
the values, returning to the emitter all the return values rather than just
|
||||
one.
|
||||
|
||||
3.0 Standard Marshallers
|
||||
========================
|
||||
|
||||
The following marshallers are provided by default.
|
||||
|
||||
Marshal<void>
|
||||
Marshal<T>
|
||||
Marshal<R> (untested, may not be portable)
|
||||
FixedMarshal<T,V>
|
||||
FastMarshal<T>
|
||||
|
||||
where
|
||||
- T can be a type, class, or pointer
|
||||
- R can be a reference
|
||||
- V is the initial value of the marshaller
|
||||
which is returned if nothing is connected.
|
||||
|
||||
All of the standard defined marshallers, with the exception of
|
||||
FastMarshal, check for a possiblity of a skipped return code via
|
||||
RetCode::check_ignore(). You can cause a return code to be
|
||||
ignored by the marshaller by setting RetCode::ignore() prior to returning
|
||||
to a function. Please note that you must be sure that you are returning to
|
||||
signal call to use ignore(). Calling at other times may result in other
|
||||
functions incorrectly skipping.
|
||||
|
||||
The check_ignore function is thread safe which may induce
|
||||
unnecessary delays in slot calling. To avoid this overhead
|
||||
either define the signal to have a void return or
|
||||
use a FastMarshal.
|
||||
|
||||
(This will all be replaced by an exeption mechanism at some point;
|
||||
however, current compiler technology is too slow for this to
|
||||
work.)
|
||||
|
96
sigc++/doc/powerusers
Normal file
96
sigc++/doc/powerusers
Normal file
@ -0,0 +1,96 @@
|
||||
The following things are be available to powerusers.
|
||||
|
||||
- changing the return type of a slot
|
||||
- changing the paramete types of slot
|
||||
- signal overloading
|
||||
- mixed type signals
|
||||
|
||||
=======================================================================
|
||||
* Slot type changing
|
||||
|
||||
Slots can be made to change their input types based on a static function.
|
||||
|
||||
Example:
|
||||
|
||||
// write some conversion functions
|
||||
int convert_mysignal_c(Callback1<int,const char*> *s,const string &str)
|
||||
{return s->call(str.c_str());}
|
||||
Slot1<int,const string&> myconvert(const Slot1<int,const char*> &s)
|
||||
{return convert(s,convert_mysignal_c);}
|
||||
|
||||
|
||||
Signal1<int,const string&> mysignal;
|
||||
int foo(const char*);
|
||||
mysignal.connect(myconvert(slot(foo));
|
||||
|
||||
|
||||
* Signal overloading
|
||||
|
||||
One signal can have multiple behavior for a single signal name.
|
||||
This is done with multiple inheritance.
|
||||
|
||||
Example:
|
||||
|
||||
class MyClass
|
||||
{
|
||||
public:
|
||||
class MySig
|
||||
:public Signal1<int,int>,
|
||||
public Signal1<void,double>
|
||||
{} mysig;
|
||||
} myclass;
|
||||
|
||||
int foo(int);
|
||||
void foo2(double);
|
||||
myclass.mysig.connect(slot(foo));
|
||||
myclass.mysig.connect(slot(foo2));
|
||||
myclass.mysig(1); // calls foo
|
||||
myclass.mysig(1.0); // calls foo2
|
||||
|
||||
|
||||
|
||||
* Mixed type signals
|
||||
|
||||
A signal can be made to accept a wide group of slots with similar data
|
||||
types.
|
||||
|
||||
Example:
|
||||
|
||||
class A
|
||||
{
|
||||
|
||||
public:
|
||||
class MySig: public Signal1<int,string&>
|
||||
{
|
||||
static int _mysig_convert(Callback1<int,const char*> *s,
|
||||
const string &str)
|
||||
{return s->call(str.c_str());}
|
||||
public:
|
||||
Connection connect(const Slot1<int,const char*> &s)
|
||||
{return connect(convert(s,_mysig_convert));}
|
||||
} mysig;
|
||||
};
|
||||
|
||||
int foo(const char* c);
|
||||
int foo2(string& s);
|
||||
|
||||
mysig.connect(slot(foo)); // this is acceptable
|
||||
mysig.connect(slot(foo2)); // this is also acceptable
|
||||
string h="hello";
|
||||
mysig(h); // calls both foo and foo2.
|
||||
|
||||
|
||||
Still in works
|
||||
----------------
|
||||
* Signal overloading over classes
|
||||
|
||||
This should be extendable accross different levels of a class.
|
||||
|
||||
Example: (details still in progress)
|
||||
|
||||
|
||||
|
||||
* Signals with translation
|
||||
|
||||
Signals can be made to convert and proxy accross other systems.
|
||||
|
145
sigc++/doc/requirements
Normal file
145
sigc++/doc/requirements
Normal file
@ -0,0 +1,145 @@
|
||||
|
||||
The following things are required for Libsigc++.
|
||||
|
||||
A good compiler with the following features
|
||||
- capable of handling numerous templates (>200)
|
||||
- proper template specialization
|
||||
- proper partial specialization
|
||||
|
||||
It works better with (but does not require)
|
||||
- template friend specialization
|
||||
- namespaces
|
||||
- void returns
|
||||
|
||||
M4 to parse the header files if you wish to rebuild the headers from
|
||||
macro source.
|
||||
|
||||
==================================================
|
||||
|
||||
Platform Issues:
|
||||
|
||||
A number of platforms do not support global C++ objects
|
||||
in shared libraries. Although not required by this
|
||||
library, it may result in problems when building C++
|
||||
libraries on those platforms. The work arround is
|
||||
to use statics in functions or pointers which must
|
||||
be initialized.
|
||||
|
||||
Platforms known to have this bug include
|
||||
NetBSD, HP-UX 9, HP-UX 10, Solaris without patch.
|
||||
|
||||
==================================================
|
||||
|
||||
Compiler Issues:
|
||||
|
||||
Cfront-based compilers: Fails
|
||||
-----
|
||||
Forget it, get a modern c++ compiler.
|
||||
|
||||
|
||||
GNU G++ 2.7.2: Fails
|
||||
-----
|
||||
Upgrade, new versions of GNU G++ are easily and freely available:
|
||||
GNU G++ 2.8.X or EGCS 1.1.2. A port to this compiler is possible
|
||||
with effort.
|
||||
|
||||
|
||||
GNU G++ 2.8: Works (Marginal)
|
||||
namespaces: no
|
||||
partial specialization: yes
|
||||
void returns: yes
|
||||
-----
|
||||
Is known to work correctly, but some performance may be subpar.
|
||||
Recommend upgrading to egcs 1.1.
|
||||
|
||||
|
||||
GNU egcs 1.0: Works (Marginal)
|
||||
namespaces: no
|
||||
partial specialization: yes
|
||||
void returns: yes
|
||||
-----
|
||||
Is known to work correctly, but some performance may be subpar.
|
||||
Recommend upgrading to egcs 1.1.
|
||||
|
||||
|
||||
GNU egcs 1.1: Works
|
||||
namespaces: yes
|
||||
partial specialization: yes
|
||||
void returns: yes
|
||||
-----
|
||||
This is the development platform, so all functionality correct.
|
||||
|
||||
HP C++: Fails
|
||||
-----
|
||||
This is a cfront compiler. No where close.
|
||||
Get a modern c++ compiler.
|
||||
|
||||
|
||||
HP aC++ A.01.22: Works
|
||||
namespaces: yes
|
||||
partial specialization: yes
|
||||
void returns: yes (only most recent version)
|
||||
-----
|
||||
HP improved template support thus allowing compilation.
|
||||
Earlier compilers lacked support for void returns and proper
|
||||
templates.
|
||||
|
||||
Missing <iostream> - use one below
|
||||
|
||||
|
||||
MipsPro 7.3 Compler on Irix: Works (Marginal)
|
||||
namespaces: yes
|
||||
partial specialization: yes
|
||||
void returns: no
|
||||
-----
|
||||
This compiler is barely within the range of usable compilers.
|
||||
Requires compiling a specialization for all types in library
|
||||
due to non-standard return behavior. Should be usable.
|
||||
|
||||
Requires a switch to get templates right.
|
||||
Use
|
||||
CC=cc CXX=CC CPPFLAGS="-ptused" ./configure
|
||||
|
||||
Missing <iostream> - use one below
|
||||
|
||||
|
||||
SunPro C++ 4.1: Unknown
|
||||
namespaces: no
|
||||
partial specialization: no
|
||||
-----
|
||||
Unlikely considering lack of partial specialization.
|
||||
Need more info.
|
||||
|
||||
|
||||
SunPro C++ 5.0: Unknown
|
||||
namespaces: yes
|
||||
partial specialization: yes
|
||||
-----
|
||||
Need more info.
|
||||
|
||||
|
||||
Visual C++ 5.0: Works (needs special distribution)
|
||||
namespaces: yes
|
||||
partial specialization: no
|
||||
void returns: no
|
||||
-----
|
||||
Although not quite up to par, a port was completed and should
|
||||
be the basis for porting back to other earlier compilers.
|
||||
VC++ lacks the ablity to use optional class arguments so
|
||||
marshallers must be explicitly declared. (see doc/win32)
|
||||
|
||||
==================================================
|
||||
|
||||
Some compilers have not yet fully adopted the standard header
|
||||
files. (Usually because they lack some compiler feature
|
||||
required for the standard header.) For those compilers a
|
||||
kludge is necessary to make the same code compile on both
|
||||
standard and non-standard headers. Add the following file
|
||||
to the standard include path.
|
||||
|
||||
#ifndef IOSTREAM_KLUDGE
|
||||
#define IOSTREAM_KLUDGE
|
||||
#include <iostream.h>
|
||||
namespace std { void iostream_kludge(); };
|
||||
#endif
|
||||
|
315
sigc++/doc/signals
Normal file
315
sigc++/doc/signals
Normal file
@ -0,0 +1,315 @@
|
||||
|
||||
1.0 Signals
|
||||
==============
|
||||
|
||||
Signals are used for communication between objects. Rather
|
||||
that using messy pointers or pointers to member functions to implement
|
||||
callbacks this library provides an elegant connection framework for
|
||||
connecting between static functions, member functions and function objects.
|
||||
To add to this all types of connections can be made with compile time
|
||||
type checking through an extensable template set. Unlike other solutions
|
||||
that break the C++ language and add incompatible extensions or code
|
||||
generation, Libsigc++ uses only the standard C++ definitions. Thus it
|
||||
will not decrease the ability of tools designed to parse the C++ language
|
||||
to handle your code. Libsigc++ provides signal framework which solves
|
||||
your problems with communication between objects. This signal framework
|
||||
makes your objects reusable components which are independent of other
|
||||
objects it communicates with. This means reducing coupling between
|
||||
objects and resulting less dependencies and thus more reusable code.
|
||||
|
||||
1.1 How does the communication work?
|
||||
------------------------------------
|
||||
|
||||
In the callback mechanism there's 3 separate entities involved.
|
||||
|
||||
sender
|
||||
receiver
|
||||
someone making connection between sender and receiver
|
||||
|
||||
In actual code, the sender specifies an interface which it can call when
|
||||
it wants to tell other objects something. This interface is specified as
|
||||
a function object and is called "Signal". Calling that interface is
|
||||
called "emitting a signal".
|
||||
|
||||
The receiver of the signal can be almost anything. In Libsigc++ the
|
||||
following objects can receive messages:
|
||||
|
||||
member function of any object derived from SigC::Object
|
||||
function object derived from SigC::Object
|
||||
static, global or friend function
|
||||
static function object
|
||||
member function to a static object
|
||||
|
||||
All connections share a common syntax through a factory that creates a
|
||||
abstract function object called a "Slot."
|
||||
|
||||
|
||||
signal.connect(slot(object,Object::&method));
|
||||
signal.connect(slot(&function));
|
||||
signal.connect(functionobject.slot())
|
||||
|
||||
Making a connection connects sender to the receiver. After that, if the
|
||||
sender emits a signal, all methods, functions and function objects that
|
||||
have been connected to that signal are called with the arguments given at
|
||||
signal emission. Signature of both sender interface and receiver method
|
||||
must match exactly to be able to make connection between them. If there's
|
||||
type mismatches in the signatures, C++ compiler will give compile time
|
||||
type error.
|
||||
|
||||
|
||||
|
||||
2.0 Implementation of signals
|
||||
=============================
|
||||
|
||||
Signals are C++ function objects. Because signals are normal C++-objects,
|
||||
you can use them in file scope, in function local scope - but they're
|
||||
most used inside class scope. A signal definition is of form:
|
||||
|
||||
Signal2<void, int, float> buttonPressed;
|
||||
|
||||
where
|
||||
2 = number of arguments
|
||||
void = type of the return
|
||||
int = type of the first parameter of the signal
|
||||
float = type of the 2nd parameter of the signal
|
||||
|
||||
This way application programmers can specify interface for a signal.
|
||||
A connection from a signal to a (member) function matching signal's
|
||||
interface can be made:
|
||||
|
||||
void my_function(int param1, float param2);
|
||||
buttonPressed.connect(slot(&my_function));
|
||||
|
||||
If the function is a member function, you'll need to specify the object
|
||||
too. Note that this object's class needs to be derived from Signal:
|
||||
|
||||
MyClass myobject;
|
||||
buttonPressed.connect(slot(myobject,&MyClass::my_function));
|
||||
|
||||
If the signal is inside an object, you'll need to specify it too:
|
||||
|
||||
obj.buttonPressed.connect(slot(myobject, &MyClass::my_function));
|
||||
|
||||
|
||||
When connection between a signal and a function has been made, calling
|
||||
the signal will make the system call all the connected functions with
|
||||
given parameters. Of course many connections can be made to same signal
|
||||
and the system will call all of them when the signal is called.
|
||||
|
||||
Calling a signal looks exactly like calling normal C++ function:
|
||||
|
||||
buttonPressed(10, 20.0);
|
||||
|
||||
or in case where you have the signal inside an object, call is in format:
|
||||
|
||||
obj.buttonPressed(10, 20.0);
|
||||
|
||||
An alternative method with a function name is also provided with
|
||||
a method emit. This is to make it easier to distiguish and provides
|
||||
a method name for STL connection calls.
|
||||
|
||||
obj.buttonPressed.emit(10, 20.0);
|
||||
|
||||
|
||||
|
||||
2.1 Signals with return types
|
||||
------------------------------
|
||||
|
||||
All signals have a return type which may be void.
|
||||
|
||||
Signal1<int,int> signal;
|
||||
|
||||
That signal can be connected to the methods with the following signature:
|
||||
|
||||
int my_callback(int);
|
||||
|
||||
There are a few restrictions on the types of returns. Return
|
||||
types must have:
|
||||
|
||||
a default constructor T t;
|
||||
a copy constructor T t1,t2; t1=t2;
|
||||
a reference form T t1; void func(T& t); func(t1);
|
||||
|
||||
A default ctor is required so that a temporary object can be
|
||||
created to hold the return type. A copy constructor is required
|
||||
so that the signal can be marshalled. A reference form is required
|
||||
to pass the return types to the marshaller functions.
|
||||
|
||||
This means that the return type must not be a reference itself.
|
||||
|
||||
|
||||
|
||||
2.2 Connecting to a signals
|
||||
-----------------------------
|
||||
|
||||
Because Libsigc++ signals use function objects heavily, there needs to be
|
||||
way to connect a signal to another signal. Lets connect a button's
|
||||
clicked()-signal to another button's clicked signal:
|
||||
|
||||
struct My_Button
|
||||
{
|
||||
Signal0<void> clicked;
|
||||
} b1,b2;
|
||||
|
||||
b1.clicked.connect(b2.clicked.slot());
|
||||
|
||||
|
||||
2.3 Summery
|
||||
------------
|
||||
|
||||
Here is the summery of the properties of a signal
|
||||
|
||||
class Signal<Rettype,Args>
|
||||
{
|
||||
public:
|
||||
Connection connect(const Slot<Rettype Args>&);
|
||||
Slot<Rettype,Args> slot();
|
||||
Rettype emit(Args);
|
||||
Rettype operator()(Args);
|
||||
};
|
||||
|
||||
Where:
|
||||
Rettype is the return type of the signal.
|
||||
Args are the arguments taken.
|
||||
|
||||
connect() inserts a slot with the same profile into the signal.
|
||||
slot() returns a slot for connecting this signal to another.
|
||||
emit() calls all slots in the signal.
|
||||
|
||||
|
||||
3.0 Common errors in use of the signals
|
||||
=======================================
|
||||
|
||||
Here are some common errors and an example of some of the errors that
|
||||
they generate. (Do not take this as an example of proper use!
|
||||
Errors similified for clarity. Your compiler messages will differ)
|
||||
|
||||
* Signature of function does not match signal
|
||||
Return type?
|
||||
arguments have correct type?
|
||||
the signal has correct types?
|
||||
|
||||
Example error session:
|
||||
void foo(int i);
|
||||
Signal1<int,int> sig;
|
||||
sig.connect(slot(foo));
|
||||
|
||||
>>foobar.cc: In function `int main()':
|
||||
>>foobar.cc:17: no matching function for call to
|
||||
`Signal1<int,int>::connect (Slot1<void,int> *)'
|
||||
^^^^^^^^^^^^^^^^
|
||||
Signiture of function
|
||||
>>signal.h: candidates are:
|
||||
Signal1<int,int>::connect<int, int> (Slot1<int,int> *)
|
||||
^^^^^^^^^^^^^^
|
||||
Signiture of Signal
|
||||
|
||||
* Using a reference as a return type
|
||||
|
||||
Example error session:
|
||||
Signal1<int&,int> sig;
|
||||
|
||||
>>basic_signal.h: In method `int & Signal1_<int &,int>::Impl::
|
||||
emit<int &, int>(int)':
|
||||
>>signal.h:100: instantiated from here
|
||||
>>basic_signal.h:244: `rc' declared as reference but not initialized
|
||||
|
||||
|
||||
|
||||
* Connecting object is not derived from SigC::Object
|
||||
|
||||
Example error session:
|
||||
struct A {int foo(int);} a;
|
||||
Signal1<int,int> sig;
|
||||
|
||||
sig.connect(slot(a,&A::foo));
|
||||
|
||||
foobar.cc:58: conversion from `A' to non-scalar type `Object' requested
|
||||
|
||||
|
||||
* Forgot to name the connected function as a method.
|
||||
|
||||
Example error session:
|
||||
struct A:public SigC::Object {int foo(int);} a;
|
||||
Signal1<int,int> sig;
|
||||
|
||||
sig.connect(slot(a,foo)); // should be sig.connect(slot(a,&A::foo));
|
||||
|
||||
>>foobar.cc:47: no matching function for call to `slot (A &, int ()(int))'
|
||||
|
||||
|
||||
* Forgot to use address of method on connection
|
||||
|
||||
Example error session:
|
||||
struct A:public SigC::Object {int foo(int);} a;
|
||||
Signal1<int,int> sig;
|
||||
|
||||
sig.connect(slot(a,A::foo)); // should be sig.connect(slot(a,&A::foo));
|
||||
|
||||
>> foobar.cc:23: warning: assuming & on `A::foo1(int)'
|
||||
|
||||
|
||||
* Passed a pointer as object (**This is different from Gtk--**)
|
||||
|
||||
Example error session:
|
||||
struct A:public SigC::Object {int foo(int);} a;
|
||||
Signal1<int,int> sig;
|
||||
|
||||
sig.connect(slot(&a,&A::foo)); // should be sig.connect(slot(a,&A::foo));
|
||||
|
||||
>>foobar.cc:93: conversion from `A *' to non-scalar type `Object'
|
||||
requested
|
||||
>>object_slot.h:177: in passing argument 1 of
|
||||
`slot<A, int, int>(Object &, int (A::*)(int))'
|
||||
|
||||
|
||||
4.0 Connections
|
||||
===============
|
||||
|
||||
4.1 Disconnecting signals
|
||||
-------------------------
|
||||
|
||||
Every signal.connect()-function returns a Connection object,
|
||||
which can be stored and it can be used to disconnect the connection
|
||||
by calling function disconnect().
|
||||
|
||||
Connection c;
|
||||
c=o.buttonPressed.connect(slot(&myfunction));
|
||||
...
|
||||
c.disconnect();
|
||||
|
||||
Its perfectly legal to just ignore the return value of connect() functions -
|
||||
all bookeeping information used by signal system is released properly.
|
||||
|
||||
|
||||
5.0 Adaptors
|
||||
============
|
||||
|
||||
Often it is desirable to connect to a function and a signal
|
||||
in which the signal and function signatures are not
|
||||
exactly the same.
|
||||
|
||||
For example, it would be good to ignore the return type
|
||||
of a function when placing it into a signal with a void return
|
||||
type.
|
||||
|
||||
Fortunately, Libsigc++ provides a mechanism to accomplish this
|
||||
type of connection. There is a broad class of slot "Adaptors".
|
||||
These functions take a slot of one type and produce a slot of
|
||||
another. Here are some sample adaptors provided:
|
||||
|
||||
bind(Slot, v1) - Passes v1 as last argument to Slot
|
||||
(The number of arguments is reduced for the resulting slot)
|
||||
bind(Slot, v1, v2) - Passes v1 and v2 as last arguments to Slot
|
||||
|
||||
Examples:
|
||||
|
||||
int func(float);
|
||||
Signal1<void,float> sig1;
|
||||
Signal1<int> sig2;
|
||||
|
||||
// cover up float argument
|
||||
sig2.connect(bind(slot(&func),20.0f));
|
||||
|
||||
|
||||
|
46
sigc++/doc/win32
Normal file
46
sigc++/doc/win32
Normal file
@ -0,0 +1,46 @@
|
||||
Libsigc++ compiles and runs under win32 (windows 95 and NT)
|
||||
with the cygwin package available from Cygnus Solutions.
|
||||
(http://sourceware.cygnus.com), Borland Builder 6 or Visual C++ 5.
|
||||
|
||||
Notes for egcs:
|
||||
- A simlink is required from /bin/sh to $(CGYWIN_HOME)/bin/sh
|
||||
for configure to run.
|
||||
- A bug in libtool results in compiling the dll stubs with the
|
||||
wrong compiler which results in a minor error. To fix
|
||||
this, a repaired version of ltdll.c is distributed.
|
||||
- The dll fails to compile with libtool >1.2d as a result of
|
||||
a bug in libtool. A bug report of this is outstanding.
|
||||
(use static libraries til fixed)
|
||||
|
||||
|
||||
Notes for Microsoft Visual C++:
|
||||
|
||||
Microsoft Visual C++ does not provide partial specialization of
|
||||
classes at this time which is a requirement for the regular
|
||||
version of the library. Also it requires the format of the
|
||||
package to be different then that of the standard GNU package.
|
||||
A special distribution is therefore required.
|
||||
|
||||
Two project files for building the library and its tests
|
||||
are located under the win32 directory. libsigc.dsp builds the
|
||||
shared dll for the library. wintest.dsp builds a simple
|
||||
test that runs through all the libraries features.
|
||||
|
||||
Unlike other platforms, VC++ does not support default
|
||||
template arguments properly. Thus the marshaller for
|
||||
signals (normally hidden) must be explicitly specified.
|
||||
The files distributed with .cc extension require modification.
|
||||
|
||||
(To compile from CVS which uses native Unix .cc extensions
|
||||
you can use the instructions found on
|
||||
http://depc14.gsi.de/hades/msdev-cc-ending.htm)
|
||||
|
||||
Exporting another library using libsigc++ can be
|
||||
fun because VC++ requires every symbol to appear
|
||||
in the DLL that it uses. This is a well known problem and
|
||||
is documented in the Microsoft Knowledge Base. The
|
||||
instructions for exporting libsigc++ are basically the
|
||||
same as those of STL class in Article #Q168958.
|
||||
|
||||
(http://support.microsoft.com/support/kb/articles/Q168/9/58.ASP)
|
||||
|
113
sigc++/handle.h
Normal file
113
sigc++/handle.h
Normal file
@ -0,0 +1,113 @@
|
||||
#ifndef SIGCXX_HANDLE_H
|
||||
#define SIGCXX_HANDLE_H
|
||||
#include <sigc++/sigc++config.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
// Signiture for Handles
|
||||
template <class Obj,class Scope_>
|
||||
class Handle
|
||||
{
|
||||
protected:
|
||||
Scope_ scope_;
|
||||
public:
|
||||
// access
|
||||
Obj* obj()
|
||||
{
|
||||
return static_cast<Obj*>(scope_.cache());
|
||||
}
|
||||
Obj* obj() const
|
||||
{
|
||||
return static_cast<Obj*>(scope_.cache());
|
||||
}
|
||||
|
||||
bool connected() const
|
||||
{return (scope_.object()!=0);}
|
||||
operator Obj*()
|
||||
{return (obj());}
|
||||
operator Obj*() const
|
||||
{return (obj());}
|
||||
|
||||
Obj& operator*() const
|
||||
{return *(obj());}
|
||||
Obj* operator->() const
|
||||
{return (obj());}
|
||||
|
||||
Scope_& scope()
|
||||
{return scope_;}
|
||||
const Scope_& scope() const
|
||||
{return scope_;}
|
||||
|
||||
void disconnect()
|
||||
{scope_.disconnect(0);}
|
||||
|
||||
// copy
|
||||
Handle& operator =(Obj* obj)
|
||||
{scope_.set(obj,obj,true); return *this;}
|
||||
Handle& operator =(Obj& obj)
|
||||
{scope_.set(&obj,&obj,false); return *this;}
|
||||
#ifndef SIGC_CXX_TEMPLATE_CCTOR
|
||||
Handle& operator =(const Handle& handle)
|
||||
{
|
||||
Obj *o=handle.obj();
|
||||
scope_.set(o,o,false);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
template <class Obj2,class Scope2>
|
||||
Handle& operator = (const Handle<Obj2,Scope2>& handle)
|
||||
{
|
||||
Obj *o=handle.obj();
|
||||
scope_.set(o,o,false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// construct
|
||||
Handle():scope_() {}
|
||||
Handle(Obj *obj):scope_() {scope_.set(obj,obj,true);}
|
||||
Handle(Obj &obj):scope_() {scope_.set(&obj,&obj,false);}
|
||||
#ifndef SIGC_CXX_TEMPLATE_CCTOR
|
||||
Handle(const Handle& handle)
|
||||
:scope_()
|
||||
{
|
||||
Obj *o=handle.obj();
|
||||
scope_.set(o,o,false);
|
||||
}
|
||||
#endif
|
||||
template <class Obj2,class Scope2>
|
||||
Handle(const Handle<Obj2,Scope2>& handle)
|
||||
:scope_()
|
||||
{
|
||||
Obj *o=handle.obj();
|
||||
scope_.set(o,o,false);
|
||||
}
|
||||
};
|
||||
|
||||
#define HANDLE_CTORS(X,T,P) \
|
||||
public: \
|
||||
X(T *t):Handle<T,P>(t) {} \
|
||||
X(T &t):Handle<T,P>(t) {} \
|
||||
template <class T2,class P2> \
|
||||
X(const Handle<T2,P2> &h):Handle<T,P>(h) {} \
|
||||
X& operator =(T *t) \
|
||||
{return Handle<T,P>::operator=(t);} \
|
||||
X& operator =(T &t) \
|
||||
{return Handle<T,P>::operator=(t);} \
|
||||
template <class T2,class P2> \
|
||||
X& operator =(const Handle<T2,P2> &t) \
|
||||
{return Handle<T,P>::operator=(t);}
|
||||
|
||||
//template <class T>
|
||||
// class Ref:public Handle<T,Scopes::RefCount>
|
||||
// {
|
||||
// HANDLE_CTORS(Ref,T,Scopes::RefCount)
|
||||
// };
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
4
sigc++/handle_system.h
Normal file
4
sigc++/handle_system.h
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
#include <sigc++/object.h>
|
||||
#include <sigc++/scope.h>
|
||||
#include <sigc++/handle.h>
|
21
sigc++/ltdll.c
Normal file
21
sigc++/ltdll.c
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <stdio.h>
|
||||
|
||||
extern "C" {
|
||||
BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
|
||||
}
|
||||
|
||||
#include <cygwin/cygwin_dll.h>
|
||||
DECLARE_CYGWIN_DLL( DllMain );
|
||||
HINSTANCE __hDllInstance_base;
|
||||
|
||||
BOOL APIENTRY
|
||||
DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
__hDllInstance_base = hInst;
|
||||
return TRUE;
|
||||
}
|
||||
|
2
sigc++/macros/.cvsignore
Normal file
2
sigc++/macros/.cvsignore
Normal file
@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
17
sigc++/macros/Makefile.am
Normal file
17
sigc++/macros/Makefile.am
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
all-local:
|
||||
|
||||
templates = \
|
||||
template.macros.m4 slot.h.m4 \
|
||||
func_slot.h.m4 class_slot.h.m4 object_slot.h.m4 \
|
||||
basic_signal.h.m4 \
|
||||
bind.h.m4 rettype.h.m4 convert.h.m4 \
|
||||
retbind.h.m4
|
||||
|
||||
noinst_HEADERS = $(templates)
|
||||
|
||||
EXTRA_DIST = README $(templates)
|
||||
|
||||
|
||||
MAINTAINERCLEANFILES=$(srcdir)/Makefile.in
|
50
sigc++/macros/README
Normal file
50
sigc++/macros/README
Normal file
@ -0,0 +1,50 @@
|
||||
This directory contains files associated with building large numbers
|
||||
of templates needed to represent different numbers of parameters.
|
||||
The file signal.macros.m4 defines all necessary macros for construction
|
||||
of templates with variable arguments.
|
||||
|
||||
These files will be placed in $(INCLUDE_DIR)/sigc++/macros for
|
||||
reuse.
|
||||
|
||||
Requires:
|
||||
Gnu M4 (others m4 may work)
|
||||
|
||||
Macros of particular interest:
|
||||
|
||||
IF(arg1,arg2[,arg3]) - if arg1 non-zero length print arg2, else arg3
|
||||
LIST(arg0,cond0 [,arg1,cond1]) - generates comma seperated list with
|
||||
conditions for each argument
|
||||
ARG_CLASS([P1,P2, ... ]) - generates string "class P1,class P2"
|
||||
ARG_BOTH([P1,P2, ... ]) - generates string "P1 p1,P2 p2"
|
||||
ARG_TYPE([P1,P2, ... ]) - generates string "P1,P2"
|
||||
ARG_NAME([P1,P2, ... ]) - generates string "p1,p2"
|
||||
[name]NUM(arg) - prints name#, where # is items in arg
|
||||
ARGS(P,n) - generates string [P1,P2,...Pn]
|
||||
|
||||
example:
|
||||
|
||||
To generalize this...
|
||||
|
||||
template<class P1,class P2> // needs to be inline for zero arguments
|
||||
void Foo::func2(int (*f)(P1,P2),P1 p1,P2 p2)
|
||||
{func(p1,p2);
|
||||
}
|
||||
|
||||
Use this...
|
||||
|
||||
include(template.macros.m4)
|
||||
define([FOO_FUNC],
|
||||
[
|
||||
IF([$1],template<ARG_CLASS($1)>,inline)
|
||||
void Foo::[func]NUM($1)(LIST(int (*f)(ARG_TYPE($1)),1,ARG_BOTH($1),[$1]))
|
||||
{func(ARG_NAME($1));
|
||||
}
|
||||
])
|
||||
|
||||
FOO_FUNC(ARGS(P,0))
|
||||
FOO_FUNC(ARGS(P,1))
|
||||
FOO_FUNC(ARGS(P,2))
|
||||
|
||||
(to prove it m4 this README file. Honest!)
|
||||
|
||||
|
227
sigc++/macros/basic_signal.h.m4
Normal file
227
sigc++/macros/basic_signal.h.m4
Normal file
@ -0,0 +1,227 @@
|
||||
dnl
|
||||
dnl Basic Signal Templates
|
||||
dnl
|
||||
dnl Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
include(template.macros.m4)
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
#include <sigc++/marshal.h>
|
||||
#include <sigc++/slot.h>
|
||||
|
||||
QT_FIREWALL
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************
|
||||
***** Signals (build by macros)
|
||||
****************************************************************/
|
||||
|
||||
// common part to all signals
|
||||
class LIBSIGC_API Signal_
|
||||
{
|
||||
private:
|
||||
Signal_(const Signal_&);
|
||||
|
||||
protected:
|
||||
typedef ScopeList List;
|
||||
|
||||
struct LIBSIGC_API Impl
|
||||
{
|
||||
typedef ScopeList List;
|
||||
List incoming_;
|
||||
List outgoing_;
|
||||
Impl();
|
||||
~Impl();
|
||||
};
|
||||
|
||||
Impl *impl;
|
||||
|
||||
SlotData* in_connect();
|
||||
SlotData* out_connect(SlotData *s);
|
||||
|
||||
Signal_();
|
||||
~Signal_();
|
||||
|
||||
public:
|
||||
bool empty() const;
|
||||
void clear();
|
||||
};
|
||||
|
||||
dnl
|
||||
dnl BASIC_SIGNAL([P1, P2, ...])
|
||||
dnl
|
||||
define([BASIC_SIGNAL],
|
||||
[/****************************************************************
|
||||
***** Signal NUM($1)
|
||||
****************************************************************/
|
||||
LINE(]__line__[)dnl
|
||||
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1],[typename Marsh=class Marshal<R> ],1)>
|
||||
class [Signal]NUM($1):public Signal_
|
||||
{
|
||||
public:
|
||||
typedef __SLOT__(R,[$1]) InSlotType;
|
||||
typedef __SLOT__(typename Marsh::OutType,[$1]) OutSlotType;
|
||||
|
||||
private:
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
typedef typename Marsh::OutType SType;
|
||||
typedef R RType;
|
||||
#else
|
||||
typedef Trait<typename Marsh::OutType>::type SType;
|
||||
typedef Trait<R>::type RType;
|
||||
#endif
|
||||
typedef typename InSlotType::Callback Callback;
|
||||
typedef [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)> Self;
|
||||
typedef CallDataObj2<typename OutSlotType::Func,Self> CallData;
|
||||
|
||||
static SType callback(LIST(void* d,1,ARG_BOTH($1),[$1]))
|
||||
{
|
||||
CallData* data=(CallData*)d;
|
||||
return data->obj->emit(ARG_NAME($1));
|
||||
}
|
||||
|
||||
public:
|
||||
OutSlotType slot()
|
||||
{
|
||||
SlotData* tmp=in_connect();
|
||||
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
|
||||
data.callback=(typename OutSlotType::Func)callback;
|
||||
data.obj=this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
Connection connect(const InSlotType &s)
|
||||
{
|
||||
return out_connect(s.data());
|
||||
}
|
||||
|
||||
SType emit(ARG_REF($1));
|
||||
SType operator()(ARG_REF($1))
|
||||
{return emit(ARG_NAME($1));}
|
||||
|
||||
[Signal]NUM($1)() {}
|
||||
[Signal]NUM($1)(const InSlotType &s) {connect(s);}
|
||||
~[Signal]NUM($1)() {}
|
||||
};
|
||||
|
||||
|
||||
// emit
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1],class Marsh,1)>
|
||||
typename [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)>::SType [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)>::
|
||||
emit(ARG_REF($1))
|
||||
{
|
||||
if (!impl||impl->outgoing_.empty()) return Marsh::default_value();
|
||||
List &out=impl->outgoing_;
|
||||
Marsh rc;
|
||||
SlotData *data;
|
||||
List::Iterator i=out.begin();
|
||||
while (i!=out.end())
|
||||
{
|
||||
data=((SlotDependent*)(i.node()))->parent();
|
||||
++i;
|
||||
Callback& s=(Callback&)(data->callback());
|
||||
if (rc.marshal(s.call(ARG_NAME($1)))) return rc.value();
|
||||
}
|
||||
return rc.value();
|
||||
}
|
||||
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
template <LIST(ARG_CLASS($1),[$1],[class Marsh],1)>
|
||||
class [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)>
|
||||
:public Signal_
|
||||
{
|
||||
public:
|
||||
typedef __SLOT__(void,[$1]) InSlotType;
|
||||
typedef __SLOT__(void,[$1]) OutSlotType;
|
||||
private:
|
||||
typedef ifelse([$1],,,[typename ])InSlotType::Callback Callback;
|
||||
typedef [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)> Self;
|
||||
typedef CallDataObj2<ifelse([$1],,,[typename ])OutSlotType::Func,Self> CallData;
|
||||
|
||||
static void callback(LIST(void* d,1,ARG_BOTH($1),[$1]))
|
||||
{
|
||||
CallData* data=(CallData*)d;
|
||||
data->obj->emit(ARG_NAME($1));
|
||||
}
|
||||
|
||||
public:
|
||||
OutSlotType slot()
|
||||
{
|
||||
SlotData* tmp=in_connect();
|
||||
CallData& data=reinterpret_cast<CallData&>(tmp->data_);
|
||||
data.callback=callback;
|
||||
data.obj=this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
Connection connect(const InSlotType &s)
|
||||
{
|
||||
return out_connect(s.data());
|
||||
}
|
||||
|
||||
void emit(ARG_REF($1));
|
||||
void operator()(ARG_REF($1))
|
||||
{emit(ARG_NAME($1));}
|
||||
|
||||
[Signal]NUM($1)() {}
|
||||
[Signal]NUM($1)(const InSlotType &s) {connect(s);}
|
||||
~[Signal]NUM($1)() {}
|
||||
};
|
||||
|
||||
|
||||
// emit
|
||||
template <LIST(ARG_CLASS($1),[$1],class Marsh,1)>
|
||||
void [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)>::
|
||||
emit(ARG_REF($1))
|
||||
{
|
||||
if (!impl||impl->outgoing_.empty()) return;
|
||||
List &out=impl->outgoing_;
|
||||
SlotData *data;
|
||||
List::Iterator i=out.begin();
|
||||
while (i!=out.end())
|
||||
{
|
||||
data=((SlotDependent*)(i.node()))->parent();
|
||||
++i;
|
||||
Callback& s=(Callback&)(data->callback());
|
||||
s.call(ARG_NAME($1));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
])dnl
|
||||
|
||||
BASIC_SIGNAL(ARGS(P,0))
|
||||
BASIC_SIGNAL(ARGS(P,1))
|
||||
BASIC_SIGNAL(ARGS(P,2))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
END_QT_FIREWALL
|
||||
|
||||
#endif // __header__
|
||||
|
178
sigc++/macros/bind.h.m4
Normal file
178
sigc++/macros/bind.h.m4
Normal file
@ -0,0 +1,178 @@
|
||||
dnl
|
||||
dnl Bind Slot Templates
|
||||
dnl
|
||||
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
include(template.macros.m4)
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
|
||||
/*
|
||||
SigC::bind
|
||||
-------------
|
||||
bind() alters a Slot by fixing arguments to certain values.
|
||||
|
||||
Argument fixing starts from the last argument. The slot is
|
||||
destroyed in the process and a new one is created, so references
|
||||
holding onto the slot will no longer be valid.
|
||||
|
||||
Up to two arguments can be bound at a time with the default
|
||||
header.
|
||||
|
||||
Simple Sample usage:
|
||||
|
||||
void f(int,int);
|
||||
Slot2<void,int,int> s1=slot(f);
|
||||
|
||||
Slot1<void,int> s2=bind(s1,1); // s1 is invalid
|
||||
s2(2); // call f with arguments 2,1
|
||||
|
||||
Multibinding usage:
|
||||
|
||||
void f(int,int);
|
||||
Slot2<void,int,int> s1=slot(f);
|
||||
|
||||
Slot0<void> s2=bind(s1,1,2); // s1 is invalid
|
||||
s2(); // call f with arguments 1,2
|
||||
|
||||
Type specified usage:
|
||||
|
||||
struct A {};
|
||||
struct B :public A {};
|
||||
B* b;
|
||||
Slot0<void, A*> s1;
|
||||
|
||||
Slot0<void> s2=bind(s1, b); // B* converted to A*
|
||||
|
||||
*/
|
||||
|
||||
#include <sigc++/adaptor.h>
|
||||
#include <sigc++/scope.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
define([FORMAT_ARG_CBASSIGN],[node->LOWER([$1])_=LOWER([$1]);])
|
||||
define([FORMAT_ARG_CBNAME],[node->LOWER([$1])_])
|
||||
define([FORMAT_ARG_CBBIND],[[$1] LOWER([$1])_;])
|
||||
|
||||
define([ARG_CBASSIGN],[PROT(ARG_LOOP([FORMAT_ARG_CBASSIGN],[[
|
||||
]],$*))])
|
||||
define([ARG_CBNAME],[PROT(ARG_LOOP([FORMAT_ARG_CBNAME],[[,]],$*))])
|
||||
define([ARG_CBBIND],[PROT(ARG_LOOP([FORMAT_ARG_CBBIND],[[
|
||||
]],$*))])
|
||||
|
||||
dnl
|
||||
dnl ADAPTOR_BIND_SLOT([P1..PN],[C0..CM],[A0..AM])
|
||||
dnl
|
||||
define([ADAPTOR_BIND_SLOT],[dnl
|
||||
/****************************************************************
|
||||
***** Adaptor Bind Slot NUM($1) arguments, NUM($2) hidden arguments
|
||||
****************************************************************/
|
||||
ADAPTOR_BIND_SLOT_IMPL(R,[$1],[$2])
|
||||
|
||||
#ifndef SIGC_CXX_VOID_RETURN
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
ADAPTOR_BIND_SLOT_IMPL(void,[$1],[$2])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <LIST(ARG_CLASS($3),[$3],[
|
||||
]class R,1,[
|
||||
]ARG_CLASS($1),[$1],[
|
||||
]ARG_CLASS($2),[$2])>
|
||||
inline
|
||||
__SLOT__(R,[$1])
|
||||
bind(const [Slot]eval(NUM($1)+NUM($2))<LIST(R,1,ARG_TYPE($1),[$1],ARG_TYPE($2),[$2])> &s,
|
||||
ARG_BOTH($3))
|
||||
{return [AdaptorBindSlot]NUM($1)[_]NUM($2)<LIST(R,1,[
|
||||
]ARG_TYPE($1),[$1],[
|
||||
]ARG_TYPE($2),[$2])>::create(s.data(),ARG_NAME($3));
|
||||
}
|
||||
|
||||
])dnl
|
||||
|
||||
|
||||
dnl
|
||||
dnl ADAPTOR_BIND_SLOT_IMPL(R,[P1..PN],[C0..CN])
|
||||
dnl
|
||||
define([ADAPTOR_BIND_SLOT_IMPL],[dnl
|
||||
LINE(]__line__[)dnl
|
||||
ifelse($1,void,[dnl
|
||||
template <LIST(ARG_CLASS($2),[$2],[
|
||||
]ARG_CLASS($3),[$3])>
|
||||
struct [AdaptorBindSlot]NUM($2)[_]NUM($3)
|
||||
<LIST(void,1,ARG_TYPE($2),[$2],[
|
||||
]ARG_TYPE($3),[$3])> : public AdaptorSlot_
|
||||
],[dnl
|
||||
template <LIST(class R,1,[
|
||||
]ARG_CLASS($2),[$2],[
|
||||
]ARG_CLASS($3),[$3])>
|
||||
struct [AdaptorBindSlot]NUM($2)[_]NUM($3): public AdaptorSlot_
|
||||
])dnl
|
||||
{TYPEDEF_RTYPE($1,RType)
|
||||
typedef __SLOT__($1,[$2]) SlotType;
|
||||
typedef __SLOT__($1,[$2],[$3]) InSlotType;
|
||||
|
||||
struct Node:public AdaptorNode
|
||||
{
|
||||
ARG_CBBIND($3)
|
||||
|
||||
Node(ARG_BOTH($3))
|
||||
: ARG_CBINIT($3)
|
||||
{ }
|
||||
};
|
||||
|
||||
typedef CallDataObj2<typename SlotType::Func,Node> CallData;
|
||||
|
||||
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
|
||||
{
|
||||
CallData* data=(CallData*)d;
|
||||
Node* node=data->obj;
|
||||
ifelse($1,void,,return) ((typename InSlotType::Callback&)(node->data_))(LIST(ARG_NAME($2),[$2],[
|
||||
]ARG_CBNAME($3),[$3]));
|
||||
}
|
||||
static SlotData* create(SlotData *s,ARG_BOTH($3))
|
||||
{
|
||||
Node *node=new Node(ARG_NAME($3));
|
||||
copy_callback(s,node);
|
||||
CallData &data=reinterpret_cast<CallData&>(s->data_);
|
||||
data.callback=&callback;
|
||||
data.obj=node;
|
||||
return s;
|
||||
}
|
||||
};
|
||||
])dnl
|
||||
|
||||
ADAPTOR_BIND_SLOT(ARGS(P,0),ARGS(C,1),ARGS(A,1))
|
||||
ADAPTOR_BIND_SLOT(ARGS(P,1),ARGS(C,1),ARGS(A,1))
|
||||
ADAPTOR_BIND_SLOT(ARGS(P,2),ARGS(C,1),ARGS(A,1))
|
||||
|
||||
ADAPTOR_BIND_SLOT(ARGS(P,0),ARGS(C,2),ARGS(A,2))
|
||||
ADAPTOR_BIND_SLOT(ARGS(P,1),ARGS(C,2),ARGS(A,2))
|
||||
ADAPTOR_BIND_SLOT(ARGS(P,2),ARGS(C,2),ARGS(A,2))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
107
sigc++/macros/class_slot.h.m4
Normal file
107
sigc++/macros/class_slot.h.m4
Normal file
@ -0,0 +1,107 @@
|
||||
dnl
|
||||
dnl Class Slot Templates
|
||||
dnl
|
||||
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
include(template.macros.m4)
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
|
||||
/*
|
||||
SigC::slot_class() (class)
|
||||
-----------------------
|
||||
slot_class() can be applied to a class method to form a Slot with a
|
||||
profile equivelent to the method. At the same time an instance
|
||||
of that class must be specified. This is an unsafe interface.
|
||||
|
||||
This does NOT require that the class be derived from SigC::Object.
|
||||
However, the object should be static with regards to the signal system.
|
||||
(allocated within the global scope.) If it is not and a connected
|
||||
slot is call it will result in a seg fault. If the object must
|
||||
be destroyed before the connected slots, all connections must
|
||||
be disconnected by hand.
|
||||
|
||||
Sample usage:
|
||||
|
||||
struct A
|
||||
{
|
||||
void foo(int,int);
|
||||
} a;
|
||||
|
||||
Slot2<void,int,int> s=slot_class(a,&A::foo);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <sigc++/object_slot.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
dnl
|
||||
dnl CLASS_SLOT
|
||||
dnl
|
||||
define([CLASS_SLOT],[dnl
|
||||
/****************************************************************
|
||||
***** Class Slot NUM($1)
|
||||
****************************************************************/
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
|
||||
struct [ClassSlot]NUM($1)_:public [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>
|
||||
{
|
||||
typedef [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)> Base;
|
||||
typedef typename Base::InFunc InFunc;
|
||||
|
||||
static SlotData* create(Obj* obj,InFunc func)
|
||||
{
|
||||
if (!obj) return 0;
|
||||
SlotData* tmp=manage(new SlotData());
|
||||
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
|
||||
data.callback=&callback;
|
||||
data.obj=obj;
|
||||
data.func=(Func)func;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
|
||||
__SLOT__(R,[$1])
|
||||
slot_class(Obj &obj,R (Obj::*func)(ARG_TYPE($1)))
|
||||
{return [ClassSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>::create(&obj,func);
|
||||
}
|
||||
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
|
||||
__SLOT__(R,[$1])
|
||||
slot_class(Obj *obj,R (Obj::*func)(ARG_TYPE($1)))
|
||||
{return [ClassSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>::create(obj,func);
|
||||
}
|
||||
|
||||
])dnl
|
||||
|
||||
CLASS_SLOT(ARGS(P,0))
|
||||
CLASS_SLOT(ARGS(P,1))
|
||||
CLASS_SLOT(ARGS(P,2))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
133
sigc++/macros/convert.h.m4
Normal file
133
sigc++/macros/convert.h.m4
Normal file
@ -0,0 +1,133 @@
|
||||
dnl
|
||||
dnl Convert Slot Templates
|
||||
dnl
|
||||
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
include(template.macros.m4)
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
|
||||
/*
|
||||
SigC::convert
|
||||
-------------
|
||||
convert() alters a Slot by assigning a conversion function
|
||||
which can completely alter the parameter types of a slot.
|
||||
|
||||
Only convert functions for changing with same number of
|
||||
arguments is compiled by default. See examples/custom_convert.h.m4
|
||||
for details on how to build non standard ones.
|
||||
|
||||
Sample usage:
|
||||
int my_string_to_char(Callback1<int,const char*> *d,const string &s)
|
||||
int f(const char*);
|
||||
string s=hello;
|
||||
|
||||
|
||||
Slot1<int,const string &> s2=convert(slot(f),my_string_to_char);
|
||||
s2(s);
|
||||
|
||||
*/
|
||||
#include <sigc++/adaptor.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
dnl
|
||||
dnl ADAPTOR_CONVERT_SLOT([P1..PN],[C0..CN])
|
||||
dnl
|
||||
define([ADAPTOR_CONVERT_SLOT],[dnl
|
||||
/****************************************************************
|
||||
***** Adaptor Convert Slot NUM($1)
|
||||
****************************************************************/
|
||||
ADAPTOR_CONVERT_SLOT_IMPL(R1,[$1],[$2])
|
||||
|
||||
#ifndef SIGC_CXX_VOID_RETURN
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
ADAPTOR_CONVERT_SLOT_IMPL(void,[$1],[$2])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <LIST(class R1,1,ARG_CLASS($1),[$1],[
|
||||
class R2],1,ARG_CLASS($2),[$2])>
|
||||
__SLOT__(R1,[$1])
|
||||
convert(const __SLOT__(R2,[$2]) &s,
|
||||
[R1 (*func)](LIST([Callback]NUM($2)PROT(<LIST(R2,1,ARG_TYPE($2),[$2])>)*,1,ARG_TYPE($1),[$1])))
|
||||
{return [AdaptorConvertSlot]NUM($1)[_]NUM($2)<LIST(R1,1,ARG_TYPE($1),[$1],[
|
||||
R2],1,ARG_TYPE($2),[$2])>::create(s.obj(),func);
|
||||
}
|
||||
|
||||
])dnl
|
||||
|
||||
dnl
|
||||
dnl ADAPTOR_CONVERT_SLOT_IMPL(R,[P1..PN],[C0..CN])
|
||||
dnl
|
||||
define([ADAPTOR_CONVERT_SLOT_IMPL],[dnl
|
||||
LINE(]__line__[)dnl
|
||||
ifelse($1,void,[dnl
|
||||
template <LIST(ARG_CLASS($2),[$2],[
|
||||
class R2],1,ARG_CLASS($3),[$3])>
|
||||
struct [AdaptorConvertSlot]NUM($2)[_]NUM($3)
|
||||
<LIST(void,1,ARG_TYPE($2),[$2],[
|
||||
R2],1,ARG_TYPE($3),[$3])>
|
||||
: public AdaptorSlot_
|
||||
],[dnl
|
||||
template <LIST(class $1,1,ARG_CLASS($2),[$2],[
|
||||
class R2],1,ARG_CLASS($3),[$3])>
|
||||
struct [AdaptorConvertSlot]NUM($2)[_]NUM($3): public AdaptorSlot_
|
||||
])dnl
|
||||
{TYPEDEF_RTYPE($1,RType)
|
||||
typedef __SLOT__($1,[$2]) SlotType;
|
||||
typedef __SLOT__(R2,[$3]) InSlotType;
|
||||
typedef typename InSlotType::Callback Callback;
|
||||
typedef RType (*Func) (Callback*,ARG_TYPE($2));
|
||||
typedef $1 (*InFunc)(Callback*,ARG_TYPE($2));
|
||||
typedef CallDataObj3<typename SlotType::Func,Callback,Func> CallData;
|
||||
|
||||
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
|
||||
{
|
||||
CallData* data=(CallData*)d;
|
||||
ifelse($1,void,,return) (data->func)(data->obj,ARG_NAME($2));
|
||||
}
|
||||
|
||||
static SlotData* create(SlotData *s,InFunc func)
|
||||
{
|
||||
SlotData* tmp=(SlotData*)s;
|
||||
AdaptorNode *node=new AdaptorNode();
|
||||
copy_callback(tmp,node);
|
||||
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
|
||||
data.callback=&callback;
|
||||
data.func=(Func)func;
|
||||
data.obj=(Callback*)&(node->data_);
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
])dnl
|
||||
|
||||
ADAPTOR_CONVERT_SLOT(ARGS(P,1),ARGS(Q,1))
|
||||
ADAPTOR_CONVERT_SLOT(ARGS(P,2),ARGS(Q,2))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
122
sigc++/macros/func_slot.h.m4
Normal file
122
sigc++/macros/func_slot.h.m4
Normal file
@ -0,0 +1,122 @@
|
||||
dnl
|
||||
dnl Function slot templates
|
||||
dnl
|
||||
dnl Copyright (C) 1998 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
include(template.macros.m4)
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
#include <sigc++/slot.h>
|
||||
|
||||
/*
|
||||
SigC::slot() (function)
|
||||
-----------------------
|
||||
slot() can be applied to a function to form a Slot with a
|
||||
profile equivelent to the function. To avoid warns be
|
||||
sure to pass the address of the function.
|
||||
|
||||
Sample usage:
|
||||
|
||||
void foo(int,int);
|
||||
|
||||
Slot2<void,int,int> s=slot(&foo);
|
||||
|
||||
*/
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
// From which we build specific Slots and a set of
|
||||
// functions for creating a slot of this type
|
||||
|
||||
dnl
|
||||
dnl FUNCTION_SLOT([P1,P2,...])
|
||||
dnl
|
||||
define([FUNCTION_SLOT],[dnl
|
||||
/****************************************************************
|
||||
***** Function Slot NUM($1)
|
||||
****************************************************************/
|
||||
FUNCTION_SLOT_IMPL(R,[$1])
|
||||
|
||||
#ifndef SIGC_CXX_VOID_RETURN
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
FUNCTION_SLOT_IMPL(void,[$1])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1])>
|
||||
inline __SLOT__(R,[$1])
|
||||
slot(R (*func)(ARG_TYPE($1)))
|
||||
{
|
||||
return [FuncSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1])>::create(func);
|
||||
}
|
||||
|
||||
])dnl
|
||||
|
||||
dnl
|
||||
dnl FUNCTION_SLOT_IMPL(R,[P1,P2,...])
|
||||
dnl
|
||||
define([FUNCTION_SLOT_IMPL],[dnl
|
||||
LINE(]__line__[)dnl
|
||||
ifelse($1,void,[dnl
|
||||
template <ARG_CLASS($2)>
|
||||
struct [FuncSlot]NUM($2)_<LIST(void,1,ARG_TYPE($2),[$2])>
|
||||
],[dnl
|
||||
template <LIST(class R,1,ARG_CLASS($2),[$2])>
|
||||
struct [FuncSlot]NUM($2)_
|
||||
])dnl
|
||||
{TYPEDEF_RTYPE($1,RType)
|
||||
typedef $1 (*InFunc)(ARG_TYPE($2));
|
||||
typedef RType (*Func)(ARG_TYPE($2));
|
||||
typedef __SLOT__($1,[$2]) SlotType;
|
||||
|
||||
ifelse($1,void,[dnl
|
||||
typedef CallDataFunc<IF([$2],[typename ])SlotType::Func,Func> CallData;
|
||||
],[dnl
|
||||
typedef CallDataFunc<typename SlotType::Func,Func> CallData;
|
||||
])dnl
|
||||
|
||||
static RType callback(LIST(void* data,1,ARG_BOTH($2),[$2]))
|
||||
{
|
||||
ifelse($1,void,,return) (((CallData*)data)->func)(ARG_NAME($2));
|
||||
}
|
||||
|
||||
static SlotData* create(InFunc func)
|
||||
{
|
||||
SlotData* tmp=manage(new SlotData());
|
||||
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
|
||||
data.callback=&callback;
|
||||
data.func=(Func)func;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
])dnl
|
||||
|
||||
FUNCTION_SLOT(ARGS(P,0))
|
||||
FUNCTION_SLOT(ARGS(P,1))
|
||||
FUNCTION_SLOT(ARGS(P,2))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif // __header__
|
144
sigc++/macros/object_slot.h.m4
Normal file
144
sigc++/macros/object_slot.h.m4
Normal file
@ -0,0 +1,144 @@
|
||||
dnl
|
||||
dnl Object Slot Templates
|
||||
dnl
|
||||
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
include(template.macros.m4)
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
|
||||
/*
|
||||
SigC::slot() (obj)
|
||||
-----------------------
|
||||
slot() can be applied to a object method to form a Slot with a
|
||||
profile equivelent to the method. At the same time an instance
|
||||
of that object must be specified. The object must be derived
|
||||
from SigC::Object.
|
||||
|
||||
Sample usage:
|
||||
|
||||
struct A: public SigC::Object
|
||||
{
|
||||
void foo(int,int);
|
||||
} a;
|
||||
|
||||
Slot2<void,int,int> s=slot(a,&A::foo);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <sigc++/slot.h>
|
||||
#include <sigc++/scope.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
dnl
|
||||
dnl OBJECT_SLOT
|
||||
dnl
|
||||
define([OBJECT_SLOT],[dnl
|
||||
/****************************************************************
|
||||
***** Object Slot NUM($1)
|
||||
****************************************************************/
|
||||
OBJECT_SLOT_IMPL(R,[$1])
|
||||
|
||||
#ifndef SIGC_CXX_VOID_RETURN
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
OBJECT_SLOT_IMPL(void,[$1])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1],[class O,class O2],1)>
|
||||
inline __SLOT__(R,[$1])
|
||||
slot(O* &obj,R (O2::*func)(ARG_TYPE($1)))
|
||||
{
|
||||
return [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],O2,1)>
|
||||
::create(obj,func);
|
||||
}
|
||||
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1],[class O,class O2],1)>
|
||||
inline __SLOT__(R,[$1])
|
||||
slot(O* const &obj,R (O2::*func)(ARG_TYPE($1)))
|
||||
{
|
||||
return [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],O2,1)>
|
||||
::create(obj,func);
|
||||
}
|
||||
|
||||
template <LIST(class R,1,ARG_CLASS($1),[$1],[class O,class O2],1)>
|
||||
inline __SLOT__(R,[$1])
|
||||
slot(O &obj,R (O2::*func)(ARG_TYPE($1)))
|
||||
{
|
||||
return [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],O2,1)>
|
||||
::create(&obj,func);
|
||||
}
|
||||
|
||||
|
||||
])dnl
|
||||
|
||||
dnl
|
||||
dnl OBJECT_SLOT_IMPL(R,[P1,P2,...])
|
||||
dnl
|
||||
define([OBJECT_SLOT_IMPL],[dnl
|
||||
LINE(]__line__[)dnl
|
||||
ifelse($1,void,[dnl
|
||||
template <LIST(ARG_CLASS($2),[$2],class Obj,1)>
|
||||
struct [ObjectSlot]NUM($2)_<LIST(void,1,ARG_TYPE($2),[$2],Obj,1)>
|
||||
],[dnl
|
||||
template <LIST(class R,1,ARG_CLASS($2),[$2],class Obj,1)>
|
||||
struct [ObjectSlot]NUM($2)_
|
||||
])dnl
|
||||
{TYPEDEF_RTYPE($1,RType)
|
||||
typedef $1 (Obj::*InFunc)(ARG_TYPE($2));
|
||||
typedef RType (Obj::*Func)(ARG_TYPE($2));
|
||||
typedef __SLOT__($1,[$2]) SlotType;
|
||||
typedef CallDataObj3<typename SlotType::Func,Obj,Func> CallData;
|
||||
|
||||
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
|
||||
{
|
||||
CallData* data=(CallData*)d;
|
||||
ifelse($1,void,,return) ((data->obj)->*(data->func))(ARG_NAME($2));
|
||||
}
|
||||
|
||||
static SlotData* create(Obj* obj,InFunc func)
|
||||
{
|
||||
if (!obj) return 0;
|
||||
SlotData* tmp=manage(new SlotData());
|
||||
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
|
||||
data.callback=&callback;
|
||||
data.obj=obj;
|
||||
data.func=(Func)func;
|
||||
obj->register_data(tmp->receiver());
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
|
||||
])dnl
|
||||
|
||||
OBJECT_SLOT(ARGS(P,0))
|
||||
OBJECT_SLOT(ARGS(P,1))
|
||||
OBJECT_SLOT(ARGS(P,2))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
156
sigc++/macros/retbind.h.m4
Normal file
156
sigc++/macros/retbind.h.m4
Normal file
@ -0,0 +1,156 @@
|
||||
dnl
|
||||
dnl Bind Slot Templates
|
||||
dnl
|
||||
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl Copyright (C) 2000 Carl Nygard <cnygard@bellatlantic.net>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
/* This was also shamelessly copied, hacked, munched, and carefully
|
||||
* tweaked from KNelson's original bind.h.m4
|
||||
* CJN 3.22.00
|
||||
*/
|
||||
include(template.macros.m4)
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
|
||||
/*
|
||||
SigC::retbind
|
||||
-------------
|
||||
retbind() alters a Slot by fixing the return value to certain values
|
||||
|
||||
Return value fixing ignores any slot return value. The slot is
|
||||
destroyed in the process and a new one is created, so references
|
||||
holding onto the slot will no longer be valid.
|
||||
|
||||
Typecasting may be necessary to match arguments between the
|
||||
slot and the binding return value. Types must be an exact match.
|
||||
To insure the proper type, the type can be explicitly specified
|
||||
on template instantation.
|
||||
|
||||
Simple Sample usage:
|
||||
|
||||
void f(int,int);
|
||||
Slot2<void,int,int> s1=slot(f);
|
||||
|
||||
Slot1<int,int,int> s2=retbind(s1,1); // s1 is invalid
|
||||
cout << "s2: " << s2(2,1) << endl;
|
||||
|
||||
Type specified usage:
|
||||
|
||||
struct A {};
|
||||
struct B :public A {};
|
||||
B* b;
|
||||
Slot1<void> s1;
|
||||
|
||||
Slot0<A*> s2=retbind<A*>(s1,b); // B* must be told to match A*
|
||||
|
||||
*/
|
||||
|
||||
#include <sigc++/adaptor.h>
|
||||
#include <sigc++/scope.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
dnl
|
||||
dnl ADAPTOR_RETBIND_SLOT([P1..PN])
|
||||
dnl
|
||||
define([ADAPTOR_RETBIND_SLOT],[dnl
|
||||
/****************************************************************
|
||||
***** Adaptor RetBind Slot NUM($1) arguments
|
||||
****************************************************************/
|
||||
ADAPTOR_RETBIND_SLOT_IMPL(R,[$1])
|
||||
|
||||
#ifndef SIGC_CXX_VOID_RETURN
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
ADAPTOR_RETBIND_SLOT_IMPL(void,[$1])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <LIST(class Ret,1,[
|
||||
]class R,1,[
|
||||
]ARG_CLASS($1),[$1])>
|
||||
__SLOT__(Ret,[$1])
|
||||
retbind(const [Slot]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1])> &s,
|
||||
Ret ret)
|
||||
{return [AdaptorRetBindSlot]NUM($1)<LIST(Ret,1,R,1,[
|
||||
]ARG_TYPE($1),[$1])>::create(s.data(),ret);
|
||||
}
|
||||
|
||||
])dnl
|
||||
|
||||
|
||||
dnl
|
||||
dnl ADAPTOR_RETBIND_SLOT_IMPL(R,[P1..PN])
|
||||
dnl
|
||||
define([ADAPTOR_RETBIND_SLOT_IMPL],[dnl
|
||||
LINE(]__line__[)dnl
|
||||
ifelse($1,void,[dnl
|
||||
template <LIST(class Ret,1,ARG_CLASS($2),[$2])>
|
||||
struct [AdaptorRetBindSlot]NUM($2)
|
||||
<LIST(Ret,1,void,1,[
|
||||
]ARG_TYPE($2),[$2])> : public AdaptorSlot_
|
||||
],[dnl
|
||||
template <LIST(class Ret,1,class $1,1,[
|
||||
]ARG_CLASS($2),[$2])>
|
||||
struct [AdaptorRetBindSlot]NUM($2): public AdaptorSlot_
|
||||
])dnl
|
||||
{TYPEDEF_RTYPE(Ret,RType)
|
||||
typedef __SLOT__(Ret,[$2]) SlotType;
|
||||
typedef __SLOT__($1,[$2]) InSlotType;
|
||||
|
||||
struct Node:public AdaptorNode
|
||||
{
|
||||
Ret ret_;
|
||||
};
|
||||
|
||||
typedef CallDataObj2<typename SlotType::Func,Node> CallData;
|
||||
|
||||
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
|
||||
{
|
||||
CallData* data=(CallData*)d;
|
||||
Node* node=data->obj;
|
||||
((typename InSlotType::Callback&)(node->data_))(LIST(ARG_NAME($2),[$2]));
|
||||
return node->ret_;
|
||||
}
|
||||
static SlotData* create(SlotData *s,Ret ret)
|
||||
{
|
||||
SlotData* tmp=(SlotData*)s;
|
||||
Node *node=new Node();
|
||||
copy_callback(tmp,node);
|
||||
node->ret_ = ret;
|
||||
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
|
||||
data.callback=&callback;
|
||||
data.obj=node;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
])dnl
|
||||
|
||||
ADAPTOR_RETBIND_SLOT(ARGS(P,0))
|
||||
ADAPTOR_RETBIND_SLOT(ARGS(P,1))
|
||||
ADAPTOR_RETBIND_SLOT(ARGS(P,2))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
144
sigc++/macros/rettype.h.m4
Normal file
144
sigc++/macros/rettype.h.m4
Normal file
@ -0,0 +1,144 @@
|
||||
dnl
|
||||
dnl Adaptor Rettype Templates
|
||||
dnl
|
||||
dnl Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
include(template.macros.m4)
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
|
||||
/*
|
||||
SigC::rettype
|
||||
-------------
|
||||
rettype() alters a Slot by changing the return type.
|
||||
|
||||
Only allowed conversions or conversions to void can properly
|
||||
be implemented. The type must always be specified as a
|
||||
template parameter.
|
||||
|
||||
Simple Sample usage:
|
||||
|
||||
int f(int);
|
||||
|
||||
Slot1<void,int> s1=rettype<void>(slot(&f));
|
||||
Slot1<float,int> s2=rettype<float>(slot(&f));
|
||||
|
||||
*/
|
||||
|
||||
#include <sigc++/adaptor.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
define([FORMAT_ARG_CBASSIGN],[node->LOWER([$1])_=LOWER([$1]);])
|
||||
define([FORMAT_ARG_CBNAME],[node->LOWER([$1])_])
|
||||
define([FORMAT_ARG_CBBIND],[[$1] LOWER([$1])_;])
|
||||
|
||||
define([ARG_CBASSIGN],[PROT(ARG_LOOP([FORMAT_ARG_CBASSIGN],[[
|
||||
]],$*))])
|
||||
define([ARG_CBNAME],[PROT(ARG_LOOP([FORMAT_ARG_CBNAME],[[,]],$*))])
|
||||
define([ARG_CBBIND],[PROT(ARG_LOOP([FORMAT_ARG_CBBIND],[[
|
||||
]],$*))])
|
||||
|
||||
dnl
|
||||
dnl ADAPTOR_RETTYPE_SLOT([P1..PN],[C0..CN])
|
||||
dnl
|
||||
define([ADAPTOR_RETTYPE_SLOT],[dnl
|
||||
/****************************************************************
|
||||
***** Adaptor Rettype Slot NUM($1)
|
||||
****************************************************************/
|
||||
ADAPTOR_RETTYPE_SLOT_IMPL(R1,[$1],[$2])
|
||||
|
||||
#ifndef SIGC_CXX_VOID_RETURN
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
ADAPTOR_RETTYPE_SLOT_IMPL(void,[$1],[$2])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
LINE(]__line__[)dnl
|
||||
|
||||
template <LIST(class R1,1,class R2,1,ARG_CLASS($1),[$1])>
|
||||
__SLOT__(R1,[$1])
|
||||
rettype(const __SLOT__(R2,[$1]) &s)
|
||||
{return [AdaptorRettypeSlot]NUM($1)_<LIST(R1,1,[
|
||||
]ARG_TYPE($1),[$1],R2,1)>::create(s.obj());
|
||||
}
|
||||
])dnl
|
||||
|
||||
dnl
|
||||
dnl ADAPTOR_RETTYPE_SLOT_IMPL(R,[P1..PN],[C0..CN])
|
||||
dnl
|
||||
define([ADAPTOR_RETTYPE_SLOT_IMPL],[dnl
|
||||
LINE(]__line__[)dnl
|
||||
ifelse($1,void,[dnl
|
||||
template <LIST([
|
||||
]ARG_CLASS($2),[$2],[
|
||||
]class R2,1)>
|
||||
struct [AdaptorRettypeSlot]NUM($2)[_]
|
||||
<LIST(void,1,[
|
||||
]ARG_TYPE($2),[$2],[
|
||||
]R2,1)>
|
||||
],[dnl
|
||||
template <LIST(class R1,1,[
|
||||
]ARG_CLASS($2),[$2],[
|
||||
]class R2,1)>
|
||||
struct [AdaptorRettypeSlot]NUM($2)[_]
|
||||
])dnl
|
||||
: public AdaptorSlot_
|
||||
{TYPEDEF_RTYPE($1,RType)
|
||||
typedef __SLOT__($1,[$2]) SlotType;
|
||||
typedef __SLOT__(R2,[$2]) InSlotType;
|
||||
typedef AdaptorNode Node;
|
||||
typedef CallDataObj2<typename SlotType::Func,Node> CallData;
|
||||
|
||||
static RType callback(LIST(void* d,1,ARG_BOTH($2),[$2]))
|
||||
{
|
||||
CallData* data=(CallData*)d;
|
||||
Node* node=data->obj;
|
||||
ifelse($1,void,[dnl
|
||||
((typename InSlotType::Callback&)(node->data_))(ARG_NAME($2));
|
||||
],[dnl
|
||||
return RType(((typename InSlotType::Callback&)(node->data_))(ARG_NAME($2)));
|
||||
])dnl
|
||||
}
|
||||
static SlotData* create(SlotData *s)
|
||||
{
|
||||
SlotData* tmp=(SlotData*)s;
|
||||
Node *node=new Node();
|
||||
copy_callback(tmp,node);
|
||||
CallData &data=reinterpret_cast<CallData&>(tmp->data_);
|
||||
data.callback=&callback;
|
||||
data.obj=node;
|
||||
return tmp;
|
||||
}
|
||||
};
|
||||
])dnl
|
||||
|
||||
ADAPTOR_RETTYPE_SLOT(ARGS(P,0))
|
||||
ADAPTOR_RETTYPE_SLOT(ARGS(P,1))
|
||||
ADAPTOR_RETTYPE_SLOT(ARGS(P,2))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
369
sigc++/macros/slot.h.m4
Normal file
369
sigc++/macros/slot.h.m4
Normal file
@ -0,0 +1,369 @@
|
||||
dnl
|
||||
dnl Abstract Slot templates
|
||||
dnl
|
||||
dnl Copyright (C) 1998 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
// -*- c++ -*-
|
||||
dnl Ignore the next line
|
||||
/* This is a generated file, do not edit. Generated from __file__ */
|
||||
include(template.macros.m4)
|
||||
|
||||
#ifndef __header__
|
||||
#define __header__
|
||||
|
||||
/*
|
||||
|
||||
This file just gives the basic definition of Slots.
|
||||
|
||||
Callback# is the 4 byte data necessary for representing all
|
||||
callback types.
|
||||
|
||||
CallData is a specific interpretation of the Callback data.
|
||||
|
||||
Slot_ is a pimple on SlotData containing an Object for
|
||||
holding its referencees, a Dependency that removes the slot
|
||||
when its caller or receiver die, and a Callback.
|
||||
|
||||
Slot is a handle to a Slot_.
|
||||
|
||||
*/
|
||||
|
||||
#include <sigc++/sigc++config.h>
|
||||
#include <sigc++/type.h>
|
||||
#include <sigc++/object.h>
|
||||
#include <sigc++/handle.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
// Base node for a polymorphic list of "extra" data needed
|
||||
// by various slots.
|
||||
struct LIBSIGC_API SlotNode
|
||||
{
|
||||
void *next_;
|
||||
SlotNode();
|
||||
virtual ~SlotNode()=0;
|
||||
};
|
||||
|
||||
struct LIBSIGC_API SlotIterator_
|
||||
{
|
||||
typedef SlotNode NodeType;
|
||||
typedef SlotIterator_ Iterator;
|
||||
NodeType *node_;
|
||||
|
||||
NodeType* node() {return node_;}
|
||||
const NodeType* node() const {return node_;}
|
||||
|
||||
NodeType& operator*()
|
||||
{return *node_;
|
||||
}
|
||||
const NodeType& operator*() const
|
||||
{return *node_;
|
||||
}
|
||||
|
||||
bool operator==(const Iterator& i) const
|
||||
{return node_==i.node_;
|
||||
}
|
||||
bool operator!=(const Iterator& i) const
|
||||
{return node_!=i.node_;
|
||||
}
|
||||
|
||||
Iterator& operator++()
|
||||
{
|
||||
if (node_)
|
||||
node_=(NodeType*)node_->next_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Iterator operator++(int)
|
||||
{Iterator tmp=*this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
Iterator& operator= (const Iterator& i)
|
||||
{
|
||||
node_=i.node_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SlotIterator_():node_(0) {}
|
||||
SlotIterator_(NodeType *node):node_(node) {}
|
||||
};
|
||||
|
||||
// This is a list for storing internal data for slots
|
||||
struct LIBSIGC_API SlotList_
|
||||
{
|
||||
typedef SlotNode NodeType;
|
||||
typedef SlotIterator_ Iterator;
|
||||
NodeType* head_;
|
||||
|
||||
Iterator begin() {return ((NodeType*)head_);}
|
||||
Iterator end() {return Iterator();}
|
||||
const Iterator begin() const {return ((NodeType*)head_);}
|
||||
const Iterator end() const {return Iterator();}
|
||||
|
||||
// this is best used at the begining of list.
|
||||
Iterator insert_direct(Iterator pos,NodeType *n);
|
||||
|
||||
void clear();
|
||||
bool empty() const {return head_==0;}
|
||||
|
||||
SlotList_():head_(0)
|
||||
{}
|
||||
~SlotList_()
|
||||
{clear();}
|
||||
|
||||
private:
|
||||
SlotList_(const SlotList_&);
|
||||
};
|
||||
|
||||
|
||||
struct SlotData;
|
||||
|
||||
// SlotDependent is an internal of SlotData used to unreference the
|
||||
// Slot when either the sender or receiver have gone away
|
||||
struct LIBSIGC_API SlotDependent:public ScopeNode
|
||||
{
|
||||
struct LIBSIGC_API Dep: public ScopeNode
|
||||
{
|
||||
SlotData *parent;
|
||||
virtual void erase();
|
||||
Dep() {}
|
||||
virtual ~Dep();
|
||||
} dep;
|
||||
|
||||
ScopeNode* receiver() {return &dep;}
|
||||
ScopeNode* sender() {return this;}
|
||||
SlotData* parent() {return dep.parent;}
|
||||
|
||||
bool connected()
|
||||
{return (next_!=this);}
|
||||
|
||||
virtual void erase();
|
||||
|
||||
void set_parent(SlotData *s)
|
||||
{dep.parent=s;}
|
||||
|
||||
SlotDependent(SlotData &s)
|
||||
{dep.parent=&s;}
|
||||
|
||||
SlotDependent()
|
||||
{}
|
||||
|
||||
virtual ~SlotDependent();
|
||||
};
|
||||
|
||||
// common data to all callbacks.
|
||||
struct Callback_
|
||||
{
|
||||
// callback function
|
||||
void* (*func_)(void*);
|
||||
|
||||
struct O;
|
||||
struct C1
|
||||
{
|
||||
void* (*f1)(void*);
|
||||
};
|
||||
struct C2
|
||||
{
|
||||
O* o;
|
||||
void (O::*v)(void);
|
||||
};
|
||||
|
||||
// Object pointer or function pointer
|
||||
union {C1 a1; C2 a2;};
|
||||
};
|
||||
|
||||
// All slots have the same base
|
||||
struct LIBSIGC_API SlotData:public ObjectScoped
|
||||
{
|
||||
typedef SlotList_ List;
|
||||
|
||||
SlotDependent dep_;
|
||||
|
||||
ScopeNode* receiver() {return dep_.receiver();}
|
||||
ScopeNode* sender() {return dep_.sender();}
|
||||
|
||||
// Called from signals to tell slot object it is connected
|
||||
// invalidates list and sets weak reference
|
||||
void connect();
|
||||
|
||||
List list_;
|
||||
Callback_ data_;
|
||||
|
||||
Callback_& callback() {return data_;}
|
||||
|
||||
SlotData()
|
||||
{dep_.set_parent(this);}
|
||||
virtual ~SlotData();
|
||||
};
|
||||
|
||||
|
||||
typedef Scopes::Extend SlotExtend;
|
||||
#ifdef LIBSIGC_MSC
|
||||
#pragma warning(disable: 4231)
|
||||
LIBSIGC_TMPL template class LIBSIGC_API Handle<SlotData,SlotExtend>;
|
||||
#endif
|
||||
class LIBSIGC_API Connection:protected Handle<SlotData,SlotExtend>
|
||||
{
|
||||
typedef Handle<SlotData,SlotExtend> Base;
|
||||
public:
|
||||
// hides virtual method
|
||||
void disconnect() {if (obj()) obj()->invalid();}
|
||||
bool connected() {return Base::connected ();}
|
||||
|
||||
Connection():Base() {}
|
||||
Connection(SlotData *s):Base(s) {}
|
||||
Connection(const Connection& s):Base(s) {}
|
||||
};
|
||||
|
||||
// possible casts of Callback
|
||||
template <class C,class F>
|
||||
struct CallDataFunc
|
||||
{
|
||||
C callback;
|
||||
F func;
|
||||
};
|
||||
|
||||
template <class C,class O>
|
||||
struct CallDataObj2
|
||||
{
|
||||
C callback;
|
||||
O *obj;
|
||||
};
|
||||
|
||||
template <class C,class O,class F>
|
||||
struct CallDataObj3
|
||||
{
|
||||
C callback;
|
||||
O* obj;
|
||||
F func;
|
||||
};
|
||||
|
||||
// from Abstract_Slots we build abstract slots
|
||||
// with various lengths of arguments
|
||||
// A slot is not concrete til it has a call
|
||||
|
||||
dnl
|
||||
dnl SLOT([P1,P2,...])
|
||||
dnl
|
||||
define([SLOT],[dnl
|
||||
/****************************************************************
|
||||
***** Abstract Slot NUM($1)
|
||||
****************************************************************/
|
||||
SLOT_IMPL(R,[$1])
|
||||
|
||||
#ifndef SIGC_CXX_VOID_RETURN
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
SLOT_IMPL(void,[$1])
|
||||
#endif
|
||||
#endif
|
||||
|
||||
])dnl end SLOT
|
||||
|
||||
dnl
|
||||
dnl SLOT_IMPL(R,[P1,P2,...])
|
||||
dnl
|
||||
define([SLOT_IMPL],[dnl
|
||||
LINE(]__line__[)dnl
|
||||
|
||||
ifelse($1,void,[dnl
|
||||
template <ARG_CLASS($2)>
|
||||
struct [Callback]NUM($2)<LIST(void,1,ARG_TYPE($2),[$2])>:public Callback_
|
||||
{
|
||||
typedef void RType;
|
||||
typedef RType (*Func)(LIST([void*],1,ARG_TYPE($2),[$2]));
|
||||
inline RType call(ARG_REF($2))
|
||||
{((Func)(func_))(LIST([(void*)this],1,ARG_NAME($2),[$2]));}
|
||||
inline RType operator()(ARG_REF($2))
|
||||
{((Func)(func_))(LIST([(void*)this],1,ARG_NAME($2),[$2]));}
|
||||
};
|
||||
],[dnl
|
||||
template <LIST(class R,1,ARG_CLASS($2),[$2])>
|
||||
struct [Callback]NUM($2):public Callback_
|
||||
{
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
typedef R RType;
|
||||
#else
|
||||
typedef Trait<R>::type RType;
|
||||
#endif
|
||||
typedef RType (*Func)(LIST([void*],1,ARG_TYPE($2),[$2]));
|
||||
inline RType call(ARG_REF($2))
|
||||
{return ((Func)(func_))(LIST([(void*)this],1,ARG_NAME($2),[$2]));}
|
||||
inline RType operator()(ARG_REF($2))
|
||||
{return ((Func)(func_))(LIST([(void*)this],1,ARG_NAME($2),[$2]));}
|
||||
};
|
||||
])dnl
|
||||
|
||||
ifelse($1,void,[dnl
|
||||
template <ARG_CLASS($2)>
|
||||
class __SLOT__(void,[$2])
|
||||
],[dnl
|
||||
template <LIST(class R,1,ARG_CLASS($2),[$2])>
|
||||
class [Slot]NUM($2)
|
||||
])dnl
|
||||
:public Handle<SlotData,SlotExtend>
|
||||
{
|
||||
public:
|
||||
typedef Handle<SlotData,SlotExtend> Base;
|
||||
typedef [Callback]NUM($2)<LIST($1,1,ARG_TYPE($2),[$2])> Callback;
|
||||
typedef ifelse([$1$2],void,,typename) Callback::RType RType;
|
||||
typedef RType (*Func)(LIST([void*],1,ARG_TYPE($2),[$2]));
|
||||
|
||||
SlotData* data() const {return (SlotData*)(scope_.object());}
|
||||
|
||||
[Slot]NUM($2)() {}
|
||||
[Slot]NUM($2)(SlotData *s):Base(s) {}
|
||||
[Slot]NUM($2)(const [Slot]NUM($2)& s):Base(s.obj()) {}
|
||||
|
||||
inline RType call(ARG_REF($2))
|
||||
{
|
||||
if (connected())
|
||||
ifelse($1,void,[
|
||||
((Callback&)(data()->callback())).call(ARG_NAME($2));
|
||||
],[dnl
|
||||
return ((Callback&)(data()->callback())).call(ARG_NAME($2));
|
||||
return RType();
|
||||
])dnl
|
||||
}
|
||||
inline RType operator()(ARG_REF($2))
|
||||
{
|
||||
if (connected())
|
||||
ifelse($1,void,[
|
||||
((Callback&)(data()->callback())).call(ARG_NAME($2));
|
||||
],[dnl
|
||||
return ((Callback&)(data()->callback())).call(ARG_NAME($2));
|
||||
return RType();
|
||||
])dnl
|
||||
}
|
||||
};
|
||||
])dnl end SLOT_IMPL
|
||||
|
||||
SLOT(ARGS(P,0))
|
||||
SLOT(ARGS(P,1))
|
||||
SLOT(ARGS(P,2))
|
||||
SLOT(ARGS(P,3))
|
||||
SLOT(ARGS(P,4))
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif // __header__
|
282
sigc++/macros/template.macros.m4
Normal file
282
sigc++/macros/template.macros.m4
Normal file
@ -0,0 +1,282 @@
|
||||
dnl-----------------------------------------------------------------------
|
||||
dnl
|
||||
dnl Karls M4 macros for the signal system used by gtk--
|
||||
dnl
|
||||
dnl Copyright (C) 1998 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
dnl Tero Pulkkinen
|
||||
dnl
|
||||
dnl Currently maintained by Tero Pulkkinen. <terop@modeemi.cs.tut.fi>
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Library General Public
|
||||
dnl License along with this library; if not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
dnl-----------------------------------------------------------------------
|
||||
dnl Recursion prevention. (Don't attempt to understand why this works!)
|
||||
changequote(, )dnl
|
||||
changequote([, ])dnl
|
||||
pushdef([DIVERSION],divnum)dnl
|
||||
divert(-1)dnl
|
||||
|
||||
ifdef([__template_macros__],[],[
|
||||
define(__template_macros__)
|
||||
dnl-----------------------------------------------------------------------
|
||||
|
||||
|
||||
dnl
|
||||
dnl M4 macros for general sanity
|
||||
dnl
|
||||
|
||||
dnl M4 Quotas are hard to work with, so use braces like autoconf
|
||||
dnl (which are matched by vi, emacs)
|
||||
changequote(, )
|
||||
changequote([, ])
|
||||
|
||||
dnl
|
||||
dnl M4 comments conflict with compiler directives
|
||||
changecom(, )
|
||||
|
||||
dnl BRACE(text) => [text]
|
||||
dnl When we want something to appear with braces
|
||||
define([BRACE],[[[$*]]])
|
||||
|
||||
dnl
|
||||
dnl PROT(macro)
|
||||
dnl If a macro generates an output with commas we need to protect it
|
||||
dnl from being broken down and interpreted
|
||||
define([PROT],[[$*]])
|
||||
|
||||
dnl
|
||||
dnl LOWER(string)
|
||||
dnl lowercase a string
|
||||
define([LOWER],[translit([$*],[ABCDEFGHIJKLMNOPQRSTUVWXYZ],[abcdefghijklmnopqrstuvwxyz])])
|
||||
|
||||
dnl
|
||||
dnl UPPER(string)
|
||||
dnl uppercase a string
|
||||
define([UPPER],[translit([$*],[abcdefghijklmnopqrstuvwxyz],[ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
|
||||
define([UPPER_SAFE],[translit([$*],[abcdefghijklmnopqrstuvwxyz.-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ__])])
|
||||
|
||||
dnl
|
||||
dnl BASENAME(string)
|
||||
dnl extract the basename of a string
|
||||
define([BASENAME],[patsubst([$*],[^.*/],[])])
|
||||
|
||||
dnl
|
||||
dnl M4NAME(string)
|
||||
dnl extract the basename of a string
|
||||
define([M4NAME],[patsubst(BASENAME([$*]),[\.m4$],[])])
|
||||
|
||||
dnl NUM(arg,arg,...)
|
||||
dnl M4 defines $# very badly (empty list=1). So we need a better one
|
||||
define([NUM],[ifelse(len([$*]),0,0,[$#])])
|
||||
|
||||
dnl
|
||||
dnl IF(cond,string1,string2)
|
||||
dnl places string1 if length (without spaces) of cond is zero,
|
||||
dnl else string2
|
||||
define([IF],[ifelse(len(PROT(translit([$1],[ ]))),0,[$3],[$2])])
|
||||
dnl define([IF],[ifelse(len(PROT(patsubst([$1],[ ]))),0,[$3],[$2])])
|
||||
|
||||
dnl
|
||||
dnl minclude(filename)
|
||||
dnl This includes only the macros from a file but throws away the output.
|
||||
dnl Used to take the macros from a file without getting it extra output.
|
||||
define([minclude],[IF([$1],[dnl
|
||||
pushdef([CURRENT_DIVERSION],divnum)dnl
|
||||
divert(-1)
|
||||
include($1)
|
||||
divert(CURRENT_DIVERSION)dnl
|
||||
popdef([CURRENT_DIVERSION])dnl],[[minclude]])])
|
||||
|
||||
dnl
|
||||
dnl makes the current filename into a string approprate for use as
|
||||
dnl C identified define. (Defaults to this library name)
|
||||
dnl
|
||||
dnl example: (filename test.hh.m4)
|
||||
dnl __header__ => SIGCXX_TEST_H
|
||||
dnl __header__(MYHEAD) => MYHEAD_TEST_H
|
||||
dnl define([__header__],[ifelse($1,,[SIGCXX],UPPER($1))[_]UPPER(patsubst(translit(BASENAME(__file__),[.-],[__]),[_m4],[]))])
|
||||
define([__header__],[ifelse($1,,[SIGCXX],UPPER($1))[_]UPPER_SAFE(M4NAME(__file__))])
|
||||
|
||||
dnl
|
||||
dnl Set of M4 macros for variable argument template building
|
||||
dnl
|
||||
|
||||
dnl ARGS(name,number)
|
||||
dnl Builds a comma seperated protected list of numbered names
|
||||
dnl Use this as short hand to specify arguement names
|
||||
dnl
|
||||
dnl ARGS(arg,3) => ARG1,ARG2,ARG3
|
||||
define([_ARGS],[ifelse(eval($2<$3),0,[$1$2],[$1$2,_ARGS($1,eval($2+1),$3)])])
|
||||
define([ARGS],[ifelse(eval($2>0),1,[PROT(_ARGS(UPPER([$1]),1,$2))],[PROT])])
|
||||
|
||||
dnl
|
||||
dnl LIST/C_LIST(string1,cond1,string2,cond2,...)
|
||||
dnl These are intended for making extended argument lists
|
||||
dnl parameters are in pairs, the first is output if the
|
||||
dnl 2nd is nonzero length, the process is then repeated
|
||||
dnl with the next set of arguments.
|
||||
dnl
|
||||
dnl Macro expansions that expand to result in commas must call
|
||||
dnl PROT to prevent permature expansion. ARG* macros do
|
||||
dnl this automatically. (If unsure, add braces until it stops
|
||||
dnl interpreting inter macros, remove one set of braces, if
|
||||
dnl still not right use PROT)
|
||||
dnl
|
||||
dnl C_LIST adds a comma in front
|
||||
dnl (LIST is probably the most useful macro in the set.)
|
||||
define([LIST],[ifelse($#,1,,len([$2]),0,[LIST(shift(shift($@)))],len([$1]),0,[LIST(shift(shift($@)))],[[$1]C_LIST(shift(shift($@)))])])
|
||||
dnl
|
||||
define([C_LIST],[ifelse($#,1,,len([$2]),0,[C_LIST(shift(shift($@)))],len([$1]),0,[C_LIST(shift(shift($@)))],[,[$1]C_LIST(shift(shift($@)))])])
|
||||
|
||||
dnl
|
||||
dnl ARG_LOOP(macro_name,seperator,argument_list)
|
||||
dnl Very powerful macro for construction of list of variables
|
||||
dnl formated in specify ways. To use define a macro taking
|
||||
dnl one variable which is called the format. The second argument
|
||||
dnl is a seperator which will appear between each argument.
|
||||
dnl The rest is then interpreted as arguments to form the list.
|
||||
dnl
|
||||
dnl Example:
|
||||
dnl define([FOO],[foo([$1])])
|
||||
dnl ARG_LOOP([FOO],[[, ]],A,B,C)
|
||||
dnl
|
||||
dnl Gives: foo(A), foo(B), foo(C)
|
||||
dnl
|
||||
define([_ARG_LOOP],[dnl
|
||||
ifelse(NUM($*),0,,NUM($*),1,[dnl
|
||||
indir(LOOP_FORMAT,[$1])],[dnl
|
||||
indir(LOOP_FORMAT,[$1])[]LOOP_SEPERATOR[]_ARG_LOOP(shift($*))])])
|
||||
|
||||
define([ARG_LOOP],[dnl
|
||||
pushdef([LOOP_FORMAT],[[$1]])dnl
|
||||
pushdef([LOOP_SEPERATOR],[$2])dnl
|
||||
_ARG_LOOP(shift(shift($*)))[]dnl
|
||||
popdef([LOOP_FORMAT])dnl
|
||||
popdef([LOOP_SEPERATOR])dnl
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Define some useful formats for use with ARG_LOOP.
|
||||
define([FORMAT_ARG_CLASS],[class [$1]])
|
||||
define([FORMAT_ARG_BOTH],[[$1] LOWER([$1])])
|
||||
define([FORMAT_ARG_REF],[typename Trait<[$1]>::ref LOWER([$1])])
|
||||
define([FORMAT_ARG_TYPE],[[$1]])
|
||||
define([FORMAT_ARG_NAME],[LOWER($1)])
|
||||
define([FORMAT_ARG_CBNAME],[LOWER($1)_])
|
||||
define([FORMAT_ARG_CBDECL],[[$1] LOWER([$1])_;])
|
||||
define([FORMAT_ARG_CBINIT],[LOWER([$1])_(LOWER([$1]))])
|
||||
|
||||
|
||||
dnl
|
||||
dnl The following functions generate various types of parameter lists
|
||||
dnl For parameter lists
|
||||
dnl ARG_CLASS([P1,P2]) -> class P1,class P2
|
||||
dnl ARG_BOTH([P1,P2]) -> P1 p1,P2 p2
|
||||
dnl ARG_TYPE([P1,P2]) -> P1,P2
|
||||
dnl ARG_NAME([P1,P2]) -> p1,p2
|
||||
dnl For callback lists
|
||||
dnl ARG_CBNAME([C1,C2]) -> c1_,c2_
|
||||
dnl ARG_CBINIT([C1,C2]) -> c1_(c1),c2_(c2)
|
||||
dnl ARG_CBDECL([C1,C2]) -> C1 c1_; C2 c2_;
|
||||
dnl
|
||||
define([ARG_CLASS],[PROT(ARG_LOOP([FORMAT_ARG_CLASS],[[,]],$*))])
|
||||
define([ARG_BOTH],[PROT(ARG_LOOP([FORMAT_ARG_BOTH],[[,]],$*))])
|
||||
define([ARG_REF],[PROT(ARG_LOOP([FORMAT_ARG_REF],[[,]],$*))])
|
||||
define([ARG_TYPE],[PROT([$*])])
|
||||
define([ARG_NAME],[PROT(LOWER($*))])
|
||||
define([ARG_CBNAME],[PROT(ARG_LOOP([FORMAT_ARG_CBNAME],[[,]],$*))])
|
||||
define([ARG_CBDECL],[PROT(ARG_LOOP([FORMAT_ARG_CBDECL],[ ],$*))])
|
||||
define([ARG_CBINIT],[PROT(ARG_LOOP([FORMAT_ARG_CBINIT],[[,]],$*))])
|
||||
|
||||
|
||||
dnl
|
||||
dnl C_* - the same with a comma in front
|
||||
dnl (we should obsolete these, LIST is better)
|
||||
define([C_ARG_CLASS], [ifelse(NUM($*),0,,[,ARG_CLASS($*)])])
|
||||
define([C_ARG_BOTH],[ifelse(NUM($*),0,,[,ARG_BOTH($*)])])
|
||||
define([C_ARG_TYPE],[ifelse(NUM($*),0,,[,ARG_TYPE($*)])])
|
||||
define([C_ARG_NAME],[ifelse(NUM($*),0,,[,ARG_NAME($*)])])
|
||||
define([C_ARG_CBNAME],[ifelse(NUM($*),0,,[,ARG_CNAME($*)])])
|
||||
define([C_ARG_CBINIT],[ifelse(NUM($*),0,,[,ARG_INIT($*)])])
|
||||
|
||||
dnl
|
||||
dnl T_DROP(string)
|
||||
dnl Removes unnecessary <> with empty templates
|
||||
dnl (occasionally useful)
|
||||
define([T_DROP],[ifelse([$1],<>,,[$*])])
|
||||
|
||||
dnl
|
||||
dnl DROP(string,drop)
|
||||
dnl Removes unnecessary strings if they match drop
|
||||
dnl (occasionally useful)
|
||||
define([DROP],[ifelse([$1],[$2],,[$*])])
|
||||
|
||||
dnl
|
||||
dnl LINE(linenum)
|
||||
dnl places a #line statement if __debug__ set
|
||||
dnl Use this at top of macro template and following
|
||||
dnl macros that contain newlines.
|
||||
dnl
|
||||
dnl example:
|
||||
dnl LINE(]__line__[)dnl
|
||||
define([LINE],[ifdef([__debug__],[#line $1 "]__file__["
|
||||
])])
|
||||
|
||||
dnl-----------------------------------------------------------------------
|
||||
|
||||
dnl Libsigc++ macros to simpilify typing of internal macros
|
||||
|
||||
define([TYPEDEF_RTYPE],[
|
||||
ifelse($1,void,[dnl
|
||||
typedef void $2;dnl
|
||||
],[dnl
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
typedef $1 $2;
|
||||
#else
|
||||
typedef typename Trait<$1>::type $2;
|
||||
#endif])])
|
||||
|
||||
define([__SLOT__],[dnl
|
||||
ifelse([$2$3],,[Slot0<$1>],
|
||||
[$3],,[Slot[]NUM($2)<$1,$2>],
|
||||
[$2],,[Slot[]NUM($3)<$1,$3>],
|
||||
[Slot[]eval(NUM($2)+NUM($3))<$1,$2,$3>])])
|
||||
|
||||
define([QT_FIREWALL],[dnl
|
||||
// Qt steals a method name.
|
||||
#ifdef SIGC_QT
|
||||
#undef emit
|
||||
#endif
|
||||
|
||||
#ifdef emit
|
||||
#define SIGC_QT
|
||||
#undef emit
|
||||
#endif
|
||||
|
||||
])
|
||||
|
||||
define([END_QT_FIREWALL],[dnl
|
||||
#ifdef SIGC_QT
|
||||
#define emit
|
||||
#endif
|
||||
])
|
||||
|
||||
|
||||
dnl-----------------------------------------------------------------------
|
||||
dnl End of recursion protection. Do not put anything below this line.
|
||||
])
|
||||
divert(DIVERSION)dnl
|
||||
popdef([DIVERSION])dnl
|
38
sigc++/marshal.cc
Normal file
38
sigc++/marshal.cc
Normal file
@ -0,0 +1,38 @@
|
||||
#include <sigc++/marshal.h>
|
||||
#ifdef SIGC_PTHREADS
|
||||
#include <sigc++/thread.h>
|
||||
#endif
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
int ignore_(int value)
|
||||
{
|
||||
#ifdef SIGC_PTHREADS
|
||||
static Threads::Private<int> ignore;
|
||||
#else
|
||||
static int ignore;
|
||||
#endif
|
||||
int rc=ignore;
|
||||
ignore=value;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int RetCode::check_ignore()
|
||||
{
|
||||
return ignore_(0);
|
||||
}
|
||||
|
||||
void RetCode::ignore()
|
||||
{
|
||||
ignore_(1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} /* namespace sigc */
|
||||
#endif
|
||||
|
209
sigc++/marshal.h
Normal file
209
sigc++/marshal.h
Normal file
@ -0,0 +1,209 @@
|
||||
#ifndef SIGCXX_MARSHALLER_H
|
||||
#define SIGCXX_MARSHALLER_H
|
||||
#include <sigc++/sigc++config.h>
|
||||
|
||||
#ifndef SIGC_CXX_PARTIAL_SPEC
|
||||
#include <sigc++/slot.h>
|
||||
#endif
|
||||
|
||||
#ifndef SIGC_CXX_INT_CTOR
|
||||
#include <new>
|
||||
#endif
|
||||
|
||||
#ifdef SIGC_PTHREADS
|
||||
#include <sigc++/thread.h>
|
||||
#endif
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
All classes used to marshal return values should have the following
|
||||
|
||||
class SomeMarshal
|
||||
{
|
||||
// both typedefs must be defined.
|
||||
typedef Type1 InType;
|
||||
typedef Type2 OutType;
|
||||
|
||||
public:
|
||||
// Return final return code.
|
||||
OutType value();
|
||||
|
||||
// Captures return codes and returns TRUE to stop emittion.
|
||||
bool marshal(const InType&);
|
||||
|
||||
SomeMarshal();
|
||||
};
|
||||
|
||||
It is not necessary for the InType to match the OutType.
|
||||
This is to allow for things like list capturing.
|
||||
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
***** Marshal
|
||||
*******************************************************************/
|
||||
|
||||
// A struct that holds an flag for determining
|
||||
// if the return value is to be ignored.
|
||||
class LIBSIGC_API RetCode
|
||||
{
|
||||
public:
|
||||
static int check_ignore();
|
||||
static void ignore();
|
||||
};
|
||||
|
||||
// Basic Marshal class.
|
||||
template <typename R>
|
||||
class Marshal
|
||||
{
|
||||
public:
|
||||
typedef R OutType;
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
typedef R InType;
|
||||
protected:
|
||||
typedef OutType OutType_;
|
||||
#else
|
||||
typedef Trait<R>::type InType;
|
||||
protected:
|
||||
typedef InType OutType_;
|
||||
#endif
|
||||
OutType_ value_;
|
||||
public:
|
||||
OutType_& value() {return value_;}
|
||||
|
||||
static OutType_ default_value()
|
||||
#ifdef SIGC_CXX_INT_CTOR
|
||||
{return OutType_();}
|
||||
#else
|
||||
{OutType_ r; new (&r) OutType_(); return r;}
|
||||
#endif
|
||||
|
||||
// This captures return values. Return TRUE to stop emittion process.
|
||||
bool marshal(const InType& newval)
|
||||
{
|
||||
if (!RetCode::check_ignore()) value_=newval;
|
||||
return 0; // continue emittion process
|
||||
};
|
||||
Marshal()
|
||||
#ifdef SIGC_CXX_INT_CTOR
|
||||
:value_()
|
||||
{RetCode::check_ignore();}
|
||||
#else
|
||||
{
|
||||
RetCode::check_ignore();
|
||||
new (&value_) OutType_();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef SIGC_CXX_SPECIALIZE_REFERENCES
|
||||
// Basic Marshal class.
|
||||
template <typename R>
|
||||
class Marshal<R&>
|
||||
{
|
||||
public:
|
||||
typedef R& OutType;
|
||||
typedef R& InType;
|
||||
R* value_;
|
||||
OutType value() {return value_;}
|
||||
static OutType default_value() {return Default;}
|
||||
static R Default;
|
||||
|
||||
// This captures return values. Return TRUE to stop emittion process.
|
||||
bool marshal(InType newval)
|
||||
{
|
||||
if (!RetCode::check_ignore()) value_=&newval;
|
||||
return 0; // continue emittion process
|
||||
};
|
||||
Marshal()
|
||||
:value_(&Default)
|
||||
{RetCode::check_ignore();}
|
||||
~Marshal()
|
||||
{}
|
||||
};
|
||||
|
||||
template <typename T> T Marshal<T&>::Default;
|
||||
#endif
|
||||
|
||||
#ifdef SIGC_CXX_PARTIAL_SPEC
|
||||
// dummy marshaller for void type.
|
||||
template <>
|
||||
class Marshal<void>
|
||||
{
|
||||
public:
|
||||
Marshal()
|
||||
{}
|
||||
~Marshal()
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// starts with a fixed value
|
||||
template <class R,R initial>
|
||||
class FixedMarshal
|
||||
{
|
||||
public:
|
||||
typedef R OutType;
|
||||
typedef R InType;
|
||||
R value_;
|
||||
OutType& value() {return value_;}
|
||||
static OutType default_value() { return initial; }
|
||||
|
||||
bool marshal(const InType& newval)
|
||||
{
|
||||
if (!RetCode::check_ignore()) value_=newval;
|
||||
return 0; // continue emittion process
|
||||
};
|
||||
|
||||
FixedMarshal()
|
||||
:value_(initial)
|
||||
{RetCode::check_ignore();}
|
||||
~FixedMarshal()
|
||||
{}
|
||||
};
|
||||
|
||||
template <class R>
|
||||
struct FastMarshal
|
||||
{
|
||||
typedef R OutType;
|
||||
typedef R InType;
|
||||
|
||||
R value_;
|
||||
OutType& value() {return value_;}
|
||||
static OutType default_value()
|
||||
#ifdef SIGC_CXX_INT_CTOR
|
||||
{return R();}
|
||||
#else
|
||||
{R r; new (&r) R(); return r;}
|
||||
#endif
|
||||
|
||||
bool marshal(const InType& newval)
|
||||
{
|
||||
value_=newval;
|
||||
return 0; // continue emittion process
|
||||
};
|
||||
|
||||
FastMarshal()
|
||||
#ifdef SIGC_CXX_INT_CTOR
|
||||
:value_()
|
||||
{}
|
||||
#else
|
||||
{new (&value_) R();}
|
||||
#endif
|
||||
~FastMarshal()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace sigc
|
||||
#endif
|
||||
|
||||
#endif
|
176
sigc++/object.cc
Normal file
176
sigc++/object.cc
Normal file
@ -0,0 +1,176 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <sigc++/object.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif // SIGC_CXX_NAMESPACES
|
||||
|
||||
int sigc_major_version=SIGC_MAJOR_VERSION;
|
||||
int sigc_minor_version=SIGC_MINOR_VERSION;
|
||||
int sigc_micro_version=SIGC_MICRO_VERSION;
|
||||
|
||||
ObjectReferenced::ObjectReferenced():
|
||||
obj_count_(0),
|
||||
obj_dynamic_(0),obj_owned_(1),obj_floating_(1),obj_transfer_(0),
|
||||
obj_invalid_(0),obj_destroyed_(0),obj_weak_(0)
|
||||
{}
|
||||
|
||||
ObjectScoped::ObjectScoped():list_()
|
||||
{}
|
||||
|
||||
ObjectReferenced::~ObjectReferenced()
|
||||
{}
|
||||
|
||||
ObjectScoped::~ObjectScoped()
|
||||
{
|
||||
// we can't be destroyed again.
|
||||
obj_destroyed_=1;
|
||||
|
||||
// trash the list.
|
||||
invalid(1);
|
||||
}
|
||||
|
||||
void ObjectReferenced::reference()
|
||||
{
|
||||
// if we exceed the int limit, we should unset dynamic_
|
||||
if (!(++obj_count_))
|
||||
obj_dynamic_=0;
|
||||
}
|
||||
|
||||
void ObjectReferenced::unreference()
|
||||
{
|
||||
if (obj_count_
|
||||
&& (!--obj_count_)
|
||||
&& obj_dynamic_
|
||||
&& !obj_floating_
|
||||
&& !obj_destroyed_
|
||||
)
|
||||
{
|
||||
obj_destroyed_=1;
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectScoped::register_data(ScopeNode *data)
|
||||
{
|
||||
list_.insert_direct(list_.end(),data);
|
||||
};
|
||||
|
||||
void ObjectScoped::register_scope(Scope *scope,const Scope *parent)
|
||||
{
|
||||
if (!scope) return;
|
||||
|
||||
// check for invalid in progress
|
||||
if (obj_invalid_)
|
||||
return;
|
||||
|
||||
// reregistering a scope
|
||||
if (scope->obj_==this)
|
||||
{
|
||||
if (obj_transfer_&&(ScopeNode*)parent==list_.begin().node())
|
||||
{list_.swap_elements(const_cast<Scope*>(parent),scope);
|
||||
obj_transfer_=0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj_transfer_&&(ScopeNode*)parent==list_.begin().node())
|
||||
{
|
||||
list_.insert_direct(list_.begin(),scope);
|
||||
obj_transfer_=0;
|
||||
}
|
||||
else
|
||||
list_.insert_direct(list_.end(),scope);
|
||||
|
||||
// complete connection
|
||||
scope->obj_=this;
|
||||
scope->on_connect();
|
||||
}
|
||||
|
||||
void ObjectScoped::unregister_scope(Scope *scope)
|
||||
{
|
||||
if (!scope) return;
|
||||
|
||||
// Check for loss of ownership
|
||||
if (obj_owned_&&(ScopeNode*)scope==list_.begin().node())
|
||||
obj_owned_=0;
|
||||
|
||||
list_.erase(scope);
|
||||
scope->obj_=0;
|
||||
}
|
||||
|
||||
void ObjectScoped::set_weak()
|
||||
{
|
||||
if (obj_weak_) return;
|
||||
obj_weak_=1;
|
||||
reference();
|
||||
}
|
||||
|
||||
struct Invalid_
|
||||
{
|
||||
ObjectReferenced* r_;
|
||||
Invalid_(ObjectReferenced& r): r_(&r)
|
||||
{
|
||||
r_->obj_invalid_=1;
|
||||
r_->reference();
|
||||
}
|
||||
~Invalid_()
|
||||
{
|
||||
r_->obj_invalid_=0;
|
||||
r_->unreference();
|
||||
}
|
||||
};
|
||||
|
||||
void ObjectScoped::invalid(bool level)
|
||||
{
|
||||
if (!level&&(obj_invalid_||!obj_dynamic_))
|
||||
return;
|
||||
|
||||
List_::Iterator current=list_.begin();
|
||||
List_::Iterator next=current;
|
||||
if (current==list_.end()&&!obj_weak_)
|
||||
return;
|
||||
|
||||
Invalid_ r(*this);
|
||||
|
||||
if (obj_weak_)
|
||||
{
|
||||
obj_weak_=0;
|
||||
unreference();
|
||||
}
|
||||
|
||||
while (current!=(list_.end()))
|
||||
{
|
||||
++next;
|
||||
(*current).disconnect(level);
|
||||
current=next;
|
||||
}
|
||||
}
|
||||
|
||||
Object::~Object()
|
||||
{}
|
||||
|
||||
void ObjectReferenced::set_dynamic() {obj_dynamic_=1;}
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif // SIGC_CXX_NAMESPACES
|
153
sigc++/object.h
Normal file
153
sigc++/object.h
Normal file
@ -0,0 +1,153 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#ifndef SIGCXX_OBJECT_H
|
||||
#define SIGCXX_OBJECT_H
|
||||
#include <sigc++/sigc++config.h>
|
||||
#include <sigc++/scope.h>
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
extern int sigc_micro_version;
|
||||
extern int sigc_minor_version;
|
||||
extern int sigc_major_version;
|
||||
|
||||
class Invalid_;
|
||||
class LIBSIGC_API ObjectReferenced
|
||||
{
|
||||
friend class Reference;
|
||||
friend class Scope;
|
||||
friend class Invalid_;
|
||||
|
||||
#ifdef SIGC_CXX_FRIEND_TEMPLATES
|
||||
template <class T>
|
||||
friend T* manage(T*);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// count of current references
|
||||
unsigned int obj_count_ :24;
|
||||
|
||||
// indicates object generated through an interface that marks dynamic
|
||||
unsigned int obj_dynamic_ :1;
|
||||
|
||||
// indicates the pointed to scope is the owner
|
||||
unsigned int obj_owned_ :1;
|
||||
|
||||
// indicates object not will delete when count reachs zero
|
||||
unsigned int obj_floating_ :1;
|
||||
|
||||
// indicates the owned scope is surrendering ownership
|
||||
unsigned int obj_transfer_ :1;
|
||||
|
||||
// indicates the object is doing a list clean up
|
||||
unsigned int obj_invalid_ :1;
|
||||
|
||||
// indicates the object been destroyed
|
||||
unsigned int obj_destroyed_ :1;
|
||||
|
||||
// indicates there is a weak reference
|
||||
unsigned int obj_weak_ :1;
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
#ifdef SIGC_CXX_FRIEND_TEMPLATES
|
||||
protected:
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
// For the controller and scope
|
||||
virtual void set_dynamic();
|
||||
inline void set_sink() {obj_floating_=0;}
|
||||
|
||||
protected:
|
||||
|
||||
inline void register_ref(Reference *)
|
||||
{
|
||||
if (obj_transfer_)
|
||||
{
|
||||
obj_transfer_=0;
|
||||
obj_owned_=0;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void reference();
|
||||
virtual void unreference();
|
||||
|
||||
inline bool is_dynamic() {return obj_dynamic_;}
|
||||
inline bool is_floating() {return obj_floating_;}
|
||||
|
||||
ObjectReferenced();
|
||||
virtual ~ObjectReferenced();
|
||||
};
|
||||
|
||||
|
||||
class LIBSIGC_API ObjectScoped :public ObjectReferenced
|
||||
{
|
||||
friend class Scope;
|
||||
typedef ScopeList List_;
|
||||
|
||||
private:
|
||||
mutable List_ list_;
|
||||
|
||||
// interface for scopes
|
||||
void register_scope(Scope *scope,const Scope *parent=0);
|
||||
void unregister_scope(Scope *scope);
|
||||
|
||||
protected:
|
||||
// This sets a very weak reference which is removed at next invalid
|
||||
void set_weak();
|
||||
|
||||
public:
|
||||
void register_data(ScopeNode* data);
|
||||
|
||||
// inform connections that object wishs to delete
|
||||
void invalid(bool destroy=0);
|
||||
|
||||
ObjectScoped();
|
||||
virtual ~ObjectScoped();
|
||||
};
|
||||
|
||||
|
||||
// There can only be one Scope_Object per any object
|
||||
class LIBSIGC_API Object: public virtual ObjectScoped
|
||||
{
|
||||
public:
|
||||
Object() {}
|
||||
virtual ~Object();
|
||||
};
|
||||
|
||||
// mark this a managable object
|
||||
template <class T>
|
||||
inline T* manage(T* t)
|
||||
{
|
||||
if (t) t->set_dynamic();
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif
|
280
sigc++/scope.cc
Normal file
280
sigc++/scope.cc
Normal file
@ -0,0 +1,280 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <sigc++/scope.h>
|
||||
#include <sigc++/object.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif //SIGC_CXX_NAMESPACES
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
Reference::~Reference() {if (obj_) obj_->unreference();}
|
||||
void Reference::set_sink() {if (obj_) obj_->set_sink();}
|
||||
|
||||
void Reference::init(ObjectReferenced *obj)
|
||||
{
|
||||
obj_=obj;
|
||||
cache_=0;
|
||||
if (obj_)
|
||||
{
|
||||
obj_->register_ref(this);
|
||||
obj_->reference();
|
||||
}
|
||||
}
|
||||
|
||||
void Reference::set(ObjectReferenced *obj,void* cache,bool is_ptr)
|
||||
{
|
||||
if (obj_==obj)
|
||||
return;
|
||||
if (obj_) obj_->unreference();
|
||||
obj_=obj;
|
||||
cache_=cache;
|
||||
if (obj_)
|
||||
{
|
||||
obj_->register_ref(this);
|
||||
obj_->reference();
|
||||
if (is_ptr) obj_->set_sink();
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
// object interaction properties
|
||||
void Scope::reference() {if (obj_) obj_->reference();}
|
||||
void Scope::unreference() {if (obj_) obj_->unreference();}
|
||||
void Scope::set_sink() {if (obj_) obj_->set_sink();}
|
||||
|
||||
void Scope::invalid()
|
||||
{
|
||||
if (obj_)
|
||||
object()->invalid();
|
||||
}
|
||||
|
||||
void Scope::register_scope(ObjectScoped *obj)
|
||||
{
|
||||
if (obj)
|
||||
obj->register_scope(this);
|
||||
}
|
||||
|
||||
void Scope::register_scope(const Scope *parent)
|
||||
{
|
||||
if (parent&&parent->obj_)
|
||||
parent->object()->register_scope(this,parent);
|
||||
}
|
||||
|
||||
void Scope::unregister_scope()
|
||||
{
|
||||
if (obj_)
|
||||
object()->unregister_scope(this);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
// object interaction properties
|
||||
void Scope::set(ObjectScoped *obj,void* cache,bool)
|
||||
{
|
||||
if (obj_==obj)
|
||||
return;
|
||||
unregister_scope();
|
||||
register_scope(obj);
|
||||
cache_=(obj_?cache:0);
|
||||
}
|
||||
|
||||
void ScopeNode::disconnect(bool dummy)
|
||||
{}
|
||||
|
||||
void Scope::erase()
|
||||
{
|
||||
obj_=0;
|
||||
cache_=0;
|
||||
}
|
||||
|
||||
Scope::~Scope()
|
||||
{}
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
// These are here because they are virtual
|
||||
|
||||
void Scopes::Uncounted::disconnect(bool l)
|
||||
{
|
||||
unregister_scope();
|
||||
}
|
||||
|
||||
Scopes::Uncounted::~Uncounted()
|
||||
{
|
||||
disconnect();
|
||||
}
|
||||
|
||||
void Scopes::Extend::set(ObjectScoped *obj,void* cache,bool is_ptr)
|
||||
{
|
||||
Scope::set(obj,cache,is_ptr);
|
||||
if (is_ptr) set_sink();
|
||||
}
|
||||
|
||||
void Scopes::Extend::on_connect()
|
||||
{
|
||||
reference();
|
||||
}
|
||||
|
||||
void Scopes::Extend::erase()
|
||||
{
|
||||
unreference();
|
||||
Scope::erase();
|
||||
}
|
||||
|
||||
void Scopes::Extend::disconnect(bool l)
|
||||
{
|
||||
unregister_scope();
|
||||
}
|
||||
|
||||
Scopes::Extend::~Extend()
|
||||
{
|
||||
disconnect();
|
||||
}
|
||||
|
||||
void Scopes::Limit::set(ObjectScoped *obj,void* cache,bool is_ptr)
|
||||
{
|
||||
Scope::set(obj,cache,is_ptr);
|
||||
if (is_ptr) set_sink();
|
||||
}
|
||||
|
||||
void Scopes::Limit::on_connect()
|
||||
{
|
||||
reference();
|
||||
}
|
||||
|
||||
void Scopes::Limit::erase()
|
||||
{
|
||||
unreference();
|
||||
Scope::erase();
|
||||
}
|
||||
|
||||
void Scopes::Limit::disconnect(bool l)
|
||||
{
|
||||
invalid();
|
||||
unregister_scope();
|
||||
}
|
||||
|
||||
Scopes::Limit::~Limit()
|
||||
{
|
||||
disconnect();
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
inline void splice_node(ScopeNode *n1,ScopeNode *n2)
|
||||
{
|
||||
n1->next_=n2;
|
||||
n2->prev_=n1;
|
||||
}
|
||||
|
||||
inline void unlink_node(ScopeNode *n)
|
||||
{
|
||||
if (n->next_==n) return;
|
||||
splice_node(n->prev_,n->next_);
|
||||
n->prev_=n->next_=n;
|
||||
}
|
||||
|
||||
void ScopeNode::remove_self() {unlink_node(this);}
|
||||
ScopeNode::~ScopeNode() {unlink_node(this);}
|
||||
void ScopeNode::erase() {}
|
||||
|
||||
DataNode::~DataNode() {}
|
||||
void DataNode::erase() {delete this;}
|
||||
|
||||
|
||||
|
||||
ScopeIterator_ ScopeList::insert_direct(Iterator pos,NodeType *tmp)
|
||||
{
|
||||
if (!tmp) return tmp;
|
||||
NodeType *after=pos.node();
|
||||
NodeType *before=(NodeType*)(after->prev_);
|
||||
|
||||
splice_node(before,tmp);
|
||||
splice_node(tmp,after);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
ScopeIterator_ ScopeList::erase(Iterator pos)
|
||||
{
|
||||
NodeType* loc=pos.node();
|
||||
Iterator tmp=pos;
|
||||
if (!loc) return tmp;
|
||||
++tmp;
|
||||
|
||||
unlink_node(loc);
|
||||
loc->erase();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void ScopeList::swap_elements(Iterator p1,Iterator p2)
|
||||
{
|
||||
NodeType *loc1=p1.node();
|
||||
NodeType *loc2=p2.node();
|
||||
|
||||
if (!loc1||!loc2) return;
|
||||
|
||||
NodeType *before1=(NodeType*)loc1->prev_;
|
||||
NodeType *after1=(NodeType*)loc1->next_;
|
||||
NodeType *before2=(NodeType*)loc2->prev_;
|
||||
NodeType *after2=(NodeType*)loc2->next_;
|
||||
|
||||
if (before1==loc1)
|
||||
{
|
||||
// loc1 is a stray?
|
||||
if (before2==loc2) return;
|
||||
splice_node(loc2,loc2);
|
||||
splice_node(before2,loc1);
|
||||
splice_node(loc1,after2);
|
||||
return;
|
||||
}
|
||||
if (before2==loc2)
|
||||
{
|
||||
// loc2 is a stray?
|
||||
splice_node(loc1,loc1);
|
||||
splice_node(before1,loc2);
|
||||
splice_node(loc2,after1);
|
||||
return;
|
||||
}
|
||||
if (loc1==before2)
|
||||
{// loc1 is right before loc2
|
||||
splice_node(before1,loc2);
|
||||
splice_node(loc2,loc1);
|
||||
splice_node(loc1,after2);
|
||||
return;
|
||||
}
|
||||
if (loc2==before1)
|
||||
{// loc2 is right before loc1
|
||||
splice_node(before2,loc1);
|
||||
splice_node(loc1,loc2);
|
||||
splice_node(loc2,after1);
|
||||
return;
|
||||
}
|
||||
|
||||
splice_node(before1,loc2);
|
||||
splice_node(loc2,after1);
|
||||
splice_node(before2,loc1);
|
||||
splice_node(loc1,after2);
|
||||
}
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif
|
291
sigc++/scope.h
Normal file
291
sigc++/scope.h
Normal file
@ -0,0 +1,291 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#ifndef SIGCXX_SCOPE_H
|
||||
#define SIGCXX_SCOPE_H
|
||||
#include <sigc++/sigc++config.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
struct LIBSIGC_API ScopeNode
|
||||
{
|
||||
mutable ScopeNode *prev_;
|
||||
mutable ScopeNode *next_;
|
||||
|
||||
// removes self from list
|
||||
void remove_self();
|
||||
|
||||
// Called to inform the item that it is erased
|
||||
virtual void erase();
|
||||
|
||||
// inform scopes that invalid requested.
|
||||
virtual void disconnect(bool destroy=0);
|
||||
|
||||
ScopeNode()
|
||||
#ifdef LIBSIGC_WIN32
|
||||
{prev_=next_=this;}
|
||||
#else
|
||||
:prev_(this),next_(this) {}
|
||||
#endif
|
||||
|
||||
virtual ~ScopeNode();
|
||||
|
||||
private:
|
||||
ScopeNode& operator=(const ScopeNode&);
|
||||
ScopeNode(const ScopeNode&);
|
||||
};
|
||||
|
||||
struct LIBSIGC_API DataNode: public ScopeNode
|
||||
{
|
||||
virtual void erase();
|
||||
virtual ~DataNode();
|
||||
};
|
||||
|
||||
/*******************************************************************
|
||||
***** Basis Scope
|
||||
*******************************************************************/
|
||||
class ObjectScoped;
|
||||
class ObjectReferenced;
|
||||
class Object;
|
||||
class Scope;
|
||||
|
||||
class LIBSIGC_API Reference
|
||||
{
|
||||
protected:
|
||||
mutable ObjectReferenced* obj_;
|
||||
mutable void* cache_;
|
||||
|
||||
public:
|
||||
void set_sink();
|
||||
|
||||
void init(ObjectReferenced* obj);
|
||||
void set(ObjectReferenced* obj,void* cache=0,bool ptr=false);
|
||||
|
||||
Reference& operator=(ObjectReferenced *obj) { set(obj); return *this; }
|
||||
Reference& operator=(ObjectReferenced &obj) { set(&obj); return *this; }
|
||||
Reference& operator=(const Reference& ref) { set(ref.obj_); return *this; };
|
||||
|
||||
ObjectReferenced* object() const {return obj_;}
|
||||
void* cache() const {return cache_;}
|
||||
|
||||
Reference():obj_(0) {}
|
||||
Reference(ObjectReferenced &obj)
|
||||
{init(&obj);}
|
||||
Reference(const Reference& ref)
|
||||
{init(ref.obj_);}
|
||||
~Reference();
|
||||
};
|
||||
|
||||
class LIBSIGC_API Scope:public ScopeNode
|
||||
{
|
||||
friend class ObjectScoped;
|
||||
|
||||
Scope& operator=(const Scope& scope);
|
||||
Scope(const Scope& scope);
|
||||
|
||||
protected:
|
||||
void set(ObjectScoped* obj,void* cache,bool ptr);
|
||||
mutable ObjectScoped* obj_;
|
||||
mutable void* cache_;
|
||||
|
||||
virtual void on_connect()=0;
|
||||
virtual void erase();
|
||||
|
||||
void register_scope(ObjectScoped *);
|
||||
void register_scope(const Scope *parent=0);
|
||||
void unregister_scope();
|
||||
|
||||
public:
|
||||
|
||||
void reference();
|
||||
void unreference();
|
||||
void set_sink();
|
||||
|
||||
ObjectScoped* object() const {return (ObjectScoped*)(obj_);}
|
||||
void* cache() const {return cache_;}
|
||||
|
||||
// Inform object it should invalidate its list.
|
||||
void invalid();
|
||||
|
||||
Scope():obj_(0),cache_(0) {}
|
||||
virtual ~Scope();
|
||||
};
|
||||
|
||||
|
||||
/******************************************************
|
||||
**** Common Scopes
|
||||
*******************************************************
|
||||
Available Scopes:
|
||||
Uncounted - non-reference
|
||||
Limit - Limits the lifetime of object to this scope
|
||||
Sinks object.
|
||||
Extend - Extends the lifetime of the object to this scope
|
||||
Sinks object.
|
||||
LimitOwned - Conditionally limits the lifetime of object
|
||||
Sinks object.
|
||||
FuncRef - Extends the lifetime, without sink
|
||||
(intended for functions)
|
||||
Reference - Extends the lifetime, with sink
|
||||
|
||||
AutoPtr - Shorthand for auto_ptr like scope.
|
||||
RefCount - Shorthand for ref_ptr like scope.
|
||||
|
||||
******************************************************/
|
||||
struct Scopes
|
||||
{
|
||||
|
||||
class LIBSIGC_API Uncounted:public Scope
|
||||
{
|
||||
Uncounted& operator=(const Uncounted&);
|
||||
Uncounted(const Uncounted&);
|
||||
public:
|
||||
virtual void disconnect(bool level=0);
|
||||
Uncounted():Scope() {}
|
||||
virtual ~Uncounted();
|
||||
};
|
||||
|
||||
class LIBSIGC_API Extend:public Scope
|
||||
{
|
||||
Extend& operator=(const Extend&);
|
||||
Extend(const Extend&);
|
||||
protected:
|
||||
virtual void on_connect();
|
||||
virtual void erase();
|
||||
public:
|
||||
virtual void disconnect(bool level=0);
|
||||
void set(ObjectScoped* obj,void* cache,bool ptr);
|
||||
Extend():Scope() {}
|
||||
virtual ~Extend();
|
||||
};
|
||||
|
||||
class LIBSIGC_API Limit:public Scope
|
||||
{
|
||||
Limit& operator=(const Limit&);
|
||||
Limit(const Limit&);
|
||||
protected:
|
||||
virtual void on_connect();
|
||||
virtual void erase();
|
||||
public:
|
||||
virtual void disconnect(bool level=0);
|
||||
void set(ObjectScoped* obj,void* cache,bool ptr);
|
||||
Limit():Scope() {}
|
||||
virtual ~Limit();
|
||||
};
|
||||
|
||||
typedef Extend RefCount;
|
||||
typedef Reference Lock;
|
||||
};
|
||||
|
||||
/*************************************************************
|
||||
***** Lists
|
||||
*************************************************************/
|
||||
// Stub for building polylists
|
||||
|
||||
|
||||
// Iterator skeleton
|
||||
struct LIBSIGC_API ScopeIterator_
|
||||
{
|
||||
typedef ScopeNode NodeType;
|
||||
private:
|
||||
NodeType *node_;
|
||||
public:
|
||||
|
||||
inline NodeType* node() {return node_;}
|
||||
inline const NodeType* node() const {return node_;}
|
||||
|
||||
inline NodeType& operator*()
|
||||
{return *node_;
|
||||
}
|
||||
inline const NodeType& operator*() const
|
||||
{return *node_;
|
||||
}
|
||||
|
||||
inline bool operator==(const ScopeIterator_& i) const
|
||||
{return node_==i.node_;
|
||||
}
|
||||
inline bool operator!=(const ScopeIterator_& i) const
|
||||
{return node_!=i.node_;
|
||||
}
|
||||
|
||||
inline ScopeIterator_& operator++()
|
||||
{
|
||||
if (node_)
|
||||
node_=(NodeType*)node_->next_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ScopeIterator_ operator++(int)
|
||||
{
|
||||
ScopeIterator_ tmp=*this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
ScopeIterator_& operator= (const ScopeIterator_& i)
|
||||
{
|
||||
node_=i.node_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ScopeIterator_(const ScopeIterator_ &n):node_(n.node_) {}
|
||||
ScopeIterator_(NodeType *n):node_(n) {}
|
||||
ScopeIterator_():node_(0) {}
|
||||
};
|
||||
|
||||
class LIBSIGC_API ScopeList
|
||||
{
|
||||
public:
|
||||
typedef ScopeNode NodeType;
|
||||
typedef ScopeIterator_ Iterator;
|
||||
|
||||
ScopeNode node_;
|
||||
|
||||
inline Iterator begin() {return Iterator(node_.next_);}
|
||||
inline Iterator end() {return Iterator(&node_);}
|
||||
|
||||
// insert item directly on list
|
||||
Iterator insert_direct(Iterator pos,NodeType *n);
|
||||
|
||||
Iterator erase(Iterator pos);
|
||||
void erase(Iterator start,Iterator stop)
|
||||
{ while (start!=stop) start=erase(start); }
|
||||
void swap_elements(Iterator p1,Iterator p2);
|
||||
|
||||
void clear()
|
||||
{ erase(begin(),end()); }
|
||||
|
||||
bool empty() const {return node_.next_==&node_;}
|
||||
|
||||
ScopeList():node_() {}
|
||||
~ScopeList() { clear(); }
|
||||
|
||||
private:
|
||||
ScopeList(const ScopeList&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace sigc
|
||||
#endif
|
||||
|
||||
#endif
|
232
sigc++/sigc-config.in
Normal file
232
sigc++/sigc-config.in
Normal file
@ -0,0 +1,232 @@
|
||||
#!/bin/sh
|
||||
|
||||
af_libs=
|
||||
af_cflags=
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
|
||||
|
||||
##
|
||||
## Define usage()
|
||||
##
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: sigc-config [OPTIONS] [LIBRARIES]
|
||||
Options:
|
||||
--cflags print pre-processor and compiler flags
|
||||
--libs print library linking information
|
||||
--libs-dirs only print the -L/-R part of --libs
|
||||
--libs-names only print the -l part of --libs
|
||||
--help display this help and exit
|
||||
--macros print the path to m4 macros
|
||||
|
||||
--prefix[=DIR]
|
||||
--exec_prefix[=DIR]
|
||||
--version output sigc version information
|
||||
Libraries:
|
||||
sigc
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
##
|
||||
## Process options
|
||||
##
|
||||
parse()
|
||||
{
|
||||
# we must be called with at least one argument
|
||||
if test $# -eq 0; then
|
||||
usage 1 1>&2
|
||||
fi
|
||||
|
||||
# at least one option should be selected
|
||||
case "$1" in
|
||||
--*)
|
||||
;;
|
||||
*)
|
||||
usage 1 1>&2
|
||||
;;
|
||||
esac
|
||||
|
||||
# grab all -- arguments
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) af_optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) af_optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--help)
|
||||
usage 0 0>&2
|
||||
;;
|
||||
--cflags)
|
||||
af_echo_cflags=yes
|
||||
;;
|
||||
--libs)
|
||||
af_echo_libs_L=yes
|
||||
af_echo_libs_l=yes
|
||||
;;
|
||||
--libs-dirs)
|
||||
af_echo_libs_L=yes
|
||||
;;
|
||||
--libs-names)
|
||||
af_echo_libs_l=yes
|
||||
;;
|
||||
--macros*)
|
||||
|
||||
echo -I @prefix@/include/sigc++/macros
|
||||
exit
|
||||
|
||||
;;
|
||||
--prefix=*)
|
||||
prefix=$af_optarg
|
||||
af_prefix_set=yes
|
||||
;;
|
||||
--prefix)
|
||||
af_echo_prefix=yes
|
||||
;;
|
||||
--exec_prefix=*)
|
||||
exec_prefix=$af_optarg
|
||||
af_exec_prefix_set=yes
|
||||
;;
|
||||
--exec_prefix)
|
||||
af_echo_exec_prefix=yes
|
||||
;;
|
||||
--version)
|
||||
af_echo_version=yes
|
||||
;;
|
||||
--*)
|
||||
usage 1 1>&2
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# if we have a default library use it
|
||||
if test $# -eq 0; then
|
||||
if test "X$af_lib_default" != "X"; then
|
||||
af_lib__AF_LIB_DEFAULT=yes
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
sigc)
|
||||
af_lib_sigc=yes
|
||||
;;
|
||||
*)
|
||||
usage 1 1>&2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
print_result()
|
||||
{
|
||||
if test "X$af_echo_cflags" = "Xyes"; then
|
||||
af_all_flags="$af_cflags"
|
||||
fi
|
||||
|
||||
if test "X$af_echo_libs_L" = "Xyes" || test "X$af_echo_libs_l" = "Xyes"; then
|
||||
af_all_flags="$af_all_flags $af_libs"
|
||||
fi
|
||||
|
||||
if test -z "$af_all_flags" || test "X$af_all_flags" = "X "; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Straight out any possible duplicates, but be careful to
|
||||
# get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz'
|
||||
af_other_flags=
|
||||
af_lib_L_flags=
|
||||
af_rev_libs=
|
||||
for i in $af_all_flags; do
|
||||
case "$i" in
|
||||
# a library, save it for later, in reverse order
|
||||
-l*) af_rev_libs="$i $af_rev_libs" ;;
|
||||
-L*|-R*)
|
||||
if test "X$af_echo_libs_L" = "Xyes"; then
|
||||
case " $af_lib_L_flags " in
|
||||
*\ $i\ *) ;; # already there
|
||||
*) af_lib_L_flags="$af_lib_L_flags $i" ;; # add it to output
|
||||
esac
|
||||
fi;;
|
||||
*)
|
||||
case " $af_other_flags " in
|
||||
*\ $i\ *) ;; # already there
|
||||
*) af_other_flags="$af_other_flags $i" ;; # add it to output
|
||||
esac ;;
|
||||
esac
|
||||
done
|
||||
|
||||
af_ord_libs=
|
||||
if test "X$af_echo_libs_l" = "Xyes"; then
|
||||
for i in $af_rev_libs; do
|
||||
case " $af_ord_libs " in
|
||||
*\ $i\ *) ;; # already there
|
||||
*) af_ord_libs="$i $af_ord_libs" ;; # add it to output in reverse order
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
echo $af_other_flags $af_lib_L_flags $af_ord_libs
|
||||
}
|
||||
|
||||
##
|
||||
## Main Body
|
||||
##
|
||||
|
||||
parse $*
|
||||
|
||||
|
||||
##
|
||||
## Initialize names
|
||||
##
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if test "X$af_echo_prefix" = "Xyes"; then
|
||||
echo $prefix
|
||||
fi
|
||||
|
||||
if test "X$af_echo_exec_prefix" = "Xyes"; then
|
||||
echo $exec_prefix
|
||||
fi
|
||||
|
||||
if test "X$af_echo_version" = "Xyes"; then
|
||||
echo @SIGC_VERSION@
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
##
|
||||
## Libraries
|
||||
##
|
||||
|
||||
#dummy because this should always be selected
|
||||
|
||||
|
||||
if test "@includedir@" != /usr/include ; then
|
||||
includes="-I@includedir@"
|
||||
fi
|
||||
if test "@libdir@" != /usr/lib ; then
|
||||
libs="-L@libdir@"
|
||||
fi
|
||||
af_cflags="$af_cflags -I@libdir@/sigc++/include $includes"
|
||||
af_libs="$libs -lsigc @THREAD_LIB@ $af_libs"
|
||||
|
||||
|
||||
|
||||
|
||||
print_result
|
||||
|
||||
exit 0
|
||||
|
36
sigc++/signal_system.h
Normal file
36
sigc++/signal_system.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*************************************************************************
|
||||
***** A Signal Framework for C++
|
||||
**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
|
||||
Based off of ideas from Gtk-- signal system by Tero Pulkkinen.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef SIGCXX_SIGNAL_SYSTEM_H
|
||||
#define SIGCXX_SIGNAL_SYSTEM_H
|
||||
|
||||
#include <sigc++/slot.h>
|
||||
#include <sigc++/object_slot.h>
|
||||
#include <sigc++/func_slot.h>
|
||||
#include <sigc++/basic_signal.h>
|
||||
#if 0
|
||||
#include <sigc++/signals.h>
|
||||
#endif
|
||||
|
||||
#endif
|
80
sigc++/slot.cc
Normal file
80
sigc++/slot.cc
Normal file
@ -0,0 +1,80 @@
|
||||
#include <sigc++/slot.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif // SIGC_CXX_NAMESPACES
|
||||
|
||||
SlotDependent::~SlotDependent()
|
||||
{}
|
||||
|
||||
SlotDependent::Dep::~Dep()
|
||||
{}
|
||||
|
||||
SlotNode::SlotNode(void):next_(0)
|
||||
{}
|
||||
|
||||
SlotNode::~SlotNode(void)
|
||||
{}
|
||||
|
||||
SlotData::~SlotData(void)
|
||||
{}
|
||||
|
||||
void SlotDependent::Dep::erase()
|
||||
{
|
||||
parent->invalid();
|
||||
}
|
||||
|
||||
void SlotDependent::erase()
|
||||
{
|
||||
dep.parent->invalid();
|
||||
}
|
||||
|
||||
void SlotData::connect()
|
||||
{
|
||||
reference();
|
||||
invalid();
|
||||
set_weak();
|
||||
unreference();
|
||||
}
|
||||
|
||||
void SlotList_::clear()
|
||||
{
|
||||
Iterator current=begin();
|
||||
Iterator next=current;
|
||||
head_=0;
|
||||
|
||||
while (current!=end())
|
||||
{
|
||||
next++;
|
||||
delete current.node();
|
||||
current=next;
|
||||
}
|
||||
}
|
||||
|
||||
SlotList_::Iterator SlotList_::insert_direct(Iterator pos,NodeType *node)
|
||||
{
|
||||
NodeType *loc=pos.node();
|
||||
if (pos==begin())
|
||||
{
|
||||
node->next_=head_;
|
||||
head_=node;
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator i,j;
|
||||
j=begin();
|
||||
while (i=j++,j!=end()&&j!=pos);
|
||||
|
||||
NodeType *parent=i.node();
|
||||
parent->next_=node;
|
||||
node->next_=loc;
|
||||
}
|
||||
return Iterator(node);
|
||||
}
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} // namespace
|
||||
#endif // SIGC_CXX_NAMESPACES
|
||||
|
||||
|
155
sigc++/thread.cc
Normal file
155
sigc++/thread.cc
Normal file
@ -0,0 +1,155 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#define SIGC_THREAD_IMPL
|
||||
#include <sigc++/thread.h>
|
||||
|
||||
#ifdef SIGC_PTHREADS
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
namespace Threads
|
||||
{
|
||||
#endif
|
||||
|
||||
Mutex::Mutex(const MutexAttr attr)
|
||||
{
|
||||
pthread_mutex_init(&mutex_,attr.impl_);
|
||||
}
|
||||
|
||||
// (needs work)
|
||||
Mutex::~Mutex()
|
||||
{destroy();}
|
||||
|
||||
int Mutex::lock() {return pthread_mutex_lock(&mutex_);}
|
||||
int Mutex::trylock() {return pthread_mutex_trylock(&mutex_);}
|
||||
int Mutex::unlock() {return pthread_mutex_unlock(&mutex_);}
|
||||
int Mutex::destroy() {return pthread_mutex_destroy(&mutex_);}
|
||||
|
||||
|
||||
Condition::Condition(const CondAttr &attr)
|
||||
{
|
||||
pthread_cond_init(&cond_,attr.impl_);
|
||||
}
|
||||
|
||||
Condition::~Condition()
|
||||
{destroy();}
|
||||
|
||||
int Condition::signal() {return pthread_cond_signal(&cond_);}
|
||||
int Condition::broadcast() {return pthread_cond_broadcast(&cond_);}
|
||||
int Condition::wait(Mutex &m) {return pthread_cond_wait(&cond_,m);}
|
||||
int Condition::wait(Mutex &m,timespec* spec)
|
||||
{return pthread_cond_timedwait(&cond_,m,spec);}
|
||||
int Condition::destroy() {return pthread_cond_destroy(&cond_);}
|
||||
|
||||
|
||||
void Semaphore::up()
|
||||
{
|
||||
access_.lock();
|
||||
value_++;
|
||||
access_.unlock();
|
||||
sig_.signal();
|
||||
}
|
||||
|
||||
void Semaphore::down()
|
||||
{
|
||||
access_.lock();
|
||||
while (value_<1)
|
||||
{sig_.wait(access_);}
|
||||
value_--;
|
||||
access_.unlock();
|
||||
}
|
||||
|
||||
Semaphore::Semaphore(int value):value_(value) {}
|
||||
Semaphore::~Semaphore() {}
|
||||
|
||||
|
||||
|
||||
void* Thread::call_main_(void* obj)
|
||||
{
|
||||
Thread *thread=(Thread*)obj;
|
||||
return thread->main(thread->arg_);
|
||||
}
|
||||
|
||||
Thread::Thread(const ThreadAttr &attr):attr_(attr) {}
|
||||
Thread::~Thread() {}
|
||||
|
||||
int Thread::detach()
|
||||
#ifdef SIGC_PTHREAD_DCE
|
||||
{return pthread_detach(&thread_);}
|
||||
#else
|
||||
{return pthread_detach(thread_);}
|
||||
#endif
|
||||
|
||||
int Thread::start(void* arg)
|
||||
{
|
||||
arg_=arg;
|
||||
Thread *t=this;
|
||||
return pthread_create(&thread_,attr_.impl_,call_main_,t);
|
||||
}
|
||||
|
||||
void* Private_::get()
|
||||
{
|
||||
void* value;
|
||||
#ifdef SIGC_PTHREAD_DCE
|
||||
pthread_getspecific(key_,(pthread_addr_t*)(&value));
|
||||
#else
|
||||
value=(void*)(pthread_getspecific(key_));
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
void Private_::set(void *value)
|
||||
{
|
||||
pthread_setspecific(key_,value);
|
||||
}
|
||||
|
||||
void Private_::create(void (*dtor)(void*))
|
||||
{
|
||||
#ifdef SIGC_PTHREAD_DCE
|
||||
pthread_keycreate(&key_,dtor);
|
||||
#else
|
||||
pthread_key_create(&key_,dtor);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Private_::destroy()
|
||||
{
|
||||
#ifndef SIGC_PTHREAD_DCE
|
||||
pthread_key_delete(key_);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef SIGC_PTHREAD_DCE
|
||||
MutexAttr Mutex::Default={pthread_mutexattr_default};
|
||||
CondAttr Condition::Default={pthread_condattr_default};
|
||||
ThreadAttr Thread::Default={pthread_attr_default};
|
||||
#else
|
||||
MutexAttr Mutex::Default={0};
|
||||
CondAttr Condition::Default={0};
|
||||
ThreadAttr Thread::Default={0};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
242
sigc++/thread.h
Normal file
242
sigc++/thread.h
Normal file
@ -0,0 +1,242 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#ifndef SIGCXX_THREAD_H
|
||||
#define SIGCXX_THREAD_H
|
||||
#include <sigc++/sigc++config.h>
|
||||
|
||||
#ifdef SIGC_PTHREADS
|
||||
|
||||
#ifdef SIGC_THREAD_IMPL
|
||||
#include <pthread.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
namespace Threads
|
||||
{
|
||||
#else
|
||||
#define Threads
|
||||
#endif
|
||||
|
||||
#ifdef SIGC_THREAD_IMPL
|
||||
#ifdef SIGC_PTHREAD_DCE
|
||||
struct CondAttr { pthread_condattr_t impl_;};
|
||||
struct MutexAttr { pthread_mutexattr_t impl_;};
|
||||
struct ThreadAttr { pthread_attr_t impl_;};
|
||||
#else
|
||||
struct CondAttr { pthread_condattr_t* impl_;};
|
||||
struct MutexAttr { pthread_mutexattr_t* impl_;};
|
||||
struct ThreadAttr { pthread_attr_t* impl_;};
|
||||
#endif
|
||||
typedef pthread_mutex_t MutexImpl;
|
||||
typedef pthread_cond_t CondImpl;
|
||||
typedef pthread_key_t KeyImpl;
|
||||
typedef pthread_t ThreadImpl;
|
||||
#else
|
||||
class CondAttr {unsigned char dummy[SIGC_PTHREAD_COND_ATTR];};
|
||||
class CondImpl {unsigned char dummy[SIGC_PTHREAD_COND_IMPL];};
|
||||
class MutexAttr {unsigned char dummy[SIGC_PTHREAD_MUTEX_ATTR];};
|
||||
class MutexImpl {unsigned char dummy[SIGC_PTHREAD_MUTEX_IMPL];};
|
||||
class ThreadAttr {unsigned char dummy[SIGC_PTHREAD_THREAD_ATTR];};
|
||||
class ThreadImpl {unsigned char dummy[SIGC_PTHREAD_THREAD_IMPL];};
|
||||
class KeyImpl {unsigned char dummy[SIGC_PTHREAD_KEY_IMPL];};
|
||||
#endif
|
||||
|
||||
// Mutual Exclusion
|
||||
class Mutex
|
||||
{
|
||||
typedef MutexImpl Impl;
|
||||
private:
|
||||
Impl mutex_;
|
||||
int destroy();
|
||||
|
||||
public:
|
||||
static MutexAttr Default;
|
||||
#ifdef SIGC_THREAD_IMPL
|
||||
operator Impl* () {return (Impl*)(&mutex_);}
|
||||
#endif
|
||||
|
||||
Mutex(const MutexAttr attr=Default);
|
||||
|
||||
// (needs work)
|
||||
~Mutex();
|
||||
|
||||
int lock();
|
||||
int trylock();
|
||||
int unlock();
|
||||
};
|
||||
|
||||
// A lazy way to unlock at end of scope
|
||||
struct MLock
|
||||
{
|
||||
Mutex &mutex_;
|
||||
MLock(Mutex& mutex):mutex_(mutex) {mutex_.lock();}
|
||||
~MLock() {mutex_.unlock();}
|
||||
};
|
||||
|
||||
// Condition Variable
|
||||
struct Condition
|
||||
{
|
||||
typedef CondImpl Impl;
|
||||
private:
|
||||
Impl cond_;
|
||||
|
||||
int destroy();
|
||||
public:
|
||||
static CondAttr Default;
|
||||
#ifdef SIGC_THREAD_IMPL
|
||||
operator Impl* () {return (Impl*)(&cond_);}
|
||||
#endif
|
||||
|
||||
Condition(const CondAttr &attr=Default);
|
||||
~Condition();
|
||||
|
||||
// restarts exactly one thread hung on condition
|
||||
int signal();
|
||||
|
||||
// restarts all threads waiting on condition
|
||||
int broadcast();
|
||||
|
||||
// unlocks a mutex while waiting on a condition, then reaquires lock.
|
||||
int wait(Mutex &m);
|
||||
|
||||
// unlocks a mutex while waiting on a condition, then reaquires lock
|
||||
// with a fixed maximum duration.
|
||||
int wait(Mutex &m,timespec* spec);
|
||||
|
||||
};
|
||||
|
||||
// Integer Semaphore
|
||||
struct Semaphore
|
||||
{
|
||||
int value_;
|
||||
Condition sig_;
|
||||
Mutex access_;
|
||||
|
||||
void up();
|
||||
void down();
|
||||
|
||||
Semaphore(int value=1);
|
||||
~Semaphore();
|
||||
};
|
||||
|
||||
struct Private_
|
||||
{
|
||||
KeyImpl key_;
|
||||
void* get();
|
||||
void set(void *value);
|
||||
void create(void (*dtor)(void*));
|
||||
void destroy();
|
||||
};
|
||||
|
||||
// Private is a thread split static.
|
||||
template <class T>
|
||||
class Private : private Private_
|
||||
{
|
||||
private:
|
||||
static void dtor(void* v)
|
||||
{
|
||||
T* obj=(T*)v;
|
||||
delete obj;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
T& operator =(const T& t)
|
||||
{return (((T&)*this)=t);}
|
||||
|
||||
operator T& ()
|
||||
{
|
||||
T *value=(T*)get();
|
||||
if (!value)
|
||||
set((void*)(value=new T()));
|
||||
return *(value);
|
||||
}
|
||||
|
||||
Private() { create(&dtor); }
|
||||
~Private() { destroy(); }
|
||||
};
|
||||
|
||||
// int needs to initialized
|
||||
template <>
|
||||
class Private<int> : private Private_
|
||||
{
|
||||
private:
|
||||
static void dtor(void* v)
|
||||
{
|
||||
int* obj=(int*)v;
|
||||
delete obj;
|
||||
}
|
||||
|
||||
public:
|
||||
int& operator =(const int& t)
|
||||
{return (((int&)*this)=t);}
|
||||
|
||||
operator int& ()
|
||||
{
|
||||
int *value=(int*)get();
|
||||
if (!value)
|
||||
set((void*)(value=new int(0)));
|
||||
return *(value);
|
||||
}
|
||||
|
||||
Private() { create(&dtor); }
|
||||
~Private() { destroy(); }
|
||||
};
|
||||
|
||||
struct Thread
|
||||
{
|
||||
protected:
|
||||
typedef ThreadImpl Impl;
|
||||
Impl thread_;
|
||||
void* arg_;
|
||||
ThreadAttr attr_;
|
||||
|
||||
static void* call_main_(void* obj);
|
||||
|
||||
public:
|
||||
#ifdef SIGC_THREAD_IMPL
|
||||
operator Impl* () {return &thread_;}
|
||||
#endif
|
||||
|
||||
virtual void* main(void*)=0;
|
||||
int detach();
|
||||
|
||||
static ThreadAttr Default;
|
||||
|
||||
// arg is for passing extra data to main, but never pass a
|
||||
// local variable or address of local variable. Arg must
|
||||
// be available throughout life of program.
|
||||
int start(void* arg=0);
|
||||
|
||||
Thread(const ThreadAttr &attr=Default);
|
||||
virtual ~Thread();
|
||||
};
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
} /* namespace Threads */
|
||||
} /* namespace SigC */
|
||||
#endif
|
||||
|
||||
#endif /* SIGC_PTHREADS */
|
||||
#endif /* SIGCXX_THREAD_H */
|
63
sigc++/type.h
Normal file
63
sigc++/type.h
Normal file
@ -0,0 +1,63 @@
|
||||
// -*- c++ -*-
|
||||
/*
|
||||
* Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#ifndef SIGCXX_TYPE_H
|
||||
#define SIGCXX_TYPE_H
|
||||
|
||||
#include <sigc++/sigc++config.h>
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
namespace SigC
|
||||
{
|
||||
#endif
|
||||
|
||||
/* some classes for making parameter passing easier */
|
||||
|
||||
#ifdef SIGC_CXX_SPECIALIZE_REFERENCES
|
||||
template <typename T>
|
||||
struct Trait
|
||||
{
|
||||
typedef const T& ref;
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Trait<T&>
|
||||
{
|
||||
typedef T& ref;
|
||||
typedef T& type;
|
||||
};
|
||||
#else
|
||||
template <typename T>
|
||||
struct Trait
|
||||
{
|
||||
typedef T ref; // VC++ does not support reference typedef
|
||||
typedef T type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct Trait<void>:public Trait<int>
|
||||
{};
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -63,6 +63,7 @@ LyXView::LyXView(int width, int height)
|
||||
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
|
||||
lyxfunc = new LyXFunc(this);
|
||||
intl = new Intl;
|
||||
|
||||
dialogs_ = new Dialogs(this);
|
||||
// temporary until all dialogs moved into Dialogs.
|
||||
dialogs_->updateBufferDependent
|
||||
|
@ -37,6 +37,7 @@
|
||||
class LyXRC;
|
||||
class TeXErrors;
|
||||
class LaTeXFeatures;
|
||||
class auto_mem_buffer;
|
||||
|
||||
///
|
||||
struct DEPCLEAN {
|
||||
@ -83,6 +84,9 @@ public:
|
||||
/// Maybe we know the function already by number...
|
||||
bool Dispatch(int ac, string const & argument);
|
||||
|
||||
/// and have an xtl buffer to work with.
|
||||
bool Dispatch(int, auto_mem_buffer &);
|
||||
|
||||
/// should be changed to work for a list.
|
||||
void resize() {
|
||||
if (users) {
|
||||
|
2
src/frontends/.cvsignore
Normal file
2
src/frontends/.cvsignore
Normal file
@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
67
src/frontends/DialogBase.h
Normal file
67
src/frontends/DialogBase.h
Normal file
@ -0,0 +1,67 @@
|
||||
// -*- C++ -*-
|
||||
/* DialogBase.h
|
||||
* Abstract base class of all dialogs.
|
||||
* Author: Allan Rae <rae@lyx.org>
|
||||
* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000
|
||||
* Allan Rae
|
||||
* ======================================================
|
||||
*/
|
||||
#ifndef DIALOGBASE_H
|
||||
#define DIALOGBASE_H
|
||||
|
||||
#include <sigc++/signal_system.h>
|
||||
|
||||
// If we do not want to bring them in global namespace, they could be
|
||||
// defined inside DialogBase... (JMarc)
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Connection;
|
||||
using SigC::slot;
|
||||
#endif
|
||||
|
||||
|
||||
/** Abstract base class of all dialogs.
|
||||
The outside world only needs some way to tell a dialog when to show, hide
|
||||
or update itself. A dialog then takes whatever steps are necessary to
|
||||
satisfy that request. Thus a dialog will have to "pull" the necessary
|
||||
details from the core of the program.
|
||||
*/
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
class DialogBase : public SigC::Object
|
||||
#else
|
||||
class DialogBase : public Object
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
/**@name Constructors and Deconstructors */
|
||||
//@{
|
||||
///
|
||||
virtual ~DialogBase() {}
|
||||
//@}
|
||||
|
||||
/**@name Signal Targets */
|
||||
//@{
|
||||
///
|
||||
virtual void show() = 0;
|
||||
///
|
||||
virtual void hide() = 0;
|
||||
///
|
||||
virtual void update() = 0;
|
||||
//@}
|
||||
|
||||
///
|
||||
enum EnumDialogStatus {
|
||||
DIALOG_UNMODIFIED,
|
||||
DIALOG_MODIFIED,
|
||||
DIALOG_READONLY
|
||||
};
|
||||
};
|
||||
|
||||
#endif // DIALOGBASE_H
|
132
src/frontends/Dialogs.h
Normal file
132
src/frontends/Dialogs.h
Normal file
@ -0,0 +1,132 @@
|
||||
// -*- C++ -*-
|
||||
/* Dialogs.h
|
||||
* Container of all dialogs and signals a LyXView needs or uses to access them.
|
||||
* Author: Allan Rae <rae@lyx.org>
|
||||
* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000
|
||||
* Allan Rae
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#ifndef DIALOGS_H
|
||||
#define DIALOGS_H
|
||||
|
||||
#include <vector>
|
||||
#include <sigc++/signal_system.h>
|
||||
|
||||
using std::vector;
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Signal0;
|
||||
using SigC::Signal1;
|
||||
#endif
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
class DialogBase;
|
||||
|
||||
// Maybe this should be a UIFunc modelled on LyXFunc
|
||||
class LyXView;
|
||||
|
||||
class InsetInclude;
|
||||
class InsetIndex;
|
||||
class InsetBibKey;
|
||||
class InsetCitation;
|
||||
class InsetBibtex;
|
||||
class InsetInfo;
|
||||
|
||||
/** Container of all dialogs and signals a LyXView needs or uses to access them
|
||||
The list of dialog signals isn't comprehensive but should be a good guide
|
||||
for any future additions. Remember don't go overboard -- think minimal.
|
||||
*/
|
||||
class Dialogs
|
||||
{
|
||||
public:
|
||||
/**@name Constructors and Deconstructors */
|
||||
//@{
|
||||
///
|
||||
Dialogs(LyXView *);
|
||||
///
|
||||
~Dialogs();
|
||||
//@}
|
||||
|
||||
/**@name Global Hide and Update Signals */
|
||||
//@{
|
||||
/// Hide all visible popups
|
||||
Signal0<void> hideAll;
|
||||
|
||||
/// Hide any popups that require a buffer for them to operate
|
||||
Signal0<void> hideBufferDependent;
|
||||
|
||||
/// Update visible, buffer-dependent popups
|
||||
Signal0<void> updateBufferDependent;
|
||||
//@}
|
||||
|
||||
/**@name Dialog Access Signals */
|
||||
//@{
|
||||
/// Opens the Preamble Dialog.
|
||||
Signal0<void> showPreamble;
|
||||
///
|
||||
Signal0<void> showLogFile;
|
||||
///
|
||||
Signal0<void> showTable;
|
||||
///
|
||||
Signal0<void> updateTable; // needed for InsetTabular-Update
|
||||
///
|
||||
Signal0<void> showTableNew;
|
||||
///
|
||||
Signal0<void> showCharacter;
|
||||
///
|
||||
Signal0<void> updateCharacter; // allow update as cursor moves
|
||||
///
|
||||
Signal0<void> showParagraph;
|
||||
///
|
||||
Signal0<void> showDocument;
|
||||
/// Do we really have to push this?
|
||||
Signal1<void, vector<string> const &> SetDocumentClassChoice;
|
||||
///
|
||||
Signal0<void> showPrint;
|
||||
///
|
||||
Signal0<void> showCopyright;
|
||||
///
|
||||
Signal0<void> showCredits;
|
||||
///
|
||||
Signal0<void> showPreferences;
|
||||
///
|
||||
Signal1<void, InsetInclude *> showInclude;
|
||||
///
|
||||
Signal1<void, InsetIndex *> showIndex;
|
||||
///
|
||||
Signal1<void, InsetBibKey *> showBibkey;
|
||||
///
|
||||
Signal1<void, InsetCitation *> showCitation;
|
||||
///
|
||||
Signal1<void, InsetBibtex *> showBibtex;
|
||||
///
|
||||
Signal1<void, InsetInfo *> showInfo;
|
||||
//@}
|
||||
private:
|
||||
/// Disallow default constructor
|
||||
Dialogs() {}
|
||||
/// Disallow copy constructor
|
||||
Dialogs(Dialogs &) {}
|
||||
///
|
||||
vector<DialogBase *> dialogs_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
201
src/frontends/Liason.C
Normal file
201
src/frontends/Liason.C
Normal file
@ -0,0 +1,201 @@
|
||||
#include <config.h>
|
||||
|
||||
//#include "config.h"
|
||||
#include "Liason.h"
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
#include "lyxrc.h"
|
||||
#include "PrinterParams.h"
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/path.h"
|
||||
|
||||
extern LyXRC lyxrc;
|
||||
extern bool RunScript(Buffer * buffer, bool wait, string const & command,
|
||||
string const & orgname = string(), bool need_shell=true);
|
||||
|
||||
|
||||
#ifdef CXX_WORKING_NAMESPACES
|
||||
namespace Liason
|
||||
{
|
||||
#endif
|
||||
|
||||
PrinterParams getPrinterParams(Buffer * buffer)
|
||||
{
|
||||
return PrinterParams(PrinterParams::PRINTER,
|
||||
lyxrc.printer,
|
||||
ChangeExtension(buffer->fileName(),
|
||||
lyxrc.print_file_extension));
|
||||
}
|
||||
|
||||
|
||||
bool printBuffer(Buffer * buffer, PrinterParams const & pp)
|
||||
{
|
||||
bool result(false);
|
||||
string command(lyxrc.print_command + ' ');
|
||||
|
||||
if (pp.target == PrinterParams::PRINTER
|
||||
&& lyxrc.print_adapt_output // dvips wants a printer name
|
||||
&& !pp.printer_name.empty()) {// printer name given
|
||||
command += lyxrc.print_to_printer
|
||||
+ pp.printer_name
|
||||
+ ' ';
|
||||
}
|
||||
|
||||
switch (pp.which_pages) {
|
||||
case PrinterParams::EVEN:
|
||||
command += lyxrc.print_evenpage_flag + ' ';
|
||||
break;
|
||||
|
||||
case PrinterParams::ODD:
|
||||
command += lyxrc.print_oddpage_flag + ' ';
|
||||
break;
|
||||
|
||||
default:
|
||||
// only option left is print all of them
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pp.from_page.empty()) {
|
||||
command += lyxrc.print_pagerange_flag + ' ';
|
||||
command += pp.from_page;
|
||||
if (pp.to_page) {
|
||||
// we have a range "from-to"
|
||||
command += '-';
|
||||
command += tostr(pp.to_page);
|
||||
}
|
||||
command += ' ';
|
||||
}
|
||||
|
||||
if (pp.reverse_order) {
|
||||
command += lyxrc.print_reverse_flag + ' ';
|
||||
}
|
||||
|
||||
BufferParams params(buffer->params);
|
||||
if (params.orientation
|
||||
== BufferParams::ORIENTATION_LANDSCAPE) {
|
||||
command += lyxrc.print_landscape_flag + ' ';
|
||||
}
|
||||
|
||||
if (1 < pp.count_copies) {
|
||||
if (pp.unsorted_copies) {
|
||||
command += lyxrc.print_copies_flag;
|
||||
} else {
|
||||
command += lyxrc.print_collcopies_flag;
|
||||
}
|
||||
command += ' ';
|
||||
command += tostr(pp.count_copies);
|
||||
command += ' ';
|
||||
}
|
||||
|
||||
if (!lyxrc.print_extra_options.empty()) {
|
||||
command += lyxrc.print_extra_options + ' ';
|
||||
}
|
||||
|
||||
char real_papersize = params.papersize;
|
||||
if (real_papersize == BufferParams::PAPER_DEFAULT) {
|
||||
real_papersize = lyxrc.default_papersize;
|
||||
}
|
||||
|
||||
if (params.use_geometry
|
||||
&& params.papersize2 == BufferParams::VM_PAPER_CUSTOM
|
||||
&& !lyxrc.print_paper_dimension_flag.empty()
|
||||
&& !params.paperwidth.empty()
|
||||
&& !params.paperheight.empty()) {
|
||||
// using a custom papersize
|
||||
command += lyxrc.print_paper_dimension_flag + ' ';
|
||||
command += params.paperwidth + ',';
|
||||
command += params.paperheight + ' ';
|
||||
} else if (!lyxrc.print_paper_flag.empty()
|
||||
&& (real_papersize != BufferParams::PAPER_USLETTER
|
||||
|| params.orientation
|
||||
== BufferParams::ORIENTATION_PORTRAIT)) {
|
||||
// There's a problem with US Letter + landscape
|
||||
string paper;
|
||||
switch (real_papersize) {
|
||||
case BufferParams::PAPER_USLETTER:
|
||||
paper = "letter";
|
||||
break;
|
||||
case BufferParams::PAPER_A3PAPER:
|
||||
paper = "a3";
|
||||
break;
|
||||
case BufferParams::PAPER_A4PAPER:
|
||||
paper = "a4";
|
||||
break;
|
||||
case BufferParams::PAPER_A5PAPER:
|
||||
paper = "a5";
|
||||
break;
|
||||
case BufferParams::PAPER_B5PAPER:
|
||||
paper = "b5";
|
||||
break;
|
||||
case BufferParams::PAPER_EXECUTIVEPAPER:
|
||||
paper = "foolscap";
|
||||
break;
|
||||
case BufferParams::PAPER_LEGALPAPER:
|
||||
paper = "legal";
|
||||
break;
|
||||
default: /* If nothing else fits, keep empty value */
|
||||
break;
|
||||
}
|
||||
if (!paper.empty()) {
|
||||
command += lyxrc.print_paper_flag + ' ';
|
||||
command += paper + ' ';
|
||||
}
|
||||
}
|
||||
|
||||
// Push directory path if necessary.
|
||||
// PS file should go where the source file is unless it's a
|
||||
// read-only directory in which case we write it to tmpdir.
|
||||
// All temporary files go in tmpdir (like spool files).
|
||||
string path = OnlyPath(buffer->fileName());
|
||||
if ((pp.target != PrinterParams::FILE
|
||||
&& lyxrc.use_tempdir)
|
||||
|| (IsDirWriteable(path) < 1)) {
|
||||
path = buffer->tmppath;
|
||||
}
|
||||
Path p(path);
|
||||
|
||||
// there are three cases here:
|
||||
// 1. we print to a file
|
||||
// 2. we print direct to a printer
|
||||
// 3. we print using a spool command (print to file first)
|
||||
switch (pp.target) {
|
||||
case PrinterParams::PRINTER:
|
||||
if (!lyxrc.print_spool_command.empty()) {
|
||||
// case 3
|
||||
command += lyxrc.print_to_file
|
||||
+ QuoteName(pp.file_name);
|
||||
string command2 = lyxrc.print_spool_command
|
||||
+ ' ';
|
||||
if (!pp.printer_name.empty()) {
|
||||
command2 += lyxrc.print_spool_printerprefix
|
||||
+ pp.printer_name;
|
||||
}
|
||||
// First run dvips.
|
||||
// If successful, then spool command
|
||||
if (result = RunScript(buffer, true, command)) {
|
||||
result = RunScript(buffer, false,
|
||||
command2,
|
||||
QuoteName(pp.file_name));
|
||||
}
|
||||
} else {
|
||||
// case 2
|
||||
result = RunScript(buffer, false, command);
|
||||
}
|
||||
break;
|
||||
|
||||
case PrinterParams::FILE:
|
||||
// case 1
|
||||
command += lyxrc.print_to_file
|
||||
+ QuoteName(MakeAbsPath(pp.file_name, path));
|
||||
result = RunScript(buffer, false, command);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef CXX_WORKING_NAMESPACES
|
||||
}
|
||||
#endif
|
||||
|
57
src/frontends/Liason.h
Normal file
57
src/frontends/Liason.h
Normal file
@ -0,0 +1,57 @@
|
||||
// -*- C++ -*-
|
||||
/* Liason.h
|
||||
* Temporary namespace to hold the various frontend functions until XTL and
|
||||
* the compilers of the world are ready for something more elaborate.
|
||||
* This is basically the Communicator class from the lyx cvs module all
|
||||
* over again.
|
||||
*
|
||||
* Eventually, we will switch back to the XTL+LyXFunc combination that
|
||||
* worked so nicely on a very small number of compilers and systems (when
|
||||
* most systems can support those required features).
|
||||
*
|
||||
* Author: Allan Rae <rae@lyx.org>
|
||||
* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000
|
||||
* Allan Rae
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#ifndef LIASON_H
|
||||
#define LIASON_H
|
||||
|
||||
class PrinterParams;
|
||||
class Buffer;
|
||||
|
||||
/** Temporary namespace to hold the various frontend functions
|
||||
* until XTL and the compilers of the world are ready for something more
|
||||
* elaborate. This is basically the Communicator class from the lyx cvs module
|
||||
* all over again.
|
||||
*
|
||||
* Eventually, we will switch back to the XTL+LyXFunc combination that
|
||||
* worked so nicely on a very small number of compilers and systems.
|
||||
* See the "dialogbase" branch of lyx-devel cvs module for xtl implementation.
|
||||
*/
|
||||
#ifdef CXX_WORKING_NAMESPACES
|
||||
namespace Liason
|
||||
{
|
||||
#endif
|
||||
/**@name Global support functions */
|
||||
//@{
|
||||
/// get global printer parameters
|
||||
PrinterParams getPrinterParams(Buffer *);
|
||||
/// print the current buffer
|
||||
bool printBuffer(Buffer *, PrinterParams const &);
|
||||
//@}
|
||||
|
||||
#ifdef CXX_WORKING_NAMESPACES
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
14
src/frontends/Makefile.am
Normal file
14
src/frontends/Makefile.am
Normal file
@ -0,0 +1,14 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
DISTCLEANFILES= *.orig *.rej *~ *.bak core
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
SUBDIRS = @FRONTEND@
|
||||
ETAGS_ARGS = --lang=c++
|
||||
INCLUDES = -I${srcdir}/../
|
||||
LIBS =
|
||||
noinst_LTLIBRARIES = libfrontends.la
|
||||
libfrontends_la_SOURCES=\
|
||||
Dialogs.h \
|
||||
DialogBase.h \
|
||||
Liason.C \
|
||||
Liason.h
|
||||
|
6
src/frontends/kde/.cvsignore
Normal file
6
src/frontends/kde/.cvsignore
Normal file
@ -0,0 +1,6 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
*.deps
|
||||
*.lo
|
||||
.libs
|
||||
libkde.la
|
105
src/frontends/kde/Dialogs.C
Normal file
105
src/frontends/kde/Dialogs.C
Normal file
@ -0,0 +1,105 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "FormCopyright.h"
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
|
||||
Dialogs::Dialogs(LyXFunc * lf)
|
||||
{
|
||||
dialogs_.push_back(new FormCopyright(lf, this));
|
||||
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
hideAll.connect(hideBufferDependent.slot());
|
||||
}
|
||||
|
||||
Dialogs::~Dialogs()
|
||||
{
|
||||
for (vector<DialogBase *>::iterator iter = dialogs_.begin();
|
||||
iter != dialogs_.end();
|
||||
++iter) {
|
||||
delete *iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
Q. WHY does Dialogs::Dialogs pass `this' to dialog constructors?
|
||||
|
||||
A. To avoid a segfault.
|
||||
The dialog constructors need to connect to their
|
||||
respective showSomeDialog signal(*) but in order to do
|
||||
that they need to get the address of the Dialogs instance
|
||||
from LyXView::getDialogs(). However, since the Dialogs
|
||||
instance is still being constructed at that time
|
||||
LyXView::getDialogs() will *not* return the correct
|
||||
address because it hasn't finished being constructed.
|
||||
A Catch-22 situation (or is that the chicken and the egg...).
|
||||
So to get around the problem we pass the address of
|
||||
the newly created Dialogs instance using `this'.
|
||||
|
||||
(*) -- I'm using signals exclusively to guarantee that the gui code
|
||||
remains hidden from the rest of the system. In fact the only
|
||||
header related to dialogs that anything in the non-gui-specific
|
||||
code gets to see is Dialogs.h! Even Dialogs.h doesn't know what a
|
||||
FormCopyright class looks like or that its even going to be used!
|
||||
|
||||
No other gui dialog headers are seen outside of the gui-specific
|
||||
directories! This ensures that the gui is completely separate from
|
||||
the rest of LyX. All this through the use of a few simple signals.
|
||||
BUT, the price is that during construction we need to connect the
|
||||
implementations show() method to the showSomeDialog signal and this
|
||||
requires that we have an instance of Dialogs and the problem mentioned
|
||||
above.
|
||||
|
||||
Almost all other dialogs should be able to operate using the same style
|
||||
of signalling used for Copyright. Exceptions should be handled
|
||||
by adding a specific show or update signal. For example, spellchecker
|
||||
needs to set the next suspect word and its options/replacements so we
|
||||
need a:
|
||||
Signal0<void> updateSpellChecker;
|
||||
|
||||
Since we would have to have a
|
||||
Signal0<void> showSpellChecker;
|
||||
|
||||
in order to just see the spellchecker and let the user push the [Start]
|
||||
button then the updateSpellChecker signal will make the SpellChecker
|
||||
dialog get the new word and replacements list from LyX. If you really,
|
||||
really wanted to you could define a signal that would pass the new
|
||||
word and replacements:
|
||||
Signal2<void, string, vector<string> > updateSpellChecker;
|
||||
|
||||
(or something similar) but, why bother when the spellchecker can get
|
||||
it anyway with a LyXFunc call or two. Besides if someone extends
|
||||
what a dialog does then they also have to change code in the rest of
|
||||
LyX to pass more parameters or get the extra info via a function
|
||||
call anyway. Thus reducing the independence of the two code bases.
|
||||
|
||||
We don't need a separate update signal for each dialog because most of
|
||||
them will be changed only when the buffer is changed (either by closing
|
||||
the current open buffer or switching to another buffer in the current
|
||||
LyXView -- different BufferView same LyXView or same BufferView same
|
||||
LyXView).
|
||||
|
||||
So we minimise signals but maximise independence and programming
|
||||
simplicity, understandability and maintainability. It's also
|
||||
extremely easy to add support for Qt or gtk-- because they use
|
||||
signals already. Guis that use callbacks, like xforms, must have their
|
||||
code wrapped up like that in the form_copyright.[Ch] which is awkward
|
||||
but will at least allow multiple instances of the same dialog.
|
||||
|
||||
Signals will also be a great help in controlling the splashscreen --
|
||||
once signalled to hide it can disconnect from the signal and remove
|
||||
itself from memory.
|
||||
|
||||
LyXFuncs will be used for requesting/setting LyX internal info. This
|
||||
will ensure that scripts or LyXServer-connected applications can all
|
||||
have access to the same calls as the internal user-interface.
|
||||
|
||||
******************************************************************************/
|
51
src/frontends/kde/FormCopyright.C
Normal file
51
src/frontends/kde/FormCopyright.C
Normal file
@ -0,0 +1,51 @@
|
||||
/***************************************************************************
|
||||
formcopyright.cpp - description
|
||||
-------------------
|
||||
begin : Thu Feb 3 2000
|
||||
copyright : (C) 2000 by Jürgen Vigna
|
||||
email : jug@sad.it
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* 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 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "FormCopyright.h"
|
||||
#include "formcopyrightdialog.h"
|
||||
#include "Dialogs.h"
|
||||
|
||||
FormCopyright::FormCopyright(LyXFunc *c, Dialogs *d)
|
||||
: dialog_(0), lf_(c), d_(d), h_(0)
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showCopyright.connect(slot(this, &FormCopyright::show));
|
||||
dialog_ = 0;
|
||||
}
|
||||
|
||||
FormCopyright::~FormCopyright()
|
||||
{
|
||||
delete dialog_;
|
||||
}
|
||||
|
||||
void FormCopyright::show()
|
||||
{
|
||||
if (!dialog_)
|
||||
dialog_ = new FormCopyrightDialog(0, "Copyright and Warranty",
|
||||
false);
|
||||
if (!dialog_->isVisible())
|
||||
h_ = d_->hideAll.connect(slot(this, &FormCopyright::hide));
|
||||
dialog_->show();
|
||||
}
|
||||
|
||||
void FormCopyright::hide()
|
||||
{
|
||||
dialog_->hide();
|
||||
h_.disconnect();
|
||||
}
|
65
src/frontends/kde/FormCopyright.h
Normal file
65
src/frontends/kde/FormCopyright.h
Normal file
@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
formcopyright.h - description
|
||||
-------------------
|
||||
begin : Thu Feb 3 2000
|
||||
copyright : (C) 2000 by Jürgen Vigna
|
||||
email : jug@sad.it
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* 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 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef FORMCOPYRIGHT_H
|
||||
#define FORMCOPYRIGHT_H
|
||||
|
||||
#include "DialogBase.h"
|
||||
|
||||
/**
|
||||
*@author Jürgen Vigna
|
||||
*/
|
||||
|
||||
class Dialogs;
|
||||
class LyXFunc;
|
||||
class FormCopyrightDialog;
|
||||
|
||||
class FormCopyright : public DialogBase {
|
||||
public:
|
||||
FormCopyright(LyXFunc *, Dialogs *);
|
||||
~FormCopyright();
|
||||
|
||||
private:
|
||||
/**@name Slot Methods */
|
||||
//@{
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Not used but we've got to implement it.
|
||||
void update() {}
|
||||
//@}
|
||||
|
||||
/**@name Private Data */
|
||||
//@{
|
||||
/// Real GUI implementation.
|
||||
FormCopyrightDialog * dialog_;
|
||||
/** Which LyXFunc do we use?
|
||||
We could modify Dialogs to have a visible LyXFunc* instead and
|
||||
save a couple of bytes per dialog.
|
||||
*/
|
||||
LyXFunc * lf_;
|
||||
/** Which Dialogs do we belong to?
|
||||
Used so we can get at the signals we have to connect to.
|
||||
*/
|
||||
Dialogs * d_;
|
||||
/// Hide connection.
|
||||
SigC::Connection h_;
|
||||
//@}
|
||||
};
|
||||
|
||||
#endif
|
50
src/frontends/kde/Makefile.am
Normal file
50
src/frontends/kde/Makefile.am
Normal file
@ -0,0 +1,50 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
noinst_LTLIBRARIES = libkde.la
|
||||
INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
|
||||
${SIGC_CFLAGS} ${FRONTEND_INCLUDES}
|
||||
|
||||
# just to make sure, automake makes them
|
||||
BUILTSOURCES = formcopyrightdialog_moc.C
|
||||
DISTCLEANFILES = $(BUILTSOURCES) *.orig *.rej *~ *.bak core
|
||||
|
||||
LIBS=
|
||||
LDFLAGS=
|
||||
LYXDATADIRS = dlg
|
||||
ETAGS_ARGS = --lang=c++
|
||||
libkde_la_SOURCES = \
|
||||
Dialogs.C \
|
||||
FormCopyright.C \
|
||||
FormCopyright.h \
|
||||
formcopyrightdialog.C \
|
||||
formcopyrightdialog.h \
|
||||
formcopyrightdialogdata.C \
|
||||
$(BUILTSOURCES)
|
||||
|
||||
# These still have to be added. Sooner or later. ARRae-20000129
|
||||
# GUI_defaults.C \
|
||||
# GUI_initialize.C \
|
||||
# GUI_postlyxrc.C \
|
||||
# GUI_runtime.C \
|
||||
# GUI_applymenu.C
|
||||
|
||||
# just copied from old lyx repository
|
||||
dist-hook:
|
||||
for subdir in $(LYXDATADIRS) ; do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
list=`(cd $(srcdir)/$$subdir && ls -1 | grep -v CVS)`; \
|
||||
echo $$list ; \
|
||||
for fil in $$list ; do \
|
||||
cp -p $(srcdir)/$$subdir/$$fil $(distdir)/$$subdir ; \
|
||||
done ; \
|
||||
done
|
||||
|
||||
# add a dependency for every moc file to be full portable
|
||||
# I've added a key binding to emacs for this.
|
||||
|
||||
formcopyrightdialog.C:formcopyrightdialog_moc.C
|
||||
formcopyrightdialog_moc.C: formcopyrightdialog.h
|
||||
$(MOC) formcopyrightdialog.h -o formcopyrightdialog_moc.C
|
86
src/frontends/kde/dlg/formcopyrightdialog.kdevdlg
Normal file
86
src/frontends/kde/dlg/formcopyrightdialog.kdevdlg
Normal file
@ -0,0 +1,86 @@
|
||||
// KDevelop Dialog Editor File (.kdevdlg)
|
||||
//
|
||||
// Created by KDlgEdit Version 0.1alpha (C) 1999 by Pascal Krahmer
|
||||
// Get KDevelop including KDlgEdit at "www.beast.de/kdevelop"
|
||||
//
|
||||
data Information
|
||||
{
|
||||
Filename="/nfs/sinco/source/lyx/rae/src/frontends/kde/dlg/formcopyrightdialog.kdevdlg"
|
||||
KDevelopVersion="0.4"
|
||||
DlgEditVersion="0.1alpha"
|
||||
LastChanged="Mon Feb 7 12:39:07 2000"
|
||||
}
|
||||
|
||||
data SessionManagement
|
||||
{
|
||||
OpenedRoot_1="Appearance"
|
||||
OpenedRoot_2="C++ Code"
|
||||
OpenedRoot_3="General"
|
||||
OpenedRoot_4="Geometry"
|
||||
OpenedRootCount="4"
|
||||
}
|
||||
|
||||
item QWidget
|
||||
{
|
||||
Name="NoName"
|
||||
VarName="this"
|
||||
X="0"
|
||||
Y="0"
|
||||
Width="400"
|
||||
Height="400"
|
||||
MinWidth="0"
|
||||
MinHeight="0"
|
||||
|
||||
item QLabel
|
||||
{
|
||||
Name="NoName"
|
||||
VarName="labelWho"
|
||||
X="10"
|
||||
Y="10"
|
||||
Width="380"
|
||||
Height="50"
|
||||
MinWidth="0"
|
||||
MinHeight="0"
|
||||
Text="LyX is Copyright ( C) 1995 by Matthias Ettrich, \n1995-2000 LyX Team"
|
||||
}
|
||||
|
||||
item QLabel
|
||||
{
|
||||
Name="NoName"
|
||||
VarName="labelGNU"
|
||||
X="10"
|
||||
Y="70"
|
||||
Width="380"
|
||||
Height="90"
|
||||
MinWidth="0"
|
||||
MinHeight="0"
|
||||
Text="This program is free software; you can redistribute it\nand/or modify it under the terms of the GNU General\nPublic License as published by the Free Software\nFoundation; either version 2 of the License, or\n(at your option) any later version."
|
||||
}
|
||||
|
||||
item QLabel
|
||||
{
|
||||
Name="NoName"
|
||||
VarName="labelLyX"
|
||||
X="10"
|
||||
Y="170"
|
||||
Width="380"
|
||||
Height="180"
|
||||
MinWidth="0"
|
||||
MinHeight="0"
|
||||
Text="LyX is distributed in the hope that it will\nbe useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of\nthe GNU General Public License\nalong with this program; if not, write to\nthe Free Software Foundation, Inc., \n675 Mass Ave, Cambridge, MA 02139, USA."
|
||||
}
|
||||
|
||||
item QPushButton
|
||||
{
|
||||
Name="NoName"
|
||||
VarName="buttonOk"
|
||||
X="130"
|
||||
Y="360"
|
||||
Width="140"
|
||||
Height="30"
|
||||
MinWidth="0"
|
||||
MinHeight="0"
|
||||
Text="OK"
|
||||
isDefault="true"
|
||||
}
|
||||
}
|
35
src/frontends/kde/formcopyrightdialog.C
Normal file
35
src/frontends/kde/formcopyrightdialog.C
Normal file
@ -0,0 +1,35 @@
|
||||
/***************************************************************************
|
||||
formcopyrightdialog.C - description
|
||||
-------------------
|
||||
begin : Fri Feb 4 2000
|
||||
copyright : (C) 2000 by Jürgen Vigna
|
||||
email : jug@sad.it
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* 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 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "formcopyrightdialog.h"
|
||||
|
||||
FormCopyrightDialog::FormCopyrightDialog(QWidget *parent, const char *name,
|
||||
bool, WFlags)
|
||||
: QDialog(parent,name,false)
|
||||
{
|
||||
initDialog();
|
||||
labelWho->setAlignment(AlignHCenter | AlignVCenter);
|
||||
labelWho->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
||||
labelGNU->setAlignment(AlignHCenter | AlignVCenter);
|
||||
labelGNU->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
||||
labelLyX->setAlignment(AlignHCenter | AlignVCenter);
|
||||
labelLyX->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
FormCopyrightDialog::~FormCopyrightDialog()
|
||||
{
|
||||
}
|
52
src/frontends/kde/formcopyrightdialog.h
Normal file
52
src/frontends/kde/formcopyrightdialog.h
Normal file
@ -0,0 +1,52 @@
|
||||
/***************************************************************************
|
||||
formcopyrightdialog.h - description
|
||||
-------------------
|
||||
begin : Fri Feb 4 2000
|
||||
copyright : (C) 2000 by Jürgen Vigna
|
||||
email : jug@sad.it
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* 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 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef FORMCOPYRIGHTDIALOG_H
|
||||
#define FORMCOPYRIGHTDIALOG_H
|
||||
|
||||
//Generated area. DO NOT EDIT!!!(begin)
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
//Generated area. DO NOT EDIT!!!(end)
|
||||
|
||||
#include <qdialog.h>
|
||||
|
||||
/**
|
||||
*@author Jürgen Vigna
|
||||
*/
|
||||
|
||||
class FormCopyrightDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FormCopyrightDialog(QWidget *parent=0, const char *name=0,
|
||||
bool modal=false, WFlags f=0);
|
||||
~FormCopyrightDialog();
|
||||
|
||||
protected:
|
||||
void initDialog();
|
||||
//Generated area. DO NOT EDIT!!!(begin)
|
||||
QLabel *labelWho;
|
||||
QLabel *labelGNU;
|
||||
QLabel *labelLyX;
|
||||
QPushButton *buttonOk;
|
||||
//Generated area. DO NOT EDIT!!!(end)
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
36
src/frontends/kde/formcopyrightdialogdata.C
Normal file
36
src/frontends/kde/formcopyrightdialogdata.C
Normal file
@ -0,0 +1,36 @@
|
||||
/**********************************************************************
|
||||
--- KDevelop (KDlgEdit) generated file ---
|
||||
|
||||
Last generated: Mon Feb 7 12:39:05 2000
|
||||
|
||||
DO NOT EDIT!!! This file will be automatically
|
||||
regenerated by KDevelop. All changes will be lost.
|
||||
|
||||
**********************************************************************/
|
||||
#include "formcopyrightdialog.h"
|
||||
|
||||
void FormCopyrightDialog::initDialog(){
|
||||
this->resize(400,400);
|
||||
this->setMinimumSize(0,0);
|
||||
labelWho= new QLabel(this,"NoName");
|
||||
labelWho->setGeometry(10,10,380,50);
|
||||
labelWho->setMinimumSize(0,0);
|
||||
labelWho->setText("LyX is Copyright ( C) 1995 by Matthias Ettrich, \n1995-2000 LyX Team");
|
||||
|
||||
labelGNU= new QLabel(this,"NoName");
|
||||
labelGNU->setGeometry(10,70,380,90);
|
||||
labelGNU->setMinimumSize(0,0);
|
||||
labelGNU->setText("This program is free software; you can redistribute it\nand/or modify it under the terms of the GNU General\nPublic License as published by the Free Software\nFoundation; either version 2 of the License, or\n(at your option) any later version.");
|
||||
|
||||
labelLyX= new QLabel(this,"NoName");
|
||||
labelLyX->setGeometry(10,170,380,180);
|
||||
labelLyX->setMinimumSize(0,0);
|
||||
labelLyX->setText("LyX is distributed in the hope that it will\nbe useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of\nthe GNU General Public License\nalong with this program; if not, write to\nthe Free Software Foundation, Inc., \n675 Mass Ave, Cambridge, MA 02139, USA.");
|
||||
|
||||
buttonOk= new QPushButton(this,"NoName");
|
||||
buttonOk->setGeometry(130,360,140,30);
|
||||
buttonOk->setMinimumSize(0,0);
|
||||
buttonOk->setText("OK");
|
||||
buttonOk->setDefault(true);
|
||||
|
||||
}
|
101
src/frontends/kde/lyxgui.kdevprj
Normal file
101
src/frontends/kde/lyxgui.kdevprj
Normal file
@ -0,0 +1,101 @@
|
||||
# KDE Config File
|
||||
[formcopyright.C]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=SOURCE
|
||||
[Workspace_1]
|
||||
openfiles=Untitled.h,Untitled.cpp,/nfs/sinco/source/lyx/rae/src/frontends/kde/formcopyrightdialog.h,
|
||||
show_outputview=true
|
||||
show_treeview=true
|
||||
header_file=/nfs/sinco/source/lyx/rae/src/frontends/kde/formcopyrightdialog.h
|
||||
cpp_file=Untitled.cpp
|
||||
browser_file=file:/usr/doc/qt1x-devel-1.44/qdialog.html
|
||||
[Config for BinMakefileAm]
|
||||
ldflags=
|
||||
cxxflags=-O0 -g3 -Wall
|
||||
bin_program=lyxgui
|
||||
[formcopyright.h]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=HEADER
|
||||
[dlg/Makefile.am]
|
||||
files=dlg/formcopyrightdialog.kdevdlg,
|
||||
type=static_library
|
||||
sub_dirs=
|
||||
[LFV Groups]
|
||||
Dialogs=*.kdevdlg,
|
||||
GNU=
|
||||
Others=*,
|
||||
Translations=*.po,
|
||||
groups=Headers,Sources,Dialogs,Translations,GNU,Others,
|
||||
Sources=*.cpp,*.c,*.cc,*.C,*.cxx,*.ec,*.ecpp,*.lxx,*.l++,*.ll,*.l,
|
||||
Headers=*.h,*.hxx,*.hpp,*.H,
|
||||
[dlg/formcopyrightdialog.kdevdlg]
|
||||
widget_files=
|
||||
data_file=formcopyrightdialogdata.C
|
||||
install_location=
|
||||
classname=FormCopyrightDialog
|
||||
baseclass=QDialog
|
||||
header_file=formcopyrightdialog.h
|
||||
dist=true
|
||||
cpp_file=formcopyrightdialog.h
|
||||
install=false
|
||||
is_toplevel_dialog=true
|
||||
type=KDEV_DIALOG
|
||||
[kde/dlg/formcopyrightdialog.kdevdlg]
|
||||
widget_files=
|
||||
data_file=formcopyrightdialogdata.C
|
||||
install_location=
|
||||
classname=FormCopyrightDialog
|
||||
baseclass=QWidget
|
||||
header_file=formcopyrightdialog.h
|
||||
dist=false
|
||||
cpp_file=formcopyrightdialog.h
|
||||
install=false
|
||||
is_toplevel_dialog=false
|
||||
type=KDEV_DIALOG
|
||||
[General]
|
||||
makefiles=Makefile.am,dlg/Makefile.am,
|
||||
version_control=None
|
||||
author=Jürgen Vigna
|
||||
project_type=normal_empty
|
||||
sub_dir=dlg/
|
||||
lfv_open_groups=Headers,Sources,Dialogs,
|
||||
workspace=1
|
||||
version=0.1
|
||||
project_name=LyxGUI
|
||||
email=jug@sad.it
|
||||
kdevprj_version=1.0beta2
|
||||
[formcopyrightdialog.C]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=SOURCE
|
||||
[formcopyrightdata.C]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=SOURCE
|
||||
[Makefile.am]
|
||||
files=lyxgui.kdevprj,FormCopyright.h,FormCopyright.C,formcopyrightdialog.h,formcopyrightdialog.C,formcopyrightdialogdata.C,
|
||||
sub_dirs=dlg,
|
||||
type=prog_main
|
||||
sub_dirs=dlg<,
|
||||
type=normal
|
||||
[lyxgui.kdevprj]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=DATA
|
||||
[formcopyrightdialogdata.C]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=SOURCE
|
||||
[formcopyrightdialog.h]
|
||||
install_location=
|
||||
dist=true
|
||||
install=false
|
||||
type=HEADER
|
6
src/frontends/xforms/.cvsignore
Normal file
6
src/frontends/xforms/.cvsignore
Normal file
@ -0,0 +1,6 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
*.deps
|
||||
*.lo
|
||||
.libs
|
||||
libxforms.la
|
109
src/frontends/xforms/Dialogs.C
Normal file
109
src/frontends/xforms/Dialogs.C
Normal file
@ -0,0 +1,109 @@
|
||||
#include <config.h>
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "FormCopyright.h"
|
||||
#include "FormPrint.h"
|
||||
#include "FormPreferences.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
|
||||
Dialogs::Dialogs(LyXView * lv)
|
||||
{
|
||||
dialogs_.push_back(new FormCopyright(lv, this));
|
||||
dialogs_.push_back(new FormPrint(lv, this));
|
||||
dialogs_.push_back(new FormPreferences(lv, this));
|
||||
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
hideAll.connect(hideBufferDependent.slot());
|
||||
}
|
||||
|
||||
Dialogs::~Dialogs()
|
||||
{
|
||||
for (vector<DialogBase *>::iterator iter = dialogs_.begin();
|
||||
iter != dialogs_.end();
|
||||
++iter) {
|
||||
delete *iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
Q. WHY does Dialogs::Dialogs pass `this' to dialog constructors?
|
||||
|
||||
A. To avoid a segfault.
|
||||
The dialog constructors need to connect to their
|
||||
respective showSomeDialog signal(*) but in order to do
|
||||
that they need to get the address of the Dialogs instance
|
||||
from LyXView::getDialogs(). However, since the Dialogs
|
||||
instance is still being constructed at that time
|
||||
LyXView::getDialogs() will *not* return the correct
|
||||
address because it hasn't finished being constructed.
|
||||
A Catch-22 situation (or is that the chicken and the egg...).
|
||||
So to get around the problem we pass the address of
|
||||
the newly created Dialogs instance using `this'.
|
||||
|
||||
(*) -- I'm using signals exclusively to guarantee that the gui code
|
||||
remains hidden from the rest of the system. In fact the only
|
||||
header related to dialogs that anything in the non-gui-specific
|
||||
code gets to see is Dialogs.h! Even Dialogs.h doesn't know what a
|
||||
FormCopyright class looks like or that its even going to be used!
|
||||
|
||||
No other gui dialog headers are seen outside of the gui-specific
|
||||
directories! This ensures that the gui is completely separate from
|
||||
the rest of LyX. All this through the use of a few simple signals.
|
||||
BUT, the price is that during construction we need to connect the
|
||||
implementations show() method to the showSomeDialog signal and this
|
||||
requires that we have an instance of Dialogs and the problem mentioned
|
||||
above.
|
||||
|
||||
Almost all other dialogs should be able to operate using the same style
|
||||
of signalling used for Copyright. Exceptions should be handled
|
||||
by adding a specific show or update signal. For example, spellchecker
|
||||
needs to set the next suspect word and its options/replacements so we
|
||||
need a:
|
||||
Signal0<void> updateSpellChecker;
|
||||
|
||||
Since we would have to have a
|
||||
Signal0<void> showSpellChecker;
|
||||
|
||||
in order to just see the spellchecker and let the user push the [Start]
|
||||
button then the updateSpellChecker signal will make the SpellChecker
|
||||
dialog get the new word and replacements list from LyX. If you really,
|
||||
really wanted to you could define a signal that would pass the new
|
||||
word and replacements:
|
||||
Signal2<void, string, vector<string> > updateSpellChecker;
|
||||
|
||||
(or something similar) but, why bother when the spellchecker can get
|
||||
it anyway with a LyXFunc call or two. Besides if someone extends
|
||||
what a dialog does then they also have to change code in the rest of
|
||||
LyX to pass more parameters or get the extra info via a function
|
||||
call anyway. Thus reducing the independence of the two code bases.
|
||||
|
||||
We don't need a separate update signal for each dialog because most of
|
||||
them will be changed only when the buffer is changed (either by closing
|
||||
the current open buffer or switching to another buffer in the current
|
||||
LyXView -- different BufferView same LyXView or same BufferView same
|
||||
LyXView).
|
||||
|
||||
So we minimise signals but maximise independence and programming
|
||||
simplicity, understandability and maintainability. It's also
|
||||
extremely easy to add support for Qt or gtk-- because they use
|
||||
signals already. Guis that use callbacks, like xforms, must have their
|
||||
code wrapped up like that in the form_copyright.[Ch] which is awkward
|
||||
but will at least allow multiple instances of the same dialog.
|
||||
|
||||
Signals will also be a great help in controlling the splashscreen --
|
||||
once signalled to hide it can disconnect from the signal and remove
|
||||
itself from memory.
|
||||
|
||||
LyXFuncs will be used for requesting/setting LyX internal info. This
|
||||
will ensure that scripts or LyXServer-connected applications can all
|
||||
have access to the same calls as the internal user-interface.
|
||||
|
||||
******************************************************************************/
|
106
src/frontends/xforms/FormCopyright.C
Normal file
106
src/frontends/xforms/FormCopyright.C
Normal file
@ -0,0 +1,106 @@
|
||||
/* FormCopyright.C
|
||||
* FormCopyright Interface Class Implementation
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "xform_macros.h"
|
||||
#include "FormCopyright.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
C_RETURNCB(FormCopyright, WMHideCB)
|
||||
C_GENERICCB(FormCopyright, OKCB)
|
||||
|
||||
FormCopyright::FormCopyright(LyXView * lv, Dialogs * d)
|
||||
: dialog_(0), lv_(lv), d_(d), h_(0)
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showCopyright.connect(slot(this, &FormCopyright::show));
|
||||
}
|
||||
|
||||
|
||||
FormCopyright::~FormCopyright()
|
||||
{
|
||||
free();
|
||||
}
|
||||
|
||||
|
||||
void FormCopyright::build()
|
||||
{
|
||||
dialog_ = build_copyright();
|
||||
}
|
||||
|
||||
|
||||
void FormCopyright::show()
|
||||
{
|
||||
if (!dialog_) {
|
||||
build();
|
||||
fl_set_form_atclose(dialog_->form_copyright,
|
||||
C_FormCopyrightWMHideCB, 0);
|
||||
}
|
||||
|
||||
if (dialog_->form_copyright->visible) {
|
||||
fl_raise_form(dialog_->form_copyright);
|
||||
} else {
|
||||
fl_show_form(dialog_->form_copyright,
|
||||
FL_PLACE_MOUSE,
|
||||
FL_FULLBORDER,
|
||||
_("Copyright and Warranty"));
|
||||
h_ = d_->hideAll.connect(slot(this, &FormCopyright::hide));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormCopyright::hide()
|
||||
{
|
||||
if (dialog_
|
||||
&& dialog_->form_copyright
|
||||
&& dialog_->form_copyright->visible) {
|
||||
fl_hide_form(dialog_->form_copyright);
|
||||
h_.disconnect();
|
||||
}
|
||||
free();
|
||||
}
|
||||
|
||||
|
||||
void FormCopyright::free()
|
||||
{
|
||||
// we don't need to delete h here because
|
||||
// hide() does that after disconnecting.
|
||||
if (dialog_) {
|
||||
if (dialog_->form_copyright
|
||||
&& dialog_->form_copyright->visible) {
|
||||
hide();
|
||||
}
|
||||
fl_free_form(dialog_->form_copyright);
|
||||
delete dialog_;
|
||||
dialog_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FormCopyright::WMHideCB(FL_FORM * form, void *)
|
||||
{
|
||||
// Ensure that the signal h is disconnected even if the
|
||||
// window manager is used to close the dialog.
|
||||
FormCopyright * pre = static_cast<FormCopyright*>(form->u_vdata);
|
||||
pre->hide();
|
||||
return FL_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
void FormCopyright::OKCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormCopyright * pre = static_cast<FormCopyright*>(ob->form->u_vdata);
|
||||
pre->hide();
|
||||
}
|
86
src/frontends/xforms/FormCopyright.h
Normal file
86
src/frontends/xforms/FormCopyright.h
Normal file
@ -0,0 +1,86 @@
|
||||
// -*- C++ -*-
|
||||
/* FormCopyright.h
|
||||
* FormCopyright Interface Class
|
||||
* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file Copyright 2000
|
||||
* Allan Rae
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#ifndef FORMCOPYRIGHT_H
|
||||
#define FORMCOPYRIGHT_H
|
||||
|
||||
#include "DialogBase.h"
|
||||
#include "form_copyright.h"
|
||||
|
||||
class Dialogs;
|
||||
// same arguement as in Dialogs.h s/LyX/UI/
|
||||
class LyXView;
|
||||
|
||||
/** This class provides an XForms implementation of the FormCopyright Dialog.
|
||||
*/
|
||||
class FormCopyright : public DialogBase {
|
||||
public:
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
/// #FormCopyright x(LyXFunc ..., Dialogs ...);#
|
||||
FormCopyright(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormCopyright();
|
||||
//@}
|
||||
|
||||
/**@name Real per-instance Callback Methods */
|
||||
//@{
|
||||
static int WMHideCB(FL_FORM *, void *);
|
||||
static void OKCB(FL_OBJECT *, long);
|
||||
//@}
|
||||
|
||||
private:
|
||||
FormCopyright() {}
|
||||
FormCopyright(FormCopyright &) : DialogBase() {}
|
||||
|
||||
/**@name Slot Methods */
|
||||
//@{
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Not used but we've got to implement it.
|
||||
void update() {}
|
||||
//@}
|
||||
|
||||
/// Build the dialog
|
||||
void build();
|
||||
///
|
||||
FD_form_copyright * build_copyright();
|
||||
/// Explicitly free the dialog.
|
||||
void free();
|
||||
|
||||
/**@name Private Data */
|
||||
//@{
|
||||
/// Real GUI implementation.
|
||||
FD_form_copyright * dialog_;
|
||||
/** Which LyXFunc do we use?
|
||||
We could modify Dialogs to have a visible LyXFunc* instead and
|
||||
save a couple of bytes per dialog.
|
||||
*/
|
||||
LyXView * lv_;
|
||||
/** Which Dialogs do we belong to?
|
||||
Used so we can get at the signals we have to connect to.
|
||||
*/
|
||||
Dialogs * d_;
|
||||
/// Hide connection.
|
||||
Connection h_;
|
||||
//@}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
399
src/frontends/xforms/FormPreferences.C
Normal file
399
src/frontends/xforms/FormPreferences.C
Normal file
@ -0,0 +1,399 @@
|
||||
/* FormPreferences.C
|
||||
* FormPreferences Interface Class Implementation
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "FormPreferences.h"
|
||||
#include "xform_macros.h"
|
||||
#include "input_validators.h"
|
||||
#include "LyXView.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "Dialogs.h"
|
||||
#include "lyxrc.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::slot;
|
||||
#endif
|
||||
|
||||
C_RETURNCB(FormPreferences, WMHideCB)
|
||||
C_GENERICCB(FormPreferences, OKCB)
|
||||
C_GENERICCB(FormPreferences, ApplyCB)
|
||||
C_GENERICCB(FormPreferences, CancelCB)
|
||||
C_GENERICCB(FormPreferences, InputCB)
|
||||
|
||||
|
||||
FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
|
||||
: dialog_(0), bind_(0), misc_(0), screen_fonts_(0),
|
||||
interface_fonts_(0), printer_(0), paths_(0),
|
||||
lv_(lv), d_(d), u_(0), h_(0)
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showPreferences.connect(slot(this,&FormPreferences::show));
|
||||
}
|
||||
|
||||
|
||||
FormPreferences::~FormPreferences()
|
||||
{
|
||||
free();
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::build()
|
||||
{
|
||||
dialog_ = build_preferences();
|
||||
bind_ = build_bind();
|
||||
screen_fonts_ = build_screen_fonts();
|
||||
interface_fonts_ = build_interface_fonts();
|
||||
misc_ = build_misc();
|
||||
printer_ = build_printer();
|
||||
paths_ = build_paths();
|
||||
|
||||
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
||||
_("Bindings"),
|
||||
bind_->form_bind);
|
||||
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
||||
_("Screen Fonts"),
|
||||
screen_fonts_->form_screen_fonts);
|
||||
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
||||
_("Interface Fonts"),
|
||||
interface_fonts_->form_interface_fonts);
|
||||
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
||||
_("Miscellaneous"),
|
||||
misc_->form_misc);
|
||||
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
||||
_("Printer"),
|
||||
printer_->form_printer);
|
||||
fl_addto_tabfolder(dialog_->tabfolder_prefs,
|
||||
_("Paths"),
|
||||
paths_->form_paths);
|
||||
|
||||
fl_set_form_atclose(dialog_->form_preferences,
|
||||
C_FormPreferencesWMHideCB, 0);
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::show()
|
||||
{
|
||||
if (!dialog_) {
|
||||
build();
|
||||
}
|
||||
update(); // make sure its up-to-date
|
||||
|
||||
if (dialog_->form_preferences->visible) {
|
||||
fl_raise_form(dialog_->form_preferences);
|
||||
} else {
|
||||
fl_show_form(dialog_->form_preferences,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE,
|
||||
FL_FULLBORDER,
|
||||
_("Preferences"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::hide()
|
||||
{
|
||||
if (dialog_
|
||||
&& dialog_->form_preferences
|
||||
&& dialog_->form_preferences->visible) {
|
||||
fl_hide_form(dialog_->form_preferences);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::apply()
|
||||
{
|
||||
// set the new lyxrc entries
|
||||
// many of these need to trigger other functions when the assignment
|
||||
// is made. For example, screen zoom and font types. These could be
|
||||
// handled either by signals/slots in lyxrc or just directly call the
|
||||
// associated functions here.
|
||||
|
||||
// Bind tab
|
||||
lyxrc.bind_file = fl_get_input(bind_->input_bind);
|
||||
// Misc tab
|
||||
lyxrc.show_banner = fl_get_button(misc_->check_banner);
|
||||
lyxrc.auto_region_delete = fl_get_button(misc_->
|
||||
check_auto_region_delete);
|
||||
lyxrc.exit_confirmation = fl_get_button(misc_->check_exit_confirm);
|
||||
lyxrc.display_shortcuts = fl_get_button(misc_->check_display_shortcuts);
|
||||
lyxrc.autosave = static_cast<unsigned int>
|
||||
(fl_get_counter_value(misc_->counter_autosave));
|
||||
lyxrc.ascii_linelen = static_cast<unsigned int>
|
||||
(fl_get_counter_value(misc_->counter_line_len));
|
||||
// Screen fonts
|
||||
lyxrc.roman_font_name = fl_get_input(screen_fonts_->input_roman);
|
||||
lyxrc.sans_font_name = fl_get_input(screen_fonts_->input_sans);
|
||||
lyxrc.typewriter_font_name = fl_get_input(screen_fonts_->
|
||||
input_typewriter);
|
||||
lyxrc.font_norm = fl_get_input(screen_fonts_->input_encoding);
|
||||
lyxrc.use_scalable_fonts = fl_get_button(screen_fonts_->check_scalable);
|
||||
lyxrc.zoom = static_cast<unsigned int>
|
||||
(fl_get_counter_value(screen_fonts_->counter_zoom));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_TINY] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_tiny));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_script));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_footnote));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_SMALL] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_small));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_NORMAL] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_normal));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_LARGE] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_large));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_LARGER] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_larger));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_LARGEST] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_largest));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_HUGE] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_huge));
|
||||
lyxrc.font_sizes[LyXFont::SIZE_HUGER] =
|
||||
strToDbl(fl_get_input(screen_fonts_->input_huger));
|
||||
// interface fonts
|
||||
lyxrc.popup_font_name =
|
||||
fl_get_input(interface_fonts_->input_popup_font);
|
||||
lyxrc.menu_font_name = fl_get_input(interface_fonts_->input_menu_font);
|
||||
lyxrc.font_norm_menu = fl_get_input(interface_fonts_->input_encoding);
|
||||
// printer
|
||||
lyxrc.print_adapt_output = fl_get_button(printer_->check_adapt_output);
|
||||
lyxrc.print_command = fl_get_input(printer_->input_command);
|
||||
lyxrc.print_pagerange_flag = fl_get_input(printer_->input_page_range);
|
||||
lyxrc.print_copies_flag = fl_get_input(printer_->input_copies);
|
||||
lyxrc.print_reverse_flag = fl_get_input(printer_->input_reverse);
|
||||
lyxrc.print_to_printer = fl_get_input(printer_->input_to_printer);
|
||||
lyxrc.print_file_extension =
|
||||
fl_get_input(printer_->input_file_extension);
|
||||
lyxrc.print_spool_command =
|
||||
fl_get_input(printer_->input_spool_command);
|
||||
lyxrc.print_paper_flag = fl_get_input(printer_->input_paper_type);
|
||||
lyxrc.print_evenpage_flag = fl_get_input(printer_->input_even_pages);
|
||||
lyxrc.print_oddpage_flag = fl_get_input(printer_->input_odd_pages);
|
||||
lyxrc.print_collcopies_flag = fl_get_input(printer_->input_collated);
|
||||
lyxrc.print_landscape_flag = fl_get_input(printer_->input_landscape);
|
||||
lyxrc.print_to_file = fl_get_input(printer_->input_to_file);
|
||||
lyxrc.print_extra_options =
|
||||
fl_get_input(printer_->input_extra_options);
|
||||
lyxrc.print_spool_printerprefix =
|
||||
fl_get_input(printer_->input_spool_prefix);
|
||||
lyxrc.print_paper_dimension_flag =
|
||||
fl_get_input(printer_->input_paper_size);
|
||||
lyxrc.printer = fl_get_input(printer_->input_name);
|
||||
// paths
|
||||
lyxrc.document_path = fl_get_input(paths_->input_default_path);
|
||||
lyxrc.template_path = fl_get_input(paths_->input_template_path);
|
||||
lyxrc.tempdir_path = fl_get_input(paths_->input_temp_dir);
|
||||
lyxrc.lastfiles = fl_get_input(paths_->input_lastfiles);
|
||||
lyxrc.backupdir_path = fl_get_input(paths_->input_backup_path);
|
||||
lyxrc.use_tempdir = fl_get_button(paths_->check_use_temp_dir);
|
||||
lyxrc.check_lastfiles = fl_get_button(paths_->check_last_files);
|
||||
lyxrc.make_backup = fl_get_button(paths_->check_make_backups);
|
||||
lyxrc.num_lastfiles = static_cast<unsigned int>
|
||||
(fl_get_counter_value(paths_->counter_lastfiles));
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::update()
|
||||
{
|
||||
if (dialog_) {
|
||||
// read lyxrc entries
|
||||
// Bind tab
|
||||
fl_set_input(bind_->input_bind, lyxrc.bind_file.c_str());
|
||||
// Misc tab
|
||||
fl_set_button(misc_->check_banner,
|
||||
lyxrc.show_banner);
|
||||
fl_set_button(misc_->check_auto_region_delete,
|
||||
lyxrc.auto_region_delete);
|
||||
fl_set_button(misc_->check_exit_confirm,
|
||||
lyxrc.exit_confirmation);
|
||||
fl_set_button(misc_->check_display_shortcuts,
|
||||
lyxrc.display_shortcuts);
|
||||
fl_set_counter_value(misc_->counter_autosave,
|
||||
lyxrc.autosave);
|
||||
fl_set_counter_value(misc_->counter_line_len,
|
||||
lyxrc.ascii_linelen);
|
||||
// Screen fonts
|
||||
fl_set_input(screen_fonts_->input_roman,
|
||||
lyxrc.roman_font_name.c_str());
|
||||
fl_set_input(screen_fonts_->input_sans,
|
||||
lyxrc.sans_font_name.c_str());
|
||||
fl_set_input(screen_fonts_->input_typewriter,
|
||||
lyxrc.typewriter_font_name.c_str());
|
||||
fl_set_input(screen_fonts_->input_encoding,
|
||||
lyxrc.font_norm.c_str());
|
||||
fl_set_button(screen_fonts_->check_scalable,
|
||||
lyxrc.use_scalable_fonts);
|
||||
fl_set_counter_value(screen_fonts_->counter_zoom,
|
||||
lyxrc.zoom);
|
||||
fl_set_input(screen_fonts_->input_tiny,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_TINY]).c_str());
|
||||
fl_set_input(screen_fonts_->input_script,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str());
|
||||
fl_set_input(screen_fonts_->input_footnote,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str());
|
||||
fl_set_input(screen_fonts_->input_small,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_SMALL]).c_str());
|
||||
fl_set_input(screen_fonts_->input_normal,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_NORMAL]).c_str());
|
||||
fl_set_input(screen_fonts_->input_large,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGE]).c_str());
|
||||
fl_set_input(screen_fonts_->input_larger,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGER]).c_str());
|
||||
fl_set_input(screen_fonts_->input_largest,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGEST]).c_str());
|
||||
fl_set_input(screen_fonts_->input_huge,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGE]).c_str());
|
||||
fl_set_input(screen_fonts_->input_huger,
|
||||
tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGER]).c_str());
|
||||
// interface fonts
|
||||
fl_set_input(interface_fonts_->input_popup_font,
|
||||
lyxrc.popup_font_name.c_str());
|
||||
fl_set_input(interface_fonts_->input_menu_font,
|
||||
lyxrc.menu_font_name.c_str());
|
||||
fl_set_input(interface_fonts_->input_encoding,
|
||||
lyxrc.font_norm_menu.c_str());
|
||||
// printer
|
||||
fl_set_button(printer_->check_adapt_output,
|
||||
lyxrc.print_adapt_output);
|
||||
fl_set_input(printer_->input_command,
|
||||
lyxrc.print_command.c_str());
|
||||
fl_set_input(printer_->input_page_range,
|
||||
lyxrc.print_pagerange_flag.c_str());
|
||||
fl_set_input(printer_->input_copies,
|
||||
lyxrc.print_copies_flag.c_str());
|
||||
fl_set_input(printer_->input_reverse,
|
||||
lyxrc.print_reverse_flag.c_str());
|
||||
fl_set_input(printer_->input_to_printer,
|
||||
lyxrc.print_to_printer.c_str());
|
||||
fl_set_input(printer_->input_file_extension,
|
||||
lyxrc.print_file_extension.c_str());
|
||||
fl_set_input(printer_->input_spool_command,
|
||||
lyxrc.print_spool_command.c_str());
|
||||
fl_set_input(printer_->input_paper_type,
|
||||
lyxrc.print_paper_flag.c_str());
|
||||
fl_set_input(printer_->input_even_pages,
|
||||
lyxrc.print_evenpage_flag.c_str());
|
||||
fl_set_input(printer_->input_odd_pages,
|
||||
lyxrc.print_oddpage_flag.c_str());
|
||||
fl_set_input(printer_->input_collated,
|
||||
lyxrc.print_collcopies_flag.c_str());
|
||||
fl_set_input(printer_->input_landscape,
|
||||
lyxrc.print_landscape_flag.c_str());
|
||||
fl_set_input(printer_->input_to_file,
|
||||
lyxrc.print_to_file.c_str());
|
||||
fl_set_input(printer_->input_extra_options,
|
||||
lyxrc.print_extra_options.c_str());
|
||||
fl_set_input(printer_->input_spool_prefix,
|
||||
lyxrc.print_spool_printerprefix.c_str());
|
||||
fl_set_input(printer_->input_paper_size,
|
||||
lyxrc.print_paper_dimension_flag.c_str());
|
||||
fl_set_input(printer_->input_name,
|
||||
lyxrc.printer.c_str());
|
||||
// paths
|
||||
fl_set_input(paths_->input_default_path,
|
||||
lyxrc.document_path.c_str());
|
||||
fl_set_input(paths_->input_template_path,
|
||||
lyxrc.template_path.c_str());
|
||||
fl_set_input(paths_->input_temp_dir,
|
||||
lyxrc.tempdir_path.c_str());
|
||||
fl_set_input(paths_->input_lastfiles,
|
||||
lyxrc.lastfiles.c_str());
|
||||
fl_set_input(paths_->input_backup_path,
|
||||
lyxrc.backupdir_path.c_str());
|
||||
fl_set_button(paths_->check_use_temp_dir,
|
||||
lyxrc.use_tempdir);
|
||||
fl_set_button(paths_->check_last_files,
|
||||
lyxrc.check_lastfiles);
|
||||
fl_set_button(paths_->check_make_backups,
|
||||
lyxrc.make_backup);
|
||||
fl_set_counter_value(paths_->counter_lastfiles,
|
||||
lyxrc.num_lastfiles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::input()
|
||||
{
|
||||
bool activate = true;
|
||||
//
|
||||
// whatever checks you need
|
||||
//
|
||||
if (activate) {
|
||||
fl_activate_object(dialog_->button_ok);
|
||||
fl_activate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_BLACK);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_BLACK);
|
||||
} else {
|
||||
fl_deactivate_object(dialog_->button_ok);
|
||||
fl_deactivate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::free()
|
||||
{
|
||||
// we don't need to delete u and h here because
|
||||
// hide() does that after disconnecting.
|
||||
if (dialog_) {
|
||||
if (dialog_->form_preferences
|
||||
&& dialog_->form_preferences->visible) {
|
||||
hide();
|
||||
}
|
||||
fl_free_form(dialog_->form_preferences);
|
||||
delete dialog_;
|
||||
dialog_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FormPreferences::WMHideCB(FL_FORM * form, void *)
|
||||
{
|
||||
// Ensure that the signals (u and h) are disconnected even if the
|
||||
// window manager is used to close the dialog.
|
||||
FormPreferences * pre = static_cast<FormPreferences*>(form->u_vdata);
|
||||
pre->hide();
|
||||
return FL_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::OKCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
pre->hide();
|
||||
|
||||
pre->lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES);
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::ApplyCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::CancelCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::InputCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormPreferences * pre = static_cast<FormPreferences*>(ob->form->u_vdata);
|
||||
pre->input();
|
||||
}
|
||||
|
||||
|
||||
|
117
src/frontends/xforms/FormPreferences.h
Normal file
117
src/frontends/xforms/FormPreferences.h
Normal file
@ -0,0 +1,117 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file copyright 1999-2000
|
||||
* Allan Rae
|
||||
*======================================================*/
|
||||
/* FormPreferences.h
|
||||
* FormPreferences Interface Class
|
||||
*/
|
||||
|
||||
#ifndef FORMPREFERENCES_H
|
||||
#define FORMPREFERENCES_H
|
||||
|
||||
#include "DialogBase.h"
|
||||
#include "form_preferences.h"
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Connection;
|
||||
#endif
|
||||
|
||||
class LyXView;
|
||||
class Dialogs;
|
||||
|
||||
/** This class provides an XForms implementation of the FormPreferences Dialog.
|
||||
The preferences dialog allows users to set/save their preferences.
|
||||
*/
|
||||
class FormPreferences : public DialogBase {
|
||||
public:
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
/// #FormPreferences x(LyXFunc ..., Dialogs ...);#
|
||||
FormPreferences(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormPreferences();
|
||||
//@}
|
||||
|
||||
/**@name Real per-instance Callback Methods */
|
||||
//@{
|
||||
static int WMHideCB(FL_FORM *, void *);
|
||||
static void OKCB(FL_OBJECT *, long);
|
||||
static void ApplyCB(FL_OBJECT *, long);
|
||||
static void CancelCB(FL_OBJECT *, long);
|
||||
static void InputCB(FL_OBJECT *, long);
|
||||
//@}
|
||||
|
||||
private:
|
||||
FormPreferences() {}
|
||||
FormPreferences(FormPreferences &) : DialogBase() {}
|
||||
|
||||
/**@name Slot Methods */
|
||||
//@{
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
//@}
|
||||
|
||||
/**@name Dialog internal methods */
|
||||
//@{
|
||||
/// Apply from dialog
|
||||
void apply();
|
||||
/// Filter the inputs
|
||||
void input();
|
||||
/// Build the dialog
|
||||
void build();
|
||||
///
|
||||
FD_form_preferences * build_preferences();
|
||||
///
|
||||
FD_form_bind * build_bind();
|
||||
///
|
||||
FD_form_misc * build_misc();
|
||||
///
|
||||
FD_form_screen_fonts * build_screen_fonts();
|
||||
///
|
||||
FD_form_interface_fonts * build_interface_fonts();
|
||||
///
|
||||
FD_form_printer * build_printer();
|
||||
///
|
||||
FD_form_paths * build_paths();
|
||||
/// Explicitly free the dialog.
|
||||
void free();
|
||||
//@}
|
||||
|
||||
/**@name Private Data */
|
||||
//@{
|
||||
/// Real GUI implementation.
|
||||
FD_form_preferences * dialog_;
|
||||
///
|
||||
FD_form_bind * bind_;
|
||||
///
|
||||
FD_form_misc * misc_;
|
||||
///
|
||||
FD_form_screen_fonts * screen_fonts_;
|
||||
///
|
||||
FD_form_interface_fonts * interface_fonts_;
|
||||
///
|
||||
FD_form_printer * printer_;
|
||||
///
|
||||
FD_form_paths * paths_;
|
||||
/// Which LyXView do we belong to?
|
||||
LyXView * lv_;
|
||||
Dialogs * d_;
|
||||
/// Update connection.
|
||||
Connection u_;
|
||||
/// Hide connection.
|
||||
Connection h_;
|
||||
//@}
|
||||
};
|
||||
|
||||
#endif
|
376
src/frontends/xforms/FormPrint.C
Normal file
376
src/frontends/xforms/FormPrint.C
Normal file
@ -0,0 +1,376 @@
|
||||
/* FormPrint.C
|
||||
* FormPrint Interface Class Implementation
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "FormPrint.h"
|
||||
#include "xform_macros.h"
|
||||
#include "input_validators.h"
|
||||
#include "LyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "lyxrc.h"
|
||||
#include "PrinterParams.h"
|
||||
#include "Liason.h"
|
||||
#include "debug.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::slot;
|
||||
#endif
|
||||
|
||||
#ifdef CXX_WORKING_NAMESPACES
|
||||
using Liason::printBuffer;
|
||||
using Liason::getPrinterParams;
|
||||
#endif
|
||||
|
||||
C_RETURNCB(FormPrint, WMHideCB)
|
||||
C_GENERICCB(FormPrint, OKCB)
|
||||
C_GENERICCB(FormPrint, ApplyCB)
|
||||
C_GENERICCB(FormPrint, CancelCB)
|
||||
C_GENERICCB(FormPrint, InputCB)
|
||||
|
||||
|
||||
FormPrint::FormPrint(LyXView * lv, Dialogs * d)
|
||||
: dialog_(0), lv_(lv), d_(d), u_(0), h_(0)
|
||||
{
|
||||
// let the dialog be shown
|
||||
// This is a permanent connection so we won't bother
|
||||
// storing a copy because we won't be disconnecting.
|
||||
d->showPrint.connect(slot(this,&FormPrint::show));
|
||||
}
|
||||
|
||||
|
||||
FormPrint::~FormPrint()
|
||||
{
|
||||
free();
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::build()
|
||||
{
|
||||
dialog_ = build_print();
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::show()
|
||||
{
|
||||
if (!dialog_) {
|
||||
build();
|
||||
// allow controlling of input and ok/apply (de)activation
|
||||
fl_set_input_return(dialog_->input_printer,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return(dialog_->input_file,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return(dialog_->input_from_page,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return(dialog_->input_to_page,
|
||||
FL_RETURN_CHANGED);
|
||||
fl_set_input_return(dialog_->input_count,
|
||||
FL_RETURN_CHANGED);
|
||||
|
||||
// limit these inputs to unsigned integers
|
||||
fl_set_input_filter(dialog_->input_from_page,
|
||||
fl_unsigned_int_filter);
|
||||
fl_set_input_filter(dialog_->input_to_page,
|
||||
fl_unsigned_int_filter);
|
||||
fl_set_input_filter(dialog_->input_count,
|
||||
fl_unsigned_int_filter);
|
||||
|
||||
// what limits (if any) make sense for these?
|
||||
fl_set_input_maxchars(dialog_->input_printer, 255);
|
||||
fl_set_input_maxchars(dialog_->input_file, 255);
|
||||
fl_set_input_maxchars(dialog_->input_from_page, 4); // 9999
|
||||
fl_set_input_maxchars(dialog_->input_to_page, 4); // 9999
|
||||
fl_set_input_maxchars(dialog_->input_count, 4); // 9999
|
||||
|
||||
fl_set_form_atclose(dialog_->form_print,
|
||||
C_FormPrintWMHideCB, 0);
|
||||
}
|
||||
|
||||
update(); // make sure its up-to-date
|
||||
|
||||
if (dialog_->form_print->visible) {
|
||||
fl_raise_form(dialog_->form_print);
|
||||
} else {
|
||||
fl_show_form(dialog_->form_print,
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE,
|
||||
FL_FULLBORDER,
|
||||
_("Print"));
|
||||
u_ = d_->updateBufferDependent.connect(slot(this,
|
||||
&FormPrint::update));
|
||||
h_ = d_->hideBufferDependent.connect(slot(this,
|
||||
&FormPrint::hide));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::hide()
|
||||
{
|
||||
if (dialog_
|
||||
&& dialog_->form_print
|
||||
&& dialog_->form_print->visible) {
|
||||
fl_hide_form(dialog_->form_print);
|
||||
u_.disconnect();
|
||||
h_.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::apply()
|
||||
{
|
||||
if (!lv_->view()->available()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PrinterParams::WhichPages wp(PrinterParams::ALL);
|
||||
if (fl_get_button(dialog_->radio_even_pages)) {
|
||||
wp = PrinterParams::EVEN;
|
||||
} else if (fl_get_button(dialog_->radio_odd_pages)) {
|
||||
wp = PrinterParams::ODD;
|
||||
}
|
||||
|
||||
string from;
|
||||
int to(0);
|
||||
if (strlen(fl_get_input(dialog_->input_from_page)) > 0) {
|
||||
// we have at least one page requested
|
||||
from = fl_get_input(dialog_->input_from_page);
|
||||
if (strlen(fl_get_input(dialog_->input_to_page)) > 0) {
|
||||
// okay we have a range
|
||||
to = strToInt(fl_get_input(dialog_->input_to_page));
|
||||
} // else we only print one page.
|
||||
}
|
||||
|
||||
PrinterParams::Target t(PrinterParams::PRINTER);
|
||||
if (fl_get_button(dialog_->radio_file)) {
|
||||
t = PrinterParams::FILE;
|
||||
}
|
||||
|
||||
// we really should use the return value here I think.
|
||||
if (!printBuffer(lv_->buffer(),
|
||||
PrinterParams(t,
|
||||
string(fl_get_input(dialog_->input_printer)),
|
||||
string(fl_get_input(dialog_->input_file)),
|
||||
wp, from, to,
|
||||
static_cast<bool>(fl_get_button(dialog_->
|
||||
radio_order_reverse)),
|
||||
static_cast<bool>(fl_get_button(dialog_->
|
||||
radio_unsorted)),
|
||||
strToInt(fl_get_input(dialog_->input_count))))) {
|
||||
WriteAlert(_("Error:"),
|
||||
_("Unable to print"),
|
||||
_("Check that your parameters are correct"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::update()
|
||||
{
|
||||
if (dialog_
|
||||
&& lv_->view()->available()) {
|
||||
PrinterParams pp(getPrinterParams(lv_->buffer()));
|
||||
|
||||
fl_set_input(dialog_->input_printer, pp.printer_name.c_str());
|
||||
fl_set_input(dialog_->input_file, pp.file_name.c_str());
|
||||
|
||||
switch (pp.target) {
|
||||
case PrinterParams::FILE:
|
||||
fl_set_button(dialog_->radio_printer, 0);
|
||||
fl_set_button(dialog_->radio_file, 1);
|
||||
break;
|
||||
|
||||
case PrinterParams::PRINTER:
|
||||
default:
|
||||
fl_set_button(dialog_->radio_printer, 1);
|
||||
fl_set_button(dialog_->radio_file, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (pp.reverse_order) {
|
||||
case true:
|
||||
fl_set_button(dialog_->radio_order_normal, 0);
|
||||
fl_set_button(dialog_->radio_order_reverse, 1);
|
||||
break;
|
||||
|
||||
case false:
|
||||
default:
|
||||
fl_set_button(dialog_->radio_order_normal, 1);
|
||||
fl_set_button(dialog_->radio_order_reverse, 0);
|
||||
break;
|
||||
}
|
||||
// should be able to remove the various set_button 0 and rely on radio button
|
||||
// action. Provided xforms is smart enough :D
|
||||
fl_set_button(dialog_->radio_all_pages, 0);
|
||||
fl_set_button(dialog_->radio_odd_pages, 0);
|
||||
fl_set_button(dialog_->radio_even_pages, 0);
|
||||
switch (pp.which_pages) {
|
||||
case PrinterParams::ODD:
|
||||
fl_set_button(dialog_->radio_odd_pages, 1);
|
||||
break;
|
||||
|
||||
case PrinterParams::EVEN:
|
||||
fl_set_button(dialog_->radio_even_pages, 1);
|
||||
break;
|
||||
|
||||
case PrinterParams::ALL:
|
||||
default:
|
||||
fl_set_button(dialog_->radio_all_pages, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
// hmmm... maybe a bit weird but maybe not
|
||||
// we might just be remembering the last
|
||||
// time this was printed.
|
||||
if (!pp.from_page.empty()) {
|
||||
fl_set_input(dialog_->input_from_page,
|
||||
pp.from_page.c_str());
|
||||
// we only set the "to" page of a range
|
||||
// if there's a corresponding "from"
|
||||
fl_activate_object(dialog_->input_to_page);
|
||||
if (pp.to_page) {
|
||||
fl_set_input(dialog_->input_to_page,
|
||||
tostr(pp.to_page).c_str());
|
||||
} else {
|
||||
fl_set_input(dialog_->input_to_page,"");
|
||||
}
|
||||
} else {
|
||||
fl_deactivate_object(dialog_->input_to_page);
|
||||
fl_set_input(dialog_->input_to_page,"");
|
||||
fl_set_input(dialog_->input_from_page,"");
|
||||
}
|
||||
|
||||
fl_set_input(dialog_->input_count,
|
||||
tostr(pp.count_copies).c_str());
|
||||
|
||||
// Even readonly docs can be printed
|
||||
// these 4 activations are probably superfluous but I'm
|
||||
// being explicit for a reason.
|
||||
// They can probably be removed soon along with a few more
|
||||
// of the de/activations above once input() is a bit smarter.
|
||||
fl_activate_object(dialog_->input_count);
|
||||
fl_activate_object(dialog_->input_file);
|
||||
fl_activate_object(dialog_->input_from_page);
|
||||
fl_activate_object(dialog_->input_printer);
|
||||
// and we should always be in a working state upon exit
|
||||
input();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// It would be nice if we checked for cases like:
|
||||
// Print only-odd-pages and from_page == an even number
|
||||
//
|
||||
void FormPrint::input()
|
||||
{
|
||||
bool activate = true;
|
||||
|
||||
// using a fl_input_filter that only permits numbers no '-' or '+'
|
||||
// and the user cannot enter a negative number even if they try.
|
||||
if (strlen(fl_get_input(dialog_->input_from_page))) {
|
||||
// using a page range so activate the "to" field
|
||||
fl_activate_object(dialog_->input_to_page);
|
||||
if (strlen(fl_get_input(dialog_->input_to_page))
|
||||
&& (strToInt(fl_get_input(dialog_->input_from_page))
|
||||
> strToInt(fl_get_input(dialog_->input_to_page)))) {
|
||||
// both from and to have values but from > to
|
||||
// We could have code to silently swap these
|
||||
// values but I'll disable the ok/apply until
|
||||
// the user fixes it since they may be editting
|
||||
// one of the fields.
|
||||
activate = false;
|
||||
// set both backgrounds to red?
|
||||
}
|
||||
} else if (strlen(fl_get_input(dialog_->input_to_page))) {
|
||||
// from is empty but to exists so probably editting from
|
||||
// therefore deactivate ok and apply until form is valid again
|
||||
activate = false;
|
||||
} else {
|
||||
// both from and to are empty. This is valid so activate
|
||||
// ok and apply but deactivate to
|
||||
fl_deactivate_object(dialog_->input_to_page);
|
||||
}
|
||||
|
||||
if (fl_get_button(dialog_->radio_file)
|
||||
&& !strlen(fl_get_input(dialog_->input_file))) {
|
||||
activate = false;
|
||||
}
|
||||
|
||||
// it is probably legal to have no printer name since the system will
|
||||
// have a default printer set. Or should have.
|
||||
// if (fl_get_button(dialog_->radio_printer)
|
||||
// && !strlen(fl_get_input(dialog_->input_printer))) {
|
||||
// activate = false;
|
||||
// }
|
||||
|
||||
if (activate) {
|
||||
fl_activate_object(dialog_->button_ok);
|
||||
fl_activate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_BLACK);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_BLACK);
|
||||
} else {
|
||||
fl_deactivate_object(dialog_->button_ok);
|
||||
fl_deactivate_object(dialog_->button_apply);
|
||||
fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE);
|
||||
fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::free()
|
||||
{
|
||||
// we don't need to delete u and h here because
|
||||
// hide() does that after disconnecting.
|
||||
if (dialog_) {
|
||||
if (dialog_->form_print
|
||||
&& dialog_->form_print->visible) {
|
||||
hide();
|
||||
}
|
||||
fl_free_form(dialog_->form_print);
|
||||
delete dialog_;
|
||||
dialog_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FormPrint::WMHideCB(FL_FORM * form, void *)
|
||||
{
|
||||
// Ensure that the signals (u and h) are disconnected even if the
|
||||
// window manager is used to close the dialog.
|
||||
FormPrint * pre = static_cast<FormPrint*>(form->u_vdata);
|
||||
pre->hide();
|
||||
return FL_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::OKCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormPrint * pre = static_cast<FormPrint*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::ApplyCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormPrint * pre = static_cast<FormPrint*>(ob->form->u_vdata);
|
||||
pre->apply();
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::CancelCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormPrint * pre = static_cast<FormPrint*>(ob->form->u_vdata);
|
||||
pre->hide();
|
||||
}
|
||||
|
||||
|
||||
void FormPrint::InputCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormPrint * pre = static_cast<FormPrint*>(ob->form->u_vdata);
|
||||
pre->input();
|
||||
}
|
93
src/frontends/xforms/FormPrint.h
Normal file
93
src/frontends/xforms/FormPrint.h
Normal file
@ -0,0 +1,93 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* This file copyright 1999-2000
|
||||
* Allan Rae
|
||||
*======================================================*/
|
||||
/* FormPrint.h
|
||||
* FormPrint Interface Class
|
||||
*/
|
||||
|
||||
#ifndef FORMPRINT_H
|
||||
#define FORMPRINT_H
|
||||
|
||||
#include "DialogBase.h"
|
||||
#include "form_print.h"
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Connection;
|
||||
#endif
|
||||
|
||||
class LyXView;
|
||||
class Dialogs;
|
||||
|
||||
/** This class provides an XForms implementation of the FormPrint Dialog.
|
||||
The print dialog allows users to print their documents.
|
||||
*/
|
||||
class FormPrint : public DialogBase {
|
||||
public:
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
/// #FormPrint x(LyXFunc ..., Dialogs ...);#
|
||||
FormPrint(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormPrint();
|
||||
//@}
|
||||
|
||||
/**@name Real per-instance Callback Methods */
|
||||
//@{
|
||||
static int WMHideCB(FL_FORM *, void *);
|
||||
static void OKCB(FL_OBJECT *, long);
|
||||
static void ApplyCB(FL_OBJECT *, long);
|
||||
static void CancelCB(FL_OBJECT *, long);
|
||||
static void InputCB(FL_OBJECT *, long);
|
||||
//@}
|
||||
|
||||
private:
|
||||
FormPrint() {}
|
||||
FormPrint(FormPrint &) : DialogBase() {}
|
||||
|
||||
/**@name Slot Methods */
|
||||
//@{
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Update the dialog.
|
||||
void update();
|
||||
//@}
|
||||
|
||||
/**@name Dialog internal methods */
|
||||
//@{
|
||||
/// Apply from dialog
|
||||
void apply();
|
||||
/// Filter the inputs
|
||||
void input();
|
||||
/// Build the dialog
|
||||
void build();
|
||||
///
|
||||
FD_form_print * build_print();
|
||||
/// Explicitly free the dialog.
|
||||
void free();
|
||||
//@}
|
||||
|
||||
/**@name Private Data */
|
||||
//@{
|
||||
/// Real GUI implementation.
|
||||
FD_form_print * dialog_;
|
||||
/// Which LyXView do we belong to?
|
||||
LyXView * lv_;
|
||||
Dialogs * d_;
|
||||
/// Update connection.
|
||||
Connection u_;
|
||||
/// Hide connection.
|
||||
Connection h_;
|
||||
//@}
|
||||
};
|
||||
|
||||
#endif
|
49
src/frontends/xforms/Makefile.am
Normal file
49
src/frontends/xforms/Makefile.am
Normal file
@ -0,0 +1,49 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
DISTCLEANFILES= *.orig *.rej *~ *.bak core
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
noinst_LTLIBRARIES = libxforms.la
|
||||
INCLUDES = -I${top_srcdir}/src/ \
|
||||
-I${top_srcdir}/src/frontends/ \
|
||||
${SIGC_CFLAGS}
|
||||
LIBS=
|
||||
LDFLAGS=
|
||||
LYXDATADIRS = forms
|
||||
ETAGS_ARGS = --lang=c++
|
||||
libxforms_la_SOURCES = \
|
||||
Dialogs.C \
|
||||
FormCopyright.C \
|
||||
FormCopyright.h \
|
||||
form_copyright.C \
|
||||
form_copyright.h \
|
||||
FormPreferences.C \
|
||||
FormPreferences.h \
|
||||
form_preferences.C \
|
||||
form_preferences.h \
|
||||
FormPrint.C \
|
||||
FormPrint.h \
|
||||
form_print.C \
|
||||
form_print.h \
|
||||
input_validators.h \
|
||||
input_validators.c \
|
||||
xform_macros.h
|
||||
|
||||
# These still have to be added. Sooner or later. ARRae-20000411
|
||||
# GUI_defaults.C \
|
||||
# GUI_initialize.C \
|
||||
# GUI_postlyxrc.C \
|
||||
# GUI_runtime.C \
|
||||
# GUI_applymenu.C
|
||||
|
||||
# just copied from old lyx repository
|
||||
dist-hook:
|
||||
for subdir in $(LYXDATADIRS) ; do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
list=`(cd $(srcdir)/$$subdir && ls -1 | grep -v CVS)`; \
|
||||
echo $$list ; \
|
||||
for fil in $$list ; do \
|
||||
cp -p $(srcdir)/$$subdir/$$fil $(distdir)/$$subdir ; \
|
||||
done ; \
|
||||
done
|
45
src/frontends/xforms/form_copyright.C
Normal file
45
src/frontends/xforms/form_copyright.C
Normal file
@ -0,0 +1,45 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.86) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <stdlib.h>
|
||||
#include "FormCopyright.h"
|
||||
|
||||
FD_form_copyright * FormCopyright::build_copyright()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_copyright *fdui = new FD_form_copyright;
|
||||
|
||||
fdui->form_copyright = fl_bgn_form(FL_NO_BOX, 450, 430);
|
||||
fdui->form_copyright->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 450, 430, "");
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 10, 10, 430, 50, _("LyX is Copyright (C) 1995 by Matthias Ettrich, \n1995-2000 LyX Team"));
|
||||
fl_set_object_boxtype(obj, FL_FRAME_BOX);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 10, 70, 430, 110, _("This program is free software; you can redistribute it\nand/or modify it under the terms of the GNU General\nPublic License as published by the Free Software\nFoundation; either version 2 of the License, or\n(at your option) any later version."));
|
||||
fl_set_object_boxtype(obj, FL_FRAME_BOX);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 160, 390, 140, 30, _("OK"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_gravity(obj, FL_South, FL_South);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormCopyrightOKCB, 0);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 10, 190, 430, 190, _("LyX is distributed in the hope that it will\nbe useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of\nthe GNU General Public License\nalong with this program; if not, write to\nthe Free Software Foundation, Inc., \n675 Mass Ave, Cambridge, MA 02139, USA."));
|
||||
fl_set_object_boxtype(obj, FL_FRAME_BOX);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_copyright->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
20
src/frontends/xforms/form_copyright.h
Normal file
20
src/frontends/xforms/form_copyright.h
Normal file
@ -0,0 +1,20 @@
|
||||
/** Header file generated with fdesign on Mon Jun 12 03:43:16 2000.**/
|
||||
|
||||
#ifndef FD_form_copyright_h_
|
||||
#define FD_form_copyright_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void C_FormCopyrightOKCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
typedef struct {
|
||||
FL_FORM *form_copyright;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *button_ok;
|
||||
} FD_form_copyright;
|
||||
|
||||
|
||||
#endif /* FD_form_copyright_h_ */
|
281
src/frontends/xforms/form_preferences.C
Normal file
281
src/frontends/xforms/form_preferences.C
Normal file
@ -0,0 +1,281 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.86) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <stdlib.h>
|
||||
#include "FormPreferences.h"
|
||||
|
||||
FD_form_bind * FormPreferences::build_bind()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_bind *fdui = new FD_form_bind;
|
||||
|
||||
fdui->form_bind = fl_bgn_form(FL_NO_BOX, 380, 320);
|
||||
fdui->form_bind->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 380, 320, "");
|
||||
fdui->input_bind = obj = fl_add_input(FL_NORMAL_INPUT, 80, 80, 190, 30, _("Bind file"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON, 270, 80, 80, 30, _("Browse..."));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_bind->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_form_misc * FormPreferences::build_misc()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_misc *fdui = new FD_form_misc;
|
||||
|
||||
fdui->form_misc = fl_bgn_form(FL_NO_BOX, 380, 320);
|
||||
fdui->form_misc->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 380, 320, "");
|
||||
fdui->check_banner = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 30, 240, 30, _("Show banner"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->check_auto_region_delete = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 60, 240, 30, _("Auto region delete"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->check_exit_confirm = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 90, 240, 30, _("Exit confirmation"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->check_display_shortcuts = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 120, 240, 30, _("Display keyboard shortcuts"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->counter_autosave = obj = fl_add_counter(FL_NORMAL_COUNTER, 160, 250, 170, 30, _("Autosave interval"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
|
||||
fl_set_counter_precision(obj, 0);
|
||||
fl_set_counter_bounds(obj, 0, 1200);
|
||||
fl_set_counter_value(obj, 300);
|
||||
fl_set_counter_step(obj, 1, 1);
|
||||
fdui->counter_line_len = obj = fl_add_counter(FL_NORMAL_COUNTER, 160, 220, 170, 30, _("Ascii line length"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
|
||||
fl_set_counter_precision(obj, 0);
|
||||
fl_set_counter_bounds(obj, 0, 120);
|
||||
fl_set_counter_value(obj, 75);
|
||||
fl_set_counter_step(obj, 1, 1);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_misc->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_form_screen_fonts * FormPreferences::build_screen_fonts()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_screen_fonts *fdui = new FD_form_screen_fonts;
|
||||
|
||||
fdui->form_screen_fonts = fl_bgn_form(FL_NO_BOX, 380, 320);
|
||||
fdui->form_screen_fonts->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 380, 320, "");
|
||||
fdui->input_roman = obj = fl_add_input(FL_NORMAL_INPUT, 160, 10, 200, 30, _("Roman"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_sans = obj = fl_add_input(FL_NORMAL_INPUT, 160, 40, 200, 30, _("Sans Serif"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_typewriter = obj = fl_add_input(FL_NORMAL_INPUT, 160, 70, 200, 30, _("Typewriter"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->counter_zoom = obj = fl_add_counter(FL_NORMAL_COUNTER, 160, 130, 200, 30, _("%"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
fl_set_counter_precision(obj, 0);
|
||||
fl_set_counter_bounds(obj, 0, 999);
|
||||
fl_set_counter_value(obj, 150);
|
||||
fl_set_counter_step(obj, 1, 1);
|
||||
fdui->check_scalable = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 0, 130, 160, 30, _("Allow scaling"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->input_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 160, 100, 200, 30, _("Encoding"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_tiny = obj = fl_add_input(FL_FLOAT_INPUT, 120, 170, 70, 30, _("tiny"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_script = obj = fl_add_input(FL_FLOAT_INPUT, 290, 170, 70, 30, _("script"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_footnote = obj = fl_add_input(FL_FLOAT_INPUT, 120, 200, 70, 30, _("footnote"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_small = obj = fl_add_input(FL_FLOAT_INPUT, 290, 200, 70, 30, _("small"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_large = obj = fl_add_input(FL_FLOAT_INPUT, 290, 230, 70, 30, _("large"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_larger = obj = fl_add_input(FL_FLOAT_INPUT, 120, 260, 70, 30, _("larger"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_largest = obj = fl_add_input(FL_FLOAT_INPUT, 290, 260, 70, 30, _("largest"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_normal = obj = fl_add_input(FL_FLOAT_INPUT, 120, 230, 70, 30, _("normal"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_huge = obj = fl_add_input(FL_FLOAT_INPUT, 120, 290, 70, 30, _("huge"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_huger = obj = fl_add_input(FL_FLOAT_INPUT, 290, 290, 70, 30, _("huger"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_screen_fonts->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_form_interface_fonts * FormPreferences::build_interface_fonts()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_interface_fonts *fdui = new FD_form_interface_fonts;
|
||||
|
||||
fdui->form_interface_fonts = fl_bgn_form(FL_NO_BOX, 380, 320);
|
||||
fdui->form_interface_fonts->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 380, 320, "");
|
||||
fdui->input_popup_font = obj = fl_add_input(FL_NORMAL_INPUT, 120, 50, 200, 30, _("Popup"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_menu_font = obj = fl_add_input(FL_NORMAL_INPUT, 120, 80, 200, 30, _("Menu"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 120, 110, 200, 30, _("Encoding"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_interface_fonts->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_form_printer * FormPreferences::build_printer()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_printer *fdui = new FD_form_printer;
|
||||
|
||||
fdui->form_printer = fl_bgn_form(FL_NO_BOX, 380, 320);
|
||||
fdui->form_printer->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 380, 320, "");
|
||||
fdui->input_command = obj = fl_add_input(FL_NORMAL_INPUT, 110, 60, 80, 30, _("command"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_page_range = obj = fl_add_input(FL_NORMAL_INPUT, 110, 90, 80, 30, _("page range"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_copies = obj = fl_add_input(FL_NORMAL_INPUT, 110, 120, 80, 30, _("copies"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_reverse = obj = fl_add_input(FL_NORMAL_INPUT, 110, 150, 80, 30, _("reverse"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_to_printer = obj = fl_add_input(FL_NORMAL_INPUT, 110, 180, 80, 30, _("to printer"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_file_extension = obj = fl_add_input(FL_NORMAL_INPUT, 110, 210, 80, 30, _("file extension"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_spool_command = obj = fl_add_input(FL_NORMAL_INPUT, 110, 240, 80, 30, _("spool command"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_paper_type = obj = fl_add_input(FL_NORMAL_INPUT, 110, 270, 80, 30, _("paper type"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_even_pages = obj = fl_add_input(FL_NORMAL_INPUT, 300, 60, 80, 30, _("even pages"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_odd_pages = obj = fl_add_input(FL_NORMAL_INPUT, 300, 90, 80, 30, _("odd pages"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_collated = obj = fl_add_input(FL_NORMAL_INPUT, 300, 120, 80, 30, _("collated"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_landscape = obj = fl_add_input(FL_NORMAL_INPUT, 300, 150, 80, 30, _("landscape"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_to_file = obj = fl_add_input(FL_NORMAL_INPUT, 300, 180, 80, 30, _("to file"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_extra_options = obj = fl_add_input(FL_NORMAL_INPUT, 300, 210, 80, 30, _("extra options"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_spool_prefix = obj = fl_add_input(FL_NORMAL_INPUT, 300, 240, 80, 30, _("spool printer prefix"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_paper_size = obj = fl_add_input(FL_NORMAL_INPUT, 300, 270, 80, 30, _("paper size"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_name = obj = fl_add_input(FL_NORMAL_INPUT, 110, 10, 80, 30, _("name"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->check_adapt_output = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 10, 120, 30, _("adapt output"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_printer->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_form_paths * FormPreferences::build_paths()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_paths *fdui = new FD_form_paths;
|
||||
|
||||
fdui->form_paths = fl_bgn_form(FL_NO_BOX, 380, 430);
|
||||
fdui->form_paths->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 380, 430, "");
|
||||
fdui->input_default_path = obj = fl_add_input(FL_NORMAL_INPUT, 110, 10, 170, 30, _("Default path"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->button_document_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 10, 90, 30, _("Browse..."));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->counter_lastfiles = obj = fl_add_counter(FL_NORMAL_COUNTER, 110, 130, 110, 30, _("Last file count"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
|
||||
fl_set_counter_precision(obj, 0);
|
||||
fl_set_counter_bounds(obj, 0, 9);
|
||||
fl_set_counter_value(obj, 4);
|
||||
fl_set_counter_step(obj, 1, 1);
|
||||
fdui->input_template_path = obj = fl_add_input(FL_NORMAL_INPUT, 110, 40, 170, 30, _("Template path"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->button_template_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 40, 90, 30, _("Browse..."));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->check_last_files = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 130, 140, 30, _("Check last files"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->input_temp_dir = obj = fl_add_input(FL_NORMAL_INPUT, 110, 70, 170, 30, _("Temp dir"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->button_temp_dir_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 70, 90, 30, _("Browse..."));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->input_lastfiles = obj = fl_add_input(FL_NORMAL_INPUT, 110, 100, 170, 30, _("Lastfiles"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->button_lastfiles_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 100, 90, 30, _("Browse..."));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->check_use_temp_dir = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 70, 50, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->check_make_backups = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 170, 40, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_button(obj, 1);
|
||||
fdui->input_backup_path = obj = fl_add_input(FL_NORMAL_INPUT, 110, 170, 170, 30, _("Backup path"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fdui->button_backup_path_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 170, 90, 30, _("Browse..."));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_paths->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_form_preferences * FormPreferences::build_preferences()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_preferences *fdui = new FD_form_preferences;
|
||||
|
||||
fdui->form_preferences = fl_bgn_form(FL_NO_BOX, 380, 430);
|
||||
fdui->form_preferences->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 380, 430, "");
|
||||
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 170, 380, 90, 30, _("Apply"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPreferencesApplyCB, 0);
|
||||
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 380, 90, 30, _("Cancel"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPreferencesCancelCB, 0);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 70, 380, 90, 30, _("Ok"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPreferencesOKCB, 0);
|
||||
fdui->tabfolder_prefs = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 380, 360, "");
|
||||
fl_set_object_boxtype(obj, FL_FLAT_BOX);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_preferences->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
131
src/frontends/xforms/form_preferences.h
Normal file
131
src/frontends/xforms/form_preferences.h
Normal file
@ -0,0 +1,131 @@
|
||||
/** Header file generated with fdesign on Mon Jun 12 03:43:04 2000.**/
|
||||
|
||||
#ifndef FD_form_bind_h_
|
||||
#define FD_form_bind_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C" void C_FormPreferencesApplyCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormPreferencesCancelCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormPreferencesOKCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
typedef struct {
|
||||
FL_FORM *form_bind;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *input_bind;
|
||||
} FD_form_bind;
|
||||
|
||||
typedef struct {
|
||||
FL_FORM *form_misc;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *check_banner;
|
||||
FL_OBJECT *check_auto_region_delete;
|
||||
FL_OBJECT *check_exit_confirm;
|
||||
FL_OBJECT *check_display_shortcuts;
|
||||
FL_OBJECT *counter_autosave;
|
||||
FL_OBJECT *counter_line_len;
|
||||
} FD_form_misc;
|
||||
|
||||
typedef struct {
|
||||
FL_FORM *form_screen_fonts;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *input_roman;
|
||||
FL_OBJECT *input_sans;
|
||||
FL_OBJECT *input_typewriter;
|
||||
FL_OBJECT *counter_zoom;
|
||||
FL_OBJECT *check_scalable;
|
||||
FL_OBJECT *input_encoding;
|
||||
FL_OBJECT *input_tiny;
|
||||
FL_OBJECT *input_script;
|
||||
FL_OBJECT *input_footnote;
|
||||
FL_OBJECT *input_small;
|
||||
FL_OBJECT *input_large;
|
||||
FL_OBJECT *input_larger;
|
||||
FL_OBJECT *input_largest;
|
||||
FL_OBJECT *input_normal;
|
||||
FL_OBJECT *input_huge;
|
||||
FL_OBJECT *input_huger;
|
||||
} FD_form_screen_fonts;
|
||||
|
||||
typedef struct {
|
||||
FL_FORM *form_interface_fonts;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *input_popup_font;
|
||||
FL_OBJECT *input_menu_font;
|
||||
FL_OBJECT *input_encoding;
|
||||
} FD_form_interface_fonts;
|
||||
|
||||
typedef struct {
|
||||
FL_FORM *form_printer;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *input_command;
|
||||
FL_OBJECT *input_page_range;
|
||||
FL_OBJECT *input_copies;
|
||||
FL_OBJECT *input_reverse;
|
||||
FL_OBJECT *input_to_printer;
|
||||
FL_OBJECT *input_file_extension;
|
||||
FL_OBJECT *input_spool_command;
|
||||
FL_OBJECT *input_paper_type;
|
||||
FL_OBJECT *input_even_pages;
|
||||
FL_OBJECT *input_odd_pages;
|
||||
FL_OBJECT *input_collated;
|
||||
FL_OBJECT *input_landscape;
|
||||
FL_OBJECT *input_to_file;
|
||||
FL_OBJECT *input_extra_options;
|
||||
FL_OBJECT *input_spool_prefix;
|
||||
FL_OBJECT *input_paper_size;
|
||||
FL_OBJECT *input_name;
|
||||
FL_OBJECT *check_adapt_output;
|
||||
} FD_form_printer;
|
||||
|
||||
typedef struct {
|
||||
FL_FORM *form_paths;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *input_default_path;
|
||||
FL_OBJECT *button_document_browse;
|
||||
FL_OBJECT *counter_lastfiles;
|
||||
FL_OBJECT *input_template_path;
|
||||
FL_OBJECT *button_template_browse;
|
||||
FL_OBJECT *check_last_files;
|
||||
FL_OBJECT *input_temp_dir;
|
||||
FL_OBJECT *button_temp_dir_browse;
|
||||
FL_OBJECT *input_lastfiles;
|
||||
FL_OBJECT *button_lastfiles_browse;
|
||||
FL_OBJECT *check_use_temp_dir;
|
||||
FL_OBJECT *check_make_backups;
|
||||
FL_OBJECT *input_backup_path;
|
||||
FL_OBJECT *button_backup_path_browse;
|
||||
} FD_form_paths;
|
||||
|
||||
typedef struct {
|
||||
FL_FORM *form_preferences;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *button_apply;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *tabfolder_prefs;
|
||||
} FD_form_preferences;
|
||||
|
||||
|
||||
#endif /* FD_form_bind_h_ */
|
112
src/frontends/xforms/form_print.C
Normal file
112
src/frontends/xforms/form_print.C
Normal file
@ -0,0 +1,112 @@
|
||||
// File modified by fdfix.sh for use by lyx (with xforms >= 0.86) and gettext
|
||||
#include <config.h>
|
||||
#include "lyx_gui_misc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* Form definition file generated with fdesign. */
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
#include <stdlib.h>
|
||||
#include "FormPrint.h"
|
||||
|
||||
FD_form_print * FormPrint::build_print()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_print *fdui = new FD_form_print;
|
||||
|
||||
fdui->form_print = fl_bgn_form(FL_NO_BOX, 340, 360);
|
||||
fdui->form_print->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 360, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 215, 320, 90, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 20, 205, 70, 20, _("Print to"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fdui->input_printer = obj = fl_add_input(FL_NORMAL_INPUT, 90, 225, 230, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fdui->input_file = obj = fl_add_input(FL_NORMAL_INPUT, 90, 265, 230, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
|
||||
fdui->group_radio_printto = fl_bgn_group();
|
||||
fdui->radio_printer = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 225, 80, 30, idex(_("Printer|#P")));fl_set_button_shortcut(obj, scex(_("Printer|#P")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fdui->radio_file = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 265, 80, 30, idex(_("File|#F")));fl_set_button_shortcut(obj, scex(_("File|#F")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fl_end_group();
|
||||
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 180, 20, 150, 70, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 160, 180, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 315, 100, 30, _("OK"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintOKCB, 0);
|
||||
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 120, 315, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintApplyCB, 0);
|
||||
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 315, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintCancelCB, 0);
|
||||
|
||||
fdui->group_radio_pages = fl_bgn_group();
|
||||
fdui->radio_all_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 160, 30, idex(_("All Pages|#G")));fl_set_button_shortcut(obj, scex(_("All Pages|#G")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fdui->radio_odd_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 160, 30, idex(_("Only Odd Pages|#O")));fl_set_button_shortcut(obj, scex(_("Only Odd Pages|#O")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fdui->radio_even_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 90, 160, 30, idex(_("Only Even Pages|#E")));fl_set_button_shortcut(obj, scex(_("Only Even Pages|#E")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fl_end_group();
|
||||
|
||||
|
||||
fdui->group_radio_order = fl_bgn_group();
|
||||
fdui->radio_order_normal = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 180, 30, 150, 30, idex(_("Normal Order|#N")));fl_set_button_shortcut(obj, scex(_("Normal Order|#N")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fdui->radio_order_reverse = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 180, 60, 150, 30, idex(_("Reverse Order|#R")));fl_set_button_shortcut(obj, scex(_("Reverse Order|#R")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fl_end_group();
|
||||
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 200, 10, 60, 20, _("Order"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 50, 20, _("Print"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fdui->input_from_page = obj = fl_add_input(FL_INT_INPUT, 20, 160, 50, 30, _("Pages:"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 180, 110, 150, 90, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 200, 95, 50, 20, _("Copies"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fdui->input_count = obj = fl_add_input(FL_INT_INPUT, 190, 160, 130, 30, _("Count:"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fdui->radio_unsorted = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 115, 140, 30, idex(_("Unsorted|#U")));fl_set_button_shortcut(obj, scex(_("Unsorted|#U")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fdui->input_to_page = obj = fl_add_input(FL_INT_INPUT, 110, 160, 50, 30, _("to"));
|
||||
fl_set_object_callback(obj, C_FormPrintInputCB, 0);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form_print->fdui = fdui;
|
||||
|
||||
return fdui;
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
41
src/frontends/xforms/form_print.h
Normal file
41
src/frontends/xforms/form_print.h
Normal file
@ -0,0 +1,41 @@
|
||||
/** Header file generated with fdesign on Mon Jun 12 03:43:16 2000.**/
|
||||
|
||||
#ifndef FD_form_print_h_
|
||||
#define FD_form_print_h_
|
||||
|
||||
/** Callbacks, globals and object handlers **/
|
||||
extern "C" void C_FormPrintInputCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormPrintOKCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormPrintApplyCB(FL_OBJECT *, long);
|
||||
extern "C" void C_FormPrintCancelCB(FL_OBJECT *, long);
|
||||
|
||||
|
||||
/**** Forms and Objects ****/
|
||||
typedef struct {
|
||||
FL_FORM *form_print;
|
||||
void *vdata;
|
||||
char *cdata;
|
||||
long ldata;
|
||||
FL_OBJECT *input_printer;
|
||||
FL_OBJECT *input_file;
|
||||
FL_OBJECT *group_radio_printto;
|
||||
FL_OBJECT *radio_printer;
|
||||
FL_OBJECT *radio_file;
|
||||
FL_OBJECT *button_ok;
|
||||
FL_OBJECT *button_apply;
|
||||
FL_OBJECT *button_cancel;
|
||||
FL_OBJECT *group_radio_pages;
|
||||
FL_OBJECT *radio_all_pages;
|
||||
FL_OBJECT *radio_odd_pages;
|
||||
FL_OBJECT *radio_even_pages;
|
||||
FL_OBJECT *group_radio_order;
|
||||
FL_OBJECT *radio_order_normal;
|
||||
FL_OBJECT *radio_order_reverse;
|
||||
FL_OBJECT *input_from_page;
|
||||
FL_OBJECT *input_count;
|
||||
FL_OBJECT *radio_unsorted;
|
||||
FL_OBJECT *input_to_page;
|
||||
} FD_form_print;
|
||||
|
||||
|
||||
#endif /* FD_form_print_h_ */
|
4
src/frontends/xforms/forms/.cvsignore
Normal file
4
src/frontends/xforms/forms/.cvsignore
Normal file
@ -0,0 +1,4 @@
|
||||
*.c
|
||||
*.h
|
||||
*.C
|
||||
*.tmp
|
52
src/frontends/xforms/forms/README
Normal file
52
src/frontends/xforms/forms/README
Normal file
@ -0,0 +1,52 @@
|
||||
All .fd files go in this directory.
|
||||
Each .fd file should have just one form in them
|
||||
|
||||
NOTE: An exception to the above is any tabbed form which
|
||||
xforms requires multiple forms to create. In that case
|
||||
the group of forms constitutes one gui form.
|
||||
|
||||
All forms should be named form_xxx and saved into a file by the same name.
|
||||
For example, the copyright notice is called form_copyright and is stored in
|
||||
form_copyright.fd. Its used by class FormCopyright. If you match this pattern
|
||||
the fdfix.sh script will do nearly all the conversions for you. That'll make
|
||||
updating the source incredibly easy.
|
||||
|
||||
Name all buttons and other form components that are likely to cause a callback.
|
||||
The names should be of the form: button_ok, radio_group_item and so on.
|
||||
|
||||
Enter the full name of the callback eg.:
|
||||
C_FormCopyrightOkCB
|
||||
|
||||
That is, they all have the same format: C_##FormName##CallbackName.
|
||||
Your code will then need to use the appropriate macro to setup this C callback
|
||||
function which will in turn call the corresponding static class member function
|
||||
of the form FormName::CallbackName. You should be able to copy the macro
|
||||
entries from a similar dialog for reuse without having to change anything.
|
||||
|
||||
The name of the wrapped dialog will be dialog_ eg.
|
||||
typedef struct {
|
||||
...
|
||||
} FD_form_copyright;
|
||||
|
||||
FD_form_copyright * dialog_;
|
||||
|
||||
If you follow these simple rules then the generated code for create_form can
|
||||
be directly used as the FormXxxx::build method without any extra editting to
|
||||
make it work. Every forms implementation will follow a very simple pattern
|
||||
and make it easier to maintain.
|
||||
|
||||
The easiest way to fit into this pattern is to copy an existing dialogs
|
||||
implementation and adjust it to suit keeping the variable names the same.
|
||||
In addition a lot of work can be saved by using the code that has already been
|
||||
written in the "lyx" module of the LyX CVS repository. This is where the old
|
||||
development branch is kept. The code there will need to be modified slightly
|
||||
to meet these new guidelines. In addition, an earlier generation signalling
|
||||
system was used in that code. A conversion script called gtmmconvert2 is
|
||||
available from the gtk-- distribution. It updates all the signals to use
|
||||
libsigc++.
|
||||
|
||||
Don't reinvent the wheel. There's 18 months worth of code in the "lyx"
|
||||
module that you should at least use as a guide even if you don't actually make
|
||||
direct use of it.
|
||||
|
||||
Allan. (ARRae)
|
112
src/frontends/xforms/forms/fdfix.sh
Normal file
112
src/frontends/xforms/forms/fdfix.sh
Normal file
@ -0,0 +1,112 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# NOTE: This is NOT the same fdfix.sh as in ${top_srcdir}/forms
|
||||
# It is a modified version to suit use for gui-indep.
|
||||
#
|
||||
if [ "$1" = "$2" ]; then
|
||||
echo "Input and Output file can not be the same."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f $2 ]; then
|
||||
echo "Output file already exists, overwrite?"
|
||||
read
|
||||
if [ "$REPLY" != "y" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $1 ]; then
|
||||
echo "Input file does not exist, can not continue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If there is a patch for the outputfile patch the input file with it.
|
||||
if [ -f "$2.patch" ]; then
|
||||
echo "Patching $1 with $2.patch"
|
||||
patch -s $1 < "$2.patch"
|
||||
fi
|
||||
|
||||
echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.86) and gettext" > $2
|
||||
echo "#include <config.h>" >> $2
|
||||
echo "#include \"lyx_gui_misc.h\"" >> $2
|
||||
echo "#include \"gettext.h\"" >> $2
|
||||
echo >> $2
|
||||
|
||||
# The commands to sed does this:
|
||||
#
|
||||
# -e 's/#include "forms\.h"/#include FORMS_H_LOCATION/'
|
||||
#
|
||||
# Replace "forms.h" by FORMS_H_LOCATION in #include directives. This
|
||||
# macro is defined in config.h and is either <forms.h> or
|
||||
# <X11/forms.h>.
|
||||
#
|
||||
# -e '/fl_/ s/".[^|]*"/_(&)/'
|
||||
#
|
||||
# For all lines containing "fl_" and a string _not_ containging |,
|
||||
# replace the string with _(string)
|
||||
#
|
||||
# -e '/shortcut/ s/".*[|].*"/scex(_(&))/'
|
||||
#
|
||||
# For all lines containing "shortcut" and a string containing |, replace
|
||||
# the string with scex(_(string))
|
||||
#
|
||||
# -e '/fl_add/ s/".*[|].*"/idex(_(&))/'
|
||||
# For all lines containing "fl_add" and a string containing |, replace
|
||||
# the string with idex(_(string))
|
||||
#
|
||||
# -e '/fl_add/ s/idex("\(.*\)").*$/&fl_set_button_shortcut(obj,"\1",1);/'
|
||||
# For all lines containing "fl_add" and a string containing |, add the
|
||||
# shortcut command after the end of this line
|
||||
#
|
||||
# -e 's/,\([^ ]\)/, \1/g'
|
||||
#
|
||||
# Someone got busy and put spaces in after commas but didn't allow for the
|
||||
# autogeneration of the files so their pretty formatting got lost. Not anymore.
|
||||
#
|
||||
# -e 's/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 dialog_ = new \2/'
|
||||
#
|
||||
# We use new/delete not malloc/free so change to suit. Also the local
|
||||
# variable for our dialog is called dialog_ so do that fix also.
|
||||
#
|
||||
#-e 's/\(FD_f\([^ ]*\)_\([^ ]*\)\) \*create[^ ]*/void F\2\3::build()/'
|
||||
#
|
||||
# Fixup the name of the create_form... function to have a signature almost
|
||||
# matching that of the method it will become. You just need to capitalize
|
||||
# the forms name.
|
||||
#
|
||||
# -e 's/\(fdui->form[^ ]*\)\(.*bgn_form.*\)/\1\2\
|
||||
# \1->u_vdata = this;/' \
|
||||
#
|
||||
# We need to store a pointer to the dialog in u_vdata so that the callbacks
|
||||
# will work.
|
||||
#
|
||||
|
||||
classname=`basename $1 .c | cut -c6-`
|
||||
firstchar=`echo $classname | cut -c1 | tr a-z A-Z`
|
||||
rest=`echo $classname | cut -c2-`
|
||||
classname=Form$firstchar$rest
|
||||
export classname
|
||||
|
||||
cat $1 | sed \
|
||||
-e 's/#include \"forms\.h\"/#include FORMS_H_LOCATION/' \
|
||||
-e "s/#include \".orm_.*\"/#include \"$classname.h\"/" \
|
||||
-e '/fl_/ s/".[^|]*"/_(&)/' \
|
||||
-e '/shortcut/ s/".*[|].*"/scex(_(&))/' \
|
||||
-e '/fl_add/ s/".*[|].*"/idex(_(&))/' \
|
||||
-e '/fl_add/ s/idex(\(.*\)").*$/&fl_set_button_shortcut(obj,scex(\1")),1);/' \
|
||||
-e 's/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 new \2/' \
|
||||
-e "s/\(FD_f\([^ _]*\)_\([^ ]*\)\) \*create_form_form[^ ]*/\1 * $classname::build_\3()/" \
|
||||
-e 's/\(fdui->form[^ ]*\)\(.*bgn_form.*\)/\1\2\
|
||||
\1->u_vdata = this;/' \
|
||||
-e 's/,\([^ ]\)/, \1/g' >> $2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
106
src/frontends/xforms/forms/form_copyright.fd
Normal file
106
src/frontends/xforms/forms/form_copyright.fd
Normal file
@ -0,0 +1,106 @@
|
||||
Magic: 13000
|
||||
|
||||
Internal Form Definition File
|
||||
(do not change)
|
||||
|
||||
Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_copyright
|
||||
Width: 450
|
||||
Height: 430
|
||||
Number of Objects: 5
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 450 430
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 10 10 430 50
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2000 LyX Team
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_NorthEast
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 10 70 430 110
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: This program is free software; you can redistribute it\nand/or modify it under the terms of the GNU General\nPublic License as published by the Free Software\nFoundation; either version 2 of the License, or\n(at your option) any later version.
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 160 390 140 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: OK
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_South FL_South
|
||||
name: button_ok
|
||||
callback: C_FormCopyrightOKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 10 190 430 190
|
||||
boxtype: FL_FRAME_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: LyX is distributed in the hope that it will\nbe useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of\nthe GNU General Public License\nalong with this program; if not, write to\nthe Free Software Foundation, Inc.,\n675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
==============================
|
||||
create_the_forms
|
1336
src/frontends/xforms/forms/form_preferences.fd
Normal file
1336
src/frontends/xforms/forms/form_preferences.fd
Normal file
File diff suppressed because it is too large
Load Diff
574
src/frontends/xforms/forms/form_print.fd
Normal file
574
src/frontends/xforms/forms/form_print.fd
Normal file
@ -0,0 +1,574 @@
|
||||
Magic: 13000
|
||||
|
||||
Internal Form Definition File
|
||||
(do not change)
|
||||
|
||||
Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_print
|
||||
Width: 340
|
||||
Height: 360
|
||||
Number of Objects: 31
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 340 360
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 215 320 90
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 20 205 70 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_BOLD_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Print to
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 90 225 230 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_printer
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 90 265 230 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_file
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BEGIN_GROUP
|
||||
type: 0
|
||||
box: 0 0 0 0
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: group_radio_printto
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 225 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Printer|#P
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_printer
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 265 80 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: File|#F
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_file
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_END_GROUP
|
||||
type: 0
|
||||
box: 0 0 0 0
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 180 20 150 70
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 10 20 160 180
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 10 315 100 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: OK
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_ok
|
||||
callback: C_FormPrintOKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 120 315 100 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Apply|#A
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_apply
|
||||
callback: C_FormPrintApplyCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 230 315 100 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Cancel|^[
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_cancel
|
||||
callback: C_FormPrintCancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BEGIN_GROUP
|
||||
type: 0
|
||||
box: 0 0 0 0
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: group_radio_pages
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 30 160 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: All Pages|#G
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_all_pages
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 60 160 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Only Odd Pages|#O
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_odd_pages
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 10 90 160 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Only Even Pages|#E
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_even_pages
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_END_GROUP
|
||||
type: 0
|
||||
box: 0 0 0 0
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BEGIN_GROUP
|
||||
type: 0
|
||||
box: 0 0 0 0
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: group_radio_order
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 180 30 150 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Normal Order|#N
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_order_normal
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: RADIO_BUTTON
|
||||
box: 180 60 150 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Reverse Order|#R
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_order_reverse
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_END_GROUP
|
||||
type: 0
|
||||
box: 0 0 0 0
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 200 10 60 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_BOLD_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Order
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 20 10 50 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_BOLD_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Print
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: INT_INPUT
|
||||
box: 20 160 50 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Pages:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_from_page
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_FRAME
|
||||
type: ENGRAVED_FRAME
|
||||
box: 180 110 150 90
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 200 95 50 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_BOLD_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Copies
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: INT_INPUT
|
||||
box: 190 160 130 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Count:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_count
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 180 115 140 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Unsorted|#U
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_unsorted
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: INT_INPUT
|
||||
box: 110 160 50 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: to
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_to_page
|
||||
callback: C_FormPrintInputCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
||||
create_the_forms
|
81
src/frontends/xforms/forms/makefile
Normal file
81
src/frontends/xforms/forms/makefile
Normal file
@ -0,0 +1,81 @@
|
||||
###/* This file is part of
|
||||
###* ======================================================
|
||||
###*
|
||||
###* LyX, the High Level Word Processor
|
||||
###*
|
||||
###* Copyright 1995 Matthias Ettrich
|
||||
###* Copyright 1995-2000 The LyX Team
|
||||
###*
|
||||
###*======================================================*/
|
||||
###
|
||||
###
|
||||
### Makefile by Lars Gullik Bjønnes (larsbj@ifi.uio.no)
|
||||
### Modified by Allan Rae <rae@lyx.org>
|
||||
###
|
||||
|
||||
SHELL = /bin/sh
|
||||
.SUFFIXES: .fd .c
|
||||
|
||||
# Various commands
|
||||
FDESIGN = fdesign
|
||||
|
||||
SRCS := form_copyright.fd \
|
||||
form_preferences.fd \
|
||||
form_print.fd
|
||||
|
||||
|
||||
OBJS := $(SRCS:.fd=.c)
|
||||
|
||||
COBJS := $(SRCS:.fd=.C)
|
||||
|
||||
all:
|
||||
@echo "This is a makefile intended for the maintainer only."
|
||||
@echo "Only run it if you are absolutely sure about what you"
|
||||
@echo "are doing."
|
||||
|
||||
c: $(OBJS)
|
||||
|
||||
d: c $(COBJS)
|
||||
|
||||
|
||||
# -e 's/\([^ ]* \*\)\([^ ]*\)/\1 \2/'
|
||||
#
|
||||
# Make declarations like "void *cdata;" into "void * cdata;"
|
||||
#
|
||||
e: c
|
||||
for hfil in *.h ; do \
|
||||
if [ -f "$$hfil.patch" ] ; then \
|
||||
(echo "Patching $$hfil with $$hfil.patch" ; \
|
||||
patch -s $$hfil < $$hfil.patch) \
|
||||
fi; \
|
||||
sed < $$hfil > $$hfil.tmp \
|
||||
-e 's/\(extern \)\(.*\)/\1 "C" \2/' \
|
||||
-e '/create_form_/d' ; \
|
||||
mv $$hfil.tmp $$hfil; \
|
||||
done
|
||||
|
||||
updatesrc: d e
|
||||
@echo >&2
|
||||
@echo "Everythings been generated now.">&2
|
||||
@echo "It's up to you to actually merge it into the respective">&2
|
||||
@echo "implementations in the parent directory. Most of the work">&2
|
||||
@echo "simply involves cutting and pasting the FormXxxx::build()">&2
|
||||
@echo "code into that forms FormXxxx.C file. You'll also want to">&2
|
||||
@echo "copy the FD_form... declaration from the header into the">&2
|
||||
@echo "classes header file.">&2
|
||||
@echo >&2
|
||||
|
||||
.fd.c:
|
||||
$(FDESIGN) -convert $<
|
||||
|
||||
.c.C:
|
||||
./fdfix.sh $< $@
|
||||
|
||||
clean:
|
||||
rm -f *.[hcC] *.bak
|
||||
|
||||
distclean: clean
|
||||
rm -f *.orig *.rej *~
|
||||
|
||||
install: updatesrc
|
||||
cp *.C *.h ..
|
91
src/frontends/xforms/input_validators.c
Normal file
91
src/frontends/xforms/input_validators.c
Normal file
@ -0,0 +1,91 @@
|
||||
// -*- C++ -*-
|
||||
/* input_validators.C
|
||||
* A collection of input filtering and validating functions for use in
|
||||
* XForms popups. Mainly meant for filtering input boxes although may
|
||||
* be extended to include other generally useful xforms-specific tools.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include FORMS_H_LOCATION
|
||||
#include "input_validators.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int fl_unsigned_int_filter(FL_OBJECT * ob,
|
||||
char const * not_used,
|
||||
char const * unused,
|
||||
int c)
|
||||
{
|
||||
if (c == 0 // final test before handing contents to app
|
||||
|| strchr("0123456789", c)) {
|
||||
// since we only accept numerals then it must be valid
|
||||
return FL_VALID;
|
||||
}
|
||||
return FL_INVALID|FL_RINGBELL;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// I've just moved this code here and written a few comments.
|
||||
// still to complete it. ARRae 20000518
|
||||
//
|
||||
void fl_print_range_filter(FL_OBJECT * ob,
|
||||
char const * not_used,
|
||||
char const * unused,
|
||||
int c)
|
||||
{
|
||||
// Started life as changes to PrintApplyCB by Stephan Witt
|
||||
// (stephan.witt@beusen.de), 19-Jan-99
|
||||
// User may give a page (range) list
|
||||
|
||||
if (strchr("0123456789", c)) {
|
||||
// Numerals are always valid
|
||||
return FL_VALID;
|
||||
} else if (strchr("-,", c)) {
|
||||
// make sure that the character can go there
|
||||
} else if (c == 0) {
|
||||
// final test before handing contents to app
|
||||
// make sure the last char isn't a "-,"
|
||||
// That might be acceptable if there was a "to_page"
|
||||
// entry however if you start making a page range in the "from"
|
||||
// field you can do it all in the "from" field. That is, a
|
||||
// range in the "from" field immmediately blanks the "to"
|
||||
// field.
|
||||
}
|
||||
return FL_INVALID|FL_RINGBELL;
|
||||
|
||||
// The code above should do the same sort of checking as the
|
||||
// code below.
|
||||
|
||||
string pages = subst(fl_get_input(fd_form_print->input_pages), ';',',');
|
||||
pages = subst(pages, '+',',');
|
||||
pages = frontStrip(strip(pages)) ;
|
||||
while (!pages.empty()) { // a page range was given
|
||||
string piece ;
|
||||
pages = split (pages, piece, ',') ;
|
||||
piece = strip(piece) ;
|
||||
piece = frontStrip(piece) ;
|
||||
if ( !stringOnlyContains (piece, "0123456789-") ) {
|
||||
WriteAlert(_("ERROR! Unable to print!"),
|
||||
_("Check 'range of pages'!"));
|
||||
return;
|
||||
}
|
||||
if (piece.find('-') == string::npos) { // not found
|
||||
pageflag += lyxrc.print_pagerange_flag + piece + '-' + piece + ' ' ;
|
||||
} else if (suffixIs(piece, "-") ) { // missing last page
|
||||
pageflag += lyxrc.print_pagerange_flag + piece + "1000 ";
|
||||
} else if (prefixIs(piece, "-") ) { // missing first page
|
||||
pageflag += lyxrc.print_pagerange_flag + '1' + piece + ' ' ;
|
||||
} else {
|
||||
pageflag += lyxrc.print_pagerange_flag + piece + ' ' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user