git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20813 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-10-07 10:31:37 +00:00
parent 9358073e14
commit 09013cf1af
4 changed files with 64 additions and 29 deletions

View File

@ -16,7 +16,6 @@
#include "ButtonController.h"
#include "DialogView.h"
#include "DockView.h"
#include "GuiBibitem.h"
#include "GuiDelimiter.h"
#include "GuiIndex.h"
#include "GuiMathMatrix.h"
@ -96,7 +95,7 @@ Dialog * createGuiLog(LyXView & lv);
Dialog * createGuiMath(LyXView & lv);
Dialog * createGuiNomencl(LyXView & lv);
Dialog * createGuiNote(LyXView & lv);
Dialog * createGuiParagraph(LyXView & lv)
Dialog * createGuiParagraph(LyXView & lv);
Dialog * createGuiPreferences(LyXView & lv);
Dialog * createGuiPrint(LyXView & lv);
Dialog * createGuiRef(LyXView & lv);
@ -129,7 +128,7 @@ Dialog * Dialogs::build(string const & name)
if (name == "aboutlyx")
return createGuiAbout(lyxview_);
if (name == "bibitem")
return new GuiBibitemDialog(lyxview_);
return createGuiBibitem(lyxview_);
if (name == "bibtex")
return createGuiBibtex(lyxview_);
if (name == "box")

View File

@ -13,6 +13,9 @@
#include "GuiBibitem.h"
#include "ControlCommand.h"
#include "qt_helpers.h"
#include "FuncRequest.h"
#include "insets/InsetCommand.h"
#include <QCloseEvent>
#include <QLineEdit>
@ -23,19 +26,19 @@ namespace lyx {
namespace frontend {
GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
: GuiDialog(lv, "bibitem")
GuiBibitem::GuiBibitem(LyXView & lv)
: GuiDialog(lv, "bibitem"), Controller(this), params_("bibitem")
{
setupUi(this);
setViewTitle(_("Bibliography Entry Settings"));
setController(new ControlCommand(*this, "bibitem"));
setController(this, false);
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(keyED, SIGNAL(textChanged(const QString &)),
connect(keyED, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
connect(labelED, SIGNAL(textChanged(const QString &)),
connect(labelED, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
@ -46,44 +49,58 @@ GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
}
ControlCommand & GuiBibitemDialog::controller()
{
return static_cast<ControlCommand &>(GuiDialog::controller());
}
void GuiBibitemDialog::change_adaptor()
void GuiBibitem::change_adaptor()
{
changed();
}
void GuiBibitemDialog::closeEvent(QCloseEvent *e)
void GuiBibitem::closeEvent(QCloseEvent *e)
{
slotClose();
e->accept();
}
void GuiBibitemDialog::updateContents()
void GuiBibitem::updateContents()
{
keyED->setText(toqstr(controller().params()["key"]));
labelED->setText(toqstr(controller().params()["label"]));
keyED->setText(toqstr(params_["key"]));
labelED->setText(toqstr(params_["label"]));
}
void GuiBibitemDialog::applyView()
void GuiBibitem::applyView()
{
controller().params()["key"] = qstring_to_ucs4(keyED->text());
controller().params()["label"] = qstring_to_ucs4(labelED->text());
params_["key"] = qstring_to_ucs4(keyED->text());
params_["label"] = qstring_to_ucs4(labelED->text());
}
bool GuiBibitemDialog::isValid()
bool GuiBibitem::isValid()
{
return !keyED->text().isEmpty();
}
bool GuiBibitem::initialiseParams(std::string const & data)
{
// The name passed with LFUN_INSET_APPLY is also the name
// used to identify the mailer.
InsetCommandMailer::string2params("bibitem", data, params_);
return true;
}
void GuiBibitem::dispatchParams()
{
std::string const lfun = InsetCommandMailer::params2string("bibitem", params_);
dispatch(FuncRequest(getLfun(), lfun));
}
Dialog * createGuiBibitem(LyXView & lv) { return new GuiBibitem(lv); }
} // namespace frontend
} // namespace lyx

View File

@ -4,6 +4,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
* \author John Levon
*
* Full author contact details are available in file CREDITS.
@ -13,18 +14,21 @@
#define GUIBIBITEM_H
#include "GuiDialog.h"
#include "ControlCommand.h"
#include "ui_BibitemUi.h"
#include "frontends/Dialog.h"
#include "insets/InsetCommandParams.h"
namespace lyx {
namespace frontend {
class GuiBibitemDialog : public GuiDialog, public Ui::BibitemUi
class GuiBibitem : public GuiDialog, public Ui::BibitemUi, public Controller
{
Q_OBJECT
public:
GuiBibitemDialog(LyXView & lv);
GuiBibitem(LyXView & lv);
private Q_SLOTS:
void change_adaptor();
@ -33,7 +37,7 @@ private:
///
void closeEvent(QCloseEvent * e);
/// parent controller
ControlCommand & controller();
Controller & controller() { return *this; }
private:
///
@ -42,6 +46,18 @@ private:
void applyView();
/// update
void updateContents();
///
bool initialiseParams(std::string const & data);
/// clean-up on hide.
void clearParams() { params_.clear(); }
/// clean-up on hide.
void dispatchParams();
///
bool isBufferDependent() const { return true; }
private:
///
InsetCommandParams params_;
};
} // namespace frontend

View File

@ -22,6 +22,9 @@
#include "gettext.h"
#include "ParagraphParameters.h"
#include "Spacing.h"
#include "GuiView.h"
#include "DialogView.h"
#include "DockView.h"
#include <QCheckBox>
#include <QCloseEvent>
@ -251,10 +254,10 @@ Dialog * createGuiParagraph(LyXView & lv)
{
GuiViewBase & guiview = static_cast<GuiViewBase &>(lv);
#ifdef USE_DOCK_WIDGET
return new DockView<ControlParagraph, GuiParagraph>(guiview, name,
return new DockView<ControlParagraph, GuiParagraph>(guiview, "paragraph",
Qt::TopDockWidgetArea);
#else
return new DialogView<ControlParagraph, GuiParagraph>(guiview, name);
return new DialogView<ControlParagraph, GuiParagraph>(guiview, "paragraph");
#endif
}