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:
Lars Gullik Bjønnes 2001-04-04 20:40:16 +00:00
parent 74784ee97b
commit b79e5c99b0
2 changed files with 74 additions and 63 deletions

View File

@ -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>";

View File

@ -130,7 +130,7 @@ public:
};
///
Inset() { owner_ = 0; top_x = top_baseline = 0; scx = 0; }
Inset() : top_x(0), top_baseline(0), scx(0), owner_(0) {}
///
virtual ~Inset() {}
///
@ -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_;
@ -276,7 +277,7 @@ private:
* 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 {
class UpdatableInset : public Inset {
public:
/** Dispatch result codes
Now that nested updatable insets are allowed, the local dispatch
@ -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