2002-01-16 14:47:58 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-05 14:10:50 +00:00
|
|
|
/**
|
2002-01-16 14:47:58 +00:00
|
|
|
* \file ControlDialog.tmpl
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-01-16 14:47:58 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-01-16 14:47:58 +00:00
|
|
|
*
|
|
|
|
* ControlDialog is a base class and so these templatised methods will be
|
|
|
|
* instantiated if this file is #included in the derived classes' .C file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ControlDialog.h"
|
2002-08-12 20:17:41 +00:00
|
|
|
|
2002-01-16 14:47:58 +00:00
|
|
|
#include "ButtonControllerBase.h"
|
|
|
|
#include "ViewBase.h"
|
2002-08-12 20:17:41 +00:00
|
|
|
|
2002-01-16 14:47:58 +00:00
|
|
|
|
|
|
|
template <class Base>
|
|
|
|
ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
|
|
|
|
: Base(lv, d), dialog_built_(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
template <class Base>
|
|
|
|
void ControlDialog<Base>::show()
|
|
|
|
{
|
2002-08-12 20:17:41 +00:00
|
|
|
if (isBufferDependent() && !bufferIsAvailable())
|
2002-01-16 14:47:58 +00:00
|
|
|
return;
|
|
|
|
|
2002-06-10 16:49:41 +00:00
|
|
|
connect();
|
2002-01-16 14:47:58 +00:00
|
|
|
|
|
|
|
setParams();
|
2002-06-10 16:49:41 +00:00
|
|
|
if (emergency_exit_) {
|
2002-01-16 14:47:58 +00:00
|
|
|
hide();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!dialog_built_) {
|
2002-06-10 16:49:41 +00:00
|
|
|
view().build();
|
2002-01-16 14:47:58 +00:00
|
|
|
dialog_built_ = true;
|
|
|
|
}
|
|
|
|
|
2002-08-12 20:17:41 +00:00
|
|
|
bc().readOnly(bufferIsReadonly());
|
2002-06-10 16:49:41 +00:00
|
|
|
view().show();
|
2002-01-16 14:47:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Base>
|
|
|
|
void ControlDialog<Base>::update()
|
|
|
|
{
|
2002-08-12 20:17:41 +00:00
|
|
|
if (isBufferDependent() && !bufferIsAvailable())
|
2002-01-16 14:47:58 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
setParams();
|
2002-06-10 16:49:41 +00:00
|
|
|
if (emergency_exit_) {
|
2002-01-16 14:47:58 +00:00
|
|
|
hide();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-08-12 20:17:41 +00:00
|
|
|
bc().readOnly(bufferIsReadonly());
|
2002-06-10 16:49:41 +00:00
|
|
|
view().update();
|
2002-01-16 14:47:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Base>
|
|
|
|
void ControlDialog<Base>::hide()
|
|
|
|
{
|
2002-06-10 16:49:41 +00:00
|
|
|
emergency_exit_ = false;
|
2002-01-16 14:47:58 +00:00
|
|
|
clearParams();
|
|
|
|
|
2002-06-10 16:49:41 +00:00
|
|
|
disconnect();
|
|
|
|
view().hide();
|
2002-01-16 14:47:58 +00:00
|
|
|
}
|