#include "ParagraphParameters.h"
#include "undo_funcs.h"
#include "funcrequest.h"
-#include "language.h"
#include "factory.h"
#include "insets/insetbib.h"
}
-void BufferView::Pimpl::finishChange(bool fitcur)
-{
- finishUndo();
- moveCursorUpdate(fitcur);
- bv_->owner()->view_state_changed();
-}
-
-
void BufferView::Pimpl::savePosition(unsigned int i)
{
if (i >= saved_positions_num)
}
break;
- case LFUN_QUOTE:
- smartQuote();
- break;
-
case LFUN_HTMLURL:
case LFUN_URL:
{
}
-void BufferView::Pimpl::smartQuote()
-{
- LyXText const * lt = bv_->getLyXText();
- Paragraph const * par = lt->cursor.par();
- pos_type pos = lt->cursor.pos();
- char c;
-
- if (!pos
- || (par->isInset(pos - 1)
- && par->getInset(pos - 1)->isSpace()))
- c = ' ';
- else
- c = par->getChar(pos - 1);
-
- hideCursor();
-
- LyXLayout_ptr const & style = par->layout();
-
- if (style->pass_thru ||
- par->getFontSettings(buffer_->params,
- pos).language()->lang() == "hebrew" ||
- (!insertInset(new InsetQuotes(c, buffer_->params))))
- bv_->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
-}
-
-
// Open and lock an updatable inset
bool BufferView::Pimpl::open_new_inset(UpdatableInset * new_inset, bool behind)
{
#include "ParagraphParameters.h"
#include "gettext.h"
#include "intl.h"
+#include "language.h"
#include "support/lstrings.h"
#include "frontends/LyXView.h"
#include "frontends/screen.h"
#include "frontends/WorkArea.h"
#include "insets/insetspecialchar.h"
#include "insets/insettext.h"
+#include "insets/insetquotes.h"
#include "insets/insetcommand.h"
#include "undo_funcs.h"
extern string current_layout;
+namespace {
+
+ void finishChange(BufferView * bv, bool fitcur = false)
+ {
+ finishUndo();
+ bv->moveCursorUpdate(fitcur);
+ bv->owner()->view_state_changed();
+ }
+
+}
+
bool LyXText::gotoNextInset(BufferView * bv,
vector<Inset::Code> const & codes, string const & contents) const
update(bv, false);
deleteWordForward(bv);
update(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_DELETE_WORD_BACKWARD:
update(bv, false);
deleteWordBackward(bv);
update(bv, true);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_DELETE_LINE_FORWARD:
update(bv, false);
deleteLineForward(bv);
update(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_SHIFT_TAB:
bv->beforeChange(this);
update(bv, false);
cursorTab(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_WORDRIGHT:
cursorLeftOneWord(bv);
else
cursorRightOneWord(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_WORDLEFT:
cursorRightOneWord(bv);
else
cursorLeftOneWord(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_BEGINNINGBUF:
bv->beforeChange(this);
update(bv, false);
cursorTop(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_ENDBUF:
bv->beforeChange(this);
update(bv, false);
cursorBottom(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_RIGHTSEL:
cursorLeft(bv);
else
cursorRight(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_LEFTSEL:
cursorRight(bv);
else
cursorLeft(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_UPSEL:
update(bv, false);
cursorUp(bv, true);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_DOWNSEL:
update(bv, false);
cursorDown(bv, true);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_UP_PARAGRAPHSEL:
update(bv, false);
cursorUpParagraph(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_DOWN_PARAGRAPHSEL:
update(bv, false);
cursorDownParagraph(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_PRIORSEL:
update(bv, false);
cursorPrevious(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_NEXTSEL:
update(bv, false);
cursorNext(bv);
- bv->finishChange();
+ finishChange(bv, true);
break;
case LFUN_HOMESEL:
update(bv, false);
cursorHome(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_ENDSEL:
update(bv, false);
cursorEnd(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_WORDRIGHTSEL:
cursorLeftOneWord(bv);
else
cursorRightOneWord(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_WORDLEFTSEL:
cursorRightOneWord(bv);
else
cursorLeftOneWord(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_RIGHT: {
}
if (!is_rtl)
cursorRight(bv, false);
- bv->finishChange(false);
+ finishChange(bv);
break;
}
}
if (is_rtl)
cursorRight(bv, false);
- bv->finishChange(false);
+ finishChange(bv);
break;
}
bv->beforeChange(this);
bv->update(this, BufferView::UPDATE);
cursorUp(bv);
- bv->finishChange(false);
+ finishChange(bv);
break;
case LFUN_DOWN:
bv->beforeChange(this);
bv->update(this, BufferView::UPDATE);
cursorDown(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_UP_PARAGRAPH:
bv->beforeChange(this);
bv->update(this, BufferView::UPDATE);
cursorUpParagraph(bv);
- bv->finishChange();
+ finishChange(bv);
break;
case LFUN_DOWN_PARAGRAPH:
bv->beforeChange(this);
bv->update(this, BufferView::UPDATE);
cursorDownParagraph(bv);
- bv->finishChange(false);
+ finishChange(bv, false);
break;
case LFUN_PRIOR:
bv->beforeChange(this);
bv->update(this, BufferView::UPDATE);
cursorPrevious(bv);
- bv->finishChange(false);
+ finishChange(bv, false);
// was:
// finishUndo();
// moveCursorUpdate(false, false);
bv->beforeChange(this);
bv->update(this, BufferView::UPDATE);
cursorNext(bv);
- bv->finishChange(false);
+ finishChange(bv, false);
break;
case LFUN_HOME:
bv->beforeChange(this);
update(bv);
cursorHome(bv);
- bv->finishChange(false);
+ finishChange(bv, false);
break;
case LFUN_END:
bv->beforeChange(this);
update(bv);
cursorEnd(bv);
- bv->finishChange(false);
+ finishChange(bv, false);
break;
case LFUN_BREAKLINE:
return Inset::UNDISPATCHED;
update(bv, false);
cursorTop(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_ENDBUFSEL:
return Inset::UNDISPATCHED;
update(bv, false);
cursorBottom(bv);
- bv->finishChange(true);
+ finishChange(bv, true);
break;
case LFUN_GETXY:
break;
}
+ case LFUN_QUOTE: {
+ Paragraph const * par = cursor.par();
+ lyx::pos_type pos = cursor.pos();
+ char c;
+
+ if (!pos)
+ c = ' ';
+ else if (par->isInset(pos - 1) && par->getInset(pos - 1)->isSpace())
+ c = ' ';
+ else
+ c = par->getChar(pos - 1);
+
+ bv->hideCursor();
+ LyXLayout_ptr const & style = par->layout();
+
+ if (style->pass_thru ||
+ par->getFontSettings(bv->buffer()->params,
+ pos).language()->lang() == "hebrew" ||
+ (!bv->insertInset(new InsetQuotes(c, bv->buffer()->params))))
+ bv->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
+ break;
+ }
+
case LFUN_SELFINSERT: {
if (cmd.argument.empty())
break;