#include "insets/InsetInclude.h"
#include "insets/InsetText.h"
+#include "mathed/InsetMathHull.h"
#include "mathed/MacroTable.h"
#include "mathed/MathMacroTemplate.h"
#include "mathed/MathSupport.h"
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-int const LYX_FORMAT = 389; // rgh: change how html_latex_* is stored
+int const LYX_FORMAT = 398; // uwestoehr: support for \mathscr
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
}
delete inset;
}
-
+
/// search for macro in local (buffer) table or in children
MacroData const * getBufferMacro(docstring const & name,
DocIterator const & pos) const;
/// If non zero, this buffer is a clone of existing buffer \p cloned_buffer_
/// This one is useful for preview detached in a thread.
Buffer const * cloned_buffer_;
-
+ /// are we in the process of exporting this buffer?
+ mutable bool doing_export;
+
private:
/// So we can force access via the accessors.
mutable Buffer const * parent_buffer;
read_only(readonly_), filename(file), file_fully_loaded(false),
toc_backend(owner), macro_lock(false), timestamp_(0),
checksum_(0), wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
- cloned_buffer_(cloned_buffer), parent_buffer(0)
+ cloned_buffer_(cloned_buffer), doing_export(false), parent_buffer(0)
{
if (!cloned_buffer_) {
temppath = createBufferTmpDir();
}
// Remove any previewed LaTeX snippets associated with this buffer.
- thePreviews().removeLoader(*this);
+ if (!isClone())
+ thePreviews().removeLoader(*this);
delete d;
}
params().isfontcolor = false;
params().notefontcolor = lyx::rgbFromHexName("#cccccc");
params().boxbgcolor = lyx::rgbFromHexName("#ff0000");
+ params().html_latex_start.clear();
+ params().html_latex_end.clear();
+ params().html_math_img_scale = 1.0;
+ params().output_sync_macro.erase();
for (int i = 0; i < 4; ++i) {
params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
break;
case LFUN_BRANCH_ADD: {
- docstring const branch_name = func.argument();
+ docstring branch_name = func.argument();
if (branch_name.empty()) {
dispatched = false;
break;
}
BranchList & branch_list = params().branchlist();
- Branch * branch = branch_list.find(branch_name);
- if (branch) {
- LYXERR0("Branch " << branch_name << " already exists.");
- dr.setError(true);
- docstring const msg =
- bformat(_("Branch \"%1$s\" already exists."), branch_name);
- dr.setMessage(msg);
- } else {
- branch_list.add(branch_name);
- branch = branch_list.find(branch_name);
- string const x11hexname = X11hexname(branch->color());
- docstring const str = branch_name + ' ' + from_ascii(x11hexname);
- lyx::dispatch(FuncRequest(LFUN_SET_COLOR, str));
- dr.setError(false);
- dr.update(Update::Force);
+ vector<docstring> const branches =
+ getVectorFromString(branch_name, branch_list.separator());
+ docstring msg;
+ for (vector<docstring>::const_iterator it = branches.begin();
+ it != branches.end(); ++it) {
+ branch_name = *it;
+ Branch * branch = branch_list.find(branch_name);
+ if (branch) {
+ LYXERR0("Branch " << branch_name << " already exists.");
+ dr.setError(true);
+ if (!msg.empty())
+ msg += ("\n");
+ msg += bformat(_("Branch \"%1$s\" already exists."), branch_name);
+ } else {
+ branch_list.add(branch_name);
+ branch = branch_list.find(branch_name);
+ string const x11hexname = X11hexname(branch->color());
+ docstring const str = branch_name + ' ' + from_ascii(x11hexname);
+ lyx::dispatch(FuncRequest(LFUN_SET_COLOR, str));
+ dr.setError(false);
+ dr.update(Update::Force);
+ }
}
+ if (!msg.empty())
+ dr.setMessage(msg);
break;
}
branch->setSelected(func.action() == LFUN_BRANCH_ACTIVATE);
dr.setError(false);
dr.update(Update::Force);
+ dr.forceBufferUpdate();
}
break;
}
}
}
- if (success)
+ if (success) {
dr.update(Update::Force);
+ dr.forceBufferUpdate();
+ }
break;
}
Language const * newL = languages.getLanguage(argument);
if (!newL || oldL == newL)
break;
- if (oldL->rightToLeft() == newL->rightToLeft() && !isMultiLingual())
+ if (oldL->rightToLeft() == newL->rightToLeft() && !isMultiLingual()) {
changeLanguage(oldL, newL);
+ dr.forceBufferUpdate();
+ }
break;
}
// if the .lyx file has been saved, we don't need an
// autosave
d->bak_clean = true;
+ d->undo_.markDirty();
}
continue;
}
+ if (doing_export && iit->inset->asInsetMath()) {
+ InsetMath * im = static_cast<InsetMath *>(iit->inset);
+ if (im->asHullInset()) {
+ InsetMathHull * hull = static_cast<InsetMathHull *>(im);
+ hull->recordLocation(it);
+ }
+ }
+
if (iit->inset->lyxCode() != MATHMACRO_CODE)
continue;
}
+namespace {
+ // helper class, to guarantee this gets reset properly
+ class MarkAsExporting {
+ public:
+ MarkAsExporting(Buffer const * buf) : buf_(buf)
+ {
+ LASSERT(buf_, /* */);
+ buf_->setExportStatus(true);
+ }
+ ~MarkAsExporting()
+ {
+ buf_->setExportStatus(false);
+ }
+ private:
+ Buffer const * const buf_;
+ };
+}
+
+
+void Buffer::setExportStatus(bool e) const
+{
+ d->doing_export = e;
+}
+
+
+bool Buffer::isExporting() const
+{
+ return d->doing_export;
+}
+
bool Buffer::doExport(string const & format, bool put_in_tempdir,
bool includeall, string & result_file) const
{
+ MarkAsExporting exporting(this);
string backend_format;
OutputParams runparams(¶ms().encoding());
runparams.flavor = OutputParams::LATEX;
bool Buffer::preview(string const & format, bool includeall) const
{
+ MarkAsExporting exporting(this);
string result_file;
// (1) export with all included children (omit \includeonly)
if (includeall && !doExport(format, true, true))
if (from == end)
break;
to = from;
- if (from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions)) {
+ SpellChecker::Result res = from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions);
+ if (SpellChecker::misspelled(res)) {
word_lang = wl;
break;
}