2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file LyXView.C
|
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-03-21 17:27:08 +00:00
|
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2002-11-27 10:30:28 +00:00
|
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-12 02:54:19 +00:00
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
#include "LyXView.h"
|
2006-06-26 16:55:35 +00:00
|
|
|
|
#include "Gui.h"
|
2003-09-05 10:55:42 +00:00
|
|
|
|
#include "Dialogs.h"
|
|
|
|
|
#include "Timeout.h"
|
2004-04-29 09:54:59 +00:00
|
|
|
|
#include "Toolbars.h"
|
2003-09-05 10:55:42 +00:00
|
|
|
|
#include "Menubar.h"
|
2006-07-03 22:31:51 +00:00
|
|
|
|
#include "WorkArea.h"
|
2003-09-05 10:55:42 +00:00
|
|
|
|
|
|
|
|
|
#include "buffer.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
|
#include "bufferparams.h"
|
2003-09-05 10:55:42 +00:00
|
|
|
|
#include "BufferView.h"
|
|
|
|
|
#include "bufferview_funcs.h"
|
2004-01-26 10:13:15 +00:00
|
|
|
|
#include "cursor.h"
|
1999-10-07 18:44:17 +00:00
|
|
|
|
#include "debug.h"
|
2006-08-13 16:16:43 +00:00
|
|
|
|
#include "errorlist.h"
|
2003-09-05 10:55:42 +00:00
|
|
|
|
#include "funcrequest.h"
|
|
|
|
|
#include "gettext.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#include "intl.h"
|
2003-09-05 10:55:42 +00:00
|
|
|
|
#include "lyx_cb.h"
|
|
|
|
|
#include "lyxfunc.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#include "lyxrc.h"
|
|
|
|
|
#include "lyxtext.h"
|
2000-09-14 17:53:12 +00:00
|
|
|
|
#include "MenuBackend.h"
|
2003-09-06 17:23:08 +00:00
|
|
|
|
#include "paragraph.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
#include "controllers/ControlCommandBuffer.h"
|
2003-09-05 10:55:42 +00:00
|
|
|
|
|
2006-07-14 21:47:48 +00:00
|
|
|
|
#include "support/lstrings.h"
|
2002-06-12 02:54:19 +00:00
|
|
|
|
#include "support/filetools.h" // OnlyFilename()
|
2001-12-10 20:06:59 +00:00
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
|
#include <boost/bind.hpp>
|
|
|
|
|
|
2005-04-26 10:30:24 +00:00
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
|
# include <sys/time.h>
|
|
|
|
|
#endif
|
2005-01-19 15:26:41 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-01-20 15:38:14 +00:00
|
|
|
|
# include <unistd.h>
|
2005-01-19 15:26:41 +00:00
|
|
|
|
#endif
|
2001-12-10 20:06:59 +00:00
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
using lyx::frontend::Gui;
|
2006-07-03 22:31:51 +00:00
|
|
|
|
using lyx::frontend::WorkArea;
|
2006-06-26 16:55:35 +00:00
|
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
|
using lyx::docstring;
|
2006-07-14 21:47:48 +00:00
|
|
|
|
using lyx::support::bformat;
|
2006-04-08 22:31:11 +00:00
|
|
|
|
using lyx::support::makeDisplayPath;
|
|
|
|
|
using lyx::support::onlyFilename;
|
2003-09-09 22:13:45 +00:00
|
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
|
using std::endl;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2000-03-28 02:18:55 +00:00
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
|
using lyx::frontend::ControlCommandBuffer;
|
2003-09-05 10:55:42 +00:00
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
string current_layout;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
Gui & LyXView::gui()
|
|
|
|
|
{
|
|
|
|
|
return owner_;
|
|
|
|
|
}
|
2000-06-12 11:27:15 +00:00
|
|
|
|
|
2006-07-03 22:31:51 +00:00
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
LyXView::LyXView(Gui & owner)
|
2006-07-06 08:18:51 +00:00
|
|
|
|
: work_area_(0),
|
|
|
|
|
owner_(owner),
|
2006-06-26 16:55:35 +00:00
|
|
|
|
toolbars_(new Toolbars(*this)),
|
2002-08-13 14:40:38 +00:00
|
|
|
|
autosave_timeout_(new Timeout(5000)),
|
|
|
|
|
lyxfunc_(new LyXFunc(this)),
|
2002-08-15 17:48:53 +00:00
|
|
|
|
dialogs_(new Dialogs(*this)),
|
2006-07-06 08:18:51 +00:00
|
|
|
|
controlcommand_(new ControlCommandBuffer(*this))
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
1999-11-09 23:52:04 +00:00
|
|
|
|
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-09-19 13:36:20 +00:00
|
|
|
|
|
2006-07-08 20:24:32 +00:00
|
|
|
|
LyXView::~LyXView()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-07-03 22:31:51 +00:00
|
|
|
|
void LyXView::setWorkArea(WorkArea * work_area)
|
2006-06-26 16:55:35 +00:00
|
|
|
|
{
|
2006-07-03 22:31:51 +00:00
|
|
|
|
work_area_ = work_area;
|
2006-06-26 16:55:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-07-08 20:24:32 +00:00
|
|
|
|
void LyXView::redrawWorkArea()
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2006-07-08 20:24:32 +00:00
|
|
|
|
work_area_->redraw();
|
2006-07-13 16:37:55 +00:00
|
|
|
|
updateStatusBar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WorkArea * LyXView::workArea()
|
|
|
|
|
{
|
|
|
|
|
return work_area_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
void LyXView::init()
|
2001-06-25 00:06:33 +00:00
|
|
|
|
{
|
2002-06-12 11:34:13 +00:00
|
|
|
|
updateLayoutChoice();
|
|
|
|
|
updateMenubar();
|
2002-06-24 20:28:12 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
// Start autosave timer
|
|
|
|
|
if (lyxrc.autosave) {
|
2002-07-21 01:38:24 +00:00
|
|
|
|
autosave_timeout_->timeout.connect(boost::bind(&LyXView::autoSave, this));
|
2002-06-12 11:34:13 +00:00
|
|
|
|
autosave_timeout_->setTimeout(lyxrc.autosave * 1000);
|
|
|
|
|
autosave_timeout_->start();
|
|
|
|
|
}
|
2001-06-25 00:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
|
Buffer * LyXView::buffer() const
|
|
|
|
|
{
|
2006-07-03 22:31:51 +00:00
|
|
|
|
return work_area_->bufferView().buffer();
|
2000-04-08 17:02:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-07-13 16:37:55 +00:00
|
|
|
|
void LyXView::setBuffer(Buffer * b)
|
|
|
|
|
{
|
2006-07-14 21:47:48 +00:00
|
|
|
|
if (work_area_->bufferView().buffer())
|
|
|
|
|
disconnectBuffer();
|
|
|
|
|
|
2006-08-17 21:46:52 +00:00
|
|
|
|
if (!b)
|
|
|
|
|
getDialogs().hideBufferDependent();
|
|
|
|
|
|
2006-07-13 16:37:55 +00:00
|
|
|
|
work_area_->bufferView().setBuffer(b);
|
2006-08-17 21:46:52 +00:00
|
|
|
|
|
2006-08-23 08:27:51 +00:00
|
|
|
|
if (work_area_->bufferView().buffer()) {
|
2006-08-17 21:46:52 +00:00
|
|
|
|
// Buffer-dependent dialogs should be updated or
|
|
|
|
|
// hidden. This should go here because some dialogs (eg ToC)
|
|
|
|
|
// require bv_->text.
|
|
|
|
|
getDialogs().updateBufferDependent(true);
|
2006-08-23 08:27:51 +00:00
|
|
|
|
connectBuffer(*work_area_->bufferView().buffer());
|
2006-08-17 21:46:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-07-13 16:37:55 +00:00
|
|
|
|
updateMenubar();
|
|
|
|
|
updateToolbars();
|
2006-08-24 16:55:31 +00:00
|
|
|
|
updateLayoutChoice();
|
2006-07-13 16:37:55 +00:00
|
|
|
|
updateWindowTitle();
|
|
|
|
|
redrawWorkArea();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool LyXView::loadLyXFile(string const & filename, bool tolastfiles)
|
|
|
|
|
{
|
2006-07-14 21:47:48 +00:00
|
|
|
|
if (work_area_->bufferView().buffer())
|
|
|
|
|
disconnectBuffer();
|
|
|
|
|
|
2006-07-13 16:37:55 +00:00
|
|
|
|
bool loaded = work_area_->bufferView().loadLyXFile(filename, tolastfiles);
|
2006-08-13 16:16:43 +00:00
|
|
|
|
|
2006-07-13 16:37:55 +00:00
|
|
|
|
updateMenubar();
|
|
|
|
|
updateToolbars();
|
|
|
|
|
updateLayoutChoice();
|
|
|
|
|
updateWindowTitle();
|
2006-07-14 21:47:48 +00:00
|
|
|
|
if (loaded) {
|
|
|
|
|
connectBuffer(*work_area_->bufferView().buffer());
|
2006-08-24 08:17:47 +00:00
|
|
|
|
showErrorList("Parse");
|
2006-07-14 21:47:48 +00:00
|
|
|
|
}
|
2006-07-13 16:37:55 +00:00
|
|
|
|
redrawWorkArea();
|
|
|
|
|
return loaded;
|
|
|
|
|
}
|
|
|
|
|
|
2006-07-14 21:47:48 +00:00
|
|
|
|
|
|
|
|
|
void LyXView::connectBuffer(Buffer & buf)
|
|
|
|
|
{
|
2006-07-15 22:43:37 +00:00
|
|
|
|
if (errorsConnection_.connected())
|
2006-07-14 21:47:48 +00:00
|
|
|
|
disconnectBuffer();
|
|
|
|
|
|
2006-07-15 22:43:37 +00:00
|
|
|
|
errorsConnection_ =
|
|
|
|
|
buf.errors.connect(
|
|
|
|
|
boost::bind(&LyXView::showErrorList, this, _1));
|
2006-07-14 21:47:48 +00:00
|
|
|
|
|
|
|
|
|
messageConnection_ =
|
|
|
|
|
buf.message.connect(
|
|
|
|
|
boost::bind(&LyXView::message, this, _1));
|
|
|
|
|
|
|
|
|
|
busyConnection_ =
|
|
|
|
|
buf.busy.connect(
|
|
|
|
|
boost::bind(&LyXView::busy, this, _1));
|
|
|
|
|
|
|
|
|
|
titleConnection_ =
|
|
|
|
|
buf.updateTitles.connect(
|
|
|
|
|
boost::bind(&LyXView::updateWindowTitle, this));
|
|
|
|
|
|
|
|
|
|
timerConnection_ =
|
|
|
|
|
buf.resetAutosaveTimers.connect(
|
|
|
|
|
boost::bind(&LyXView::resetAutosaveTimer, this));
|
|
|
|
|
|
|
|
|
|
readonlyConnection_ =
|
|
|
|
|
buf.readonly.connect(
|
|
|
|
|
boost::bind(&LyXView::showReadonly, this, _1));
|
|
|
|
|
|
|
|
|
|
closingConnection_ =
|
|
|
|
|
buf.closing.connect(
|
|
|
|
|
boost::bind(&LyXView::setBuffer, this, (Buffer *)0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LyXView::disconnectBuffer()
|
|
|
|
|
{
|
|
|
|
|
messageConnection_.disconnect();
|
|
|
|
|
busyConnection_.disconnect();
|
|
|
|
|
titleConnection_.disconnect();
|
|
|
|
|
timerConnection_.disconnect();
|
|
|
|
|
readonlyConnection_.disconnect();
|
|
|
|
|
closingConnection_.disconnect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-19 13:36:20 +00:00
|
|
|
|
void LyXView::connectBufferView(BufferView & bv)
|
|
|
|
|
{
|
|
|
|
|
show_dialog_connection_ = bv.showDialog.connect(
|
|
|
|
|
boost::bind(&LyXView::showDialog, this, _1));
|
|
|
|
|
show_dialog_with_data_connection_ = bv.showDialogWithData.connect(
|
|
|
|
|
boost::bind(&LyXView::showDialogWithData, this, _1, _2));
|
|
|
|
|
show_inset_dialog_connection_ = bv.showInsetDialog.connect(
|
|
|
|
|
boost::bind(&LyXView::showInsetDialog, this, _1, _2, _3));
|
|
|
|
|
update_dialog_connection_ = bv.updateDialog.connect(
|
|
|
|
|
boost::bind(&LyXView::updateDialog, this, _1, _2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LyXView::disconnectBufferView()
|
|
|
|
|
{
|
|
|
|
|
show_dialog_connection_.disconnect();
|
|
|
|
|
show_dialog_with_data_connection_.disconnect();
|
|
|
|
|
show_inset_dialog_connection_.disconnect();
|
|
|
|
|
update_dialog_connection_.disconnect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-08-13 16:16:43 +00:00
|
|
|
|
void LyXView::showErrorList(string const & error_type)
|
2006-07-14 21:47:48 +00:00
|
|
|
|
{
|
2006-08-13 16:16:43 +00:00
|
|
|
|
ErrorList & el = buffer()->errorList(error_type);
|
|
|
|
|
if (!el.empty()) {
|
|
|
|
|
getDialogs().show("errorlist", error_type);
|
2006-07-14 21:47:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-19 13:36:20 +00:00
|
|
|
|
void LyXView::showDialog(string const & name)
|
|
|
|
|
{
|
|
|
|
|
getDialogs().show(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LyXView::showDialogWithData(string const & name,
|
|
|
|
|
string const & data)
|
|
|
|
|
{
|
|
|
|
|
getDialogs().show(name, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LyXView::showInsetDialog(string const & name, string const & data,
|
|
|
|
|
InsetBase * inset)
|
|
|
|
|
{
|
|
|
|
|
getDialogs().show(name, data, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LyXView::updateDialog(string const & name, string const & data)
|
|
|
|
|
{
|
|
|
|
|
if (getDialogs().visible(name))
|
|
|
|
|
getDialogs().update(name, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-07-14 21:47:48 +00:00
|
|
|
|
void LyXView::showReadonly(bool)
|
|
|
|
|
{
|
|
|
|
|
updateWindowTitle();
|
|
|
|
|
getDialogs().updateBufferDependent(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
BufferView * LyXView::view() const
|
2000-04-08 17:02:02 +00:00
|
|
|
|
{
|
2006-07-03 22:31:51 +00:00
|
|
|
|
return &work_area_->bufferView();
|
2000-04-08 17:02:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
void LyXView::setLayout(string const & layout)
|
2000-07-24 13:53:19 +00:00
|
|
|
|
{
|
2004-04-29 09:54:59 +00:00
|
|
|
|
toolbars_->setLayout(layout);
|
2000-07-24 13:53:19 +00:00
|
|
|
|
}
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2000-07-25 10:46:18 +00:00
|
|
|
|
|
2004-04-29 09:54:59 +00:00
|
|
|
|
void LyXView::updateToolbars()
|
2000-07-25 10:46:18 +00:00
|
|
|
|
{
|
2006-07-03 22:31:51 +00:00
|
|
|
|
bool const math = work_area_->bufferView().cursor().inMathed();
|
2003-04-10 14:08:06 +00:00
|
|
|
|
bool const table =
|
2004-03-18 13:57:20 +00:00
|
|
|
|
getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
|
2004-04-29 09:54:59 +00:00
|
|
|
|
toolbars_->update(math, table);
|
2005-04-13 09:43:58 +00:00
|
|
|
|
// update redaonly status of open dialogs. This could also be in
|
|
|
|
|
// updateMenubar(), but since updateToolbars() and updateMenubar()
|
|
|
|
|
// are always called together it is only here.
|
|
|
|
|
getDialogs().checkStatus();
|
2000-07-25 10:46:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
void LyXView::updateMenubar()
|
2000-07-24 13:53:19 +00:00
|
|
|
|
{
|
2002-06-12 02:54:19 +00:00
|
|
|
|
menubar_->update();
|
2000-07-24 13:53:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2002-06-12 11:34:13 +00:00
|
|
|
|
void LyXView::autoSave()
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2002-06-12 11:34:13 +00:00
|
|
|
|
lyxerr[Debug::INFO] << "Running autoSave()" << endl;
|
|
|
|
|
|
2006-09-16 14:00:13 +00:00
|
|
|
|
if (view()->buffer()) {
|
2006-06-26 16:55:35 +00:00
|
|
|
|
::autoSave(view());
|
2002-06-12 11:34:13 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
void LyXView::resetAutosaveTimer()
|
|
|
|
|
{
|
2000-03-12 10:35:05 +00:00
|
|
|
|
if (lyxrc.autosave)
|
2002-06-12 02:54:19 +00:00
|
|
|
|
autosave_timeout_->restart();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LyXView::updateLayoutChoice()
|
|
|
|
|
{
|
2005-02-08 13:18:05 +00:00
|
|
|
|
// Don't show any layouts without a buffer
|
2002-06-12 02:54:19 +00:00
|
|
|
|
if (!view()->buffer()) {
|
2004-04-29 09:54:59 +00:00
|
|
|
|
toolbars_->clearLayoutList();
|
2002-03-21 17:27:08 +00:00
|
|
|
|
return;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-02-08 13:18:05 +00:00
|
|
|
|
// Update the layout display
|
2004-04-29 09:54:59 +00:00
|
|
|
|
if (toolbars_->updateLayoutList(buffer()->params().textclass)) {
|
2003-09-09 09:47:59 +00:00
|
|
|
|
current_layout = buffer()->params().getLyXTextClass().defaultLayoutName();
|
2001-08-03 18:28:11 +00:00
|
|
|
|
}
|
2002-03-02 16:39:54 +00:00
|
|
|
|
|
2006-07-03 22:31:51 +00:00
|
|
|
|
if (work_area_->bufferView().cursor().inMathed())
|
2004-02-06 16:14:06 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2002-03-02 16:39:54 +00:00
|
|
|
|
string const & layout =
|
2006-07-03 22:31:51 +00:00
|
|
|
|
work_area_->bufferView().cursor().paragraph().layout()->name();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-12-05 23:16:13 +00:00
|
|
|
|
if (layout != current_layout) {
|
2004-04-29 09:54:59 +00:00
|
|
|
|
toolbars_->setLayout(layout);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
current_layout = layout;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
void LyXView::updateWindowTitle()
|
|
|
|
|
{
|
2006-09-11 08:54:10 +00:00
|
|
|
|
static docstring last_title = lyx::from_ascii("LyX");
|
|
|
|
|
docstring maximize_title = lyx::from_ascii("LyX");
|
|
|
|
|
docstring minimize_title = lyx::from_ascii("LyX");
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-09-16 14:00:13 +00:00
|
|
|
|
if (view()->buffer()) {
|
2001-04-17 15:15:59 +00:00
|
|
|
|
string const cur_title = buffer()->fileName();
|
2002-02-16 15:59:55 +00:00
|
|
|
|
if (!cur_title.empty()) {
|
2006-09-11 08:54:10 +00:00
|
|
|
|
maximize_title += lyx::from_ascii(": ") + makeDisplayPath(cur_title, 30);
|
|
|
|
|
minimize_title = lyx::from_utf8(onlyFilename(cur_title));
|
2002-09-11 18:05:42 +00:00
|
|
|
|
if (!buffer()->isClean()) {
|
2006-09-11 08:54:10 +00:00
|
|
|
|
maximize_title += _(" (changed)");
|
|
|
|
|
minimize_title += lyx::char_type('*');
|
2002-09-11 18:05:42 +00:00
|
|
|
|
}
|
1999-11-09 23:52:04 +00:00
|
|
|
|
if (buffer()->isReadonly())
|
2006-09-11 08:54:10 +00:00
|
|
|
|
maximize_title += _(" (read only)");
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-06-12 02:54:19 +00:00
|
|
|
|
|
2002-09-11 18:05:42 +00:00
|
|
|
|
if (maximize_title != last_title) {
|
|
|
|
|
setWindowTitle(maximize_title, minimize_title);
|
|
|
|
|
last_title = maximize_title;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-08-13 17:43:40 +00:00
|
|
|
|
|
|
|
|
|
|
2004-01-15 17:34:44 +00:00
|
|
|
|
void LyXView::dispatch(FuncRequest const & cmd)
|
2002-08-13 17:43:40 +00:00
|
|
|
|
{
|
2004-01-15 17:34:44 +00:00
|
|
|
|
getLyXFunc().dispatch(cmd);
|
2002-08-13 17:43:40 +00:00
|
|
|
|
}
|
2003-10-14 21:30:23 +00:00
|
|
|
|
|
|
|
|
|
|
2004-04-13 13:10:33 +00:00
|
|
|
|
Buffer const * const LyXView::updateInset(InsetBase const * inset) const
|
2003-10-14 21:30:23 +00:00
|
|
|
|
{
|
|
|
|
|
Buffer const * buffer_ptr = 0;
|
|
|
|
|
if (inset) {
|
2006-07-03 22:31:51 +00:00
|
|
|
|
buffer_ptr = work_area_->bufferView().buffer();
|
2005-08-02 14:25:48 +00:00
|
|
|
|
// No FitCursor:
|
2006-07-03 22:31:51 +00:00
|
|
|
|
work_area_->bufferView().update(Update::Force);
|
2003-10-14 21:30:23 +00:00
|
|
|
|
}
|
|
|
|
|
return buffer_ptr;
|
|
|
|
|
}
|