Abdelrazak Younes wrote:
Abdelrazak Younes wrote:
Georg Baum wrote:
And then look at the very recent marginal bug: AFAIK (correct me if I am
wrong) this happened because of missing review of the insetName -> name
change.
Small correction: this bug appeared in the InsetOld -> Inset transfer
with the removal of setInsetName(). Nothin to do with the insetName ->
name change.
A simple and safe looking change caused a serious bug.
About this particular one, I proposed to make the method pure virtual,
any objection?
Here is the patch.
Abdel.
Index: insets/Inset.h
===================================================================
--- insets/Inset.h (revision 18191)
+++ insets/Inset.h (working copy)
@@ -365,7 +365,7 @@
virtual bool hasFixedWidth() const { return false; }
///
- virtual docstring name() const { return from_ascii("unknown"); }
+ virtual docstring name() const = 0;
/// used to toggle insets
/// is the inset open?
/// should this inset be handled like a normal charater
Index: insets/InsetBibitem.h
===================================================================
--- insets/InsetBibitem.h (revision 18191)
+++ insets/InsetBibitem.h (working copy)
@@ -28,6 +28,8 @@
///
InsetBibitem(InsetCommandParams const &);
///
+ virtual docstring name() const { return from_ascii("bibitem"); }
+ ///
void read(Buffer const &, Lexer & lex);
///
docstring const getScreenLabel(Buffer const &) const;
Index: insets/InsetBibtex.h
===================================================================
--- insets/InsetBibtex.h (revision 18191)
+++ insets/InsetBibtex.h (working copy)
@@ -28,6 +28,8 @@
///
InsetBibtex(InsetCommandParams const &);
///
+ virtual docstring name() const { return from_ascii("bibtex"); }
+ ///
docstring const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
Index: insets/InsetCaption.h
===================================================================
--- insets/InsetCaption.h (revision 18191)
+++ insets/InsetCaption.h (working copy)
@@ -28,6 +28,8 @@
///
virtual ~InsetCaption() {}
///
+ virtual docstring name() const { return from_ascii("caption"); }
+ ///
void write(Buffer const & buf, std::ostream & os) const;
///
void read(Buffer const & buf, Lexer & lex);
Index: insets/InsetCitation.h
===================================================================
--- insets/InsetCitation.h (revision 18191)
+++ insets/InsetCitation.h (working copy)
@@ -29,6 +29,8 @@
///
InsetCitation(InsetCommandParams const &);
///
+ virtual docstring name() const { return from_ascii("citation"); }
+ ///
docstring const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
Index: insets/InsetExternal.h
===================================================================
--- insets/InsetExternal.h (revision 18191)
+++ insets/InsetExternal.h (working copy)
@@ -113,6 +113,8 @@
///
virtual Inset::Code lyxCode() const { return EXTERNAL_CODE; }
///
+ virtual docstring name() const { return from_ascii("external"); }
+ ///
virtual EDITABLE editable() const { return IS_EDITABLE; }
///
Index: insets/InsetFloatList.h
===================================================================
--- insets/InsetFloatList.h (revision 18191)
+++ insets/InsetFloatList.h (working copy)
@@ -27,6 +27,8 @@
///
InsetFloatList(std::string const & type);
///
+ virtual docstring name() const { return from_ascii("floatlist"); }
+ ///
docstring const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
Index: insets/InsetGraphics.h
===================================================================
--- insets/InsetGraphics.h (revision 18191)
+++ insets/InsetGraphics.h (working copy)
@@ -35,6 +35,8 @@
///
~InsetGraphics();
///
+ virtual docstring name() const { return from_ascii("graphics"); }
+ ///
bool metrics(MetricsInfo &, Dimension &) const;
///
EDITABLE editable() const;
Index: insets/InsetHFill.h
===================================================================
--- insets/InsetHFill.h (revision 18191)
+++ insets/InsetHFill.h (working copy)
@@ -23,6 +23,8 @@
///
InsetHFill();
///
+ virtual docstring name() const { return from_ascii("hfill"); }
+ ///
bool metrics(MetricsInfo &, Dimension &) const;
///
docstring const getScreenLabel(Buffer const &) const;
Index: insets/InsetInclude.h
===================================================================
--- insets/InsetInclude.h (revision 18191)
+++ insets/InsetInclude.h (working copy)
@@ -35,6 +35,8 @@
///
InsetInclude(InsetCommandParams const &);
~InsetInclude();
+ ///
+ virtual docstring name() const { return from_ascii("include"); }
/// Override these InsetButton methods if Previewing
bool metrics(MetricsInfo & mi, Dimension & dim) const;
Index: insets/InsetIndex.h
===================================================================
--- insets/InsetIndex.h (revision 18191)
+++ insets/InsetIndex.h (working copy)
@@ -27,6 +27,8 @@
///
InsetIndex(InsetCommandParams const &);
///
+ virtual docstring name() const { return from_ascii("index"); }
+ ///
docstring const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
@@ -46,6 +48,8 @@
public:
///
InsetPrintIndex(InsetCommandParams const &);
+ ///
+ virtual docstring name() const { return from_ascii("printindex"); }
/// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const;
///
Index: insets/InsetLabel.h
===================================================================
--- insets/InsetLabel.h (revision 18191)
+++ insets/InsetLabel.h (working copy)
@@ -22,6 +22,8 @@
///
InsetLabel(InsetCommandParams const &);
///
+ virtual docstring name() const { return from_ascii("label"); }
+ ///
docstring const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
Index: insets/InsetLine.h
===================================================================
--- insets/InsetLine.h (revision 18191)
+++ insets/InsetLine.h (working copy)
@@ -24,6 +24,8 @@
InsetLine() {}
Inset::Code lyxCode() const { return Inset::LINE_CODE; }
+ ///
+ virtual docstring name() const { return from_ascii("line"); }
bool metrics(MetricsInfo &, Dimension &) const;
Index: insets/InsetNewline.h
===================================================================
--- insets/InsetNewline.h (revision 18191)
+++ insets/InsetNewline.h (working copy)
@@ -24,6 +24,8 @@
InsetNewline() {}
Inset::Code lyxCode() const { return Inset::NEWLINE_CODE; }
+ ///
+ virtual docstring name() const { return from_ascii("newline"); }
bool metrics(MetricsInfo &, Dimension &) const;
Index: insets/InsetNomencl.h
===================================================================
--- insets/InsetNomencl.h (revision 18191)
+++ insets/InsetNomencl.h (working copy)
@@ -28,6 +28,8 @@
///
InsetNomencl(InsetCommandParams const &);
///
+ virtual docstring name() const { return from_ascii("nomencl"); }
+ ///
docstring const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
@@ -53,6 +55,8 @@
public:
///
InsetPrintNomencl(InsetCommandParams const &);
+ ///
+ virtual docstring name() const { return from_ascii("printnomencl"); }
/// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const;
// FIXME: This should be editable to set the label width (stored
Index: insets/InsetPagebreak.h
===================================================================
--- insets/InsetPagebreak.h (revision 18191)
+++ insets/InsetPagebreak.h (working copy)
@@ -24,6 +24,8 @@
InsetPagebreak() {}
Inset::Code lyxCode() const { return Inset::PAGEBREAK_CODE; }
+ ///
+ virtual docstring name() const { return from_ascii("pagebreak"); }
bool metrics(MetricsInfo &, Dimension &) const;
@@ -61,6 +63,8 @@
class InsetClearPage : public InsetPagebreak {
public:
InsetClearPage() {}
+ ///
+ virtual docstring name() const { return from_ascii("clearpage"); }
docstring insetLabel() const { return _("Clear Page"); }
Index: insets/InsetRef.h
===================================================================
--- insets/InsetRef.h (revision 18191)
+++ insets/InsetRef.h (working copy)
@@ -37,8 +37,9 @@
InsetRef(InsetCommandParams const &, Buffer const &);
-
///
+ virtual docstring name() const { return from_ascii("ref"); }
+ ///
docstring const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
Index: insets/InsetSpace.h
===================================================================
--- insets/InsetSpace.h (revision 18191)
+++ insets/InsetSpace.h (working copy)
@@ -54,6 +54,8 @@
explicit
InsetSpace(Kind k);
///
+ virtual docstring name() const { return from_ascii("space"); }
+ ///
Kind kind() const;
///
bool metrics(MetricsInfo &, Dimension &) const;
Index: insets/InsetSpecialChar.h
===================================================================
--- insets/InsetSpecialChar.h (revision 18191)
+++ insets/InsetSpecialChar.h (working copy)
@@ -46,6 +46,8 @@
explicit
InsetSpecialChar(Kind k);
///
+ virtual docstring name() const { return from_ascii("specialchar"); }
+ ///
Kind kind() const;
///
bool metrics(MetricsInfo &, Dimension &) const;
Index: insets/InsetTabular.h
===================================================================
--- insets/InsetTabular.h (revision 18191)
+++ insets/InsetTabular.h (working copy)
@@ -669,6 +669,8 @@
///
~InsetTabular();
///
+ virtual docstring name() const { return from_ascii("tabular"); }
+ ///
void read(Buffer const &, Lexer &);
///
void write(Buffer const &, std::ostream &) const;
Index: insets/InsetText.h
===================================================================
--- insets/InsetText.h (revision 18191)
+++ insets/InsetText.h (working copy)
@@ -42,6 +42,8 @@
explicit InsetText(BufferParams const &);
///
InsetText();
+ ///
+ virtual docstring name() const { return from_ascii("text"); }
/// empty inset to empty par
void clear();
Index: insets/InsetTOC.h
===================================================================
--- insets/InsetTOC.h (revision 18191)
+++ insets/InsetTOC.h (working copy)
@@ -24,6 +24,8 @@
///
explicit InsetTOC(InsetCommandParams const &);
///
+ virtual docstring name() const { return from_ascii("toc"); }
+ ///
docstring const getScreenLabel(Buffer const &) const;
///
EDITABLE editable() const { return IS_EDITABLE; }
Index: insets/InsetUrl.h
===================================================================
--- insets/InsetUrl.h (revision 18191)
+++ insets/InsetUrl.h (working copy)
@@ -30,6 +30,8 @@
///
Inset::Code lyxCode() const { return Inset::URL_CODE; }
///
+ virtual docstring name() const { return from_ascii("url"); }
+ ///
void validate(LaTeXFeatures &) const;
///
docstring const getScreenLabel(Buffer const &) const;
Index: insets/InsetVSpace.h
===================================================================
--- insets/InsetVSpace.h (revision 18191)
+++ insets/InsetVSpace.h (working copy)
@@ -29,6 +29,8 @@
///
~InsetVSpace();
///
+ virtual docstring name() const { return from_ascii("vspace"); }
+ ///
bool metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
Index: mathed/InsetMath.h
===================================================================
--- mathed/InsetMath.h (revision 18191)
+++ mathed/InsetMath.h (working copy)
@@ -96,6 +96,8 @@
InsetMath * asInsetMath() { return this; }
/// this is overridden in math text insets (i.e. mbox)
bool inMathed() const { return true; }
+ ///
+ virtual docstring name() const { return from_ascii("unknown"); }
/// the ascent of the inset above the baseline
/// compute the size of the object for text based drawing