2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiDialogView.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiDialogView.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "Qt2BC.h"
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
#include "controllers/ButtonController.h"
|
|
|
|
|
2006-10-09 10:35:14 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiDialogView::GuiDialogView(Dialog & parent, docstring const & t)
|
2006-03-05 17:24:44 +00:00
|
|
|
: Dialog::View(parent,t), updating_(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
Qt2BC & GuiDialogView::bcview()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
return static_cast<Qt2BC &>(dialog().bc().view());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
bool GuiDialogView::isVisible() const
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
return form() && form()->isVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
bool GuiDialogView::readOnly() const
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
return kernel().isBufferReadonly();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiDialogView::show()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
if (!form()) {
|
|
|
|
build();
|
|
|
|
}
|
|
|
|
|
2007-04-03 21:47:00 +00:00
|
|
|
QSize const sizeHint = form()->sizeHint();
|
2007-04-03 20:45:46 +00:00
|
|
|
if (sizeHint.height() >= 0 && sizeHint.width() >= 0)
|
|
|
|
form()->setMinimumSize(sizeHint);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
update(); // make sure its up-to-date
|
|
|
|
if (dialog().controller().exitEarly())
|
|
|
|
return;
|
|
|
|
|
2006-08-17 08:53:10 +00:00
|
|
|
form()->setWindowTitle(toqstr("LyX: " + getTitle()));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
if (form()->isVisible()) {
|
|
|
|
form()->raise();
|
2007-01-28 20:10:47 +00:00
|
|
|
form()->activateWindow();
|
2007-02-13 18:20:07 +00:00
|
|
|
form()->setFocus();
|
2006-03-05 17:24:44 +00:00
|
|
|
} else {
|
|
|
|
form()->show();
|
2007-02-13 18:20:07 +00:00
|
|
|
form()->setFocus();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiDialogView::hide()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
if (form() && form()->isVisible())
|
|
|
|
form()->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
bool GuiDialogView::isValid()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiDialogView::changed()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
if (updating_)
|
|
|
|
return;
|
|
|
|
bc().valid(isValid());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiDialogView::slotWMHide()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
dialog().CancelButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiDialogView::slotApply()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
dialog().ApplyButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiDialogView::slotOK()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
dialog().OKButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiDialogView::slotClose()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
dialog().CancelButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiDialogView::slotRestore()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
dialog().RestoreButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2006-05-18 08:51:12 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiDialogView_moc.cpp"
|