mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
minipage placement testing
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1807 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
28da50b522
commit
93dda00aac
40
src/buffer.C
40
src/buffer.C
@ -2809,7 +2809,8 @@ void linux_doc_line_break(ostream & os, string::size_type & colcount,
|
|||||||
|
|
||||||
|
|
||||||
// Handle internal paragraph parsing -- layout already processed.
|
// Handle internal paragraph parsing -- layout already processed.
|
||||||
void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, int /*depth*/)
|
void Buffer::SimpleLinuxDocOnePar(ostream & os,
|
||||||
|
LyXParagraph * par, int /*depth*/)
|
||||||
{
|
{
|
||||||
LyXLayout const & style = textclasslist.Style(params.textclass,
|
LyXLayout const & style = textclasslist.Style(params.textclass,
|
||||||
par->GetLayout());
|
par->GetLayout());
|
||||||
@ -2821,8 +2822,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, int /*depth*
|
|||||||
if (style.labeltype == LABEL_MANUAL) {
|
if (style.labeltype == LABEL_MANUAL) {
|
||||||
font_old = style.labelfont;
|
font_old = style.labelfont;
|
||||||
desc_on = true;
|
desc_on = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
font_old = style.font;
|
font_old = style.font;
|
||||||
desc_on = false;
|
desc_on = false;
|
||||||
}
|
}
|
||||||
@ -2843,12 +2843,12 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, int /*depth*
|
|||||||
};
|
};
|
||||||
char const * tag_name[] = {"tt","sf","bf","it","sl","em"};
|
char const * tag_name[] = {"tt","sf","bf","it","sl","em"};
|
||||||
|
|
||||||
stack <int> tag_state;
|
stack<int> tag_state;
|
||||||
// parsing main loop
|
// parsing main loop
|
||||||
for (LyXParagraph::size_type i = 0; i < par->size(); ++i) {
|
for (LyXParagraph::size_type i = 0; i < par->size(); ++i) {
|
||||||
|
|
||||||
bitset < LAST > tag_close;
|
bitset<LAST> tag_close;
|
||||||
list <int> tag_open;
|
list<int> tag_open;
|
||||||
|
|
||||||
LyXFont const font = par->getFont(params, i);
|
LyXFont const font = par->getFont(params, i);
|
||||||
|
|
||||||
@ -2929,16 +2929,15 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, int /*depth*
|
|||||||
if (font.emph() == LyXFont::ON) {
|
if (font.emph() == LyXFont::ON) {
|
||||||
tag_open.push_back(EM);
|
tag_open.push_back(EM);
|
||||||
is_em = true;
|
is_em = true;
|
||||||
}
|
} else if (is_em) {
|
||||||
else if (is_em) {
|
|
||||||
tag_close.set(EM);
|
tag_close.set(EM);
|
||||||
is_em = false;
|
is_em = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list <int> temp;
|
list<int> temp;
|
||||||
while(!tag_state.empty() && tag_close.any()) {
|
while (!tag_state.empty() && tag_close.any()) {
|
||||||
int k=tag_state.top();
|
int k = tag_state.top();
|
||||||
tag_state.pop();
|
tag_state.pop();
|
||||||
os << "</" << tag_name[k] << ">";
|
os << "</" << tag_name[k] << ">";
|
||||||
if (tag_close[k])
|
if (tag_close[k])
|
||||||
@ -2947,13 +2946,13 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, int /*depth*
|
|||||||
temp.push_back(k);
|
temp.push_back(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(list<int>::const_iterator j = temp.begin();
|
for (list<int>::const_iterator j = temp.begin();
|
||||||
j != temp.end(); ++j) {
|
j != temp.end(); ++j) {
|
||||||
tag_state.push(*j);
|
tag_state.push(*j);
|
||||||
os << "<" << tag_name[*j] << ">";
|
os << "<" << tag_name[*j] << ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
for(list<int>::const_iterator j = tag_open.begin();
|
for (list<int>::const_iterator j = tag_open.begin();
|
||||||
j != tag_open.end(); ++j) {
|
j != tag_open.end(); ++j) {
|
||||||
tag_state.push(*j);
|
tag_state.push(*j);
|
||||||
os << "<" << tag_name[*j] << ">";
|
os << "<" << tag_name[*j] << ">";
|
||||||
@ -3027,17 +3026,22 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
|||||||
|
|
||||||
niceFile = nice; // this will be used by Insetincludes.
|
niceFile = nice; // this will be used by Insetincludes.
|
||||||
|
|
||||||
string top_element= textclasslist.LatexnameOfClass(params.textclass);
|
string top_element = textclasslist.LatexnameOfClass(params.textclass);
|
||||||
|
|
||||||
vector <string> environment_stack;
|
vector <string> environment_stack;
|
||||||
vector <string> environment_inner;
|
vector <string> environment_inner;
|
||||||
vector <string> command_stack;
|
vector <string> command_stack;
|
||||||
|
|
||||||
bool command_flag= false;
|
bool command_flag = false;
|
||||||
int command_depth= 0, command_base= 0, cmd_depth= 0;
|
int command_depth = 0;
|
||||||
|
int command_base = 0;
|
||||||
|
int cmd_depth = 0;
|
||||||
|
|
||||||
string item_name, command_name;
|
string item_name;
|
||||||
string c_depth, c_params, tmps;
|
string command_name;
|
||||||
|
string c_depth;
|
||||||
|
string c_params;
|
||||||
|
string tmps;
|
||||||
|
|
||||||
int depth = 0; // paragraph depth
|
int depth = 0; // paragraph depth
|
||||||
LyXTextClass const & tclass =
|
LyXTextClass const & tclass =
|
||||||
|
@ -183,7 +183,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
|||||||
|
|
||||||
if (!cleared && ((inset->need_update == InsetText::FULL) ||
|
if (!cleared && ((inset->need_update == InsetText::FULL) ||
|
||||||
(inset->need_update == InsetText::INIT) ||
|
(inset->need_update == InsetText::INIT) ||
|
||||||
(top_x!=int(x)) || (top_baseline!=baseline))) {
|
(top_x != int(x)) || (top_baseline != baseline))) {
|
||||||
int w = owner() ? width(bv, f) : pain.paperWidth();
|
int w = owner() ? width(bv, f) : pain.paperWidth();
|
||||||
int h = ascent(bv, f) + descent(bv, f);
|
int h = ascent(bv, f) + descent(bv, f);
|
||||||
int tx = (needFullRow() && !owner()) ? 0 : int(x);
|
int tx = (needFullRow() && !owner()) ? 0 : int(x);
|
||||||
@ -203,8 +203,21 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
|||||||
top_x = int(x);
|
top_x = int(x);
|
||||||
top_baseline = baseline;
|
top_baseline = baseline;
|
||||||
|
|
||||||
|
#if 0
|
||||||
draw_collapsed(pain, f, baseline, x);
|
draw_collapsed(pain, f, baseline, x);
|
||||||
inset->draw(bv, f, baseline, x, cleared);
|
inset->draw(bv, f, baseline, x, cleared);
|
||||||
|
#else
|
||||||
|
#warning Jürgen, can you have a look at this? (Lgb)
|
||||||
|
// the intention is quite clear if you set the positon in a minipage you
|
||||||
|
// want the minipage drawn according to that. but as you can see the
|
||||||
|
// cursor is wrongly placed.
|
||||||
|
draw_collapsed(pain, f,
|
||||||
|
baseline - ascent(bv, f) + ascent_collapsed(pain, f),
|
||||||
|
x);
|
||||||
|
inset->draw(bv, f,
|
||||||
|
baseline - ascent(bv, f) + ascent_collapsed(pain, f),
|
||||||
|
x, cleared);
|
||||||
|
#endif
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +177,56 @@ Inset * InsetMinipage::Clone(Buffer const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetMinipage::ascent(BufferView * bv, LyXFont const & font) const
|
||||||
|
{
|
||||||
|
lyxerr << "InsetMinipage::ascent" << endl;
|
||||||
|
|
||||||
|
if (collapsed)
|
||||||
|
return ascent_collapsed(bv->painter(), font);
|
||||||
|
else {
|
||||||
|
// Take placement into account.
|
||||||
|
int i = 0;
|
||||||
|
switch (pos_) {
|
||||||
|
case top:
|
||||||
|
i = InsetCollapsable::ascent(bv, font);
|
||||||
|
break;
|
||||||
|
case center:
|
||||||
|
i = (InsetCollapsable::ascent(bv, font)
|
||||||
|
+ InsetCollapsable::descent(bv, font)) / 2;
|
||||||
|
break;
|
||||||
|
case bottom:
|
||||||
|
i = InsetCollapsable::descent(bv, font);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetMinipage::descent(BufferView * bv, LyXFont const & font) const
|
||||||
|
{
|
||||||
|
if (collapsed)
|
||||||
|
return descent_collapsed(bv->painter(), font);
|
||||||
|
else {
|
||||||
|
// Take placement into account.
|
||||||
|
int i = 0;
|
||||||
|
switch (pos_) {
|
||||||
|
case top:
|
||||||
|
i = InsetCollapsable::descent(bv, font);
|
||||||
|
break;
|
||||||
|
case center:
|
||||||
|
i = (InsetCollapsable::ascent(bv, font)
|
||||||
|
+ InsetCollapsable::descent(bv, font)) / 2;
|
||||||
|
break;
|
||||||
|
case bottom:
|
||||||
|
i = InsetCollapsable::ascent(bv, font);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetMinipage::EditMessage() const
|
string const InsetMinipage::EditMessage() const
|
||||||
{
|
{
|
||||||
return _("Opened Minipage Inset");
|
return _("Opened Minipage Inset");
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 2001 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================
|
* ======================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef InsetMinipage_H
|
#ifndef InsetMinipage_H
|
||||||
@ -49,6 +49,10 @@ public:
|
|||||||
///
|
///
|
||||||
Inset * Clone(Buffer const &) const;
|
Inset * Clone(Buffer const &) const;
|
||||||
///
|
///
|
||||||
|
int ascent(BufferView *, LyXFont const &) const;
|
||||||
|
///
|
||||||
|
int descent(BufferView *, LyXFont const &) const;
|
||||||
|
///
|
||||||
Inset::Code LyxCode() const { return Inset::MINIPAGE_CODE; }
|
Inset::Code LyxCode() const { return Inset::MINIPAGE_CODE; }
|
||||||
///
|
///
|
||||||
int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
|
int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
|
||||||
@ -86,8 +90,6 @@ public:
|
|||||||
int getMaxWidth(Painter &, UpdatableInset const *) const;
|
int getMaxWidth(Painter &, UpdatableInset const *) const;
|
||||||
///
|
///
|
||||||
bool needFullRow() const { return false; }
|
bool needFullRow() const { return false; }
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Position pos_;
|
Position pos_;
|
||||||
|
Loading…
Reference in New Issue
Block a user