#include "support/lyxfunctional.h" //equal_1st_in_pair
#include "language.h"
#include "gettext.h"
-#include "lyxfunc.h"
extern BufferList bufferlist;
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);
// 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;
// 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) {
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);
}
-// Open and lock an updatable inset
-bool BufferView::open_new_inset(UpdatableInset * new_inset, bool behind)
-{
- beforeChange(text);
- text->FinishUndo();
- if (!insertInset(new_inset)) {
- delete new_inset;
- return false;
- }
- if (behind) {
- LyXFont & font = getLyXText()->real_current_font;
- new_inset->Edit(this, new_inset->width(this, font), 0, 0);
- } else
- new_inset->Edit(this, 0, 0, 0);
- return true;
-}
-
/* This is also a buffer property (ale) */
// Not so sure about that. a goto Label function can not be buffer local, just
// think how this will work in a multiwindo/buffer environment, all the
}
-#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();
- insertInset(new_inset);
- new_inset->Edit(this, 0, 0, 0);
-}
-
-
-#ifndef NEW_INSETS
-void BufferView::openStuff()
-{
- if (available()) {
- owner()->getLyXFunc()->Dispatch(LFUN_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()->getLyXFunc()->Dispatch(LFUN_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()) {
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Undo"));
+ owner()->message(_("Undo"));
hideCursor();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
if (!text->TextUndo(this))
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
- _("No forther undo information"));
+ owner()->message(_("No forther undo information"));
else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
setState();
void BufferView::menuRedo()
{
if (theLockingInset()) {
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
- _("Redo not yet supported in math mode"));
+ owner()->message(_("Redo not yet supported in math mode"));
return;
}
if (available()) {
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
- _("Redo"));
+ owner()->message(_("Redo"));
hideCursor();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
if (!text->TextRedo(this))
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
- _("No further redo information"));
+ owner()->message(_("No further redo information"));
else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
setState();
toggleSelection();
text->ClearSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
- _("Paragraph environment type copied"));
+ owner()->message(_("Paragraph environment type copied"));
}
}
{
if (available()) {
text->pasteEnvironmentType(this);
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
- _("Paragraph environment type set"));
+ owner()->message(_("Paragraph environment type set"));
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
toggleSelection();
text->ClearSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Copy"));
+ owner()->message(_("Copy"));
}
}
update(text, BufferView::SELECT|BufferView::FITCUR);
text->CutSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Cut"));
+ owner()->message(_("Cut"));
}
}
{
if (!available()) return;
- owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Paste"));
+ owner()->message(_("Paste"));
hideCursor();
// clear the selection
text->cursor.pos(0);
if (!text->GotoNextInset(this, codes, contents)) {
text->cursor = tmp;
- owner()->getLyXFunc()
- ->Dispatch(LFUN_MESSAGE,
- _("No more insets"));
+ owner()->message(_("No more insets"));
}
} else {
- owner()->getLyXFunc()
- ->Dispatch(LFUN_MESSAGE,
- _("No more insets"));
+ owner()->message(_("No more insets"));
}
}
update(text, BufferView::SELECT|BufferView::FITCUR);
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
}
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;
}
}
}
-#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
text->FullRebreak(this);
}
par = par->next();
-#endif
}
text->SetCursorIntern(this, cursor.par(), cursor.pos());
return flag;
vector<pair<string,string> > keys = buffer()->getBibkeyList();
if (count_if(keys.begin(), keys.end(),
- equal_1st_in_pair<string,string>(from))
+ lyx::equal_1st_in_pair<string,string>(from))
> 1)
return false;
void BufferView::theLockingInset(UpdatableInset * inset)
{
- text->the_locking_inset = inset;
+ text->the_locking_inset = inset;
}