#include "InsetNote.h"
#include "Buffer.h"
+#include "BufferParams.h"
#include "BufferView.h"
+#include "BufferParams.h"
+#include "Counters.h"
#include "Cursor.h"
#include "debug.h"
#include "DispatchResult.h"
#include "FuncStatus.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
-#include "Color.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
-#include "Paragraph.h"
-#include "support/lyxalgo.h"
#include "support/Translator.h"
+#include <algorithm>
#include <sstream>
}
-void InsetNote::init()
-{
- setButtonLabel();
-}
-
-
InsetNote::InsetNote(BufferParams const & bp, string const & label)
: InsetCollapsable(bp)
{
params_.type = notetranslator().find(label);
- init();
+ setLayout(bp);
+ setButtonLabel();
}
InsetNote::InsetNote(InsetNote const & in)
: InsetCollapsable(in), params_(in.params_)
{
- init();
+ setButtonLabel();
}
}
+docstring InsetNote::name() const
+{
+ return from_ascii(string("Note") + string(":") + string(notetranslator().find(params_.type)));
+}
+
+
Inset::DisplayType InsetNote::display() const
{
switch (params_.type) {
{
params_.read(lex);
InsetCollapsable::read(buf, lex);
+ setLayout(buf.params());
setButtonLabel();
}
{
docstring const label = notetranslator_loc().find(params_.type);
setLabel(label);
-
- Font font(Font::ALL_SANE);
- font.decSize();
- font.decSize();
-
- Color_color c;
- switch (params_.type) {
- case InsetNoteParams::Note:
- c = Color::note;
- break;
- case InsetNoteParams::Comment:
- c = Color::comment;
- break;
- case InsetNoteParams::Greyedout:
- c = Color::greyedout;
- break;
- case InsetNoteParams::Framed:
- c = Color::greyedout;
- break;
- case InsetNoteParams::Shaded:
- c = Color::greyedout;
- break;
- }
- font.setColor(c);
- setLabelFont(font);
+ setLabelFont(layout_.labelfont);
}
case LFUN_INSET_MODIFY:
InsetNoteMailer::string2params(to_utf8(cmd.argument()), params_);
+ // get a bp from cur:
+ setLayout(cur.buffer().params());
setButtonLabel();
break;
}
}
+void InsetNote::updateLabels(Buffer const & buf, ParIterator const & it)
+{
+ TextClass const & tclass = buf.params().getTextClass();
+ Counters savecnt = tclass.counters();
+ InsetCollapsable::updateLabels(buf, it);
+ tclass.counters() = savecnt;
+}
+
int InsetNote::latex(Buffer const & buf, odocstream & os,
OutputParams const & runparams_in) const
os << str;
runparams_in.encoding = runparams.encoding;
// Return how many newlines we issued.
- return int(lyx::count(str.begin(), str.end(), '\n'));
+ return int(std::count(str.begin(), str.end(), '\n'));
}