Hello,
With this patch I am satisfying Lars desiderata. The only remaining
issue is the naming of the TheGui class. Lars, could you please make up
your mind about that: MainGui, QtGui, GuiInstance ?
Abdel.
Log:
* Use work_area_ member instead of workarea() access method.
* Correct some spacing issues.
Index: BufferView_pimpl.C
===================================================================
--- BufferView_pimpl.C (revision 14145)
+++ BufferView_pimpl.C (working copy)
@@ -62,10 +62,10 @@
#include "frontends/Dialogs.h"
#include "frontends/FileDialog.h"
#include "frontends/font_metrics.h"
+#include "frontends/Gui.h"
#include "frontends/LyXView.h"
-#include "frontends/Gui.h"
+#include "frontends/Painter.h"
#include "frontends/WorkArea.h"
-#include "frontends/Painter.h"
#include "graphics/Previews.h"
@@ -337,7 +337,7 @@
lyx::frontend::Painter & BufferView::Pimpl::painter() const
{
- return workarea().getPainter();
+ return work_area_->getPainter();
}
@@ -460,7 +460,7 @@
if (!bv_->text()) {
lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION
<< " no text in updateScrollbar" << endl;
- workarea().setScrollbarParams(0, 0, 0);
+ work_area_->setScrollbarParams(0, 0, 0);
return;
}
@@ -482,7 +482,7 @@
// estimated average paragraph height:
if (wh_ == 0)
- wh_ = workarea().height() / 4;
+ wh_ = work_area_->height() / 4;
int h = t.getPar(anchor_ref_).height();
// Normalize anchor/offset (MV):
@@ -495,7 +495,7 @@
int sumh = 0;
int nh = 0;
for (lyx::pit_type pit = anchor_ref_; pit <= parsize; ++pit) {
- if (sumh > workarea().height())
+ if (sumh > work_area_->height())
break;
int const h2 = t.getPar(pit).height();
sumh += h2;
@@ -506,7 +506,7 @@
if (hav > wh_)
wh_ = hav;
- workarea().setScrollbarParams((parsize + 1) * wh_,
+ work_area_->setScrollbarParams((parsize + 1) * wh_,
anchor_ref_ * wh_ + int(offset_ref_ * wh_ / float(h)),
int(wh_ * defaultRowHeight() / float(h)));
}
@@ -539,7 +539,7 @@
int const height = 2 * defaultRowHeight();
int const first = height;
- int const last = workarea().height() - height;
+ int const last = work_area_->height() - height;
LCursor & cur = cursor_;
bv_funcs::CurStatus st = bv_funcs::status(bv_, cur);
@@ -583,7 +583,7 @@
// scrollDocView(new_top_y);
//
// // Update the scrollbar.
-// workarea().setScrollbarParams(t->height(), top_y(), defaultRowHeight());
+// work_area_->.setScrollbarParams(t->height(), top_y(),
defaultRowHeight());
}
@@ -647,12 +647,12 @@
static int work_area_width;
static int work_area_height;
- bool const widthChange = workarea().width() != work_area_width;
- bool const heightChange = workarea().height() != work_area_height;
+ bool const widthChange = work_area_->width() != work_area_width;
+ bool const heightChange = work_area_->height() != work_area_height;
// Update from work area
- work_area_width = workarea().width();
- work_area_height = workarea().height();
+ work_area_width = work_area_->width();
+ work_area_height = work_area_->height();
if (buffer_ && widthChange) {
// The visible LyXView need a resize
@@ -675,7 +675,7 @@
int const asc = font_metrics::maxAscent(font);
int const des = font_metrics::maxDescent(font);
Point const p = bv_funcs::getPos(cursor_, cursor_.boundary());
- if (p.y_ - asc >= 0 && p.y_ + des < workarea().height())
+ if (p.y_ - asc >= 0 && p.y_ + des < work_area_->height())
return false;
}
center();
@@ -730,14 +730,14 @@
}
if (forceupdate) {
// Second drawing step
- workarea().redraw(*bv_, vi);
+ work_area_->redraw(*bv_, vi);
} else {
// Abort updating of the coord
// cache - just restore the old one
std::swap(theCoords, backup);
}
} else
- workarea().greyOut();
+ work_area_->greyOut();
// And the scrollbar
updateScrollbar();
@@ -876,7 +876,7 @@
Paragraph const & par = bot.text()->paragraphs()[pit];
anchor_ref_ = pit;
offset_ref_ = bv_funcs::coordOffset(cursor_, cursor_.boundary()).y_
- + par.ascent() - workarea().height() / 2;
+ + par.ascent() - work_area_->height() / 2;
}
@@ -1013,7 +1013,7 @@
// surrounding LyXText will handle this event.
// Build temporary cursor.
- cmd.y = min(max(cmd.y,-1), workarea().height());
+ cmd.y = min(max(cmd.y, -1), work_area_->height());
InsetBase * inset = bv_->text()->editXY(cur, cmd.x, cmd.y);
//lyxerr << BOOST_CURRENT_FUNCTION
// << " * hit inset at tip: " << inset << endl;
Index: BufferView_pimpl.h
===================================================================
--- BufferView_pimpl.h (revision 14145)
+++ BufferView_pimpl.h (working copy)
@@ -34,8 +34,6 @@
#include <boost/shared_ptr.hpp>
#include <boost/signals/trackable.hpp>
-
-
class Change;
class LyXKeySym;
class LyXView;