Applied Angus patch to compile on DEC C++ and to avoid name clashes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1830 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Kalle Dalheimer 2001-03-26 19:34:45 +00:00
parent b63ac8a6c3
commit c5a0750890
20 changed files with 220 additions and 217 deletions

View File

@ -20,21 +20,22 @@
#include "FormCopyrightDialogImpl.h" #include "FormCopyrightDialogImpl.h"
#undef emit #undef emit
#include "../xforms/FormCredits.h"
#include "../xforms/FormError.h"
#include "../xforms/FormGraphics.h"
#include "../xforms/FormPreferences.h"
#include "../xforms/FormTabular.h"
#include "FormCharacter.h" #include "FormCharacter.h"
#include "FormCitation.h" #include "FormCitation.h"
#include "FormCredits.h"
#include "FormCopyright.h" #include "FormCopyright.h"
//#include "FormDocument.h" //#include "FormDocument.h"
#include "FormError.h"
#include "FormGraphics.h"
//#include "FormIndex.h" //#include "FormIndex.h"
#include "FormParagraph.h" #include "FormParagraph.h"
#include "FormPreferences.h"
#include "FormPrint.h" #include "FormPrint.h"
//#include "FormRef.h" //#include "FormRef.h"
#include "FormSearch.h" #include "FormSearch.h"
#include "FormSplash.h" #include "FormSplash.h"
#include "FormTabular.h"
#include "FormTabularCreate.h" #include "FormTabularCreate.h"
//#include "FormToc.h" //#include "FormToc.h"
//#include "FormUrl.h" //#include "FormUrl.h"

View File

