dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
finishUndo();
return 0;
- } else if (inset && theLockingInset() &&
+ }
+ if (inset && theLockingInset() &&
theLockingInset()->unlockInsetInInset(this, inset)) {
// Tell the paragraph dialog that we changed paragraph
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
#include "buffer_funcs.h"
#include "bufferlist.h"
#include "bufferparams.h"
+#include "cursor.h"
#include "debug.h"
#include "factory.h"
#include "FloatList.h"
}
#warning does not help much
- bv_->text->redoParagraphs(bv_->text->ownerParagraphs().begin(),
- bv_->text->ownerParagraphs().end());
+ //bv_->text->redoParagraphs(bv_->text->ownerParagraphs().begin(),
+ // bv_->text->ownerParagraphs().end());
if (par != bv_->text->ownerParagraphs().end()) {
bv_->text->selection.set(true);
ev.errorMessage(N_("Unknown function!"));
break;
- default:
+ default:
return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_));
} // end of switch
converter.h \
counters.C \
counters.h \
+ cursor.C \
+ cursor.h \
debug.C \
debug.h \
dimension.C \
state << _(", Position: ") << text->cursor.pos();
RowList::iterator rit = text->cursorRow();
state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->end());
- state << _(", Inset: ") <<
- (text->cursor.par()->inInset() ? text->cursor.par()->inInset()->id() : -1);
+ state << _(", Inset: ");
+ InsetOld * inset = text->cursor.par()->inInset();
+ if (inset)
+ state << inset << " id: " << inset->id()
+ << " text: " << inset->getLyXText(bv, true)
+ << " owner: " << inset->owner();
+ else
+ state << -1;
#endif
return state.str();
}
--- /dev/null
+/**
+ * \file cursor.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jürgen Vigna
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "buffer.h"
+#include "BufferView.h"
+#include "cursor.h"
+#include "debug.h"
+#include "iterators.h"
+#include "lyxtext.h"
+#include "paragraph.h"
+
+#include "insets/updatableinset.h"
+
+using std::vector;
+
+
+dispatch_result Cursor::dispatch(FuncRequest const &)
+{
+ for (int i = data_.size() - 1; i >= 0; --i) {
+ lyxerr << "trying to dispatch to " << data_[i].text_ << std::endl;
+ }
+ return UNDISPATCHED;
+}
+
+
+void buildCursor(Cursor & cursor, BufferView & bv)
+{
+ UpdatableInset * inset = bv.theLockingInset();
+ lyxerr << "\nbuildCursor: " << inset << std::endl;
+ if (!inset)
+ return;
+
+ inset = inset->getLockingInset();
+
+ bool ok = false;
+ ParIterator pit = bv.buffer()->par_iterator_begin();
+ ParIterator end = bv.buffer()->par_iterator_end();
+ for ( ; pit != end && !ok; ++pit) {
+ InsetList::iterator it = pit->insetlist.begin();
+ InsetList::iterator iend = pit->insetlist.end();
+ for ( ; it != iend && !ok; ++it)
+ if (it->inset == inset || it->inset == inset->owner())
+ ok = true;
+ }
+
+ if (!ok) {
+ lyxerr << " tli not found! inset: " << inset << std::endl;
+ return;
+ }
+
+ vector<ParagraphList::iterator> pits;
+ vector<ParagraphList const *> plists;
+ vector<LyXText *> texts;
+/*
+ pit.getPits(pits, plists, texts);
+
+ cursor.data_.resize(pits.size());
+ for (size_t i = 0, n = pits.size(); i != n; ++i) {
+ cursor.data_[i].text_ = texts[i];
+ cursor.data_[i].pit_ = pits[i];
+ //cursor.data_[i].pos_ = texts[i]->cursor.pos();
+ cursor.data_[i].pos_ = 0;
+ lyxerr << " text: " << cursor.data_[i].text_
+ << " pit: " << cursor.data_[i].pit_->id()
+ << " pos: " << cursor.data_[i].pos_
+ << std::endl;
+ }
+*/
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file cursor.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef CURSOR_H
+#define CURSOR_H
+
+#include "ParagraphList_fwd.h"
+#include "textcursor.h"
+
+#include "support/types.h"
+
+#include "insets/insetbase.h"
+
+#include <vector>
+
+class LyXText;
+
+
+/**
+ * The cursor class describes the position of a cursor within a document.
+ */
+
+class CursorItem : public TextCursor {
+public:
+ ///
+ CursorItem() : text_(0) {}
+public:
+ ///
+ LyXText * text_;
+ ///
+ ParagraphList::iterator pit_;
+ ///
+ int pos_;
+};
+
+
+class Cursor {
+public:
+ ///
+ Cursor() {}
+ ///
+ dispatch_result dispatch(FuncRequest const & cmd);
+public:
+ /// mainly used as stack, bnut wee need random access
+ std::vector<CursorItem> data_;
+};
+
+/// build cursor from current cursor in view
+void buildCursor(Cursor & cursor, BufferView & bv);
+
+/// build cursor from (x,y) coordinates
+void buildCursor(Cursor & cursor, BufferView & bv, int x, int y);
+
+#endif // LYXCURSOR_H
#include "bufferlist.h"
#include "bufferparams.h"
#include "BufferView.h"
+#include "cursor.h"
#include "debug.h"
#include "encoding.h"
#include "exporter.h"
if (view()->available())
view()->hideCursor();
+#if 1
+ {
+ Cursor cursor;
+ buildCursor(cursor, *view());
+ if (cursor.dispatch(FuncRequest(ev, view())) == DISPATCHED) {
+ lyxerr << "dispatched by Cursor::dispatch()\n";
+ goto exit_with_message;
+ }
+ }
+#endif
+
+
if (view()->available() && view()->theLockingInset()) {
InsetOld::RESULT result;
if (action > 1 || (action == LFUN_UNKNOWN_ACTION &&