mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
Fixed inset-redraw problems on resizing lyx-window, and some other small
fixes in inset-text and inset-tabular (layout update). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@884 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6b31ec115b
commit
08c732ecfa
11
ChangeLog
11
ChangeLog
@ -1,5 +1,16 @@
|
||||
2000-07-14 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/insets/insettext.C (clear): fixed for multiple paragraps/layouts.
|
||||
|
||||
* src/frontends/xforms/forms/form_tabular.fd: updated a bit.
|
||||
|
||||
* src/insets/insettabular.C (resizeLyXText): need this to be able to
|
||||
do a redraw when the window is resized!
|
||||
(LocalDispatch): small fix so LFUN_TAB works only with locked_inset.
|
||||
|
||||
* src/insets/insettext.C (resizeLyXText): added function to correctly
|
||||
being able to resize the LyXWindow.
|
||||
|
||||
* src/table.C (Read): fixed read on DOS-lyx-file (lf-lr)
|
||||
|
||||
2000-07-13 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
@ -33,11 +33,6 @@ src/frontends/xforms/FormPreferences.C
|
||||
src/frontends/xforms/form_preferences.C
|
||||
src/frontends/xforms/FormPrint.C
|
||||
src/frontends/xforms/form_print.C
|
||||
src/frontends/xforms/forms/form_citation.C
|
||||
src/frontends/xforms/forms/form_copyright.C
|
||||
src/frontends/xforms/forms/form_preferences.C
|
||||
src/frontends/xforms/forms/form_print.C
|
||||
src/frontends/xforms/forms/form_tabular.C
|
||||
src/frontends/xforms/FormTabular.C
|
||||
src/frontends/xforms/form_tabular.C
|
||||
src/gettext.h
|
||||
|
@ -270,10 +270,8 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
}
|
||||
}
|
||||
bv_->text->first = screen_->TopCursorVisible(bv_->text);
|
||||
/* this will scroll the
|
||||
* screen such that the
|
||||
* cursor becomes
|
||||
* visible */
|
||||
buffer_->resizeInsets(bv_);
|
||||
// this will scroll the screen such that the cursor becomes visible
|
||||
updateScrollbar();
|
||||
redraw();
|
||||
owner_->getMiniBuffer()->Init();
|
||||
|
13
src/buffer.C
13
src/buffer.C
@ -3732,18 +3732,21 @@ bool Buffer::Dispatch(int action, string const & argument)
|
||||
|
||||
void Buffer::resize()
|
||||
{
|
||||
/// first resize the BufferViews!
|
||||
if (users) {
|
||||
/// resize the BufferViews!
|
||||
if (users)
|
||||
users->resize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Buffer::resizeInsets(BufferView * bv)
|
||||
{
|
||||
/// then remove all LyXText in text-insets
|
||||
LyXParagraph * par = paragraph;
|
||||
for(;par;par = par->next) {
|
||||
par->deleteInsetsLyXText(users);
|
||||
par->resizeInsetsLyXText(bv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Buffer::ChangeLanguage(Language const * from, Language const * to)
|
||||
{
|
||||
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
|
||||
/// should be changed to work for a list.
|
||||
void resize();
|
||||
void resizeInsets(BufferView *);
|
||||
|
||||
/// Update window titles of all users
|
||||
void updateTitles() const;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "FormTabular.h"
|
||||
#include "form_tabular.h"
|
||||
#include "xform_macros.h"
|
||||
#include "input_validators.h"
|
||||
#include "LyXView.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#define FORMTABULAR_H
|
||||
|
||||
#include "DialogBase.h"
|
||||
#include "form_tabular.h"
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Connection;
|
||||
#endif
|
||||
@ -26,6 +25,12 @@ using SigC::Connection;
|
||||
class LyXView;
|
||||
class Dialogs;
|
||||
class InsetTabular;
|
||||
struct FD_form_tabular;
|
||||
struct FD_form_tabular_options;
|
||||
struct FD_form_column_options;
|
||||
struct FD_form_cell_options;
|
||||
struct FD_form_longtable_options;
|
||||
struct FD_form_create_tabular;
|
||||
|
||||
/** This class provides an XForms implementation of the FormTabular Dialog.
|
||||
The tabular dialog allows users to set/save their tabular.
|
||||
|
@ -15,21 +15,21 @@ FD_form_tabular * FormTabular::build_tabular()
|
||||
FL_OBJECT *obj;
|
||||
FD_form_tabular *fdui = new FD_form_tabular;
|
||||
|
||||
fdui->form_tabular = fl_bgn_form(FL_NO_BOX, 510, 340);
|
||||
fdui->form_tabular = fl_bgn_form(FL_NO_BOX, 510, 285);
|
||||
fdui->form_tabular->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 340, "");
|
||||
fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 10, 10, 485, 240, _("Tabbed folder"));
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 285, "");
|
||||
fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 505, 245, _("Tabbed folder"));
|
||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||
fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 395, 300, 100, 30, idex(_("Close|#C")));fl_set_button_shortcut(obj, scex(_("Close|#C")), 1);
|
||||
fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 415, 250, 90, 30, idex(_("Close|#C")));fl_set_button_shortcut(obj, scex(_("Close|#C")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormTabularCloseCB, 0);
|
||||
fdui->input_tabular_column = obj = fl_add_input(FL_NORMAL_INPUT, 15, 300, 60, 30, _("Column"));
|
||||
fdui->input_tabular_column = obj = fl_add_input(FL_NORMAL_INPUT, 5, 250, 60, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fdui->input_tabular_row = obj = fl_add_input(FL_NORMAL_INPUT, 85, 300, 60, 30, _("Row"));
|
||||
fdui->input_tabular_row = obj = fl_add_input(FL_NORMAL_INPUT, 65, 250, 60, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 10, 250, 485, 30, "");
|
||||
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 125, 250, 290, 30, "");
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
@ -46,9 +46,9 @@ FD_form_tabular_options * FormTabular::build_tabular_options()
|
||||
FL_OBJECT *obj;
|
||||
FD_form_tabular_options *fdui = new FD_form_tabular_options;
|
||||
|
||||
fdui->form_tabular_options = fl_bgn_form(FL_NO_BOX, 485, 220);
|
||||
fdui->form_tabular_options = fl_bgn_form(FL_NO_BOX, 505, 227);
|
||||
fdui->form_tabular_options->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 485, 220, "");
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 280, 20, 120, 75, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
fdui->button_append_column = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 40, 120, 30, idex(_("Append Column|#A")));fl_set_button_shortcut(obj, scex(_("Append Column|#A")), 1);
|
||||
@ -90,9 +90,9 @@ FD_form_column_options * FormTabular::build_column_options()
|
||||
FL_OBJECT *obj;
|
||||
FD_form_column_options *fdui = new FD_form_column_options;
|
||||
|
||||
fdui->form_column_options = fl_bgn_form(FL_NO_BOX, 485, 220);
|
||||
fdui->form_column_options = fl_bgn_form(FL_NO_BOX, 505, 227);
|
||||
fdui->form_column_options->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 485, 220, "");
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 20, 20, 170, 105, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
@ -172,9 +172,9 @@ FD_form_cell_options * FormTabular::build_cell_options()
|
||||
FL_OBJECT *obj;
|
||||
FD_form_cell_options *fdui = new FD_form_cell_options;
|
||||
|
||||
fdui->form_cell_options = fl_bgn_form(FL_NO_BOX, 485, 220);
|
||||
fdui->form_cell_options = fl_bgn_form(FL_NO_BOX, 505, 227);
|
||||
fdui->form_cell_options->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 485, 220, "");
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 110, 180, 100, "");
|
||||
fl_set_object_color(obj, FL_COL1, FL_COL1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
@ -265,9 +265,9 @@ FD_form_longtable_options * FormTabular::build_longtable_options()
|
||||
FL_OBJECT *obj;
|
||||
FD_form_longtable_options *fdui = new FD_form_longtable_options;
|
||||
|
||||
fdui->form_longtable_options = fl_bgn_form(FL_NO_BOX, 485, 220);
|
||||
fdui->form_longtable_options = fl_bgn_form(FL_NO_BOX, 505, 227);
|
||||
fdui->form_longtable_options->u_vdata = this;
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 485, 220, "");
|
||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, "");
|
||||
obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 100, 75, "");
|
||||
obj = fl_add_text(FL_NORMAL_TEXT, 15, 10, 85, 20, _("Header"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/** Header file generated with fdesign on Fri Jul 14 09:35:06 2000.**/
|
||||
/** Header file generated with fdesign on Fri Jul 14 15:53:33 2000.**/
|
||||
|
||||
#ifndef FD_form_tabular_h_
|
||||
#define FD_form_tabular_h_
|
||||
|
@ -10,13 +10,13 @@ SnapGrid: 5
|
||||
=============== FORM ===============
|
||||
Name: form_tabular
|
||||
Width: 510
|
||||
Height: 340
|
||||
Height: 285
|
||||
Number of Objects: 6
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: FLAT_BOX
|
||||
box: 0 0 510 340
|
||||
box: 0 0 510 285
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -34,7 +34,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_TABFOLDER
|
||||
type: TOP_TABFOLDER
|
||||
box: 10 10 485 240
|
||||
box: 0 0 505 245
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
@ -52,7 +52,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 395 300 100 30
|
||||
box: 415 250 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -70,14 +70,14 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 15 300 60 30
|
||||
box: 64 250 60 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Column
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
@ -88,14 +88,14 @@ argument:
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 85 300 60 30
|
||||
box: 5 250 60 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Row
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
@ -106,7 +106,7 @@ argument:
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 10 250 485 30
|
||||
box: 125 250 290 30
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
@ -123,14 +123,14 @@ argument:
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_tabular_options
|
||||
Width: 485
|
||||
Height: 220
|
||||
Width: 505
|
||||
Height: 227
|
||||
Number of Objects: 11
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 485 220
|
||||
box: 0 0 505 227
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -327,14 +327,14 @@ argument:
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_column_options
|
||||
Width: 485
|
||||
Height: 220
|
||||
Width: 505
|
||||
Height: 227
|
||||
Number of Objects: 21
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 485 220
|
||||
box: 0 0 505 227
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -711,14 +711,14 @@ argument:
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_cell_options
|
||||
Width: 485
|
||||
Height: 220
|
||||
Width: 505
|
||||
Height: 227
|
||||
Number of Objects: 26
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 485 220
|
||||
box: 0 0 505 227
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1185,14 +1185,14 @@ argument: 0
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_longtable_options
|
||||
Width: 485
|
||||
Height: 220
|
||||
Width: 505
|
||||
Height: 227
|
||||
Number of Objects: 12
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 485 220
|
||||
box: 0 0 505 227
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
|
@ -321,7 +321,7 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
||||
}
|
||||
if (!widthCollapsed) {
|
||||
widthCollapsed = width_collapsed(bv->painter(), font);
|
||||
inset->deleteLyXText(bv);
|
||||
inset->resizeLyXText(bv);
|
||||
need_update = FULL;
|
||||
if (owner()) {
|
||||
owner()->update(bv, font);
|
||||
@ -330,7 +330,7 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
||||
}
|
||||
if (oldWidth != width(bv, font)) {
|
||||
oldWidth = width(bv, font);
|
||||
inset->deleteLyXText(bv);
|
||||
inset->resizeLyXText(bv);
|
||||
need_update = FULL;
|
||||
if (owner()) {
|
||||
owner()->update(bv, font);
|
||||
@ -435,7 +435,15 @@ LyXText * InsetCollapsable::getLyXText(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::deleteLyXText(BufferView * bv) const
|
||||
void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
|
||||
{
|
||||
inset->deleteLyXText(bv);
|
||||
inset->deleteLyXText(bv, recursive);
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::resizeLyXText(BufferView * bv) const
|
||||
{
|
||||
inset->resizeLyXText(bv);
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
oldWidth = width(bv, font);
|
||||
}
|
||||
|
@ -120,7 +120,8 @@ public:
|
||||
int getMaxWidth(Painter & pain, UpdatableInset const *) const;
|
||||
///
|
||||
LyXText * getLyXText(BufferView *) const;
|
||||
void deleteLyXText(BufferView *) const;
|
||||
void deleteLyXText(BufferView *, bool recursive=true) const;
|
||||
void resizeLyXText(BufferView *) const;
|
||||
|
||||
protected:
|
||||
///
|
||||
@ -156,7 +157,7 @@ private:
|
||||
///
|
||||
int widthCollapsed;
|
||||
///
|
||||
int oldWidth;
|
||||
mutable int oldWidth;
|
||||
///
|
||||
mutable int topx;
|
||||
mutable int topbaseline;
|
||||
|
@ -162,7 +162,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
||||
if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
|
||||
(top_x != int(x)) || (top_baseline != baseline))) {
|
||||
int h = ascent(bv, font) + descent(bv, font);
|
||||
int tx = display()? 0:top_x;
|
||||
int tx = display()||!owner()? 0:top_x;
|
||||
int w = tx? width(bv, font):pain.paperWidth();
|
||||
int ty = baseline - ascent(bv, font);
|
||||
|
||||
@ -567,7 +567,6 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
resetPos(bv);
|
||||
return result;
|
||||
}
|
||||
result=DISPATCHED;
|
||||
|
||||
if ((action < 0) && arg.empty())
|
||||
return FINISHED;
|
||||
@ -599,6 +598,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
|
||||
bool hs = hasSelection();
|
||||
HideInsetCursor(bv);
|
||||
result=DISPATCHED;
|
||||
switch (action) {
|
||||
// Normal chars not handled here
|
||||
case -1:
|
||||
@ -623,7 +623,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
sel_pos_start = sel_pos_end = cursor.pos();
|
||||
sel_cell_start = sel_cell_end = actcell;
|
||||
if (hs)
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
UpdateLocal(bv, SELECTION, false);
|
||||
break;
|
||||
case LFUN_LEFTSEL:
|
||||
if (tabular->IsFirstCellInRow(actcell) && cellstart(cursor.pos()))
|
||||
@ -644,7 +644,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
sel_pos_start = sel_pos_end = cursor.pos();
|
||||
sel_cell_start = sel_cell_end = actcell;
|
||||
if (hs)
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
UpdateLocal(bv, SELECTION, false);
|
||||
break;
|
||||
case LFUN_DOWNSEL:
|
||||
{
|
||||
@ -664,7 +664,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
sel_pos_start = sel_pos_end = cursor.pos();
|
||||
sel_cell_start = sel_cell_end = actcell;
|
||||
if (hs)
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
UpdateLocal(bv, SELECTION, false);
|
||||
break;
|
||||
case LFUN_UPSEL:
|
||||
{
|
||||
@ -684,7 +684,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
sel_pos_start = sel_pos_end = cursor.pos();
|
||||
sel_cell_start = sel_cell_end = actcell;
|
||||
if (hs)
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
UpdateLocal(bv, SELECTION, false);
|
||||
break;
|
||||
case LFUN_BACKSPACE:
|
||||
break;
|
||||
@ -697,9 +697,9 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
case LFUN_SHIFT_TAB:
|
||||
case LFUN_TAB:
|
||||
if (the_locking_inset) {
|
||||
the_locking_inset->InsetUnlock(bv);
|
||||
UnlockInsetInInset(bv, the_locking_inset);
|
||||
the_locking_inset = 0;
|
||||
}
|
||||
the_locking_inset = 0;
|
||||
if (action == LFUN_TAB)
|
||||
moveNextCell(bv);
|
||||
else
|
||||
@ -707,7 +707,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
|
||||
sel_pos_start = sel_pos_end = cursor.pos();
|
||||
sel_cell_start = sel_cell_end = actcell;
|
||||
if (hs)
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
UpdateLocal(bv, SELECTION, false);
|
||||
break;
|
||||
case LFUN_LAYOUT_TABLE:
|
||||
{
|
||||
@ -1349,3 +1349,9 @@ void InsetTabular::recomputeTextInsets(BufferView * bv, const LyXFont & font) co
|
||||
// cx += tabular->GetWidthOfColumn(cell);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::resizeLyXText(BufferView *) const
|
||||
{
|
||||
need_update = FULL;
|
||||
}
|
||||
|
@ -118,6 +118,8 @@ public:
|
||||
///
|
||||
bool InsertInset(BufferView *, Inset *);
|
||||
///
|
||||
bool IsTextInset() const { return true; }
|
||||
///
|
||||
bool display() const { return tabular->IsLongTabular(); }
|
||||
///
|
||||
void InsetButtonRelease(BufferView *, int, int, int);
|
||||
@ -155,6 +157,8 @@ public:
|
||||
int getMaxWidth(Painter & pain, UpdatableInset const *) const;
|
||||
///
|
||||
Buffer * BufferOwner() const { return buffer; }
|
||||
///
|
||||
void resizeLyXText(BufferView *) const;
|
||||
|
||||
///
|
||||
/// Public structures and variables
|
||||
|
@ -116,6 +116,19 @@ InsetText::~InsetText()
|
||||
}
|
||||
|
||||
|
||||
void InsetText::clear()
|
||||
{
|
||||
LyXParagraph * p = par->next;
|
||||
delete par;
|
||||
while(p) {
|
||||
par = p;
|
||||
p = p->next;
|
||||
delete par;
|
||||
}
|
||||
par = new LyXParagraph();
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetText::Clone() const
|
||||
{
|
||||
InsetText * t = new InsetText(*this);
|
||||
@ -323,15 +336,18 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||
{
|
||||
if (reinit) { // && (need_update != CURSOR)) {
|
||||
need_update = INIT;
|
||||
deleteLyXText(bv);
|
||||
resizeLyXText(bv);
|
||||
if (owner())
|
||||
owner()->update(bv, font, true);
|
||||
return;
|
||||
}
|
||||
if (the_locking_inset)
|
||||
if (the_locking_inset) {
|
||||
inset_x = cx(bv) - top_x + drawTextXOffset;
|
||||
inset_y = cy(bv) + drawTextYOffset;
|
||||
the_locking_inset->update(bv, font, reinit);
|
||||
}
|
||||
if (need_update == INIT) {
|
||||
deleteLyXText(bv);
|
||||
resizeLyXText(bv);
|
||||
need_update = FULL;
|
||||
// if (!owner() && bv->text)
|
||||
// bv->text->UpdateInset(bv, this);
|
||||
@ -350,7 +366,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||
if (oldw != insetWidth) {
|
||||
// printf("TW(%p): %d-%d-%d-%d\n",this,insetWidth, oldw,
|
||||
// textWidth(bv->painter()),static_cast<int>(TEXT(bv)->width));
|
||||
deleteLyXText(bv);
|
||||
resizeLyXText(bv);
|
||||
need_update = FULL;
|
||||
#if 0
|
||||
if (owner()) {
|
||||
@ -781,6 +797,16 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
UpdateLocal(bv, CURSOR_PAR, false);
|
||||
break;
|
||||
case LFUN_PASTE:
|
||||
if (!autoBreakRows) {
|
||||
CutAndPaste cap;
|
||||
|
||||
if (cap.nrOfParagraphs() > 1) {
|
||||
WriteAlert(_("Impossible operation"),
|
||||
_("Cannot include more than one paragraph!"),
|
||||
_("Sorry."));
|
||||
break;
|
||||
}
|
||||
}
|
||||
bv->text->SetUndo(bv->buffer(), Undo::INSERT,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
|
||||
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next);
|
||||
@ -960,7 +986,7 @@ void InsetText::ToggleInsetCursor(BufferView * bv)
|
||||
if (cursor_visible)
|
||||
bv->hideLockedInsetCursor();
|
||||
else
|
||||
bv->showLockedInsetCursor(cx(bv), cy(bv),
|
||||
bv->showLockedInsetCursor(cx(bv)-1, cy(bv),
|
||||
asc, desc);
|
||||
cursor_visible = !cursor_visible;
|
||||
}
|
||||
@ -1252,12 +1278,74 @@ LyXText * InsetText::getLyXText(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
void InsetText::deleteLyXText(BufferView * bv) const
|
||||
void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
|
||||
{
|
||||
cache.erase(bv);
|
||||
/// then remove all LyXText in text-insets
|
||||
LyXParagraph * p = par;
|
||||
for(;p;p = p->next) {
|
||||
if (recursive) {
|
||||
/// then remove all LyXText in text-insets
|
||||
LyXParagraph * p = par;
|
||||
for(;p;p = p->next) {
|
||||
p->deleteInsetsLyXText(bv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InsetText::resizeLyXText(BufferView * bv) const
|
||||
{
|
||||
if (!par->next && !par->size()) // not neccessary!
|
||||
return;
|
||||
|
||||
LyXParagraph * lpar = 0;
|
||||
LyXParagraph * selstartpar = 0;
|
||||
LyXParagraph * selendpar = 0;
|
||||
int pos = 0;
|
||||
int selstartpos = 0;
|
||||
int selendpos = 0;
|
||||
int selection = 0;
|
||||
int mark_set = 0;
|
||||
|
||||
// ProhibitInput(bv);
|
||||
|
||||
lpar = TEXT(bv)->cursor.par();
|
||||
pos = TEXT(bv)->cursor.pos();
|
||||
selstartpar = TEXT(bv)->sel_start_cursor.par();
|
||||
selstartpos = TEXT(bv)->sel_start_cursor.pos();
|
||||
selendpar = TEXT(bv)->sel_end_cursor.par();
|
||||
selendpos = TEXT(bv)->sel_end_cursor.pos();
|
||||
selection = TEXT(bv)->selection;
|
||||
mark_set = TEXT(bv)->mark_set;
|
||||
deleteLyXText(bv, (the_locking_inset == 0));
|
||||
|
||||
if (lpar) {
|
||||
TEXT(bv)->selection = true;
|
||||
/* at this point just to avoid the Delete-Empty-Paragraph
|
||||
* Mechanism when setting the cursor */
|
||||
TEXT(bv)->mark_set = mark_set;
|
||||
if (selection) {
|
||||
TEXT(bv)->SetCursor(bv, selstartpar, selstartpos);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
TEXT(bv)->SetCursor(bv, selendpar, selendpos);
|
||||
TEXT(bv)->SetSelection();
|
||||
TEXT(bv)->SetCursor(bv, lpar, pos);
|
||||
} else {
|
||||
TEXT(bv)->SetCursor(bv, lpar, pos);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
TEXT(bv)->selection = false;
|
||||
}
|
||||
}
|
||||
if (bv->screen())
|
||||
TEXT(bv)->first = bv->screen()->TopCursorVisible(TEXT(bv));
|
||||
// this will scroll the screen such that the cursor becomes visible
|
||||
bv->updateScrollbar();
|
||||
// AllowInput(bv);
|
||||
if (the_locking_inset) {
|
||||
/// then resize all LyXText in text-insets
|
||||
inset_x = cx(bv) - top_x + drawTextXOffset;
|
||||
inset_y = cy(bv) + drawTextYOffset;
|
||||
LyXParagraph * p = par;
|
||||
for(;p;p = p->next) {
|
||||
p->resizeInsetsLyXText(bv);
|
||||
}
|
||||
}
|
||||
need_update = FULL;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
///
|
||||
InsetText & operator= (InsetText const & it);
|
||||
///
|
||||
void clear() const { par->clearContents(); }
|
||||
void clear();
|
||||
///
|
||||
void Read(Buffer const *, LyXLex &);
|
||||
///
|
||||
@ -153,7 +153,8 @@ public:
|
||||
// LyXFont GetDrawFont(BufferView *, LyXParagraph *, int pos) const;
|
||||
///
|
||||
LyXText * getLyXText(BufferView *) const;
|
||||
void deleteLyXText(BufferView *) const;
|
||||
void deleteLyXText(BufferView *, bool recursive=true) const;
|
||||
void resizeLyXText(BufferView *) const;
|
||||
|
||||
LyXParagraph * par;
|
||||
///
|
||||
|
@ -212,7 +212,8 @@ public:
|
||||
/// because we could have fake text insets and have to call this
|
||||
/// inside them without cast!!!
|
||||
virtual LyXText * getLyXText(BufferView *) const;
|
||||
virtual void deleteLyXText(BufferView *) const {}
|
||||
virtual void deleteLyXText(BufferView *, bool =true) const {}
|
||||
virtual void resizeLyXText(BufferView *) const {}
|
||||
|
||||
protected:
|
||||
///
|
||||
|
@ -200,6 +200,7 @@ public:
|
||||
void SetInsetOwner(Inset * i);
|
||||
///
|
||||
void deleteInsetsLyXText(BufferView *);
|
||||
void resizeInsetsLyXText(BufferView *);
|
||||
private:
|
||||
///
|
||||
TextContainer text;
|
||||
|
@ -4429,3 +4429,18 @@ void LyXParagraph::deleteInsetsLyXText(BufferView * bv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXParagraph::resizeInsetsLyXText(BufferView * bv)
|
||||
{
|
||||
// then the insets
|
||||
for (InsetList::const_iterator cit = insetlist.begin();
|
||||
cit != insetlist.end(); ++cit) {
|
||||
if ((*cit).inset) {
|
||||
if ((*cit).inset->IsTextInset()) {
|
||||
static_cast<UpdatableInset *>
|
||||
((*cit).inset)->resizeLyXText(bv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user