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:
Lars Gullik Bjønnes 2001-03-22 19:36:21 +00:00
parent 28da50b522
commit 93dda00aac
4 changed files with 92 additions and 23 deletions

View File

@ -2809,7 +2809,8 @@ void linux_doc_line_break(ostream & os, string::size_type & colcount,
// 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,
par->GetLayout());
@ -2821,8 +2822,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, int /*depth*
if (style.labeltype == LABEL_MANUAL) {
font_old = style.labelfont;
desc_on = true;
}
else {
} else {
font_old = style.font;
desc_on = false;
}
@ -2929,8 +2929,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, int /*depth*
if (font.emph() == LyXFont::ON) {
tag_open.push_back(EM);
is_em = true;
}
else if (is_em) {
} else if (is_em) {
tag_close.set(EM);
is_em = false;
}
@ -3034,10 +3033,15 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
vector <string> command_stack;
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 c_depth, c_params, tmps;
string item_name;
string command_name;
string c_depth;
string c_params;
string tmps;
int depth = 0; // paragraph depth
LyXTextClass const & tclass =

View File

@ -203,8 +203,21 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
top_x = int(x);
top_baseline = baseline;
#if 0
draw_collapsed(pain, f, baseline, x);
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;
}

View File

@ -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
{
return _("Opened Minipage Inset");

View File

@ -4,7 +4,7 @@
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
* Copyright 2001 The LyX Team.
*
* ======================================================
*/
@ -49,6 +49,10 @@ public:
///
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; }
///
int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
@ -86,8 +90,6 @@ public:
int getMaxWidth(Painter &, UpdatableInset const *) const;
///
bool needFullRow() const { return false; }
private:
///
Position pos_;