#include "BufferView.h"
#include "Cursor.h"
#include "Dimension.h"
-#include "DispatchResult.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "InsetLayout.h"
-#include "InsetList.h"
-#include "Language.h"
#include "Lexer.h"
#include "MetricsInfo.h"
-#include "output_xhtml.h"
#include "OutputParams.h"
-#include "paragraph_funcs.h"
-#include "ParagraphParameters.h"
-#include "sgml.h"
-#include "TextClass.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
namespace lyx {
-InsetCollapsable::InsetCollapsable(Buffer const & buf, InsetText::UsePlain ltype)
- : InsetText(buf, ltype), status_(Inset::Open),
+InsetCollapsable::InsetCollapsable(Buffer * buf, InsetText::UsePlain ltype)
+ : InsetText(buf, ltype), status_(Open),
openinlined_(false), mouse_hover_(false)
{
setAutoBreakRows(true);
break;
}
os << "\n";
- text().write(buffer(), os);
+ text().write(os);
}
// Draw button first -- top, left or only
Dimension dimc = dimensionCollapsed(bv);
- if (geometry(*pi.base.bv) == TopButton ||
- geometry(*pi.base.bv) == LeftButton ||
- geometry(*pi.base.bv) == ButtonOnly) {
+ if (geometry(bv) == TopButton ||
+ geometry(bv) == LeftButton ||
+ geometry(bv) == ButtonOnly) {
button_dim.x1 = x + 0;
button_dim.x2 = x + dimc.width();
button_dim.y1 = y - dimc.asc;
}
-bool InsetCollapsable::descendable() const
+bool InsetCollapsable::descendable(BufferView const & bv) const
{
- return geometry() != ButtonOnly;
+ return geometry(bv) != ButtonOnly;
}
}
-docstring const InsetCollapsable::buttonLabel(BufferView const &) const
+docstring const InsetCollapsable::buttonLabel(BufferView const & bv) const
{
- return labelstring_.empty() ? getLayout().labelstring() : labelstring_;
+ docstring const label = labelstring_.empty() ?
+ translateIfPossible(getLayout().labelstring()) : labelstring_;
+ InsetLayout const & il = getLayout();
+ if (!il.contentaslabel() || geometry(bv) != ButtonOnly)
+ return label;
+ return getNewLabel(label);
}