remove NO_PEXTRA_STUFF

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5045 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-08-20 20:30:45 +00:00
parent e733558125
commit 5e7275dabc
8 changed files with 11 additions and 467 deletions

View File

@ -1,5 +1,11 @@
2002-08-20 Lars Gullik Bjønnes <larsbj@gullik.net>
* paragraph.h:
* lyxlength.C:
* buffer.C:
* ParameterStruct.h:
* ParagraphParameters.[Ch]: remove NO_PEXTRA_REALLY stuff
* bufferlist.C (emergencyWriteAll): use boost bind
* BufferView_pimpl.C (moveCursorUpdate): remove inline

View File

@ -34,16 +34,6 @@ void ParagraphParameters::clear()
tmp.labelstring.erase();
tmp.labelwidthstring.erase();
tmp.start_of_appendix = false;
#ifndef NO_PEXTRA_REALLY
//tmp.pextra_type = PEXTRA_NONE;
tmp.pextra_type = 0;
tmp.pextra_width.erase();
tmp.pextra_widthp.erase();
//tmp.pextra_alignment = MINIPAGE_ALIGN_TOP;
tmp.pextra_alignment = 0;
tmp.pextra_hfill = false;
tmp.pextra_start_minipage = false;
#endif
set_from_struct(tmp);
}
@ -59,14 +49,6 @@ bool ParagraphParameters::sameLayout(ParagraphParameters const & pp) const
param->pagebreak_top == pp.param->pagebreak_top &&
param->added_space_top == pp.param->added_space_top &&
param->spacing == pp.param->spacing &&
#ifndef NO_PEXTRA_REALLY
param->pextra_type == pp.param->pextra_type &&
param->pextra_width == pp.param->pextra_width &&
param->pextra_widthp == pp.param->pextra_widthp &&
param->pextra_alignment == pp.param->pextra_alignment &&
param->pextra_hfill == pp.param->pextra_hfill &&
param->pextra_start_minipage == pp.param->pextra_start_minipage &&
#endif
param->noindent == pp.param->noindent &&
param->depth == pp.param->depth;
}
@ -282,88 +264,3 @@ void ParagraphParameters::leftIndent(LyXLength const & li)
tmp.leftindent = li;
set_from_struct(tmp);
}
#ifndef NO_PEXTRA_REALLY
int ParagraphParameters::pextraType() const
{
return param->pextra_type;
}
void ParagraphParameters::pextraType(int t)
{
ParameterStruct tmp(*param);
tmp.pextra_type = t;
set_from_struct(tmp);
}
string const & ParagraphParameters::pextraWidth() const
{
return param->pextra_width;
}
void ParagraphParameters::pextraWidth(string const & w)
{
ParameterStruct tmp(*param);
tmp.pextra_width = w;
set_from_struct(tmp);
}
string const & ParagraphParameters::pextraWidthp() const
{
return param->pextra_widthp;
}
void ParagraphParameters::pextraWidthp(string const & wp)
{
ParameterStruct tmp(*param);
tmp.pextra_widthp = wp;
set_from_struct(tmp);
}
int ParagraphParameters::pextraAlignment() const
{
return param->pextra_alignment;
}
void ParagraphParameters::pextraAlignment(int a)
{
ParameterStruct tmp(*param);
tmp.pextra_alignment = a;
set_from_struct(tmp);
}
bool ParagraphParameters::pextraHfill() const
{
return param->pextra_hfill;
}
void ParagraphParameters::pextraHfill(bool hf)
{
ParameterStruct tmp(*param);
tmp.pextra_hfill = hf;
set_from_struct(tmp);
}
bool ParagraphParameters::pextraStartMinipage() const
{
return param->pextra_start_minipage;
}
void ParagraphParameters::pextraStartMinipage(bool smp)
{
ParameterStruct tmp(*param);
tmp.pextra_start_minipage = smp;
set_from_struct(tmp);
}
#endif

View File

@ -11,9 +11,6 @@
#include "ShareContainer.h"
#include "layout.h"
// Not yet... lyx 1.3.x or so
#define NO_PEXTRA_REALLY 1
#include "ParameterStruct.h"
class VSpace;
@ -91,33 +88,6 @@ public:
LyXLength const & leftIndent() const;
///
void leftIndent(LyXLength const &);
///
#ifndef NO_PEXTRA_REALLY
///
int pextraType() const;
///
void pextraType(int);
///
string const & pextraWidth() const;
///
void pextraWidth(string const &);
///
string const & pextraWidthp() const;
///
void pextraWidthp(string const &);
///
int pextraAlignment() const;
///
void pextraAlignment(int);
///
bool pextraHfill() const;
///
void pextraHfill(bool);
///
bool pextraStartMinipage() const;
///
void pextraStartMinipage(bool);
#endif
private:
///
void set_from_struct(ParameterStruct const &);

