#include "insets/insetinfo.h"
#include "insets/insetspecialchar.h"
#include "LyXView.h"
-#include "minibuffer.h"
#include "bufferlist.h"
#include "support/FileInfo.h"
#include "lyxscreen.h"
#include "BufferView_pimpl.h"
#include "insets/insetcommand.h" //ChangeRefs
#include "support/lyxfunctional.h" //equal_1st_in_pair
+#include "language.h"
+#include "gettext.h"
+#include "lyxfunc.h"
extern BufferList bufferlist;
return false;
}
- beforeChange();
+ beforeChange(text);
ifstream ifs(fname.c_str());
if (!ifs) {
LyXCursor cursor;
bool a = false;
+#ifndef NEW_INSETS
while (par) {
// this has to be done before the delete
-#ifndef NEW_INSETS
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
-#endif
text->SetCursor(this, cursor, par, 0);
if (par->AutoDeleteInsets()){
a = true;
-#ifndef NEW_INSETS
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
-#endif
text->RedoParagraphs(this, cursor,
- cursor.par()->Next());
+ cursor.par()->next());
text->FullRebreak(this);
-#ifndef NEW_INSETS
}
-#endif
}
- par = par->next;
+ 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);
+ if (par->AutoDeleteInsets()){
+ a = true;
+ 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()->size())
+ tmpcursor.pos(tmpcursor.par()->size());
+#endif
text->SetCursorIntern(this, tmpcursor.par(), tmpcursor.pos());
return a;
text->SetCursorParUndo(buffer());
text->FreezeUndo();
- beforeChange();
+ beforeChange(text);
if (!lout.empty()) {
update(text, BufferView::SELECT|BufferView::FITCUR);
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();
+ beforeChange(text);
text->FinishUndo();
if (!insertInset(new_inset)) {
delete new_inset;
vector<string> labels = (*it)->getLabelList();
if (find(labels.begin(),labels.end(),label)
!= labels.end()) {
- beforeChange();
+ beforeChange(text);
text->SetCursor(this, it.getPar(), it.getPos());
text->sel_cursor = text->cursor;
update(text, BufferView::SELECT|BufferView::FITCUR);
&& cursor.par()->footnotekind != LyXParagraph::ALGORITHM)))
toggleFloat();
else
- beforeChange();
+ beforeChange(text);
LyXCursor tmpcursor = cursor;
cursor.par(tmpcursor.par()->ParFromPos(tmpcursor.pos()));
)
)
) {
- if (par->previous
- && par->previous->footnoteflag !=
+ if (par->previous_
+ && par->previous_->footnoteflag !=
LyXParagraph::CLOSED_FOOTNOTE){ /* should be */
text->SetCursorIntern(this,
- par->previous,
+ par->previous_,
0);
text->OpenFootnote(this);
}
text->CloseFootnote(this);
}
}
- par = par->next;
+ par = par->next_;
}
text->SetCursorIntern(this, cursor.par(), cursor.pos());
void BufferView::openStuff()
{
if (available()) {
- owner()->getMiniBuffer()->Set(_("Open/Close..."));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
+ _("Open/Close..."));
hideCursor();
- beforeChange();
+ beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
text->OpenStuff(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
void BufferView::toggleFloat()
{
if (available()) {
- owner()->getMiniBuffer()->Set(_("Open/Close..."));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
+ _("Open/Close..."));
hideCursor();
- beforeChange();
+ beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
text->ToggleFootnote(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
void BufferView::menuUndo()
{
if (available()) {
- owner()->getMiniBuffer()->Set(_("Undo"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Undo"));
hideCursor();
- beforeChange();
+ beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
if (!text->TextUndo(this))
- owner()->getMiniBuffer()->Set(_("No further undo information"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
+ _("No forther undo information"));
else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
setState();
void BufferView::menuRedo()
{
if (theLockingInset()) {
- owner()->getMiniBuffer()->Set(_("Redo not yet supported in math mode"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
+ _("Redo not yet supported in math mode"));
return;
}
if (available()) {
- owner()->getMiniBuffer()->Set(_("Redo"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
+ _("Redo"));
hideCursor();
- beforeChange();
+ beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
if (!text->TextRedo(this))
- owner()->getMiniBuffer()->Set(_("No further redo information"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
+ _("No further redo information"));
else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
setState();
}
}
+
void BufferView::copyEnvironment()
{
if (available()) {
text->copyEnvironmentType();
// clear the selection, even if mark_set
toggleSelection();
- text->ClearSelection();
+ text->ClearSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
- owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
+ _("Paragraph environment type copied"));
}
}
{
if (available()) {
text->pasteEnvironmentType(this);
- owner()->getMiniBuffer()->Set(_("Paragraph environment type set"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE,
+ _("Paragraph environment type set"));
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
text->CopySelection(this);
// clear the selection, even if mark_set
toggleSelection();
- text->ClearSelection();
+ text->ClearSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
- owner()->getMiniBuffer()->Set(_("Copy"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Copy"));
}
}
update(text, BufferView::SELECT|BufferView::FITCUR);
text->CutSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
- owner()->getMiniBuffer()->Set(_("Cut"));
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Cut"));
}
}
void BufferView::paste()
{
if (!available()) return;
-
- owner()->getMiniBuffer()->Set(_("Paste"));
+
+ owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Paste"));
+
hideCursor();
// clear the selection
toggleSelection();
- text->ClearSelection();
+ text->ClearSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
// paste
// clear the selection
toggleSelection();
- text->ClearSelection();
+ text->ClearSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
}
if (!available()) return;
hideCursor();
- beforeChange();
+ beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
string contents;
text->cursor.pos(0);
if (!text->GotoNextInset(this, codes, contents)) {
text->cursor = tmp;
- owner()->getMiniBuffer()->Set(_("No more insets"));
+ owner()->getLyXFunc()
+ ->Dispatch(LFUN_MESSAGE,
+ _("No more insets"));
}
} else {
- owner()->getMiniBuffer()->Set(_("No more insets"));
+ owner()->getLyXFunc()
+ ->Dispatch(LFUN_MESSAGE,
+ _("No more insets"));
}
}
update(text, BufferView::SELECT|BufferView::FITCUR);
if (!available()) return;
hideCursor();
- beforeChange();
+ beforeChange(text);
text->SelectSelectedWord(this);
toggleSelection(false);
update(text, BufferView::SELECT|BufferView::FITCUR);
if (!available()) return;
hideCursor();
- beforeChange();
+ beforeChange(text);
text->SelectSelectedWord(this);
- text->ClearSelection();
+ text->ClearSelection(this);
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;
- text->SetUndo(buffer(), kind,
#ifndef NEW_INSETS
+ text->SetUndo(buffer(), kind,
text->cursor.par()->
- ParFromPos(text->cursor.pos())->previous,
+ ParFromPos(text->cursor.pos())->previous_,
text->cursor.par()->
- ParFromPos(text->cursor.pos())->next
+ ParFromPos(text->cursor.pos())->next_);
#else
- text->cursor.par()->previous,
- text->cursor.par()->next
+ text->SetUndo(buffer(), kind,
+ text->cursor.par()->previous(),
+ text->cursor.par()->next());
#endif
- );
}
if (text->UpdateInset(this, inset)) {
update();
if (mark_dirty) {
- if (buffer()->isLyxClean())
- owner()->getMiniBuffer()->
- setTimer(4);
buffer()->markDirty();
}
updateScrollbar();
if (text->UpdateInset(this, theLockingInset())) {
update();
if (mark_dirty){
- if (buffer()->isLyxClean())
- owner()->getMiniBuffer()->
- setTimer(4);
buffer()->markDirty();
}
updateScrollbar();
}
-bool BufferView::ChangeInsets(Inset::Code code, string const & from, string const & to)
+bool BufferView::ChangeInsets(Inset::Code code,
+ string const & from, string const & to)
{
bool flag = false;
LyXParagraph * par = buffer()->paragraph;
}
}
}
+#ifndef NEW_INSETS
if (flag2) {
flag = true;
-#ifndef NEW_INSETS
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
-#endif
// 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->cursor.par()->next());
text->FullRebreak(this);
-#ifndef NEW_INSETS
}
-#endif
}
- par = par->next;
+ par = par->next_;
+#else
+ if (flag2) {
+ flag = true;
+ // 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();
+#endif
}
text->SetCursorIntern(this, cursor.par(), cursor.pos());
return flag;
LyXText * BufferView::getLyXText() const
{
if (theLockingInset()) {
- LyXText * txt = theLockingInset()->getLyXText(this);
+ LyXText * txt = theLockingInset()->getLyXText(this, true);
if (txt)
return txt;
}
return text;
}
+
Language const * BufferView::getParentLanguage(Inset * inset) const
{
LyXText * text = getParentText(inset);