2003-08-23 00:17:00 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file LyXFunc.cpp
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Alfredo Braunstein
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
* \author Angus Leeming
|
|
|
|
* \author John Levon
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Allan Rae
|
|
|
|
* \author Dekel Tsur
|
|
|
|
* \author Martin Vermeer
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jü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
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "LyXFunc.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
2008-03-07 03:53:21 +00:00
|
|
|
#include "LayoutFile.h"
|
2003-09-09 17:00:19 +00:00
|
|
|
#include "BranchList.h"
|
2003-06-20 12:46:28 +00:00
|
|
|
#include "buffer_funcs.h"
|
2007-09-19 22:37:22 +00:00
|
|
|
#include "Buffer.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "BufferList.h"
|
|
|
|
#include "BufferParams.h"
|
2007-09-19 22:37:22 +00:00
|
|
|
#include "BufferView.h"
|
2007-10-20 23:27:03 +00:00
|
|
|
#include "CmdDef.h"
|
2007-11-02 23:42:27 +00:00
|
|
|
#include "Color.h"
|
2007-10-25 06:09:38 +00:00
|
|
|
#include "Converter.h"
|
2007-04-26 14:56:30 +00:00
|
|
|
#include "Cursor.h"
|
2004-03-30 16:19:50 +00:00
|
|
|
#include "CutAndPaste.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "DispatchResult.h"
|
|
|
|
#include "Encoding.h"
|
|
|
|
#include "ErrorList.h"
|
|
|
|
#include "Format.h"
|
|
|
|
#include "FuncRequest.h"
|
2006-10-12 14:10:13 +00:00
|
|
|
#include "FuncStatus.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "InsetIterator.h"
|
|
|
|
#include "Intl.h"
|
2007-04-27 08:05:58 +00:00
|
|
|
#include "KeyMap.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Language.h"
|
2007-09-19 22:37:22 +00:00
|
|
|
#include "Lexer.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
#include "LyXAction.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
#include "lyxfind.h"
|
2007-09-19 22:37:22 +00:00
|
|
|
#include "LyX.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "LyXRC.h"
|
|
|
|
#include "LyXVC.h"
|
|
|
|
#include "Paragraph.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
#include "ParagraphParameters.h"
|
2007-09-19 22:37:22 +00:00
|
|
|
#include "ParIterator.h"
|
|
|
|
#include "Row.h"
|
|
|
|
#include "Server.h"
|
|
|
|
#include "Session.h"
|
2009-08-08 17:26:18 +00:00
|
|
|
#include "SpellChecker.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetBox.h"
|
|
|
|
#include "insets/InsetBranch.h"
|
|
|
|
#include "insets/InsetCommand.h"
|
|
|
|
#include "insets/InsetERT.h"
|
|
|
|
#include "insets/InsetExternal.h"
|
|
|
|
#include "insets/InsetFloat.h"
|
|
|
|
#include "insets/InsetGraphics.h"
|
|
|
|
#include "insets/InsetInclude.h"
|
2008-06-24 07:37:14 +00:00
|
|
|
#include "insets/InsetListings.h"
|
|
|
|
#include "insets/InsetNote.h"
|
2009-01-30 00:56:37 +00:00
|
|
|
#include "insets/InsetPhantom.h"
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
#include "insets/InsetSpace.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "insets/InsetTabular.h"
|
|
|
|
#include "insets/InsetVSpace.h"
|
|
|
|
#include "insets/InsetWrap.h"
|
2001-12-10 20:06:59 +00:00
|
|
|
|
2007-04-28 20:44:46 +00:00
|
|
|
#include "frontends/alert.h"
|
2007-11-18 00:01:14 +00:00
|
|
|
#include "frontends/Application.h"
|
2007-04-27 08:43:38 +00:00
|
|
|
#include "frontends/KeySymbol.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
#include "frontends/LyXView.h"
|
2007-07-06 17:03:45 +00:00
|
|
|
#include "frontends/Selection.h"
|
2002-02-27 09:59:52 +00:00
|
|
|
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/debug.h"
|
2005-02-15 13:45:41 +00:00
|
|
|
#include "support/environment.h"
|
2007-11-19 12:03:38 +00:00
|
|
|
#include "support/FileName.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
#include "support/filetools.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/gettext.h"
|
2004-03-28 14:12:33 +00:00
|
|
|
#include "support/lstrings.h"
|
Rename files in src/support, step one.
src/support/package.h src/support/Package.h Package
src/support/package.C.in src/support/Package.C.in Package
src/support/path.h src/support/Path.h Path
src/support/fs_extras.h src/support/fs_extras.h NOCLASSES
src/support/RandomAccessList.h src/support/RandomAccessList.h RandomAccessList
src/support/lyxmanip.h src/support/lyxmanip.h NOCLASSES
src/support/rename.C src/support/rename.cpp NOCLASSES
src/support/abort.C src/support/abort.cpp NOCLASSES
src/support/lyxlib.h src/support/lyxlib.h NOCLASSES
src/support/ExceptionMessage.h src/support/ExceptionMessage.h ExceptionMessage
src/support/copy.C src/support/copy.cpp NOCLASSES
src/support/limited_stack.h src/support/limited_stack.h limited_stack
src/support/filefilterlist.C src/support/FileFilterList.cpp ['FileFilterList', 'Filter']
src/support/cow_ptr.h src/support/cow_ptr.h cow_ptr
src/support/os_unix.C src/support/os_unix.cpp NOCLASSES
src/support/socktools.h src/support/socktools.h NOCLASSES
src/support/forkedcontr.h src/support/ForkedcallsController.h ForkedcallsController
src/support/os.h src/support/os.h NOCLASSES
src/support/FileMonitor.h src/support/FileMonitor.h FileMonitor
src/support/copied_ptr.h src/support/copied_ptr.h copied_ptr
src/support/translator.h src/support/Translator.h Translator
src/support/filetools.C src/support/filetools.cpp NOCLASSES
src/support/unlink.C src/support/unlink.cpp NOCLASSES
src/support/os_win32.C src/support/os_win32.cpp GetFolderPath
src/support/lstrings.C src/support/lstrings.cpp NOCLASSES
src/support/qstring_helpers.C src/support/qstring_helpers.cpp NOCLASSES
src/support/getcwd.C src/support/getcwd.cpp NOCLASSES
src/support/systemcall.C src/support/Systemcall.cpp Systemcall
src/support/lyxalgo.h src/support/lyxalgo.h NOCLASSES
src/support/filefilterlist.h src/support/FileFilterList.h ['FileFilterList', 'Filter']
src/support/unicode.C src/support/unicode.cpp IconvProcessor
src/support/userinfo.C src/support/userinfo.cpp NOCLASSES
src/support/lyxtime.C src/support/lyxtime.cpp NOCLASSES
src/support/kill.C src/support/kill.cpp NOCLASSES
src/support/docstring.C src/support/docstring.cpp to_local8bit_failure
src/support/os_cygwin.C src/support/os_cygwin.cpp NOCLASSES
src/support/lyxsum.C src/support/lyxsum.cpp NOCLASSES
src/support/environment.C src/support/environment.cpp NOCLASSES
src/support/filetools.h src/support/filetools.h NOCLASSES
src/support/textutils.C src/support/textutils.cpp NOCLASSES
src/support/mkdir.C src/support/mkdir.cpp NOCLASSES
src/support/forkedcall.C src/support/Forkedcall.cpp ['ForkedProcess', 'Forkedcall']
src/support/tempname.C src/support/tempname.cpp NOCLASSES
src/support/os_win32.h src/support/os_win32.h GetFolderPath
src/support/types.h src/support/types.h NOCLASSES
src/support/lstrings.h src/support/lstrings.h NOCLASSES
src/support/forkedcallqueue.C src/support/ForkedCallQueue.cpp ForkedCallQueue
src/support/qstring_helpers.h src/support/qstring_helpers.h NOCLASSES
src/support/convert.C src/support/convert.cpp NOCLASSES
src/support/filename.C src/support/FileName.cpp ['FileName', 'DocFileName']
src/support/tests/convert.C src/support/tests/convert.cpp NOCLASSES
src/support/tests/filetools.C src/support/tests/filetools.cpp NOCLASSES
src/support/tests/lstrings.C src/support/tests/lstrings.cpp NOCLASSES
src/support/tests/boost.C src/support/tests/boost.cpp NOCLASSES
src/support/docstream.C src/support/docstream.cpp ['iconv_codecvt_facet_exception', 'idocfstream', 'odocfstream']
src/support/std_istream.h src/support/std_istream.h NOCLASSES
src/support/systemcall.h src/support/Systemcall.h Systemcall
src/support/chdir.C src/support/chdir.cpp NOCLASSES
src/support/std_ostream.h src/support/std_ostream.h NOCLASSES
src/support/unicode.h src/support/unicode.h IconvProcessor
src/support/path.C src/support/Path.cpp Path
src/support/fs_extras.C src/support/fs_extras.cpp NOCLASSES
src/support/userinfo.h src/support/userinfo.h NOCLASSES
src/support/lyxtime.h src/support/lyxtime.h NOCLASSES
src/support/docstring.h src/support/docstring.h to_local8bit_failure
src/support/debugstream.h src/support/debugstream.h basic_debugstream
src/support/environment.h src/support/environment.h NOCLASSES
src/support/textutils.h src/support/textutils.h NOCLASSES
src/support/forkedcall.h src/support/Forkedcall.h ['ForkedProcess', 'Forkedcall']
src/support/socktools.C src/support/socktools.cpp NOCLASSES
src/support/forkedcallqueue.h src/support/ForkedCallQueue.h ForkedCallQueue
src/support/forkedcontr.C src/support/ForkedcallsController.cpp ForkedcallsController
src/support/os.C src/support/os.cpp NOCLASSES
src/support/convert.h src/support/convert.h NOCLASSES
src/support/filename.h src/support/FileName.h ['FileName', 'DocFileName']
src/support/docstream.h src/support/docstream.h ['iconv_codecvt_facet_exception', 'idocfstream', 'odocfstream']
src/support/FileMonitor.C src/support/FileMonitor.cpp FileMonitor
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18024 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-26 05:12:52 +00:00
|
|
|
#include "support/Path.h"
|
|
|
|
#include "support/Package.h"
|
|
|
|
#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
|
|
|
|
2004-07-24 10:55:30 +00:00
|
|
|
#include <sstream>
|
2008-02-19 09:10:59 +00:00
|
|
|
#include <vector>
|
2004-07-24 10:55:30 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
using namespace lyx::support;
|
2007-08-14 08:53:34 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
using frontend::LyXView;
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace Alert = frontend::Alert;
|
2004-05-19 15:11:37 +00:00
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
namespace {
|
|
|
|
|
2007-10-25 06:09:38 +00:00
|
|
|
|
2007-10-03 18:34:32 +00:00
|
|
|
// This function runs "configure" and then rereads lyx.defaults to
|
|
|
|
// reconfigure the automatic settings.
|
2008-03-14 16:33:16 +00:00
|
|
|
void reconfigure(LyXView * lv, string const & option)
|
2007-10-03 18:34:32 +00:00
|
|
|
{
|
|
|
|
// emit message signal.
|
2008-03-14 16:33:16 +00:00
|
|
|
if (lv)
|
|
|
|
lv->message(_("Running configure..."));
|
2007-10-03 18:34:32 +00:00
|
|
|
|
|
|
|
// Run configure in user lyx directory
|
2007-12-12 19:57:42 +00:00
|
|
|
PathChanger p(package().user_support());
|
2007-10-03 18:34:32 +00:00
|
|
|
string configure_command = package().configure_command();
|
|
|
|
configure_command += option;
|
|
|
|
Systemcall one;
|
2007-10-14 14:51:05 +00:00
|
|
|
int ret = one.startscript(Systemcall::Wait, configure_command);
|
2007-10-03 18:34:32 +00:00
|
|
|
p.pop();
|
|
|
|
// emit message signal.
|
2008-03-14 16:33:16 +00:00
|
|
|
if (lv)
|
|
|
|
lv->message(_("Reloading configuration..."));
|
2007-12-12 19:57:42 +00:00
|
|
|
lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
|
2007-10-03 18:34:32 +00:00
|
|
|
// Re-read packages.lst
|
|
|
|
LaTeXFeatures::getAvailable();
|
|
|
|
|
2007-10-14 14:51:05 +00:00
|
|
|
if (ret)
|
|
|
|
Alert::information(_("System reconfiguration failed"),
|
|
|
|
_("The system reconfiguration has failed.\n"
|
|
|
|
"Default textclass is used but LyX may "
|
|
|
|
"not be able to work properly.\n"
|
|
|
|
"Please reconfigure again if needed."));
|
|
|
|
else
|
|
|
|
|
|
|
|
Alert::information(_("System reconfigured"),
|
2007-10-03 18:34:32 +00:00
|
|
|
_("The system has been reconfigured.\n"
|
|
|
|
"You need to restart LyX to make use of any\n"
|
|
|
|
"updated document class specifications."));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-29 11:00:18 +00:00
|
|
|
bool getLocalStatus(Cursor cursor, FuncRequest const & cmd, FuncStatus & status)
|
2005-01-05 20:21:27 +00:00
|
|
|
{
|
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)
|
2007-04-26 14:56:30 +00:00
|
|
|
//Cursor safe = *this;
|
2005-01-05 20:21:27 +00:00
|
|
|
bool res = false;
|
2005-02-08 13:18:05 +00:00
|
|
|
for ( ; cursor.depth(); cursor.pop()) {
|
2007-04-26 14:56:30 +00:00
|
|
|
//lyxerr << "\nCursor::getStatus: cmd: " << cmd << endl << *this << endl;
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(cursor.idx() <= cursor.lastidx(), /**/);
|
|
|
|
LASSERT(cursor.pit() <= cursor.lastpit(), /**/);
|
|
|
|
LASSERT(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.
|
|
|
|
*/
|
2006-05-05 23:11:19 +00:00
|
|
|
Change::Type lookupChangeType(DocIterator const & dit, bool outer = false)
|
2005-09-07 10:37:05 +00:00
|
|
|
{
|
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];
|
2006-04-05 23:56:29 +00:00
|
|
|
if (!slice.inset().inMathed()
|
2005-09-07 10:37:05 +00:00
|
|
|
&& slice.pos() < slice.paragraph().size()) {
|
2006-05-08 20:30:52 +00:00
|
|
|
Change::Type const ch = slice.paragraph().lookupChange(slice.pos()).type;
|
2005-09-07 10:37:05 +00:00
|
|
|
if (ch != Change::UNCHANGED)
|
|
|
|
return ch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Change::UNCHANGED;
|
|
|
|
}
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
}
|
|
|
|
|
2007-09-17 22:51:03 +00:00
|
|
|
|
2006-10-19 07:20:32 +00:00
|
|
|
LyXFunc::LyXFunc()
|
2007-10-02 21:51:54 +00:00
|
|
|
: lyx_view_(0), encoded_last_key(0), meta_fake_bit(NoModifier)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-04-17 15:15:59 +00:00
|
|
|
|
2007-04-27 08:05:58 +00:00
|
|
|
void LyXFunc::initKeySequences(KeyMap * kb)
|
2006-10-19 07:20:32 +00:00
|
|
|
{
|
2007-09-17 22:51:03 +00:00
|
|
|
keyseq = KeySequence(kb, kb);
|
|
|
|
cancel_meta_seq = KeySequence(kb, kb);
|
2006-10-19 07:20:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-12 14:58:57 +00:00
|
|
|
void LyXFunc::setLyXView(LyXView * lv)
|
|
|
|
{
|
2009-09-05 14:29:11 +00:00
|
|
|
if (lyx_view_ && lyx_view_->currentBufferView() && lyx_view_ != lv)
|
2007-07-06 17:03:45 +00:00
|
|
|
// save current selection to the selection buffer to allow
|
|
|
|
// middle-button paste in another window
|
2009-09-05 14:29:11 +00:00
|
|
|
cap::saveSelection(lyx_view_->currentBufferView()->cursor());
|
2006-10-19 07:28:35 +00:00
|
|
|
lyx_view_ = lv;
|
2006-10-12 14:58:57 +00:00
|
|
|
}
|
|
|
|
|
2006-10-19 07:20:32 +00:00
|
|
|
|
2008-03-15 01:20:36 +00:00
|
|
|
void LyXFunc::handleKeyFunc(FuncCode action)
|
2001-02-23 16:10:03 +00:00
|
|
|
{
|
2006-10-22 10:15:23 +00:00
|
|
|
char_type c = encoded_last_key;
|
2001-02-23 16:10:03 +00:00
|
|
|
|
2007-09-17 22:51:03 +00:00
|
|
|
if (keyseq.length())
|
2001-11-30 13:25:38 +00:00
|
|
|
c = 0;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2009-09-05 14:29:11 +00:00
|
|
|
LASSERT(lyx_view_ && lyx_view_->currentBufferView(), /**/);
|
2009-09-05 15:42:53 +00:00
|
|
|
BufferView * bv = lyx_view_->currentBufferView();
|
|
|
|
bv->getIntl().getTransManager().deadkey(
|
|
|
|
c, get_accent(action).accent, bv->cursor().innerText(),
|
|
|
|
bv->cursor());
|
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
|
2007-09-17 22:51:03 +00:00
|
|
|
keyseq.clear();
|
2001-02-23 16:10:03 +00:00
|
|
|
// copied verbatim from do_accent_char
|
2009-09-05 15:42:53 +00:00
|
|
|
bv->cursor().resetAnchor();
|
|
|
|
bv->processUpdateFlags(Update::FitCursor);
|
2001-02-23 16:10:03 +00:00
|
|
|
}
|
|
|
|
|
2008-02-27 11:05:58 +00:00
|
|
|
//FIXME: bookmark handling is a frontend issue. This code should be transferred
|
|
|
|
// to GuiView and be GuiView and be window dependent.
|
2007-01-11 16:01:10 +00:00
|
|
|
void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
|
|
|
|
{
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(lyx_view_, /**/);
|
2008-07-14 08:35:00 +00:00
|
|
|
if (!theSession().bookmarks().isValid(idx))
|
2007-01-11 16:01:10 +00:00
|
|
|
return;
|
2008-07-14 08:35:00 +00:00
|
|
|
BookmarksSection::Bookmark const & bm = theSession().bookmarks().bookmark(idx);
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(!bm.filename.empty(), /**/);
|
2007-01-11 16:01:10 +00:00
|
|
|
string const file = bm.filename.absFilename();
|
|
|
|
// if the file is not opened, open it.
|
2008-07-29 07:53:08 +00:00
|
|
|
if (!theBufferList().exists(bm.filename)) {
|
2007-01-11 16:01:10 +00:00
|
|
|
if (openFile)
|
|
|
|
dispatch(FuncRequest(LFUN_FILE_OPEN, file));
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// open may fail, so we need to test it again
|
2008-07-29 07:53:08 +00:00
|
|
|
if (!theBufferList().exists(bm.filename))
|
2007-08-22 14:36:18 +00:00
|
|
|
return;
|
2007-08-22 14:25:51 +00:00
|
|
|
|
2009-02-13 13:46:08 +00:00
|
|
|
// bm can be changed when saving
|
|
|
|
BookmarksSection::Bookmark tmp = bm;
|
|
|
|
|
|
|
|
// Special case idx == 0 used for back-from-back jump navigation
|
|
|
|
if (idx == 0)
|
|
|
|
dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
|
|
|
|
|
2007-08-22 14:36:18 +00:00
|
|
|
// if the current buffer is not that one, switch to it.
|
2009-09-05 14:48:36 +00:00
|
|
|
if (!lyx_view_->documentBufferView()
|
|
|
|
|| lyx_view_->documentBufferView()->buffer().fileName() != tmp.filename) {
|
2007-08-22 14:36:18 +00:00
|
|
|
if (!switchToBuffer)
|
|
|
|
return;
|
|
|
|
dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
|
|
|
|
}
|
2009-02-13 13:46:08 +00:00
|
|
|
|
2007-08-22 14:36:18 +00:00
|
|
|
// moveToPosition try paragraph id first and then paragraph (pit, pos).
|
2009-09-05 15:42:53 +00:00
|
|
|
if (!lyx_view_->documentBufferView()->moveToPosition(
|
|
|
|
tmp.bottom_pit, tmp.bottom_pos, tmp.top_id, tmp.top_pos))
|
2009-02-13 13:46:08 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// bm changed
|
|
|
|
if (idx == 0)
|
2007-08-22 14:36:18 +00:00
|
|
|
return;
|
2007-08-22 14:25:51 +00:00
|
|
|
|
2007-08-22 14:36:18 +00:00
|
|
|
// Cursor jump succeeded!
|
2009-09-05 15:42:53 +00:00
|
|
|
Cursor const & cur = lyx_view_->documentBufferView()->cursor();
|
2007-08-22 14:36:18 +00:00
|
|
|
pit_type new_pit = cur.pit();
|
|
|
|
pos_type new_pos = cur.pos();
|
|
|
|
int new_id = cur.paragraph().id();
|
|
|
|
|
|
|
|
// if bottom_pit, bottom_pos or top_id has been changed, update bookmark
|
|
|
|
// see http://bugzilla.lyx.org/show_bug.cgi?id=3092
|
|
|
|
if (bm.bottom_pit != new_pit || bm.bottom_pos != new_pos
|
|
|
|
|| bm.top_id != new_id) {
|
|
|
|
const_cast<BookmarksSection::Bookmark &>(bm).updatePos(
|
|
|
|
new_pit, new_pos, new_id);
|
2007-05-28 22:27:45 +00:00
|
|
|
}
|
2007-01-11 16:01:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-02 21:51:54 +00:00
|
|
|
void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
|
2000-08-14 15:31:16 +00:00
|
|
|
{
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::KEY, "KeySym is " << keysym.getSymbolName());
|
2002-11-04 02:12:42 +00:00
|
|
|
|
2000-08-14 15:31:16 +00:00
|
|
|
// Do nothing if we have nothing (JMarc)
|
2007-09-17 18:41:03 +00:00
|
|
|
if (!keysym.isOK()) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::KEY, "Empty kbd action (probably composing)");
|
2007-11-13 09:52:28 +00:00
|
|
|
lyx_view_->restartCursor();
|
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
|
|
|
|
2007-09-17 18:41:03 +00:00
|
|
|
if (keysym.isModifier()) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::KEY, "isModifier true");
|
2008-03-14 16:33:16 +00:00
|
|
|
if (lyx_view_)
|
|
|
|
lyx_view_->restartCursor();
|
2001-05-17 01:23:29 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2009-09-05 15:42:53 +00:00
|
|
|
//Encoding const * encoding = lyx_view_->documentBufferView()->cursor().getEncoding();
|
2007-09-17 18:41:03 +00:00
|
|
|
//encoded_last_key = keysym.getISOEncoded(encoding ? encoding->name() : "");
|
2007-01-24 14:01:34 +00:00
|
|
|
// FIXME: encoded_last_key shadows the member variable of the same
|
|
|
|
// name. Is that intended?
|
2007-09-17 18:41:03 +00:00
|
|
|
char_type encoded_last_key = keysym.getUCSEncoded();
|
2003-01-05 22:38:42 +00:00
|
|
|
|
2000-08-14 15:31:16 +00:00
|
|
|
// Do a one-deep top-level lookup for
|
|
|
|
// cancel and meta-fake keys. RVDK_PATCH_5
|
2007-09-17 22:51:03 +00:00
|
|
|
cancel_meta_seq.reset();
|
2000-08-14 15:31:16 +00:00
|
|
|
|
2007-09-17 22:51:03 +00:00
|
|
|
FuncRequest func = cancel_meta_seq.addkey(keysym, state);
|
2007-11-29 21:10:35 +00:00
|
|
|
LYXERR(Debug::KEY, "action first set to [" << func.action << ']');
|
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.
|
2007-10-02 21:51:54 +00:00
|
|
|
// Mostly, meta_fake_bit = NoModifier. RVDK_PATCH_5.
|
2006-05-05 20:23:12 +00:00
|
|
|
if ((func.action != LFUN_CANCEL) && (func.action != LFUN_META_PREFIX)) {
|
2000-08-14 15:31:16 +00:00
|
|
|
// remove Caps Lock and Mod2 as a modifiers
|
2007-09-17 22:51:03 +00:00
|
|
|
func = keyseq.addkey(keysym, (state | meta_fake_bit));
|
2007-11-29 21:10:35 +00:00
|
|
|
LYXERR(Debug::KEY, "action now set to [" << func.action << ']');
|
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.
|
2007-10-02 21:51:54 +00:00
|
|
|
meta_fake_bit = NoModifier;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2005-02-08 02:06:39 +00:00
|
|
|
// Can this happen now ?
|
2007-10-02 21:51:54 +00:00
|
|
|
if (func.action == LFUN_NOACTION)
|
2006-05-05 20:23:12 +00:00
|
|
|
func = FuncRequest(LFUN_COMMAND_PREFIX);
|
2000-08-14 15:31:16 +00:00
|
|
|
|
2007-11-29 21:10:35 +00:00
|
|
|
LYXERR(Debug::KEY, " Key [action=" << func.action << "]["
|
|
|
|
<< keyseq.print(KeySequence::Portable) << ']');
|
2000-08-14 15:31:16 +00:00
|
|
|
|
|
|
|
// already here we know if it any point in going further
|
|
|
|
// why not return already here if action == -1 and
|
|
|
|
// num_bytes == 0? (Lgb)
|
|
|
|
|
2007-10-02 21:51:54 +00:00
|
|
|
if (keyseq.length() > 1)
|
2007-10-20 20:28:05 +00:00
|
|
|
lyx_view_->message(keyseq.print(KeySequence::ForGui));
|
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
|
2007-10-02 21:51:54 +00:00
|
|
|
if (func.action == LFUN_UNKNOWN_ACTION && state == ShiftModifier) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::KEY, "Trying without shift");
|
2007-10-02 21:51:54 +00:00
|
|
|
func = keyseq.addkey(keysym, NoModifier);
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::KEY, "Action now " << func.action);
|
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
|
2007-09-17 22:51:03 +00:00
|
|
|
if (keysym.isText() && keyseq.length() == 1) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::KEY, "isText() is true, inserting.");
|
2006-05-05 20:23:12 +00:00
|
|
|
func = FuncRequest(LFUN_SELF_INSERT,
|
2006-01-18 17:44:01 +00:00
|
|
|
FuncRequest::KEYBOARD);
|
2002-12-12 13:46:06 +00:00
|
|
|
} else {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::KEY, "Unknown, !isText() - giving up");
|
2006-10-19 07:28:35 +00:00
|
|
|
lyx_view_->message(_("Unknown function."));
|
2007-11-13 09:52:28 +00:00
|
|
|
lyx_view_->restartCursor();
|
2001-05-17 01:23:29 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
if (func.action == LFUN_SELF_INSERT) {
|
2003-01-05 22:38:42 +00:00
|
|
|
if (encoded_last_key != 0) {
|
2006-09-01 15:41:38 +00:00
|
|
|
docstring const arg(1, encoded_last_key);
|
2006-05-05 20:23:12 +00:00
|
|
|
dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
|
2006-01-18 17:44:01 +00:00
|
|
|
FuncRequest::KEYBOARD));
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']");
|
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);
|
2008-02-25 07:32:02 +00:00
|
|
|
if (!lyx_view_)
|
|
|
|
return;
|
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;
|
2006-10-23 16:29:24 +00:00
|
|
|
|
2009-07-14 11:36:08 +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 or view-related.
|
|
|
|
|
|
|
|
If this code is moved somewhere else (like in
|
|
|
|
GuiView::getStatus), then several functions will not be
|
|
|
|
handled correctly.
|
|
|
|
*/
|
|
|
|
frontend::LyXView * lv = 0;
|
|
|
|
Buffer * buf = 0;
|
|
|
|
if (lyx_view_
|
|
|
|
&& (cmd.origin != FuncRequest::MENU || lyx_view_->hasFocus())) {
|
|
|
|
lv = lyx_view_;
|
2009-09-05 14:48:36 +00:00
|
|
|
if (lyx_view_->documentBufferView())
|
|
|
|
buf = &lyx_view_->documentBufferView()->buffer();
|
2009-07-14 11:36:08 +00:00
|
|
|
}
|
2004-11-16 10:46:23 +00:00
|
|
|
|
2004-02-13 07:30:59 +00:00
|
|
|
if (cmd.action == LFUN_NOACTION) {
|
2006-10-21 00:16:43 +00:00
|
|
|
flag.message(from_utf8(N_("Nothing to do")));
|
2008-05-29 15:14:00 +00:00
|
|
|
flag.setEnabled(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:
|
|
|
|
flag.unknown(true);
|
2008-05-29 15:14:00 +00:00
|
|
|
flag.setEnabled(false);
|
2002-12-18 14:24:32 +00:00
|
|
|
break;
|
2006-10-05 16:52:04 +00:00
|
|
|
|
2002-12-18 14:24:32 +00:00
|
|
|
default:
|
2006-10-05 16:52:04 +00:00
|
|
|
break;
|
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()) {
|
2006-10-21 00:16:43 +00:00
|
|
|
flag.message(from_utf8(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())
|
2006-10-21 00:16:43 +00:00
|
|
|
flag.message(from_utf8(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
|
2006-10-21 00:16:43 +00:00
|
|
|
flag.message(from_utf8(N_("Command not allowed with"
|
2006-09-11 08:54:10 +00:00
|
|
|
"out any document open")));
|
2008-05-29 15:14:00 +00:00
|
|
|
flag.setEnabled(false);
|
2004-03-23 11:22:11 +00:00
|
|
|
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) {
|
2007-11-19 20:56:05 +00:00
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_CITATION_INSERT: {
|
2005-10-07 14:51:39 +00:00
|
|
|
FuncRequest fr(LFUN_INSET_INSERT, "citation");
|
|
|
|
enable = getStatus(fr).enabled();
|
|
|
|
break;
|
|
|
|
}
|
2007-12-04 22:21:25 +00:00
|
|
|
|
|
|
|
// This could be used for the no-GUI version. The GUI version is handled in
|
2007-12-28 17:11:39 +00:00
|
|
|
// LyXView::getStatus(). See above.
|
2007-12-04 22:21:25 +00:00
|
|
|
/*
|
|
|
|
case LFUN_BUFFER_WRITE:
|
|
|
|
case LFUN_BUFFER_WRITE_AS: {
|
2008-07-29 08:16:09 +00:00
|
|
|
Buffer * b = theBufferList().getBuffer(FileName(cmd.getArg(0)));
|
2007-12-04 22:21:25 +00:00
|
|
|
enable = b && (b->isUnnamed() || !b->isClean());
|
2006-03-16 13:12:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-12-04 22:21:25 +00:00
|
|
|
*/
|
2007-08-06 15:34:02 +00:00
|
|
|
|
|
|
|
case LFUN_BUFFER_WRITE_ALL: {
|
2007-12-04 22:21:25 +00:00
|
|
|
// We enable the command only if there are some modified buffers
|
2007-08-06 15:34:02 +00:00
|
|
|
Buffer * first = theBufferList().first();
|
2007-12-04 22:21:25 +00:00
|
|
|
enable = false;
|
|
|
|
if (!first)
|
|
|
|
break;
|
|
|
|
Buffer * b = first;
|
2007-08-06 15:34:02 +00:00
|
|
|
// We cannot use a for loop as the buffer list is a cycle.
|
2007-12-04 22:21:25 +00:00
|
|
|
do {
|
|
|
|
if (!b->isClean()) {
|
|
|
|
enable = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
b = theBufferList().next(b);
|
|
|
|
} while (b != first);
|
2007-08-06 15:34:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-01-22 14:43:45 +00:00
|
|
|
case LFUN_BOOKMARK_GOTO: {
|
|
|
|
const unsigned int num = convert<unsigned int>(to_utf8(cmd.argument()));
|
2008-07-14 08:35:00 +00:00
|
|
|
enable = theSession().bookmarks().isValid(num);
|
2007-01-22 14:43:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case LFUN_BOOKMARK_CLEAR:
|
2009-01-07 01:48:47 +00:00
|
|
|
enable = theSession().bookmarks().hasValid();
|
2007-01-22 14:43:45 +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
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_COMMAND_SEQUENCE: {
|
2004-05-04 14:12:50 +00:00
|
|
|
// argument contains ';'-terminated commands
|
2006-10-21 00:16:43 +00:00
|
|
|
string const firstcmd = token(to_utf8(cmd.argument()), ';', 0);
|
2004-11-16 10:46:23 +00:00
|
|
|
FuncRequest func(lyxaction.lookupFunc(firstcmd));
|
|
|
|
func.origin = cmd.origin;
|
|
|
|
flag = getStatus(func);
|
2007-10-20 23:27:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-09-24 15:08:46 +00:00
|
|
|
// we want to check if at least one of these is enabled
|
|
|
|
case LFUN_COMMAND_ALTERNATIVES: {
|
|
|
|
// argument contains ';'-terminated commands
|
|
|
|
string arg = to_utf8(cmd.argument());
|
|
|
|
while (!arg.empty()) {
|
|
|
|
string first;
|
|
|
|
arg = split(arg, first, ';');
|
|
|
|
FuncRequest func(lyxaction.lookupFunc(first));
|
|
|
|
func.origin = cmd.origin;
|
|
|
|
flag = getStatus(func);
|
|
|
|
// if this one is enabled, the whole thing is
|
|
|
|
if (flag.enabled())
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-10-20 23:27:03 +00:00
|
|
|
case LFUN_CALL: {
|
|
|
|
FuncRequest func;
|
2007-12-12 19:28:07 +00:00
|
|
|
string name = to_utf8(cmd.argument());
|
2008-07-14 08:35:00 +00:00
|
|
|
if (theTopLevelCmdDef().lock(name, func)) {
|
2007-10-20 23:27:03 +00:00
|
|
|
func.origin = cmd.origin;
|
|
|
|
flag = getStatus(func);
|
2008-07-14 08:35:00 +00:00
|
|
|
theTopLevelCmdDef().release(name);
|
2007-10-20 23:27:03 +00:00
|
|
|
} else {
|
2009-05-27 15:51:56 +00:00
|
|
|
// catch recursion or unknown command
|
|
|
|
// definition. all operations until the
|
|
|
|
// recursion or unknown command definition
|
|
|
|
// occurs are performed, so set the state to
|
|
|
|
// enabled
|
2007-10-20 23:27:03 +00:00
|
|
|
enable = true;
|
|
|
|
}
|
|
|
|
break;
|
2004-05-04 14:12:50 +00:00
|
|
|
}
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_COMMAND_PREFIX:
|
2004-03-18 13:57:20 +00:00
|
|
|
case LFUN_CANCEL:
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_META_PREFIX:
|
2004-03-18 13:57:20 +00:00
|
|
|
case LFUN_RECONFIGURE:
|
|
|
|
case LFUN_DROP_LAYOUTS_CHOICE:
|
2008-07-07 19:09:06 +00:00
|
|
|
case LFUN_SERVER_GET_FILENAME:
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_SERVER_NOTIFY:
|
|
|
|
case LFUN_SERVER_GOTO_FILE_ROW:
|
2008-03-09 21:23:37 +00:00
|
|
|
case LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE:
|
2004-03-18 13:57:20 +00:00
|
|
|
case LFUN_REPEAT:
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_PREFERENCES_SAVE:
|
2008-04-27 16:20:12 +00:00
|
|
|
case LFUN_INSET_EDIT:
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_BUFFER_SAVE_AS_DEFAULT:
|
2004-03-31 16:50:59 +00:00
|
|
|
case LFUN_LYXRC_APPLY:
|
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:
|
2008-05-23 09:53:27 +00:00
|
|
|
if (!theApp()) {
|
|
|
|
enable = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (theApp()->getStatus(cmd, flag))
|
|
|
|
break;
|
|
|
|
|
2008-05-22 15:01:36 +00:00
|
|
|
// Does the view know something?
|
2009-07-14 11:36:08 +00:00
|
|
|
if (!lv) {
|
2008-05-22 15:01:36 +00:00
|
|
|
enable = false;
|
|
|
|
break;
|
|
|
|
}
|
2009-07-14 11:36:08 +00:00
|
|
|
if (lv->getStatus(cmd, flag))
|
2008-05-22 15:01:36 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-05 15:42:53 +00:00
|
|
|
BufferView * bv = lv->currentBufferView();
|
2009-09-19 14:05:52 +00:00
|
|
|
BufferView * doc_bv = lv->documentBufferView();
|
2009-04-06 12:12:06 +00:00
|
|
|
// If we do not have a BufferView, then other functions are disabled
|
2009-09-05 15:42:53 +00:00
|
|
|
if (!bv) {
|
2007-10-11 10:05:04 +00:00
|
|
|
enable = false;
|
2007-10-11 09:57:52 +00:00
|
|
|
break;
|
2007-10-11 10:05:04 +00:00
|
|
|
}
|
2009-03-30 13:49:52 +00:00
|
|
|
// Is this a function that acts on inset at point?
|
2009-09-05 15:42:53 +00:00
|
|
|
Inset * inset = bv->cursor().nextInset();
|
2009-03-30 13:49:52 +00:00
|
|
|
if (lyxaction.funcHasFlag(cmd.action, LyXAction::AtPoint)
|
2009-09-05 15:42:53 +00:00
|
|
|
&& inset && inset->getStatus(bv->cursor(), cmd, flag))
|
2009-03-30 13:49:52 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-05 15:42:53 +00:00
|
|
|
bool decided = getLocalStatus(bv->cursor(), cmd, flag);
|
2009-04-06 12:12:06 +00:00
|
|
|
if (!decided)
|
|
|
|
// try the BufferView
|
2009-09-05 15:42:53 +00:00
|
|
|
decided = bv->getStatus(cmd, flag);
|
2009-04-06 12:12:06 +00:00
|
|
|
if (!decided)
|
|
|
|
// try the Buffer
|
2009-09-19 14:05:52 +00:00
|
|
|
decided = bv->buffer().getStatus(cmd, flag);
|
|
|
|
if (!decided && doc_bv)
|
|
|
|
// try the Document Buffer
|
|
|
|
decided = doc_bv->buffer().getStatus(cmd, flag);
|
2002-07-21 15:51:07 +00:00
|
|
|
}
|
|
|
|
|
2004-03-23 11:22:11 +00:00
|
|
|
if (!enable)
|
2008-05-29 15:14:00 +00:00
|
|
|
flag.setEnabled(false);
|
2004-03-23 11:22:11 +00:00
|
|
|
|
|
|
|
// 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)) {
|
2006-10-21 00:16:43 +00:00
|
|
|
flag.message(from_utf8(N_("Document is read-only")));
|
2008-05-29 15:14:00 +00:00
|
|
|
flag.setEnabled(false);
|
2004-03-23 11:22:11 +00:00
|
|
|
}
|
|
|
|
|
2005-09-07 10:37:05 +00:00
|
|
|
// Are we in a DELETED change-tracking region?
|
2009-09-05 15:42:53 +00:00
|
|
|
if (lyx_view_ && lyx_view_->documentBufferView()
|
|
|
|
&& (lookupChangeType(lyx_view_->documentBufferView()->cursor(), true)
|
|
|
|
== Change::DELETED)
|
2005-09-07 10:37:05 +00:00
|
|
|
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly)
|
|
|
|
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)) {
|
2006-10-21 00:16:43 +00:00
|
|
|
flag.message(from_utf8(N_("This portion of the document is deleted.")));
|
2008-05-29 15:14:00 +00:00
|
|
|
flag.setEnabled(false);
|
2005-09-07 10:37:05 +00:00
|
|
|
}
|
|
|
|
|
2004-12-02 11:32:14 +00:00
|
|
|
// the default error message if we disable the command
|
|
|
|
if (!flag.enabled() && flag.message().empty())
|
2006-10-21 00:16:43 +00:00
|
|
|
flag.message(from_utf8(N_("Command disabled")));
|
2004-12-02 11:32:14 +00:00
|
|
|
|
1999-12-10 00:07:59 +00:00
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-17 10:51:59 +00:00
|
|
|
namespace {
|
|
|
|
|
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
|
|
|
{
|
2006-10-21 00:16:43 +00:00
|
|
|
string const argument = to_utf8(cmd.argument());
|
2008-03-15 01:20:36 +00:00
|
|
|
FuncCode const action = cmd.action;
|
2003-09-21 23:00:47 +00:00
|
|
|
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::ACTION, "\nLyXFunc::dispatch: cmd: " << cmd);
|
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();
|
|
|
|
|
2006-04-20 14:51:23 +00:00
|
|
|
// redraw the screen at the end (first of the two drawing steps).
|
2006-06-26 16:55:35 +00:00
|
|
|
//This is done unless explicitely requested otherwise
|
2006-10-22 11:46:36 +00:00
|
|
|
Update::flags updateFlags = Update::FitCursor;
|
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
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::ACTION, "LyXFunc::dispatch: "
|
2002-01-12 20:00:47 +00:00
|
|
|
<< lyxaction.getActionName(action)
|
2007-11-15 20:04:51 +00:00
|
|
|
<< " [" << action << "] is disabled at this location");
|
2004-11-25 09:15:26 +00:00
|
|
|
setErrorMessage(flag.message());
|
2008-09-26 12:35:35 +00:00
|
|
|
if (lyx_view_)
|
|
|
|
lyx_view_->restartCursor();
|
2003-11-13 13:43:44 +00:00
|
|
|
} else {
|
2009-09-05 14:48:36 +00:00
|
|
|
Buffer * buffer = 0;
|
|
|
|
if (lyx_view_ && lyx_view_->currentBufferView())
|
|
|
|
buffer = &lyx_view_->currentBufferView()->buffer();
|
2003-11-13 13:43:44 +00:00
|
|
|
switch (action) {
|
2007-11-24 07:58:12 +00:00
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_COMMAND_PREFIX:
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(lyx_view_, /**/);
|
2007-09-17 22:51:03 +00:00
|
|
|
lyx_view_->message(keyseq.printOptions(true));
|
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_CANCEL:
|
2009-09-05 14:29:11 +00:00
|
|
|
LASSERT(lyx_view_ && lyx_view_->currentBufferView(), /**/);
|
2007-09-17 22:51:03 +00:00
|
|
|
keyseq.reset();
|
2007-10-02 21:51:54 +00:00
|
|
|
meta_fake_bit = NoModifier;
|
2008-10-23 07:08:12 +00:00
|
|
|
if (buffer)
|
2003-11-13 13:43:44 +00:00
|
|
|
// cancel any selection
|
|
|
|
dispatch(FuncRequest(LFUN_MARK_OFF));
|
2007-02-14 19:11:09 +00:00
|
|
|
setMessage(from_ascii(N_("Cancel")));
|
2003-11-13 13:43:44 +00:00
|
|
|
break;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_META_PREFIX:
|
2007-10-02 21:51:54 +00:00
|
|
|
meta_fake_bit = AltModifier;
|
2007-10-20 20:28:05 +00:00
|
|
|
setMessage(keyseq.print(KeySequence::ForGui));
|
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
|
|
|
// --- Menus -----------------------------------------------
|
|
|
|
case LFUN_RECONFIGURE:
|
2007-09-26 19:36:09 +00:00
|
|
|
// argument is any additional parameter to the configure.py command
|
2008-03-14 16:33:16 +00:00
|
|
|
reconfigure(lyx_view_, argument);
|
2000-07-24 13:53:19 +00:00
|
|
|
break;
|
2003-11-13 13:43:44 +00:00
|
|
|
|
|
|
|
// --- lyxserver commands ----------------------------
|
2008-07-07 19:09:06 +00:00
|
|
|
case LFUN_SERVER_GET_FILENAME:
|
2008-10-23 07:08:12 +00:00
|
|
|
LASSERT(lyx_view_ && buffer, /**/);
|
|
|
|
setMessage(from_utf8(buffer->absFileName()));
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::INFO, "FNAME["
|
2008-10-23 07:08:12 +00:00
|
|
|
<< buffer->absFileName() << ']');
|
2003-11-13 13:43:44 +00:00
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_SERVER_NOTIFY:
|
2007-10-20 20:28:05 +00:00
|
|
|
dispatch_buffer = keyseq.print(KeySequence::Portable);
|
2007-04-29 16:22:46 +00:00
|
|
|
theServer().notifyClient(to_utf8(dispatch_buffer));
|
2003-11-13 13:43:44 +00:00
|
|
|
break;
|
2001-02-23 16:10:03 +00:00
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_SERVER_GOTO_FILE_ROW: {
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(lyx_view_, /**/);
|
2003-11-13 13:43:44 +00:00
|
|
|
string file_name;
|
|
|
|
int row;
|
|
|
|
istringstream is(argument);
|
|
|
|
is >> file_name >> row;
|
2009-08-22 14:04:23 +00:00
|
|
|
file_name = os::internal_path(file_name);
|
2007-08-21 07:33:46 +00:00
|
|
|
Buffer * buf = 0;
|
|
|
|
bool loaded = false;
|
2009-05-01 15:18:11 +00:00
|
|
|
string const abstmp = package().temp_dir().absFilename();
|
|
|
|
string const realtmp = package().temp_dir().realPath();
|
2009-05-23 13:51:23 +00:00
|
|
|
// We have to use os::path_prefix_is() here, instead of
|
|
|
|
// simply prefixIs(), because the file name comes from
|
|
|
|
// an external application and may need case adjustment.
|
2009-05-22 22:34:43 +00:00
|
|
|
if (os::path_prefix_is(file_name, abstmp, os::CASE_ADJUSTED)
|
|
|
|
|| os::path_prefix_is(file_name, realtmp, os::CASE_ADJUSTED)) {
|
2003-11-13 13:43:44 +00:00
|
|
|
// Needed by inverse dvi search. If it is a file
|
2009-05-01 15:18:11 +00:00
|
|
|
// in tmpdir, call the apropriated function.
|
|
|
|
// If tmpdir is a symlink, we may have the real
|
|
|
|
// path passed back, so we correct for that.
|
2009-05-02 18:55:55 +00:00
|
|
|
if (!prefixIs(file_name, abstmp))
|
2009-05-01 15:18:11 +00:00
|
|
|
file_name = subst(file_name, realtmp, abstmp);
|
2007-08-21 07:33:46 +00:00
|
|
|
buf = theBufferList().getBufferFromTmp(file_name);
|
2009-05-01 15:18:11 +00:00
|
|
|
} else {
|
2003-11-13 13:43:44 +00:00
|
|
|
// Must replace extension of the file to be .lyx
|
|
|
|
// and get full path
|
2006-12-02 16:07:15 +00:00
|
|
|
FileName const s = fileSearch(string(), changeExtension(file_name, ".lyx"), "lyx");
|
2003-11-13 13:43:44 +00:00
|
|
|
// Either change buffer or load the file
|
2008-07-29 07:53:08 +00:00
|
|
|
if (theBufferList().exists(s))
|
2008-07-29 08:16:09 +00:00
|
|
|
buf = theBufferList().getBuffer(s);
|
2009-04-26 22:52:22 +00:00
|
|
|
else if (s.exists()) {
|
2008-02-06 23:02:57 +00:00
|
|
|
buf = lyx_view_->loadDocument(s);
|
2007-08-21 07:33:46 +00:00
|
|
|
loaded = true;
|
2009-04-26 22:52:22 +00:00
|
|
|
} else
|
|
|
|
lyx_view_->message(bformat(
|
|
|
|
_("File does not exist: %1$s"),
|
|
|
|
makeDisplayPath(file_name)));
|
2003-10-14 11:35:50 +00:00
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
if (!buf) {
|
|
|
|
updateFlags = Update::None;
|
|
|
|
break;
|
|
|
|
}
|
2000-02-04 09:38:32 +00:00
|
|
|
|
2008-11-16 16:43:49 +00:00
|
|
|
buf->updateLabels();
|
2007-08-21 07:33:46 +00:00
|
|
|
lyx_view_->setBuffer(buf);
|
2009-09-05 15:42:53 +00:00
|
|
|
lyx_view_->documentBufferView()->setCursorFromRow(row);
|
2007-08-21 07:33:46 +00:00
|
|
|
if (loaded)
|
2007-11-23 11:53:10 +00:00
|
|
|
buf->errors("Parse");
|
2007-01-22 15:00:33 +00:00
|
|
|
updateFlags = Update::FitCursor;
|
2003-11-13 13:43:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2000-07-25 10:46:18 +00:00
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2003-11-13 13:43:44 +00:00
|
|
|
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(lyx_view_, /**/);
|
2004-01-30 11:41:12 +00:00
|
|
|
string const name = cmd.getArg(0);
|
2007-10-18 05:08:16 +00:00
|
|
|
InsetCode code = insetCode(name);
|
2006-10-21 00:16:43 +00:00
|
|
|
string data = trim(to_utf8(cmd.argument()).substr(name.size()));
|
2007-10-18 05:08:16 +00:00
|
|
|
bool insetCodeOK = true;
|
|
|
|
switch (code) {
|
|
|
|
case BIBITEM_CODE:
|
|
|
|
case BIBTEX_CODE:
|
|
|
|
case INDEX_CODE:
|
|
|
|
case LABEL_CODE:
|
|
|
|
case NOMENCL_CODE:
|
2009-05-22 16:26:15 +00:00
|
|
|
case NOMENCL_PRINT_CODE:
|
2007-10-18 05:08:16 +00:00
|
|
|
case REF_CODE:
|
|
|
|
case TOC_CODE:
|
|
|
|
case HYPERLINK_CODE: {
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams p(code);
|
2008-03-27 22:26:24 +00:00
|
|
|
data = InsetCommand::params2string(name, p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case INCLUDE_CODE: {
|
2006-12-18 16:45:20 +00:00
|
|
|
// data is the include type: one of "include",
|
|
|
|
// "input", "verbatiminput" or "verbatiminput*"
|
|
|
|
if (data.empty())
|
|
|
|
// default type is requested
|
|
|
|
data = "include";
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams p(INCLUDE_CODE, data);
|
2008-03-27 22:26:24 +00:00
|
|
|
data = InsetCommand::params2string("include", p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case BOX_CODE: {
|
2003-12-10 22:10:38 +00:00
|
|
|
// \c data == "Boxed" || "Frameless" etc
|
|
|
|
InsetBoxParams p(data);
|
2008-03-27 07:26:37 +00:00
|
|
|
data = InsetBox::params2string(p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case BRANCH_CODE: {
|
2003-12-10 22:10:38 +00:00
|
|
|
InsetBranchParams p;
|
2008-03-27 22:26:24 +00:00
|
|
|
data = InsetBranch::params2string(p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case CITE_CODE: {
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams p(CITE_CODE);
|
2008-03-27 22:26:24 +00:00
|
|
|
data = InsetCommand::params2string(name, p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case ERT_CODE: {
|
2008-07-14 12:38:43 +00:00
|
|
|
data = InsetERT::params2string(InsetCollapsable::Open);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case EXTERNAL_CODE: {
|
2003-12-10 22:10:38 +00:00
|
|
|
InsetExternalParams p;
|
2008-10-23 07:08:12 +00:00
|
|
|
data = InsetExternal::params2string(p, *buffer);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case FLOAT_CODE: {
|
2003-12-10 22:10:38 +00:00
|
|
|
InsetFloatParams p;
|
2008-03-27 22:26:24 +00:00
|
|
|
data = InsetFloat::params2string(p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case LISTINGS_CODE: {
|
Add support for listings package. Two listings command \lstinline, \lstinputlisting and an environment \lstlisting are supported, along with preamble \lstset. \lstinputlisting is implemented through Include dialog, and the other two are implemented with a new inset listings, along with its dialog.
* src/LyXAction.cpp: listing-insert action
* src/insets/Inset.h,cpp: LISTINGS_CODE
* src/insets/InsetInclude.cpp: handle \lstinputlisting
* src/insets/InsetListings.h,cpp: new listings inset
* src/insets/InsetListingsParams.h,cpp: parameters from listings package
* src/insets/InsetCommandParams.h,cpp: handle lstinputlisting option
* src/Bidi.cpp: handle LISTINGS_CODE
* src/frontends/qt4/ui/TextLayoutUi.ui: update UI
* src/frontends/qt4/ui/ListingsUi.ui: new dialog
* src/frontends/qt4/ui/IncludeUi.ui: update UI
* src/frontends/qt4/QInclude.h,cpp: add lstinputlisting
* src/frontends/qt4/QDocument.h,cpp: add textedit for preamble listings_params
* src/frontends/qt4/QListings.h,cpp: new listings inset
* src/frontends/qt4/Dialogs.cpp: new listings dialog
* src/frontends/controllers/ControlInclude.h,cpp: add lstinputlisting
* src/frontends/controllers/ControlListings.h,cpp: new listings inset
* src/LyXFunc.cpp: handle LISTING_CODE
* src/Paragraph.cpp: handle LISTING_CODE
* src/factory.cpp: new listings inset
* src/CutAndPaste.cpp: handle LISTINGS_CODE
* src/LaTeXFeatures.cpp: require listings
* src/Text3.cpp: Handle LISTINGS_CODE
* src/lfuns.h: add LFUN_LISTING_INSERT
* src/Buffer.cpp: change lyx file format to 269
* src/BufferParams.h,cpp: add listings_params to preamble
* lib/lyx2lyx/LyX.py: lyx2lyx
* lib/lyx2lyx/lyx_1_5.py: lyx2lyx
* lib/ui/stdmenus.inc: new menu item (no shortcut!)
* src/insets/Makefile.am: update autotools
* src/frontends/controllers/Makefile.am
* src/frontends/qt4/Makefile.dialogs
* src/frontends/qt4/Makefile.am
* po/POTFILES.in: a few more translatable files.
* development/scons/scons_manifest.py: scons build system
* development/FORMAT: document format changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18243 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-09 19:11:42 +00:00
|
|
|
InsetListingsParams p;
|
2008-03-27 22:26:24 +00:00
|
|
|
data = InsetListings::params2string(p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case GRAPHICS_CODE: {
|
2003-12-10 22:10:38 +00:00
|
|
|
InsetGraphicsParams p;
|
2008-10-23 07:08:12 +00:00
|
|
|
data = InsetGraphics::params2string(p, *buffer);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case NOTE_CODE: {
|
2003-12-10 22:10:38 +00:00
|
|
|
InsetNoteParams p;
|
2008-03-27 22:26:24 +00:00
|
|
|
data = InsetNote::params2string(p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2009-01-30 00:56:37 +00:00
|
|
|
case PHANTOM_CODE: {
|
|
|
|
InsetPhantomParams p;
|
|
|
|
data = InsetPhantom::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
case SPACE_CODE: {
|
|
|
|
InsetSpaceParams p;
|
2008-03-27 22:26:24 +00:00
|
|
|
data = InsetSpace::params2string(p);
|
*** File Format Change: UI and enhancement for InsetSpace ***
* src/insets/InsetSpace.{cpp,h}:
- merge in HFill inset, add support for dotfill, hrulefill,
hspace and hspace*
* src/insets/InsetHFill.{cpp,h}:
- remove
* src/frontends/qt4/GuiHSpace.{cpp,h}:
* src/frontends/qt4/ui/HSpaceUi.ui:
* src/frontends/qt4/GuiView:
- new GUI for Space insets.
* src/insets/Inset.{cpp,h}:
* src/insets/InsetCode.h:
* src/insets/InsetCollapsable.cpp:
* src/insets/InsetCommandParams.cpp:
- remove HFILL_CODE and LFUN_HFILL_INSERT, add SPACE_CODE where necessary,
new Inset member isStretchableSpace() to indicate HFill and friends.
* Buffer.cpp:
- increase format to 319
* lib/lyx2lyx/LyX.py:
* lib/lyx2lyx/lyx_1_6.py:
- conversion/reversion routines
* development/FORMAT:
- document file format change
* src/Makefile.am:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
- deal with UI changes.
* src/LyXAction.cpp:
- remove LFUN_HFILL_INSERT
* src/LyXFunc.cpp:
- handle space dialog.
* src/factory.cpp:
* src/Paragraph.cpp (isHFill):
* src/Text.cpp:
* src/Text3.cpp:
* src/TextMetrics.cpp:
- adapt to changes
* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
- add HSpace dialog, remove HFill.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23787 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-17 09:23:43 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case VSPACE_CODE: {
|
2003-11-28 15:53:34 +00:00
|
|
|
VSpace space;
|
2008-03-27 00:21:35 +00:00
|
|
|
data = InsetVSpace::params2string(space);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2009-01-20 01:04:48 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
case WRAP_CODE: {
|
2003-12-10 22:10:38 +00:00
|
|
|
InsetWrapParams p;
|
2008-03-27 00:07:54 +00:00
|
|
|
data = InsetWrap::params2string(p);
|
2007-10-18 05:08:16 +00:00
|
|
|
break;
|
2003-11-13 13:43:44 +00:00
|
|
|
}
|
2007-10-18 05:08:16 +00:00
|
|
|
default:
|
|
|
|
lyxerr << "Inset type '" << name <<
|
2007-12-12 19:28:07 +00:00
|
|
|
"' not recognized in LFUN_DIALOG_SHOW_NEW_INSET" << endl;
|
2007-10-18 05:08:16 +00:00
|
|
|
insetCodeOK = false;
|
|
|
|
break;
|
|
|
|
} // end switch(code)
|
|
|
|
if (insetCodeOK)
|
2007-11-21 22:48:13 +00:00
|
|
|
dispatch(FuncRequest(LFUN_DIALOG_SHOW, name + " " + data));
|
2003-11-13 13:43:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_CITATION_INSERT: {
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(lyx_view_, /**/);
|
2005-10-07 14:51:39 +00:00
|
|
|
if (!argument.empty()) {
|
|
|
|
// we can have one optional argument, delimited by '|'
|
|
|
|
// citation-insert <key>|<text_before>
|
2006-04-05 23:56:29 +00:00
|
|
|
// this should be enhanced to also support text_after
|
2005-10-07 14:51:39 +00:00
|
|
|
// and citation style
|
|
|
|
string arg = argument;
|
|
|
|
string opt1;
|
|
|
|
if (contains(argument, "|")) {
|
|
|
|
arg = token(argument, '|', 0);
|
2007-04-05 13:49:01 +00:00
|
|
|
opt1 = token(argument, '|', 1);
|
2005-10-07 14:51:39 +00:00
|
|
|
}
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams icp(CITE_CODE);
|
2007-04-05 13:49:01 +00:00
|
|
|
icp["key"] = from_utf8(arg);
|
|
|
|
if (!opt1.empty())
|
|
|
|
icp["before"] = from_utf8(opt1);
|
2008-03-27 22:26:24 +00:00
|
|
|
string icstr = InsetCommand::params2string("citation", icp);
|
2007-04-05 13:49:01 +00:00
|
|
|
FuncRequest fr(LFUN_INSET_INSERT, icstr);
|
2005-10-07 14:51:39 +00:00
|
|
|
dispatch(fr);
|
|
|
|
} else
|
2007-04-05 15:55:04 +00:00
|
|
|
dispatch(FuncRequest(LFUN_DIALOG_SHOW_NEW_INSET, "citation"));
|
2005-10-07 14:51:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-03-09 21:23:37 +00:00
|
|
|
case LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE:
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(lyx_view_, /**/);
|
2003-11-13 13:43:44 +00:00
|
|
|
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_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;
|
2008-10-23 07:08:12 +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
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_COMMAND_SEQUENCE: {
|
2003-11-13 13:43:44 +00:00
|
|
|
// argument contains ';'-terminated commands
|
2004-05-04 14:12:50 +00:00
|
|
|
string arg = argument;
|
2008-11-17 12:26:19 +00:00
|
|
|
if (theBufferList().isLoaded(buffer))
|
|
|
|
buffer->undo().beginUndoGroup();
|
2004-05-04 14:12:50 +00:00
|
|
|
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
|
|
|
}
|
2008-11-17 12:26:19 +00:00
|
|
|
if (theBufferList().isLoaded(buffer))
|
|
|
|
buffer->undo().endUndoGroup();
|
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
|
|
|
|
2008-09-24 15:08:46 +00:00
|
|
|
case LFUN_COMMAND_ALTERNATIVES: {
|
|
|
|
// argument contains ';'-terminated commands
|
|
|
|
string arg = argument;
|
|
|
|
while (!arg.empty()) {
|
|
|
|
string first;
|
|
|
|
arg = split(arg, first, ';');
|
|
|
|
FuncRequest func(lyxaction.lookupFunc(first));
|
|
|
|
func.origin = cmd.origin;
|
|
|
|
FuncStatus stat = getStatus(func);
|
|
|
|
if (stat.enabled()) {
|
|
|
|
dispatch(func);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-10-20 23:27:03 +00:00
|
|
|
case LFUN_CALL: {
|
|
|
|
FuncRequest func;
|
2008-07-14 08:35:00 +00:00
|
|
|
if (theTopLevelCmdDef().lock(argument, func)) {
|
2007-10-20 23:27:03 +00:00
|
|
|
func.origin = cmd.origin;
|
|
|
|
dispatch(func);
|
2008-07-14 08:35:00 +00:00
|
|
|
theTopLevelCmdDef().release(argument);
|
2007-10-20 23:27:03 +00:00
|
|
|
} else {
|
|
|
|
if (func.action == LFUN_UNKNOWN_ACTION) {
|
|
|
|
// unknown command definition
|
|
|
|
lyxerr << "Warning: unknown command definition `"
|
|
|
|
<< argument << "'"
|
|
|
|
<< endl;
|
|
|
|
} else {
|
|
|
|
// recursion detected
|
|
|
|
lyxerr << "Warning: Recursion in the command definition `"
|
|
|
|
<< argument << "' detected"
|
|
|
|
<< endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_PREFERENCES_SAVE: {
|
2006-12-27 10:56:11 +00:00
|
|
|
lyxrc.write(makeAbsPath("preferences",
|
2007-05-28 22:27:45 +00:00
|
|
|
package().user_support().absFilename()),
|
|
|
|
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
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_BUFFER_SAVE_AS_DEFAULT: {
|
2004-08-08 22:36:34 +00:00
|
|
|
string const fname =
|
2007-04-06 13:09:54 +00:00
|
|
|
addName(addPath(package().user_support().absFilename(), "templates/"),
|
2004-08-08 22:36:34 +00:00
|
|
|
"defaults.lyx");
|
|
|
|
Buffer defaults(fname);
|
|
|
|
|
|
|
|
istringstream ss(argument);
|
2008-04-02 23:06:22 +00:00
|
|
|
Lexer lex;
|
2004-08-08 22:36:34 +00:00
|
|
|
lex.setStream(ss);
|
|
|
|
int const unknown_tokens = defaults.readHeader(lex);
|
|
|
|
|
|
|
|
if (unknown_tokens != 0) {
|
2006-05-05 20:23:12 +00:00
|
|
|
lyxerr << "Warning in LFUN_BUFFER_SAVE_AS_DEFAULT!\n"
|
2004-08-08 22:36:34 +00:00
|
|
|
<< unknown_tokens << " unknown token"
|
|
|
|
<< (unknown_tokens == 1 ? "" : "s")
|
|
|
|
<< endl;
|
|
|
|
}
|
2004-10-05 10:11:42 +00:00
|
|
|
|
2007-10-20 10:03:45 +00:00
|
|
|
if (defaults.writeFile(FileName(defaults.absFileName())))
|
2007-02-14 19:11:09 +00:00
|
|
|
setMessage(bformat(_("Document defaults saved in %1$s"),
|
2007-05-28 22:27:45 +00:00
|
|
|
makeDisplayPath(fname)));
|
2004-08-08 22:36:34 +00:00
|
|
|
else
|
2007-02-14 19:11:09 +00:00
|
|
|
setErrorMessage(from_ascii(N_("Unable to save document defaults")));
|
2004-08-08 22:36:34 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
case LFUN_LYXRC_APPLY: {
|
2009-07-25 06:16:46 +00:00
|
|
|
// reset active key sequences, since the bindings
|
|
|
|
// are updated (bug 6064)
|
|
|
|
keyseq.reset();
|
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);
|
2007-01-15 15:51:45 +00:00
|
|
|
|
2009-08-08 17:05:31 +00:00
|
|
|
setSpellChecker();
|
|
|
|
|
2007-11-21 15:12:47 +00:00
|
|
|
theApp()->resetGui();
|
|
|
|
|
2007-01-15 15:51:45 +00:00
|
|
|
/// We force the redraw in any case because there might be
|
|
|
|
/// some screen font changes.
|
|
|
|
/// FIXME: only the current view will be updated. the Gui
|
|
|
|
/// class is able to furnish the list of views.
|
|
|
|
updateFlags = Update::Force;
|
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
|
|
|
|
2007-01-11 16:01:10 +00:00
|
|
|
case LFUN_BOOKMARK_GOTO:
|
|
|
|
// go to bookmark, open unopened file and switch to buffer if necessary
|
|
|
|
gotoBookmark(convert<unsigned int>(to_utf8(cmd.argument())), true, true);
|
2007-12-22 10:19:26 +00:00
|
|
|
updateFlags = Update::FitCursor;
|
2006-11-01 15:55:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LFUN_BOOKMARK_CLEAR:
|
2008-07-14 08:35:00 +00:00
|
|
|
theSession().bookmarks().clear();
|
2006-11-01 15:55:17 +00:00
|
|
|
break;
|
|
|
|
|
2007-12-21 10:42:59 +00:00
|
|
|
default:
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(theApp(), /**/);
|
2007-11-26 14:36:50 +00:00
|
|
|
// Let the frontend dispatch its own actions.
|
|
|
|
if (theApp()->dispatch(cmd))
|
|
|
|
// Nothing more to do.
|
|
|
|
return;
|
|
|
|
|
2008-03-14 16:33:16 +00:00
|
|
|
// Everything below is only for active lyx_view_
|
|
|
|
if (lyx_view_ == 0)
|
|
|
|
break;
|
|
|
|
|
2008-09-15 15:44:49 +00:00
|
|
|
// Start an undo group. This may be needed for
|
|
|
|
// some stuff like inset-apply on labels.
|
2008-10-23 06:59:31 +00:00
|
|
|
if (theBufferList().isLoaded(buffer))
|
|
|
|
buffer->undo().beginUndoGroup();
|
2008-09-15 15:44:49 +00:00
|
|
|
|
2007-11-26 14:36:50 +00:00
|
|
|
// Let the current LyXView dispatch its own actions.
|
2007-11-26 22:45:17 +00:00
|
|
|
if (lyx_view_->dispatch(cmd)) {
|
2009-09-21 16:52:04 +00:00
|
|
|
BufferView * bv = lyx_view_->currentBufferView();
|
2009-09-20 21:41:21 +00:00
|
|
|
if (bv) {
|
2009-09-21 16:52:04 +00:00
|
|
|
buffer = &(bv->buffer());
|
2009-09-20 21:41:21 +00:00
|
|
|
updateFlags = bv->cursor().result().update();
|
2008-10-23 06:59:31 +00:00
|
|
|
if (theBufferList().isLoaded(buffer))
|
|
|
|
buffer->undo().endUndoGroup();
|
2008-09-15 15:44:49 +00:00
|
|
|
}
|
2007-11-26 14:36:50 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-09-21 16:52:04 +00:00
|
|
|
BufferView * bv = lyx_view_->currentBufferView();
|
2009-09-20 21:41:21 +00:00
|
|
|
LASSERT(bv, /**/);
|
2008-08-15 19:24:56 +00:00
|
|
|
|
2007-12-21 10:42:59 +00:00
|
|
|
// Let the current BufferView dispatch its own actions.
|
2009-09-20 21:41:21 +00:00
|
|
|
if (bv->dispatch(cmd)) {
|
|
|
|
// The BufferView took care of its own updates if needed.
|
2009-09-21 16:52:04 +00:00
|
|
|
buffer = &(bv->buffer());
|
2009-09-20 21:41:21 +00:00
|
|
|
updateFlags = Update::None;
|
|
|
|
if (theBufferList().isLoaded(buffer))
|
|
|
|
buffer->undo().endUndoGroup();
|
|
|
|
break;
|
|
|
|
}
|
2009-09-21 16:52:04 +00:00
|
|
|
|
|
|
|
BufferView * doc_bv = lyx_view_->documentBufferView();
|
2009-09-20 21:41:21 +00:00
|
|
|
// Try with the document BufferView dispatch if any.
|
|
|
|
if (doc_bv && doc_bv->dispatch(cmd)) {
|
2007-12-21 10:42:59 +00:00
|
|
|
// The BufferView took care of its own updates if needed.
|
2009-09-20 21:41:21 +00:00
|
|
|
buffer = &(doc_bv->buffer());
|
2007-12-21 10:42:59 +00:00
|
|
|
updateFlags = Update::None;
|
2008-10-23 06:59:31 +00:00
|
|
|
if (theBufferList().isLoaded(buffer))
|
|
|
|
buffer->undo().endUndoGroup();
|
2007-12-21 10:42:59 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-11-26 14:36:50 +00:00
|
|
|
|
2009-09-20 21:41:21 +00:00
|
|
|
// OK, so try the current Buffer itself...
|
2009-04-06 12:12:06 +00:00
|
|
|
DispatchResult dr;
|
2009-09-05 15:42:53 +00:00
|
|
|
bv->buffer().dispatch(cmd, dr);
|
2009-04-06 12:12:06 +00:00
|
|
|
if (dr.dispatched()) {
|
|
|
|
updateFlags = dr.update();
|
|
|
|
break;
|
|
|
|
}
|
2009-09-20 21:41:21 +00:00
|
|
|
// and with the document Buffer.
|
2009-09-19 14:05:52 +00:00
|
|
|
if (doc_bv) {
|
2009-09-20 21:41:21 +00:00
|
|
|
doc_bv->buffer().dispatch(cmd, dr);
|
2009-09-19 14:05:52 +00:00
|
|
|
if (dr.dispatched()) {
|
|
|
|
updateFlags = dr.update();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-04-06 12:12:06 +00:00
|
|
|
|
2009-03-30 13:49:52 +00:00
|
|
|
// Is this a function that acts on inset at point?
|
2009-09-05 15:42:53 +00:00
|
|
|
Inset * inset = bv->cursor().nextInset();
|
2009-03-30 13:49:52 +00:00
|
|
|
if (lyxaction.funcHasFlag(action, LyXAction::AtPoint)
|
|
|
|
&& inset) {
|
2009-09-05 15:42:53 +00:00
|
|
|
bv->cursor().result().dispatched(true);
|
|
|
|
bv->cursor().result().update(Update::FitCursor | Update::Force);
|
2009-03-30 13:49:52 +00:00
|
|
|
FuncRequest tmpcmd = cmd;
|
2009-09-05 15:42:53 +00:00
|
|
|
inset->dispatch(bv->cursor(), tmpcmd);
|
|
|
|
if (bv->cursor().result().dispatched()) {
|
|
|
|
updateFlags = bv->cursor().result().update();
|
2009-03-30 13:49:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-26 14:36:50 +00:00
|
|
|
// Let the current Cursor dispatch its own actions.
|
2009-09-05 15:42:53 +00:00
|
|
|
Cursor old = bv->cursor();
|
|
|
|
bv->cursor().getPos(cursorPosBeforeDispatchX_,
|
2007-12-17 18:13:02 +00:00
|
|
|
cursorPosBeforeDispatchY_);
|
2009-09-05 15:42:53 +00:00
|
|
|
bv->cursor().dispatch(cmd);
|
2008-02-22 20:45:18 +00:00
|
|
|
|
|
|
|
// notify insets we just left
|
2009-09-05 15:42:53 +00:00
|
|
|
if (bv->cursor() != old) {
|
2008-02-22 20:45:18 +00:00
|
|
|
old.fixIfBroken();
|
2009-09-05 15:42:53 +00:00
|
|
|
bool badcursor = notifyCursorLeavesOrEnters(old, bv->cursor());
|
2008-02-22 20:45:18 +00:00
|
|
|
if (badcursor)
|
2009-09-05 15:42:53 +00:00
|
|
|
bv->cursor().fixIfBroken();
|
2007-12-21 11:22:17 +00:00
|
|
|
}
|
2008-02-22 20:45:18 +00:00
|
|
|
|
2008-10-23 06:59:31 +00:00
|
|
|
if (theBufferList().isLoaded(buffer))
|
|
|
|
buffer->undo().endUndoGroup();
|
2008-09-18 14:34:33 +00:00
|
|
|
|
2008-02-29 09:18:46 +00:00
|
|
|
// update completion. We do it here and not in
|
|
|
|
// processKeySym to avoid another redraw just for a
|
|
|
|
// changed inline completion
|
|
|
|
if (cmd.origin == FuncRequest::KEYBOARD) {
|
2009-07-12 14:56:38 +00:00
|
|
|
if (cmd.action == LFUN_SELF_INSERT
|
2009-09-05 15:42:53 +00:00
|
|
|
|| (cmd.action == LFUN_ERT_INSERT && bv->cursor().inMathed()))
|
|
|
|
lyx_view_->updateCompletion(bv->cursor(), true, true);
|
2008-02-29 09:18:46 +00:00
|
|
|
else if (cmd.action == LFUN_CHAR_DELETE_BACKWARD)
|
2009-09-05 15:42:53 +00:00
|
|
|
lyx_view_->updateCompletion(bv->cursor(), false, true);
|
2008-02-29 09:18:46 +00:00
|
|
|
else
|
2009-09-05 15:42:53 +00:00
|
|
|
lyx_view_->updateCompletion(bv->cursor(), false, false);
|
2008-02-29 09:18:46 +00:00
|
|
|
}
|
|
|
|
|
2009-09-05 15:42:53 +00:00
|
|
|
updateFlags = bv->cursor().result().update();
|
2004-03-18 12:53:43 +00:00
|
|
|
}
|
2001-02-23 16:10:03 +00:00
|
|
|
|
2008-10-23 06:59:31 +00:00
|
|
|
// if we executed a mutating lfun, mark the buffer as dirty
|
2008-10-23 12:35:20 +00:00
|
|
|
if (theBufferList().isLoaded(buffer) && flag.enabled()
|
2008-10-23 06:59:31 +00:00
|
|
|
&& !lyxaction.funcHasFlag(action, LyXAction::NoBuffer)
|
|
|
|
&& !lyxaction.funcHasFlag(action, LyXAction::ReadOnly))
|
|
|
|
buffer->markDirty();
|
|
|
|
|
2009-09-05 14:48:36 +00:00
|
|
|
if (lyx_view_ && lyx_view_->currentBufferView()) {
|
2006-11-21 09:04:54 +00:00
|
|
|
// BufferView::update() updates the ViewMetricsInfo and
|
|
|
|
// also initializes the position cache for all insets in
|
|
|
|
// (at least partially) visible top-level paragraphs.
|
2006-12-07 11:46:27 +00:00
|
|
|
// We will redraw the screen only if needed.
|
2009-09-05 15:42:53 +00:00
|
|
|
lyx_view_->currentBufferView()->processUpdateFlags(updateFlags);
|
2006-07-13 16:37:55 +00:00
|
|
|
|
2008-03-10 19:08:03 +00:00
|
|
|
// Do we have a selection?
|
2009-09-05 15:42:53 +00:00
|
|
|
theSelection().haveSelection(
|
|
|
|
lyx_view_->currentBufferView()->cursor().selection());
|
2008-03-10 19:08:03 +00:00
|
|
|
|
|
|
|
// update gui
|
|
|
|
lyx_view_->restartCursor();
|
2004-03-25 09:16:36 +00:00
|
|
|
}
|
2004-03-18 12:53:43 +00:00
|
|
|
}
|
2008-02-27 12:30:41 +00:00
|
|
|
if (lyx_view_) {
|
2007-02-14 19:11:09 +00:00
|
|
|
// Some messages may already be translated, so we cannot use _()
|
|
|
|
sendDispatchMessage(translateIfPossible(getMessage()), cmd);
|
2006-11-09 14:56:57 +00:00
|
|
|
}
|
2002-07-18 20:15:29 +00:00
|
|
|
}
|
1999-11-22 16:19:48 +00:00
|
|
|
|
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
void LyXFunc::sendDispatchMessage(docstring const & msg, FuncRequest const & cmd)
|
2002-07-18 20:15:29 +00:00
|
|
|
{
|
2006-11-09 14:56:57 +00:00
|
|
|
const bool verbose = (cmd.origin == FuncRequest::MENU
|
|
|
|
|| cmd.origin == FuncRequest::TOOLBAR
|
2004-11-08 10:54:29 +00:00
|
|
|
|| cmd.origin == FuncRequest::COMMANDBUFFER);
|
|
|
|
|
2006-05-05 20:23:12 +00:00
|
|
|
if (cmd.action == LFUN_SELF_INSERT || !verbose) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::ACTION, "dispatch msg is " << to_utf8(msg));
|
2002-07-18 20:15:29 +00:00
|
|
|
if (!msg.empty())
|
2006-10-19 07:28:35 +00:00
|
|
|
lyx_view_->message(msg);
|
2002-07-18 20:15:29 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-07-28 18:13:51 +00:00
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
docstring 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
|
|
|
|
2006-12-22 09:23:10 +00:00
|
|
|
docstring comname = from_utf8(lyxaction.getActionName(cmd.action));
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-07-18 20:15:29 +00:00
|
|
|
bool argsadded = false;
|
|
|
|
|
2006-09-01 15:41:38 +00:00
|
|
|
if (!cmd.argument().empty()) {
|
2004-01-30 11:41:12 +00:00
|
|
|
if (cmd.action != LFUN_UNKNOWN_ACTION) {
|
2006-12-22 09:23:10 +00:00
|
|
|
comname += ' ' + cmd.argument();
|
2002-07-18 20:15:29 +00:00
|
|
|
argsadded = true;
|
|
|
|
}
|
|
|
|
}
|
1999-11-22 16:19:48 +00:00
|
|
|
|
2008-10-31 11:19:16 +00:00
|
|
|
docstring const shortcuts = theTopLevelKeymap().printBindings(cmd, KeySequence::ForGui);
|
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;
|
2006-09-01 15:41:38 +00:00
|
|
|
else if (!argsadded && !cmd.argument().empty())
|
2006-12-22 09:23:10 +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);
|
2006-12-22 09:23:10 +00:00
|
|
|
dispatch_msg += '(' + rtrim(comname) + ')';
|
2002-07-18 20:15:29 +00:00
|
|
|
}
|
|
|
|
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::ACTION, "verbose dispatch msg " << to_utf8(dispatch_msg));
|
2002-07-18 20:15:29 +00:00
|
|
|
if (!dispatch_msg.empty())
|
2006-10-19 07:28:35 +00:00
|
|
|
lyx_view_->message(dispatch_msg);
|
2002-07-18 20:15:29 +00:00
|
|
|
}
|
|
|
|
|
2002-07-28 18:13:51 +00:00
|
|
|
|
2006-10-19 07:28:35 +00:00
|
|
|
// Each "lyx_view_" should have it's own message method. lyxview and
|
1999-09-27 18:44:28 +00:00
|
|
|
// 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.
|
2006-09-11 08:54:10 +00:00
|
|
|
void LyXFunc::setErrorMessage(docstring const & m) const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
dispatch_buffer = m;
|
|
|
|
errorstat = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
void LyXFunc::setMessage(docstring const & m) const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
dispatch_buffer = m;
|
|
|
|
}
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
|
|
|
2008-03-15 01:20:36 +00:00
|
|
|
docstring 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())
|
2007-10-20 20:28:05 +00:00
|
|
|
return keyseq.print(KeySequence::ForGui) + "M-";
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
|
|
// Else, when a non-complete key sequence is pressed,
|
|
|
|
// show the available options.
|
2007-09-17 22:51:03 +00:00
|
|
|
if (keyseq.length() > 0 && !keyseq.deleted())
|
|
|
|
return keyseq.printOptions(true);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(lyx_view_, /**/);
|
2009-09-05 14:48:36 +00:00
|
|
|
if (!lyx_view_->currentBufferView())
|
2006-12-21 13:58:28 +00:00
|
|
|
return _("Welcome to LyX!");
|
2002-07-28 18:13:51 +00:00
|
|
|
|
2009-09-05 15:42:53 +00:00
|
|
|
return lyx_view_->currentBufferView()->cursor().currentState();
|
2001-04-17 15:15:59 +00:00
|
|
|
}
|
2003-07-28 22:34:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool LyXFunc::wasMetaKey() const
|
|
|
|
{
|
2007-10-02 21:51:54 +00:00
|
|
|
return (meta_fake_bit != NoModifier);
|
2003-07-28 22:34:48 +00:00
|
|
|
}
|
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:
|
2007-01-15 22:49:14 +00:00
|
|
|
case LyXRC::RC_PLAINTEXT_LINELEN:
|
2008-11-16 17:49:00 +00:00
|
|
|
case LyXRC::RC_PLAINTEXT_ROFF_COMMAND:
|
2009-01-17 13:49:49 +00:00
|
|
|
case LyXRC::RC_AUTOCORRECTION_MATH:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_AUTOREGIONDELETE:
|
|
|
|
case LyXRC::RC_AUTORESET_OPTIONS:
|
|
|
|
case LyXRC::RC_AUTOSAVE:
|
|
|
|
case LyXRC::RC_AUTO_NUMBER:
|
|
|
|
case LyXRC::RC_BACKUPDIR_PATH:
|
2009-05-08 10:07:32 +00:00
|
|
|
case LyXRC::RC_BIBTEX_ALTERNATIVES:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_BIBTEX_COMMAND:
|
|
|
|
case LyXRC::RC_BINDFILE:
|
|
|
|
case LyXRC::RC_CHECKLASTFILES:
|
2008-03-16 17:07:10 +00:00
|
|
|
case LyXRC::RC_COMPLETION_CURSOR_TEXT:
|
2008-02-21 19:42:34 +00:00
|
|
|
case LyXRC::RC_COMPLETION_INLINE_DELAY:
|
2008-02-22 15:38:26 +00:00
|
|
|
case LyXRC::RC_COMPLETION_INLINE_DOTS:
|
2008-02-21 19:42:34 +00:00
|
|
|
case LyXRC::RC_COMPLETION_INLINE_MATH:
|
|
|
|
case LyXRC::RC_COMPLETION_INLINE_TEXT:
|
2008-02-22 15:38:26 +00:00
|
|
|
case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
|
2008-02-21 19:42:34 +00:00
|
|
|
case LyXRC::RC_COMPLETION_POPUP_DELAY:
|
|
|
|
case LyXRC::RC_COMPLETION_POPUP_MATH:
|
|
|
|
case LyXRC::RC_COMPLETION_POPUP_TEXT:
|
2006-04-05 22:56:18 +00:00
|
|
|
case LyXRC::RC_USELASTFILEPOS:
|
|
|
|
case LyXRC::RC_LOADSESSION:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_CHKTEX_COMMAND:
|
|
|
|
case LyXRC::RC_CONVERTER:
|
2006-11-13 19:52:05 +00:00
|
|
|
case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_COPIER:
|
|
|
|
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
|
2009-03-27 17:41:58 +00:00
|
|
|
case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_DATE_INSERT_FORMAT:
|
|
|
|
case LyXRC::RC_DEFAULT_LANGUAGE:
|
2008-06-24 12:55:40 +00:00
|
|
|
case LyXRC::RC_GUI_LANGUAGE:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_DEFAULT_PAPERSIZE:
|
2009-04-07 05:01:08 +00:00
|
|
|
case LyXRC::RC_DEFAULT_VIEW_FORMAT:
|
2007-11-10 11:22:19 +00:00
|
|
|
case LyXRC::RC_DEFFILE:
|
2005-01-16 21:01:41 +00:00
|
|
|
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) {
|
2007-10-18 21:10:35 +00:00
|
|
|
FileName path(lyxrc_new.document_path);
|
|
|
|
if (path.exists() && path.isDirectory())
|
2007-12-12 19:57:42 +00:00
|
|
|
package().document_dir() = FileName(lyxrc.document_path);
|
2005-01-16 21:01:41 +00:00
|
|
|
}
|
2009-09-05 15:11:43 +00:00
|
|
|
case LyXRC::RC_EDITOR_ALTERNATIVES:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_ESC_CHARS:
|
2007-11-30 00:04:44 +00:00
|
|
|
case LyXRC::RC_EXAMPLEPATH:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_FONT_ENCODING:
|
|
|
|
case LyXRC::RC_FORMAT:
|
2008-03-14 16:35:44 +00:00
|
|
|
case LyXRC::RC_GROUP_LAYOUTS:
|
2009-08-08 17:05:31 +00:00
|
|
|
case LyXRC::RC_HUNSPELLDIR_PATH:
|
2009-05-08 10:07:32 +00:00
|
|
|
case LyXRC::RC_INDEX_ALTERNATIVES:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_INDEX_COMMAND:
|
2009-04-13 09:53:40 +00:00
|
|
|
case LyXRC::RC_JBIBTEX_COMMAND:
|
|
|
|
case LyXRC::RC_JINDEX_COMMAND:
|
2008-08-23 09:44:00 +00:00
|
|
|
case LyXRC::RC_NOMENCL_COMMAND:
|
2005-01-16 21:01:41 +00:00
|
|
|
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:
|
2008-07-14 12:41:36 +00:00
|
|
|
case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
|
2008-01-25 22:02:38 +00:00
|
|
|
case LyXRC::RC_MACRO_EDIT_STYLE:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_MAKE_BACKUP:
|
|
|
|
case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
|
2008-01-30 21:20:29 +00:00
|
|
|
case LyXRC::RC_MOUSE_WHEEL_SPEED:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_NUMLASTFILES:
|
2009-08-19 23:02:27 +00:00
|
|
|
case LyXRC::RC_PARAGRAPH_MARKERS:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_PATH_PREFIX:
|
|
|
|
if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
|
2007-12-12 19:57:42 +00:00
|
|
|
prependEnvPath("PATH", lyxrc.path_prefix);
|
2005-01-16 21:01:41 +00:00
|
|
|
}
|
|
|
|
case LyXRC::RC_PERS_DICT:
|
|
|
|
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_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:
|
2007-11-15 12:58:44 +00:00
|
|
|
case LyXRC::RC_GEOMETRY_SESSION:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_SCREEN_ZOOM:
|
|
|
|
case LyXRC::RC_SERVERPIPE:
|
|
|
|
case LyXRC::RC_SET_COLOR:
|
|
|
|
case LyXRC::RC_SHOW_BANNER:
|
2008-03-14 23:27:31 +00:00
|
|
|
case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_SPELL_COMMAND:
|
2009-08-08 17:05:31 +00:00
|
|
|
case LyXRC::RC_SPELLCHECKER:
|
2009-03-29 19:57:30 +00:00
|
|
|
case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
|
2009-04-16 07:29:01 +00:00
|
|
|
case LyXRC::RC_SPLITINDEX_COMMAND:
|
2005-01-16 21:01:41 +00:00
|
|
|
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:51:24 +00:00
|
|
|
case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
|
|
|
|
if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
|
2007-12-12 19:57:42 +00:00
|
|
|
os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
|
2006-06-27 10:51:24 +00:00
|
|
|
}
|
2008-11-16 18:48:25 +00:00
|
|
|
case LyXRC::RC_THESAURUSDIRPATH:
|
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:
|
2006-11-13 19:52:05 +00:00
|
|
|
case LyXRC::RC_USE_CONVERTER_CACHE:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_USE_ESC_CHARS:
|
|
|
|
case LyXRC::RC_USE_INP_ENC:
|
|
|
|
case LyXRC::RC_USE_PERS_DICT:
|
2007-12-26 13:52:56 +00:00
|
|
|
case LyXRC::RC_USE_TOOLTIP:
|
2007-11-05 15:50:00 +00:00
|
|
|
case LyXRC::RC_USE_PIXMAP_CACHE:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_USE_SPELL_LIB:
|
|
|
|
case LyXRC::RC_VIEWDVI_PAPEROPTION:
|
2007-11-10 00:21:42 +00:00
|
|
|
case LyXRC::RC_SORT_LAYOUTS:
|
2008-02-21 14:34:41 +00:00
|
|
|
case LyXRC::RC_FULL_SCREEN_LIMIT:
|
|
|
|
case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
|
2009-05-26 21:41:45 +00:00
|
|
|
case LyXRC::RC_FULL_SCREEN_MENUBAR:
|
2008-02-21 14:34:41 +00:00
|
|
|
case LyXRC::RC_FULL_SCREEN_TABBAR:
|
|
|
|
case LyXRC::RC_FULL_SCREEN_TOOLBARS:
|
|
|
|
case LyXRC::RC_FULL_SCREEN_WIDTH:
|
|
|
|
case LyXRC::RC_VISUAL_CURSOR:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_VIEWER:
|
2009-09-05 15:11:43 +00:00
|
|
|
case LyXRC::RC_VIEWER_ALTERNATIVES:
|
2005-01-16 21:01:41 +00:00
|
|
|
case LyXRC::RC_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace anon
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|