Various small fixes, look in ChangeLog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@636 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-03-31 10:35:53 +00:00
parent 97c08cee29
commit b8dd79b64d
10 changed files with 81 additions and 21 deletions

View File

@ -1,3 +1,20 @@
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

View File

@ -230,6 +230,19 @@ void BufferView::insertInset(Inset * inset, string const & lout,
}
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();

View File

@ -41,6 +41,13 @@ Inset::EDITABLE Inset::Editable() const
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
{

View File

@ -20,7 +20,8 @@
#include "Painter.h"
InsetCollapsable::InsetCollapsable(Buffer * bf): InsetText(bf)
InsetCollapsable::InsetCollapsable(Buffer * bf)
: InsetText(bf)
{
collapsed = true;
label = "Label";
@ -37,6 +38,7 @@ Inset * InsetCollapsable::Clone() const
InsetCollapsable * result = new InsetCollapsable(buffer);
result->init(buffer, par);
result->collapsed = collapsed;
return result;
}

View File

@ -89,7 +89,7 @@ int InsetCommand::width(Painter & pain, LyXFont const &) const
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
}
return width+4;
return width + 4;
}
@ -111,7 +111,7 @@ void InsetCommand::draw(Painter & pain, LyXFont const &,
true, width);
}
x += width;
x += width + 4;
}

View File

@ -21,7 +21,8 @@
#include "Painter.h"
InsetFoot::InsetFoot(Buffer * bf): InsetCollapsable(bf)
InsetFoot::InsetFoot(Buffer * bf)
: InsetCollapsable(bf)
{
setLabel(_("foot"));
LyXFont font(LyXFont::ALL_SANE);
@ -38,6 +39,7 @@ Inset * InsetFoot::Clone() const
InsetFoot * result = new InsetFoot(buffer);
result->init(buffer, par);
result->collapsed = collapsed;
return result;
}

View File

@ -60,6 +60,7 @@ extern unsigned char getCurrentTextClass(Buffer *);
InsetText::InsetText(Buffer * buf)
{
par = new LyXParagraph();
widthOffset = 0;
init(buf);
}
@ -67,6 +68,7 @@ InsetText::InsetText(Buffer * buf)
InsetText::InsetText(InsetText const & ins, Buffer * buf)
{
par = 0;
widthOffset = 0;
init(buf, ins.par);
}
@ -75,15 +77,7 @@ void InsetText::init(Buffer * buf, LyXParagraph *p)
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;
@ -93,7 +87,7 @@ void InsetText::init(Buffer * buf, LyXParagraph *p)
interline_space = 1;
no_selection = false;
init_inset = true;
maxAscent = maxDescent = insetWidth = widthOffset = 0;
maxAscent = maxDescent = insetWidth = 0;
autoBreakRows = false;
xpos = 0.0;
}

View File

@ -83,6 +83,8 @@ public:
///
TEXT_CODE,
///
ERT_CODE,
///
FOOT_CODE,
///
MARGIN_CODE,
@ -116,6 +118,8 @@ public:
///
virtual EDITABLE Editable() const;
///
bool IsTextInset() const;
///
virtual bool AutoDelete() const;
///
virtual void Write(ostream &) const = 0;
@ -140,7 +144,7 @@ public:
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 {

View File

@ -532,10 +532,15 @@ string LyXFunc::Dispatch(int ac,
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();

View File

@ -659,7 +659,7 @@ Inset * LyXParagraph::GetInset(LyXParagraph::size_type pos)
}
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
@ -1477,11 +1477,27 @@ LyXParagraph * LyXParagraph::Clone() const
// 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;
}