virtual ~Inset() {}
/// change associated Buffer
+ /// FIXME this should go.
virtual void setBuffer(Buffer & buffer);
/// retrieve associated Buffer
virtual Buffer & buffer();
virtual Buffer const & buffer() const;
+ /// validate inset.
+ /**
+ * This is typically used after this inset is created interactively.
+ * Intented purpose is to sanitize internal state with regard to current
+ * Buffer.
+ **/
+ virtual void validate() {}
+
/// identification as math inset
virtual InsetMath * asInsetMath() { return 0; }
/// true for 'math' math inset, but not for e.g. mbox
{}
+void InsetLabel::validate()
+{
+ update(getParam("name"));
+}
+
+
void InsetLabel::update(docstring const & new_label)
{
docstring const old_label = getParam("name");
- if (old_label == new_label)
- return;
-
docstring label = new_label;
int i = 0;
while (buffer().insetLabel(label)) {
public:
///
InsetLabel(InsetCommandParams const &);
+
+ /// verify label and update references.
+ /**
+ * Overloaded from Inset::validate.
+ **/
+ void validate();
+
///
docstring screenLabel() const;
///