View File

@ -48,21 +48,6 @@ struct ParameterStruct {
string labelwidthstring;
///
LyXLength leftindent;
///
#ifndef NO_PEXTRA_REALLY
///
int pextra_type;
///
string pextra_width;
///
string pextra_widthp;
///
int pextra_alignment;
///
bool pextra_hfill;
///
bool pextra_start_minipage;
#endif
};
@ -72,10 +57,6 @@ ParameterStruct::ParameterStruct()
pagebreak_top(false), pagebreak_bottom(false),
align(LYX_ALIGN_BLOCK), depth(0), start_of_appendix(false),
appendix(false)
#ifndef NO_PEXTRA_REALLY
, pextra_type(0), pextra_alignment(0), pextra_hfill(false),
pextra_start_minipage(false)
#endif
{}
@ -97,16 +78,7 @@ bool operator==(ParameterStruct const & ps1,
&& ps1.appendix == ps2.appendix
&& ps1.labelstring == ps2.labelstring
&& ps1.labelwidthstring == ps2.labelwidthstring
&& ps1.leftindent == ps2.leftindent
#ifndef NO_PEXTRA_REALLY
&& ps1.pextra_type == ps2.pextra_type
&& ps1.pextra_width == ps2.pextra_width
&& ps1.pextra_widthp == ps2.pextra_widthp
&& ps1.pextra_alignment == ps2.pextra_alignment
&& ps1.pextra_hfill == ps2.pextra_hfill
&& ps1.pextra_start_minipage == ps2.pextra_start_minipage
#endif
;
&& ps1.leftindent == ps2.leftindent;
}

View File

