git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24754 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-05-13 21:28:04 +00:00
parent 2a18b2a5cc
commit 42d79d543b
2 changed files with 18 additions and 9 deletions

View File

@ -68,8 +68,15 @@ ViewSourceWidget::ViewSourceWidget(GuiViewSource & controller)
void ViewSourceWidget::updateView()
{
BufferView * view = controller_.bufferview();
if (!view) {
document_->setPlainText(QString());
setEnabled(false);
return;
}
if (autoUpdateCB->isChecked())
update(viewFullSourceCB->isChecked());
document_->setPlainText(controller_.getContent(
viewFullSourceCB->isChecked()));
GuiViewSource::Row row = controller_.getRows();
QTextCursor c = QTextCursor(viewSourceTV->document());
@ -81,12 +88,6 @@ void ViewSourceWidget::updateView()
}
void ViewSourceWidget::update(bool full_source)
{
document_->setPlainText(controller_.getContent(full_source));
}
GuiViewSource::GuiViewSource(GuiView & parent,
Qt::DockWidgetArea area, Qt::WindowFlags flags)
: DockView(parent, "view-source", qt_("LaTeX Source"), area, flags)
@ -108,6 +109,15 @@ void GuiViewSource::updateView()
}
void GuiViewSource::enableView(bool enable)
{
if (!enable)
// In the opposite case, updateView() will be called anyway.
widget_->updateView();
widget_->setEnabled(enable);
}
bool GuiViewSource::initialiseParams(string const & /*source*/)
{
setWindowTitle(title());

View File

@ -44,8 +44,6 @@ public:
public Q_SLOTS:
// update content
void updateView();
///
void update(bool full_source);
private:
///
@ -78,6 +76,7 @@ public:
bool canApply() const { return true; }
bool canApplyToReadOnly() const { return true; }
void updateView();
void enableView(bool enable);
///@}
/// The title displayed by the dialog reflects source type.