]> git.lyx.org Git - features.git/blob - src/BufferView_pimpl.C
use more explicit on constructors use the pimpl idom to reduce size with about 500k
[features.git] / src / BufferView_pimpl.C
1 #include <config.h>
2
3 //#include <utility>
4
5 #ifdef __GNUG__
6 #pragma implementation
7 #endif
8
9 #include "BufferView_pimpl.h"
10 #include "WorkArea.h"
11 #include "lyxscreen.h"
12 #include "lyxtext.h"
13 #include "lyxrow.h"
14 #include "LyXView.h"
15 #include "commandtags.h"
16 #include "lyxfunc.h"
17 #include "minibuffer.h"
18 #include "font.h"
19 #include "lyx_cb.h"
20 #include "TextCache.h"
21 #include "bufferlist.h"
22 #include "insets/insetbib.h"
23
24 using std::pair;
25
26 extern BufferList bufferlist;
27 extern bool selection_possible;
28 extern char ascii_type;
29
30 extern int bibitemMaxWidth(Painter &, LyXFont const &);
31
32 extern "C"
33 void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf);
34
35
36 BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
37              int xpos, int ypos, int width, int height)
38         : bv_(b), owner_(o)
39 {
40         buffer_ = 0;
41         workarea = new WorkArea(bv_, xpos, ypos, width, height);
42         screen = 0;
43         timer_cursor = 0;
44         create_view();
45         current_scrollbar_value = 0;
46         fl_set_timer(timer_cursor, 0.4);
47         workarea->setFocus();
48         work_area_focus = true;
49         lyx_focus = false;
50 }
51
52 void BufferView::Pimpl::updateScreen()
53 {
54         // Regenerate the screen.
55         delete screen;
56         screen = new LyXScreen(*workarea, bv_->text);
57 }
58
59
60 void BufferView::Pimpl::create_view()
61 {
62         FL_OBJECT * obj;
63
64         //
65         // TIMERS
66         //
67         
68         // timer_cursor
69         timer_cursor = obj = fl_add_timer(FL_HIDDEN_TIMER,
70                                           0, 0, 0, 0, "Timer");
71         fl_set_object_callback(obj, C_BufferView_CursorToggleCB, 0);
72         obj->u_vdata = bv_;
73 }
74
75
76 int BufferView::Pimpl::scrollUp(long time)
77 {
78         if (buffer_ == 0) return 0;
79         if (!screen) return 0;
80    
81         double value = workarea->getScrollbarValue();
82    
83         if (value == 0) return 0;
84
85         float add_value =  (bv_->text->DefaultHeight()
86                             + float(time) * float(time) * 0.125);
87    
88         if (add_value > workarea->height())
89                 add_value = float(workarea->height() -
90                                   bv_->text->DefaultHeight());
91    
92         value -= add_value;
93
94         if (value < 0)
95                 value = 0;
96    
97         workarea->setScrollbarValue(value);
98    
99         bv_->scrollCB(value); 
100         return 0;
101 }
102
103
104 int BufferView::Pimpl::scrollDown(long time)
105 {
106         if (buffer_ == 0) return 0;
107         if (!screen) return 0;
108    
109         double value= workarea->getScrollbarValue();
110         pair<double, double> p = workarea->getScrollbarBounds();
111         double max = p.second;
112         
113         if (value == max) return 0;
114
115         float add_value =  (bv_->text->DefaultHeight()
116                             + float(time) * float(time) * 0.125);
117    
118         if (add_value > workarea->height())
119                 add_value = float(workarea->height() -
120                                   bv_->text->DefaultHeight());
121    
122         value += add_value;
123    
124         if (value > max)
125                 value = max;
126
127         workarea->setScrollbarValue(value);
128         
129         bv_->scrollCB(value); 
130         return 0;
131 }
132
133
134 void BufferView::Pimpl::scrollUpOnePage()
135 {
136         if (buffer_ == 0) return;
137         if (!screen) return;
138    
139         long y = screen->first;
140
141         if (!y) return;
142
143         Row * row = bv_->text->GetRowNearY(y);
144
145         y = y - workarea->height() + row->height;
146
147         workarea->setScrollbarValue(y);
148         
149         bv_->scrollCB(y); 
150 }
151
152
153 void BufferView::Pimpl::scrollDownOnePage()
154 {
155         if (buffer_ == 0) return;
156         if (!screen) return;
157    
158         long y = screen->first;
159
160         if (y > bv_->text->height - workarea->height())
161                 return;
162    
163         y += workarea->height();
164         bv_->text->GetRowNearY(y);
165
166         workarea->setScrollbarValue(y);
167         
168         bv_->scrollCB(y); 
169 }
170
171
172 void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
173 {
174         if (buffer_ == 0 || !screen) return;
175
176         // Check for inset locking
177         if (bv_->the_locking_inset) {
178                 LyXCursor cursor = bv_->text->cursor;
179                 bv_->the_locking_inset->
180                         InsetMotionNotify(bv_,
181                                           x - cursor.x,
182                                           y - cursor.y,
183                                           state);
184                 return;
185         }
186
187         // Only use motion with button 1
188         if (!state & Button1MotionMask)
189                 return; 
190    
191         /* The selection possible is needed, that only motion events are 
192          * used, where the bottom press event was on the drawing area too */
193         if (selection_possible) {
194                 screen->HideCursor();
195
196                 bv_->text->SetCursorFromCoordinates(x, y + screen->first);
197       
198                 if (!bv_->text->selection)
199                         bv_->update(-3); // Maybe an empty line was deleted
200       
201                 bv_->text->SetSelection();
202                 screen->ToggleToggle();
203                 if (screen->FitCursor())
204                         bv_->updateScrollbar(); 
205                 screen->ShowCursor();
206         }
207         return;
208 }
209
210
211 // Single-click on work area
212 void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, unsigned int button)
213 {
214         last_click_x = -1;
215         last_click_y = -1;
216
217         if (buffer_ == 0 || !screen) return;
218
219         Inset * inset_hit = checkInsetHit(xpos, ypos, button);
220
221         // ok ok, this is a hack.
222         if (button == 4 || button == 5) {
223                 switch (button) {
224                 case 4:
225                         scrollUp(100); // This number is only temporary
226                         break;
227                 case 5:
228                         scrollDown(100);
229                         break;
230                 }
231         }
232         
233         if (bv_->the_locking_inset) {
234                 // We are in inset locking mode
235                 
236                 /* Check whether the inset was hit. If not reset mode,
237                    otherwise give the event to the inset */
238                 if (inset_hit == bv_->the_locking_inset) {
239                         bv_->the_locking_inset->
240                                 InsetButtonPress(bv_,
241                                                  xpos, ypos,
242                                                  button);
243                         return;
244                 } else {
245                         bv_->unlockInset(bv_->the_locking_inset);
246                 }
247         }
248         
249         if (!inset_hit)
250                 selection_possible = true;
251         screen->HideCursor();
252         
253         // Right button mouse click on a table
254         if (button == 3 &&
255             (bv_->text->cursor.par->table ||
256              bv_->text->MouseHitInTable(xpos, ypos + screen->first))) {
257                 // Set the cursor to the press-position
258                 bv_->text->SetCursorFromCoordinates(xpos, ypos + screen->first);
259                 bool doit = true;
260                 
261                 // Only show the table popup if the hit is in
262                 // the table, too
263                 if (!bv_->text->HitInTable(bv_->text->cursor.row, xpos))
264                         doit = false;
265                 
266                 // Hit above or below the table?
267                 if (doit) {
268                         if (!bv_->text->selection) {
269                                 screen->ToggleSelection();
270                                 bv_->text->ClearSelection();
271                                 bv_->text->FullRebreak();
272                                 screen->Update();
273                                 bv_->updateScrollbar();
274                         }
275                         // Popup table popup when on a table.
276                         // This is obviously temporary, since we
277                         // should be able to popup various
278                         // context-sensitive-menus with the
279                         // the right mouse. So this should be done more
280                         // general in the future. Matthias.
281                         selection_possible = false;
282                         owner_->getLyXFunc()
283                                 ->Dispatch(LFUN_LAYOUT_TABLE,
284                                            "true");
285                         return;
286                 }
287         }
288         
289         int screen_first = screen->first;
290         
291         // Middle button press pastes if we have a selection
292         bool paste_internally = false;
293         if (button == 2
294             && bv_->text->selection) {
295                 owner_->getLyXFunc()->Dispatch(LFUN_COPY);
296                 paste_internally = true;
297         }
298         
299         // Clear the selection
300         screen->ToggleSelection();
301         bv_->text->ClearSelection();
302         bv_->text->FullRebreak();
303         screen->Update();
304         bv_->updateScrollbar();
305         
306         // Single left click in math inset?
307         if ((inset_hit != 0) &&
308             (inset_hit->Editable()==Inset::HIGHLY_EDITABLE)) {
309                 // Highly editable inset, like math
310                 UpdatableInset * inset = static_cast<UpdatableInset *>(inset_hit);
311                 selection_possible = false;
312                 owner_->updateLayoutChoice();
313                 owner_->getMiniBuffer()->Set(inset->EditMessage());
314                 inset->InsetButtonPress(bv_, xpos, ypos, button);
315                 inset->Edit(bv_, xpos, ypos, button);
316                 return;
317         } 
318         
319         // Right click on a footnote flag opens float menu
320         if (button == 3) { 
321                 selection_possible = false;
322                 return;
323         }
324         
325         if (!inset_hit) // otherwise it was already set in checkInsetHit(...)
326                 bv_->text->SetCursorFromCoordinates(xpos, ypos + screen_first);
327         bv_->text->FinishUndo();
328         bv_->text->sel_cursor = bv_->text->cursor;
329         bv_->text->cursor.x_fix = bv_->text->cursor.x;
330         
331         owner_->updateLayoutChoice();
332         if (screen->FitCursor()){
333                 bv_->updateScrollbar();
334                 selection_possible = false;
335         }
336         
337         // Insert primary selection with middle mouse
338         // if there is a local selection in the current buffer,
339         // insert this
340         if (button == 2) {
341                 if (paste_internally)
342                         owner_->getLyXFunc()->Dispatch(LFUN_PASTE);
343                 else
344                         owner_->getLyXFunc()->Dispatch(LFUN_PASTESELECTION,
345                                                        "paragraph");
346                 selection_possible = false;
347                 return;
348         }
349 }
350
351
352 void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button) 
353 {
354         // select a word
355         if (buffer_ && !bv_->the_locking_inset) {
356                 if (screen && button == 1) {
357                         screen->HideCursor();
358                         screen->ToggleSelection();
359                         bv_->text->SelectWord();
360                         screen->ToggleSelection(false);
361                         /* This will fit the cursor on the screen
362                          * if necessary */
363                         bv_->update(0);
364                 }
365         }            
366 }
367
368
369 void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
370 {
371         // select a line
372         if (buffer_ && screen && button == 1) {
373                 screen->HideCursor();
374                 screen->ToggleSelection();
375                 bv_->text->CursorHome();
376                 bv_->text->sel_cursor = bv_->text->cursor;
377                 bv_->text->CursorEnd();
378                 bv_->text->SetSelection();
379                 screen->ToggleSelection(false);
380                 /* This will fit the cursor on the screen
381                  * if necessary */
382                 bv_->update(0);
383         }
384 }
385
386
387 void BufferView::Pimpl::workAreaButtonRelease(int x, int y, unsigned int button)
388 {
389         if (buffer_ == 0 || screen == 0) return;
390
391         // If we hit an inset, we have the inset coordinates in these
392         // and inset_hit points to the inset.  If we do not hit an
393         // inset, inset_hit is 0, and inset_x == x, inset_y == y.
394         Inset * inset_hit = checkInsetHit(x, y, button);
395
396         if (bv_->the_locking_inset) {
397                 // We are in inset locking mode.
398
399                 /* LyX does a kind of work-area grabbing for insets.
400                    Only a ButtonPress Event outside the inset will 
401                    force a InsetUnlock. */
402                 bv_->the_locking_inset->
403                         InsetButtonRelease(bv_, x, y, button);
404                 return;
405         }
406         
407         selection_possible = false;
408         if (bv_->text->cursor.par->table) {
409                 int cell = bv_->text->
410                         NumberOfCell(bv_->text->cursor.par,
411                                      bv_->text->cursor.pos);
412                 if (bv_->text->cursor.par->table->IsContRow(cell) &&
413                     bv_->text->cursor.par->table->
414                     CellHasContRow(bv_->text->cursor.par->table->
415                                    GetCellAbove(cell))<0) {
416                         bv_->text->CursorUp();
417                 }
418         }
419         
420         if (button >= 2) return;
421
422         bv_->setState();
423         owner_->getMiniBuffer()->Set(CurrentState());
424
425         // Did we hit an editable inset?
426         if (inset_hit != 0) {
427                 // Inset like error, notes and figures
428                 selection_possible = false;
429 #ifdef WITH_WARNINGS
430 #warning fix this proper in 0.13
431 #endif
432                 // Following a ref shouldn't issue
433                 // a push on the undo-stack
434                 // anylonger, now that we have
435                 // keybindings for following
436                 // references and returning from
437                 // references.  IMHO though, it
438                 // should be the inset's own business
439                 // to push or not push on the undo
440                 // stack. They don't *have* to
441                 // alter the document...
442                 // (Joacim)
443                 // ...or maybe the SetCursorParUndo()
444                 // below isn't necessary at all anylonger?
445                 if (inset_hit->LyxCode() == Inset::REF_CODE) {
446                         bv_->text->SetCursorParUndo();
447                 }
448
449                 owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
450                 if (inset_hit->Editable()==Inset::HIGHLY_EDITABLE) {
451                         // Highly editable inset, like math
452                         UpdatableInset *inset = (UpdatableInset *)inset_hit;
453                         inset->InsetButtonRelease(bv_, x, y, button);
454                 } else {
455                         inset_hit->Edit(bv_, x, y, button);
456                 }
457                 return;
458         }
459
460         // check whether we want to open a float
461         if (bv_->text) {
462                 bool hit = false;
463                 char c = ' ';
464                 if (bv_->text->cursor.pos <
465                     bv_->text->cursor.par->Last()) {
466                         c = bv_->text->cursor.par->
467                                 GetChar(bv_->text->cursor.pos);
468                 }
469                 if (c == LyXParagraph::META_FOOTNOTE
470                     || c == LyXParagraph::META_MARGIN
471                     || c == LyXParagraph::META_FIG
472                     || c == LyXParagraph::META_TAB
473                     || c == LyXParagraph::META_WIDE_FIG
474                     || c == LyXParagraph::META_WIDE_TAB
475                     || c == LyXParagraph::META_ALGORITHM){
476                         hit = true;
477                 } else if (bv_->text->cursor.pos - 1 >= 0) {
478                         c = bv_->text->cursor.par->
479                                 GetChar(bv_->text->cursor.pos - 1);
480                         if (c == LyXParagraph::META_FOOTNOTE
481                             || c == LyXParagraph::META_MARGIN
482                             || c == LyXParagraph::META_FIG
483                             || c == LyXParagraph::META_TAB
484                             || c == LyXParagraph::META_WIDE_FIG 
485                             || c == LyXParagraph::META_WIDE_TAB
486                             || c == LyXParagraph::META_ALGORITHM){
487                                 // We are one step too far to the right
488                                 bv_->text->CursorLeft();
489                                 hit = true;
490                         }
491                 }
492                 if (hit == true) {
493                         bv_->toggleFloat();
494                         selection_possible = false;
495                         return;
496                 }
497         }
498
499         // Do we want to close a float? (click on the float-label)
500         if (bv_->text->cursor.row->par->footnoteflag == 
501             LyXParagraph::OPEN_FOOTNOTE
502             //&& text->cursor.pos == 0
503             && bv_->text->cursor.row->previous &&
504             bv_->text->cursor.row->previous->par->
505             footnoteflag != LyXParagraph::OPEN_FOOTNOTE){
506                 LyXFont font(LyXFont::ALL_SANE);
507                 font.setSize(LyXFont::SIZE_FOOTNOTE);
508
509                 int box_x = 20; // LYX_PAPER_MARGIN;
510                 box_x += lyxfont::width(" wide-tab ", font);
511
512                 int screen_first = screen->first;
513
514                 if (x < box_x
515                     && y + screen_first > bv_->text->cursor.y -
516                     bv_->text->cursor.row->baseline
517                     && y + screen_first < bv_->text->cursor.y -
518                     bv_->text->cursor.row->baseline
519                     + lyxfont::maxAscent(font) * 1.2 + lyxfont::maxDescent(font) * 1.2) {
520                         bv_->toggleFloat();
521                         selection_possible = false;
522                         return;
523                 }
524         }
525
526         // Maybe we want to edit a bibitem ale970302
527         if (bv_->text->cursor.par->bibkey && x < 20 + 
528             bibitemMaxWidth(bv_->painter(),
529                             textclasslist
530                             .TextClass(buffer_->
531                                        params.textclass).defaultfont())) {
532                 bv_->text->cursor.par->bibkey->Edit(bv_, 0, 0, 0);
533         }
534
535         return;
536 }
537
538
539 /* 
540  * Returns an inset if inset was hit. 0 otherwise.
541  * If hit, the coordinates are changed relative to the inset. 
542  * Otherwise coordinates are not changed, and false is returned.
543  */
544 Inset * BufferView::Pimpl::checkInsetHit(int & x, int & y, unsigned int button)
545 {
546         if (!screen)
547                 return 0;
548   
549         int y_tmp = y + screen->first;
550   
551         LyXCursor cursor;
552         bv_->text->SetCursorFromCoordinates(cursor, x, y_tmp);
553 #if 1
554         bool move_cursor = true;
555 #else
556         bool move_cursor = ((cursor.par != bv_->text->cursor.par) ||
557                             (cursor.pos != bv_->text->cursor.pos)) && (button < 2);
558 #endif
559
560         if (cursor.pos < cursor.par->Last()
561             && cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
562             && cursor.par->GetInset(cursor.pos)
563             && cursor.par->GetInset(cursor.pos)->Editable()) {
564
565                 // Check whether the inset really was hit
566                 Inset * tmpinset = cursor.par->GetInset(cursor.pos);
567                 LyXFont font = bv_->text->GetFont(cursor.par, cursor.pos);
568                 bool is_rtl = font.isVisibleRightToLeft();
569                 int start_x, end_x;
570
571                 if (is_rtl) {
572                         start_x = cursor.x - tmpinset->width(bv_->painter(), font);
573                         end_x = cursor.x;
574                 } else {
575                         start_x = cursor.x;
576                         end_x = cursor.x + tmpinset->width(bv_->painter(), font);
577                 }
578
579                 if (x > start_x && x < end_x
580                     && y_tmp > cursor.y - tmpinset->ascent(bv_->painter(), font)
581                     && y_tmp < cursor.y + tmpinset->descent(bv_->painter(), font)) {
582                         if (move_cursor)
583                                 bv_->text->SetCursorFromCoordinates(x, y_tmp);
584                         x = x - start_x;
585                         // The origin of an inset is on the baseline
586                         y = y_tmp - (bv_->text->cursor.y); 
587                         return tmpinset;
588                 }
589         }
590
591         if ((cursor.pos - 1 >= 0) &&
592             (cursor.par->GetChar(cursor.pos-1) == LyXParagraph::META_INSET) &&
593             (cursor.par->GetInset(cursor.pos - 1)) &&
594             (cursor.par->GetInset(cursor.pos - 1)->Editable())) {
595                 Inset * tmpinset = cursor.par->GetInset(cursor.pos-1);
596                 LyXFont font = bv_->text->GetFont(cursor.par, cursor.pos-1);
597                 bool is_rtl = font.isVisibleRightToLeft();
598                 int start_x, end_x;
599
600                 if (!is_rtl) {
601                         start_x = cursor.x - tmpinset->width(bv_->painter(), font);
602                         end_x = cursor.x;
603                 } else {
604                         start_x = cursor.x;
605                         end_x = cursor.x + tmpinset->width(bv_->painter(), font);
606                 }
607                 if (x > start_x && x < end_x
608                     && y_tmp > cursor.y - tmpinset->ascent(bv_->painter(), font)
609                     && y_tmp < cursor.y + tmpinset->descent(bv_->painter(), font)) {
610                         if (move_cursor)
611                                 bv_->text->SetCursorFromCoordinates(x, y_tmp);
612                         x = x - start_x;
613                         // The origin of an inset is on the baseline
614                         y = y_tmp - (bv_->text->cursor.y); 
615                         return tmpinset;
616                 }
617         }
618         return 0;
619 }
620
621
622 void BufferView::Pimpl::workAreaExpose()
623 {
624         // this is a hack to ensure that we only call this through
625         // BufferView::redraw().
626         //if (!lgb_hack) {
627         //      redraw();
628         //}
629         
630         static int work_area_width = -1;
631         static int work_area_height = -1;
632
633         bool widthChange = workarea->workWidth() != work_area_width;
634         bool heightChange = workarea->height() != work_area_height;
635
636         // update from work area
637         work_area_width = workarea->workWidth();
638         work_area_height = workarea->height();
639         if (buffer_ != 0) {
640                 if (widthChange) {
641                         // All buffers need a resize
642                         bufferlist.resize();
643
644                         // Remove all texts from the textcache
645                         // This is not _really_ what we want to do. What
646                         // we really want to do is to delete in textcache
647                         // that does not have a BufferView with matching
648                         // width, but as long as we have only one BufferView
649                         // deleting all gives the same result.
650                         if (lyxerr.debugging())
651                                 textcache.show(lyxerr, "Expose delete all");
652                         textcache.clear();
653                 } else if (heightChange) {
654                         // Rebuild image of current screen
655                         updateScreen();
656                         // fitCursor() ensures we don't jump back
657                         // to the start of the document on vertical
658                         // resize
659                         bv_->fitCursor();
660
661                         // The main window size has changed, repaint most stuff
662                         bv_->redraw();
663                         // ...including the minibuffer
664                         owner_->getMiniBuffer()->Init();
665
666                 } else if (screen) screen->Redraw();
667         } else {
668                 // Grey box when we don't have a buffer
669                 workarea->greyOut();
670         }
671
672         // always make sure that the scrollbar is sane.
673         bv_->updateScrollbar();
674         owner_->updateLayoutChoice();
675         return;
676 }
677
678
679 static
680 string fromClipboard(Window win, XEvent * event)
681 {
682         string strret;
683         if (event->xselection.type == XA_STRING
684             && event->xselection.property) {
685                 Atom tmpatom;
686                 unsigned long ul1;
687                 unsigned long ul2;
688                 unsigned char * uc = 0;
689                 int tmpint;
690                 if (XGetWindowProperty(
691                         event->xselection.display,  // display
692                         win,                        // w
693                         event->xselection.property, // property
694                         0,                          // long_offset      
695                         0,                          // logn_length      
696                         False,                      // delete   
697                         XA_STRING,                  // req_type 
698                         &tmpatom,                   // actual_type_return
699                         &tmpint,                    // actual_format_return
700                         &ul1,
701                         &ul2,
702                         &uc                         // prop_return      
703                         ) != Success) {
704                         return strret;
705                 }
706                 if (uc) {
707                         free(uc);
708                         uc = 0;
709                 }
710                 if (XGetWindowProperty(
711                         event->xselection.display,             // display
712                         win,                        // w
713                         event->xselection.property, // property
714                         0,                          // long_offset
715                         ul2/4+1,                    // long_length
716                         True,                       // delete
717                         XA_STRING,                  // req_type
718                         &tmpatom,                   // actual_type_return
719                         &tmpint,                    // actual_format_return
720                         &ul1,                       // nitems_return
721                         &ul2,                       // bytes_after_return
722                         &uc                         // prop_return */
723                         ) != Success) {
724                         return strret;
725                 }
726                 if (uc) {
727                         strret = reinterpret_cast<char*>(uc);
728                         free(uc); // yes free!
729                         uc = 0;
730                 }
731         }
732         return strret;
733 }
734
735
736 void BufferView::Pimpl::workAreaSelectionNotify(Window win, XEvent * event)
737 {
738         if (buffer_ == 0) return;
739
740         screen->HideCursor();
741         bv_->beforeChange();
742         string clb = fromClipboard(win, event);
743         if (!clb.empty()) {
744                 if (!ascii_type)
745                         bv_->text->InsertStringA(clb);
746                 else
747                         bv_->text->InsertStringB(clb);
748
749                 bv_->update(1);
750         }
751 }
752