@ -474,17 +474,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
)
{
bool the_end_read = false;
#ifndef NO_COMPABILITY
#ifndef NO_PEXTRA_REALLY
// This is super temporary but is needed to get the compability
// mode for minipages work correctly together with new tabulars.
static int call_depth;
++call_depth;
bool checkminipage = false;
static Paragraph * minipar = 0;
static Paragraph * parBeforeMinipage;
#endif
#endif
// The order of the tags tested may seem unnatural, but this
// has been done in order to reduce the number of string
@ -823,9 +812,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
}
if (!inset) {
#ifndef NO_PEXTRA_REALLY
--call_depth;
#endif
return false; // no end read yet
}
@ -1183,28 +1169,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
value.keep() ||
(value.kind() != VSpace::LENGTH))
par->params().spaceBottom(value);
#ifndef NO_COMPABILITY
#ifndef NO_PEXTRA_REALLY
} else if (token == "\\pextra_type") {
lex.nextToken();
par->params().pextraType(lex.getInteger());
} else if (token == "\\pextra_width") {
lex.nextToken();
par->params().pextraWidth(lex.getString());
} else if (token == "\\pextra_widthp") {
lex.nextToken();
par->params().pextraWidthp(lex.getString());
} else if (token == "\\pextra_alignment") {
lex.nextToken();
par->params().pextraAlignment(lex.getInteger());
} else if (token == "\\pextra_hfill") {
lex.nextToken();
par->params().pextraHfill(lex.getInteger());
} else if (token == "\\pextra_start_minipage") {
lex.nextToken();
par->params().pextraStartMinipage(lex.getInteger());
#endif
#endif
} else if (token == "\\labelwidthstring") {
lex.eatLine();
par->params().labelWidthString(lex.getString());
@ -1263,13 +1227,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
insertErtContents(par, pos);
#endif
the_end_read = true;
#ifndef NO_COMPABILITY
#ifndef NO_PEXTRA_REALLY
if (minipar == par)
par = 0;
minipar = parBeforeMinipage = 0;
#endif
#endif
} else {
#ifndef NO_COMPABILITY
if (ert_comp.active) {
@ -1292,191 +1249,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
#endif
}
#ifndef NO_COMPABILITY
#ifndef NO_PEXTRA_REALLY
// I wonder if we could use this blanket fix for all the
// checkminipage cases...
// don't forget about ert paragraphs and compatibility read for'em
if (par && (par->size() || !ert_comp.contents.empty())) {
// It is possible that this will check to often,
// but that should not be an correctness issue.
// Only a speed issue.
checkminipage = true;
}
// now check if we have a minipage paragraph as at this
// point we already read all the necessary data!
// this cannot be done in layout because there we did
// not read yet the paragraph PEXTRA-params (Jug)
//
// BEGIN pextra_minipage compability
// This should be removed in 1.3.x (Lgb)
// I don't think we should remove this so fast (Jug)
// This compability code is not perfect. In a couple
// of rand cases it fails. When the minipage par is
// the first par in the document, and when there are
// none or only one regular paragraphs after the
// minipage. Currently I am not investing any effort
// in fixing those cases.
// lyxerr << "Call depth: " << call_depth << endl;
// lyxerr << "Checkminipage: " << checkminipage << endl;
if (checkminipage && (call_depth == 1)) {
checkminipage = false;
if (minipar && (minipar != par) &&
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
lyxerr << "minipages in a row" << endl;
if (par->params().pextraStartMinipage()) {
lyxerr << "start new minipage" << endl;
// minipages in a row
par->previous()->next(0);
par->previous(0);
Paragraph * tmp = minipar;
while (tmp) {
tmp->params().pextraType(0);
tmp->params().pextraWidth(string());
tmp->params().pextraWidthp(string());
tmp->params().pextraAlignment(0);
tmp->params().pextraHfill(false);
tmp->params().pextraStartMinipage(false);
tmp = tmp->next();
}
// create a new paragraph to insert the
// minipages in the following case
if (par->params().pextraStartMinipage() &&
!par->params().pextraHfill()) {
Paragraph * p = new Paragraph;
p->layout(params.getLyXTextClass().defaultLayoutName());
p->previous(parBeforeMinipage);
parBeforeMinipage->next(p);
p->next(0);
p->params().depth(parBeforeMinipage->params().depth());
parBeforeMinipage = p;
}
InsetMinipage * mini = new InsetMinipage(params);
mini->pos(static_cast<InsetMinipage::Position>(par->params().pextraAlignment()));
mini->pageWidth(LyXLength(par->params().pextraWidth()));
if (!par->params().pextraWidthp().empty()) {
lyxerr << "WP:" << mini->pageWidth().asString() << endl;
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
}
Paragraph * op = mini->firstParagraph();
mini->inset.paragraph(par);
//
// and free the old ones!
//
while(op) {
Paragraph * pp = op->next();
delete op;
op = pp;
}
// Insert the minipage last in the
// previous paragraph.
if (par->params().pextraHfill()) {
parBeforeMinipage->insertChar
(parBeforeMinipage->size(),
Paragraph::META_HFILL, font);
}
parBeforeMinipage->insertInset
(parBeforeMinipage->size(), mini, font);
minipar = par;
} else {
lyxerr << "new minipage par" << endl;
//nothing to do just continue reading
}
} else if (minipar && (minipar != par)) {
lyxerr << "last minipage par read" << endl;
// The last paragraph read was not part of a
// minipage but the par linked list is...
// So we need to remove the last par from the
// rest
if (par->previous())
par->previous()->next(0);
par->previous(parBeforeMinipage);
parBeforeMinipage->next(par);
Paragraph * tmp = minipar;
while (tmp) {
tmp->params().pextraType(0);
tmp->params().pextraWidth(string());
tmp->params().pextraWidthp(string());
tmp->params().pextraAlignment(0);
tmp->params().pextraHfill(false);
tmp->params().pextraStartMinipage(false);
tmp = tmp->next();
}
depth = parBeforeMinipage->params().depth();
// and set this depth on the par as it has not been set already
par->params().depth(depth);
minipar = parBeforeMinipage = 0;
} else if (!minipar &&
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
// par is the first paragraph in a minipage
lyxerr << "begin minipage" << endl;
// To minimize problems for
// the users we will insert
// the first minipage in
// a sequence of minipages
// in its own paragraph.
Paragraph * p = new Paragraph;
p->layout(params.getLyXTextClass().defaultLayoutName());
p->previous(par->previous());
p->next(0);
p->params().depth(depth);
par->params().depth(0);
depth = 0;
if (par->previous())
par->previous()->next(p);
par->previous(0);
parBeforeMinipage = p;
minipar = par;
if (!first_par || (first_par == par))
first_par = p;
InsetMinipage * mini = new InsetMinipage(params);
mini->pos(static_cast<InsetMinipage::Position>(minipar->params().pextraAlignment()));
mini->pageWidth(LyXLength(minipar->params().pextraWidth()));
if (!par->params().pextraWidthp().empty()) {
lyxerr << "WP:" << mini->pageWidth().asString() << endl;
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"col%"));
}
Paragraph * op = mini->firstParagraph();
mini->inset.paragraph(minipar);
//
// and free the old ones!
//
while(op) {
Paragraph * pp = op->next();
delete op;
op = pp;
}
// Insert the minipage last in the
// previous paragraph.
if (minipar->params().pextraHfill()) {
parBeforeMinipage->insertChar
(parBeforeMinipage->size(),
Paragraph::META_HFILL, font);
}
parBeforeMinipage->insertInset
(parBeforeMinipage->size(), mini, font);
} else if (par->params().pextraType() == Paragraph::PEXTRA_INDENT) {
par->params().leftIndent(LyXLength(par->params().pextraWidth()));
if (!par->params().pextraWidthp().empty()) {
par->params().leftIndent(LyXLength((par->params().pextraWidthp())+"col%"));
}
}
}
// End of pextra_minipage compability
--call_depth;
#endif
#endif
return the_end_read;
}

