mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Transfer LFUN_HELP_OPEN to GuiApplication. There's some code factorization to do in there...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31441 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d87a67d8dc
commit
a6201e6d63
@ -558,7 +558,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
case LFUN_CANCEL:
|
case LFUN_CANCEL:
|
||||||
case LFUN_META_PREFIX:
|
case LFUN_META_PREFIX:
|
||||||
case LFUN_RECONFIGURE:
|
case LFUN_RECONFIGURE:
|
||||||
case LFUN_HELP_OPEN:
|
|
||||||
case LFUN_DROP_LAYOUTS_CHOICE:
|
case LFUN_DROP_LAYOUTS_CHOICE:
|
||||||
case LFUN_SERVER_GET_FILENAME:
|
case LFUN_SERVER_GET_FILENAME:
|
||||||
case LFUN_SERVER_NOTIFY:
|
case LFUN_SERVER_NOTIFY:
|
||||||
@ -706,35 +705,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
reconfigure(lyx_view_, argument);
|
reconfigure(lyx_view_, argument);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_HELP_OPEN: {
|
|
||||||
if (lyx_view_ == 0)
|
|
||||||
theApp()->dispatch(FuncRequest(LFUN_WINDOW_NEW));
|
|
||||||
string const arg = argument;
|
|
||||||
if (arg.empty()) {
|
|
||||||
setErrorMessage(from_utf8(N_("Missing argument")));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
FileName fname = i18nLibFileSearch("doc", arg, "lyx");
|
|
||||||
if (fname.empty())
|
|
||||||
fname = i18nLibFileSearch("examples", arg, "lyx");
|
|
||||||
|
|
||||||
if (fname.empty()) {
|
|
||||||
lyxerr << "LyX: unable to find documentation file `"
|
|
||||||
<< arg << "'. Bad installation?" << endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
lyx_view_->message(bformat(_("Opening help file %1$s..."),
|
|
||||||
makeDisplayPath(fname.absFilename())));
|
|
||||||
Buffer * buf = lyx_view_->loadDocument(fname, false);
|
|
||||||
if (buf) {
|
|
||||||
buf->updateLabels();
|
|
||||||
lyx_view_->setBuffer(buf);
|
|
||||||
buf->errors("Parse");
|
|
||||||
}
|
|
||||||
updateFlags = Update::None;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- lyxserver commands ----------------------------
|
// --- lyxserver commands ----------------------------
|
||||||
case LFUN_SERVER_GET_FILENAME:
|
case LFUN_SERVER_GET_FILENAME:
|
||||||
LASSERT(lyx_view_ && buffer, /**/);
|
LASSERT(lyx_view_ && buffer, /**/);
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include "support/debug.h"
|
#include "support/debug.h"
|
||||||
#include "support/ExceptionMessage.h"
|
#include "support/ExceptionMessage.h"
|
||||||
#include "support/FileName.h"
|
#include "support/FileName.h"
|
||||||
|
#include "support/filetools.h"
|
||||||
#include "support/foreach.h"
|
#include "support/foreach.h"
|
||||||
#include "support/ForkedCalls.h"
|
#include "support/ForkedCalls.h"
|
||||||
#include "support/gettext.h"
|
#include "support/gettext.h"
|
||||||
@ -813,6 +814,7 @@ bool GuiApplication::getStatus(FuncRequest const & cmd, FuncStatus & flag) const
|
|||||||
case LFUN_BUFFER_NEW:
|
case LFUN_BUFFER_NEW:
|
||||||
case LFUN_BUFFER_NEW_TEMPLATE:
|
case LFUN_BUFFER_NEW_TEMPLATE:
|
||||||
case LFUN_FILE_OPEN:
|
case LFUN_FILE_OPEN:
|
||||||
|
case LFUN_HELP_OPEN:
|
||||||
case LFUN_SCREEN_FONT_UPDATE:
|
case LFUN_SCREEN_FONT_UPDATE:
|
||||||
case LFUN_SET_COLOR:
|
case LFUN_SET_COLOR:
|
||||||
case LFUN_WINDOW_NEW:
|
case LFUN_WINDOW_NEW:
|
||||||
@ -900,6 +902,7 @@ bool GuiApplication::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_FILE_OPEN:
|
case LFUN_FILE_OPEN:
|
||||||
|
// FIXME: create a new method shared with LFUN_HELP_OPEN.
|
||||||
if (d->views_.empty()
|
if (d->views_.empty()
|
||||||
|| (!lyxrc.open_buffers_in_tabs && current_view_->documentBufferView() != 0)) {
|
|| (!lyxrc.open_buffers_in_tabs && current_view_->documentBufferView() != 0)) {
|
||||||
string const fname = to_utf8(cmd.argument());
|
string const fname = to_utf8(cmd.argument());
|
||||||
@ -915,6 +918,35 @@ bool GuiApplication::dispatch(FuncRequest const & cmd)
|
|||||||
current_view_->openDocument(to_utf8(cmd.argument()));
|
current_view_->openDocument(to_utf8(cmd.argument()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_HELP_OPEN: {
|
||||||
|
// FIXME: create a new method shared with LFUN_FILE_OPEN.
|
||||||
|
if (current_view_ == 0)
|
||||||
|
createView();
|
||||||
|
string const arg = to_utf8(cmd.argument());
|
||||||
|
if (arg.empty()) {
|
||||||
|
current_view_->message(_("Missing argument"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
FileName fname = i18nLibFileSearch("doc", arg, "lyx");
|
||||||
|
if (fname.empty())
|
||||||
|
fname = i18nLibFileSearch("examples", arg, "lyx");
|
||||||
|
|
||||||
|
if (fname.empty()) {
|
||||||
|
lyxerr << "LyX: unable to find documentation file `"
|
||||||
|
<< arg << "'. Bad installation?" << endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
current_view_->message(bformat(_("Opening help file %1$s..."),
|
||||||
|
makeDisplayPath(fname.absFilename())));
|
||||||
|
Buffer * buf = current_view_->loadDocument(fname, false);
|
||||||
|
if (buf) {
|
||||||
|
current_view_->setBuffer(buf);
|
||||||
|
buf->updateLabels();
|
||||||
|
buf->errors("Parse");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case LFUN_SET_COLOR: {
|
case LFUN_SET_COLOR: {
|
||||||
string lyx_name;
|
string lyx_name;
|
||||||
string const x11_name = split(to_utf8(cmd.argument()), lyx_name, ' ');
|
string const x11_name = split(to_utf8(cmd.argument()), lyx_name, ' ');
|
||||||
|
Loading…
Reference in New Issue
Block a user