GuiSelection.h GuiSelection.C \
LyXKeySymFactory.C \
QLMenubar.C QLMenubar.h \
- QBibitem.C QBibitem.h \
- QBibtex.C QBibtex.h \
QBox.C QBox.h \
- QBranch.C QBranch.h \
QBranches.C QBranches.h \
QChanges.C QChanges.h \
QCharacter.C QCharacter.h \
QCitation.C QCitation.h \
QDialogView.C QDialogView.h \
QErrorList.C QErrorList.h \
- QExternal.C QExternal.h \
QFloat.C QFloat.h \
QGraphics.C QGraphics.h \
QInclude.C QInclude.h \
- QIndex.C QIndex.h \
QLImage.C QLImage.h \
QViewSource.C QViewSource.h \
QLPainter.C QLPainter.h \
lengthcombo.C lengthcombo.h \
panelstack.C panelstack.h \
QAbout.C QAbout.h \
- QBibitemDialog.C QBibitemDialog.h \
- QBibtexDialog.C QBibtexDialog.h \
+ QBibitem.C QBibitem.h \
+ QBibtex.C QBibtex.h \
QBox.C QBox.h \
- QBranchDialog.C QBranchDialog.h \
+ QBranch.C QBranch.h \
QBranches.C QBranches.h \
QChangesDialog.C QChangesDialog.h \
QCharacterDialog.C QCharacterDialog.h \
QDocument.C QDocument.h \
QErrorListDialog.C QErrorListDialog.h \
QERT.C QERT.h \
- QExternalDialog.C QExternalDialog.h \
+ QExternal.C QExternal.h \
QFloatDialog.C QFloatDialog.h \
QGraphicsDialog.C QGraphicsDialog.h \
QIncludeDialog.C QIncludeDialog.h \
- QIndexDialog.C QIndexDialog.h \
+ QIndex.C QIndex.h \
QLog.C QLog.h \
QViewSource.C QViewSource.h \
QLMenubar.C QLMenubar.h \
#include <config.h>
#include "QBibitem.h"
-#include "QBibitemDialog.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "controllers/ControlCommand.h"
-#include <qlineedit.h>
-#include <qpushbutton.h>
+#include <QLineEdit>
+#include <QPushButton>
namespace lyx {
namespace frontend {
-typedef QController<ControlCommand, QView<QBibitemDialog> > bibitem_base_class;
+/////////////////////////////////////////////////////////////////////
+//
+// QBibItemDialog
+//
+/////////////////////////////////////////////////////////////////////
+
+QBibitemDialog::QBibitemDialog(QBibitem * form)
+ : form_(form)
+{
+ setupUi(this);
+ connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
+ connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
+
+ connect(keyED, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+ connect(labelED, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+}
+
+
+void QBibitemDialog::change_adaptor()
+{
+ form_->changed();
+}
+
+
+void QBibitemDialog::closeEvent(QCloseEvent *e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// QBibItem
+//
+/////////////////////////////////////////////////////////////////////
+
+typedef QController<ControlCommand, QView<QBibitemDialog> > BibItemBase;
QBibitem::QBibitem(Dialog & parent)
- : bibitem_base_class(parent, _("Bibliography Entry Settings"))
+ : BibItemBase(parent, _("Bibliography Entry Settings"))
{
}
} // namespace frontend
} // namespace lyx
+
+#include "QBibitem_moc.cpp"
#ifndef QBIBITEM_CONTROLLER_H
#define QBIBITEM_CONTROLLER_H
-#include "QBibitemDialog.h"
#include "QDialogView.h"
+#include "ui/BibitemUi.h"
+
+#include <QDialog>
+#include <QCloseEvent>
+
+
namespace lyx {
namespace frontend {
+class QBibitem;
+
+class QBibitemDialog : public QDialog, public Ui::QBibitemUi {
+ Q_OBJECT
+public:
+
+ QBibitemDialog(QBibitem * form);
+protected Q_SLOTS:
+ virtual void change_adaptor();
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+private:
+ QBibitem * form_;
+};
+
+
class ControlCommand;
class QBibitem
+++ /dev/null
-/**
- * \file QBibitemDialog.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 "QBibitemDialog.h"
-
-#include "QBibitem.h"
-
-#include <qpushbutton.h>
-#include <QCloseEvent>
-
-namespace lyx {
-namespace frontend {
-
-QBibitemDialog::QBibitemDialog(QBibitem * form)
- : form_(form)
-{
- setupUi(this);
- connect(okPB, SIGNAL(clicked()),
- form, SLOT(slotOK()));
- connect(closePB, SIGNAL(clicked()),
- form, SLOT(slotClose()));
-
- connect( keyED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
- connect( labelED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
-}
-
-
-void QBibitemDialog::change_adaptor()
-{
- form_->changed();
-}
-
-
-void QBibitemDialog::closeEvent(QCloseEvent *e)
-{
- form_->slotWMHide();
- e->accept();
-}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "QBibitemDialog_moc.cpp"
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file QBibitemDialog.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 QBIBITEMDIALOG_H
-#define QBIBITEMDIALOG_H
-
-#include "ui/BibitemUi.h"
-
-#include <QDialog>
-
-#include <QCloseEvent>
-
-
-namespace lyx {
-namespace frontend {
-
-class QBibitem;
-
-class QBibitemDialog : public QDialog, public Ui::QBibitemUi {
- Q_OBJECT
-public:
-
- QBibitemDialog(QBibitem * form);
-protected Q_SLOTS:
- virtual void change_adaptor();
-protected:
- virtual void closeEvent(QCloseEvent * e);
-private:
- QBibitem * form_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // QBIBITEMDIALOG_H
#include "QBibtex.h"
-#include "QBibtexDialog.h"
#include "ui/BibtexAddUi.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "validators.h"
-
#include "lyxrc.h"
+#include "checkedwidgets.h"
+
+#include "controllers/ControlBibtex.h"
+#include "controllers/ButtonPolicies.h"
#include "controllers/ControlBibtex.h"
#include <QPushButton>
#include <QListWidget>
#include <QCheckBox>
-
+#include <QCloseEvent>
+#include <QLineEdit>
using lyx::support::changeExtension;
using lyx::support::split;
using std::vector;
using std::string;
+#include "debug.h"
+#include "support/filetools.h"
+#include "support/lstrings.h"
+
+
namespace lyx {
namespace frontend {
-typedef QController<ControlBibtex, QView<QBibtexDialog> > bibtex_base_class;
+
+/////////////////////////////////////////////////////////////////////
+//
+// QBibtexDialog
+//
+/////////////////////////////////////////////////////////////////////
+
+QBibtexDialog::QBibtexDialog(QBibtex * form)
+ : form_(form)
+{
+ setupUi(this);
+ QDialog::setModal(true);
+
+ connect(okPB, SIGNAL(clicked()),
+ form, SLOT(slotOK()));
+ connect(closePB, SIGNAL(clicked()),
+ form, SLOT(slotClose()));
+ connect(stylePB, SIGNAL(clicked()),
+ this, SLOT( browsePressed()));
+ connect(deletePB, SIGNAL(clicked()),
+ this, SLOT( deletePressed()));
+ connect(styleCB, SIGNAL(editTextChanged (const QString &)),
+ this, SLOT( change_adaptor()));
+ connect(databaseLW, SIGNAL(itemSelectionChanged()),
+ this, SLOT( databaseChanged()));
+ connect(bibtocCB, SIGNAL(clicked()),
+ this, SLOT( change_adaptor()));
+ connect(btPrintCO, SIGNAL(activated(int)),
+ this, SLOT( change_adaptor()));
+ connect(addBibPB, SIGNAL(clicked()),
+ this, SLOT( addPressed()));
+
+ add_ = new UiDialog<Ui::QBibtexAddUi>(this, true);
+
+ Qt2BC * bcview = new Qt2BC(add_bc_);
+ add_bc_.view(bcview);
+ add_bc_.bp(new OkCancelPolicy);
+
+ bcview->setOK(add_->addPB);
+ bcview->setCancel(add_->closePB);
+
+ add_->bibED->setValidator(new PathValidator(true, add_->bibED));
+ addCheckedLineEdit(add_bc_.view(), add_->bibED, 0);
+
+ connect(add_->bibED, SIGNAL(textChanged(const QString &)),
+ this, SLOT(bibEDChanged()));
+ connect(add_->addPB, SIGNAL(clicked()),
+ this, SLOT(addDatabase()));
+ connect(add_->addPB, SIGNAL(clicked()),
+ add_, SLOT(accept()));
+ connect(add_->bibLW, SIGNAL(itemActivated(QListWidgetItem *)),
+ this, SLOT(addDatabase()));
+ connect(add_->bibLW, SIGNAL(itemActivated(QListWidgetItem *)),
+ add_, SLOT(accept()));
+ connect(add_->bibLW, SIGNAL(itemSelectionChanged()),
+ this, SLOT(availableChanged()));
+ connect(add_->browsePB, SIGNAL(clicked()),
+ this, SLOT(browseBibPressed()));
+ connect(add_->closePB, SIGNAL(clicked()),
+ add_, SLOT(reject()));
+
+}
+
+
+void QBibtexDialog::bibEDChanged()
+{
+ // Indicate to the button controller that the contents have
+ // changed. The actual test of validity is carried out by
+ // the checkedLineEdit.
+ add_bc_.valid(true);
+}
+
+
+void QBibtexDialog::change_adaptor()
+{
+ form_->changed();
+}
+
+
+void QBibtexDialog::browsePressed()
+{
+ docstring const file = form_->controller().browseBst(docstring());
+
+ if (!file.empty()) {
+ // FIXME UNICODE
+ docstring const filen = from_utf8(changeExtension(to_utf8(file), ""));
+ bool present = false;
+ unsigned int pres = 0;
+
+ for (int i = 0; i != styleCB->count(); ++i) {
+ if (qstring_to_ucs4(styleCB->itemText(i)) == filen) {
+ present = true;
+ pres = i;
+ }
+ }
+
+ if (!present)
+ styleCB->insertItem(0, toqstr(filen));
+
+ styleCB->setCurrentIndex(pres);
+ form_->changed();
+ }
+}
+
+
+void QBibtexDialog::browseBibPressed()
+{
+ docstring const file = trim(form_->controller().browseBib(docstring()));
+
+ if (!file.empty()) {
+ // FIXME UNICODE
+ QString const f = toqstr(changeExtension(to_utf8(file), ""));
+ bool present = false;
+
+ for (int i = 0; i < add_->bibLW->count(); ++i) {
+ if (add_->bibLW->item(i)->text() == f)
+ present = true;
+ }
+
+ if (!present) {
+ add_->bibLW->addItem(f);
+ form_->changed();
+ }
+
+ add_->bibED->setText(f);
+ }
+}
+
+
+void QBibtexDialog::addPressed()
+{
+ add_bc_.valid(false);
+ add_->exec();
+}
+
+
+void QBibtexDialog::addDatabase()
+{
+ int const sel = add_->bibLW->currentRow();
+ docstring const file = trim(qstring_to_ucs4(add_->bibED->text()));
+
+ if (sel < 0 && file.empty())
+ return;
+
+ // Add the selected browser_bib keys to browser_database
+ // multiple selections are possible
+ for (int i = 0; i != add_->bibLW->count(); ++i) {
+ QListWidgetItem * const item = add_->bibLW->item(i);
+ if (add_->bibLW->isItemSelected(item)) {
+ add_->bibLW->setItemSelected(item, false);
+ QList<QListWidgetItem *> matches =
+ databaseLW->findItems(item->text(), Qt::MatchExactly);
+ if (matches.empty())
+ databaseLW->addItem(item->text());
+ }
+ }
+
+ if (!file.empty()) {
+ add_->bibED->clear();
+ QString const f = toqstr(from_utf8(changeExtension(to_utf8(file), "")));
+ QList<QListWidgetItem *> matches =
+ databaseLW->findItems(f, Qt::MatchExactly);
+ if (matches.empty())
+ databaseLW->addItem(f);
+ }
+
+ form_->changed();
+}
+
+
+void QBibtexDialog::deletePressed()
+{
+ databaseLW->takeItem(databaseLW->currentRow());
+ form_->changed();
+}
+
+
+
+void QBibtexDialog::databaseChanged()
+{
+ deletePB->setEnabled(!form_->readOnly() && databaseLW->currentRow() != -1);
+}
+
+
+void QBibtexDialog::availableChanged()
+{
+ add_bc_.valid(true);
+}
+
+
+void QBibtexDialog::closeEvent(QCloseEvent *e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// QBibTex
+//
+/////////////////////////////////////////////////////////////////////
+
+
+typedef QController<ControlBibtex, QView<QBibtexDialog> > BibtexBase;
QBibtex::QBibtex(Dialog & parent)
- : bibtex_base_class(parent, _("BibTeX Bibliography"))
+ : BibtexBase(parent, _("BibTeX Bibliography"))
{
}
} // namespace frontend
} // namespace lyx
+
+#include "QBibtex_moc.cpp"
* Full author contact details are available in file CREDITS.
*/
-#ifndef QBIBTEX_CONTROLLER_H
-#define QBIBTEX_CONTROLLER_H
+#ifndef QBIBTEX_H
+#define QBIBTEX_H
#include "QDialogView.h"
-#include "QBibtexDialog.h"
+
+#include "ui/BibtexUi.h"
+#include "ui/BibtexAddUi.h"
+
+#include "ButtonController.h"
+
+#include <QCloseEvent>
+#include <QDialog>
namespace lyx {
namespace frontend {
+class QBibtex;
+
+template<class UI>
+class UiDialog : public QDialog, public UI
+{
+public:
+ UiDialog(QWidget * parent=0, bool modal=false, Qt::WFlags f=0)
+ : QDialog(parent, f)
+ {
+ UI::setupUi(this);
+ QDialog::setModal(modal);
+ }
+};
+
+
+class QBibtexDialog : public QDialog, public Ui::QBibtexUi {
+ Q_OBJECT
+
+public:
+ QBibtexDialog(QBibtex * form);
+
+ UiDialog<Ui::QBibtexAddUi> * add_;
+
+protected Q_SLOTS:
+ virtual void change_adaptor();
+ virtual void browsePressed();
+ virtual void browseBibPressed();
+ virtual void addPressed();
+ virtual void addDatabase();
+ virtual void deletePressed();
+ virtual void databaseChanged();
+ virtual void availableChanged();
+ void bibEDChanged();
+
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+
+private:
+ QBibtex * form_;
+ ButtonController add_bc_;
+};
+
+
class ControlBibtex;
class QBibtex
#include <config.h>
#include "QBranch.h"
-#include "QBranchDialog.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "insets/InsetBranch.h"
#include <QPushButton>
+#include <QCloseEvent>
namespace lyx {
namespace frontend {
+/////////////////////////////////////////////////////////////////////
+//
+// QBranchDialog
+//
+/////////////////////////////////////////////////////////////////////
+
+QBranchDialog::QBranchDialog(QBranch * form)
+ : form_(form)
+{
+ setupUi(this);
+ connect(okPB, SIGNAL(clicked()),
+ form, SLOT(slotOK()));
+ connect(closePB, SIGNAL(clicked()),
+ form, SLOT(slotClose()));
+ connect(branchCO, SIGNAL( activated(int) ),
+ this, SLOT( change_adaptor() ) );
+}
+
+
+void QBranchDialog::closeEvent(QCloseEvent * e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
+
+
+void QBranchDialog::change_adaptor()
+{
+ form_->changed();
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// QBranch
+//
+/////////////////////////////////////////////////////////////////////
+
typedef QController<ControlBranch, QView<QBranchDialog> > branch_base_class;
} // namespace frontend
} // namespace lyx
+
+#include "QBranch_moc.cpp"
#ifndef QBRANCH_H
#define QBRANCH_H
-#include "QBranchDialog.h"
#include "QDialogView.h"
+#include "ui/BranchUi.h"
+
+#include <QCloseEvent>
+#include <QDialog>
namespace lyx {
namespace frontend {
+class QBranch;
+
+class QBranchDialog : public QDialog, public Ui::QBranchUi {
+ Q_OBJECT
+public:
+ QBranchDialog(QBranch * form);
+protected Q_SLOTS:
+ virtual void change_adaptor();
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+private:
+ QBranch * form_;
+};
+
class ControlBranch;
/** This class provides a QT implementation of the Branch Dialog.
#include "lyxrc.h"
#include "controllers/ControlExternal.h"
+#include "controllers/ButtonController.h"
#include "insets/ExternalTemplate.h"
#include "insets/InsetExternal.h"
#include "support/lstrings.h"
#include "support/convert.h"
#include "support/os.h"
+#include "support/lyxlib.h"
#include "QExternal.h"
-#include "QExternalDialog.h"
#include "Qt2BC.h"
#include "checkedwidgets.h"
using lyx::support::isStrDbl;
using lyx::support::token;
using lyx::support::trim;
+using lyx::support::float_equal;
using lyx::support::os::internal_path;
using std::vector;
using std::find;
+
namespace lyx {
namespace frontend {
+/////////////////////////////////////////////////////////////////////
+//
+// QExternalDialog
+//
+/////////////////////////////////////////////////////////////////////
+
+
+QExternalDialog::QExternalDialog(QExternal * 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( displayCB, SIGNAL( toggled(bool) ), showCO, SLOT( setEnabled(bool) ) );
+ connect( displayCB, SIGNAL( toggled(bool) ), displayscaleED, SLOT( setEnabled(bool) ) );
+ connect( showCO, SIGNAL( activated(const QString&) ), this, SLOT( change_adaptor() ) );
+ connect( originCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
+ connect( aspectratioCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
+ connect( browsePB, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
+ connect( editPB, SIGNAL( clicked() ), this, SLOT( editClicked() ) );
+ connect( externalCO, SIGNAL( activated(const QString&) ), this, SLOT( templateChanged() ) );
+ connect( extraED, SIGNAL( textChanged(const QString&) ), this, SLOT( extraChanged(const QString&) ) );
+ connect( extraFormatCO, SIGNAL( activated(const QString&) ), this, SLOT( formatChanged(const QString&) ) );
+ connect( widthUnitCO, SIGNAL( activated(int) ), this, SLOT( widthUnitChanged() ) );
+ connect( heightUnitCO, SIGNAL( selectionChanged(lyx::LyXLength::UNIT) ), this, SLOT( change_adaptor() ) );
+ connect( displayCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
+ connect( displayscaleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
+ connect( angleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
+ connect( widthED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) );
+ connect( heightED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) );
+ connect( fileED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
+ connect( clipCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
+ connect( getbbPB, SIGNAL( clicked() ), this, SLOT( getbbClicked() ) );
+ connect( xrED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
+ connect( ytED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
+ connect( xlED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
+ connect( ybED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
+ connect( draftCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
+
+ QIntValidator * validator = new QIntValidator(displayscaleED);
+ validator->setBottom(1);
+ displayscaleED->setValidator(validator);
+
+ angleED->setValidator(new QDoubleValidator(-360, 360, 2, angleED));
+
+ xlED->setValidator(new QIntValidator(xlED));
+ ybED->setValidator(new QIntValidator(ybED));
+ xrED->setValidator(new QIntValidator(xrED));
+ ytED->setValidator(new QIntValidator(ytED));
+
+ widthED->setValidator(unsignedLengthValidator(widthED));
+ heightED->setValidator(unsignedLengthValidator(heightED));
+
+ fileED->setValidator(new PathValidator(true, fileED));
+ setFocusProxy(fileED);
+}
+
+
+void QExternalDialog::show()
+{
+ QDialog::show();
+}
+
+
+
+bool QExternalDialog::activateAspectratio() const
+{
+ if (widthUnitCO->currentIndex() == 0)
+ return false;
+
+ string const wstr = fromqstr(widthED->text());
+ if (wstr.empty())
+ return false;
+ bool const wIsDbl = isStrDbl(wstr);
+ if (wIsDbl && float_equal(convert<double>(wstr), 0.0, 0.05))
+ return false;
+ LyXLength l;
+ if (!wIsDbl && (!isValidLength(wstr, &l) || l.zero()))
+ return false;
+
+ string const hstr = fromqstr(heightED->text());
+ if (hstr.empty())
+ return false;
+ bool const hIsDbl = isStrDbl(hstr);
+ if (hIsDbl && float_equal(convert<double>(hstr), 0.0, 0.05))
+ return false;
+ if (!hIsDbl && (!isValidLength(hstr, &l) || l.zero()))
+ return false;
+
+ return true;
+}
+
+
+void QExternalDialog::bbChanged()
+{
+ form_->controller().bbChanged(true);
+ form_->changed();
+}
+
+
+void QExternalDialog::browseClicked()
+{
+ int const choice = externalCO->currentIndex();
+ docstring const template_name =
+ lyx::from_utf8(form_->controller().getTemplate(choice).lyxName);
+ docstring const str =
+ form_->controller().browse(qstring_to_ucs4(fileED->text()),
+ template_name);
+ fileED->setText(toqstr(str));
+ form_->changed();
+}
+
+
+void QExternalDialog::change_adaptor()
+{
+ form_->changed();
+}
+
+
+void QExternalDialog::closeEvent(QCloseEvent * e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
+
+
+void QExternalDialog::editClicked()
+{
+ form_->controller().editExternal();
+}
+
+
+
+void QExternalDialog::extraChanged(const QString& text)
+{
+ std::string const format = fromqstr(extraFormatCO->currentText());
+ form_->extra_[format] = text;
+ form_->changed();
+}
+
+
+void QExternalDialog::formatChanged(const QString& format)
+{
+ extraED->setText(form_->extra_[fromqstr(format)]);
+}
+
+
+void QExternalDialog::getbbClicked()
+{
+ form_->getBB();
+}
+
+
+void QExternalDialog::sizeChanged()
+{
+ aspectratioCB->setEnabled(activateAspectratio());
+ form_->changed();
+}
+
+
+void QExternalDialog::templateChanged()
+{
+ form_->updateTemplate();
+ form_->changed();
+}
+
+
+void QExternalDialog::widthUnitChanged()
+{
+ bool useHeight = (widthUnitCO->currentIndex() > 0);
+
+ if (useHeight)
+ widthED->setValidator(unsignedLengthValidator(widthED));
+ else
+ widthED->setValidator(new QDoubleValidator(0, 1000, 2, widthED));
+
+ heightED->setEnabled(useHeight);
+ heightUnitCO->setEnabled(useHeight);
+ form_->changed();
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// QExternal
+//
+/////////////////////////////////////////////////////////////////////
+
namespace {
LyXLength::UNIT defaultUnit()
} // namespace anon
-typedef QController<ControlExternal, QView<QExternalDialog> > external_base_class;
+typedef QController<ControlExternal, QView<QExternalDialog> >
+ ExternalBase;
QExternal::QExternal(Dialog & parent)
- : external_base_class(parent, _("External Material"))
+ : ExternalBase(parent, _("External Material"))
{}
} // namespace frontend
} // namespace lyx
+
+#include "QExternal_moc.cpp"
#define QEXTERNAL_H
#include "QDialogView.h"
-#include "QExternalDialog.h"
+
+#include "ui/ExternalUi.h"
+
+#include <QCloseEvent>
+#include <QDialog>
#include <map>
namespace lyx {
namespace frontend {
+class QExternal;
+
+class QExternalDialog : public QDialog, public Ui::QExternalUi {
+ Q_OBJECT
+public:
+ QExternalDialog(QExternal * form);
+
+ virtual void show();
+protected Q_SLOTS:
+ virtual void bbChanged();
+ virtual void browseClicked();
+ virtual void change_adaptor();
+ virtual void editClicked();
+ virtual void extraChanged(const QString&);
+ virtual void formatChanged(const QString&);
+ virtual void getbbClicked();
+ virtual void sizeChanged();
+ virtual void templateChanged();
+ virtual void widthUnitChanged();
+
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+private:
+ bool activateAspectratio() const;
+ QExternal * form_;
+};
+
+
class ControlExternal;
class QExternal
+++ /dev/null
-/**
- * \file QExternalDialog.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-// Qt defines a macro 'signals' that clashes with a boost namespace.
-// All is well if the namespace is visible first.
-#include "insets/ExternalTemplate.h"
-
-#include "controllers/ButtonController.h"
-#include "controllers/ControlExternal.h"
-
-#include "support/convert.h"
-#include "support/lstrings.h"
-#include "support/lyxlib.h"
-
-#include "QExternalDialog.h"
-
-#include "lengthcombo.h"
-#include "validators.h"
-#include "qt_helpers.h"
-#include "QExternal.h"
-
-#include <QCloseEvent>
-#include <QCheckBox>
-#include <QPushButton>
-#include <QTextBrowser>
-#include <QLineEdit>
-
-
-using lyx::support::float_equal;
-using lyx::support::isStrDbl;
-using std::string;
-
-namespace lyx {
-namespace frontend {
-
-QExternalDialog::QExternalDialog(QExternal * 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( displayCB, SIGNAL( toggled(bool) ), showCO, SLOT( setEnabled(bool) ) );
- connect( displayCB, SIGNAL( toggled(bool) ), displayscaleED, SLOT( setEnabled(bool) ) );
- connect( showCO, SIGNAL( activated(const QString&) ), this, SLOT( change_adaptor() ) );
- connect( originCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
- connect( aspectratioCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
- connect( browsePB, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
- connect( editPB, SIGNAL( clicked() ), this, SLOT( editClicked() ) );
- connect( externalCO, SIGNAL( activated(const QString&) ), this, SLOT( templateChanged() ) );
- connect( extraED, SIGNAL( textChanged(const QString&) ), this, SLOT( extraChanged(const QString&) ) );
- connect( extraFormatCO, SIGNAL( activated(const QString&) ), this, SLOT( formatChanged(const QString&) ) );
- connect( widthUnitCO, SIGNAL( activated(int) ), this, SLOT( widthUnitChanged() ) );
- connect( heightUnitCO, SIGNAL( selectionChanged(lyx::LyXLength::UNIT) ), this, SLOT( change_adaptor() ) );
- connect( displayCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
- connect( displayscaleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
- connect( angleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
- connect( widthED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) );
- connect( heightED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) );
- connect( fileED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
- connect( clipCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
- connect( getbbPB, SIGNAL( clicked() ), this, SLOT( getbbClicked() ) );
- connect( xrED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
- connect( ytED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
- connect( xlED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
- connect( ybED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
- connect( draftCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
-
- QIntValidator * validator = new QIntValidator(displayscaleED);
- validator->setBottom(1);
- displayscaleED->setValidator(validator);
-
- angleED->setValidator(new QDoubleValidator(-360, 360, 2, angleED));
-
- xlED->setValidator(new QIntValidator(xlED));
- ybED->setValidator(new QIntValidator(ybED));
- xrED->setValidator(new QIntValidator(xrED));
- ytED->setValidator(new QIntValidator(ytED));
-
- widthED->setValidator(unsignedLengthValidator(widthED));
- heightED->setValidator(unsignedLengthValidator(heightED));
-
- fileED->setValidator(new PathValidator(true, fileED));
- setFocusProxy(fileED);
-}
-
-
-void QExternalDialog::show()
-{
- QDialog::show();
-}
-
-
-
-bool QExternalDialog::activateAspectratio() const
-{
- if (widthUnitCO->currentIndex() == 0)
- return false;
-
- string const wstr = fromqstr(widthED->text());
- if (wstr.empty())
- return false;
- bool const wIsDbl = isStrDbl(wstr);
- if (wIsDbl && float_equal(convert<double>(wstr), 0.0, 0.05))
- return false;
- LyXLength l;
- if (!wIsDbl && (!isValidLength(wstr, &l) || l.zero()))
- return false;
-
- string const hstr = fromqstr(heightED->text());
- if (hstr.empty())
- return false;
- bool const hIsDbl = isStrDbl(hstr);
- if (hIsDbl && float_equal(convert<double>(hstr), 0.0, 0.05))
- return false;
- if (!hIsDbl && (!isValidLength(hstr, &l) || l.zero()))
- return false;
-
- return true;
-}
-
-
-void QExternalDialog::bbChanged()
-{
- form_->controller().bbChanged(true);
- form_->changed();
-}
-
-
-void QExternalDialog::browseClicked()
-{
- int const choice = externalCO->currentIndex();
- docstring const template_name =
- lyx::from_utf8(form_->controller().getTemplate(choice).lyxName);
- docstring const str =
- form_->controller().browse(qstring_to_ucs4(fileED->text()),
- template_name);
- fileED->setText(toqstr(str));
- form_->changed();
-}
-
-
-void QExternalDialog::change_adaptor()
-{
- form_->changed();
-}
-
-
-void QExternalDialog::closeEvent(QCloseEvent * e)
-{
- form_->slotWMHide();
- e->accept();
-}
-
-
-void QExternalDialog::editClicked()
-{
- form_->controller().editExternal();
-}
-
-
-
-void QExternalDialog::extraChanged(const QString& text)
-{
- std::string const format = fromqstr(extraFormatCO->currentText());
- form_->extra_[format] = text;
- form_->changed();
-}
-
-
-void QExternalDialog::formatChanged(const QString& format)
-{
- extraED->setText(form_->extra_[fromqstr(format)]);
-}
-
-
-void QExternalDialog::getbbClicked()
-{
- form_->getBB();
-}
-
-
-void QExternalDialog::sizeChanged()
-{
- aspectratioCB->setEnabled(activateAspectratio());
- form_->changed();
-}
-
-
-void QExternalDialog::templateChanged()
-{
- form_->updateTemplate();
- form_->changed();
-}
-
-
-void QExternalDialog::widthUnitChanged()
-{
- bool useHeight = (widthUnitCO->currentIndex() > 0);
-
- if (useHeight)
- widthED->setValidator(unsignedLengthValidator(widthED));
- else
- widthED->setValidator(new QDoubleValidator(0, 1000, 2, widthED));
-
- heightED->setEnabled(useHeight);
- heightUnitCO->setEnabled(useHeight);
- form_->changed();
-}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "QExternalDialog_moc.cpp"
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file QExternalDialog.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 QEXTERNALDIALOG_H
-#define QEXTERNALDIALOG_H
-
-#include "ui/ExternalUi.h"
-
-#include <QCloseEvent>
-#include <QDialog>
-
-namespace lyx {
-namespace frontend {
-
-class QExternal;
-
-class QExternalDialog : public QDialog, public Ui::QExternalUi {
- Q_OBJECT
-public:
- QExternalDialog(QExternal * form);
-
- virtual void show();
-protected Q_SLOTS:
- virtual void bbChanged();
- virtual void browseClicked();
- virtual void change_adaptor();
- virtual void editClicked();
- virtual void extraChanged(const QString&);
- virtual void formatChanged(const QString&);
- virtual void getbbClicked();
- virtual void sizeChanged();
- virtual void templateChanged();
- virtual void widthUnitChanged();
-
-protected:
- virtual void closeEvent(QCloseEvent * e);
-private:
- bool activateAspectratio() const;
- QExternal * form_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // QEXTERNALDIALOG_H
#include "ControlCommand.h"
#include "qt_helpers.h"
-#include "QIndexDialog.h"
#include "QIndex.h"
#include "Qt2BC.h"
#include "ButtonController.h"
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
+
+#include <QLabel>
+#include <QPushButton>
+#include <QLineEdit>
+#include <QWhatsThis>
+#include <QCloseEvent>
+
using std::string;
+/////////////////////////////////////////////////////////////////////
+//
+// QIndexDialog
+//
+/////////////////////////////////////////////////////////////////////
+
namespace lyx {
namespace frontend {
-typedef QController<ControlCommand, QView<QIndexDialog> > index_base_class;
+QIndexDialog::QIndexDialog(QIndex * form)
+ : form_(form)
+{
+ setupUi(this);
+
+ connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
+ connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
+ connect( keywordED, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+
+ setFocusProxy(keywordED);
+
+ keywordED->setWhatsThis( qt_(
+ "The format of the entry in the index.\n"
+ "\n"
+ "An entry can be specified as a sub-entry of\n"
+ "another with \"!\":\n"
+ "\n"
+ "cars!mileage\n"
+ "\n"
+ "You can cross-refer to another entry like so:\n"
+ "\n"
+ "cars!mileage|see{economy}\n"
+ "\n"
+ "For further details refer to the local LaTeX\n"
+ "documentation.\n")
+ );
+}
+void QIndexDialog::change_adaptor()
+{
+ form_->changed();
+}
+
+
+void QIndexDialog::reject()
+{
+ form_->slotClose();
+}
+
+
+void QIndexDialog::closeEvent(QCloseEvent * e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// QIndex
+//
+/////////////////////////////////////////////////////////////////////
+
+
+typedef QController<ControlCommand, QView<QIndexDialog> > IndexBase;
+
QIndex::QIndex(Dialog & parent, docstring const & title, QString const & label)
- : index_base_class(parent, title), label_(label)
+ : IndexBase(parent, title), label_(label)
{
}
} // namespace frontend
} // namespace lyx
+
+#include "QIndex_moc.cpp"
#define QINDEX_H
#include "QDialogView.h"
-#include "QIndexDialog.h"
+#include "ui/IndexUi.h"
+
+#include <QDialog>
+#include <QCloseEvent>
namespace lyx {
namespace frontend {
+class QIndex;
+
+class QIndexDialog : public QDialog, public Ui::QIndexUi {
+ Q_OBJECT
+public:
+ QIndexDialog(QIndex * form);
+
+protected Q_SLOTS:
+ virtual void change_adaptor();
+ virtual void reject();
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+private:
+ QIndex * form_;
+};
+
class ControlCommand;
class QIndex :
+++ /dev/null
-/**
- * \file QIndexDialog.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 "qt_helpers.h"
-
-#include "QIndex.h"
-#include "QIndexDialog.h"
-
-#include <QPushButton>
-#include <QLineEdit>
-#include <QWhatsThis>
-#include <QCloseEvent>
-
-namespace lyx {
-namespace frontend {
-
-QIndexDialog::QIndexDialog(QIndex * form)
- : form_(form)
-{
- setupUi(this);
-
- connect(okPB, SIGNAL(clicked()),
- form, SLOT(slotOK()));
- connect(closePB, SIGNAL(clicked()),
- form, SLOT(slotClose()));
- connect( keywordED, SIGNAL( textChanged(const QString&) ),
- this, SLOT( change_adaptor() ) );
-
- setFocusProxy(keywordED);
-
- keywordED->setWhatsThis( qt_(
- "The format of the entry in the index.\n"
- "\n"
- "An entry can be specified as a sub-entry of\n"
- "another with \"!\":\n"
- "\n"
- "cars!mileage\n"
- "\n"
- "You can cross-refer to another entry like so:\n"
- "\n"
- "cars!mileage|see{economy}\n"
- "\n"
- "For further details refer to the local LaTeX\n"
- "documentation.\n")
- );
-}
-
-
-void QIndexDialog::change_adaptor()
-{
- form_->changed();
-}
-
-
-void QIndexDialog::reject()
-{
- form_->slotClose();
-}
-
-
-void QIndexDialog::closeEvent(QCloseEvent * e)
-{
- form_->slotWMHide();
- e->accept();
-}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "QIndexDialog_moc.cpp"
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file QIndexDialog.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 QINDEXDIALOG_H
-#define QINDEXDIALOG_H
-
-#include "ui/IndexUi.h"
-
-#include <QDialog>
-#include <QCloseEvent>
-
-namespace lyx {
-namespace frontend {
-
-class QIndex;
-
-class QIndexDialog : public QDialog, public Ui::QIndexUi {
- Q_OBJECT
-public:
- QIndexDialog(QIndex * form);
-
-protected Q_SLOTS:
- virtual void change_adaptor();
- virtual void reject();
-protected:
- virtual void closeEvent(QCloseEvent * e);
-private:
- QIndex * form_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // QINDEXDIALOG_H
+++ /dev/null
-/**
- * \file QLogDialog.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 "QLogDialog.h"
-#include "QLog.h"
-
-#include <QPushButton>
-#include <QCloseEvent>
-
-
-namespace lyx {
-namespace frontend {
-
-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();
-}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "QLogDialog_moc.cpp"
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file QLogDialog.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 QLOGDIALOG_H
-#define QLOGDIALOG_H
-
-#include "ui/LogUi.h"
-
-#include <QDialog>
-#include <QCloseEvent>
-
-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_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // QLOGDIALOG_H