float dialog from edwin

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3435 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-01-25 17:46:18 +00:00
parent a15152c919
commit 1d3fa881d3
10 changed files with 473 additions and 22 deletions

View File

@ -1,3 +1,20 @@
2002-01-25 Edwin Leuven <leuven@fee.uva.nl>
* Makefile.am:
* Dialogs.C:
* Makefile.dialogs:
* QFloat.h:
* QFloat.C:
* QFloatDialog.h:
* QFloatDialog.C:
* ui/QFloatDialog.ui: add float dialog
2002-01-25 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am:
* Makefile.dialogs: don't compile QPar/Doc
for now, as they cause problems
2002-01-20 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am:

View File

@ -20,6 +20,7 @@
#include "QErrorDialog.h"
#include "QERTDialog.h"
#include "QExternalDialog.h"
#include "QFloatDialog.h"
#include "QGraphicsDialog.h"
#include "QIncludeDialog.h"
#include "QIndexDialog.h"
@ -45,6 +46,7 @@
#include "QError.h"
#include "QERT.h"
#include "QExternal.h"
#include "QFloat.h"
#include "QGraphics.h"
#include "QInclude.h"
#include "QIndex.h"
@ -73,8 +75,6 @@
#include "xforms/FormBrowser.h"
#include "xforms/form_browser.h"
#include "xforms/FormDocument.h"
#include "xforms/FormFloat.h"
#include "xforms/form_float.h"
#include "xforms/FormMathsPanel.h"
#include "xforms/FormParagraph.h"
#include "xforms/FormPreferences.h"
@ -98,6 +98,7 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIError<QError, Qt2BC>(*lv, *this));
add(new GUIERT<QERT, Qt2BC>(*lv, *this));
add(new GUIExternal<QExternal, Qt2BC>(*lv, *this));
add(new GUIFloat<QFloat, Qt2BC>(*lv, *this));
add(new GUIGraphics<QGraphics, Qt2BC>(*lv, *this));
add(new GUIInclude<QInclude, Qt2BC>(*lv, *this));
add(new GUIIndex<QIndex, Qt2BC>(*lv, *this));
@ -116,7 +117,6 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIVCLog<QVCLog, Qt2BC>(*lv, *this));
// dialogs not yet converted
add(new GUIFloat<FormFloat, xformsBC>(*lv, *this));
add(new GUIShowFile<FormShowFile, xformsBC>(*lv, *this));
// dialogs not yet MVCd

View File

@ -18,7 +18,6 @@ libqt2_la_LIBADD = \
ui/libqt2ui.la \
moc/libqt2moc.la \
ui/moc/libqt2uimoc.la \
../controllers/ButtonControllerBase.lo \
../xforms/combox.lo \
../xforms/Alert_pimpl.lo \
../xforms/Color.lo \
@ -26,7 +25,6 @@ libqt2_la_LIBADD = \
../xforms/FormBase.lo \
../xforms/FormBaseDeprecated.lo \
../xforms/FormBrowser.lo \
../xforms/FormFloat.lo \
../xforms/FormMathsBitmap.lo \
../xforms/FormMathsDeco.lo \
../xforms/FormMathsDelim.lo \
@ -47,7 +45,6 @@ libqt2_la_LIBADD = \
../xforms/bmtable.lo \
../xforms/form_browser.lo \
../xforms/form_document.lo \
../xforms/form_float.lo \
../xforms/form_preferences.lo \
../xforms/form_tabular.lo \
../xforms/form_maths_deco.lo \
@ -61,7 +58,7 @@ libqt2_la_LIBADD = \
../xforms/xformsBC.lo \
../xforms/xforms_helpers.lo \
@LYX_LIBS@ @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@
LIBS=
#LDFLAGS= $(libqt2_la_OBJADD)
ETAGS_ARGS = --lang=c++

View File

