mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
The insettext patch.
This has been out in the wild now for two weeks.... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7252 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1279bac2b3
commit
485313c6d7
@ -382,16 +382,14 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
mark_set = bv_->text->selection.mark();
|
||||
the_locking_inset = bv_->theLockingInset();
|
||||
buffer_->resizeInsets(bv_);
|
||||
// I don't think the delete and new are necessary here we
|
||||
// just could call only init! (Jug 20020419)
|
||||
delete bv_->text;
|
||||
bv_->text = new LyXText(bv_);
|
||||
bv_->text->init(bv_);
|
||||
} else {
|
||||
lyxerr << "text not available!\n";
|
||||
// See if we have a text in TextCache that fits
|
||||
// the new buffer_ with the correct width.
|
||||
bv_->text = textcache.findFit(buffer_, workarea().workWidth());
|
||||
if (bv_->text) {
|
||||
lyxerr << "text in cache!\n";
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Found a LyXText that fits:\n";
|
||||
textcache.show(lyxerr, make_pair(buffer_, make_pair(workarea().workWidth(), bv_->text)));
|
||||
@ -403,9 +401,10 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
|
||||
buffer_->resizeInsets(bv_);
|
||||
} else {
|
||||
lyxerr << "no text in cache!\n";
|
||||
bv_->text = new LyXText(bv_);
|
||||
buffer_->resizeInsets(bv_);
|
||||
bv_->text->init(bv_);
|
||||
//buffer_->resizeInsets(bv_);
|
||||
}
|
||||
|
||||
par = bv_->text->ownerParagraphs().end();
|
||||
|
@ -1,3 +1,12 @@
|
||||
|
||||
2003-07-10 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* BufferView_pimpl.C:
|
||||
* tabular.h:
|
||||
* tabular_funcs.C:
|
||||
* text.C:
|
||||
* text2.C: remove InsetText::InnerCache, clean up consequences
|
||||
|
||||
2003-07-07 Adrien Rebollo <adrien.rebollo@gmx.fr>
|
||||
|
||||
* ispell.C: fix two typos in error messages
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
2003-07-10 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insettabular.C:
|
||||
* insettext.[Ch]: remove InsetText::InnerCache, clean up consequences
|
||||
|
||||
2003-07-04 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* introduce namespace lyx::graphics
|
||||
|
@ -249,9 +249,16 @@ void InsetTabular::read(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::metrics(MetricsInfo &,
|
||||
Dimension & dim) const
|
||||
void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
if (mi.base.bv) {
|
||||
//lyxerr << "InsetTabular::metrics, bv: " << mi.base.bv << endl;
|
||||
for (int i = 0; i < tabular.getNumberOfCells(); ++i) {
|
||||
tabular.cellinfo_of_cell(i)->inset.text_.bv_owner = mi.base.bv;
|
||||
tabular.cellinfo_of_cell(i)->inset.reinitLyXText();
|
||||
}
|
||||
}
|
||||
|
||||
dim.asc = tabular.getAscentOfRow(0);
|
||||
dim.des = tabular.getHeightOfTabular() - tabular.getAscentOfRow(0) + 1;
|
||||
dim.wid = tabular.getWidthOfTabular() + 2 * ADD_TO_TABULAR_WIDTH;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,12 +19,13 @@
|
||||
#include "ParagraphList.h"
|
||||
#include "RowList.h"
|
||||
#include "dimension.h"
|
||||
#include "frontends/mouse_state.h"
|
||||
#include "lyxtext.h"
|
||||
|
||||
#include "support/types.h"
|
||||
|
||||
#include "frontends/mouse_state.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <map>
|
||||
|
||||
class Painter;
|
||||
class BufferView;
|
||||
@ -268,19 +269,6 @@ private:
|
||||
///
|
||||
void lfunMouseMotion(FuncRequest const &);
|
||||
|
||||
///
|
||||
struct InnerCache {
|
||||
///
|
||||
InnerCache(boost::shared_ptr<LyXText>);
|
||||
///
|
||||
boost::shared_ptr<LyXText> text;
|
||||
///
|
||||
bool remove;
|
||||
};
|
||||
///
|
||||
typedef std::map<BufferView *, InnerCache> Cache;
|
||||
///
|
||||
typedef Cache::value_type value_type;
|
||||
///
|
||||
RESULT moveRight(BufferView *,
|
||||
bool activate_inset = true,
|
||||
@ -336,8 +324,6 @@ private:
|
||||
///
|
||||
void restoreLyXTextState(LyXText *) const;
|
||||
///
|
||||
void reinitLyXText() const;
|
||||
///
|
||||
void collapseParagraphs(BufferView *);
|
||||
|
||||
/* Private structures and variables */
|
||||
@ -365,22 +351,12 @@ private:
|
||||
UpdatableInset * the_locking_inset;
|
||||
///
|
||||
mutable ParagraphList::iterator old_par;
|
||||
/// The cache.
|
||||
mutable Cache cache;
|
||||
///
|
||||
mutable int last_drawn_width;
|
||||
///
|
||||
mutable BufferView * cached_bview;
|
||||
///
|
||||
mutable boost::shared_ptr<LyXText> cached_text;
|
||||
|
||||
/// some funny 'temporarily saved state'
|
||||
mutable TextCursor sstate;
|
||||
|
||||
///
|
||||
// this is needed globally so we know that we're using it actually and
|
||||
// so the LyXText-Cache is not erased until used!
|
||||
mutable LyXText * lt;
|
||||
///
|
||||
// to remember old painted frame dimensions to clear it on the right spot!
|
||||
///
|
||||
@ -390,13 +366,16 @@ private:
|
||||
mutable int frame_h;
|
||||
///
|
||||
bool in_update; /* as update is not reentrant! */
|
||||
mutable BufferView * do_resize;
|
||||
mutable bool do_reinit;
|
||||
mutable bool in_insetAllowed;
|
||||
///
|
||||
// these are used to check for mouse movement in Motion selection code
|
||||
///
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
public:
|
||||
///
|
||||
void reinitLyXText() const;
|
||||
///
|
||||
mutable LyXText text_;
|
||||
};
|
||||
#endif
|
||||
|
@ -223,9 +223,11 @@ private:
|
||||
|
||||
refresh_status refresh_status_;
|
||||
|
||||
public:
|
||||
/// only the top-level LyXText has this non-zero
|
||||
BufferView * bv_owner;
|
||||
|
||||
private:
|
||||
/// returns a pointer to a specified row.
|
||||
RowList::iterator
|
||||
getRow(ParagraphList::iterator pit, lyx::pos_type pos) const;
|
||||
|
@ -386,7 +386,8 @@ public:
|
||||
///
|
||||
/// recalculate the widths/heights only!
|
||||
void reinit();
|
||||
private:
|
||||
///
|
||||
//private:
|
||||
///
|
||||
mutable int cur_cell;
|
||||
///
|
||||
@ -422,6 +423,7 @@ private:
|
||||
///
|
||||
InsetText inset;
|
||||
};
|
||||
cellstruct * cellinfo_of_cell(int cell) const;
|
||||
///
|
||||
typedef std::vector<cellstruct> cell_vector;
|
||||
///
|
||||
@ -532,8 +534,6 @@ private:
|
||||
///
|
||||
void calculate_width_of_tabular();
|
||||
///
|
||||
cellstruct * cellinfo_of_cell(int cell) const;
|
||||
///
|
||||
void delete_column(int column);
|
||||
///
|
||||
int cells_in_multicolumn(int cell) const;
|
||||
|
@ -156,7 +156,10 @@ int LyXText::workWidth(Inset const * inset) const
|
||||
ParagraphList::iterator par = std::find(ownerParagraphs().begin(),
|
||||
ownerParagraphs().end(),
|
||||
*inset->parOwner());
|
||||
//Assert(par);
|
||||
if (par == ownerParagraphs().end()) {
|
||||
lyxerr[Debug::GUI] << "LyXText::workWidth: unexpected\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
pos_type pos = par->getPositionOfInset(inset);
|
||||
Assert(pos != -1);
|
||||
|
@ -83,6 +83,7 @@ LyXText::LyXText(BufferView * bv, InsetText * inset)
|
||||
|
||||
void LyXText::init(BufferView * bview, bool reinit)
|
||||
{
|
||||
bv_owner = bview;
|
||||
if (reinit) {
|
||||
rowlist_.clear();
|
||||
need_break_row = rows().end();
|
||||
|
Loading…
Reference in New Issue
Block a user