mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
make cursor_visible private
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1887 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
74784ee97b
commit
b79e5c99b0
@ -12,13 +12,11 @@
|
||||
#include "debug.h"
|
||||
#include "buffer.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::vector;
|
||||
using std::endl;
|
||||
|
||||
string const InsetTOC::getScreenLabel() const
|
||||
{
|
||||
string cmdname( getCmdName() );
|
||||
string const cmdname( getCmdName() );
|
||||
if (cmdname == "tableofcontents" )
|
||||
return _("Table of Contents");
|
||||
else if (cmdname == "listofalgorithms" )
|
||||
@ -32,12 +30,12 @@ string const InsetTOC::getScreenLabel() const
|
||||
|
||||
Inset::Code InsetTOC::LyxCode() const
|
||||
{
|
||||
string cmdname( getCmdName() );
|
||||
if (cmdname == "tableofcontents" )
|
||||
string const cmdname(getCmdName());
|
||||
if (cmdname == "tableofcontents")
|
||||
return Inset::TOC_CODE;
|
||||
else if (cmdname == "listofalgorithms" )
|
||||
else if (cmdname == "listofalgorithms")
|
||||
return Inset::LOA_CODE;
|
||||
else if (cmdname == "listoffigures" )
|
||||
else if (cmdname == "listoffigures")
|
||||
return Inset::LOF_CODE;
|
||||
else
|
||||
return Inset::LOT_CODE;
|
||||
@ -50,9 +48,9 @@ void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::Ascii(Buffer const * buffer, ostream & os, int) const
|
||||
int InsetTOC::Ascii(Buffer const * buffer, std::ostream & os, int) const
|
||||
{
|
||||
os << getScreenLabel() << endl << endl;
|
||||
os << getScreenLabel() << "\n\n";
|
||||
|
||||
#if 0
|
||||
Buffer::TocType type;
|
||||
@ -75,7 +73,7 @@ int InsetTOC::Ascii(Buffer const * buffer, ostream & os, int) const
|
||||
#else
|
||||
#warning Fix Me! (Lgb)
|
||||
string type;
|
||||
string cmdname = getCmdName();
|
||||
string const cmdname = getCmdName();
|
||||
if (cmdname == "tableofcontents" )
|
||||
type = "TOC";
|
||||
else if (cmdname == "listofalgorithms" )
|
||||
@ -93,15 +91,15 @@ int InsetTOC::Ascii(Buffer const * buffer, ostream & os, int) const
|
||||
Buffer::SingleList::const_iterator end = cit->second.end();
|
||||
for (; ccit != end; ++ccit)
|
||||
os << string(4 * ccit->depth, ' ')
|
||||
<< ccit->str << endl;
|
||||
<< ccit->str << "\n";
|
||||
}
|
||||
#endif
|
||||
os << endl;
|
||||
os << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
|
||||
int InsetTOC::Linuxdoc(Buffer const *, std::ostream & os) const
|
||||
{
|
||||
if (getCmdName() == "tableofcontents" )
|
||||
os << "<toc>";
|
||||
@ -109,7 +107,7 @@ int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::DocBook(Buffer const *, ostream & os) const
|
||||
int InsetTOC::DocBook(Buffer const *, std::ostream & os) const
|
||||
{
|
||||
if (getCmdName() == "tableofcontents" )
|
||||
os << "<toc></toc>";
|
||||
|
@ -128,9 +128,9 @@ public:
|
||||
///
|
||||
HIGHLY_EDITABLE
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
Inset() { owner_ = 0; top_x = top_baseline = 0; scx = 0; }
|
||||
Inset() : top_x(0), top_baseline(0), scx(0), owner_(0) {}
|
||||
///
|
||||
virtual ~Inset() {}
|
||||
///
|
||||
@ -170,11 +170,11 @@ public:
|
||||
///
|
||||
virtual void Read(Buffer const *, LyXLex & lex) = 0;
|
||||
/** returns the number of rows (\n's) of generated tex code.
|
||||
fragile == true means, that the inset should take care about
|
||||
fragile commands by adding a \protect before.
|
||||
If the free_spc (freespacing) variable is set, then this inset
|
||||
is in a free-spacing paragraph.
|
||||
*/
|
||||
fragile == true means, that the inset should take care about
|
||||
fragile commands by adding a \protect before.
|
||||
If the free_spc (freespacing) variable is set, then this inset
|
||||
is in a free-spacing paragraph.
|
||||
*/
|
||||
virtual int Latex(Buffer const *, std::ostream &, bool fragile,
|
||||
bool free_spc) const = 0;
|
||||
///
|
||||
@ -188,17 +188,17 @@ public:
|
||||
virtual void Validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
virtual bool Deletable() const;
|
||||
|
||||
|
||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||
virtual Inset::Code LyxCode() const { return NO_CODE; }
|
||||
|
||||
|
||||
virtual std::vector<string> const getLabelList() const {
|
||||
return std::vector<string>();
|
||||
}
|
||||
|
||||
///
|
||||
virtual Inset * Clone(Buffer const &) const = 0;
|
||||
|
||||
|
||||
/// returns true to override begin and end inset in file
|
||||
virtual bool DirectWrite() const;
|
||||
|
||||
@ -228,20 +228,21 @@ public:
|
||||
// because we could have fake text insets and have to call this
|
||||
// inside them without cast!!!
|
||||
///
|
||||
virtual LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
|
||||
virtual LyXText * getLyXText(BufferView const *,
|
||||
bool const recursive = false) const;
|
||||
///
|
||||
virtual void deleteLyXText(BufferView *, bool = true) const {}
|
||||
///
|
||||
virtual void resizeLyXText(BufferView *) const {}
|
||||
/// returns the actuall scroll-value
|
||||
int scroll() const { return scx; }
|
||||
|
||||
protected:
|
||||
///
|
||||
mutable int top_x;
|
||||
///
|
||||
mutable int top_baseline;
|
||||
///
|
||||
mutable int scx;
|
||||
|
||||
private:
|
||||
///
|
||||
Inset * owner_;
|
||||
@ -256,27 +257,27 @@ private:
|
||||
// [Alejandro 080596]
|
||||
|
||||
/** Extracted from Matthias notes:
|
||||
*
|
||||
* An inset can simple call LockInset in it's edit call and *ONLY*
|
||||
* in it's edit call.
|
||||
*
|
||||
* Unlocking is either done by LyX or the inset itself with a
|
||||
* UnlockInset-call
|
||||
*
|
||||
* During the lock, all button and keyboard events will be modified
|
||||
* and send to the inset through the following inset-features. Note that
|
||||
* Inset::InsetUnlock will be called from inside UnlockInset. It is meant
|
||||
* to contain the code for restoring the menus and things like this.
|
||||
*
|
||||
* If a inset wishes any redraw and/or update it just has to call
|
||||
* UpdateInset(this).
|
||||
*
|
||||
* It's is completly irrelevant, where the inset is. UpdateInset will
|
||||
* find it in any paragraph in any buffer.
|
||||
* Of course the_locking_inset and the insets in the current paragraph/buffer
|
||||
* are checked first, so no performance problem should occur.
|
||||
*/
|
||||
class UpdatableInset: public Inset {
|
||||
*
|
||||
* An inset can simple call LockInset in it's edit call and *ONLY*
|
||||
* in it's edit call.
|
||||
*
|
||||
* Unlocking is either done by LyX or the inset itself with a
|
||||
* UnlockInset-call
|
||||
*
|
||||
* During the lock, all button and keyboard events will be modified
|
||||
* and send to the inset through the following inset-features. Note that
|
||||
* Inset::InsetUnlock will be called from inside UnlockInset. It is meant
|
||||
* to contain the code for restoring the menus and things like this.
|
||||
*
|
||||
* If a inset wishes any redraw and/or update it just has to call
|
||||
* UpdateInset(this).
|
||||
*
|
||||
* It's is completly irrelevant, where the inset is. UpdateInset will
|
||||
* find it in any paragraph in any buffer.
|
||||
* Of course the_locking_inset and the insets in the current paragraph/buffer
|
||||
* are checked first, so no performance problem should occur.
|
||||
*/
|
||||
class UpdatableInset : public Inset {
|
||||
public:
|
||||
/** Dispatch result codes
|
||||
Now that nested updatable insets are allowed, the local dispatch
|
||||
@ -285,17 +286,17 @@ public:
|
||||
|
||||
DISPATCHED = the inset catched the action
|
||||
DISPATCHED_NOUPDATE = the inset catched the action and no update
|
||||
is needed here to redraw the inset
|
||||
is needed here to redraw the inset
|
||||
FINISHED = the inset must be unlocked as a result
|
||||
of the action
|
||||
UNDISPATCHED = the action was not catched, it should be
|
||||
dispatched by lower level insets
|
||||
*/
|
||||
enum RESULT {
|
||||
UNDISPATCHED = 0,
|
||||
DISPATCHED,
|
||||
DISPATCHED_NOUPDATE,
|
||||
FINISHED
|
||||
UNDISPATCHED = 0,
|
||||
DISPATCHED,
|
||||
DISPATCHED_NOUPDATE,
|
||||
FINISHED
|
||||
};
|
||||
|
||||
/// To convert old binary dispatch results
|
||||
@ -303,15 +304,17 @@ public:
|
||||
return b ? DISPATCHED : FINISHED;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
UpdatableInset() {}
|
||||
UpdatableInset() : cursor_visible_(false) {}
|
||||
|
||||
///
|
||||
virtual EDITABLE Editable() const;
|
||||
|
||||
|
||||
/// may call ToggleLockedInsetCursor
|
||||
virtual void ToggleInsetCursor(BufferView *);
|
||||
///
|
||||
virtual void ShowInsetCursor(BufferView *, bool show=true);
|
||||
virtual void ShowInsetCursor(BufferView *, bool show = true);
|
||||
///
|
||||
virtual void HideInsetCursor(BufferView *);
|
||||
///
|
||||
@ -359,21 +362,31 @@ public:
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
virtual RESULT LocalDispatch(BufferView *, kb_action, string const &);
|
||||
///
|
||||
virtual bool isCursorVisible() const { return cursor_visible; }
|
||||
bool isCursorVisible() const { return cursor_visible_; }
|
||||
///
|
||||
virtual int getMaxWidth(BufferView * bv, UpdatableInset const *) const;
|
||||
///
|
||||
int scroll() const { return scx; }
|
||||
int scroll() const {
|
||||
// We need this method to not clobber the real method in Inset
|
||||
return Inset::scroll();
|
||||
}
|
||||
///
|
||||
virtual bool ShowInsetDialog(BufferView *) const { return false; }
|
||||
|
||||
protected:
|
||||
///
|
||||
mutable bool cursor_visible;
|
||||
|
||||
// scrolls to absolute position in bufferview-workwidth * sx units
|
||||
void toggleCursorVisible() const {
|
||||
cursor_visible_ = !cursor_visible_;
|
||||
}
|
||||
///
|
||||
void setCursorVisible(bool b) const {
|
||||
cursor_visible_ = b;
|
||||
}
|
||||
/// scrolls to absolute position in bufferview-workwidth * sx units
|
||||
void scroll(BufferView *, float sx) const;
|
||||
// scrolls offset pixels
|
||||
/// scrolls offset pixels
|
||||
void scroll(BufferView *, int offset) const;
|
||||
private:
|
||||
///
|
||||
mutable bool cursor_visible_;
|
||||
};
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user