mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
remove !NEW_INSETS cruft
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1980 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
53c5edb99e
commit
4c6091b63f
@ -170,18 +170,8 @@ public:
|
||||
void menuUndo();
|
||||
///
|
||||
void menuRedo();
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
void toggleFloat();
|
||||
///
|
||||
void openStuff();
|
||||
#endif
|
||||
///
|
||||
void insertNote();
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
void allFloats(char flag, char figmar);
|
||||
#endif
|
||||
/// removes all autodeletable insets
|
||||
bool removeAutoInsets();
|
||||
///
|
||||
|
@ -106,26 +106,7 @@ bool BufferView::removeAutoInsets()
|
||||
LyXCursor cursor;
|
||||
|
||||
bool a = false;
|
||||
#ifndef NEW_INSETS
|
||||
while (par) {
|
||||
// this has to be done before the delete
|
||||
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
|
||||
text->SetCursor(this, cursor, par, 0);
|
||||
if (par->AutoDeleteInsets()){
|
||||
a = true;
|
||||
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
|
||||
text->RedoParagraphs(this, cursor,
|
||||
cursor.par()->next());
|
||||
text->FullRebreak(this);
|
||||
}
|
||||
}
|
||||
par = par->next_;
|
||||
}
|
||||
|
||||
// avoid forbidden cursor positions caused by error removing
|
||||
if (tmpcursor.pos() > tmpcursor.par()->Last())
|
||||
tmpcursor.pos(tmpcursor.par()->Last());
|
||||
#else
|
||||
while (par) {
|
||||
// this has to be done before the delete
|
||||
text->SetCursor(this, cursor, par, 0);
|
||||
@ -141,7 +122,7 @@ bool BufferView::removeAutoInsets()
|
||||
// avoid forbidden cursor positions caused by error removing
|
||||
if (tmpcursor.pos() > tmpcursor.par()->size())
|
||||
tmpcursor.pos(tmpcursor.par()->size());
|
||||
#endif
|
||||
|
||||
text->SetCursorIntern(this, tmpcursor.par(), tmpcursor.pos());
|
||||
|
||||
return a;
|
||||
@ -153,12 +134,6 @@ void BufferView::insertErrors(TeXErrors & terr)
|
||||
// Save the cursor position
|
||||
LyXCursor cursor = text->cursor;
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
// This is drastic, but it's the only fix, I could find. (Asger)
|
||||
allFloats(1, 0);
|
||||
allFloats(1, 1);
|
||||
#endif
|
||||
|
||||
for (TeXErrors::Errors::const_iterator cit = terr.begin();
|
||||
cit != terr.end();
|
||||
++cit) {
|
||||
@ -237,11 +212,7 @@ bool BufferView::insertInset(Inset * inset, string const & lout,
|
||||
text->BreakParagraph(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
if (text->cursor.par()->Last()) {
|
||||
#else
|
||||
if (text->cursor.par()->size()) {
|
||||
#endif
|
||||
text->CursorLeft(this);
|
||||
|
||||
text->BreakParagraph(this);
|
||||
@ -322,96 +293,6 @@ bool BufferView::gotoLabel(string const & label)
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
void BufferView::allFloats(char flag, char figmar)
|
||||
{
|
||||
if (!available()) return;
|
||||
|
||||
LyXCursor cursor = text->cursor;
|
||||
|
||||
if (!flag
|
||||
&& cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE
|
||||
&& ((figmar
|
||||
&& cursor.par()->footnotekind != LyXParagraph::FOOTNOTE
|
||||
&& cursor.par()->footnotekind != LyXParagraph::MARGIN
|
||||
)
|
||||
|| (!figmar
|
||||
&& cursor.par()->footnotekind != LyXParagraph::FIG
|
||||
&& cursor.par()->footnotekind != LyXParagraph::TAB
|
||||
&& cursor.par()->footnotekind != LyXParagraph::WIDE_FIG
|
||||
&& cursor.par()->footnotekind != LyXParagraph::WIDE_TAB
|
||||
&& cursor.par()->footnotekind != LyXParagraph::ALGORITHM)))
|
||||
toggleFloat();
|
||||
else
|
||||
beforeChange(text);
|
||||
|
||||
LyXCursor tmpcursor = cursor;
|
||||
cursor.par(tmpcursor.par()->ParFromPos(tmpcursor.pos()));
|
||||
cursor.pos(tmpcursor.par()->PositionInParFromPos(tmpcursor.pos()));
|
||||
|
||||
LyXParagraph *par = buffer()->paragraph;
|
||||
while (par) {
|
||||
if (flag) {
|
||||
if (par->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE
|
||||
&& ((figmar
|
||||
&& par->footnotekind != LyXParagraph::FOOTNOTE
|
||||
&& par->footnotekind != LyXParagraph::MARGIN)
|
||||
|| (!figmar
|
||||
&& par->footnotekind != LyXParagraph::FIG
|
||||
&& par->footnotekind != LyXParagraph::TAB
|
||||
&& par->footnotekind != LyXParagraph::WIDE_FIG
|
||||
&& par->footnotekind != LyXParagraph::WIDE_TAB
|
||||
&& par->footnotekind != LyXParagraph::ALGORITHM
|
||||
)
|
||||
)
|
||||
) {
|
||||
if (par->previous_
|
||||
&& par->previous_->footnoteflag !=
|
||||
LyXParagraph::CLOSED_FOOTNOTE){ /* should be */
|
||||
text->SetCursorIntern(this,
|
||||
par->previous_,
|
||||
0);
|
||||
text->OpenFootnote(this);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
|
||||
&& (
|
||||
(figmar
|
||||
&&
|
||||
par->footnotekind != LyXParagraph::FOOTNOTE
|
||||
&&
|
||||
par->footnotekind != LyXParagraph::MARGIN
|
||||
)
|
||||
||
|
||||
(!figmar
|
||||
&&
|
||||
par->footnotekind != LyXParagraph::FIG
|
||||
&&
|
||||
par->footnotekind != LyXParagraph::TAB
|
||||
&&
|
||||
par->footnotekind != LyXParagraph::WIDE_FIG
|
||||
&&
|
||||
par->footnotekind != LyXParagraph::WIDE_TAB
|
||||
&&
|
||||
par->footnotekind != LyXParagraph::ALGORITHM
|
||||
)
|
||||
)
|
||||
) {
|
||||
text->SetCursorIntern(this, par, 0);
|
||||
text->CloseFootnote(this);
|
||||
}
|
||||
}
|
||||
par = par->next_;
|
||||
}
|
||||
|
||||
text->SetCursorIntern(this, cursor.par(), cursor.pos());
|
||||
redraw();
|
||||
fitCursor(text);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void BufferView::insertNote()
|
||||
{
|
||||
InsetInfo * new_inset = new InsetInfo();
|
||||
@ -420,35 +301,6 @@ void BufferView::insertNote()
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
void BufferView::openStuff()
|
||||
{
|
||||
if (available()) {
|
||||
owner()->message(_("Open/Close..."));
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
text->OpenStuff(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
setState();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BufferView::toggleFloat()
|
||||
{
|
||||
if (available()) {
|
||||
owner()->message(_("Open/Close..."));
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
text->ToggleFootnote(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
setState();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void BufferView::menuUndo()
|
||||
{
|
||||
if (available()) {
|
||||
@ -841,17 +693,9 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
|
||||
return; // shouldn't happen
|
||||
if (kind == Undo::EDIT) // in this case insets would not be stored!
|
||||
kind = Undo::FINISH;
|
||||
#ifndef NEW_INSETS
|
||||
text->SetUndo(buffer(), kind,
|
||||
text->cursor.par()->
|
||||
ParFromPos(text->cursor.pos())->previous_,
|
||||
text->cursor.par()->
|
||||
ParFromPos(text->cursor.pos())->next_);
|
||||
#else
|
||||
text->SetUndo(buffer(), kind,
|
||||
text->cursor.par()->previous(),
|
||||
text->cursor.par()->next());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -905,13 +749,8 @@ bool BufferView::ChangeInsets(Inset::Code code,
|
||||
LyXParagraph * par = buffer()->paragraph;
|
||||
LyXCursor cursor = text->cursor;
|
||||
LyXCursor tmpcursor = cursor;
|
||||
#ifndef NEW_INSETS
|
||||
cursor.par(tmpcursor.par()->ParFromPos(tmpcursor.pos()));
|
||||
cursor.pos(tmpcursor.par()->PositionInParFromPos(tmpcursor.pos()));
|
||||
#else
|
||||
cursor.par(tmpcursor.par());
|
||||
cursor.pos(tmpcursor.pos());
|
||||
#endif
|
||||
|
||||
while (par) {
|
||||
bool flag2 = false;
|
||||
@ -925,20 +764,6 @@ bool BufferView::ChangeInsets(Inset::Code code,
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
if (flag2) {
|
||||
flag = true;
|
||||
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
|
||||
// this is possible now, since SetCursor takes
|
||||
// care about footnotes
|
||||
text->SetCursorIntern(this, par, 0);
|
||||
text->RedoParagraphs(this, text->cursor,
|
||||
text->cursor.par()->next());
|
||||
text->FullRebreak(this);
|
||||
}
|
||||
}
|
||||
par = par->next_;
|
||||
#else
|
||||
if (flag2) {
|
||||
flag = true;
|
||||
// this is possible now, since SetCursor takes
|
||||
@ -949,7 +774,6 @@ bool BufferView::ChangeInsets(Inset::Code code,
|
||||
text->FullRebreak(this);
|
||||
}
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
text->SetCursorIntern(this, cursor.par(), cursor.pos());
|
||||
return flag;
|
||||
|
@ -807,73 +807,6 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
// check whether we want to open a float
|
||||
if (bv_->text) {
|
||||
bool hit = false;
|
||||
char c = ' ';
|
||||
if (bv_->text->cursor.pos() <
|
||||
bv_->text->cursor.par()->Last()) {
|
||||
c = bv_->text->cursor.par()->
|
||||
GetChar(bv_->text->cursor.pos());
|
||||
}
|
||||
if(!bv_->text->selection)
|
||||
if (c == LyXParagraph::META_FOOTNOTE
|
||||
|| c == LyXParagraph::META_MARGIN
|
||||
|| c == LyXParagraph::META_FIG
|
||||
|| c == LyXParagraph::META_TAB
|
||||
|| c == LyXParagraph::META_WIDE_FIG
|
||||
|| c == LyXParagraph::META_WIDE_TAB
|
||||
|| c == LyXParagraph::META_ALGORITHM){
|
||||
hit = true;
|
||||
} else
|
||||
if (bv_->text->cursor.pos() - 1 >= 0) {
|
||||
c = bv_->text->cursor.par()->
|
||||
GetChar(bv_->text->cursor.pos() - 1);
|
||||
if (c == LyXParagraph::META_FOOTNOTE
|
||||
|| c == LyXParagraph::META_MARGIN
|
||||
|| c == LyXParagraph::META_FIG
|
||||
|| c == LyXParagraph::META_TAB
|
||||
|| c == LyXParagraph::META_WIDE_FIG
|
||||
|| c == LyXParagraph::META_WIDE_TAB
|
||||
|| c == LyXParagraph::META_ALGORITHM){
|
||||
// We are one step too far to the right
|
||||
bv_->text->CursorLeft(bv_);
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
if (hit == true) {
|
||||
bv_->toggleFloat();
|
||||
selection_possible = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Do we want to close a float? (click on the float-label)
|
||||
if (bv_->text->cursor.row()->par()->footnoteflag ==
|
||||
LyXParagraph::OPEN_FOOTNOTE
|
||||
&& bv_->text->cursor.row()->previous() &&
|
||||
bv_->text->cursor.row()->previous()->par()->
|
||||
footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
font.setSize(LyXFont::SIZE_FOOTNOTE);
|
||||
|
||||
int box_x = 20; // LYX_PAPER_MARGIN;
|
||||
box_x += lyxfont::width(" wide-tab ", font);
|
||||
|
||||
unsigned int screen_first = bv_->text->first;
|
||||
|
||||
if (x < box_x
|
||||
&& y + screen_first > bv_->text->cursor.y() -
|
||||
bv_->text->cursor.row()->baseline()
|
||||
&& y + screen_first < bv_->text->cursor.y() -
|
||||
bv_->text->cursor.row()->baseline()
|
||||
+ lyxfont::maxAscent(font) * 1.2 + lyxfont::maxDescent(font) * 1.2) {
|
||||
bv_->toggleFloat();
|
||||
selection_possible = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// check whether we want to open a float
|
||||
if (bv_->text) {
|
||||
bool hit = false;
|
||||
@ -892,7 +825,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Maybe we want to edit a bibitem ale970302
|
||||
if (bv_->text->cursor.par()->bibkey && x < 20 +
|
||||
bibitemMaxWidth(bv_, textclasslist.
|
||||
@ -923,11 +856,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
|
||||
text->SetCursor(bv_, cursor, cursor.par(),cursor.pos(),true);
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
if (cursor.pos() < cursor.par()->Last()
|
||||
#else
|
||||
if (cursor.pos() < cursor.par()->size()
|
||||
#endif
|
||||
&& cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
|
||||
&& cursor.par()->GetInset(cursor.pos())
|
||||
&& cursor.par()->GetInset(cursor.pos())->Editable()) {
|
||||
@ -1219,7 +1148,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
|
||||
if (i >= saved_positions_num)
|
||||
return;
|
||||
|
||||
string fname = saved_positions[i].filename;
|
||||
string const fname = saved_positions[i].filename;
|
||||
|
||||
beforeChange(bv_->text);
|
||||
|
||||
@ -1234,13 +1163,9 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
|
||||
if (!par)
|
||||
return;
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
bv_->text->SetCursor(bv_, par,
|
||||
min(par->Last(), saved_positions[i].par_pos));
|
||||
#else
|
||||
bv_->text->SetCursor(bv_, par,
|
||||
min(par->size(), saved_positions[i].par_pos));
|
||||
#endif
|
||||
|
||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
if (i > 0) {
|
||||
string const str = _("Moved to bookmark") + ' ' + tostr(i);
|
||||
@ -1838,11 +1763,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
update(TEXT(bv_), BufferView::SELECT|BufferView::FITCUR);
|
||||
if (is_rtl)
|
||||
TEXT(bv_)->CursorLeft(bv_, false);
|
||||
#ifndef NEW_INSETS
|
||||
if (TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->Last()
|
||||
#else
|
||||
if (TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->size()
|
||||
#endif
|
||||
&& TEXT(bv_)->cursor.par()->GetChar(TEXT(bv_)->cursor.pos())
|
||||
== LyXParagraph::META_INSET
|
||||
&& TEXT(bv_)->cursor.par()->GetInset(TEXT(bv_)->cursor.pos())
|
||||
@ -1880,11 +1801,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
if (!is_rtl)
|
||||
TEXT(bv_)->CursorLeft(bv_, false);
|
||||
if ((is_rtl || cur != TEXT(bv_)->cursor) && // only if really moved!
|
||||
#ifndef NEW_INSETS
|
||||
TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->Last() &&
|
||||
#else
|
||||
TEXT(bv_)->cursor.pos() < TEXT(bv_)->cursor.par()->size() &&
|
||||
#endif
|
||||
(TEXT(bv_)->cursor.par()->GetChar(TEXT(bv_)->cursor.pos()) ==
|
||||
LyXParagraph::META_INSET) &&
|
||||
TEXT(bv_)->cursor.par()->GetInset(TEXT(bv_)->cursor.pos()) &&
|
||||
@ -2255,11 +2172,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
LyXCursor cursor = TEXT(bv_)->cursor;
|
||||
|
||||
if (!TEXT(bv_)->selection) {
|
||||
#ifndef NEW_INSETS
|
||||
if (cursor.pos() == cursor.par()->Last()) {
|
||||
#else
|
||||
if (cursor.pos() == cursor.par()->size()) {
|
||||
#endif
|
||||
TEXT(bv_)->CursorRight(bv_);
|
||||
cursor = TEXT(bv_)->cursor;
|
||||
if (cursor.pos() == 0
|
||||
|
@ -1,3 +1,43 @@
|
||||
2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* undo.C: remove !NEW_INSETS cruft
|
||||
|
||||
2001-04-28 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* text2.C: remove !NEW_INSETS cruft
|
||||
|
||||
* text.C: remove !NEW_INSETS cruft
|
||||
|
||||
* tabular.C: remove !NEW_INSETS cruft
|
||||
|
||||
* spellchecker.C: remove !NEW_INSETS cruft
|
||||
|
||||
* lyxtext.h: remove !NEW_INSETS cruft
|
||||
|
||||
* lyxlex_pimpl.C: remove !NEW_INSETS cruft
|
||||
|
||||
* lyxfunc.C: remove !NEW_INSETS cruft
|
||||
|
||||
* lyxfind.C: remove !NEW_INSETS cruft
|
||||
|
||||
* lyx_cb.C: remove !NEW_INSETS cruft
|
||||
|
||||
* figureForm.C: remove !NEW_INSETS cruft
|
||||
|
||||
* bufferview_funcs.[Ch]: remove !NEW_INSETS cruft
|
||||
|
||||
* buffer.[Ch]: remove !NEW_INSETS cruft
|
||||
|
||||
* ToolbarDefaults.C: remove !NEW_INSETS cruft
|
||||
|
||||
* CutAndPaste.C: remove !NEW_INSETS cruft
|
||||
|
||||
* BufferView_pimpl.C: remove !NEW_INSETS cruft
|
||||
|
||||
* BufferView2.C: remove !NEW_INSETS cruft
|
||||
|
||||
* BufferView.h: remove !NEW_INSETS cruft
|
||||
|
||||
2001-05-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* Lsstream.h: include LString.h before the sstream headers to
|
||||
|
@ -63,11 +63,7 @@ void DeleteBuffer()
|
||||
|
||||
while (buf) {
|
||||
tmppar = buf;
|
||||
#ifndef NEW_INSETS
|
||||
buf = buf->next_;
|
||||
#else
|
||||
buf = buf->next();
|
||||
#endif
|
||||
delete tmppar;
|
||||
}
|
||||
buf = 0;
|
||||
@ -76,76 +72,6 @@ void DeleteBuffer()
|
||||
} // namespace anon
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
|
||||
int start, int & end, char tc, bool doclear)
|
||||
{
|
||||
if (!startpar || (start > startpar->Last()))
|
||||
return false;
|
||||
|
||||
DeleteBuffer();
|
||||
|
||||
textclass = tc;
|
||||
|
||||
if (!(*endpar) ||
|
||||
(startpar->ParFromPos(start) ==
|
||||
(*endpar)->ParFromPos(end))) {
|
||||
// only within one paragraph
|
||||
buf = new LyXParagraph;
|
||||
LyXParagraph::size_type i = start;
|
||||
if (end > startpar->Last())
|
||||
end = startpar->Last();
|
||||
for (; i < end; ++i) {
|
||||
startpar->CopyIntoMinibuffer(*current_view->buffer(), start);
|
||||
startpar->Erase(start);
|
||||
|
||||
buf->InsertFromMinibuffer(buf->Last());
|
||||
}
|
||||
end = start - 1;
|
||||
} else {
|
||||
// more than one paragraph
|
||||
(*endpar)->BreakParagraphConservative(current_view->buffer()->params,
|
||||
end);
|
||||
*endpar = (*endpar)->next();
|
||||
end = 0;
|
||||
|
||||
startpar->BreakParagraphConservative(current_view->buffer()->params,
|
||||
start);
|
||||
|
||||
// store the selection
|
||||
buf = startpar->ParFromPos(start)->next_;
|
||||
buf->previous(0);
|
||||
(*endpar)->previous()->next(0);
|
||||
|
||||
// cut the selection
|
||||
startpar->ParFromPos(start)->next(*endpar);
|
||||
|
||||
(*endpar)->previous(startpar->ParFromPos(start));
|
||||
|
||||
// care about footnotes
|
||||
if (buf->footnoteflag) {
|
||||
LyXParagraph * tmppar = buf;
|
||||
while (tmppar){
|
||||
tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
tmppar = tmppar->next_;
|
||||
}
|
||||
}
|
||||
|
||||
// the cut selection should begin with standard layout
|
||||
buf->Clear();
|
||||
|
||||
// paste the paragraphs again, if possible
|
||||
if (doclear)
|
||||
startpar->next()->StripLeadingSpaces(textclass);
|
||||
if (startpar->FirstPhysicalPar()->HasSameLayout(startpar->next()) ||
|
||||
!startpar->next()->Last()) {
|
||||
startpar->ParFromPos(start)->PasteParagraph(current_view->buffer()->params);
|
||||
(*endpar) = startpar; // this because endpar gets deleted here!
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
|
||||
int start, int & end, char tc, bool doclear)
|
||||
{
|
||||
@ -206,72 +132,8 @@ bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
|
||||
int start, int end, char tc)
|
||||
{
|
||||
if (!startpar || (start > startpar->Last()))
|
||||
return false;
|
||||
|
||||
DeleteBuffer();
|
||||
|
||||
textclass = tc;
|
||||
|
||||
if (!(endpar) ||
|
||||
(startpar->ParFromPos(start) ==
|
||||
(endpar)->ParFromPos(end))) {
|
||||
// only within one paragraph
|
||||
buf = new LyXParagraph;
|
||||
LyXParagraph::size_type i = start;
|
||||
if (end > startpar->Last())
|
||||
end = startpar->Last();
|
||||
for (; i < end; ++i) {
|
||||
startpar->CopyIntoMinibuffer(*current_view->buffer(),
|
||||
i);
|
||||
buf->InsertFromMinibuffer(buf->Last());
|
||||
}
|
||||
} else {
|
||||
// copy more than one paragraph
|
||||
// clone the paragraphs within the selection
|
||||
LyXParagraph * tmppar = startpar->ParFromPos(start);
|
||||
buf = tmppar->Clone();
|
||||
LyXParagraph * tmppar2 = buf;
|
||||
|
||||
while (tmppar != endpar->ParFromPos(end)
|
||||
&& tmppar->next_) {
|
||||
tmppar = tmppar->next_;
|
||||
tmppar2->next(tmppar->Clone());
|
||||
tmppar2->next_->previous(tmppar2);
|
||||
tmppar2 = tmppar2->next_;
|
||||
}
|
||||
tmppar2->next(0);
|
||||
|
||||
// care about footnotes
|
||||
if (buf->footnoteflag) {
|
||||
tmppar = buf;
|
||||
while (tmppar) {
|
||||
tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
tmppar = tmppar->next_;
|
||||
}
|
||||
}
|
||||
|
||||
// the buf paragraph is too big
|
||||
LyXParagraph::size_type tmpi2 = startpar->PositionInParFromPos(start);
|
||||
for (; tmpi2; --tmpi2)
|
||||
buf->Erase(0);
|
||||
|
||||
// now tmppar 2 is too big, delete all after end
|
||||
tmpi2 = endpar->PositionInParFromPos(end);
|
||||
while (tmppar2->size() > tmpi2) {
|
||||
tmppar2->Erase(tmppar2->size() - 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
|
||||
int start, int end, char tc)
|
||||
{
|
||||
@ -322,131 +184,8 @@ bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar,
|
||||
int & pos, char tc)
|
||||
{
|
||||
if (!checkPastePossible(*par))
|
||||
return false;
|
||||
|
||||
if (pos > (*par)->Last())
|
||||
pos = (*par)->Last();
|
||||
|
||||
LyXParagraph * tmpbuf;
|
||||
LyXParagraph * tmppar = *par;
|
||||
int tmppos = pos;
|
||||
|
||||
// There are two cases: cutbuffer only one paragraph or many
|
||||
if (!buf->next_) {
|
||||
// only within a paragraph
|
||||
tmpbuf = buf->Clone();
|
||||
// Some provisions should be done here for checking
|
||||
// if we are inserting at the beginning of a
|
||||
// paragraph. If there are a space at the beginning
|
||||
// of the text to insert and we are inserting at
|
||||
// the beginning of the paragraph the space should
|
||||
// be removed.
|
||||
while (buf->size()) {
|
||||
// This is an attempt to fix the
|
||||
// "never insert a space at the
|
||||
// beginning of a paragraph" problem.
|
||||
if (!tmppos && buf->IsLineSeparator(0)) {
|
||||
buf->Erase(0);
|
||||
} else {
|
||||
buf->CutIntoMinibuffer(current_view->buffer()->params, 0);
|
||||
buf->Erase(0);
|
||||
if (tmppar->InsertFromMinibuffer(tmppos))
|
||||
++tmppos;
|
||||
}
|
||||
}
|
||||
delete buf;
|
||||
buf = tmpbuf;
|
||||
*endpar = tmppar->next();
|
||||
pos = tmppos;
|
||||
} else {
|
||||
// many paragraphs
|
||||
|
||||
// make a copy of the simple cut_buffer
|
||||
tmpbuf = buf;
|
||||
LyXParagraph * simple_cut_clone = tmpbuf->Clone();
|
||||
LyXParagraph * tmpbuf2 = simple_cut_clone;
|
||||
if ((*par)->footnoteflag) {
|
||||
tmpbuf->footnoteflag = (*par)->footnoteflag;
|
||||
tmpbuf->footnotekind = (*par)->footnotekind;
|
||||
}
|
||||
while (tmpbuf->next_) {
|
||||
tmpbuf = tmpbuf->next_;
|
||||
tmpbuf2->next(tmpbuf->Clone());
|
||||
tmpbuf2->next_->previous(tmpbuf2);
|
||||
tmpbuf2 = tmpbuf2->next_;
|
||||
if ((*par)->footnoteflag){
|
||||
tmpbuf->footnoteflag = (*par)->footnoteflag;
|
||||
tmpbuf->footnotekind = (*par)->footnotekind;
|
||||
}
|
||||
}
|
||||
|
||||
// make sure there is no class difference
|
||||
SwitchLayoutsBetweenClasses(textclass, tc, buf);
|
||||
|
||||
// make the buf exactly the same layout than
|
||||
// the cursor paragraph
|
||||
buf->MakeSameLayout(*par);
|
||||
|
||||
// find the end of the buffer
|
||||
LyXParagraph * lastbuffer = buf;
|
||||
while (lastbuffer->next())
|
||||
lastbuffer = lastbuffer->next();
|
||||
|
||||
bool paste_the_end = false;
|
||||
|
||||
// open the paragraph for inserting the buf
|
||||
// if necessary
|
||||
if (((*par)->Last() > pos) || !(*par)->next()) {
|
||||
(*par)->BreakParagraphConservative(current_view->buffer()->params,
|
||||
pos);
|
||||
paste_the_end = true;
|
||||
}
|
||||
// set the end for redoing later
|
||||
*endpar = (*par)->ParFromPos(pos)->next_->next();
|
||||
|
||||
// paste it!
|
||||
lastbuffer->ParFromPos(lastbuffer->Last())->next(
|
||||
(*par)->ParFromPos(pos)->next_);
|
||||
(*par)->ParFromPos(pos)->next()->previous(
|
||||
lastbuffer->ParFromPos(lastbuffer->Last()));
|
||||
|
||||
(*par)->ParFromPos(pos)->next(buf);
|
||||
buf->previous((*par)->ParFromPos(pos));
|
||||
|
||||
if ((*par)->ParFromPos(pos)->next() == lastbuffer)
|
||||
lastbuffer = *par;
|
||||
|
||||
(*par)->ParFromPos(pos)->PasteParagraph(current_view->buffer()->params);
|
||||
// store the new cursor position
|
||||
*par = lastbuffer;
|
||||
pos = lastbuffer->Last();
|
||||
// maybe some pasting
|
||||
if (lastbuffer->next() && paste_the_end) {
|
||||
if (lastbuffer->next()->HasSameLayout(lastbuffer)) {
|
||||
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph(current_view->buffer()->params);
|
||||
} else if (!lastbuffer->next()->Last()) {
|
||||
lastbuffer->next()->MakeSameLayout(lastbuffer);
|
||||
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph(current_view->buffer()->params);
|
||||
} else if (!lastbuffer->Last()) {
|
||||
lastbuffer->MakeSameLayout(lastbuffer->next_);
|
||||
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph(current_view->buffer()->params);
|
||||
} else
|
||||
lastbuffer->next()->StripLeadingSpaces(tc);
|
||||
}
|
||||
// restore the simple cut buffer
|
||||
buf = simple_cut_clone;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar,
|
||||
int & pos, char tc)
|
||||
{
|
||||
@ -558,7 +297,6 @@ bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar,
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int CutAndPaste::nrOfParagraphs()
|
||||
@ -568,17 +306,10 @@ int CutAndPaste::nrOfParagraphs()
|
||||
|
||||
int n = 1;
|
||||
LyXParagraph * tmppar = buf;
|
||||
#ifndef NEW_INSETS
|
||||
while(tmppar->next_) {
|
||||
++n;
|
||||
tmppar = tmppar->next_;
|
||||
}
|
||||
#else
|
||||
while(tmppar->next()) {
|
||||
++n;
|
||||
tmppar = tmppar->next();
|
||||
}
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -590,9 +321,7 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1,
|
||||
int ret = 0;
|
||||
if (!par || c1 == c2)
|
||||
return ret;
|
||||
#ifndef NEW_INSETS
|
||||
par = par->FirstPhysicalPar();
|
||||
#endif
|
||||
|
||||
while (par) {
|
||||
string name = textclasslist.NameOfLayout(c1, par->layout);
|
||||
int lay = 0;
|
||||
@ -617,39 +346,15 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1,
|
||||
InsetError * new_inset = new InsetError(s);
|
||||
par->InsertInset(0, new_inset);
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
bool CutAndPaste::checkPastePossible(LyXParagraph * par)
|
||||
#else
|
||||
bool CutAndPaste::checkPastePossible(LyXParagraph *)
|
||||
#endif
|
||||
{
|
||||
if (!buf) return false;
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
// be carefull with footnotes in footnotes
|
||||
if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
|
||||
// check whether the cut_buffer includes a footnote
|
||||
LyXParagraph * tmppar = buf;
|
||||
while (tmppar && tmppar->footnoteflag == LyXParagraph::NO_FOOTNOTE)
|
||||
tmppar = tmppar->next_;
|
||||
|
||||
if (tmppar) {
|
||||
WriteAlert(_("Impossible operation"),
|
||||
_("Can't paste float into float!"),
|
||||
_("Sorry."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -20,10 +20,6 @@
|
||||
#include "lyxlex.h"
|
||||
#include "debug.h"
|
||||
#include "lyxlex.h"
|
||||
#if 1
|
||||
// only until we don't need access to the NEW_INSETS anymore
|
||||
#include "lyxparagraph.h"
|
||||
#endif
|
||||
|
||||
using std::endl;
|
||||
|
||||
@ -62,13 +58,9 @@ void ToolbarDefaults::init()
|
||||
add(LFUN_FREE);
|
||||
add(SEPARATOR);
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
add(LFUN_FOOTMELT);
|
||||
add(LFUN_MARGINMELT);
|
||||
#else
|
||||
add(LFUN_INSET_FOOTNOTE);
|
||||
add(LFUN_INSET_MARGINAL);
|
||||
#endif
|
||||
|
||||
add(LFUN_DEPTH);
|
||||
add(SEPARATOR);
|
||||
|
||||
|
374
src/buffer.C
374
src/buffer.C
@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "buffer.h"
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "buffer.h"
|
||||
@ -165,19 +165,11 @@ Buffer::~Buffer()
|
||||
|
||||
LyXParagraph * par = paragraph;
|
||||
LyXParagraph * tmppar;
|
||||
#ifndef NEW_INSETS
|
||||
while (par) {
|
||||
tmppar = par->next_;
|
||||
delete par;
|
||||
par = tmppar;
|
||||
}
|
||||
#else
|
||||
while (par) {
|
||||
tmppar = par->next();
|
||||
delete par;
|
||||
par = tmppar;
|
||||
}
|
||||
#endif
|
||||
paragraph = 0;
|
||||
}
|
||||
|
||||
@ -294,10 +286,6 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
{
|
||||
int pos = 0;
|
||||
char depth = 0; // signed or unsigned?
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
|
||||
#endif
|
||||
bool the_end_read = false;
|
||||
|
||||
LyXParagraph * return_par = 0;
|
||||
@ -341,10 +329,6 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
parseSingleLyXformat2Token(lex, par, return_par,
|
||||
pretoken, pos, depth,
|
||||
font
|
||||
#ifndef NEW_INSETS
|
||||
, footnoteflag,
|
||||
footnotekind
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
@ -370,20 +354,14 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
LyXParagraph *& return_par,
|
||||
string const & token, int & pos,
|
||||
char & depth, LyXFont & font
|
||||
#ifndef NEW_INSETS
|
||||
, LyXParagraph::footnote_flag & footnoteflag,
|
||||
LyXParagraph::footnote_kind & footnotekind
|
||||
#endif
|
||||
)
|
||||
{
|
||||
bool the_end_read = false;
|
||||
#ifndef NO_PEXTRA_REALLY
|
||||
#ifdef NEW_INSETS
|
||||
// This is super temporary but is needed to get the compability
|
||||
// mode for minipages work correctly together with new tabulars.
|
||||
static int call_depth = 0;
|
||||
++call_depth;
|
||||
#endif
|
||||
bool checkminipage = false;
|
||||
static LyXParagraph * minipar = 0;
|
||||
static LyXParagraph * parBeforeMinipage = 0;
|
||||
@ -403,40 +381,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
} else if (token == "\\layout") {
|
||||
#ifndef NEW_INSETS
|
||||
if (!return_par)
|
||||
return_par = par;
|
||||
else {
|
||||
par->fitToSize();
|
||||
par = new LyXParagraph(par);
|
||||
}
|
||||
pos = 0;
|
||||
lex.EatLine();
|
||||
string const layoutname = lex.GetString();
|
||||
pair<bool, LyXTextClass::LayoutList::size_type> pp
|
||||
= textclasslist.NumberOfLayout(params.textclass,
|
||||
layoutname);
|
||||
if (pp.first) {
|
||||
par->layout = pp.second;
|
||||
} else { // layout not found
|
||||
// use default layout "Standard" (0)
|
||||
par->layout = 0;
|
||||
}
|
||||
// Test whether the layout is obsolete.
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(params.textclass,
|
||||
par->layout);
|
||||
if (!layout.obsoleted_by().empty())
|
||||
par->layout =
|
||||
textclasslist.NumberOfLayout(params.textclass,
|
||||
layout.obsoleted_by()).second;
|
||||
par->footnoteflag = footnoteflag;
|
||||
par->footnotekind = footnotekind;
|
||||
par->params.depth(depth);
|
||||
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
||||
if (file_format < 216 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
#else
|
||||
lex.EatLine();
|
||||
string const layoutname = lex.GetString();
|
||||
pair<bool, LyXTextClass::LayoutList::size_type> pp
|
||||
@ -527,34 +471,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
#if USE_CAPTION
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NEW_INSETS
|
||||
} else if (token == "\\end_float") {
|
||||
if (!return_par)
|
||||
return_par = par;
|
||||
else {
|
||||
par->fitToSize();
|
||||
par = new LyXParagraph(par);
|
||||
}
|
||||
footnotekind = LyXParagraph::FOOTNOTE;
|
||||
footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
pos = 0;
|
||||
lex.EatLine();
|
||||
par->layout = LYX_DUMMY_LAYOUT;
|
||||
font = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
||||
if (file_format < 216 && params.language->lang() == "hebrew")
|
||||
font.setLanguage(default_language);
|
||||
} else if (token == "\\begin_float") {
|
||||
int tmpret = lex.FindToken(string_footnotekinds);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
if (tmpret != LYX_LAYOUT_DEFAULT)
|
||||
footnotekind = static_cast<LyXParagraph::footnote_kind>(tmpret); // bad
|
||||
if (footnotekind == LyXParagraph::FOOTNOTE
|
||||
|| footnotekind == LyXParagraph::MARGIN)
|
||||
footnoteflag = LyXParagraph::CLOSED_FOOTNOTE;
|
||||
else
|
||||
footnoteflag = LyXParagraph::OPEN_FOOTNOTE;
|
||||
#else
|
||||
|
||||
} else if (token == "\\begin_float") {
|
||||
// This is the compability reader. It can be removed in
|
||||
// LyX version 1.3.0. (Lgb)
|
||||
@ -628,7 +545,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
inset->Read(this, nylex);
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
#endif
|
||||
} else if (token == "\\begin_deeper") {
|
||||
++depth;
|
||||
} else if (token == "\\end_deeper") {
|
||||
@ -1586,9 +1502,6 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
|
||||
LyXFont font2;
|
||||
Inset const * inset;
|
||||
char c;
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
#endif
|
||||
char depth = 0;
|
||||
int ltype = 0;
|
||||
int ltype_depth = 0;
|
||||
@ -1597,29 +1510,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
|
||||
|
||||
int noparbreak = 0;
|
||||
int islatex = 0;
|
||||
#ifndef NEW_INSETS
|
||||
if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE ||
|
||||
!par->previous_
|
||||
|| par->previous()->footnoteflag == LyXParagraph::NO_FOOTNOTE) {
|
||||
/* begins a footnote environment ? */
|
||||
if (footnoteflag != par->footnoteflag) {
|
||||
footnoteflag = par->footnoteflag;
|
||||
if (footnoteflag) {
|
||||
size_t const j = strlen(string_footnotekinds[par->footnotekind]) + 4;
|
||||
if ((linelen > 0) &&
|
||||
((currlinelen + j) > linelen)) {
|
||||
buffer << "\n";
|
||||
currlinelen = 0;
|
||||
}
|
||||
buffer << "(["
|
||||
<< string_footnotekinds[par->footnotekind]
|
||||
<< "] ";
|
||||
currlinelen += j;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!par->previous()) {
|
||||
#endif
|
||||
if (!par->previous()) {
|
||||
/* begins or ends a deeper area ?*/
|
||||
if (depth != par->params.depth()) {
|
||||
if (par->params.depth() > depth) {
|
||||
@ -1673,23 +1564,12 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
|
||||
|
||||
/* what about the alignment */
|
||||
} else {
|
||||
#ifndef NEW_INSETS
|
||||
/* dummy layout, that means a footnote ended */
|
||||
footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
buffer << ") ";
|
||||
noparbreak = 1;
|
||||
#else
|
||||
lyxerr << "Should this ever happen?" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
font1 = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
||||
for (LyXParagraph::size_type i = 0; i < par->size(); ++i) {
|
||||
if (!i &&
|
||||
#ifndef NEW_INSETS
|
||||
!footnoteflag &&
|
||||
#endif
|
||||
!noparbreak) {
|
||||
if (!i && !noparbreak) {
|
||||
if (linelen > 0)
|
||||
buffer << "\n\n";
|
||||
for (char j = 0; j < depth; ++j)
|
||||
@ -2338,11 +2218,6 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
|
||||
|
||||
// if only_body
|
||||
while (par != endpar) {
|
||||
#ifndef NEW_INSETS
|
||||
if (par->IsDummy())
|
||||
lyxerr[Debug::LATEX] << "Error in latexParagraphs."
|
||||
<< endl;
|
||||
#endif
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(params.textclass,
|
||||
par->layout);
|
||||
@ -2364,23 +2239,10 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
|
||||
// ordinary \footnote{} generation
|
||||
// flag this with ftcount
|
||||
ftcount = -1;
|
||||
if (layout.isEnvironment()
|
||||
#ifndef NEW_INSETS
|
||||
|| par->params.pextraType() != LyXParagraph::PEXTRA_NONE
|
||||
#endif
|
||||
) {
|
||||
par = par->TeXEnvironment(this, params, ofs, texrow
|
||||
#ifndef NEW_INSETS
|
||||
,ftnote, ft_texrow, ftcount
|
||||
#endif
|
||||
);
|
||||
if (layout.isEnvironment()) {
|
||||
par = par->TeXEnvironment(this, params, ofs, texrow);
|
||||
} else {
|
||||
par = par->TeXOnePar(this, params, ofs, texrow, false
|
||||
#ifndef NEW_INSETS
|
||||
,
|
||||
ftnote, ft_texrow, ftcount
|
||||
#endif
|
||||
);
|
||||
par = par->TeXOnePar(this, params, ofs, texrow, false);
|
||||
}
|
||||
|
||||
// Write out what we've generated...
|
||||
@ -2518,12 +2380,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
string const temp = "toc";
|
||||
sgmlOpenTag(ofs, depth, temp);
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
linuxDocHandleFootnote(ofs, par, depth);
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -2605,19 +2462,9 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
do {
|
||||
SimpleLinuxDocOnePar(ofs, par, depth);
|
||||
|
||||
par = par->next_;
|
||||
linuxDocHandleFootnote(ofs, par, depth);
|
||||
}
|
||||
while(par && par->IsDummy());
|
||||
#else
|
||||
SimpleLinuxDocOnePar(ofs, par, depth);
|
||||
|
||||
par = par->next();
|
||||
#endif
|
||||
|
||||
ofs << "\n";
|
||||
// write closing SGML tags
|
||||
@ -2649,39 +2496,16 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
void Buffer::linuxDocHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
int depth)
|
||||
{
|
||||
string const tag = "footnote";
|
||||
|
||||
while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
|
||||
sgmlOpenTag(os, depth + 1, tag);
|
||||
SimpleLinuxDocOnePar(os, par, 0, depth + 1);
|
||||
sgmlCloseTag(os, depth + 1, tag);
|
||||
par = par->next_;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag,
|
||||
int depth, int desc_on,
|
||||
LyXParagraph * & par)
|
||||
{
|
||||
LyXParagraph * tpar = par;
|
||||
#ifndef NEW_INSETS
|
||||
while (tpar
|
||||
&& (tpar->footnoteflag != LyXParagraph::NO_FOOTNOTE)
|
||||
&& (tpar->layout != textclasslist.NumberOfLayout(params.textclass,
|
||||
"Caption").second))
|
||||
tpar = tpar->next_;
|
||||
#else
|
||||
while (tpar
|
||||
&& (tpar->layout != textclasslist.NumberOfLayout(params.textclass,
|
||||
"Caption").second))
|
||||
tpar = tpar->next();
|
||||
#endif
|
||||
|
||||
if (tpar &&
|
||||
tpar->layout == textclasslist.NumberOfLayout(params.textclass,
|
||||
"Caption").second) {
|
||||
@ -2696,106 +2520,6 @@ void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag,
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
int depth)
|
||||
{
|
||||
string tag, inner_tag;
|
||||
string tmp_par, extra_par;
|
||||
bool inner_span = false;
|
||||
int desc_on = 4;
|
||||
|
||||
// Someone should give this enum a proper name (Lgb)
|
||||
enum SOME_ENUM {
|
||||
NO_ONE,
|
||||
FOOTNOTE_LIKE,
|
||||
MARGIN_LIKE,
|
||||
FIG_LIKE,
|
||||
TAB_LIKE
|
||||
};
|
||||
SOME_ENUM last = NO_ONE;
|
||||
SOME_ENUM present = FOOTNOTE_LIKE;
|
||||
|
||||
while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
|
||||
if (last == present) {
|
||||
if (inner_span) {
|
||||
if (!tmp_par.empty()) {
|
||||
os << tmp_par;
|
||||
tmp_par.erase();
|
||||
sgmlCloseTag(os, depth + 1, inner_tag);
|
||||
sgmlOpenTag(os, depth + 1, inner_tag);
|
||||
}
|
||||
} else {
|
||||
os << "\n";
|
||||
}
|
||||
} else {
|
||||
os << tmp_par;
|
||||
if (!inner_tag.empty()) sgmlCloseTag(os, depth + 1,
|
||||
inner_tag);
|
||||
if (!extra_par.empty()) os << extra_par;
|
||||
if (!tag.empty()) sgmlCloseTag(os, depth, tag);
|
||||
extra_par.erase();
|
||||
|
||||
switch (par->footnotekind) {
|
||||
case LyXParagraph::FOOTNOTE:
|
||||
case LyXParagraph::ALGORITHM:
|
||||
tag = "footnote";
|
||||
inner_tag = "para";
|
||||
present = FOOTNOTE_LIKE;
|
||||
inner_span = true;
|
||||
break;
|
||||
case LyXParagraph::MARGIN:
|
||||
tag = "sidebar";
|
||||
inner_tag = "para";
|
||||
present = MARGIN_LIKE;
|
||||
inner_span = true;
|
||||
break;
|
||||
case LyXParagraph::FIG:
|
||||
case LyXParagraph::WIDE_FIG:
|
||||
tag = "figure";
|
||||
inner_tag = "title";
|
||||
present = FIG_LIKE;
|
||||
inner_span = false;
|
||||
break;
|
||||
case LyXParagraph::TAB:
|
||||
case LyXParagraph::WIDE_TAB:
|
||||
tag = "table";
|
||||
inner_tag = "title";
|
||||
present = TAB_LIKE;
|
||||
inner_span = false;
|
||||
break;
|
||||
}
|
||||
sgmlOpenTag(os, depth, tag);
|
||||
if ((present == TAB_LIKE) || (present == FIG_LIKE)) {
|
||||
DocBookHandleCaption(os, inner_tag, depth,
|
||||
desc_on, par);
|
||||
inner_tag.erase();
|
||||
} else {
|
||||
sgmlOpenTag(os, depth + 1, inner_tag);
|
||||
}
|
||||
}
|
||||
// ignore all caption here, we processed them above!!!
|
||||
if (par->layout != textclasslist
|
||||
.NumberOfLayout(params.textclass,
|
||||
"Caption").second) {
|
||||
std::ostringstream ost;
|
||||
SimpleDocBookOnePar(ost, extra_par, par,
|
||||
desc_on, depth + 2);
|
||||
tmp_par += ost.str().c_str();
|
||||
}
|
||||
tmp_par = frontStrip(strip(tmp_par));
|
||||
|
||||
last = present;
|
||||
par = par->next_;
|
||||
}
|
||||
os << tmp_par;
|
||||
if (!inner_tag.empty()) sgmlCloseTag(os, depth + 1, inner_tag);
|
||||
if (!extra_par.empty()) os << extra_par;
|
||||
if (!tag.empty()) sgmlCloseTag(os, depth, tag);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// checks, if newcol chars should be put into this line
|
||||
// writes newline, if necessary.
|
||||
namespace {
|
||||
@ -3289,21 +3013,11 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
do {
|
||||
string extra_par;
|
||||
SimpleDocBookOnePar(ofs, extra_par, par, desc_on,
|
||||
depth + 1 + command_depth);
|
||||
par = par->next_;
|
||||
DocBookHandleFootnote(ofs, par,
|
||||
depth + 1 + command_depth);
|
||||
} while(par && par->IsDummy());
|
||||
#else
|
||||
string extra_par;
|
||||
SimpleDocBookOnePar(ofs, extra_par, par, desc_on,
|
||||
depth + 1 + command_depth);
|
||||
par = par->next();
|
||||
#endif
|
||||
|
||||
string end_tag;
|
||||
// write closing SGML tags
|
||||
switch (style.latextype) {
|
||||
@ -3536,11 +3250,7 @@ void Buffer::validate(LaTeXFeatures & features) const
|
||||
par->validate(features);
|
||||
|
||||
// and then the next paragraph
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
|
||||
// the bullet shapes are buffer level not paragraph level
|
||||
@ -3646,45 +3356,12 @@ Buffer::Lists const Buffer::getLists() const
|
||||
{
|
||||
Lists l;
|
||||
LyXParagraph * par = paragraph;
|
||||
#ifdef NEW_INSETS
|
||||
bool found;
|
||||
LyXTextClassList::size_type cap;
|
||||
boost::tie(found, cap) = textclasslist
|
||||
.NumberOfLayout(params.textclass, "Caption");
|
||||
#endif
|
||||
|
||||
while (par) {
|
||||
#ifndef NEW_INSETS
|
||||
if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
|
||||
if (textclasslist.Style(params.textclass,
|
||||
par->GetLayout()).labeltype
|
||||
== LABEL_SENSITIVE) {
|
||||
string type;
|
||||
switch (par->footnotekind) {
|
||||
case LyXParagraph::FIG:
|
||||
case LyXParagraph::WIDE_FIG:
|
||||
type = "LOF";
|
||||
break;
|
||||
case LyXParagraph::TAB:
|
||||
case LyXParagraph::WIDE_TAB:
|
||||
type = "LOT";
|
||||
break;
|
||||
case LyXParagraph::ALGORITHM:
|
||||
type = "LOA";
|
||||
break;
|
||||
case LyXParagraph::FOOTNOTE:
|
||||
case LyXParagraph::MARGIN:
|
||||
break;
|
||||
}
|
||||
if (!type.empty()) {
|
||||
SingleList & item = l[type];
|
||||
string const str =
|
||||
tostr(item.size()+1) + ". " + par->String(this, false);
|
||||
item.push_back(TocItem(par, 0, str));
|
||||
}
|
||||
}
|
||||
} else if (!par->IsDummy()) {
|
||||
#endif
|
||||
char const labeltype =
|
||||
textclasslist.Style(params.textclass,
|
||||
par->GetLayout()).labeltype;
|
||||
@ -3698,7 +3375,6 @@ Buffer::Lists const Buffer::getLists() const
|
||||
textclasslist.TextClass(params.textclass).maxcounter());
|
||||
item.push_back(TocItem(par, depth, par->String(this, true)));
|
||||
}
|
||||
#ifdef NEW_INSETS
|
||||
// For each paragrph, traverse its insets and look for
|
||||
// FLOAT_CODE
|
||||
|
||||
@ -3734,13 +3410,7 @@ Buffer::Lists const Buffer::getLists() const
|
||||
lyxerr << "caption not found" << endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifndef NEW_INSETS
|
||||
}
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
return l;
|
||||
}
|
||||
@ -3763,11 +3433,7 @@ vector<pair<string, string> > const Buffer::getBibkeyList()
|
||||
if (par->bibkey)
|
||||
keys.push_back(pair<string, string>(par->bibkey->getContents(),
|
||||
par->String(this, false)));
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Might be either using bibtex or a child has bibliography
|
||||
@ -3862,15 +3528,9 @@ void Buffer::resizeInsets(BufferView * bv)
|
||||
{
|
||||
/// then remove all LyXText in text-insets
|
||||
LyXParagraph * par = paragraph;
|
||||
#ifndef NEW_INSETS
|
||||
for (; par; par = par->next_) {
|
||||
par->resizeInsetsLyXText(bv);
|
||||
}
|
||||
#else
|
||||
for (; par; par = par->next()) {
|
||||
par->resizeInsetsLyXText(bv);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -3880,11 +3540,7 @@ void Buffer::ChangeLanguage(Language const * from, Language const * to)
|
||||
LyXParagraph * par = paragraph;
|
||||
while (par) {
|
||||
par->ChangeLanguage(params, from, to);
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -3895,11 +3551,7 @@ bool Buffer::isMultiLingual()
|
||||
while (par) {
|
||||
if (par->isMultiLingual(params))
|
||||
return true;
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -3911,11 +3563,7 @@ Buffer::inset_iterator::inset_iterator(LyXParagraph * paragraph,
|
||||
{
|
||||
it = par->InsetIterator(pos);
|
||||
if (it == par->inset_iterator_end()) {
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
SetParagraph();
|
||||
}
|
||||
}
|
||||
@ -3927,11 +3575,7 @@ void Buffer::inset_iterator::SetParagraph()
|
||||
it = par->inset_iterator_begin();
|
||||
if (it != par->inset_iterator_end())
|
||||
return;
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
//it = 0;
|
||||
// We maintain an invariant that whenever par = 0 then it = 0
|
||||
|
25
src/buffer.h
25
src/buffer.h
@ -132,12 +132,7 @@ public:
|
||||
bool parseSingleLyXformat2Token(LyXLex &, LyXParagraph *& par,
|
||||
LyXParagraph *& return_par,
|
||||
string const & token, int & pos,
|
||||
char & depth, LyXFont &
|
||||
#ifndef NEW_INSETS
|
||||
,LyXParagraph::footnote_flag &,
|
||||
LyXParagraph::footnote_kind &
|
||||
#endif
|
||||
);
|
||||
char & depth, LyXFont &);
|
||||
private:
|
||||
/// Parse a single inset.
|
||||
void readInset(LyXLex &, LyXParagraph *& par, int & pos, LyXFont &);
|
||||
@ -324,20 +319,10 @@ public:
|
||||
/// Used when typesetting to place errorboxes.
|
||||
TexRow texrow;
|
||||
private:
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
void linuxDocHandleFootnote(std::ostream & os,
|
||||
LyXParagraph * & par, int depth);
|
||||
#endif
|
||||
///
|
||||
void DocBookHandleCaption(std::ostream & os, string & inner_tag,
|
||||
int depth, int desc_on,
|
||||
LyXParagraph * & par);
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
void DocBookHandleFootnote(std::ostream & os,
|
||||
LyXParagraph * & par, int depth);
|
||||
#endif
|
||||
/// Open SGML/XML tag.
|
||||
void sgmlOpenTag(std::ostream & os, int depth,
|
||||
string const & latexname) const;
|
||||
@ -404,11 +389,7 @@ public:
|
||||
if (par) {
|
||||
++it;
|
||||
if (it == par->inset_iterator_end()) {
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
SetParagraph();
|
||||
}
|
||||
}
|
||||
@ -420,11 +401,7 @@ public:
|
||||
if (par) {
|
||||
++it;
|
||||
if (it == par->inset_iterator_end()) {
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
SetParagraph();
|
||||
}
|
||||
}
|
||||
|
@ -27,21 +27,6 @@
|
||||
#include "language.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
void Foot(BufferView * bv)
|
||||
{
|
||||
if (!bv->available())
|
||||
return;
|
||||
|
||||
bv->owner()->getMiniBuffer()
|
||||
->Set(_("Inserting Footnote..."));
|
||||
bv->hideCursor();
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
bv->text->InsertFootnoteEnvironment(bv, LyXParagraph::FOOTNOTE);
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Emph(BufferView * bv)
|
||||
{
|
||||
@ -67,19 +52,6 @@ void Noun(BufferView * bv)
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
void Margin(BufferView * bv)
|
||||
{
|
||||
if (bv->available()) {
|
||||
bv->owner()->message(_("Inserting margin note...");
|
||||
bv->hideCursor();
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
bv->text->InsertFootnoteEnvironment(bv, LyXParagraph::MARGIN);
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Number(BufferView * bv)
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
@ -99,21 +71,6 @@ void Lang(BufferView * bv, string const & l)
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
void Melt(BufferView * bv)
|
||||
{
|
||||
if (!bv->available()) return;
|
||||
|
||||
bv->owner()->message(_("Melt"));
|
||||
bv->hideCursor();
|
||||
bv->beforeChange(bv->text);
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
bv->text->MeltFootnoteEnvironment(bv);
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Tex(BufferView * bv)
|
||||
{
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
|
@ -22,20 +22,12 @@ class BufferView;
|
||||
class LyXFont;
|
||||
class LyXText;
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
extern void Foot(BufferView *);
|
||||
#endif
|
||||
///
|
||||
extern void Emph(BufferView *);
|
||||
///
|
||||
extern void Bold(BufferView *);
|
||||
///
|
||||
extern void Noun(BufferView *);
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
extern void Margin(BufferView *);
|
||||
#endif
|
||||
///
|
||||
extern void Figure();
|
||||
///
|
||||
@ -44,10 +36,6 @@ extern void Table();
|
||||
extern void Lang(BufferView *, string const &);
|
||||
///
|
||||
extern void Number(BufferView *);
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
extern void Melt(BufferView *);
|
||||
#endif
|
||||
///
|
||||
extern void Tex(BufferView *);
|
||||
///
|
||||
|
@ -69,11 +69,7 @@ void FigureApplyCB(FL_OBJECT *, long)
|
||||
current_view->text->BreakParagraph(current_view);
|
||||
current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
if (current_view->text->cursor.par()->Last()) {
|
||||
#else
|
||||
if (current_view->text->cursor.par()->size()) {
|
||||
#endif
|
||||
current_view->text->CursorLeft(current_view);
|
||||
|
||||
current_view->text->BreakParagraph(current_view);
|
||||
@ -83,10 +79,6 @@ void FigureApplyCB(FL_OBJECT *, long)
|
||||
// The standard layout should always be numer 0;
|
||||
current_view->text->SetLayout(current_view, 0);
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
if (current_view->text->cursor.par()->footnoteflag ==
|
||||
LyXParagraph::NO_FOOTNOTE) {
|
||||
#endif
|
||||
current_view->text->
|
||||
SetParagraph(current_view, 0, 0,
|
||||
0, 0,
|
||||
@ -96,17 +88,6 @@ void FigureApplyCB(FL_OBJECT *, long)
|
||||
buffer->params.spacing.getValue(),
|
||||
LyXLength::CM),
|
||||
LYX_ALIGN_CENTER, string(), 0);
|
||||
#ifndef NEW_INSETS
|
||||
} else {
|
||||
current_view->text->SetParagraph(current_view, 0, 0,
|
||||
0, 0,
|
||||
VSpace(VSpace::NONE),
|
||||
VSpace(VSpace::NONE),
|
||||
LYX_ALIGN_CENTER,
|
||||
string(),
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
|
||||
current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* FormParagraph.[Ch]: remove !NO_PEXTRA and !NEW_INSETS cruft
|
||||
|
||||
2001-04-26 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* Dialogs.C: included insetgraphicsParams.h
|
||||
|
@ -25,13 +25,11 @@
|
||||
#include "buffer.h"
|
||||
#include "lyxtext.h"
|
||||
#include "xforms_helpers.h"
|
||||
#if 1
|
||||
#include "lyxparagraph.h"
|
||||
#endif
|
||||
|
||||
using Liason::setMinibuffer;
|
||||
using SigC::slot;
|
||||
|
||||
|
||||
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
|
||||
: FormBaseBD(lv, d, _("Paragraph Layout"))
|
||||
{
|
||||
@ -104,25 +102,8 @@ void FormParagraph::build()
|
||||
bc_.addReadOnly (general_->check_noindent);
|
||||
bc_.addReadOnly (general_->input_labelwidth);
|
||||
|
||||
#ifndef NO_PEXTRA
|
||||
// the document class form
|
||||
extra_.reset(build_paragraph_extra());
|
||||
|
||||
fl_set_input_return(extra_->input_pextra_width, FL_RETURN_CHANGED);
|
||||
fl_set_input_return(extra_->input_pextra_widthp, FL_RETURN_CHANGED);
|
||||
|
||||
bc_.addReadOnly (extra_->radio_pextra_indent);
|
||||
bc_.addReadOnly (extra_->radio_pextra_minipage);
|
||||
bc_.addReadOnly (extra_->radio_pextra_floatflt);
|
||||
bc_.addReadOnly (extra_->radio_pextra_hfill);
|
||||
bc_.addReadOnly (extra_->radio_pextra_startmp);
|
||||
#endif
|
||||
|
||||
// now make them fit together
|
||||
fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form);
|
||||
#ifndef NO_PEXTRA
|
||||
fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"), extra_->form);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -132,9 +113,6 @@ void FormParagraph::apply()
|
||||
return;
|
||||
|
||||
general_apply();
|
||||
#ifndef NO_PEXTRA
|
||||
extra_apply();
|
||||
#endif
|
||||
|
||||
lv_->view()->update(lv_->view()->text,
|
||||
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
||||
@ -149,9 +127,7 @@ void FormParagraph::update()
|
||||
return;
|
||||
|
||||
general_update();
|
||||
#ifndef NO_PEXTRA
|
||||
extra_update();
|
||||
#endif
|
||||
|
||||
bc_.readOnly(lv_->buffer()->isReadonly());
|
||||
}
|
||||
|
||||
@ -257,40 +233,6 @@ void FormParagraph::general_apply()
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_PEXTRA
|
||||
void FormParagraph::extra_apply()
|
||||
{
|
||||
char const * width = fl_get_input(extra_->input_pextra_width);
|
||||
char const * widthp = fl_get_input(extra_->input_pextra_widthp);
|
||||
LyXText * text = lv_->view()->text;
|
||||
int type = LyXParagraph::PEXTRA_NONE;
|
||||
LyXParagraph::MINIPAGE_ALIGNMENT
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
|
||||
bool
|
||||
hfill = false,
|
||||
start_minipage = false;
|
||||
|
||||
if (fl_get_button(extra_->radio_pextra_indent)) {
|
||||
type = LyXParagraph::PEXTRA_INDENT;
|
||||
} else if (fl_get_button(extra_->radio_pextra_minipage)) {
|
||||
type = LyXParagraph::PEXTRA_MINIPAGE;
|
||||
hfill = fl_get_button(extra_->radio_pextra_hfill);
|
||||
start_minipage = fl_get_button(extra_->radio_pextra_startmp);
|
||||
if (fl_get_button(extra_->radio_pextra_top))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
|
||||
else if (fl_get_button(extra_->radio_pextra_middle))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
|
||||
else if (fl_get_button(extra_->radio_pextra_bottom))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
|
||||
} else if (fl_get_button(extra_->radio_pextra_floatflt)) {
|
||||
type = LyXParagraph::PEXTRA_FLOATFLT;
|
||||
}
|
||||
text->SetParagraphExtraOpt(lv_->view(), type, width, widthp, alignment,
|
||||
hfill, start_minipage);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void FormParagraph::general_update()
|
||||
{
|
||||
if (!general_.get())
|
||||
@ -331,21 +273,6 @@ void FormParagraph::general_update()
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
fl_set_button(general_->check_lines_top,
|
||||
text->cursor.par()->FirstPhysicalPar()->params.lineTop());
|
||||
|
||||
fl_set_button(general_->check_lines_bottom,
|
||||
text->cursor.par()->FirstPhysicalPar()->params.lineBottom());
|
||||
|
||||
fl_set_button(general_->check_pagebreaks_top,
|
||||
text->cursor.par()->FirstPhysicalPar()->params.pagebreakTop());
|
||||
|
||||
fl_set_button(general_->check_pagebreaks_bottom,
|
||||
text->cursor.par()->FirstPhysicalPar()->params.pagebreakBottom());
|
||||
fl_set_button(general_->check_noindent,
|
||||
text->cursor.par()->FirstPhysicalPar()->params.noindent());
|
||||
#else
|
||||
fl_set_button(general_->check_lines_top,
|
||||
text->cursor.par()->params.lineTop());
|
||||
fl_set_button(general_->check_lines_bottom,
|
||||
@ -356,15 +283,10 @@ void FormParagraph::general_update()
|
||||
text->cursor.par()->params.pagebreakBottom());
|
||||
fl_set_button(general_->check_noindent,
|
||||
text->cursor.par()->params.noindent());
|
||||
#endif
|
||||
|
||||
fl_set_input (general_->input_space_above, "");
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
switch (text->cursor.par()->FirstPhysicalPar()->params.spaceTop().kind()) {
|
||||
#else
|
||||
switch (text->cursor.par()->params.spaceTop().kind()) {
|
||||
#endif
|
||||
|
||||
case VSpace::NONE:
|
||||
fl_set_choice (general_->choice_space_above, 1);
|
||||
break;
|
||||
@ -385,29 +307,16 @@ void FormParagraph::general_update()
|
||||
break;
|
||||
case VSpace::LENGTH:
|
||||
fl_set_choice (general_->choice_space_above, 7);
|
||||
#ifndef NEW_INSETS
|
||||
fl_set_input(general_->input_space_above,
|
||||
text->cursor.par()->FirstPhysicalPar()->
|
||||
params.spaceTop().length().asString().c_str());
|
||||
#else
|
||||
fl_set_input(general_->input_space_above, text->cursor.par()->
|
||||
params.spaceTop().length().asString().c_str());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
fl_set_button(general_->check_space_above,
|
||||
text->cursor.par()->FirstPhysicalPar()->
|
||||
params.spaceTop().keep());
|
||||
fl_set_input(general_->input_space_below, "");
|
||||
switch (text->cursor.par()->FirstPhysicalPar()->
|
||||
params.spaceBottom().kind()) {
|
||||
#else
|
||||
|
||||
fl_set_button (general_->check_space_above,
|
||||
text->cursor.par()->params.spaceTop().keep());
|
||||
fl_set_input (general_->input_space_below, "");
|
||||
|
||||
switch (text->cursor.par()->params.spaceBottom().kind()) {
|
||||
#endif
|
||||
case VSpace::NONE:
|
||||
fl_set_choice (general_->choice_space_below, 1);
|
||||
break;
|
||||
@ -428,29 +337,6 @@ void FormParagraph::general_update()
|
||||
break;
|
||||
case VSpace::LENGTH:
|
||||
fl_set_choice (general_->choice_space_below, 7);
|
||||
#ifndef NEW_INSETS
|
||||
fl_set_input(general_->input_space_below,
|
||||
text->cursor.par()->FirstPhysicalPar()->
|
||||
params.spaceBottom().length().asString().c_str());
|
||||
break;
|
||||
}
|
||||
fl_set_button(general_->check_space_below,
|
||||
text->cursor.par()->FirstPhysicalPar()->
|
||||
params.spaceBottom().keep());
|
||||
fl_set_button(general_->check_noindent,
|
||||
text->cursor.par()->FirstPhysicalPar()->params.noindent());
|
||||
|
||||
bool const enable = (!text->cursor.par()->FirstPhysicalPar()->InInset());
|
||||
|
||||
setEnabled(general_->check_pagebreaks_top, enable);
|
||||
setEnabled(general_->check_pagebreaks_bottom, enable);
|
||||
|
||||
if (!enable) {
|
||||
fl_set_button(general_->check_pagebreaks_top, 0);
|
||||
fl_set_button(general_->check_pagebreaks_bottom, 0);
|
||||
}
|
||||
|
||||
#else
|
||||
fl_set_input(general_->input_space_below, text->cursor.par()->
|
||||
params.spaceBottom().length().asString().c_str());
|
||||
break;
|
||||
@ -459,80 +345,9 @@ void FormParagraph::general_update()
|
||||
text->cursor.par()->params.spaceBottom().keep());
|
||||
fl_set_button(general_->check_noindent,
|
||||
text->cursor.par()->params.noindent());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_PEXTRA
|
||||
void FormParagraph::extra_update()
|
||||
{
|
||||
if (!lv_->view()->available() || !extra_.get())
|
||||
return;
|
||||
|
||||
LyXParagraph * par = lv_->view()->text->cursor.par();
|
||||
|
||||
setEnabled(extra_->input_pextra_width, true);
|
||||
setEnabled(extra_->input_pextra_widthp, true);
|
||||
|
||||
fl_set_input(extra_->input_pextra_width,
|
||||
par->params.pextraWidth().c_str());
|
||||
fl_set_input(extra_->input_pextra_widthp,
|
||||
par->params.pextraWidthp().c_str());
|
||||
switch (par->params.pextraAlignment()) {
|
||||
case LyXParagraph::MINIPAGE_ALIGN_TOP:
|
||||
fl_set_button(extra_->radio_pextra_top, 1);
|
||||
break;
|
||||
case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
|
||||
fl_set_button(extra_->radio_pextra_middle, 1);
|
||||
break;
|
||||
case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
|
||||
fl_set_button(extra_->radio_pextra_bottom, 1);
|
||||
break;
|
||||
}
|
||||
fl_set_button(extra_->radio_pextra_hfill,
|
||||
par->params.pextraHfill());
|
||||
fl_set_button(extra_->radio_pextra_startmp,
|
||||
par->params.pextraStartMinipage());
|
||||
if (par->params.pextraType() == LyXParagraph::PEXTRA_INDENT) {
|
||||
fl_set_button(extra_->radio_pextra_indent, 1);
|
||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 0);
|
||||
setEnabled(extra_->radio_pextra_top, false);
|
||||
setEnabled(extra_->radio_pextra_middle, false);
|
||||
setEnabled(extra_->radio_pextra_bottom, false);
|
||||
input(extra_->radio_pextra_indent, 0);
|
||||
} else if (par->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE) {
|
||||
fl_set_button(extra_->radio_pextra_indent, 0);
|
||||
fl_set_button(extra_->radio_pextra_minipage, 1);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 0);
|
||||
setEnabled(extra_->radio_pextra_top, true);
|
||||
setEnabled(extra_->radio_pextra_middle, true);
|
||||
setEnabled(extra_->radio_pextra_bottom, true);
|
||||
input(extra_->radio_pextra_minipage, 0);
|
||||
} else if (par->params.pextraType() == LyXParagraph::PEXTRA_FLOATFLT) {
|
||||
fl_set_button(extra_->radio_pextra_indent, 0);
|
||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 1);
|
||||
setEnabled(extra_->radio_pextra_top, false);
|
||||
setEnabled(extra_->radio_pextra_middle, false);
|
||||
setEnabled(extra_->radio_pextra_bottom, false);
|
||||
input(extra_->radio_pextra_floatflt, 0);
|
||||
} else {
|
||||
fl_set_button(extra_->radio_pextra_indent, 0);
|
||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 0);
|
||||
setEnabled(extra_->input_pextra_width, false);
|
||||
setEnabled(extra_->input_pextra_widthp, false);
|
||||
setEnabled(extra_->radio_pextra_top, false);
|
||||
setEnabled(extra_->radio_pextra_middle, false);
|
||||
setEnabled(extra_->radio_pextra_bottom, false);
|
||||
input(0, 0);
|
||||
}
|
||||
fl_hide_object(dialog_->text_warning);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool FormParagraph::input(FL_OBJECT * ob, long)
|
||||
{
|
||||
bool ret = true;
|
||||
@ -553,61 +368,6 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
|
||||
if (fl_get_choice (general_->choice_space_below) != 7)
|
||||
fl_set_input (general_->input_space_below, "");
|
||||
|
||||
#ifndef NO_PEXTRA
|
||||
//
|
||||
// then the extra form
|
||||
//
|
||||
if (ob == extra_->radio_pextra_indent) {
|
||||
bool const enable = (fl_get_button(extra_->radio_pextra_indent) != 0);
|
||||
|
||||
if (enable) {
|
||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 0);
|
||||
}
|
||||
|
||||
setEnabled(extra_->input_pextra_width, enable);
|
||||
setEnabled(extra_->input_pextra_widthp, enable);
|
||||
|
||||
setEnabled(extra_->radio_pextra_top, false);
|
||||
setEnabled(extra_->radio_pextra_middle, false);
|
||||
setEnabled(extra_->radio_pextra_bottom, false);
|
||||
setEnabled(extra_->radio_pextra_hfill, false);
|
||||
setEnabled(extra_->radio_pextra_startmp, false);
|
||||
|
||||
} else if (ob == extra_->radio_pextra_minipage) {
|
||||
bool const enable = (fl_get_button(extra_->radio_pextra_minipage) != 0);
|
||||
|
||||
if (enable) {
|
||||
fl_set_button(extra_->radio_pextra_indent, 0);
|
||||
fl_set_button(extra_->radio_pextra_floatflt, 0);
|
||||
}
|
||||
|
||||
setEnabled(extra_->input_pextra_width, enable);
|
||||
setEnabled(extra_->input_pextra_widthp, enable);
|
||||
setEnabled(extra_->radio_pextra_top, enable);
|
||||
setEnabled(extra_->radio_pextra_middle, enable);
|
||||
setEnabled(extra_->radio_pextra_bottom, enable);
|
||||
setEnabled(extra_->radio_pextra_hfill, enable);
|
||||
setEnabled(extra_->radio_pextra_startmp, enable);
|
||||
} else if (ob == extra_->radio_pextra_floatflt) {
|
||||
bool const enable = (fl_get_button(extra_->radio_pextra_floatflt) != 0);
|
||||
|
||||
if (enable) {
|
||||
fl_set_button(extra_->radio_pextra_indent, 0);
|
||||
fl_set_button(extra_->radio_pextra_minipage, 0);
|
||||
}
|
||||
|
||||
setEnabled(extra_->input_pextra_width, enable);
|
||||
setEnabled(extra_->input_pextra_widthp, enable);
|
||||
|
||||
setEnabled(extra_->radio_pextra_top, false);
|
||||
setEnabled(extra_->radio_pextra_middle, false);
|
||||
setEnabled(extra_->radio_pextra_bottom, false);
|
||||
setEnabled(extra_->radio_pextra_hfill, false);
|
||||
setEnabled(extra_->radio_pextra_startmp, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// first the general form
|
||||
//
|
||||
@ -634,44 +394,6 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_PEXTRA
|
||||
//
|
||||
// then the extra form
|
||||
//
|
||||
int n = fl_get_button(extra_->radio_pextra_indent) +
|
||||
fl_get_button(extra_->radio_pextra_minipage) +
|
||||
fl_get_button(extra_->radio_pextra_floatflt);
|
||||
string s1 = fl_get_input(extra_->input_pextra_width);
|
||||
string s2 = fl_get_input(extra_->input_pextra_widthp);
|
||||
if (!n) { // no button pressed both should be deactivated now
|
||||
setEnabled(extra_->input_pextra_width, false);
|
||||
setEnabled(extra_->input_pextra_widthp, false);
|
||||
fl_hide_object(dialog_->text_warning);
|
||||
} else if (s1.empty() && s2.empty()) {
|
||||
setEnabled(extra_->input_pextra_width, true);
|
||||
setEnabled(extra_->input_pextra_widthp, true);
|
||||
fl_hide_object(dialog_->text_warning);
|
||||
ret = false;
|
||||
} else if (!s1.empty()) { // LyXLength parameter
|
||||
setEnabled(extra_->input_pextra_width, true);
|
||||
setEnabled(extra_->input_pextra_widthp, false);
|
||||
if (!isValidLength(s1)) {
|
||||
fl_set_object_label(dialog_->text_warning,
|
||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
||||
fl_show_object(dialog_->text_warning);
|
||||
ret = false;
|
||||
}
|
||||
} else { // !s2.empty() % parameter
|
||||
setEnabled(extra_->input_pextra_width, false);
|
||||
setEnabled(extra_->input_pextra_widthp, true);
|
||||
if ((lyx::atoi(s2) < 0 ) || (lyx::atoi(s2) > 100)) {
|
||||
ret = false;
|
||||
fl_set_object_label(dialog_->text_warning,
|
||||
_("Warning: Invalid percent value (0-100)"));
|
||||
fl_show_object(dialog_->text_warning);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -20,9 +20,6 @@
|
||||
#endif
|
||||
|
||||
#include "FormBaseDeprecated.h"
|
||||
#if 1
|
||||
#include "lyxparagraph.h"
|
||||
#endif
|
||||
|
||||
struct FD_form_tabbed_paragraph;
|
||||
struct FD_form_paragraph_general;
|
||||
@ -55,32 +52,19 @@ private:
|
||||
|
||||
///
|
||||
void general_update();
|
||||
#ifndef NO_PEXTRA
|
||||
///
|
||||
void extra_update();
|
||||
#endif
|
||||
///
|
||||
void general_apply();
|
||||
#ifndef NO_PEXTRA
|
||||
///
|
||||
void extra_apply();
|
||||
#endif
|
||||
|
||||
/// Fdesign generated methods
|
||||
FD_form_tabbed_paragraph * build_tabbed_paragraph();
|
||||
///
|
||||
FD_form_paragraph_general * build_paragraph_general();
|
||||
//#ifndef NO_PEXTRA
|
||||
///
|
||||
FD_form_paragraph_extra * build_paragraph_extra();
|
||||
//#endif
|
||||
/// Real GUI implementation.
|
||||
boost::scoped_ptr<FD_form_tabbed_paragraph> dialog_;
|
||||
///
|
||||
boost::scoped_ptr<FD_form_paragraph_general> general_;
|
||||
#ifndef NO_PEXTRA
|
||||
///
|
||||
boost::scoped_ptr<FD_form_paragraph_extra> extra_;
|
||||
#endif
|
||||
/// The ButtonController
|
||||
ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC> bc_;
|
||||
};
|
||||
|
@ -1,3 +1,13 @@
|
||||
2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* insettext.C: remvoe !NEW_INSETS cruft
|
||||
|
||||
* insettabular.C: remove !NEW_INSETS cruft
|
||||
|
||||
* insetcollapsable.h: remove !NEW_INSETS cruft
|
||||
|
||||
* insetbib.C: remove !NEW_INSETS cruft
|
||||
|
||||
2001-04-27 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* insettoc.C: hack to make listof algorithm work
|
||||
|
@ -261,11 +261,7 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
|
||||
int const wx = par->bibkey->width(bv, font);
|
||||
if (wx > w) w = wx;
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
return w;
|
||||
}
|
||||
@ -290,11 +286,7 @@ string const bibitemWidest(Buffer const * buffer)
|
||||
bkey = par->bibkey;
|
||||
}
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
par = par->next_;
|
||||
#else
|
||||
par = par->next();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (bkey && !bkey->getBibLabel().empty())
|
||||
|
@ -21,9 +21,6 @@
|
||||
#include "insettext.h"
|
||||
#include "lyxfont.h"
|
||||
#include "LColor.h"
|
||||
#if 1 // NEW_INSETS
|
||||
#include "lyxparagraph.h"
|
||||
#endif
|
||||
|
||||
class Painter;
|
||||
class LyXText;
|
||||
@ -160,9 +157,7 @@ protected:
|
||||
LColor::color framecolor;
|
||||
///
|
||||
LyXFont labelfont;
|
||||
#ifdef NEW_INSETS
|
||||
public:
|
||||
#endif
|
||||
///
|
||||
InsetText inset;
|
||||
protected:
|
||||
|
@ -941,14 +941,8 @@ InsetTabular::LocalDispatch(BufferView * bv,
|
||||
if (!copySelection(bv))
|
||||
break;
|
||||
bv->text->SetUndo(bv->buffer(), Undo::DELETE,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
cutSelection();
|
||||
UpdateLocal(bv, INIT, true);
|
||||
break;
|
||||
@ -1027,14 +1021,8 @@ InsetTabular::LocalDispatch(BufferView * bv,
|
||||
case LFUN_PASTE:
|
||||
if (hasPasteBuffer()) {
|
||||
bv->text->SetUndo(bv->buffer(), Undo::INSERT,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
pasteSelection(bv);
|
||||
UpdateLocal(bv, INIT, true);
|
||||
break;
|
||||
@ -1558,14 +1546,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
|
||||
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
|
||||
}
|
||||
bv->text->SetUndo(bv->buffer(), Undo::FINISH,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
|
||||
int row = tabular->row_of_cell(actcell);
|
||||
int column = tabular->column_of_cell(actcell);
|
||||
|
@ -122,21 +122,12 @@ InsetText::~InsetText()
|
||||
delete (*cit).second;
|
||||
(*cit).second = 0;
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph * p = par->next_;
|
||||
delete par;
|
||||
while(p) {
|
||||
par = p;
|
||||
p = p->next_;
|
||||
delete par;
|
||||
}
|
||||
#else
|
||||
|
||||
while (par) {
|
||||
LyXParagraph * tmp = par->next();
|
||||
delete par;
|
||||
par = tmp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -148,21 +139,12 @@ void InsetText::clear()
|
||||
delete (*cit).second;
|
||||
(*cit).second = 0;
|
||||
}
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph * p = par->next_;
|
||||
delete par;
|
||||
while(p) {
|
||||
par = p;
|
||||
p = p->next_;
|
||||
delete par;
|
||||
}
|
||||
#else
|
||||
|
||||
while (par) {
|
||||
LyXParagraph * tmp = par->next();
|
||||
delete par;
|
||||
par = tmp;
|
||||
}
|
||||
#endif
|
||||
par = new LyXParagraph;
|
||||
}
|
||||
|
||||
@ -193,10 +175,6 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
|
||||
int pos = 0;
|
||||
LyXParagraph * return_par = 0;
|
||||
char depth = 0; // signed or unsigned?
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
|
||||
#endif
|
||||
LyXFont font(LyXFont::ALL_INHERIT);
|
||||
|
||||
// delete all instances of LyXText before deleting the paragraps used
|
||||
@ -206,21 +184,12 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
|
||||
(*cit).second = 0;
|
||||
}
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph * p = par->next_;
|
||||
delete par;
|
||||
while(p) {
|
||||
par = p;
|
||||
p = p->next_;
|
||||
delete par;
|
||||
}
|
||||
#else
|
||||
while (par) {
|
||||
LyXParagraph * tmp = par->next();
|
||||
delete par;
|
||||
par = tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
par = new LyXParagraph;
|
||||
while (lex.IsOK()) {
|
||||
lex.nextToken();
|
||||
@ -231,12 +200,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
|
||||
break;
|
||||
if (const_cast<Buffer*>(buf)->
|
||||
parseSingleLyXformat2Token(lex, par, return_par,
|
||||
token, pos, depth, font
|
||||
#ifndef NEW_INSETS
|
||||
, footnoteflag, footnotekind
|
||||
#endif
|
||||
))
|
||||
{
|
||||
token, pos, depth, font)) {
|
||||
// the_end read this should NEVER happen
|
||||
lex.printError("\\the_end read in inset! Error in document!");
|
||||
return;
|
||||
@ -247,11 +211,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
|
||||
par = return_par;
|
||||
while(return_par) {
|
||||
return_par->SetInsetOwner(this);
|
||||
#ifndef NEW_INSETS
|
||||
return_par = return_par->next_;
|
||||
#else
|
||||
return_par = return_par->next();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (token != "\\end_inset") {
|
||||
@ -578,12 +538,7 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
|
||||
|
||||
// If the inset is empty set the language of the current font to the
|
||||
// language to the surronding text.
|
||||
#ifndef NEW_INSETS
|
||||
if (par->Last() == 0 && !par->next_)
|
||||
#else
|
||||
if (par->size() == 0 && !par->next())
|
||||
#endif
|
||||
{
|
||||
if (par->size() == 0 && !par->next()) {
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLanguage(bv->getParentLanguage(this));
|
||||
SetFont(bv, font, false);
|
||||
@ -891,14 +846,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
* true (on). */
|
||||
|
||||
bv->text->SetUndo(bv->buffer(), Undo::INSERT,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
bv->setState();
|
||||
if (lyxrc.auto_region_delete) {
|
||||
if (TEXT(bv)->selection){
|
||||
@ -978,14 +927,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
break;
|
||||
case LFUN_BACKSPACE:
|
||||
bv->text->SetUndo(bv->buffer(), Undo::DELETE,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
if (TEXT(bv)->selection)
|
||||
TEXT(bv)->CutSelection(bv);
|
||||
else
|
||||
@ -994,14 +937,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
break;
|
||||
case LFUN_DELETE:
|
||||
bv->text->SetUndo(bv->buffer(), Undo::DELETE,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
if (TEXT(bv)->selection)
|
||||
TEXT(bv)->CutSelection(bv);
|
||||
else
|
||||
@ -1010,14 +947,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
break;
|
||||
case LFUN_CUT:
|
||||
bv->text->SetUndo(bv->buffer(), Undo::DELETE,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
TEXT(bv)->CutSelection(bv);
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
break;
|
||||
@ -1052,14 +983,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
}
|
||||
}
|
||||
bv->text->SetUndo(bv->buffer(), Undo::INSERT,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
TEXT(bv)->PasteSelection(bv);
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
break;
|
||||
@ -1079,14 +1004,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
if (!autoBreakRows)
|
||||
return DISPATCHED;
|
||||
bv->text->SetUndo(bv->buffer(), Undo::INSERT,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
TEXT(bv)->InsertChar(bv, LyXParagraph::META_NEWLINE);
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
break;
|
||||
@ -1184,12 +1103,7 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
|
||||
/// If the action has deleted all text in the inset, we need to change the
|
||||
// language to the language to the surronding text.
|
||||
#ifndef NEW_INSETS
|
||||
if (par->Last() == 0 && !par->next_)
|
||||
#else
|
||||
if (par->size() == 0 && !par->next())
|
||||
#endif
|
||||
{
|
||||
if (par->size() == 0 && !par->next()) {
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLanguage(bv->getParentLanguage(this));
|
||||
SetFont(bv, font, false);
|
||||
@ -1221,11 +1135,7 @@ int InsetText::Ascii(Buffer const * buf, ostream & os, int linelen) const
|
||||
tmp = buf->asciiParagraph(p, linelen);
|
||||
lines += countChar(tmp, '\n');
|
||||
os << tmp;
|
||||
#ifndef NEW_INSETS
|
||||
p = p->next();
|
||||
#else
|
||||
p = p->next();
|
||||
#endif
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
@ -1240,11 +1150,7 @@ int InsetText::DocBook(Buffer const * buf, ostream & os) const
|
||||
string tmp;
|
||||
while (p) {
|
||||
buf->SimpleDocBookOnePar(os,tmp,p,desc,0);
|
||||
#ifndef NEW_INSETS
|
||||
p = p->next_;
|
||||
#else
|
||||
p = p->next();
|
||||
#endif
|
||||
}
|
||||
|
||||
return lines;
|
||||
@ -1256,11 +1162,7 @@ void InsetText::Validate(LaTeXFeatures & features) const
|
||||
LyXParagraph * p = par;
|
||||
while(p) {
|
||||
p->validate(features);
|
||||
#ifndef NEW_INSETS
|
||||
p = p->next_;
|
||||
#else
|
||||
p = p->next();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1367,11 +1269,7 @@ UpdatableInset::RESULT
|
||||
InsetText::moveRightIntern(BufferView * bv, bool behind,
|
||||
bool activate_inset, bool selecting)
|
||||
{
|
||||
#ifndef NEW_INSETS
|
||||
if (!cpar(bv)->next_ && (cpos(bv) >= cpar(bv)->Last()))
|
||||
#else
|
||||
if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size()))
|
||||
#endif
|
||||
return FINISHED;
|
||||
if (activate_inset && checkAndActivateInset(bv, behind))
|
||||
return DISPATCHED;
|
||||
@ -1386,11 +1284,7 @@ UpdatableInset::RESULT
|
||||
InsetText::moveLeftIntern(BufferView * bv, bool behind,
|
||||
bool activate_inset, bool selecting)
|
||||
{
|
||||
#ifndef NEW_INSETS
|
||||
if (!cpar(bv)->previous_ && (cpos(bv) <= 0))
|
||||
#else
|
||||
if (!cpar(bv)->previous() && (cpos(bv) <= 0))
|
||||
#endif
|
||||
return FINISHED;
|
||||
TEXT(bv)->CursorLeft(bv);
|
||||
if (!selecting)
|
||||
@ -1429,14 +1323,8 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
|
||||
return false;
|
||||
}
|
||||
bv->text->SetUndo(bv->buffer(), Undo::INSERT,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
inset->setOwner(this);
|
||||
HideInsetCursor(bv);
|
||||
TEXT(bv)->InsertInset(bv, inset);
|
||||
@ -1498,14 +1386,8 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
|
||||
{
|
||||
if (TEXT(bv)->selection) {
|
||||
bv->text->SetUndo(bv->buffer(), Undo::EDIT,
|
||||
#ifndef NEW_INSETS
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous_,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next_
|
||||
#else
|
||||
bv->text->cursor.par()->previous(),
|
||||
bv->text->cursor.par()->next()
|
||||
#endif
|
||||
);
|
||||
bv->text->cursor.par()->next());
|
||||
}
|
||||
TEXT(bv)->SetFont(bv, font, toggleall);
|
||||
bv->fitCursor(TEXT(bv));
|
||||
@ -1594,28 +1476,6 @@ void InsetText::SetParagraphData(LyXParagraph * p)
|
||||
(*cit).second = 0;
|
||||
}
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph * np;
|
||||
if (par) {
|
||||
np = par->next_;
|
||||
delete par;
|
||||
while (np) {
|
||||
par = np;
|
||||
np = np->next_;
|
||||
delete par;
|
||||
}
|
||||
}
|
||||
par = p->Clone();
|
||||
par->SetInsetOwner(this);
|
||||
np = par;
|
||||
while (p->next_) {
|
||||
p = p->next_;
|
||||
np->next(p->Clone());
|
||||
np->next_->previous(np);
|
||||
np = np->next_;
|
||||
np->SetInsetOwner(this);
|
||||
}
|
||||
#else
|
||||
while (par) {
|
||||
LyXParagraph * tmp = par->next();
|
||||
delete par;
|
||||
@ -1632,7 +1492,7 @@ void InsetText::SetParagraphData(LyXParagraph * p)
|
||||
np = np->next();
|
||||
np->SetInsetOwner(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
need_update = INIT;
|
||||
}
|
||||
|
||||
@ -1754,26 +1614,16 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
|
||||
if (recursive) {
|
||||
/// then remove all LyXText in text-insets
|
||||
LyXParagraph * p = par;
|
||||
#ifndef NEW_INSETS
|
||||
for (; p; p = p->next_) {
|
||||
p->deleteInsetsLyXText(bv);
|
||||
}
|
||||
#else
|
||||
for (; p; p = p->next()) {
|
||||
p->deleteInsetsLyXText(bv);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetText::resizeLyXText(BufferView * bv) const
|
||||
{
|
||||
#ifndef NEW_INSETS
|
||||
if (!par->next_ && !par->size()) // resize not neccessary!
|
||||
#else
|
||||
if (!par->next() && !par->size()) // resize not neccessary!
|
||||
#endif
|
||||
return;
|
||||
if ((cache.find(bv) == cache.end()) || !cache[bv])
|
||||
return;
|
||||
@ -1835,15 +1685,9 @@ void InsetText::resizeLyXText(BufferView * bv) const
|
||||
/// then resize all LyXText in text-insets
|
||||
inset_x = cx(bv) - top_x + drawTextXOffset;
|
||||
inset_y = cy(bv) + drawTextYOffset;
|
||||
#ifndef NEW_INSETS
|
||||
for (LyXParagraph * p = par; p; p = p->next_) {
|
||||
p->resizeInsetsLyXText(bv);
|
||||
}
|
||||
#else
|
||||
for (LyXParagraph * p = par; p; p = p->next()) {
|
||||
p->resizeInsetsLyXText(bv);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
need_update = FULL;
|
||||
}
|
||||
@ -1851,13 +1695,8 @@ void InsetText::resizeLyXText(BufferView * bv) const
|
||||
|
||||
void InsetText::removeNewlines()
|
||||
{
|
||||
#ifndef NEW_INSETS
|
||||
for (LyXParagraph * p = par; p; p = p->next_) {
|
||||
for (int i = 0; i < p->Last(); ++i) {
|
||||
#else
|
||||
for (LyXParagraph * p = par; p; p = p->next()) {
|
||||
for (int i = 0; i < p->size(); ++i) {
|
||||
#endif
|
||||
if (p->GetChar(i) == LyXParagraph::META_NEWLINE)
|
||||
p->Erase(i);
|
||||
}
|
||||
|
30
src/lyx_cb.C
30
src/lyx_cb.C
@ -473,23 +473,13 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
|
||||
string label(arg);
|
||||
ProhibitInput(bv);
|
||||
if (label.empty()) {
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph * par =
|
||||
bv->text->cursor.par()->FirstPhysicalPar();
|
||||
#else
|
||||
LyXParagraph * par = bv->text->cursor.par();
|
||||
#endif
|
||||
LyXLayout const * layout =
|
||||
&textclasslist.Style(bv->buffer()->params.textclass,
|
||||
par->GetLayout());
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
if (layout->latextype == LATEX_PARAGRAPH && par->previous_) {
|
||||
LyXParagraph * par2 = par->previous_->FirstPhysicalPar();
|
||||
#else
|
||||
if (layout->latextype == LATEX_PARAGRAPH && par->previous()) {
|
||||
LyXParagraph * par2 = par->previous();
|
||||
#endif
|
||||
LyXLayout const * layout2 =
|
||||
&textclasslist.Style(bv->buffer()->params.textclass,
|
||||
par2->GetLayout());
|
||||
@ -501,25 +491,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
|
||||
string text = layout->latexname().substr(0, 3);
|
||||
if (layout->latexname() == "theorem")
|
||||
text = "thm"; // Create a correct prefix for prettyref
|
||||
#ifndef NEW_INSETS
|
||||
if (par->footnoteflag==LyXParagraph::OPEN_FOOTNOTE)
|
||||
switch (par->footnotekind) {
|
||||
case LyXParagraph::FIG:
|
||||
case LyXParagraph::WIDE_FIG:
|
||||
text = "fig";
|
||||
break;
|
||||
case LyXParagraph::TAB:
|
||||
case LyXParagraph::WIDE_TAB:
|
||||
text = "tab";
|
||||
break;
|
||||
case LyXParagraph::ALGORITHM:
|
||||
text = "alg";
|
||||
break;
|
||||
case LyXParagraph::FOOTNOTE:
|
||||
case LyXParagraph::MARGIN:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
text += ":";
|
||||
if (layout->latextype == LATEX_PARAGRAPH ||
|
||||
lyxrc.label_init_length < 0)
|
||||
|
@ -118,11 +118,7 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
|
||||
|
||||
string::size_type size = str.length();
|
||||
LyXParagraph::size_type i = 0;
|
||||
#ifndef NEW_INSETS
|
||||
while (((pos + i) < par->Last())
|
||||
#else
|
||||
while (((pos + i) < par->size())
|
||||
#endif
|
||||
&& (string::size_type(i) < size)
|
||||
&& (cs ? (str[i] == par->GetChar(pos + i))
|
||||
: (toupper(str[i]) == toupper(par->GetChar(pos + i)))))
|
||||
@ -133,11 +129,7 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
|
||||
// if necessary, check whether string matches word
|
||||
if (!mw ||
|
||||
(mw && ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1)))
|
||||
#ifndef NEW_INSETS
|
||||
&& (pos + size >= par->Last()
|
||||
#else
|
||||
&& (pos + size >= par->size()
|
||||
#endif
|
||||
|| !IsLetterCharOrDigit(par->GetChar(pos + size))))
|
||||
)
|
||||
)
|
||||
@ -156,11 +148,7 @@ bool SearchForward(BufferView * bv, string const & str,
|
||||
LyXParagraph::size_type pos = bv->text->cursor.pos();
|
||||
|
||||
while (par && !IsStringInText(par, pos, str, cs, mw)) {
|
||||
#ifndef NEW_INSETS
|
||||
if (pos < par->Last() - 1)
|
||||
#else
|
||||
if (pos < par->size() - 1)
|
||||
#endif
|
||||
++pos;
|
||||
else {
|
||||
pos = 0;
|
||||
@ -193,11 +181,7 @@ bool SearchBackward(BufferView * bv, string const & str,
|
||||
do {
|
||||
par = par->previous();
|
||||
if (par)
|
||||
#ifndef NEW_INSETS
|
||||
pos = par->Last() - 1;
|
||||
#else
|
||||
pos = par->size() - 1;
|
||||
#endif
|
||||
} while (par && pos < 0);
|
||||
}
|
||||
} while (par && !IsStringInText(par, pos, str, cs, mw));
|
||||
|
@ -968,12 +968,6 @@ string const LyXFunc::Dispatch(int ac,
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
case LFUN_OPENSTUFF:
|
||||
owner->view()->openStuff();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case LFUN_HYPHENATION:
|
||||
owner->view()->hyphenationPoint();
|
||||
break;
|
||||
@ -1015,43 +1009,12 @@ string const LyXFunc::Dispatch(int ac,
|
||||
owner->view()->setState();
|
||||
owner->showState();
|
||||
break;
|
||||
#ifndef NEW_INSETS
|
||||
case LFUN_MELT:
|
||||
Melt(owner->view());
|
||||
break;
|
||||
#endif
|
||||
|
||||
case LFUN_RECONFIGURE:
|
||||
Reconfigure(owner->view());
|
||||
break;
|
||||
#ifndef NEW_INSETS
|
||||
case LFUN_FOOTMELT:
|
||||
if (owner->view()->available()
|
||||
&& !TEXT()->selection
|
||||
&& TEXT()->cursor.par()->footnoteflag
|
||||
!= LyXParagraph::NO_FOOTNOTE)
|
||||
{ // only melt footnotes with FOOTMELT, not margins etc
|
||||
if (TEXT()->cursor.par()->footnotekind == LyXParagraph::FOOTNOTE)
|
||||
Melt(owner->view());
|
||||
}
|
||||
else
|
||||
Foot(owner->view());
|
||||
owner->view()->setState();
|
||||
break;
|
||||
|
||||
case LFUN_MARGINMELT:
|
||||
if (owner->view()->available()
|
||||
&& !TEXT()->selection
|
||||
&& TEXT()->cursor.par()->footnoteflag
|
||||
!= LyXParagraph::NO_FOOTNOTE) {
|
||||
// only melt margins
|
||||
if (TEXT()->cursor.par()->footnotekind == LyXParagraph::MARGIN)
|
||||
Melt(owner->view());
|
||||
} else
|
||||
Margin(owner->view());
|
||||
owner->view()->setState();
|
||||
break;
|
||||
#endif
|
||||
#ifndef NEW_INSETS
|
||||
#if 0
|
||||
case LFUN_FLOATSOPERATE:
|
||||
if (argument == "openfoot")
|
||||
owner->view()->allFloats(1,0);
|
||||
@ -1422,35 +1385,6 @@ string const LyXFunc::Dispatch(int ac,
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
case LFUN_INSERTFOOTNOTE:
|
||||
{
|
||||
LyXParagraph::footnote_kind kind;
|
||||
if (argument == "footnote") {
|
||||
kind = LyXParagraph::FOOTNOTE;
|
||||
} else if (argument == "margin") {
|
||||
kind = LyXParagraph::MARGIN;
|
||||
} else if (argument == "figure") {
|
||||
kind = LyXParagraph::FIG;
|
||||
} else if (argument == "table") {
|
||||
kind = LyXParagraph::TAB;
|
||||
} else if (argument == "wide-fig") {
|
||||
kind = LyXParagraph::WIDE_FIG;
|
||||
} else if (argument == "wide-tab") {
|
||||
kind = LyXParagraph::WIDE_TAB;
|
||||
} else if (argument == "algorithm") {
|
||||
kind = LyXParagraph::ALGORITHM;
|
||||
} else {
|
||||
setErrorMessage(N_("Unknown kind of footnote"));
|
||||
break;
|
||||
}
|
||||
TEXT()->InsertFootnoteEnvironment(owner->view(), kind);
|
||||
owner->view()->update(TEXT(),
|
||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
owner->view()->setState();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case LFUN_TOGGLECURSORFOLLOW:
|
||||
lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
|
||||
break;
|
||||
|
@ -9,9 +9,6 @@
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/filetools.h"
|
||||
#include "debug.h"
|
||||
#if 1 // to get NEW_INSETS
|
||||
#include "lyxparagraph.h"
|
||||
#endif
|
||||
|
||||
using std::sort;
|
||||
using std::ostream;
|
||||
@ -142,12 +139,6 @@ void LyXLex::Pimpl::setCommentChar(char c)
|
||||
bool LyXLex::Pimpl::next(bool esc /* = false */)
|
||||
{
|
||||
if (!pushTok.empty()) {
|
||||
#ifndef NEW_INSETS
|
||||
pushTok.copy(buff, string::npos);
|
||||
buff[pushTok.length()] = '\0';
|
||||
pushTok.erase();
|
||||
return true;
|
||||
#else
|
||||
// There can have been a whole line pushed so
|
||||
// we extract the first word and leaves the rest
|
||||
// in pushTok. (Lgb)
|
||||
@ -163,7 +154,6 @@ bool LyXLex::Pimpl::next(bool esc /* = false */)
|
||||
pushTok.erase();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!esc) {
|
||||
unsigned char c = 0; // getc() returns an int
|
||||
@ -401,15 +391,6 @@ int LyXLex::Pimpl::lex()
|
||||
|
||||
bool LyXLex::Pimpl::EatLine()
|
||||
{
|
||||
#ifndef NEW_INSETS
|
||||
// This is not handling the pushed token
|
||||
if (!pushTok.empty()) {
|
||||
pushTok.copy(buff, string::npos);
|
||||
buff[pushTok.length()] = '\0';
|
||||
pushTok.erase();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
int i = 0;
|
||||
unsigned char c = '\0';
|
||||
char cc = 0;
|
||||
@ -442,12 +423,6 @@ bool LyXLex::Pimpl::EatLine()
|
||||
bool LyXLex::Pimpl::nextToken()
|
||||
{
|
||||
if (!pushTok.empty()) {
|
||||
#ifndef NEW_INSETS
|
||||
pushTok.copy(buff, string::npos);
|
||||
buff[pushTok.length()] = '\0';
|
||||
pushTok.erase();
|
||||
return true;
|
||||
#else
|
||||
// There can have been a whole line pushed so
|
||||
// we extract the first word and leaves the rest
|
||||
// in pushTok. (Lgb)
|
||||
@ -463,7 +438,6 @@ bool LyXLex::Pimpl::nextToken()
|
||||
pushTok.erase();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
status = 0;
|
||||
|
@ -156,10 +156,6 @@ public:
|
||||
Returns true if something was broken. */
|
||||
bool FullRebreak(BufferView *);
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
LyXParagraph::footnote_flag GetFootnoteFlag(int row);
|
||||
#endif
|
||||
///
|
||||
Row * need_break_row;
|
||||
///
|
||||
@ -338,29 +334,6 @@ public:
|
||||
void GetVisibleRow(BufferView *, int y_offset, int x_offset,
|
||||
Row * row_ptr, int y, bool cleared=false);
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
/* footnotes: */
|
||||
///
|
||||
void ToggleFootnote(BufferView *);
|
||||
///
|
||||
void OpenStuff(BufferView *);
|
||||
///
|
||||
void OpenFootnotes();
|
||||
///
|
||||
void OpenFootnote(BufferView *);
|
||||
///
|
||||
void CloseFootnotes();
|
||||
///
|
||||
void CloseFootnote(BufferView *);
|
||||
|
||||
/** turn the selection into a new environment. If there is no
|
||||
selection, create an empty environment
|
||||
*/
|
||||
void InsertFootnoteEnvironment(BufferView *,
|
||||
LyXParagraph::footnote_kind kind);
|
||||
///
|
||||
void MeltFootnoteEnvironment(BufferView *);
|
||||
#endif
|
||||
///
|
||||
void CutSelection(BufferView *, bool = true);
|
||||
///
|
||||
@ -394,14 +367,7 @@ public:
|
||||
LyXAlignment align,
|
||||
string labelwidthstring,
|
||||
bool noindent);
|
||||
#ifndef NO_PEXTRA
|
||||
///
|
||||
void SetParagraphExtraOpt(BufferView *, int type,
|
||||
string const & width,
|
||||
string const & widthp,
|
||||
int alignment, bool hfill,
|
||||
bool start_minipage);
|
||||
#endif
|
||||
|
||||
/* these things are for search and replace */
|
||||
|
||||
/** sets the selection over the number of characters of string,
|
||||
|
@ -811,12 +811,6 @@ bool RunSpellChecker(BufferView * bv)
|
||||
int newvalue;
|
||||
FL_OBJECT * obj;
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
// Open all floats
|
||||
bv->allFloats(1, 0);
|
||||
bv->allFloats(1, 1);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PSPELL
|
||||
string tmp = (lyxrc.isp_use_alt_lang) ?
|
||||
lyxrc.isp_alt_lang : bv->buffer()->params.language->code();
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-05-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* textutils.h: remvoe !NEW_INSETS cruft
|
||||
|
||||
2001-05-02 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* fmt.C:
|
||||
|
@ -42,21 +42,6 @@ bool IsInsetChar(char c) {
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
///
|
||||
inline
|
||||
bool IsFloatChar(char c) {
|
||||
return (c == LyXParagraph::META_FOOTNOTE
|
||||
|| c == LyXParagraph::META_MARGIN
|
||||
|| c == LyXParagraph::META_FIG
|
||||
|| c == LyXParagraph::META_TAB
|
||||
|| c == LyXParagraph::META_ALGORITHM
|
||||
|| c == LyXParagraph::META_WIDE_FIG
|
||||
|| c == LyXParagraph::META_WIDE_TAB);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
///
|
||||
inline
|
||||
bool IsLineSeparatorChar(char c) {
|
||||
@ -124,9 +109,6 @@ bool IsWordChar(unsigned char c) {
|
||||
return !( IsSeparatorChar( c )
|
||||
|| IsKommaChar( c )
|
||||
|| IsHfillChar( c )
|
||||
#ifndef NEW_INSETS
|
||||
|| IsFloatChar( c )
|
||||
#endif
|
||||
|| IsInsetChar( c ));
|
||||
}
|
||||
|
||||
|
@ -1475,10 +1475,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
|
||||
LyXParagraph * par = new LyXParagraph;
|
||||
LyXParagraph * return_par = 0;
|
||||
#ifndef NEW_INSETS
|
||||
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
|
||||
LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
|
||||
#endif
|
||||
|
||||
string tmptok;
|
||||
int pos = 0;
|
||||
char depth = 0;
|
||||
@ -1499,14 +1496,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
if (owner_->BufferOwner()->parseSingleLyXformat2Token(lex, par,
|
||||
return_par,
|
||||
token, pos,
|
||||
depth, font
|
||||
#ifndef NEW_INSETS
|
||||
,
|
||||
footnoteflag,
|
||||
footnotekind
|
||||
#endif
|
||||
))
|
||||
{
|
||||
depth, font)) {
|
||||
// the_end read
|
||||
lex.pushToken(token);
|
||||
break;
|
||||
@ -1524,12 +1514,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
InsetText * inset = GetCellInset(cell);
|
||||
int row;
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
for (int i = 0; i < par->Last(); ++i)
|
||||
#else
|
||||
for (int i = 0; i < par->size(); ++i)
|
||||
#endif
|
||||
{
|
||||
for (int i = 0; i < par->size(); ++i) {
|
||||
if (par->IsNewline(i)) {
|
||||
++cell;
|
||||
if (cell > GetNumberOfCells()) {
|
||||
@ -1558,11 +1543,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
}
|
||||
}
|
||||
par->CopyIntoMinibuffer(*owner_->BufferOwner(), i);
|
||||
#ifndef NEW_INSETS
|
||||
inset->par->InsertFromMinibuffer(inset->par->Last());
|
||||
#else
|
||||
inset->par->InsertFromMinibuffer(inset->par->size());
|
||||
#endif
|
||||
}
|
||||
delete par;
|
||||
Reinit();
|
||||
@ -2165,11 +2146,8 @@ int LyXTabular::Latex(Buffer const * buf,
|
||||
InsetText * inset = GetCellInset(cell);
|
||||
|
||||
bool rtl = inset->par->isRightToLeftPar(buf->params) &&
|
||||
#ifndef NEW_INSETS
|
||||
inset->par->Last() > 0 && GetPWidth(cell).empty();
|
||||
#else
|
||||
inset->par->size() > 0 && GetPWidth(cell).empty();
|
||||
#endif
|
||||
inset->par->size() > 0 && GetPWidth(cell).empty();
|
||||
|
||||
if (rtl)
|
||||
os << "\\R{";
|
||||
ret += inset->Latex(buf, os, fragile, fp);
|
||||
@ -2565,20 +2543,6 @@ std::vector<string> const LyXTabular::getLabelList() const
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
|
||||
{
|
||||
LyXParagraph * par = GetCellInset(cell)->par;
|
||||
|
||||
for (; par; par = par->next_) {
|
||||
for (int i = 0; i < par->Last(); ++i) {
|
||||
if (par->GetChar(i) == LyXParagraph::META_NEWLINE)
|
||||
return BOX_PARBOX;
|
||||
}
|
||||
}
|
||||
return BOX_NONE;
|
||||
}
|
||||
#else
|
||||
LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
|
||||
{
|
||||
LyXParagraph * par = GetCellInset(cell)->par;
|
||||
@ -2591,7 +2555,7 @@ LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
|
||||
}
|
||||
return BOX_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Emacs:
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
927
src/text.C
927
src/text.C
File diff suppressed because it is too large
Load Diff
1024
src/text2.C
1024
src/text2.C
File diff suppressed because it is too large
Load Diff
12
src/undo.C
12
src/undo.C
@ -31,17 +31,6 @@ Undo::Undo(undo_kind kind_arg,
|
||||
}
|
||||
|
||||
|
||||
#ifndef NEW_INSETS
|
||||
Undo::~Undo()
|
||||
{
|
||||
LyXParagraph * tmppar;
|
||||
while (par) {
|
||||
tmppar = par;
|
||||
par = par->next_;
|
||||
delete tmppar;
|
||||
}
|
||||
}
|
||||
#else
|
||||
Undo::~Undo()
|
||||
{
|
||||
LyXParagraph * tmppar;
|
||||
@ -51,7 +40,6 @@ Undo::~Undo()
|
||||
delete tmppar;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
UndoStack::UndoStack()
|
||||
|
Loading…
Reference in New Issue
Block a user