X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FCommandInset.cpp;h=344c570323a32aef7156509539c2574617d242b0;hb=5d7dae9e382f0b01800f5652e673e12fa6923740;hp=3ad90d1eb88f49109ce00674f53eb24d82c7a023;hpb=31713932b247802b5b59482f5157c8a4f7206825;p=lyx.git diff --git a/src/mathed/CommandInset.cpp b/src/mathed/CommandInset.cpp index 3ad90d1eb8..344c570323 100644 --- a/src/mathed/CommandInset.cpp +++ b/src/mathed/CommandInset.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author André Pönitz + * \author André Pönitz * * Full author contact details are available in file CREDITS. */ @@ -14,7 +14,6 @@ #include "MathData.h" #include "MathStream.h" #include "DispatchResult.h" -#include "FuncRequest.h" #include @@ -23,8 +22,8 @@ using namespace std; namespace lyx { -CommandInset::CommandInset(docstring const & name, bool needs_math_mode) - : InsetMathNest(2), name_(name), needs_math_mode_(needs_math_mode), +CommandInset::CommandInset(Buffer * buf, docstring const & name, bool needs_math_mode) + : InsetMathNest(buf, 2), name_(name), needs_math_mode_(needs_math_mode), set_label_(false) { lock_ = true; @@ -41,11 +40,9 @@ void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const { if (!set_label_) { set_label_ = true; - button_.update(screenLabel(), true); + button_.update(screenLabel(), true, false); } button_.metrics(mi, dim); - // Cache the inset dimension. - setDimCache(mi, dim); } @@ -59,18 +56,17 @@ Inset * CommandInset::editXY(Cursor & cur, int /*x*/, int /*y*/) void CommandInset::draw(PainterInfo & pi, int x, int y) const { button_.draw(pi, x, y); - setPosCache(pi, x, y); } void CommandInset::write(WriteStream & os) const { - bool brace = ensureMath(os, needs_math_mode_); - os << '\\' << name_.c_str(); - if (cell(1).size()) + ModeSpecifier specifier(os, currentMode(), lockedMode(), asciiOnly()); + MathEnsurer ensurer(os, needs_math_mode_); + os << '\\' << name_; + if (!cell(1).empty()) os << '[' << cell(1) << ']'; os << '{' << cell(0) << '}'; - os.pendingBrace(brace); }