mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
better mouse pointer handling, actualy makes sense now
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@658 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
36e819ef14
commit
f2044aeec7
13
ChangeLog
13
ChangeLog
@ -1,5 +1,18 @@
|
||||
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"
|
||||
|
@ -148,6 +148,18 @@ void BufferView::upCB(long time, int button)
|
||||
}
|
||||
|
||||
|
||||
void BufferView::enterView()
|
||||
{
|
||||
pimpl_->enterView();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::leaveView()
|
||||
{
|
||||
pimpl_->leaveView();
|
||||
}
|
||||
|
||||
|
||||
// Callback for scrollbar slider
|
||||
void BufferView::scrollCB(double value)
|
||||
{
|
||||
|
@ -218,6 +218,10 @@ public:
|
||||
///
|
||||
void tripleClick(int x, int y, unsigned int button);
|
||||
///
|
||||
void enterView();
|
||||
///
|
||||
void leaveView();
|
||||
///
|
||||
void workAreaSelectionNotify(Window win, XEvent * event);
|
||||
private:
|
||||
struct Pimpl;
|
||||
|
@ -51,6 +51,21 @@ void waitForX()
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
@ -65,6 +80,7 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
|
||||
workarea->setFocus();
|
||||
work_area_focus = true;
|
||||
lyx_focus = false;
|
||||
using_xterm_cursor = false;
|
||||
}
|
||||
|
||||
|
||||
@ -747,6 +763,24 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
@ -77,6 +77,10 @@ struct BufferView::Pimpl {
|
||||
///
|
||||
void tripleClick(int x, int y, unsigned int button);
|
||||
///
|
||||
void enterView();
|
||||
///
|
||||
void leaveView();
|
||||
///
|
||||
void cursorToggle();
|
||||
///
|
||||
void cursorPrevious();
|
||||
@ -142,5 +146,7 @@ struct BufferView::Pimpl {
|
||||
WorkArea * workarea;
|
||||
///
|
||||
UpdateInset updatelist;
|
||||
private:
|
||||
bool using_xterm_cursor;
|
||||
};
|
||||
#endif
|
||||
|
@ -428,9 +428,11 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
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;
|
||||
|
@ -17,21 +17,6 @@ extern FD_form_paragraph * fd_form_paragraph;
|
||||
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())
|
||||
@ -190,10 +175,6 @@ void AllowInput(BufferView * bv)
|
||||
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();
|
||||
}
|
||||
@ -258,8 +239,10 @@ string CurrentState(BufferView * bv)
|
||||
// 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
|
||||
@ -297,7 +280,6 @@ string CurrentState(BufferView * bv)
|
||||
}
|
||||
|
||||
|
||||
// candidate for move to BufferView
|
||||
/* -------> Does the actual toggle job of the XxxCB() calls above.
|
||||
* Also shows the current font state.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user