2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file lyxfunc.C
|
|
|
|
|
* 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
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Alfredo Braunstein
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
* \author Angus Leeming
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* \author Allan Rae
|
|
|
|
|
* \author Dekel Tsur
|
|
|
|
|
* \author Martin Vermeer
|
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
2000-04-11 22:55:29 +00:00
|
|
|
|
|
2001-12-10 20:06:59 +00:00
|
|
|
|
#include "lyxfunc.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "BranchList.h"
|
2003-05-23 13:54:09 +00:00
|
|
|
|
#include "buffer.h"
|
2003-06-20 12:46:28 +00:00
|
|
|
|
#include "buffer_funcs.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "bufferlist.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
|
#include "bufferparams.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#include "BufferView.h"
|
2003-09-17 16:44:51 +00:00
|
|
|
|
#include "cursor.h"
|
2004-03-30 16:19:50 +00:00
|
|
|
|
#include "CutAndPaste.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
#include "debug.h"
|
2003-10-29 10:47:21 +00:00
|
|
|
|
#include "dispatchresult.h"
|
2003-01-05 22:38:42 +00:00
|
|
|
|
#include "encoding.h"
|
2004-03-30 16:19:50 +00:00
|
|
|
|
#include "errorlist.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
#include "exporter.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "format.h"
|
|
|
|
|
#include "funcrequest.h"
|
|
|
|
|
#include "gettext.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
#include "importer.h"
|
2004-03-30 12:36:33 +00:00
|
|
|
|
#include "insetiterator.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "intl.h"
|
|
|
|
|
#include "kbmap.h"
|
2004-03-30 16:19:50 +00:00
|
|
|
|
#include "language.h"
|
2003-09-16 10:30:59 +00:00
|
|
|
|
#include "LColor.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "lyx_cb.h"
|
|
|
|
|
#include "LyXAction.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
#include "lyxfind.h"
|
2004-03-30 16:19:50 +00:00
|
|
|
|
#include "lyxlex.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
|
#include "lyxrc.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "lyxrow.h"
|
|
|
|
|
#include "lyxserver.h"
|
2004-03-30 16:19:50 +00:00
|
|
|
|
#include "lyxtextclasslist.h"
|
2003-09-09 11:24:33 +00:00
|
|
|
|
#include "lyxvc.h"
|
2003-09-06 17:23:08 +00:00
|
|
|
|
#include "paragraph.h"
|
2004-03-28 22:00:22 +00:00
|
|
|
|
#include "pariterator.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
#include "ParagraphParameters.h"
|
2003-10-14 13:01:49 +00:00
|
|
|
|
#include "undo.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
|
2003-12-10 22:10:38 +00:00
|
|
|
|
#include "insets/insetbox.h"
|
|
|
|
|
#include "insets/insetbranch.h"
|
2002-09-09 17:32:53 +00:00
|
|
|
|
#include "insets/insetcommand.h"
|
2003-12-10 22:10:38 +00:00
|
|
|
|
#include "insets/insetert.h"
|
2003-06-11 11:01:34 +00:00
|
|
|
|
#include "insets/insetexternal.h"
|
2003-12-10 22:10:38 +00:00
|
|
|
|
#include "insets/insetfloat.h"
|
|
|
|
|
#include "insets/insetgraphics.h"
|
2005-08-02 22:31:56 +00:00
|
|
|
|
#include "insets/insetinclude.h"
|
2003-12-10 22:10:38 +00:00
|
|
|
|
#include "insets/insetnote.h"
|
2001-07-24 22:08:49 +00:00
|
|
|
|
#include "insets/insettabular.h"
|
2003-11-28 15:53:34 +00:00
|
|
|
|
#include "insets/insetvspace.h"
|
2003-12-10 22:10:38 +00:00
|
|
|
|
#include "insets/insetwrap.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "frontends/Alert.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
#include "frontends/Dialogs.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "frontends/FileDialog.h"
|
|
|
|
|
#include "frontends/lyx_gui.h"
|
2003-09-06 20:08:10 +00:00
|
|
|
|
#include "frontends/LyXKeySym.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "frontends/LyXView.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
#include "frontends/Menubar.h"
|
2004-04-29 09:54:59 +00:00
|
|
|
|
#include "frontends/Toolbars.h"
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
2005-02-15 13:45:41 +00:00
|
|
|
|
#include "support/environment.h"
|
2004-11-25 11:08:32 +00:00
|
|
|
|
#include "support/filefilterlist.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "support/filetools.h"
|
2002-02-27 09:59:52 +00:00
|
|
|
|
#include "support/forkedcontr.h"
|
2005-01-31 10:42:26 +00:00
|
|
|
|
#include "support/fs_extras.h"
|
2004-03-28 14:12:33 +00:00
|
|
|
|
#include "support/lstrings.h"
|
1999-11-15 12:01:38 +00:00
|
|
|
|
#include "support/path.h"
|
2005-01-10 19:17:43 +00:00
|
|
|
|
#include "support/package.h"
|
2004-03-27 23:11:46 +00:00
|
|
|
|
#include "support/systemcall.h"
|
2005-01-06 16:39:35 +00:00
|
|
|
|
#include "support/convert.h"
|
2003-10-14 11:35:50 +00:00
|
|
|
|
#include "support/os.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
|
2005-03-07 11:03:45 +00:00
|
|
|
|
#include <boost/current_function.hpp>
|
2005-01-31 10:42:26 +00:00
|
|
|
|
#include <boost/filesystem/operations.hpp>
|
|
|
|
|
|
2004-07-24 10:55:30 +00:00
|
|
|
|
#include <sstream>
|
|
|
|
|
|
2003-09-09 22:13:45 +00:00
|
|
|
|
using bv_funcs::freefont2string;
|
|
|
|
|
|
2005-02-03 17:24:40 +00:00
|
|
|
|
using lyx::support::AbsolutePath;
|
2003-09-09 22:13:45 +00:00
|
|
|
|
using lyx::support::AddName;
|
|
|
|
|
using lyx::support::AddPath;
|
|
|
|
|
using lyx::support::bformat;
|
|
|
|
|
using lyx::support::ChangeExtension;
|
2004-03-27 23:11:46 +00:00
|
|
|
|
using lyx::support::contains;
|
2004-01-08 10:59:51 +00:00
|
|
|
|
using lyx::support::FileFilterList;
|
2003-09-09 22:13:45 +00:00
|
|
|
|
using lyx::support::FileSearch;
|
|
|
|
|
using lyx::support::ForkedcallsController;
|
|
|
|
|
using lyx::support::i18nLibFileSearch;
|
|
|
|
|
using lyx::support::IsDirWriteable;
|
|
|
|
|
using lyx::support::IsFileReadable;
|
|
|
|
|
using lyx::support::isStrInt;
|
|
|
|
|
using lyx::support::MakeAbsPath;
|
|
|
|
|
using lyx::support::MakeDisplayPath;
|
2005-01-10 19:17:43 +00:00
|
|
|
|
using lyx::support::package;
|
2003-09-09 22:13:45 +00:00
|
|
|
|
using lyx::support::Path;
|
2004-03-28 14:12:33 +00:00
|
|
|
|
using lyx::support::QuoteName;
|
2003-09-09 22:13:45 +00:00
|
|
|
|
using lyx::support::rtrim;
|
|
|
|
|
using lyx::support::split;
|
2004-03-27 23:11:46 +00:00
|
|
|
|
using lyx::support::subst;
|
|
|
|
|
using lyx::support::Systemcall;
|
2003-09-09 22:13:45 +00:00
|
|
|
|
using lyx::support::token;
|
|
|
|
|
using lyx::support::trim;
|
2003-10-14 11:35:50 +00:00
|
|
|
|
using lyx::support::prefixIs;
|
2003-06-30 23:56:22 +00:00
|
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
|
using std::endl;
|
2003-09-08 00:33:41 +00:00
|
|
|
|
using std::make_pair;
|
2003-12-05 13:37:23 +00:00
|
|
|
|
using std::pair;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-09-05 18:02:24 +00:00
|
|
|
|
using std::istringstream;
|
2003-09-08 00:33:41 +00:00
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
|
namespace biblio = lyx::biblio;
|
2005-01-31 10:42:26 +00:00
|
|
|
|
namespace fs = boost::filesystem;
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
extern BufferList bufferlist;
|
1999-11-04 01:40:20 +00:00
|
|
|
|
extern LyXServer * lyxserver;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-03-07 16:18:05 +00:00
|
|
|
|
extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
// (alkis)
|
|
|
|
|
extern tex_accent_struct get_accent(kb_action action);
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
bool getStatus(LCursor cursor,
|
|
|
|
|
FuncRequest const & cmd, FuncStatus & status)
|
|
|
|
|
{
|
2005-02-15 17:34:54 +00:00
|
|
|
|
// Try to fix cursor in case it is broken.
|
|
|
|
|
cursor.fixIfBroken();
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
// This is, of course, a mess. Better create a new doc iterator and use
|
|
|
|
|
// this in Inset::getStatus. This might require an additional
|
|
|
|
|
// BufferView * arg, though (which should be avoided)
|
|
|
|
|
//LCursor safe = *this;
|
|
|
|
|
bool res = false;
|
2005-02-08 13:18:05 +00:00
|
|
|
|
for ( ; cursor.depth(); cursor.pop()) {
|
2005-01-05 20:21:27 +00:00
|
|
|
|
//lyxerr << "\nLCursor::getStatus: cmd: " << cmd << endl << *this << endl;
|
2005-03-07 11:03:45 +00:00
|
|
|
|
BOOST_ASSERT(cursor.idx() <= cursor.lastidx());
|
|
|
|
|
BOOST_ASSERT(cursor.pit() <= cursor.lastpit());
|
|
|
|
|
BOOST_ASSERT(cursor.pos() <= cursor.lastpos());
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
|
|
|
|
// The inset's getStatus() will return 'true' if it made
|
|
|
|
|
// a definitive decision on whether it want to handle the
|
|
|
|
|
// request or not. The result of this decision is put into
|
|
|
|
|
// the 'status' parameter.
|
|
|
|
|
if (cursor.inset().getStatus(cursor, cmd, status)) {
|
|
|
|
|
res = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-07 10:37:05 +00:00
|
|
|
|
|
|
|
|
|
/** Return the change status at cursor position, taking in account the
|
|
|
|
|
* status at each level of the document iterator (a table in a deleted
|
|
|
|
|
* footnote is deleted).
|
|
|
|
|
* When \param outer is true, the top slice is not looked at.
|
|
|
|
|
*/
|
|
|
|
|
Change::Type lookupChange(DocIterator const & dit, bool outer = false)
|
|
|
|
|
{
|
2005-09-08 12:06:49 +00:00
|
|
|
|
size_t const depth = dit.depth() - (outer ? 1 : 0);
|
2005-09-07 10:37:05 +00:00
|
|
|
|
|
|
|
|
|
for (size_t i = 0 ; i < depth ; ++i) {
|
|
|
|
|
CursorSlice const & slice = dit[i];
|
|
|
|
|
if (!slice.inset().inMathed()
|
|
|
|
|
&& slice.pos() < slice.paragraph().size()) {
|
|
|
|
|
Change::Type const ch = slice.paragraph().lookupChange(slice.pos());
|
|
|
|
|
if (ch != Change::UNCHANGED)
|
|
|
|
|
return ch;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Change::UNCHANGED;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
LyXFunc::LyXFunc(LyXView * lv)
|
|
|
|
|
: owner(lv),
|
2003-01-05 22:38:42 +00:00
|
|
|
|
encoded_last_key(0),
|
2001-11-30 13:25:38 +00:00
|
|
|
|
keyseq(toplevel_keymap.get(), toplevel_keymap.get()),
|
2002-10-21 16:21:56 +00:00
|
|
|
|
cancel_meta_seq(toplevel_keymap.get(), toplevel_keymap.get()),
|
|
|
|
|
meta_fake_bit(key_modifier::none)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
2001-02-23 16:10:03 +00:00
|
|
|
|
void LyXFunc::handleKeyFunc(kb_action action)
|
|
|
|
|
{
|
2003-01-05 22:38:42 +00:00
|
|
|
|
char c = encoded_last_key;
|
2001-02-23 16:10:03 +00:00
|
|
|
|
|
2003-01-05 22:38:42 +00:00
|
|
|
|
if (keyseq.length()) {
|
2001-11-30 13:25:38 +00:00
|
|
|
|
c = 0;
|
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2002-08-13 14:40:38 +00:00
|
|
|
|
owner->getIntl().getTransManager()
|
2003-07-28 22:34:48 +00:00
|
|
|
|
.deadkey(c, get_accent(action).accent, view()->getLyXText());
|
2001-11-30 13:25:38 +00:00
|
|
|
|
// Need to clear, in case the minibuffer calls these
|
2001-02-23 16:10:03 +00:00
|
|
|
|
// actions
|
2001-11-30 13:25:38 +00:00
|
|
|
|
keyseq.clear();
|
2001-02-23 16:10:03 +00:00
|
|
|
|
// copied verbatim from do_accent_char
|
2004-01-20 14:25:24 +00:00
|
|
|
|
view()->cursor().resetAnchor();
|
2003-08-04 09:06:35 +00:00
|
|
|
|
view()->update();
|
2001-02-23 16:10:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-01-26 10:13:15 +00:00
|
|
|
|
void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
|
2000-08-14 15:31:16 +00:00
|
|
|
|
{
|
2004-02-03 14:29:00 +00:00
|
|
|
|
lyxerr[Debug::KEY] << "KeySym is " << keysym->getSymbolName() << endl;
|
2002-11-04 02:12:42 +00:00
|
|
|
|
|
2000-08-14 15:31:16 +00:00
|
|
|
|
// Do nothing if we have nothing (JMarc)
|
2002-08-07 08:11:41 +00:00
|
|
|
|
if (!keysym->isOK()) {
|
2000-08-14 15:31:16 +00:00
|
|
|
|
lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
|
|
|
|
|
<< endl;
|
2001-05-17 01:23:29 +00:00
|
|
|
|
return;
|
2000-08-14 15:31:16 +00:00
|
|
|
|
}
|
2000-10-12 01:18:11 +00:00
|
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
|
if (keysym->isModifier()) {
|
2002-12-12 13:46:06 +00:00
|
|
|
|
lyxerr[Debug::KEY] << "isModifier true" << endl;
|
2001-05-17 01:23:29 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2004-03-18 12:53:43 +00:00
|
|
|
|
Encoding const * encoding = view()->cursor().getEncoding();
|
2003-01-05 22:38:42 +00:00
|
|
|
|
|
|
|
|
|
encoded_last_key = keysym->getISOEncoded(encoding ? encoding->Name() : "");
|
|
|
|
|
|
2000-08-14 15:31:16 +00:00
|
|
|
|
// Do a one-deep top-level lookup for
|
|
|
|
|
// cancel and meta-fake keys. RVDK_PATCH_5
|
|
|
|
|
cancel_meta_seq.reset();
|
|
|
|
|
|
2003-09-21 23:00:47 +00:00
|
|
|
|
FuncRequest func = cancel_meta_seq.addkey(keysym, state);
|
2005-02-08 02:06:39 +00:00
|
|
|
|
lyxerr[Debug::KEY] << BOOST_CURRENT_FUNCTION
|
|
|
|
|
<< " action first set to [" << func.action << ']'
|
|
|
|
|
<< endl;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
|
|
// When not cancel or meta-fake, do the normal lookup.
|
2000-08-14 15:31:16 +00:00
|
|
|
|
// Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
|
2002-05-26 17:33:14 +00:00
|
|
|
|
// Mostly, meta_fake_bit = key_modifier::none. RVDK_PATCH_5.
|
2003-09-21 23:00:47 +00:00
|
|
|
|
if ((func.action != LFUN_CANCEL) && (func.action != LFUN_META_FAKE)) {
|
2000-08-14 15:31:16 +00:00
|
|
|
|
// remove Caps Lock and Mod2 as a modifiers
|
2003-09-21 23:00:47 +00:00
|
|
|
|
func = keyseq.addkey(keysym, (state | meta_fake_bit));
|
2005-02-08 02:06:39 +00:00
|
|
|
|
lyxerr[Debug::KEY] << BOOST_CURRENT_FUNCTION
|
|
|
|
|
<< "action now set to ["
|
|
|
|
|
<< func.action << ']' << endl;
|
2000-08-14 15:31:16 +00:00
|
|
|
|
}
|
2002-08-10 15:21:07 +00:00
|
|
|
|
|
2000-08-14 15:31:16 +00:00
|
|
|
|
// Dont remove this unless you know what you are doing.
|
2002-05-26 17:33:14 +00:00
|
|
|
|
meta_fake_bit = key_modifier::none;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2005-02-08 02:06:39 +00:00
|
|
|
|
// Can this happen now ?
|
2003-09-21 23:00:47 +00:00
|
|
|
|
if (func.action == LFUN_NOACTION) {
|
|
|
|
|
func = FuncRequest(LFUN_PREFIX);
|
2001-11-30 13:25:38 +00:00
|
|
|
|
}
|
2000-08-14 15:31:16 +00:00
|
|
|
|
|
|
|
|
|
if (lyxerr.debugging(Debug::KEY)) {
|
2005-02-08 02:06:39 +00:00
|
|
|
|
lyxerr << BOOST_CURRENT_FUNCTION
|
|
|
|
|
<< " Key [action="
|
2003-09-21 23:00:47 +00:00
|
|
|
|
<< func.action << "]["
|
2002-11-27 10:30:28 +00:00
|
|
|
|
<< keyseq.print() << ']'
|
2000-08-14 15:31:16 +00:00
|
|
|
|
<< endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// already here we know if it any point in going further
|
|
|
|
|
// why not return already here if action == -1 and
|
|
|
|
|
// num_bytes == 0? (Lgb)
|
|
|
|
|
|
2002-03-01 14:13:01 +00:00
|
|
|
|
if (keyseq.length() > 1) {
|
2001-11-30 13:25:38 +00:00
|
|
|
|
owner->message(keyseq.print());
|
2000-08-14 15:31:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-02-13 16:53:15 +00:00
|
|
|
|
|
2002-12-12 13:46:06 +00:00
|
|
|
|
// Maybe user can only reach the key via holding down shift.
|
|
|
|
|
// Let's see. But only if shift is the only modifier
|
2003-09-21 23:00:47 +00:00
|
|
|
|
if (func.action == LFUN_UNKNOWN_ACTION &&
|
|
|
|
|
state == key_modifier::shift) {
|
2002-12-12 13:46:06 +00:00
|
|
|
|
lyxerr[Debug::KEY] << "Trying without shift" << endl;
|
2003-09-21 23:00:47 +00:00
|
|
|
|
func = keyseq.addkey(keysym, key_modifier::none);
|
|
|
|
|
lyxerr[Debug::KEY] << "Action now " << func.action << endl;
|
2002-12-12 13:46:06 +00:00
|
|
|
|
}
|
2003-02-13 16:53:15 +00:00
|
|
|
|
|
2003-09-21 23:00:47 +00:00
|
|
|
|
if (func.action == LFUN_UNKNOWN_ACTION) {
|
2002-12-12 13:46:06 +00:00
|
|
|
|
// Hmm, we didn't match any of the keysequences. See
|
|
|
|
|
// if it's normal insertable text not already covered
|
|
|
|
|
// by a binding
|
|
|
|
|
if (keysym->isText() && keyseq.length() == 1) {
|
|
|
|
|
lyxerr[Debug::KEY] << "isText() is true, inserting." << endl;
|
2006-01-18 17:44:01 +00:00
|
|
|
|
func = FuncRequest(LFUN_SELFINSERT,
|
|
|
|
|
FuncRequest::KEYBOARD);
|
2002-12-12 13:46:06 +00:00
|
|
|
|
} else {
|
|
|
|
|
lyxerr[Debug::KEY] << "Unknown, !isText() - giving up" << endl;
|
2001-05-17 01:23:29 +00:00
|
|
|
|
owner->message(_("Unknown function."));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-21 23:00:47 +00:00
|
|
|
|
if (func.action == LFUN_SELFINSERT) {
|
2003-01-05 22:38:42 +00:00
|
|
|
|
if (encoded_last_key != 0) {
|
2005-02-08 02:06:39 +00:00
|
|
|
|
string const arg(1, encoded_last_key);
|
2006-01-18 17:44:01 +00:00
|
|
|
|
dispatch(FuncRequest(LFUN_SELFINSERT, arg,
|
|
|
|
|
FuncRequest::KEYBOARD));
|
2004-02-03 14:29:00 +00:00
|
|
|
|
lyxerr[Debug::KEY]
|
|
|
|
|
<< "SelfInsert arg[`" << arg << "']" << endl;
|
2003-01-05 22:38:42 +00:00
|
|
|
|
}
|
2002-06-18 17:22:17 +00:00
|
|
|
|
} else {
|
2003-09-21 23:00:47 +00:00
|
|
|
|
dispatch(func);
|
2002-06-18 17:22:17 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
}
|
2000-08-14 15:31:16 +00:00
|
|
|
|
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
2004-02-13 07:30:59 +00:00
|
|
|
|
FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
1999-12-10 00:07:59 +00:00
|
|
|
|
{
|
2004-03-18 13:57:20 +00:00
|
|
|
|
//lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
|
2002-01-09 09:36:35 +00:00
|
|
|
|
FuncStatus flag;
|
2004-02-06 16:14:06 +00:00
|
|
|
|
LCursor & cur = view()->cursor();
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2004-11-16 10:46:23 +00:00
|
|
|
|
/* In LyX/Mac, when a dialog is open, the menus of the
|
|
|
|
|
application can still be accessed without giving focus to
|
|
|
|
|
the main window. In this case, we want to disable the menu
|
|
|
|
|
entries that are buffer-related.
|
2005-09-21 13:18:15 +00:00
|
|
|
|
|
|
|
|
|
Note that this code is not perfect, as bug 1941 attests:
|
|
|
|
|
http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
|
2004-11-16 10:46:23 +00:00
|
|
|
|
*/
|
|
|
|
|
Buffer * buf;
|
|
|
|
|
if (cmd.origin == FuncRequest::UI && !owner->hasFocus())
|
|
|
|
|
buf = 0;
|
|
|
|
|
else
|
|
|
|
|
buf = owner->buffer();
|
|
|
|
|
|
2004-02-13 07:30:59 +00:00
|
|
|
|
if (cmd.action == LFUN_NOACTION) {
|
2004-11-25 09:15:26 +00:00
|
|
|
|
flag.message(N_("Nothing to do"));
|
2004-03-18 13:57:20 +00:00
|
|
|
|
flag.enabled(false);
|
2003-10-21 16:15:14 +00:00
|
|
|
|
return flag;
|
2002-03-27 23:27:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-02-13 07:30:59 +00:00
|
|
|
|
switch (cmd.action) {
|
2002-12-18 14:24:32 +00:00
|
|
|
|
case LFUN_UNKNOWN_ACTION:
|
|
|
|
|
#ifndef HAVE_LIBAIKSAURUS
|
|
|
|
|
case LFUN_THESAURUS_ENTRY:
|
|
|
|
|
#endif
|
|
|
|
|
flag.unknown(true);
|
2004-03-18 13:57:20 +00:00
|
|
|
|
flag.enabled(false);
|
2002-12-18 14:24:32 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2004-02-13 07:30:59 +00:00
|
|
|
|
flag |= lyx_gui::getStatus(cmd);
|
2002-12-18 14:24:32 +00:00
|
|
|
|
}
|
2003-02-13 16:53:15 +00:00
|
|
|
|
|
2002-12-18 14:24:32 +00:00
|
|
|
|
if (flag.unknown()) {
|
2004-11-25 09:15:26 +00:00
|
|
|
|
flag.message(N_("Unknown action"));
|
2002-12-18 14:24:32 +00:00
|
|
|
|
return flag;
|
2000-06-12 11:27:15 +00:00
|
|
|
|
}
|
2002-02-06 15:12:40 +00:00
|
|
|
|
|
2004-12-02 11:32:14 +00:00
|
|
|
|
if (!flag.enabled()) {
|
|
|
|
|
if (flag.message().empty())
|
|
|
|
|
flag.message(N_("Command disabled"));
|
2004-06-23 14:04:09 +00:00
|
|
|
|
return flag;
|
2004-12-02 11:32:14 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
1999-12-10 00:07:59 +00:00
|
|
|
|
// Check whether we need a buffer
|
2004-03-23 11:22:11 +00:00
|
|
|
|
if (!lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer) && !buf) {
|
|
|
|
|
// no, exit directly
|
2004-11-25 09:15:26 +00:00
|
|
|
|
flag.message(N_("Command not allowed with"
|
2004-03-23 11:22:11 +00:00
|
|
|
|
"out any document open"));
|
|
|
|
|
flag.enabled(false);
|
|
|
|
|
return flag;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-06 02:44:26 +00:00
|
|
|
|
// I would really like to avoid having this switch and rather try to
|
|
|
|
|
// encode this in the function itself.
|
2004-03-18 13:57:20 +00:00
|
|
|
|
// -- And I'd rather let an inset decide which LFUNs it is willing
|
|
|
|
|
// to handle (Andre')
|
|
|
|
|
bool enable = true;
|
2004-02-13 07:30:59 +00:00
|
|
|
|
switch (cmd.action) {
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_TOOLTIPS_TOGGLE:
|
|
|
|
|
flag.setOnOff(owner->getDialogs().tooltipsEnabled());
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_READ_ONLY_TOGGLE:
|
|
|
|
|
flag.setOnOff(buf->isReadonly());
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_SWITCHBUFFER:
|
|
|
|
|
// toggle on the current buffer, but do not toggle off
|
|
|
|
|
// the other ones (is that a good idea?)
|
|
|
|
|
if (cmd.argument == buf->fileName())
|
|
|
|
|
flag.setOnOff(true);
|
|
|
|
|
break;
|
|
|
|
|
|
2000-11-06 11:20:22 +00:00
|
|
|
|
case LFUN_EXPORT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cmd.argument == "custom"
|
|
|
|
|
|| Exporter::IsExportable(*buf, cmd.argument);
|
2000-11-06 11:20:22 +00:00
|
|
|
|
break;
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
case LFUN_RUNCHKTEX:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = buf->isLatex() && lyxrc.chktex_command != "none";
|
1999-12-16 06:43:25 +00:00
|
|
|
|
break;
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2000-07-25 10:46:18 +00:00
|
|
|
|
case LFUN_BUILDPROG:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = Exporter::IsExportable(*buf, "program");
|
2000-07-31 12:51:19 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2000-08-01 09:35:42 +00:00
|
|
|
|
case LFUN_LAYOUT_TABULAR:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cur.innerInsetOfType(InsetBase::TABULAR_CODE);
|
2003-04-03 01:26:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2002-01-20 23:17:17 +00:00
|
|
|
|
case LFUN_LAYOUT:
|
2004-02-06 16:14:06 +00:00
|
|
|
|
case LFUN_LAYOUT_PARAGRAPH:
|
2005-11-17 08:41:56 +00:00
|
|
|
|
enable = !cur.inset().forceDefaultParagraphs(cur.idx());
|
2000-08-01 09:35:42 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
|
case LFUN_VC_REGISTER:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = !buf->lyxvc().inUse();
|
2000-07-24 13:53:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_VC_CHECKIN:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = buf->lyxvc().inUse() && !buf->isReadonly();
|
2000-07-24 13:53:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_VC_CHECKOUT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = buf->lyxvc().inUse() && buf->isReadonly();
|
2000-07-24 13:53:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case LFUN_VC_REVERT:
|
|
|
|
|
case LFUN_VC_UNDO:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = buf->lyxvc().inUse();
|
2000-07-24 13:53:19 +00:00
|
|
|
|
break;
|
2003-02-17 18:40:04 +00:00
|
|
|
|
case LFUN_MENURELOAD:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = !buf->isUnnamed() && !buf->isClean();
|
2003-02-17 18:40:04 +00:00
|
|
|
|
break;
|
2003-10-29 12:18:08 +00:00
|
|
|
|
|
2003-04-26 19:01:33 +00:00
|
|
|
|
case LFUN_INSET_SETTINGS: {
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = false;
|
2005-02-08 13:18:05 +00:00
|
|
|
|
if (!cur)
|
2004-03-18 13:57:20 +00:00
|
|
|
|
break;
|
2005-07-15 22:10:25 +00:00
|
|
|
|
InsetBase::Code code = cur.inset().lyxCode();
|
2003-04-26 19:01:33 +00:00
|
|
|
|
switch (code) {
|
2004-11-25 19:13:07 +00:00
|
|
|
|
case InsetBase::TABULAR_CODE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cmd.argument == "tabular";
|
2003-04-26 19:01:33 +00:00
|
|
|
|
break;
|
2004-11-25 19:13:07 +00:00
|
|
|
|
case InsetBase::ERT_CODE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cmd.argument == "ert";
|
2003-04-26 19:01:33 +00:00
|
|
|
|
break;
|
2004-11-25 19:13:07 +00:00
|
|
|
|
case InsetBase::FLOAT_CODE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cmd.argument == "float";
|
2003-04-26 19:01:33 +00:00
|
|
|
|
break;
|
2004-11-25 19:13:07 +00:00
|
|
|
|
case InsetBase::WRAP_CODE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cmd.argument == "wrap";
|
2003-04-26 19:01:33 +00:00
|
|
|
|
break;
|
2004-11-25 19:13:07 +00:00
|
|
|
|
case InsetBase::NOTE_CODE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cmd.argument == "note";
|
2003-07-15 23:52:05 +00:00
|
|
|
|
break;
|
2004-11-25 19:13:07 +00:00
|
|
|
|
case InsetBase::BRANCH_CODE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cmd.argument == "branch";
|
2003-08-17 11:28:23 +00:00
|
|
|
|
break;
|
2004-11-25 19:13:07 +00:00
|
|
|
|
case InsetBase::BOX_CODE:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = cmd.argument == "box";
|
2003-10-07 07:42:15 +00:00
|
|
|
|
break;
|
2003-04-26 19:01:33 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-13 09:43:58 +00:00
|
|
|
|
case LFUN_INSET_APPLY: {
|
|
|
|
|
string const name = cmd.getArg(0);
|
|
|
|
|
InsetBase * inset = owner->getDialogs().getOpenInset(name);
|
|
|
|
|
if (inset) {
|
|
|
|
|
FuncRequest fr(LFUN_INSET_MODIFY, cmd.argument);
|
|
|
|
|
FuncStatus fs;
|
|
|
|
|
bool const success = inset->getStatus(cur, fr, fs);
|
|
|
|
|
// Every inset is supposed to handle this
|
|
|
|
|
BOOST_ASSERT(success);
|
|
|
|
|
flag |= fs;
|
|
|
|
|
} else {
|
|
|
|
|
FuncRequest fr(LFUN_INSET_INSERT, cmd.argument);
|
|
|
|
|
flag |= getStatus(fr);
|
|
|
|
|
}
|
|
|
|
|
enable = flag.enabled();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-30 23:56:22 +00:00
|
|
|
|
case LFUN_DIALOG_SHOW: {
|
2004-02-13 07:30:59 +00:00
|
|
|
|
string const name = cmd.getArg(0);
|
2004-03-18 12:53:43 +00:00
|
|
|
|
if (!buf)
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = name == "aboutlyx"
|
|
|
|
|
|| name == "file"
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|| name == "forks"
|
2004-03-31 18:51:11 +00:00
|
|
|
|
|| name == "prefs"
|
2004-03-18 13:57:20 +00:00
|
|
|
|
|| name == "texinfo";
|
2004-03-18 12:53:43 +00:00
|
|
|
|
else if (name == "print")
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = Exporter::IsExportable(*buf, "dvi")
|
|
|
|
|
&& lyxrc.print_command != "none";
|
2005-02-03 17:24:40 +00:00
|
|
|
|
else if (name == "character" || name == "mathpanel")
|
2004-11-25 19:13:07 +00:00
|
|
|
|
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
|
2004-03-18 12:53:43 +00:00
|
|
|
|
else if (name == "latexlog")
|
2004-03-18 13:57:20 +00:00
|
|
|
|
enable = IsFileReadable(buf->getLogName().second);
|
2005-05-05 21:08:18 +00:00
|
|
|
|
#if !defined (USE_ASPELL) && !defined (USE_ISPELL) && !defined (USE_PSPELL)
|
|
|
|
|
else if (name == "spellchecker")
|
|
|
|
|
enable = false;
|
|
|
|
|
#endif
|
|
|
|
|
else if (name == "vclog")
|
|
|
|
|
enable = buf->lyxvc().inUse();
|
2003-06-19 16:49:45 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-03 17:24:40 +00:00
|
|
|
|
case LFUN_DIALOG_SHOW_NEW_INSET:
|
|
|
|
|
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
|
|
|
|
|
break;
|
|
|
|
|
|
2004-04-05 18:34:36 +00:00
|
|
|
|
case LFUN_DIALOG_UPDATE: {
|
|
|
|
|
string const name = cmd.getArg(0);
|
|
|
|
|
if (!buf)
|
|
|
|
|
enable = name == "prefs";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-07 14:51:39 +00:00
|
|
|
|
case LFUN_INSERT_CITATION: {
|
|
|
|
|
FuncRequest fr(LFUN_INSET_INSERT, "citation");
|
|
|
|
|
enable = getStatus(fr).enabled();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-16 13:14:37 +00:00
|
|
|
|
case LFUN_MENUWRITE: {
|
2006-03-23 13:51:00 +00:00
|
|
|
|
enable = view()->buffer()->isUnnamed()
|
|
|
|
|
|| !view()->buffer()->isClean();
|
2006-03-16 13:14:37 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-04 14:12:50 +00:00
|
|
|
|
// this one is difficult to get right. As a half-baked
|
|
|
|
|
// solution, we consider only the first action of the sequence
|
|
|
|
|
case LFUN_SEQUENCE: {
|
|
|
|
|
// argument contains ';'-terminated commands
|
|
|
|
|
string const firstcmd = token(cmd.argument, ';', 0);
|
2004-11-16 10:46:23 +00:00
|
|
|
|
FuncRequest func(lyxaction.lookupFunc(firstcmd));
|
|
|
|
|
func.origin = cmd.origin;
|
|
|
|
|
flag = getStatus(func);
|
2004-05-04 14:12:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_MENUNEW:
|
|
|
|
|
case LFUN_MENUNEWTMPLT:
|
|
|
|
|
case LFUN_WORDFINDFORWARD:
|
|
|
|
|
case LFUN_WORDFINDBACKWARD:
|
|
|
|
|
case LFUN_PREFIX:
|
|
|
|
|
case LFUN_EXEC_COMMAND:
|
|
|
|
|
case LFUN_CANCEL:
|
|
|
|
|
case LFUN_META_FAKE:
|
|
|
|
|
case LFUN_CLOSEBUFFER:
|
|
|
|
|
case LFUN_WRITEAS:
|
|
|
|
|
case LFUN_UPDATE:
|
|
|
|
|
case LFUN_PREVIEW:
|
|
|
|
|
case LFUN_IMPORT:
|
|
|
|
|
case LFUN_QUIT:
|
|
|
|
|
case LFUN_TOCVIEW:
|
|
|
|
|
case LFUN_AUTOSAVE:
|
|
|
|
|
case LFUN_RECONFIGURE:
|
|
|
|
|
case LFUN_HELP_OPEN:
|
|
|
|
|
case LFUN_FILE_NEW:
|
|
|
|
|
case LFUN_FILE_OPEN:
|
|
|
|
|
case LFUN_DROP_LAYOUTS_CHOICE:
|
|
|
|
|
case LFUN_MENU_OPEN_BY_NAME:
|
|
|
|
|
case LFUN_GETNAME:
|
|
|
|
|
case LFUN_NOTIFY:
|
|
|
|
|
case LFUN_GOTOFILEROW:
|
|
|
|
|
case LFUN_DIALOG_SHOW_NEXT_INSET:
|
|
|
|
|
case LFUN_DIALOG_HIDE:
|
|
|
|
|
case LFUN_DIALOG_DISCONNECT_INSET:
|
|
|
|
|
case LFUN_CHILDOPEN:
|
|
|
|
|
case LFUN_TOGGLECURSORFOLLOW:
|
|
|
|
|
case LFUN_KMAP_OFF:
|
|
|
|
|
case LFUN_KMAP_PRIM:
|
|
|
|
|
case LFUN_KMAP_SEC:
|
|
|
|
|
case LFUN_KMAP_TOGGLE:
|
|
|
|
|
case LFUN_REPEAT:
|
2004-03-27 23:11:46 +00:00
|
|
|
|
case LFUN_EXPORT_CUSTOM:
|
2004-03-28 14:12:33 +00:00
|
|
|
|
case LFUN_PRINT:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
case LFUN_SAVEPREFERENCES:
|
|
|
|
|
case LFUN_SCREEN_FONT_UPDATE:
|
|
|
|
|
case LFUN_SET_COLOR:
|
|
|
|
|
case LFUN_MESSAGE:
|
|
|
|
|
case LFUN_EXTERNAL_EDIT:
|
2004-04-13 10:36:09 +00:00
|
|
|
|
case LFUN_GRAPHICS_EDIT:
|
2004-03-30 12:36:33 +00:00
|
|
|
|
case LFUN_ALL_INSETS_TOGGLE:
|
2004-03-30 16:19:50 +00:00
|
|
|
|
case LFUN_LANGUAGE_BUFFER:
|
|
|
|
|
case LFUN_TEXTCLASS_APPLY:
|
|
|
|
|
case LFUN_TEXTCLASS_LOAD:
|
|
|
|
|
case LFUN_SAVE_AS_DEFAULT:
|
|
|
|
|
case LFUN_BUFFERPARAMS_APPLY:
|
2004-03-31 16:50:59 +00:00
|
|
|
|
case LFUN_LYXRC_APPLY:
|
2004-10-22 10:24:55 +00:00
|
|
|
|
case LFUN_NEXTBUFFER:
|
|
|
|
|
case LFUN_PREVIOUSBUFFER:
|
2004-03-18 13:57:20 +00:00
|
|
|
|
// these are handled in our dispatch()
|
2003-03-07 15:58:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2001-07-19 08:52:59 +00:00
|
|
|
|
default:
|
2004-04-03 08:37:12 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
if (!::getStatus(cur, cmd, flag))
|
|
|
|
|
flag = view()->getStatus(cmd);
|
2002-07-21 15:51:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-03-23 11:22:11 +00:00
|
|
|
|
if (!enable)
|
|
|
|
|
flag.enabled(false);
|
|
|
|
|
|
|
|
|
|
// Can we use a readonly buffer?
|
2004-03-30 16:19:50 +00:00
|
|
|
|
if (buf && buf->isReadonly()
|
2004-03-23 11:22:11 +00:00
|
|
|
|
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)
|
|
|
|
|
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)) {
|
2004-11-25 09:15:26 +00:00
|
|
|
|
flag.message(N_("Document is read-only"));
|
2004-03-23 11:22:11 +00:00
|
|
|
|
flag.enabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-07 10:37:05 +00:00
|
|
|
|
// Are we in a DELETED change-tracking region?
|
|
|
|
|
if (buf && buf->params().tracking_changes
|
|
|
|
|
&& lookupChange(cur, true) == Change::DELETED
|
|
|
|
|
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)
|
|
|
|
|
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)) {
|
|
|
|
|
flag.message(N_("This portion of the document is deleted."));
|
|
|
|
|
flag.enabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-02 11:32:14 +00:00
|
|
|
|
// the default error message if we disable the command
|
|
|
|
|
if (!flag.enabled() && flag.message().empty())
|
|
|
|
|
flag.message(N_("Command disabled"));
|
|
|
|
|
|
1999-12-10 00:07:59 +00:00
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-07-10 12:26:40 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
2003-10-13 00:38:09 +00:00
|
|
|
|
bool ensureBufferClean(BufferView * bv)
|
|
|
|
|
{
|
|
|
|
|
Buffer & buf = *bv->buffer();
|
|
|
|
|
if (buf.isClean())
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
string const file = MakeDisplayPath(buf.fileName(), 30);
|
|
|
|
|
string text = bformat(_("The document %1$s has unsaved "
|
|
|
|
|
"changes.\n\nDo you want to save "
|
|
|
|
|
"the document?"), file);
|
|
|
|
|
int const ret = Alert::prompt(_("Save changed document?"),
|
|
|
|
|
text, 0, 1, _("&Save"),
|
|
|
|
|
_("&Cancel"));
|
|
|
|
|
|
|
|
|
|
if (ret == 0)
|
|
|
|
|
bv->owner()->dispatch(FuncRequest(LFUN_MENUWRITE));
|
|
|
|
|
|
|
|
|
|
return buf.isClean();
|
|
|
|
|
}
|
2003-07-25 21:20:24 +00:00
|
|
|
|
|
2004-03-31 09:44:40 +00:00
|
|
|
|
|
2004-03-28 14:12:33 +00:00
|
|
|
|
void showPrintError(string const & name)
|
|
|
|
|
{
|
2004-03-31 09:44:40 +00:00
|
|
|
|
string str = bformat(_("Could not print the document %1$s.\n"
|
|
|
|
|
"Check that your printer is set up correctly."),
|
|
|
|
|
MakeDisplayPath(name, 50));
|
|
|
|
|
Alert::error(_("Print document failed"), str);
|
2004-03-28 14:12:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-03-31 09:44:40 +00:00
|
|
|
|
|
|
|
|
|
void loadTextclass(string const & name)
|
|
|
|
|
{
|
|
|
|
|
std::pair<bool, lyx::textclass_type> const tc_pair =
|
|
|
|
|
textclasslist.NumberOfClass(name);
|
|
|
|
|
|
|
|
|
|
if (!tc_pair.first) {
|
|
|
|
|
lyxerr << "Document class \"" << name
|
|
|
|
|
<< "\" does not exist."
|
|
|
|
|
<< std::endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lyx::textclass_type const tc = tc_pair.second;
|
|
|
|
|
|
|
|
|
|
if (!textclasslist[tc].load()) {
|
|
|
|
|
string s = bformat(_("The document could not be converted\n"
|
|
|
|
|
"into the document class %1$s."),
|
|
|
|
|
textclasslist[tc].name());
|
|
|
|
|
Alert::error(_("Could not change class"), s);
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-04-03 08:37:12 +00:00
|
|
|
|
|
2005-01-16 21:01:41 +00:00
|
|
|
|
|
|
|
|
|
void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
|
|
|
|
|
|
2003-07-10 12:26:40 +00:00
|
|
|
|
} //namespace anon
|
2002-01-12 20:00:47 +00:00
|
|
|
|
|
2003-07-25 21:20:24 +00:00
|
|
|
|
|
2004-11-08 10:54:29 +00:00
|
|
|
|
void LyXFunc::dispatch(FuncRequest const & cmd)
|
2002-01-12 20:00:47 +00:00
|
|
|
|
{
|
2004-11-30 01:59:49 +00:00
|
|
|
|
BOOST_ASSERT(view());
|
2004-03-18 12:53:43 +00:00
|
|
|
|
string const argument = cmd.argument;
|
|
|
|
|
kb_action const action = cmd.action;
|
2003-09-21 23:00:47 +00:00
|
|
|
|
|
2004-01-30 11:41:12 +00:00
|
|
|
|
lyxerr[Debug::ACTION] << "LyXFunc::dispatch: cmd: " << cmd << endl;
|
2004-03-08 21:14:45 +00:00
|
|
|
|
//lyxerr << "LyXFunc::dispatch: cmd: " << cmd << endl;
|
2002-01-12 20:00:47 +00:00
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
// we have not done anything wrong yet.
|
|
|
|
|
errorstat = false;
|
2002-01-12 20:00:47 +00:00
|
|
|
|
dispatch_buffer.erase();
|
|
|
|
|
|
2005-02-08 02:06:39 +00:00
|
|
|
|
bool update = false;
|
2004-04-20 08:51:15 +00:00
|
|
|
|
|
2004-11-25 09:15:26 +00:00
|
|
|
|
FuncStatus const flag = getStatus(cmd);
|
|
|
|
|
if (!flag.enabled()) {
|
|
|
|
|
// We cannot use this function here
|
2002-07-20 20:47:54 +00:00
|
|
|
|
lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
|
2002-01-12 20:00:47 +00:00
|
|
|
|
<< lyxaction.getActionName(action)
|
|
|
|
|
<< " [" << action << "] is disabled at this location"
|
2001-07-24 22:08:49 +00:00
|
|
|
|
<< endl;
|
2004-11-25 09:15:26 +00:00
|
|
|
|
setErrorMessage(flag.message());
|
2003-11-13 13:43:44 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if (view()->available())
|
|
|
|
|
view()->hideCursor();
|
2003-05-03 18:05:53 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
switch (action) {
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_WORDFINDFORWARD:
|
|
|
|
|
case LFUN_WORDFINDBACKWARD: {
|
|
|
|
|
static string last_search;
|
|
|
|
|
string searched_string;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
if (!argument.empty()) {
|
|
|
|
|
last_search = argument;
|
|
|
|
|
searched_string = argument;
|
2004-03-18 16:12:51 +00:00
|
|
|
|
} else {
|
2003-11-13 13:43:44 +00:00
|
|
|
|
searched_string = last_search;
|
2004-03-18 16:12:51 +00:00
|
|
|
|
}
|
2004-01-07 17:00:03 +00:00
|
|
|
|
|
|
|
|
|
if (searched_string.empty())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
bool const fw = action == LFUN_WORDFINDFORWARD;
|
|
|
|
|
string const data =
|
2004-01-15 17:34:44 +00:00
|
|
|
|
lyx::find::find2string(searched_string, true, false, fw);
|
2004-03-25 09:16:36 +00:00
|
|
|
|
lyx::find::find(view(), FuncRequest(LFUN_WORD_FIND, data));
|
2003-11-13 13:43:44 +00:00
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_PREFIX:
|
|
|
|
|
owner->message(keyseq.printOptions());
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_EXEC_COMMAND:
|
2004-04-29 09:54:59 +00:00
|
|
|
|
owner->getToolbars().display("minibuffer", true);
|
2003-11-13 13:43:44 +00:00
|
|
|
|
owner->focus_command_buffer();
|
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_CANCEL:
|
|
|
|
|
keyseq.reset();
|
|
|
|
|
meta_fake_bit = key_modifier::none;
|
|
|
|
|
if (view()->available())
|
|
|
|
|
// cancel any selection
|
|
|
|
|
dispatch(FuncRequest(LFUN_MARK_OFF));
|
|
|
|
|
setMessage(N_("Cancel"));
|
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_META_FAKE:
|
|
|
|
|
meta_fake_bit = key_modifier::alt;
|
|
|
|
|
setMessage(keyseq.print());
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_READ_ONLY_TOGGLE:
|
|
|
|
|
if (owner->buffer()->lyxvc().inUse())
|
|
|
|
|
owner->buffer()->lyxvc().toggleReadOnly();
|
|
|
|
|
else
|
|
|
|
|
owner->buffer()->setReadonly(
|
|
|
|
|
!owner->buffer()->isReadonly());
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
// --- Menus -----------------------------------------------
|
|
|
|
|
case LFUN_MENUNEW:
|
|
|
|
|
menuNew(argument, false);
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_MENUNEWTMPLT:
|
|
|
|
|
menuNew(argument, true);
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_CLOSEBUFFER:
|
|
|
|
|
closeBuffer();
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_MENUWRITE:
|
|
|
|
|
if (!owner->buffer()->isUnnamed()) {
|
|
|
|
|
string const str = bformat(_("Saving document %1$s..."),
|
|
|
|
|
MakeDisplayPath(owner->buffer()->fileName()));
|
|
|
|
|
owner->message(str);
|
|
|
|
|
MenuWrite(owner->buffer());
|
|
|
|
|
owner->message(str + _(" done."));
|
|
|
|
|
} else
|
|
|
|
|
WriteAs(owner->buffer());
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_WRITEAS:
|
|
|
|
|
WriteAs(owner->buffer(), argument);
|
|
|
|
|
break;
|
2003-03-29 07:44:44 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_MENURELOAD: {
|
|
|
|
|
string const file = MakeDisplayPath(view()->buffer()->fileName(), 20);
|
|
|
|
|
string text = bformat(_("Any changes will be lost. Are you sure "
|
|
|
|
|
"you want to revert to the saved version of the document %1$s?"), file);
|
|
|
|
|
int const ret = Alert::prompt(_("Revert to saved document?"),
|
|
|
|
|
text, 0, 1, _("&Revert"), _("&Cancel"));
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
if (ret == 0)
|
|
|
|
|
view()->reload();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_UPDATE:
|
|
|
|
|
Exporter::Export(owner->buffer(), argument, true);
|
|
|
|
|
view()->showErrorList(BufferFormat(*owner->buffer()));
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_PREVIEW:
|
|
|
|
|
Exporter::Preview(owner->buffer(), argument);
|
|
|
|
|
view()->showErrorList(BufferFormat(*owner->buffer()));
|
|
|
|
|
break;
|
2002-03-19 03:56:23 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_BUILDPROG:
|
|
|
|
|
Exporter::Export(owner->buffer(), "program", true);
|
|
|
|
|
view()->showErrorList(_("Build"));
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_RUNCHKTEX:
|
|
|
|
|
owner->buffer()->runChktex();
|
|
|
|
|
view()->showErrorList(_("ChkTeX"));
|
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_EXPORT:
|
|
|
|
|
if (argument == "custom")
|
2004-03-27 23:11:46 +00:00
|
|
|
|
owner->getDialogs().show("sendto");
|
2003-11-13 13:43:44 +00:00
|
|
|
|
else {
|
|
|
|
|
Exporter::Export(owner->buffer(), argument, false);
|
|
|
|
|
view()->showErrorList(BufferFormat(*owner->buffer()));
|
|
|
|
|
}
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2004-03-27 23:11:46 +00:00
|
|
|
|
case LFUN_EXPORT_CUSTOM: {
|
|
|
|
|
string format_name;
|
|
|
|
|
string command = split(argument, format_name, ' ');
|
|
|
|
|
Format const * format = formats.getFormat(format_name);
|
|
|
|
|
if (!format) {
|
|
|
|
|
lyxerr << "Format \"" << format_name
|
|
|
|
|
<< "\" not recognized!"
|
|
|
|
|
<< std::endl;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Buffer * buffer = owner->buffer();
|
|
|
|
|
|
|
|
|
|
// The name of the file created by the conversion process
|
|
|
|
|
string filename;
|
|
|
|
|
|
|
|
|
|
// Output to filename
|
|
|
|
|
if (format->name() == "lyx") {
|
|
|
|
|
string const latexname =
|
|
|
|
|
buffer->getLatexName(false);
|
|
|
|
|
filename = ChangeExtension(latexname,
|
|
|
|
|
format->extension());
|
|
|
|
|
filename = AddName(buffer->temppath(), filename);
|
|
|
|
|
|
|
|
|
|
if (!buffer->writeFile(filename))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Exporter::Export(buffer, format_name, true,
|
|
|
|
|
filename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Substitute $$FName for filename
|
|
|
|
|
if (!contains(command, "$$FName"))
|
|
|
|
|
command = "( " + command + " ) < $$FName";
|
|
|
|
|
command = subst(command, "$$FName", filename);
|
|
|
|
|
|
|
|
|
|
// Execute the command in the background
|
|
|
|
|
Systemcall call;
|
|
|
|
|
call.startscript(Systemcall::DontWait, command);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-28 14:12:33 +00:00
|
|
|
|
case LFUN_PRINT: {
|
|
|
|
|
string target;
|
|
|
|
|
string target_name;
|
|
|
|
|
string command = split(split(argument, target, ' '),
|
|
|
|
|
target_name, ' ');
|
|
|
|
|
|
|
|
|
|
if (target.empty()
|
|
|
|
|
|| target_name.empty()
|
|
|
|
|
|| command.empty()) {
|
|
|
|
|
lyxerr << "Unable to parse \""
|
|
|
|
|
<< argument << '"' << std::endl;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (target != "printer" && target != "file") {
|
|
|
|
|
lyxerr << "Unrecognized target \""
|
|
|
|
|
<< target << '"' << std::endl;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Buffer * buffer = owner->buffer();
|
|
|
|
|
|
|
|
|
|
if (!Exporter::Export(buffer, "dvi", true)) {
|
|
|
|
|
showPrintError(buffer->fileName());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Push directory path.
|
|
|
|
|
string const path = buffer->temppath();
|
|
|
|
|
Path p(path);
|
|
|
|
|
|
|
|
|
|
// there are three cases here:
|
|
|
|
|
// 1. we print to a file
|
|
|
|
|
// 2. we print directly to a printer
|
|
|
|
|
// 3. we print using a spool command (print to file first)
|
|
|
|
|
Systemcall one;
|
|
|
|
|
int res = 0;
|
|
|
|
|
string const dviname =
|
|
|
|
|
ChangeExtension(buffer->getLatexName(true),
|
|
|
|
|
"dvi");
|
|
|
|
|
|
|
|
|
|
if (target == "printer") {
|
|
|
|
|
if (!lyxrc.print_spool_command.empty()) {
|
|
|
|
|
// case 3: print using a spool
|
|
|
|
|
string const psname =
|
|
|
|
|
ChangeExtension(dviname,".ps");
|
|
|
|
|
command += lyxrc.print_to_file
|
|
|
|
|
+ QuoteName(psname)
|
|
|
|
|
+ ' '
|
|
|
|
|
+ QuoteName(dviname);
|
|
|
|
|
|
|
|
|
|
string command2 =
|
|
|
|
|
lyxrc.print_spool_command +' ';
|
|
|
|
|
if (target_name != "default") {
|
|
|
|
|
command2 += lyxrc.print_spool_printerprefix
|
|
|
|
|
+ target_name
|
|
|
|
|
+ ' ';
|
|
|
|
|
}
|
|
|
|
|
command2 += QuoteName(psname);
|
|
|
|
|
// First run dvips.
|
|
|
|
|
// If successful, then spool command
|
|
|
|
|
res = one.startscript(
|
|
|
|
|
Systemcall::Wait,
|
|
|
|
|
command);
|
|
|
|
|
|
|
|
|
|
if (res == 0)
|
|
|
|
|
res = one.startscript(
|
|
|
|
|
Systemcall::DontWait,
|
|
|
|
|
command2);
|
|
|
|
|
} else {
|
|
|
|
|
// case 2: print directly to a printer
|
|
|
|
|
res = one.startscript(
|
|
|
|
|
Systemcall::DontWait,
|
|
|
|
|
command + QuoteName(dviname));
|
|
|
|
|
}
|
2004-03-30 16:19:50 +00:00
|
|
|
|
|
2004-03-28 14:12:33 +00:00
|
|
|
|
} else {
|
|
|
|
|
// case 1: print to a file
|
|
|
|
|
command += lyxrc.print_to_file
|
|
|
|
|
+ QuoteName(MakeAbsPath(target_name,
|
|
|
|
|
path))
|
|
|
|
|
+ ' '
|
|
|
|
|
+ QuoteName(dviname);
|
|
|
|
|
res = one.startscript(Systemcall::DontWait,
|
|
|
|
|
command);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (res != 0)
|
|
|
|
|
showPrintError(buffer->fileName());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_IMPORT:
|
|
|
|
|
doImport(argument);
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_QUIT:
|
2005-07-16 10:35:43 +00:00
|
|
|
|
QuitLyX(argument == "force");
|
2003-11-13 13:43:44 +00:00
|
|
|
|
break;
|
2000-08-01 17:33:32 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_TOCVIEW: {
|
|
|
|
|
InsetCommandParams p("tableofcontents");
|
|
|
|
|
string const data = InsetCommandMailer::params2string("toc", p);
|
|
|
|
|
owner->getDialogs().show("toc", data, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_AUTOSAVE:
|
|
|
|
|
AutoSave(view());
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_RECONFIGURE:
|
|
|
|
|
Reconfigure(view());
|
2000-07-24 13:53:19 +00:00
|
|
|
|
break;
|
2003-11-13 13:43:44 +00:00
|
|
|
|
|
|
|
|
|
case LFUN_HELP_OPEN: {
|
|
|
|
|
string const arg = argument;
|
|
|
|
|
if (arg.empty()) {
|
|
|
|
|
setErrorMessage(N_("Missing argument"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
string const fname = i18nLibFileSearch("doc", arg, "lyx");
|
|
|
|
|
if (fname.empty()) {
|
|
|
|
|
lyxerr << "LyX: unable to find documentation file `"
|
|
|
|
|
<< arg << "'. Bad installation?" << endl;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
owner->message(bformat(_("Opening help file %1$s..."),
|
|
|
|
|
MakeDisplayPath(fname)));
|
|
|
|
|
view()->loadLyXFile(fname, false);
|
2000-07-24 13:53:19 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
// --- version control -------------------------------
|
|
|
|
|
case LFUN_VC_REGISTER:
|
|
|
|
|
if (!ensureBufferClean(view()))
|
|
|
|
|
break;
|
|
|
|
|
if (!owner->buffer()->lyxvc().inUse()) {
|
|
|
|
|
owner->buffer()->lyxvc().registrer();
|
|
|
|
|
view()->reload();
|
|
|
|
|
}
|
2003-07-10 12:26:40 +00:00
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_VC_CHECKIN:
|
|
|
|
|
if (!ensureBufferClean(view()))
|
|
|
|
|
break;
|
|
|
|
|
if (owner->buffer()->lyxvc().inUse()
|
|
|
|
|
&& !owner->buffer()->isReadonly()) {
|
|
|
|
|
owner->buffer()->lyxvc().checkIn();
|
|
|
|
|
view()->reload();
|
|
|
|
|
}
|
2003-07-10 12:26:40 +00:00
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_VC_CHECKOUT:
|
|
|
|
|
if (!ensureBufferClean(view()))
|
|
|
|
|
break;
|
|
|
|
|
if (owner->buffer()->lyxvc().inUse()
|
|
|
|
|
&& owner->buffer()->isReadonly()) {
|
|
|
|
|
owner->buffer()->lyxvc().checkOut();
|
|
|
|
|
view()->reload();
|
|
|
|
|
}
|
2003-07-10 12:26:40 +00:00
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_VC_REVERT:
|
|
|
|
|
owner->buffer()->lyxvc().revert();
|
|
|
|
|
view()->reload();
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_VC_UNDO:
|
|
|
|
|
owner->buffer()->lyxvc().undoLast();
|
|
|
|
|
view()->reload();
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
// --- buffers ----------------------------------------
|
|
|
|
|
case LFUN_SWITCHBUFFER:
|
2004-03-18 12:53:43 +00:00
|
|
|
|
view()->setBuffer(bufferlist.getBuffer(argument));
|
2003-11-13 13:43:44 +00:00
|
|
|
|
break;
|
2000-07-24 13:53:19 +00:00
|
|
|
|
|
2004-10-22 10:24:55 +00:00
|
|
|
|
case LFUN_NEXTBUFFER:
|
|
|
|
|
view()->setBuffer(bufferlist.next(view()->buffer()));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LFUN_PREVIOUSBUFFER:
|
|
|
|
|
view()->setBuffer(bufferlist.previous(view()->buffer()));
|
|
|
|
|
break;
|
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_FILE_NEW:
|
|
|
|
|
NewFile(view(), argument);
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_FILE_OPEN:
|
|
|
|
|
open(argument);
|
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_DROP_LAYOUTS_CHOICE:
|
2004-04-29 09:54:59 +00:00
|
|
|
|
owner->getToolbars().openLayoutList();
|
2003-11-13 13:43:44 +00:00
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_MENU_OPEN_BY_NAME:
|
|
|
|
|
owner->getMenubar().openByName(argument);
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
// --- lyxserver commands ----------------------------
|
|
|
|
|
case LFUN_GETNAME:
|
|
|
|
|
setMessage(owner->buffer()->fileName());
|
|
|
|
|
lyxerr[Debug::INFO] << "FNAME["
|
|
|
|
|
<< owner->buffer()->fileName()
|
|
|
|
|
<< "] " << endl;
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_NOTIFY:
|
|
|
|
|
dispatch_buffer = keyseq.print();
|
|
|
|
|
lyxserver->notifyClient(dispatch_buffer);
|
|
|
|
|
break;
|
2001-02-23 16:10:03 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_GOTOFILEROW: {
|
|
|
|
|
string file_name;
|
|
|
|
|
int row;
|
|
|
|
|
istringstream is(argument);
|
|
|
|
|
is >> file_name >> row;
|
2005-01-10 19:17:43 +00:00
|
|
|
|
if (prefixIs(file_name, package().temp_dir())) {
|
2003-11-13 13:43:44 +00:00
|
|
|
|
// Needed by inverse dvi search. If it is a file
|
|
|
|
|
// in tmpdir, call the apropriated function
|
2004-03-18 12:53:43 +00:00
|
|
|
|
view()->setBuffer(bufferlist.getBufferFromTmp(file_name));
|
2003-10-14 11:35:50 +00:00
|
|
|
|
} else {
|
2003-11-13 13:43:44 +00:00
|
|
|
|
// Must replace extension of the file to be .lyx
|
|
|
|
|
// and get full path
|
|
|
|
|
string const s = ChangeExtension(file_name, ".lyx");
|
|
|
|
|
// Either change buffer or load the file
|
|
|
|
|
if (bufferlist.exists(s)) {
|
2004-03-18 12:53:43 +00:00
|
|
|
|
view()->setBuffer(bufferlist.getBuffer(s));
|
2003-11-13 13:43:44 +00:00
|
|
|
|
} else {
|
|
|
|
|
view()->loadLyXFile(s);
|
|
|
|
|
}
|
2003-10-14 11:35:50 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
view()->setCursorFromRow(row);
|
2000-02-04 09:38:32 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
view()->center();
|
|
|
|
|
// see BufferView_pimpl::center()
|
|
|
|
|
view()->updateScrollbar();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-07-25 10:46:18 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_DIALOG_SHOW: {
|
2004-01-30 11:41:12 +00:00
|
|
|
|
string const name = cmd.getArg(0);
|
|
|
|
|
string data = trim(cmd.argument.substr(name.size()));
|
2003-11-13 13:43:44 +00:00
|
|
|
|
|
|
|
|
|
if (name == "character") {
|
|
|
|
|
data = freefont2string();
|
|
|
|
|
if (!data.empty())
|
|
|
|
|
owner->getDialogs().show("character", data);
|
2003-12-05 13:37:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (name == "latexlog") {
|
|
|
|
|
pair<Buffer::LogType, string> const logfile =
|
|
|
|
|
owner->buffer()->getLogName();
|
|
|
|
|
switch (logfile.first) {
|
|
|
|
|
case Buffer::latexlog:
|
|
|
|
|
data = "latex ";
|
|
|
|
|
break;
|
|
|
|
|
case Buffer::buildlog:
|
|
|
|
|
data = "literate ";
|
|
|
|
|
break;
|
|
|
|
|
}
|
2006-08-25 19:25:41 +00:00
|
|
|
|
data += LyXLex::quoteString(logfile.second);
|
2003-12-05 13:37:23 +00:00
|
|
|
|
owner->getDialogs().show("log", data);
|
|
|
|
|
}
|
|
|
|
|
else if (name == "vclog") {
|
|
|
|
|
string const data = "vc " +
|
2006-08-25 19:25:41 +00:00
|
|
|
|
LyXLex::quoteString(owner->buffer()->lyxvc().getLogFile());
|
2003-12-05 13:37:23 +00:00
|
|
|
|
owner->getDialogs().show("log", data);
|
|
|
|
|
}
|
2003-11-13 13:43:44 +00:00
|
|
|
|
else
|
|
|
|
|
owner->getDialogs().show(name, data);
|
|
|
|
|
break;
|
2003-02-25 14:51:38 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
2004-01-30 11:41:12 +00:00
|
|
|
|
string const name = cmd.getArg(0);
|
|
|
|
|
string data = trim(cmd.argument.substr(name.size()));
|
2003-11-13 13:43:44 +00:00
|
|
|
|
if (name == "bibitem" ||
|
2003-12-10 22:10:38 +00:00
|
|
|
|
name == "bibtex" ||
|
|
|
|
|
name == "index" ||
|
|
|
|
|
name == "label" ||
|
|
|
|
|
name == "ref" ||
|
|
|
|
|
name == "toc" ||
|
|
|
|
|
name == "url") {
|
2003-11-13 13:43:44 +00:00
|
|
|
|
InsetCommandParams p(name);
|
|
|
|
|
data = InsetCommandMailer::params2string(name, p);
|
2005-08-02 22:31:56 +00:00
|
|
|
|
} else if (name == "include") {
|
|
|
|
|
InsetCommandParams p(data);
|
|
|
|
|
data = InsetIncludeMailer::params2string(p);
|
2003-12-10 22:10:38 +00:00
|
|
|
|
} else if (name == "box") {
|
|
|
|
|
// \c data == "Boxed" || "Frameless" etc
|
|
|
|
|
InsetBoxParams p(data);
|
|
|
|
|
data = InsetBoxMailer::params2string(p);
|
|
|
|
|
} else if (name == "branch") {
|
|
|
|
|
InsetBranchParams p;
|
|
|
|
|
data = InsetBranchMailer::params2string(p);
|
2003-11-13 13:43:44 +00:00
|
|
|
|
} else if (name == "citation") {
|
|
|
|
|
InsetCommandParams p("cite");
|
|
|
|
|
data = InsetCommandMailer::params2string(name, p);
|
2003-12-10 22:10:38 +00:00
|
|
|
|
} else if (name == "ert") {
|
|
|
|
|
data = InsetERTMailer::params2string(InsetCollapsable::Open);
|
|
|
|
|
} else if (name == "external") {
|
|
|
|
|
InsetExternalParams p;
|
|
|
|
|
Buffer const & buffer = *owner->buffer();
|
|
|
|
|
data = InsetExternalMailer::params2string(p, buffer);
|
|
|
|
|
} else if (name == "float") {
|
|
|
|
|
InsetFloatParams p;
|
|
|
|
|
data = InsetFloatMailer::params2string(p);
|
|
|
|
|
} else if (name == "graphics") {
|
|
|
|
|
InsetGraphicsParams p;
|
|
|
|
|
Buffer const & buffer = *owner->buffer();
|
|
|
|
|
data = InsetGraphicsMailer::params2string(p, buffer);
|
|
|
|
|
} else if (name == "note") {
|
|
|
|
|
InsetNoteParams p;
|
|
|
|
|
data = InsetNoteMailer::params2string(p);
|
2003-11-28 15:53:34 +00:00
|
|
|
|
} else if (name == "vspace") {
|
|
|
|
|
VSpace space;
|
|
|
|
|
data = InsetVSpaceMailer::params2string(space);
|
2003-12-10 22:10:38 +00:00
|
|
|
|
} else if (name == "wrap") {
|
|
|
|
|
InsetWrapParams p;
|
|
|
|
|
data = InsetWrapMailer::params2string(p);
|
2003-11-13 13:43:44 +00:00
|
|
|
|
}
|
|
|
|
|
owner->getDialogs().show(name, data, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_DIALOG_SHOW_NEXT_INSET:
|
|
|
|
|
break;
|
2003-09-09 17:25:35 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_DIALOG_UPDATE: {
|
|
|
|
|
string const & name = argument;
|
|
|
|
|
// Can only update a dialog connected to an existing inset
|
|
|
|
|
InsetBase * inset = owner->getDialogs().getOpenInset(name);
|
|
|
|
|
if (inset) {
|
2004-01-30 11:41:12 +00:00
|
|
|
|
FuncRequest fr(LFUN_INSET_DIALOG_UPDATE, cmd.argument);
|
2004-01-20 14:25:24 +00:00
|
|
|
|
inset->dispatch(view()->cursor(), fr);
|
2003-11-13 13:43:44 +00:00
|
|
|
|
} else if (name == "paragraph") {
|
|
|
|
|
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
2004-04-05 18:34:36 +00:00
|
|
|
|
} else if (name == "prefs") {
|
|
|
|
|
owner->getDialogs().update(name, string());
|
2003-11-13 13:43:44 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2003-02-25 14:51:38 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_DIALOG_HIDE:
|
|
|
|
|
Dialogs::hide(argument, 0);
|
|
|
|
|
break;
|
2003-02-25 14:51:38 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_DIALOG_DISCONNECT_INSET:
|
|
|
|
|
owner->getDialogs().disconnect(argument);
|
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2005-10-07 14:51:39 +00:00
|
|
|
|
|
|
|
|
|
case LFUN_INSERT_CITATION: {
|
|
|
|
|
if (!argument.empty()) {
|
|
|
|
|
// we can have one optional argument, delimited by '|'
|
|
|
|
|
// citation-insert <key>|<text_before>
|
|
|
|
|
// this should be enhanced to also support text_after
|
|
|
|
|
// and citation style
|
|
|
|
|
string arg = argument;
|
|
|
|
|
string opt1;
|
|
|
|
|
if (contains(argument, "|")) {
|
|
|
|
|
arg = token(argument, '|', 0);
|
|
|
|
|
opt1 = '[' + token(argument, '|', 1) + ']';
|
|
|
|
|
}
|
|
|
|
|
std::ostringstream os;
|
|
|
|
|
os << "citation LatexCommand\n"
|
|
|
|
|
<< "\\cite" << opt1 << "{" << arg << "}\n"
|
|
|
|
|
<< "\\end_inset";
|
|
|
|
|
FuncRequest fr(LFUN_INSET_INSERT, os.str());
|
|
|
|
|
dispatch(fr);
|
|
|
|
|
} else
|
|
|
|
|
dispatch(FuncRequest(LFUN_DIALOG_SHOW, "citation"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_CHILDOPEN: {
|
|
|
|
|
string const filename =
|
|
|
|
|
MakeAbsPath(argument, owner->buffer()->filePath());
|
|
|
|
|
setMessage(N_("Opening child document ") +
|
|
|
|
|
MakeDisplayPath(filename) + "...");
|
|
|
|
|
view()->savePosition(0);
|
2003-11-24 20:48:21 +00:00
|
|
|
|
string const parentfilename = owner->buffer()->fileName();
|
2003-11-13 13:43:44 +00:00
|
|
|
|
if (bufferlist.exists(filename))
|
2004-03-18 12:53:43 +00:00
|
|
|
|
view()->setBuffer(bufferlist.getBuffer(filename));
|
2003-11-13 13:43:44 +00:00
|
|
|
|
else
|
|
|
|
|
view()->loadLyXFile(filename);
|
2003-11-24 20:48:21 +00:00
|
|
|
|
// Set the parent name of the child document.
|
|
|
|
|
// This makes insertion of citations and references in the child work,
|
|
|
|
|
// when the target is in the parent or another child document.
|
|
|
|
|
owner->buffer()->setParentName(parentfilename);
|
2003-11-13 13:43:44 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_TOGGLECURSORFOLLOW:
|
|
|
|
|
lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_KMAP_OFF:
|
|
|
|
|
owner->getIntl().KeyMapOn(false);
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_KMAP_PRIM:
|
|
|
|
|
owner->getIntl().KeyMapPrim();
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_KMAP_SEC:
|
|
|
|
|
owner->getIntl().KeyMapSec();
|
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_KMAP_TOGGLE:
|
|
|
|
|
owner->getIntl().ToggleKeyMap();
|
|
|
|
|
break;
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_REPEAT: {
|
|
|
|
|
// repeat command
|
|
|
|
|
string countstr;
|
2004-03-18 12:53:43 +00:00
|
|
|
|
string rest = split(argument, countstr, ' ');
|
2003-11-13 13:43:44 +00:00
|
|
|
|
istringstream is(countstr);
|
|
|
|
|
int count = 0;
|
|
|
|
|
is >> count;
|
2004-03-18 12:53:43 +00:00
|
|
|
|
lyxerr << "repeat: count: " << count << " cmd: " << rest << endl;
|
2003-11-13 13:43:44 +00:00
|
|
|
|
for (int i = 0; i < count; ++i)
|
2004-03-18 12:53:43 +00:00
|
|
|
|
dispatch(lyxaction.lookupFunc(rest));
|
2003-11-13 13:43:44 +00:00
|
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2004-05-04 14:12:50 +00:00
|
|
|
|
case LFUN_SEQUENCE: {
|
2003-11-13 13:43:44 +00:00
|
|
|
|
// argument contains ';'-terminated commands
|
2004-05-04 14:12:50 +00:00
|
|
|
|
string arg = argument;
|
|
|
|
|
while (!arg.empty()) {
|
2003-11-13 13:43:44 +00:00
|
|
|
|
string first;
|
2004-05-04 14:12:50 +00:00
|
|
|
|
arg = split(arg, first, ';');
|
2004-11-16 10:46:23 +00:00
|
|
|
|
FuncRequest func(lyxaction.lookupFunc(first));
|
|
|
|
|
func.origin = cmd.origin;
|
|
|
|
|
dispatch(func);
|
2003-11-13 13:43:44 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2004-05-04 14:12:50 +00:00
|
|
|
|
}
|
2000-08-14 05:24:35 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_SAVEPREFERENCES: {
|
2005-01-10 19:17:43 +00:00
|
|
|
|
Path p(package().user_support());
|
2004-04-05 18:21:25 +00:00
|
|
|
|
lyxrc.write("preferences", false);
|
2000-06-26 15:33:13 +00:00
|
|
|
|
break;
|
2003-10-27 12:41:26 +00:00
|
|
|
|
}
|
2000-06-26 15:33:13 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_SCREEN_FONT_UPDATE:
|
|
|
|
|
// handle the screen font changes.
|
|
|
|
|
lyxrc.set_font_norm_type();
|
|
|
|
|
lyx_gui::update_fonts();
|
|
|
|
|
// All visible buffers will need resize
|
|
|
|
|
view()->resize();
|
2000-06-26 15:33:13 +00:00
|
|
|
|
break;
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_SET_COLOR: {
|
|
|
|
|
string lyx_name;
|
|
|
|
|
string const x11_name = split(argument, lyx_name, ' ');
|
|
|
|
|
if (lyx_name.empty() || x11_name.empty()) {
|
|
|
|
|
setErrorMessage(N_("Syntax: set-color <lyx_name>"
|
|
|
|
|
" <x11_name>"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool const graphicsbg_changed =
|
|
|
|
|
(lyx_name == lcolor.getLyXName(LColor::graphicsbg) &&
|
|
|
|
|
x11_name != lcolor.getX11Name(LColor::graphicsbg));
|
|
|
|
|
|
2004-03-25 15:51:21 +00:00
|
|
|
|
if (!lcolor.setColor(lyx_name, x11_name)) {
|
2003-11-13 13:43:44 +00:00
|
|
|
|
setErrorMessage(
|
|
|
|
|
bformat(_("Set-color \"%1$s\" failed "
|
|
|
|
|
"- color is undefined or "
|
|
|
|
|
"may not be redefined"), lyx_name));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lyx_gui::update_color(lcolor.getFromLyXName(lyx_name));
|
2002-02-27 09:59:52 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
if (graphicsbg_changed) {
|
2002-06-25 15:59:10 +00:00
|
|
|
|
#ifdef WITH_WARNINGS
|
|
|
|
|
#warning FIXME!! The graphics cache no longer has a changeDisplay method.
|
|
|
|
|
#endif
|
|
|
|
|
#if 0
|
2003-11-13 13:43:44 +00:00
|
|
|
|
lyx::graphics::GCache::get().changeDisplay(true);
|
2002-06-25 15:59:10 +00:00
|
|
|
|
#endif
|
2003-11-13 13:43:44 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2002-02-27 09:59:52 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_MESSAGE:
|
|
|
|
|
owner->message(argument);
|
|
|
|
|
break;
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
|
case LFUN_TOOLTIPS_TOGGLE:
|
|
|
|
|
owner->getDialogs().toggleTooltips();
|
|
|
|
|
break;
|
2002-03-11 09:54:42 +00:00
|
|
|
|
|
2004-03-18 12:53:43 +00:00
|
|
|
|
case LFUN_EXTERNAL_EDIT: {
|
|
|
|
|
FuncRequest fr(action, argument);
|
|
|
|
|
InsetExternal().dispatch(view()->cursor(), fr);
|
2003-11-13 13:43:44 +00:00
|
|
|
|
break;
|
2004-03-18 12:53:43 +00:00
|
|
|
|
}
|
2003-06-11 11:01:34 +00:00
|
|
|
|
|
2004-04-13 10:36:09 +00:00
|
|
|
|
case LFUN_GRAPHICS_EDIT: {
|
|
|
|
|
FuncRequest fr(action, argument);
|
|
|
|
|
InsetGraphics().dispatch(view()->cursor(), fr);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-13 09:43:58 +00:00
|
|
|
|
case LFUN_INSET_APPLY: {
|
|
|
|
|
string const name = cmd.getArg(0);
|
|
|
|
|
InsetBase * inset = owner->getDialogs().getOpenInset(name);
|
|
|
|
|
if (inset) {
|
|
|
|
|
FuncRequest fr(LFUN_INSET_MODIFY, argument);
|
|
|
|
|
inset->dispatch(view()->cursor(), fr);
|
|
|
|
|
} else {
|
|
|
|
|
FuncRequest fr(LFUN_INSET_INSERT, argument);
|
|
|
|
|
dispatch(fr);
|
|
|
|
|
}
|
2005-05-06 12:15:36 +00:00
|
|
|
|
// ideally, the update flag should be set by the insets,
|
|
|
|
|
// but this is not possible currently
|
|
|
|
|
update = true;
|
2005-04-13 09:43:58 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-30 12:36:33 +00:00
|
|
|
|
case LFUN_ALL_INSETS_TOGGLE: {
|
|
|
|
|
string action;
|
|
|
|
|
string const name = split(argument, action, ' ');
|
|
|
|
|
InsetBase::Code const inset_code =
|
|
|
|
|
InsetBase::translate(name);
|
|
|
|
|
|
|
|
|
|
LCursor & cur = view()->cursor();
|
|
|
|
|
FuncRequest fr(LFUN_INSET_TOGGLE, action);
|
|
|
|
|
|
|
|
|
|
InsetBase & inset = owner->buffer()->inset();
|
|
|
|
|
InsetIterator it = inset_iterator_begin(inset);
|
|
|
|
|
InsetIterator const end = inset_iterator_end(inset);
|
|
|
|
|
for (; it != end; ++it) {
|
|
|
|
|
if (inset_code == InsetBase::NO_CODE
|
2005-10-24 09:42:20 +00:00
|
|
|
|
|| inset_code == it->lyxCode()) {
|
|
|
|
|
LCursor tmpcur = cur;
|
|
|
|
|
tmpcur.pushLeft(*it);
|
|
|
|
|
it->dispatch(tmpcur, fr);
|
|
|
|
|
}
|
2004-03-30 12:36:33 +00:00
|
|
|
|
}
|
2005-09-15 16:00:29 +00:00
|
|
|
|
update = true;
|
2004-03-30 12:36:33 +00:00
|
|
|
|
break;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-03-30 16:19:50 +00:00
|
|
|
|
case LFUN_LANGUAGE_BUFFER: {
|
|
|
|
|
Buffer & buffer = *owner->buffer();
|
|
|
|
|
Language const * oldL = buffer.params().language;
|
|
|
|
|
Language const * newL = languages.getLanguage(argument);
|
|
|
|
|
if (!newL || oldL == newL)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (oldL->RightToLeft() == newL->RightToLeft()
|
|
|
|
|
&& !buffer.isMultiLingual())
|
|
|
|
|
buffer.changeLanguage(oldL, newL);
|
|
|
|
|
else
|
|
|
|
|
buffer.updateDocLang(newL);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-08 22:36:34 +00:00
|
|
|
|
case LFUN_SAVE_AS_DEFAULT: {
|
|
|
|
|
string const fname =
|
2005-01-10 19:17:43 +00:00
|
|
|
|
AddName(AddPath(package().user_support(), "templates/"),
|
2004-08-08 22:36:34 +00:00
|
|
|
|
"defaults.lyx");
|
|
|
|
|
Buffer defaults(fname);
|
|
|
|
|
|
|
|
|
|
istringstream ss(argument);
|
|
|
|
|
LyXLex lex(0,0);
|
|
|
|
|
lex.setStream(ss);
|
|
|
|
|
int const unknown_tokens = defaults.readHeader(lex);
|
|
|
|
|
|
|
|
|
|
if (unknown_tokens != 0) {
|
|
|
|
|
lyxerr << "Warning in LFUN_SAVE_AS_DEFAULT!\n"
|
|
|
|
|
<< unknown_tokens << " unknown token"
|
|
|
|
|
<< (unknown_tokens == 1 ? "" : "s")
|
|
|
|
|
<< endl;
|
|
|
|
|
}
|
2004-10-05 10:11:42 +00:00
|
|
|
|
|
2004-08-08 22:36:34 +00:00
|
|
|
|
if (defaults.writeFile(defaults.fileName()))
|
|
|
|
|
setMessage(_("Document defaults saved in ")
|
|
|
|
|
+ MakeDisplayPath(fname));
|
|
|
|
|
else
|
|
|
|
|
setErrorMessage(_("Unable to save document defaults"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-30 16:19:50 +00:00
|
|
|
|
case LFUN_BUFFERPARAMS_APPLY: {
|
2004-05-17 08:52:21 +00:00
|
|
|
|
biblio::CiteEngine const engine =
|
|
|
|
|
owner->buffer()->params().cite_engine;
|
|
|
|
|
|
2004-03-30 16:19:50 +00:00
|
|
|
|
istringstream ss(argument);
|
|
|
|
|
LyXLex lex(0,0);
|
|
|
|
|
lex.setStream(ss);
|
|
|
|
|
int const unknown_tokens =
|
|
|
|
|
owner->buffer()->readHeader(lex);
|
|
|
|
|
|
|
|
|
|
if (unknown_tokens != 0) {
|
|
|
|
|
lyxerr << "Warning in LFUN_BUFFERPARAMS_APPLY!\n"
|
|
|
|
|
<< unknown_tokens << " unknown token"
|
|
|
|
|
<< (unknown_tokens == 1 ? "" : "s")
|
|
|
|
|
<< endl;
|
|
|
|
|
}
|
2004-05-17 08:52:21 +00:00
|
|
|
|
if (engine == owner->buffer()->params().cite_engine)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
LCursor & cur = view()->cursor();
|
|
|
|
|
FuncRequest fr(LFUN_INSET_REFRESH);
|
|
|
|
|
|
|
|
|
|
InsetBase & inset = owner->buffer()->inset();
|
|
|
|
|
InsetIterator it = inset_iterator_begin(inset);
|
|
|
|
|
InsetIterator const end = inset_iterator_end(inset);
|
|
|
|
|
for (; it != end; ++it)
|
|
|
|
|
if (it->lyxCode() == InsetBase::CITE_CODE)
|
|
|
|
|
it->dispatch(cur, fr);
|
2004-03-30 16:19:50 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LFUN_TEXTCLASS_APPLY: {
|
|
|
|
|
Buffer * buffer = owner->buffer();
|
|
|
|
|
|
|
|
|
|
lyx::textclass_type const old_class =
|
|
|
|
|
buffer->params().textclass;
|
|
|
|
|
|
2004-03-31 09:44:40 +00:00
|
|
|
|
loadTextclass(argument);
|
2004-03-30 16:19:50 +00:00
|
|
|
|
|
|
|
|
|
std::pair<bool, lyx::textclass_type> const tc_pair =
|
|
|
|
|
textclasslist.NumberOfClass(argument);
|
|
|
|
|
|
|
|
|
|
if (!tc_pair.first)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
lyx::textclass_type const new_class = tc_pair.second;
|
|
|
|
|
if (old_class == new_class)
|
|
|
|
|
// nothing to do
|
|
|
|
|
break;
|
|
|
|
|
|
2004-03-31 19:11:56 +00:00
|
|
|
|
owner->message(_("Converting document to new document class..."));
|
2005-09-19 09:55:49 +00:00
|
|
|
|
recordUndoFullDocument(view());
|
|
|
|
|
buffer->params().textclass = new_class;
|
2005-07-15 17:45:36 +00:00
|
|
|
|
StableDocIterator backcur(view()->cursor());
|
2004-03-30 16:19:50 +00:00
|
|
|
|
ErrorList el;
|
2006-05-22 10:12:09 +00:00
|
|
|
|
lyx::cap::switchBetweenClasses(
|
2004-03-30 16:19:50 +00:00
|
|
|
|
old_class, new_class,
|
2006-05-22 10:12:09 +00:00
|
|
|
|
static_cast<InsetText &>(buffer->inset()), el);
|
2004-03-30 16:19:50 +00:00
|
|
|
|
|
2005-07-15 17:45:36 +00:00
|
|
|
|
view()->setCursor(backcur.asDocIterator(&(buffer->inset())));
|
2004-03-30 16:19:50 +00:00
|
|
|
|
bufferErrors(*buffer, el);
|
|
|
|
|
view()->showErrorList(_("Class switch"));
|
2005-04-19 09:04:25 +00:00
|
|
|
|
updateCounters(*buffer);
|
|
|
|
|
update = true;
|
2004-03-30 16:19:50 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-31 09:44:40 +00:00
|
|
|
|
case LFUN_TEXTCLASS_LOAD:
|
|
|
|
|
loadTextclass(argument);
|
2004-03-30 16:19:50 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
|
case LFUN_LYXRC_APPLY: {
|
2005-01-16 21:01:41 +00:00
|
|
|
|
LyXRC const lyxrc_orig = lyxrc;
|
|
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
|
istringstream ss(argument);
|
|
|
|
|
bool const success = lyxrc.read(ss) == 0;
|
2004-04-03 08:37:12 +00:00
|
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
|
if (!success) {
|
|
|
|
|
lyxerr << "Warning in LFUN_LYXRC_APPLY!\n"
|
|
|
|
|
<< "Unable to read lyxrc data"
|
|
|
|
|
<< endl;
|
2005-01-16 21:01:41 +00:00
|
|
|
|
break;
|
2004-03-31 16:50:59 +00:00
|
|
|
|
}
|
2005-01-16 21:01:41 +00:00
|
|
|
|
|
|
|
|
|
actOnUpdatedPrefs(lyxrc_orig, lyxrc);
|
2004-03-31 16:50:59 +00:00
|
|
|
|
break;
|
2004-04-03 08:37:12 +00:00
|
|
|
|
}
|
2004-03-31 16:50:59 +00:00
|
|
|
|
|
2004-03-18 12:53:43 +00:00
|
|
|
|
default: {
|
2004-08-13 14:56:06 +00:00
|
|
|
|
view()->cursor().dispatch(cmd);
|
2005-02-08 02:06:39 +00:00
|
|
|
|
update |= view()->cursor().result().update();
|
2005-07-14 17:30:24 +00:00
|
|
|
|
if (!view()->cursor().result().dispatched())
|
2004-04-07 20:20:15 +00:00
|
|
|
|
update |= view()->dispatch(cmd);
|
2004-01-15 17:34:44 +00:00
|
|
|
|
break;
|
2003-11-10 09:06:48 +00:00
|
|
|
|
}
|
2004-03-18 12:53:43 +00:00
|
|
|
|
}
|
2001-02-23 16:10:03 +00:00
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
if (view()->available()) {
|
2004-08-14 14:03:42 +00:00
|
|
|
|
// Redraw screen unless explicitly told otherwise.
|
|
|
|
|
// This also initializes the position cache for all insets
|
|
|
|
|
// in (at least partially) visible top-level paragraphs.
|
2005-05-31 14:40:30 +00:00
|
|
|
|
if (update)
|
|
|
|
|
view()->update(Update::FitCursor | Update::Force);
|
|
|
|
|
else
|
|
|
|
|
view()->update(Update::FitCursor);
|
2004-11-30 01:59:49 +00:00
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
// if we executed a mutating lfun, mark the buffer as dirty
|
2005-12-23 12:19:56 +00:00
|
|
|
|
if (flag.enabled()
|
|
|
|
|
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)
|
|
|
|
|
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly))
|
2004-03-25 09:16:36 +00:00
|
|
|
|
view()->buffer()->markDirty();
|
|
|
|
|
}
|
2003-03-19 18:43:56 +00:00
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
if (view()->cursor().inTexted()) {
|
|
|
|
|
view()->owner()->updateLayoutChoice();
|
|
|
|
|
}
|
2004-03-18 12:53:43 +00:00
|
|
|
|
}
|
2005-04-05 12:27:04 +00:00
|
|
|
|
sendDispatchMessage(_(getMessage()), cmd);
|
2002-07-18 20:15:29 +00:00
|
|
|
|
}
|
1999-11-22 16:19:48 +00:00
|
|
|
|
|
|
|
|
|
|
2004-11-08 10:54:29 +00:00
|
|
|
|
void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & cmd)
|
2002-07-18 20:15:29 +00:00
|
|
|
|
{
|
2005-09-21 13:18:15 +00:00
|
|
|
|
/* When an action did not originate from the UI/kbd, it makes
|
|
|
|
|
* sense to avoid updating the GUI. It turns out that this
|
|
|
|
|
* fixes bug 1941, for reasons that are described here:
|
|
|
|
|
* http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
|
|
|
|
|
*/
|
|
|
|
|
if (cmd.origin != FuncRequest::INTERNAL) {
|
|
|
|
|
owner->updateMenubar();
|
|
|
|
|
owner->updateToolbars();
|
|
|
|
|
}
|
2002-07-28 18:13:51 +00:00
|
|
|
|
|
2004-11-08 10:54:29 +00:00
|
|
|
|
const bool verbose = (cmd.origin == FuncRequest::UI
|
|
|
|
|
|| cmd.origin == FuncRequest::COMMANDBUFFER);
|
|
|
|
|
|
2004-01-30 11:41:12 +00:00
|
|
|
|
if (cmd.action == LFUN_SELFINSERT || !verbose) {
|
2002-07-18 20:15:29 +00:00
|
|
|
|
lyxerr[Debug::ACTION] << "dispatch msg is " << msg << endl;
|
|
|
|
|
if (!msg.empty())
|
|
|
|
|
owner->message(msg);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2002-07-28 18:13:51 +00:00
|
|
|
|
|
2002-08-07 08:11:41 +00:00
|
|
|
|
string dispatch_msg = msg;
|
2002-07-18 20:15:29 +00:00
|
|
|
|
if (!dispatch_msg.empty())
|
2002-11-27 10:30:28 +00:00
|
|
|
|
dispatch_msg += ' ';
|
2002-07-28 18:13:51 +00:00
|
|
|
|
|
2004-01-30 11:41:12 +00:00
|
|
|
|
string comname = lyxaction.getActionName(cmd.action);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2002-07-18 20:15:29 +00:00
|
|
|
|
bool argsadded = false;
|
|
|
|
|
|
2004-01-30 11:41:12 +00:00
|
|
|
|
if (!cmd.argument.empty()) {
|
|
|
|
|
if (cmd.action != LFUN_UNKNOWN_ACTION) {
|
|
|
|
|
comname += ' ' + cmd.argument;
|
2002-07-18 20:15:29 +00:00
|
|
|
|
argsadded = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-11-22 16:19:48 +00:00
|
|
|
|
|
2004-07-02 10:03:22 +00:00
|
|
|
|
string const shortcuts = toplevel_keymap->printbindings(cmd);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2005-07-14 22:09:22 +00:00
|
|
|
|
if (!shortcuts.empty())
|
2002-07-18 20:15:29 +00:00
|
|
|
|
comname += ": " + shortcuts;
|
2005-07-14 22:09:22 +00:00
|
|
|
|
else if (!argsadded && !cmd.argument.empty())
|
2004-01-30 11:41:12 +00:00
|
|
|
|
comname += ' ' + cmd.argument;
|
2002-07-18 20:15:29 +00:00
|
|
|
|
|
|
|
|
|
if (!comname.empty()) {
|
2002-07-28 22:50:13 +00:00
|
|
|
|
comname = rtrim(comname);
|
2005-07-14 22:09:22 +00:00
|
|
|
|
dispatch_msg += '(' + rtrim(comname) + ')';
|
2002-07-18 20:15:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lyxerr[Debug::ACTION] << "verbose dispatch msg " << dispatch_msg << endl;
|
|
|
|
|
if (!dispatch_msg.empty())
|
|
|
|
|
owner->message(dispatch_msg);
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-28 18:13:51 +00:00
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
void LyXFunc::setupLocalKeymap()
|
|
|
|
|
{
|
2003-11-13 13:43:44 +00:00
|
|
|
|
keyseq.stdmap = toplevel_keymap.get();
|
|
|
|
|
keyseq.curmap = toplevel_keymap.get();
|
|
|
|
|
cancel_meta_seq.stdmap = toplevel_keymap.get();
|
|
|
|
|
cancel_meta_seq.curmap = toplevel_keymap.get();
|
1999-12-16 06:43:25 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
2002-07-11 15:13:21 +00:00
|
|
|
|
void LyXFunc::menuNew(string const & name, bool fromTemplate)
|
1999-12-16 06:43:25 +00:00
|
|
|
|
{
|
2000-10-11 21:06:43 +00:00
|
|
|
|
string initpath = lyxrc.document_path;
|
2002-07-11 15:13:21 +00:00
|
|
|
|
string filename(name);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-08-13 17:43:40 +00:00
|
|
|
|
if (view()->available()) {
|
2002-01-14 23:31:23 +00:00
|
|
|
|
string const trypath = owner->buffer()->filePath();
|
1999-12-16 06:43:25 +00:00
|
|
|
|
// If directory is writeable, use this as default.
|
2001-08-01 10:08:53 +00:00
|
|
|
|
if (IsDirWriteable(trypath))
|
1999-12-16 06:43:25 +00:00
|
|
|
|
initpath = trypath;
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-06-04 23:57:32 +00:00
|
|
|
|
static int newfile_number;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2002-07-11 15:13:21 +00:00
|
|
|
|
if (filename.empty()) {
|
|
|
|
|
filename = AddName(lyxrc.document_path,
|
2005-01-06 15:40:49 +00:00
|
|
|
|
"newfile" + convert<string>(++newfile_number) + ".lyx");
|
2005-01-31 10:42:26 +00:00
|
|
|
|
while (bufferlist.exists(filename) || fs::is_readable(filename)) {
|
2000-08-08 11:08:07 +00:00
|
|
|
|
++newfile_number;
|
2002-07-11 15:13:21 +00:00
|
|
|
|
filename = AddName(lyxrc.document_path,
|
2005-01-06 15:40:49 +00:00
|
|
|
|
"newfile" + convert<string>(newfile_number) +
|
2000-10-02 16:44:47 +00:00
|
|
|
|
".lyx");
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
1999-12-16 06:43:25 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
// The template stuff
|
|
|
|
|
string templname;
|
|
|
|
|
if (fromTemplate) {
|
2003-02-21 12:22:25 +00:00
|
|
|
|
FileDialog fileDlg(_("Select template file"),
|
2001-03-07 14:25:31 +00:00
|
|
|
|
LFUN_SELECT_FILE_SYNC,
|
2002-01-13 15:01:25 +00:00
|
|
|
|
make_pair(string(_("Documents|#o#O")),
|
2001-04-17 15:15:59 +00:00
|
|
|
|
string(lyxrc.document_path)),
|
2002-01-13 15:01:25 +00:00
|
|
|
|
make_pair(string(_("Templates|#T#t")),
|
2001-04-17 15:15:59 +00:00
|
|
|
|
string(lyxrc.template_path)));
|
|
|
|
|
|
|
|
|
|
FileDialog::Result result =
|
2002-11-17 08:32:09 +00:00
|
|
|
|
fileDlg.open(lyxrc.template_path,
|
2004-01-08 10:59:51 +00:00
|
|
|
|
FileFilterList(_("LyX Documents (*.lyx)")),
|
|
|
|
|
string());
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
|
if (result.first == FileDialog::Later)
|
|
|
|
|
return;
|
2003-11-13 13:43:44 +00:00
|
|
|
|
if (result.second.empty())
|
2001-03-07 14:25:31 +00:00
|
|
|
|
return;
|
2003-11-13 13:43:44 +00:00
|
|
|
|
templname = result.second;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2006-08-12 12:31:19 +00:00
|
|
|
|
Buffer * const b = newFile(filename, templname, !name.empty());
|
|
|
|
|
if (b)
|
|
|
|
|
view()->setBuffer(b);
|
1999-12-16 06:43:25 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
2001-07-16 15:42:57 +00:00
|
|
|
|
void LyXFunc::open(string const & fname)
|
1999-12-16 06:43:25 +00:00
|
|
|
|
{
|
2000-03-12 10:35:05 +00:00
|
|
|
|
string initpath = lyxrc.document_path;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2002-08-13 17:43:40 +00:00
|
|
|
|
if (view()->available()) {
|
2002-01-14 23:31:23 +00:00
|
|
|
|
string const trypath = owner->buffer()->filePath();
|
1999-12-16 06:43:25 +00:00
|
|
|
|
// If directory is writeable, use this as default.
|
2001-08-01 10:08:53 +00:00
|
|
|
|
if (IsDirWriteable(trypath))
|
1999-12-16 06:43:25 +00:00
|
|
|
|
initpath = trypath;
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
|
string filename;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
|
if (fname.empty()) {
|
2003-02-21 12:22:25 +00:00
|
|
|
|
FileDialog fileDlg(_("Select document to open"),
|
2001-03-07 14:25:31 +00:00
|
|
|
|
LFUN_FILE_OPEN,
|
2002-01-13 15:01:25 +00:00
|
|
|
|
make_pair(string(_("Documents|#o#O")),
|
2001-04-17 15:15:59 +00:00
|
|
|
|
string(lyxrc.document_path)),
|
2002-01-13 15:01:25 +00:00
|
|
|
|
make_pair(string(_("Examples|#E#e")),
|
2005-01-10 19:17:43 +00:00
|
|
|
|
string(AddPath(package().system_support(), "examples"))));
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
|
|
|
|
FileDialog::Result result =
|
2002-11-17 08:32:09 +00:00
|
|
|
|
fileDlg.open(initpath,
|
2004-01-08 10:59:51 +00:00
|
|
|
|
FileFilterList(_("LyX Documents (*.lyx)")),
|
|
|
|
|
string());
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
|
if (result.first == FileDialog::Later)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
filename = result.second;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-03-07 14:25:31 +00:00
|
|
|
|
// check selected filename
|
|
|
|
|
if (filename.empty()) {
|
2001-04-24 17:33:01 +00:00
|
|
|
|
owner->message(_("Canceled."));
|
2001-03-07 14:25:31 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
filename = fname;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-06-27 14:10:35 +00:00
|
|
|
|
// get absolute path of file and add ".lyx" to the filename if
|
|
|
|
|
// necessary
|
2001-08-01 10:08:53 +00:00
|
|
|
|
string const fullpath = FileSearch(string(), filename, "lyx");
|
2002-08-01 22:26:30 +00:00
|
|
|
|
if (!fullpath.empty()) {
|
|
|
|
|
filename = fullpath;
|
2001-08-01 10:08:53 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-06-14 17:58:49 +00:00
|
|
|
|
string const disp_fn(MakeDisplayPath(filename));
|
|
|
|
|
|
2002-08-01 22:26:30 +00:00
|
|
|
|
// if the file doesn't exist, let the user create one
|
2005-01-31 10:42:26 +00:00
|
|
|
|
if (!fs::exists(filename)) {
|
2006-08-12 12:31:19 +00:00
|
|
|
|
// the user specifically chose this name. Believe him.
|
|
|
|
|
Buffer * const b = newFile(filename, string(), true);
|
|
|
|
|
if (b)
|
|
|
|
|
view()->setBuffer(b);
|
2002-08-01 22:26:30 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-13 09:48:57 +00:00
|
|
|
|
owner->message(bformat(_("Opening document %1$s..."), disp_fn));
|
2001-06-14 17:58:49 +00:00
|
|
|
|
|
2003-05-13 09:48:57 +00:00
|
|
|
|
string str2;
|
2003-06-20 12:46:28 +00:00
|
|
|
|
if (view()->loadLyXFile(filename)) {
|
2003-05-13 09:48:57 +00:00
|
|
|
|
str2 = bformat(_("Document %1$s opened."), disp_fn);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
} else {
|
2003-05-13 09:48:57 +00:00
|
|
|
|
str2 = bformat(_("Could not open document %1$s"), disp_fn);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2003-05-13 09:48:57 +00:00
|
|
|
|
owner->message(str2);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-14 02:01:57 +00:00
|
|
|
|
|
2000-10-23 12:16:05 +00:00
|
|
|
|
void LyXFunc::doImport(string const & argument)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2000-10-23 12:16:05 +00:00
|
|
|
|
string format;
|
|
|
|
|
string filename = split(argument, format, ' ');
|
2002-05-30 19:49:00 +00:00
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format
|
2001-06-27 14:10:35 +00:00
|
|
|
|
<< " file: " << filename << endl;
|
2002-06-24 20:28:12 +00:00
|
|
|
|
|
2002-05-30 19:49:00 +00:00
|
|
|
|
// need user interaction
|
|
|
|
|
if (filename.empty()) {
|
2000-04-28 11:18:04 +00:00
|
|
|
|
string initpath = lyxrc.document_path;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2002-08-13 17:43:40 +00:00
|
|
|
|
if (view()->available()) {
|
2002-01-14 23:31:23 +00:00
|
|
|
|
string const trypath = owner->buffer()->filePath();
|
2000-04-28 11:18:04 +00:00
|
|
|
|
// If directory is writeable, use this as default.
|
2001-08-01 10:08:53 +00:00
|
|
|
|
if (IsDirWriteable(trypath))
|
2000-04-28 11:18:04 +00:00
|
|
|
|
initpath = trypath;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-13 09:48:57 +00:00
|
|
|
|
string const text = bformat(_("Select %1$s file to import"),
|
|
|
|
|
formats.prettyName(format));
|
2001-03-07 14:25:31 +00:00
|
|
|
|
|
2003-02-21 12:22:25 +00:00
|
|
|
|
FileDialog fileDlg(text,
|
2001-03-07 14:25:31 +00:00
|
|
|
|
LFUN_IMPORT,
|
2002-01-13 15:01:25 +00:00
|
|
|
|
make_pair(string(_("Documents|#o#O")),
|
2001-04-17 15:15:59 +00:00
|
|
|
|
string(lyxrc.document_path)),
|
2002-01-13 15:01:25 +00:00
|
|
|
|
make_pair(string(_("Examples|#E#e")),
|
2005-01-10 19:17:43 +00:00
|
|
|
|
string(AddPath(package().system_support(), "examples"))));
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2004-01-08 10:59:51 +00:00
|
|
|
|
string const filter = formats.prettyName(format)
|
2002-11-27 10:30:28 +00:00
|
|
|
|
+ " (*." + formats.extension(format) + ')';
|
2001-03-07 14:25:31 +00:00
|
|
|
|
|
2004-01-08 10:59:51 +00:00
|
|
|
|
FileDialog::Result result =
|
|
|
|
|
fileDlg.open(initpath,
|
|
|
|
|
FileFilterList(filter),
|
|
|
|
|
string());
|
2001-03-07 14:25:31 +00:00
|
|
|
|
|
|
|
|
|
if (result.first == FileDialog::Later)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
filename = result.second;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2000-04-28 11:18:04 +00:00
|
|
|
|
// check selected filename
|
2001-04-17 15:15:59 +00:00
|
|
|
|
if (filename.empty())
|
2001-04-24 17:33:01 +00:00
|
|
|
|
owner->message(_("Canceled."));
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (filename.empty())
|
2000-04-28 11:18:04 +00:00
|
|
|
|
return;
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// get absolute path of file
|
|
|
|
|
filename = MakeAbsPath(filename);
|
|
|
|
|
|
2000-11-14 02:01:57 +00:00
|
|
|
|
string const lyxfile = ChangeExtension(filename, ".lyx");
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
// Check if the document already is open
|
2003-03-31 02:59:34 +00:00
|
|
|
|
if (lyx_gui::use_gui && bufferlist.exists(lyxfile)) {
|
2003-04-26 15:24:56 +00:00
|
|
|
|
if (!bufferlist.close(bufferlist.getBuffer(lyxfile), true)) {
|
2003-03-29 07:09:13 +00:00
|
|
|
|
owner->message(_("Canceled."));
|
|
|
|
|
return;
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-06-24 20:28:12 +00:00
|
|
|
|
// if the file exists already, and we didn't do
|
2002-05-30 19:49:00 +00:00
|
|
|
|
// -i lyx thefile.lyx, warn
|
2005-01-31 10:42:26 +00:00
|
|
|
|
if (fs::exists(lyxfile) && filename != lyxfile) {
|
2003-03-29 07:09:13 +00:00
|
|
|
|
string const file = MakeDisplayPath(lyxfile, 30);
|
|
|
|
|
|
2003-05-13 09:48:57 +00:00
|
|
|
|
string text = bformat(_("The document %1$s already exists.\n\n"
|
|
|
|
|
"Do you want to over-write that document?"), file);
|
2003-03-29 07:09:13 +00:00
|
|
|
|
int const ret = Alert::prompt(_("Over-write document?"),
|
2003-04-27 16:40:50 +00:00
|
|
|
|
text, 0, 1, _("&Over-write"), _("&Cancel"));
|
2003-03-29 07:09:13 +00:00
|
|
|
|
|
|
|
|
|
if (ret == 1) {
|
2003-01-06 14:02:24 +00:00
|
|
|
|
owner->message(_("Canceled."));
|
2002-05-30 19:49:00 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2000-10-23 12:16:05 +00:00
|
|
|
|
Importer::Import(owner, filename, format);
|
2000-03-20 18:55:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-07-16 15:42:57 +00:00
|
|
|
|
void LyXFunc::closeBuffer()
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2003-03-29 07:09:13 +00:00
|
|
|
|
if (bufferlist.close(owner->buffer(), true) && !quitting) {
|
1999-11-05 06:02:34 +00:00
|
|
|
|
if (bufferlist.empty()) {
|
2003-07-25 17:11:25 +00:00
|
|
|
|
// need this otherwise SEGV may occur while
|
2003-07-11 12:21:31 +00:00
|
|
|
|
// trying to set variables that don't exist
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// since there's no current buffer
|
2002-08-13 14:40:38 +00:00
|
|
|
|
owner->getDialogs().hideBufferDependent();
|
2000-11-14 02:01:57 +00:00
|
|
|
|
} else {
|
2004-03-18 12:53:43 +00:00
|
|
|
|
view()->setBuffer(bufferlist.first());
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Each "owner" should have it's own message method. lyxview and
|
|
|
|
|
// the minibuffer would use the minibuffer, but lyxserver would
|
|
|
|
|
// send an ERROR signal to its client. Alejandro 970603
|
2004-01-30 11:41:12 +00:00
|
|
|
|
// This function is bit problematic when it comes to NLS, to make the
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// lyx servers client be language indepenent we must not translate
|
|
|
|
|
// strings sent to this func.
|
1999-11-22 16:19:48 +00:00
|
|
|
|
void LyXFunc::setErrorMessage(string const & m) const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
dispatch_buffer = m;
|
|
|
|
|
errorstat = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
void LyXFunc::setMessage(string const & m) const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
dispatch_buffer = m;
|
|
|
|
|
}
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
|
|
|
|
|
2004-02-20 08:44:11 +00:00
|
|
|
|
string const LyXFunc::viewStatusMessage()
|
2001-04-17 15:15:59 +00:00
|
|
|
|
{
|
|
|
|
|
// When meta-fake key is pressed, show the key sequence so far + "M-".
|
2004-02-20 08:44:11 +00:00
|
|
|
|
if (wasMetaKey())
|
2002-07-18 20:15:29 +00:00
|
|
|
|
return keyseq.print() + "M-";
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
|
|
|
|
// Else, when a non-complete key sequence is pressed,
|
|
|
|
|
// show the available options.
|
2004-02-20 08:44:11 +00:00
|
|
|
|
if (keyseq.length() > 0 && !keyseq.deleted())
|
2002-07-18 20:15:29 +00:00
|
|
|
|
return keyseq.printOptions();
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2002-08-13 17:43:40 +00:00
|
|
|
|
if (!view()->available())
|
2002-07-18 20:15:29 +00:00
|
|
|
|
return _("Welcome to LyX!");
|
2002-07-28 18:13:51 +00:00
|
|
|
|
|
2004-02-13 07:30:59 +00:00
|
|
|
|
return view()->cursor().currentState();
|
2002-08-13 17:43:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BufferView * LyXFunc::view() const
|
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(owner);
|
2002-08-13 17:43:40 +00:00
|
|
|
|
return owner->view().get();
|
2001-04-17 15:15:59 +00:00
|
|
|
|
}
|
2003-07-28 22:34:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool LyXFunc::wasMetaKey() const
|
|
|
|
|
{
|
|
|
|
|
return (meta_fake_bit != key_modifier::none);
|
|
|
|
|
}
|
2005-01-16 21:01:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
|
|
|
|
{
|
|
|
|
|
// Why the switch you might ask. It is a trick to ensure that all
|
|
|
|
|
// the elements in the LyXRCTags enum is handled. As you can see
|
|
|
|
|
// there are no breaks at all. So it is just a huge fall-through.
|
|
|
|
|
// The nice thing is that we will get a warning from the compiler
|
|
|
|
|
// if we forget an element.
|
|
|
|
|
LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
|
|
|
|
|
switch (tag) {
|
|
|
|
|
case LyXRC::RC_ACCEPT_COMPOUND:
|
|
|
|
|
case LyXRC::RC_ALT_LANG:
|
|
|
|
|
case LyXRC::RC_ASCIIROFF_COMMAND:
|
|
|
|
|
case LyXRC::RC_ASCII_LINELEN:
|
|
|
|
|
case LyXRC::RC_AUTOREGIONDELETE:
|
|
|
|
|
case LyXRC::RC_AUTORESET_OPTIONS:
|
|
|
|
|
case LyXRC::RC_AUTOSAVE:
|
|
|
|
|
case LyXRC::RC_AUTO_NUMBER:
|
|
|
|
|
case LyXRC::RC_BACKUPDIR_PATH:
|
|
|
|
|
case LyXRC::RC_BIBTEX_COMMAND:
|
|
|
|
|
case LyXRC::RC_BINDFILE:
|
|
|
|
|
case LyXRC::RC_CHECKLASTFILES:
|
|
|
|
|
case LyXRC::RC_CHKTEX_COMMAND:
|
|
|
|
|
case LyXRC::RC_CONVERTER:
|
|
|
|
|
case LyXRC::RC_COPIER:
|
|
|
|
|
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
|
|
|
|
|
case LyXRC::RC_CUSTOM_EXPORT_COMMAND:
|
|
|
|
|
case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
|
|
|
|
|
case LyXRC::RC_DATE_INSERT_FORMAT:
|
|
|
|
|
case LyXRC::RC_DEFAULT_LANGUAGE:
|
|
|
|
|
case LyXRC::RC_DEFAULT_PAPERSIZE:
|
|
|
|
|
case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
|
|
|
|
|
case LyXRC::RC_DISPLAY_GRAPHICS:
|
|
|
|
|
case LyXRC::RC_DOCUMENTPATH:
|
|
|
|
|
if (lyxrc_orig.document_path != lyxrc_new.document_path) {
|
2005-01-31 10:42:26 +00:00
|
|
|
|
if (fs::exists(lyxrc_new.document_path) &&
|
|
|
|
|
fs::is_directory(lyxrc_new.document_path)) {
|
2005-01-16 21:01:41 +00:00
|
|
|
|
using lyx::support::package;
|
|
|
|
|
package().document_dir() = lyxrc.document_path;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
case LyXRC::RC_ESC_CHARS:
|
|
|
|
|
case LyXRC::RC_FONT_ENCODING:
|
|
|
|
|
case LyXRC::RC_FORMAT:
|
|
|
|
|
case LyXRC::RC_INDEX_COMMAND:
|
|
|
|
|
case LyXRC::RC_INPUT:
|
|
|
|
|
case LyXRC::RC_KBMAP:
|
|
|
|
|
case LyXRC::RC_KBMAP_PRIMARY:
|
|
|
|
|
case LyXRC::RC_KBMAP_SECONDARY:
|
|
|
|
|
case LyXRC::RC_LABEL_INIT_LENGTH:
|
|
|
|
|
case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
|
|
|
|
|
case LyXRC::RC_LANGUAGE_AUTO_END:
|
|
|
|
|
case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
|
|
|
|
|
case LyXRC::RC_LANGUAGE_COMMAND_END:
|
|
|
|
|
case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
|
|
|
|
|
case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
|
|
|
|
|
case LyXRC::RC_LANGUAGE_PACKAGE:
|
|
|
|
|
case LyXRC::RC_LANGUAGE_USE_BABEL:
|
|
|
|
|
case LyXRC::RC_LASTFILES:
|
|
|
|
|
case LyXRC::RC_MAKE_BACKUP:
|
|
|
|
|
case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
|
|
|
|
|
case LyXRC::RC_NUMLASTFILES:
|
|
|
|
|
case LyXRC::RC_PATH_PREFIX:
|
|
|
|
|
if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
|
|
|
|
|
using lyx::support::prependEnvPath;
|
|
|
|
|
prependEnvPath("PATH", lyxrc.path_prefix);
|
|
|
|
|
}
|
|
|
|
|
case LyXRC::RC_PERS_DICT:
|
|
|
|
|
case LyXRC::RC_POPUP_BOLD_FONT:
|
|
|
|
|
case LyXRC::RC_POPUP_FONT_ENCODING:
|
|
|
|
|
case LyXRC::RC_POPUP_NORMAL_FONT:
|
|
|
|
|
case LyXRC::RC_PREVIEW:
|
|
|
|
|
case LyXRC::RC_PREVIEW_HASHED_LABELS:
|
|
|
|
|
case LyXRC::RC_PREVIEW_SCALE_FACTOR:
|
|
|
|
|
case LyXRC::RC_PRINTCOLLCOPIESFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTCOPIESFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTER:
|
|
|
|
|
case LyXRC::RC_PRINTEVENPAGEFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTEXSTRAOPTIONS:
|
|
|
|
|
case LyXRC::RC_PRINTFILEEXTENSION:
|
|
|
|
|
case LyXRC::RC_PRINTLANDSCAPEFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTODDPAGEFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTPAGERANGEFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTPAPERFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTREVERSEFLAG:
|
|
|
|
|
case LyXRC::RC_PRINTSPOOL_COMMAND:
|
|
|
|
|
case LyXRC::RC_PRINTSPOOL_PRINTERPREFIX:
|
|
|
|
|
case LyXRC::RC_PRINTTOFILE:
|
|
|
|
|
case LyXRC::RC_PRINTTOPRINTER:
|
|
|
|
|
case LyXRC::RC_PRINT_ADAPTOUTPUT:
|
|
|
|
|
case LyXRC::RC_PRINT_COMMAND:
|
|
|
|
|
case LyXRC::RC_RTL_SUPPORT:
|
|
|
|
|
case LyXRC::RC_SCREEN_DPI:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_ENCODING:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_ROMAN:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_SANS:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_SCALABLE:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_SIZES:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
|
|
|
|
|
case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
|
|
|
|
|
case LyXRC::RC_SCREEN_ZOOM:
|
|
|
|
|
case LyXRC::RC_SERVERPIPE:
|
|
|
|
|
case LyXRC::RC_SET_COLOR:
|
|
|
|
|
case LyXRC::RC_SHOW_BANNER:
|
|
|
|
|
case LyXRC::RC_SPELL_COMMAND:
|
|
|
|
|
case LyXRC::RC_TEMPDIRPATH:
|
|
|
|
|
case LyXRC::RC_TEMPLATEPATH:
|
2005-04-19 09:04:25 +00:00
|
|
|
|
case LyXRC::RC_TEX_ALLOWS_SPACES:
|
2006-06-27 10:54:14 +00:00
|
|
|
|
case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
|
|
|
|
|
if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
|
|
|
|
|
namespace os = lyx::support::os;
|
|
|
|
|
os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
|
|
|
|
|
}
|
2005-01-16 21:01:41 +00:00
|
|
|
|
case LyXRC::RC_UIFILE:
|
|
|
|
|
case LyXRC::RC_USER_EMAIL:
|
|
|
|
|
case LyXRC::RC_USER_NAME:
|
|
|
|
|
case LyXRC::RC_USETEMPDIR:
|
|
|
|
|
case LyXRC::RC_USE_ALT_LANG:
|
|
|
|
|
case LyXRC::RC_USE_ESC_CHARS:
|
|
|
|
|
case LyXRC::RC_USE_INP_ENC:
|
|
|
|
|
case LyXRC::RC_USE_PERS_DICT:
|
|
|
|
|
case LyXRC::RC_USE_SPELL_LIB:
|
|
|
|
|
case LyXRC::RC_VIEWDVI_PAPEROPTION:
|
|
|
|
|
case LyXRC::RC_VIEWER:
|
|
|
|
|
case LyXRC::RC_WHEEL_JUMP:
|
|
|
|
|
case LyXRC::RC_LAST:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace anon
|