+2002-03-05 Juergen Vigna <jug@sad.it>
+
+ * insetert.C (status): change behaviour of Inlined.
+ (getMaxWidth): added for new inlined behaviour.
+
2002-03-05 José Abílio Oliveira Matos <jamatos@novalis.fc.up.pt>
* insetnote.h (linuxdoc, docbook): add empty methods.
* insettext.C (insetButtonPress): don't call exit on a InsetButtonPress
only that one in the inset. Should be enough.
+ (updateLocal): set the selection cursor always if we don't have a
+ selection to be sure it's set!
* insettabular.C (insetButtonPress): don't hit a sub inset 2 times.
#include "lyxtext.h"
#include "debug.h"
#include "lyxtextclasslist.h"
+#include "lyxrow.h"
#include "insets/insettext.h"
{
if (st != status_) {
status_ = st;
+ need_update = FULL;
switch (st) {
case Inlined:
- inset.setAutoBreakRows(false);
+ inset.setUpdateStatus(bv, InsetText::INIT);
break;
case Open:
- inset.setAutoBreakRows(true);
collapsed_ = false;
- need_update = FULL;
setButtonLabel();
break;
case Collapsed:
- inset.setAutoBreakRows(true);
collapsed_ = true;
- need_update = FULL;
setButtonLabel();
if (bv)
bv->unlockInset(const_cast<InsetERT *>(this));
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
font.setColor(LColor::latex);
}
+
+
+int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const
+{
+ int w = InsetCollapsable::getMaxWidth(bv, in);
+ if (status_ != Inlined || w < 0)
+ return w;
+ LyXText * text = inset.getLyXText(bv);
+ if (text->width < w && !text->firstRow()->next())
+ return -1;
+ return w;
+}
bool forceDefaultParagraphs(Inset const *) const {
return true;
}
+ ///
+ int getMaxWidth(BufferView *, UpdatableInset const *) const;
private:
///
setUpdateStatus(bv, what);
bool flag = (((need_update != CURSOR) && (need_update != NONE)) ||
(lt->status() != LyXText::UNCHANGED) || lt->selection.set());
+ if (!lt->selection.set())
+ lt->selection.cursor = lt->cursor;
if (clear)
lt = 0;
if (flag)
textclasslist[bview->buffer()->params.textclass][cursor.row()->par()->layout()].free_spacing ||
cursor.row()->par()->isFreeSpacing();
-
if (lyxrc.auto_number) {
static string const number_operators = "+-/*";
static string const number_unary_operators = "+-";
Row * row = cursor.row();
int y = cursor.y() - row->baseline();
if (c != Paragraph::META_INSET) /* Here case LyXText::InsertInset
- * already insertet the character */
+ * already insertet the character */
cursor.par()->insertChar(cursor.pos(), c);
setCharFont(bview->buffer(), cursor.par(), cursor.pos(), rawtmpfont);
|| ((cursor.pos() < cursor.par()->size()) &&
cursor.par()->isInset(cursor.pos()+1))
|| cursor.row()->fill() == -1)
- && row->previous() && row->previous()->par() == row->par()) {
+ && row->previous() && row->previous()->par() == row->par())
+ {
pos_type z = nextBreakPoint(bview,
row->previous(),
workWidth(bview));
// recalculate the fill of the row
if (row->fill() >= 0) /* needed because a newline
- * will set fill to -1. Otherwise
- * we would not get a rebreak! */
+ * will set fill to -1. Otherwise
+ * we would not get a rebreak! */
row->fill(fill(bview, row, workWidth(bview)));
if (row->fill() < 0) {
refresh_y = y;