From 480b4f4fdcb730adcfd6cef10c7dbd33b5f34756 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 22 Sep 2006 14:26:06 +0000 Subject: [PATCH] This commit replaces BufferView->LyXView->getLyXFunc() with theApp->lyxFunc() and BufferView->LyXView->dispatch() with theApp->lyxFunc().dispatch(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15121 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/cursor.C | 4 ++-- src/frontends/LyXView.h | 9 +++++++++ src/insets/insetref.C | 2 +- src/mathed/InsetMathHull.C | 2 +- src/text2.C | 8 ++++---- src/text3.C | 18 +++++++++--------- 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/cursor.C b/src/cursor.C index 3a4b3a6169..0d71f75110 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -1105,13 +1105,13 @@ void LCursor::handleFont(string const & font) void LCursor::message(docstring const & msg) const { - bv().owner()->getLyXFunc().setMessage(msg); + theApp->lyxFunc().setMessage(msg); } void LCursor::errorMessage(docstring const & msg) const { - bv().owner()->getLyXFunc().setErrorMessage(msg); + theApp->lyxFunc().setErrorMessage(msg); } diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index 932e98602e..d083869887 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -87,6 +87,15 @@ public: /// return the buffer currently shown in this window Buffer * buffer() const; + /* FIXME: Abdel 22/09/71 + there is only one lyxFunc() for now but there is maybe a need + for more in the feature. Something like that: + + LyXFunc & getLyXFunc() { return theApp->lyxFunc(id_); } + + where id_ would be the this LyXView ID. + That's the reason why I didn't remove these methods for now. + */ /// return the LyX function handler for this view LyXFunc & getLyXFunc() { return theApp->lyxFunc(); } /// diff --git a/src/insets/insetref.C b/src/insets/insetref.C index fa8fe76dd1..8576a1c677 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -48,7 +48,7 @@ void InsetRef::doDispatch(LCursor & cur, FuncRequest & cmd) case LFUN_MOUSE_PRESS: // Eventually trigger dialog with button 3 not 1 if (cmd.button() == mouse_button::button3) - cur.bv().owner()->dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents())); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents())); else { InsetCommandMailer("ref", *this).showDialog(&cur.bv()); cur.undispatched(); diff --git a/src/mathed/InsetMathHull.C b/src/mathed/InsetMathHull.C index 0054d6f461..b5ed8347f4 100644 --- a/src/mathed/InsetMathHull.C +++ b/src/mathed/InsetMathHull.C @@ -1264,7 +1264,7 @@ void InsetMathHull::mutateToText() view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt); // remove ourselves - //view_->owner()->dispatch(LFUN_ESCAPE); + //theApp->lyxFunc().dispatch(LFUN_ESCAPE); #endif } diff --git a/src/text2.C b/src/text2.C index 09b9a2ce93..5495f9bfa4 100644 --- a/src/text2.C +++ b/src/text2.C @@ -366,13 +366,13 @@ void LyXText::setLayout(LCursor & cur, string const & layout) if (lyxlayout->is_environment) { // move everything in a new environment inset lyxerr[Debug::DEBUG] << "setting layout " << layout << endl; - bv.owner()->dispatch(FuncRequest(LFUN_LINE_BEGIN)); - bv.owner()->dispatch(FuncRequest(LFUN_LINE_END_SELECT)); - bv.owner()->dispatch(FuncRequest(LFUN_CUT)); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_LINE_BEGIN)); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_LINE_END_SELECT)); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_CUT)); InsetBase * inset = new InsetEnvironment(params, layout); insertInset(cur, inset); //inset->edit(cur, true); - //bv.owner()->dispatch(FuncRequest(LFUN_PASTE)); + //theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE)); return; } diff --git a/src/text3.C b/src/text3.C index f5142a1c76..b6d0634a32 100644 --- a/src/text3.C +++ b/src/text3.C @@ -266,7 +266,7 @@ bool doInsertInset(LCursor & cur, LyXText * text, recordUndo(cur); bool gotsel = false; if (cur.selection()) { - cur.bv().owner()->dispatch(FuncRequest(LFUN_CUT)); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_CUT)); gotsel = true; } text->insertInset(cur, inset); @@ -275,7 +275,7 @@ bool doInsertInset(LCursor & cur, LyXText * text, inset->edit(cur, true); if (gotsel && pastesel) { - cur.bv().owner()->dispatch(FuncRequest(LFUN_PASTE)); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE)); // reset first par to default if (cur.lastpit() != 0 || cur.lastpos() != 0) { LyXLayout_ptr const layout = @@ -936,16 +936,16 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) cur.posRight(); } else - bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT, "\"")); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT, "\"")); break; } case LFUN_DATE_INSERT: if (cmd.argument().empty()) - bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT, + theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT, lyx::formatted_time(lyx::current_time()))); else - bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT, + theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT, lyx::formatted_time(lyx::current_time(), lyx::to_utf8(cmd.argument())))); break; @@ -980,7 +980,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) // we have to check this first bool paste_internally = false; if (cmd.button() == mouse_button::button2 && cur.selection()) { - bv->owner()->dispatch(FuncRequest(LFUN_COPY)); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_COPY)); paste_internally = true; } @@ -991,9 +991,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) // insert this if (cmd.button() == mouse_button::button2) { if (paste_internally) - bv->owner()->dispatch(FuncRequest(LFUN_PASTE)); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE)); else - bv->owner()->dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph")); + theApp->lyxFunc().dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph")); } break; @@ -1384,7 +1384,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) case LFUN_ACCENT_HUNGARIAN_UMLAUT: case LFUN_ACCENT_CIRCLE: case LFUN_ACCENT_OGONEK: - bv->owner()->getLyXFunc().handleKeyFunc(cmd.action); + theApp->lyxFunc().handleKeyFunc(cmd.action); if (!cmd.argument().empty()) // FIXME: Are all these characters encoded in one byte in utf8? bv->getIntl().getTransManager()