-#ifdef NEW_WA
-void BufferView::WorkAreaButtonRelease(int x, int y, unsigned int button)
-{
- if (buffer_ == 0 || screen == 0) return;
-
- // If we hit an inset, we have the inset coordinates in these
- // and inset_hit points to the inset. If we do not hit an
- // inset, inset_hit is 0, and inset_x == x, inset_y == y.
- Inset * inset_hit = checkInsetHit(x, y);
-
- if (the_locking_inset) {
- // We are in inset locking mode.
-
- /* LyX does a kind of work-area grabbing for insets.
- Only a ButtonPress Event outside the inset will
- force a InsetUnlock. */
- the_locking_inset->
- InsetButtonRelease(x, x, button);
- return;
- }
-
- selection_possible = false;
- if (text->cursor.par->table) {
- int cell = text->
- NumberOfCell(text->cursor.par,
- text->cursor.pos);
- if (text->cursor.par->table->IsContRow(cell) &&
- text->cursor.par->table->
- CellHasContRow(text->cursor.par->table->
- GetCellAbove(cell))<0) {
- text->CursorUp();
- }
- }
-
- if (button >= 2) return;
-
- SetState();
- owner_->getMiniBuffer()->Set(CurrentState());
-
- // Did we hit an editable inset?
- if (inset_hit != 0) {
- // Inset like error, notes and figures
- selection_possible = false;
-#ifdef WITH_WARNINGS
-#warning fix this proper in 0.13
-#endif
- // Following a ref shouldn't issue
- // a push on the undo-stack
- // anylonger, now that we have
- // keybindings for following
- // references and returning from
- // references. IMHO though, it
- // should be the inset's own business
- // to push or not push on the undo
- // stack. They don't *have* to
- // alter the document...
- // (Joacim)
- // ...or maybe the SetCursorParUndo()
- // below isn't necessary at all anylonger?
- if (inset_hit->LyxCode() == Inset::REF_CODE) {
- text->SetCursorParUndo();
- }
-
- owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
- inset_hit->Edit(x, y);
- return;
- }
-
- // check whether we want to open a float
- if (text) {
- bool hit = false;
- char c = ' ';
- if (text->cursor.pos <
- text->cursor.par->Last()) {
- c = text->cursor.par->
- GetChar(text->cursor.pos);
- }
- if (c == LyXParagraph::META_FOOTNOTE
- || c == LyXParagraph::META_MARGIN
- || c == LyXParagraph::META_FIG
- || c == LyXParagraph::META_TAB
- || c == LyXParagraph::META_WIDE_FIG
- || c == LyXParagraph::META_WIDE_TAB
- || c == LyXParagraph::META_ALGORITHM){
- hit = true;
- } else if (text->cursor.pos - 1 >= 0) {
- c = text->cursor.par->
- GetChar(text->cursor.pos - 1);
- if (c == LyXParagraph::META_FOOTNOTE
- || c == LyXParagraph::META_MARGIN
- || c == LyXParagraph::META_FIG
- || c == LyXParagraph::META_TAB
- || c == LyXParagraph::META_WIDE_FIG
- || c == LyXParagraph::META_WIDE_TAB
- || c == LyXParagraph::META_ALGORITHM){
- // We are one step too far to the right
- text->CursorLeft();
- hit = true;
- }
- }
- if (hit == true) {
- toggleFloat();
- selection_possible = false;
- return;
- }
- }
-
- // Do we want to close a float? (click on the float-label)
- if (text->cursor.row->par->footnoteflag ==
- LyXParagraph::OPEN_FOOTNOTE
- //&& text->cursor.pos == 0
- && text->cursor.row->previous &&
- text->cursor.row->previous->par->
- footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
- LyXFont font (LyXFont::ALL_SANE);
- font.setSize(LyXFont::SIZE_FOOTNOTE);
-
- int box_x = 20; // LYX_PAPER_MARGIN;
- box_x += font.textWidth(" wide-tab ", 10);
-
- int screen_first = screen->first;
-
- if (x < box_x
- && y + screen_first > text->cursor.y -
- text->cursor.row->baseline
- && y + screen_first < text->cursor.y -
- text->cursor.row->baseline
- + font.maxAscent() * 1.2 + font.maxDescent() * 1.2) {
- toggleFloat();
- selection_possible = false;
- return;
- }
- }
-
- // Maybe we want to edit a bibitem ale970302
-#ifdef USE_PAINTER
- if (text->cursor.par->bibkey && x < 20 +
- bibitemMaxWidth(painter(),
- textclasslist
- .TextClass(buffer_->
- params.textclass).defaultfont())) {
- text->cursor.par->bibkey->Edit(0, 0);
- }
-#else
- if (text->cursor.par->bibkey && x < 20 +
- bibitemMaxWidth(textclasslist
- .TextClass(buffer_->
- params.textclass).defaultfont())) {
- text->cursor.par->bibkey->Edit(0, 0);
- }
-#endif