mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
some more buffer -> document buffer fixes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31377 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
91bfdfe57c
commit
6854d67067
@ -1199,11 +1199,11 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_WRITE:
|
case LFUN_BUFFER_WRITE:
|
||||||
enable = buf && (buf->isUnnamed() || !buf->isClean());
|
enable = doc_buffer && (doc_buffer->isUnnamed() || !doc_buffer->isClean());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_WRITE_AS:
|
case LFUN_BUFFER_WRITE_AS:
|
||||||
enable = buf;
|
enable = doc_buffer;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_CLOSE_ALL:
|
case LFUN_BUFFER_CLOSE_ALL:
|
||||||
@ -1212,10 +1212,10 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
|
|
||||||
case LFUN_SPLIT_VIEW:
|
case LFUN_SPLIT_VIEW:
|
||||||
if (cmd.getArg(0) == "vertical")
|
if (cmd.getArg(0) == "vertical")
|
||||||
enable = buf && (d.splitter_->count() == 1 ||
|
enable = doc_buffer && (d.splitter_->count() == 1 ||
|
||||||
d.splitter_->orientation() == Qt::Vertical);
|
d.splitter_->orientation() == Qt::Vertical);
|
||||||
else
|
else
|
||||||
enable = buf && (d.splitter_->count() == 1 ||
|
enable = doc_buffer && (d.splitter_->count() == 1 ||
|
||||||
d.splitter_->orientation() == Qt::Horizontal);
|
d.splitter_->orientation() == Qt::Horizontal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1237,16 +1237,16 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
// fall through to set "enable"
|
// fall through to set "enable"
|
||||||
case LFUN_DIALOG_SHOW: {
|
case LFUN_DIALOG_SHOW: {
|
||||||
string const name = cmd.getArg(0);
|
string const name = cmd.getArg(0);
|
||||||
if (!buf)
|
if (!doc_buffer)
|
||||||
enable = name == "aboutlyx"
|
enable = name == "aboutlyx"
|
||||||
|| name == "file" //FIXME: should be removed.
|
|| name == "file" //FIXME: should be removed.
|
||||||
|| name == "prefs"
|
|| name == "prefs"
|
||||||
|| name == "texinfo";
|
|| name == "texinfo";
|
||||||
else if (name == "print")
|
else if (name == "print")
|
||||||
enable = buf->isExportable("dvi")
|
enable = doc_buffer->isExportable("dvi")
|
||||||
&& lyxrc.print_command != "none";
|
&& lyxrc.print_command != "none";
|
||||||
else if (name == "character" || name == "symbols") {
|
else if (name == "character" || name == "symbols") {
|
||||||
if (buf->isReadonly() || !currentBufferView()
|
if (!buf || buf->isReadonly()
|
||||||
|| !currentBufferView()->cursor().inTexted())
|
|| !currentBufferView()->cursor().inTexted())
|
||||||
enable = false;
|
enable = false;
|
||||||
else {
|
else {
|
||||||
@ -1257,11 +1257,11 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (name == "latexlog")
|
else if (name == "latexlog")
|
||||||
enable = FileName(buf->logName()).isReadableFile();
|
enable = FileName(doc_buffer->logName()).isReadableFile();
|
||||||
else if (name == "spellchecker")
|
else if (name == "spellchecker")
|
||||||
enable = theSpellChecker() && !buf->isReadonly();
|
enable = theSpellChecker() && !doc_buffer->isReadonly();
|
||||||
else if (name == "vclog")
|
else if (name == "vclog")
|
||||||
enable = buf->lyxvc().inUse();
|
enable = doc_buffer->lyxvc().inUse();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1328,11 +1328,11 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_ZOOM_OUT:
|
case LFUN_BUFFER_ZOOM_OUT:
|
||||||
enable = buf && lyxrc.zoom > 10;
|
enable = doc_buffer && lyxrc.zoom > 10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_ZOOM_IN:
|
case LFUN_BUFFER_ZOOM_IN:
|
||||||
enable = buf;
|
enable = doc_buffer;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_SWITCH:
|
case LFUN_BUFFER_SWITCH:
|
||||||
@ -2393,7 +2393,7 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_RELOAD: {
|
case LFUN_BUFFER_RELOAD: {
|
||||||
LASSERT(doc_buffer, /**/);
|
LASSERT(doc_buffer, break);
|
||||||
docstring const file = makeDisplayPath(doc_buffer->absFileName(), 20);
|
docstring const file = makeDisplayPath(doc_buffer->absFileName(), 20);
|
||||||
docstring text = bformat(_("Any changes will be lost. Are you sure "
|
docstring text = bformat(_("Any changes will be lost. Are you sure "
|
||||||
"you want to revert to the saved version of the document %1$s?"), file);
|
"you want to revert to the saved version of the document %1$s?"), file);
|
||||||
@ -2406,13 +2406,13 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_BUFFER_WRITE:
|
case LFUN_BUFFER_WRITE:
|
||||||
if (bv)
|
LASSERT(doc_buffer, break);
|
||||||
saveBuffer(bv->buffer());
|
saveBuffer(*doc_buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_WRITE_AS:
|
case LFUN_BUFFER_WRITE_AS:
|
||||||
if (bv)
|
LASSERT(doc_buffer, break);
|
||||||
renameBuffer(bv->buffer(), cmd.argument());
|
renameBuffer(*doc_buffer, cmd.argument());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BUFFER_WRITE_ALL: {
|
case LFUN_BUFFER_WRITE_ALL: {
|
||||||
@ -2482,7 +2482,7 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
|||||||
showDialog("character", data);
|
showDialog("character", data);
|
||||||
} else if (name == "latexlog") {
|
} else if (name == "latexlog") {
|
||||||
Buffer::LogType type;
|
Buffer::LogType type;
|
||||||
string const logfile = documentBufferView()->buffer().logName(&type);
|
string const logfile = doc_buffer->logName(&type);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Buffer::latexlog:
|
case Buffer::latexlog:
|
||||||
data = "latex ";
|
data = "latex ";
|
||||||
@ -2495,7 +2495,7 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
|||||||
showDialog("log", data);
|
showDialog("log", data);
|
||||||
} else if (name == "vclog") {
|
} else if (name == "vclog") {
|
||||||
string const data = "vc " +
|
string const data = "vc " +
|
||||||
Lexer::quoteString(documentBufferView()->buffer().lyxvc().getLogFile());
|
Lexer::quoteString(doc_buffer->lyxvc().getLogFile());
|
||||||
showDialog("log", data);
|
showDialog("log", data);
|
||||||
} else if (name == "symbols") {
|
} else if (name == "symbols") {
|
||||||
data = bv->cursor().getEncoding()->name();
|
data = bv->cursor().getEncoding()->name();
|
||||||
@ -2539,17 +2539,16 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
|||||||
setFocus();
|
setFocus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_SPLIT_VIEW:
|
case LFUN_SPLIT_VIEW: {
|
||||||
if (documentBufferView()) {
|
LASSERT(doc_buffer, break);
|
||||||
string const orientation = cmd.getArg(0);
|
string const orientation = cmd.getArg(0);
|
||||||
d.splitter_->setOrientation(orientation == "vertical"
|
d.splitter_->setOrientation(orientation == "vertical"
|
||||||
? Qt::Vertical : Qt::Horizontal);
|
? Qt::Vertical : Qt::Horizontal);
|
||||||
TabWorkArea * twa = addTabWorkArea();
|
TabWorkArea * twa = addTabWorkArea();
|
||||||
GuiWorkArea * wa = twa->addWorkArea(documentBufferView()->buffer(), *this);
|
GuiWorkArea * wa = twa->addWorkArea(*doc_buffer, *this);
|
||||||
setCurrentWorkArea(wa);
|
setCurrentWorkArea(wa);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case LFUN_CLOSE_TAB_GROUP:
|
case LFUN_CLOSE_TAB_GROUP:
|
||||||
if (TabWorkArea * twa = d.currentTabWorkArea()) {
|
if (TabWorkArea * twa = d.currentTabWorkArea()) {
|
||||||
closeTabWorkArea(twa);
|
closeTabWorkArea(twa);
|
||||||
|
Loading…
Reference in New Issue
Block a user