mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 16:31:13 +00:00
ParagraphParameters and SharedContainer
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1691 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
44a5985e18
commit
03d1c984a0
@ -2215,18 +2215,18 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
TEXT(bv_)->CursorRight(bv_);
|
||||
cursor = TEXT(bv_)->cursor;
|
||||
if (cursor.pos() == 0
|
||||
&& !(cursor.par()->added_space_top
|
||||
&& !(cursor.par()->params.spaceTop()
|
||||
== VSpace (VSpace::NONE))) {
|
||||
TEXT(bv_)->SetParagraph
|
||||
(bv_,
|
||||
cursor.par()->line_top,
|
||||
cursor.par()->line_bottom,
|
||||
cursor.par()->pagebreak_top,
|
||||
cursor.par()->pagebreak_bottom,
|
||||
cursor.par()->params.lineTop(),
|
||||
cursor.par()->params.lineBottom(),
|
||||
cursor.par()->params.pagebreakTop(),
|
||||
cursor.par()->params.pagebreakBottom(),
|
||||
VSpace(VSpace::NONE),
|
||||
cursor.par()->added_space_bottom,
|
||||
cursor.par()->align,
|
||||
cursor.par()->labelwidthstring, 0);
|
||||
cursor.par()->params.spaceBottom(),
|
||||
cursor.par()->params.align(),
|
||||
cursor.par()->params.labelWidthString(), 0);
|
||||
TEXT(bv_)->CursorLeft(bv_);
|
||||
update(TEXT(bv_),
|
||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
@ -2323,17 +2323,17 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
|
||||
if (!TEXT(bv_)->selection) {
|
||||
if (cursor.pos() == 0
|
||||
&& !(cursor.par()->added_space_top
|
||||
&& !(cursor.par()->params.spaceTop()
|
||||
== VSpace (VSpace::NONE))) {
|
||||
TEXT(bv_)->SetParagraph
|
||||
(bv_,
|
||||
cursor.par()->line_top,
|
||||
cursor.par()->line_bottom,
|
||||
cursor.par()->pagebreak_top,
|
||||
cursor.par()->pagebreak_bottom,
|
||||
VSpace(VSpace::NONE), cursor.par()->added_space_bottom,
|
||||
cursor.par()->align,
|
||||
cursor.par()->labelwidthstring, 0);
|
||||
cursor.par()->params.lineTop(),
|
||||
cursor.par()->params.lineBottom(),
|
||||
cursor.par()->params.pagebreakTop(),
|
||||
cursor.par()->params.pagebreakBottom(),
|
||||
VSpace(VSpace::NONE), cursor.par()->params.spaceBottom(),
|
||||
cursor.par()->params.align(),
|
||||
cursor.par()->params.labelWidthString(), 0);
|
||||
update(TEXT(bv_),
|
||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
} else {
|
||||
@ -2382,16 +2382,16 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
|
||||
beforeChange(TEXT(bv_));
|
||||
if (cursor.pos() == 0) {
|
||||
if (cursor.par()->added_space_top == VSpace(VSpace::NONE)) {
|
||||
if (cursor.par()->params.spaceTop() == VSpace(VSpace::NONE)) {
|
||||
TEXT(bv_)->SetParagraph
|
||||
(bv_,
|
||||
cursor.par()->line_top,
|
||||
cursor.par()->line_bottom,
|
||||
cursor.par()->pagebreak_top,
|
||||
cursor.par()->pagebreak_bottom,
|
||||
VSpace(VSpace::DEFSKIP), cursor.par()->added_space_bottom,
|
||||
cursor.par()->align,
|
||||
cursor.par()->labelwidthstring, 1);
|
||||
cursor.par()->params.lineTop(),
|
||||
cursor.par()->params.lineBottom(),
|
||||
cursor.par()->params.pagebreakTop(),
|
||||
cursor.par()->params.pagebreakBottom(),
|
||||
VSpace(VSpace::DEFSKIP), cursor.par()->params.spaceBottom(),
|
||||
cursor.par()->params.align(),
|
||||
cursor.par()->params.labelWidthString(), 1);
|
||||
//update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
}
|
||||
@ -2411,10 +2411,10 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
case LFUN_PARAGRAPH_SPACING:
|
||||
{
|
||||
LyXParagraph * par = TEXT(bv_)->cursor.par();
|
||||
Spacing::Space cur_spacing = par->spacing.getSpace();
|
||||
Spacing::Space cur_spacing = par->params.spacing().getSpace();
|
||||
float cur_value = 1.0;
|
||||
if (cur_spacing == Spacing::Other) {
|
||||
cur_value = par->spacing.getValue();
|
||||
cur_value = par->params.spacing().getValue();
|
||||
}
|
||||
|
||||
istringstream istr(argument.c_str());
|
||||
@ -2446,7 +2446,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
<< argument << endl;
|
||||
}
|
||||
if (cur_spacing != new_spacing || cur_value != new_value) {
|
||||
par->spacing.set(new_spacing, new_value);
|
||||
par->params.spacing(Spacing(new_spacing, new_value));
|
||||
TEXT(bv_)->RedoParagraph(bv_);
|
||||
update(TEXT(bv_),
|
||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
|
@ -1,3 +1,38 @@
|
||||
2001-03-06 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* lyxparagraph.h: move serveral local vars to
|
||||
ParameterStruct/ParagraphParameters., use ShareContainer in
|
||||
FontTable., make vars in FontTable private and add getter and
|
||||
setter.
|
||||
|
||||
* paragraph.C: changes because of the above.
|
||||
|
||||
* lyxfont.h: remove copy constructor and copy assignment. (the
|
||||
default ones is ok), move number inside FontBits. move inlines to lyxfont.C
|
||||
|
||||
* lyxfont.C: add number to initializaton of statics, move several
|
||||
inlines here. constify several local vars. some whitespace
|
||||
cleanup. Dont hide outerscope variables.
|
||||
|
||||
* Spacing.h: add two new constructors to match the set methods.
|
||||
|
||||
* ShareContainer.h: new file, will perhaps be moved to support
|
||||
|
||||
* ParameterStruct.h: new file
|
||||
|
||||
* ParagraphParameters.h: new file
|
||||
|
||||
* ParagraphParameters.C: new file
|
||||
|
||||
* Makefile.am (lyx_SOURCES): add ParagraphParameters.C,
|
||||
ParagraphParameters.h, ParameterStruct.h and ShareContainer.h
|
||||
|
||||
* BufferView_pimpl.C: ParagraphParameter changes.
|
||||
* buffer.C: Likewise.
|
||||
* bufferview_funcs.C: Likewise.
|
||||
* text.C: Likewise.
|
||||
* text2.C: Likewise.
|
||||
|
||||
2001-03-06 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* lyxfind.C (LyXReplace): do not redefine default argument in
|
||||
|
@ -65,9 +65,13 @@ lyx_SOURCES = \
|
||||
Painter.h \
|
||||
PainterBase.C \
|
||||
PainterBase.h \
|
||||
ParagraphParameters.C \
|
||||
ParagraphParameters.h \
|
||||
ParameterStruct.h \
|
||||
PrinterParams.h \
|
||||
Sectioning.h \
|
||||
Sectioning.C \
|
||||
ShareContainer.h \
|
||||
Spacing.C \
|
||||
Spacing.h \
|
||||
TextCache.C \
|
||||
|
380
src/ParagraphParameters.C
Normal file
380
src/ParagraphParameters.C
Normal file
@ -0,0 +1,380 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "ParagraphParameters.h"
|
||||
#include "ParameterStruct.h"
|
||||
|
||||
// Initialize static member var.
|
||||
ShareContainer<ParameterStruct> ParagraphParameters::container;
|
||||
|
||||
ParagraphParameters::ParagraphParameters()
|
||||
{
|
||||
ParameterStruct tmp;
|
||||
tmp.appendix = false;
|
||||
tmp.align = LYX_ALIGN_BLOCK;
|
||||
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::clear()
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.line_top = false;
|
||||
tmp.line_bottom = false;
|
||||
tmp.pagebreak_top = false;
|
||||
tmp.pagebreak_bottom = false;
|
||||
tmp.added_space_top = VSpace(VSpace::NONE);
|
||||
tmp.added_space_bottom = VSpace(VSpace::NONE);
|
||||
tmp.spacing.set(Spacing::Default);
|
||||
tmp.align = LYX_ALIGN_LAYOUT;
|
||||
tmp.depth = 0;
|
||||
tmp.noindent = false;
|
||||
tmp.labelstring.erase();
|
||||
tmp.labelwidthstring.erase();
|
||||
tmp.start_of_appendix = false;
|
||||
//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;
|
||||
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphParameters::sameLayout(ParagraphParameters const & pp) const
|
||||
{
|
||||
return param->align == pp.param->align &&
|
||||
param->line_bottom == pp.param->line_bottom &&
|
||||
param->pagebreak_bottom == pp.param->pagebreak_bottom &&
|
||||
param->added_space_bottom == pp.param->added_space_bottom &&
|
||||
|
||||
param->line_top == pp.param->line_top &&
|
||||
param->pagebreak_top == pp.param->pagebreak_top &&
|
||||
param->added_space_top == pp.param->added_space_top &&
|
||||
param->spacing == pp.param->spacing &&
|
||||
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 &&
|
||||
param->noindent == pp.param->noindent &&
|
||||
param->depth == pp.param->depth;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::makeSame(ParagraphParameters const & pp)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.align = pp.param->align;
|
||||
// tmp.labelwidthstring = pp.params.labelwidthstring;
|
||||
tmp.line_bottom = pp.param->line_bottom;
|
||||
tmp.pagebreak_bottom = pp.param->pagebreak_bottom;
|
||||
tmp.added_space_bottom = pp.param->added_space_bottom;
|
||||
tmp.line_top = pp.param->line_top;
|
||||
tmp.pagebreak_top = pp.param->pagebreak_top;
|
||||
tmp.added_space_top = pp.param->added_space_top;
|
||||
tmp.spacing = pp.param->spacing;
|
||||
tmp.pextra_type = pp.param->pextra_type;
|
||||
tmp.pextra_width = pp.param->pextra_width;
|
||||
tmp.pextra_widthp = pp.param->pextra_widthp;
|
||||
tmp.pextra_alignment = pp.param->pextra_alignment;
|
||||
tmp.pextra_hfill = pp.param->pextra_hfill;
|
||||
tmp.pextra_start_minipage = pp.param->pextra_start_minipage;
|
||||
tmp.noindent = pp.param->noindent;
|
||||
tmp.depth = pp.param->depth;
|
||||
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::set_from_struct(ParameterStruct const & ps)
|
||||
{
|
||||
// get new param from container with tmp as template
|
||||
param = container.get(ps);
|
||||
}
|
||||
|
||||
|
||||
VSpace const & ParagraphParameters::spaceTop() const
|
||||
{
|
||||
return param->added_space_top;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::spaceTop(VSpace const & vs)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.added_space_top = vs;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
VSpace const & ParagraphParameters::spaceBottom() const
|
||||
{
|
||||
return param->added_space_bottom;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::spaceBottom(VSpace const & vs)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.added_space_bottom = vs;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
Spacing const & ParagraphParameters::spacing() const
|
||||
{
|
||||
return param->spacing;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::spacing(Spacing const & s)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.spacing = s;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphParameters::noindent() const
|
||||
{
|
||||
return param->noindent;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::noindent(bool ni)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.noindent = ni;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphParameters::lineTop() const
|
||||
{
|
||||
return param->line_top;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::lineTop(bool lt)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.line_top = lt;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphParameters::lineBottom() const
|
||||
{
|
||||
return param->line_bottom;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::lineBottom(bool lb)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.line_bottom = lb;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphParameters::pagebreakTop() const
|
||||
{
|
||||
return param->pagebreak_top;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::pagebreakTop(bool pbt)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.pagebreak_top = pbt;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphParameters::pagebreakBottom() const
|
||||
{
|
||||
return param->pagebreak_bottom;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::pagebreakBottom(bool pbb)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.pagebreak_bottom = pbb;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
LyXAlignment ParagraphParameters::align() const
|
||||
{
|
||||
return param->align;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::align(LyXAlignment la)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.align = la;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
char ParagraphParameters::depth() const
|
||||
{
|
||||
return param->depth;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::depth(char d)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.depth = d;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphParameters::startOfAppendix() const
|
||||
{
|
||||
return param->start_of_appendix;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::startOfAppendix(bool soa)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.start_of_appendix = soa;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
bool ParagraphParameters::appendix() const
|
||||
{
|
||||
return param->appendix;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::appendix(bool a)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.appendix = a;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
string const & ParagraphParameters::labelString() const
|
||||
{
|
||||
return param->labelstring;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::labelString(string const & ls)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.labelstring = ls;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
string const & ParagraphParameters::labelWidthString() const
|
||||
{
|
||||
return param->labelwidthstring;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::labelWidthString(string const & lws)
|
||||
{
|
||||
ParameterStruct tmp(*param);
|
||||
tmp.labelwidthstring = lws;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
113
src/ParagraphParameters.h
Normal file
113
src/ParagraphParameters.h
Normal file
@ -0,0 +1,113 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef PARAGRAPHPARAMETERS_H
|
||||
#define PARAGRAPHPARAMETERS_H
|
||||
|
||||
#include "ShareContainer.h"
|
||||
#include "LString.h"
|
||||
#include "layout.h"
|
||||
|
||||
class VSpace;
|
||||
class Spacing;
|
||||
struct ParameterStruct;
|
||||
|
||||
///
|
||||
class ParagraphParameters {
|
||||
public:
|
||||
///
|
||||
ParagraphParameters();
|
||||
///
|
||||
void clear();
|
||||
///
|
||||
bool sameLayout(ParagraphParameters const &) const;
|
||||
///
|
||||
void makeSame(ParagraphParameters const & pp);
|
||||
///
|
||||
VSpace const & spaceTop() const;
|
||||
///
|
||||
void spaceTop(VSpace const &);
|
||||
///
|
||||
VSpace const & spaceBottom() const;
|
||||
///
|
||||
void spaceBottom(VSpace const &);
|
||||
///
|
||||
Spacing const & spacing() const;
|
||||
///
|
||||
void spacing(Spacing const &);
|
||||
///
|
||||
bool noindent() const;
|
||||
///
|
||||
void noindent(bool);
|
||||
///
|
||||
bool lineTop() const;
|
||||
///
|
||||
void lineTop(bool);
|
||||
///
|
||||
bool lineBottom() const;
|
||||
///
|
||||
void lineBottom(bool);
|
||||
///
|
||||
bool pagebreakTop() const;
|
||||
///
|
||||
void pagebreakTop(bool);
|
||||
///
|
||||
bool pagebreakBottom() const;
|
||||
///
|
||||
void pagebreakBottom(bool);
|
||||
///
|
||||
LyXAlignment align() const;
|
||||
///
|
||||
void align(LyXAlignment);
|
||||
///
|
||||
char depth() const;
|
||||
///
|
||||
void depth(char);
|
||||
///
|
||||
bool startOfAppendix() const;
|
||||
///
|
||||
void startOfAppendix(bool);
|
||||
///
|
||||
bool appendix() const;
|
||||
///
|
||||
void appendix(bool);
|
||||
///
|
||||
string const & labelString() const;
|
||||
///
|
||||
void labelString(string const &);
|
||||
///
|
||||
string const & labelWidthString() const;
|
||||
///
|
||||
void labelWidthString(string const &);
|
||||
///
|
||||
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);
|
||||
private:
|
||||
///
|
||||
void set_from_struct(ParameterStruct const &);
|
||||
///
|
||||
boost::shared_ptr<ParameterStruct> param;
|
||||
///
|
||||
static ShareContainer<ParameterStruct> container;
|
||||
};
|
||||
#endif
|
81
src/ParameterStruct.h
Normal file
81
src/ParameterStruct.h
Normal file
@ -0,0 +1,81 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef PARAMETERSTRUCT_H
|
||||
#define PARAMETERSTRUCT_H
|
||||
|
||||
#include "vspace.h"
|
||||
#include "Spacing.h"
|
||||
#include "layout.h"
|
||||
|
||||
///
|
||||
struct ParameterStruct {
|
||||
///
|
||||
VSpace added_space_top;
|
||||
///
|
||||
VSpace added_space_bottom;
|
||||
///
|
||||
Spacing spacing;
|
||||
///
|
||||
bool noindent;
|
||||
///
|
||||
bool line_top;
|
||||
///
|
||||
bool line_bottom;
|
||||
///
|
||||
bool pagebreak_top;
|
||||
///
|
||||
bool pagebreak_bottom;
|
||||
///
|
||||
LyXAlignment align;
|
||||
///
|
||||
char depth; // wrong type (Lgb)
|
||||
///
|
||||
bool start_of_appendix;
|
||||
///
|
||||
bool appendix;
|
||||
///
|
||||
string labelstring;
|
||||
///
|
||||
string labelwidthstring;
|
||||
///
|
||||
int pextra_type;
|
||||
///
|
||||
string pextra_width;
|
||||
///
|
||||
string pextra_widthp;
|
||||
///
|
||||
int pextra_alignment;
|
||||
///
|
||||
bool pextra_hfill;
|
||||
///
|
||||
bool pextra_start_minipage;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
bool operator==(ParameterStruct const & ps1,
|
||||
ParameterStruct const & ps2)
|
||||
{
|
||||
return ps1.added_space_top == ps2.added_space_top
|
||||
&& ps1.added_space_bottom == ps2.added_space_bottom
|
||||
&& ps1.spacing == ps2.spacing
|
||||
&& ps1.noindent == ps2.noindent
|
||||
&& ps1.line_top == ps2.line_top
|
||||
&& ps1.line_bottom == ps2.line_bottom
|
||||
&& ps1.pagebreak_top == ps2.pagebreak_top
|
||||
&& ps1.pagebreak_bottom == ps2.pagebreak_bottom
|
||||
&& ps1.align == ps2.align
|
||||
&& ps1.depth == ps2.depth
|
||||
&& ps1.start_of_appendix == ps2.start_of_appendix
|
||||
&& ps1.appendix == ps2.appendix
|
||||
&& ps1.labelstring == ps2.labelstring
|
||||
&& ps1.labelwidthstring == ps2.labelwidthstring
|
||||
&& 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
|
73
src/ShareContainer.h
Normal file
73
src/ShareContainer.h
Normal file
@ -0,0 +1,73 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef SHARECONTAINER_H
|
||||
#define SHARECONTAINER_H
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/smart_ptr.hpp>
|
||||
|
||||
///
|
||||
template<class Share>
|
||||
class ShareContainer : public noncopyable {
|
||||
public:
|
||||
///
|
||||
typedef std::vector<boost::shared_ptr<Share> > Params;
|
||||
///
|
||||
Params::value_type
|
||||
get(Share const & ps) const {
|
||||
// First see if we already have this ps in the container
|
||||
Params::iterator it = params.begin();
|
||||
Params::iterator end = params.end();
|
||||
for (; it != end; ++it) {
|
||||
if (ps == *(*it).get())
|
||||
break;
|
||||
}
|
||||
Params::value_type tmp;
|
||||
if (it == end) {
|
||||
// ok we don't have it so we should
|
||||
// insert it.
|
||||
tmp.reset(new Share(ps));
|
||||
params.push_back(tmp);
|
||||
// We clean here. This can cause us to have
|
||||
// some (one) unique elemements some times
|
||||
// but we should gain a lot in speed.
|
||||
clean();
|
||||
std::sort(params.rbegin(), params.rend(), comp());
|
||||
} else {
|
||||
// yes we have it already
|
||||
tmp = *it;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
private:
|
||||
///
|
||||
struct comp {
|
||||
int operator()(Params::value_type const & p1,
|
||||
Params::value_type const & p2) {
|
||||
return p1.use_count() < p2.use_count();
|
||||
}
|
||||
};
|
||||
///
|
||||
struct isUnique {
|
||||
bool operator()(Params::value_type const & p) const {
|
||||
return p.unique();
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
void clean() const {
|
||||
// Remove all unique items. (i.e. entries that only
|
||||
// exists in the conatainer and does not have a
|
||||
// corresponding paragrah.
|
||||
Params::iterator it = std::remove_if(params.begin(),
|
||||
params.end(),
|
||||
isUnique());
|
||||
params.erase(it, params.end());
|
||||
}
|
||||
|
||||
///
|
||||
mutable Params params;
|
||||
};
|
||||
#endif
|
@ -39,6 +39,13 @@ public:
|
||||
///
|
||||
Spacing() : space(Single), value(1.0) {}
|
||||
///
|
||||
Spacing(Spacing::Space sp, float val = 1.0) {
|
||||
set(sp, val);
|
||||
}
|
||||
Spacing(Spacing::Space sp, string const & val) {
|
||||
set(sp, val);
|
||||
}
|
||||
///
|
||||
bool isDefault() const {
|
||||
return space == Default;
|
||||
}
|
||||
|
83
src/buffer.C
83
src/buffer.C
@ -394,7 +394,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->footnoteflag = footnoteflag;
|
||||
par->footnotekind = footnotekind;
|
||||
#endif
|
||||
par->depth = depth;
|
||||
par->params.depth(depth);
|
||||
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
||||
if (file_format < 216 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
@ -550,21 +550,21 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
lex.EatLine();
|
||||
params.fonts = lex.GetString();
|
||||
} else if (token == "\\noindent") {
|
||||
par->noindent = true;
|
||||
par->params.noindent(true);
|
||||
} else if (token == "\\fill_top") {
|
||||
par->added_space_top = VSpace(VSpace::VFILL);
|
||||
par->params.spaceTop(VSpace(VSpace::VFILL));
|
||||
} else if (token == "\\fill_bottom") {
|
||||
par->added_space_bottom = VSpace(VSpace::VFILL);
|
||||
par->params.spaceBottom(VSpace(VSpace::VFILL));
|
||||
} else if (token == "\\line_top") {
|
||||
par->line_top = true;
|
||||
par->params.lineTop(true);
|
||||
} else if (token == "\\line_bottom") {
|
||||
par->line_bottom = true;
|
||||
par->params.lineBottom(true);
|
||||
} else if (token == "\\pagebreak_top") {
|
||||
par->pagebreak_top = true;
|
||||
par->params.pagebreakTop(true);
|
||||
} else if (token == "\\pagebreak_bottom") {
|
||||
par->pagebreak_bottom = true;
|
||||
par->params.pagebreakBottom(true);
|
||||
} else if (token == "\\start_of_appendix") {
|
||||
par->start_of_appendix = true;
|
||||
par->params.startOfAppendix(true);
|
||||
} else if (token == "\\paragraph_separation") {
|
||||
int tmpret = lex.FindToken(string_paragraph_separation);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
@ -755,7 +755,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
// Small hack so that files written with klyx will be
|
||||
// parsed correctly.
|
||||
if (return_par) {
|
||||
par->spacing.set(tmp_space, tmp_val);
|
||||
par->params.spacing(Spacing(tmp_space, tmp_val));
|
||||
} else {
|
||||
params.spacing.set(tmp_space, tmp_val);
|
||||
}
|
||||
@ -763,15 +763,15 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
lex.next();
|
||||
string const tmp = strip(lex.GetString());
|
||||
if (tmp == "single") {
|
||||
par->spacing.set(Spacing::Single);
|
||||
par->params.spacing(Spacing(Spacing::Single));
|
||||
} else if (tmp == "onehalf") {
|
||||
par->spacing.set(Spacing::Onehalf);
|
||||
par->params.spacing(Spacing(Spacing::Onehalf));
|
||||
} else if (tmp == "double") {
|
||||
par->spacing.set(Spacing::Double);
|
||||
par->params.spacing(Spacing(Spacing::Double));
|
||||
} else if (tmp == "other") {
|
||||
lex.next();
|
||||
par->spacing.set(Spacing::Other,
|
||||
lex.GetFloat());
|
||||
par->params.spacing(Spacing(Spacing::Other,
|
||||
lex.GetFloat()));
|
||||
} else {
|
||||
lex.printError("Unknown spacing token: '$$Token'");
|
||||
}
|
||||
@ -844,35 +844,35 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
if (tmpret != LYX_LAYOUT_DEFAULT) { // tmpret != 99 ???
|
||||
int const tmpret2 = int(pow(2.0, tmpret));
|
||||
//lyxerr << "Tmpret2 = " << tmpret2 << endl;
|
||||
par->align = LyXAlignment(tmpret2);
|
||||
par->params.align(LyXAlignment(tmpret2));
|
||||
}
|
||||
} else if (token == "\\added_space_top") {
|
||||
lex.nextToken();
|
||||
par->added_space_top = VSpace(lex.GetString());
|
||||
par->params.spaceTop(VSpace(lex.GetString()));
|
||||
} else if (token == "\\added_space_bottom") {
|
||||
lex.nextToken();
|
||||
par->added_space_bottom = VSpace(lex.GetString());
|
||||
par->params.spaceBottom(VSpace(lex.GetString()));
|
||||
} else if (token == "\\pextra_type") {
|
||||
lex.nextToken();
|
||||
par->pextra_type = lex.GetInteger();
|
||||
par->params.pextraType(lex.GetInteger());
|
||||
} else if (token == "\\pextra_width") {
|
||||
lex.nextToken();
|
||||
par->pextra_width = lex.GetString();
|
||||
par->params.pextraWidth(lex.GetString());
|
||||
} else if (token == "\\pextra_widthp") {
|
||||
lex.nextToken();
|
||||
par->pextra_widthp = lex.GetString();
|
||||
par->params.pextraWidthp(lex.GetString());
|
||||
} else if (token == "\\pextra_alignment") {
|
||||
lex.nextToken();
|
||||
par->pextra_alignment = lex.GetInteger();
|
||||
par->params.pextraAlignment(lex.GetInteger());
|
||||
} else if (token == "\\pextra_hfill") {
|
||||
lex.nextToken();
|
||||
par->pextra_hfill = lex.GetInteger();
|
||||
par->params.pextraHfill(lex.GetInteger());
|
||||
} else if (token == "\\pextra_start_minipage") {
|
||||
lex.nextToken();
|
||||
par->pextra_start_minipage = lex.GetInteger();
|
||||
par->params.pextraStartMinipage(lex.GetInteger());
|
||||
} else if (token == "\\labelwidthstring") {
|
||||
lex.EatLine();
|
||||
par->labelwidthstring = lex.GetString();
|
||||
par->params.labelWidthString(lex.GetString());
|
||||
// do not delete this token, it is still needed!
|
||||
} else if (token == "\\end_inset") {
|
||||
lyxerr << "Solitary \\end_inset. Missing \\begin_inset?.\n"
|
||||
@ -1343,14 +1343,13 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
|
||||
}
|
||||
#endif
|
||||
/* begins or ends a deeper area ?*/
|
||||
if (depth != par->depth) {
|
||||
if (par->depth > depth) {
|
||||
while (par->depth > depth) {
|
||||
if (depth != par->params.depth()) {
|
||||
if (par->params.depth() > depth) {
|
||||
while (par->params.depth() > depth) {
|
||||
++depth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (par->depth < depth) {
|
||||
} else {
|
||||
while (par->params.depth() < depth) {
|
||||
--depth;
|
||||
}
|
||||
}
|
||||
@ -1439,7 +1438,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
buffer << par->labelstring << " ";
|
||||
buffer << par->params.labelString() << " ";
|
||||
break;
|
||||
}
|
||||
if (ltype_depth > depth) {
|
||||
@ -2088,7 +2087,7 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
|
||||
// flag this with ftcount
|
||||
ftcount = -1;
|
||||
if (layout.isEnvironment()
|
||||
|| par->pextra_type != LyXParagraph::PEXTRA_NONE) {
|
||||
|| par->params.pextraType() != LyXParagraph::PEXTRA_NONE) {
|
||||
par = par->TeXEnvironment(this, params, ofs, texrow
|
||||
#ifndef NEW_INSETS
|
||||
,ftnote, ft_texrow, ftcount
|
||||
@ -2254,7 +2253,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
}
|
||||
|
||||
// environment tag closing
|
||||
for (; depth > par->depth; --depth) {
|
||||
for (; depth > par->params.depth(); --depth) {
|
||||
sgmlCloseTag(ofs, depth, environment_stack[depth]);
|
||||
environment_stack[depth].erase();
|
||||
}
|
||||
@ -2262,7 +2261,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
// write opening SGML tags
|
||||
switch (style.latextype) {
|
||||
case LATEX_PARAGRAPH:
|
||||
if (depth == par->depth
|
||||
if (depth == par->params.depth()
|
||||
&& !environment_stack[depth].empty()) {
|
||||
sgmlCloseTag(ofs, depth, environment_stack[depth]);
|
||||
environment_stack[depth].erase();
|
||||
@ -2292,7 +2291,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
|
||||
case LATEX_ENVIRONMENT:
|
||||
case LATEX_ITEM_ENVIRONMENT:
|
||||
if (depth == par->depth
|
||||
if (depth == par->params.depth()
|
||||
&& environment_stack[depth] != style.latexname()
|
||||
&& !environment_stack[depth].empty()) {
|
||||
|
||||
@ -2300,8 +2299,8 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
environment_stack[depth]);
|
||||
environment_stack[depth].erase();
|
||||
}
|
||||
if (depth < par->depth) {
|
||||
depth = par->depth;
|
||||
if (depth < par->params.depth()) {
|
||||
depth = par->params.depth();
|
||||
environment_stack[depth].erase();
|
||||
}
|
||||
if (environment_stack[depth] != style.latexname()) {
|
||||
@ -2879,7 +2878,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
par->layout);
|
||||
|
||||
// environment tag closing
|
||||
for (; depth > par->depth; --depth) {
|
||||
for (; depth > par->params.depth(); --depth) {
|
||||
if (environment_inner[depth] != "!-- --") {
|
||||
item_name= "listitem";
|
||||
sgmlCloseTag(ofs, command_depth + depth,
|
||||
@ -2894,7 +2893,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
environment_inner[depth].erase();
|
||||
}
|
||||
|
||||
if (depth == par->depth
|
||||
if (depth == par->params.depth()
|
||||
&& environment_stack[depth] != style.latexname()
|
||||
&& !environment_stack[depth].empty()) {
|
||||
if (environment_inner[depth] != "!-- --") {
|
||||
@ -2978,8 +2977,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
|
||||
case LATEX_ENVIRONMENT:
|
||||
case LATEX_ITEM_ENVIRONMENT:
|
||||
if (depth < par->depth) {
|
||||
depth = par->depth;
|
||||
if (depth < par->params.depth()) {
|
||||
depth = par->params.depth();
|
||||
environment_stack[depth].erase();
|
||||
}
|
||||
|
||||
|
@ -254,9 +254,9 @@ string const CurrentState(BufferView * bv)
|
||||
state += string(_(", Depth: ")) + tostr(depth);
|
||||
// The paragraph spacing, but only if different from
|
||||
// buffer spacing.
|
||||
if (!text->cursor.par()->spacing.isDefault()) {
|
||||
if (!text->cursor.par()->params.spacing().isDefault()) {
|
||||
Spacing::Space cur_space =
|
||||
text->cursor.par()->spacing.getSpace();
|
||||
text->cursor.par()->params.spacing().getSpace();
|
||||
state += _(", Spacing: ");
|
||||
switch (cur_space) {
|
||||
case Spacing::Single:
|
||||
@ -270,7 +270,7 @@ string const CurrentState(BufferView * bv)
|
||||
break;
|
||||
case Spacing::Other:
|
||||
state += _("Other (");
|
||||
state += tostr(text->cursor.par()->spacing.getValue());
|
||||
state += tostr(text->cursor.par()->params.spacing().getValue());
|
||||
state += ")";
|
||||
break;
|
||||
case Spacing::Default:
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-03-06 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* FormParagraph.C: changes because of ParagraphParameters.
|
||||
|
||||
2001-03-06 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* FormSearch.C (Replace): remove default argument
|
||||
|
@ -336,36 +336,36 @@ void FormParagraph::general_update()
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
fl_set_button(general_->check_lines_top,
|
||||
text->cursor.par()->FirstPhysicalPar()->line_top);
|
||||
text->cursor.par()->FirstPhysicalPar()->params.lineTop());
|
||||
|
||||
fl_set_button(general_->check_lines_bottom,
|
||||
text->cursor.par()->FirstPhysicalPar()->line_bottom);
|
||||
text->cursor.par()->FirstPhysicalPar()->params.lineBottom());
|
||||
|
||||
fl_set_button(general_->check_pagebreaks_top,
|
||||
text->cursor.par()->FirstPhysicalPar()->pagebreak_top);
|
||||
text->cursor.par()->FirstPhysicalPar()->params.pagebreakTop());
|
||||
|
||||
fl_set_button(general_->check_pagebreaks_bottom,
|
||||
text->cursor.par()->FirstPhysicalPar()->pagebreak_bottom);
|
||||
text->cursor.par()->FirstPhysicalPar()->params.pagebreakBottom());
|
||||
fl_set_button(general_->check_noindent,
|
||||
text->cursor.par()->FirstPhysicalPar()->noindent);
|
||||
text->cursor.par()->FirstPhysicalPar()->params.noindent());
|
||||
#else
|
||||
fl_set_button(general_->check_lines_top,
|
||||
text->cursor.par()->line_top);
|
||||
text->cursor.par()->params.lineTop());
|
||||
fl_set_button(general_->check_lines_bottom,
|
||||
text->cursor.par()->line_bottom);
|
||||
text->cursor.par()->params.lineBottom());
|
||||
fl_set_button(general_->check_pagebreaks_top,
|
||||
text->cursor.par()->pagebreak_top);
|
||||
text->cursor.par()->params.pagebreakTop());
|
||||
fl_set_button(general_->check_pagebreaks_bottom,
|
||||
text->cursor.par()->pagebreak_bottom);
|
||||
text->cursor.par()->params.pagebreakBottom());
|
||||
fl_set_button(general_->check_noindent,
|
||||
text->cursor.par()->noindent);
|
||||
text->cursor.par()->params.noindent());
|
||||
#endif
|
||||
fl_set_input (general_->input_space_above, "");
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
switch (text->cursor.par()->FirstPhysicalPar()->added_space_top.kind()) {
|
||||
switch (text->cursor.par()->FirstPhysicalPar()->params.spaceTop().kind()) {
|
||||
#else
|
||||
switch (text->cursor.par()->added_space_top.kind()) {
|
||||
switch (text->cursor.par()->params.spaceTop().kind()) {
|
||||
#endif
|
||||
|
||||
case VSpace::NONE:
|
||||
@ -391,25 +391,25 @@ void FormParagraph::general_update()
|
||||
#ifndef NEW_INSETS
|
||||
fl_set_input(general_->input_space_above,
|
||||
text->cursor.par()->FirstPhysicalPar()->
|
||||
added_space_top.length().asString().c_str());
|
||||
params.spaceTop().length().asString().c_str());
|
||||
#else
|
||||
fl_set_input(general_->input_space_above, text->cursor.par()->
|
||||
added_space_top.length().asString().c_str());
|
||||
params.spaceTop().length().asString().c_str());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
fl_set_button(general_->check_space_above,
|
||||
text->cursor.par()->FirstPhysicalPar()->
|
||||
added_space_top.keep());
|
||||
params.spaceTop().keep());
|
||||
fl_set_input(general_->input_space_below, "");
|
||||
switch (text->cursor.par()->FirstPhysicalPar()->
|
||||
added_space_bottom.kind()) {
|
||||
params.spaceBottom().kind()) {
|
||||
#else
|
||||
fl_set_button (general_->check_space_above,
|
||||
text->cursor.par()->added_space_top.keep());
|
||||
text->cursor.par()->params.spaceTop().keep());
|
||||
fl_set_input (general_->input_space_below, "");
|
||||
switch (text->cursor.par()->added_space_bottom.kind()) {
|
||||
switch (text->cursor.par()->params.spaceBottom().kind()) {
|
||||
#endif
|
||||
case VSpace::NONE:
|
||||
fl_set_choice (general_->choice_space_below, 1);
|
||||
@ -434,14 +434,14 @@ void FormParagraph::general_update()
|
||||
#ifndef NEW_INSETS
|
||||
fl_set_input(general_->input_space_below,
|
||||
text->cursor.par()->FirstPhysicalPar()->
|
||||
added_space_bottom.length().asString().c_str());
|
||||
params.spaceBottom().length().asString().c_str());
|
||||
break;
|
||||
}
|
||||
fl_set_button(general_->check_space_below,
|
||||
text->cursor.par()->FirstPhysicalPar()->
|
||||
added_space_bottom.keep());
|
||||
params.spaceBottom().keep());
|
||||
fl_set_button(general_->check_noindent,
|
||||
text->cursor.par()->FirstPhysicalPar()->noindent);
|
||||
text->cursor.par()->FirstPhysicalPar()->params.noindent());
|
||||
|
||||
bool const enable = (!text->cursor.par()->FirstPhysicalPar()->InInset());
|
||||
|
||||
@ -455,13 +455,13 @@ void FormParagraph::general_update()
|
||||
|
||||
#else
|
||||
fl_set_input(general_->input_space_below, text->cursor.par()->
|
||||
added_space_bottom.length().asString().c_str());
|
||||
params.spaceBottom().length().asString().c_str());
|
||||
break;
|
||||
}
|
||||
fl_set_button(general_->check_space_below,
|
||||
text->cursor.par()->added_space_bottom.keep());
|
||||
text->cursor.par()->params.spaceBottom().keep());
|
||||
fl_set_button(general_->check_noindent,
|
||||
text->cursor.par()->noindent);
|
||||
text->cursor.par()->params.noindent());
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -477,10 +477,10 @@ void FormParagraph::extra_update()
|
||||
setEnabled(extra_->input_pextra_widthp, true);
|
||||
|
||||
fl_set_input(extra_->input_pextra_width,
|
||||
par->pextra_width.c_str());
|
||||
par->params.pextraWidth().c_str());
|
||||
fl_set_input(extra_->input_pextra_widthp,
|
||||
par->pextra_widthp.c_str());
|
||||
switch (par->pextra_alignment) {
|
||||
par->params.pextraWidthp().c_str());
|
||||
switch (par->params.pextraAlignment()) {
|
||||
case LyXParagraph::MINIPAGE_ALIGN_TOP:
|
||||
fl_set_button(extra_->radio_pextra_top, 1);
|
||||
break;
|
||||
@ -492,10 +492,10 @@ void FormParagraph::extra_update()
|
||||
break;
|
||||
}
|
||||
fl_set_button(extra_->radio_pextra_hfill,
|
||||
par->pextra_hfill);
|
||||
par->params.pextraHfill());
|
||||
fl_set_button(extra_->radio_pextra_startmp,
|
||||
par->pextra_start_minipage);
|
||||
if (par->pextra_type == LyXParagraph::PEXTRA_INDENT) {
|
||||
par->params.pextraStartMinipage());
|
||||
if (par->params.pextraType() == LyXParagraph::PEXTRA_INDENT) {
|
||||
fl_set_button(extra_->radio_pextra_indent, 1);
|
||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 0);
|
||||
@ -503,7 +503,7 @@ void FormParagraph::extra_update()
|
||||
setEnabled(extra_->radio_pextra_middle, false);
|
||||
setEnabled(extra_->radio_pextra_bottom, false);
|
||||
input(extra_->radio_pextra_indent, 0);
|
||||
} else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
|
||||
} else if (par->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE) {
|
||||
fl_set_button(extra_->radio_pextra_indent, 0);
|
||||
fl_set_button(extra_->radio_pextra_minipage, 1);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 0);
|
||||
@ -511,7 +511,7 @@ void FormParagraph::extra_update()
|
||||
setEnabled(extra_->radio_pextra_middle, true);
|
||||
setEnabled(extra_->radio_pextra_bottom, true);
|
||||
input(extra_->radio_pextra_minipage, 0);
|
||||
} else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) {
|
||||
} else if (par->params.pextraType() == LyXParagraph::PEXTRA_FLOATFLT) {
|
||||
fl_set_button(extra_->radio_pextra_indent, 0);
|
||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 1);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-03-06 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* insettext.C: changes becuase of ParagraphParameters.
|
||||
|
||||
2001-02-28 Baruch Even <baruch@ev-en.org>
|
||||
|
||||
* insetgraphics.C (updateInset): Changed due to the change in
|
||||
|
@ -1053,10 +1053,10 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
// inherit bufferparams/paragraphparams in a strange way. (Lgb)
|
||||
{
|
||||
LyXParagraph * par = TEXT(bv)->cursor.par();
|
||||
Spacing::Space cur_spacing = par->spacing.getSpace();
|
||||
Spacing::Space cur_spacing = par->params.spacing().getSpace();
|
||||
float cur_value = 1.0;
|
||||
if (cur_spacing == Spacing::Other) {
|
||||
cur_value = par->spacing.getValue();
|
||||
cur_value = par->params.spacing().getValue();
|
||||
}
|
||||
|
||||
std::istringstream istr(arg.c_str());
|
||||
@ -1087,7 +1087,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
<< arg << endl;
|
||||
}
|
||||
if (cur_spacing != new_spacing || cur_value != new_value) {
|
||||
par->spacing.set(new_spacing, new_value);
|
||||
par->params.spacing(Spacing(new_spacing, new_value));
|
||||
//TEXT(bv)->RedoParagraph(owner->view());
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
//bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
|
275
src/lyxfont.C
275
src/lyxfont.C
@ -10,12 +10,12 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <clocale>
|
||||
#include <cctype>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "lyxfont.h"
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <cctype>
|
||||
|
||||
#include "gettext.h"
|
||||
#include "lyxfont.h"
|
||||
@ -104,6 +104,8 @@ char const * LaTeXSizeNames[14] =
|
||||
"Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
|
||||
|
||||
|
||||
|
||||
// Initialize static member
|
||||
LyXFont::FontBits LyXFont::sane = {
|
||||
ROMAN_FAMILY,
|
||||
MEDIUM_SERIES,
|
||||
@ -113,8 +115,10 @@ LyXFont::FontBits LyXFont::sane = {
|
||||
OFF,
|
||||
OFF,
|
||||
OFF,
|
||||
OFF,
|
||||
OFF };
|
||||
|
||||
// Initialize static member
|
||||
LyXFont::FontBits LyXFont::inherit = {
|
||||
INHERIT_FAMILY,
|
||||
INHERIT_SERIES,
|
||||
@ -124,8 +128,10 @@ LyXFont::FontBits LyXFont::inherit = {
|
||||
INHERIT,
|
||||
INHERIT,
|
||||
INHERIT,
|
||||
INHERIT };
|
||||
INHERIT,
|
||||
OFF };
|
||||
|
||||
// Initialize static member
|
||||
LyXFont::FontBits LyXFont::ignore = {
|
||||
IGNORE_FAMILY,
|
||||
IGNORE_SERIES,
|
||||
@ -135,6 +141,7 @@ LyXFont::FontBits LyXFont::ignore = {
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE,
|
||||
IGNORE };
|
||||
|
||||
|
||||
@ -148,7 +155,8 @@ bool LyXFont::FontBits::operator==(LyXFont::FontBits const & fb1) const
|
||||
fb1.emph == emph &&
|
||||
fb1.underbar == underbar &&
|
||||
fb1.noun == noun &&
|
||||
fb1.latex == latex;
|
||||
fb1.latex == latex &&
|
||||
fb1.number == number;
|
||||
}
|
||||
|
||||
|
||||
@ -158,6 +166,210 @@ bool LyXFont::FontBits::operator!=(LyXFont::FontBits const & fb1) const
|
||||
}
|
||||
|
||||
|
||||
LyXFont::LyXFont()
|
||||
{
|
||||
bits = sane;
|
||||
lang = default_language;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT1)
|
||||
{
|
||||
bits = inherit;
|
||||
lang = default_language;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT2)
|
||||
{
|
||||
bits = ignore;
|
||||
lang = ignore_language;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT3)
|
||||
{
|
||||
bits = sane;
|
||||
lang = default_language;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT1, Language const * l)
|
||||
{
|
||||
bits = inherit;
|
||||
lang = l;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT2, Language const * l)
|
||||
{
|
||||
bits = ignore;
|
||||
lang = l;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l)
|
||||
{
|
||||
bits = sane;
|
||||
lang = l;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_FAMILY LyXFont::family() const
|
||||
{
|
||||
return bits.family;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_SERIES LyXFont::series() const
|
||||
{
|
||||
return bits.series;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_SHAPE LyXFont::shape() const
|
||||
{
|
||||
return bits.shape;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_SIZE LyXFont::size() const
|
||||
{
|
||||
return bits.size;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_MISC_STATE LyXFont::emph() const
|
||||
{
|
||||
return bits.emph;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_MISC_STATE LyXFont::underbar() const
|
||||
{
|
||||
return bits.underbar;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_MISC_STATE LyXFont::noun() const
|
||||
{
|
||||
return bits.noun;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_MISC_STATE LyXFont::latex() const
|
||||
{
|
||||
return bits.latex;
|
||||
}
|
||||
|
||||
|
||||
LColor::color LyXFont::color() const
|
||||
{
|
||||
return bits.color;
|
||||
}
|
||||
|
||||
|
||||
Language const * LyXFont::language() const
|
||||
{
|
||||
return lang;
|
||||
}
|
||||
|
||||
|
||||
LyXFont::FONT_MISC_STATE LyXFont::number() const
|
||||
{
|
||||
return bits.number;
|
||||
}
|
||||
|
||||
|
||||
bool LyXFont::isRightToLeft() const
|
||||
{
|
||||
return lang->RightToLeft();
|
||||
}
|
||||
|
||||
|
||||
bool LyXFont::isVisibleRightToLeft() const
|
||||
{
|
||||
return (lang->RightToLeft() && latex() != ON && number() != ON);
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setFamily(LyXFont::FONT_FAMILY f)
|
||||
{
|
||||
bits.family = f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setSeries(LyXFont::FONT_SERIES s)
|
||||
{
|
||||
bits.series = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setShape(LyXFont::FONT_SHAPE s)
|
||||
{
|
||||
bits.shape = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setSize(LyXFont::FONT_SIZE s)
|
||||
{
|
||||
bits.size = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setEmph(LyXFont::FONT_MISC_STATE e)
|
||||
{
|
||||
bits.emph = e;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u)
|
||||
{
|
||||
bits.underbar = u;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
|
||||
{
|
||||
bits.noun = n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
|
||||
{
|
||||
bits.latex = l;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setColor(LColor::color c)
|
||||
{
|
||||
bits.color = c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setLanguage(Language const * l)
|
||||
{
|
||||
lang = l;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
LyXFont & LyXFont::setNumber(LyXFont::FONT_MISC_STATE n)
|
||||
{
|
||||
bits.number = n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/// Decreases font size by one
|
||||
LyXFont & LyXFont::decSize()
|
||||
{
|
||||
@ -365,7 +577,6 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
|
||||
if (bits.color == LColor::inherit) {
|
||||
bits.color = tmplt.bits.color;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -422,7 +633,7 @@ string const LyXFont::stateText(BufferParams * params) const
|
||||
// Set family according to lyx format string
|
||||
LyXFont & LyXFont::setLyXFamily(string const & fam)
|
||||
{
|
||||
string s = lowercase(fam);
|
||||
string const s = lowercase(fam);
|
||||
|
||||
int i = 0;
|
||||
while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") ++i;
|
||||
@ -438,7 +649,7 @@ LyXFont & LyXFont::setLyXFamily(string const & fam)
|
||||
// Set series according to lyx format string
|
||||
LyXFont & LyXFont::setLyXSeries(string const & ser)
|
||||
{
|
||||
string s = lowercase(ser);
|
||||
string const s = lowercase(ser);
|
||||
|
||||
int i = 0;
|
||||
while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") ++i;
|
||||
@ -454,7 +665,7 @@ LyXFont & LyXFont::setLyXSeries(string const & ser)
|
||||
// Set shape according to lyx format string
|
||||
LyXFont & LyXFont::setLyXShape(string const & sha)
|
||||
{
|
||||
string s = lowercase(sha);
|
||||
string const s = lowercase(sha);
|
||||
|
||||
int i = 0;
|
||||
while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") ++i;
|
||||
@ -470,7 +681,7 @@ LyXFont & LyXFont::setLyXShape(string const & sha)
|
||||
// Set size according to lyx format string
|
||||
LyXFont & LyXFont::setLyXSize(string const & siz)
|
||||
{
|
||||
string s = lowercase(siz);
|
||||
string const s = lowercase(siz);
|
||||
int i = 0;
|
||||
while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i;
|
||||
if (s == LyXSizeNames[i]) {
|
||||
@ -485,7 +696,7 @@ LyXFont & LyXFont::setLyXSize(string const & siz)
|
||||
// Set size according to lyx format string
|
||||
LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
|
||||
{
|
||||
string s = lowercase(siz);
|
||||
string const s = lowercase(siz);
|
||||
int i = 0;
|
||||
while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i;
|
||||
if (s == LyXMiscNames[i])
|
||||
@ -519,7 +730,7 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex)
|
||||
bool finished = false;
|
||||
while (!finished && lex.IsOK() && !error) {
|
||||
lex.next();
|
||||
string tok = lowercase(lex.GetString());
|
||||
string const tok = lowercase(lex.GetString());
|
||||
|
||||
if (tok.empty()) {
|
||||
continue;
|
||||
@ -527,54 +738,54 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex)
|
||||
finished = true;
|
||||
} else if (tok == "family") {
|
||||
lex.next();
|
||||
string tok = lex.GetString();
|
||||
setLyXFamily(tok);
|
||||
string const ttok = lex.GetString();
|
||||
setLyXFamily(ttok);
|
||||
} else if (tok == "series") {
|
||||
lex.next();
|
||||
string tok = lex.GetString();
|
||||
setLyXSeries(tok);
|
||||
string const ttok = lex.GetString();
|
||||
setLyXSeries(ttok);
|
||||
} else if (tok == "shape") {
|
||||
lex.next();
|
||||
string tok = lex.GetString();
|
||||
setLyXShape(tok);
|
||||
string const ttok = lex.GetString();
|
||||
setLyXShape(ttok);
|
||||
} else if (tok == "size") {
|
||||
lex.next();
|
||||
string tok = lex.GetString();
|
||||
setLyXSize(tok);
|
||||
string const ttok = lex.GetString();
|
||||
setLyXSize(ttok);
|
||||
} else if (tok == "latex") {
|
||||
lex.next();
|
||||
string tok = lowercase(lex.GetString());
|
||||
string const ttok = lowercase(lex.GetString());
|
||||
|
||||
if (tok == "no_latex") {
|
||||
if (ttok == "no_latex") {
|
||||
setLatex(OFF);
|
||||
} else if (tok == "latex") {
|
||||
} else if (ttok == "latex") {
|
||||
setLatex(ON);
|
||||
} else {
|
||||
lex.printError("Illegal LaTeX type`$$Token'");
|
||||
}
|
||||
} else if (tok == "misc") {
|
||||
lex.next();
|
||||
string tok = lowercase(lex.GetString());
|
||||
string const ttok = lowercase(lex.GetString());
|
||||
|
||||
if (tok == "no_bar") {
|
||||
if (ttok == "no_bar") {
|
||||
setUnderbar(OFF);
|
||||
} else if (tok == "no_emph") {
|
||||
} else if (ttok == "no_emph") {
|
||||
setEmph(OFF);
|
||||
} else if (tok == "no_noun") {
|
||||
} else if (ttok == "no_noun") {
|
||||
setNoun(OFF);
|
||||
} else if (tok == "emph") {
|
||||
} else if (ttok == "emph") {
|
||||
setEmph(ON);
|
||||
} else if (tok == "underbar") {
|
||||
} else if (ttok == "underbar") {
|
||||
setUnderbar(ON);
|
||||
} else if (tok == "noun") {
|
||||
} else if (ttok == "noun") {
|
||||
setNoun(ON);
|
||||
} else {
|
||||
lex.printError("Illegal misc type `$$Token´");
|
||||
}
|
||||
} else if (tok == "color") {
|
||||
lex.next();
|
||||
string tok = lex.GetString();
|
||||
setLyXColor(tok);
|
||||
string const ttok = lex.GetString();
|
||||
setLyXColor(ttok);
|
||||
} else {
|
||||
lex.printError("Unknown tag `$$Token'");
|
||||
error = true;
|
||||
@ -677,7 +888,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
|
||||
count += 3;
|
||||
}
|
||||
} else {
|
||||
string tmp =
|
||||
string const tmp =
|
||||
subst(lyxrc.language_command_local,
|
||||
"$$lang", language()->babel());
|
||||
os << tmp;
|
||||
|
282
src/lyxfont.h
282
src/lyxfont.h
@ -155,9 +155,6 @@ public:
|
||||
///
|
||||
LyXFont();
|
||||
|
||||
// LyXFont x(LyXFont ...) and LyXFont x = LyXFont ...
|
||||
LyXFont(LyXFont const & x);
|
||||
|
||||
/// Shortcut initialization
|
||||
explicit
|
||||
LyXFont(LyXFont::FONT_INIT1);
|
||||
@ -174,9 +171,6 @@ public:
|
||||
/// Shortcut initialization
|
||||
LyXFont(LyXFont::FONT_INIT3, Language const * l);
|
||||
|
||||
/// LyXFont x, y; x = y;
|
||||
LyXFont & operator=(LyXFont const & x);
|
||||
|
||||
/// Decreases font size by one
|
||||
LyXFont & decSize();
|
||||
|
||||
@ -350,13 +344,15 @@ private:
|
||||
FONT_MISC_STATE noun;
|
||||
///
|
||||
FONT_MISC_STATE latex;
|
||||
///
|
||||
FONT_MISC_STATE number;
|
||||
};
|
||||
|
||||
///
|
||||
FontBits bits;
|
||||
|
||||
///
|
||||
Language const * lang;
|
||||
///
|
||||
FONT_MISC_STATE number_;
|
||||
|
||||
/// Sane font
|
||||
static FontBits sane;
|
||||
@ -377,276 +373,16 @@ std::ostream & operator<<(std::ostream &, LyXFont::FONT_MISC_STATE);
|
||||
|
||||
///
|
||||
inline
|
||||
bool operator==(LyXFont const & font1, LyXFont const & font2) {
|
||||
bool operator==(LyXFont const & font1, LyXFont const & font2)
|
||||
{
|
||||
return font1.bits == font2.bits &&
|
||||
font1.lang == font2.lang &&
|
||||
font1.number_ == font2.number_;
|
||||
font1.lang == font2.lang;
|
||||
}
|
||||
|
||||
///
|
||||
inline
|
||||
bool operator!=(LyXFont const & font1, LyXFont const & font2) {
|
||||
bool operator!=(LyXFont const & font1, LyXFont const & font2)
|
||||
{
|
||||
return !(font1 == font2);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont()
|
||||
{
|
||||
bits = sane;
|
||||
lang = default_language;
|
||||
number_ = OFF;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont(LyXFont const & x)
|
||||
{
|
||||
bits = x.bits;
|
||||
lang = x.lang;
|
||||
number_ = x.number_;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT1)
|
||||
{
|
||||
bits = inherit;
|
||||
lang = default_language;
|
||||
number_ = OFF;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT2)
|
||||
{
|
||||
bits = ignore;
|
||||
lang = ignore_language;
|
||||
number_ = IGNORE;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT3)
|
||||
{
|
||||
bits = sane;
|
||||
lang = default_language;
|
||||
number_ = OFF;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT1, Language const * l)
|
||||
{
|
||||
bits = inherit;
|
||||
lang = l;
|
||||
number_ = OFF;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT2, Language const * l)
|
||||
{
|
||||
bits = ignore;
|
||||
lang = l;
|
||||
number_ = IGNORE;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l)
|
||||
{
|
||||
bits = sane;
|
||||
lang = l;
|
||||
number_ = OFF;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::operator=(LyXFont const & x)
|
||||
{
|
||||
bits = x.bits;
|
||||
lang = x.lang;
|
||||
number_ = x.number_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_FAMILY LyXFont::family() const
|
||||
{
|
||||
return bits.family;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_SERIES LyXFont::series() const
|
||||
{
|
||||
return bits.series;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_SHAPE LyXFont::shape() const
|
||||
{
|
||||
return bits.shape;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_SIZE LyXFont::size() const
|
||||
{
|
||||
return bits.size;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_MISC_STATE LyXFont::emph() const
|
||||
{
|
||||
return bits.emph;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_MISC_STATE LyXFont::underbar() const
|
||||
{
|
||||
return bits.underbar;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_MISC_STATE LyXFont::noun() const
|
||||
{
|
||||
return bits.noun;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_MISC_STATE LyXFont::latex() const
|
||||
{
|
||||
return bits.latex;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LColor::color LyXFont::color() const
|
||||
{
|
||||
return bits.color;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
Language const * LyXFont::language() const
|
||||
{
|
||||
return lang;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont::FONT_MISC_STATE LyXFont::number() const
|
||||
{
|
||||
return number_;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool LyXFont::isRightToLeft() const
|
||||
{
|
||||
return lang->RightToLeft();
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool LyXFont::isVisibleRightToLeft() const
|
||||
{
|
||||
return (lang->RightToLeft() && latex() != ON && number() != ON);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setFamily(LyXFont::FONT_FAMILY f)
|
||||
{
|
||||
bits.family = f;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setSeries(LyXFont::FONT_SERIES s)
|
||||
{
|
||||
bits.series = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setShape(LyXFont::FONT_SHAPE s)
|
||||
{
|
||||
bits.shape = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setSize(LyXFont::FONT_SIZE s)
|
||||
{
|
||||
bits.size = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setEmph(LyXFont::FONT_MISC_STATE e)
|
||||
{
|
||||
bits.emph = e;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setUnderbar(LyXFont::FONT_MISC_STATE u)
|
||||
{
|
||||
bits.underbar = u;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
|
||||
{
|
||||
bits.noun = n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
|
||||
{
|
||||
bits.latex = l;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setColor(LColor::color c)
|
||||
{
|
||||
bits.color = c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setLanguage(Language const * l)
|
||||
{
|
||||
lang = l;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
LyXFont & LyXFont::setNumber(LyXFont::FONT_MISC_STATE n)
|
||||
{
|
||||
number_ = n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -18,12 +18,11 @@
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include "insets/lyxinset.h"
|
||||
#include "vspace.h"
|
||||
#include "layout.h"
|
||||
#include <boost/array.hpp>
|
||||
#include "language.h"
|
||||
#include "ParagraphParameters.h"
|
||||
|
||||
class BufferParams;
|
||||
class LyXBuffer;
|
||||
@ -225,14 +224,8 @@ public:
|
||||
void setContentsFromPar(LyXParagraph * par);
|
||||
///
|
||||
void clearContents();
|
||||
///
|
||||
VSpace added_space_top;
|
||||
|
||||
///
|
||||
VSpace added_space_bottom;
|
||||
|
||||
///
|
||||
Spacing spacing;
|
||||
ParagraphParameters params;
|
||||
|
||||
///
|
||||
LyXTextClass::LayoutList::size_type layout;
|
||||
@ -249,26 +242,6 @@ public:
|
||||
/// footnote, margin, fig, tab
|
||||
footnote_kind footnotekind;
|
||||
#endif
|
||||
///
|
||||
bool line_top;
|
||||
|
||||
///
|
||||
bool line_bottom;
|
||||
|
||||
///
|
||||
bool pagebreak_top;
|
||||
|
||||
///
|
||||
bool pagebreak_bottom;
|
||||
|
||||
///
|
||||
LyXAlignment align;
|
||||
|
||||
///
|
||||
char depth;
|
||||
|
||||
///
|
||||
bool noindent;
|
||||
|
||||
private:
|
||||
///
|
||||
@ -280,11 +253,6 @@ public:
|
||||
int getCounter(int i) const;
|
||||
///
|
||||
void incCounter(int i);
|
||||
///
|
||||
bool start_of_appendix;
|
||||
|
||||
///
|
||||
bool appendix;
|
||||
|
||||
///
|
||||
char enumdepth;
|
||||
@ -292,26 +260,6 @@ public:
|
||||
///
|
||||
char itemdepth;
|
||||
|
||||
/* This is for the paragraph extra stuff */
|
||||
///
|
||||
int pextra_type;
|
||||
///
|
||||
string pextra_width;
|
||||
///
|
||||
string pextra_widthp;
|
||||
///
|
||||
int pextra_alignment;
|
||||
///
|
||||
bool pextra_hfill;
|
||||
///
|
||||
bool pextra_start_minipage;
|
||||
|
||||
///
|
||||
string labelstring;
|
||||
|
||||
///
|
||||
string labelwidthstring;
|
||||
|
||||
///
|
||||
LyXParagraph * next;
|
||||
///
|
||||
@ -524,7 +472,7 @@ private:
|
||||
///
|
||||
Inset * inset;
|
||||
///
|
||||
InsetTable(size_type p, Inset * i) { pos = p; inset = i;}
|
||||
InsetTable(size_type p, Inset * i) : pos(p), inset(i) {}
|
||||
};
|
||||
///
|
||||
friend struct matchIT;
|
||||
@ -549,8 +497,23 @@ private:
|
||||
(font_1 covers the chars 0,...,pos_1) (Dekel)
|
||||
*/
|
||||
struct FontTable {
|
||||
///
|
||||
FontTable(size_type p, LyXFont const & f)
|
||||
: pos_(p)
|
||||
{
|
||||
font_ = container.get(f);
|
||||
}
|
||||
///
|
||||
size_type pos() const { return pos_; }
|
||||
///
|
||||
void pos(size_type p) { pos_ = p; }
|
||||
///
|
||||
LyXFont const & font() const { return *font_; }
|
||||
///
|
||||
void font(LyXFont const & f) { font_ = container.get(f);}
|
||||
private:
|
||||
/// End position of paragraph this font attribute covers
|
||||
size_type pos;
|
||||
size_type pos_;
|
||||
/** Font. Interpretation of the font values:
|
||||
If a value is LyXFont::INHERIT_*, it means that the font
|
||||
attribute is inherited from either the layout of this
|
||||
@ -560,9 +523,9 @@ private:
|
||||
The values LyXFont::IGNORE_* and LyXFont::TOGGLE are NOT
|
||||
allowed in these font tables.
|
||||
*/
|
||||
LyXFont font;
|
||||
boost::shared_ptr<LyXFont> font_;
|
||||
///
|
||||
FontTable(size_type p, LyXFont const & f) {pos = p; font = f;}
|
||||
static ShareContainer<LyXFont> container;
|
||||
};
|
||||
///
|
||||
friend struct matchFT;
|
||||
@ -572,7 +535,7 @@ private:
|
||||
inline
|
||||
int operator()(LyXParagraph::FontTable const & a,
|
||||
LyXParagraph::FontTable const & b) const {
|
||||
return a.pos < b.pos;
|
||||
return a.pos() < b.pos();
|
||||
}
|
||||
};
|
||||
|
||||
|
599
src/paragraph.C
599
src/paragraph.C
File diff suppressed because it is too large
Load Diff
123
src/text.C
123
src/text.C
@ -727,17 +727,17 @@ int LyXText::LeftMargin(BufferView * bview, Row const * row) const
|
||||
// a layout. Since there is always a redo,
|
||||
// LeftMargin() is always called
|
||||
#ifndef NEW_INSETS
|
||||
row->par()->FirstPhysicalPar()->depth = 0;
|
||||
row->par()->FirstPhysicalPar()->params.depth(0);
|
||||
#else
|
||||
row->par()->depth = 0;
|
||||
row->par()->params.depth(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (newpar && !row->par()->GetLayout()) {
|
||||
#ifndef NEW_INSETS
|
||||
if (newpar->FirstPhysicalPar()->noindent)
|
||||
if (newpar->FirstPhysicalPar()->params.noindent())
|
||||
#else
|
||||
if (newpar->noindent)
|
||||
if (newpar->params.noindent())
|
||||
#endif
|
||||
parindent.erase();
|
||||
else
|
||||
@ -837,12 +837,12 @@ int LyXText::LeftMargin(BufferView * bview, Row const * row) const
|
||||
break;
|
||||
}
|
||||
if ((workWidth(bview) > 0) &&
|
||||
(row->par()->pextra_type == LyXParagraph::PEXTRA_INDENT)) {
|
||||
if (!row->par()->pextra_widthp.empty()) {
|
||||
(row->par()->params.pextraType() == LyXParagraph::PEXTRA_INDENT)) {
|
||||
if (!row->par()->params.pextraWidthp().empty()) {
|
||||
x += workWidth(bview) *
|
||||
lyx::atoi(row->par()->pextra_widthp) / 100;
|
||||
} else if (!row->par()->pextra_width.empty()) {
|
||||
int xx = VSpace(row->par()->pextra_width).inPixels(bview);
|
||||
lyx::atoi(row->par()->params.pextraWidthp()) / 100;
|
||||
} else if (!row->par()->params.pextraWidth().empty()) {
|
||||
int xx = VSpace(row->par()->params.pextraWidth()).inPixels(bview);
|
||||
if (xx > workWidth(bview))
|
||||
xx = workWidth(bview) * 80 / 100;
|
||||
x += xx;
|
||||
@ -854,15 +854,15 @@ int LyXText::LeftMargin(BufferView * bview, Row const * row) const
|
||||
|
||||
int align; // wrong type
|
||||
#ifndef NEW_INSETS
|
||||
if (row->par()->FirstPhysicalPar()->align == LYX_ALIGN_LAYOUT)
|
||||
if (row->par()->FirstPhysicalPar()->params.align() == LYX_ALIGN_LAYOUT)
|
||||
align = layout.align;
|
||||
else
|
||||
align = row->par()->FirstPhysicalPar()->align;
|
||||
align = row->par()->FirstPhysicalPar()->params.align();
|
||||
#else
|
||||
if (row->par()->align == LYX_ALIGN_LAYOUT)
|
||||
if (row->par()->params.align() == LYX_ALIGN_LAYOUT)
|
||||
align = layout.align;
|
||||
else
|
||||
align = row->par()->align;
|
||||
align = row->par()->params.align();
|
||||
#endif
|
||||
// set the correct parindent
|
||||
if (row->pos() == 0) {
|
||||
@ -876,7 +876,7 @@ int LyXText::LeftMargin(BufferView * bview, Row const * row) const
|
||||
&& row->par() == row->par()->FirstPhysicalPar()
|
||||
#endif
|
||||
&& align == LYX_ALIGN_BLOCK
|
||||
&& !row->par()->noindent
|
||||
&& !row->par()->params.noindent()
|
||||
&& (row->par()->layout ||
|
||||
bview->buffer()->params.paragraph_separation ==
|
||||
BufferParams::PARSEP_INDENT))
|
||||
@ -958,9 +958,9 @@ int LyXText::RightMargin(Buffer const * buf, Row const * row) const
|
||||
// a layout. Since there is always a redo,
|
||||
// LeftMargin() is always called
|
||||
#ifndef NEW_INSETS
|
||||
row->par()->FirstPhysicalPar()->depth = 0;
|
||||
row->par()->FirstPhysicalPar()->params.depth(0);
|
||||
#else
|
||||
row->par()->depth = 0;
|
||||
row->par()->params.depth(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1188,8 +1188,8 @@ int LyXText::LabelFill(BufferView * bview, Row const * row) const
|
||||
}
|
||||
|
||||
int fill = 0;
|
||||
if (!row->par()->labelwidthstring.empty()) {
|
||||
fill = max(lyxfont::width(row->par()->labelwidthstring,
|
||||
if (!row->par()->params.labelWidthString().empty()) {
|
||||
fill = max(lyxfont::width(row->par()->params.labelWidthString(),
|
||||
GetFont(bview->buffer(), row->par(), -2)) - w,
|
||||
0);
|
||||
}
|
||||
@ -1341,8 +1341,8 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
LyXFont labelfont = GetFont(bview->buffer(), par, -2);
|
||||
|
||||
float spacing_val = 1.0;
|
||||
if (!row_ptr->par()->spacing.isDefault()) {
|
||||
spacing_val = row_ptr->par()->spacing.getValue();
|
||||
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||
} else {
|
||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
||||
}
|
||||
@ -1422,17 +1422,17 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
maxasc += LYX_PAPER_MARGIN;
|
||||
|
||||
/* add the vertical spaces, that the user added */
|
||||
if (firstpar->added_space_top.kind() != VSpace::NONE)
|
||||
maxasc += int(firstpar->added_space_top.inPixels(bview));
|
||||
if (firstpar->params.spaceTop().kind() != VSpace::NONE)
|
||||
maxasc += int(firstpar->params.spaceTop().inPixels(bview));
|
||||
|
||||
/* do not forget the DTP-lines!
|
||||
* there height depends on the font of the nearest character */
|
||||
if (firstpar->line_top)
|
||||
if (firstpar->params.lineTop())
|
||||
maxasc += 2 * lyxfont::ascent('x', GetFont(bview->buffer(),
|
||||
firstpar, 0));
|
||||
|
||||
/* and now the pagebreaks */
|
||||
if (firstpar->pagebreak_top)
|
||||
if (firstpar->params.pagebreakTop())
|
||||
maxasc += 3 * DefaultHeight();
|
||||
|
||||
/* this is special code for the chapter, since the label of this
|
||||
@ -1440,8 +1440,8 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
if (layout.labeltype == LABEL_COUNTER_CHAPTER
|
||||
&& bview->buffer()->params.secnumdepth >= 0) {
|
||||
float spacing_val = 1.0;
|
||||
if (!row_ptr->par()->spacing.isDefault()) {
|
||||
spacing_val = row_ptr->par()->spacing.getValue();
|
||||
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||
} else {
|
||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
||||
}
|
||||
@ -1461,8 +1461,8 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
&& row_ptr->par()->IsFirstInSequence()
|
||||
&& !row_ptr->par()->GetLabelstring().empty()) {
|
||||
float spacing_val = 1.0;
|
||||
if (!row_ptr->par()->spacing.isDefault()) {
|
||||
spacing_val = row_ptr->par()->spacing.getValue();
|
||||
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||
} else {
|
||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
||||
}
|
||||
@ -1481,7 +1481,7 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
/* and now the layout spaces, for example before and after a section,
|
||||
* or between the items of a itemize or enumerate environment */
|
||||
|
||||
if (!firstpar->pagebreak_top) {
|
||||
if (!firstpar->params.pagebreakTop()) {
|
||||
LyXParagraph * prev = row_ptr->par()->Previous();
|
||||
if (prev)
|
||||
prev = row_ptr->par()->DepthHook(row_ptr->par()->GetDepth());
|
||||
@ -1502,7 +1502,7 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
if (tmptop > 0)
|
||||
layoutasc = (tmptop * DefaultHeight());
|
||||
}
|
||||
else if (row_ptr->par()->line_top){
|
||||
else if (row_ptr->par()->params.lineTop()) {
|
||||
tmptop = layout.topsep;
|
||||
|
||||
if (tmptop > 0)
|
||||
@ -1541,22 +1541,22 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
maxdesc += LYX_PAPER_MARGIN;
|
||||
|
||||
/* add the vertical spaces, that the user added */
|
||||
if (firstpar->added_space_bottom.kind() != VSpace::NONE)
|
||||
maxdesc += int(firstpar->added_space_bottom.inPixels(bview));
|
||||
if (firstpar->params.spaceBottom().kind() != VSpace::NONE)
|
||||
maxdesc += int(firstpar->params.spaceBottom().inPixels(bview));
|
||||
|
||||
/* do not forget the DTP-lines!
|
||||
* there height depends on the font of the nearest character */
|
||||
if (firstpar->line_bottom)
|
||||
if (firstpar->params.lineBottom())
|
||||
maxdesc += 2 * lyxfont::ascent('x', GetFont(bview->buffer(),
|
||||
par, par->Last() - 1));
|
||||
|
||||
/* and now the pagebreaks */
|
||||
if (firstpar->pagebreak_bottom)
|
||||
if (firstpar->params.pagebreakBottom())
|
||||
maxdesc += 3 * DefaultHeight();
|
||||
|
||||
/* and now the layout spaces, for example before and after a section,
|
||||
* or between the items of a itemize or enumerate environment */
|
||||
if (!firstpar->pagebreak_bottom && row_ptr->par()->Next()) {
|
||||
if (!firstpar->params.pagebreakBottom() && row_ptr->par()->Next()) {
|
||||
LyXParagraph * nextpar = row_ptr->par()->Next();
|
||||
LyXParagraph * comparepar = row_ptr->par();
|
||||
float usual = 0;
|
||||
@ -2241,15 +2241,15 @@ void LyXText::PrepareToPrint(BufferView * bview,
|
||||
// set x how you need it
|
||||
int align;
|
||||
#ifndef NEW_INSETS
|
||||
if (row->par()->FirstPhysicalPar()->align == LYX_ALIGN_LAYOUT)
|
||||
if (row->par()->FirstPhysicalPar()->params.align() == LYX_ALIGN_LAYOUT)
|
||||
align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->GetLayout()).align;
|
||||
else
|
||||
align = row->par()->FirstPhysicalPar()->align;
|
||||
align = row->par()->FirstPhysicalPar()->params.align();
|
||||
#else
|
||||
if (row->par()->align == LYX_ALIGN_LAYOUT)
|
||||
if (row->par()->params.align() == LYX_ALIGN_LAYOUT)
|
||||
align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->GetLayout()).align;
|
||||
else
|
||||
align = row->par()->align;
|
||||
align = row->par()->params.align();
|
||||
#endif
|
||||
|
||||
// center displayed insets
|
||||
@ -2734,11 +2734,11 @@ void LyXText::Backspace(BufferView * bview)
|
||||
&& cursor.par()->footnoteflag == tmppar->footnoteflag
|
||||
#endif
|
||||
&& cursor.par()->GetAlign() == tmppar->GetAlign()) {
|
||||
// Inherit botom DTD from the paragraph below.
|
||||
// Inherit bottom DTD from the paragraph below.
|
||||
// (the one we are deleting)
|
||||
tmppar->line_bottom = cursor.par()->line_bottom;
|
||||
tmppar->added_space_bottom = cursor.par()->added_space_bottom;
|
||||
tmppar->pagebreak_bottom = cursor.par()->pagebreak_bottom;
|
||||
tmppar->params.lineBottom(cursor.par()->params.lineBottom());
|
||||
tmppar->params.spaceBottom(cursor.par()->params.spaceBottom());
|
||||
tmppar->params.pagebreakBottom(cursor.par()->params.pagebreakBottom());
|
||||
}
|
||||
|
||||
CursorLeft(bview);
|
||||
@ -3322,7 +3322,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
|
||||
// Draw appendix lines
|
||||
LyXParagraph * p = row_ptr->par()->PreviousBeforeFootnote()->FirstPhysicalPar();
|
||||
if (p->appendix){
|
||||
if (p->params.appendix()) {
|
||||
pain.line(1, y_offset,
|
||||
1, y_offset + row_ptr->height(),
|
||||
LColor::appendixline);
|
||||
@ -3334,7 +3334,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
|
||||
// Draw minipage line
|
||||
bool const minipage =
|
||||
(p->pextra_type == LyXParagraph::PEXTRA_MINIPAGE);
|
||||
(p->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE);
|
||||
if (minipage)
|
||||
pain.line(LYX_PAPER_MARGIN/5, y_offset,
|
||||
LYX_PAPER_MARGIN/5,
|
||||
@ -3370,7 +3370,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
#else
|
||||
LyXParagraph * firstpar = row_ptr->par();
|
||||
#endif
|
||||
if (firstpar->appendix){
|
||||
if (firstpar->params.appendix()) {
|
||||
pain.line(1, y_offset,
|
||||
1, y_offset + row_ptr->height(),
|
||||
LColor::appendixline);
|
||||
@ -3381,7 +3381,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
|
||||
// Draw minipage line
|
||||
bool const minipage =
|
||||
(firstpar->pextra_type == LyXParagraph::PEXTRA_MINIPAGE);
|
||||
(firstpar->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE);
|
||||
if (minipage)
|
||||
pain.line(LYX_PAPER_MARGIN/5 + box_x, y_offset,
|
||||
LYX_PAPER_MARGIN/5 + box_x,
|
||||
@ -3444,7 +3444,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
if (!row_ptr->pos() && (row_ptr->par() == firstpar)) {
|
||||
|
||||
/* start of appendix? */
|
||||
if (row_ptr->par()->start_of_appendix){
|
||||
if (row_ptr->par()->params.startOfAppendix()) {
|
||||
pain.line(1, y_offset,
|
||||
ww - 2, y_offset,
|
||||
LColor::appendixline);
|
||||
@ -3454,7 +3454,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
if (!row_ptr->previous() && bv_owner)
|
||||
y_top += LYX_PAPER_MARGIN;
|
||||
|
||||
if (row_ptr->par()->pagebreak_top){ /* draw a top pagebreak */
|
||||
/* draw a top pagebreak */
|
||||
if (row_ptr->par()->params.pagebreakTop()) {
|
||||
LyXFont pb_font;
|
||||
pb_font.setColor(LColor::pagebreak).decSize();
|
||||
int w = 0, a = 0, d = 0;
|
||||
@ -3478,7 +3479,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
y_top += 3 * DefaultHeight();
|
||||
}
|
||||
|
||||
if (row_ptr->par()->added_space_top.kind() == VSpace::VFILL) {
|
||||
if (row_ptr->par()->params.spaceTop().kind() == VSpace::VFILL) {
|
||||
/* draw a vfill top */
|
||||
pain.line(0, y_offset + 2 + y_top,
|
||||
LYX_PAPER_MARGIN, y_offset + 2 + y_top,
|
||||
@ -3498,7 +3499,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
}
|
||||
|
||||
/* think about user added space */
|
||||
y_top += int(row_ptr->par()->added_space_top.inPixels(bview));
|
||||
y_top += int(row_ptr->par()->params.spaceTop().inPixels(bview));
|
||||
|
||||
/* think about the parskip */
|
||||
/* some parskips VERY EASY IMPLEMENTATION */
|
||||
@ -3515,7 +3516,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
y_top += bview->buffer()->params.getDefSkip().inPixels(bview);
|
||||
}
|
||||
|
||||
if (row_ptr->par()->line_top) { /* draw a top line */
|
||||
if (row_ptr->par()->params.lineTop()) { /* draw a top line */
|
||||
y_top += lyxfont::ascent('x',
|
||||
GetFont(bview->buffer(),
|
||||
row_ptr->par(), 0));
|
||||
@ -3548,8 +3549,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
/* this is special code for the chapter layout. This is printed in
|
||||
* an extra row and has a pagebreak at the top. */
|
||||
float spacing_val = 1.0;
|
||||
if (!row_ptr->par()->spacing.isDefault()) {
|
||||
spacing_val = row_ptr->par()->spacing.getValue();
|
||||
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||
} else {
|
||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
||||
}
|
||||
@ -3595,8 +3596,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
string const tmpstring =
|
||||
row_ptr->par()->GetLabelstring();
|
||||
float spacing_val = 1.0;
|
||||
if (!row_ptr->par()->spacing.isDefault()) {
|
||||
spacing_val = row_ptr->par()->spacing.getValue();
|
||||
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||
} else {
|
||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
||||
}
|
||||
@ -3653,7 +3654,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
y_bottom -= LYX_PAPER_MARGIN;
|
||||
|
||||
/* draw a bottom pagebreak */
|
||||
if (firstpar->pagebreak_bottom) {
|
||||
if (firstpar->params.pagebreakBottom()) {
|
||||
LyXFont pb_font;
|
||||
pb_font.setColor(LColor::pagebreak).decSize();
|
||||
int w = 0, a = 0, d = 0;
|
||||
@ -3678,7 +3679,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
y_bottom -= 3 * DefaultHeight();
|
||||
}
|
||||
|
||||
if (firstpar->added_space_bottom.kind() == VSpace::VFILL) {
|
||||
if (firstpar->params.spaceBottom().kind() == VSpace::VFILL) {
|
||||
/* draw a vfill bottom */
|
||||
pain.line(0, y_offset + y_bottom - 3 * DefaultHeight(),
|
||||
LYX_PAPER_MARGIN,
|
||||
@ -3697,9 +3698,9 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
}
|
||||
|
||||
/* think about user added space */
|
||||
y_bottom -= int(firstpar->added_space_bottom.inPixels(bview));
|
||||
y_bottom -= int(firstpar->params.spaceBottom().inPixels(bview));
|
||||
|
||||
if (firstpar->line_bottom) {
|
||||
if (firstpar->params.lineBottom()) {
|
||||
/* draw a bottom line */
|
||||
y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(),
|
||||
par, par->Last() - 1));
|
||||
@ -3971,7 +3972,7 @@ void LyXText::InsertFootnoteEnvironment(BufferView * bview,
|
||||
}
|
||||
/* no marginpars in minipages */
|
||||
if (kind == LyXParagraph::MARGIN
|
||||
&& cursor.par()->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
|
||||
&& cursor.par()->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE) {
|
||||
WriteAlert(_("Impossible operation"),
|
||||
_("You can't insert a marginpar in a minipage!"),
|
||||
_("Sorry."));
|
||||
|
108
src/text2.C
108
src/text2.C
@ -590,10 +590,10 @@ LyXParagraph * LyXText::SetLayout(BufferView * bview,
|
||||
#else
|
||||
LyXParagraph * fppar = cur.par();
|
||||
#endif
|
||||
fppar->added_space_top = lyxlayout.fill_top ?
|
||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
||||
fppar->added_space_bottom = lyxlayout.fill_bottom ?
|
||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
||||
fppar->params.spaceTop(lyxlayout.fill_top ?
|
||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
|
||||
fppar->params.spaceBottom(lyxlayout.fill_bottom ?
|
||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
|
||||
if (lyxlayout.margintype == MARGIN_MANUAL)
|
||||
cur.par()->SetLabelWidthString(lyxlayout.labelstring());
|
||||
if (lyxlayout.labeltype != LABEL_BIBLIO
|
||||
@ -616,10 +616,10 @@ LyXParagraph * LyXText::SetLayout(BufferView * bview,
|
||||
#else
|
||||
LyXParagraph * fppar = cur.par();
|
||||
#endif
|
||||
fppar->added_space_top = lyxlayout.fill_top ?
|
||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
||||
fppar->added_space_bottom = lyxlayout.fill_bottom ?
|
||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
||||
fppar->params.spaceTop(lyxlayout.fill_top ?
|
||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
|
||||
fppar->params.spaceBottom(lyxlayout.fill_bottom ?
|
||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
|
||||
if (lyxlayout.margintype == MARGIN_MANUAL)
|
||||
cur.par()->SetLabelWidthString(lyxlayout.labelstring());
|
||||
if (lyxlayout.labeltype != LABEL_BIBLIO
|
||||
@ -735,9 +735,9 @@ void LyXText::IncDepth(BufferView * bview)
|
||||
&& textclasslist.Style(bview->buffer()->params.textclass,
|
||||
prev->GetLayout()).isEnvironment()))) {
|
||||
#ifndef NEW_INSETS
|
||||
cursor.par()->FirstPhysicalPar()->depth++;
|
||||
cursor.par()->FirstPhysicalPar()->params.depth(cursor.par()->FirstPhysicalPar()->params.depth() + 1);
|
||||
#else
|
||||
cursor.par()->depth++;
|
||||
cursor.par()->params.depth(cursor.par()->params.depth() + 1);
|
||||
#endif
|
||||
anything_changed = true;
|
||||
}
|
||||
@ -752,17 +752,17 @@ void LyXText::IncDepth(BufferView * bview)
|
||||
cursor = sel_start_cursor;
|
||||
while (cursor.par() != sel_end_cursor.par()) {
|
||||
#ifndef NEW_INSETS
|
||||
cursor.par()->FirstPhysicalPar()->depth = 0;
|
||||
cursor.par()->FirstPhysicalPar()->params.depth(0);
|
||||
#else
|
||||
cursor.par()->depth = 0;
|
||||
cursor.par()->params.depth(0);
|
||||
#endif
|
||||
cursor.par(cursor.par()->Next());
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
if (cursor.par()->footnoteflag == sel_start_cursor.par()->footnoteflag)
|
||||
cursor.par()->FirstPhysicalPar()->depth = 0;
|
||||
cursor.par()->FirstPhysicalPar()->params.depth(0);
|
||||
#else
|
||||
cursor.par()->depth = 0;
|
||||
cursor.par()->params.depth(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -831,12 +831,12 @@ void LyXText::DecDepth(BufferView * bview)
|
||||
#ifndef NEW_INSETS
|
||||
if (cursor.par()->footnoteflag ==
|
||||
sel_start_cursor.par()->footnoteflag) {
|
||||
if (cursor.par()->FirstPhysicalPar()->depth)
|
||||
cursor.par()->FirstPhysicalPar()->depth--;
|
||||
if (cursor.par()->FirstPhysicalPar()->params.depth())
|
||||
cursor.par()->FirstPhysicalPar()->params.depth(cursor.par()->FirstPhysicalPar()->params.depth() - 1);
|
||||
}
|
||||
#else
|
||||
if (cursor.par()->depth)
|
||||
cursor.par()->depth--;
|
||||
if (cursor.par()->params.depth())
|
||||
cursor.par()->params.depth(cursor.par()->params.depth() - 1);
|
||||
#endif
|
||||
if (cursor.par() == sel_end_cursor.par())
|
||||
break;
|
||||
@ -1208,7 +1208,7 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
|
||||
}
|
||||
|
||||
|
||||
void LyXText::ClearSelection(BufferView * bview) const
|
||||
void LyXText::ClearSelection(BufferView * /*bview*/) const
|
||||
{
|
||||
selection = false;
|
||||
mark_set = false;
|
||||
@ -1484,12 +1484,12 @@ void LyXText::SetParagraph(BufferView * bview,
|
||||
if (cursor.par()->footnoteflag ==
|
||||
sel_start_cursor.par()->footnoteflag) {
|
||||
#endif
|
||||
cursor.par()->line_top = line_top;
|
||||
cursor.par()->line_bottom = line_bottom;
|
||||
cursor.par()->pagebreak_top = pagebreak_top;
|
||||
cursor.par()->pagebreak_bottom = pagebreak_bottom;
|
||||
cursor.par()->added_space_top = space_top;
|
||||
cursor.par()->added_space_bottom = space_bottom;
|
||||
cursor.par()->params.lineTop(line_top);
|
||||
cursor.par()->params.lineBottom(line_bottom);
|
||||
cursor.par()->params.pagebreakTop(pagebreak_top);
|
||||
cursor.par()->params.pagebreakBottom(pagebreak_bottom);
|
||||
cursor.par()->params.spaceTop(space_top);
|
||||
cursor.par()->params.spaceBottom(space_bottom);
|
||||
// does the layout allow the new alignment?
|
||||
if (align == LYX_ALIGN_LAYOUT)
|
||||
align = textclasslist
|
||||
@ -1501,12 +1501,12 @@ void LyXText::SetParagraph(BufferView * bview,
|
||||
if (align == textclasslist
|
||||
.Style(bview->buffer()->params.textclass,
|
||||
cursor.par()->GetLayout()).align)
|
||||
cursor.par()->align = LYX_ALIGN_LAYOUT;
|
||||
cursor.par()->params.align(LYX_ALIGN_LAYOUT);
|
||||
else
|
||||
cursor.par()->align = align;
|
||||
cursor.par()->params.align(align);
|
||||
}
|
||||
cursor.par()->SetLabelWidthString(labelwidthstring);
|
||||
cursor.par()->noindent = noindent;
|
||||
cursor.par()->params.noindent(noindent);
|
||||
#ifndef NEW_INSETS
|
||||
}
|
||||
|
||||
@ -1589,16 +1589,16 @@ void LyXText::SetParagraphExtraOpt(BufferView * bview, int type,
|
||||
sel_start_cursor.par()->footnoteflag) {
|
||||
#endif
|
||||
if (type == LyXParagraph::PEXTRA_NONE) {
|
||||
if (cursor.par()->pextra_type != LyXParagraph::PEXTRA_NONE) {
|
||||
if (cursor.par()->params.pextraType() != LyXParagraph::PEXTRA_NONE) {
|
||||
cursor.par()->UnsetPExtraType(bview->buffer()->params);
|
||||
cursor.par()->pextra_type = LyXParagraph::PEXTRA_NONE;
|
||||
cursor.par()->params.pextraType(LyXParagraph::PEXTRA_NONE);
|
||||
}
|
||||
} else {
|
||||
cursor.par()->SetPExtraType(bview->buffer()->params,
|
||||
type, width, widthp);
|
||||
cursor.par()->pextra_hfill = hfill;
|
||||
cursor.par()->pextra_start_minipage = start_minipage;
|
||||
cursor.par()->pextra_alignment = alignment;
|
||||
cursor.par()->params.pextraHfill(hfill);
|
||||
cursor.par()->params.pextraStartMinipage(start_minipage);
|
||||
cursor.par()->params.pextraAlignment(alignment);
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
}
|
||||
@ -1697,12 +1697,12 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
par->setCounter(i, par->Previous()->GetFirstCounter(i));
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
par->appendix = par->Previous()->FirstPhysicalPar()->appendix;
|
||||
par->params.appendix(par->Previous()->FirstPhysicalPar()->params.appendix());
|
||||
#else
|
||||
par->appendix = par->Previous()->appendix;
|
||||
par->params.appendix(par->Previous()->params.appendix());
|
||||
#endif
|
||||
if (!par->appendix && par->start_of_appendix){
|
||||
par->appendix = true;
|
||||
if (!par->params.appendix() && par->params.startOfAppendix()) {
|
||||
par->params.appendix(true);
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
par->setCounter(i, 0);
|
||||
}
|
||||
@ -1718,7 +1718,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
par->setCounter(i, 0);
|
||||
}
|
||||
par->appendix = par->start_of_appendix;
|
||||
par->params.appendix(par->params.startOfAppendix());
|
||||
par->enumdepth = 0;
|
||||
par->itemdepth = 0;
|
||||
}
|
||||
@ -1787,12 +1787,12 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
par->setCounter(i, 0);
|
||||
}
|
||||
|
||||
if (!par->labelstring.empty()) {
|
||||
par->labelstring.erase();
|
||||
if (!par->params.labelString().empty()) {
|
||||
par->params.labelString(string());
|
||||
}
|
||||
|
||||
if (layout.margintype == MARGIN_MANUAL) {
|
||||
if (par->labelwidthstring.empty()) {
|
||||
if (par->params.labelWidthString().empty()) {
|
||||
par->SetLabelWidthString(layout.labelstring());
|
||||
}
|
||||
} else {
|
||||
@ -1807,21 +1807,21 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
par->incCounter(i); // increment the counter
|
||||
|
||||
// Is there a label? Useful for Chapter layout
|
||||
if (!par->appendix){
|
||||
if (!par->params.appendix()) {
|
||||
if (!layout.labelstring().empty())
|
||||
par->labelstring = layout.labelstring();
|
||||
par->params.labelString(layout.labelstring());
|
||||
else
|
||||
par->labelstring.erase();
|
||||
par->params.labelString(string());
|
||||
} else {
|
||||
if (!layout.labelstring_appendix().empty())
|
||||
par->labelstring = layout.labelstring_appendix();
|
||||
par->params.labelString(layout.labelstring_appendix());
|
||||
else
|
||||
par->labelstring.erase();
|
||||
par->params.labelString(string());
|
||||
}
|
||||
|
||||
std::ostringstream s;
|
||||
|
||||
if (!par->appendix) {
|
||||
if (!par->params.appendix()) {
|
||||
switch (2 * LABEL_COUNTER_CHAPTER -
|
||||
textclass.maxcounter() + i) {
|
||||
case LABEL_COUNTER_CHAPTER:
|
||||
@ -1944,7 +1944,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
}
|
||||
}
|
||||
|
||||
par->labelstring += s.str().c_str();
|
||||
par->params.labelString(par->params.labelString() +s.str().c_str());
|
||||
// We really want to remove the c_str as soon as
|
||||
// possible...
|
||||
|
||||
@ -1996,7 +1996,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
break;
|
||||
}
|
||||
|
||||
par->labelstring = s.str().c_str();
|
||||
par->params.labelString(s.str().c_str());
|
||||
// we really want to get rid of that c_str()
|
||||
|
||||
for (i += par->enumdepth + 1; i < 10; ++i)
|
||||
@ -2012,7 +2012,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
par->bibkey = new InsetBibKey(p);
|
||||
}
|
||||
par->bibkey->setCounter(number);
|
||||
par->labelstring = layout.labelstring();
|
||||
par->params.labelString(layout.labelstring());
|
||||
|
||||
// In biblio should't be following counters but...
|
||||
} else {
|
||||
@ -2052,7 +2052,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
? " :úåòîùî øñç" : "Senseless: ";
|
||||
}
|
||||
}
|
||||
par->labelstring = s;
|
||||
par->params.labelString(s);
|
||||
|
||||
/* reset the enumeration counter. They are always resetted
|
||||
* when there is any other layout between */
|
||||
@ -3503,13 +3503,13 @@ void LyXText::toggleAppendix(BufferView * bview)
|
||||
#else
|
||||
LyXParagraph * par = cursor.par();
|
||||
#endif
|
||||
bool start = !par->start_of_appendix;
|
||||
bool start = !par->params.startOfAppendix();
|
||||
|
||||
// ensure that we have only one start_of_appendix in this document
|
||||
LyXParagraph * tmp = FirstParagraph();
|
||||
for (; tmp; tmp = tmp->next)
|
||||
tmp->start_of_appendix = 0;
|
||||
par->start_of_appendix = start;
|
||||
tmp->params.startOfAppendix(false);
|
||||
par->params.startOfAppendix(start);
|
||||
|
||||
// we can set the refreshing parameters now
|
||||
status = LyXText::NEED_MORE_REFRESH;
|
||||
|
Loading…
Reference in New Issue
Block a user