@ -6,16 +6,15 @@ DIALOGS = \
QBibtex \
QCharacter \
QCitation \
QDocument \
QError \
QERT \
QExternal \
QFloat \
QGraphics \
QInclude \
QIndex \
QLog \
QMinipage \
QParagraph \
QPreamble \
QPrint \
QRef \
@ -39,14 +38,14 @@ DIALOGSOURCES = \
QCharacter.C QCharacterDialog.C \
QCitation.h QCitationDialog.h \
QCitation.C QCitationDialog.C \
QDocument.h QDocumentDialog.h \
QDocument.C QDocumentDialog.C \
QError.h QErrorDialog.h \
QError.C QErrorDialog.C \
QERT.h QERTDialog.h \
QERT.C QERTDialog.C \
QExternal.h QExternalDialog.h \
QExternal.C QExternalDialog.C \
QFloat.h QFloatDialog.h \
QFloat.C QFloatDialog.C \
QGraphics.h QGraphicsDialog.h \
QGraphics.C QGraphicsDialog.C \
QInclude.h QIncludeDialog.h \
@ -57,8 +56,6 @@ DIALOGSOURCES = \
QLog.C QLogDialog.C \
QMinipage.h QMinipageDialog.h \
QMinipage.C QMinipageDialog.C \
QParagraph.h QParagraphDialog.h \
QParagraph.C QParagraphDialog.C \
QPreamble.h QPreambleDialog.h \
QPreamble.C QPreambleDialog.C \
QPrint.h QPrintDialog.h \
@ -88,16 +85,15 @@ MOCDIALOGS = \
QBibtexDialog_moc.C \
QCharacterDialog_moc.C \
QCitationDialog_moc.C \
QDocumentDialog_moc.C \
QErrorDialog_moc.C \
QERTDialog_moc.C \
QExternalDialog_moc.C \
QFloatDialog_moc.C \
QGraphicsDialog_moc.C \
QIncludeDialog_moc.C \
QIndexDialog_moc.C \
QLogDialog_moc.C \
QMinipageDialog_moc.C \
QParagraphDialog_moc.C \
QPreambleDialog_moc.C \
QPrintDialog_moc.C \
QRefDialog_moc.C \
@ -121,14 +117,14 @@ UIDIALOGS = \
QCharacterDialogBase.C \
QCitationDialogBase.h \
QCitationDialogBase.C \
QDocumentDialogBase.h \
QDocumentDialogBase.C \
QErrorDialogBase.C \
QErrorDialogBase.h \
QERTDialogBase.C \
QERTDialogBase.h \
QExternalDialogBase.C \
QExternalDialogBase.h \
QFloatDialogBase.C \
QFloatDialogBase.h \
QGraphicsDialogBase.C \
QGraphicsDialogBase.h \
QIncludeDialogBase.h \
@ -139,8 +135,6 @@ UIDIALOGS = \
QLogDialogBase.C \
QMinipageDialogBase.h \
QMinipageDialogBase.C \
QParagraphDialogBase.h \
QParagraphDialogBase.C \
QPreambleDialogBase.h \
QPreambleDialogBase.C \
QPrintDialogBase.h \
@ -170,16 +164,15 @@ UIMOCDIALOGS = \
QBibtexDialogBase_moc.C \
QCharacterDialogBase_moc.C \
QCitationDialogBase_moc.C \
QDocumentDialogBase_moc.C \
QErrorDialogBase_moc.C \
QERTDialogBase_moc.C \
QExternalDialogBase_moc.C \
QFloatDialogBase_moc.C \
QGraphicsDialogBase_moc.C \
QIncludeDialogBase_moc.C \
QIndexDialogBase_moc.C \
QLogDialogBase_moc.C \
QMinipageDialogBase_moc.C \
QParagraphDialogBase_moc.C \
QPreambleDialogBase_moc.C \
QPrintDialogBase_moc.C \
QRefDialogBase_moc.C \
@ -195,3 +188,5 @@ UIMOCDIALOGS = \

102
src/frontends/qt2/QFloat.C Normal file
View File

