From 72efbf28ac2e8d8cef29ff21dcc2fb3f2baf09ae Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 26 Jan 2001 10:16:05 +0000 Subject: [PATCH] The qt2 frontend git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1398 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 10 + autogen.sh | 2 +- config/qt2.m4 | 348 +++++++++++++++++++ configure.in | 8 + lib/CREDITS | 5 +- lib/ChangeLog | 4 + src/frontends/ChangeLog | 3 + src/frontends/Makefile.am | 8 +- src/frontends/qt2/.cvsignore | 7 + src/frontends/qt2/ChangeLog | 14 + src/frontends/qt2/Dialogs.C | 77 ++++ src/frontends/qt2/FormCopyright.C | 53 +++ src/frontends/qt2/FormCopyright.h | 57 +++ src/frontends/qt2/FormCopyrightDialog.C | 22 ++ src/frontends/qt2/FormCopyrightDialog.h | 15 + src/frontends/qt2/FormCopyrightDialogBase.C | 80 +++++ src/frontends/qt2/FormCopyrightDialogBase.h | 37 ++ src/frontends/qt2/FormCopyrightDialogBase.ui | 190 ++++++++++ src/frontends/qt2/GUIRunTime.C | 113 ++++++ src/frontends/qt2/Makefile.am | 92 +++++ 20 files changed, 1140 insertions(+), 5 deletions(-) create mode 100644 config/qt2.m4 create mode 100644 src/frontends/qt2/.cvsignore create mode 100644 src/frontends/qt2/ChangeLog create mode 100644 src/frontends/qt2/Dialogs.C create mode 100644 src/frontends/qt2/FormCopyright.C create mode 100644 src/frontends/qt2/FormCopyright.h create mode 100644 src/frontends/qt2/FormCopyrightDialog.C create mode 100644 src/frontends/qt2/FormCopyrightDialog.h create mode 100644 src/frontends/qt2/FormCopyrightDialogBase.C create mode 100644 src/frontends/qt2/FormCopyrightDialogBase.h create mode 100644 src/frontends/qt2/FormCopyrightDialogBase.ui create mode 100644 src/frontends/qt2/GUIRunTime.C create mode 100644 src/frontends/qt2/Makefile.am diff --git a/ChangeLog b/ChangeLog index c648c4ec11..4bf6b25b06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-01-25 John Levon + + * autogen.sh: add qt2.m4 + + * configure.in: add qt2 frontend option, Makefile + + * config/qt2.m4: config gubbins for qt2 + + * lib/CREDITS: add Kalle + 2001-01-25 Jean-Marc Lasgouttes * INSTALL (Problems): update description of the "missing linux diff --git a/autogen.sh b/autogen.sh index fa0859b9ee..ff42367219 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,7 +24,7 @@ fi echo -n "Generate acinclude.m4... " rm -f acinclude.m4 sigc++/acinclude.m4 touch acinclude.m4 -for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 config/sigc++.m4 config/kde.m4 config/gtk--.m4 config/gnome--.m4 config/gnome.m4 config/pspell.m4; do +for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 config/sigc++.m4 config/kde.m4 config/qt2.m4 config/gtk--.m4 config/gnome--.m4 config/gnome.m4 config/pspell.m4; do cat $fil >> acinclude.m4 done touch sigc++/acinclude.m4 diff --git a/config/qt2.m4 b/config/qt2.m4 new file mode 100644 index 0000000000..3de5fd30d7 --- /dev/null +++ b/config/qt2.m4 @@ -0,0 +1,348 @@ +# Configure paths and libs when using Qt2 GUI +## -*- shell-script -*- + +## Based on KDE file written by : +## Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) +## (C) 1997 Stephan Kulow (coolo@kde.org) + +## This file 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; see the file COPYING.LIB. If not, write to +## the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +## Boston, MA 02111-1307, USA. + +## ------------------------------------------------------------------------ +## Find a file (or one of more files in a list of dirs) +## ------------------------------------------------------------------------ +## + +AC_DEFUN(QT2_MOC_ERROR_MESSAGE, +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_qt2moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN(QT2_FIND_PATH, +[ + AC_MSG_CHECKING([for $1]) + AC_CACHE_VAL(qt2_cv_path_$1, + [ + qt2_cv_path_$1="NONE" + if test -n "$$2"; then + qt2_cv_path_$1="$$2"; + else + dirs="$3" + qt2_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + dirs="$dirs $dir" + done + IFS=$qt2_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + qt2_cv_path_$1="$dir/$1" + break + fi + else + qt2_cv_path_$1="$dir/$1" + break + fi + fi + done + + fi + + ]) + + if test -z "$qt2_cv_path_$1" || test "$qt2_cv_path_$1" = "NONE"; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($qt2_cv_path_$1) + $2=$qt2_cv_path_$1 + fi +]) + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some +dnl more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(QT2_AC_PATH_MOC, +[ + QT2_FIND_PATH(moc, MOC, [$ac_qt2_bindir $QTDIR/bin \ + /usr/bin /usr/X11R6/bin /usr/lib/qt2/bin \ + /usr/local/qt2/bin /usr/local/qt/bin /usr/lib/qt/bin], [QT2_MOC_ERROR_MESSAGE]) + + if test -z "$MOC"; then + if test -n "$ac_cv_path_qt2moc"; then + output=`eval "$ac_cv_path_qt2moc --help 2>&1 | sed -e '1q' | grep Qt"` + fi + echo "configure:__oline__: tried to call $ac_cv_path_qt2moc --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC + echo "configure:__oline__: moc output: $output" >&AC_FD_CC + + if test -z "$output"; then + MOC_ERROR_MESSAGE + fi + fi + + AC_SUBST(MOC) +]) + +AC_DEFUN(QT2_PRINT_PROGRAM, +[ +AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext < +#include +int main() { + QMovie m; + m.setSpeed(20); + return 0; +} +EOF +]) + +AC_DEFUN(QT2_CHECK_DIRECT, +[ +AC_MSG_CHECKING([if Qt2 compiles without flags]) +AC_CACHE_VAL(cv_qt2_direct, +[ +ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH +ac_LIBRARY_PATH="$LIBRARY_PATH" +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt2_includes" +LDFLAGS="$X_LDFLAGS" +LIBS="-lqt -lXext -lX11 $LIBSOCKET" +LD_LIBRARY_PATH= +export LD_LIBRARY_PATH +LIBRARY_PATH= +export LIBRARY_PATH + +QT2_PRINT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + cv_qt2_direct="yes" +else + cv_qt2_direct="no" + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +]) + +if test "$cv_qt2_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +## ------------------------------------------------------------------------ +## Try to find the Qt2 headers and libraries. +## $(QT2_LDFLAGS) will be -Lqt2liblocation (if needed) +## and $(QT2_INCLUDES) will be -Iqt2hdrlocation (if needed) +## ------------------------------------------------------------------------ +## +AC_DEFUN(QT2_AC_PATH, +[ +AC_MSG_CHECKING([for Qt 2]) +ac_qt2_includes=NO ac_qt2_libraries=NO ac_qt2_bindir=NO +qt2_libraries="" +qt2_includes="" +AC_ARG_WITH(qt2-dir, + [ --with-qt2-dir where the root of Qt2 is installed ], + [ ac_qt2_includes="$withval"/include + ac_qt2_libraries="$withval"/lib + ac_qt2_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt2-includes, + [ --with-qt2-includes where the Qt2 includes are. ], + [ + ac_qt2_includes="$withval" + ]) + +qt2_libs_given=no + +AC_ARG_WITH(qt2-libraries, + [ --with-qt2-libraries where the Qt2 library is installed.], + [ ac_qt2_libraries="$withval" + qt2_libs_given=yes + ]) + +if test "$ac_qt2_includes" = NO || test "$ac_qt2_libraries" = NO; then + +AC_CACHE_VAL(ac_cv_have_qt2, +[#try to guess Qt2 locations + +qt_incdirs="$ac_qt2_includes usr/lib/qt2/include /usr/local/qt2/include /usr/include/qt2 /usr/X11R6/include/X11/qt2 /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes $QTINC" +test -n "$QTDIR" && qt2_incdirs="$QTDIR/include/qt2 $QTDIR/include/qt $QTDIR/include $QTDIR $qt2_incdirs" +AC_FIND_FILE(qmovie.h, $qt2_incdirs, qt2_incdir) +ac_qt2_includes="$qt2_incdir" + +if test ! "$ac_qt2_libraries" = "NO"; then + qt2_libdirs="$ac_qt2_libraries" +fi + +qt2_libdirs="$qt2_libdirs /usr/lib/qt2/lib /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt2/lib /usr/lib/qt2 /usr/local/qt/lib /usr/lib/qt $x_libraries $QTLIB" +test -n "$QTDIR" && qt2_libdirs="$QTDIR/lib $QTDIR $qt2_libdirs" + +test=NONE +qt2_libdir=NONE +for dir in $qt2_libdirs; do + try="ls -1 $dir/libqt*" + if test=`eval $try 2> /dev/null`; then qt2_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi +done + +dnl AC_FIND_FILE(libqt.so.2.2.3 libqt.so.2.2 libqt.so.2 libqt2.so libqt.a libqt.sl, $qt2_libdirs, qt2_libdir) +ac_qt2_libraries="$qt2_libdir" + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt2_incdir" +LDFLAGS="-L$qt2_libdir $X_LDFLAGS" +LIBS="$LIBS -lqt -lXext -lX11 $LIBSOCKET" + +QT2_PRINT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt2_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +if test "$ac_qt2_includes" = NO || test "$ac_qt2_libraries" = NO; then + ac_cv_have_qt2="have_qt2=no" + ac_qt2_notfound="" + if test "$ac_qt2_includes" = NO; then + if test "$ac_qt2_libraries" = NO; then + ac_qt2_notfound="(headers and libraries)"; + else + ac_qt2_notfound="(headers)"; + fi + else + ac_qt2_notfound="(libraries)"; + fi + + AC_MSG_ERROR([Qt2 $ac_qt2_notfound not found. Please check your installation! ]); +else + have_qt2="yes" +fi +]) +else + have_qt2="yes" +fi + +eval "$ac_cv_have_qt2" + +if test "$have_qt2" != yes; then + AC_MSG_RESULT([$have_qt2]); +else + ac_cv_have_qt2="have_qt2=yes \ + ac_qt2_includes=$ac_qt2_includes ac_qt2_libraries=$ac_qt2_libraries" + AC_MSG_RESULT([libraries $ac_qt2_libraries, headers $ac_qt2_includes]) + + qt2_libraries="$ac_qt2_libraries" + qt2_includes="$ac_qt2_includes" +fi + +if test ! "$qt2_libs_given" = "yes"; then +QT2_CHECK_DIRECT(qt2_libraries= ,[]) +fi + +dnl check it is Qt2 +dnl FIXME: what minor version do we require ??? + +SAVE_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS -I$qt2_includes -L$qt2_libraries" +dnl specify we are definitely C++ compiling first +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +#include +], +[ +#if (QT_VERSION < 200) +break_me_(\\\); +#endif +], +ac_qt2_ok=yes, +ac_qt2_ok=no +) +test "$ac_qt2_ok" = no && AC_MSG_ERROR([Found an earlier version of Qt - you must specify the path to Qt2]) +CXXFLAGS="$SAVE_CXXFLAGS" + +AC_SUBST(qt2_libraries) +AC_SUBST(qt2_includes) + +if test "$qt2_includes" = "$x_includes" || test -z "$qt2_includes"; then + QT2_INCLUDES=""; +else + QT2_INCLUDES="-I$qt2_includes" + all_includes="$QT2_INCLUDES $all_includes" +fi + +if test "$qt2_libraries" = "$x_libraries" || test -z "$qt2_libraries"; then + QT2_LDFLAGS="" +else + QT2_LDFLAGS="-L$qt2_libraries" + all_libraries="$QT2_LDFLAGS $all_libraries" +fi + +QT2_LIBS="-lqt" + +AC_SUBST(QT2_INCLUDES) +AC_SUBST(QT2_LDFLAGS) +AC_SUBST(QT2_LIBS) +QT2_AC_PATH_MOC +]) + +AC_DEFUN(QT2_DO_IT_ALL, +[ +if test "$QT2DIR" != ""; then + QTDIR=$QT2DIR +fi +QT2_AC_PATH +]) diff --git a/configure.in b/configure.in index 85b37fa20d..f991f483f7 100644 --- a/configure.in +++ b/configure.in @@ -186,6 +186,13 @@ case "$lyx_use_frontend" in FRONTEND_LDFLAGS="\$(GNOMEMM_LIBDIR)" FRONTEND_INCLUDES="-I\${srcdir}/gnome \$(GNOMEMM_INCLUDEDIR) \$(GTKMM_CFLAGS)" FRONTEND_LIBS="\$(GNOMEMM_LIBS) \$(GTKMM_LIBS)";; + qt2) + QT2_DO_IT_ALL + FRONTEND="qt2" + FRONTEND_GUILIB="\${top_builddir}/src/frontends/qt2/libqt2.la" + FRONTEND_LDFLAGS="\$(QT2_LDFLAGS)" + FRONTEND_INCLUDES="-I\${srcdir}/qt2 \$(QT2_INCLUDES)" + FRONTEND_LIBS="\$(QT2_LIBS)";; *) LYX_ERROR(Unknown frontend $lyx_use_frontend);; esac @@ -298,6 +305,7 @@ AC_OUTPUT([Makefile \ src/frontends/Makefile \ src/frontends/support/Makefile \ src/frontends/xforms/Makefile \ + src/frontends/qt2/Makefile \ src/frontends/kde/Makefile \ src/frontends/kde/moc/Makefile \ src/frontends/kde/dlg/Makefile \ diff --git a/lib/CREDITS b/lib/CREDITS index 777e224b81..25904c3c74 100644 --- a/lib/CREDITS +++ b/lib/CREDITS @@ -44,6 +44,9 @@ @bClaudio Coco @iE-mail: lacocio@iol.it Italian translation +@bKalle Dalheimer +@iE-mail: kalle@kde.org + Qt2 port @bedscott @iE-mail: edscott@imp.mx Various bug fixes @@ -121,7 +124,7 @@ @iE-mail: jamatos@novalis.fc.up.pt linuxdoc sgml support @bTino Meinen -@iE-mail: tino@direct.a2000.nl +@iE-mail: a.t.meinen@chello.nl Dutch translation coordinator @bDaniel Naber @iE-mail dnaber@mini.gt.owl.de diff --git a/lib/ChangeLog b/lib/ChangeLog index 34562af3a1..e89cc8648d 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2001-01-26 Jean-Marc Lasgouttes + + * CREDITS: update Tino Meinen address. + 2001-01-25 Jean-Marc Lasgouttes * examples/fr_ItemizeBullets.lyx: new translation. diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index e69de29bb2..5486d986d2 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -0,0 +1,3 @@ +2001-01-24 John Levon + + * Makefile.am: add qt2 frontend diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index 88f076857f..01b6473711 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -23,8 +23,10 @@ libfrontends_la_SOURCES=\ Toolbar.C \ Toolbar.h -EXTRA_DIST = kde gnome +EXTRA_DIST = kde qt2 gnome dist-hook: - @cd $(distdir) ; rm -rf `find kde -name \*CVS\*`; \ - rm -rf `find gnome -name \*CVS\*` + @cd $(distdir) ; \ + rm -rf `find kde -name \*CVS\*`; \ + rm -rf `find qt2 -name \*CVS\*`; \ + rm -rf `find gnome -name \*CVS\*` diff --git a/src/frontends/qt2/.cvsignore b/src/frontends/qt2/.cvsignore new file mode 100644 index 0000000000..508b382224 --- /dev/null +++ b/src/frontends/qt2/.cvsignore @@ -0,0 +1,7 @@ +Makefile.in +Makefile +*.deps +*.lo +.libs +libqt2.la +*moc.C diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog new file mode 100644 index 0000000000..e3d052e766 --- /dev/null +++ b/src/frontends/qt2/ChangeLog @@ -0,0 +1,14 @@ +2001-01-24 John Levon + + * src/frontends/qt2/.cvsignore: + * Dialogs.C: + * FormCopyright.C: + * FormCopyright.h: + * FormCopyrightDialog.C: + * FormCopyrightDialog.h: + * FormCopyrightDialogBase.C: + * FormCopyrightDialogBase.h: + * FormCopyrightDialogBase.ui: + * GUIRunTime.C: + * Makefile.am: start frontend with the Copyright + dialog diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C new file mode 100644 index 0000000000..89bb944a44 --- /dev/null +++ b/src/frontends/qt2/Dialogs.C @@ -0,0 +1,77 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. + * + * ====================================================== + */ + +#include + +#include "Dialogs.h" +#include "FormCitation.h" +#include "FormCopyright.h" +#include "FormDocument.h" +#include "FormError.h" +#include "FormGraphics.h" +#include "FormIndex.h" +#include "FormParagraph.h" +#include "FormPreferences.h" +#include "FormPrint.h" +#include "FormRef.h" +#include "FormTabular.h" +#include "FormTabularCreate.h" +#include "FormToc.h" +#include "FormUrl.h" + +#ifdef __GNUG__ +#pragma implementation +#endif + +using std::endl; + +// temporary till ported +extern void ShowCredits(); + + +// Signal enabling all visible popups to be redrawn if so desired. +// E.g., when the GUI colours have been remapped. +Signal0 Dialogs::redrawGUI; + + +Dialogs::Dialogs(LyXView * lv) +{ + dialogs_.push_back(new FormCitation(lv, this)); + dialogs_.push_back(new FormCopyright(lv, this)); + dialogs_.push_back(new FormDocument(lv, this)); + dialogs_.push_back(new FormError(lv, this)); + dialogs_.push_back(new FormGraphics(lv, this)); + dialogs_.push_back(new FormIndex(lv, this)); + dialogs_.push_back(new FormParagraph(lv, this)); + dialogs_.push_back(new FormPreferences(lv, this)); + dialogs_.push_back(new FormPrint(lv, this)); + dialogs_.push_back(new FormRef(lv, this)); + dialogs_.push_back(new FormTabular(lv, this)); + dialogs_.push_back(new FormTabularCreate(lv, this)); + dialogs_.push_back(new FormToc(lv, this)); + dialogs_.push_back(new FormUrl(lv, this)); + + showCredits.connect(slot(ShowCredits)); + + // reduce the number of connections needed in + // dialogs by a simple connection here. + hideAll.connect(hideBufferDependent.slot()); +} + + +Dialogs::~Dialogs() +{ + for (vector::iterator iter = dialogs_.begin(); + iter != dialogs_.end(); + ++iter) { + delete *iter; + } +} diff --git a/src/frontends/qt2/FormCopyright.C b/src/frontends/qt2/FormCopyright.C new file mode 100644 index 0000000000..99fdefc2e6 --- /dev/null +++ b/src/frontends/qt2/FormCopyright.C @@ -0,0 +1,53 @@ +/*************************************************************************** + 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 + +#include "Dialogs.h" +#include "FormCopyright.h" +#include "FormCopyrightDialog.h" +#include "gettext.h" + +FormCopyright::FormCopyright(LyXView *v, Dialogs *d) + : dialog_(0), lv_(v), 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() +{ + 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(); +} diff --git a/src/frontends/qt2/FormCopyright.h b/src/frontends/qt2/FormCopyright.h new file mode 100644 index 0000000000..d0a9af86a6 --- /dev/null +++ b/src/frontends/qt2/FormCopyright.h @@ -0,0 +1,57 @@ +/*************************************************************************** + 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" +#include "boost/utility.hpp" + +class Dialogs; +class LyXView; +class FormCopyrightDialog; + +/** + @author Jürgen Vigna + */ +class FormCopyright : public DialogBase, public noncopyable { +public: + FormCopyright(LyXView *, Dialogs *); + ~FormCopyright(); + +private: + /// Create the dialog if necessary, update it and display it. + void show(); + /// Hide the dialog. + void hide(); + + /// 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. + */ + 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 diff --git a/src/frontends/qt2/FormCopyrightDialog.C b/src/frontends/qt2/FormCopyrightDialog.C new file mode 100644 index 0000000000..ff3164e8a6 --- /dev/null +++ b/src/frontends/qt2/FormCopyrightDialog.C @@ -0,0 +1,22 @@ +#include "FormCopyrightDialog.h" + +/* + * Constructs a FormCopyrightDialog which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +FormCopyrightDialog::FormCopyrightDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) + : FormCopyrightDialogBase( parent, name, modal, fl ) +{ +} + +/* + * Destroys the object and frees any allocated resources + */ +FormCopyrightDialog::~FormCopyrightDialog() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/frontends/qt2/FormCopyrightDialog.h b/src/frontends/qt2/FormCopyrightDialog.h new file mode 100644 index 0000000000..d91a84e386 --- /dev/null +++ b/src/frontends/qt2/FormCopyrightDialog.h @@ -0,0 +1,15 @@ +#ifndef FORMCOPYRIGHTDIALOG_H +#define FORMCOPYRIGHTDIALOG_H +#include "FormCopyrightDialogBase.h" + +class FormCopyrightDialog : public FormCopyrightDialogBase +{ + Q_OBJECT + +public: + FormCopyrightDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~FormCopyrightDialog(); + +}; + +#endif // FORMCOPYRIGHTDIALOG_H diff --git a/src/frontends/qt2/FormCopyrightDialogBase.C b/src/frontends/qt2/FormCopyrightDialogBase.C new file mode 100644 index 0000000000..6bf86714a3 --- /dev/null +++ b/src/frontends/qt2/FormCopyrightDialogBase.C @@ -0,0 +1,80 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'FormCopyrightDialogBase.ui' +** +** Created: Wed Jan 24 12:18:52 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "FormCopyrightDialogBase.h" + +#include +#include +#include +#include +#include +#include + +/* + * Constructs a FormCopyrightDialogBase which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +FormCopyrightDialogBase::FormCopyrightDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "FormCopyrightDialogBase" ); + resize( 472, 454 ); + setCaption( tr( "Form1" ) ); + FormCopyrightDialogBaseLayout = new QVBoxLayout( this ); + FormCopyrightDialogBaseLayout->setSpacing( 6 ); + FormCopyrightDialogBaseLayout->setMargin( 11 ); + + TextLabel5 = new QLabel( this, "TextLabel5" ); + TextLabel5->setText( tr( "KLyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2001 by LyX Team" ) ); + TextLabel5->setFrameShape( QLabel::Box ); + TextLabel5->setFrameShadow( QLabel::Sunken ); + TextLabel5->setMargin( 6 ); + TextLabel5->setAlignment( int( QLabel::AlignCenter ) ); + FormCopyrightDialogBaseLayout->addWidget( TextLabel5 ); + + TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); + TextLabel5_2->setText( tr( "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." ) ); + TextLabel5_2->setFrameShape( QLabel::Box ); + TextLabel5_2->setFrameShadow( QLabel::Sunken ); + TextLabel5_2->setMargin( 6 ); + TextLabel5_2->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); + TextLabel5_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, TextLabel5_2->sizePolicy().hasHeightForWidth() ) ); + FormCopyrightDialogBaseLayout->addWidget( TextLabel5_2 ); + + TextLabel5_2_2 = new QLabel( this, "TextLabel5_2_2" ); + TextLabel5_2_2->setText( tr( "KLyX is distributed in the hope that it will be\nuseful, but WITHOUT ANY WARRANTY, \nwithout even the implied warranty of \nMERCHANTABILITY or FITNESS FOR A \nPARTICULAR PURPOSE. See the GNU General \nPublic License for more details.\nYou should have received a copy of the GNU \nGeneral Public License along with this program; \nif not, write to thee Free Software Foundation, Inc., \n675 Mass Ave, Cambridge, MA 02139, USA." ) ); + TextLabel5_2_2->setFrameShape( QLabel::Box ); + TextLabel5_2_2->setFrameShadow( QLabel::Sunken ); + TextLabel5_2_2->setMargin( 6 ); + TextLabel5_2_2->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); + TextLabel5_2_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, TextLabel5_2_2->sizePolicy().hasHeightForWidth() ) ); + TextLabel5_2_2->setMinimumSize( QSize( 0, 0 ) ); + FormCopyrightDialogBaseLayout->addWidget( TextLabel5_2_2 ); + + okPB = new QPushButton( this, "okPB" ); + okPB->setText( tr( "&OK" ) ); + okPB->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, okPB->sizePolicy().hasHeightForWidth() ) ); + okPB->setDefault( TRUE ); + FormCopyrightDialogBaseLayout->addWidget( okPB ); + + // signals and slots connections + connect( okPB, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +FormCopyrightDialogBase::~FormCopyrightDialogBase() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/frontends/qt2/FormCopyrightDialogBase.h b/src/frontends/qt2/FormCopyrightDialogBase.h new file mode 100644 index 0000000000..62f4627f7f --- /dev/null +++ b/src/frontends/qt2/FormCopyrightDialogBase.h @@ -0,0 +1,37 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'FormCopyrightDialogBase.ui' +** +** Created: Wed Jan 24 12:18:18 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef FORMCOPYRIGHTDIALOGBASE_H +#define FORMCOPYRIGHTDIALOGBASE_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QLabel; +class QPushButton; + +class FormCopyrightDialogBase : public QDialog +{ + Q_OBJECT + +public: + FormCopyrightDialogBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~FormCopyrightDialogBase(); + + QLabel* TextLabel5; + QLabel* TextLabel5_2; + QLabel* TextLabel5_2_2; + QPushButton* okPB; + +protected: + QVBoxLayout* FormCopyrightDialogBaseLayout; +}; + +#endif // FORMCOPYRIGHTDIALOGBASE_H diff --git a/src/frontends/qt2/FormCopyrightDialogBase.ui b/src/frontends/qt2/FormCopyrightDialogBase.ui new file mode 100644 index 0000000000..41d2555dc1 --- /dev/null +++ b/src/frontends/qt2/FormCopyrightDialogBase.ui @@ -0,0 +1,190 @@ + +FormCopyrightDialogBase + + QDialog + + name + FormCopyrightDialogBase + + + geometry + + 0 + 0 + 472 + 454 + + + + caption + Form1 + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + TextLabel5 + + + text + KLyX is Copyright (C) 1995 by Matthias Ettrich, +1995-2001 by LyX Team + + + frameShape + Box + + + frameShadow + Sunken + + + margin + 6 + + + alignment + AlignCenter + + + hAlign + + + + QLabel + + name + TextLabel5_2 + + + text + 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. + + + frameShape + Box + + + frameShadow + Sunken + + + margin + 6 + + + alignment + WordBreak|AlignCenter + + + sizePolicy + + 1 + 1 + + + + hAlign + + + wordwrap + + + + QLabel + + name + TextLabel5_2_2 + + + text + KLyX 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 thee Free Software Foundation, Inc., +675 Mass Ave, Cambridge, MA 02139, USA. + + + frameShape + Box + + + frameShadow + Sunken + + + margin + 6 + + + alignment + WordBreak|AlignCenter + + + sizePolicy + + 1 + 1 + + + + minimumSize + + 0 + 0 + + + + hAlign + + + wordwrap + + + + QPushButton + + name + okPB + + + text + &OK + + + sizePolicy + + 0 + 0 + + + + default + true + + + + + + + okPB + clicked() + FormCopyrightDialogBase + reject() + + + diff --git a/src/frontends/qt2/GUIRunTime.C b/src/frontends/qt2/GUIRunTime.C new file mode 100644 index 0000000000..6c33d71243 --- /dev/null +++ b/src/frontends/qt2/GUIRunTime.C @@ -0,0 +1,113 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2001 The LyX Team. + * + * ====================================================== */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "GUIRunTime.h" +#include "debug.h" + +#include + +#include FORMS_H_LOCATION + +using std::endl; + +// For now we need this here as long as we use xforms components! + +// I keep these here so that it will be processed as early in +// the compilation process as possible. +#if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0 +#error LyX will not compile with this version of XForms.\ + Please get version 0.89.\ + If you want to try to compile anyway, delete this test in src/frontends/qt2/GUIRunTime.C. +#endif + +extern bool finished; + +static int const xforms_include_version = FL_INCLUDE_VERSION; + +int GUIRunTime::initApplication(int argc, char * argv[]) +{ + // Check the XForms version in the forms.h header against + // the one in the libforms. If they don't match quit the + // execution of LyX. Better with a clean fast exit than + // a strange segfault later. + // I realize that this check have to be moved when we + // support several toolkits, but IMO all the toolkits + // should try to have the same kind of check. This could + // be done by having a CheckHeaderAndLib function in + // all the toolkit implementations, this function is + // responsible for notifing the user. + // if (!CheckHeaderAndLib()) { + // // header vs. lib version failed + // return 1; + // } + int xforms_lib_version = fl_library_version(0, 0); + if (xforms_include_version != xforms_lib_version) { + lyxerr << "You are either running LyX with wrong " + "version of a dynamic XForms library\n" + "or you have build LyX with conflicting header " + "and library (different\n" + "versions of XForms. Sorry but there is no point " + "in continuing executing LyX!" << endl; + return 1; + } + + // I belive this is done in the wrong place, imo this should + // be done in lyx_gui.C similar to how/where xforms does it (Lgb) + static QApplication a(argc, argv); + + return 0; +} + +void GUIRunTime::processEvents() +{ + qApp->processEvents(); +} + + +void GUIRunTime::runTime() +{ + // We still use xforms event handler as the main one... + XEvent ev; + while (!finished) { + processEvents(); + if (fl_check_forms() == FL_EVENT) { + lyxerr << "LyX: This shouldn't happen..." << endl; + fl_XNextEvent(&ev); + } + } +} + + +void GUIRunTime::setDefaults() +{ + FL_IOPT cntl; + cntl.buttonFontSize = FL_NORMAL_SIZE; + cntl.browserFontSize = FL_NORMAL_SIZE; + cntl.labelFontSize = FL_NORMAL_SIZE; + cntl.choiceFontSize = FL_NORMAL_SIZE; + cntl.inputFontSize = FL_NORMAL_SIZE; + cntl.menuFontSize = FL_NORMAL_SIZE; + cntl.borderWidth = -1; + cntl.vclass = FL_DefaultVisual; + fl_set_defaults(FL_PDVisual + | FL_PDButtonFontSize + | FL_PDBrowserFontSize + | FL_PDLabelFontSize + | FL_PDChoiceFontSize + | FL_PDInputFontSize + | FL_PDMenuFontSize + | FL_PDBorderWidth, &cntl); +} + diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am new file mode 100644 index 0000000000..36c2e0ff24 --- /dev/null +++ b/src/frontends/qt2/Makefile.am @@ -0,0 +1,92 @@ +AUTOMAKE_OPTIONS = foreign 1.4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in +noinst_LTLIBRARIES = libqt2.la +BOOST_INCLUDES = -I$(top_srcdir)/boost +INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \ + ${SIGC_CFLAGS} ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \ + -I${top_srcdir}/src/frontends/xforms +DEFINES = -DQT_CLEAN_NAMESPACE + +# moc generated files +BUILTSOURCES = FormCopyrightDialog_moc.C \ + FormCopyrightDialogBase_moc.C + +LYXDATADIRS = dlg +DISTCLEANFILES = $(BUILTSOURCES) *.orig *.rej *~ *.bak core + +libqt2_la_OBJADD = \ + ../xforms/ButtonController.lo \ + ../xforms/Color.lo \ + ../xforms/FormBase.lo \ + ../xforms/FormCitation.lo \ + ../xforms/FormDocument.lo \ + ../xforms/FormError.lo \ + ../xforms/FormGraphics.lo \ + ../xforms/FormIndex.lo \ + ../xforms/FormInset.lo \ + ../xforms/FormParagraph.lo \ + ../xforms/FormPreferences.lo \ + ../xforms/FormPrint.lo \ + ../xforms/FormRef.lo \ + ../xforms/FormTabular.lo \ + ../xforms/FormTabularCreate.lo \ + ../xforms/FormToc.lo \ + ../xforms/FormUrl.lo \ + ../xforms/Menubar_pimpl.lo \ + ../xforms/RadioButtonGroup.lo \ + ../xforms/Toolbar_pimpl.lo \ + ../xforms/form_citation.lo \ + ../xforms/form_copyright.lo \ + ../xforms/form_document.lo \ + ../xforms/form_error.lo \ + ../xforms/form_graphics.lo \ + ../xforms/form_index.lo \ + ../xforms/form_paragraph.lo \ + ../xforms/form_preferences.lo \ + ../xforms/form_print.lo \ + ../xforms/form_ref.lo \ + ../xforms/form_tabular.lo \ + ../xforms/form_tabular_create.lo \ + ../xforms/form_toc.lo \ + ../xforms/form_url.lo \ + ../xforms/input_validators.lo \ + ../xforms/xform_helpers.lo + +LIBS= +LDFLAGS= $(libqt2_la_OBJADD) +ETAGS_ARGS = --lang=c++ + +libqt2_la_SOURCES = \ + $(BUILTSOURCES) \ + Dialogs.C \ + GUIRunTime.C \ + FormCopyright.C \ + FormCopyright.h \ + FormCopyrightDialog.C \ + FormCopyrightDialog.h \ + FormCopyrightDialogBase.C \ + FormCopyrightDialogBase.h + +# 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 + +FormCopyright.C: FormCopyrightDialogBase.h +FormCopyrightDialogBase.h: FormCopyrightDialogBase.ui + uic -o $@ $< +FormCopyrightDialogBase.C: FormCopyrightDialogBase.ui + uic -impl FormCopyrightDialogBase.h -o $@ $< +FormCopyrightDialogBase_moc.C: FormCopyrightDialogBase.h + moc -o $@ $< +FormCopyrightDialog_moc.C: FormCopyrightDialog.h + moc -o $@ $<