Organize header files in src\insets.

- Functions that inherit from the same baseclass are grouped together with a command;
- Functions that inherit should not have a doxy entry;
- Other functions are also grouped together as much as possible;
- Some function don't need to be implemented if they return the same as the baseclass;
- and more.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35873 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-10-27 21:35:13 +00:00
parent 716cfaea68
commit c75d667e78
12 changed files with 367 additions and 149 deletions

View File

@ -35,6 +35,35 @@ public:
InsetBibitem(Buffer *, InsetCommandParams const &);
///
~InsetBibitem();
///
void updateCommand(docstring const & new_key, bool dummy = false);
/// \name Public functions inherited from Inset class
//@{
///
InsetCode lyxCode() const { return BIBITEM_CODE; }
///
bool hasSettings() const { return true; }
/// \copydoc Inset::initView()
/// verify label and update references.
void initView();
///
bool isLabeled() const { return true; }
///
void read(Lexer & lex);
///
int plaintext(odocstream &, OutputParams const &) const;
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
/// update the counter of this inset
void updateBuffer(ParIterator const &, UpdateType);
///@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
@ -42,38 +71,28 @@ public:
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "bibitem"; }
///
void updateCommand(docstring const & new_key, bool dummy = false);
///@}
private:
/// verify label and update references.
/// Overloaded from Inset::initView.
void initView();
///
bool isLabeled() const { return true; }
///
void read(Lexer & lex);
///
docstring screenLabel() const;
///
bool hasSettings() const { return true; }
///
InsetCode lyxCode() const { return BIBITEM_CODE; }
///
docstring bibLabel() const;
///
int plaintext(odocstream &, OutputParams const &) const;
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
/// Update the counter of this inset
void updateBuffer(ParIterator const &, UpdateType);
/// \name Private functions inherited from Inset class
//@{
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
Inset * clone() const { return new InsetBibitem(*this); }
///@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const;
//@}
friend docstring bibitemWidest(Buffer const & buffer, OutputParams const &);
/// The label that is set by updateBuffer
docstring autolabel_;
///
@ -84,6 +103,7 @@ private:
/// Return the widest label in the Bibliography.
docstring bibitemWidest(Buffer const &, OutputParams const &);
} // namespace lyx
#endif // INSET_BIBITEM_H

View File

