From 0dd7fe4e0623794a20be9392a92a0fea5cc5b8af Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 7 Feb 2002 16:43:54 +0000 Subject: [PATCH] fix loss of selection from John; some small things git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3500 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 4 ++++ lib/ui/default.ui | 2 +- po/POTFILES.in | 1 + src/BufferView_pimpl.C | 11 +++++++++++ src/BufferView_pimpl.h | 2 ++ src/ChangeLog | 16 ++++++++++++++++ src/WorkArea.C | 15 ++++++++++----- src/WorkArea.h | 2 ++ src/lyxfunc.C | 3 +++ src/vspace.C | 2 ++ 10 files changed, 52 insertions(+), 6 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index ff13f0d6c9..28f36ad0a4 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2002-02-07 Jean-Marc Lasgouttes + + * ui/default.ui: add ... to math panel + 2002-02-04 Martin Vermeer * bind/math-bind: keybindings for umlauts and other special chars diff --git a/lib/ui/default.ui b/lib/ui/default.ui index 44a91258c5..b1a3fd3dfc 100644 --- a/lib/ui/default.ui +++ b/lib/ui/default.ui @@ -235,7 +235,7 @@ Menuset Separator Submenu "Symbols|S" "insert_math_symbol" Separator - Item "Math Panel|l" "math-panel" + Item "Math Panel...|l" "math-panel" End Menu "insert_math_symbol" diff --git a/po/POTFILES.in b/po/POTFILES.in index f4c6ecd96f..3570609547 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -75,6 +75,7 @@ src/frontends/xforms/combox.C src/frontends/xforms/FileDialog.C src/frontends/xforms/form_aboutlyx.C src/frontends/xforms/FormAboutlyx.C +src/frontends/xforms/FormBase.C src/frontends/xforms/form_bibitem.C src/frontends/xforms/FormBibitem.C src/frontends/xforms/form_bibtex.C diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index b8cc2a3996..7b0b902e54 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -157,6 +157,8 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o, .connect(slot(this, &BufferView::Pimpl::workAreaKeyPress)); workarea_.selectionRequested .connect(slot(this, &BufferView::Pimpl::selectionRequested)); + workarea_.selectionLost + .connect(slot(this, &BufferView::Pimpl::selectionLost)); cursor_timeout.timeout.connect(slot(this, &BufferView::Pimpl::cursorToggle)); @@ -753,6 +755,15 @@ void BufferView::Pimpl::selectionRequested() } +void BufferView::Pimpl::selectionLost() +{ + hideCursor(); + toggleSelection(); + bv_->getLyXText()->clearSelection(); + showCursor(); +} + + void BufferView::Pimpl::enterView() { if (active() && available()) { diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index 652b6c7be4..09fb00d935 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -80,6 +80,8 @@ struct BufferView::Pimpl : public SigC::Object { /// void selectionRequested(); /// + void selectionLost(); + /// void enterView(); /// void leaveView(); diff --git a/src/ChangeLog b/src/ChangeLog index acaf6f920c..dc4e855e1c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2002-02-07 Jean-Marc Lasgouttes + + * lyxfunc.C (dispatch): a few comments from Martin + +2002-02-06 John Levon + + * WorkArea.h: + * WorkArea.C: + * BufferView_pimpl.h: + * BufferView_pimpl.C: clear our selection when X tells us we've lost + the X selection. + +2002-02-07 Jean-Marc Lasgouttes + + * vspace.C (inPixels): fix compiler warning + 2002-02-06 Jean-Marc Lasgouttes * lyxfunc.C (getStatus): fix status message for disabled commands. diff --git a/src/WorkArea.C b/src/WorkArea.C index 7dd3b8e3f7..ad4751de09 100644 --- a/src/WorkArea.C +++ b/src/WorkArea.C @@ -577,11 +577,16 @@ extern "C" { void WorkArea::event_cb(XEvent * xev) { - if (xev->type != SelectionRequest) - return; - - selectionRequested.emit(); - return; + switch (xev->type) { + case SelectionRequest: + lyxerr[Debug::GUI] << "X requested selection." << endl; + selectionRequested.emit(); + break; + case SelectionClear: + lyxerr[Debug::GUI] << "Lost selection." << endl; + selectionLost.emit(); + break; + } } diff --git a/src/WorkArea.h b/src/WorkArea.h index 6a1dde6b5f..eb1bf551ff 100644 --- a/src/WorkArea.h +++ b/src/WorkArea.h @@ -128,6 +128,8 @@ public: SigC::Signal3 workAreaTripleClick; /// emitted when an X client has requested our selection SigC::Signal0 selectionRequested; + /// emitted when another X client has stolen our selection + SigC::Signal0 selectionLost; /// handles SelectionRequest X Event, to fill the clipboard void event_cb(XEvent * xev); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index ebdb24c6eb..a8f210868d 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -881,10 +881,12 @@ string const LyXFunc::dispatch(kb_action action, string argument) owner->view()->menuRedo(); goto exit_with_message; } else if (((result=owner->view()->theLockingInset()-> + // Hand-over to inset's own dispatch: localDispatch(owner->view(), action, argument)) == UpdatableInset::DISPATCHED) || (result == UpdatableInset::DISPATCHED_NOUPDATE)) goto exit_with_message; + // If UNDISPATCHED, just soldier on else if (result == UpdatableInset::FINISHED) { if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) { TEXT()->cursorRight(owner->view()); @@ -1616,6 +1618,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) default: // Then if it was none of the above + // Trying the BufferView::pimpl dispatch: if (!owner->view()->Dispatch(action, argument)) lyxerr << "A truly unknown func [" << lyxaction.getActionName(action) << "]!" diff --git a/src/vspace.C b/src/vspace.C index 6c1e46f34a..103d3e9a40 100644 --- a/src/vspace.C +++ b/src/vspace.C @@ -457,4 +457,6 @@ int VSpace::inPixels(BufferView * bv) const case LENGTH: return len_.len().inPixels(default_width, default_height); } + // we cannot go there, but there is a compiler warning... + return 0; }