From c10dfd15cd79499dd23f161d8f1716c00a143e09 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 13 Aug 2002 14:40:38 +0000 Subject: [PATCH] * LyXView: the accessor methods now return a reference to the member variables, not a pointer. * WordLangTuple: you can forward-declare a return type you know ;-) * Qt: get it to compile again, having broken it yesterday. * Everything else? See above. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4957 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.h | 2 +- src/BufferView2.C | 5 +- src/BufferView_pimpl.C | 86 +++++++++---------- src/ChangeLog | 31 +++++++ src/SpellBase.h | 3 +- src/WordLangTuple.h | 5 +- src/buffer.C | 2 +- src/converter.C | 2 +- src/frontends/ChangeLog | 8 ++ src/frontends/LyXView.C | 38 ++------ src/frontends/LyXView.h | 44 ++++++---- src/frontends/controllers/ChangeLog | 11 ++- .../controllers/ControlConnections.C | 4 +- .../controllers/ControlSpellchecker.h | 1 - src/frontends/controllers/ControlTexinfo.C | 2 +- src/frontends/qt2/ChangeLog | 12 +++ src/frontends/qt2/FileDialog_private.C | 2 +- src/frontends/qt2/Menubar_pimpl.C | 4 +- src/frontends/qt2/Qt2Base.h | 2 +- src/frontends/qt2/QtView.C | 2 +- src/frontends/qt2/Toolbar_pimpl.C | 8 +- src/frontends/qt2/lyx_gui.C | 4 +- src/frontends/xforms/ChangeLog | 14 +++ src/frontends/xforms/FileDialog.C | 2 +- src/frontends/xforms/FormMathsDelim.C | 2 +- src/frontends/xforms/FormMathsMatrix.C | 2 +- src/frontends/xforms/FormMathsPanel.C | 22 ++--- src/frontends/xforms/FormPreferences.C | 10 +-- src/frontends/xforms/Menubar_pimpl.C | 6 +- src/frontends/xforms/Toolbar_pimpl.C | 8 +- src/frontends/xforms/XFormsView.C | 4 +- src/frontends/xforms/lyx_gui.C | 4 +- src/importer.C | 2 +- src/insets/ChangeLog | 37 ++++++++ src/insets/inset.C | 22 +++-- src/insets/inset.h | 5 +- src/insets/insetbib.C | 4 +- src/insets/insetcite.C | 2 +- src/insets/insetcollapsable.C | 18 ++-- src/insets/insetcollapsable.h | 8 +- src/insets/inseterror.C | 2 +- src/insets/insetert.C | 27 +++--- src/insets/insetert.h | 3 +- src/insets/insetexternal.C | 2 +- src/insets/insetfloat.C | 2 +- src/insets/insetfloatlist.C | 2 +- src/insets/insetgraphics.C | 2 +- src/insets/insetinclude.C | 2 +- src/insets/insetindex.C | 2 +- src/insets/insetminipage.C | 2 +- src/insets/insetparent.C | 2 +- src/insets/insetref.C | 4 +- src/insets/insettabular.C | 44 +++++----- src/insets/insettabular.h | 6 +- src/insets/insettext.C | 44 +++++----- src/insets/insettext.h | 5 +- src/insets/insettoc.C | 2 +- src/insets/inseturl.C | 2 +- src/ispell.C | 1 + src/lyxfunc.C | 58 ++++++------- src/lyxtext.h | 4 +- src/lyxvc.C | 4 +- src/mathed/ChangeLog | 10 +++ src/mathed/formulabase.C | 12 +-- src/mathed/math_inset.C | 4 +- src/mathed/math_inset.h | 4 +- src/mathed/ref_inset.C | 2 +- src/pspell.C | 1 + src/text.C | 5 +- src/toc.C | 2 +- src/vc-backend.C | 14 +-- 71 files changed, 422 insertions(+), 304 deletions(-) diff --git a/src/BufferView.h b/src/BufferView.h index 5f1f8fc25e..454dab6cf8 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -18,7 +18,6 @@ #include "undo.h" #include "insets/inset.h" -#include "WordLangTuple.h" #include @@ -30,6 +29,7 @@ class LyXScreen; class Language; class Painter; class UpdatableInset; +class WordLangTuple; /// class BufferView : boost::noncopyable { diff --git a/src/BufferView2.C b/src/BufferView2.C index b32045a32f..f555045e72 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -25,6 +25,7 @@ #include "debug.h" #include "iterators.h" #include "lyxlex.h" +#include "WordLangTuple.h" #include "frontends/Alert.h" #include "frontends/Dialogs.h" @@ -612,13 +613,13 @@ int BufferView::unlockInset(UpdatableInset * inset) // make sure we update the combo ! owner()->setLayout(getLyXText()->cursor.par()->layout()->name()); // Tell the paragraph dialog that we changed paragraph - owner()->getDialogs()->updateParagraph(); + owner()->getDialogs().updateParagraph(); finishUndo(); return 0; } else if (inset && theLockingInset() && theLockingInset()->unlockInsetInInset(this, inset)) { // Tell the paragraph dialog that we changed paragraph - owner()->getDialogs()->updateParagraph(); + owner()->getDialogs().updateParagraph(); // owner inset has updated the layout combo finishUndo(); return 0; diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index d0e77c5d1f..866e32c607 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -238,10 +238,10 @@ void BufferView::Pimpl::buffer(Buffer * b) // Similarly, buffer-dependent dialogs should be updated or // hidden. This should go here because some dialogs (eg ToC) // require bv_->text. - owner_->getDialogs()->updateBufferDependent(true); + owner_->getDialogs().updateBufferDependent(true); } else { lyxerr[Debug::INFO] << " No Buffer!" << endl; - owner_->getDialogs()->hideBufferDependent(); + owner_->getDialogs().hideBufferDependent(); // Also remove all remaining text's from the testcache. // (there should not be any!) (if there is any it is a @@ -274,7 +274,7 @@ bool BufferView::Pimpl::fitCursor() ret = screen().fitCursor(bv_->text, bv_); } - bv_->owner()->getDialogs()->updateParagraph(); + bv_->owner()->getDialogs().updateParagraph(); if (ret) updateScrollbar(); return ret; @@ -447,7 +447,7 @@ int BufferView::Pimpl::scroll(long time) void BufferView::Pimpl::workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state) { - bv_->owner()->getLyXFunc()->processKeySym(key, state); + bv_->owner()->getLyXFunc().processKeySym(key, state); } @@ -545,7 +545,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, // we have to check this first bool paste_internally = false; if (button == mouse_button::button2 && bv_->getLyXText()->selection.set()) { - owner_->getLyXFunc()->dispatch(LFUN_COPY); + owner_->getLyXFunc().dispatch(LFUN_COPY); paste_internally = true; } @@ -616,9 +616,9 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, // insert this if (button == mouse_button::button2) { if (paste_internally) - owner_->getLyXFunc()->dispatch(LFUN_PASTE); + owner_->getLyXFunc().dispatch(LFUN_PASTE); else - owner_->getLyXFunc()->dispatch(FuncRequest(LFUN_PASTESELECTION, "paragraph")); + owner_->getLyXFunc().dispatch(FuncRequest(LFUN_PASTESELECTION, "paragraph")); selection_possible = false; return; } @@ -1272,11 +1272,11 @@ void BufferView::Pimpl::switchKeyMap() && !(bv_->theLockingInset() && bv_->theLockingInset()->lyxCode()== Inset::ERT_CODE)) { - if (owner_->getIntl()->keymap == Intl::PRIMARY) - owner_->getIntl()->KeyMapSec(); + if (owner_->getIntl().keymap == Intl::PRIMARY) + owner_->getIntl().KeyMapSec(); } else { - if (owner_->getIntl()->keymap == Intl::SECONDARY) - owner_->getIntl()->KeyMapPrim(); + if (owner_->getIntl().keymap == Intl::SECONDARY) + owner_->getIntl().KeyMapPrim(); } } @@ -1617,7 +1617,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) break; case LFUN_FREE: - owner_->getDialogs()->setUserFreeFont(); + owner_->getDialogs().setUserFreeFont(); break; case LFUN_FILE_INSERT: @@ -1643,7 +1643,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) // function list/array with information about what // functions needs arguments and their type. if (ev.argument.empty()) { - owner_->getLyXFunc()->setErrorMessage( + owner_->getLyXFunc().setErrorMessage( _("LyX function 'layout' needs an argument.")); break; } @@ -1661,7 +1661,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) } if (!hasLayout) { - owner_->getLyXFunc()->setErrorMessage( + owner_->getLyXFunc().setErrorMessage( string(N_("Layout ")) + ev.argument + N_(" not known")); break; @@ -1750,7 +1750,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) break; case LFUN_FONT_STATE: - owner_->getLyXFunc()->setMessage(currentState(bv_)); + owner_->getLyXFunc().setMessage(currentState(bv_)); break; case LFUN_UPCASE_WORD: @@ -1823,7 +1823,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) case LFUN_REF_INSERT: if (ev.argument.empty()) { InsetCommandParams p("ref"); - owner_->getDialogs()->createRef(p.getAsString()); + owner_->getDialogs().createRef(p.getAsString()); } else { InsetCommandParams p; p.setFromString(ev.argument); @@ -1881,7 +1881,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) && lt->cursor.par()->isInset(lt->cursor.pos()) && isHighlyEditableInset(lt->cursor.par()->getInset(lt->cursor.pos()))) { Inset * tmpinset = lt->cursor.par()->getInset(lt->cursor.pos()); - owner_->getLyXFunc()->setMessage(tmpinset->editMessage()); + owner_->getLyXFunc().setMessage(tmpinset->editMessage()); if (is_rtl) tmpinset->edit(bv_, false); else @@ -1913,7 +1913,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) lt->cursor.par()->isInset(lt->cursor.pos()) && isHighlyEditableInset(lt->cursor.par()->getInset(lt->cursor.pos()))) { Inset * tmpinset = lt->cursor.par()->getInset(lt->cursor.pos()); - owner_->getLyXFunc()->setMessage(tmpinset->editMessage()); + owner_->getLyXFunc().setMessage(tmpinset->editMessage()); if (is_rtl) tmpinset->edit(bv_); else @@ -2357,14 +2357,14 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) update(lt, BufferView::SELECT | BufferView::FITCUR); - owner_->getLyXFunc()->setMessage(N_("Mark removed")); + owner_->getLyXFunc().setMessage(N_("Mark removed")); } else { beforeChange(lt); lt->selection.mark(true); update(lt, BufferView::SELECT | BufferView::FITCUR); - owner_->getLyXFunc()->setMessage(N_("Mark set")); + owner_->getLyXFunc().setMessage(N_("Mark set")); } lt->selection.cursor = lt->cursor; } @@ -2495,7 +2495,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) beforeChange(lt); update(lt, BufferView::SELECT|BufferView::FITCUR); lt->selection.cursor = lt->cursor; - owner_->getLyXFunc()->setMessage(N_("Mark off")); + owner_->getLyXFunc().setMessage(N_("Mark off")); } break; @@ -2508,7 +2508,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) lt->selection.mark(true); update(lt, BufferView::SELECT|BufferView::FITCUR); lt->selection.cursor = lt->cursor; - owner_->getLyXFunc()->setMessage(N_("Mark on")); + owner_->getLyXFunc().setMessage(N_("Mark on")); } break; @@ -2517,7 +2517,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) LyXText * lt = bv_->getLyXText(); if (!lt->selection.set()) { - if (owner_->getIntl()->getTransManager().backspace()) { + if (owner_->getIntl().getTransManager().backspace()) { lt->backspace(bv_); lt->selection.cursor = lt->cursor; update(lt, @@ -2720,7 +2720,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) p.setCmdName("htmlurl"); else p.setCmdName("url"); - owner_->getDialogs()->createUrl(p.getAsString()); + owner_->getDialogs().createUrl(p.getAsString()); } break; @@ -2818,7 +2818,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) case LFUN_TABULAR_INSERT: { if (ev.argument.empty()) { - owner_->getDialogs()->showTabularCreate(); + owner_->getDialogs().showTabularCreate(); break; } @@ -2840,15 +2840,15 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) { pos_type pos = bv_->getLyXText()->cursor.pos(); if (pos < bv_->getLyXText()->cursor.par()->size()) - owner_->getLyXFunc()->setMessage( + owner_->getLyXFunc().setMessage( tostr(bv_->getLyXText()->cursor.par()->getChar(pos))); else - owner_->getLyXFunc()->setMessage("EOF"); + owner_->getLyXFunc().setMessage("EOF"); } break; case LFUN_GETXY: - owner_->getLyXFunc()->setMessage(tostr(bv_->getLyXText()->cursor.x()) + owner_->getLyXFunc().setMessage(tostr(bv_->getLyXText()->cursor.x()) + ' ' + tostr(bv_->getLyXText()->cursor.y())); break; @@ -2866,18 +2866,18 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) break; case LFUN_GETLAYOUT: - owner_->getLyXFunc()->setMessage(tostr(bv_->getLyXText()->cursor.par()->layout())); + owner_->getLyXFunc().setMessage(tostr(bv_->getLyXText()->cursor.par()->layout())); break; case LFUN_GETFONT: { LyXFont & font = bv_->getLyXText()->current_font; if (font.shape() == LyXFont::ITALIC_SHAPE) - owner_->getLyXFunc()->setMessage("E"); + owner_->getLyXFunc().setMessage("E"); else if (font.shape() == LyXFont::SMALLCAPS_SHAPE) - owner_->getLyXFunc()->setMessage("N"); + owner_->getLyXFunc().setMessage("N"); else - owner_->getLyXFunc()->setMessage("0"); + owner_->getLyXFunc().setMessage("0"); } break; @@ -2903,10 +2903,10 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) case LFUN_OGONEK: if (ev.argument.empty()) { // As always... - owner_->getLyXFunc()->handleKeyFunc(ev.action); + owner_->getLyXFunc().handleKeyFunc(ev.action); } else { - owner_->getLyXFunc()->handleKeyFunc(ev.action); - owner_->getIntl()->getTransManager() + owner_->getLyXFunc().handleKeyFunc(ev.action); + owner_->getIntl().getTransManager() .TranslateAndInsert(ev.argument[0], bv_->getLyXText()); update(bv_->getLyXText(), BufferView::SELECT @@ -3022,7 +3022,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) } if (entry.empty()) { - owner_->getDialogs()->createIndex(); + owner_->getDialogs().createIndex(); break; } @@ -3066,7 +3066,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) delete inset; else { updateInset(inset, true); - bv_->owner()->getDialogs()->showInclude(inset); + bv_->owner()->getDialogs().showInclude(inset); } } break; @@ -3099,7 +3099,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) } } - bv_->owner()->getDialogs()->showThesaurus(arg); + bv_->owner()->getDialogs().showThesaurus(arg); } break; @@ -3132,7 +3132,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) string::const_iterator cit = ev.argument.begin(); string::const_iterator end = ev.argument.end(); for (; cit != end; ++cit) { - owner_->getIntl()->getTransManager(). + owner_->getIntl().getTransManager(). TranslateAndInsert(*cit, lt); } @@ -3182,7 +3182,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) break; case LFUN_UNKNOWN_ACTION: - owner_->getLyXFunc()->setErrorMessage(N_("Unknown function!")); + owner_->getLyXFunc().setErrorMessage(N_("Unknown function!")); break; default: @@ -3265,8 +3265,8 @@ void BufferView::Pimpl::smartQuote() if (style->pass_thru || (!insertInset(new InsetQuotes(c, bv_->buffer()->params)))) - bv_->owner()->getLyXFunc() - ->dispatch(FuncRequest(LFUN_SELFINSERT, "\"")); + bv_->owner()->getLyXFunc(). + dispatch(FuncRequest(LFUN_SELFINSERT, "\"")); } @@ -3288,7 +3288,7 @@ void BufferView::Pimpl::insertAndEditInset(Inset * inset) if (insertInset(inset)) { inset->edit(bv_); if (gotsel) - owner_->getLyXFunc()->dispatch(LFUN_PASTESELECTION); + owner_->getLyXFunc().dispatch(LFUN_PASTESELECTION); } else delete inset; diff --git a/src/ChangeLog b/src/ChangeLog index a27614c528..236dbb5cc5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,34 @@ +2002-08-13 Angus Leeming + + * BufferView2.C: + * BufferView_pimpl.C: + * buffer.C: + * converter.C: + * importer.C: + * lyxfunc.C: + * lyxvc.C: + * toc.C: + * vc-backend.C: + changes due to the changed LyXView interface that now returns references + to member variables not pointers. + +2002-08-13 Angus Leeming + + * WordLangTuple (word, lang_code): return references to strings, + not strings. + + * BufferView.h: + * SpellBase.h: + * lyxtext.h: forward-declare WordLangTuple. + + * BufferView2.C: + * ispell.C: + * pspell.C: + * text.C: #include "WordLangTuple.h". + + * lyxtext.h: + * text.C: (selectNextWordToSpellcheck): constify return type. + 2002-08-12 Martin Vermeer * buffer.C: diff --git a/src/SpellBase.h b/src/SpellBase.h index 1348c1e24c..2d5f4ddfaa 100644 --- a/src/SpellBase.h +++ b/src/SpellBase.h @@ -12,9 +12,8 @@ #include "LString.h" // can't forward declare... -#include "WordLangTuple.h" - class BufferParams; +class WordLangTuple; /** * Base class of all spell checker implementations. diff --git a/src/WordLangTuple.h b/src/WordLangTuple.h index 47343f6a4f..90fd01918f 100644 --- a/src/WordLangTuple.h +++ b/src/WordLangTuple.h @@ -9,7 +9,6 @@ #ifndef WORD_LANG_TUPLE_H #define WORD_LANG_TUPLE_H -#include #include "LString.h" /** @@ -25,12 +24,12 @@ public: {} /// return the word - string const word() const { + string const & word() const { return word_; } /// return its language code - string const lang_code() const { + string const & lang_code() const { return code_; } diff --git a/src/buffer.C b/src/buffer.C index 2167570ce2..430de7cf63 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -241,7 +241,7 @@ void Buffer::setReadonly(bool flag) if (read_only != flag) { read_only = flag; updateTitles(); - users->owner()->getDialogs()->updateBufferDependent(false); + users->owner()->getDialogs().updateBufferDependent(false); } } diff --git a/src/converter.C b/src/converter.C index 7b86dd6786..4b3bf5fe86 100644 --- a/src/converter.C +++ b/src/converter.C @@ -852,7 +852,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command) LaTeX latex(command, name, buffer->filePath()); TeXErrors terr; int result = latex.run(terr, - bv ? bv->owner()->getLyXFunc() : 0); + bv ? &bv->owner()->getLyXFunc() : 0); if (bv) { if ((result & LaTeX::ERRORS)) { diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index fb64a27cd0..061adef322 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,11 @@ +2002-08-13 Angus Leeming + + * LyXView.[Ch]: + (getLyXFunc, getToolbar, getMenubar, getDialogs, getIntl): all now + return a reference not a pointer. + (controlcommand_, intl_, autosave_timeout_): employ the + const scoped_ptr idiom. + 2002-08-12 Angus Leeming * DialogBase.h: no longer derive from boost::signals::trackable. diff --git a/src/frontends/LyXView.C b/src/frontends/LyXView.C index 2b34be2980..46b4a0d01b 100644 --- a/src/frontends/LyXView.C +++ b/src/frontends/LyXView.C @@ -45,17 +45,13 @@ string current_layout; LyXView::LyXView() + : controlcommand_(new ControlCommandBuffer(getLyXFunc())), + intl_(new Intl), + autosave_timeout_(new Timeout(5000)), + lyxfunc_(new LyXFunc(this)), + dialogs_(new Dialogs(this)) { lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl; - - lyxfunc_.reset(new LyXFunc(this)); - intl_.reset(new Intl); - - // Give the timeout some default sensible value. - autosave_timeout_.reset(new Timeout(5000)); - - dialogs_.reset(new Dialogs(this)); - controlcommand_.reset(new ControlCommandBuffer(*getLyXFunc())); } @@ -92,12 +88,6 @@ boost::shared_ptr const & LyXView::view() const } -Toolbar * LyXView::getToolbar() const -{ - return toolbar_.get(); -} - - void LyXView::setLayout(string const & layout) { toolbar_->setLayout(layout); @@ -110,30 +100,12 @@ void LyXView::updateToolbar() } -LyXFunc * LyXView::getLyXFunc() const -{ - return lyxfunc_.get(); -} - - -Menubar * LyXView::getMenubar() const -{ - return menubar_.get(); -} - - void LyXView::updateMenubar() { menubar_->update(); } -Intl * LyXView::getIntl() const -{ - return intl_.get(); -} - - void LyXView::autoSave() { lyxerr[Debug::INFO] << "Running autoSave()" << endl; diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index e41c1f02b5..dff70dad24 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -77,23 +77,33 @@ public: */ boost::shared_ptr const & view() const; - /// return the LyX function handler for this view - LyXFunc * getLyXFunc() const; - /// return the buffer currently shown in this window Buffer * buffer() const; + /// return the LyX function handler for this view + LyXFunc & getLyXFunc() { return *lyxfunc_.get(); } + /// + LyXFunc const & getLyXFunc() const { return *lyxfunc_.get(); } + /// return the toolbar for this view - Toolbar * getToolbar() const; + Toolbar & getToolbar() { return *toolbar_.get(); } + /// + Toolbar const & getToolbar() const { return *toolbar_.get(); } /// return the menubar for this view - Menubar * getMenubar() const; + Menubar & getMenubar() { return *menubar_.get(); } + /// + Menubar const & getMenubar() const { return *menubar_.get(); } /// get access to the dialogs - Dialogs * getDialogs() { return dialogs_.get(); } + Dialogs & getDialogs() { return *dialogs_.get(); } + /// + Dialogs const & getDialogs() const { return *dialogs_.get(); } /// get this view's keyboard map handler - Intl * getIntl() const; + Intl & getIntl() { return *intl_.get(); } + /// + Intl const & getIntl() const { return *intl_.get(); } //@} @@ -123,7 +133,7 @@ public: void resetAutosaveTimer(); protected: - /// view of a buffer. FuncRequestually there will be several. + /// view of a buffer. Eventtually there will be several. boost::shared_ptr bufferview_; /// view's menubar @@ -131,16 +141,7 @@ protected: /// view's toolbar boost::scoped_ptr toolbar_; /// view's command buffer controller - boost::scoped_ptr controlcommand_; - - /// keyboard mapping object - boost::scoped_ptr intl_; - - /// auto-saving of buffers - boost::scoped_ptr autosave_timeout_; - - /// called on timeout - void autoSave(); + boost::scoped_ptr const controlcommand_; private: /** @@ -150,6 +151,13 @@ private: */ virtual void setWindowTitle(string const & t, string const & it) = 0; + /// called on timeout + void autoSave(); + + /// keyboard mapping object + boost::scoped_ptr const intl_; + /// auto-saving of buffers + boost::scoped_ptr const autosave_timeout_; /// our function handler boost::scoped_ptr lyxfunc_; /// dialogs for this view diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 3fa784d00e..8a84487c38 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,10 @@ +2002-08-13 Angus Leeming + + * ControlConnections.C: + * ControlTexinfo.C: + changes due to the changed LyXView interface that now returns references + to member variables not pointers. + 2002-08-12 Angus Leeming * ControlConnections.[Ch]: (isReadonly): renamed as bufferIsReadonly. @@ -50,7 +57,7 @@ * ControlSpellchecker.C: some cleanups * ControlTabularCreate.C: s/LFUN_INSET_TABULAR/LFUN_TABULAR_INSERT/ - + < 2002-08-02 Edwin Leuven * ControlParagraph.[Ch] (changedParagraph): new method invoked when @@ -68,7 +75,7 @@ 2002-08-01 John Levon * ControlSendto.C: writeFile() change - + 2002-08-01 John Levon * ControlSpellchecker.h: diff --git a/src/frontends/controllers/ControlConnections.C b/src/frontends/controllers/ControlConnections.C index 94cb89091d..0f99ed0641 100644 --- a/src/frontends/controllers/ControlConnections.C +++ b/src/frontends/controllers/ControlConnections.C @@ -95,13 +95,13 @@ Buffer const * ControlConnectBase::buffer() const LyXFunc & ControlConnectBase::lyxfunc() { - return *lv_.getLyXFunc(); + return lv_.getLyXFunc(); } LyXFunc const & ControlConnectBase::lyxfunc() const { - return *lv_.getLyXFunc(); + return lv_.getLyXFunc(); } diff --git a/src/frontends/controllers/ControlSpellchecker.h b/src/frontends/controllers/ControlSpellchecker.h index 65a515f12a..71fb6bcd62 100644 --- a/src/frontends/controllers/ControlSpellchecker.h +++ b/src/frontends/controllers/ControlSpellchecker.h @@ -98,7 +98,6 @@ private: /// The actual spellchecker object SpellBase * speller_; - }; #endif // CONTROLSPELLCHECKER_H diff --git a/src/frontends/controllers/ControlTexinfo.C b/src/frontends/controllers/ControlTexinfo.C index ac8faf1d60..46b4c46789 100644 --- a/src/frontends/controllers/ControlTexinfo.C +++ b/src/frontends/controllers/ControlTexinfo.C @@ -86,7 +86,7 @@ ControlTexinfo::getContents(texFileSuffix type, bool withFullPath) const void ControlTexinfo::viewFile(string const filename) const { - lv_.getDialogs()->showFile(filename); + lv_.getDialogs().showFile(filename); } diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 968a020d56..be32813b13 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,15 @@ +2002-08-13 Angus Leeming + + * Qt2Base.h: compile fix isReadonly -> bufferIsReadonly. + + * FileDialog_private.C: + * Menubar_pimpl.C: + * Toolbar_pimpl.C: + * QtView.C: + * lyx_gui.C: + changes due to the changed LyXView interface that now returns references + to member variables not pointers. + 2002-08-12 Angus Leeming * Menubar_pimpl.C: no need to #include "Dialogs.h". Remove semi-colon diff --git a/src/frontends/qt2/FileDialog_private.C b/src/frontends/qt2/FileDialog_private.C index 4b97afdee2..03942dfa9e 100644 --- a/src/frontends/qt2/FileDialog_private.C +++ b/src/frontends/qt2/FileDialog_private.C @@ -39,7 +39,7 @@ void LyXFileDialog::done(int what) } if (what == QDialog::Accepted) - lv_->getLyXFunc()->dispatch(FuncRequest(action_, selectedFile().data())); + lv_->getLyXFunc().dispatch(FuncRequest(action_, selectedFile().data())); delete this; } diff --git a/src/frontends/qt2/Menubar_pimpl.C b/src/frontends/qt2/Menubar_pimpl.C index 998b0ed9f7..e62242f2e4 100644 --- a/src/frontends/qt2/Menubar_pimpl.C +++ b/src/frontends/qt2/Menubar_pimpl.C @@ -123,7 +123,7 @@ void Menubar::Pimpl::updateSubmenu(MenuItemInfo const & i) for (; m != end; ++m) { if (m->action() > 0) { FuncStatus const status = - owner_->getLyXFunc()->getStatus(m->action()); + owner_->getLyXFunc().getStatus(m->action()); if (!status.disabled()) enable = true; } @@ -146,7 +146,7 @@ void Menubar::Pimpl::updateItem(MenuItemInfo const & i) if (i.id_ < 0) return; - FuncStatus const status = owner_->getLyXFunc()->getStatus(i.id_); + FuncStatus const status = owner_->getLyXFunc().getStatus(i.id_); i.parent_->setItemEnabled(i.id_, !status.disabled()); i.parent_->setItemChecked(i.id_, status.onoff(true)); } diff --git a/src/frontends/qt2/Qt2Base.h b/src/frontends/qt2/Qt2Base.h index 640a043ced..3bea0caaef 100644 --- a/src/frontends/qt2/Qt2Base.h +++ b/src/frontends/qt2/Qt2Base.h @@ -160,7 +160,7 @@ class Qt2CB: public Base { public: bool readOnly() const { - return controller().isReadonly(); + return controller().bufferIsReadonly(); } protected: diff --git a/src/frontends/qt2/QtView.C b/src/frontends/qt2/QtView.C index 086c775d52..0cb50062d9 100644 --- a/src/frontends/qt2/QtView.C +++ b/src/frontends/qt2/QtView.C @@ -123,7 +123,7 @@ void QtView::update_view_state() void QtView::activated(int id) { - getLyXFunc()->dispatch(id, true); + getLyXFunc().dispatch(id, true); } diff --git a/src/frontends/qt2/Toolbar_pimpl.C b/src/frontends/qt2/Toolbar_pimpl.C index 68e8cd5e85..188590cff5 100644 --- a/src/frontends/qt2/Toolbar_pimpl.C +++ b/src/frontends/qt2/Toolbar_pimpl.C @@ -116,7 +116,7 @@ void Toolbar::Pimpl::update() int action = p->second; FuncStatus const status = - owner_->getLyXFunc()->getStatus(action); + owner_->getLyXFunc().getStatus(action); button->setToggleButton(true); button->setOn(status.onoff(true)); @@ -124,7 +124,7 @@ void Toolbar::Pimpl::update() } if (combo_) - combo_->setEnabled(!owner_->getLyXFunc()->getStatus(LFUN_LAYOUT).disabled()); + combo_->setEnabled(!owner_->getLyXFunc().getStatus(LFUN_LAYOUT).disabled()); } @@ -137,7 +137,7 @@ void Toolbar::Pimpl::button_selected(QToolButton * button) return; } - owner_->getLyXFunc()->dispatch(cit->second, true); + owner_->getLyXFunc().dispatch(cit->second, true); } @@ -150,7 +150,7 @@ void Toolbar::Pimpl::changed_layout(string const & sel) for (LyXTextClass::const_iterator cit = tc.begin(); cit != end; ++cit) { if (_((*cit)->name()) == sel) { - owner_->getLyXFunc()->dispatch(FuncRequest(LFUN_LAYOUT, (*cit)->name())); + owner_->getLyXFunc().dispatch(FuncRequest(LFUN_LAYOUT, (*cit)->name())); return; } } diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index acb9e932cb..b0d3b460e3 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -89,7 +89,7 @@ void lyx_gui::start(string const & batch, vector files) // FIXME: some code below needs moving - lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes); + lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes); vector::const_iterator cit = files.begin(); vector::const_iterator end = files.end(); @@ -107,7 +107,7 @@ void lyx_gui::start(string const & batch, vector files) // handle the batch commands the user asked for if (!batch.empty()) { - view.getLyXFunc()->dispatch(batch); + view.getLyXFunc().dispatch(batch); } qApp->exec(); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index f927cc22e8..5f0cc7530d 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,17 @@ +2002-08-13 Angus Leeming + + * FileDialog.C: + * FormMathsDelim.C: + * FormMathsMatrix.C: + * FormMathsPanel.C: + * FormPreferences.C: + * Menubar_pimpl.C: + * Toolbar_pimpl.C: + * XFormsView.C: + * lyx_gui.C: + changes due to the changed LyXView interface that now returns references + to member variables not pointers. + 2002-08-13 Jean-Marc Lasgouttes * Menubar_pimpl.C (create_submenu): fix code to disable submenu diff --git a/src/frontends/xforms/FileDialog.C b/src/frontends/xforms/FileDialog.C index 0678fd7472..56c9c1914b 100644 --- a/src/frontends/xforms/FileDialog.C +++ b/src/frontends/xforms/FileDialog.C @@ -33,7 +33,7 @@ using std::endl; FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2) : private_(0), lv_(lv), title_(t), success_(s) { - private_ = new FileDialog::Private(*lv->getDialogs()); + private_ = new FileDialog::Private(lv->getDialogs()); private_->SetButton(0, b1.first, b1.second); private_->SetButton(1, b2.first, b2.second); diff --git a/src/frontends/xforms/FormMathsDelim.C b/src/frontends/xforms/FormMathsDelim.C index 99c3873b88..015819245e 100644 --- a/src/frontends/xforms/FormMathsDelim.C +++ b/src/frontends/xforms/FormMathsDelim.C @@ -93,7 +93,7 @@ void FormMathsDelim::apply() ostringstream ost; ost << delim_values[left] << ' ' << delim_values[right]; - lv_->getLyXFunc()-> + lv_->getLyXFunc(). dispatch(FuncRequest(LFUN_MATH_DELIM, ost.str().c_str()), false); } diff --git a/src/frontends/xforms/FormMathsMatrix.C b/src/frontends/xforms/FormMathsMatrix.C index 84de53f1a2..77ebb6a4c7 100644 --- a/src/frontends/xforms/FormMathsMatrix.C +++ b/src/frontends/xforms/FormMathsMatrix.C @@ -100,7 +100,7 @@ void FormMathsMatrix::apply() ostringstream ost; ost << nx << ' ' << ny << ' ' << c << ' ' << sh; - lv_->getLyXFunc()-> + lv_->getLyXFunc(). dispatch(FuncRequest(LFUN_INSERT_MATRIX, ost.str().c_str())); } diff --git a/src/frontends/xforms/FormMathsPanel.C b/src/frontends/xforms/FormMathsPanel.C index a84805b9d9..ba8e925b90 100644 --- a/src/frontends/xforms/FormMathsPanel.C +++ b/src/frontends/xforms/FormMathsPanel.C @@ -320,19 +320,19 @@ bool FormMathsPanel::input(FL_OBJECT *, long data) break; case MM_SUPER: - //lv_->getLyXFunc()->dispatch(LFUN_MATH_MODE); - lv_->getLyXFunc()->dispatch(LFUN_SUPERSCRIPT); + //lv_->getLyXFunc().dispatch(LFUN_MATH_MODE); + lv_->getLyXFunc().dispatch(LFUN_SUPERSCRIPT); break; case MM_SUB: - //lv_->getLyXFunc()->dispatch(LFUN_MATH_MODE); - lv_->getLyXFunc()->dispatch(LFUN_SUBSCRIPT); + //lv_->getLyXFunc().dispatch(LFUN_MATH_MODE); + lv_->getLyXFunc().dispatch(LFUN_SUBSCRIPT); break; case MM_SUBSUPER: - lv_->getLyXFunc()->dispatch(LFUN_SUBSCRIPT); - lv_->getLyXFunc()->dispatch(LFUN_LEFT); - lv_->getLyXFunc()->dispatch(LFUN_SUPERSCRIPT); + lv_->getLyXFunc().dispatch(LFUN_SUBSCRIPT); + lv_->getLyXFunc().dispatch(LFUN_LEFT); + lv_->getLyXFunc().dispatch(LFUN_SUPERSCRIPT); break; case MM_DELIM: @@ -382,21 +382,21 @@ bool FormMathsPanel::input(FL_OBJECT *, long data) void FormMathsPanel::insertSymbol(string const & sym, bool bs) const { if (bs) - lv_->getLyXFunc()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + sym)); + lv_->getLyXFunc().dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + sym)); else - lv_->getLyXFunc()->dispatch(FuncRequest(LFUN_INSERT_MATH, sym)); + lv_->getLyXFunc().dispatch(FuncRequest(LFUN_INSERT_MATH, sym)); } void FormMathsPanel::dispatchFunc(kb_action action) const { - lv_->getLyXFunc()->dispatch(action); + lv_->getLyXFunc().dispatch(action); } void FormMathsPanel::mathDisplay() const { - lv_->getLyXFunc()->dispatch(LFUN_MATH_DISPLAY); + lv_->getLyXFunc().dispatch(LFUN_MATH_DISPLAY); } diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index f2d4d8ec85..562ba46ac7 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -132,7 +132,7 @@ void FormPreferences::ok() colors_.modifiedXformsPrefs = !XformsColor::write(filename); } - lv_->getLyXFunc()->dispatch(LFUN_SAVEPREFERENCES); + lv_->getLyXFunc().dispatch(LFUN_SAVEPREFERENCES); } @@ -415,7 +415,7 @@ void FormPreferences::Colors::apply() setCursorColor(GUI_COLOR_CURSOR); } } - parent_.lv_->getDialogs()->redrawGUI(); + parent_.lv_->getDialogs().redrawGUI(); } // Now do the same for the LyX LColors... @@ -437,7 +437,7 @@ void FormPreferences::Colors::apply() string const s = lcolor.getLyXName(lc) + string(" ") + hexname; - parent_.lv_->getLyXFunc()->dispatch(FuncRequest(LFUN_SET_COLOR, s)); + parent_.lv_->getLyXFunc().dispatch(FuncRequest(LFUN_SET_COLOR, s)); } } } @@ -744,7 +744,7 @@ void FormPreferences::Colors::LoadBrowserLyX() << "\". Set to \"black\"!" << endl; string const arg = lcolor.getLyXName(lc) + " black"; - parent_.lv_->getLyXFunc()-> + parent_.lv_->getLyXFunc(). dispatch(FuncRequest(LFUN_SET_COLOR, arg)); continue; } @@ -2557,7 +2557,7 @@ void FormPreferences::ScreenFonts::apply() const if (changed) { // Now update the buffers // Can anything below here affect the redraw process? - parent_.lv_->getLyXFunc()->dispatch(LFUN_SCREEN_FONT_UPDATE); + parent_.lv_->getLyXFunc().dispatch(LFUN_SCREEN_FONT_UPDATE); } } diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index e4d261a39e..f430ecd050 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -232,7 +232,7 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, if (i->kind() == MenuItem::Separator) *last = "%l"; else if (!i->optional() || - !(view->getLyXFunc()->getStatus(i->action()).disabled())) + !(view->getLyXFunc().getStatus(i->action()).disabled())) last = it; it = extra_labels.begin(); @@ -258,7 +258,7 @@ int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, switch (item.kind()) { case MenuItem::Command: { FuncStatus const flag = - view->getLyXFunc()->getStatus(item.action()); + view->getLyXFunc().getStatus(item.action()); // handle optional entries. if (item.optional() && (flag.disabled())) { @@ -402,7 +402,7 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button) // If the action value is too low, then it is not a // valid action, but something else. if (choice >= action_offset + 1) { - view->getLyXFunc()->dispatch(choice - action_offset, true); + view->getLyXFunc().dispatch(choice - action_offset, true); } else { lyxerr[Debug::GUI] << "MenuCallback: ignoring bogus action " diff --git a/src/frontends/xforms/Toolbar_pimpl.C b/src/frontends/xforms/Toolbar_pimpl.C index 0e8de0e828..c6e6847276 100644 --- a/src/frontends/xforms/Toolbar_pimpl.C +++ b/src/frontends/xforms/Toolbar_pimpl.C @@ -118,7 +118,7 @@ void Toolbar::Pimpl::update() ToolbarList::const_iterator end = toollist_.end(); for (; p != end; ++p) { if (p->action == ToolbarDefaults::LAYOUTS && combox_) { - if (owner_->getLyXFunc()->getStatus(LFUN_LAYOUT).disabled()) + if (owner_->getLyXFunc().getStatus(LFUN_LAYOUT).disabled()) combox_->deactivate(); else combox_->activate(); @@ -128,7 +128,7 @@ void Toolbar::Pimpl::update() if (!p->icon) continue; - FuncStatus const status = owner_->getLyXFunc()->getStatus(p->action); + FuncStatus const status = owner_->getLyXFunc().getStatus(p->action); if (status.onoff(true)) { // I'd like to use a different color // here, but then the problem is to @@ -170,7 +170,7 @@ void Toolbar::Pimpl::layoutSelected() for (LyXTextClass::const_iterator cit = tc.begin(); cit != end; ++cit) { if (_((*cit)->name()) == layoutguiname) { - owner_->getLyXFunc()->dispatch(FuncRequest(LFUN_LAYOUT, (*cit)->name())); + owner_->getLyXFunc().dispatch(FuncRequest(LFUN_LAYOUT, (*cit)->name())); return; } } @@ -234,7 +234,7 @@ void ToolbarCB(FL_OBJECT * ob, long ac) { XFormsView * owner = static_cast(ob->u_vdata); - owner->getLyXFunc()->dispatch(int(ac), true); + owner->getLyXFunc().dispatch(int(ac), true); } diff --git a/src/frontends/xforms/XFormsView.C b/src/frontends/xforms/XFormsView.C index eeb2776c8b..00519c2978 100644 --- a/src/frontends/xforms/XFormsView.C +++ b/src/frontends/xforms/XFormsView.C @@ -67,7 +67,7 @@ XFormsView::XFormsView(int width, int height) // Make sure the buttons are disabled if needed. updateToolbar(); - redraw_con = getDialogs()->redrawGUI.connect(boost::bind(&XFormsView::redraw, this)); + redraw_con = getDialogs().redrawGUI.connect(boost::bind(&XFormsView::redraw, this)); } @@ -198,7 +198,7 @@ void XFormsView::message(string const & str) void XFormsView::show_view_state() { - message(getLyXFunc()->view_status_message()); + message(getLyXFunc().view_status_message()); } diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index 05b418dc3c..ca69abcd72 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -275,7 +275,7 @@ void lyx_gui::start(string const & batch, vector files) // FIXME: some code below needs moving - lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes); + lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes); vector::const_iterator cit = files.begin(); vector::const_iterator end = files.end(); @@ -293,7 +293,7 @@ void lyx_gui::start(string const & batch, vector files) // handle the batch commands the user asked for if (!batch.empty()) { - view.getLyXFunc()->dispatch(batch); + view.getLyXFunc().dispatch(batch); } // enter the event loop diff --git a/src/importer.C b/src/importer.C index 749ff9b19c..0bc17cc27d 100644 --- a/src/importer.C +++ b/src/importer.C @@ -78,7 +78,7 @@ bool Importer::Import(LyXView * lv, string const & filename, : ChangeExtension(filename, formats.extension(loader_format)); InsertAsciiFile(lv->view().get(), filename2, as_paragraphs); - lv->getLyXFunc()->dispatch(LFUN_MARK_OFF); + lv->getLyXFunc().dispatch(LFUN_MARK_OFF); } // we are done diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 9d399cfcb4..c48be7e51d 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,40 @@ +2002-08-13 Angus Leeming + + * insetbib.C: + * insetcite.C: + * inseterror.C: + * insetert.C: + * insetexternal.C: + * insetfloat.C: + * insetfloatlist.C: + * insetgraphics.C: + * insetinclude.C: + * insetindex.C: + * insetminipage.C: + * insetparent.C: + * insetref.C: + * insettabular.C: + * insettext.C: + * insettoc.C: + * inseturl.C: + changes due to the changed LyXView interface that now returns references + to member variables not pointers. + +2002-08-13 Angus Leeming + + * inset.h: + * insetcollapsable.h: + * insetert.h: + * insettabular.h: + * insettext.h: forward-declare WordLangTuple + (selectNextWordToSpellcheck) constify return type. + + * inset.C: + * insetcollapsable.C: + * insetert.C: + * insettabular.C: + * insettext.C: #include "WordLangTuple.h" and rearrange included files. + 2002-08-12 Angus Leeming * insetgraphicsParams.C: fix reading of lyxsize_type in 1.2.0 documents. diff --git a/src/insets/inset.C b/src/insets/inset.C index 0bc1ecb186..cb155122b7 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -15,17 +15,21 @@ #endif #include "inset.h" -#include "debug.h" + #include "BufferView.h" -#include "support/lstrings.h" +#include "debug.h" +#include "funcrequest.h" +#include "gettext.h" +#include "lyxcursor.h" +#include "lyxfont.h" +#include "lyxtext.h" +#include "WordLangTuple.h" + #include "frontends/Painter.h" #include "frontends/mouse_state.h" -#include "funcrequest.h" + +#include "support/lstrings.h" #include "support/lstrings.h" -#include "gettext.h" -#include "lyxfont.h" -#include "lyxcursor.h" -#include "lyxtext.h" using std::endl; @@ -358,8 +362,8 @@ LyXCursor const & Inset::cursor(BufferView * bv) const } -WordLangTuple UpdatableInset::selectNextWordToSpellcheck(BufferView *bv, - float & value) const +WordLangTuple const +UpdatableInset::selectNextWordToSpellcheck(BufferView *bv, float & value) const { // we have to unlock ourself in this function by default! bv->unlockInset(const_cast(this)); diff --git a/src/insets/inset.h b/src/insets/inset.h index c3ff56608b..7e437057bf 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -19,7 +19,6 @@ #include "LString.h" #include "LColor.h" #include "frontends/mouse_state.h" -#include "WordLangTuple.h" class LyXFont; class BufferView; @@ -30,6 +29,7 @@ class LyXLex; class Paragraph; class LyXCursor; class FuncRequest; +class WordLangTuple; struct LaTeXFeatures; @@ -537,7 +537,8 @@ public: /// virtual bool allowSpellcheck() { return false; } /// - virtual WordLangTuple selectNextWordToSpellcheck(BufferView *, float & value) const; + virtual WordLangTuple const + selectNextWordToSpellcheck(BufferView *, float & value) const; /// virtual void selectSelectedWord(BufferView *) { return; } /// diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index a12d698402..fcb8b416fe 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -112,7 +112,7 @@ string const InsetBibKey::getScreenLabel(Buffer const *) const void InsetBibKey::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showBibitem(this); + bv->owner()->getDialogs().showBibitem(this); } @@ -279,7 +279,7 @@ vector > const InsetBibtex::getKeys(Buffer const * buffer) void InsetBibtex::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showBibtex(this); + bv->owner()->getDialogs().showBibtex(this); } diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index dffb0abefe..7cefcfa783 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -315,7 +315,7 @@ void InsetCitation::edit(BufferView * bv, int, int, mouse_button::state) // Doesn't matter if there is no bv->buffer() entry in the map. loading_buffer[bv->buffer()] = false; - bv->owner()->getDialogs()->showCitation(this); + bv->owner()->getDialogs().showCitation(this); } diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 1fe588517e..de05a31279 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -15,16 +15,18 @@ #endif #include "insetcollapsable.h" +#include "insettext.h" + +#include "BufferView.h" +#include "debug.h" #include "gettext.h" #include "lyxfont.h" -#include "BufferView.h" -#include "frontends/Painter.h" -#include "debug.h" -#include "lyxtext.h" -#include "frontends/font_metrics.h" #include "lyxlex.h" +#include "lyxtext.h" +#include "WordLangTuple.h" -#include "insets/insettext.h" +#include "frontends/font_metrics.h" +#include "frontends/Painter.h" #include "support/LOstream.h" #include "support/lstrings.h" @@ -672,8 +674,8 @@ bool InsetCollapsable::searchBackward(BufferView * bv, string const & str, } -WordLangTuple InsetCollapsable::selectNextWordToSpellcheck(BufferView * bv, - float & value) const +WordLangTuple const +InsetCollapsable::selectNextWordToSpellcheck(BufferView * bv, float & value) const { WordLangTuple word = inset.selectNextWordToSpellcheck(bv, value); if (first_after_edit && word.word().empty()) diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 140e15ba97..9f1abf4ec2 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -175,12 +175,14 @@ public: void close(BufferView *) const; /// bool allowSpellcheck() { return inset.allowSpellcheck(); } - - WordLangTuple selectNextWordToSpellcheck(BufferView *, float &) const; - + /// + WordLangTuple const + selectNextWordToSpellcheck(BufferView *, float &) const; + /// void selectSelectedWord(BufferView * bv) { inset.selectSelectedWord(bv); } + /// void toggleSelection(BufferView * bv, bool kill_selection) { inset.toggleSelection(bv, kill_selection); } diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index dd1a12acd6..77bcc09dc5 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -88,7 +88,7 @@ string const InsetError::editMessage() const void InsetError::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showError(this); + bv->owner()->getDialogs().showError(this); } diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 062bb4d0cd..a2f485c87d 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -14,22 +14,23 @@ #endif #include "insetert.h" -#include "gettext.h" -#include "lyxfont.h" -#include "language.h" +#include "insettext.h" + #include "buffer.h" #include "BufferView.h" -#include "frontends/LyXView.h" -#include "lyxtext.h" -#include "funcrequest.h" #include "debug.h" -#include "lyxrow.h" +#include "funcrequest.h" +#include "gettext.h" +#include "language.h" +#include "lyxfont.h" #include "lyxlex.h" +#include "lyxrow.h" +#include "lyxtext.h" +#include "WordLangTuple.h" -#include "insets/insettext.h" - -#include "frontends/Dialogs.h" #include "frontends/Alert.h" +#include "frontends/Dialogs.h" +#include "frontends/LyXView.h" #include "support/LOstream.h" @@ -653,7 +654,7 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const bool InsetERT::showInsetDialog(BufferView * bv) const { - bv->owner()->getDialogs()->showERT(const_cast(this)); + bv->owner()->getDialogs().showERT(const_cast(this)); return true; } @@ -675,8 +676,8 @@ void InsetERT::close(BufferView * bv) const } -WordLangTuple InsetERT::selectNextWordToSpellcheck(BufferView * bv, - float &) const +WordLangTuple const +InsetERT::selectNextWordToSpellcheck(BufferView * bv, float &) const { bv->unlockInset(const_cast(this)); return WordLangTuple(); diff --git a/src/insets/insetert.h b/src/insets/insetert.h index b75f62c7b5..3ab24e0cdc 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -114,7 +114,8 @@ public: /// bool allowSpellcheck() { return false; } - WordLangTuple selectNextWordToSpellcheck(BufferView *, float &) const; + WordLangTuple const + selectNextWordToSpellcheck(BufferView *, float &) const; /// int ascent(BufferView *, LyXFont const &) const; /// diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 8e557f91cd..86a4d9876f 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -81,7 +81,7 @@ void InsetExternal::edit(BufferView * bv, int /*x*/, int /*y*/, mouse_button::state) { view_ = bv; - view_->owner()->getDialogs()->showExternal(this); + view_->owner()->getDialogs().showExternal(this); } diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index 837ff845e5..2bfb0aa927 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -287,7 +287,7 @@ bool InsetFloat::insetAllowed(Inset::Code code) const bool InsetFloat::showInsetDialog(BufferView * bv) const { if (!inset.showInsetDialog(bv)) { - bv->owner()->getDialogs()->showFloat(const_cast(this)); + bv->owner()->getDialogs().showFloat(const_cast(this)); } return true; } diff --git a/src/insets/insetfloatlist.C b/src/insets/insetfloatlist.C index a64693664f..33251b1350 100644 --- a/src/insets/insetfloatlist.C +++ b/src/insets/insetfloatlist.C @@ -81,7 +81,7 @@ void InsetFloatList::read(Buffer const *, LyXLex & lex) void InsetFloatList::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showTOC(this); + bv->owner()->getDialogs().showTOC(this); } diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 681f8c1810..7085b0c5cb 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -373,7 +373,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font, void InsetGraphics::edit(BufferView *bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showGraphics(this); + bv->owner()->getDialogs().showGraphics(this); } diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 018da0fb38..9f40fd4bd2 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -169,7 +169,7 @@ Inset * InsetInclude::clone(Buffer const & buffer, bool) const void InsetInclude::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showInclude(this); + bv->owner()->getDialogs().showInclude(this); } diff --git a/src/insets/insetindex.C b/src/insets/insetindex.C index 3f66ba3509..eaf92d2554 100644 --- a/src/insets/insetindex.C +++ b/src/insets/insetindex.C @@ -27,7 +27,7 @@ string const InsetIndex::getScreenLabel(Buffer const *) const void InsetIndex::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showIndex(this); + bv->owner()->getDialogs().showIndex(this); } diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 91bef6d40c..bb1ef5bfb2 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -322,7 +322,7 @@ void InsetMinipage::pageWidth(LyXLength const & ll) bool InsetMinipage::showInsetDialog(BufferView * bv) const { if (!inset.showInsetDialog(bv)) - bv->owner()->getDialogs()->showMinipage(const_cast(this)); + bv->owner()->getDialogs().showMinipage(const_cast(this)); return true; } diff --git a/src/insets/insetparent.C b/src/insets/insetparent.C index 8a5a197285..a7c5d8eafd 100644 --- a/src/insets/insetparent.C +++ b/src/insets/insetparent.C @@ -46,7 +46,7 @@ string const InsetParent::getScreenLabel(Buffer const *) const void InsetParent::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getLyXFunc()-> + bv->owner()->getLyXFunc(). dispatch(FuncRequest(LFUN_CHILDOPEN, getContents())); } diff --git a/src/insets/insetref.C b/src/insets/insetref.C index a0bbc2857c..19d3c11211 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -27,10 +27,10 @@ void InsetRef::edit(BufferView * bv, int, int, mouse_button::state button) { // FuncRequestually trigger dialog with button 3 not 1 if (button == mouse_button::button3) - bv->owner()->getLyXFunc()-> + bv->owner()->getLyXFunc(). dispatch(FuncRequest(LFUN_REF_GOTO, getContents())); else if (button == mouse_button::button1) - bv->owner()->getDialogs()->showRef(this); + bv->owner()->getDialogs().showRef(this); } diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 8a4bb1c0b9..e5f7ad7ab5 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -15,30 +15,30 @@ #endif #include "insettabular.h" +#include "insettext.h" -#include "lyx_cb.h" #include "buffer.h" +#include "BufferView.h" #include "commandtags.h" -#include "lyxfunc.h" -#include "debug.h" -#include "LaTeXFeatures.h" -#include "frontends/Painter.h" -#include "frontends/font_metrics.h" -#include "lyxtext.h" -#include "frontends/LyXView.h" -#include "insets/insettext.h" #include "debug.h" +#include "funcrequest.h" #include "gettext.h" #include "language.h" -#include "BufferView.h" -#include "undo_funcs.h" +#include "LaTeXFeatures.h" +#include "lyx_cb.h" +#include "lyxfunc.h" #include "lyxlength.h" -#include "ParagraphParameters.h" #include "lyxlex.h" -#include "funcrequest.h" +#include "lyxtext.h" +#include "ParagraphParameters.h" +#include "undo_funcs.h" +#include "WordLangTuple.h" -#include "frontends/Dialogs.h" #include "frontends/Alert.h" +#include "frontends/Dialogs.h" +#include "frontends/font_metrics.h" +#include "frontends/LyXView.h" +#include "frontends/Painter.h" #include "support/LAssert.h" #include "support/lstrings.h" @@ -710,7 +710,7 @@ bool InsetTabular::unlockInsetInInset(BufferView * bv, UpdatableInset * inset, if (the_locking_inset->unlockInsetInInset(bv, inset, lr)) { if (inset->lyxCode() == TABULAR_CODE && !the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) { - bv->owner()->getDialogs()->updateTabular(this); + bv->owner()->getDialogs().updateTabular(this); oldcell = actcell; } return true; @@ -845,7 +845,7 @@ bool InsetTabular::insetButtonRelease(BufferView * bv, ret = the_locking_inset->insetButtonRelease(bv, x - inset_x, y - inset_y, button); if (button == mouse_button::button3 && !ret) { - bv->owner()->getDialogs()->showTabular(this); + bv->owner()->getDialogs().showTabular(this); return true; } return ret; @@ -1117,7 +1117,7 @@ InsetTabular::localDispatch(BufferView * bv, FuncRequest const & ev) case LFUN_ENDBUFSEL: break; case LFUN_LAYOUT_TABULAR: - bv->owner()->getDialogs()->showTabular(this); + bv->owner()->getDialogs().showTabular(this); break; case LFUN_TABULAR_FEATURE: if (!tabularFeatures(bv, arg)) @@ -1607,7 +1607,7 @@ void InsetTabular::resetPos(BufferView * bv) const !the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) && actcell != oldcell) { InsetTabular * inset = const_cast(this); - bv->owner()->getDialogs()->updateTabular(inset); + bv->owner()->getDialogs().updateTabular(inset); oldcell = actcell; } in_reset_pos = 0; @@ -2283,8 +2283,8 @@ LyXText * InsetTabular::getLyXText(BufferView const * bv, bool InsetTabular::showInsetDialog(BufferView * bv) const { if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv)) - bv->owner()->getDialogs() - ->showTabular(const_cast(this)); + bv->owner()->getDialogs(). + showTabular(const_cast(this)); return true; } @@ -2299,7 +2299,7 @@ void InsetTabular::openLayoutDialog(BufferView * bv) const return; } } - bv->owner()->getDialogs()->showTabular( + bv->owner()->getDialogs().showTabular( const_cast(this)); } @@ -2678,7 +2678,7 @@ Inset * InsetTabular::getInsetFromID(int id_arg) const } -WordLangTuple +WordLangTuple const InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const { nodraw(true); diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 6e653b9aad..3fec464b5a 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -215,8 +215,12 @@ public: LyXCursor const & cursor(BufferView *) const; /// bool allowSpellcheck() { return true; } - WordLangTuple selectNextWordToSpellcheck(BufferView *, float & value) const; + /// + WordLangTuple const + selectNextWordToSpellcheck(BufferView *, float & value) const; + /// void selectSelectedWord(BufferView *); + /// void toggleSelection(BufferView *, bool kill_selection); /// bool searchForward(BufferView *, string const &, diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 28af9b8631..be16b2ad3a 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -15,34 +15,36 @@ #endif #include "insettext.h" -#include "paragraph.h" -#include "lyxlex.h" -#include "debug.h" -#include "lyxfont.h" + #include "buffer.h" -#include "frontends/LyXView.h" #include "BufferView.h" -#include "LaTeXFeatures.h" -#include "frontends/Painter.h" -#include "lyxtext.h" -#include "lyxcursor.h" #include "CutAndPaste.h" -#include "frontends/font_metrics.h" +#include "debug.h" +#include "funcrequest.h" +#include "gettext.h" +#include "intl.h" +#include "LaTeXFeatures.h" #include "LColor.h" +#include "lyxfont.h" +#include "lyxcursor.h" +#include "lyxfind.h" +#include "lyxfunc.h" +#include "lyxlex.h" #include "lyxrow.h" #include "lyxrc.h" -#include "intl.h" -#include "trans_mgr.h" -#include "frontends/screen.h" -#include "gettext.h" -#include "lyxfunc.h" +#include "lyxtext.h" +#include "paragraph.h" #include "ParagraphParameters.h" +#include "trans_mgr.h" #include "undo_funcs.h" -#include "lyxfind.h" -#include "funcrequest.h" +#include "WordLangTuple.h" #include "frontends/Alert.h" #include "frontends/Dialogs.h" +#include "frontends/font_metrics.h" +#include "frontends/LyXView.h" +#include "frontends/Painter.h" +#include "frontends/screen.h" #include "support/textutils.h" #include "support/LAssert.h" @@ -714,7 +716,7 @@ void InsetText::edit(BufferView * bv, int x, int y, mouse_button::state button) showInsetCursor(bv); // Tell the paragraph dialog that we've entered an insettext. - bv->owner()->getDialogs()->updateParagraph(); + bv->owner()->getDialogs().updateParagraph(); } @@ -1256,7 +1258,7 @@ InsetText::localDispatch(BufferView * bv, FuncRequest const & ev) } lt->clearSelection(); for (string::size_type i = 0; i < ev.argument.length(); ++i) { - bv->owner()->getIntl()->getTransManager(). + bv->owner()->getIntl().getTransManager(). TranslateAndInsert(ev.argument[i], lt); } } @@ -1451,7 +1453,7 @@ InsetText::localDispatch(BufferView * bv, FuncRequest const & ev) // see if we found the layout number: if (!hasLayout) { FuncRequest lf(LFUN_MESSAGE, N_("Layout ") + ev.argument + N_(" not known")); - bv->owner()->getLyXFunc()->dispatch(lf); + bv->owner()->getLyXFunc().dispatch(lf); break; } @@ -2566,7 +2568,7 @@ Inset * InsetText::getInsetFromID(int id_arg) const } -WordLangTuple +WordLangTuple const InsetText::selectNextWordToSpellcheck(BufferView * bv, float & value) const { diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 06c320c0d3..20b7ce9072 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -231,8 +231,9 @@ public: /// bool allowSpellcheck() { return true; } /// - WordLangTuple selectNextWordToSpellcheck(BufferView *, - float & value) const; + WordLangTuple const + selectNextWordToSpellcheck(BufferView *, float & value) const; + /// void selectSelectedWord(BufferView *); /// void toggleSelection(BufferView *, bool kill_selection); diff --git a/src/insets/insettoc.C b/src/insets/insettoc.C index b658a3bd80..af6fb2d0ab 100644 --- a/src/insets/insettoc.C +++ b/src/insets/insettoc.C @@ -37,7 +37,7 @@ Inset::Code InsetTOC::lyxCode() const void InsetTOC::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showTOC(this); + bv->owner()->getDialogs().showTOC(this); } diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index f214d7c904..731147c73a 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -23,7 +23,7 @@ InsetUrl::InsetUrl(InsetCommandParams const & p, bool) void InsetUrl::edit(BufferView * bv, int, int, mouse_button::state) { - bv->owner()->getDialogs()->showUrl(this); + bv->owner()->getDialogs().showUrl(this); } diff --git a/src/ispell.C b/src/ispell.C index c8e8721ee0..e531795dbe 100644 --- a/src/ispell.C +++ b/src/ispell.C @@ -49,6 +49,7 @@ #include "debug.h" #include "encoding.h" #include "ispell.h" +#include "WordLangTuple.h" #ifndef CXX_GLOBAL_CSTD using std::strcpy; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 7cb094a73f..4449d5f1b8 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -166,7 +166,7 @@ void LyXFunc::handleKeyFunc(kb_action action) c = 0; } - owner->getIntl()->getTransManager() + owner->getIntl().getTransManager() .deadkey(c, get_accent(action).accent, TEXT(false)); // Need to clear, in case the minibuffer calls these // actions @@ -602,7 +602,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const // A few general toggles switch (ev.action) { case LFUN_TOOLTIPS_TOGGLE: - flag.setOnOff(owner->getDialogs()->tooltipsEnabled()); + flag.setOnOff(owner->getDialogs().tooltipsEnabled()); break; case LFUN_READ_ONLY_TOGGLE: @@ -883,7 +883,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) } finishUndo(); // Tell the paragraph dialog that we changed paragraph - owner->getDialogs()->updateParagraph(); + owner->getDialogs().updateParagraph(); } } break; @@ -1003,12 +1003,12 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_MENUPRINT: - owner->getDialogs()->showPrint(); + owner->getDialogs().showPrint(); break; case LFUN_EXPORT: if (argument == "custom") - owner->getDialogs()->showSendto(); + owner->getDialogs().showSendto(); else Exporter::Export(owner->buffer(), argument, false); break; @@ -1042,7 +1042,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) else p.setCmdName("listoftables"); #endif - owner->getDialogs()->createTOC(p.getAsString()); + owner->getDialogs().createTOC(p.getAsString()); break; } @@ -1059,7 +1059,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_MENUSEARCH: - owner->getDialogs()->showSearch(); + owner->getDialogs().showSearch(); break; case LFUN_REMOVEERRORS: @@ -1079,7 +1079,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_FREE: - owner->getDialogs()->setUserFreeFont(); + owner->getDialogs().setUserFreeFont(); break; case LFUN_RECONFIGURE: @@ -1103,11 +1103,11 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) #endif #endif case LFUN_HELP_ABOUTLYX: - owner->getDialogs()->showAboutlyx(); + owner->getDialogs().showAboutlyx(); break; case LFUN_HELP_TEXINFO: - owner->getDialogs()->showTexinfo(); + owner->getDialogs().showTexinfo(); break; case LFUN_HELP_OPEN: @@ -1172,7 +1172,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) case LFUN_VC_HISTORY: { - owner->getDialogs()->showVCLogFile(); + owner->getDialogs().showVCLogFile(); break; } @@ -1196,19 +1196,19 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_LATEX_LOG: - owner->getDialogs()->showLogFile(); + owner->getDialogs().showLogFile(); break; case LFUN_LAYOUT_DOCUMENT: - owner->getDialogs()->showDocument(); + owner->getDialogs().showDocument(); break; case LFUN_LAYOUT_PARAGRAPH: - owner->getDialogs()->showParagraph(); + owner->getDialogs().showParagraph(); break; case LFUN_LAYOUT_CHARACTER: - owner->getDialogs()->showCharacter(); + owner->getDialogs().showCharacter(); break; case LFUN_LAYOUT_TABULAR: @@ -1227,19 +1227,19 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_LAYOUT_PREAMBLE: - owner->getDialogs()->showPreamble(); + owner->getDialogs().showPreamble(); break; case LFUN_DROP_LAYOUTS_CHOICE: - owner->getToolbar()->openLayoutList(); + owner->getToolbar().openLayoutList(); break; case LFUN_MENU_OPEN_BY_NAME: - owner->getMenubar()->openByName(argument); + owner->getMenubar().openByName(argument); break; // RVDK_PATCH_5 case LFUN_SPELLCHECK: - owner->getDialogs()->showSpellchecker(); + owner->getDialogs().showSpellchecker(); break; // --- lyxserver commands ---------------------------- @@ -1344,7 +1344,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_MATH_PANEL: - owner->getDialogs()->showMathPanel(); + owner->getDialogs().showMathPanel(); break; case LFUN_CITATION_CREATE: @@ -1364,7 +1364,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) } dispatch(FuncRequest(LFUN_CITATION_INSERT, p.getAsString())); } else - owner->getDialogs()->createCitation(p.getAsString()); + owner->getDialogs().createCitation(p.getAsString()); } break; @@ -1388,19 +1388,19 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_KMAP_OFF: // keymap off - owner->getIntl()->KeyMapOn(false); + owner->getIntl().KeyMapOn(false); break; case LFUN_KMAP_PRIM: // primary keymap - owner->getIntl()->KeyMapPrim(); + owner->getIntl().KeyMapPrim(); break; case LFUN_KMAP_SEC: // secondary keymap - owner->getIntl()->KeyMapSec(); + owner->getIntl().KeyMapSec(); break; case LFUN_KMAP_TOGGLE: // toggle keymap - owner->getIntl()->ToggleKeyMap(); + owner->getIntl().ToggleKeyMap(); break; case LFUN_SEQUENCE: @@ -1415,7 +1415,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_DIALOG_PREFERENCES: - owner->getDialogs()->showPreferences(); + owner->getDialogs().showPreferences(); break; case LFUN_SAVEPREFERENCES: @@ -1486,7 +1486,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_FORKS_SHOW: - owner->getDialogs()->showForks(); + owner->getDialogs().showForks(); break; case LFUN_FORKS_KILL: @@ -1501,7 +1501,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) } case LFUN_TOOLTIPS_TOGGLE: - owner->getDialogs()->toggleTooltips(); + owner->getDialogs().toggleTooltips(); break; default: @@ -1817,7 +1817,7 @@ void LyXFunc::closeBuffer() // need this otherwise SEGV may occur while trying to // set variables that don't exist // since there's no current buffer - owner->getDialogs()->hideBufferDependent(); + owner->getDialogs().hideBufferDependent(); } else { owner->view()->buffer(bufferlist.first()); } diff --git a/src/lyxtext.h b/src/lyxtext.h index 89edf41d65..ba127439e7 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -21,7 +21,6 @@ #include "layout.h" #include "LColor.h" #include "insets/inset.h" -#include "WordLangTuple.h" class Buffer; class BufferParams; @@ -32,6 +31,7 @@ class Row; class Spacing; class UpdatableInset; class VSpace; +class WordLangTuple; /** @@ -293,7 +293,7 @@ public: to the beginning of this word. With SelectSelectedWord can this be highlighted really */ - WordLangTuple selectNextWordToSpellcheck(BufferView *, float & value) const; + WordLangTuple const selectNextWordToSpellcheck(BufferView *, float & value) const; /// void selectSelectedWord(BufferView *); /// returns true if par was empty and was removed diff --git a/src/lyxvc.C b/src/lyxvc.C index 61ecb73d78..92670f2a17 100644 --- a/src/lyxvc.C +++ b/src/lyxvc.C @@ -113,7 +113,7 @@ void LyXVC::registrer() MakeDisplayPath(filename, 50), _("Save document and proceed?"))) { vcs->owner()->getUser()->owner() - ->getLyXFunc()->dispatch(LFUN_MENUWRITE); + ->getLyXFunc().dispatch(LFUN_MENUWRITE); } // Maybe the save fails, or we answered "no". In both cases, @@ -146,7 +146,7 @@ void LyXVC::checkIn() MakeDisplayPath(vcs->owner()->fileName(), 50), _("Save document and proceed?"))) { vcs->owner()->getUser()->owner() - ->getLyXFunc()->dispatch(LFUN_MENUWRITE); + ->getLyXFunc().dispatch(LFUN_MENUWRITE); } // Maybe the save fails, or we answered "no". In both cases, diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index bc8c6f6c08..4dd2edada2 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,13 @@ +2002-08-13 Angus Leeming + + * formulabase.C: + * ref_inset.C: + changes due to the changed LyXView interface that now returns references + to member variables not pointers. + + * math_inset.[Ch] (getDialogs, getLyXFunc): return a reference, not a + pointer, reflecting this change. + 2002-08-02 Angus Leeming * formula.C: pass the BufferView to the PreviewedInset so that it can diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 9476d59905..37541fe047 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -118,7 +118,7 @@ void InsetFormulaBase::mutateToText() view_->owner()->getIntl()->getTransManager().TranslateAndInsert(*cit, lt); // remove ourselves - //view_->owner()->getLyXFunc()->dispatch(LFUN_ESCAPE); + //view_->owner()->getLyXFunc().dispatch(LFUN_ESCAPE); #endif } @@ -303,7 +303,7 @@ bool InsetFormulaBase::insetButtonRelease(BufferView * bv, return true; // launch math panel for right mouse button - bv->owner()->getDialogs()->showMathPanel(); + bv->owner()->getDialogs().showMathPanel(); return true; } @@ -740,7 +740,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, FuncRequest const & ev) case LFUN_REF_INSERT: //if (argument.empty()) { // InsetCommandParams p("ref"); - // owner_->getDialogs()->createRef(p.getAsString()); + // owner_->getDialogs().createRef(p.getAsString()); //} else { // InsetCommandParams p; // p.setFromString(argument); @@ -754,7 +754,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, FuncRequest const & ev) // if (ev.argument.empty()) { InsetCommandParams p("ref"); - bv->owner()->getDialogs()->createRef(p.getAsString()); + bv->owner()->getDialogs().createRef(p.getAsString()); } else { //mathcursor->handleNest(new InsetRef2); //mathcursor->insert(arg); @@ -951,7 +951,7 @@ void mathDispatchCreation(BufferView * bv, string const & arg, bool display) bv->getLyXText()->cutSelection(bv); openNewInset(bv, f); } - bv->owner()->getLyXFunc()->setMessage(N_("Math editor mode")); + bv->owner()->getLyXFunc().setMessage(N_("Math editor mode")); } @@ -978,7 +978,7 @@ void mathDispatchMathMacro(BufferView * bv, string const & arg) if (!bv->available()) return; if (arg.empty()) - bv->owner()->getLyXFunc()->setErrorMessage(N_("Missing argument")); + bv->owner()->getLyXFunc().setErrorMessage(N_("Missing argument")); else { string s = arg; string const s1 = token(s, ' ', 1); diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index f075e4654c..683bf3d99f 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -301,13 +301,13 @@ MathArray asArray(string const & str) } -Dialogs * getDialogs() +Dialogs & getDialogs() { return mathcursor->formula()->view()->owner()->getDialogs(); } -LyXFunc * getLyXFunc() +LyXFunc & getLyXFunc() { return mathcursor->formula()->view()->owner()->getLyXFunc(); } diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index 8a98be797f..8ca244a754 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -308,7 +308,7 @@ void initMath(); class Dialogs; class LyXFunc; -Dialogs * getDialogs(); -LyXFunc * getLyXFunc(); +Dialogs & getDialogs(); +LyXFunc & getLyXFunc(); #endif diff --git a/src/mathed/ref_inset.C b/src/mathed/ref_inset.C index 0055d75407..a7231d78f7 100644 --- a/src/mathed/ref_inset.C +++ b/src/mathed/ref_inset.C @@ -42,7 +42,7 @@ int RefInset::dispatch(FuncRequest const & cmd, idx_type, pos_type) case LFUN_MOUSE_RELEASE: if (cmd.extra == 3) { lyxerr << "trying to goto ref" << cell(0) << "\n"; - mathcursor->formula()->view()->owner()->getLyXFunc()-> + mathcursor->formula()->view()->owner()->getLyXFunc(). dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0)))); return 1; // dispatched } diff --git a/src/pspell.C b/src/pspell.C index f31605d02a..b9c113dfbd 100644 --- a/src/pspell.C +++ b/src/pspell.C @@ -24,6 +24,7 @@ extern "C" { } #include "pspell.h" +#include "WordLangTuple.h" using std::endl; diff --git a/src/text.C b/src/text.C index 74349c6dcb..ec90880c58 100644 --- a/src/text.C +++ b/src/text.C @@ -28,6 +28,7 @@ #include "language.h" #include "ParagraphParameters.h" #include "undo_funcs.h" +#include "WordLangTuple.h" #include "insets/insetbib.h" #include "insets/insettext.h" @@ -2393,8 +2394,8 @@ bool LyXText::selectWordWhenUnderCursor(BufferView * bview, // This function is only used by the spellchecker for NextWord(). // It doesn't handle LYX_ACCENTs and probably never will. -WordLangTuple LyXText::selectNextWordToSpellcheck(BufferView * bview, - float & value) const +WordLangTuple const +LyXText::selectNextWordToSpellcheck(BufferView * bview, float & value) const { if (the_locking_inset) { WordLangTuple word = the_locking_inset->selectNextWordToSpellcheck(bview, value); diff --git a/src/toc.C b/src/toc.C index 5627acb83c..256da3a315 100644 --- a/src/toc.C +++ b/src/toc.C @@ -46,7 +46,7 @@ string const TocItem::asString() const void TocItem::goTo(LyXView & lv_) const { string const tmp = tostr(par->id()); - lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_GOTO_PARAGRAPH, tmp)); + lv_.getLyXFunc().dispatch(FuncRequest(LFUN_GOTO_PARAGRAPH, tmp)); } diff --git a/src/vc-backend.C b/src/vc-backend.C index 56528c53ae..d72d6b3406 100644 --- a/src/vc-backend.C +++ b/src/vc-backend.C @@ -159,7 +159,7 @@ void RCS::registrer(string const & msg) cmd += OnlyFilename(owner_->fileName()); cmd += "\""; doVCCommand(cmd, owner_->filePath()); - owner_->getUser()->owner()->getLyXFunc()->dispatch(LFUN_MENURELOAD); + owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD); } @@ -167,7 +167,7 @@ void RCS::checkIn(string const & msg) { doVCCommand("ci -q -u -m\"" + msg + "\" \"" + OnlyFilename(owner_->fileName()) + "\"", owner_->filePath()); - owner_->getUser()->owner()->getLyXFunc()->dispatch(LFUN_MENURELOAD); + owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD); } @@ -176,7 +176,7 @@ void RCS::checkOut() owner_->markClean(); doVCCommand("co -q -l \"" + OnlyFilename(owner_->fileName()) + "\"", owner_->filePath()); - owner_->getUser()->owner()->getLyXFunc()->dispatch(LFUN_MENURELOAD); + owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD); } @@ -187,7 +187,7 @@ void RCS::revert() // We ignore changes and just reload! owner_->markClean(); owner_->getUser()->owner() - ->getLyXFunc()->dispatch(LFUN_MENURELOAD); + ->getLyXFunc().dispatch(LFUN_MENURELOAD); } @@ -289,7 +289,7 @@ void CVS::registrer(string const & msg) { doVCCommand("cvs -q add -m \"" + msg + "\" \"" + OnlyFilename(owner_->fileName()) + "\"", owner_->filePath()); - owner_->getUser()->owner()->getLyXFunc()->dispatch(LFUN_MENURELOAD); + owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD); } @@ -298,7 +298,7 @@ void CVS::checkIn(string const & msg) doVCCommand("cvs -q commit -m \"" + msg + "\" \"" + OnlyFilename(owner_->fileName()) + "\"", owner_->filePath()); - owner_->getUser()->owner()->getLyXFunc()->dispatch(LFUN_MENURELOAD); + owner_->getUser()->owner()->getLyXFunc().dispatch(LFUN_MENURELOAD); } @@ -319,7 +319,7 @@ void CVS::revert() owner_->filePath()); owner_->markClean(); owner_->getUser()->owner() - ->getLyXFunc()->dispatch(LFUN_MENURELOAD); + ->getLyXFunc().dispatch(LFUN_MENURELOAD); }