mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
IU of clone() and getLabelList()
Some mathed internal renamings to prepare further IU git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7173 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1e909d97f0
commit
2a5ab60ce8
@ -395,7 +395,8 @@ void BufferView::gotoLabel(string const & label)
|
||||
{
|
||||
for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
|
||||
it != buffer()->inset_iterator_end(); ++it) {
|
||||
vector<string> labels = it->getLabelList();
|
||||
vector<string> labels;
|
||||
it->getLabelList(labels);
|
||||
if (find(labels.begin(),labels.end(),label)
|
||||
!= labels.end()) {
|
||||
beforeChange(text);
|
||||
@ -660,7 +661,8 @@ bool BufferView::ChangeInsets(Inset::Code code,
|
||||
bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
|
||||
{
|
||||
// Check if the label 'from' appears more than once
|
||||
vector<string> labels = buffer()->getLabelList();
|
||||
vector<string> labels;
|
||||
buffer()->getLabelList(labels);
|
||||
|
||||
if (lyx::count(labels.begin(), labels.end(), from) > 1)
|
||||
return false;
|
||||
|
@ -1,3 +1,11 @@
|
||||
2003-06-16 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* BufferView.C:
|
||||
* buffer.C:
|
||||
* buffer.h:
|
||||
* paragraph.C:
|
||||
* tabular.[Ch]: IU of clone() and getLabelList();
|
||||
|
||||
2003-06-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* tabular.h: compactification
|
||||
|
13
src/buffer.C
13
src/buffer.C
@ -2012,24 +2012,23 @@ void Buffer::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
vector<string> const Buffer::getLabelList() const
|
||||
void Buffer::getLabelList(std::vector<string> & list) const
|
||||
{
|
||||
/// if this is a child document and the parent is already loaded
|
||||
/// Use the parent's list instead [ale990407]
|
||||
if (!params.parentname.empty()
|
||||
&& bufferlist.exists(params.parentname)) {
|
||||
Buffer const * tmp = bufferlist.getBuffer(params.parentname);
|
||||
if (tmp)
|
||||
return tmp->getLabelList();
|
||||
if (tmp) {
|
||||
tmp->getLabelList(list);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
vector<string> label_list;
|
||||
for (inset_iterator it = inset_const_iterator_begin();
|
||||
it != inset_const_iterator_end(); ++it) {
|
||||
vector<string> const l = it->getLabelList();
|
||||
label_list.insert(label_list.end(), l.begin(), l.end());
|
||||
it->getLabelList(list);
|
||||
}
|
||||
return label_list;
|
||||
}
|
||||
|
||||
|
||||
|
@ -256,7 +256,7 @@ public:
|
||||
/// return all bibkeys from buffer and its childs
|
||||
void fillWithBibKeys(std::vector<std::pair<string, string> > & keys) const;
|
||||
///
|
||||
std::vector<string> const getLabelList() const;
|
||||
void getLabelList(std::vector<string> &) const;
|
||||
|
||||
/** This will clearly have to change later. Later we can have more
|
||||
than one user per buffer. */
|
||||
|
@ -34,7 +34,9 @@ vector<string> const ControlRef::getLabelList(string const & name) const
|
||||
Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
|
||||
if (!buf)
|
||||
buf = kernel().buffer();
|
||||
return buf->getLabelList();
|
||||
vector<string> list;
|
||||
buf->getLabelList(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,11 @@
|
||||
|
||||
2003-06-16 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insetbase.h: new virtual base function clone()
|
||||
|
||||
* *inset*.[Ch]: IU of clone() and getLabelList (i.e. essentially
|
||||
Inset * clone() -> InsetBase * clone()
|
||||
|
||||
2003-06-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insettabular.[Ch]: make tabular a proper member
|
||||
|
@ -15,7 +15,6 @@
|
||||
#ifndef INSET_H
|
||||
#define INSET_H
|
||||
|
||||
#include "LString.h"
|
||||
#include "LColor.h"
|
||||
#include "insetbase.h"
|
||||
#include "support/types.h"
|
||||
@ -194,13 +193,6 @@ public:
|
||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||
virtual Inset::Code lyxCode() const { return NO_CODE; }
|
||||
|
||||
virtual std::vector<string> const getLabelList() const {
|
||||
return std::vector<string>();
|
||||
}
|
||||
|
||||
///
|
||||
virtual Inset * clone() const = 0;
|
||||
|
||||
/// returns true to override begin and end inset in file
|
||||
virtual bool directWrite() const;
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#ifndef INSETBASE_H
|
||||
#define INSETBASE_H
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class BufferView;
|
||||
@ -64,6 +66,11 @@ public:
|
||||
/// type for column numbers
|
||||
typedef size_t col_type;
|
||||
|
||||
/// virtual base class destructor
|
||||
virtual ~InsetBase() {}
|
||||
/// replicate ourselves
|
||||
virtual InsetBase * clone() const = 0;
|
||||
|
||||
// the real dispatcher
|
||||
virtual dispatch_result dispatch
|
||||
(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
|
||||
@ -75,15 +82,14 @@ public:
|
||||
/// draw inset and update (xo, yo)-cache
|
||||
virtual void draw(PainterInfo & pi, int x, int y) const = 0;
|
||||
|
||||
///
|
||||
virtual ~InsetBase() {}
|
||||
|
||||
/// Methods to cache and retrieve a cached BufferView.
|
||||
virtual void cache(BufferView *) const {}
|
||||
///
|
||||
virtual BufferView * view() const { return 0; }
|
||||
/// request "external features"
|
||||
virtual void validate(LaTeXFeatures &) const {}
|
||||
/// fill in all labels in the inset
|
||||
virtual void getLabelList(std::vector<string> &) const {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@ InsetBibitem::~InsetBibitem()
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetBibitem::clone() const
|
||||
InsetBase * InsetBibitem::clone() const
|
||||
{
|
||||
InsetBibitem * b = new InsetBibitem(params());
|
||||
b->setCounter(counter);
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
///
|
||||
~InsetBibitem();
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
/** Currently \bibitem is used as a LyX2.x command,
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
///
|
||||
~InsetBibtex();
|
||||
///
|
||||
Inset * clone() const {
|
||||
InsetBase * clone() const {
|
||||
return new InsetBibtex(params());
|
||||
}
|
||||
/// small wrapper for the time being
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
~InsetCitation();
|
||||
///
|
||||
Inset * clone() const {
|
||||
InsetBase * clone() const {
|
||||
return new InsetCitation(params());
|
||||
}
|
||||
///
|
||||
|
@ -481,9 +481,9 @@ void InsetCollapsable::resizeLyXText(BufferView * bv, bool force) const
|
||||
}
|
||||
|
||||
|
||||
vector<string> const InsetCollapsable::getLabelList() const
|
||||
void InsetCollapsable::getLabelList(std::vector<string> & list) const
|
||||
{
|
||||
return inset.getLabelList();
|
||||
inset.getLabelList(list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
///
|
||||
void resizeLyXText(BufferView *, bool force = false) const;
|
||||
///
|
||||
std::vector<string> const getLabelList() const;
|
||||
void getLabelList(std::vector<string> &) const;
|
||||
///
|
||||
bool nodraw() const;
|
||||
///
|
||||
|
@ -40,7 +40,7 @@ InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
|
||||
{}
|
||||
|
||||
|
||||
Inset * InsetEnvironment::clone() const
|
||||
InsetBase * InsetEnvironment::clone() const
|
||||
{
|
||||
return new InsetEnvironment(*this);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
void read(Buffer const * buf, LyXLex & lex);
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::ENVIRONMENT_CODE; }
|
||||
///
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset * clone() const {
|
||||
InsetBase * clone() const {
|
||||
return new InsetError(contents);
|
||||
}
|
||||
///
|
||||
|
@ -70,7 +70,7 @@ InsetERT::InsetERT(InsetERT const & in)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetERT::clone() const
|
||||
InsetBase * InsetERT::clone() const
|
||||
{
|
||||
return new InsetERT(*this);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
///
|
||||
InsetERT(InsetERT const &);
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
InsetERT(BufferParams const &,
|
||||
Language const *, string const & contents, bool collapsed);
|
||||
|
@ -99,7 +99,7 @@ InsetExternal::InsetExternal(InsetExternal const & other)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetExternal::clone() const
|
||||
InsetBase * InsetExternal::clone() const
|
||||
{
|
||||
InsetExternal * inset = new InsetExternal(*this);
|
||||
return inset;
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
virtual Inset::Code lyxCode() const { return EXTERNAL_CODE; }
|
||||
|
||||
///
|
||||
virtual Inset * clone() const;
|
||||
virtual InsetBase * clone() const;
|
||||
|
||||
/// Set the inset parameters.
|
||||
virtual void setParams(Params const &, string const & filepath);
|
||||
|
@ -259,7 +259,7 @@ void InsetFloat::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetFloat::clone() const
|
||||
InsetBase * InsetFloat::clone() const
|
||||
{
|
||||
return new InsetFloat(*this);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
|
||||
///
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
~InsetFloatList();
|
||||
///
|
||||
Inset * clone() const {
|
||||
InsetBase * clone() const {
|
||||
return new InsetFloatList(getCmdName());
|
||||
}
|
||||
///
|
||||
|
@ -46,7 +46,7 @@ InsetFoot::InsetFoot(InsetFoot const & in)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetFoot::clone() const
|
||||
InsetBase * InsetFoot::clone() const
|
||||
{
|
||||
return new InsetFoot(*this);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
///
|
||||
InsetFoot(InsetFoot const &);
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
|
||||
///
|
||||
|
@ -151,7 +151,7 @@ InsetGraphics::InsetGraphics(InsetGraphics const & ig)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetGraphics::clone() const
|
||||
InsetBase * InsetGraphics::clone() const
|
||||
{
|
||||
return new InsetGraphics(*this);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
Inset::Code lyxCode() const { return Inset::GRAPHICS_CODE; }
|
||||
|
||||
///
|
||||
virtual Inset * clone() const;
|
||||
virtual InsetBase * clone() const;
|
||||
|
||||
/** Set the inset parameters, used by the GUIndependent dialog.
|
||||
Return true of new params are different from what was so far.
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
///
|
||||
InsetHFill();
|
||||
///
|
||||
virtual Inset * clone() const {
|
||||
virtual InsetBase * clone() const {
|
||||
return new InsetHFill;
|
||||
}
|
||||
///
|
||||
|
@ -203,7 +203,7 @@ void InsetInclude::set(Params const & p)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetInclude::clone() const
|
||||
InsetBase * InsetInclude::clone() const
|
||||
{
|
||||
//Params p(params_);
|
||||
//p.masterFilename_ = buffer.fileName();
|
||||
@ -489,18 +489,14 @@ void InsetInclude::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
vector<string> const InsetInclude::getLabelList() const
|
||||
void InsetInclude::getLabelList(std::vector<string> & list) const
|
||||
{
|
||||
vector<string> l;
|
||||
|
||||
if (loadIfNeeded()) {
|
||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||
tmp->setParentName("");
|
||||
l = tmp->getLabelList();
|
||||
tmp->getLabelList(list);
|
||||
tmp->setParentName(getMasterFilename());
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,11 +74,11 @@ public:
|
||||
void set(Params const & params);
|
||||
|
||||
///
|
||||
virtual Inset * clone() const;
|
||||
virtual InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::INCLUDE_CODE; }
|
||||
/// This returns the list of labels on the child buffer
|
||||
std::vector<string> const getLabelList() const;
|
||||
void getLabelList(std::vector<string> &) const;
|
||||
/// This returns the list of bibkeys on the child buffer
|
||||
void fillWithBibKeys(std::vector<std::pair<string,string> > & keys) const;
|
||||
///
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
~InsetIndex();
|
||||
///
|
||||
virtual Inset * clone() const {
|
||||
virtual InsetBase * clone() const {
|
||||
return new InsetIndex(params());
|
||||
}
|
||||
///
|
||||
@ -49,7 +49,7 @@ public:
|
||||
///
|
||||
~InsetPrintIndex();
|
||||
///
|
||||
Inset * clone() const {
|
||||
InsetBase * clone() const {
|
||||
return new InsetPrintIndex(params());
|
||||
}
|
||||
///
|
||||
|
@ -39,14 +39,13 @@ InsetLabel::InsetLabel(InsetCommandParams const & p)
|
||||
|
||||
InsetLabel::~InsetLabel()
|
||||
{
|
||||
InsetCommandMailer mailer("label", *this);
|
||||
mailer.hideDialog();
|
||||
InsetCommandMailer("label", *this).hideDialog();
|
||||
}
|
||||
|
||||
|
||||
vector<string> const InsetLabel::getLabelList() const
|
||||
void InsetLabel::getLabelList(std::vector<string> & list) const
|
||||
{
|
||||
return vector<string>(1, getContents());
|
||||
list.push_back(getContents());
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
///
|
||||
~InsetLabel();
|
||||
///
|
||||
virtual Inset * clone() const {
|
||||
virtual InsetBase * clone() const {
|
||||
return new InsetLabel(params());
|
||||
}
|
||||
///
|
||||
@ -34,7 +34,7 @@ public:
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::LABEL_CODE; }
|
||||
///
|
||||
std::vector<string> const getLabelList() const;
|
||||
void getLabelList(std::vector<string> &) const;
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
LatexRunParams const &) const;
|
||||
|
@ -647,7 +647,7 @@ bool InsetLatexAccent::directWrite() const
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetLatexAccent::clone() const
|
||||
InsetBase * InsetLatexAccent::clone() const
|
||||
{
|
||||
return new InsetLatexAccent(contents);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
///
|
||||
bool directWrite() const;
|
||||
///
|
||||
virtual Inset * clone() const;
|
||||
virtual InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode()const;
|
||||
///
|
||||
|
@ -41,7 +41,7 @@ InsetMarginal::InsetMarginal(InsetMarginal const & in)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetMarginal::clone() const
|
||||
InsetBase * InsetMarginal::clone() const
|
||||
{
|
||||
return new InsetMarginal(*this);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
InsetMarginal(InsetMarginal const &);
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::MARGIN_CODE; }
|
||||
///
|
||||
|
@ -93,7 +93,7 @@ InsetMinipage::InsetMinipage(InsetMinipage const & in)
|
||||
{}
|
||||
|
||||
|
||||
Inset * InsetMinipage::clone() const
|
||||
InsetBase * InsetMinipage::clone() const
|
||||
{
|
||||
return new InsetMinipage(*this);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
///
|
||||
void read(Buffer const * buf, LyXLex & lex);
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
InsetNewline() {}
|
||||
|
||||
virtual Inset * clone() const {
|
||||
virtual InsetBase * clone() const {
|
||||
return new InsetNewline;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ InsetNote::InsetNote(InsetNote const & in)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetNote::clone() const
|
||||
InsetBase * InsetNote::clone() const
|
||||
{
|
||||
return new InsetNote(*this);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
InsetNote(InsetNote const &);
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
string const editMessage() const;
|
||||
///
|
||||
|
@ -47,7 +47,7 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetOptArg::clone() const
|
||||
InsetBase * InsetOptArg::clone() const
|
||||
{
|
||||
return new InsetOptArg(*this);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
InsetOptArg(InsetOptArg const &);
|
||||
/// make a duplicate of this inset
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
/// this inset is editable
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
/// code of the inset
|
||||
|
@ -351,7 +351,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetQuotes::clone() const
|
||||
InsetBase * InsetQuotes::clone() const
|
||||
{
|
||||
return new InsetQuotes(language_, side_, times_);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
/// Create the right quote inset after character c
|
||||
InsetQuotes(char c, BufferParams const & params);
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
|
||||
~InsetRef();
|
||||
///
|
||||
virtual Inset * clone() const {
|
||||
virtual InsetBase * clone() const {
|
||||
return new InsetRef(*this);
|
||||
}
|
||||
///
|
||||
|
@ -250,7 +250,7 @@ int InsetSpace::docbook(Buffer const *, ostream & os, bool) const
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetSpace::clone() const
|
||||
InsetBase * InsetSpace::clone() const
|
||||
{
|
||||
return new InsetSpace(kind_);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
///
|
||||
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
|
||||
///
|
||||
virtual Inset * clone() const;
|
||||
virtual InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::SPACE_CODE; }
|
||||
/// We don't need \begin_inset and \end_inset
|
||||
|
@ -238,7 +238,7 @@ int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetSpecialChar::clone() const
|
||||
InsetBase * InsetSpecialChar::clone() const
|
||||
{
|
||||
return new InsetSpecialChar(kind_);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
///
|
||||
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
|
||||
///
|
||||
virtual Inset * clone() const;
|
||||
virtual InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::SPECIALCHAR_CODE; }
|
||||
/// We don't need \begin_inset and \end_inset
|
||||
|
@ -196,7 +196,7 @@ InsetTabular::~InsetTabular()
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetTabular::clone() const
|
||||
InsetBase * InsetTabular::clone() const
|
||||
{
|
||||
return new InsetTabular(*this);
|
||||
}
|
||||
@ -2351,9 +2351,9 @@ FuncStatus InsetTabular::getStatus(string const & what) const
|
||||
}
|
||||
|
||||
|
||||
vector<string> const InsetTabular::getLabelList() const
|
||||
void InsetTabular::getLabelList(std::vector<string> & list) const
|
||||
{
|
||||
return tabular.getLabelList();
|
||||
tabular.getLabelList(list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
///
|
||||
~InsetTabular();
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void read(Buffer const *, LyXLex &);
|
||||
///
|
||||
@ -164,7 +164,7 @@ public:
|
||||
///
|
||||
FuncStatus getStatus(string const & argument) const;
|
||||
///
|
||||
std::vector<string> const getLabelList() const;
|
||||
void getLabelList(std::vector<string> &) const;
|
||||
///
|
||||
void nodraw(bool b) const {
|
||||
UpdatableInset::nodraw(b);
|
||||
|
@ -193,12 +193,6 @@ void InsetText::init(InsetText const * ins)
|
||||
}
|
||||
|
||||
|
||||
InsetText::~InsetText()
|
||||
{
|
||||
paragraphs.clear();
|
||||
}
|
||||
|
||||
|
||||
void InsetText::clear(bool just_mark_erased)
|
||||
{
|
||||
if (just_mark_erased) {
|
||||
@ -224,7 +218,7 @@ void InsetText::clear(bool just_mark_erased)
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetText::clone() const
|
||||
InsetBase * InsetText::clone() const
|
||||
{
|
||||
return new InsetText(*this);
|
||||
}
|
||||
@ -1809,21 +1803,16 @@ bool InsetText::showInsetDialog(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
vector<string> const InsetText::getLabelList() const
|
||||
void InsetText::getLabelList(std::vector<string> & list) const
|
||||
{
|
||||
vector<string> label_list;
|
||||
|
||||
ParagraphList::const_iterator pit = paragraphs.begin();
|
||||
ParagraphList::const_iterator pend = paragraphs.end();
|
||||
for (; pit != pend; ++pit) {
|
||||
InsetList::const_iterator beg = pit->insetlist.begin();
|
||||
InsetList::const_iterator end = pit->insetlist.end();
|
||||
for (; beg != end; ++beg) {
|
||||
vector<string> const l = beg->inset->getLabelList();
|
||||
label_list.insert(label_list.end(), l.begin(), l.end());
|
||||
}
|
||||
for (; beg != end; ++beg)
|
||||
beg->inset->getLabelList(list);
|
||||
}
|
||||
return label_list;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,12 +72,9 @@ public:
|
||||
///
|
||||
InsetText(BufferParams const &);
|
||||
///
|
||||
explicit
|
||||
InsetText(InsetText const &);
|
||||
explicit InsetText(InsetText const &);
|
||||
///
|
||||
~InsetText();
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
InsetText & operator=(InsetText const & it);
|
||||
/// empty inset to empty par, or just mark as erased
|
||||
@ -172,7 +169,7 @@ public:
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
std::vector<string> const getLabelList() const;
|
||||
void getLabelList(std::vector<string> &) const;
|
||||
///
|
||||
bool nodraw() const;
|
||||
///
|
||||
|
@ -53,7 +53,7 @@ void InsetTheorem::write(Buffer const * buf, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetTheorem::clone() const
|
||||
InsetBase * InsetTheorem::clone() const
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Is this inset used? If YES this is WRONG!!! (Jug)
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
void write(Buffer const * buf, std::ostream & os) const;
|
||||
///
|
||||
virtual Inset * clone() const;
|
||||
virtual InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::THEOREM_CODE; }
|
||||
///
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
///
|
||||
~InsetTOC();
|
||||
///
|
||||
virtual Inset * clone() const {
|
||||
virtual InsetBase * clone() const {
|
||||
return new InsetTOC(params());
|
||||
}
|
||||
///
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
///
|
||||
~InsetUrl();
|
||||
///
|
||||
virtual Inset * clone() const {
|
||||
virtual InsetBase * clone() const {
|
||||
return new InsetUrl(params());
|
||||
}
|
||||
///
|
||||
|
@ -167,7 +167,7 @@ void InsetWrap::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetWrap::clone() const
|
||||
InsetBase * InsetWrap::clone() const
|
||||
{
|
||||
return new InsetWrap(*this);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
Inset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
|
||||
///
|
||||
|
@ -1,24 +1,10 @@
|
||||
2003-06-11 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* button_inset.[Ch]: removed.
|
||||
* Makefile.am: remove button_inset.[Ch].
|
||||
2003-06-16 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* command_inset.[Ch]: no longer derived from ButtonInset.
|
||||
Instead has a ButtonRenderer member variable.
|
||||
* math_*inset.[Ch]: IU of clone()
|
||||
|
||||
* ref_inset.[Ch]: associated changes.
|
||||
|
||||
2003-06-03 John Levon <levon@movementarian.org>
|
||||
|
||||
* formula.[Ch]:
|
||||
* formulabase.h:
|
||||
* formulamacro.[Ch]: clone() doesn't take a Buffer anymore
|
||||
|
||||
2003-06-02 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* math_*.[Ch]: finish unified two-stage drawing
|
||||
|
||||
* math_inset.h: move validate to insetbase.h
|
||||
* math_cursorpos.[Ch]:
|
||||
* math_cursor.[Ch]: rename MathCursorPos -> CursorPos, par_ -> inset_
|
||||
|
||||
2003-05-28 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -14,7 +14,7 @@ CommandInset::CommandInset(string const & name)
|
||||
}
|
||||
|
||||
|
||||
MathInset * CommandInset::clone() const
|
||||
InsetBase * CommandInset::clone() const
|
||||
{
|
||||
return new CommandInset(*this);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
///
|
||||
explicit CommandInset(string const & name);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
|
@ -122,7 +122,7 @@ void InsetFormulaBase::handleFont
|
||||
// this whole function is a hack and won't work for incremental font
|
||||
// changes...
|
||||
bv->lockedInsetStoreUndo(Undo::EDIT);
|
||||
if (mathcursor->par()->name() == font)
|
||||
if (mathcursor->inset()->name() == font)
|
||||
mathcursor->handleFont(font);
|
||||
else {
|
||||
mathcursor->handleNest(createMathInset(font));
|
||||
|
@ -18,7 +18,7 @@ MathAMSArrayInset::MathAMSArrayInset(string const & name)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathAMSArrayInset::clone() const
|
||||
InsetBase * MathAMSArrayInset::clone() const
|
||||
{
|
||||
return new MathAMSArrayInset(*this);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
///
|
||||
MathAMSArrayInset(string const & name);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
|
@ -57,7 +57,7 @@ MathArrayInset::MathArrayInset(string const & name, string const & str)
|
||||
}
|
||||
|
||||
|
||||
MathInset * MathArrayInset::clone() const
|
||||
InsetBase * MathArrayInset::clone() const
|
||||
{
|
||||
return new MathArrayInset(*this);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
/// convienience constructor from whitespace/newline seperated data
|
||||
MathArrayInset(string const &, string const & str);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
|
@ -14,9 +14,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "math_atom.h"
|
||||
#include "math_inset.h"
|
||||
#include "insets/insetbase.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
@ -26,13 +26,13 @@ MathAtom::MathAtom()
|
||||
{}
|
||||
|
||||
|
||||
MathAtom::MathAtom(MathInset * p)
|
||||
: nucleus_(p)
|
||||
MathAtom::MathAtom(InsetBase * p)
|
||||
: nucleus_(static_cast<MathInset *>(p))
|
||||
{}
|
||||
|
||||
|
||||
MathAtom::MathAtom(MathAtom const & at)
|
||||
: nucleus_(at.nucleus_ ? at.nucleus_->clone() : 0)
|
||||
: nucleus_(at.nucleus_ ? static_cast<MathInset *>(at.nucleus_->clone()) : 0)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@ Andre'
|
||||
|
||||
*/
|
||||
|
||||
class InsetBase;
|
||||
class MathInset;
|
||||
|
||||
class MathAtom {
|
||||
@ -43,7 +44,7 @@ public:
|
||||
// std::containers
|
||||
MathAtom();
|
||||
/// the "real constructor"
|
||||
explicit MathAtom(MathInset * p);
|
||||
explicit MathAtom(InsetBase * p);
|
||||
/// copy constructor, invokes nucleus_->clone()
|
||||
MathAtom(MathAtom const &);
|
||||
/// we really need to clean up
|
||||
|
@ -12,7 +12,7 @@ MathBigInset::MathBigInset(string const & name, string const & delim)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathBigInset::clone() const
|
||||
InsetBase * MathBigInset::clone() const
|
||||
{
|
||||
return new MathBigInset(*this);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
///
|
||||
MathBigInset(string const & name, string const & delim);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
|
@ -16,7 +16,7 @@ MathBinaryOpInset::MathBinaryOpInset(char op)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathBinaryOpInset::clone() const
|
||||
InsetBase * MathBinaryOpInset::clone() const
|
||||
{
|
||||
return new MathBinaryOpInset(*this);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
///
|
||||
explicit MathBinaryOpInset(char op);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void draw(PainterInfo &, int x, int y) const;
|
||||
///
|
||||
|
@ -14,7 +14,7 @@ MathBinomInset::MathBinomInset(bool choose)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathBinomInset::clone() const
|
||||
InsetBase * MathBinomInset::clone() const
|
||||
{
|
||||
return new MathBinomInset(*this);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
///
|
||||
explicit MathBinomInset(bool choose = false);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
|
@ -12,7 +12,7 @@ MathBoxInset::MathBoxInset(string const & name)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathBoxInset::clone() const
|
||||
InsetBase * MathBoxInset::clone() const
|
||||
{
|
||||
return new MathBoxInset(*this);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
///
|
||||
explicit MathBoxInset(string const & name);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
///
|
||||
|
@ -21,7 +21,7 @@ MathBraceInset::MathBraceInset(MathArray const & ar)
|
||||
}
|
||||
|
||||
|
||||
MathInset * MathBraceInset::clone() const
|
||||
InsetBase * MathBraceInset::clone() const
|
||||
{
|
||||
return new MathBraceInset(*this);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
///
|
||||
MathBraceInset(MathArray const & ar);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
/// we write extra braces in any case...
|
||||
bool extraBraces() const { return true; }
|
||||
///
|
||||
|
@ -14,7 +14,7 @@ MathCasesInset::MathCasesInset(row_type n)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathCasesInset::clone() const
|
||||
InsetBase * MathCasesInset::clone() const
|
||||
{
|
||||
return new MathCasesInset(*this);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
///
|
||||
explicit MathCasesInset(row_type rows = 1u);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
|
@ -49,7 +49,7 @@ MathCharInset::MathCharInset(char c)
|
||||
|
||||
|
||||
|
||||
MathInset * MathCharInset::clone() const
|
||||
InsetBase * MathCharInset::clone() const
|
||||
{
|
||||
return new MathCharInset(*this);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
///
|
||||
explicit MathCharInset(char c);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
|
@ -21,7 +21,7 @@ MathCommentInset::MathCommentInset(string const & str)
|
||||
}
|
||||
|
||||
|
||||
MathInset * MathCommentInset::clone() const
|
||||
InsetBase * MathCommentInset::clone() const
|
||||
{
|
||||
return new MathCommentInset(*this);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
///
|
||||
explicit MathCommentInset(string const &);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
|
@ -80,7 +80,7 @@ MathCursor::~MathCursor()
|
||||
|
||||
void MathCursor::push(MathAtom & t)
|
||||
{
|
||||
Cursor_.push_back(MathCursorPos(t.nucleus()));
|
||||
Cursor_.push_back(CursorPos(t.nucleus()));
|
||||
}
|
||||
|
||||
|
||||
@ -106,10 +106,10 @@ bool MathCursor::popLeft()
|
||||
//lyxerr << "Leaving atom to the left\n";
|
||||
if (depth() <= 1) {
|
||||
if (depth() == 1)
|
||||
par()->notifyCursorLeaves(idx());
|
||||
inset()->notifyCursorLeaves(idx());
|
||||
return false;
|
||||
}
|
||||
par()->notifyCursorLeaves(idx());
|
||||
inset()->notifyCursorLeaves(idx());
|
||||
Cursor_.pop_back();
|
||||
return true;
|
||||
}
|
||||
@ -117,13 +117,13 @@ bool MathCursor::popLeft()
|
||||
|
||||
bool MathCursor::popRight()
|
||||
{
|
||||
//lyxerr << "Leaving atom "; par()->write(cerr, false); cerr << " right\n";
|
||||
//lyxerr << "Leaving atom "; inset()->write(cerr, false); cerr << " right\n";
|
||||
if (depth() <= 1) {
|
||||
if (depth() == 1)
|
||||
par()->notifyCursorLeaves(idx());
|
||||
inset()->notifyCursorLeaves(idx());
|
||||
return false;
|
||||
}
|
||||
par()->notifyCursorLeaves(idx());
|
||||
inset()->notifyCursorLeaves(idx());
|
||||
Cursor_.pop_back();
|
||||
posRight();
|
||||
return true;
|
||||
@ -151,7 +151,7 @@ bool MathCursor::popRight()
|
||||
bool MathCursor::isInside(MathInset const * p) const
|
||||
{
|
||||
for (unsigned i = 0; i < depth(); ++i)
|
||||
if (Cursor_[i].par_ == p)
|
||||
if (Cursor_[i].inset_ == p)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -169,7 +169,7 @@ bool MathCursor::openable(MathAtom const & t, bool sel) const
|
||||
// we can't move into anything new during selection
|
||||
if (depth() == Anchor_.size())
|
||||
return false;
|
||||
if (t.operator->() != Anchor_[depth()].par_)
|
||||
if (t.operator->() != Anchor_[depth()].inset_)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -178,7 +178,7 @@ bool MathCursor::openable(MathAtom const & t, bool sel) const
|
||||
|
||||
bool MathCursor::inNucleus() const
|
||||
{
|
||||
return par()->asScriptInset() && idx() == 2;
|
||||
return inset()->asScriptInset() && idx() == 2;
|
||||
}
|
||||
|
||||
|
||||
@ -244,7 +244,7 @@ void MathCursor::first()
|
||||
{
|
||||
Cursor_.clear();
|
||||
push(formula_->par());
|
||||
par()->idxFirst(idx(), pos());
|
||||
inset()->idxFirst(idx(), pos());
|
||||
}
|
||||
|
||||
|
||||
@ -252,7 +252,7 @@ void MathCursor::last()
|
||||
{
|
||||
Cursor_.clear();
|
||||
push(formula_->par());
|
||||
par()->idxLast(idx(), pos());
|
||||
inset()->idxLast(idx(), pos());
|
||||
}
|
||||
|
||||
|
||||
@ -265,7 +265,7 @@ bool positionable
|
||||
|
||||
// anchor might be deeper, should have same path then
|
||||
for (MathIterator::size_type i = 0; i < cursor.size(); ++i)
|
||||
if (cursor[i].par_ != anchor[i].par_)
|
||||
if (cursor[i].inset_ != anchor[i].inset_)
|
||||
return false;
|
||||
|
||||
// position should be ok.
|
||||
@ -296,7 +296,7 @@ bool MathCursor::home(bool sel)
|
||||
autocorrect_ = false;
|
||||
selHandle(sel);
|
||||
macroModeClose();
|
||||
if (!par()->idxHome(idx(), pos()))
|
||||
if (!inset()->idxHome(idx(), pos()))
|
||||
return popLeft();
|
||||
dump("home 2");
|
||||
targetx_ = -1; // "no target"
|
||||
@ -310,7 +310,7 @@ bool MathCursor::end(bool sel)
|
||||
autocorrect_ = false;
|
||||
selHandle(sel);
|
||||
macroModeClose();
|
||||
if (!par()->idxEnd(idx(), pos()))
|
||||
if (!inset()->idxEnd(idx(), pos()))
|
||||
return popRight();
|
||||
dump("end 2");
|
||||
targetx_ = -1; // "no target"
|
||||
@ -430,8 +430,8 @@ bool MathCursor::backspace()
|
||||
}
|
||||
|
||||
if (pos() == 0) {
|
||||
if (par()->ncols() == 1 &&
|
||||
par()->nrows() == 1 &&
|
||||
if (inset()->ncols() == 1 &&
|
||||
inset()->nrows() == 1 &&
|
||||
depth() == 1 &&
|
||||
size() == 0)
|
||||
return false;
|
||||
@ -466,15 +466,15 @@ bool MathCursor::erase()
|
||||
|
||||
// delete empty cells if possible
|
||||
if (array().empty())
|
||||
if (par()->idxDelete(idx()))
|
||||
if (inset()->idxDelete(idx()))
|
||||
return true;
|
||||
|
||||
// old behaviour when in last position of cell
|
||||
if (pos() == size()) {
|
||||
if (par()->ncols() == 1 && par()->nrows() == 1 && depth() == 1 && size() == 0)
|
||||
if (inset()->ncols() == 1 && inset()->nrows() == 1 && depth() == 1 && size() == 0)
|
||||
return false;
|
||||
else{
|
||||
par()->idxGlue(idx());
|
||||
inset()->idxGlue(idx());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -623,10 +623,10 @@ void MathCursor::drawSelection(PainterInfo & pi) const
|
||||
{
|
||||
if (!selection_)
|
||||
return;
|
||||
MathCursorPos i1;
|
||||
MathCursorPos i2;
|
||||
CursorPos i1;
|
||||
CursorPos i2;
|
||||
getSelection(i1, i2);
|
||||
i1.par_->drawSelection(pi, i1.idx_, i1.pos_, i2.idx_, i2.pos_);
|
||||
i1.inset_->drawSelection(pi, i1.idx_, i1.pos_, i2.idx_, i2.pos_);
|
||||
}
|
||||
|
||||
|
||||
@ -641,7 +641,7 @@ void MathCursor::handleNest(MathAtom const & a)
|
||||
|
||||
void MathCursor::getPos(int & x, int & y) const
|
||||
{
|
||||
par()->getPos(idx(), pos(), x, y);
|
||||
inset()->getPos(idx(), pos(), x, y);
|
||||
}
|
||||
|
||||
|
||||
@ -655,9 +655,9 @@ int MathCursor::targetX() const
|
||||
}
|
||||
|
||||
|
||||
MathInset * MathCursor::par() const
|
||||
MathInset * MathCursor::inset() const
|
||||
{
|
||||
return cursor().par_;
|
||||
return cursor().inset_;
|
||||
}
|
||||
|
||||
|
||||
@ -739,7 +739,7 @@ bool MathCursor::selection() const
|
||||
MathGridInset * MathCursor::enclosingGrid(MathCursor::idx_type & idx) const
|
||||
{
|
||||
for (MathInset::difference_type i = depth() - 1; i >= 0; --i) {
|
||||
MathGridInset * p = Cursor_[i].par_->asGridInset();
|
||||
MathGridInset * p = Cursor_[i].inset_->asGridInset();
|
||||
if (p) {
|
||||
idx = Cursor_[i].idx_;
|
||||
return p;
|
||||
@ -751,21 +751,21 @@ MathGridInset * MathCursor::enclosingGrid(MathCursor::idx_type & idx) const
|
||||
|
||||
void MathCursor::popToHere(MathInset const * p)
|
||||
{
|
||||
while (depth() && Cursor_.back().par_ != p)
|
||||
while (depth() && Cursor_.back().inset_ != p)
|
||||
Cursor_.pop_back();
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::popToEnclosingGrid()
|
||||
{
|
||||
while (depth() && !Cursor_.back().par_->asGridInset())
|
||||
while (depth() && !Cursor_.back().inset_->asGridInset())
|
||||
Cursor_.pop_back();
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::popToEnclosingHull()
|
||||
{
|
||||
while (depth() && !Cursor_.back().par_->asHullInset())
|
||||
while (depth() && !Cursor_.back().inset_->asHullInset())
|
||||
Cursor_.pop_back();
|
||||
}
|
||||
|
||||
@ -795,20 +795,20 @@ void MathCursor::touch()
|
||||
|
||||
void MathCursor::normalize()
|
||||
{
|
||||
if (idx() >= par()->nargs()) {
|
||||
if (idx() >= inset()->nargs()) {
|
||||
lyxerr << "this should not really happen - 1: "
|
||||
<< idx() << ' ' << par()->nargs()
|
||||
<< " in: " << par() << endl;
|
||||
<< idx() << ' ' << inset()->nargs()
|
||||
<< " in: " << inset() << endl;
|
||||
dump("error 2");
|
||||
}
|
||||
idx() = min(idx(), par()->nargs() - 1);
|
||||
idx() = min(idx(), inset()->nargs() - 1);
|
||||
|
||||
if (pos() > size()) {
|
||||
lyxerr << "this should not really happen - 2: "
|
||||
<< pos() << ' ' << size() << " in idx: " << idx()
|
||||
<< " in atom: '";
|
||||
WriteStream wi(lyxerr, false, true);
|
||||
par()->write(wi);
|
||||
inset()->write(wi);
|
||||
lyxerr << endl;
|
||||
dump("error 4");
|
||||
}
|
||||
@ -866,7 +866,7 @@ MathArray & MathCursor::array() const
|
||||
{
|
||||
static MathArray dummy;
|
||||
|
||||
if (idx() >= par()->nargs()) {
|
||||
if (idx() >= inset()->nargs()) {
|
||||
lyxerr << "############ idx_ " << idx() << " not valid\n";
|
||||
return dummy;
|
||||
}
|
||||
@ -882,13 +882,13 @@ MathArray & MathCursor::array() const
|
||||
|
||||
void MathCursor::idxNext()
|
||||
{
|
||||
par()->idxNext(idx(), pos());
|
||||
inset()->idxNext(idx(), pos());
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::idxPrev()
|
||||
{
|
||||
par()->idxPrev(idx(), pos());
|
||||
inset()->idxPrev(idx(), pos());
|
||||
}
|
||||
|
||||
|
||||
@ -908,9 +908,9 @@ char MathCursor::halign() const
|
||||
}
|
||||
|
||||
|
||||
void MathCursor::getSelection(MathCursorPos & i1, MathCursorPos & i2) const
|
||||
void MathCursor::getSelection(CursorPos & i1, CursorPos & i2) const
|
||||
{
|
||||
MathCursorPos anc = normalAnchor();
|
||||
CursorPos anc = normalAnchor();
|
||||
if (anc < cursor()) {
|
||||
i1 = anc;
|
||||
i2 = cursor();
|
||||
@ -921,14 +921,14 @@ void MathCursor::getSelection(MathCursorPos & i1, MathCursorPos & i2) const
|
||||
}
|
||||
|
||||
|
||||
MathCursorPos & MathCursor::cursor()
|
||||
CursorPos & MathCursor::cursor()
|
||||
{
|
||||
lyx::Assert(depth());
|
||||
return Cursor_.back();
|
||||
}
|
||||
|
||||
|
||||
MathCursorPos const & MathCursor::cursor() const
|
||||
CursorPos const & MathCursor::cursor() const
|
||||
{
|
||||
lyx::Assert(depth());
|
||||
return Cursor_.back();
|
||||
@ -977,7 +977,7 @@ bool MathCursor::goUpDown(bool up)
|
||||
}
|
||||
|
||||
// try current cell for e.g. text insets
|
||||
if (par()->idxUpDown2(idx(), pos(), up, targetx_))
|
||||
if (inset()->idxUpDown2(idx(), pos(), up, targetx_))
|
||||
return true;
|
||||
|
||||
//xarray().boundingBox(xlow, xhigh, ylow, yhigh);
|
||||
@ -992,9 +992,9 @@ bool MathCursor::goUpDown(bool up)
|
||||
|
||||
// try to find an inset that knows better then we
|
||||
while (1) {
|
||||
///lyxerr << "updown: We are in " << *par() << " idx: " << idx() << '\n';
|
||||
///lyxerr << "updown: We are in " << *inset() << " idx: " << idx() << '\n';
|
||||
// ask inset first
|
||||
if (par()->idxUpDown(idx(), pos(), up, targetx_)) {
|
||||
if (inset()->idxUpDown(idx(), pos(), up, targetx_)) {
|
||||
// try to find best position within this inset
|
||||
if (!selection())
|
||||
bruteFind2(xo, yo);
|
||||
@ -1085,21 +1085,21 @@ void MathCursor::bruteFind2(int x, int y)
|
||||
|
||||
bool MathCursor::idxLineLast()
|
||||
{
|
||||
idx() -= idx() % par()->ncols();
|
||||
idx() += par()->ncols() - 1;
|
||||
idx() -= idx() % inset()->ncols();
|
||||
idx() += inset()->ncols() - 1;
|
||||
pos() = size();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MathCursor::idxLeft()
|
||||
{
|
||||
return par()->idxLeft(idx(), pos());
|
||||
return inset()->idxLeft(idx(), pos());
|
||||
}
|
||||
|
||||
|
||||
bool MathCursor::idxRight()
|
||||
{
|
||||
return par()->idxRight(idx(), pos());
|
||||
return inset()->idxRight(idx(), pos());
|
||||
}
|
||||
|
||||
|
||||
@ -1118,7 +1118,7 @@ bool MathCursor::script(bool up)
|
||||
string safe = grabAndEraseSelection();
|
||||
if (inNucleus()) {
|
||||
// we are in a nucleus of a script inset, move to _our_ script
|
||||
par()->asScriptInset()->ensure(up);
|
||||
inset()->asScriptInset()->ensure(up);
|
||||
idx() = up;
|
||||
pos() = 0;
|
||||
} else if (hasPrevAtom() && prevAtom()->asScriptInset()) {
|
||||
@ -1298,7 +1298,7 @@ string MathCursor::info() const
|
||||
ostringstream os;
|
||||
os << "Math editor mode. ";
|
||||
for (int i = 0, n = depth(); i < n; ++i) {
|
||||
Cursor_[i].par_->infoize(os);
|
||||
Cursor_[i].inset_->infoize(os);
|
||||
os << " ";
|
||||
}
|
||||
if (hasPrevAtom())
|
||||
@ -1318,11 +1318,11 @@ unsigned MathCursor::depth() const
|
||||
|
||||
namespace {
|
||||
|
||||
void region(MathCursorPos const & i1, MathCursorPos const & i2,
|
||||
void region(CursorPos const & i1, CursorPos const & i2,
|
||||
MathInset::row_type & r1, MathInset::row_type & r2,
|
||||
MathInset::col_type & c1, MathInset::col_type & c2)
|
||||
{
|
||||
MathInset * p = i1.par_;
|
||||
MathInset * p = i1.inset_;
|
||||
c1 = p->col(i1.idx_);
|
||||
c2 = p->col(i2.idx_);
|
||||
if (c1 > c2)
|
||||
@ -1341,8 +1341,8 @@ string MathCursor::grabSelection() const
|
||||
if (!selection_)
|
||||
return string();
|
||||
|
||||
MathCursorPos i1;
|
||||
MathCursorPos i2;
|
||||
CursorPos i1;
|
||||
CursorPos i2;
|
||||
getSelection(i1, i2);
|
||||
|
||||
if (i1.idx_ == i2.idx_) {
|
||||
@ -1361,7 +1361,7 @@ string MathCursor::grabSelection() const
|
||||
for (col_type col = c1; col <= c2; ++col) {
|
||||
if (col > c1)
|
||||
data += '&';
|
||||
data += asString(i1.par_->cell(i1.par_->index(row, col)));
|
||||
data += asString(i1.inset_->cell(i1.inset_->index(row, col)));
|
||||
}
|
||||
}
|
||||
return data;
|
||||
@ -1370,13 +1370,13 @@ string MathCursor::grabSelection() const
|
||||
|
||||
void MathCursor::eraseSelection()
|
||||
{
|
||||
MathCursorPos i1;
|
||||
MathCursorPos i2;
|
||||
CursorPos i1;
|
||||
CursorPos i2;
|
||||
getSelection(i1, i2);
|
||||
if (i1.idx_ == i2.idx_)
|
||||
i1.cell().erase(i1.pos_, i2.pos_);
|
||||
else {
|
||||
MathInset * p = i1.par_;
|
||||
MathInset * p = i1.inset_;
|
||||
row_type r1, r2;
|
||||
col_type c1, c2;
|
||||
region(i1, i2, r1, r2, c1, c2);
|
||||
@ -1399,7 +1399,7 @@ string MathCursor::grabAndEraseSelection()
|
||||
}
|
||||
|
||||
|
||||
MathCursorPos MathCursor::normalAnchor() const
|
||||
CursorPos MathCursor::normalAnchor() const
|
||||
{
|
||||
if (Anchor_.size() < depth()) {
|
||||
Anchor_ = Cursor_;
|
||||
@ -1407,7 +1407,7 @@ MathCursorPos MathCursor::normalAnchor() const
|
||||
}
|
||||
//lyx::Assert(Anchor_.size() >= cursor.depth());
|
||||
// use Anchor on the same level as Cursor
|
||||
MathCursorPos normal = Anchor_[depth() - 1];
|
||||
CursorPos normal = Anchor_[depth() - 1];
|
||||
if (depth() < Anchor_.size() && !(normal < cursor())) {
|
||||
// anchor is behind cursor -> move anchor behind the inset
|
||||
++normal.pos_;
|
||||
@ -1425,7 +1425,7 @@ dispatch_result MathCursor::dispatch(FuncRequest const & cmd)
|
||||
case LFUN_MOUSE_MOTION:
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
case LFUN_MOUSE_DOUBLE: {
|
||||
MathCursorPos & pos = Cursor_.back();
|
||||
CursorPos & pos = Cursor_.back();
|
||||
dispatch_result res = UNDISPATCHED;
|
||||
int x = 0, y = 0;
|
||||
getPos(x, y);
|
||||
@ -1445,8 +1445,8 @@ dispatch_result MathCursor::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
for (int i = Cursor_.size() - 1; i >= 0; --i) {
|
||||
MathCursorPos & pos = Cursor_[i];
|
||||
dispatch_result res = pos.par_->dispatch(cmd, pos.idx_, pos.pos_);
|
||||
CursorPos & pos = Cursor_[i];
|
||||
dispatch_result res = pos.inset_->dispatch(cmd, pos.idx_, pos.pos_);
|
||||
if (res != UNDISPATCHED) {
|
||||
if (res == DISPATCHED_POP) {
|
||||
Cursor_.shrink(i + 1);
|
||||
@ -1462,7 +1462,7 @@ dispatch_result MathCursor::dispatch(FuncRequest const & cmd)
|
||||
MathInset::mode_type MathCursor::currentMode() const
|
||||
{
|
||||
for (int i = Cursor_.size() - 1; i >= 0; --i) {
|
||||
MathInset::mode_type res = Cursor_[i].par_->currentMode();
|
||||
MathInset::mode_type res = Cursor_[i].inset_->currentMode();
|
||||
if (res != MathInset::UNDECIDED_MODE)
|
||||
return res;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class MathUnknownInset;
|
||||
[Have a look at math_inset.h first]
|
||||
|
||||
The MathCursor is different from the kind of cursor used in the Outer
|
||||
World. It contains a stack of MathCursorPos, each of which is made
|
||||
World. It contains a stack of CursorPos, each of which is made
|
||||
up of a inset pointer, an index and a position offset, marking a path from
|
||||
this formula's MathHullInset to the current position.
|
||||
|
||||
@ -106,7 +106,7 @@ public:
|
||||
/// in pixels from left of screen
|
||||
int targetX() const;
|
||||
/// current inset
|
||||
MathInset * par() const;
|
||||
MathInset * inset() const;
|
||||
/// return the next enclosing grid inset and the cursor's index in it
|
||||
MathGridInset * enclosingGrid(idx_type & idx) const;
|
||||
/// go up to enclosing grid
|
||||
@ -208,14 +208,14 @@ public:
|
||||
MathAtom & nextAtom();
|
||||
|
||||
/// returns the selection
|
||||
void getSelection(MathCursorPos &, MathCursorPos &) const;
|
||||
void getSelection(CursorPos &, CursorPos &) const;
|
||||
/// returns the normalized anchor of the selection
|
||||
MathCursorPos normalAnchor() const;
|
||||
CursorPos normalAnchor() const;
|
||||
|
||||
/// reference to the last item of the path, i.e. "The Cursor"
|
||||
MathCursorPos & cursor();
|
||||
CursorPos & cursor();
|
||||
/// reference to the last item of the path, i.e. "The Cursor"
|
||||
MathCursorPos const & cursor() const;
|
||||
CursorPos const & cursor() const;
|
||||
/// how deep are we nested?
|
||||
unsigned depth() const;
|
||||
|
||||
|
@ -14,7 +14,7 @@ MathDecorationInset::MathDecorationInset(latexkeys const * key)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathDecorationInset::clone() const
|
||||
InsetBase * MathDecorationInset::clone() const
|
||||
{
|
||||
return new MathDecorationInset(*this);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
///
|
||||
explicit MathDecorationInset(latexkeys const * key);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void draw(PainterInfo &, int x, int y) const;
|
||||
///
|
||||
|
@ -52,7 +52,7 @@ MathDelimInset::MathDelimInset
|
||||
}
|
||||
|
||||
|
||||
MathInset * MathDelimInset::clone() const
|
||||
InsetBase * MathDelimInset::clone() const
|
||||
{
|
||||
return new MathDelimInset(*this);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
///
|
||||
MathDelimInset(string const & left, string const & right, MathArray const &);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
MathDelimInset * asDelimInset() { return this; }
|
||||
///
|
||||
|
@ -11,7 +11,7 @@ MathDiffInset::MathDiffInset()
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathDiffInset::clone() const
|
||||
InsetBase * MathDiffInset::clone() const
|
||||
{
|
||||
return new MathDiffInset(*this);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
///
|
||||
explicit MathDiffInset();
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void addDer(MathArray const & der);
|
||||
///
|
||||
|
@ -12,7 +12,7 @@ MathDotsInset::MathDotsInset(latexkeys const * key)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathDotsInset::clone() const
|
||||
InsetBase * MathDotsInset::clone() const
|
||||
{
|
||||
return new MathDotsInset(*this);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
///
|
||||
explicit MathDotsInset(latexkeys const * l);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
|
@ -11,7 +11,7 @@ MathEnvInset::MathEnvInset(string const & name)
|
||||
{}
|
||||
|
||||
|
||||
MathInset * MathEnvInset::clone() const
|
||||
InsetBase * MathEnvInset::clone() const
|
||||
{
|
||||
return new MathEnvInset(*this);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
///
|
||||
MathEnvInset(string const & name_);
|
||||
///
|
||||
MathInset * clone() const;
|
||||
InsetBase * clone() const;
|
||||
///
|
||||
void draw(PainterInfo &, int x, int y) const;
|
||||
///
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user