// 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());
if (style.labeltype == LABEL_MANUAL) {
font_old = style.labelfont;
desc_on = true;
- }
- else {
+ } else {
font_old = style.font;
desc_on = false;
}
};
char const * tag_name[] = {"tt","sf","bf","it","sl","em"};
- stack <int> tag_state;
+ stack<int> tag_state;
// parsing main loop
for (LyXParagraph::size_type i = 0; i < par->size(); ++i) {
- bitset < LAST > tag_close;
- list <int> tag_open;
+ bitset<LAST> tag_close;
+ list<int> tag_open;
LyXFont const font = par->getFont(params, i);
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;
}
}
- list <int> temp;
- while(!tag_state.empty() && tag_close.any()) {
- int k=tag_state.top();
+ list<int> temp;
+ while (!tag_state.empty() && tag_close.any()) {
+ int k = tag_state.top();
tag_state.pop();
os << "</" << tag_name[k] << ">";
if (tag_close[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) {
tag_state.push(*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) {
tag_state.push(*j);
os << "<" << tag_name[*j] << ">";
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_inner;
vector <string> command_stack;
- bool command_flag= false;
- int command_depth= 0, command_base= 0, cmd_depth= 0;
+ bool command_flag = false;
+ 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 =
if (!cleared && ((inset->need_update == InsetText::FULL) ||
(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 h = ascent(bv, f) + descent(bv, f);
int tx = (needFullRow() && !owner()) ? 0 : int(x);
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;
}
}
+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");
*
* LyX, The Document Processor
*
- * Copyright 1998 The LyX Team.
+ * Copyright 2001 The LyX Team.
*
- *======================================================
+ * ======================================================
*/
#ifndef InsetMinipage_H
///
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;
int getMaxWidth(Painter &, UpdatableInset const *) const;
///
bool needFullRow() const { return false; }
-
-
private:
///
Position pos_;