mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
19f83569df
- fix yesterday's selection regression - remove a few update() calls - remove unused Selection::last_sel_cursor member - ... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7504 a592a061-630c-0410-9148-cb99ea01b6c8
78 lines
1.8 KiB
C++
78 lines
1.8 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file cursor.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author unknown
|
|
* \author Lars Gullik Bjønnes
|
|
* \author John Levon
|
|
*
|
|
* Full author contact details are available in file CREDITS
|
|
*/
|
|
|
|
#include "lyxcursor.h"
|
|
|
|
#ifndef TEXTCURSOR_H
|
|
#define TEXTCURSOR_H
|
|
|
|
// Do not even think of forward declaring LyXText/BufferView etc here!
|
|
// If you need Paragraph proper, go to text_func.h
|
|
|
|
/** The cursor.
|
|
Later this variable has to be removed. There should be now internal
|
|
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]
|
|
It should neverthe less to keep classes and intedependencies small
|
|
*/
|
|
|
|
// 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 {
|
|
///
|
|
void setSelection();
|
|
///
|
|
void clearSelection();
|
|
///
|
|
string const selectionAsString(Buffer const * buffer, bool label) const;
|
|
|
|
// actual cursor position
|
|
LyXCursor cursor;
|
|
|
|
Selection selection;
|
|
// this is used to handle XSelection events in the right manner
|
|
Selection xsel_cache;
|
|
};
|
|
|
|
#endif
|