}
// this function should be used always [asierra060396]
- if (owner->view()->available() &&
- owner->view()->the_locking_inset &&
- keysym_return == XK_Escape) {
- owner->view()->unlockInset(owner->view()->the_locking_inset);
- owner->view()->text->CursorRight();
- moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ UpdatableInset * tli = owner->view()->the_locking_inset;
+ if (owner->view()->available() && tli && (keysym_return==XK_Escape)) {
+ if (tli == tli->GetLockingInset()) {
+ owner->view()->unlockInset(tli);
+ owner->view()->text->CursorRight();
+ moveCursorUpdate(false);
+ owner->getMiniBuffer()->Set(CurrentState());
+ } else {
+ tli->UnlockInsetInInset(owner->view(),
+ tli->GetLockingInset());
+ }
return 0;
}
return string();
else {
setMessage(N_("Text mode"));
- LyXDirection direction = owner->view()->text->
- cursor.par->getParDirection();
switch(action) {
case LFUN_UNKNOWN_ACTION:
case LFUN_BREAKPARAGRAPH:
owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_RIGHT:
- if (direction == LYX_DIR_LEFT_TO_RIGHT) {
+ if (!owner->view()->text->cursor.par->isRightToLeftPar()) {
owner->view()->text->CursorRight();
moveCursorUpdate(false);
owner->getMiniBuffer()->
}
return string();
case LFUN_LEFT:
- if (direction == LYX_DIR_RIGHT_TO_LEFT) {
+ if (owner->view()->text->cursor.par->isRightToLeftPar()) {
owner->view()->text->CursorRight();
moveCursorUpdate(false);
owner->getMiniBuffer()->
// Pretend we got the name instead.
Dispatch(int(LFUN_LAYOUT),
textclasslist.NameOfLayout(owner->view()->
- text->parameters->
+ text->bparams->
textclass,
sel).c_str());
return string();
// Derive layout number from given argument (string)
// and current buffer's textclass (number). */
LyXTextClassList::ClassList::size_type tclass =
- owner->view()->text->parameters->textclass;
+ owner->view()->text->bparams->textclass;
pair <bool, LyXTextClass::size_type> layout =
textclasslist.NumberOfLayout(tclass, argument);
case LFUN_EMPH:
Emph();
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_BOLD:
Bold();
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_NOUN:
Noun();
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_CODE:
Code();
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_SANS:
Sans();
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_ROMAN:
Roman();
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_DEFAULT:
StyleReset();
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_UNDERLINE:
Underline();
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_FONT_SIZE:
FontSize(argument);
+ owner->getMiniBuffer()->Set(CurrentState());
break;
case LFUN_FONT_STATE:
case LFUN_RIGHT:
{
LyXText * tmptext = owner->view()->text;
- LyXDirection direction =
- tmptext->cursor.par->getParDirection();
+ bool is_rtl = tmptext->cursor.par->isRightToLeftPar();
if(!tmptext->mark_set)
owner->view()->beforeChange();
owner->view()->update(-2);
- if (direction == LYX_DIR_RIGHT_TO_LEFT)
+ if (is_rtl)
tmptext->CursorLeft();
if (tmptext->cursor.pos < tmptext->cursor.par->Last()
&& tmptext->cursor.par->GetChar(tmptext->cursor.pos)
tmpinset->Edit(owner->view(), 0, 0, 0);
break;
}
- if (direction == LYX_DIR_LEFT_TO_RIGHT)
+ if (!is_rtl)
tmptext->CursorRight();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
// This is soooo ugly. Isn`t it possible to make
// it simpler? (Lgb)
LyXText * txt = owner->view()->text;
- LyXDirection direction = txt->cursor.par->getParDirection();
+ bool is_rtl = txt->cursor.par->isRightToLeftPar();
if(!txt->mark_set) owner->view()->beforeChange();
owner->view()->update(-2);
- if (direction == LYX_DIR_LEFT_TO_RIGHT)
+ if (!is_rtl)
txt->CursorLeft();
if (txt->cursor.pos < txt->cursor.par->Last()
&& txt->cursor.par->GetChar(txt->cursor.pos)
0, 0);
break;
}
- if (direction == LYX_DIR_RIGHT_TO_LEFT)
+ if (is_rtl)
txt->CursorRight();
owner->view()->text->FinishUndo();
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(-2);
- if (owner->view()->text->cursor.par->getParDirection()
- == LYX_DIR_LEFT_TO_RIGHT)
- owner->view()->text->CursorRightOneWord();
- else
+ if (owner->view()->text->cursor.par->isRightToLeftPar())
owner->view()->text->CursorLeftOneWord();
+ else
+ owner->view()->text->CursorRightOneWord();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(-2);
- if (owner->view()->text->cursor.par->getParDirection()
- == LYX_DIR_LEFT_TO_RIGHT)
- owner->view()->text->CursorLeftOneWord();
- else
+ if (owner->view()->text->cursor.par->isRightToLeftPar())
owner->view()->text->CursorRightOneWord();
+ else
+ owner->view()->text->CursorLeftOneWord();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
/* cursor selection ---------------------------- */
case LFUN_RIGHTSEL:
owner->view()->update(-2);
- if (owner->view()->text->cursor.par->getParDirection()
- == LYX_DIR_LEFT_TO_RIGHT)
- owner->view()->text->CursorRight();
- else
+ if (owner->view()->text->cursor.par->isRightToLeftPar())
owner->view()->text->CursorLeft();
+ else
+ owner->view()->text->CursorRight();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
case LFUN_LEFTSEL:
owner->view()->update(-2);
- if (owner->view()->text->cursor.par->getParDirection()
- == LYX_DIR_LEFT_TO_RIGHT)
- owner->view()->text->CursorLeft();
- else
+ if (owner->view()->text->cursor.par->isRightToLeftPar())
owner->view()->text->CursorRight();
+ else
+ owner->view()->text->CursorLeft();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
case LFUN_WORDRIGHTSEL:
owner->view()->update(-2);
- if (owner->view()->text->cursor.par->getParDirection()
- == LYX_DIR_LEFT_TO_RIGHT)
- owner->view()->text->CursorRightOneWord();
- else
+ if (owner->view()->text->cursor.par->isRightToLeftPar())
owner->view()->text->CursorLeftOneWord();
+ else
+ owner->view()->text->CursorRightOneWord();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
case LFUN_WORDLEFTSEL:
owner->view()->update(-2);
- if (owner->view()->text->cursor.par->getParDirection()
- == LYX_DIR_LEFT_TO_RIGHT)
- owner->view()->text->CursorLeftOneWord();
- else
+ if (owner->view()->text->cursor.par->isRightToLeftPar())
owner->view()->text->CursorRightOneWord();
+ else
+ owner->view()->text->CursorLeftOneWord();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());