2000-04-14 Lars Gullik Bjønnes <larsbj@lyx.org>
+ * src/WorkArea.C (work_area_handler): call BufferView::enterView
+ and Buffer::leaveView when FL_ENTER and FL_LEAVE.
+
+ * src/BufferView.C (enterView): new func
+ (leaveView): new func
+
+ * src/BufferView_pimpl.C (enterView): new func, sets xterm cursor
+ when approp.
+ (leaveView): new func, undefines xterm cursor when approp.
+
+ * src/bufferview_funcs.C: moved SetXCursor to BufferView_pimp.C
+ (AllowInput): delete the Workarea cursor handling from this func.
+
* src/Painter.C (underline): draw a slimer underline in most cases.
* src/lyx_main.C (error_handler): use extern "C"
}
+void BufferView::enterView()
+{
+ pimpl_->enterView();
+}
+
+
+void BufferView::leaveView()
+{
+ pimpl_->leaveView();
+}
+
+
// Callback for scrollbar slider
void BufferView::scrollCB(double value)
{
///
void tripleClick(int x, int y, unsigned int button);
///
+ void enterView();
+ ///
+ void leaveView();
+ ///
void workAreaSelectionNotify(Window win, XEvent * event);
private:
struct Pimpl;
}
+static
+void SetXtermCursor(Window win)
+{
+ static Cursor cursor;
+ static bool cursor_undefined = true;
+ if (cursor_undefined){
+ cursor = XCreateFontCursor(fl_display, XC_xterm);
+ XFlush(fl_display);
+ cursor_undefined = false;
+ }
+ XDefineCursor(fl_display, win, cursor);
+ XFlush(fl_display);
+}
+
+
BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
int xpos, int ypos, int width, int height)
: bv_(b), owner_(o)
workarea->setFocus();
work_area_focus = true;
lyx_focus = false;
+ using_xterm_cursor = false;
}
}
+void BufferView::Pimpl::enterView()
+{
+ if (active() && available()) {
+ SetXtermCursor(workarea->getWin());
+ using_xterm_cursor = true;
+ }
+}
+
+
+void BufferView::Pimpl::leaveView()
+{
+ if (using_xterm_cursor) {
+ XUndefineCursor(fl_display, workarea->getWin());
+ using_xterm_cursor = false;
+ }
+}
+
+
void BufferView::Pimpl::workAreaButtonRelease(int x, int y, unsigned int button)
{
if (buffer_ == 0 || screen == 0) return;
///
void tripleClick(int x, int y, unsigned int button);
///
+ void enterView();
+ ///
+ void leaveView();
+ ///
void cursorToggle();
///
void cursorPrevious();
WorkArea * workarea;
///
UpdateInset updatelist;
+private:
+ bool using_xterm_cursor;
};
#endif
break;
case FL_ENTER:
lyxerr.debug() << "Workarea event: ENTER" << endl;
+ area->owner->enterView();
break;
case FL_LEAVE:
lyxerr.debug() << "Workarea event: LEAVE" << endl;
+ area->owner->leaveView();
break;
case FL_DBLCLICK:
if (!ev) break;
extern FD_form_character * fd_form_character;
-static
-void SetXtermCursor(Window win)
-{
- static Cursor cursor;
- static bool cursor_undefined = true;
- if (cursor_undefined){
- cursor = XCreateFontCursor(fl_display, XC_xterm);
- XFlush(fl_display);
- cursor_undefined = false;
- }
- XDefineCursor(fl_display, win, cursor);
- XFlush(fl_display);
-}
-
-
void Foot(BufferView * bv)
{
if (!bv->available())
XUndefineCursor(fl_display,
fd_form_character->form_character->window);
- // What to do about this? (Lgb)
- if (bv->belowMouse())
- SetXtermCursor(bv->owner()->getForm()->window);
-
XFlush(fl_display);
fl_activate_all_forms();
}
// font. (Asger)
Buffer * buffer = bv->buffer();
LyXFont font = bv->text->real_current_font;
- LyXFont defaultfont = textclasslist.TextClass(buffer->
- params.textclass).defaultfont();
+ LyXFont const & defaultfont =
+ textclasslist
+ .TextClass(buffer->params.textclass)
+ .defaultfont();
font.reduce(defaultfont);
state = _("Font: ") + font.stateText();
// The paragraph depth
}
-// candidate for move to BufferView
/* -------> Does the actual toggle job of the XxxCB() calls above.
* Also shows the current font state.
*/