#include "intl.h"
#include "support/LAssert.h"
#include "frontends/Dialogs.h"
-#ifndef NEW_MENUBAR
-# include "menus.h"
-#endif
#ifdef SIGC_CXX_NAMESPACES
using SigC::slot;
{
buffer_ = 0;
workarea_ = new WorkArea(bv_, xpos, ypos, width, height);
+ // Setup the signals
+ workarea_->workAreaExpose
+ .connect(slot(this, &BufferView::Pimpl::workAreaExpose));
+ workarea_->workAreaEnter
+ .connect(slot(this, &BufferView::Pimpl::enterView));
+ workarea_->workAreaLeave
+ .connect(slot(this, &BufferView::Pimpl::leaveView));
+ workarea_->workAreaButtonPress
+ .connect(slot(this, &BufferView::Pimpl::workAreaButtonPress));
+ workarea_->workAreaButtonRelease
+ .connect(slot(this,
+ &BufferView::Pimpl::workAreaButtonRelease));
+ workarea_->workAreaMotionNotify
+ .connect(slot(this, &BufferView::Pimpl::workAreaMotionNotify));
+ workarea_->workAreaDoubleClick
+ .connect(slot(this, &BufferView::Pimpl::doubleClick));
+ workarea_->workAreaTripleClick
+ .connect(slot(this, &BufferView::Pimpl::tripleClick));
+ workarea_->workAreaKeyPress
+ .connect(slot(this, &BufferView::Pimpl::workAreaKeyPress));
+
screen_ = 0;
cursor_timeout.timeout.connect(slot(this,
updateScrollbar();
}
bv_->text->first = screen_->TopCursorVisible(bv_->text);
-#ifdef NEW_MENUBAR
owner_->updateMenubar();
-#else
- owner_->getMenus()->showMenus();
-#endif
owner_->updateToolbar();
redraw();
owner_->getDialogs()->updateBufferDependent();
bv_->insetWakeup();
} else {
lyxerr[Debug::INFO] << " No Buffer!" << endl;
-#ifdef NEW_MENUBAR
owner_->updateMenubar();
-#else
- owner_->getMenus()->hideMenus();
-#endif
owner_->updateToolbar();
updateScrollbar();
workarea_->redraw();
}
-bool BufferView::Pimpl::fitCursor()
+bool BufferView::Pimpl::fitCursor(LyXText * text)
{
Assert(screen_); // it is a programming error to call fitCursor
// without a valid screen.
- bool ret = screen_->FitCursor(bv_->text);
- if (ret) updateScrollbar();
+ bool ret = screen_->FitCursor(text);
+ if (ret)
+ updateScrollbar();
return ret;
}
}
+void BufferView::Pimpl::workAreaKeyPress(KeySym keysym, unsigned int state)
+{
+ bv_->owner()->getLyXFunc()->processKeySym(keysym, state);
+}
+
+
void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
{
// Only use motion with button 1
bv_->text->SetSelection();
screen_->ToggleToggle(bv_->text);
- fitCursor();
+ fitCursor(bv_->text);
screen_->ShowCursor(bv_->text);
}
return;
selection_possible = true;
screen_->HideCursor();
-#ifndef NEW_TABULAR
- // Right button mouse click on a table
- if (button == 3 &&
- (bv_->text->cursor.par()->table ||
- bv_->text->MouseHitInTable(bv_, xpos, ypos + bv_->text->first))) {
- // Set the cursor to the press-position
- bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + bv_->text->first);
- bool doit = true;
-
- // Only show the table popup if the hit is in
- // the table, too
- if (!bv_->text->HitInTable(bv_,
- bv_->text->cursor.row(), xpos))
- doit = false;
-
- // Hit above or below the table?
- if (doit) {
- if (!bv_->text->selection) {
- screen_->ToggleSelection(bv_->text);
- bv_->text->ClearSelection();
- bv_->text->FullRebreak(bv_);
- screen_->Update(bv_->text);
- updateScrollbar();
- }
- // Popup table popup when on a table.
- // This is obviously temporary, since we
- // should be able to popup various
- // context-sensitive-menus with the
- // the right mouse. So this should be done more
- // general in the future. Matthias.
- selection_possible = false;
- owner_->getLyXFunc()
- ->Dispatch(LFUN_LAYOUT_TABLE,
- "true");
- return;
- }
- }
-#endif
-
- int screen_first = bv_->text->first;
+ int const screen_first = bv_->text->first;
// Middle button press pastes if we have a selection
bool paste_internally = false;
bv_->text->cursor.x_fix(bv_->text->cursor.x());
owner_->updateLayoutChoice();
- if (fitCursor()) {
+ if (fitCursor(bv_->text)) {
selection_possible = false;
}
* if necessary */
update(BufferView::SELECT|BufferView::FITCUR);
}
- }
+ }
}
void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
{
// select a line
- if (buffer_ && screen_ && button == 1) {
+ if (buffer_ && screen_ && !bv_->the_locking_inset && (button == 1)) {
screen_->HideCursor();
screen_->ToggleSelection(bv_->text);
bv_->text->CursorHome(bv_);
}
selection_possible = false;
-#ifndef NEW_TABULAR
- if (bv_->text->cursor.par()->table) {
- int cell = bv_->text->
- NumberOfCell(bv_->text->cursor.par(),
- bv_->text->cursor.pos());
- if (bv_->text->cursor.par()->table->IsContRow(cell) &&
- bv_->text->cursor.par()->table->
- CellHasContRow(bv_->text->cursor.par()->table->
- GetCellAbove(cell))<0) {
- bv_->text->CursorUp(bv_);
- }
- }
-#endif
if (button >= 2) return;
// fitCursor() ensures we don't jump back
// to the start of the document on vertical
// resize
- fitCursor();
+ fitCursor(bv_->text);
// The main window size has changed, repaint most stuff
redraw();
update();
if ((f & FITCUR)) {
- fitCursor();
+ fitCursor(bv_->text);
}
if ((f & CHANGE)) {
{
if (!bv_->text->cursor.row()->previous()) return;
- long y = bv_->text->first;
+ int y = bv_->text->first;
Row * cursorrow = bv_->text->cursor.row();
bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
bv_->text->FinishUndo();
{
if (!bv_->text->cursor.row()->next()) return;
- long y = bv_->text->first;
+ int y = bv_->text->first;
bv_->text->GetRowNearY(y);
Row * cursorrow = bv_->text->cursor.row();
bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y