* 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
This commit is contained in:
Angus Leeming 2002-08-13 14:40:38 +00:00
parent d5bf18637f
commit c10dfd15cd
71 changed files with 422 additions and 304 deletions

View File

@ -18,7 +18,6 @@
#include "undo.h"
#include "insets/inset.h"
#include "WordLangTuple.h"
#include <boost/utility.hpp>
@ -30,6 +29,7 @@ class LyXScreen;
class Language;
class Painter;
class UpdatableInset;
class WordLangTuple;
///
class BufferView : boost::noncopyable {

View File

@ -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;

View File

@ -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;

View File

@ -1,3 +1,34 @@
2002-08-13 Angus Leeming <leeming@lyx.org>
* 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 <leeming@lyx.org>
* 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 <martin.vermeer@hut.fi>
* buffer.C:

View File

@ -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.

View File

@ -9,7 +9,6 @@
#ifndef WORD_LANG_TUPLE_H
#define WORD_LANG_TUPLE_H
#include <config.h>
#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_;
}

View File

@ -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);
}
}

View File

@ -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)) {

View File

@ -1,3 +1,11 @@
2002-08-13 Angus Leeming <leeming@lyx.org>
* 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 <leeming@lyx.org>
* DialogBase.h: no longer derive from boost::signals::trackable.

View File

@ -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<BufferView> 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;

View File

@ -77,23 +77,33 @@ public:
*/
boost::shared_ptr<BufferView> 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> bufferview_;
/// view's menubar
@ -131,16 +141,7 @@ protected:
/// view's toolbar
boost::scoped_ptr<Toolbar> toolbar_;
/// view's command buffer controller
boost::scoped_ptr<ControlCommandBuffer> controlcommand_;
/// keyboard mapping object
boost::scoped_ptr<Intl> intl_;
/// auto-saving of buffers
boost::scoped_ptr<Timeout> autosave_timeout_;
/// called on timeout
void autoSave();
boost::scoped_ptr<ControlCommandBuffer> 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<Intl> const intl_;
/// auto-saving of buffers
boost::scoped_ptr<Timeout> const autosave_timeout_;
/// our function handler
boost::scoped_ptr<LyXFunc> lyxfunc_;
/// dialogs for this view

View File

@ -1,3 +1,10 @@
2002-08-13 Angus Leeming <leeming@lyx.org>
* 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 <leeming@lyx.org>
* 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 <leuven@fee.uva.nl>
* ControlParagraph.[Ch] (changedParagraph): new method invoked when
@ -68,7 +75,7 @@
2002-08-01 John Levon <levon@movementarian.org>
* ControlSendto.C: writeFile() change
2002-08-01 John Levon <levon@movementarian.org>
* ControlSpellchecker.h:

View File

@ -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();
}

View File

@ -98,7 +98,6 @@ private:
/// The actual spellchecker object
SpellBase * speller_;
};
#endif // CONTROLSPELLCHECKER_H

View File

@ -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);
}

View File

@ -1,3 +1,15 @@
2002-08-13 Angus Leeming <leeming@lyx.org>
* 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 <leeming@lyx.org>
* Menubar_pimpl.C: no need to #include "Dialogs.h". Remove semi-colon

View File

@ -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;
}

View File

@ -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));
}

View File

@ -160,7 +160,7 @@ class Qt2CB: public Base
{
public:
bool readOnly() const {
return controller().isReadonly();
return controller().bufferIsReadonly();
}
protected:

View File

@ -123,7 +123,7 @@ void QtView::update_view_state()
void QtView::activated(int id)
{
getLyXFunc()->dispatch(id, true);
getLyXFunc().dispatch(id, true);
}

View File

@ -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;
}
}

View File

@ -89,7 +89,7 @@ void lyx_gui::start(string const & batch, vector<string> files)
// FIXME: some code below needs moving
lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes);
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
vector<string>::const_iterator cit = files.begin();
vector<string>::const_iterator end = files.end();
@ -107,7 +107,7 @@ void lyx_gui::start(string const & batch, vector<string> files)
// handle the batch commands the user asked for
if (!batch.empty()) {
view.getLyXFunc()->dispatch(batch);
view.getLyXFunc().dispatch(batch);
}
qApp->exec();

