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
This commit is contained in:
Abdelrazak Younes 2006-09-22 14:26:06 +00:00
parent 6104eebe0d
commit 480b4f4fdc
6 changed files with 26 additions and 17 deletions

View File

@ -1105,13 +1105,13 @@ void LCursor::handleFont(string const & font)
void LCursor::message(docstring const & msg) const void LCursor::message(docstring const & msg) const
{ {
bv().owner()->getLyXFunc().setMessage(msg); theApp->lyxFunc().setMessage(msg);
} }
void LCursor::errorMessage(docstring const & msg) const void LCursor::errorMessage(docstring const & msg) const
{ {
bv().owner()->getLyXFunc().setErrorMessage(msg); theApp->lyxFunc().setErrorMessage(msg);
} }

View File

@ -87,6 +87,15 @@ public:
/// return the buffer currently shown in this window /// return the buffer currently shown in this window
Buffer * buffer() const; 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 /// return the LyX function handler for this view
LyXFunc & getLyXFunc() { return theApp->lyxFunc(); } LyXFunc & getLyXFunc() { return theApp->lyxFunc(); }
/// ///

View File

@ -48,7 +48,7 @@ void InsetRef::doDispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_MOUSE_PRESS: case LFUN_MOUSE_PRESS:
// Eventually trigger dialog with button 3 not 1 // Eventually trigger dialog with button 3 not 1
if (cmd.button() == mouse_button::button3) if (cmd.button() == mouse_button::button3)
cur.bv().owner()->dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents())); theApp->lyxFunc().dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents()));
else { else {
InsetCommandMailer("ref", *this).showDialog(&cur.bv()); InsetCommandMailer("ref", *this).showDialog(&cur.bv());
cur.undispatched(); cur.undispatched();

View File

@ -1264,7 +1264,7 @@ void InsetMathHull::mutateToText()
view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt); view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt);
// remove ourselves // remove ourselves
//view_->owner()->dispatch(LFUN_ESCAPE); //theApp->lyxFunc().dispatch(LFUN_ESCAPE);
#endif #endif
} }

View File

@ -366,13 +366,13 @@ void LyXText::setLayout(LCursor & cur, string const & layout)
if (lyxlayout->is_environment) { if (lyxlayout->is_environment) {
// move everything in a new environment inset // move everything in a new environment inset
lyxerr[Debug::DEBUG] << "setting layout " << layout << endl; lyxerr[Debug::DEBUG] << "setting layout " << layout << endl;
bv.owner()->dispatch(FuncRequest(LFUN_LINE_BEGIN)); theApp->lyxFunc().dispatch(FuncRequest(LFUN_LINE_BEGIN));
bv.owner()->dispatch(FuncRequest(LFUN_LINE_END_SELECT)); theApp->lyxFunc().dispatch(FuncRequest(LFUN_LINE_END_SELECT));
bv.owner()->dispatch(FuncRequest(LFUN_CUT)); theApp->lyxFunc().dispatch(FuncRequest(LFUN_CUT));
InsetBase * inset = new InsetEnvironment(params, layout); InsetBase * inset = new InsetEnvironment(params, layout);
insertInset(cur, inset); insertInset(cur, inset);
//inset->edit(cur, true); //inset->edit(cur, true);
//bv.owner()->dispatch(FuncRequest(LFUN_PASTE)); //theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
return; return;
} }

View File

@ -266,7 +266,7 @@ bool doInsertInset(LCursor & cur, LyXText * text,
recordUndo(cur); recordUndo(cur);
bool gotsel = false; bool gotsel = false;
if (cur.selection()) { if (cur.selection()) {
cur.bv().owner()->dispatch(FuncRequest(LFUN_CUT)); theApp->lyxFunc().dispatch(FuncRequest(LFUN_CUT));
gotsel = true; gotsel = true;
} }
text->insertInset(cur, inset); text->insertInset(cur, inset);
@ -275,7 +275,7 @@ bool doInsertInset(LCursor & cur, LyXText * text,
inset->edit(cur, true); inset->edit(cur, true);
if (gotsel && pastesel) { if (gotsel && pastesel) {
cur.bv().owner()->dispatch(FuncRequest(LFUN_PASTE)); theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
// reset first par to default // reset first par to default
if (cur.lastpit() != 0 || cur.lastpos() != 0) { if (cur.lastpit() != 0 || cur.lastpos() != 0) {
LyXLayout_ptr const layout = LyXLayout_ptr const layout =
@ -936,16 +936,16 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
cur.posRight(); cur.posRight();
} }
else else
bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT, "\"")); theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
break; break;
} }
case LFUN_DATE_INSERT: case LFUN_DATE_INSERT:
if (cmd.argument().empty()) if (cmd.argument().empty())
bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT, theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT,
lyx::formatted_time(lyx::current_time()))); lyx::formatted_time(lyx::current_time())));
else 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())))); lyx::formatted_time(lyx::current_time(), lyx::to_utf8(cmd.argument()))));
break; break;
@ -980,7 +980,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
// we have to check this first // we have to check this first
bool paste_internally = false; bool paste_internally = false;
if (cmd.button() == mouse_button::button2 && cur.selection()) { if (cmd.button() == mouse_button::button2 && cur.selection()) {
bv->owner()->dispatch(FuncRequest(LFUN_COPY)); theApp->lyxFunc().dispatch(FuncRequest(LFUN_COPY));
paste_internally = true; paste_internally = true;
} }
@ -991,9 +991,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
// insert this // insert this
if (cmd.button() == mouse_button::button2) { if (cmd.button() == mouse_button::button2) {
if (paste_internally) if (paste_internally)
bv->owner()->dispatch(FuncRequest(LFUN_PASTE)); theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
else else
bv->owner()->dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph")); theApp->lyxFunc().dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
} }
break; break;
@ -1384,7 +1384,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_ACCENT_HUNGARIAN_UMLAUT: case LFUN_ACCENT_HUNGARIAN_UMLAUT:
case LFUN_ACCENT_CIRCLE: case LFUN_ACCENT_CIRCLE:
case LFUN_ACCENT_OGONEK: case LFUN_ACCENT_OGONEK:
bv->owner()->getLyXFunc().handleKeyFunc(cmd.action); theApp->lyxFunc().handleKeyFunc(cmd.action);
if (!cmd.argument().empty()) if (!cmd.argument().empty())
// FIXME: Are all these characters encoded in one byte in utf8? // FIXME: Are all these characters encoded in one byte in utf8?
bv->getIntl().getTransManager() bv->getIntl().getTransManager()