Merge the working bits of the resize patch, and fix a couple of things

that broke.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4441 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-06-20 20:37:42 +00:00
parent ba21e88032
commit 60b905b885
12 changed files with 32 additions and 82 deletions

View File

@ -65,15 +65,9 @@ void BufferView::buffer(Buffer * b)
} }
void BufferView::resize(int xpos, int ypos, int width, int height)
{
pimpl_->resize(xpos, ypos, width, height);
}
void BufferView::resize() void BufferView::resize()
{ {
pimpl_->resize(); pimpl_->resizeCurrentBuffer();
} }
@ -119,12 +113,6 @@ void BufferView::redoCurrentBuffer()
} }
int BufferView::resizeCurrentBuffer()
{
return pimpl_->resizeCurrentBuffer();
}
void BufferView::cursorPrevious(LyXText * text) void BufferView::cursorPrevious(LyXText * text)
{ {
pimpl_->cursorPrevious(text); pimpl_->cursorPrevious(text);

View File

@ -58,8 +58,6 @@ public:
/// ///
void buffer(Buffer * b); void buffer(Buffer * b);
/// ///
void resize(int, int, int, int);
///
void resize(); void resize();
/// ///
void redraw(); void redraw();
@ -76,8 +74,6 @@ public:
/// ///
void redoCurrentBuffer(); void redoCurrentBuffer();
/// ///
int resizeCurrentBuffer();
///
void cursorPrevious(LyXText *); void cursorPrevious(LyXText *);
/// ///
void cursorNext(LyXText *); void cursorNext(LyXText *);

View File

@ -133,8 +133,8 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
// Setup the signals // Setup the signals
workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1)); workarea().scrollDocView.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
workarea().workAreaExpose workarea().workAreaResize
.connect(boost::bind(&BufferView::Pimpl::workAreaExpose, this)); .connect(boost::bind(&BufferView::Pimpl::workAreaResize, this));
workarea().workAreaButtonPress workarea().workAreaButtonPress
.connect(boost::bind(&BufferView::Pimpl::workAreaButtonPress, this, _1, _2, _3)); .connect(boost::bind(&BufferView::Pimpl::workAreaButtonPress, this, _1, _2, _3));
workarea().workAreaButtonRelease workarea().workAreaButtonRelease
@ -244,21 +244,6 @@ void BufferView::Pimpl::buffer(Buffer * b)
} }
void BufferView::Pimpl::resize(int xpos, int ypos, int width, int height)
{
workarea().resize(xpos, ypos, width, height);
update(bv_->text, SELECT);
redraw();
}
void BufferView::Pimpl::resize()
{
if (buffer_)
resizeCurrentBuffer();
}
void BufferView::Pimpl::redraw() void BufferView::Pimpl::redraw()
{ {
lyxerr[Debug::INFO] << "BufferView::redraw()" << endl; lyxerr[Debug::INFO] << "BufferView::redraw()" << endl;
@ -288,7 +273,7 @@ void BufferView::Pimpl::redoCurrentBuffer()
{ {
lyxerr[Debug::INFO] << "BufferView::redoCurrentBuffer" << endl; lyxerr[Debug::INFO] << "BufferView::redoCurrentBuffer" << endl;
if (buffer_ && bv_->text) { if (buffer_ && bv_->text) {
resize(); resizeCurrentBuffer();
owner_->updateLayoutChoice(); owner_->updateLayoutChoice();
} }
} }
@ -349,8 +334,6 @@ int BufferView::Pimpl::resizeCurrentBuffer()
} }
} }
updateScreen();
if (par) { if (par) {
bv_->text->selection.set(true); bv_->text->selection.set(true);
// At this point just to avoid the Delete-Empty-Paragraph- // At this point just to avoid the Delete-Empty-Paragraph-
@ -916,7 +899,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y)
} }
void BufferView::Pimpl::workAreaExpose() void BufferView::Pimpl::workAreaResize()
{ {
static int work_area_width; static int work_area_width;
static unsigned int work_area_height; static unsigned int work_area_height;
@ -930,7 +913,7 @@ void BufferView::Pimpl::workAreaExpose()
if (buffer_ != 0) { if (buffer_ != 0) {
if (widthChange) { if (widthChange) {
// The visible LyXView need a resize // The visible LyXView need a resize
owner_->view()->resize(); resizeCurrentBuffer();
// Remove all texts from the textcache // Remove all texts from the textcache
// This is not _really_ what we want to do. What // This is not _really_ what we want to do. What
@ -941,10 +924,9 @@ void BufferView::Pimpl::workAreaExpose()
if (lyxerr.debugging()) if (lyxerr.debugging())
textcache.show(lyxerr, "Expose delete all"); textcache.show(lyxerr, "Expose delete all");
textcache.clear(); textcache.clear();
// FIXME: this is aalready done in resizeCurrentBuffer() ??
buffer_->resizeInsets(bv_); buffer_->resizeInsets(bv_);
} else if (heightChange) { } else if (heightChange) {
// Rebuild image of current screen
updateScreen();
// fitCursor() ensures we don't jump back // fitCursor() ensures we don't jump back
// to the start of the document on vertical // to the start of the document on vertical
// resize // resize

View File

@ -45,10 +45,6 @@ struct BufferView::Pimpl : public boost::signals::trackable {
/// ///
void buffer(Buffer *); void buffer(Buffer *);
/// ///
void resize(int xpos, int ypos, int width, int height);
///
void resize();
///
void redraw(); void redraw();
/// Return true if the cursor was fitted. /// Return true if the cursor was fitted.
bool fitCursor(); bool fitCursor();
@ -63,7 +59,7 @@ struct BufferView::Pimpl : public boost::signals::trackable {
/// Update pixmap of screen /// Update pixmap of screen
void updateScreen(); void updateScreen();
/// ///
void workAreaExpose(); void workAreaResize();
/// ///
void updateScrollbar(); void updateScrollbar();
/// ///

View File

@ -1,3 +1,11 @@
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* BufferView.h:
* BufferView.C:
* BufferView_pimpl.h:
* BufferView_pimpl.C: clean up resize() stuff,
and unnecessary updateScreen()s
2002-06-20 John Levon <moz@compsoc.man.ac.uk> 2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* BufferView.h: * BufferView.h:

View File

@ -1,3 +1,7 @@
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* WorkArea.h: remove unused resize(..) and change name
2002-06-20 John Levon <moz@compsoc.man.ac.uk> 2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* LyXKeySym.h: * LyXKeySym.h:

View File

@ -46,8 +46,6 @@ public:
/// return the height of the work area in pixels /// return the height of the work area in pixels
virtual int workHeight() const = 0; virtual int workHeight() const = 0;
/// FIXME: GUII
virtual void resize(int xpos, int ypos, int width, int height) = 0;
/// FIXME: GUII /// FIXME: GUII
virtual void redraw() const = 0; virtual void redraw() const = 0;
@ -67,8 +65,8 @@ public:
/// fill the clipboard /// fill the clipboard
virtual void putClipboard(string const &) const = 0; virtual void putClipboard(string const &) const = 0;
/// FIXME: GUII /// work area dimensions have changed
boost::signal0<void> workAreaExpose; boost::signal0<void> workAreaResize;
/// the scrollbar has changed /// the scrollbar has changed
boost::signal1<void, int> scrollDocView; boost::signal1<void, int> scrollDocView;
/// a key combination has been pressed /// a key combination has been pressed

View File

@ -1,3 +1,7 @@
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* QWorkArea.h: remove unused resize(...)
2002-06-20 John Levon <moz@compsoc.man.ac.uk> 2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* QWorkArea.h: remove unused stuff * QWorkArea.h: remove unused stuff

View File

@ -48,8 +48,6 @@ public:
virtual int workWidth() const { return content_->width(); } virtual int workWidth() const { return content_->width(); }
/// return the height of the content pane /// return the height of the content pane
virtual int workHeight() const { return content_->height(); } virtual int workHeight() const { return content_->height(); }
/// resize this widget
virtual void resize(int xpos, int ypos, int width, int height);
/// FIXME: makes no sense ? /// FIXME: makes no sense ?
virtual void redraw() const { } virtual void redraw() const { }
/// ///

View File

@ -1,3 +1,8 @@
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* XWorkArea.h:
* XWorkArea.C: remove unused code, name change
2002-06-20 John Levon <moz@compsoc.man.ac.uk> 2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* XLyXKeySym.h: * XLyXKeySym.h:

View File

@ -256,33 +256,6 @@ XWorkArea::~XWorkArea()
} }
void XWorkArea::resize(int xpos, int ypos, int width, int height)
{
fl_freeze_all_forms();
int const bw = int(abs(fl_get_border_width()));
// a box
fl_set_object_geometry(backgroundbox, xpos, ypos, width - 15, height);
//
// THE SCROLLBAR
//
fl_set_object_geometry(scrollbar, xpos + width - 15,
ypos, 17, height);
// Create the workarea pixmap
createPixmap(width - 15 - 2 * bw, height - 2 * bw);
// the free object
fl_set_object_geometry(work_area, xpos + bw, ypos + bw,
width - 15 - 2 * bw,
height - 2 * bw);
fl_unfreeze_all_forms();
}
namespace { namespace {
void destroy_object(FL_OBJECT * obj) void destroy_object(FL_OBJECT * obj)
{ {
@ -407,7 +380,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
return 1; return 1;
lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl; lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
area->createPixmap(area->workWidth(), area->workHeight()); area->createPixmap(area->workWidth(), area->workHeight());
area->workAreaExpose(); area->workAreaResize();
break; break;
case FL_PUSH: case FL_PUSH:
if (!ev || ev->xbutton.button == 0) break; if (!ev || ev->xbutton.button == 0) break;

View File

@ -34,8 +34,6 @@ public:
/// ///
virtual int workHeight() const { return work_area->h; } virtual int workHeight() const { return work_area->h; }
/// ///
virtual void resize(int xpos, int ypos, int width, int height);
///
virtual void redraw() const { virtual void redraw() const {
fl_redraw_object(work_area); fl_redraw_object(work_area);
fl_redraw_object(scrollbar); fl_redraw_object(scrollbar);