View File

@ -1,3 +1,17 @@
2002-08-13 Angus Leeming <leeming@lyx.org>
* 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 <lasgouttes@freesurf.fr>
* Menubar_pimpl.C (create_submenu): fix code to disable submenu

View File

@ -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);

View File

@ -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);
}

View File

@ -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()));
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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 "

View File

@ -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<XFormsView *>(ob->u_vdata);
owner->getLyXFunc()->dispatch(int(ac), true);
owner->getLyXFunc().dispatch(int(ac), true);
}

View File

@ -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());
}

View File

@ -275,7 +275,7 @@ void lyx_gui::start(string const & batch, vector<string> files)
// FIXME: some code below needs moving
lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes);
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
vector<string>::const_iterator cit = files.begin();
vector<string>::const_iterator end = files.end();
@ -293,7 +293,7 @@ void lyx_gui::start(string const & batch, vector<string> files)
// handle the batch commands the user asked for
if (!batch.empty()) {
view.getLyXFunc()->dispatch(batch);
view.getLyXFunc().dispatch(batch);
}
// enter the event loop

View File

@ -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

View File

@ -1,3 +1,40 @@
2002-08-13 Angus Leeming <leeming@lyx.org>
* 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 <leeming@lyx.org>
* 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 <leeming@lyx.org>
* insetgraphicsParams.C: fix reading of lyxsize_type in 1.2.0 documents.

View File

@ -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<UpdatableInset *>(this));

View File

@ -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; }
///

View File

@ -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<pair<string, string> > 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);
}

View File

@ -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);
}

View File

@ -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())

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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<InsetERT *>(this));
bv->owner()->getDialogs().showERT(const_cast<InsetERT *>(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<InsetERT *>(this));
return WordLangTuple();

View File

@ -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;
///

View File

@ -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);
}

View File

@ -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<InsetFloat *>(this));
bv->owner()->getDialogs().showFloat(const_cast<InsetFloat *>(this));
}
return true;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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<InsetMinipage *>(this));
bv->owner()->getDialogs().showMinipage(const_cast<InsetMinipage *>(this));
return true;
}

View File

@ -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()));
}

View File

@ -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);
}

View File

@ -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<InsetTabular *>(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<InsetTabular *>(this));
bv->owner()->getDialogs().
showTabular(const_cast<InsetTabular *>(this));
return true;
}
@ -2299,7 +2299,7 @@ void InsetTabular::openLayoutDialog(BufferView * bv) const
return;
}
}
bv->owner()->getDialogs()->showTabular(
bv->owner()->getDialogs().showTabular(
const_cast<InsetTabular *>(this));
}
@ -2678,7 +2678,7 @@ Inset * InsetTabular::getInsetFromID(int id_arg) const
}
WordLangTuple
WordLangTuple const
InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
{
nodraw(true);

View File

@ -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 &,

View File

@ -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
{

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -49,6 +49,7 @@
#include "debug.h"
#include "encoding.h"
#include "ispell.h"
#include "WordLangTuple.h"
#ifndef CXX_GLOBAL_CSTD
using std::strcpy;

View File

@ -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());
}

View File

@ -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

View File

@ -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,

View File

@ -1,3 +1,13 @@
2002-08-13 Angus Leeming <leeming@lyx.org>
* 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 <leeming@lyx.org>
* formula.C: pass the BufferView to the PreviewedInset so that it can

View File

@ -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);

View File

@ -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();
}

View File

@ -308,7 +308,7 @@ void initMath();
class Dialogs;
class LyXFunc;
Dialogs * getDialogs();
LyXFunc * getLyXFunc();
Dialogs & getDialogs();
LyXFunc & getLyXFunc();
#endif

View File

@ -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
}

View File

@ -24,6 +24,7 @@ extern "C" {
}
#include "pspell.h"
#include "WordLangTuple.h"
using std::endl;

View File

@ -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);

View File

@ -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));
}

View File

@ -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);
}