@ -0,0 +1,102 @@
/**
* \file QFloat.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven <leuven@fee.uva.nl>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlFloat.h"
#include "QFloatDialog.h"
#include "QFloat.h"
#include "Qt2BC.h"
#include "gettext.h"
#include "helper_funcs.h"
#include "support/lstrings.h"
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
QFloat::QFloat(ControlFloat & c)
: base_class(c, _("LaTeX Information"))
{
}
void QFloat::build_dialog()
{
dialog_.reset(new QFloatDialog(this));
bc().setCancel(dialog_->closePB);
bc().setApply(dialog_->applyPB);
bc().setOK(dialog_->okPB);
bc().setRestore(dialog_->restorePB);
}
void QFloat::update_contents()
{
bool top = false;
bool bottom = false;
bool page = false;
bool here = false;
bool forcehere = false;
string placement(controller().params().placement);
if (contains(placement, "H")) {
forcehere = true;
} else {
if (contains(placement, "t")) {
top = true;
}
if (contains(placement, "b")) {
bottom = true;
}
if (contains(placement, "p")) {
page = true;
}
if (contains(placement, "h")) {
here = true;
}
}
dialog_->top->setChecked(top);
dialog_->bottom->setChecked(bottom);
dialog_->page->setChecked(page);
dialog_->here->setChecked(here);
dialog_->forcehere->setChecked(forcehere);
}
void QFloat::apply()
{
string placement;
if (dialog_->forcehere->isChecked()) {
placement += "H";
} else {
if (dialog_->top->isChecked()) {
placement += "t";
}
if (dialog_->bottom->isChecked()) {
placement += "b";
}
if (dialog_->page->isChecked()) {
placement += "p";
}
if (dialog_->here->isChecked()) {
placement += "h";
}
}
controller().params().placement = placement;
}

View File

@ -0,0 +1,44 @@
// -*- C++ -*-
/**
* \file QFloat.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven <leuven@fee.uva.nl>
*/
#ifndef QFLOAT_H
#define QFLOAT_H
#ifdef __GNUG__
#pragma interface
#endif
#include "Qt2Base.h"
class ControlFloat;
class QFloatDialog;
///
class QFloat
: public Qt2CB<ControlFloat, Qt2DB<QFloatDialog> >
{
public:
///
friend class QFloatDialog;
///
QFloat(ControlFloat &);
private:
/// Apply changes
virtual void apply();
/// update
virtual void update_contents();
/// build the dialog
virtual void build_dialog();
};
#endif // QFLOAT_H

View File

@ -0,0 +1,46 @@
/**
* \file QFloatDialog.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven <leuven@fee.uva.nl>
*/
#include <config.h>
#include <qpushbutton.h>
#include "LString.h"
#include "ControlFloat.h"
#include "QFloatDialog.h"
#include "Dialogs.h"
#include "QFloat.h"
QFloatDialog::QFloatDialog(QFloat * form)
: QFloatDialogBase(0, 0, false, 0),
form_(form)
{
connect(restorePB, SIGNAL(clicked()),
form, SLOT(slotRestore()));
connect(okPB, SIGNAL(clicked()),
form, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()),
form, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
}
void QFloatDialog::change_adaptor()
{
form_->changed();
}
void QFloatDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}

View File

@ -0,0 +1,37 @@
/**
* \file QFloatDialog.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven <leuven@fee.uva.nl>
*/
#ifndef QFLOATDIALOG_H
#define QFLOATDIALOG_H
#include <config.h>
#include "ui/QFloatDialogBase.h"
class QFloat;
class QFloatDialog : public QFloatDialogBase
{ Q_OBJECT
public:
QFloatDialog(QFloat * form);
protected slots:
virtual void change_adaptor();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QFloat * form_;
};
#endif // QFLOATDIALOG_H

View File

@ -43,7 +43,7 @@ void QTexinfo::build_dialog()
bc().setCancel(dialog_->closePB);
}
void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
{
bool const withFullPath = dialog_->path->isChecked();
@ -61,6 +61,7 @@ void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
activeStyle = whichStyle;
}
void QTexinfo::updateStyles()
{
updateStyles(activeStyle);

View File

@ -0,0 +1,212 @@
<!DOCTYPE UI><UI>
<class>QFloatDialogBase</class>
<include location="global">config.h</include>
<include location="local">gettext.h</include>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>QFloatDialogBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>169</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Form1</string>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="2" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout1</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>restorePB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Restore</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>okPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;OK</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>applyPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Apply</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>closePB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Close</string>
</property>
</widget>
</hbox>
</widget>
<widget row="0" column="0" >
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>placement</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Placement</string>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="1" column="0" >
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>bottom</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Bottom of the page</string>
</property>
</widget>
<widget row="0" column="0" >
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>top</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Top of the page</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>page</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Page of floats</string>
</property>
</widget>
<widget row="1" column="1" >
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>here</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Here, if possible</string>
</property>
</widget>
</grid>
</widget>
<widget row="1" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>forcehere</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Here, definitely</string>
</property>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>forcehere</sender>
<signal>toggled(bool)</signal>
<receiver>placement</receiver>
<slot>setDisabled(bool)</slot>
</connection>
</connections>
<tabstops>
<tabstop>top</tabstop>
<tabstop>bottom</tabstop>
<tabstop>page</tabstop>
<tabstop>here</tabstop>
<tabstop>forcehere</tabstop>
<tabstop>restorePB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
</UI>