- // ok ok, this is a hack.
- if (button == 4 || button == 5) {
- switch (button) {
- case 4:
- scrollUp(100); // This number is only temporary
- break;
- case 5:
- scrollDown(100);
- break;
- }
- }
-
- if (the_locking_inset) {
- // We are in inset locking mode
-
- /* Check whether the inset was hit. If not reset mode,
- otherwise give the event to the inset */
- if (inset_hit) {
- the_locking_inset->
- InsetButtonPress(this,
- xpos, ypos,
- button);
- return;
- } else {
- unlockInset(the_locking_inset);
- }
- }
-
- selection_possible = true;
- screen->HideCursor();
-
- // Right button mouse click on a table
- if (button == 3 &&
- (text->cursor.par->table ||
- text->MouseHitInTable(xpos, ypos + screen->first))) {
- // Set the cursor to the press-position
- text->SetCursorFromCoordinates(xpos, ypos + screen->first);
- bool doit = true;
-
- // Only show the table popup if the hit is in
- // the table, too
- if (!text->HitInTable(text->cursor.row, xpos))
- doit = false;
-
- // Hit above or below the table?
- if (doit) {
- if (!text->selection) {
- screen->ToggleSelection();
- text->ClearSelection();
- text->FullRebreak();
- screen->Update();
- 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;
- }
- }
-
- int screen_first = screen->first;
-
- // Middle button press pastes if we have a selection
- bool paste_internally = false;
- if (button == 2
- && text->selection) {
- owner_->getLyXFunc()->Dispatch(LFUN_COPY);
- paste_internally = true;
- }
-
- // Clear the selection
- screen->ToggleSelection();
- text->ClearSelection();
- text->FullRebreak();
- screen->Update();
- updateScrollbar();
-
- // Single left click in math inset?
- if (inset_hit != 0 && inset_hit->Editable()==Inset::HIGHLY_EDITABLE) {
- // Highly editable inset, like math
- selection_possible = false;
- owner_->updateLayoutChoice();
- owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
- inset_hit->Edit(this, xpos, ypos, button);
- return;
- }
-
- // Right click on a footnote flag opens float menu
- if (button == 3) {
- selection_possible = false;
- return;
- }
-
- text->SetCursorFromCoordinates(xpos, ypos + screen_first);
- text->FinishUndo();
- text->sel_cursor = text->cursor;
- text->cursor.x_fix = text->cursor.x;
-
- owner_->updateLayoutChoice();
- if (screen->FitCursor()){
- updateScrollbar();
- selection_possible = false;
- }
-
- // Insert primary selection with middle mouse
- // if there is a local selection in the current buffer,
- // insert this
- if (button == 2) {
- if (paste_internally)
- owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
- else
- owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
- "paragraph");
- selection_possible = false;
- return;
- }