mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-05 17:09:56 +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_);
|
TEXT(bv_)->CursorRight(bv_);
|
||||||
cursor = TEXT(bv_)->cursor;
|
cursor = TEXT(bv_)->cursor;
|
||||||
if (cursor.pos() == 0
|
if (cursor.pos() == 0
|
||||||
&& !(cursor.par()->added_space_top
|
&& !(cursor.par()->params.spaceTop()
|
||||||
== VSpace (VSpace::NONE))) {
|
== VSpace (VSpace::NONE))) {
|
||||||
TEXT(bv_)->SetParagraph
|
TEXT(bv_)->SetParagraph
|
||||||
(bv_,
|
(bv_,
|
||||||
cursor.par()->line_top,
|
cursor.par()->params.lineTop(),
|
||||||
cursor.par()->line_bottom,
|
cursor.par()->params.lineBottom(),
|
||||||
cursor.par()->pagebreak_top,
|
cursor.par()->params.pagebreakTop(),
|
||||||
cursor.par()->pagebreak_bottom,
|
cursor.par()->params.pagebreakBottom(),
|
||||||
VSpace(VSpace::NONE),
|
VSpace(VSpace::NONE),
|
||||||
cursor.par()->added_space_bottom,
|
cursor.par()->params.spaceBottom(),
|
||||||
cursor.par()->align,
|
cursor.par()->params.align(),
|
||||||
cursor.par()->labelwidthstring, 0);
|
cursor.par()->params.labelWidthString(), 0);
|
||||||
TEXT(bv_)->CursorLeft(bv_);
|
TEXT(bv_)->CursorLeft(bv_);
|
||||||
update(TEXT(bv_),
|
update(TEXT(bv_),
|
||||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
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 (!TEXT(bv_)->selection) {
|
||||||
if (cursor.pos() == 0
|
if (cursor.pos() == 0
|
||||||
&& !(cursor.par()->added_space_top
|
&& !(cursor.par()->params.spaceTop()
|
||||||
== VSpace (VSpace::NONE))) {
|
== VSpace (VSpace::NONE))) {
|
||||||
TEXT(bv_)->SetParagraph
|
TEXT(bv_)->SetParagraph
|
||||||
(bv_,
|
(bv_,
|
||||||
cursor.par()->line_top,
|
cursor.par()->params.lineTop(),
|
||||||
cursor.par()->line_bottom,
|
cursor.par()->params.lineBottom(),
|
||||||
cursor.par()->pagebreak_top,
|
cursor.par()->params.pagebreakTop(),
|
||||||
cursor.par()->pagebreak_bottom,
|
cursor.par()->params.pagebreakBottom(),
|
||||||
VSpace(VSpace::NONE), cursor.par()->added_space_bottom,
|
VSpace(VSpace::NONE), cursor.par()->params.spaceBottom(),
|
||||||
cursor.par()->align,
|
cursor.par()->params.align(),
|
||||||
cursor.par()->labelwidthstring, 0);
|
cursor.par()->params.labelWidthString(), 0);
|
||||||
update(TEXT(bv_),
|
update(TEXT(bv_),
|
||||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
} else {
|
} else {
|
||||||
@ -2382,16 +2382,16 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
|||||||
|
|
||||||
beforeChange(TEXT(bv_));
|
beforeChange(TEXT(bv_));
|
||||||
if (cursor.pos() == 0) {
|
if (cursor.pos() == 0) {
|
||||||
if (cursor.par()->added_space_top == VSpace(VSpace::NONE)) {
|
if (cursor.par()->params.spaceTop() == VSpace(VSpace::NONE)) {
|
||||||
TEXT(bv_)->SetParagraph
|
TEXT(bv_)->SetParagraph
|
||||||
(bv_,
|
(bv_,
|
||||||
cursor.par()->line_top,
|
cursor.par()->params.lineTop(),
|
||||||
cursor.par()->line_bottom,
|
cursor.par()->params.lineBottom(),
|
||||||
cursor.par()->pagebreak_top,
|
cursor.par()->params.pagebreakTop(),
|
||||||
cursor.par()->pagebreak_bottom,
|
cursor.par()->params.pagebreakBottom(),
|
||||||
VSpace(VSpace::DEFSKIP), cursor.par()->added_space_bottom,
|
VSpace(VSpace::DEFSKIP), cursor.par()->params.spaceBottom(),
|
||||||
cursor.par()->align,
|
cursor.par()->params.align(),
|
||||||
cursor.par()->labelwidthstring, 1);
|
cursor.par()->params.labelWidthString(), 1);
|
||||||
//update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
//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:
|
case LFUN_PARAGRAPH_SPACING:
|
||||||
{
|
{
|
||||||
LyXParagraph * par = TEXT(bv_)->cursor.par();
|
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;
|
float cur_value = 1.0;
|
||||||
if (cur_spacing == Spacing::Other) {
|
if (cur_spacing == Spacing::Other) {
|
||||||
cur_value = par->spacing.getValue();
|
cur_value = par->params.spacing().getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
istringstream istr(argument.c_str());
|
istringstream istr(argument.c_str());
|
||||||
@ -2446,7 +2446,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
|||||||
<< argument << endl;
|
<< argument << endl;
|
||||||
}
|
}
|
||||||
if (cur_spacing != new_spacing || cur_value != new_value) {
|
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_);
|
TEXT(bv_)->RedoParagraph(bv_);
|
||||||
update(TEXT(bv_),
|
update(TEXT(bv_),
|
||||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
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>
|
2001-03-06 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* lyxfind.C (LyXReplace): do not redefine default argument in
|
* lyxfind.C (LyXReplace): do not redefine default argument in
|
||||||
|
@ -65,9 +65,13 @@ lyx_SOURCES = \
|
|||||||
Painter.h \
|
Painter.h \
|
||||||
PainterBase.C \
|
PainterBase.C \
|
||||||
PainterBase.h \
|
PainterBase.h \
|
||||||
|
ParagraphParameters.C \
|
||||||
|
ParagraphParameters.h \
|
||||||
|
ParameterStruct.h \
|
||||||
PrinterParams.h \
|
PrinterParams.h \
|
||||||
Sectioning.h \
|
Sectioning.h \
|
||||||
Sectioning.C \
|
Sectioning.C \
|
||||||
|
ShareContainer.h \
|
||||||
Spacing.C \
|
Spacing.C \
|
||||||
Spacing.h \
|
Spacing.h \
|
||||||
TextCache.C \
|
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() : 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 {
|
bool isDefault() const {
|
||||||
return space == Default;
|
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->footnoteflag = footnoteflag;
|
||||||
par->footnotekind = footnotekind;
|
par->footnotekind = footnotekind;
|
||||||
#endif
|
#endif
|
||||||
par->depth = depth;
|
par->params.depth(depth);
|
||||||
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
||||||
if (file_format < 216 && params.language->lang() == "hebrew")
|
if (file_format < 216 && params.language->lang() == "hebrew")
|
||||||
font.setLanguage(default_language);
|
font.setLanguage(default_language);
|
||||||
@ -550,21 +550,21 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
lex.EatLine();
|
lex.EatLine();
|
||||||
params.fonts = lex.GetString();
|
params.fonts = lex.GetString();
|
||||||
} else if (token == "\\noindent") {
|
} else if (token == "\\noindent") {
|
||||||
par->noindent = true;
|
par->params.noindent(true);
|
||||||
} else if (token == "\\fill_top") {
|
} else if (token == "\\fill_top") {
|
||||||
par->added_space_top = VSpace(VSpace::VFILL);
|
par->params.spaceTop(VSpace(VSpace::VFILL));
|
||||||
} else if (token == "\\fill_bottom") {
|
} else if (token == "\\fill_bottom") {
|
||||||
par->added_space_bottom = VSpace(VSpace::VFILL);
|
par->params.spaceBottom(VSpace(VSpace::VFILL));
|
||||||
} else if (token == "\\line_top") {
|
} else if (token == "\\line_top") {
|
||||||
par->line_top = true;
|
par->params.lineTop(true);
|
||||||
} else if (token == "\\line_bottom") {
|
} else if (token == "\\line_bottom") {
|
||||||
par->line_bottom = true;
|
par->params.lineBottom(true);
|
||||||
} else if (token == "\\pagebreak_top") {
|
} else if (token == "\\pagebreak_top") {
|
||||||
par->pagebreak_top = true;
|
par->params.pagebreakTop(true);
|
||||||
} else if (token == "\\pagebreak_bottom") {
|
} else if (token == "\\pagebreak_bottom") {
|
||||||
par->pagebreak_bottom = true;
|
par->params.pagebreakBottom(true);
|
||||||
} else if (token == "\\start_of_appendix") {
|
} else if (token == "\\start_of_appendix") {
|
||||||
par->start_of_appendix = true;
|
par->params.startOfAppendix(true);
|
||||||
} else if (token == "\\paragraph_separation") {
|
} else if (token == "\\paragraph_separation") {
|
||||||
int tmpret = lex.FindToken(string_paragraph_separation);
|
int tmpret = lex.FindToken(string_paragraph_separation);
|
||||||
if (tmpret == -1) ++tmpret;
|
if (tmpret == -1) ++tmpret;
|
||||||
@ -755,7 +755,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
// Small hack so that files written with klyx will be
|
// Small hack so that files written with klyx will be
|
||||||
// parsed correctly.
|
// parsed correctly.
|
||||||
if (return_par) {
|
if (return_par) {
|
||||||
par->spacing.set(tmp_space, tmp_val);
|
par->params.spacing(Spacing(tmp_space, tmp_val));
|
||||||
} else {
|
} else {
|
||||||
params.spacing.set(tmp_space, tmp_val);
|
params.spacing.set(tmp_space, tmp_val);
|
||||||
}
|
}
|
||||||
@ -763,15 +763,15 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
lex.next();
|
lex.next();
|
||||||
string const tmp = strip(lex.GetString());
|
string const tmp = strip(lex.GetString());
|
||||||
if (tmp == "single") {
|
if (tmp == "single") {
|
||||||
par->spacing.set(Spacing::Single);
|
par->params.spacing(Spacing(Spacing::Single));
|
||||||
} else if (tmp == "onehalf") {
|
} else if (tmp == "onehalf") {
|
||||||
par->spacing.set(Spacing::Onehalf);
|
par->params.spacing(Spacing(Spacing::Onehalf));
|
||||||
} else if (tmp == "double") {
|
} else if (tmp == "double") {
|
||||||
par->spacing.set(Spacing::Double);
|
par->params.spacing(Spacing(Spacing::Double));
|
||||||
} else if (tmp == "other") {
|
} else if (tmp == "other") {
|
||||||
lex.next();
|
lex.next();
|
||||||
par->spacing.set(Spacing::Other,
|
par->params.spacing(Spacing(Spacing::Other,
|
||||||
lex.GetFloat());
|
lex.GetFloat()));
|
||||||
} else {
|
} else {
|
||||||
lex.printError("Unknown spacing token: '$$Token'");
|
lex.printError("Unknown spacing token: '$$Token'");
|
||||||
}
|
}
|
||||||
@ -844,35 +844,35 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
|||||||
if (tmpret != LYX_LAYOUT_DEFAULT) { // tmpret != 99 ???
|
if (tmpret != LYX_LAYOUT_DEFAULT) { // tmpret != 99 ???
|
||||||
int const tmpret2 = int(pow(2.0, tmpret));
|
int const tmpret2 = int(pow(2.0, tmpret));
|
||||||
//lyxerr << "Tmpret2 = " << tmpret2 << endl;
|
//lyxerr << "Tmpret2 = " << tmpret2 << endl;
|
||||||
par->align = LyXAlignment(tmpret2);
|
par->params.align(LyXAlignment(tmpret2));
|
||||||
}
|
}
|
||||||
} else if (token == "\\added_space_top") {
|
} else if (token == "\\added_space_top") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->added_space_top = VSpace(lex.GetString());
|
par->params.spaceTop(VSpace(lex.GetString()));
|
||||||
} else if (token == "\\added_space_bottom") {
|
} else if (token == "\\added_space_bottom") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->added_space_bottom = VSpace(lex.GetString());
|
par->params.spaceBottom(VSpace(lex.GetString()));
|
||||||
} else if (token == "\\pextra_type") {
|
} else if (token == "\\pextra_type") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->pextra_type = lex.GetInteger();
|
par->params.pextraType(lex.GetInteger());
|
||||||
} else if (token == "\\pextra_width") {
|
} else if (token == "\\pextra_width") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->pextra_width = lex.GetString();
|
par->params.pextraWidth(lex.GetString());
|
||||||
} else if (token == "\\pextra_widthp") {
|
} else if (token == "\\pextra_widthp") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->pextra_widthp = lex.GetString();
|
par->params.pextraWidthp(lex.GetString());
|
||||||
} else if (token == "\\pextra_alignment") {
|
} else if (token == "\\pextra_alignment") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->pextra_alignment = lex.GetInteger();
|
par->params.pextraAlignment(lex.GetInteger());
|
||||||
} else if (token == "\\pextra_hfill") {
|
} else if (token == "\\pextra_hfill") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->pextra_hfill = lex.GetInteger();
|
par->params.pextraHfill(lex.GetInteger());
|
||||||
} else if (token == "\\pextra_start_minipage") {
|
} else if (token == "\\pextra_start_minipage") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->pextra_start_minipage = lex.GetInteger();
|
par->params.pextraStartMinipage(lex.GetInteger());
|
||||||
} else if (token == "\\labelwidthstring") {
|
} else if (token == "\\labelwidthstring") {
|
||||||
lex.EatLine();
|
lex.EatLine();
|
||||||
par->labelwidthstring = lex.GetString();
|
par->params.labelWidthString(lex.GetString());
|
||||||
// do not delete this token, it is still needed!
|
// do not delete this token, it is still needed!
|
||||||
} else if (token == "\\end_inset") {
|
} else if (token == "\\end_inset") {
|
||||||
lyxerr << "Solitary \\end_inset. Missing \\begin_inset?.\n"
|
lyxerr << "Solitary \\end_inset. Missing \\begin_inset?.\n"
|
||||||
@ -1343,14 +1343,13 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* begins or ends a deeper area ?*/
|
/* begins or ends a deeper area ?*/
|
||||||
if (depth != par->depth) {
|
if (depth != par->params.depth()) {
|
||||||
if (par->depth > depth) {
|
if (par->params.depth() > depth) {
|
||||||
while (par->depth > depth) {
|
while (par->params.depth() > depth) {
|
||||||
++depth;
|
++depth;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
while (par->params.depth() < depth) {
|
||||||
while (par->depth < depth) {
|
|
||||||
--depth;
|
--depth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1439,7 +1438,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
buffer << par->labelstring << " ";
|
buffer << par->params.labelString() << " ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ltype_depth > depth) {
|
if (ltype_depth > depth) {
|
||||||
@ -2088,7 +2087,7 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
|
|||||||
// flag this with ftcount
|
// flag this with ftcount
|
||||||
ftcount = -1;
|
ftcount = -1;
|
||||||
if (layout.isEnvironment()
|
if (layout.isEnvironment()
|
||||||
|| par->pextra_type != LyXParagraph::PEXTRA_NONE) {
|
|| par->params.pextraType() != LyXParagraph::PEXTRA_NONE) {
|
||||||
par = par->TeXEnvironment(this, params, ofs, texrow
|
par = par->TeXEnvironment(this, params, ofs, texrow
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
,ftnote, ft_texrow, ftcount
|
,ftnote, ft_texrow, ftcount
|
||||||
@ -2254,7 +2253,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// environment tag closing
|
// environment tag closing
|
||||||
for (; depth > par->depth; --depth) {
|
for (; depth > par->params.depth(); --depth) {
|
||||||
sgmlCloseTag(ofs, depth, environment_stack[depth]);
|
sgmlCloseTag(ofs, depth, environment_stack[depth]);
|
||||||
environment_stack[depth].erase();
|
environment_stack[depth].erase();
|
||||||
}
|
}
|
||||||
@ -2262,7 +2261,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
|||||||
// write opening SGML tags
|
// write opening SGML tags
|
||||||
switch (style.latextype) {
|
switch (style.latextype) {
|
||||||
case LATEX_PARAGRAPH:
|
case LATEX_PARAGRAPH:
|
||||||
if (depth == par->depth
|
if (depth == par->params.depth()
|
||||||
&& !environment_stack[depth].empty()) {
|
&& !environment_stack[depth].empty()) {
|
||||||
sgmlCloseTag(ofs, depth, environment_stack[depth]);
|
sgmlCloseTag(ofs, depth, environment_stack[depth]);
|
||||||
environment_stack[depth].erase();
|
environment_stack[depth].erase();
|
||||||
@ -2292,7 +2291,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
|||||||
|
|
||||||
case LATEX_ENVIRONMENT:
|
case LATEX_ENVIRONMENT:
|
||||||
case LATEX_ITEM_ENVIRONMENT:
|
case LATEX_ITEM_ENVIRONMENT:
|
||||||
if (depth == par->depth
|
if (depth == par->params.depth()
|
||||||
&& environment_stack[depth] != style.latexname()
|
&& environment_stack[depth] != style.latexname()
|
||||||
&& !environment_stack[depth].empty()) {
|
&& !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]);
|
||||||
environment_stack[depth].erase();
|
environment_stack[depth].erase();
|
||||||
}
|
}
|
||||||
if (depth < par->depth) {
|
if (depth < par->params.depth()) {
|
||||||
depth = par->depth;
|
depth = par->params.depth();
|
||||||
environment_stack[depth].erase();
|
environment_stack[depth].erase();
|
||||||
}
|
}
|
||||||
if (environment_stack[depth] != style.latexname()) {
|
if (environment_stack[depth] != style.latexname()) {
|
||||||
@ -2879,7 +2878,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
|||||||
par->layout);
|
par->layout);
|
||||||
|
|
||||||
// environment tag closing
|
// environment tag closing
|
||||||
for (; depth > par->depth; --depth) {
|
for (; depth > par->params.depth(); --depth) {
|
||||||
if (environment_inner[depth] != "!-- --") {
|
if (environment_inner[depth] != "!-- --") {
|
||||||
item_name= "listitem";
|
item_name= "listitem";
|
||||||
sgmlCloseTag(ofs, command_depth + depth,
|
sgmlCloseTag(ofs, command_depth + depth,
|
||||||
@ -2894,7 +2893,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
|||||||
environment_inner[depth].erase();
|
environment_inner[depth].erase();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth == par->depth
|
if (depth == par->params.depth()
|
||||||
&& environment_stack[depth] != style.latexname()
|
&& environment_stack[depth] != style.latexname()
|
||||||
&& !environment_stack[depth].empty()) {
|
&& !environment_stack[depth].empty()) {
|
||||||
if (environment_inner[depth] != "!-- --") {
|
if (environment_inner[depth] != "!-- --") {
|
||||||
@ -2978,8 +2977,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
|||||||
|
|
||||||
case LATEX_ENVIRONMENT:
|
case LATEX_ENVIRONMENT:
|
||||||
case LATEX_ITEM_ENVIRONMENT:
|
case LATEX_ITEM_ENVIRONMENT:
|
||||||
if (depth < par->depth) {
|
if (depth < par->params.depth()) {
|
||||||
depth = par->depth;
|
depth = par->params.depth();
|
||||||
environment_stack[depth].erase();
|
environment_stack[depth].erase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,9 +254,9 @@ string const CurrentState(BufferView * bv)
|
|||||||
state += string(_(", Depth: ")) + tostr(depth);
|
state += string(_(", Depth: ")) + tostr(depth);
|
||||||
// The paragraph spacing, but only if different from
|
// The paragraph spacing, but only if different from
|
||||||
// buffer spacing.
|
// buffer spacing.
|
||||||
if (!text->cursor.par()->spacing.isDefault()) {
|
if (!text->cursor.par()->params.spacing().isDefault()) {
|
||||||
Spacing::Space cur_space =
|
Spacing::Space cur_space =
|
||||||
text->cursor.par()->spacing.getSpace();
|
text->cursor.par()->params.spacing().getSpace();
|
||||||
state += _(", Spacing: ");
|
state += _(", Spacing: ");
|
||||||
switch (cur_space) {
|
switch (cur_space) {
|
||||||
case Spacing::Single:
|
case Spacing::Single:
|
||||||
@ -270,7 +270,7 @@ string const CurrentState(BufferView * bv)
|
|||||||
break;
|
break;
|
||||||
case Spacing::Other:
|
case Spacing::Other:
|
||||||
state += _("Other (");
|
state += _("Other (");
|
||||||
state += tostr(text->cursor.par()->spacing.getValue());
|
state += tostr(text->cursor.par()->params.spacing().getValue());
|
||||||
state += ")";
|
state += ")";
|
||||||
break;
|
break;
|
||||||
case Spacing::Default:
|
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>
|
2001-03-06 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* FormSearch.C (Replace): remove default argument
|
* FormSearch.C (Replace): remove default argument
|
||||||
|
@ -336,36 +336,36 @@ void FormParagraph::general_update()
|
|||||||
|
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
fl_set_button(general_->check_lines_top,
|
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,
|
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,
|
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,
|
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,
|
fl_set_button(general_->check_noindent,
|
||||||
text->cursor.par()->FirstPhysicalPar()->noindent);
|
text->cursor.par()->FirstPhysicalPar()->params.noindent());
|
||||||
#else
|
#else
|
||||||
fl_set_button(general_->check_lines_top,
|
fl_set_button(general_->check_lines_top,
|
||||||
text->cursor.par()->line_top);
|
text->cursor.par()->params.lineTop());
|
||||||
fl_set_button(general_->check_lines_bottom,
|
fl_set_button(general_->check_lines_bottom,
|
||||||
text->cursor.par()->line_bottom);
|
text->cursor.par()->params.lineBottom());
|
||||||
fl_set_button(general_->check_pagebreaks_top,
|
fl_set_button(general_->check_pagebreaks_top,
|
||||||
text->cursor.par()->pagebreak_top);
|
text->cursor.par()->params.pagebreakTop());
|
||||||
fl_set_button(general_->check_pagebreaks_bottom,
|
fl_set_button(general_->check_pagebreaks_bottom,
|
||||||
text->cursor.par()->pagebreak_bottom);
|
text->cursor.par()->params.pagebreakBottom());
|
||||||
fl_set_button(general_->check_noindent,
|
fl_set_button(general_->check_noindent,
|
||||||
text->cursor.par()->noindent);
|
text->cursor.par()->params.noindent());
|
||||||
#endif
|
#endif
|
||||||
fl_set_input (general_->input_space_above, "");
|
fl_set_input (general_->input_space_above, "");
|
||||||
|
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
switch (text->cursor.par()->FirstPhysicalPar()->added_space_top.kind()) {
|
switch (text->cursor.par()->FirstPhysicalPar()->params.spaceTop().kind()) {
|
||||||
#else
|
#else
|
||||||
switch (text->cursor.par()->added_space_top.kind()) {
|
switch (text->cursor.par()->params.spaceTop().kind()) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case VSpace::NONE:
|
case VSpace::NONE:
|
||||||
@ -391,25 +391,25 @@ void FormParagraph::general_update()
|
|||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
fl_set_input(general_->input_space_above,
|
fl_set_input(general_->input_space_above,
|
||||||
text->cursor.par()->FirstPhysicalPar()->
|
text->cursor.par()->FirstPhysicalPar()->
|
||||||
added_space_top.length().asString().c_str());
|
params.spaceTop().length().asString().c_str());
|
||||||
#else
|
#else
|
||||||
fl_set_input(general_->input_space_above, text->cursor.par()->
|
fl_set_input(general_->input_space_above, text->cursor.par()->
|
||||||
added_space_top.length().asString().c_str());
|
params.spaceTop().length().asString().c_str());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
fl_set_button(general_->check_space_above,
|
fl_set_button(general_->check_space_above,
|
||||||
text->cursor.par()->FirstPhysicalPar()->
|
text->cursor.par()->FirstPhysicalPar()->
|
||||||
added_space_top.keep());
|
params.spaceTop().keep());
|
||||||
fl_set_input(general_->input_space_below, "");
|
fl_set_input(general_->input_space_below, "");
|
||||||
switch (text->cursor.par()->FirstPhysicalPar()->
|
switch (text->cursor.par()->FirstPhysicalPar()->
|
||||||
added_space_bottom.kind()) {
|
params.spaceBottom().kind()) {
|
||||||
#else
|
#else
|
||||||
fl_set_button (general_->check_space_above,
|
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, "");
|
fl_set_input (general_->input_space_below, "");
|
||||||
switch (text->cursor.par()->added_space_bottom.kind()) {
|
switch (text->cursor.par()->params.spaceBottom().kind()) {
|
||||||
#endif
|
#endif
|
||||||
case VSpace::NONE:
|
case VSpace::NONE:
|
||||||
fl_set_choice (general_->choice_space_below, 1);
|
fl_set_choice (general_->choice_space_below, 1);
|
||||||
@ -434,14 +434,14 @@ void FormParagraph::general_update()
|
|||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
fl_set_input(general_->input_space_below,
|
fl_set_input(general_->input_space_below,
|
||||||
text->cursor.par()->FirstPhysicalPar()->
|
text->cursor.par()->FirstPhysicalPar()->
|
||||||
added_space_bottom.length().asString().c_str());
|
params.spaceBottom().length().asString().c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fl_set_button(general_->check_space_below,
|
fl_set_button(general_->check_space_below,
|
||||||
text->cursor.par()->FirstPhysicalPar()->
|
text->cursor.par()->FirstPhysicalPar()->
|
||||||
added_space_bottom.keep());
|
params.spaceBottom().keep());
|
||||||
fl_set_button(general_->check_noindent,
|
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());
|
bool const enable = (!text->cursor.par()->FirstPhysicalPar()->InInset());
|
||||||
|
|
||||||
@ -455,13 +455,13 @@ void FormParagraph::general_update()
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
fl_set_input(general_->input_space_below, text->cursor.par()->
|
fl_set_input(general_->input_space_below, text->cursor.par()->
|
||||||
added_space_bottom.length().asString().c_str());
|
params.spaceBottom().length().asString().c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fl_set_button(general_->check_space_below,
|
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,
|
fl_set_button(general_->check_noindent,
|
||||||
text->cursor.par()->noindent);
|
text->cursor.par()->params.noindent());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,10 +477,10 @@ void FormParagraph::extra_update()
|
|||||||
setEnabled(extra_->input_pextra_widthp, true);
|
setEnabled(extra_->input_pextra_widthp, true);
|
||||||
|
|
||||||
fl_set_input(extra_->input_pextra_width,
|
fl_set_input(extra_->input_pextra_width,
|
||||||
par->pextra_width.c_str());
|
par->params.pextraWidth().c_str());
|
||||||
fl_set_input(extra_->input_pextra_widthp,
|
fl_set_input(extra_->input_pextra_widthp,
|
||||||
par->pextra_widthp.c_str());
|
par->params.pextraWidthp().c_str());
|
||||||
switch (par->pextra_alignment) {
|
switch (par->params.pextraAlignment()) {
|
||||||
case LyXParagraph::MINIPAGE_ALIGN_TOP:
|
case LyXParagraph::MINIPAGE_ALIGN_TOP:
|
||||||
fl_set_button(extra_->radio_pextra_top, 1);
|
fl_set_button(extra_->radio_pextra_top, 1);
|
||||||
break;
|
break;
|
||||||
@ -492,10 +492,10 @@ void FormParagraph::extra_update()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fl_set_button(extra_->radio_pextra_hfill,
|
fl_set_button(extra_->radio_pextra_hfill,
|
||||||
par->pextra_hfill);
|
par->params.pextraHfill());
|
||||||
fl_set_button(extra_->radio_pextra_startmp,
|
fl_set_button(extra_->radio_pextra_startmp,
|
||||||
par->pextra_start_minipage);
|
par->params.pextraStartMinipage());
|
||||||
if (par->pextra_type == LyXParagraph::PEXTRA_INDENT) {
|
if (par->params.pextraType() == LyXParagraph::PEXTRA_INDENT) {
|
||||||
fl_set_button(extra_->radio_pextra_indent, 1);
|
fl_set_button(extra_->radio_pextra_indent, 1);
|
||||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||||
fl_set_button(extra_->radio_pextra_floatflt, 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_middle, false);
|
||||||
setEnabled(extra_->radio_pextra_bottom, false);
|
setEnabled(extra_->radio_pextra_bottom, false);
|
||||||
input(extra_->radio_pextra_indent, 0);
|
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_indent, 0);
|
||||||
fl_set_button(extra_->radio_pextra_minipage, 1);
|
fl_set_button(extra_->radio_pextra_minipage, 1);
|
||||||
fl_set_button(extra_->radio_pextra_floatflt, 0);
|
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_middle, true);
|
||||||
setEnabled(extra_->radio_pextra_bottom, true);
|
setEnabled(extra_->radio_pextra_bottom, true);
|
||||||
input(extra_->radio_pextra_minipage, 0);
|
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_indent, 0);
|
||||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||||
fl_set_button(extra_->radio_pextra_floatflt, 1);
|
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>
|
2001-02-28 Baruch Even <baruch@ev-en.org>
|
||||||
|
|
||||||
* insetgraphics.C (updateInset): Changed due to the change in
|
* 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)
|
// inherit bufferparams/paragraphparams in a strange way. (Lgb)
|
||||||
{
|
{
|
||||||
LyXParagraph * par = TEXT(bv)->cursor.par();
|
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;
|
float cur_value = 1.0;
|
||||||
if (cur_spacing == Spacing::Other) {
|
if (cur_spacing == Spacing::Other) {
|
||||||
cur_value = par->spacing.getValue();
|
cur_value = par->params.spacing().getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::istringstream istr(arg.c_str());
|
std::istringstream istr(arg.c_str());
|
||||||
@ -1087,7 +1087,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
|||||||
<< arg << endl;
|
<< arg << endl;
|
||||||
}
|
}
|
||||||
if (cur_spacing != new_spacing || cur_value != new_value) {
|
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());
|
//TEXT(bv)->RedoParagraph(owner->view());
|
||||||
UpdateLocal(bv, CURSOR_PAR, true);
|
UpdateLocal(bv, CURSOR_PAR, true);
|
||||||
//bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
//bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
|
275
src/lyxfont.C
275
src/lyxfont.C
@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "lyxfont.h"
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cctype>
|
|
||||||
|
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
@ -104,6 +104,8 @@ char const * LaTeXSizeNames[14] =
|
|||||||
"Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
|
"Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize static member
|
||||||
LyXFont::FontBits LyXFont::sane = {
|
LyXFont::FontBits LyXFont::sane = {
|
||||||
ROMAN_FAMILY,
|
ROMAN_FAMILY,
|
||||||
MEDIUM_SERIES,
|
MEDIUM_SERIES,
|
||||||
@ -113,8 +115,10 @@ LyXFont::FontBits LyXFont::sane = {
|
|||||||
OFF,
|
OFF,
|
||||||
OFF,
|
OFF,
|
||||||
OFF,
|
OFF,
|
||||||
|
OFF,
|
||||||
OFF };
|
OFF };
|
||||||
|
|
||||||
|
// Initialize static member
|
||||||
LyXFont::FontBits LyXFont::inherit = {
|
LyXFont::FontBits LyXFont::inherit = {
|
||||||
INHERIT_FAMILY,
|
INHERIT_FAMILY,
|
||||||
INHERIT_SERIES,
|
INHERIT_SERIES,
|
||||||
@ -124,8 +128,10 @@ LyXFont::FontBits LyXFont::inherit = {
|
|||||||
INHERIT,
|
INHERIT,
|
||||||
INHERIT,
|
INHERIT,
|
||||||
INHERIT,
|
INHERIT,
|
||||||
INHERIT };
|
INHERIT,
|
||||||
|
OFF };
|
||||||
|
|
||||||
|
// Initialize static member
|
||||||
LyXFont::FontBits LyXFont::ignore = {
|
LyXFont::FontBits LyXFont::ignore = {
|
||||||
IGNORE_FAMILY,
|
IGNORE_FAMILY,
|
||||||
IGNORE_SERIES,
|
IGNORE_SERIES,
|
||||||
@ -135,6 +141,7 @@ LyXFont::FontBits LyXFont::ignore = {
|
|||||||
IGNORE,
|
IGNORE,
|
||||||
IGNORE,
|
IGNORE,
|
||||||
IGNORE,
|
IGNORE,
|
||||||
|
IGNORE,
|
||||||
IGNORE };
|
IGNORE };
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +155,8 @@ bool LyXFont::FontBits::operator==(LyXFont::FontBits const & fb1) const
|
|||||||
fb1.emph == emph &&
|
fb1.emph == emph &&
|
||||||
fb1.underbar == underbar &&
|
fb1.underbar == underbar &&
|
||||||
fb1.noun == noun &&
|
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
|
/// Decreases font size by one
|
||||||
LyXFont & LyXFont::decSize()
|
LyXFont & LyXFont::decSize()
|
||||||
{
|
{
|
||||||
@ -365,7 +577,6 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
|
|||||||
if (bits.color == LColor::inherit) {
|
if (bits.color == LColor::inherit) {
|
||||||
bits.color = tmplt.bits.color;
|
bits.color = tmplt.bits.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +633,7 @@ string const LyXFont::stateText(BufferParams * params) const
|
|||||||
// Set family according to lyx format string
|
// Set family according to lyx format string
|
||||||
LyXFont & LyXFont::setLyXFamily(string const & fam)
|
LyXFont & LyXFont::setLyXFamily(string const & fam)
|
||||||
{
|
{
|
||||||
string s = lowercase(fam);
|
string const s = lowercase(fam);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") ++i;
|
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
|
// Set series according to lyx format string
|
||||||
LyXFont & LyXFont::setLyXSeries(string const & ser)
|
LyXFont & LyXFont::setLyXSeries(string const & ser)
|
||||||
{
|
{
|
||||||
string s = lowercase(ser);
|
string const s = lowercase(ser);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") ++i;
|
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
|
// Set shape according to lyx format string
|
||||||
LyXFont & LyXFont::setLyXShape(string const & sha)
|
LyXFont & LyXFont::setLyXShape(string const & sha)
|
||||||
{
|
{
|
||||||
string s = lowercase(sha);
|
string const s = lowercase(sha);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") ++i;
|
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
|
// Set size according to lyx format string
|
||||||
LyXFont & LyXFont::setLyXSize(string const & siz)
|
LyXFont & LyXFont::setLyXSize(string const & siz)
|
||||||
{
|
{
|
||||||
string s = lowercase(siz);
|
string const s = lowercase(siz);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i;
|
while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i;
|
||||||
if (s == LyXSizeNames[i]) {
|
if (s == LyXSizeNames[i]) {
|
||||||
@ -485,7 +696,7 @@ LyXFont & LyXFont::setLyXSize(string const & siz)
|
|||||||
// Set size according to lyx format string
|
// Set size according to lyx format string
|
||||||
LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
|
LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
|
||||||
{
|
{
|
||||||
string s = lowercase(siz);
|
string const s = lowercase(siz);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i;
|
while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i;
|
||||||
if (s == LyXMiscNames[i])
|
if (s == LyXMiscNames[i])
|
||||||
@ -519,7 +730,7 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex)
|
|||||||
bool finished = false;
|
bool finished = false;
|
||||||
while (!finished && lex.IsOK() && !error) {
|
while (!finished && lex.IsOK() && !error) {
|
||||||
lex.next();
|
lex.next();
|
||||||
string tok = lowercase(lex.GetString());
|
string const tok = lowercase(lex.GetString());
|
||||||
|
|
||||||
if (tok.empty()) {
|
if (tok.empty()) {
|
||||||
continue;
|
continue;
|
||||||
@ -527,54 +738,54 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex)
|
|||||||
finished = true;
|
finished = true;
|
||||||
} else if (tok == "family") {
|
} else if (tok == "family") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string tok = lex.GetString();
|
string const ttok = lex.GetString();
|
||||||
setLyXFamily(tok);
|
setLyXFamily(ttok);
|
||||||
} else if (tok == "series") {
|
} else if (tok == "series") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string tok = lex.GetString();
|
string const ttok = lex.GetString();
|
||||||
setLyXSeries(tok);
|
setLyXSeries(ttok);
|
||||||
} else if (tok == "shape") {
|
} else if (tok == "shape") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string tok = lex.GetString();
|
string const ttok = lex.GetString();
|
||||||
setLyXShape(tok);
|
setLyXShape(ttok);
|
||||||
} else if (tok == "size") {
|
} else if (tok == "size") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string tok = lex.GetString();
|
string const ttok = lex.GetString();
|
||||||
setLyXSize(tok);
|
setLyXSize(ttok);
|
||||||
} else if (tok == "latex") {
|
} else if (tok == "latex") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string tok = lowercase(lex.GetString());
|
string const ttok = lowercase(lex.GetString());
|
||||||
|
|
||||||
if (tok == "no_latex") {
|
if (ttok == "no_latex") {
|
||||||
setLatex(OFF);
|
setLatex(OFF);
|
||||||
} else if (tok == "latex") {
|
} else if (ttok == "latex") {
|
||||||
setLatex(ON);
|
setLatex(ON);
|
||||||
} else {
|
} else {
|
||||||
lex.printError("Illegal LaTeX type`$$Token'");
|
lex.printError("Illegal LaTeX type`$$Token'");
|
||||||
}
|
}
|
||||||
} else if (tok == "misc") {
|
} else if (tok == "misc") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string tok = lowercase(lex.GetString());
|
string const ttok = lowercase(lex.GetString());
|
||||||
|
|
||||||
if (tok == "no_bar") {
|
if (ttok == "no_bar") {
|
||||||
setUnderbar(OFF);
|
setUnderbar(OFF);
|
||||||
} else if (tok == "no_emph") {
|
} else if (ttok == "no_emph") {
|
||||||
setEmph(OFF);
|
setEmph(OFF);
|
||||||
} else if (tok == "no_noun") {
|
} else if (ttok == "no_noun") {
|
||||||
setNoun(OFF);
|
setNoun(OFF);
|
||||||
} else if (tok == "emph") {
|
} else if (ttok == "emph") {
|
||||||
setEmph(ON);
|
setEmph(ON);
|
||||||
} else if (tok == "underbar") {
|
} else if (ttok == "underbar") {
|
||||||
setUnderbar(ON);
|
setUnderbar(ON);
|
||||||
} else if (tok == "noun") {
|
} else if (ttok == "noun") {
|
||||||
setNoun(ON);
|
setNoun(ON);
|
||||||
} else {
|
} else {
|
||||||
lex.printError("Illegal misc type `$$Token´");
|
lex.printError("Illegal misc type `$$Token´");
|
||||||
}
|
}
|
||||||
} else if (tok == "color") {
|
} else if (tok == "color") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string tok = lex.GetString();
|
string const ttok = lex.GetString();
|
||||||
setLyXColor(tok);
|
setLyXColor(ttok);
|
||||||
} else {
|
} else {
|
||||||
lex.printError("Unknown tag `$$Token'");
|
lex.printError("Unknown tag `$$Token'");
|
||||||
error = true;
|
error = true;
|
||||||
@ -677,7 +888,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
|
|||||||
count += 3;
|
count += 3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
string tmp =
|
string const tmp =
|
||||||
subst(lyxrc.language_command_local,
|
subst(lyxrc.language_command_local,
|
||||||
"$$lang", language()->babel());
|
"$$lang", language()->babel());
|
||||||
os << tmp;
|
os << tmp;
|
||||||
|
282
src/lyxfont.h
282
src/lyxfont.h
@ -155,9 +155,6 @@ public:
|
|||||||
///
|
///
|
||||||
LyXFont();
|
LyXFont();
|
||||||
|
|
||||||
// LyXFont x(LyXFont ...) and LyXFont x = LyXFont ...
|
|
||||||
LyXFont(LyXFont const & x);
|
|
||||||
|
|
||||||
/// Shortcut initialization
|
/// Shortcut initialization
|
||||||
explicit
|
explicit
|
||||||
LyXFont(LyXFont::FONT_INIT1);
|
LyXFont(LyXFont::FONT_INIT1);
|
||||||
@ -174,9 +171,6 @@ public:
|
|||||||
/// Shortcut initialization
|
/// Shortcut initialization
|
||||||
LyXFont(LyXFont::FONT_INIT3, Language const * l);
|
LyXFont(LyXFont::FONT_INIT3, Language const * l);
|
||||||
|
|
||||||
/// LyXFont x, y; x = y;
|
|
||||||
LyXFont & operator=(LyXFont const & x);
|
|
||||||
|
|
||||||
/// Decreases font size by one
|
/// Decreases font size by one
|
||||||
LyXFont & decSize();
|
LyXFont & decSize();
|
||||||
|
|
||||||
@ -350,13 +344,15 @@ private:
|
|||||||
FONT_MISC_STATE noun;
|
FONT_MISC_STATE noun;
|
||||||
///
|
///
|
||||||
FONT_MISC_STATE latex;
|
FONT_MISC_STATE latex;
|
||||||
|
///
|
||||||
|
FONT_MISC_STATE number;
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
FontBits bits;
|
FontBits bits;
|
||||||
|
|
||||||
///
|
///
|
||||||
Language const * lang;
|
Language const * lang;
|
||||||
///
|
|
||||||
FONT_MISC_STATE number_;
|
|
||||||
|
|
||||||
/// Sane font
|
/// Sane font
|
||||||
static FontBits sane;
|
static FontBits sane;
|
||||||
@ -377,276 +373,16 @@ std::ostream & operator<<(std::ostream &, LyXFont::FONT_MISC_STATE);
|
|||||||
|
|
||||||
///
|
///
|
||||||
inline
|
inline
|
||||||
bool operator==(LyXFont const & font1, LyXFont const & font2) {
|
bool operator==(LyXFont const & font1, LyXFont const & font2)
|
||||||
|
{
|
||||||
return font1.bits == font2.bits &&
|
return font1.bits == font2.bits &&
|
||||||
font1.lang == font2.lang &&
|
font1.lang == font2.lang;
|
||||||
font1.number_ == font2.number_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
inline
|
inline
|
||||||
bool operator!=(LyXFont const & font1, LyXFont const & font2) {
|
bool operator!=(LyXFont const & font1, LyXFont const & font2)
|
||||||
|
{
|
||||||
return !(font1 == 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
|
#endif
|
||||||
|
@ -18,12 +18,11 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <boost/array.hpp>
|
||||||
|
|
||||||
#include "insets/lyxinset.h"
|
#include "insets/lyxinset.h"
|
||||||
#include "vspace.h"
|
|
||||||
#include "layout.h"
|
|
||||||
#include <boost/array.hpp>
|
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include "ParagraphParameters.h"
|
||||||
|
|
||||||
class BufferParams;
|
class BufferParams;
|
||||||
class LyXBuffer;
|
class LyXBuffer;
|
||||||
@ -225,14 +224,8 @@ public:
|
|||||||
void setContentsFromPar(LyXParagraph * par);
|
void setContentsFromPar(LyXParagraph * par);
|
||||||
///
|
///
|
||||||
void clearContents();
|
void clearContents();
|
||||||
///
|
|
||||||
VSpace added_space_top;
|
|
||||||
|
|
||||||
///
|
ParagraphParameters params;
|
||||||
VSpace added_space_bottom;
|
|
||||||
|
|
||||||
///
|
|
||||||
Spacing spacing;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
LyXTextClass::LayoutList::size_type layout;
|
LyXTextClass::LayoutList::size_type layout;
|
||||||
@ -249,26 +242,6 @@ public:
|
|||||||
/// footnote, margin, fig, tab
|
/// footnote, margin, fig, tab
|
||||||
footnote_kind footnotekind;
|
footnote_kind footnotekind;
|
||||||
#endif
|
#endif
|
||||||
///
|
|
||||||
bool line_top;
|
|
||||||
|
|
||||||
///
|
|
||||||
bool line_bottom;
|
|
||||||
|
|
||||||
///
|
|
||||||
bool pagebreak_top;
|
|
||||||
|
|
||||||
///
|
|
||||||
bool pagebreak_bottom;
|
|
||||||
|
|
||||||
///
|
|
||||||
LyXAlignment align;
|
|
||||||
|
|
||||||
///
|
|
||||||
char depth;
|
|
||||||
|
|
||||||
///
|
|
||||||
bool noindent;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
@ -280,11 +253,6 @@ public:
|
|||||||
int getCounter(int i) const;
|
int getCounter(int i) const;
|
||||||
///
|
///
|
||||||
void incCounter(int i);
|
void incCounter(int i);
|
||||||
///
|
|
||||||
bool start_of_appendix;
|
|
||||||
|
|
||||||
///
|
|
||||||
bool appendix;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
char enumdepth;
|
char enumdepth;
|
||||||
@ -292,26 +260,6 @@ public:
|
|||||||
///
|
///
|
||||||
char itemdepth;
|
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;
|
LyXParagraph * next;
|
||||||
///
|
///
|
||||||
@ -524,7 +472,7 @@ private:
|
|||||||
///
|
///
|
||||||
Inset * inset;
|
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;
|
friend struct matchIT;
|
||||||
@ -549,8 +497,23 @@ private:
|
|||||||
(font_1 covers the chars 0,...,pos_1) (Dekel)
|
(font_1 covers the chars 0,...,pos_1) (Dekel)
|
||||||
*/
|
*/
|
||||||
struct FontTable {
|
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
|
/// End position of paragraph this font attribute covers
|
||||||
size_type pos;
|
size_type pos_;
|
||||||
/** Font. Interpretation of the font values:
|
/** Font. Interpretation of the font values:
|
||||||
If a value is LyXFont::INHERIT_*, it means that the font
|
If a value is LyXFont::INHERIT_*, it means that the font
|
||||||
attribute is inherited from either the layout of this
|
attribute is inherited from either the layout of this
|
||||||
@ -560,9 +523,9 @@ private:
|
|||||||
The values LyXFont::IGNORE_* and LyXFont::TOGGLE are NOT
|
The values LyXFont::IGNORE_* and LyXFont::TOGGLE are NOT
|
||||||
allowed in these font tables.
|
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;
|
friend struct matchFT;
|
||||||
@ -572,7 +535,7 @@ private:
|
|||||||
inline
|
inline
|
||||||
int operator()(LyXParagraph::FontTable const & a,
|
int operator()(LyXParagraph::FontTable const & a,
|
||||||
LyXParagraph::FontTable const & b) const {
|
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,
|
// a layout. Since there is always a redo,
|
||||||
// LeftMargin() is always called
|
// LeftMargin() is always called
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
row->par()->FirstPhysicalPar()->depth = 0;
|
row->par()->FirstPhysicalPar()->params.depth(0);
|
||||||
#else
|
#else
|
||||||
row->par()->depth = 0;
|
row->par()->params.depth(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newpar && !row->par()->GetLayout()) {
|
if (newpar && !row->par()->GetLayout()) {
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
if (newpar->FirstPhysicalPar()->noindent)
|
if (newpar->FirstPhysicalPar()->params.noindent())
|
||||||
#else
|
#else
|
||||||
if (newpar->noindent)
|
if (newpar->params.noindent())
|
||||||
#endif
|
#endif
|
||||||
parindent.erase();
|
parindent.erase();
|
||||||
else
|
else
|
||||||
@ -837,12 +837,12 @@ int LyXText::LeftMargin(BufferView * bview, Row const * row) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((workWidth(bview) > 0) &&
|
if ((workWidth(bview) > 0) &&
|
||||||
(row->par()->pextra_type == LyXParagraph::PEXTRA_INDENT)) {
|
(row->par()->params.pextraType() == LyXParagraph::PEXTRA_INDENT)) {
|
||||||
if (!row->par()->pextra_widthp.empty()) {
|
if (!row->par()->params.pextraWidthp().empty()) {
|
||||||
x += workWidth(bview) *
|
x += workWidth(bview) *
|
||||||
lyx::atoi(row->par()->pextra_widthp) / 100;
|
lyx::atoi(row->par()->params.pextraWidthp()) / 100;
|
||||||
} else if (!row->par()->pextra_width.empty()) {
|
} else if (!row->par()->params.pextraWidth().empty()) {
|
||||||
int xx = VSpace(row->par()->pextra_width).inPixels(bview);
|
int xx = VSpace(row->par()->params.pextraWidth()).inPixels(bview);
|
||||||
if (xx > workWidth(bview))
|
if (xx > workWidth(bview))
|
||||||
xx = workWidth(bview) * 80 / 100;
|
xx = workWidth(bview) * 80 / 100;
|
||||||
x += xx;
|
x += xx;
|
||||||
@ -854,15 +854,15 @@ int LyXText::LeftMargin(BufferView * bview, Row const * row) const
|
|||||||
|
|
||||||
int align; // wrong type
|
int align; // wrong type
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
if (row->par()->FirstPhysicalPar()->align == LYX_ALIGN_LAYOUT)
|
if (row->par()->FirstPhysicalPar()->params.align() == LYX_ALIGN_LAYOUT)
|
||||||
align = layout.align;
|
align = layout.align;
|
||||||
else
|
else
|
||||||
align = row->par()->FirstPhysicalPar()->align;
|
align = row->par()->FirstPhysicalPar()->params.align();
|
||||||
#else
|
#else
|
||||||
if (row->par()->align == LYX_ALIGN_LAYOUT)
|
if (row->par()->params.align() == LYX_ALIGN_LAYOUT)
|
||||||
align = layout.align;
|
align = layout.align;
|
||||||
else
|
else
|
||||||
align = row->par()->align;
|
align = row->par()->params.align();
|
||||||
#endif
|
#endif
|
||||||
// set the correct parindent
|
// set the correct parindent
|
||||||
if (row->pos() == 0) {
|
if (row->pos() == 0) {
|
||||||
@ -876,7 +876,7 @@ int LyXText::LeftMargin(BufferView * bview, Row const * row) const
|
|||||||
&& row->par() == row->par()->FirstPhysicalPar()
|
&& row->par() == row->par()->FirstPhysicalPar()
|
||||||
#endif
|
#endif
|
||||||
&& align == LYX_ALIGN_BLOCK
|
&& align == LYX_ALIGN_BLOCK
|
||||||
&& !row->par()->noindent
|
&& !row->par()->params.noindent()
|
||||||
&& (row->par()->layout ||
|
&& (row->par()->layout ||
|
||||||
bview->buffer()->params.paragraph_separation ==
|
bview->buffer()->params.paragraph_separation ==
|
||||||
BufferParams::PARSEP_INDENT))
|
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,
|
// a layout. Since there is always a redo,
|
||||||
// LeftMargin() is always called
|
// LeftMargin() is always called
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
row->par()->FirstPhysicalPar()->depth = 0;
|
row->par()->FirstPhysicalPar()->params.depth(0);
|
||||||
#else
|
#else
|
||||||
row->par()->depth = 0;
|
row->par()->params.depth(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1188,8 +1188,8 @@ int LyXText::LabelFill(BufferView * bview, Row const * row) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
int fill = 0;
|
int fill = 0;
|
||||||
if (!row->par()->labelwidthstring.empty()) {
|
if (!row->par()->params.labelWidthString().empty()) {
|
||||||
fill = max(lyxfont::width(row->par()->labelwidthstring,
|
fill = max(lyxfont::width(row->par()->params.labelWidthString(),
|
||||||
GetFont(bview->buffer(), row->par(), -2)) - w,
|
GetFont(bview->buffer(), row->par(), -2)) - w,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
@ -1341,8 +1341,8 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
|||||||
LyXFont labelfont = GetFont(bview->buffer(), par, -2);
|
LyXFont labelfont = GetFont(bview->buffer(), par, -2);
|
||||||
|
|
||||||
float spacing_val = 1.0;
|
float spacing_val = 1.0;
|
||||||
if (!row_ptr->par()->spacing.isDefault()) {
|
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||||
spacing_val = row_ptr->par()->spacing.getValue();
|
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||||
} else {
|
} else {
|
||||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
spacing_val = bview->buffer()->params.spacing.getValue();
|
||||||
}
|
}
|
||||||
@ -1422,17 +1422,17 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
|||||||
maxasc += LYX_PAPER_MARGIN;
|
maxasc += LYX_PAPER_MARGIN;
|
||||||
|
|
||||||
/* add the vertical spaces, that the user added */
|
/* add the vertical spaces, that the user added */
|
||||||
if (firstpar->added_space_top.kind() != VSpace::NONE)
|
if (firstpar->params.spaceTop().kind() != VSpace::NONE)
|
||||||
maxasc += int(firstpar->added_space_top.inPixels(bview));
|
maxasc += int(firstpar->params.spaceTop().inPixels(bview));
|
||||||
|
|
||||||
/* do not forget the DTP-lines!
|
/* do not forget the DTP-lines!
|
||||||
* there height depends on the font of the nearest character */
|
* 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(),
|
maxasc += 2 * lyxfont::ascent('x', GetFont(bview->buffer(),
|
||||||
firstpar, 0));
|
firstpar, 0));
|
||||||
|
|
||||||
/* and now the pagebreaks */
|
/* and now the pagebreaks */
|
||||||
if (firstpar->pagebreak_top)
|
if (firstpar->params.pagebreakTop())
|
||||||
maxasc += 3 * DefaultHeight();
|
maxasc += 3 * DefaultHeight();
|
||||||
|
|
||||||
/* this is special code for the chapter, since the label of this
|
/* 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
|
if (layout.labeltype == LABEL_COUNTER_CHAPTER
|
||||||
&& bview->buffer()->params.secnumdepth >= 0) {
|
&& bview->buffer()->params.secnumdepth >= 0) {
|
||||||
float spacing_val = 1.0;
|
float spacing_val = 1.0;
|
||||||
if (!row_ptr->par()->spacing.isDefault()) {
|
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||||
spacing_val = row_ptr->par()->spacing.getValue();
|
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||||
} else {
|
} else {
|
||||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
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()->IsFirstInSequence()
|
||||||
&& !row_ptr->par()->GetLabelstring().empty()) {
|
&& !row_ptr->par()->GetLabelstring().empty()) {
|
||||||
float spacing_val = 1.0;
|
float spacing_val = 1.0;
|
||||||
if (!row_ptr->par()->spacing.isDefault()) {
|
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||||
spacing_val = row_ptr->par()->spacing.getValue();
|
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||||
} else {
|
} else {
|
||||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
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,
|
/* and now the layout spaces, for example before and after a section,
|
||||||
* or between the items of a itemize or enumerate environment */
|
* or between the items of a itemize or enumerate environment */
|
||||||
|
|
||||||
if (!firstpar->pagebreak_top) {
|
if (!firstpar->params.pagebreakTop()) {
|
||||||
LyXParagraph * prev = row_ptr->par()->Previous();
|
LyXParagraph * prev = row_ptr->par()->Previous();
|
||||||
if (prev)
|
if (prev)
|
||||||
prev = row_ptr->par()->DepthHook(row_ptr->par()->GetDepth());
|
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)
|
if (tmptop > 0)
|
||||||
layoutasc = (tmptop * DefaultHeight());
|
layoutasc = (tmptop * DefaultHeight());
|
||||||
}
|
}
|
||||||
else if (row_ptr->par()->line_top){
|
else if (row_ptr->par()->params.lineTop()) {
|
||||||
tmptop = layout.topsep;
|
tmptop = layout.topsep;
|
||||||
|
|
||||||
if (tmptop > 0)
|
if (tmptop > 0)
|
||||||
@ -1541,22 +1541,22 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
|||||||
maxdesc += LYX_PAPER_MARGIN;
|
maxdesc += LYX_PAPER_MARGIN;
|
||||||
|
|
||||||
/* add the vertical spaces, that the user added */
|
/* add the vertical spaces, that the user added */
|
||||||
if (firstpar->added_space_bottom.kind() != VSpace::NONE)
|
if (firstpar->params.spaceBottom().kind() != VSpace::NONE)
|
||||||
maxdesc += int(firstpar->added_space_bottom.inPixels(bview));
|
maxdesc += int(firstpar->params.spaceBottom().inPixels(bview));
|
||||||
|
|
||||||
/* do not forget the DTP-lines!
|
/* do not forget the DTP-lines!
|
||||||
* there height depends on the font of the nearest character */
|
* 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(),
|
maxdesc += 2 * lyxfont::ascent('x', GetFont(bview->buffer(),
|
||||||
par, par->Last() - 1));
|
par, par->Last() - 1));
|
||||||
|
|
||||||
/* and now the pagebreaks */
|
/* and now the pagebreaks */
|
||||||
if (firstpar->pagebreak_bottom)
|
if (firstpar->params.pagebreakBottom())
|
||||||
maxdesc += 3 * DefaultHeight();
|
maxdesc += 3 * DefaultHeight();
|
||||||
|
|
||||||
/* and now the layout spaces, for example before and after a section,
|
/* and now the layout spaces, for example before and after a section,
|
||||||
* or between the items of a itemize or enumerate environment */
|
* 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 * nextpar = row_ptr->par()->Next();
|
||||||
LyXParagraph * comparepar = row_ptr->par();
|
LyXParagraph * comparepar = row_ptr->par();
|
||||||
float usual = 0;
|
float usual = 0;
|
||||||
@ -2241,15 +2241,15 @@ void LyXText::PrepareToPrint(BufferView * bview,
|
|||||||
// set x how you need it
|
// set x how you need it
|
||||||
int align;
|
int align;
|
||||||
#ifndef NEW_INSETS
|
#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;
|
align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->GetLayout()).align;
|
||||||
else
|
else
|
||||||
align = row->par()->FirstPhysicalPar()->align;
|
align = row->par()->FirstPhysicalPar()->params.align();
|
||||||
#else
|
#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;
|
align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->GetLayout()).align;
|
||||||
else
|
else
|
||||||
align = row->par()->align;
|
align = row->par()->params.align();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// center displayed insets
|
// center displayed insets
|
||||||
@ -2734,11 +2734,11 @@ void LyXText::Backspace(BufferView * bview)
|
|||||||
&& cursor.par()->footnoteflag == tmppar->footnoteflag
|
&& cursor.par()->footnoteflag == tmppar->footnoteflag
|
||||||
#endif
|
#endif
|
||||||
&& cursor.par()->GetAlign() == tmppar->GetAlign()) {
|
&& cursor.par()->GetAlign() == tmppar->GetAlign()) {
|
||||||
// Inherit botom DTD from the paragraph below.
|
// Inherit bottom DTD from the paragraph below.
|
||||||
// (the one we are deleting)
|
// (the one we are deleting)
|
||||||
tmppar->line_bottom = cursor.par()->line_bottom;
|
tmppar->params.lineBottom(cursor.par()->params.lineBottom());
|
||||||
tmppar->added_space_bottom = cursor.par()->added_space_bottom;
|
tmppar->params.spaceBottom(cursor.par()->params.spaceBottom());
|
||||||
tmppar->pagebreak_bottom = cursor.par()->pagebreak_bottom;
|
tmppar->params.pagebreakBottom(cursor.par()->params.pagebreakBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorLeft(bview);
|
CursorLeft(bview);
|
||||||
@ -3322,7 +3322,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
|
|
||||||
// Draw appendix lines
|
// Draw appendix lines
|
||||||
LyXParagraph * p = row_ptr->par()->PreviousBeforeFootnote()->FirstPhysicalPar();
|
LyXParagraph * p = row_ptr->par()->PreviousBeforeFootnote()->FirstPhysicalPar();
|
||||||
if (p->appendix){
|
if (p->params.appendix()) {
|
||||||
pain.line(1, y_offset,
|
pain.line(1, y_offset,
|
||||||
1, y_offset + row_ptr->height(),
|
1, y_offset + row_ptr->height(),
|
||||||
LColor::appendixline);
|
LColor::appendixline);
|
||||||
@ -3334,7 +3334,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
|
|
||||||
// Draw minipage line
|
// Draw minipage line
|
||||||
bool const minipage =
|
bool const minipage =
|
||||||
(p->pextra_type == LyXParagraph::PEXTRA_MINIPAGE);
|
(p->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE);
|
||||||
if (minipage)
|
if (minipage)
|
||||||
pain.line(LYX_PAPER_MARGIN/5, y_offset,
|
pain.line(LYX_PAPER_MARGIN/5, y_offset,
|
||||||
LYX_PAPER_MARGIN/5,
|
LYX_PAPER_MARGIN/5,
|
||||||
@ -3370,7 +3370,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
#else
|
#else
|
||||||
LyXParagraph * firstpar = row_ptr->par();
|
LyXParagraph * firstpar = row_ptr->par();
|
||||||
#endif
|
#endif
|
||||||
if (firstpar->appendix){
|
if (firstpar->params.appendix()) {
|
||||||
pain.line(1, y_offset,
|
pain.line(1, y_offset,
|
||||||
1, y_offset + row_ptr->height(),
|
1, y_offset + row_ptr->height(),
|
||||||
LColor::appendixline);
|
LColor::appendixline);
|
||||||
@ -3381,7 +3381,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
|
|
||||||
// Draw minipage line
|
// Draw minipage line
|
||||||
bool const minipage =
|
bool const minipage =
|
||||||
(firstpar->pextra_type == LyXParagraph::PEXTRA_MINIPAGE);
|
(firstpar->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE);
|
||||||
if (minipage)
|
if (minipage)
|
||||||
pain.line(LYX_PAPER_MARGIN/5 + box_x, y_offset,
|
pain.line(LYX_PAPER_MARGIN/5 + box_x, y_offset,
|
||||||
LYX_PAPER_MARGIN/5 + box_x,
|
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)) {
|
if (!row_ptr->pos() && (row_ptr->par() == firstpar)) {
|
||||||
|
|
||||||
/* start of appendix? */
|
/* start of appendix? */
|
||||||
if (row_ptr->par()->start_of_appendix){
|
if (row_ptr->par()->params.startOfAppendix()) {
|
||||||
pain.line(1, y_offset,
|
pain.line(1, y_offset,
|
||||||
ww - 2, y_offset,
|
ww - 2, y_offset,
|
||||||
LColor::appendixline);
|
LColor::appendixline);
|
||||||
@ -3454,7 +3454,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
if (!row_ptr->previous() && bv_owner)
|
if (!row_ptr->previous() && bv_owner)
|
||||||
y_top += LYX_PAPER_MARGIN;
|
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;
|
LyXFont pb_font;
|
||||||
pb_font.setColor(LColor::pagebreak).decSize();
|
pb_font.setColor(LColor::pagebreak).decSize();
|
||||||
int w = 0, a = 0, d = 0;
|
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();
|
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 */
|
/* draw a vfill top */
|
||||||
pain.line(0, y_offset + 2 + y_top,
|
pain.line(0, y_offset + 2 + y_top,
|
||||||
LYX_PAPER_MARGIN, 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 */
|
/* 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 */
|
/* think about the parskip */
|
||||||
/* some parskips VERY EASY IMPLEMENTATION */
|
/* 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);
|
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',
|
y_top += lyxfont::ascent('x',
|
||||||
GetFont(bview->buffer(),
|
GetFont(bview->buffer(),
|
||||||
row_ptr->par(), 0));
|
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
|
/* this is special code for the chapter layout. This is printed in
|
||||||
* an extra row and has a pagebreak at the top. */
|
* an extra row and has a pagebreak at the top. */
|
||||||
float spacing_val = 1.0;
|
float spacing_val = 1.0;
|
||||||
if (!row_ptr->par()->spacing.isDefault()) {
|
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||||
spacing_val = row_ptr->par()->spacing.getValue();
|
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||||
} else {
|
} else {
|
||||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
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 =
|
string const tmpstring =
|
||||||
row_ptr->par()->GetLabelstring();
|
row_ptr->par()->GetLabelstring();
|
||||||
float spacing_val = 1.0;
|
float spacing_val = 1.0;
|
||||||
if (!row_ptr->par()->spacing.isDefault()) {
|
if (!row_ptr->par()->params.spacing().isDefault()) {
|
||||||
spacing_val = row_ptr->par()->spacing.getValue();
|
spacing_val = row_ptr->par()->params.spacing().getValue();
|
||||||
} else {
|
} else {
|
||||||
spacing_val = bview->buffer()->params.spacing.getValue();
|
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;
|
y_bottom -= LYX_PAPER_MARGIN;
|
||||||
|
|
||||||
/* draw a bottom pagebreak */
|
/* draw a bottom pagebreak */
|
||||||
if (firstpar->pagebreak_bottom) {
|
if (firstpar->params.pagebreakBottom()) {
|
||||||
LyXFont pb_font;
|
LyXFont pb_font;
|
||||||
pb_font.setColor(LColor::pagebreak).decSize();
|
pb_font.setColor(LColor::pagebreak).decSize();
|
||||||
int w = 0, a = 0, d = 0;
|
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();
|
y_bottom -= 3 * DefaultHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstpar->added_space_bottom.kind() == VSpace::VFILL) {
|
if (firstpar->params.spaceBottom().kind() == VSpace::VFILL) {
|
||||||
/* draw a vfill bottom */
|
/* draw a vfill bottom */
|
||||||
pain.line(0, y_offset + y_bottom - 3 * DefaultHeight(),
|
pain.line(0, y_offset + y_bottom - 3 * DefaultHeight(),
|
||||||
LYX_PAPER_MARGIN,
|
LYX_PAPER_MARGIN,
|
||||||
@ -3697,9 +3698,9 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* think about user added space */
|
/* 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 */
|
/* draw a bottom line */
|
||||||
y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(),
|
y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(),
|
||||||
par, par->Last() - 1));
|
par, par->Last() - 1));
|
||||||
@ -3971,7 +3972,7 @@ void LyXText::InsertFootnoteEnvironment(BufferView * bview,
|
|||||||
}
|
}
|
||||||
/* no marginpars in minipages */
|
/* no marginpars in minipages */
|
||||||
if (kind == LyXParagraph::MARGIN
|
if (kind == LyXParagraph::MARGIN
|
||||||
&& cursor.par()->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
|
&& cursor.par()->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE) {
|
||||||
WriteAlert(_("Impossible operation"),
|
WriteAlert(_("Impossible operation"),
|
||||||
_("You can't insert a marginpar in a minipage!"),
|
_("You can't insert a marginpar in a minipage!"),
|
||||||
_("Sorry."));
|
_("Sorry."));
|
||||||
|
108
src/text2.C
108
src/text2.C
@ -590,10 +590,10 @@ LyXParagraph * LyXText::SetLayout(BufferView * bview,
|
|||||||
#else
|
#else
|
||||||
LyXParagraph * fppar = cur.par();
|
LyXParagraph * fppar = cur.par();
|
||||||
#endif
|
#endif
|
||||||
fppar->added_space_top = lyxlayout.fill_top ?
|
fppar->params.spaceTop(lyxlayout.fill_top ?
|
||||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
|
||||||
fppar->added_space_bottom = lyxlayout.fill_bottom ?
|
fppar->params.spaceBottom(lyxlayout.fill_bottom ?
|
||||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
|
||||||
if (lyxlayout.margintype == MARGIN_MANUAL)
|
if (lyxlayout.margintype == MARGIN_MANUAL)
|
||||||
cur.par()->SetLabelWidthString(lyxlayout.labelstring());
|
cur.par()->SetLabelWidthString(lyxlayout.labelstring());
|
||||||
if (lyxlayout.labeltype != LABEL_BIBLIO
|
if (lyxlayout.labeltype != LABEL_BIBLIO
|
||||||
@ -616,10 +616,10 @@ LyXParagraph * LyXText::SetLayout(BufferView * bview,
|
|||||||
#else
|
#else
|
||||||
LyXParagraph * fppar = cur.par();
|
LyXParagraph * fppar = cur.par();
|
||||||
#endif
|
#endif
|
||||||
fppar->added_space_top = lyxlayout.fill_top ?
|
fppar->params.spaceTop(lyxlayout.fill_top ?
|
||||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
|
||||||
fppar->added_space_bottom = lyxlayout.fill_bottom ?
|
fppar->params.spaceBottom(lyxlayout.fill_bottom ?
|
||||||
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
|
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE));
|
||||||
if (lyxlayout.margintype == MARGIN_MANUAL)
|
if (lyxlayout.margintype == MARGIN_MANUAL)
|
||||||
cur.par()->SetLabelWidthString(lyxlayout.labelstring());
|
cur.par()->SetLabelWidthString(lyxlayout.labelstring());
|
||||||
if (lyxlayout.labeltype != LABEL_BIBLIO
|
if (lyxlayout.labeltype != LABEL_BIBLIO
|
||||||
@ -735,9 +735,9 @@ void LyXText::IncDepth(BufferView * bview)
|
|||||||
&& textclasslist.Style(bview->buffer()->params.textclass,
|
&& textclasslist.Style(bview->buffer()->params.textclass,
|
||||||
prev->GetLayout()).isEnvironment()))) {
|
prev->GetLayout()).isEnvironment()))) {
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
cursor.par()->FirstPhysicalPar()->depth++;
|
cursor.par()->FirstPhysicalPar()->params.depth(cursor.par()->FirstPhysicalPar()->params.depth() + 1);
|
||||||
#else
|
#else
|
||||||
cursor.par()->depth++;
|
cursor.par()->params.depth(cursor.par()->params.depth() + 1);
|
||||||
#endif
|
#endif
|
||||||
anything_changed = true;
|
anything_changed = true;
|
||||||
}
|
}
|
||||||
@ -752,17 +752,17 @@ void LyXText::IncDepth(BufferView * bview)
|
|||||||
cursor = sel_start_cursor;
|
cursor = sel_start_cursor;
|
||||||
while (cursor.par() != sel_end_cursor.par()) {
|
while (cursor.par() != sel_end_cursor.par()) {
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
cursor.par()->FirstPhysicalPar()->depth = 0;
|
cursor.par()->FirstPhysicalPar()->params.depth(0);
|
||||||
#else
|
#else
|
||||||
cursor.par()->depth = 0;
|
cursor.par()->params.depth(0);
|
||||||
#endif
|
#endif
|
||||||
cursor.par(cursor.par()->Next());
|
cursor.par(cursor.par()->Next());
|
||||||
}
|
}
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
if (cursor.par()->footnoteflag == sel_start_cursor.par()->footnoteflag)
|
if (cursor.par()->footnoteflag == sel_start_cursor.par()->footnoteflag)
|
||||||
cursor.par()->FirstPhysicalPar()->depth = 0;
|
cursor.par()->FirstPhysicalPar()->params.depth(0);
|
||||||
#else
|
#else
|
||||||
cursor.par()->depth = 0;
|
cursor.par()->params.depth(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,12 +831,12 @@ void LyXText::DecDepth(BufferView * bview)
|
|||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
if (cursor.par()->footnoteflag ==
|
if (cursor.par()->footnoteflag ==
|
||||||
sel_start_cursor.par()->footnoteflag) {
|
sel_start_cursor.par()->footnoteflag) {
|
||||||
if (cursor.par()->FirstPhysicalPar()->depth)
|
if (cursor.par()->FirstPhysicalPar()->params.depth())
|
||||||
cursor.par()->FirstPhysicalPar()->depth--;
|
cursor.par()->FirstPhysicalPar()->params.depth(cursor.par()->FirstPhysicalPar()->params.depth() - 1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (cursor.par()->depth)
|
if (cursor.par()->params.depth())
|
||||||
cursor.par()->depth--;
|
cursor.par()->params.depth(cursor.par()->params.depth() - 1);
|
||||||
#endif
|
#endif
|
||||||
if (cursor.par() == sel_end_cursor.par())
|
if (cursor.par() == sel_end_cursor.par())
|
||||||
break;
|
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;
|
selection = false;
|
||||||
mark_set = false;
|
mark_set = false;
|
||||||
@ -1484,12 +1484,12 @@ void LyXText::SetParagraph(BufferView * bview,
|
|||||||
if (cursor.par()->footnoteflag ==
|
if (cursor.par()->footnoteflag ==
|
||||||
sel_start_cursor.par()->footnoteflag) {
|
sel_start_cursor.par()->footnoteflag) {
|
||||||
#endif
|
#endif
|
||||||
cursor.par()->line_top = line_top;
|
cursor.par()->params.lineTop(line_top);
|
||||||
cursor.par()->line_bottom = line_bottom;
|
cursor.par()->params.lineBottom(line_bottom);
|
||||||
cursor.par()->pagebreak_top = pagebreak_top;
|
cursor.par()->params.pagebreakTop(pagebreak_top);
|
||||||
cursor.par()->pagebreak_bottom = pagebreak_bottom;
|
cursor.par()->params.pagebreakBottom(pagebreak_bottom);
|
||||||
cursor.par()->added_space_top = space_top;
|
cursor.par()->params.spaceTop(space_top);
|
||||||
cursor.par()->added_space_bottom = space_bottom;
|
cursor.par()->params.spaceBottom(space_bottom);
|
||||||
// does the layout allow the new alignment?
|
// does the layout allow the new alignment?
|
||||||
if (align == LYX_ALIGN_LAYOUT)
|
if (align == LYX_ALIGN_LAYOUT)
|
||||||
align = textclasslist
|
align = textclasslist
|
||||||
@ -1501,12 +1501,12 @@ void LyXText::SetParagraph(BufferView * bview,
|
|||||||
if (align == textclasslist
|
if (align == textclasslist
|
||||||
.Style(bview->buffer()->params.textclass,
|
.Style(bview->buffer()->params.textclass,
|
||||||
cursor.par()->GetLayout()).align)
|
cursor.par()->GetLayout()).align)
|
||||||
cursor.par()->align = LYX_ALIGN_LAYOUT;
|
cursor.par()->params.align(LYX_ALIGN_LAYOUT);
|
||||||
else
|
else
|
||||||
cursor.par()->align = align;
|
cursor.par()->params.align(align);
|
||||||
}
|
}
|
||||||
cursor.par()->SetLabelWidthString(labelwidthstring);
|
cursor.par()->SetLabelWidthString(labelwidthstring);
|
||||||
cursor.par()->noindent = noindent;
|
cursor.par()->params.noindent(noindent);
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1589,16 +1589,16 @@ void LyXText::SetParagraphExtraOpt(BufferView * bview, int type,
|
|||||||
sel_start_cursor.par()->footnoteflag) {
|
sel_start_cursor.par()->footnoteflag) {
|
||||||
#endif
|
#endif
|
||||||
if (type == LyXParagraph::PEXTRA_NONE) {
|
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()->UnsetPExtraType(bview->buffer()->params);
|
||||||
cursor.par()->pextra_type = LyXParagraph::PEXTRA_NONE;
|
cursor.par()->params.pextraType(LyXParagraph::PEXTRA_NONE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cursor.par()->SetPExtraType(bview->buffer()->params,
|
cursor.par()->SetPExtraType(bview->buffer()->params,
|
||||||
type, width, widthp);
|
type, width, widthp);
|
||||||
cursor.par()->pextra_hfill = hfill;
|
cursor.par()->params.pextraHfill(hfill);
|
||||||
cursor.par()->pextra_start_minipage = start_minipage;
|
cursor.par()->params.pextraStartMinipage(start_minipage);
|
||||||
cursor.par()->pextra_alignment = alignment;
|
cursor.par()->params.pextraAlignment(alignment);
|
||||||
}
|
}
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
}
|
}
|
||||||
@ -1697,12 +1697,12 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
|||||||
par->setCounter(i, par->Previous()->GetFirstCounter(i));
|
par->setCounter(i, par->Previous()->GetFirstCounter(i));
|
||||||
}
|
}
|
||||||
#ifndef NEW_INSETS
|
#ifndef NEW_INSETS
|
||||||
par->appendix = par->Previous()->FirstPhysicalPar()->appendix;
|
par->params.appendix(par->Previous()->FirstPhysicalPar()->params.appendix());
|
||||||
#else
|
#else
|
||||||
par->appendix = par->Previous()->appendix;
|
par->params.appendix(par->Previous()->params.appendix());
|
||||||
#endif
|
#endif
|
||||||
if (!par->appendix && par->start_of_appendix){
|
if (!par->params.appendix() && par->params.startOfAppendix()) {
|
||||||
par->appendix = true;
|
par->params.appendix(true);
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
par->setCounter(i, 0);
|
par->setCounter(i, 0);
|
||||||
}
|
}
|
||||||
@ -1718,7 +1718,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
|||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
par->setCounter(i, 0);
|
par->setCounter(i, 0);
|
||||||
}
|
}
|
||||||
par->appendix = par->start_of_appendix;
|
par->params.appendix(par->params.startOfAppendix());
|
||||||
par->enumdepth = 0;
|
par->enumdepth = 0;
|
||||||
par->itemdepth = 0;
|
par->itemdepth = 0;
|
||||||
}
|
}
|
||||||
@ -1787,12 +1787,12 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
|||||||
par->setCounter(i, 0);
|
par->setCounter(i, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!par->labelstring.empty()) {
|
if (!par->params.labelString().empty()) {
|
||||||
par->labelstring.erase();
|
par->params.labelString(string());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layout.margintype == MARGIN_MANUAL) {
|
if (layout.margintype == MARGIN_MANUAL) {
|
||||||
if (par->labelwidthstring.empty()) {
|
if (par->params.labelWidthString().empty()) {
|
||||||
par->SetLabelWidthString(layout.labelstring());
|
par->SetLabelWidthString(layout.labelstring());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1807,21 +1807,21 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
|||||||
par->incCounter(i); // increment the counter
|
par->incCounter(i); // increment the counter
|
||||||
|
|
||||||
// Is there a label? Useful for Chapter layout
|
// Is there a label? Useful for Chapter layout
|
||||||
if (!par->appendix){
|
if (!par->params.appendix()) {
|
||||||
if (!layout.labelstring().empty())
|
if (!layout.labelstring().empty())
|
||||||
par->labelstring = layout.labelstring();
|
par->params.labelString(layout.labelstring());
|
||||||
else
|
else
|
||||||
par->labelstring.erase();
|
par->params.labelString(string());
|
||||||
} else {
|
} else {
|
||||||
if (!layout.labelstring_appendix().empty())
|
if (!layout.labelstring_appendix().empty())
|
||||||
par->labelstring = layout.labelstring_appendix();
|
par->params.labelString(layout.labelstring_appendix());
|
||||||
else
|
else
|
||||||
par->labelstring.erase();
|
par->params.labelString(string());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
|
|
||||||
if (!par->appendix) {
|
if (!par->params.appendix()) {
|
||||||
switch (2 * LABEL_COUNTER_CHAPTER -
|
switch (2 * LABEL_COUNTER_CHAPTER -
|
||||||
textclass.maxcounter() + i) {
|
textclass.maxcounter() + i) {
|
||||||
case LABEL_COUNTER_CHAPTER:
|
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
|
// We really want to remove the c_str as soon as
|
||||||
// possible...
|
// possible...
|
||||||
|
|
||||||
@ -1996,7 +1996,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
par->labelstring = s.str().c_str();
|
par->params.labelString(s.str().c_str());
|
||||||
// we really want to get rid of that c_str()
|
// we really want to get rid of that c_str()
|
||||||
|
|
||||||
for (i += par->enumdepth + 1; i < 10; ++i)
|
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 = new InsetBibKey(p);
|
||||||
}
|
}
|
||||||
par->bibkey->setCounter(number);
|
par->bibkey->setCounter(number);
|
||||||
par->labelstring = layout.labelstring();
|
par->params.labelString(layout.labelstring());
|
||||||
|
|
||||||
// In biblio should't be following counters but...
|
// In biblio should't be following counters but...
|
||||||
} else {
|
} else {
|
||||||
@ -2052,7 +2052,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
|||||||
? " :úåòîùî øñç" : "Senseless: ";
|
? " :úåòîùî øñç" : "Senseless: ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
par->labelstring = s;
|
par->params.labelString(s);
|
||||||
|
|
||||||
/* reset the enumeration counter. They are always resetted
|
/* reset the enumeration counter. They are always resetted
|
||||||
* when there is any other layout between */
|
* when there is any other layout between */
|
||||||
@ -3503,13 +3503,13 @@ void LyXText::toggleAppendix(BufferView * bview)
|
|||||||
#else
|
#else
|
||||||
LyXParagraph * par = cursor.par();
|
LyXParagraph * par = cursor.par();
|
||||||
#endif
|
#endif
|
||||||
bool start = !par->start_of_appendix;
|
bool start = !par->params.startOfAppendix();
|
||||||
|
|
||||||
// ensure that we have only one start_of_appendix in this document
|
// ensure that we have only one start_of_appendix in this document
|
||||||
LyXParagraph * tmp = FirstParagraph();
|
LyXParagraph * tmp = FirstParagraph();
|
||||||
for (; tmp; tmp = tmp->next)
|
for (; tmp; tmp = tmp->next)
|
||||||
tmp->start_of_appendix = 0;
|
tmp->params.startOfAppendix(false);
|
||||||
par->start_of_appendix = start;
|
par->params.startOfAppendix(start);
|
||||||
|
|
||||||
// we can set the refreshing parameters now
|
// we can set the refreshing parameters now
|
||||||
status = LyXText::NEED_MORE_REFRESH;
|
status = LyXText::NEED_MORE_REFRESH;
|
||||||
|
Loading…
Reference in New Issue
Block a user