+2000-10-19 Juergen Vigna <jug@sad.it>
+
+ * src/lyxfunc.C (MenuNew): small fix (form John)
+
+ * src/screen.C (Update): removed unneeded code.
+
+ * src/tabular.C (Ascii): refixed int != uint bug!
+
+ * src/support/lyxlib.h: added sys/types.h include for now permits
+ compiling, but I don't like this!
+
+2000-10-18 Juergen Vigna <jug@sad.it>
+
+ * src/text2.C (ClearSelection): if we clear the selection we need
+ more refresh so set the status aprpriate
+
+ * src/insets/insettext.C (draw): hopefully finally fixed draw
+ problems!
+
+2000-10-12 Juergen Vigna <jug@sad.it>
+
+ * src/insets/insettext.C (draw): another small fix and make a block
+ so that variables are localized.
+
2000-10-18 Angus Leeming <a.leeming@ic.ac.uk>
* src/support/lstrings.C (lowercase, uppercase):
use explicit casts to remove compiler warnings.
return;
}
x += TEXT_TO_INSET_OFFSET;
- int y = 0;
- Row * row = TEXT(bv)->GetRowNearY(y);
- int y_offset = baseline - row->ascent_of_text();
- int ph = pain.paperHeight();
- y += y_offset;
- while ((row != 0) && ((y+row->height()) <= 0)) {
- y += row->height();
- row = row->next();
- }
- y -= y_offset;
- TEXT(bv)->first = y;
- if (cleared || !locked || (need_update == FULL)) {
- int first = y;
- y = 0;
- while ((row != 0) && (y < ph)) {
- TEXT(bv)->GetVisibleRow(bv, y+first+y_offset, int(x), row,
- y+first, cleared);
+ {
+ int y = 0;
+ Row * row = TEXT(bv)->GetRowNearY(y);
+ int y_offset = baseline - row->ascent_of_text();
+ int ph = pain.paperHeight();
+ int first = 0;
+ y = y_offset;
+ while ((row != 0) && ((y+row->height()) <= 0)) {
y += row->height();
+ first += row->height();
row = row->next();
}
- } else if (need_update == SELECTION) {
- bv->screen()->ToggleToggle(TEXT(bv), y+y_offset, int(x));
- } else {
- locked = false;
- if (need_update == CURSOR) {
- bv->screen()->ToggleSelection(TEXT(bv), true, y+y_offset, int(x));
- TEXT(bv)->ClearSelection();
- TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
+ if (y_offset < 0)
+ y_offset = y;
+ TEXT(bv)->first = first;
+ if (cleared || !locked || (need_update == FULL)) {
+ int yf = y_offset;
+ y = 0;
+ while ((row != 0) && (yf < ph)) {
+ TEXT(bv)->GetVisibleRow(bv, y+y_offset, int(x), row,
+ y+first, cleared);
+ y += row->height();
+ yf += row->height();
+ row = row->next();
+ }
+ } else if (need_update == SELECTION) {
+ bv->screen()->ToggleToggle(TEXT(bv), y_offset, int(x));
+ } else {
+ locked = false;
+ if (need_update == CURSOR) {
+ bv->screen()->ToggleSelection(TEXT(bv), true, y_offset,int(x));
+ TEXT(bv)->ClearSelection();
+ TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
+ }
+ bv->screen()->Update(TEXT(bv), y_offset, int(x));
+ locked = true;
}
- bv->screen()->Update(TEXT(bv), y, int(x));
- locked = true;
}
TEXT(bv)->refresh_y = 0;
TEXT(bv)->status = LyXText::UNCHANGED;
bv->text->FinishUndo();
result= moveLeft(bv);
TEXT(bv)->ClearSelection();
+ TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
UpdateLocal(bv, CURSOR, false);
break;
case LFUN_DOWNSEL:
bv->text->FinishUndo();
result = moveDown(bv);
TEXT(bv)->ClearSelection();
+ TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
UpdateLocal(bv, CURSOR, false);
break;
case LFUN_UPSEL:
bv->text->FinishUndo();
result = moveUp(bv);
TEXT(bv)->ClearSelection();
+ TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
UpdateLocal(bv, CURSOR, false);
break;
case LFUN_HOME:
bv->text->FinishUndo();
TEXT(bv)->CursorHome(bv);
+ TEXT(bv)->ClearSelection();
+ TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
UpdateLocal(bv, CURSOR, false);
break;
case LFUN_END:
TEXT(bv)->CursorEnd(bv);
+ TEXT(bv)->ClearSelection();
+ TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
UpdateLocal(bv, CURSOR, false);
break;
case LFUN_BACKSPACE:
fname = fileDlg.Select(_("Choose template"),
lyxrc.template_path,
"*.lyx");
+ if (fname.empty())
+ return;
templname = fname;
AllowInput(owner->view());
}
/// the current font
mutable LyXFont real_current_font;
/// first visible pixel-row is set from LyXScreen!!!
- unsigned int first;
+ // unsigned is wrong here for text-insets!
+ int first;
///
BufferView * bv_owner;
///
{
if (cursor_visible) HideCursor();
- unsigned int old_first = text->first;
+ int old_first = text->first;
text->first = y;
// is any optimiziation possible?
{
int newtop = text->first;
- if (y + desc - text->first >= owner.height())
+ if (y + desc - text->first >= (int)owner.height())
newtop = y - 3 * owner.height() / 4; // the scroll region must be so big!!
else if (y - asc < (int)text->first
&& text->first > 0) {
void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
int asc, int desc, Cursor_Shape shape)
{
- unsigned int y1 = max(y - text->first - asc, 0U);
+ unsigned int y1 = max(y - text->first - asc, 0);
typedef unsigned int uint;
- unsigned int y2 = min(y - text->first + desc, owner.height());
+ unsigned int y2 = min(y - text->first + desc, (int)owner.height());
// Secure against very strange situations
y2 = max(y2, y1);
else
newtop = text->cursor.y()
- 3 * owner.height() / 4; /* the scroll region must be so big!! */
- } else if (text->cursor.y() - text->cursor.row()->baseline() < text->first
- && text->first > 0) {
+ } else if ((int)(text->cursor.y() - text->cursor.row()->baseline()) <
+ text->first && text->first > 0)
+ {
if (text->cursor.row()->height() < owner.height()
&& text->cursor.row()->height() > owner.height() / 4)
newtop = text->cursor.y() - text->cursor.row()->baseline();
bool LyXScreen::FitCursor(LyXText * text)
{
// Is a change necessary?
- unsigned int newtop = TopCursorVisible(text);
+ int newtop = TopCursorVisible(text);
bool result = (newtop != text->first);
if (result)
Draw(text, newtop);
case LyXText::NEED_MORE_REFRESH:
{
int y = max(int(text->refresh_y - text->first), 0);
- int height;
- if (text->inset_owner)
- height = text->inset_owner->ascent(owner.owner(),
- text->real_current_font)
- + text->inset_owner->descent(owner.owner(),
- text->real_current_font);
- else
- height = owner.height();
DrawFromTo(text, y, owner.height(), y_offset, x_offset);
text->refresh_y = 0;
text->status = LyXText::UNCHANGED;
- expose(0, y,
- owner.workWidth(), owner.height() - y);
+ expose(0, y, owner.workWidth(), owner.height() - y);
}
break;
case LyXText::NEED_VERY_LITTLE_REFRESH:
// only if there is a selection
if (!text->selection) return;
- int bottom = min(max(text->sel_end_cursor.y()
+ int bottom = min(max((int)(text->sel_end_cursor.y()
- text->sel_end_cursor.row()->baseline()
- + text->sel_end_cursor.row()->height(), text->first),
- text->first + owner.height());
- int top = min(max(text->sel_start_cursor.y()
- - text->sel_start_cursor.row()->baseline(), text->first),
- text->first + owner.height());
+ + text->sel_end_cursor.row()->height()), text->first),
+ (int)(text->first + owner.height()));
+ int top = min(max((int)(text->sel_start_cursor.y() -
+ text->sel_start_cursor.row()->baseline()),
+ text->first),
+ (int)(text->first + owner.height()));
if (kill_selection)
text->selection = 0;
typedef unsigned int uint;
- bottom = min(max(uint(bottom), text->first), text->first + owner.height());
- top = min(max(uint(top), text->first), text->first + owner.height());
+ bottom = min(max(bottom, text->first), (int)(text->first + owner.height()));
+ top = min(max(top, text->first), (int)(text->first + owner.height()));
DrawFromTo(text, top - text->first, bottom - text->first, y_offset,
x_offset);
#define LYX_LIB_H
#include "LString.h"
+#include <sys/types.h>
// Where can I put this? I found the occurence of the same code
// three/four times. Don't you think it better to use a macro definition
continue;
ostringstream sstr;
GetCellInset(cell)->Ascii(buf, sstr, 0);
- string::size_type len = sstr.str().length();
+ int len = int(sstr.str().length());
int const n = cells_in_multicolumn(cell);
for (int k = j; (len > 0) && (k < (j + n - 1)); ++k)
len -= clen[k];
- if (len > clen[j + n - 1])
+ if (len > int(clen[j + n - 1]))
clen[j + n - 1] = len;
}
}
void LyXText::ClearSelection() const
{
+ if (selection)
+ status = LyXText::NEED_MORE_REFRESH;
selection = false;
mark_set = false;
}