View File

@ -810,7 +810,7 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
bool const inset_hit = insetHit(bv, cmd.x, cmd.y);
FuncRequest cmd1 = cmd;
FuncRequest cmd1 = cmd;
cmd1.x -= inset_x;
cmd1.y -= inset_y;
@ -849,7 +849,7 @@ bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
{
bool ret = false;
if (the_locking_inset) {
FuncRequest cmd1 = cmd;
FuncRequest cmd1 = cmd;
cmd1.x -= inset_x;
cmd1.y -= inset_y;
ret = the_locking_inset->localDispatch(cmd1);
@ -865,7 +865,7 @@ bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
void InsetTabular::lfunMouseMotion(FuncRequest const & cmd)
{
if (the_locking_inset) {
FuncRequest cmd1 = cmd;
FuncRequest cmd1 = cmd;
cmd1.x -= inset_x;
cmd1.y -= inset_y;
the_locking_inset->localDispatch(cmd1);

View File

@ -36,49 +36,12 @@ LyXLength::LyXLength(double v, LyXLength::UNIT u)
{}
#ifndef NO_PEXTRA_REALLY
// compatibility stuff < version 1.2.0pre and for
// "old" 1.2.0 files before the pre
namespace {
string const convertOldRelLength(string const & oldLength)
{
// we can have only one or none of the following
if (oldLength.find("c%") != string::npos) {
return subst(oldLength,"c%","col%");
} else if (oldLength.find("t%") != string::npos) {
if (oldLength.find("text%") != string::npos ||
oldLength.find("height%") != string::npos)
return oldLength;
else
return subst(oldLength,"t%","text%");
} else if (oldLength.find("l%") != string::npos) {
if (oldLength.find("col%") != string::npos)
return oldLength;
else
return subst(oldLength,"l%","line%");
} else if (oldLength.find("p%") != string::npos)
return subst(oldLength,"p%","page%");
return oldLength;
}
} // end anon
#endif
LyXLength::LyXLength(string const & data)
: val_(0), unit_(LyXLength::PT)
{
LyXLength tmp;
#ifndef NO_PEXTRA_REALLY
// this is needed for 1.1.x minipages with width like %t
if (!isValidLength (convertOldRelLength(data), &tmp))
#else
if (!isValidLength (data, &tmp))
#endif
if (!isValidLength (convertOldRelLength(data), &tmp))
if (!isValidLength(data, &tmp))
return; // should raise an exception
val_ = tmp.val_;

View File

@ -32,11 +32,6 @@ class LaTeXFeatures;
class ParagraphParameters;
class TexRow;
// After 1.2.0 is released, during 1.3.0cvs, we enable this. And after
// a while we verify that reading of 1.2.x files work perfectly we remove
// this code completely. (Lgb)
#define NO_PEXTRA_REALLY 1
// Define this if you want to try out the new storage container for
// paragraphs. (Lgb)
// This is non working and far from finished.
@ -45,28 +40,6 @@ class TexRow;
/// A Paragraph holds all text, attributes and insets in a text paragraph
class Paragraph {
public:
#ifndef NO_PEXTRA_REALLY
///
enum PEXTRA_TYPE {
///
PEXTRA_NONE,
///
PEXTRA_INDENT,
///
PEXTRA_MINIPAGE,
///
PEXTRA_FLOATFLT
};
///
enum MINIPAGE_ALIGNMENT {
///
MINIPAGE_ALIGN_TOP,
///
MINIPAGE_ALIGN_MIDDLE,
///
MINIPAGE_ALIGN_BOTTOM
};
#endif
///
enum META_KIND {
///
@ -314,15 +287,6 @@ public:
///
int stripLeadingSpaces();
#ifndef NO_PEXTRA_REALLY
/* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE
I have to set it on each of it's elements */
///
void setPExtraType(BufferParams const &, int type,
string const & width, string const & widthp);
///
void unsetPExtraType(BufferParams const &);
#endif
///
bool isFreeSpacing() const;