@ -29,8 +29,16 @@ public:
InsetBibtex(Buffer *, InsetCommandParams const &);
///
~InsetBibtex();
///
docstring screenLabel() const;
support::FileNameList getBibFiles() const;
///
bool addDatabase(docstring const &);
///
bool delDatabase(docstring const &);
/// \name Public functions inherited from Inset class
//@{
///
docstring toolTip(BufferView const & bv, int x, int y) const;
///
@ -44,37 +52,47 @@ public:
///
void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
///
support::FileNameList getBibFiles() const;
///
bool addDatabase(docstring const &);
///
bool delDatabase(docstring const &);
///
void validate(LaTeXFeatures &) const;
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
docstring contextMenu(BufferView const &, int, int) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "bibtex"; }
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "bibtex"; }
//@}
private:
/// look up the path to the file using TeX
static support::FileName
getBibTeXPath(docstring const & filename, Buffer const & buf);
///
docstring contextMenu(BufferView const &, int, int) const;
private:
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
void editDatabases() const;
/// \name Private functions inherited from Inset class
//@{
///
bool getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const;
///
void editDatabases() const;
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
Inset * clone() const { return new InsetBibtex(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const;
//@}
};

View File

@ -32,12 +32,13 @@ class InsetCitation : public InsetCommand
{
public:
///
explicit InsetCitation(Buffer * buf, InsetCommandParams const &);
InsetCitation(Buffer * buf, InsetCommandParams const &);
/// \name Public functions inherited from Inset class
//@{
///
bool isLabeled() const { return true; }
///
docstring screenLabel() const;
///
bool hasSettings() const { return true; }
///
docstring toolTip(BufferView const & bv, int x, int y) const;
@ -51,7 +52,7 @@ public:
int docbook(odocstream &, OutputParams const &) const;
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
/// the string that is passed to the TOC
///
void tocString(odocstream &) const;
///
void validate(LaTeXFeatures &) const;
@ -59,7 +60,12 @@ public:
void updateBuffer(ParIterator const & it, UpdateType);
///
void addToToc(DocIterator const &);
///
docstring contextMenu(BufferView const & bv, int x, int y) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
// FIXME This is the locus of the design problem we have.
@ -69,17 +75,28 @@ public:
static std::string defaultCommand() { return "cite"; }
///
static bool isCompatibleCommand(std::string const & cmd);
///
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
//@}
private:
///
Inset * clone() const { return new InsetCitation(*this); }
/// tries to make a pretty label and makes a basic one if not
docstring generateLabel(bool for_xhtml = false) const;
/// makes a pretty label
docstring complexLabel(bool for_xhtml = false) const;
/// makes a very basic label, in case we can't make a pretty one
docstring basicLabel(bool for_xhtml = false) const;
/// \name Private functions inherited from Inset class
//@{
///
Inset * clone() const { return new InsetCitation(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const;
//@}
/// we'll eventually want to be able to get info on this from the
/// various CiteEngines
static ParamInfo param_info_;
@ -102,6 +119,7 @@ private:
mutable Cache cache;
};
} // namespace lyx
#endif // INSET_CITATION_H

View File

@ -64,7 +64,7 @@ public:
/// FIXME Remove
docstring const getFirstNonOptParam() const { return p_.getFirstNonOptParam(); }
/// \name Methods inherited from Inset class
/// \name Public functions inherited from Inset class
//@{
///
void write(std::ostream & os) const { p_.write(os); }
@ -98,7 +98,7 @@ public:
//@}
protected:
/// \name Methods relaying to the InsetCommandParams
/// \name Functions relaying to the InsetCommandParams
//@{
/// Build the complete LaTeX command
/// \see InsetCommandParams::getCommand
@ -120,7 +120,7 @@ private:
/// This should provide the text for the button
virtual docstring screenLabel() const = 0;
/// \name Methods obligated for InsetCommand derived classes
/// \name Static public methods obligated for InsetCommand derived classes
//@{
/// Return parameter information for command cmdName.
/// Not implemented here. Must be implemented in derived class.

View File

@ -26,8 +26,9 @@ public:
InsetFloatList(Buffer *);
///
InsetFloatList(Buffer *, std::string const & type);
///
docstring screenLabel() const;
/// \name Public functions inherited from Inset class
//@{
///
InsetCode lyxCode() const { return FLOAT_LIST_CODE; }
///
@ -46,15 +47,31 @@ public:
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
void validate(LaTeXFeatures & features) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "listoftables"; }
///
static bool isCompatibleCommand(std::string const & s);
//@}
private:
/// \name Private functions inherited from Inset class
//@{
///
Inset * clone() const { return new InsetFloatList(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const;
//@}
///
static ParamInfo param_info_;
};

View File

@ -23,17 +23,26 @@ class InsetHyperlink : public InsetCommand
{
public:
///
explicit InsetHyperlink(Buffer * buf, InsetCommandParams const &);
InsetHyperlink(Buffer * buf, InsetCommandParams const &);
/// \name Public functions inherited from Inset class
//@{
///
InsetCode lyxCode() const { return HYPERLINK_CODE; }
///
void validate(LaTeXFeatures &) const;
///
docstring screenLabel() const;
///
bool hasSettings() const { return true; }
///
DisplayType display() const { return Inline; }
bool forceLTR() const { return true; }
///
bool isInToc() const { return true; }
///
void tocString(odocstream &) const;
///
docstring toolTip(BufferView const & bv, int x, int y) const;
///
docstring contextMenu(BufferView const &, int, int) const;
///
void validate(LaTeXFeatures &) const;
///
int latex(odocstream &, OutputParams const &) const;
///
@ -42,37 +51,42 @@ public:
int docbook(odocstream &, OutputParams const &) const;
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
/// the string that is passed to the TOC
void tocString(odocstream &) const;
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "href"; }
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "href"; }
/// Force inset into LTR environment if surroundings are RTL
bool forceLTR() const { return true; }
///
bool isInToc() const { return true; }
static std::string defaultCommand() { return "href"; }
///
docstring contextMenu(BufferView const & bv, int x, int y) const;
///
docstring toolTip(BufferView const & bv, int x, int y) const;
static ParamInfo const & findInfo(std::string const &);
//@}
private:
///
/// \name Private functions inherited from Inset class
//@{
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
bool getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const;
///
void viewTarget() const;
///
Inset * clone() const { return new InsetHyperlink(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const;
//@}
///
void viewTarget() const;
};
} // namespace lyx
#endif
#endif // INSET_HYPERLINK_H

View File

@ -37,11 +37,39 @@ class InsetInclude : public InsetCommand {
public:
///
InsetInclude(Buffer * buf, InsetCommandParams const &);
///
~InsetInclude();
void setBuffer(Buffer & buffer);
bool isLabeled() const { return true; }
///
void setChildBuffer(Buffer * buffer);
/// \return the child buffer if the file is a LyX doc and could be loaded
Buffer * getChildBuffer() const;
/** Update the cache with all bibfiles in use of the child buffer
* (including bibfiles of grandchild documents).
* Does nothing if the child document is not loaded to prevent
* automatic loading of all child documents upon loading the master.
* \param buffer the Buffer containing this inset.
*/
void updateBibfilesCache();
/** Return the cache with all bibfiles in use of the child buffer
* (including bibfiles of grandchild documents).
* Return an empty vector if the child doc is not loaded.
* \param buffer the Buffer containing this inset.
*/
support::FileNameList const &
getBibfilesCache() const;
///
void updateCommand();
/// \name Public functions inherited from Inset class
//@{
///
void setBuffer(Buffer & buffer);
///
bool isLabeled() const { return true; }
/// Override these InsetButton methods if Previewing
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
@ -50,17 +78,11 @@ public:
DisplayType display() const;
///
InsetCode lyxCode() const { return INCLUDE_CODE; }
///
void setChildBuffer(Buffer * buffer);
/** Fills \c keys
* \param buffer the Buffer containing this inset.
/** Fills \c key
* \param keys the list of bibkeys in the child buffer.
* \param it not used here
*/
void fillWithBibKeys(BiblioInfo & keys, InsetIterator const & it) const;
///
bool hasSettings() const { return true; }
///
@ -78,45 +100,57 @@ public:
///
void addToToc(DocIterator const &);
///
void updateCommand();
///
void updateBuffer(ParIterator const &, UpdateType);
///
docstring contextMenu(BufferView const & bv, int x, int y) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "include"; }
///
static bool isCompatibleCommand(std::string const & s);
///
docstring contextMenu(BufferView const & bv, int x, int y) const;
/// \return the child buffer if the file is a LyX doc and could be loaded
Buffer * getChildBuffer() const;
protected:
InsetInclude(InsetInclude const &);
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
Inset * clone() const { return new InsetInclude(*this); }
//@}
protected:
///
InsetInclude(InsetInclude const &);
private:
/** Slot receiving a signal that the external file has changed
* and the preview should be regenerated.
*/
void fileChanged() const;
/// \return loaded Buffer or zero if the file loading did not proceed.
Buffer * loadIfNeeded() const;
/// launch external application
void editIncluded(std::string const & file);
///
bool isChildIncluded() const;
/// \name Private functions inherited from Inset class
//@{
Inset * clone() const { return new InsetInclude(*this); }
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
//@}
/// \name Private functions inherited from InsetCommand class
//@{
/// set the parameters
// FIXME:InsetCommmand::setParams is not virtual
void setParams(InsetCommandParams const & params);
/// get the text displayed on the button
docstring screenLabel() const;
//@}
/// holds the entity name that defines the file location (SGML)
docstring const include_label;
///
bool isChildIncluded() const;
/// The pointer never changes although *preview_'s contents may.
boost::scoped_ptr<RenderMonitoredPreview> const preview_;

View File

@ -94,15 +94,11 @@ class InsetPrintIndex : public InsetCommand {
public:
///
InsetPrintIndex(Buffer * buf, InsetCommandParams const &);
/// \name Public functions inherited from Inset class
//@{
///
InsetCode lyxCode() const { return INDEX_PRINT_CODE; }
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "printindex"; }
///
static bool isCompatibleCommand(std::string const & s);
///
int latex(odocstream &, OutputParams const &) const;
///
@ -112,19 +108,37 @@ public:
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
///
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
private:
docstring contextMenu(BufferView const & bv, int x, int y) const;
/// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const;
///
bool hasSettings() const;
///
DisplayType display() const { return AlignCenter; }
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
docstring screenLabel() const;
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "printindex"; }
///
static bool isCompatibleCommand(std::string const & s);
//@}
private:
/// \name Private functions inherited from Inset class
//@{
///
Inset * clone() const { return new InsetPrintIndex(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const;
//@}
};

View File

@ -25,17 +25,21 @@ public:
///
InsetLabel(Buffer * buf, InsetCommandParams const &);
/// verify label and update references.
/**
* Overloaded from Inset::initView.
**/
void initView();
///
docstring const & activeCounter() const { return active_counter_; }
///
docstring const & counterValue() const { return counter_value_; }
///
docstring const & prettyCounter() const { return pretty_counter_; }
///
void updateCommand(docstring const & new_label, bool updaterefs = true);
/// \name Public functions inherited from Inset class
//@{
/// verify label and update references.
void initView();
///
bool isLabeled() const { return true; }
///
docstring screenLabel() const;
///
bool hasSettings() const { return true; }
///
@ -47,32 +51,40 @@ public:
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
void updateBuffer(ParIterator const & it, UpdateType);
///
void addToToc(DocIterator const &);
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "label"; }
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "label"; }
//@}
//FIXME: private
/// \name Private functions inherited from InsetCommand class
//@{
///
void updateBuffer(ParIterator const & it, UpdateType);
docstring screenLabel() const;
//@}
private:
/// \name Private functions inherited from Inset class
//@{
///
void addToToc(DocIterator const &);
///
void updateCommand(docstring const & new_label, bool updaterefs = true);
Inset * clone() const { return new InsetLabel(*this); }
///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const;
///
docstring const & activeCounter() const { return active_counter_; }
///
docstring const & counterValue() const { return counter_value_; }
///
docstring const & prettyCounter() const { return pretty_counter_; }
protected:
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
private:
///
Inset * clone() const { return new InsetLabel(*this); }
//@}
///
docstring screen_label_;
///

