} // anon namespace
-BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
+BufferView::Pimpl::Pimpl(BufferView * bv, LyXView * owner,
int xpos, int ypos, int width, int height)
- : bv_(b), owner_(o), buffer_(0), cursor_timeout(400),
+ : bv_(bv), owner_(owner), buffer_(0), cursor_timeout(400),
using_xterm_cursor(false)
{
workarea_.reset(WorkAreaFactory::create(xpos, ypos, width, height));
screen_.reset(LyXScreenFactory::create(workarea()));
// Setup the signals
- doccon = workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
+ doccon = workarea().scrollDocView
+ .connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
resizecon = workarea().workAreaResize
.connect(boost::bind(&BufferView::Pimpl::workAreaResize, this));
bpresscon = workarea().workAreaButtonPress
lostcon = workarea().selectionLost
.connect(boost::bind(&BufferView::Pimpl::selectionLost, this));
- timecon = cursor_timeout.timeout.connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
+ timecon = cursor_timeout.timeout
+ .connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
cursor_timeout.start();
saved_positions.resize(saved_positions_num);
}
bv_->text = 0;
}
- // Set current buffer
+ // set current buffer
buffer_ = b;
if (bufferlist.getState() == BufferList::CLOSING) return;
- // If we are closing the buffer, use the first buffer as current
+ // if we are closing the buffer, use the first buffer as current
if (!buffer_) {
buffer_ = bufferlist.first();
}
}
// FIXME: needed when ?
- bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
+ bv_->text->first_y =
+ screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
// Similarly, buffer-dependent dialogs should be updated or
// hidden. This should go here because some dialogs (eg ToC)
LyXTextClass const & tclass = buffer_->params.getLyXTextClass();
switch (ev.action) {
- // --- Misc -------------------------------------------
- case LFUN_APPENDIX:
- {
- if (available()) {
- LyXText * lt = bv_->getLyXText();
- lt->toggleAppendix(bv_);
- update(lt,
- BufferView::SELECT
- | BufferView::FITCUR
- | BufferView::CHANGE);
- }
- }
- break;
case LFUN_TOC_INSERT:
{
}
case LFUN_SCROLL_INSET:
- // this is not handled here as this funktion is only aktive
+ // this is not handled here as this function is only active
// if we have a locking_inset and that one is (or contains)
// a tabular-inset
break;
break;
default:
- return false;
+ FuncRequest cmd = ev;
+ cmd.setView(bv_);
+ return bv_->getLyXText()->dispatch(cmd);
} // end of switch
return true;
+
+2002-08-19 André Pönitz <poenitz@gmx.net>
+
+ * lyxtext.h:
+ * text.C: new LyXText::dispatch()
+
+ * BufferView_pimpl.C: move handling of LFUN_APPENDIX to LyXText
+
2002-08-18 Dekel Tsur <dekelts@tau.ac.il>
* text.C (paintRowSelection): Fix code for rows with both RTL & LTR text.
paragraphs */
void decDepth(BufferView *);
- /** Get the depth at current cursor position
- */
+ /// get the depth at current cursor position
int getDepth() const;
/** set font over selection and make a total rebreak of those
///
void insertInset(BufferView *, Inset * inset);
- /** Completes the insertion with a full rebreak. */
+ /// Completes the insertion with a full rebreak
void fullRebreak(BufferView *);
///
///
void status(BufferView *, text_status) const;
+ ///
+ Inset::RESULT dispatch(FuncRequest const & cmd);
+
private:
/** wether the screen needs a refresh,
starting with refresh_y
///
void checkParagraph(BufferView *, Paragraph * par, lyx::pos_type pos);
///
- void toggleAppendix(BufferView *);
- ///
int workWidth(BufferView *) const;
///
int workWidth(BufferView *, Inset * inset) const;
private:
///
void setCounter(Buffer const *, Paragraph * par) const;
+ ///
+ Inset::RESULT lfunAppendix(FuncRequest const & cmd);
/*
* some low level functions
#include "ParagraphParameters.h"
#include "undo_funcs.h"
#include "WordLangTuple.h"
+#include "funcrequest.h"
#include "insets/insetbib.h"
#include "insets/insettext.h"
{
return cursor.par()->getDepth();
}
+
+
+Inset::RESULT LyXText::lfunAppendix(FuncRequest const & cmd)
+{
+ BufferView * bv = cmd.view();
+ // what is this good for?
+ if (!bv->available())
+ return Inset::UNDISPATCHED;
+
+ Paragraph * par = cursor.par();
+ bool start = !par->params().startOfAppendix();
+
+ // ensure that we have only one start_of_appendix in this document
+ Paragraph * tmp = ownerParagraph();
+ for (; tmp; tmp = tmp->next()) {
+ tmp->params().startOfAppendix(false);
+ }
+
+ par->params().startOfAppendix(start);
+
+ // we can set the refreshing parameters now
+ status(cmd.view(), LyXText::NEED_MORE_REFRESH);
+ refresh_y = 0;
+ refresh_row = 0; // not needed for full update
+ updateCounters(cmd.view());
+ setCursor(cmd.view(), cursor.par(), cursor.pos());
+ bv->update(this,
+ BufferView::SELECT
+ | BufferView::FITCUR
+ | BufferView::CHANGE);
+ return Inset::DISPATCHED;
+}
+
+
+Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
+{
+ switch (cmd.action) {
+ case LFUN_APPENDIX:
+ return lfunAppendix(cmd);
+
+ default:
+ return Inset::UNDISPATCHED;
+ }
+ // shut up compiler
+ return Inset::UNDISPATCHED;
+}
}
-void LyXText::toggleAppendix(BufferView * bview)
-{
- Paragraph * par = cursor.par();
- bool start = !par->params().startOfAppendix();
-
- // ensure that we have only one start_of_appendix in this document
- Paragraph * tmp = ownerParagraph();
- for (; tmp; tmp = tmp->next()) {
- tmp->params().startOfAppendix(false);
- }
-
- par->params().startOfAppendix(start);
-
- // we can set the refreshing parameters now
- status(bview, LyXText::NEED_MORE_REFRESH);
- refresh_y = 0;
- refresh_row = 0; // not needed for full update
- updateCounters(bview);
- setCursor(bview, cursor.par(), cursor.pos());
-}
-
-
Paragraph * LyXText::ownerParagraph() const
{
if (inset_owner) {