mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
John's minibuffer, checkInsetHit, lyxfunc-timeout patches + fix crash
on changing ERT insets Status (inlined, open, collapsed). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3138 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d196f7e852
commit
63ab8b3517
@ -874,58 +874,45 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
|
||||
text->setCursorFromCoordinates(bv_, cursor, x, y_tmp);
|
||||
text->setCursor(bv_, cursor, cursor.par(),cursor.pos(),true);
|
||||
|
||||
|
||||
lyx::pos_type pos;
|
||||
|
||||
if (cursor.pos() < cursor.par()->size()
|
||||
&& cursor.par()->isInset(cursor.pos())
|
||||
&& isEditableInset(cursor.par()->getInset(cursor.pos()))) {
|
||||
|
||||
// Check whether the inset really was hit
|
||||
Inset * tmpinset = cursor.par()->getInset(cursor.pos());
|
||||
LyXFont font = text->getFont(buffer_,
|
||||
cursor.par(), cursor.pos());
|
||||
int const width = tmpinset->width(bv_, font);
|
||||
int const inset_x = font.isVisibleRightToLeft()
|
||||
? cursor.x() - width : cursor.x();
|
||||
int const start_x = inset_x + tmpinset->scroll();
|
||||
int const end_x = inset_x + width;
|
||||
|
||||
if (x > start_x && x < end_x
|
||||
&& y_tmp > cursor.y() - tmpinset->ascent(bv_, font)
|
||||
&& y_tmp < cursor.y() + tmpinset->descent(bv_, font)) {
|
||||
text->setCursor(bv_, cursor.par(),cursor.pos(), true);
|
||||
x = x - start_x;
|
||||
// The origin of an inset is on the baseline
|
||||
y = y_tmp - (text->cursor.y());
|
||||
return tmpinset;
|
||||
}
|
||||
&& isEditableInset(cursor.par()->getInset(cursor.pos())))
|
||||
{
|
||||
pos = cursor.pos();
|
||||
} else if ((cursor.pos() - 1 >= 0)
|
||||
&& cursor.par()->isInset(cursor.pos() - 1)
|
||||
&& isEditableInset(cursor.par()->getInset(cursor.pos() - 1)))
|
||||
{
|
||||
pos = cursor.pos() - 1;
|
||||
// if the inset takes a full row, then the cursor.y()
|
||||
// at the end of the inset will be wrong. So step the cursor
|
||||
// back one
|
||||
text->setCursor(bv_, cursor, cursor.par(), cursor.pos() - 1, true);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor.pos() - 1 >= 0) &&
|
||||
cursor.par()->isInset(cursor.pos() - 1) &&
|
||||
isEditableInset(cursor.par()->getInset(cursor.pos() - 1))) {
|
||||
Inset * tmpinset = cursor.par()->getInset(cursor.pos()-1);
|
||||
LyXFont font = text->getFont(buffer_, cursor.par(),
|
||||
cursor.pos() - 1);
|
||||
int const width = tmpinset->width(bv_, font);
|
||||
int const inset_x = font.isVisibleRightToLeft()
|
||||
? cursor.x() : cursor.x() - width;
|
||||
int const start_x = inset_x + tmpinset->scroll();
|
||||
int const end_x = inset_x + width;
|
||||
|
||||
if (x > start_x && x < end_x
|
||||
&& y_tmp > cursor.y() - tmpinset->ascent(bv_, font)
|
||||
&& y_tmp < cursor.y() + tmpinset->descent(bv_, font)) {
|
||||
#if 0
|
||||
if (move_cursor && (tmpinset != bv_->theLockingInset()))
|
||||
#endif
|
||||
text->setCursor(bv_, cursor.par(),
|
||||
cursor.pos() - 1, true);
|
||||
x = x - start_x;
|
||||
// The origin of an inset is on the baseline
|
||||
y = y_tmp - (text->cursor.y());
|
||||
return tmpinset;
|
||||
}
|
||||
// Check whether the inset really was hit
|
||||
Inset * inset = cursor.par()->getInset(pos);
|
||||
LyXFont const & font = text->getFont(buffer_, cursor.par(), pos);
|
||||
int const width = inset->width(bv_, font);
|
||||
int const inset_x = font.isVisibleRightToLeft()
|
||||
? cursor.x() - width : cursor.x();
|
||||
int const start_x = inset_x + inset->scroll();
|
||||
int const end_x = inset_x + width;
|
||||
int const start_y = cursor.y() - inset->ascent(bv_, font);
|
||||
int const end_y = cursor.y() + inset->descent(bv_, font);
|
||||
|
||||
if (x > start_x && x < end_x && y_tmp > start_y && y < end_y) {
|
||||
text->setCursor(bv_, cursor.par(), pos, true);
|
||||
x = x - start_x;
|
||||
// The origin of an inset is on the baseline
|
||||
y = y_tmp - (text->cursor.y());
|
||||
return inset;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,20 @@
|
||||
2001-12-03 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* text.C (rowLast): simplified code
|
||||
|
||||
2001-12-03 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* lyxfunc.C: fix show options on timeout
|
||||
|
||||
2001-12-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* screen.C (topCursorVisible): scroll half a page when the cursor
|
||||
reached top of bottom of screen
|
||||
|
||||
2001-12-02 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* minibuffer.C: deactivate on loss of focus
|
||||
|
||||
2001-12-02 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* vspace.[Ch] (operator!=): add operator.
|
||||
@ -12,6 +24,10 @@
|
||||
* BufferView_pimpl.C: refuse to open an inset when
|
||||
there's a selection.
|
||||
|
||||
2001-11-30 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* BufferView_pimpl.C: allow to click on RHS of full row insets
|
||||
|
||||
2001-11-30 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* tabular.C (LyXTabular): add a same_id to set the same id's in the
|
||||
@ -107,7 +123,7 @@
|
||||
* paragraph_pimpl.h:
|
||||
* paragraph_pimpl.C: tidy, and fix font-change in "LaTeX"
|
||||
bug a bit
|
||||
|
||||
|
||||
2001-11-26 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* text.C:
|
||||
|
@ -1,3 +1,8 @@
|
||||
2001-12-03 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettext.C (updateInsetInInset): use lt variable to forbid
|
||||
changes of LyXText in an update call.
|
||||
|
||||
2001-12-01 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* insettabular.C: capture some more functions to prevent
|
||||
|
@ -842,8 +842,17 @@ bool InsetText::updateInsetInInset(BufferView * bv, Inset * inset)
|
||||
setUpdateStatus(bv, CURSOR_PAR);
|
||||
return the_locking_inset->updateInsetInInset(bv, inset);
|
||||
}
|
||||
if (getLyXText(bv)->updateInset(bv, inset))
|
||||
bool clear = false;
|
||||
if (!lt) {
|
||||
lt = getLyXText(bv);
|
||||
clear = true;
|
||||
}
|
||||
if (lt->updateInset(bv, inset)) {
|
||||
if (clear)
|
||||
lt = 0;
|
||||
updateLocal(bv, CURSOR_PAR, false);
|
||||
} else if (clear)
|
||||
lt = 0;
|
||||
if (cpar(bv) == inset_par && cpos(bv) == inset_pos) {
|
||||
inset_x = cx(bv) - top_x + drawTextXOffset;
|
||||
inset_y = cy(bv) + drawTextYOffset;
|
||||
@ -2202,12 +2211,18 @@ void InsetText::reinitLyXText() const
|
||||
|
||||
void InsetText::removeNewlines()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
for (Paragraph * p = par; p; p = p->next()) {
|
||||
for (int i = 0; i < p->size(); ++i) {
|
||||
if (p->getChar(i) == Paragraph::META_NEWLINE)
|
||||
if (p->getChar(i) == Paragraph::META_NEWLINE) {
|
||||
changed = true;
|
||||
p->erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
reinitLyXText();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2015,7 +2015,7 @@ void LyXFunc::initMiniBuffer()
|
||||
|
||||
// Else, when a non-complete key sequence is pressed,
|
||||
// show the available options.
|
||||
else if (keyseq.length() > 1) {
|
||||
if (keyseq.length() > 0 && !keyseq.deleted()) {
|
||||
text = keyseq.printOptions();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "Lsstream.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace {
|
||||
// this is now here and in lyxgluelength.C
|
||||
|
||||
|
@ -100,6 +100,9 @@ void MiniBuffer::stored_set(string const & str)
|
||||
int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
|
||||
{
|
||||
switch (event) {
|
||||
case FL_UNFOCUS:
|
||||
deactivate();
|
||||
break;
|
||||
case FL_KEYBOARD:
|
||||
{
|
||||
char const * tmp = fl_get_input(ob);
|
||||
|
@ -233,9 +233,7 @@ int LyXText::singleWidth(BufferView * bview, Paragraph * par,
|
||||
// Returns the paragraph position of the last character in the specified row
|
||||
pos_type LyXText::rowLast(Row const * row) const
|
||||
{
|
||||
if (row->next() == 0)
|
||||
return row->par()->size() - 1;
|
||||
else if (row->next()->par() != row->par())
|
||||
if (!row->next() || row->next()->par() != row->par())
|
||||
return row->par()->size() - 1;
|
||||
else
|
||||
return row->next()->pos() - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user