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
|
|
|
*
|
2003-02-21 15:36:29 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2003-03-10 03:13:28 +00:00
|
|
|
#include "ButtonController.h"
|
2002-01-16 14:47:58 +00:00
|
|
|
#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
|
|
|
|
2003-02-17 18:40:04 +00:00
|
|
|
if (!dialog_built_) {
|
|
|
|
view().build();
|
|
|
|
dialog_built_ = true;
|
|
|
|
}
|
|
|
|
|
2002-01-16 14:47:58 +00:00
|
|
|
setParams();
|
2003-03-27 17:38:24 +00:00
|
|
|
if (this->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().show();
|
2002-10-22 12:39:05 +00:00
|
|
|
|
|
|
|
// The widgets may not be valid, so refresh the button controller
|
|
|
|
bc().refresh();
|
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();
|
2003-03-27 17:38:24 +00:00
|
|
|
if (this->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-10-22 12:39:05 +00:00
|
|
|
|
|
|
|
// The widgets may not be valid, so refresh the button controller
|
|
|
|
bc().refresh();
|
2002-01-16 14:47:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Base>
|
|
|
|
void ControlDialog<Base>::hide()
|
|
|
|
{
|
2003-03-27 17:38:24 +00:00
|
|
|
this->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
|
|
|
}
|