+2000-06-19 Juergen Vigna <jug@sad.it>
+
+ * src/BufferView.h: added screen() function.
+
+ * src/insets/insettext.C (LocalDispatch): some selection code
+ fixed.
+
+ * src/vspace.C (nextToken): use stringfunctions instead of sscanf.
+
+ * src/insets/insettext.C (SetParagraphData):
+ (Read):
+ (InsetText): fixes for multiple paragraphs.
+
2000-06-17 Kayvan A. Sylvan <kayvan@sylvan.com>
* development/lyx.spec.in: Call configure with ``--without-warnings''
argument:
--------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
+class: FL_BOX
+type: FRAME_BOX
box: 120 190 190 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_COL1
=============== FORM ===============
Name: form_character
-Width: 295
-Height: 385
+Width: 300
+Height: 415
Number of Objects: 16
--------------------
class: FL_BOX
type: UP_BOX
-box: 0 0 295 385
+box: 0 0 300 415
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
callback:
argument:
---------------------
-class: FL_CHOICE
-type: NORMAL_CHOICE
-box: 95 155 190 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Language|#L
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NorthWest FL_NorthEast
-name: choice_language
-callback:
-argument:
-
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
-box: 10 295 280 45
+box: 10 325 280 45
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
-box: 10 235 280 45
+box: 10 265 280 45
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
lcol: FL_BLACK
-label: Family:|#F
+label:
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
-name: choice_family
+name:
callback:
argument:
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
-box: 10 10 280 210
+box: 10 10 280 240
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
lcol: FL_BLACK
-label: Series:|#S
+label:
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
-name: choice_series
+name:
callback:
argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 94 95 191 30
+box: 94 15 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Shape:|#H
+label: Family:|#F
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
-name: choice_shape
+name: choice_family
callback:
argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 94 50 191 30
+box: 94 55 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Color:|#C
+label: Series:|#S
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
-name: choice_color
+name: choice_series
callback:
argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 94 85 191 30
+box: 94 95 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Toggle on all these|#T
-shortcut:
-resize: FL_RESIZE_X
-gravity: FL_NorthWest FL_NorthEast
-name: check_toggle_all
-callback:
-argument:
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 10 320 280 45
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
-shortcut:
-resize: FL_RESIZE_X
-gravity: FL_NorthWest FL_NorthEast
-name:
-callback:
-argument:
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 10 260 280 45
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label:
+label: Shape:|#H
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
-name:
+name: choice_shape
callback:
argument:
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 95 245 191 30
+box: 95 275 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 95 305 190 30
+box: 95 335 190 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 60 345 80 30
+box: 60 375 80 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
-box: 175 345 80 30
+box: 175 375 80 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 95 120 191 30
+box: 95 135 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 30 190 260 25
+box: 30 215 255 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: Toggle on all these|#T
shortcut:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
-box: 20 225 210 20
+box: 20 255 210 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: These are never toggled
shortcut:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
-box: 20 285 215 20
+box: 20 315 215 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
+size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: These are always toggled
shortcut:
argument:
--------------------
-class: FL_BOX
-type: FRAME_BOX
+class: FL_CHOICE
+type: DROPLIST_CHOICE
box: 95 175 190 30
boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_COL1
+colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Language:
shortcut:
-resize: FL_RESIZE_NONE
-gravity: FL_NorthWest FL_NoGravity
+resize: FL_RESIZE_X
+gravity: FL_NorthWest FL_NorthEast
name: choice_language
callback:
argument:
# Various commands
FDESIGN = fdesign
-SRCS = bullet_forms.fd cite.fd credits_form.fd form1.fd \
+SRCS = bullet_forms.fd credits_form.fd form1.fd \
latexoptions.fd layout_forms.fd lyx.fd lyx_sendfax.fd math_forms.fd \
print_form.fd sp_form.fd
-OBJS = bullet_forms.c cite.c credits_form.c form1.c \
+OBJS = bullet_forms.c credits_form.c form1.c \
latexoptions.c layout_forms.c lyx.c lyx_sendfax.c math_forms.c \
print_form.c sp_form.c
-COBJS = bullet_forms.C cite.C credits_form.C form1.C \
+COBJS = bullet_forms.C credits_form.C form1.C \
latexoptions.C layout_forms.C lyx.C lyx_sendfax.C math_forms.C \
print_form.C sp_form.C
#include "BufferView_pimpl.h"
#include "lyxtext.h"
#include "WorkArea.h"
+#include "lyxscreen.h"
BufferView::BufferView(LyXView * o, int xpos, int ypos,
}
+LyXScreen * BufferView::screen() const
+{
+ return pimpl_->screen_;
+}
+
+
LyXView * BufferView::owner() const
{
return pimpl_->owner_;
class LyXText;
class TeXErrors;
class Buffer;
+class LyXScreen;
///
class BufferView {
///
Painter & painter();
///
+ LyXScreen * screen() const;
+ ///
void buffer(Buffer * b);
///
void resize(int, int, int, int);
text->SetCursor(this, cursor,
cursor.par(), cursor.pos() - 1);
y += cursor.y() + the_locking_inset->InsetInInsetY();
- pimpl_->screen->ShowManualCursor(x, y, asc, desc,
+ pimpl_->screen_->ShowManualCursor(x, y, asc, desc,
LyXScreen::BAR_SHAPE);
}
}
void BufferView::hideLockedInsetCursor()
{
if (the_locking_inset && available()) {
- pimpl_->screen->HideCursor();
+ pimpl_->screen_->HideCursor();
}
}
{
if (the_locking_inset && available()){
y += text->cursor.y() + the_locking_inset->InsetInInsetY();
- if (pimpl_->screen->FitManualCursor(x, y, asc, desc))
+ if (pimpl_->screen_->FitManualCursor(x, y, asc, desc))
updateScrollbar();
}
}
{
buffer_ = 0;
workarea_ = new WorkArea(bv_, xpos, ypos, width, height);
- screen = 0;
+ screen_ = 0;
cursor_timeout.callback(BufferView::cursorToggleCB, bv_);
current_scrollbar_value = 0;
// Nuke old image
// screen is always deleted when the buffer is changed.
- delete screen;
- screen = 0;
+ delete screen_;
+ screen_ = 0;
// If we are closing the buffer, use the first buffer as current
if (!buffer_) {
updateScreen();
updateScrollbar();
}
- screen->first = screen->TopCursorVisible();
+ screen_->first = screen_->TopCursorVisible();
redraw();
owner_->getDialogs()->updateBufferDependent();
bv_->insetWakeup();
bool BufferView::Pimpl::fitCursor()
{
- Assert(screen); // it is a programming error to call fitCursor
+ Assert(screen_); // it is a programming error to call fitCursor
// without a valid screen.
- bool ret = screen->FitCursor();
+ bool ret = screen_->FitCursor();
if (ret) updateScrollbar();
return ret;
}
bv_->text->selection = false;
}
}
- screen->first = screen->TopCursorVisible(); /* this will scroll the
+ screen_->first = screen_->TopCursorVisible(); /* this will scroll the
* screen such that the
* cursor becomes
* visible */
void BufferView::Pimpl::gotoError()
{
- if (!screen)
+ if (!screen_)
return;
- screen->HideCursor();
+ screen_->HideCursor();
bv_->beforeChange();
update(BufferView::SELECT|BufferView::FITCUR);
LyXCursor tmp;
void BufferView::Pimpl::updateScreen()
{
// Regenerate the screen.
- delete screen;
- screen = new LyXScreen(*workarea_, bv_->text);
+ delete screen_;
+ screen_ = new LyXScreen(*workarea_, bv_->text);
}
if (bv_->text)
cbth = bv_->text->height;
- if (screen)
- cbsf = screen->first;
+ if (screen_)
+ cbsf = screen_->first;
// check if anything has changed.
if (max2 == cbth &&
if (current_scrollbar_value < 0)
current_scrollbar_value = 0;
- if (!screen)
+ if (!screen_)
return;
- screen->Draw(current_scrollbar_value);
+ screen_->Draw(current_scrollbar_value);
if (cursor_follows_scrollbar) {
LyXText * vbt = bv_->text;
unsigned int height = vbt->DefaultHeight();
- if (vbt->cursor.y() < screen->first + height) {
+ if (vbt->cursor.y() < screen_->first + height) {
vbt->SetCursorFromCoordinates(bv_, 0,
- screen->first +
+ screen_->first +
height);
} else if (vbt->cursor.y() >
- screen->first + workarea_->height() - height) {
+ screen_->first + workarea_->height() - height) {
vbt->SetCursorFromCoordinates(bv_, 0,
- screen->first +
+ screen_->first +
workarea_->height() -
height);
}
int BufferView::Pimpl::scrollUp(long time)
{
if (buffer_ == 0) return 0;
- if (!screen) return 0;
+ if (!screen_) return 0;
double value = workarea_->getScrollbarValue();
int BufferView::Pimpl::scrollDown(long time)
{
if (buffer_ == 0) return 0;
- if (!screen) return 0;
+ if (!screen_) return 0;
double value= workarea_->getScrollbarValue();
pair<float, float> p = workarea_->getScrollbarBounds();
if (!(state & Button1MotionMask))
return;
- if (buffer_ == 0 || !screen) return;
+ if (buffer_ == 0 || !screen_) return;
// Check for inset locking
if (bv_->the_locking_inset) {
bv_->the_locking_inset->
InsetMotionNotify(bv_,
x - cursor.x(),
- y - cursor.y() + screen->first,
+ y - cursor.y() + screen_->first,
state);
return;
}
/* The selection possible is needed, that only motion events are
* used, where the bottom press event was on the drawing area too */
if (selection_possible) {
- screen->HideCursor();
+ screen_->HideCursor();
- bv_->text->SetCursorFromCoordinates(bv_, x, y + screen->first);
+ bv_->text->SetCursorFromCoordinates(bv_, x, y + screen_->first);
if (!bv_->text->selection)
update(BufferView::UPDATE); // Maybe an empty line was deleted
bv_->text->SetSelection();
- screen->ToggleToggle();
+ screen_->ToggleToggle();
fitCursor();
- screen->ShowCursor();
+ screen_->ShowCursor();
}
return;
}
last_click_x = -1;
last_click_y = -1;
- if (buffer_ == 0 || !screen) return;
+ if (buffer_ == 0 || !screen_) return;
Inset * inset_hit = checkInsetHit(xpos, ypos, button);
if (!inset_hit)
selection_possible = true;
- screen->HideCursor();
+ screen_->HideCursor();
#ifndef NEW_TABULAR
// Right button mouse click on a table
if (button == 3 &&
(bv_->text->cursor.par()->table ||
- bv_->text->MouseHitInTable(bv_, xpos, ypos + screen->first))) {
+ bv_->text->MouseHitInTable(bv_, xpos, ypos + screen_->first))) {
// Set the cursor to the press-position
- bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + screen->first);
+ bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + screen_->first);
bool doit = true;
// Only show the table popup if the hit is in
// Hit above or below the table?
if (doit) {
if (!bv_->text->selection) {
- screen->ToggleSelection();
+ screen_->ToggleSelection();
bv_->text->ClearSelection();
bv_->text->FullRebreak(bv_);
- screen->Update();
+ screen_->Update();
updateScrollbar();
}
// Popup table popup when on a table.
}
#endif
- int screen_first = screen->first;
+ int screen_first = screen_->first;
// Middle button press pastes if we have a selection
bool paste_internally = false;
}
// Clear the selection
- screen->ToggleSelection();
+ screen_->ToggleSelection();
bv_->text->ClearSelection();
bv_->text->FullRebreak(bv_);
- screen->Update();
+ screen_->Update();
updateScrollbar();
// Single left click in math inset?
{
// select a word
if (buffer_ && !bv_->the_locking_inset) {
- if (screen && button == 1) {
- screen->HideCursor();
- screen->ToggleSelection();
+ if (screen_ && button == 1) {
+ screen_->HideCursor();
+ screen_->ToggleSelection();
bv_->text->SelectWord(bv_);
- screen->ToggleSelection(false);
+ screen_->ToggleSelection(false);
/* This will fit the cursor on the screen
* if necessary */
update(BufferView::SELECT|BufferView::FITCUR);
void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
{
// select a line
- if (buffer_ && screen && button == 1) {
- screen->HideCursor();
- screen->ToggleSelection();
+ if (buffer_ && screen_ && button == 1) {
+ screen_->HideCursor();
+ screen_->ToggleSelection();
bv_->text->CursorHome(bv_);
bv_->text->sel_cursor = bv_->text->cursor;
bv_->text->CursorEnd(bv_);
bv_->text->SetSelection();
- screen->ToggleSelection(false);
+ screen_->ToggleSelection(false);
/* This will fit the cursor on the screen
* if necessary */
update(BufferView::SELECT|BufferView::FITCUR);
void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
unsigned int button)
{
- if (buffer_ == 0 || screen == 0) return;
+ if (buffer_ == 0 || screen_ == 0) return;
// If we hit an inset, we have the inset coordinates in these
// and inset_hit points to the inset. If we do not hit an
int box_x = 20; // LYX_PAPER_MARGIN;
box_x += lyxfont::width(" wide-tab ", font);
- unsigned int screen_first = screen->first;
+ unsigned int screen_first = screen_->first;
if (x < box_x
&& y + screen_first > bv_->text->cursor.y() -
Inset * BufferView::Pimpl::checkInsetHit(int & x, int & y,
unsigned int /* button */)
{
- if (!screen)
+ if (!screen_)
return 0;
- unsigned int y_tmp = y + screen->first;
+ unsigned int y_tmp = y + screen_->first;
LyXCursor cursor;
bv_->text->SetCursorFromCoordinates(bv_, cursor, x, y_tmp);
// ...including the minibuffer
owner_->getMiniBuffer()->Init();
- } else if (screen) screen->Redraw();
+ } else if (screen_) screen_->Redraw();
} else {
// Grey box when we don't have a buffer
workarea_->greyOut();
void BufferView::Pimpl::update()
{
- if (screen) screen->Update();
+ if (screen_) screen_->Update();
}
// Values used when calling update:
updatelist.update(bv_);
- if (!screen) {
+ if (!screen_) {
goto set_timer_and_return;
}
if (lyx_focus && work_area_focus) {
if (!bv_->the_locking_inset) {
- screen->CursorToggle();
+ screen_->CursorToggle();
} else {
bv_->the_locking_inset->
ToggleInsetCursor(bv_);
} else {
// Make sure that the cursor is visible.
if (!bv_->the_locking_inset) {
- screen->ShowCursor();
+ screen_->ShowCursor();
} else {
if (!bv_->the_locking_inset->isCursorVisible())
bv_->the_locking_inset->
{
if (!bv_->text->cursor.row()->previous()) return;
- long y = screen->first;
+ long y = screen_->first;
Row * cursorrow = bv_->text->cursor.row();
bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
bv_->text->FinishUndo();
bv_->text->CursorUp(bv_);
if (bv_->text->cursor.row()->height() < workarea_->height())
- screen->Draw(bv_->text->cursor.y()
+ screen_->Draw(bv_->text->cursor.y()
- bv_->text->cursor.row()->baseline()
+ bv_->text->cursor.row()->height()
- workarea_->height() + 1 );
{
if (!bv_->text->cursor.row()->next()) return;
- long y = screen->first;
+ long y = screen_->first;
bv_->text->GetRowNearY(y);
Row * cursorrow = bv_->text->cursor.row();
bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y
bv_->text->CursorDown(bv_);
if (bv_->text->cursor.row()->height() < workarea_->height())
- screen->Draw(bv_->text->cursor.y()
+ screen_->Draw(bv_->text->cursor.y()
- bv_->text->cursor.row()->baseline());
updateScrollbar();
}
void BufferView::Pimpl::showCursor()
{
- if (screen)
- screen->ShowCursor();
+ if (screen_)
+ screen_->ShowCursor();
}
void BufferView::Pimpl::hideCursor()
{
- if (screen)
- screen->HideCursor();
+ if (screen_)
+ screen_->HideCursor();
}
void BufferView::Pimpl::toggleSelection(bool b)
{
- if (screen)
- screen->ToggleSelection(b);
+ if (screen_)
+ screen_->ToggleSelection(b);
}
void BufferView::Pimpl::toggleToggle()
{
- if (screen)
- screen->ToggleToggle();
+ if (screen_)
+ screen_->ToggleToggle();
}
{
beforeChange();
if (bv_->text->cursor.y() > workarea_->height() / 2) {
- screen->Draw(bv_->text->cursor.y() - workarea_->height() / 2);
+ screen_->Draw(bv_->text->cursor.y() - workarea_->height() / 2);
} else {
- screen->Draw(0);
+ screen_->Draw(0);
}
update(BufferView::SELECT|BufferView::FITCUR);
redraw();
{
if (buffer_ == 0) return;
- screen->HideCursor();
+ screen_->HideCursor();
bv_->beforeChange();
string clip(workarea_->getClipboard());
///
Buffer * buffer_;
///
- LyXScreen * screen;
+ LyXScreen * screen_;
///
long current_scrollbar_value;
///
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_form_bullet_h_
#define FD_form_bullet_h_
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_form_credits_h_
#define FD_form_credits_h_
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_KeyMap_h_
#define FD_KeyMap_h_
setLabel(_("ERT"));
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
- real_current_font = current_font = font;
labelfont = LyXFont(LyXFont::ALL_SANE);
labelfont.decSize();
labelfont.decSize();
InsetCollapsable::Edit(bv, x, y, button);
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
- current_font = real_current_font = font;
}
#include "lyxfont.h"
#include "BufferView.h"
#include "Painter.h"
+#include "lyxtext.h"
#include "support/LOstream.h"
using std::ostream;
LyXFont InsetFoot::GetDrawFont(Buffer const * buf, LyXParagraph * p, int pos) const
{
- LyXFont fn = InsetCollapsable::GetDrawFont(buf, p, pos);
+ LyXFont fn = text->GetFont(buf, p, pos);
fn.decSize().decSize();
return fn;
}
// in pixels if we have a pwidth for this cell.
int InsetTabular::GetMaxWidthOfCell(Painter &, int cell) const
{
- string w;
+ string s = tabular->GetPWidth(cell);
- if ((w=tabular->GetPWidth(cell)).empty())
+ if (s.empty())
return -1;
- return VSpace(w).inPixels( 0, 0);
+ return VSpace(s).inPixels( 0, 0);
}
int InsetTabular::getMaxWidth(Painter & pain,
cell = tabular->GetCellNumber(i,j);
inset = tabular->GetCellInset(cell);
inset->update(bv, font);
- inset->computeTextRows(bv->painter());
tabular->SetWidthOfCell(cell, inset->width(bv->painter(), font));
}
// cell = tabular->GetCellNumber(0, j);
#include "lyxrc.h"
#include "intl.h"
#include "trans_mgr.h"
+#include "lyxscreen.h"
using std::ostream;
using std::ifstream;
}
-InsetText::InsetText(InsetText const & ins) : UpdatableInset()
+InsetText::InsetText(InsetText const & ins)
+ : UpdatableInset()
{
par = 0;
init(&ins);
{
the_locking_inset = 0;
cursor_visible = false;
- cursor.x_fix(-1);
interline_space = 1;
no_selection = false;
init_inset = true;
- maxAscent = maxDescent = insetWidth = 0;
drawTextXOffset = drawTextYOffset = 0;
autoBreakRows = drawLockedFrame = false;
xpos = 0.0;
drawLockedFrame = ins->drawLockedFrame;
}
par->SetInsetOwner(this);
- cursor.par(par);
- cursor.pos(0);
- selection_start_cursor = selection_end_cursor = cursor;
+// selection_start_cursor = selection_end_cursor = cursor;
frame_color = LColor::insetframe;
locked = false;
old_par = 0;
InsetText::~InsetText()
{
+ LyXParagraph * p;
+ p = par->next;
delete par;
+ while(p) {
+ par = p;
+ p = p->next;
+ delete par;
+ }
}
LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
LyXFont font(LyXFont::ALL_INHERIT);
+ LyXParagraph * p;
+ p = par->next;
delete par;
+ while(p) {
+ par = p;
+ p = p->next;
+ delete par;
+ }
par = new LyXParagraph;
- par->SetInsetOwner(this);
-
while (lex.IsOK()) {
lex.nextToken();
token = lex.GetString();
if (!return_par)
return_par = par;
par = return_par;
+ while(return_par) {
+ return_par->SetInsetOwner(this);
+ return_par = return_par->next;
+ }
+
if (token != "\\end_inset") {
lex.printError("Missing \\end_inset at this point. "
"Read: `$$Token'");
xpos = x;
UpdatableInset::draw(pain, f, baseline, x);
-#if 0
- if (init_inset) {
- text->init(current_view);
- computeTextRows(pain);
- init_inset = false;
- }
-#endif
- if ((baseline != top_baseline) || (top_x != int(x))) {
- top_baseline = baseline;
- top_x = int(x);
- computeBaselines(baseline);
- }
- if (the_locking_inset && (text->cursor.pos() == inset_pos)) {
- resetPos(pain);
+ top_baseline = baseline;
+ top_x = int(x);
+
+ if (the_locking_inset && (cpos() == inset_pos)) {
inset_x = cx() - top_x + drawTextXOffset;
inset_y = cy() + drawTextYOffset;
}
- if (drawLockedFrame && locked) {
- pain.rectangle(int(x), baseline - ascent(pain, f), width(pain, f),
- ascent(pain,f) + descent(pain, f), frame_color);
- }
x += TEXT_TO_INSET_OFFSET; // place for border
-#if 1
long int y = 0;
Row * row = text->GetRowNearY(y);
y += baseline - row->ascent_of_text() + 1;
y += row->height();
row = row->next();
}
-#else
- for(RowList::size_type r = 0; r < rows.size() - 1; ++r) {
- drawRowSelection(pain, rows[r].pos, rows[r + 1].pos, r,
- rows[r].baseline, x);
- drawRowText(pain, rows[r].pos, rows[r + 1].pos, rows[r].baseline, x);
+ x += width(pain, f) - TEXT_TO_INSET_OFFSET;
+ if (drawLockedFrame && locked) {
+ pain.rectangle(top_x, baseline - ascent(pain, f), width(pain, f),
+ ascent(pain,f) + descent(pain, f), frame_color);
}
-#endif
- x += insetWidth - TEXT_TO_INSET_OFFSET;
}
}
-void InsetText::drawRowSelection(Painter & pain, int startpos, int endpos,
- int row, int baseline, float x) const
-{
- if (!hasSelection())
- return;
-
- int s_start, s_end;
- if (selection_start_cursor.pos() > selection_end_cursor.pos()) {
- s_start = selection_end_cursor.pos();
- s_end = selection_start_cursor.pos();
- } else {
- s_start = selection_start_cursor.pos();
- s_end = selection_end_cursor.pos();
- }
- if ((s_start > endpos) || (s_end < startpos))
- return;
-
- int esel_x;
- int ssel_x = esel_x = int(x);
- LyXFont font;
- int p = startpos;
- for(; p < endpos; ++p) {
- if (p == s_start)
- ssel_x = int(x);
- if ((p >= s_start) && (p <= s_end))
- esel_x = int(x);
- char ch = par->GetChar(p);
- font = GetDrawFont(current_view->buffer(), par, p);
- if (IsFloatChar(ch)) {
- // skip for now
- } else if (ch == LyXParagraph::META_INSET) {
- Inset const * tmpinset = par->GetInset(p);
- x += tmpinset->width(pain, font);
- } else {
- x += lyxfont::width(ch, font);
- }
- }
- if (p == s_start)
- ssel_x = int(x);
- if ((p >= s_start) && (p <= s_end))
- esel_x = int(x);
- if (ssel_x < esel_x) {
- pain.fillRectangle(int(ssel_x), baseline-rows[row].asc,
- int(esel_x - ssel_x),
- rows[row].asc + rows[row].desc,
- LColor::selection);
- }
-}
-
-
-void InsetText::drawRowText(Painter & pain, int startpos, int endpos,
- int baseline, float x) const
-{
- Assert(endpos <= par->Last());
-
- for(int p = startpos; p < endpos; ++p) {
- char ch = par->GetChar(p);
- LyXFont font = GetDrawFont(current_view->buffer(), par, p);
- if (IsFloatChar(ch)) {
- // skip for now
- } else if (par->IsNewline(p)) {
- // Draw end-of-line marker
- int wid = lyxfont::width('n', font);
- int asc = lyxfont::maxAscent(font);
- int y = baseline;
- int xp[3], yp[3];
-
- xp[0] = int(x + wid * 0.375);
- yp[0] = int(y - 0.875 * asc * 0.75);
-
- xp[1] = int(x);
- yp[1] = int(y - 0.500 * asc * 0.75);
-
- xp[2] = int(x + wid * 0.375);
- yp[2] = int(y - 0.125 * asc * 0.75);
-
- pain.lines(xp, yp, 3, LColor::eolmarker);
-
- xp[0] = int(x);
- yp[0] = int(y - 0.500 * asc * 0.75);
-
- xp[1] = int(x + wid);
- yp[1] = int(y - 0.500 * asc * 0.75);
-
- xp[2] = int(x + wid);
- yp[2] = int(y - asc * 0.75);
-
- pain.lines(xp, yp, 3, LColor::eolmarker);
- x += wid;
- } else if (ch == LyXParagraph::META_INSET) {
- Inset * tmpinset = par->GetInset(p);
- if (tmpinset)
- tmpinset->draw(pain, font, baseline, x);
- } else {
- pain.text(int(x), baseline, ch, font);
- x += lyxfont::width(ch, font);
- }
- }
-}
-
-
char const * InsetText::EditMessage() const
{
return _("Opened Text Inset");
locked = true;
the_locking_inset = 0;
inset_pos = inset_x = inset_y = 0;
- setPos(bv->painter(), x, y);
+// setPos(bv->painter(), x, y);
checkAndActivateInset(bv, x, y, button);
- selection_start_cursor = selection_end_cursor = cursor;
+// selection_start_cursor = selection_end_cursor = cursor;
text->sel_cursor = text->cursor;
bv->text->FinishUndo();
UpdateLocal(bv, true, false);
HideInsetCursor(bv);
lyxerr[Debug::INSETS] << "InsetText::InsetUnlock(" << this <<
")" << endl;
- selection_start_cursor = selection_end_cursor = cursor;
+// selection_start_cursor = selection_end_cursor = cursor;
no_selection = false;
locked = false;
UpdateLocal(bv, true, false);
lyxerr[Debug::INSETS] << "InsetText::LockInsetInInset(" << inset << "): ";
if (!inset)
return false;
- if (inset == par->GetInset(text->cursor.pos())) {
+ if (inset == par->GetInset(cpos())) {
lyxerr[Debug::INSETS] << "OK" << endl;
the_locking_inset = inset;
- resetPos(bv->painter());
+// resetPos(bv->painter());
inset_x = cx() - top_x + drawTextXOffset;
inset_y = cy() + drawTextYOffset;
- inset_pos = text->cursor.pos();
+ inset_pos = cpos();
return true;
} else if (the_locking_inset && (the_locking_inset == inset)) {
- if (text->cursor.pos() == inset_pos) {
+ if (cpos() == inset_pos) {
lyxerr[Debug::INSETS] << "OK" << endl;
- resetPos(bv->painter());
+// resetPos(bv->painter());
inset_x = cx() - top_x + drawTextXOffset;
inset_y = cy() + drawTextYOffset;
} else {
lyxerr[Debug::INSETS] << "InsetText::UpdateInsetInInset(" << inset <<
")" << endl;
UpdateLocal(bv, true, false);
- if (text->cursor.pos() == inset_pos) {
+ if (cpos() == inset_pos) {
inset_x = cx() - top_x + drawTextXOffset;
inset_y = cy() + drawTextYOffset;
}
void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
{
- if (hasSelection()) {
- selection_start_cursor = selection_end_cursor = cursor;
+ if (text->selection) {
+ text->selection = 0;
UpdateLocal(bv, false, false);
}
no_selection = false;
- setPos(bv->painter(), x, y);
- cursor.x_fix(-1);
+// setPos(bv->painter(), x, y);
+// cursor.x_fix(-1);
+ text->SetCursorFromCoordinates(bv, x, y+bv->screen()->first);
if (the_locking_inset) {
UpdatableInset * inset = 0;
- if (par->GetChar(cursor.pos()) == LyXParagraph::META_INSET)
- inset = static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
+ if (par->GetChar(cpos()) == LyXParagraph::META_INSET)
+ inset = static_cast<UpdatableInset*>(par->GetInset(cpos()));
if (the_locking_inset == inset) {
the_locking_inset->InsetButtonPress(bv,x-inset_x,y-inset_y,button);
return;
} else if (inset) {
// otherwise unlock the_locking_inset and lock the new inset
the_locking_inset->InsetUnlock(bv);
- inset_x = cursor.x() - top_x + drawTextXOffset;
- inset_y = cursor.y() + drawTextYOffset;
+ inset_x = cx() - top_x + drawTextXOffset;
+ inset_y = cy() + drawTextYOffset;
inset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
inset->Edit(bv, x - inset_x, y - inset_y, button);
UpdateLocal(bv, true, false);
the_locking_inset = 0;
}
if (bv->the_locking_inset) {
- if ((par->GetChar(cursor.pos()) == LyXParagraph::META_INSET) &&
- par->GetInset(cursor.pos()) &&
- (par->GetInset(cursor.pos())->Editable() == Inset::HIGHLY_EDITABLE)) {
+ if ((par->GetChar(cpos()) == LyXParagraph::META_INSET) &&
+ par->GetInset(cpos()) &&
+ (par->GetInset(cpos())->Editable() == Inset::HIGHLY_EDITABLE)) {
UpdatableInset * inset =
- static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
- inset_x = cursor.x() - top_x + drawTextXOffset;
- inset_y = cursor.y() + drawTextYOffset;
+ static_cast<UpdatableInset*>(par->GetInset(cpos()));
+ inset_x = cx() - top_x + drawTextXOffset;
+ inset_y = cy() + drawTextYOffset;
inset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
inset->Edit(bv, x - inset_x, y - inset_y, 0);
UpdateLocal(bv, true, false);
}
}
- selection_start_cursor = selection_end_cursor = cursor;
+// selection_start_cursor = selection_end_cursor = cursor;
}
if (the_locking_inset) {
the_locking_inset->InsetButtonRelease(bv, x-inset_x, y-inset_y,button);
} else {
- if (par->GetChar(cursor.pos()) == LyXParagraph::META_INSET) {
- inset = static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
+ if (par->GetChar(cpos()) == LyXParagraph::META_INSET) {
+ inset = static_cast<UpdatableInset*>(par->GetInset(cpos()));
if (inset->Editable() == Inset::HIGHLY_EDITABLE) {
inset->InsetButtonRelease(bv, x - inset_x, y - inset_y,button);
} else {
- inset_x = cursor.x() - top_x + drawTextXOffset;
- inset_y = cursor.y() + drawTextYOffset;
+ inset_x = cx() - top_x + drawTextXOffset;
+ inset_y = cy() + drawTextYOffset;
inset->InsetButtonRelease(bv, x - inset_x, y - inset_y,button);
inset->Edit(bv, x - inset_x, y - inset_y, button);
}
y - inset_y,state);
return;
}
+#warning REDO this (Jug)
if (!no_selection) {
- LyXCursor old = selection_end_cursor;
+// LyXCursor old = selection_end_cursor;
HideInsetCursor(bv);
- setPos(bv->painter(), x, y);
- selection_end_cursor = cursor;
- if (old != selection_end_cursor)
- UpdateLocal(bv, false, false);
+// setPos(bv->painter(), x, y);
+// selection_end_cursor = cursor;
+// if (old != selection_end_cursor)
+// UpdateLocal(bv, false, false);
ShowInsetCursor(bv);
}
no_selection = false;
UpdatableInset::RESULT
result= UpdatableInset::LocalDispatch(bv, action, arg);
if (result != UNDISPATCHED) {
- resetPos(bv->painter());
+// resetPos(bv->painter());
return DISPATCHED;
}
if ((action < 0) && arg.empty())
return FINISHED;
- if ((action != LFUN_DOWN) && (action != LFUN_UP) &&
- (action != LFUN_DOWNSEL) && (action != LFUN_UPSEL))
- cursor.x_fix(-1);
if (the_locking_inset) {
result = the_locking_inset->LocalDispatch(bv, action, arg);
if (result == DISPATCHED_NOUPDATE)
switch(action) {
case -1:
case LFUN_RIGHT:
- cursor.pos(inset_pos + 1);
- resetPos(bv->painter());
+ moveRight(bv);
+// text->cursor.pos(inset_pos + 1);
+// resetPos(bv->painter());
break;
case LFUN_DOWN:
moveDown(bv);
case LFUN_RIGHT:
bv->text->FinishUndo();
result = moveRight(bv);
+ text->selection = 0;
text->sel_cursor = text->cursor;
UpdateLocal(bv, false, false);
break;
case LFUN_LEFT:
bv->text->FinishUndo();
result= moveLeft(bv);
+ text->selection = 0;
text->sel_cursor = text->cursor;
UpdateLocal(bv, false, false);
break;
case LFUN_DOWNSEL:
bv->text->FinishUndo();
moveDown(bv);
- selection_end_cursor = cursor;
+ text->SetSelection();
UpdateLocal(bv, false, false);
break;
case LFUN_DOWN:
bv->text->FinishUndo();
result = moveDown(bv);
+ text->selection = 0;
text->sel_cursor = text->cursor;
UpdateLocal(bv, false, false);
break;
case LFUN_UPSEL:
bv->text->FinishUndo();
moveUp(bv);
- selection_end_cursor = cursor;
+ text->SetSelection();
UpdateLocal(bv, false, false);
break;
case LFUN_UP:
bv->text->FinishUndo();
result = moveUp(bv);
+ text->selection = 0;
text->sel_cursor = text->cursor;
UpdateLocal(bv, false, false);
break;
case LFUN_HOME:
bv->text->FinishUndo();
text->CursorHome(bv);
+ text->selection = 0;
text->sel_cursor = text->cursor;
UpdateLocal(bv, false, false);
break;
case LFUN_END:
text->CursorEnd(bv);
+ text->selection = 0;
text->sel_cursor = text->cursor;
UpdateLocal(bv, false, false);
break;
if (cur_layout != layout.second) {
cur_layout = layout.second;
text->SetLayout(bv, layout.second);
- bv->owner()->getToolbar()->combox->select(cursor.par()->GetLayout()+1);
+ bv->owner()->getToolbar()->combox->select(cpar()->GetLayout()+1);
UpdateLocal(bv, true, true);
}
}
}
-// Returns the width of a character at a certain spot
-int InsetText::SingleWidth(Painter & pain, LyXParagraph * p, int pos) const
-{
- LyXFont font = GetDrawFont(current_view->buffer(), p, pos);
- char c = p->GetChar(pos);
-
- if (IsPrintable(c)) {
- return lyxfont::width(c, font);
- } else if (c == LyXParagraph::META_INSET) {
- Inset const * tmpinset = p->GetInset(pos);
- if (tmpinset)
- return tmpinset->width(pain, font);
- else
- return 0;
- } else if (IsSeparatorChar(c))
- c = ' ';
- else if (IsNewlineChar(c))
- c = 'n';
- return lyxfont::width(c, font);
-}
-
-
-// Returns the width of a character at a certain spot
-void InsetText::SingleHeight(Painter & pain, LyXParagraph * p,int pos,
- int & asc, int & desc) const
-{
- LyXFont font = GetDrawFont(current_view->buffer(), p, pos);
- char c = p->GetChar(pos);
-
- asc = desc = 0;
- if (c == LyXParagraph::META_INSET) {
- Inset const * tmpinset=p->GetInset(pos);
- if (tmpinset) {
- asc = tmpinset->ascent(pain, font);
- desc = tmpinset->descent(pain, font);
- }
- } else {
- asc = lyxfont::maxAscent(font);
- desc = lyxfont::maxDescent(font);
- }
- return;
-}
-
-
-// Gets the fully instantiated font at a given position in a paragraph
-// Basically the same routine as LyXParagraph::getFont() in paragraph.C.
-// The difference is that this one is used for displaying, and thus we
-// are allowed to make cosmetic improvements. For instance make footnotes
-// smaller. (Asger)
-// If position is -1, we get the layout font of the paragraph.
-// If position is -2, we get the font of the manual label of the paragraph.
-LyXFont InsetText::GetFont(Buffer const * buf, LyXParagraph * p, int pos) const
-{
- char par_depth = p->GetDepth();
-
- LyXLayout const & layout =
- textclasslist.Style(buf->params.textclass, p->GetLayout());
-
- // We specialize the 95% common case:
- if (p->footnoteflag == LyXParagraph::NO_FOOTNOTE && !par_depth) {
- if (pos >= 0) {
- // 95% goes here
- if (layout.labeltype == LABEL_MANUAL
- && pos < BeginningOfMainBody(buf, p)) {
- // 1% goes here
- return p->GetFontSettings(buf->params,
- pos).realize(layout.reslabelfont);
- } else
- return p->GetFontSettings(buf->params,
- pos).realize(layout.resfont);
- } else {
- // 5% goes here.
- // process layoutfont for pos == -1 and labelfont for pos < -1
- if (pos == -1)
- return layout.resfont;
- else
- return layout.reslabelfont;
- }
- }
- // The uncommon case need not be optimized as much
-
- LyXFont layoutfont, tmpfont;
-
- if (pos >= 0){
- // 95% goes here
- if (pos < BeginningOfMainBody(buf, p)) {
- // 1% goes here
- layoutfont = layout.labelfont;
- } else {
- // 99% goes here
- layoutfont = layout.font;
- }
- tmpfont = p->GetFontSettings(buf->params, pos);
- tmpfont.realize(layoutfont);
- } else{
- // 5% goes here.
- // process layoutfont for pos == -1 and labelfont for pos < -1
- if (pos == -1)
- tmpfont = layout.font;
- else
- tmpfont = layout.labelfont;
- }
-
- // Resolve against environment font information
- //if (par->GetDepth()){ // already in while condition
- while (p && par_depth && !tmpfont.resolved()) {
- p = p->DepthHook(par_depth - 1);
- if (p) {
- tmpfont.realize(textclasslist.Style(buf->params.textclass,
- p->GetLayout()).font);
- par_depth = p->GetDepth();
- }
- }
- tmpfont.realize((textclasslist.TextClass(buf->params.textclass).
- defaultfont()));
- return tmpfont;
-}
-
-
-// the font for drawing may be different from the real font
-LyXFont InsetText::GetDrawFont(Buffer const * buf, LyXParagraph * p, int pos) const
-{
- return text->GetFont(buf, p, pos);
-}
-
-
int InsetText::BeginningOfMainBody(Buffer const * buf, LyXParagraph * p) const
{
if (textclasslist.Style(buf->params.textclass,
void InsetText::GetCursorPos(int & x, int & y) const
{
- x = cursor.x();
- y = cursor.y();
+ x = cx();
+ y = cy();
}
return;
}
- LyXFont font = GetDrawFont(bv->buffer(), cpar(), cpos());
+ LyXFont font = text->GetFont(bv->buffer(), cpar(), cpos());
int asc = lyxfont::maxAscent(font);
int desc = lyxfont::maxDescent(font);
return;
}
if (!cursor_visible) {
- LyXFont font = GetDrawFont(bv->buffer(), cpar(), cpos());
+ LyXFont font = text->GetFont(bv->buffer(), cpar(), cpos());
int asc = lyxfont::maxAscent(font);
int desc = lyxfont::maxDescent(font);
}
-void InsetText::setPos(Painter & pain, int x, int y) const
-{
- x -= drawTextXOffset;
- y -= drawTextYOffset;
- // search right X-pos x==0 -> top_x
- cursor.pos(0);
- actrow = 0;
- cursor.y(top_baseline);
- y += cursor.y();
- for(unsigned int i = 1;
- (long(cursor.y() + rows[i - 1].desc) < y)
- && (i < rows.size() - 1); ++i) {
- cursor.y(rows[i].baseline);
- cursor.pos(rows[i].pos);
- actrow = i;
- }
- cursor.y(cursor.y() - top_baseline);
- cursor.x(top_x + 2); // 2 = frame width
- x += cursor.x();
-
- int swh;
- int sw = swh = SingleWidth(pain, par, cursor.pos());
- if (par->GetChar(cursor.pos()) != LyXParagraph::META_INSET)
- swh /= 2;
- int checkpos = rows[actrow + 1].pos;
- if ((actrow + 2) < (int)rows.size())
- --checkpos;
- while ((cursor.pos() < checkpos) && ((cursor.x() + swh) < x)) {
- cursor.x(cursor.x() + sw);
- cursor.pos(cursor.pos() + 1);
- sw = swh = SingleWidth(pain, par, cursor.pos());
- if (par->GetChar(cursor.pos())!=LyXParagraph::META_INSET)
- swh /= 2;
- }
-}
-
-
-void InsetText::resetPos(Painter & pain) const
-{
- cursor.par(par);
-
- if (!rows.size())
- return;
-
- int old_pos = cursor.pos();
-
- cursor.y(top_baseline);
- actrow = 0;
- for(unsigned int i = 0;
- i < (rows.size() - 1) && rows[i].pos <= cursor.pos();
- ++i) {
- cursor.y(rows[i].baseline);
- actrow = i;
- }
- cursor.y(cursor.y() - top_baseline);
- setPos(pain, 0, cursor.y());
- cursor.x(top_x + 2); // 2 = frame width
- while(cursor.pos() < old_pos) {
- cursor.x(cursor.x() + SingleWidth(pain, par,cursor.pos()));
- cursor.pos(cursor.pos() + 1);
- }
-}
-
-
UpdatableInset::RESULT
InsetText::moveRight(BufferView * bv, bool activate_inset)
{
bool InsetText::Delete()
{
- if ((par->GetChar(cursor.pos())==LyXParagraph::META_INSET) &&
- !par->GetInset(cursor.pos())->Deletable()) {
+ if ((par->GetChar(cpos())==LyXParagraph::META_INSET) &&
+ !par->GetInset(cpos())->Deletable()) {
return false;
}
- par->Erase(cursor.pos());
+ par->Erase(cpos());
return true;
}
UpdatableInset * i = static_cast<UpdatableInset *>(inset);
i->setOwner(static_cast<UpdatableInset *>(this));
}
- par->InsertChar(cursor.pos(), LyXParagraph::META_INSET);
- par->InsertInset(cursor.pos(), inset);
- if (hasSelection()) {
- selection_start_cursor = selection_end_cursor = cursor;
- } else {
- selection_start_cursor = selection_end_cursor = cursor;
- }
+ par->InsertChar(cpos(), LyXParagraph::META_INSET);
+ par->InsertInset(cpos(), inset);
+ text->selection = 0;
UpdateLocal(bv, true, true);
static_cast<UpdatableInset*>(inset)->Edit(bv, 0, 0, 0);
return true;
}
-void InsetText::computeTextRows(Painter & pain) const
-{
- int p,
- nwp = 0,
- asc = 0,
- desc = 0,
- oasc = 0,
- odesc = 0,
- wordAscent,
- wordDescent;
- row_struct row;
-
- if (rows.size())
- rows.clear();
- int width = wordAscent = wordDescent = 0;
- insetWidth = maxAscent = maxDescent = 0;
- row.asc = 0;
- row.desc = 0;
- row.pos = 0;
- row.baseline = 0;
- rows.push_back(row);
- if (!autoBreakRows || (getMaxTextWidth(pain, this) < 0)) {
- for(p = 0; p < par->Last(); ++p) {
- insetWidth += SingleWidth(pain, par, p);
- SingleHeight(pain, par, p, asc, desc);
- maxAscent = max(maxAscent, asc);
- maxDescent = max(maxDescent, desc);
- }
- insetWidth += (2 * TEXT_TO_INSET_OFFSET);
- rows[0].asc = maxAscent;
- rows[0].desc = maxDescent;
- // alocate a dummy row for the endpos
- row.pos = par->Last();
- rows.push_back(row);
- return;
- }
-
- bool is_first_word_in_row = true;
- int cw, lastWordWidth = 0;
- int maxWidth = getMaxTextWidth(pain, this);
- // if we auto break rows than the insetwidth should be always the max
- // width as the display is stable it may get larger if we have a really
- // large word below and we draw it!!!
- insetWidth = maxWidth;
-
- for(p = 0; p < par->Last(); ++p) {
- if (par->IsNewline(p)) {
- rows.back().asc = wordAscent;
- rows.back().desc = wordDescent;
- row.pos = p+1;
- rows.push_back(row);
- nwp = p+1;
- width = lastWordWidth = 0;
- oasc = odesc = wordAscent = wordDescent = 0;
- is_first_word_in_row = true;
- continue;
- }
- cw = SingleWidth(pain, par, p);
- Inset * inset = 0;
- if (par->GetChar(p) == LyXParagraph::META_INSET)
- inset = par->GetInset(p);
- if (inset && inset->display()) {
- inset->setOwner(const_cast<InsetText *>(this));
- if (cw > insetWidth)
- insetWidth = cw;
- if (!is_first_word_in_row || (p != nwp)) {
- oasc = max(oasc, wordAscent);
- odesc = max(odesc, wordDescent);
- rows.back().asc = oasc;
- rows.back().desc = odesc;
- row.pos = p;
- rows.push_back(row);
- }
- SingleHeight(pain, par, p, asc, desc);
- rows.back().asc = asc;
- rows.back().desc = desc;
- row.pos = nwp = p + 1;
- rows.push_back(row);
- width = lastWordWidth = 0;
- oasc = odesc = wordAscent = wordDescent = 0;
- is_first_word_in_row = true;
- continue;
- }
- SingleHeight(pain, par, p, asc, desc);
- width += cw;
- lastWordWidth += cw;
- if (width > maxWidth) {
- if (is_first_word_in_row) {
- if (!(width-cw)) { // only this character in word
- rows.back().asc = asc;
- rows.back().desc = desc;
- row.pos = p+1;
- rows.push_back(row);
- oasc = 0;
- odesc = 0;
- wordAscent = 0;
- wordDescent = 0;
- nwp = p + 1;
- lastWordWidth = width = 0;
- } else {
- rows.back().asc = wordAscent;
- rows.back().desc = wordDescent;
- row.pos = p;
- rows.push_back(row);
- oasc = 0;
- odesc = 0;
- wordAscent = asc;
- wordDescent = desc;
- lastWordWidth = width = cw;
- nwp = p;
- }
- } else {
- rows.back().asc = oasc;
- rows.back().desc = odesc;
- row.pos = nwp;
- rows.push_back(row);
- oasc = wordAscent;
- odesc = wordDescent;
- width = lastWordWidth;
- wordAscent = max(wordAscent, asc);
- wordDescent = max(wordDescent, desc);
- is_first_word_in_row = true;
- }
- } else {
- wordAscent = max(wordAscent, asc);
- wordDescent = max(wordDescent, desc);
- }
- if (par->IsSeparator(p) || inset) {
- if (inset) {
- inset->setOwner(const_cast<InsetText *>(this));
- if (cw > maxWidth)
- insetWidth = cw;
- }
- oasc = max(oasc, wordAscent);
- odesc = max(odesc, wordDescent);
- wordAscent = wordDescent = lastWordWidth = 0;
- nwp = p + 1;
- is_first_word_in_row = false;
- }
- }
- // if we have some data in the paragraph we have ascent/descent
- if (p) {
- // assign last row data
- rows.back().asc = max(oasc, wordAscent);
- rows.back().desc = max(odesc, wordDescent);
- }
- insetWidth += (2 * TEXT_TO_INSET_OFFSET);
- // alocate a dummy row for the endpos
- row.pos = par->Last();
- rows.push_back(row);
- // calculate maxAscent/Descent
- maxAscent = rows[0].asc;
- maxDescent = rows[0].desc;
- for (RowList::size_type i = 1; i < rows.size() - 1; ++i) {
- maxDescent += rows[i].asc + rows[i].desc + interline_space;
- }
-}
-
-
-void InsetText::computeBaselines(int baseline) const
-{
- rows[0].baseline = baseline;
- for (unsigned int i = 1; i < rows.size() - 1; i++) {
- rows[i].baseline = rows[i - 1].baseline + rows[i - 1].desc +
- rows[i].asc + interline_space;
- }
-}
-
-
void InsetText::UpdateLocal(BufferView * bv, bool what, bool mark_dirty)
{
if (what) {
}
-bool InsetText::cutSelection(Buffer const * buf)
-{
- if (!hasSelection())
- return false;
-
- CutAndPaste cap;
-
- LyXParagraph * endpar = par;
- int start, end;
- if (selection_start_cursor.pos() > selection_end_cursor.pos()) {
- start = selection_end_cursor.pos();
- end = selection_start_cursor.pos();
- } else {
- start = selection_start_cursor.pos();
- end = selection_end_cursor.pos();
- }
-
- return cap.cutSelection(par, &endpar, start, end, buf->params.textclass);
-}
-
-
-bool InsetText::copySelection(Buffer const * buf)
-{
- if (!hasSelection())
- return false;
-
- CutAndPaste cap;
-
- int start, end;
- if (selection_start_cursor.pos() > selection_end_cursor.pos()) {
- start = selection_end_cursor.pos();
- end = selection_start_cursor.pos();
- } else {
- start = selection_start_cursor.pos();
- end = selection_end_cursor.pos();
- }
- return cap.copySelection(par, par, start, end, buf->params.textclass);
-}
-
-
-bool InsetText::pasteSelection(Buffer const * buf)
-{
- CutAndPaste cap;
-
- if (cap.nrOfParagraphs() > 1) {
- WriteAlert(_("Impossible operation"),
- _("Cannot include more than one paragraph!"),
- _("Sorry."));
- return false;
- }
- LyXParagraph * endpar;
- LyXParagraph * actpar = par;
-
- int pos = cursor.pos();
- bool ret = cap.pasteSelection(&actpar, &endpar, pos,buf->params.textclass);
- cursor.pos(pos);
- return ret;
-}
-
-
bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
int button)
{
- if (par->GetChar(cursor.pos()) == LyXParagraph::META_INSET) {
+ if (par->GetChar(cpos()) == LyXParagraph::META_INSET) {
UpdatableInset * inset =
- static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
+ static_cast<UpdatableInset*>(par->GetInset(cpos()));
LyXFont font = text->GetFont(bv->buffer(), cpar(), cpos());
if (x < 0)
x = inset->width(bv->painter(), font);
if (y < 0)
y = inset->descent(bv->painter(), font);
- inset_x = cursor.x() - top_x + drawTextXOffset;
- inset_y = cursor.y() + drawTextYOffset;
+ inset_x = cx() - top_x + drawTextXOffset;
+ inset_y = cy() + drawTextYOffset;
inset->Edit(bv, x - inset_x, y - inset_y, button);
if (!the_locking_inset)
return false;
int InsetText::getMaxTextWidth(Painter & pain, UpdatableInset const * inset) const
{
-// int w=getMaxWidth(pain, inset);
-// return (w - x);
return getMaxWidth(pain, inset) - 4; // 2+2 width of eventual border
}
void InsetText::SetParagraphData(LyXParagraph *p)
{
- if (par)
+ LyXParagraph * np;
+
+ if (par) {
+ np = par->next;
delete par;
+ while(np) {
+ par = np;
+ np = np->next;
+ delete par;
+ }
+ }
par = p->Clone();
par->SetInsetOwner(this);
+ np = par;
+ while(p->next) {
+ p = p->next;
+ np->next = p->Clone();
+ np->next->previous = np;
+ np = np->next;
+ }
init_inset = true;
}
}
}
+LyXFont InsetText::GetDrawFont(Buffer const * buf, LyXParagraph * par, int pos) const
+{
+ return text->GetFont(buf, par, pos);
+}
+
int InsetText::cx() const
{
return text->cursor.x() + top_x + 1;
///
void SetFrameColor(LColor::color);
///
- void computeTextRows(Painter &) const;
+ LyXFont GetDrawFont(Buffer const *, LyXParagraph *, int pos) const;
///
LyXParagraph * par;
///
///
void WriteParagraphData(Buffer const *, std::ostream &) const;
///
- void resetPos(Painter &) const;
- ///
- void drawSelection(Painter &, int pos, int baseline, float x);
- ///
- void SingleHeight(Painter &, LyXParagraph * par,int pos,
- int & asc, int & desc) const;
- ///
- int SingleWidth(Painter &, LyXParagraph * par, int pos) const;
- ///
- LyXFont GetFont(Buffer const *, LyXParagraph * par, int pos) const;
- ///
- virtual LyXFont GetDrawFont(Buffer const *, LyXParagraph * par, int pos) const;
- ///
virtual int getMaxTextWidth(Painter &, UpdatableInset const *) const;
LyXText * text;
///
- LyXFont current_font;
- ///
- LyXFont real_current_font;
- ///
- mutable int maxAscent;
- ///
- mutable int maxDescent;
- ///
- mutable int insetWidth;
- ///
mutable int drawTextXOffset;
mutable int drawTextYOffset;
///
LColor::color frame_color;
private:
- ///
- void drawRowSelection(Painter &, int startpos, int endpos, int row,
- int baseline, float x) const;
- ///
- void drawRowText(Painter &, int startpos, int endpos, int baseline,
- float x) const;
- ///
- void computeBaselines(int) const;
///
int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
///
///
void HideInsetCursor(BufferView *);
///
- void setPos(Painter &, int x, int y) const;
- ///
UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true);
///
UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true);
///
bool Delete();
///
- bool cutSelection(Buffer const *);
- ///
- bool copySelection(Buffer const *);
- ///
- bool pasteSelection(Buffer const *);
- ///
- bool hasSelection() const
- { return (selection_start_cursor != selection_end_cursor); }
- ///
void SetCharFont(Buffer const *, int pos, LyXFont const & font);
///
string getText(int);
///
int interline_space;
///
- LyXCursor selection_start_cursor;
- ///
- LyXCursor selection_end_cursor;
- ///
- mutable LyXCursor cursor;
- ///
- mutable LyXCursor old_cursor;
- ///
- mutable int actrow;
- ///
bool no_selection;
///
mutable float xpos;
///
UpdatableInset * the_locking_inset;
///
- struct row_struct {
- ///
- int asc;
- ///
- int desc;
- ///
- int pos;
- ///
- int baseline;
- };
- ///
- typedef std::vector<row_struct> RowList;
- ///
- mutable RowList rows;
- ///
LyXParagraph * old_par;
};
#endif
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_LaTeXOptions_h_
#define FD_LaTeXOptions_h_
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
fl_set_object_resize(obj, FL_RESIZE_NONE);
- fdui->choice_language = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 190, 190, 30, _("Language:"));
- fl_set_object_boxtype(obj, FL_FRAME_BOX);
- fl_set_object_color(obj, FL_COL1, FL_COL1);
+ fdui->choice_language = obj = fl_add_box(FL_FRAME_BOX, 120, 190, 190, 30, _("Language:"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_LEFT);
fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
fl_set_object_resize(obj, FL_RESIZE_NONE);
fdui->input_default_skip = obj = fl_add_input(FL_NORMAL_INPUT, 220, 310, 90, 30, "");
FL_OBJECT *obj;
FD_form_character *fdui = (FD_form_character *) fl_calloc(1, sizeof(FD_form_character));
- fdui->form_character = fl_bgn_form(FL_NO_BOX, 295, 385);
- obj = fl_add_box(FL_UP_BOX, 0, 0, 295, 385, "");
+ fdui->form_character = fl_bgn_form(FL_NO_BOX, 300, 415);
+ obj = fl_add_box(FL_UP_BOX, 0, 0, 300, 415, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
- fdui->choice_language = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 155, 190, 30, idex(_("Language|#L")));fl_set_button_shortcut(obj, scex(_("Language|#L")), 1);
- fl_set_object_boxtype(obj, FL_FRAME_BOX);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 295, 280, 45, "");
+ obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 325, 280, 45, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 235, 280, 45, "");
+ obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 265, 280, 45, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 210, "");
+ obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 240, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
fdui->choice_family = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 15, 191, 30, idex(_("Family:|#F")));fl_set_button_shortcut(obj, scex(_("Family:|#F")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_series = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 50, 191, 30, idex(_("Series:|#S")));fl_set_button_shortcut(obj, scex(_("Series:|#S")), 1);
+ fdui->choice_series = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 55, 191, 30, idex(_("Series:|#S")));fl_set_button_shortcut(obj, scex(_("Series:|#S")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_shape = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 85, 191, 30, idex(_("Shape:|#H")));fl_set_button_shortcut(obj, scex(_("Shape:|#H")), 1);
+ fdui->choice_shape = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 95, 191, 30, idex(_("Shape:|#H")));fl_set_button_shortcut(obj, scex(_("Shape:|#H")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 245, 191, 30, idex(_("Size:|#Z")));fl_set_button_shortcut(obj, scex(_("Size:|#Z")), 1);
+ fdui->choice_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 275, 191, 30, idex(_("Size:|#Z")));fl_set_button_shortcut(obj, scex(_("Size:|#Z")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_bar = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 305, 190, 30, idex(_("Misc:|#M")));fl_set_button_shortcut(obj, scex(_("Misc:|#M")), 1);
+ fdui->choice_bar = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 335, 190, 30, idex(_("Misc:|#M")));fl_set_button_shortcut(obj, scex(_("Misc:|#M")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 345, 80, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
+ fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 375, 80, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, CharacterApplyCB, 0);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, CharacterCloseCB, 0);
- fdui->choice_color = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 120, 191, 30, idex(_("Color:|#C")));fl_set_button_shortcut(obj, scex(_("Color:|#C")), 1);
+ fdui->choice_color = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 135, 191, 30, idex(_("Color:|#C")));fl_set_button_shortcut(obj, scex(_("Color:|#C")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 190, 260, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 215, 255, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_text(FL_NORMAL_TEXT, 20, 225, 210, 20, _("These are never toggled"));
+ obj = fl_add_text(FL_NORMAL_TEXT, 20, 255, 210, 20, _("These are never toggled"));
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_text(FL_NORMAL_TEXT, 20, 285, 215, 20, _("These are always toggled"));
+ obj = fl_add_text(FL_NORMAL_TEXT, 20, 315, 215, 20, _("These are always toggled"));
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_language = obj = fl_add_box(FL_FRAME_BOX, 95, 175, 190, 30, _("Language:"));
+ fdui->choice_language = obj = fl_add_choice(FL_DROPLIST_CHOICE, 95, 175, 190, 30, _("Language:"));
+ fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT);
- fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
- fl_set_object_resize(obj, FL_RESIZE_NONE);
+ fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
+ fl_set_object_resize(obj, FL_RESIZE_X);
fl_end_form();
//fdui->form_character->fdui = fdui;
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_form_document_h_
#define FD_form_document_h_
void *vdata;
char *cdata;
long ldata;
- FL_OBJECT *choice_language;
FL_OBJECT *choice_family;
FL_OBJECT *choice_series;
FL_OBJECT *choice_shape;
- FL_OBJECT *choice_color;
- FL_OBJECT *check_toggle_all;
FL_OBJECT *choice_size;
FL_OBJECT *choice_bar;
FL_OBJECT *button_apply;
FL_OBJECT *button_close;
+ FL_OBJECT *choice_color;
+ FL_OBJECT *check_toggle_all;
+ FL_OBJECT *choice_language;
} FD_form_character;
extern FD_form_character * create_form_form_character(void);
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_form_title_h_
#define FD_form_title_h_
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_xsendfax_h_
#define FD_xsendfax_h_
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_panel_h_
#define FD_panel_h_
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_form_sendto_h_
#define FD_form_sendto_h_
-/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/
#ifndef FD_form_spell_options_h_
#define FD_form_spell_options_h_
int y_top, y_bottom;
float fill_separator, fill_hfill, fill_label_hfill;
- LyXFont font;
+ LyXFont font(LyXFont::ALL_SANE);
int maxdesc;
if (row_ptr->height() <= 0) {
lyxerr << "LYX_ERROR: row.height: "
x += x_offset;
// clear the area where we want to paint/print
- int ww = workWidth(bview);
- if (ww < 0)
+ int ww;
+ if (inset_owner)
+ ww = inset_owner->width(bview->painter(), font) - 1;
+ else
ww = bview->workWidth();
+
if (bv_owner)
pain.fillRectangle(x_offset, y_offset, ww, row_ptr->height());
if (sel_start_cursor.row() == row_ptr &&
sel_end_cursor.row() == row_ptr) {
if (sel_start_cursor.x() < sel_end_cursor.x())
- pain.fillRectangle(sel_start_cursor.x(), y_offset,
+ pain.fillRectangle(x_offset + sel_start_cursor.x(),
+ y_offset,
sel_end_cursor.x() - sel_start_cursor.x(),
row_ptr->height(),
LColor::selection);
else
- pain.fillRectangle(sel_end_cursor.x(), y_offset,
+ pain.fillRectangle(x_offset + sel_end_cursor.x(),
+ y_offset,
sel_start_cursor.x() - sel_end_cursor.x(),
row_ptr->height(),
LColor::selection);
row_ptr->height(),
LColor::selection);
else
- pain.fillRectangle(sel_start_cursor.x(), y_offset,
+ pain.fillRectangle(x_offset + sel_start_cursor.x(),
+ y_offset,
ww - sel_start_cursor.x(),
row_ptr->height(),
LColor::selection);
} else if (sel_end_cursor.row() == row_ptr) {
if (is_rtl)
- pain.fillRectangle(sel_end_cursor.x(), y_offset,
+ pain.fillRectangle(x_offset + sel_end_cursor.x(),
+ y_offset,
ww - sel_end_cursor.x(),
row_ptr->height(),
LColor::selection);
LColor::selection);
} else if (y > long(sel_start_cursor.y())
&& y < long(sel_end_cursor.y())) {
- pain.fillRectangle(x_offset, y_offset,
- ww, row_ptr->height(),
+ pain.fillRectangle(x_offset, y_offset, ww,
+ row_ptr->height(),
LColor::selection);
}
} else if ( sel_start_cursor.row() != row_ptr &&
sel_end_cursor.row() != row_ptr &&
y > long(sel_start_cursor.y())
&& y < long(sel_end_cursor.y())) {
- pain.fillRectangle(x_offset, y_offset, ww, row_ptr->height(),
+ pain.fillRectangle(x_offset, y_offset, ww,
+ row_ptr->height(),
LColor::selection);
} else if (sel_start_cursor.row() == row_ptr ||
sel_end_cursor.row() == row_ptr) {
sel_start_cursor.pos() <= pos) &&
(sel_end_cursor.row() != row_ptr ||
pos < sel_end_cursor.pos()) )
- pain.fillRectangle(int(old_tmpx), y_offset,
+ pain.fillRectangle(x_offset + int(old_tmpx),
+ y_offset,
int(tmpx - old_tmpx + 1),
row_ptr->height(),
LColor::selection);
sel_start_cursor.pos() <= pos) &&
(sel_end_cursor.row() != row_ptr ||
pos < sel_end_cursor.pos()) )
- pain.fillRectangle(int(old_tmpx), y_offset,
+ pain.fillRectangle(x_offset + int(old_tmpx),
+ y_offset,
int(tmpx - old_tmpx + 1),
row_ptr->height(),
- LColor::selection);
+ LColor::selection);
}
#ifndef NEW_TABULAR
}
#endif
if ( (sel_start_cursor.row() != row_ptr && is_rtl) ||
(sel_end_cursor.row() != row_ptr && !is_rtl) )
- pain.fillRectangle(int(tmpx), y_offset,
+ pain.fillRectangle(x_offset + int(tmpx),
+ y_offset,
int(ww - tmpx),
row_ptr->height(),
LColor::selection);
// I really mean assignment ("=") below, not equality!
if ((i = data.find_last_of("0123456789.")) != string::npos) {
if (number_index > 3) return 'E'; // Error
- string buffer = data.substr(0, i + 1);
- if (sscanf (buffer.c_str(),
- "%f", &number[number_index]) == 1) {
+ string buffer = data.substr(0, i + 1).c_str();
+ double x = strToDbl(buffer);
+ if (x) {
+ number[number_index] = x;
lyx_advance (data, i + 1);
++number_index;
return 'n';