Rationalize lyxCode().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20990 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2007-10-16 16:48:21 +00:00
parent b5538c32aa
commit 13d7df639b
13 changed files with 16 additions and 40 deletions

View File

@ -103,6 +103,8 @@ static TranslatorMap const build_translator()
InsetName("mathmacroarg", MATHMACROARG_CODE), InsetName("mathmacroarg", MATHMACROARG_CODE),
InsetName("listings", LISTINGS_CODE), InsetName("listings", LISTINGS_CODE),
InsetName("info", INFO_CODE), InsetName("info", INFO_CODE),
InsetName("collapsable", COLLAPSABLE_CODE),
InsetName("pagebreak", PAGEBREAK_CODE),
}; };
std::size_t const insetnames_size = std::size_t const insetnames_size =

View File

@ -123,13 +123,17 @@ enum InsetCode {
LISTINGS_CODE, LISTINGS_CODE,
/// ///
INFO_CODE, INFO_CODE,
///
COLLAPSABLE_CODE, // 50
}; };
/** returns the InsetCode corresponding to the \c name. /** returns the InsetCode corresponding to the \c name.
* Eg, translate("branch") == BRANCH_CODE * Eg, insetCode("branch") == BRANCH_CODE
* implemented in 'Inset.cpp'. * Implemented in 'Inset.cpp'.
*/ */
InsetCode insetCode(std::string const & name); InsetCode insetCode(std::string const & name);
/// the other way
std::string insetName(InsetCode);
} // namespace lyx } // namespace lyx

View File

@ -136,6 +136,8 @@ public:
OutputParams const &) const; OutputParams const &) const;
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
///
virtual InsetCode lyxCode() const { return COLLAPSABLE_CODE; }
protected: protected:
/// ///

View File

@ -60,12 +60,6 @@ docstring const InsetFloatList::getScreenLabel(Buffer const & buf) const
} }
InsetCode InsetFloatList::lyxCode() const
{
return FLOAT_LIST_CODE;
}
void InsetFloatList::write(Buffer const &, ostream & os) const void InsetFloatList::write(Buffer const &, ostream & os) const
{ {
os << "FloatList " << to_ascii(getParam("type")) << "\n"; os << "FloatList " << to_ascii(getParam("type")) << "\n";

View File

@ -31,7 +31,7 @@ public:
/// ///
EDITABLE editable() const { return IS_EDITABLE; } EDITABLE editable() const { return IS_EDITABLE; }
/// ///
InsetCode lyxCode() const; InsetCode lyxCode() const { return FLOAT_LIST_CODE; }
/// ///
DisplayType display() const { return AlignCenter; } DisplayType display() const { return AlignCenter; }
/// ///

View File

@ -50,12 +50,6 @@ int InsetIndex::docbook(Buffer const & buf, odocstream & os,
} }
InsetCode InsetIndex::lyxCode() const
{
return INDEX_CODE;
}
Inset * InsetIndex::clone() const Inset * InsetIndex::clone() const
{ {
return new InsetIndex(*this); return new InsetIndex(*this);

View File

@ -32,7 +32,7 @@ public:
/// ///
EDITABLE editable() const { return IS_EDITABLE; } EDITABLE editable() const { return IS_EDITABLE; }
/// ///
InsetCode lyxCode() const; InsetCode lyxCode() const { return INDEX_CODE; }
/// ///
/// ///
void metrics(MetricsInfo &, Dimension &) const; void metrics(MetricsInfo &, Dimension &) const;

View File

@ -70,12 +70,6 @@ void InsetNomencl::validate(LaTeXFeatures & features) const
} }
InsetCode InsetNomencl::lyxCode() const
{
return NOMENCL_CODE;
}
InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p) InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
: InsetCommand(p, string()) : InsetCommand(p, string())
{} {}

View File

@ -34,7 +34,7 @@ public:
/// Updates needed features for this inset. /// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
/// ///
InsetCode lyxCode() const; InsetCode lyxCode() const { return NOMENCL_CODE; }
/// ///
int docbook(Buffer const &, odocstream &, int docbook(Buffer const &, odocstream &,
OutputParams const &) const; OutputParams const &) const;

View File

@ -385,10 +385,4 @@ Inset * InsetQuotes::clone() const
} }
InsetCode InsetQuotes::lyxCode() const
{
return QUOTE_CODE;
}
} // namespace lyx } // namespace lyx

View File

@ -100,8 +100,8 @@ public:
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
/// ///
InsetCode lyxCode() const; InsetCode lyxCode() const { return QUOTE_CODE; }
// should this inset be handled like a normal character /// should this inset be handled like a normal character
bool isChar() const { return true; } bool isChar() const { return true; }
private: private:

View File

@ -48,14 +48,6 @@ docstring const InsetTOC::getScreenLabel(Buffer const & buf) const
} }
InsetCode InsetTOC::lyxCode() const
{
if (getCmdName() == "tableofcontents")
return TOC_CODE;
return NO_CODE;
}
int InsetTOC::plaintext(Buffer const & buffer, odocstream & os, int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
OutputParams const &) const OutputParams const &) const
{ {

View File

@ -28,7 +28,7 @@ public:
/// ///
EDITABLE editable() const { return IS_EDITABLE; } EDITABLE editable() const { return IS_EDITABLE; }
/// ///
InsetCode lyxCode() const; InsetCode lyxCode() const { return TOC_CODE; }
/// ///
DisplayType display() const { return AlignCenter; } DisplayType display() const { return AlignCenter; }
/// ///