mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
more Foo/FooDialog merge
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17956 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ee89110c24
commit
24bb9669a5
@ -49,7 +49,6 @@ libqt4_la_SOURCES = \
|
||||
QChanges.C QChanges.h \
|
||||
QCharacter.C QCharacter.h \
|
||||
QCitation.C QCitation.h \
|
||||
QDocument.C QDocument.h \
|
||||
QDialogView.C QDialogView.h \
|
||||
QErrorList.C QErrorList.h \
|
||||
QExternal.C QExternal.h \
|
||||
@ -58,18 +57,15 @@ libqt4_la_SOURCES = \
|
||||
QInclude.C QInclude.h \
|
||||
QIndex.C QIndex.h \
|
||||
QLImage.C QLImage.h \
|
||||
QLog.C QLog.h \
|
||||
QViewSource.C QViewSource.h \
|
||||
QLPainter.C QLPainter.h \
|
||||
QLyXKeySym.C QLyXKeySym.h \
|
||||
QNomencl.C QNomencl.h \
|
||||
QNote.C QNote.h \
|
||||
QParagraph.C QParagraph.h \
|
||||
QPrefs.C QPrefs.h \
|
||||
QPrint.C QPrint.h \
|
||||
QRef.C QRef.h \
|
||||
QSendto.C QSendto.h \
|
||||
QShowFile.C QShowFile.h \
|
||||
Qt2BC.C Qt2BC.h \
|
||||
checkedwidgets.C checkedwidgets.h \
|
||||
panelstack.h panelstack.C \
|
||||
|
@ -98,7 +98,7 @@ MOCFILES = \
|
||||
QCommandBuffer.C QCommandBuffer.h \
|
||||
QCommandEdit.C QCommandEdit.h \
|
||||
QDelimiterDialog.C QDelimiterDialog.h \
|
||||
QDocumentDialog.C QDocumentDialog.h \
|
||||
QDocument.C QDocument.h \
|
||||
QErrorListDialog.C QErrorListDialog.h \
|
||||
QERT.C QERT.h \
|
||||
QExternalDialog.C QExternalDialog.h \
|
||||
@ -107,7 +107,6 @@ MOCFILES = \
|
||||
QIncludeDialog.C QIncludeDialog.h \
|
||||
QIndexDialog.C QIndexDialog.h \
|
||||
QLog.C QLog.h \
|
||||
QLogDialog.C QLogDialog.h \
|
||||
QViewSource.C QViewSource.h \
|
||||
QLMenubar.C QLMenubar.h \
|
||||
QLPopupMenu.C QLPopupMenu.h \
|
||||
@ -115,13 +114,13 @@ MOCFILES = \
|
||||
QMathMatrixDialog.C QMathMatrixDialog.h \
|
||||
QNomenclDialog.C QNomenclDialog.h \
|
||||
QNoteDialog.C QNoteDialog.h \
|
||||
QParagraphDialog.C QParagraphDialog.h \
|
||||
QParagraph.C QParagraph.h \
|
||||
QPrefsDialog.C QPrefsDialog.h \
|
||||
QRefDialog.C QRefDialog.h \
|
||||
QSearch.C QSearch.h \
|
||||
QSendtoDialog.C QSendtoDialog.h \
|
||||
qsetborder.C qsetborder.h \
|
||||
QShowFileDialog.C QShowFileDialog.h \
|
||||
QShowFile.C QShowFile.h \
|
||||
QSpellchecker.C QSpellchecker.h \
|
||||
QDialogView.C QDialogView.h \
|
||||
QTabularCreate.C QTabularCreate.h \
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,19 +13,107 @@
|
||||
#define QDOCUMENT_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QDocumentDialog.h"
|
||||
#include "BulletsModule.h"
|
||||
|
||||
#include "BranchList.h"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <string>
|
||||
#include "ui/DocumentUi.h"
|
||||
#include "ui/FontUi.h"
|
||||
#include "ui/TextLayoutUi.h"
|
||||
#include "ui/MathsUi.h"
|
||||
#include "ui/LaTeXUi.h"
|
||||
#include "ui/PageLayoutUi.h"
|
||||
#include "ui/LanguageUi.h"
|
||||
#include "ui/BiblioUi.h"
|
||||
#include "ui/NumberingUi.h"
|
||||
#include "ui/MarginsUi.h"
|
||||
#include "ui/PreambleUi.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QDialog>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class LengthCombo;
|
||||
class QLineEdit;
|
||||
class FloatPlacement;
|
||||
|
||||
template<class UI>
|
||||
class UiWidget: public QWidget, public UI
|
||||
{
|
||||
public:
|
||||
UiWidget(QWidget * parent = 0) : QWidget(parent)
|
||||
{
|
||||
UI::setupUi(this);
|
||||
}
|
||||
};
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBranches;
|
||||
class QDocument;
|
||||
|
||||
class QDocumentDialog : public QDialog, public Ui::QDocumentUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
friend class QDocument;
|
||||
|
||||
QDocumentDialog(QDocument *);
|
||||
~QDocumentDialog();
|
||||
|
||||
void updateParams(BufferParams const & params);
|
||||
void apply(BufferParams & params);
|
||||
|
||||
void updateFontsize(std::string const &, std::string const &);
|
||||
void updatePagestyle(std::string const &, std::string const &);
|
||||
|
||||
void showPreamble();
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateNumbering();
|
||||
void change_adaptor();
|
||||
void saveDefaultClicked();
|
||||
void useDefaultsClicked();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void setLSpacing(int);
|
||||
void setMargins(bool);
|
||||
void setCustomPapersize(int);
|
||||
void setCustomMargins(bool);
|
||||
void romanChanged(int);
|
||||
void sansChanged(int);
|
||||
void ttChanged(int);
|
||||
void setSkip(int);
|
||||
void enableSkip(bool);
|
||||
void portraitChanged();
|
||||
void classChanged();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent * e);
|
||||
|
||||
private:
|
||||
|
||||
UiWidget<Ui::TextLayoutUi> *textLayoutModule;
|
||||
UiWidget<Ui::FontUi> *fontModule;
|
||||
UiWidget<Ui::PageLayoutUi> *pageLayoutModule;
|
||||
UiWidget<Ui::MarginsUi> *marginsModule;
|
||||
UiWidget<Ui::LanguageUi> *langModule;
|
||||
UiWidget<Ui::NumberingUi> *numberingModule;
|
||||
UiWidget<Ui::BiblioUi> *biblioModule;
|
||||
UiWidget<Ui::MathsUi> *mathsModule;
|
||||
UiWidget<Ui::LaTeXUi> *latexModule;
|
||||
UiWidget<Ui::PreambleUi> *preambleModule;
|
||||
|
||||
QBranches *branchesModule;
|
||||
|
||||
BulletsModule * bulletsModule;
|
||||
FloatPlacement * floatModule;
|
||||
|
||||
QDocument * form_;
|
||||
|
||||
/// FIXME
|
||||
std::vector<std::string> lang_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ControlDocument;
|
||||
|
||||
class QDocument
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,118 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QDocumentDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QDOCUMENTDIALOG_H
|
||||
#define QDOCUMENTDIALOG_H
|
||||
|
||||
#include "ui/DocumentUi.h"
|
||||
#include "ui/FontUi.h"
|
||||
#include "ui/TextLayoutUi.h"
|
||||
#include "ui/MathsUi.h"
|
||||
#include "ui/LaTeXUi.h"
|
||||
#include "ui/PageLayoutUi.h"
|
||||
#include "ui/LanguageUi.h"
|
||||
#include "ui/BiblioUi.h"
|
||||
#include "ui/NumberingUi.h"
|
||||
#include "ui/MarginsUi.h"
|
||||
#include "ui/PreambleUi.h"
|
||||
|
||||
#include "BulletsModule.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QDialog>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class FloatPlacement;
|
||||
|
||||
template<class UI>
|
||||
class UiWidget: public QWidget, public UI
|
||||
{
|
||||
public:
|
||||
UiWidget(QWidget * Parent=0): QWidget(Parent)
|
||||
{
|
||||
UI::setupUi(this);
|
||||
}
|
||||
};
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBranches;
|
||||
class QDocument;
|
||||
|
||||
class QDocumentDialog : public QDialog, public Ui::QDocumentUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
friend class QDocument;
|
||||
|
||||
QDocumentDialog(QDocument *);
|
||||
~QDocumentDialog();
|
||||
|
||||
void updateParams(BufferParams const & params);
|
||||
void apply(BufferParams & params);
|
||||
|
||||
void updateFontsize(std::string const &, std::string const &);
|
||||
void updatePagestyle(std::string const &, std::string const &);
|
||||
|
||||
void showPreamble();
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateNumbering();
|
||||
void change_adaptor();
|
||||
void saveDefaultClicked();
|
||||
void useDefaultsClicked();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void setLSpacing(int);
|
||||
void setMargins(bool);
|
||||
void setCustomPapersize(int);
|
||||
void setCustomMargins(bool);
|
||||
void romanChanged(int);
|
||||
void sansChanged(int);
|
||||
void ttChanged(int);
|
||||
void setSkip(int);
|
||||
void enableSkip(bool);
|
||||
void portraitChanged();
|
||||
void classChanged();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent * e);
|
||||
|
||||
private:
|
||||
|
||||
UiWidget<Ui::TextLayoutUi> *textLayoutModule;
|
||||
UiWidget<Ui::FontUi> *fontModule;
|
||||
UiWidget<Ui::PageLayoutUi> *pageLayoutModule;
|
||||
UiWidget<Ui::MarginsUi> *marginsModule;
|
||||
UiWidget<Ui::LanguageUi> *langModule;
|
||||
UiWidget<Ui::NumberingUi> *numberingModule;
|
||||
UiWidget<Ui::BiblioUi> *biblioModule;
|
||||
UiWidget<Ui::MathsUi> *mathsModule;
|
||||
UiWidget<Ui::LaTeXUi> *latexModule;
|
||||
UiWidget<Ui::PreambleUi> *preambleModule;
|
||||
|
||||
QBranches *branchesModule;
|
||||
|
||||
BulletsModule * bulletsModule;
|
||||
FloatPlacement * floatModule;
|
||||
|
||||
QDocument * form_;
|
||||
|
||||
/// FIXME
|
||||
std::vector<std::string> lang_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // DOCUMENTDIALOG_H
|
@ -11,7 +11,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "QLog.h"
|
||||
#include "QLogDialog.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "frontends/Application.h"
|
||||
@ -26,15 +25,46 @@
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlLog, QView<QLogDialog> > log_base_class;
|
||||
|
||||
QLog::QLog(Dialog & parent)
|
||||
: log_base_class(parent, lyx::docstring())
|
||||
{}
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QLogDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
logHighlighter::logHighlighter(QTextDocument * parent) :
|
||||
QSyntaxHighlighter(parent)
|
||||
QLogDialog::QLogDialog(QLog * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
connect( updatePB, SIGNAL( clicked() ),
|
||||
this, SLOT( updateClicked() ) );
|
||||
}
|
||||
|
||||
|
||||
void QLogDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QLogDialog::updateClicked()
|
||||
{
|
||||
form_->update_contents();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LogHighlighter
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
LogHighlighter::LogHighlighter(QTextDocument * parent)
|
||||
: QSyntaxHighlighter(parent)
|
||||
{
|
||||
infoFormat.setForeground(Qt::darkGray);
|
||||
warningFormat.setForeground(Qt::darkBlue);
|
||||
@ -42,7 +72,7 @@ logHighlighter::logHighlighter(QTextDocument * parent) :
|
||||
}
|
||||
|
||||
|
||||
void logHighlighter::highlightBlock(QString const & text)
|
||||
void LogHighlighter::highlightBlock(QString const & text)
|
||||
{
|
||||
// Info
|
||||
QRegExp exprInfo("^(Document Class:|LaTeX Font Info:|File:|Package:|Language:|Underfull|Overfull|\\(|\\\\).*$");
|
||||
@ -71,11 +101,24 @@ void logHighlighter::highlightBlock(QString const & text)
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QLog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef QController<ControlLog, QView<QLogDialog> > LogBase;
|
||||
|
||||
QLog::QLog(Dialog & parent)
|
||||
: LogBase(parent, lyx::docstring())
|
||||
{}
|
||||
|
||||
|
||||
void QLog::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QLogDialog(this));
|
||||
// set syntax highlighting
|
||||
highlighter = new logHighlighter(dialog_->logTB->document());
|
||||
highlighter = new LogHighlighter(dialog_->logTB->document());
|
||||
//
|
||||
dialog_->logTB->setReadOnly(true);
|
||||
QFont font(toqstr(theApp()->typewriterFontName()));
|
||||
|
@ -13,15 +13,34 @@
|
||||
#define QLOG_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QLogDialog.h"
|
||||
|
||||
|
||||
#include "ui/LogUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
#include <QSyntaxHighlighter>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QLog;
|
||||
|
||||
class QLogDialog : public QDialog, public Ui::QLogUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QLogDialog(QLog * form);
|
||||
protected Q_SLOTS:
|
||||
virtual void updateClicked();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QLog * form_;
|
||||
};
|
||||
|
||||
|
||||
class ControlLog;
|
||||
class logHighlighter;
|
||||
class LogHighlighter;
|
||||
|
||||
///
|
||||
class QLog
|
||||
@ -40,18 +59,15 @@ private:
|
||||
/// build the dialog
|
||||
virtual void build_dialog();
|
||||
/// log syntax highlighter
|
||||
logHighlighter * highlighter;
|
||||
|
||||
LogHighlighter * highlighter;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
class logHighlighter : public QSyntaxHighlighter
|
||||
class LogHighlighter : public QSyntaxHighlighter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
logHighlighter(QTextDocument * parent);
|
||||
LogHighlighter(QTextDocument * parent);
|
||||
|
||||
protected:
|
||||
void highlightBlock(QString const & text);
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "QParagraph.h"
|
||||
#include "QParagraphDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
@ -28,18 +27,154 @@
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
using std::string;
|
||||
using std::endl;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QParagraphDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlParagraph, QView<QParagraphDialog> > paragraph_base_class;
|
||||
QParagraphDialog::QParagraphDialog(QParagraph * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()), form_, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()), form_, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
|
||||
connect(restorePB, SIGNAL(clicked()), form_, SLOT(slotRestore()));
|
||||
connect(alignDefaultCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(alignJustRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(alignLeftRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(alignRightRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(alignCenterRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(linespacing, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
||||
connect(linespacing, SIGNAL(activated(int)),
|
||||
this, SLOT(enableLinespacingValue(int)));
|
||||
connect(linespacingValue, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(indentCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(labelWidth, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
linespacingValue->setValidator(new QDoubleValidator(linespacingValue));
|
||||
|
||||
labelWidth->setWhatsThis( qt_(
|
||||
"As described in the User Guide, the length of"
|
||||
" this text will determine how wide the label part"
|
||||
" of each item is in environments like List and"
|
||||
" Description.\n"
|
||||
"\n"
|
||||
" Normally you won't need to set this,"
|
||||
" since the largest label width of all the"
|
||||
" items is used. But if you need to, you can"
|
||||
" change it here."
|
||||
));
|
||||
|
||||
radioMap[LYX_ALIGN_BLOCK] = alignJustRB;
|
||||
radioMap[LYX_ALIGN_LEFT] = alignLeftRB;
|
||||
radioMap[LYX_ALIGN_RIGHT] = alignRightRB;
|
||||
radioMap[LYX_ALIGN_CENTER] = alignCenterRB;
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::enableLinespacingValue(int)
|
||||
{
|
||||
bool const enable = linespacing->currentIndex() == 4;
|
||||
linespacingValue->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::checkAlignmentRadioButtons() {
|
||||
if (alignDefaultCB->isChecked()) {
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it)
|
||||
it->second->setDisabled(true);
|
||||
} else {
|
||||
LyXAlignment alignPossible = form_->controller().alignPossible();
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it)
|
||||
it->second->setEnabled(it->first & alignPossible);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::on_alignDefaultCB_toggled(bool)
|
||||
{
|
||||
checkAlignmentRadioButtons();
|
||||
alignmentToRadioButtons();
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::alignmentToRadioButtons(LyXAlignment align)
|
||||
{
|
||||
if (align == LYX_ALIGN_LAYOUT)
|
||||
align = form_->controller().alignDefault();
|
||||
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (;it != radioMap.end(); ++it) {
|
||||
if (align == it->first) {
|
||||
it->second->setChecked(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
lyxerr << BOOST_CURRENT_FUNCTION << "Unknown alignment "
|
||||
<< align << std::endl;
|
||||
}
|
||||
|
||||
|
||||
LyXAlignment QParagraphDialog::getAlignmentFromDialog()
|
||||
{
|
||||
if (alignDefaultCB->isChecked())
|
||||
return LYX_ALIGN_LAYOUT;
|
||||
LyXAlignment alignment = LYX_ALIGN_NONE;
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it) {
|
||||
if (it->second->isChecked()) {
|
||||
alignment = it->first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (alignment == form_->controller().alignDefault())
|
||||
return LYX_ALIGN_LAYOUT;
|
||||
return alignment;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QParagraph
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef QController<ControlParagraph, QView<QParagraphDialog> >
|
||||
ParagraphBase;
|
||||
|
||||
|
||||
QParagraph::QParagraph(Dialog & parent)
|
||||
: paragraph_base_class(parent, _("Paragraph Settings"))
|
||||
: ParagraphBase(parent, _("Paragraph Settings"))
|
||||
{}
|
||||
|
||||
|
||||
@ -155,3 +290,5 @@ void QParagraph::update_contents()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QParagraph_moc.cpp"
|
||||
|
@ -14,10 +14,43 @@
|
||||
#define QPARAGRAPH_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QParagraphDialog.h"
|
||||
|
||||
#include <map>
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
#include "layout.h"
|
||||
#include "ui/ParagraphUi.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QParagraph;
|
||||
|
||||
class QParagraphDialog : public QDialog, public Ui::QParagraphUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QParagraphDialog(QParagraph * form);
|
||||
///
|
||||
void checkAlignmentRadioButtons();
|
||||
///
|
||||
void alignmentToRadioButtons(LyXAlignment align = LYX_ALIGN_LAYOUT);
|
||||
///
|
||||
LyXAlignment getAlignmentFromDialog();
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * e);
|
||||
private:
|
||||
QParagraph * form_;
|
||||
typedef std::map<LyXAlignment, QRadioButton *> QPRadioMap;
|
||||
QPRadioMap radioMap;
|
||||
protected Q_SLOTS:
|
||||
///
|
||||
void change_adaptor();
|
||||
///
|
||||
void enableLinespacingValue(int);
|
||||
///
|
||||
void on_alignDefaultCB_toggled(bool);
|
||||
};
|
||||
|
||||
|
||||
class ControlParagraph;
|
||||
|
||||
|
@ -1,170 +0,0 @@
|
||||
/**
|
||||
* \file QParagraphDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
* \author Edwin Leuven
|
||||
* \author Richard Heck
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
#include "QParagraphDialog.h"
|
||||
#include "QParagraph.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QValidator>
|
||||
#include <QWhatsThis>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "qt_helpers.h"
|
||||
#include "frontends/controllers/ControlParagraph.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QParagraphDialog::QParagraphDialog(QParagraph * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form_, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()),
|
||||
form_, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form_, SLOT(slotClose()));
|
||||
connect(restorePB, SIGNAL(clicked()),
|
||||
form_, SLOT(slotRestore()));
|
||||
connect(alignDefaultCB, SIGNAL( clicked() ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
connect(alignJustRB, SIGNAL( clicked() ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
connect(alignLeftRB, SIGNAL( clicked() ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
connect(alignRightRB, SIGNAL( clicked() ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
connect(alignCenterRB, SIGNAL( clicked() ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
connect(linespacing, SIGNAL( activated(int) ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
connect(linespacing, SIGNAL( activated(int) ),
|
||||
this, SLOT( enableLinespacingValue(int) ) );
|
||||
connect(linespacingValue, SIGNAL( textChanged(const QString&) ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
connect(indentCB, SIGNAL( clicked() ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
connect(labelWidth, SIGNAL( textChanged(const QString&) ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
|
||||
linespacingValue->setValidator(new QDoubleValidator(linespacingValue));
|
||||
|
||||
labelWidth->setWhatsThis( qt_(
|
||||
"As described in the User Guide, the length of"
|
||||
" this text will determine how wide the label part"
|
||||
" of each item is in environments like List and"
|
||||
" Description.\n"
|
||||
"\n"
|
||||
" Normally you won't need to set this,"
|
||||
" since the largest label width of all the"
|
||||
" items is used. But if you need to, you can"
|
||||
" change it here."
|
||||
));
|
||||
|
||||
radioMap[LYX_ALIGN_BLOCK] = alignJustRB;
|
||||
radioMap[LYX_ALIGN_LEFT] = alignLeftRB;
|
||||
radioMap[LYX_ALIGN_RIGHT] = alignRightRB;
|
||||
radioMap[LYX_ALIGN_CENTER] = alignCenterRB;
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::enableLinespacingValue(int)
|
||||
{
|
||||
bool const enable = linespacing->currentIndex() == 4;
|
||||
linespacingValue->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::checkAlignmentRadioButtons() {
|
||||
if (alignDefaultCB->isChecked()) {
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it)
|
||||
it->second->setDisabled(true);
|
||||
} else {
|
||||
LyXAlignment alignPossible = form_->controller().alignPossible();
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it)
|
||||
it->second->setEnabled(it->first & alignPossible);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::on_alignDefaultCB_toggled(bool)
|
||||
{
|
||||
checkAlignmentRadioButtons();
|
||||
alignmentToRadioButtons();
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::alignmentToRadioButtons(LyXAlignment align)
|
||||
{
|
||||
if (align == LYX_ALIGN_LAYOUT)
|
||||
align = form_->controller().alignDefault();
|
||||
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (;it != radioMap.end(); ++it) {
|
||||
if (align == it->first) {
|
||||
it->second->setChecked(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
lyxerr << BOOST_CURRENT_FUNCTION << "Unknown alignment "
|
||||
<< align << std::endl;
|
||||
}
|
||||
|
||||
|
||||
LyXAlignment QParagraphDialog::getAlignmentFromDialog()
|
||||
{
|
||||
if (alignDefaultCB->isChecked())
|
||||
return LYX_ALIGN_LAYOUT;
|
||||
LyXAlignment alignment = LYX_ALIGN_NONE;
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it) {
|
||||
if (it->second->isChecked()) {
|
||||
alignment = it->first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (alignment == form_->controller().alignDefault())
|
||||
return LYX_ALIGN_LAYOUT;
|
||||
else return alignment;
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QParagraphDialog_moc.cpp"
|
@ -1,57 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QParagraphDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
* \author Edwin Leuven
|
||||
* \author Richard Heck
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QPARAGRAPHDIALOG_H
|
||||
#define QPARAGRAPHDIALOG_H
|
||||
|
||||
#include "ui/ParagraphUi.h"
|
||||
|
||||
#include <map>
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
#include "layout.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QParagraph;
|
||||
|
||||
class QParagraphDialog : public QDialog, public Ui::QParagraphUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QParagraphDialog(QParagraph * form);
|
||||
///
|
||||
void checkAlignmentRadioButtons();
|
||||
///
|
||||
void alignmentToRadioButtons(LyXAlignment align = LYX_ALIGN_LAYOUT);
|
||||
///
|
||||
LyXAlignment getAlignmentFromDialog();
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * e);
|
||||
private:
|
||||
QParagraph * form_;
|
||||
typedef std::map<LyXAlignment, QRadioButton *> QPRadioMap;
|
||||
QPRadioMap radioMap;
|
||||
protected Q_SLOTS:
|
||||
///
|
||||
void change_adaptor();
|
||||
///
|
||||
void enableLinespacingValue(int);
|
||||
///
|
||||
void on_alignDefaultCB_toggled(bool);
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QPARAGRAPHDIALOG_H
|
@ -11,7 +11,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "QShowFile.h"
|
||||
#include "QShowFileDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
@ -20,16 +19,42 @@
|
||||
#include <QTextBrowser>
|
||||
#include <QPushButton>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlShowFile, QView<QShowFileDialog> > showfile_base_class;
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QShowFileDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
QShowFileDialog::QShowFileDialog(QShowFile * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
void QShowFileDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QShowFile
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef QController<ControlShowFile, QView<QShowFileDialog> >
|
||||
ShowFileBase;
|
||||
|
||||
|
||||
QShowFile::QShowFile(Dialog & parent)
|
||||
: showfile_base_class(parent, _("Show File"))
|
||||
: ShowFileBase(parent, _("Show File"))
|
||||
{
|
||||
}
|
||||
|
||||
@ -46,7 +71,7 @@ void QShowFile::update_contents()
|
||||
{
|
||||
dialog_->setWindowTitle(toqstr(controller().getFileName()));
|
||||
|
||||
string contents = controller().getFileContents();
|
||||
std::string contents = controller().getFileContents();
|
||||
if (contents.empty()) {
|
||||
contents = "Error -> Cannot load file!";
|
||||
}
|
||||
@ -56,3 +81,5 @@ void QShowFile::update_contents()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QShowFile_moc.cpp"
|
||||
|
@ -13,11 +13,28 @@
|
||||
#define QSHOWFILE_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QShowFileDialog.h"
|
||||
|
||||
#include "ui/ShowFileUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QShowFile;
|
||||
|
||||
class QShowFileDialog : public QDialog, public Ui::QShowFileUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QShowFileDialog(QShowFile * form);
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QShowFile * form_;
|
||||
};
|
||||
|
||||
|
||||
class ControlShowFile;
|
||||
|
||||
class QShowFile
|
||||
|
@ -1,41 +0,0 @@
|
||||
/**
|
||||
* \file QShowFileDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "QShowFileDialog.h"
|
||||
#include "QShowFile.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QShowFileDialog::QShowFileDialog(QShowFile * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
void QShowFileDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QShowFileDialog_moc.cpp"
|
@ -1,38 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QShowFileDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QSHOWFILEDIALOG_H
|
||||
#define QSHOWFILEDIALOG_H
|
||||
|
||||
#include "ui/ShowFileUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QShowFile;
|
||||
|
||||
class QShowFileDialog : public QDialog, public Ui::QShowFileUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QShowFileDialog(QShowFile * form);
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QShowFile * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QSHOWFILEDIALOG_H
|
Loading…
Reference in New Issue
Block a user