+2000-03-31 Juergen Vigna <jug@sad.it>
+
+ * src/paragraph.C (GetInset): commented out text[pos] = ' '
+ (Clone): changed mode how the paragraph-data is copied to the
+ new clone-paragraph.
+
+ * src/lyxfunc.C (Dispatch): fixed small problem when calling
+ GetInset(pos) with no inset anymore there (in inset UNDO)
+
+ * src/insets/insetcommand.C (draw): small fix as here x is
+ incremented not as much as width() returns (2 before, 2 behind = 4)
+
+2000-03-30 Juergen Vigna <jug@sad.it>
+
+ * src/insets/insettext.C (InsetText): small fix in initialize
+ widthOffset (should not be done in the init() function)
+
2000-03-29 Amir Karger <karger@lyx.org>
* lib/examples/it_ItemizeBullets.lyx: translation by
}
text->InsertInset(inset);
+#if 1
+ // if we enter a text-inset the cursor should be to the left side
+ // of it! This couldn't happen before as Undo was not handled inside
+ // inset now after the Undo LyX tries to call inset->Edit(...) again
+ // and cannot do this as the cursor is behind the inset and GetInset
+ // does not return the inset!
+ if (inset->IsTextInset()) {
+ if (text->cursor.par->getParDirection()==LYX_DIR_LEFT_TO_RIGHT)
+ text->CursorLeft();
+ else
+ text->CursorRight();
+ }
+#endif
update(-1);
text->UnFreezeUndo();
return NOT_EDITABLE;
}
+bool Inset::IsTextInset() const
+{
+ return ((LyxCode() == TEXT_CODE) ||
+ (LyxCode() == ERT_CODE) ||
+ (LyxCode() == FOOT_CODE) ||
+ (LyxCode() == MARGIN_CODE));
+}
void Inset::Validate(LaTeXFeatures &) const
{
#include "Painter.h"
-InsetCollapsable::InsetCollapsable(Buffer * bf): InsetText(bf)
+InsetCollapsable::InsetCollapsable(Buffer * bf)
+ : InsetText(bf)
{
collapsed = true;
label = "Label";
InsetCollapsable * result = new InsetCollapsable(buffer);
result->init(buffer, par);
+ result->collapsed = collapsed;
return result;
}
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
}
- return width+4;
+ return width + 4;
}
true, width);
}
- x += width;
+ x += width + 4;
}
#include "Painter.h"
-InsetFoot::InsetFoot(Buffer * bf): InsetCollapsable(bf)
+InsetFoot::InsetFoot(Buffer * bf)
+ : InsetCollapsable(bf)
{
setLabel(_("foot"));
LyXFont font(LyXFont::ALL_SANE);
InsetFoot * result = new InsetFoot(buffer);
result->init(buffer, par);
+ result->collapsed = collapsed;
return result;
}
InsetText::InsetText(Buffer * buf)
{
par = new LyXParagraph();
+ widthOffset = 0;
init(buf);
}
InsetText::InsetText(InsetText const & ins, Buffer * buf)
{
par = 0;
+ widthOffset = 0;
init(buf, ins.par);
}
if (p) {
if (par)
delete par;
- par = new LyXParagraph(p);
- for(int pos = 0; pos < p->Last(); ++pos) {
- par->InsertChar(pos, p->GetChar(pos));
- par->SetFont(pos, p->GetFontSettings(pos));
- if ((p->GetChar(pos) == LyXParagraph::META_INSET) &&
- p->GetInset(pos)) {
- par->InsertInset(pos, p->GetInset(pos)->Clone());
- }
- }
+ par = p->Clone();
}
the_locking_inset = 0;
buffer = buf;
interline_space = 1;
no_selection = false;
init_inset = true;
- maxAscent = maxDescent = insetWidth = widthOffset = 0;
+ maxAscent = maxDescent = insetWidth = 0;
autoBreakRows = false;
xpos = 0.0;
}
///
TEXT_CODE,
///
+ ERT_CODE,
+ ///
FOOT_CODE,
///
MARGIN_CODE,
///
virtual EDITABLE Editable() const;
///
+ bool IsTextInset() const;
+ ///
virtual bool AutoDelete() const;
///
virtual void Write(ostream &) const = 0;
virtual bool Deletable() const;
/// returns LyX code associated with the inset. Used for TOC, ...)
- virtual Inset::Code LyxCode() const = 0;
+ virtual Inset::Code LyxCode() const { return NO_CODE; }
/// Get the label that appears at screen
virtual string getLabel(int) const {
inset->GetCursorPos(slx, sly);
owner->view()->unlockInset(inset);
owner->view()->menuUndo();
- inset = static_cast<UpdatableInset*>(
- owner->view()->text->cursor.par->
- GetInset(owner->view()->text->
- cursor.pos));
+ if (owner->view()->text->cursor.par->
+ IsInset(owner->view()->text->cursor.pos)) {
+ inset = static_cast<UpdatableInset*>(
+ owner->view()->text->cursor.par->
+ GetInset(owner->view()->text->
+ cursor.pos));
+ } else {
+ inset = 0;
+ }
if (inset)
inset->Edit(owner->view(),slx,sly,0);
return string();
}
lyxerr << "ERROR (LyXParagraph::GetInset): "
"Inset does not exist: " << pos << endl;
- text[pos] = ' '; // WHY!!! does this set the pos to ' '????
+ // text[pos] = ' '; // WHY!!! does this set the pos to ' '????
// Did this commenting out introduce a bug? So far I have not
// see any, please enlighten me. (Lgb)
// My guess is that since the inset does not exist, we might
// copy everything behind the break-position to the new paragraph
-
+
+ // IMO this is not correct. Here we should not use the Minibuffer to
+ // copy stuff, as the Minibuffer is global and we could be in a
+ // situation where we copy a paragraph inside a paragraph (this now
+ // is possible think of Text-Insets!). So I'm changing this so that
+ // then inside the Text-Inset I can use par->Clone() to copy the
+ // paragraph data from one inset to the other!
+#if 0
for (size_type i = 0; i < size(); ++i) {
CopyIntoMinibuffer(i);
result->InsertFromMinibuffer(i);
}
+#else
+ for(size_type i = 0; i < size(); ++i) {
+ result->InsertChar(i, GetChar(i));
+ result->SetFont(i, GetFontSettings(i));
+ if ((GetChar(i) == LyXParagraph::META_INSET) && GetInset(i)) {
+ result->InsertInset(i, GetInset(i)->Clone());
+ }
+ }
+#endif
result->text.resize(result->text.size());
return result;
}