lyx_mirror/src/mathed/CommandInset.h
Jean-Marc Lasgouttes a48581f48c Linearize macros in box edit mode too.
The special mode used by macros where the macro name is displayed as
grey text in a box is now one of the possible marker types for any
inset. The new code puts the macro name below the text, which means
that only the text below the current line will be moved. This makes
edition much more comfortable. The grey border around the contents has
been removed too.

The marker_type enum has been moved from Inset to InsetMath. A
markerMargin() function returns the horizontal margin required on each
side for the marker. Only the corner-type markers MARKER and MARKER2
need some.

A new BOX_MARKER enum value has been added and is taken care of in
afterMetricsMarkers (renamed from metricsMarkerVertical) and
drawMarkers.

The InsetMath::marker() macro now takes a BufferView pointer as
argument, so that the marker type can depend on editing state.

MathRow::metrics now makes changes to the MathRow object when needed.

The specific metrics/draw code in MathMacro has been removed and
replaced by assertions. Code in addToMathRow and marker is adapted to
reflect the cases where linearization is possible.
2017-03-23 10:17:07 +01:00

66 lines
1.2 KiB
C++

// -*- C++ -*-
/**
* \file CommandInset.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#ifndef COMMAND_INSET_H
#define COMMAND_INSET_H
#include "InsetMathNest.h"
#include "insets/RenderButton.h"
namespace lyx {
/// Inset for things like \name[options]{contents}
class CommandInset : public InsetMathNest {
public:
///
explicit CommandInset(Buffer * buf, docstring const & name,
bool needs_math_mode = true);
///
marker_type marker(BufferView const *) const { return NO_MARKER; }
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
Inset * editXY(Cursor &, int, int);
///
void write(WriteStream & os) const;
//
// void infoize(odocstream & os) const;
///
virtual docstring const screenLabel() const;
///
docstring const & commandname() const { return name_; }
///
bool isActive() const { return false; }
private:
virtual Inset * clone() const;
///
docstring name_;
///
bool needs_math_mode_;
///
mutable bool set_label_;
///
mutable RenderButton button_;
};
} // namespace lyx
#endif