#include "lyxscreen.h"
#include "up.xpm"
#include "down.xpm"
-#include "error.h"
+#include "debug.h"
#include "lyxdraw.h"
#include "lyx_gui_misc.h"
#include "BackStack.h"
void BufferView::setBuffer(Buffer *b)
{
- lyxerr.debug("Setting buffer in BufferView");
+ lyxerr.debug() << "Setting buffer in BufferView" << endl;
if (_buffer) {
_buffer->InsetSleep();
_buffer->delUser(this);
}
if (_buffer) {
- lyxerr.debug(string(" Buffer addr: ") + tostr(_buffer));
+ lyxerr.debug() << " Buffer addr: " << _buffer << endl;
_buffer->addUser(this);
_owner->getMenus()->showMenus();
// If we don't have a text object for this, we make one
updateAllVisibleBufferRelatedPopups();
_buffer->InsetWakeup();
} else {
- lyxerr.debug(" No Buffer!");
+ lyxerr.debug() << " No Buffer!" << endl;
_owner->getMenus()->hideMenus();
//workAreaExpose();
updateScrollbar();
void BufferView::redraw()
{
- lyxerr.debug("BufferView::redraw()");
+ lyxerr.debug() << "BufferView::redraw()" << endl;
lgb_hack = true;
fl_redraw_object(work_area);
fl_redraw_object(scrollbar);
void BufferView::redoCurrentBuffer()
{
- lyxerr.debug("BufferView::redoCurrentBuffer");
+ lyxerr.debug() << "BufferView::redoCurrentBuffer" << endl;
if (_buffer && _buffer->text) {
resize();
_owner->updateLayoutChoice();
int BufferView::resizeCurrentBuffer()
{
- lyxerr.debug("resizeCurrentBuffer");
+ lyxerr.debug() << "resizeCurrentBuffer" << endl;
LyXParagraph *par = 0;
LyXParagraph *selstartpar = 0;
_buffer->text->cursor;
}
+// Just a bunch of C wrappers around static members of BufferView
+extern "C" void C_BufferView_UpCB(FL_OBJECT *ob, long buf) {
+ BufferView::UpCB(ob,buf);
+}
+
+extern "C" void C_BufferView_DownCB(FL_OBJECT *ob, long buf) {
+ BufferView::DownCB(ob,buf);
+}
+
+extern "C" void C_BufferView_ScrollCB(FL_OBJECT *ob, long buf) {
+ BufferView::ScrollCB(ob,buf);
+}
+
+extern "C" void C_BufferView_CursorToggleCB(FL_OBJECT *ob, long buf) {
+ BufferView::CursorToggleCB(ob,buf);
+}
+
+extern "C" int C_BufferView_work_area_handler(FL_OBJECT *ob, int event,
+ FL_Coord, FL_Coord,
+ int key, void *xev) {
+ return BufferView::work_area_handler(ob, event, 0, 0, key, xev);
+}
+
void BufferView::create_view(int xpos, int ypos, int width, int height)
{
xpos +bw, ypos+bw,
width-15-2*bw /* scrollbarwidth */,
height-2*bw,"",
- work_area_handler);
+ C_BufferView_work_area_handler);
obj->wantkey = FL_KEY_TAB;
- obj->u_vdata = (void*) this; /* This is how we pass the BufferView
+ obj->u_vdata = this; /* This is how we pass the BufferView
to the work_area_handler. */
fl_set_object_boxtype(obj,FL_DOWN_BOX);
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_color(obj,FL_MCOL,FL_BLUE);
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj,NorthEastGravity, NorthEastGravity);
- fl_set_object_callback(obj,UpCB,(long)this);
+ fl_set_object_callback(obj,C_BufferView_UpCB,(long)this);
fl_set_pixmapbutton_data(obj, up_xpm);
#if FL_REVISION >85
fl_set_object_boxtype(obj, FL_UP_BOX);
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
- fl_set_object_callback(obj,ScrollCB,(long)this);
+ fl_set_object_callback(obj,C_BufferView_ScrollCB,(long)this);
// down - scrollbar button
#if FL_REVISION > 85
fl_set_object_color(obj,FL_MCOL,FL_BLUE);
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
- fl_set_object_callback(obj,DownCB,(long)this);
+ fl_set_object_callback(obj,C_BufferView_DownCB,(long)this);
fl_set_pixmapbutton_data(obj, down_xpm);
fl_set_border_width(-bw);
// timer_cursor
timer_cursor = obj = fl_add_timer(FL_HIDDEN_TIMER,
0,0,0,0,"Timer");
- fl_set_object_callback(obj,CursorToggleCB,0);
- obj->u_vdata = (void*) this;
+ fl_set_object_callback(obj,C_BufferView_CursorToggleCB,0);
+ obj->u_vdata = this;
}
// Hit above or below the table?
if (doit) {
-#if 0
- long y_tmp = y + screen->first;
-
- Row* row = _buffer->text->GetRowNearY(y_tmp);
-
- // Isn't this empty code anyway? (Lgb)
- if (row->par != _buffer->text->cursor.par)
- doit = true;
- }
-
- if (doit) {
-#endif
if (!_buffer->text->selection) {
screen->ToggleSelection();
_buffer->text->ClearSelection();
// Right click on a footnote flag opens float menu
if (button == 3) {
-#if 0
- // Isn't this empty code anyway? (Lgb)
- if (_buffer->text->cursor.par->footnoteflag ==
- LyXParagraph::OPEN_FOOTNOTE) {
- selection_possible = false;
- lyxerr.debug("LyX: Sorry not implemented yet.");
- return 0;
- }
- }
-
- if (button == 3) {
-#endif
selection_possible = false;
return 0;
}
Window tmpwin;
int tmp;
XGetInputFocus(fl_display, &tmpwin, &tmp);
- lyxerr.debug(string("tmpwin: ") + tostr(tmpwin));
- lyxerr.debug(string("window: ")
- + tostr(view->_owner->getForm()->window));
- lyxerr.debug(string("work_area_focus: ")
- + tostr(view->work_area_focus));
- lyxerr.debug(string("lyx_focus : ")
- + tostr(view->lyx_focus));
+ if (lyxerr.debugging()) {
+ lyxerr << "tmpwin: " << tmpwin
+ << "\nwindow: " << view->_owner->getForm()->window
+ << "\nwork_area_focus: " << view->work_area_focus
+ << "\nlyx_focus : " << view->lyx_focus
+ << endl;
+ }
if (tmpwin != view->_owner->getForm()->window) {
view->lyx_focus = false;
goto skip_timer;
void BufferView::restorePosition()
{
+ if (backstack->empty()) return;
+
int x, y;
string fname = backstack->pop(&x, &y);
currentBuffer()->text->SetCursorFromCoordinates(x, y);
currentBuffer()->update(0);
}
-