View File

@ -27,8 +27,12 @@ class InsetNomencl : public InsetCommand {
public:
///
InsetNomencl(Buffer * buf, InsetCommandParams const &);
///
docstring screenLabel() const;
int docbookGlossary(odocstream &) const;
/// \name Public functions inherited from Inset class
//@{
///
docstring toolTip(BufferView const & bv, int x, int y) const;
///
@ -41,8 +45,10 @@ public:
int docbook(odocstream &, OutputParams const &) const;
/// Does nothing at the moment.
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
int docbookGlossary(odocstream &) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
@ -50,8 +56,21 @@ public:
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "nomenclature"; }
//@}
private:
/// \name Private functions inherited from Inset class
//@{
///
Inset * clone() const { return new InsetNomencl(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const;
//@}
/// unique id for this nomenclature entry for docbook export
docstring nomenclature_entry_id;
};
@ -61,6 +80,9 @@ class InsetPrintNomencl : public InsetCommand {
public:
///
InsetPrintNomencl(Buffer * buf, InsetCommandParams const &);
/// \name Public functions inherited from Inset class
//@{
/// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const;
///
@ -74,7 +96,13 @@ public:
///
DisplayType display() const { return AlignCenter; }
///
docstring screenLabel() const;
int latex(odocstream &, OutputParams const &) const;
///
docstring contextMenu(BufferView const & bv, int x, int y) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
@ -82,17 +110,24 @@ public:
///
static bool isCompatibleCommand(std::string const & s)
{ return s == "printnomenclature"; }
//@}
private:
/// \name Private functions inherited from Inset class
//@{
///
int latex(odocstream &, OutputParams const &) const;
Inset * clone() const { return new InsetPrintNomencl(*this); }
///
docstring contextMenu(BufferView const & bv, int x, int y) const;
protected:
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const;
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
Inset * clone() const { return new InsetPrintNomencl(*this); }
docstring screenLabel() const;
//@}
};
} // namespace lyx