@ -28,7 +28,7 @@ LyXFileDialog::LyXFileDialog(LyXView * lv, kb_action a, string const & p, string
void LyXFileDialog::done(int what) void LyXFileDialog::done(int what)
{ {
lyxerr[Debug::GUI] << "Done FileDialog, value " << what << endl; lyxerr[Debug::GUI] << "Done FileDialog, value " << what << std::endl;
if (action_ == LFUN_SELECT_FILE_SYNC) { if (action_ == LFUN_SELECT_FILE_SYNC) {
QDialog::done(what); QDialog::done(what);

View File

@ -1,120 +0,0 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include <qdialog.h>
#undef emit
#include "Dialogs.h"
#include "FormBase.h"
#include "qt2BC.h"
#include "support/LAssert.h"
#include <stdio.h>
FormBase::FormBase(ControlBase & c, string const & t)
: ViewBC<qt2BC>(c), title_(t)
{}
void FormBase::show()
{
fprintf( stderr, "FormBase::show() 1\n" );
if (!form()) {
fprintf( stderr, "FormBase::show() 2\n" );
build();
fprintf( stderr, "FormBase::show() 3\n" );
}
fprintf( stderr, "FormBase::show() 4\n" );
update(); // make sure its up-to-date
fprintf( stderr, "FormBase::show() 5\n" );
if (form()->isVisible()) {
fprintf( stderr, "FormBase::show() 6\n" );
form()->raise();
fprintf( stderr, "FormBase::show() 7\n" );
} else {
fprintf( stderr, "FormBase::show() 8\n" );
form()->setCaption( title_.c_str() );
fprintf( stderr, "FormBase::show() 9\n" );
form()->show();
fprintf( stderr, "FormBase::show() 10\n" );
}
}
void FormBase::hide()
{
if (form() && form()->isVisible() )
form()->hide();
}
// PENDING(kalle) Handle this with QValidator?
// void FormBase::InputCB(FL_OBJECT * ob, long data)
// {
// bc().input(input(ob, data));
// }
ButtonPolicy::SMInput FormBase::input(QWidget*, long)
{
return ButtonPolicy::SMI_VALID;
}
void FormBase::slotWMHide()
{
CancelButton();
}
void FormBase::slotApply()
{
ApplyButton();
}
void FormBase::slotOK()
{
OKButton();
}
void FormBase::slotCancel()
{
CancelButton();
}
void FormBase::slotRestore()
{
RestoreButton();
}
// PENDING(kalle) How to handle this?
// extern "C" void C_FormBaseInputCB(FL_OBJECT * ob, long d)
// {
// GetForm(ob)->InputCB(ob, d);
// }

View File

@ -19,6 +19,7 @@
#include "language.h" #include "language.h"
#include "support/lstrings.h" #include "support/lstrings.h"
using SigC::slot;
using Liason::setMinibuffer; using Liason::setMinibuffer;
FormCharacter::FormCharacter(LyXView *v, Dialogs *d) FormCharacter::FormCharacter(LyXView *v, Dialogs *d)

View File

@ -35,9 +35,11 @@
#include <qmultilineedit.h> #include <qmultilineedit.h>
#include <qpushbutton.h> #include <qpushbutton.h>
using SigC::slot;
using std::vector; using std::vector;
using std::pair; using std::pair;
using std::find; using std::find;
using std::sort;
FormCitation::FormCitation(LyXView *v, Dialogs *d) FormCitation::FormCitation(LyXView *v, Dialogs *d)
: dialog_(0), lv_(v), d_(d), inset_(0), ih_(0) : dialog_(0), lv_(v), d_(d), inset_(0), ih_(0)

View File

@ -60,11 +60,11 @@ private:
/// create a Citation inset /// create a Citation inset
void createCitation(string const &); void createCitation(string const &);
/// edit a Citation inset /// edit a Citation inset
void showCitation(InsetCommand * const); void showCitation(InsetCommand* );
/// update a listbox /// update a listbox
void updateBrowser( QListBox* listbox, void updateBrowser( QListBox* listbox,
vector<string> const & keys) const; std::vector<string> const & keys) const;
/// Real GUI implementation. /// Real GUI implementation.
FormCitationDialog * dialog_; FormCitationDialog * dialog_;

View File

@ -1,5 +1,5 @@
/** /**
* $Id: FormCitationDialogImpl.C,v 1.1 2001/03/16 17:20:06 kalle Exp $ * $Id: FormCitationDialogImpl.C,v 1.2 2001/03/26 19:34:45 kalle Exp $
*/ */
#include "FormCitationDialogImpl.h" #include "FormCitationDialogImpl.h"
@ -14,7 +14,10 @@
#include "LyXView.h" #include "LyXView.h"
#include "buffer.h" #include "buffer.h"
// PENDING(kalle) Wire text before and citaiton style using std::vector;
using std::find;
// PENDING(kalle) Wire text before and citation style
/* /*
* Constructs a FormCitationDialogImpl which is a child of 'parent', with the * Constructs a FormCitationDialogImpl which is a child of 'parent', with the

View File

@ -26,7 +26,7 @@
#include "ControlCopyright.h" #include "ControlCopyright.h"
#include "FormCopyright.h" #include "FormCopyright.h"
typedef FormCB<ControlCopyright, FormDB<FormCopyrightDialogImpl> > base_class; typedef Qt2CB<ControlCopyright, Qt2DB<FormCopyrightDialogImpl> > base_class;
FormCopyright::FormCopyright( ControlCopyright& c ) : FormCopyright::FormCopyright( ControlCopyright& c ) :
base_class( c, _( "Copyright and Warranty" ) ) base_class( c, _( "Copyright and Warranty" ) )

View File

@ -18,7 +18,7 @@
#ifndef FORMCOPYRIGHT_H #ifndef FORMCOPYRIGHT_H
#define FORMCOPYRIGHT_H #define FORMCOPYRIGHT_H
#include "FormBase.h" #include "Qt2Base.h"
#include "boost/utility.hpp" #include "boost/utility.hpp"
class Dialogs; class Dialogs;
@ -30,7 +30,7 @@ class ControlCopyright;
@author Kalle Dalheimer @author Kalle Dalheimer
*/ */
class FormCopyright class FormCopyright
: public FormCB<ControlCopyright, FormDB<FormCopyrightDialogImpl> > : public Qt2CB<ControlCopyright, Qt2DB<FormCopyrightDialogImpl> >
{ {
public: public:
FormCopyright( ControlCopyright& ); FormCopyright( ControlCopyright& );

View File

@ -19,6 +19,7 @@
#include "lyxtext.h" #include "lyxtext.h"
#include "debug.h" #include "debug.h"
using SigC::slot;
using Liason::setMinibuffer; using Liason::setMinibuffer;
using std::endl; using std::endl;

View File

@ -20,7 +20,7 @@
FormSplash::FormSplash(LyXView *, Dialogs * d) FormSplash::FormSplash(LyXView *, Dialogs * d)
: dialog_(0), d_(d) : dialog_(0), d_(d)
{ {
c_ = d->showSplash.connect(slot(this, &FormSplash::show)); c_ = d->showSplash.connect(SigC::slot(this, &FormSplash::show));
} }

View File

@ -17,6 +17,8 @@
#include "insets/insettabular.h" #include "insets/insettabular.h"
#include "support/lstrings.h" #include "support/lstrings.h"
using SigC::slot;
FormTabularCreate::FormTabularCreate(LyXView *v, Dialogs *d) FormTabularCreate::FormTabularCreate(LyXView *v, Dialogs *d)
: dialog_(0), lv_(v), d_(d), h_(0) : dialog_(0), lv_(v), d_(d), h_(0)
{ {

View File

@ -5,14 +5,13 @@ noinst_LTLIBRARIES = libqt2.la
BOOST_INCLUDES = -I$(top_srcdir)/boost BOOST_INCLUDES = -I$(top_srcdir)/boost
INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \ INCLUDES = -I${top_srcdir}/src/ -I${top_srcdir}/src/frontends/ \
${SIGC_CFLAGS} ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \ ${SIGC_CFLAGS} ${FRONTEND_INCLUDES} $(BOOST_INCLUDES) \
-I${top_srcdir}/src/frontends/xforms \
-I$(top_srcdir)/src/frontends/controllers -I$(top_srcdir)/src/frontends/controllers
CXXFLAGS += -DQT_CLEAN_NAMESPACE -fno-rtti -fno-exceptions DEFINES += -DQT_CLEAN_NAMESPACE
# moc generated files # moc generated files
BUILTSOURCES = \ BUILTSOURCES = \
moc_FileDialog_private.C \ moc_FileDialog_private.C \
moc_FormBase.C \ moc_Qt2Base.C \
moc_FormCitationDialog.C \ moc_FormCitationDialog.C \
moc_FormCitationDialogImpl.C \ moc_FormCitationDialogImpl.C \
moc_FormCopyrightDialog.C \ moc_FormCopyrightDialog.C \
@ -100,8 +99,8 @@ libqt2_la_SOURCES = \
chardlgimpl.h \ chardlgimpl.h \
FileDialog.C \ FileDialog.C \
FileDialog_private.C \ FileDialog_private.C \
FormBase.C \ Qt2Base.C \
FormBase.h \ Qt2Base.h \
FormCitation.C \ FormCitation.C \
FormCitation.h \ FormCitation.h \
FormCitationDialog.C \ FormCitationDialog.C \
@ -161,7 +160,7 @@ dist-hook:
done ; \ done ; \
done done
moc_FormBase.C: FormBase.h moc_Qt2Base.C: Qt2Base.h
$(MOC) -o $@ $< $(MOC) -o $@ $<
FormCitation.C: FormCitationDialog.h FormCitation.C: FormCitationDialog.h

110
src/frontends/qt2/Qt2Base.C Normal file
View File

@ -0,0 +1,110 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2000 The LyX Team.
*
* ======================================================
*
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include <qdialog.h>
#undef emit
#include "Dialogs.h"
#include "Qt2Base.h"
#include "qt2BC.h"
#include "support/LAssert.h"
#include <stdio.h>
Qt2Base::Qt2Base(ControlBase & c, string const & t)
: ViewBC<qt2BC>(c), title_(t)
{}
void Qt2Base::show()
{
if (!form()) {
build();
}
update(); // make sure its up-to-date
if (form()->isVisible()) {
form()->raise();
} else {
form()->setCaption( title_.c_str() );
form()->show();
}
}
void Qt2Base::hide()
{
if (form() && form()->isVisible() )
form()->hide();
}
// PENDING(kalle) Handle this with QValidator?
// void Qt2Base::InputCB(FL_OBJECT * ob, long data)
// {
// bc().input(input(ob, data));
// }
ButtonPolicy::SMInput Qt2Base::input(QWidget*, long)
{
return ButtonPolicy::SMI_VALID;
}
void Qt2Base::slotWMHide()
{
CancelButton();
}
void Qt2Base::slotApply()
{
ApplyButton();
}
void Qt2Base::slotOK()
{
OKButton();
}
void Qt2Base::slotCancel()
{
CancelButton();
}
void Qt2Base::slotRestore()
{
RestoreButton();
}
// PENDING(kalle) How to handle this?
// extern "C" void C_Qt2BaseInputCB(FL_OBJECT * ob, long d)
// {
// GetForm(ob)->InputCB(ob, d);
// }

View File

@ -11,8 +11,8 @@
* \author Angus Leeming <a.leeming@ic.ac.uk> * \author Angus Leeming <a.leeming@ic.ac.uk>
*/ */
#ifndef FORMBASE_H #ifndef QT2BASE_H
#define FORMBASE_H #define QT2BASE_H
#include <boost/smart_ptr.hpp> #include <boost/smart_ptr.hpp>
@ -33,14 +33,14 @@ class qt2BC;
/** This class is an Qt2 GUI base class. /** This class is an Qt2 GUI base class.
*/ */
class FormBase : public QObject, public ViewBC<qt2BC> class Qt2Base : public QObject, public ViewBC<qt2BC>
{ {
Q_OBJECT Q_OBJECT
public: public:
/// ///
FormBase(ControlBase &, string const &); Qt2Base(ControlBase &, string const &);
/// ///
virtual ~FormBase() {} virtual ~Qt2Base() {}
protected: protected:
/// Build the dialog /// Build the dialog
@ -80,11 +80,11 @@ private:
template <class Dialog> template <class Dialog>
class FormDB: public FormBase class Qt2DB: public Qt2Base
{ {
protected: protected:
/// ///
FormDB(ControlBase &, string const &); Qt2DB(ControlBase &, string const &);
/// Pointer to the actual instantiation of the Qt dialog /// Pointer to the actual instantiation of the Qt dialog
virtual QDialog* form() const; virtual QDialog* form() const;
/// Real GUI implementation. /// Real GUI implementation.
@ -93,37 +93,37 @@ protected:
template <class Dialog> template <class Dialog>
FormDB<Dialog>::FormDB(ControlBase & c, string const & t) Qt2DB<Dialog>::Qt2DB(ControlBase & c, string const & t)
: FormBase(c, t) : Qt2Base(c, t)
{} {}
template <class Dialog> template <class Dialog>
QDialog* FormDB<Dialog>::form() const QDialog* Qt2DB<Dialog>::form() const
{ {
return dialog_.get(); return dialog_.get();
} }
template <class Controller, class Base> template <class Controller, class Base>
class FormCB: public Base class Qt2CB: public Base
{ {
protected: protected:
/// ///
FormCB(ControlBase &, string const &); Qt2CB(ControlBase &, string const &);
/// The parent controller /// The parent controller
Controller & controller() const; Controller & controller() const;
}; };
template <class Controller, class Base> template <class Controller, class Base>
FormCB<Controller, Base>::FormCB(ControlBase & c, string const & t) Qt2CB<Controller, Base>::Qt2CB(ControlBase & c, string const & t)
: Base(c, t) : Base(c, t)
{} {}
template <class Controller, class Base> template <class Controller, class Base>
Controller & FormCB<Controller, Base>::controller() const Controller & Qt2CB<Controller, Base>::controller() const
{ {
return static_cast<Controller &>(controller_); return static_cast<Controller &>(controller_);
//return dynamic_cast<Controller &>(controller_); //return dynamic_cast<Controller &>(controller_);

View File

@ -32,11 +32,11 @@ class CharDlgImpl : public CharDlg
LyXFont getChar(); LyXFont getChar();
int langItem() { int langItem() {
lang->currentItem(); return lang->currentItem();
}; };
bool toggleAll() { bool toggleAll() {
toggleall->isChecked(); return toggleall->isChecked();
}; };
void setReadOnly(bool); void setReadOnly(bool);

View File

@ -1,13 +1,14 @@
/**************************************************************************** /****************************************************************************
** Form implementation generated from reading ui file 'searchdlg.ui' ** Form implementation generated from reading ui file 'searchdlg.ui'
** **
** Created: Sun Mar 4 21:52:22 2001 ** Created: Mon Mar 26 21:50:02 2001
** by: The User Interface Compiler (uic) ** by: The User Interface Compiler (uic)
** **
** WARNING! All changes made in this file will be lost! ** WARNING! All changes made in this file will be lost!
****************************************************************************/ ****************************************************************************/
#include "searchdlg.h" #include "searchdlg.h"
#include <config.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qcombobox.h> #include <qcombobox.h>
#include <qlabel.h> #include <qlabel.h>
@ -29,7 +30,7 @@ SearchDlg::SearchDlg( QWidget* parent, const char* name, bool modal, WFlags fl
{ {
if ( !name ) if ( !name )
setName( "SearchDlg" ); setName( "SearchDlg" );
resize( 379, 168 ); resize( 388, 168 );
setCaption( tr( "Form1" ) ); setCaption( tr( "Form1" ) );
setSizeGripEnabled( TRUE ); setSizeGripEnabled( TRUE );
SearchDlgLayout = new QGridLayout( this ); SearchDlgLayout = new QGridLayout( this );
@ -43,9 +44,9 @@ SearchDlg::SearchDlg( QWidget* parent, const char* name, bool modal, WFlags fl
find = new QComboBox( FALSE, this, "find" ); find = new QComboBox( FALSE, this, "find" );
find->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, find->sizePolicy().hasHeightForWidth() ) ); find->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, find->sizePolicy().hasHeightForWidth() ) );
find->setFocusPolicy( QComboBox::StrongFocus );
find->setEditable( TRUE ); find->setEditable( TRUE );
find->setDuplicatesEnabled( TRUE ); find->setDuplicatesEnabled( TRUE );
find->setFocusPolicy( QComboBox::StrongFocus );
SearchDlgLayout->addMultiCellWidget( find, 0, 0, 1, 2 ); SearchDlgLayout->addMultiCellWidget( find, 0, 0, 1, 2 );

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** Form interface generated from reading ui file 'searchdlg.ui' ** Form interface generated from reading ui file 'searchdlg.ui'
** **
** Created: Sun Mar 4 21:52:20 2001 ** Created: Mon Mar 26 21:48:19 2001
** by: The User Interface Compiler (uic) ** by: The User Interface Compiler (uic)
** **
** WARNING! All changes made in this file will be lost! ** WARNING! All changes made in this file will be lost!

View File

@ -1,5 +1,6 @@
<!DOCTYPE UI><UI> <!DOCTYPE UI><UI>
<class>SearchDlg</class> <class>SearchDlg</class>
<include location="global">config.h</include>
<widget> <widget>
<class>QDialog</class> <class>QDialog</class>
<property stdset="1"> <property stdset="1">
@ -11,7 +12,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>379</width> <width>388</width>
<height>168</height> <height>168</height>
</rect> </rect>
</property> </property>
@ -62,6 +63,10 @@
<vsizetype>0</vsizetype> <vsizetype>0</vsizetype>
</sizepolicy> </sizepolicy>
</property> </property>
<property stdset="1">
<name>focusPolicy</name>
<enum>StrongFocus</enum>
</property>
<property stdset="1"> <property stdset="1">
<name>editable</name> <name>editable</name>
<bool>true</bool> <bool>true</bool>
@ -70,10 +75,6 @@
<name>duplicatesEnabled</name> <name>duplicatesEnabled</name>
<bool>true</bool> <bool>true</bool>
</property> </property>
<property stdset="1">
<name>focusPolicy</name>
<enum>StrongFocus</enum>
</property>
</widget> </widget>
<widget row="1" column="0" > <widget row="1" column="0" >
<class>QLabel</class> <class>QLabel</class>

View File

@ -6,6 +6,8 @@
* \author Edwin Leuven * \author Edwin Leuven
*/ */
#include <config.h>
#include "searchdlgimpl.h" #include "searchdlgimpl.h"
#include <qpushbutton.h> #include <qpushbutton.h>