2003-06-27 11:53:41 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \file textcursor.h
|
2003-06-27 11:53:41 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author unknown
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
2003-06-27 11:53:41 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-06-27 11:53:41 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef TEXTCURSOR_H
|
|
|
|
|
#define TEXTCURSOR_H
|
|
|
|
|
|
2003-09-06 12:36:58 +00:00
|
|
|
|
#include "lyxcursor.h"
|
|
|
|
|
#include "support/std_string.h"
|
|
|
|
|
|
|
|
|
|
class Buffer;
|
|
|
|
|
|
2003-07-01 11:51:20 +00:00
|
|
|
|
// Do not even think of forward declaring LyXText/BufferView etc here!
|
|
|
|
|
// If you need Paragraph proper, go to text_func.h
|
|
|
|
|
|
2003-06-27 11:53:41 +00:00
|
|
|
|
/** The cursor.
|
2003-08-22 08:47:32 +00:00
|
|
|
|
Later this variable has to be removed. There should be no internal
|
2003-06-27 11:53:41 +00:00
|
|
|
|
cursor in a text (and thus not in a buffer). By keeping this it is
|
|
|
|
|
(I think) impossible to have several views with the same buffer, but
|
|
|
|
|
the cursor placed at different places.
|
|
|
|
|
[later]
|
|
|
|
|
Since the LyXText now has been moved from Buffer to BufferView
|
|
|
|
|
it should not be absolutely needed to move the cursor...
|
|
|
|
|
[even later]
|
2003-08-22 08:47:32 +00:00
|
|
|
|
Nevertheless, it should still be moved, in order to keep classes
|
2003-08-28 07:41:31 +00:00
|
|
|
|
and interdependencies small.
|
2003-06-27 11:53:41 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// The structure that keeps track of the selections set.
|
|
|
|
|
struct Selection {
|
|
|
|
|
Selection()
|
|
|
|
|
: set_(false), mark_(false)
|
|
|
|
|
{}
|
|
|
|
|
bool set() const {
|
|
|
|
|
return set_;
|
|
|
|
|
}
|
|
|
|
|
void set(bool s) {
|
|
|
|
|
set_ = s;
|
|
|
|
|
}
|
|
|
|
|
bool mark() const {
|
|
|
|
|
return mark_;
|
|
|
|
|
}
|
|
|
|
|
void mark(bool m) {
|
|
|
|
|
mark_ = m;
|
|
|
|
|
}
|
|
|
|
|
LyXCursor cursor; // temporary cursor to hold a cursor position
|
|
|
|
|
// until setSelection is called!
|
|
|
|
|
LyXCursor start; // start of a REAL selection
|
|
|
|
|
LyXCursor end; // end of a REAL selection
|
|
|
|
|
private:
|
|
|
|
|
bool set_; // former selection
|
|
|
|
|
bool mark_; // former mark_set
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TextCursor {
|
2003-08-05 10:54:19 +00:00
|
|
|
|
///
|
|
|
|
|
void setSelection();
|
2003-06-27 13:13:04 +00:00
|
|
|
|
///
|
|
|
|
|
void clearSelection();
|
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
string const selectionAsString(Buffer const & buffer, bool label) const;
|
2003-06-27 13:13:04 +00:00
|
|
|
|
|
2003-06-27 11:53:41 +00:00
|
|
|
|
// actual cursor position
|
|
|
|
|
LyXCursor cursor;
|
|
|
|
|
|
|
|
|
|
Selection selection;
|
|
|
|
|
// this is used to handle XSelection events in the right manner
|
|
|
|
|
Selection xsel_cache;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|