View File

@ -35,14 +35,14 @@ public:
///
static std::string const & getName(int type);
///
InsetRef(Buffer * buffer, InsetCommandParams const &);
/// \name Public functions inherited from Inset class
//@{
///
bool isLabeled() const { return true; }
///
docstring screenLabel() const { return screen_label_; }
///
docstring toolTip(BufferView const &, int, int) const
{ return tooltip_; }
///
@ -64,21 +64,39 @@ public:
///
void validate(LaTeXFeatures & features) const;
///
void updateBuffer(ParIterator const & it, UpdateType);
///
void addToToc(DocIterator const &);
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
static std::string defaultCommand() { return "ref"; }
///
static bool isCompatibleCommand(std::string const & s);
//@}
//FIXME: private
/// \name Private functions inherited from InsetCommand class
//@{
///
void updateBuffer(ParIterator const & it, UpdateType);
///
void addToToc(DocIterator const &);
docstring screenLabel() const { return screen_label_; }
//@}
protected:
///
InsetRef(InsetRef const &);
private:
/// \name Private functions inherited from Inset class
//@{
///
Inset * clone() const { return new InsetRef(*this); }
//@}
///
bool isLatex;
/// Force inset into LTR environment if surroundings are RTL
@ -89,6 +107,7 @@ private:
mutable docstring tooltip_;
};
} // namespace lyx
#endif
#endif // INSET_REF_H

View File

@ -26,8 +26,9 @@ class InsetTOC : public InsetCommand {
public:
///
InsetTOC(Buffer * buf, InsetCommandParams const &);
///
docstring screenLabel() const;
/// \name Public functions inherited from Inset class
//@{
///
InsetCode lyxCode() const { return TOC_CODE; }
///
@ -38,6 +39,10 @@ public:
int docbook(odocstream &, OutputParams const &) const;
///
docstring xhtml(XHTMLStream & xs, OutputParams const &) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
//@{
///
static ParamInfo const & findInfo(std::string const &);
///
@ -45,8 +50,20 @@ public:
///
static bool isCompatibleCommand(std::string const & cmd)
{ return cmd == defaultCommand(); }
//@}
private:
/// \name Private functions inherited from Inset class
//@{
///
Inset * clone() const { return new InsetTOC(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
docstring screenLabel() const;
//@}
};