From ec57ed1e96f6ca1b36c094b9a0083351ac313890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 24 Apr 2001 17:33:01 +0000 Subject: [PATCH] call message more directly git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1951 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 41 +++++++-------------- src/BufferView_pimpl.C | 23 +++++------- src/ChangeLog | 16 ++++++++ src/FontLoader.C | 7 +--- src/LyXView.C | 2 +- src/WorkArea.C | 1 - src/buffer.C | 3 +- src/bufferview_funcs.C | 11 ++---- src/converter.C | 4 +- src/figureForm.C | 12 ++---- src/frontends/Liason.C | 1 - src/frontends/controllers/ControlCommand.C | 5 ++- src/frontends/controllers/ControlGraphics.C | 1 - src/frontends/controllers/ControlInclude.C | 1 - src/frontends/controllers/ControlUrl.C | 2 - src/frontends/xforms/FormMathsDelim.C | 6 +-- src/frontends/xforms/FormMathsMatrix.C | 2 +- src/frontends/xforms/FormMathsPanel.C | 2 +- src/frontends/xforms/FormPreferences.C | 2 +- src/frontends/xforms/FormRef.C | 1 - src/frontends/xforms/Menubar_pimpl.C | 2 +- src/frontends/xforms/Toolbar_pimpl.C | 2 +- src/importer.C | 5 ++- src/insets/insetinclude.C | 1 - src/insets/insetparent.C | 2 +- src/insets/insetref.C | 2 +- src/insets/insettabular.C | 2 - src/insets/insettext.C | 8 ++-- src/lyx_cb.C | 18 +++------ src/lyx_gui_misc.C | 9 ++--- src/lyxfunc.C | 38 +++++++++---------- src/lyxserver.C | 2 +- src/lyxvc.C | 2 +- src/mathed/formula.C | 25 ++++++------- src/text.C | 9 +---- src/text2.C | 5 +-- 36 files changed, 115 insertions(+), 160 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index 6db015c47c..4ca2792757 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -33,7 +33,6 @@ #include "support/lyxfunctional.h" //equal_1st_in_pair #include "language.h" #include "gettext.h" -#include "lyxfunc.h" extern BufferList bufferlist; @@ -425,8 +424,7 @@ void BufferView::insertNote() void BufferView::openStuff() { if (available()) { - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Open/Close...")); + owner()->message(_("Open/Close...")); hideCursor(); beforeChange(text); update(text, BufferView::SELECT|BufferView::FITCUR); @@ -440,8 +438,7 @@ void BufferView::openStuff() void BufferView::toggleFloat() { if (available()) { - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Open/Close...")); + owner()->message(_("Open/Close...")); hideCursor(); beforeChange(text); update(text, BufferView::SELECT|BufferView::FITCUR); @@ -455,13 +452,12 @@ void BufferView::toggleFloat() void BufferView::menuUndo() { if (available()) { - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Undo")); + owner()->message(_("Undo")); hideCursor(); beforeChange(text); update(text, BufferView::SELECT|BufferView::FITCUR); if (!text->TextUndo(this)) - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("No forther undo information")); + owner()->message(_("No forther undo information")); else update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); setState(); @@ -472,20 +468,17 @@ void BufferView::menuUndo() void BufferView::menuRedo() { if (theLockingInset()) { - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Redo not yet supported in math mode")); + owner()->message(_("Redo not yet supported in math mode")); return; } if (available()) { - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Redo")); + owner()->message(_("Redo")); hideCursor(); beforeChange(text); update(text, BufferView::SELECT|BufferView::FITCUR); if (!text->TextRedo(this)) - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("No further redo information")); + owner()->message(_("No further redo information")); else update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); setState(); @@ -586,8 +579,7 @@ void BufferView::copyEnvironment() toggleSelection(); text->ClearSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR); - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Paragraph environment type copied")); + owner()->message(_("Paragraph environment type copied")); } } @@ -596,8 +588,7 @@ void BufferView::pasteEnvironment() { if (available()) { text->pasteEnvironmentType(this); - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Paragraph environment type set")); + owner()->message(_("Paragraph environment type set")); update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); } } @@ -611,7 +602,7 @@ void BufferView::copy() toggleSelection(); text->ClearSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR); - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Copy")); + owner()->message(_("Copy")); } } @@ -622,7 +613,7 @@ void BufferView::cut() update(text, BufferView::SELECT|BufferView::FITCUR); text->CutSelection(this); update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Cut")); + owner()->message(_("Cut")); } } @@ -631,7 +622,7 @@ void BufferView::paste() { if (!available()) return; - owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Paste")); + owner()->message(_("Paste")); hideCursor(); // clear the selection @@ -677,14 +668,10 @@ void BufferView::gotoInset(std::vector const & codes, text->cursor.pos(0); if (!text->GotoNextInset(this, codes, contents)) { text->cursor = tmp; - owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("No more insets")); + owner()->message(_("No more insets")); } } else { - owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("No more insets")); + owner()->message(_("No more insets")); } } update(text, BufferView::SELECT|BufferView::FITCUR); diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index fe77ae6227..37c1640ee3 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -16,7 +16,6 @@ #include "lyxrow.h" #include "LyXView.h" #include "commandtags.h" -#include "lyxfunc.h" #include "font.h" #include "bufferview_funcs.h" #include "TextCache.h" @@ -288,8 +287,7 @@ int BufferView::Pimpl::resizeCurrentBuffer() ProhibitInput(bv_); - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Formatting document...")); + owner_->message(_("Formatting document...")); if (bv_->text) { par = bv_->text->cursor.par(); @@ -634,8 +632,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, UpdatableInset * inset = static_cast(inset_hit); selection_possible = false; owner_->updateLayoutChoice(); - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, - inset->EditMessage()); + owner_->message(inset->EditMessage()); inset->InsetButtonPress(bv_, xpos, ypos, button); inset->Edit(bv_, xpos, ypos, button); return; @@ -797,8 +794,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y, bv_->text->SetCursorParUndo(bv_->buffer()); } - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, - inset_hit->EditMessage()); + owner_->message(inset_hit->EditMessage()); if (inset_hit->Editable()==Inset::HIGHLY_EDITABLE) { // Highly editable inset, like math @@ -1213,7 +1209,7 @@ void BufferView::Pimpl::savePosition(unsigned int i) bv_->text->cursor.pos()); if (i > 0) { string const str = _("Saved bookmark") + ' ' + tostr(i); - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, str); + owner_->message(str); } } @@ -1248,7 +1244,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i) update(bv_->text, BufferView::SELECT|BufferView::FITCUR); if (i > 0) { string const str = _("Moved to bookmark") + ' ' + tostr(i); - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, str); + owner_->message(str); } } @@ -1467,8 +1463,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen) // check selected filename if (filename.empty()) { - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Canceled.")); + owner_->message(_("Canceled.")); return; } } @@ -1482,16 +1477,16 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen) // Inserts document string const s1 = _("Inserting document") + ' ' + MakeDisplayPath(filename) + " ..."; - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, s1); + owner_->message(s1); bool const res = bv_->insertLyXFile(filename); if (res) { string const str = _("Document") + ' ' + MakeDisplayPath(filename) + ' ' + _("inserted."); - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, str); + owner_->message(str); } else { string const str = _("Could not insert document") + ' ' + MakeDisplayPath(filename); - owner_->getLyXFunc()->Dispatch(LFUN_MESSAGE, str); + owner_->message(str); } } diff --git a/src/ChangeLog b/src/ChangeLog index 28a2fa36b5..206c8b995e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,21 @@ 2001-04-24 Lars Gullik Bjønnes + * call message directly through LyXView instead of through LyXFunc + * BufferView2.C: adjust + * BufferView_pimpl.C: adjust + * FontLoader.C: adjust + * buffer.C: adjust + * bufferview_funcs.C: adjust + * converter.C: adjust + * figureForm.C: adjust + * importer.C: adjust + * lyx_cb.C: adjust + * lyx_gui_misc.C: adjust + * lyxfunc.C: adjust + * lyxvc.C: adjust + * text2.C: adjust + + more files in subdirs + * lyxparagraph.h (size): move up int file (GetLayout): ditto diff --git a/src/FontLoader.C b/src/FontLoader.C index d68831a972..fde64efe09 100644 --- a/src/FontLoader.C +++ b/src/FontLoader.C @@ -23,7 +23,6 @@ #include "lyxrc.h" // lyxrc.font_* #include "BufferView.h" #include "LyXView.h" -#include "lyxfunc.h" using std::endl; @@ -246,9 +245,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, XFontStruct * fs = 0; - current_view->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE_PUSH, - _("Loading font into X-Server...")); + current_view->owner()->messagePush(_("Loading font into X-Server...")); fs = XLoadQueryFont(fl_get_display(), font.c_str()); @@ -276,7 +273,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, << "' matched by\n" << font << endl; } - current_view->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE_POP); + current_view->owner()->messagePop(); fontstruct[family][series][shape][size] = fs; return fs; diff --git a/src/LyXView.C b/src/LyXView.C index 70cca46830..8134949e34 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -23,7 +23,6 @@ #include "lyxlookup.h" #endif #include "minibuffer.h" -#include "lyxfunc.h" #include "debug.h" #include "intl.h" #include "lyxrc.h" @@ -39,6 +38,7 @@ #include "lyx_gui_misc.h" // [update,Close,Redraw]AllBufferRelatedDialogs #include "bufferview_funcs.h" // CurrentState() #include "gettext.h" +#include "lyxfunc.h" using std::endl; diff --git a/src/WorkArea.C b/src/WorkArea.C index 33be3fd150..2e7a3222ff 100644 --- a/src/WorkArea.C +++ b/src/WorkArea.C @@ -19,7 +19,6 @@ #include "debug.h" #include "support/lstrings.h" #include "LyXView.h" -#include "lyxfunc.h" #if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5) #include "lyxlookup.h" diff --git a/src/buffer.C b/src/buffer.C index 679c9636ab..0f068f40ba 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -3482,8 +3482,7 @@ int Buffer::runChktex() } Path p(path); // path to LaTeX file - users->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Running chktex...")); + users->owner()->message(_("Running chktex...")); // Remove all error insets bool const removedErrorInsets = users->removeAutoInsets(); diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 79c1165b45..10fb795b21 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -26,7 +26,6 @@ #include "lyx_cb.h" #include "language.h" #include "gettext.h" -#include "lyxfunc.h" #ifndef NEW_INSETS void Foot(BufferView * bv) @@ -72,7 +71,7 @@ void Noun(BufferView * bv) void Margin(BufferView * bv) { if (bv->available()) { - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Inserting margin note..."); + bv->owner()->message(_("Inserting margin note..."); bv->hideCursor(); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); bv->text->InsertFootnoteEnvironment(bv, LyXParagraph::MARGIN); @@ -105,7 +104,7 @@ void Melt(BufferView * bv) { if (!bv->available()) return; - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Melt")); + bv->owner()->message(_("Melt")); bv->hideCursor(); bv->beforeChange(bv->text); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); @@ -140,10 +139,8 @@ void changeDepth(BufferView * bv, LyXText * text, int decInc) if (text->inset_owner) bv->updateInset((Inset *)text->inset_owner, true); bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); - bv->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("Changed environment depth " - "(in possible range, maybe not)")); + bv->owner()->message(_("Changed environment depth " + "(in possible range, maybe not)")); } diff --git a/src/converter.C b/src/converter.C index 818c8eb81b..604e4d70f4 100644 --- a/src/converter.C +++ b/src/converter.C @@ -28,7 +28,6 @@ #include "lyx_gui_misc.h" #include "lyx_cb.h" // ShowMessage() #include "support/lyxfunctional.h" -#include "lyxfunc.h" #include "gettext.h" using std::vector; @@ -818,8 +817,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command) if (bv) { ProhibitInput(bv); - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Running LaTeX...")); + bv->owner()->message(_("Running LaTeX...")); // Remove all error insets need_redraw = bv->removeAutoInsets(); } diff --git a/src/figureForm.C b/src/figureForm.C index f51a9209d4..4f6cd05759 100644 --- a/src/figureForm.C +++ b/src/figureForm.C @@ -22,7 +22,6 @@ #include "BufferView.h" #include "lyxtext.h" #include "LyXView.h" -#include "lyxfunc.h" #include "gettext.h" extern FD_form_figure * fd_form_figure; @@ -51,15 +50,11 @@ void FigureApplyCB(FL_OBJECT *, long) if (buffer->isReadonly()) // paranoia return; - current_view->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("Inserting figure...")); + current_view->owner()->message(_("Inserting figure...")); if (fl_get_button(fd_form_figure->radio_inline)) { InsetFig * new_inset = new InsetFig(100, 20, *buffer); current_view->insertInset(new_inset); - current_view->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("Figure inserted")); + current_view->owner()->message(_("Figure inserted")); new_inset->Edit(current_view, 0, 0, 0); return; } @@ -119,8 +114,7 @@ void FigureApplyCB(FL_OBJECT *, long) current_view->insertInset(new_inset); new_inset->Edit(current_view, 0, 0, 0); current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR); - current_view->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Figure inserted")); + current_view->owner()->message(_("Figure inserted")); current_view->text->UnFreezeUndo(); current_view->setState(); } diff --git a/src/frontends/Liason.C b/src/frontends/Liason.C index fcc83da5b6..37a1f94b32 100644 --- a/src/frontends/Liason.C +++ b/src/frontends/Liason.C @@ -27,7 +27,6 @@ #include "exporter.h" #include "converter.h" #include "support/syscall.h" -#include "lyxfunc.h" using std::endl; diff --git a/src/frontends/controllers/ControlCommand.C b/src/frontends/controllers/ControlCommand.C index 45806e8ee8..1d4b5399a7 100644 --- a/src/frontends/controllers/ControlCommand.C +++ b/src/frontends/controllers/ControlCommand.C @@ -20,8 +20,8 @@ #include "ControlCommand.h" #include "buffer.h" #include "Dialogs.h" -#include "lyxfunc.h" #include "LyXView.h" +#include "lyxfunc.h" ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac) : ControlInset(lv, d), @@ -36,17 +36,20 @@ InsetCommandParams const ControlCommand::getParams(string const & arg) return params; } + InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset) { return inset.params(); } + void ControlCommand::applyParamsToInset() { inset()->setParams(params()); lv_.view()->updateInset(inset(), true); } + void ControlCommand::applyParamsNoInset() { if (action_ == LFUN_NOACTION) return; diff --git a/src/frontends/controllers/ControlGraphics.C b/src/frontends/controllers/ControlGraphics.C index 8d7acb3ad8..f5d3991142 100644 --- a/src/frontends/controllers/ControlGraphics.C +++ b/src/frontends/controllers/ControlGraphics.C @@ -20,7 +20,6 @@ #include "ControlGraphics.h" #include "buffer.h" #include "Dialogs.h" -#include "lyxfunc.h" #include "LyXView.h" #include "gettext.h" diff --git a/src/frontends/controllers/ControlInclude.C b/src/frontends/controllers/ControlInclude.C index a352fd5ea9..eef0c3d23a 100644 --- a/src/frontends/controllers/ControlInclude.C +++ b/src/frontends/controllers/ControlInclude.C @@ -18,7 +18,6 @@ #include "ControlInclude.h" #include "buffer.h" #include "Dialogs.h" -#include "lyxfunc.h" #include "LyXView.h" #include "gettext.h" diff --git a/src/frontends/controllers/ControlUrl.C b/src/frontends/controllers/ControlUrl.C index 86f942a1d5..59101761ae 100644 --- a/src/frontends/controllers/ControlUrl.C +++ b/src/frontends/controllers/ControlUrl.C @@ -22,8 +22,6 @@ #include "LyXView.h" #include "buffer.h" -#include "lyxfunc.h" - using SigC::slot; ControlUrl::ControlUrl(LyXView & lv, Dialogs & d) diff --git a/src/frontends/xforms/FormMathsDelim.C b/src/frontends/xforms/FormMathsDelim.C index 049cfb1a67..01d243649e 100644 --- a/src/frontends/xforms/FormMathsDelim.C +++ b/src/frontends/xforms/FormMathsDelim.C @@ -19,10 +19,10 @@ #include "form_maths_delim.h" #include "Dialogs.h" #include "LyXView.h" -#include "lyxfunc.h" #include "bmtable.h" #include "debug.h" #include "mathed/symbol_def.h" +#include "lyxfunc.h" #include "delim.xbm" #include "delim0.xpm" @@ -80,8 +80,8 @@ void FormMathsDelim::build() void FormMathsDelim::apply() { - int left = int(dialog_->radio_left->u_ldata); - int right= int(dialog_->radio_right->u_ldata); + int const left = int(dialog_->radio_left->u_ldata); + int const right= int(dialog_->radio_right->u_ldata); std::ostringstream ost; ost << delim_values[left] << ' ' << delim_values[right]; diff --git a/src/frontends/xforms/FormMathsMatrix.C b/src/frontends/xforms/FormMathsMatrix.C index 48a3547cd8..0c74f7541d 100644 --- a/src/frontends/xforms/FormMathsMatrix.C +++ b/src/frontends/xforms/FormMathsMatrix.C @@ -19,8 +19,8 @@ #include "form_maths_matrix.h" #include "Dialogs.h" #include "LyXView.h" -#include "lyxfunc.h" #include "Lsstream.h" +#include "lyxfunc.h" static char h_align_str[80] = "c"; static char v_align_c[] = "tcb"; diff --git a/src/frontends/xforms/FormMathsPanel.C b/src/frontends/xforms/FormMathsPanel.C index 8c4beae9cc..fffe677b2d 100644 --- a/src/frontends/xforms/FormMathsPanel.C +++ b/src/frontends/xforms/FormMathsPanel.C @@ -17,11 +17,11 @@ #include "Dialogs.h" #include "LyXView.h" -#include "lyxfunc.h" #include "FormMathsPanel.h" #include "form_maths_panel.h" #include "MathsSymbols.h" #include "debug.h" +#include "lyxfunc.h" #include "form_maths_deco.h" #include "form_maths_delim.h" diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index b7331fe47e..4d0a550f05 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -31,8 +31,8 @@ #include "form_preferences.h" #include "input_validators.h" #include "LyXView.h" -#include "language.h" #include "lyxfunc.h" +#include "language.h" #include "Dialogs.h" #include "lyxrc.h" #include "combox.h" diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 5670eca6a4..1bdec292bd 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -31,7 +31,6 @@ #include "LyXView.h" #include "buffer.h" #include "form_ref.h" -#include "lyxfunc.h" */ using std::find; diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index f18d8cdf72..c6dfb0afeb 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -19,11 +19,11 @@ #include "support/LAssert.h" #include "debug.h" #include "LyXAction.h" -#include "lyxfunc.h" #include "kbmap.h" #include "buffer.h" #include "Dialogs.h" #include "LyXView.h" +#include "lyxfunc.h" #include "MenuBackend.h" #include "Menubar_pimpl.h" #include "gettext.h" diff --git a/src/frontends/xforms/Toolbar_pimpl.C b/src/frontends/xforms/Toolbar_pimpl.C index 8ba8157795..d40dd171b6 100644 --- a/src/frontends/xforms/Toolbar_pimpl.C +++ b/src/frontends/xforms/Toolbar_pimpl.C @@ -20,9 +20,9 @@ #endif #include "Toolbar_pimpl.h" -#include "lyxfunc.h" #include "debug.h" #include "LyXView.h" +#include "lyxfunc.h" #include "BufferView.h" #include "buffer.h" #include "LyXAction.h" diff --git a/src/importer.C b/src/importer.C index e331f6670f..1f6d770257 100644 --- a/src/importer.C +++ b/src/importer.C @@ -20,6 +20,7 @@ #include "converter.h" #include "LyXView.h" #include "lyxfunc.h" + #include "bufferlist.h" #include "support/filetools.h" #include "lyx_gui_misc.h" //WriteAlert @@ -37,7 +38,7 @@ bool Importer::Import(LyXView * lv, string const & filename, { string const displaypath = MakeDisplayPath(filename); string const s1 = _("Importing") + ' ' + displaypath + "..."; - lv->getLyXFunc()->Dispatch(LFUN_MESSAGE, s1); + lv->message(s1); string const lyxfile = ChangeExtension(filename, ".lyx"); @@ -79,7 +80,7 @@ bool Importer::Import(LyXView * lv, string const & filename, } // we are done - lv->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("imported.")); + lv->message(_("imported.")); return true; } diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 52fbee7f33..bdfcd6a28d 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -20,7 +20,6 @@ #include "gettext.h" #include "support/FileInfo.h" #include "layout.h" -#include "lyxfunc.h" using std::ostream; using std::endl; diff --git a/src/insets/insetparent.C b/src/insets/insetparent.C index 128ee44b04..9ad0f61bbb 100644 --- a/src/insets/insetparent.C +++ b/src/insets/insetparent.C @@ -21,10 +21,10 @@ #include "support/filetools.h" #include "BufferView.h" #include "LyXView.h" -#include "lyxfunc.h" #include "commandtags.h" #include "buffer.h" #include "gettext.h" +#include "lyxfunc.h" using std::ostream; diff --git a/src/insets/insetref.C b/src/insets/insetref.C index aa43f91640..cdc3caf9bd 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -10,9 +10,9 @@ #include "debug.h" #include "gettext.h" #include "LaTeXFeatures.h" -#include "lyxfunc.h" #include "LyXView.h" #include "frontends/Dialogs.h" +#include "lyxfunc.h" using std::ostream; diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 9d82bafcc1..8cb1c1310f 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -30,11 +30,9 @@ #include "lyxtext.h" #include "lyx_gui_misc.h" #include "LyXView.h" -#include "lyxfunc.h" #include "insets/insettext.h" #include "frontends/Dialogs.h" #include "debug.h" -#include "lyxfunc.h" #include "WorkArea.h" #include "gettext.h" #include "language.h" diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 6262480911..18c39ca006 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -46,7 +46,6 @@ #include "trans_mgr.h" #include "lyxscreen.h" #include "WorkArea.h" -#include "lyxfunc.h" #include "gettext.h" using std::ostream; @@ -1099,8 +1098,8 @@ InsetText::LocalDispatch(BufferView * bv, // and current buffer's textclass (number). */ LyXTextClassList::ClassList::size_type tclass = bv->buffer()->params.textclass; - std::pair layout = - textclasslist.NumberOfLayout(tclass, arg); + std::pair layout = + textclasslist.NumberOfLayout(tclass, arg); // If the entry is obsolete, use the new one instead. if (layout.first) { @@ -1113,8 +1112,7 @@ InsetText::LocalDispatch(BufferView * bv, // see if we found the layout number: if (!layout.first) { string const msg = string(N_("Layout ")) + arg + N_(" not known"); - bv->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, msg); + bv->owner()->message(msg); break; } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 183ce46de2..9f4c5e04de 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -32,7 +32,6 @@ #include "support/filetools.h" #include "support/path.h" #include "support/syscall.h" -#include "lyxfunc.h" #include "gettext.h" using std::vector; @@ -117,8 +116,7 @@ void ShowMessage(Buffer const * buf, { if (lyxrc.use_gui) { string const str = msg1 + ' ' + msg2 + ' ' + msg3; - buf->getUser()->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - str); + buf->getUser()->owner()->message(str); } else lyxerr << msg1 << msg2 << msg3 << endl; } @@ -317,9 +315,7 @@ void AutoSave(BufferView * bv) return; } - bv->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("Autosaving current document...")); + bv->owner()->message(_("Autosaving current document...")); // create autosave filename string fname = OnlyPath(bv->buffer()->fileName()); @@ -359,9 +355,7 @@ void AutoSave(BufferView * bv) // It is dangerous to do this in the child, // but safe in the parent, so... if (pid == -1) - bv->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("Autosave Failed!")); + bv->owner()->message(_("Autosave Failed!")); } } if (pid == 0) { // we are the child so... @@ -573,16 +567,14 @@ void MenuLayoutSave(BufferView * bv) // reconfigure the automatic settings. void Reconfigure(BufferView * bv) { - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Running configure...")); + bv->owner()->message(_("Running configure...")); // Run configure in user lyx directory Path p(user_lyxdir); Systemcalls one(Systemcalls::System, AddName(system_lyxdir, "configure")); p.pop(); - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, - _("Reloading configuration...")); + bv->owner()->message(_("Reloading configuration...")); lyxrc.read(LibFileSearch(string(), "lyxrc.defaults")); WriteAlert(_("The system has been reconfigured."), _("You need to restart LyX to make use of any"), diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index e0762cd6a7..ff80186813 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -29,7 +29,6 @@ #include "bufferview_funcs.h" #include "support/filetools.h" #include "lyxrc.h" -#include "lyxfunc.h" using std::pair; using std::make_pair; @@ -139,14 +138,14 @@ char const * flyx_ident_extract(char const * sc) // void WriteAlert(string const & s1, string const & s2, string const & s3) { - LyXFunc * lfun = 0; + LyXView * lview = 0; if (current_view && current_view->owner()) - lfun = current_view->owner()->getLyXFunc(); - if (lfun) { + lview = current_view->owner(); + if (lview) { /// Write to minibuffer ProhibitInput(current_view); string const msg = s1 + ' ' + s2 + ' ' + s3; - lfun->Dispatch(LFUN_MESSAGE, msg); + lview->message(msg); fl_set_resource("flAlert.dismiss.label", _("Dismiss")); fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0); AllowInput(current_view); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 222b805eef..39fa6c68d0 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1604,7 +1604,7 @@ void LyXFunc::MenuNew(bool fromTemplate) _("newfile")); if (result.second.empty()) { - Dispatch(LFUN_MESSAGE, _("Canceled.")); + owner->message(_("Canceled.")); lyxerr.debug() << "New Document Cancelled." << endl; return; } @@ -1631,7 +1631,7 @@ void LyXFunc::MenuNew(bool fromTemplate) owner->view()->buffer(bufferlist.getBuffer(s)); return; case 3: // Cancel: Do nothing - Dispatch(LFUN_MESSAGE, _("Canceled.")); + owner->message(_("Canceled.")); return; } } @@ -1643,14 +1643,14 @@ void LyXFunc::MenuNew(bool fromTemplate) MakeDisplayPath(s, 50), _("Do you want to open the document?"))) { // loads document - Dispatch(LFUN_MESSAGE, _("Opening document") - + ' ' + MakeDisplayPath(s) + "..."); + owner->message(_("Opening document") + ' ' + + MakeDisplayPath(s) + "..."); XFlush(fl_get_display()); owner->view()->buffer( bufferlist.loadLyXFile(s)); - Dispatch(LFUN_MESSAGE, _("Document") - + ' ' + MakeDisplayPath(s) + ' ' - + _("opened.")); + owner->message(_("Document") + ' ' + + MakeDisplayPath(s) + ' ' + + _("opened.")); return; } } @@ -1729,7 +1729,7 @@ void LyXFunc::Open(string const & fname) // check selected filename if (filename.empty()) { - Dispatch(LFUN_MESSAGE, _("Canceled.")); + owner->message(_("Canceled.")); return; } } else @@ -1742,19 +1742,17 @@ void LyXFunc::Open(string const & fname) filename += ".lyx"; // loads document - Dispatch(LFUN_MESSAGE, - _("Opening document") + ' ' - + MakeDisplayPath(filename) + "..."); + owner->message(_("Opening document") + ' ' + + MakeDisplayPath(filename) + "..."); Buffer * openbuf = bufferlist.loadLyXFile(filename); if (openbuf) { owner->view()->buffer(openbuf); - Dispatch(LFUN_MESSAGE, - _("Document") + ' ' - + MakeDisplayPath(filename) + ' ' + _("opened.")); + owner->message(_("Document") + ' ' + + MakeDisplayPath(filename) + + ' ' + _("opened.")); } else { - Dispatch(LFUN_MESSAGE, - _("Could not open document") + ' ' - + MakeDisplayPath(filename)); + owner->message(_("Could not open document") + ' ' + + MakeDisplayPath(filename)); } } @@ -1801,7 +1799,7 @@ void LyXFunc::doImport(string const & argument) // check selected filename if (filename.empty()) - Dispatch(LFUN_MESSAGE, _("Canceled.")); + owner->message(_("Canceled.")); } // still no filename? abort @@ -1829,7 +1827,7 @@ void LyXFunc::doImport(string const & argument) owner->view()->buffer(bufferlist.getBuffer(lyxfile)); return; case 3: // Cancel: Do nothing - Dispatch(LFUN_MESSAGE, _("Canceled.")); + owner->message(_("Canceled.")); return; } } @@ -1839,7 +1837,7 @@ void LyXFunc::doImport(string const & argument) if (f.exist() && !AskQuestion(_("A document by the name"), MakeDisplayPath(lyxfile), _("already exists. Overwrite?"))) { - Dispatch(LFUN_MESSAGE, _("Canceled")); + owner->message(_("Canceled")); return; } // filename should be valid now diff --git a/src/lyxserver.C b/src/lyxserver.C index 395ecb8b79..ab777168f4 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -50,10 +50,10 @@ #endif #include "lyxserver.h" -#include "lyxfunc.h" #include "lyx_main.h" #include "debug.h" #include "LyXAction.h" +#include "lyxfunc.h" #include "support/lstrings.h" #include "support/lyxlib.h" diff --git a/src/lyxvc.C b/src/lyxvc.C index eae96b08e9..11946528e2 100644 --- a/src/lyxvc.C +++ b/src/lyxvc.C @@ -15,8 +15,8 @@ #include "gettext.h" #include "support/filetools.h" #include "support/lyxlib.h" -#include "lyxfunc.h" #include "LyXView.h" +#include "lyxfunc.h" using std::endl; using std::pair; diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 0ab0ea917e..6da33f51a8 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -45,7 +45,6 @@ #include "math_spaceinset.h" #include "math_deliminset.h" #include "mathed/support.h" -#include "lyxfunc.h" using std::ostream; using std::istream; @@ -859,7 +858,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, case LFUN_GREEK: if (!greek_kb_flag) { greek_kb_flag = 1; - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Math greek mode on")); + bv->owner()->message(_("Math greek mode on")); } else greek_kb_flag = 0; break; @@ -868,9 +867,9 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, case LFUN_GREEK_TOGGLE: greek_kb_flag = (greek_kb_flag) ? 0 : 2; if (greek_kb_flag) - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Math greek keyboard on")); + bv->owner()->message(_("Math greek keyboard on")); else - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Math greek keyboard off")); + bv->owner()->message(_("Math greek keyboard off")); break; // Math fonts @@ -884,7 +883,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, case LFUN_TEX: // varcode = LM_TC_TEX; mathcursor->setLastCode(LM_TC_TEX); - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("TeX mode")); + bv->owner()->message(_("TeX mode")); break; case LFUN_MATH_NUMBER: @@ -901,10 +900,10 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, label_.erase(); } */ - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("No number")); + bv->owner()->message(_("No number")); } else { ++type; - bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("Number")); + bv->owner()->message(_("Number")); } par->SetType(type); // Andre: @@ -1115,8 +1114,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, // Invalid actions under math mode case LFUN_MATH_MODE: if (mathcursor->getLastCode()!= LM_TC_TEXTRM) { - bv->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, _("math text mode")); + bv->owner()->message(_("math text mode")); varcode = LM_TC_TEXTRM; } else { varcode = LM_TC_VAR; @@ -1125,9 +1123,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, break; case LFUN_UNDO: - bv->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("Invalid action in math mode!")); + bv->owner()->message(_("Invalid action in math mode!")); break; //------- dummy actions @@ -1246,7 +1242,10 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action, if (was_macro) mathcursor->MacroModeClose(); // This line nukes the mathcursor. Why? - //bv->owner()->getLyXFunc()->Dispatch(LFUN_MESSAGE, _("TeX mode")); +#ifdef WITH_WARNINGS +#warning Still? (Lgb) +#endif + bv->owner()->message(_("TeX mode")); mathcursor->setLastCode(LM_TC_TEX); } // Andre: diff --git a/src/text.C b/src/text.C index a62e653344..1dca2666d9 100644 --- a/src/text.C +++ b/src/text.C @@ -33,7 +33,6 @@ #include "lyxscreen.h" #include "bufferview_funcs.h" #include "language.h" -#include "lyxfunc.h" using std::max; using std::min; @@ -2110,13 +2109,9 @@ void LyXText::InsertChar(BufferView * bview, char c) #endif )) { if (cursor.pos() == 0 ) - bview->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial.")); + bview->owner()->message(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial.")); else - bview->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("You cannot type two spaces this way. Please read the Tutorial.")); + bview->owner()->message(_("You cannot type two spaces this way. Please read the Tutorial.")); charInserted(); return; } diff --git a/src/text2.C b/src/text2.C index cd242053e1..c8bb54bd07 100644 --- a/src/text2.C +++ b/src/text2.C @@ -42,7 +42,6 @@ #include "lyxrc.h" #include "FloatList.h" #include "language.h" -#include "lyxfunc.h" using std::copy; using std::find; @@ -1322,9 +1321,7 @@ void LyXText::ToggleFree(BufferView * bview, // If the mask is completely neutral, tell user if (font == LyXFont(LyXFont::ALL_IGNORE)) { // Could only happen with user style - bview->owner()->getLyXFunc() - ->Dispatch(LFUN_MESSAGE, - _("No font change defined. Use Character under the Layout menu to define font change.")); + bview->owner()->message(_("No font change defined. Use Character under the Layout menu to define font change.")); return; }