#include "support/convert.h"
#include "support/os.h"
+#include <boost/current_function.hpp>
#include <boost/filesystem/operations.hpp>
#include <sstream>
bool res = false;
for ( ; cursor.depth(); cursor.pop()) {
//lyxerr << "\nLCursor::getStatus: cmd: " << cmd << endl << *this << endl;
- DocIterator::idx_type & idx = cursor.idx();
- DocIterator::idx_type const lastidx = cursor.lastidx();
- BOOST_ASSERT(idx <= lastidx);
-
- DocIterator::pit_type & pit = cursor.pit();
- DocIterator::pit_type const lastpit = cursor.lastpit();
- BOOST_ASSERT(pit <= lastpit);
-
- DocIterator::pos_type & pos = cursor.pos();
- DocIterator::pos_type const lastpos = cursor.lastpos();
- BOOST_ASSERT(pos <= lastpos);
+ BOOST_ASSERT(cursor.idx() <= cursor.lastidx());
+ BOOST_ASSERT(cursor.pit() <= cursor.lastpit());
+ BOOST_ASSERT(cursor.pos() <= cursor.lastpos());
// The inset's getStatus() will return 'true' if it made
// a definitive decision on whether it want to handle the
break;
}
+ 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;
+ }
+
case LFUN_DIALOG_SHOW: {
string const name = cmd.getArg(0);
if (!buf)
&& lyxrc.print_command != "none";
else if (name == "character" || name == "mathpanel")
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
- else if (name == "vclog")
- enable = buf->lyxvc().inUse();
else if (name == "latexlog")
enable = IsFileReadable(buf->getLogName().second);
+#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();
break;
}
break;
}
+ 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);
+ }
+ // ideally, the update flag should be set by the insets,
+ // but this is not possible currently
+ update = true;
+ break;
+ }
+
case LFUN_ALL_INSETS_TOGGLE: {
string action;
string const name = split(argument, action, ' ');
owner->message(_("Converting document to new document class..."));
ErrorList el;
- lyx::cap::SwitchLayoutsBetweenClasses(
+ lyx::cap::SwitchBetweenClasses(
old_class, new_class,
buffer->paragraphs(), el);
bufferErrors(*buffer, el);
view()->showErrorList(_("Class switch"));
+ updateCounters(*buffer);
+ update = true;
break;
}
// Redraw screen unless explicitly told otherwise.
// This also initializes the position cache for all insets
// in (at least partially) visible top-level paragraphs.
- view()->update(true, update);
+ if (update)
+ view()->update(Update::FitCursor | Update::Force);
+ else
+ view()->update(Update::FitCursor);
// if we executed a mutating lfun, mark the buffer as dirty
+ // FIXME: Why not use flag.enabled() but call getStatus again?
if (getStatus(cmd).enabled()
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)
&& !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly))
view()->owner()->updateLayoutChoice();
}
}
- sendDispatchMessage(getMessage(), cmd);
+ sendDispatchMessage(_(getMessage()), cmd);
}
case LyXRC::RC_SPELL_COMMAND:
case LyXRC::RC_TEMPDIRPATH:
case LyXRC::RC_TEMPLATEPATH:
+ case LyXRC::RC_TEX_ALLOWS_SPACES:
case LyXRC::RC_UIFILE:
case LyXRC::RC_USER_EMAIL:
case LyXRC::RC_USER_NAME: