From 7cb3b054916d146ccf5b57d15351b448775af26a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 4 Jul 2001 07:19:09 +0000 Subject: [PATCH] change LyXScreen names to begin with lower case git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2179 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 6 ++--- src/BufferView_pimpl.C | 58 ++++++++++++++++++++-------------------- src/ChangeLog | 2 ++ src/insets/insettext.C | 12 ++++----- src/lyxscreen.h | 28 ++++++++++---------- src/screen.C | 60 +++++++++++++++++++++--------------------- 6 files changed, 84 insertions(+), 82 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index 3db22eb0f5..4c08feb2de 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -440,7 +440,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc) ? LyXScreen::REVERSED_L_SHAPE : LyXScreen::L_SHAPE; y += cursor.y() + theLockingInset()->insetInInsetY(); - pimpl_->screen_->ShowManualCursor(text, x, y, asc, desc, + pimpl_->screen_->showManualCursor(text, x, y, asc, desc, shape); } } @@ -449,7 +449,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc) void BufferView::hideLockedInsetCursor() { if (theLockingInset() && available()) { - pimpl_->screen_->HideCursor(); + pimpl_->screen_->hideCursor(); } } @@ -458,7 +458,7 @@ void BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc) { if (theLockingInset() && available()) { y += text->cursor.y() + theLockingInset()->insetInInsetY(); - if (pimpl_->screen_->FitManualCursor(text, this, x, y, asc, desc)) + if (pimpl_->screen_->fitManualCursor(text, this, x, y, asc, desc)) updateScrollbar(); } } diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 542abbcd69..877e0cd4d8 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -198,7 +198,7 @@ void BufferView::Pimpl::buffer(Buffer * b) updateScreen(); updateScrollbar(); } - bv_->text->first = screen_->TopCursorVisible(bv_->text); + bv_->text->first = screen_->topCursorVisible(bv_->text); owner_->updateMenubar(); owner_->updateToolbar(); // Similarly, buffer-dependent dialogs should be updated or @@ -257,7 +257,7 @@ bool BufferView::Pimpl::fitCursor(LyXText * text) bv_->owner()->getDialogs()->updateParagraph(); - bool const ret = screen_->FitCursor(text, bv_); + bool const ret = screen_->fitCursor(text, bv_); if (ret) updateScrollbar(); return ret; @@ -343,7 +343,7 @@ int BufferView::Pimpl::resizeCurrentBuffer() // remake the inset locking bv_->theLockingInset(the_locking_inset); } - bv_->text->first = screen_->TopCursorVisible(bv_->text); + bv_->text->first = screen_->topCursorVisible(bv_->text); buffer_->resizeInsets(bv_); // this will scroll the screen such that the cursor becomes visible updateScrollbar(); @@ -380,7 +380,7 @@ void BufferView::Pimpl::updateScrollbar() return; } - unsigned long const text_height = bv_->text->height; + long const text_height = bv_->text->height; double const lineh = bv_->text->defaultHeight(); double const slider_size = 1.0 / double(text_height); @@ -418,7 +418,7 @@ void BufferView::Pimpl::scrollCB(double value) if (!screen_.get()) return; - screen_->Draw(bv_->text, bv_, current_scrollbar_value); + screen_->draw(bv_->text, bv_, current_scrollbar_value); if (!lyxrc.cursor_follows_scrollbar) { waitForX(); @@ -535,7 +535,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state) if (!selection_possible) return; - screen_->HideCursor(); + screen_->hideCursor(); bv_->text->setCursorFromCoordinates(bv_, x, y + bv_->text->first); @@ -543,9 +543,9 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state) update(bv_->text, BufferView::UPDATE); // Maybe an empty line was deleted bv_->text->setSelection(bv_); - screen_->ToggleToggle(bv_->text, bv_); + screen_->toggleToggle(bv_->text, bv_); fitCursor(bv_->text); - screen_->ShowCursor(bv_->text, bv_); + screen_->showCursor(bv_->text, bv_); } @@ -587,7 +587,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, if (!inset_hit) selection_possible = true; - screen_->HideCursor(); + screen_->hideCursor(); int const screen_first = bv_->text->first; @@ -600,10 +600,10 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, } // Clear the selection - screen_->ToggleSelection(bv_->text, bv_); + screen_->toggleSelection(bv_->text, bv_); bv_->text->clearSelection(bv_); bv_->text->fullRebreak(bv_); - screen_->Update(bv_->text, bv_); + screen_->update(bv_->text, bv_); updateScrollbar(); // Single left click in math inset? @@ -664,10 +664,10 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button) if (screen_.get() && button == 1) { if (text->bv_owner) { - screen_->HideCursor(); - screen_->ToggleSelection(text, bv_); + screen_->hideCursor(); + screen_->toggleSelection(text, bv_); text->selectWord(bv_); - screen_->ToggleSelection(text, bv_, false); + screen_->toggleSelection(text, bv_, false); } else { text->selectWord(bv_); } @@ -690,13 +690,13 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button) return; if (screen_.get() && (button == 1)) { - screen_->HideCursor(); - screen_->ToggleSelection(text, bv_); + screen_->hideCursor(); + screen_->toggleSelection(text, bv_); text->cursorHome(bv_); text->selection.cursor = text->cursor; text->cursorEnd(bv_); text->setSelection(bv_); - screen_->ToggleSelection(text, bv_, false); + screen_->toggleSelection(text, bv_, false); /* This will fit the cursor on the screen * if necessary */ update(text, BufferView::SELECT|BufferView::FITCUR); @@ -930,7 +930,7 @@ void BufferView::Pimpl::workAreaExpose() // The main window size has changed, repaint most stuff redraw(); } else if (screen_.get()) - screen_->Redraw(bv_->text, bv_); + screen_->redraw(bv_->text, bv_); } else { // Grey box when we don't have a buffer workarea_.greyOut(); @@ -948,7 +948,7 @@ void BufferView::Pimpl::update() if (screen_.get() && (!bv_->theLockingInset() || !bv_->theLockingInset()->nodraw())) { - screen_->Update(bv_->text, bv_); + screen_->update(bv_->text, bv_); } } @@ -1041,7 +1041,7 @@ void BufferView::Pimpl::cursorToggle() } if (!bv_->theLockingInset()) { - screen_->CursorToggle(bv_->text, bv_); + screen_->cursorToggle(bv_->text, bv_); } else { bv_->theLockingInset()->toggleInsetCursor(bv_); } @@ -1067,7 +1067,7 @@ void BufferView::Pimpl::cursorPrevious(LyXText * text) if (text->inset_owner || text->cursor.row()->height() < workarea_.height()) - screen_->Draw(bv_->text, bv_, + screen_->draw(bv_->text, bv_, text->cursor.y() - text->cursor.row()->baseline() + text->cursor.row()->height() @@ -1095,7 +1095,7 @@ void BufferView::Pimpl::cursorNext(LyXText * text) if (text->inset_owner || text->cursor.row()->height() < workarea_.height()) - screen_->Draw(bv_->text, bv_, text->cursor.y() - + screen_->draw(bv_->text, bv_, text->cursor.y() - text->cursor.row()->baseline()); updateScrollbar(); } @@ -1250,28 +1250,28 @@ bool BufferView::Pimpl::belowMouse() const void BufferView::Pimpl::showCursor() { if (screen_.get()) - screen_->ShowCursor(bv_->text, bv_); + screen_->showCursor(bv_->text, bv_); } void BufferView::Pimpl::hideCursor() { if (screen_.get()) - screen_->HideCursor(); + screen_->hideCursor(); } void BufferView::Pimpl::toggleSelection(bool b) { if (screen_.get()) - screen_->ToggleSelection(bv_->text, bv_, b); + screen_->toggleSelection(bv_->text, bv_, b); } void BufferView::Pimpl::toggleToggle() { if (screen_.get()) - screen_->ToggleToggle(bv_->text, bv_); + screen_->toggleToggle(bv_->text, bv_); } @@ -1279,9 +1279,9 @@ void BufferView::Pimpl::center() { beforeChange(bv_->text); if (bv_->text->cursor.y() > static_cast((workarea_.height() / 2))) { - screen_->Draw(bv_->text, bv_, bv_->text->cursor.y() - workarea_.height() / 2); + screen_->draw(bv_->text, bv_, bv_->text->cursor.y() - workarea_.height() / 2); } else { - screen_->Draw(bv_->text, bv_, 0); + screen_->draw(bv_->text, bv_, 0); } update(bv_->text, BufferView::SELECT|BufferView::FITCUR); redraw(); @@ -1292,7 +1292,7 @@ void BufferView::Pimpl::pasteClipboard(bool asPara) { if (!buffer_) return; - screen_->HideCursor(); + screen_->hideCursor(); beforeChange(bv_->text); string const clip(workarea_.getClipboard()); diff --git a/src/ChangeLog b/src/ChangeLog index 5d4c1f3f39..06d9e54784 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2001-07-04 Lars Gullik Bjønnes + * screen.[Ch]: change method names to begin with lowercase + * BufferView_pimpl.C (updateScrollbar): simplify further and hopefully make it a bit faster. diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 23913b27a4..d7ac5096bf 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -364,21 +364,21 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, } } else if (!locked) { if (need_update & CURSOR) { - bv->screen()->ToggleSelection(getLyXText(bv), bv, true, y_offset,int(x)); + bv->screen()->toggleSelection(getLyXText(bv), bv, true, y_offset,int(x)); getLyXText(bv)->clearSelection(bv); getLyXText(bv)->selection.cursor = getLyXText(bv)->cursor; } - bv->screen()->Update(getLyXText(bv), bv, y_offset, int(x)); + bv->screen()->update(getLyXText(bv), bv, y_offset, int(x)); } else { locked = false; if (need_update & SELECTION) - bv->screen()->ToggleToggle(getLyXText(bv), bv, y_offset, int(x)); + bv->screen()->toggleToggle(getLyXText(bv), bv, y_offset, int(x)); else if (need_update & CURSOR) { - bv->screen()->ToggleSelection(getLyXText(bv), bv, true, y_offset,int(x)); + bv->screen()->toggleSelection(getLyXText(bv), bv, true, y_offset,int(x)); getLyXText(bv)->clearSelection(bv); getLyXText(bv)->selection.cursor = getLyXText(bv)->cursor; } - bv->screen()->Update(getLyXText(bv), bv, y_offset, int(x)); + bv->screen()->update(getLyXText(bv), bv, y_offset, int(x)); locked = true; } @@ -1740,7 +1740,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const } if (bv->screen()) { LyXText * t = getLyXText(bv); - t->first = bv->screen()->TopCursorVisible(t); + t->first = bv->screen()->topCursorVisible(t); } // this will scroll the screen such that the cursor becomes visible diff --git a/src/lyxscreen.h b/src/lyxscreen.h index ee247130c9..7501f67e3b 100644 --- a/src/lyxscreen.h +++ b/src/lyxscreen.h @@ -57,32 +57,32 @@ public: /** Draws the screen form textposition y. Uses as much of the already printed pixmap as possible */ - void Draw(LyXText *, BufferView *, unsigned int y); + void draw(LyXText *, BufferView *, unsigned int y); /// Redraws the screen, without using existing pixmap - void Redraw(LyXText *, BufferView *); + void redraw(LyXText *, BufferView *); /// Returns a new top so that the cursor is visible - unsigned int TopCursorVisible(LyXText const *); + unsigned int topCursorVisible(LyXText const *); /// Redraws the screen such that the cursor is visible - bool FitCursor(LyXText *, BufferView *); + bool fitCursor(LyXText *, BufferView *); /// - void ShowCursor(LyXText const *, BufferView const *); + void showCursor(LyXText const *, BufferView const *); /// - void HideCursor(); + void hideCursor(); /// - void CursorToggle(LyXText const *, BufferView const *); + void cursorToggle(LyXText const *, BufferView const *); /// - void ShowManualCursor(LyXText const *, int x, int y, + void showManualCursor(LyXText const *, int x, int y, int asc, int desc, Cursor_Shape shape); /// returns 1 if first has changed, otherwise 0 - bool FitManualCursor(LyXText *, BufferView *, int, int, int, int); + bool fitManualCursor(LyXText *, BufferView *, int, int, int, int); /// - void ToggleSelection(LyXText *, BufferView *, bool = true, + void toggleSelection(LyXText *, BufferView *, bool = true, int y_offset = 0, int x_offset = 0); /// - void ToggleToggle(LyXText *, BufferView *, + void toggleToggle(LyXText *, BufferView *, int y_offset = 0, int x_offset = 0); /** Updates part of the screen. If text->status is @@ -90,7 +90,7 @@ public: point of change and to the end of the screen. If text->status is LyXText::NEED_VERY_LITTLE_REFRESH, we only update the current row. */ - void Update(LyXText *, BufferView *, int y_offset=0, int x_offset=0); + void update(LyXText *, BufferView *, int y_offset=0, int x_offset=0); /// bool forceClear() const { return force_clear; } @@ -101,11 +101,11 @@ private: void expose(int x, int y, int exp_width, int exp_height); /// y1 and y2 are coordinates of the screen - void DrawFromTo(LyXText *, BufferView *, int y1, int y2, + void drawFromTo(LyXText *, BufferView *, int y1, int y2, int y_offset = 0, int x_offset = 0); /// y is a coordinate of the text - void DrawOneRow(LyXText *, BufferView *, Row * row, + void drawOneRow(LyXText *, BufferView *, Row * row, int y_text, int y_offset = 0, int x_offset = 0); /// diff --git a/src/screen.C b/src/screen.C index 2b17cb9ac9..bd802911a8 100644 --- a/src/screen.C +++ b/src/screen.C @@ -87,13 +87,13 @@ void LyXScreen::setCursorColor() } -void LyXScreen::Redraw(LyXText * text, BufferView * bv) +void LyXScreen::redraw(LyXText * text, BufferView * bv) { - DrawFromTo(text, bv, 0, owner.height()); + drawFromTo(text, bv, 0, owner.height()); expose(0, 0, owner.workWidth(), owner.height()); if (cursor_visible) { cursor_visible = false; - ShowCursor(text, bv); + showCursor(text, bv); } } @@ -111,7 +111,7 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height) } -void LyXScreen::DrawFromTo(LyXText * text, BufferView * bv, +void LyXScreen::drawFromTo(LyXText * text, BufferView * bv, int y1, int y2, int y_offset, int x_offset) { int y_text = text->first + y1; @@ -146,7 +146,7 @@ void LyXScreen::DrawFromTo(LyXText * text, BufferView * bv, } -void LyXScreen::DrawOneRow(LyXText * text, BufferView * bv, Row * row, +void LyXScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row, int y_text, int y_offset, int x_offset) { int const y = y_text - text->first + y_offset; @@ -168,9 +168,9 @@ void LyXScreen::DrawOneRow(LyXText * text, BufferView * bv, Row * row, /* draws the screen, starting with textposition y. uses as much already * printed pixels as possible */ -void LyXScreen::Draw(LyXText * text, BufferView * bv, unsigned int y) +void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y) { - if (cursor_visible) HideCursor(); + if (cursor_visible) hideCursor(); int const old_first = text->first; text->first = y; @@ -179,7 +179,7 @@ void LyXScreen::Draw(LyXText * text, BufferView * bv, unsigned int y) if ((y - old_first) < owner.height() && (old_first - y) < owner.height()) { if (text->first < old_first) { - DrawFromTo(text, bv, 0, old_first - text->first); + drawFromTo(text, bv, 0, old_first - text->first); XCopyArea (fl_get_display(), owner.getWin(), owner.getWin(), @@ -196,7 +196,7 @@ void LyXScreen::Draw(LyXText * text, BufferView * bv, unsigned int y) owner.workWidth(), old_first - text->first); } else { - DrawFromTo(text, bv, + drawFromTo(text, bv, owner.height() + old_first - text->first, owner.height()); XCopyArea (fl_get_display(), @@ -215,13 +215,13 @@ void LyXScreen::Draw(LyXText * text, BufferView * bv, unsigned int y) } } else { // make a dumb new-draw - DrawFromTo(text, bv, 0, owner.height()); + drawFromTo(text, bv, 0, owner.height()); expose(0, 0, owner.workWidth(), owner.height()); } } -void LyXScreen::ShowCursor(LyXText const * text, BufferView const * bv) +void LyXScreen::showCursor(LyXText const * text, BufferView const * bv) { if (!cursor_visible) { Cursor_Shape shape = BAR_SHAPE; @@ -231,7 +231,7 @@ void LyXScreen::ShowCursor(LyXText const * text, BufferView const * bv) != bv->buffer()->params.language->RightToLeft()) shape = (text->real_current_font.isVisibleRightToLeft()) ? REVERSED_L_SHAPE : L_SHAPE; - ShowManualCursor(text, text->cursor.x(), text->cursor.y(), + showManualCursor(text, text->cursor.x(), text->cursor.y(), lyxfont::maxAscent(text->real_current_font), lyxfont::maxDescent(text->real_current_font), shape); @@ -240,7 +240,7 @@ void LyXScreen::ShowCursor(LyXText const * text, BufferView const * bv) /* returns true if first has changed, otherwise false */ -bool LyXScreen::FitManualCursor(LyXText * text, BufferView * bv, +bool LyXScreen::fitManualCursor(LyXText * text, BufferView * bv, int /*x*/, int y, int asc, int desc) { int newtop = text->first; @@ -255,7 +255,7 @@ bool LyXScreen::FitManualCursor(LyXText * text, BufferView * bv, newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb) if (newtop != static_cast(text->first)) { - Draw(text, bv, newtop); + draw(text, bv, newtop); text->first = newtop; return true; } @@ -263,7 +263,7 @@ bool LyXScreen::FitManualCursor(LyXText * text, BufferView * bv, } -void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y, +void LyXScreen::showManualCursor(LyXText const * text, int x, int y, int asc, int desc, Cursor_Shape shape) { // Update the cursor color. @@ -342,7 +342,7 @@ void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y, } -void LyXScreen::HideCursor() +void LyXScreen::hideCursor() { if (!cursor_visible) return; @@ -360,17 +360,17 @@ void LyXScreen::HideCursor() } -void LyXScreen::CursorToggle(LyXText const * text, BufferView const * bv) +void LyXScreen::cursorToggle(LyXText const * text, BufferView const * bv) { if (cursor_visible) - HideCursor(); + hideCursor(); else - ShowCursor(text, bv); + showCursor(text, bv); } /* returns a new top so that the cursor is visible */ -unsigned int LyXScreen::TopCursorVisible(LyXText const * text) +unsigned int LyXScreen::topCursorVisible(LyXText const * text) { int newtop = text->first; @@ -406,25 +406,25 @@ unsigned int LyXScreen::TopCursorVisible(LyXText const * text) /* scrolls the screen so that the cursor is visible, if necessary. * returns true if a change was made, otherwise false */ -bool LyXScreen::FitCursor(LyXText * text, BufferView * bv) +bool LyXScreen::fitCursor(LyXText * text, BufferView * bv) { // Is a change necessary? - int const newtop = TopCursorVisible(text); + int const newtop = topCursorVisible(text); bool const result = (newtop != text->first); if (result) - Draw(text, bv, newtop); + draw(text, bv, newtop); return result; } -void LyXScreen::Update(LyXText * text, BufferView * bv, +void LyXScreen::update(LyXText * text, BufferView * bv, int y_offset, int x_offset) { switch (text->status) { case LyXText::NEED_MORE_REFRESH: { int const y = max(int(text->refresh_y - text->first), 0); - DrawFromTo(text, bv, y, owner.height(), y_offset, x_offset); + drawFromTo(text, bv, y, owner.height(), y_offset, x_offset); text->refresh_y = 0; text->status = LyXText::UNCHANGED; expose(0, y, owner.workWidth(), owner.height() - y); @@ -433,7 +433,7 @@ void LyXScreen::Update(LyXText * text, BufferView * bv, case LyXText::NEED_VERY_LITTLE_REFRESH: { // ok I will update the current cursor row - DrawOneRow(text, bv, text->refresh_row, text->refresh_y, + drawOneRow(text, bv, text->refresh_row, text->refresh_y, y_offset, x_offset); text->status = LyXText::UNCHANGED; expose(0, text->refresh_y - text->first + y_offset, @@ -448,7 +448,7 @@ void LyXScreen::Update(LyXText * text, BufferView * bv, } -void LyXScreen::ToggleSelection(LyXText * text, BufferView * bv, +void LyXScreen::toggleSelection(LyXText * text, BufferView * bv, bool kill_selection, int y_offset, int x_offset) { @@ -469,7 +469,7 @@ void LyXScreen::ToggleSelection(LyXText * text, BufferView * bv, if (kill_selection) text->selection.set(false); - DrawFromTo(text, bv, top - text->first, bottom - text->first, + drawFromTo(text, bv, top - text->first, bottom - text->first, y_offset, x_offset); expose(0, top - text->first, owner.workWidth(), @@ -477,7 +477,7 @@ void LyXScreen::ToggleSelection(LyXText * text, BufferView * bv, } -void LyXScreen::ToggleToggle(LyXText * text, BufferView * bv, +void LyXScreen::toggleToggle(LyXText * text, BufferView * bv, int y_offset, int x_offset) { if (text->toggle_cursor.par() == text->toggle_end_cursor.par() @@ -495,7 +495,7 @@ void LyXScreen::ToggleToggle(LyXText * text, BufferView * bv, int const top = min(max(top_tmp, text->first), static_cast(text->first + owner.height())); - DrawFromTo(text, bv, top - text->first, bottom - text->first, y_offset, + drawFromTo(text, bv, top - text->first, bottom - text->first, y_offset, x_offset); expose(0, top - text->first, owner.workWidth(), bottom - text->first - (top - text->first)); -- 2.39.2