* Constify Buffer::getLabelList.

* reduce file dependencies of the controllers on the core.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4947 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-08-12 20:17:41 +00:00
parent 07ea949693
commit 9681e21dae
45 changed files with 224 additions and 168 deletions

View File

@ -1,3 +1,6 @@
2002-08-12 Angus Leeming <leeming@lyx.org>
* buffer.[Ch] (getLabelList): constify.
2002-08-07 André Pönitz <poenitz@gmx.net>

View File

@ -3691,20 +3691,20 @@ string const Buffer::getIncludeonlyList(char delim)
}
vector<string> const Buffer::getLabelList()
vector<string> const Buffer::getLabelList() const
{
/// if this is a child document and the parent is already loaded
/// Use the parent's list instead [ale990407]
if (!params.parentname.empty()
&& bufferlist.exists(params.parentname)) {
Buffer * tmp = bufferlist.getBuffer(params.parentname);
Buffer const * tmp = bufferlist.getBuffer(params.parentname);
if (tmp)
return tmp->getLabelList();
}
vector<string> label_list;
for (inset_iterator it = inset_iterator_begin();
it != inset_iterator_end(); ++it) {
for (inset_iterator it = inset_const_iterator_begin();
it != inset_const_iterator_end(); ++it) {
vector<string> const l = (*it)->getLabelList();
label_list.insert(label_list.end(), l.begin(), l.end());
}

View File

@ -278,7 +278,7 @@ public:
///
std::vector<std::pair<string, string> > const getBibkeyList() const;
///
std::vector<string> const getLabelList();
std::vector<string> const getLabelList() const;
/** This will clearly have to change later. Later we can have more
than one user per buffer. */

View File

@ -1,3 +1,12 @@
2002-08-12 Angus Leeming <leeming@lyx.org>
* ControlConnections.[Ch]: (isReadonly): renamed as bufferIsReadonly.
(bufferIsAvailable, bufferview, buffer, lyxfunc): new methods. Wrappers
for the most commonly accessed core methods, to minimise code
dependiencies.
* many files: use these wrappers and remove associated #includes.
2002-08-12 Angus Leeming <leeming@lyx.org>
* ControlButtons.[Ch] (bc, view): no longer virtual.

View File

@ -15,9 +15,7 @@
#endif
#include "ControlAboutlyx.h"
#include "frontends/LyXView.h"
#include "Lsstream.h"
#include "BufferView.h"
#include "gettext.h"
#include "support/filetools.h" // FileSearch
#include "version.h"

View File

@ -32,16 +32,16 @@ void ControlBibitem::applyParamsToInset()
// FIXME:
// confirm, is this only necessary for FormBibTeX ???
if (params().getContents() != inset()->params().getContents())
lv_.view()->ChangeCitationsIfUnique(inset()->params().getContents(),
bufferview()->ChangeCitationsIfUnique(inset()->params().getContents(),
params().getContents());
inset()->setParams(params());
lv_.view()->updateInset(inset(), true);
bufferview()->updateInset(inset(), true);
// We need to do a redraw because the maximum
// InsetBibKey width could have changed
#warning please check you mean repaint() not update(),
#warning and whether the repaint() is needed at all
lv_.view()->repaint();
lv_.view()->fitCursor();
bufferview()->repaint();
bufferview()->fitCursor();
}

View File

@ -20,6 +20,7 @@
#endif
#include "ControlBibtex.h"
#include "buffer.h"
#include "BufferView.h"
#include "lyxrc.h"
#include "helper_funcs.h"
@ -27,7 +28,6 @@
#include "gettext.h"
#include "support/lstrings.h"
#include "frontends/LyXView.h"
using std::pair;
@ -41,17 +41,17 @@ ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
void ControlBibtex::applyParamsToInset()
{
if (params().getContents() != inset()->params().getContents())
lv_.view()->ChangeCitationsIfUnique(inset()->params().getContents(),
bufferview()->ChangeCitationsIfUnique(inset()->params().getContents(),
params().getContents());
inset()->setParams(params());
lv_.view()->updateInset(inset(), true);
bufferview()->updateInset(inset(), true);
// We need to do a redraw because the maximum
// InsetBibKey width could have changed
#warning are you sure you need this repaint() ?
lv_.view()->repaint();
lv_.view()->fitCursor();
bufferview()->repaint();
bufferview()->fitCursor();
}
@ -64,7 +64,7 @@ string const ControlBibtex::Browse(string const & in_name,
string const & pattern)
{
pair<string, string> dir1(_("Documents|#o#O"), string(lyxrc.document_path));
return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
return browseRelFile(&lv_, in_name, buffer()->filePath(),
title, pattern, dir1);
}

View File

@ -20,7 +20,6 @@
#include "bufferview_funcs.h" // ToggleAndShow
#include "gettext.h"
#include "language.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
@ -59,12 +58,12 @@ void ControlCharacter::apply()
return;
// Apply from the view if it's visible. Otherwise, use the stored values
if (lv_.view()->available())
if (bufferIsAvailable())
view().apply();
toggleAndShow(lv_.view().get(), *(font_.get()), toggleall_);
toggleAndShow(bufferview(), *(font_.get()), toggleall_);
lv_.view_state_changed();
lv_.buffer()->markDirty();
buffer()->markDirty();
setMinibuffer(&lv_, _("Character set"));
}
@ -223,7 +222,7 @@ void ControlCharacter::setLanguage(string const & val)
font_->setLanguage(ignore_language);
else if (val == "reset")
font_->setLanguage(lv_.buffer()->params.language);
font_->setLanguage(buffer()->params.language);
else
font_->setLanguage(languages.getLanguage(val));

View File

@ -18,6 +18,7 @@
#endif
#include "ControlCitation.h"
#include "buffer.h"
using std::vector;
using std::pair;
@ -38,7 +39,7 @@ void ControlCitation::clearDaughterParams()
void ControlCitation::setDaughterParams()
{
vector<pair<string,string> > blist = lv_.buffer()->getBibkeyList();
vector<pair<string,string> > blist = buffer()->getBibkeyList();
typedef std::map<string, string>::value_type InfoMapValue;
@ -65,7 +66,7 @@ biblio::InfoMap const & ControlCitation::bibkeysInfo() const
bool ControlCitation::usingNatbib() const
{
return lv_.buffer()->params.use_natbib;
return buffer()->params.use_natbib;
}
@ -76,7 +77,7 @@ vector<string> const ControlCitation::getCiteStrings(string const & key) const
vector<biblio::CiteStyle> const cs =
biblio::getCiteStyles(usingNatbib());
if (lv_.buffer()->params.use_numerical_citations)
if (buffer()->params.use_numerical_citations)
styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs);
else
styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs);

View File

@ -22,7 +22,6 @@
#include "ControlCommand.h"
#include "buffer.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "lyxfunc.h"
#include "BufferView.h"
#include "funcrequest.h"
@ -51,7 +50,7 @@ InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
void ControlCommand::applyParamsToInset()
{
inset()->setParams(params());
lv_.view()->updateInset(inset(), true);
bufferview()->updateInset(inset(), true);
}
@ -59,5 +58,5 @@ void ControlCommand::applyParamsNoInset()
{
if (action_ == LFUN_NOACTION)
return;
lv_.getLyXFunc()->dispatch(FuncRequest(action_, params().getAsString()));
lyxfunc().dispatch(FuncRequest(action_, params().getAsString()));
}

View File

@ -8,6 +8,8 @@
* \author John Levon <levon@movementarian.org>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif

View File

@ -12,8 +12,6 @@
#ifndef CONTROLCOMMANDBUFFER_H
#define CONTROLCOMMANDBUFFER_H
#include <config.h>
#include "LString.h"
#include <vector>

View File

@ -21,6 +21,7 @@
#include "ViewBase.h"
#include "Dialogs.h"
#include "buffer.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
@ -50,7 +51,7 @@ void ControlConnectBase::redraw()
}
bool ControlConnectBase::isReadonly() const
bool ControlConnectBase::bufferIsReadonly() const
{
if (!lv_.buffer())
return true;
@ -59,6 +60,51 @@ bool ControlConnectBase::isReadonly() const
}
bool ControlConnectBase::bufferIsAvailable() const
{
if (!lv_.view())
return false;
return lv_.view()->available();
}
BufferView * ControlConnectBase::bufferview()
{
return lv_.view().get();
}
BufferView const * ControlConnectBase::bufferview() const
{
return lv_.view().get();
}
Buffer * ControlConnectBase::buffer()
{
return lv_.buffer();
}
Buffer const * ControlConnectBase::buffer() const
{
return lv_.buffer();
}
LyXFunc & ControlConnectBase::lyxfunc()
{
return *lv_.getLyXFunc();
}
LyXFunc const & ControlConnectBase::lyxfunc() const
{
return *lv_.getLyXFunc();
}
ControlConnectBase::DocTypes ControlConnectBase::docType() const
{
if (!lv_.buffer())

View File

@ -39,8 +39,11 @@
#include <boost/signals/connection.hpp>
class Buffer;
class BufferView;
class Dialogs;
class LyXView;
class LyXFunc;
/** Base class to control connection/disconnection of signals with the LyX
kernel. It is meant to be used solely as the parent class to
@ -63,7 +66,7 @@ public:
///
ControlConnectBase(LyXView &, Dialogs &);
/// The View may need to know if the buffer is read-only.
bool isReadonly() const;
bool bufferIsReadonly() const;
///
DocTypes docType() const;
@ -81,7 +84,23 @@ protected:
*/
void redraw();
/// Get at the kernel Dispatch methods we need to apply() parameters.
/// a wrapper for BufferView::avaliable()
bool bufferIsAvailable() const;
/// a wrapper for LyXView::view()
BufferView * bufferview();
///
BufferView const * bufferview() const;
/// a wrapper for LyXView::buffer()
Buffer * buffer();
///
Buffer const * buffer() const;
/// a wrapper for LyXView::getLyXFunc()
LyXFunc & lyxfunc();
///
LyXFunc const & lyxfunc() const;
///
LyXView & lv_;
/// Contains the signals we have to connect to.
Dialogs & d_;

View File

@ -11,12 +11,10 @@
*/
#include "ControlDialog.h"
#include "ButtonControllerBase.h"
#include "ControlConnections.h"
#include "frontends/LyXView.h"
#include "BufferView.h"
#include "ViewBase.h"
#include "debug.h"
template <class Base>
ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
@ -27,7 +25,7 @@ ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
template <class Base>
void ControlDialog<Base>::show()
{
if (isBufferDependent() && !lv_.view()->available())
if (isBufferDependent() && !bufferIsAvailable())
return;
connect();
@ -43,14 +41,14 @@ void ControlDialog<Base>::show()
dialog_built_ = true;
}
bc().readOnly(isReadonly());
bc().readOnly(bufferIsReadonly());
view().show();
}
template <class Base>
void ControlDialog<Base>::update()
{
if (isBufferDependent() && !lv_.view()->available())
if (isBufferDependent() && !bufferIsAvailable())
return;
setParams();
@ -59,7 +57,7 @@ void ControlDialog<Base>::update()
return;
}
bc().readOnly(isReadonly());
bc().readOnly(bufferIsReadonly());
view().update();
}

View File

@ -30,7 +30,7 @@ ControlERT::ControlERT(LyXView & lv, Dialogs & d)
void ControlERT::applyParamsToInset()
{
inset()->status(lv_.view().get(), params().status);
inset()->status(bufferview(), params().status);
}

View File

@ -20,6 +20,7 @@
#endif
#include "ControlExternal.h"
#include "buffer.h"
#include "BufferView.h"
#include "gettext.h"
#include "helper_funcs.h"
@ -50,7 +51,7 @@ ControlExternal::getParams(InsetExternal const & inset)
void ControlExternal::applyParamsToInset()
{
inset()->setFromParams(params());
lv_.view()->updateInset(inset(), true);
bufferview()->updateInset(inset(), true);
}
void ControlExternal::editExternal()
@ -62,7 +63,7 @@ void ControlExternal::editExternal()
// Create a local copy of the inset and initialise it with this
// params struct.
boost::scoped_ptr<InsetExternal> ie;
ie.reset(static_cast<InsetExternal *>(inset()->clone(*lv_.buffer())));
ie.reset(static_cast<InsetExternal *>(inset()->clone(*buffer())));
ie->setFromParams(params());
ie->editExternal();
@ -73,7 +74,7 @@ void ControlExternal::viewExternal()
view().apply();
boost::scoped_ptr<InsetExternal> ie;
ie.reset(static_cast<InsetExternal *>(inset()->clone(*lv_.buffer())));
ie.reset(static_cast<InsetExternal *>(inset()->clone(*buffer())));
ie->setFromParams(params());
ie->viewExternal();
@ -84,7 +85,7 @@ void ControlExternal::updateExternal()
view().apply();
boost::scoped_ptr<InsetExternal> ie;
ie.reset(static_cast<InsetExternal *>(inset()->clone(*lv_.buffer())));
ie.reset(static_cast<InsetExternal *>(inset()->clone(*buffer())));
ie->setFromParams(params());
ie->updateExternal();
@ -139,7 +140,7 @@ string const ControlExternal::Browse(string const & input) const
{
string const title = _("Select external file");
string const bufpath = lv_.buffer()->filePath();
string const bufpath = buffer()->filePath();
/// Determine the template file extension
ExternalTemplate const & et = params().templ;

View File

@ -28,7 +28,7 @@ void ControlFloat::applyParamsToInset()
{
inset()->placement(params().placement);
inset()->wide(params().wide);
lv_.view()->updateInset(inset(), true);
bufferview()->updateInset(inset(), true);
}

View File

@ -22,6 +22,9 @@
#include "ControlInset.h"
// needed to instatiate inset->hideDialog in ControlInset
#include "insets/insetfloat.h"
class InsetFloat;
///

View File

@ -15,8 +15,6 @@
#include "ControlForks.h"
#include "ViewBase.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
#include "lyxfunc.h"
#include "funcrequest.h"
@ -55,7 +53,7 @@ void ControlForks::kill(pid_t pid)
void ControlForks::apply()
{
if (!lv_.view()->available())
if (!bufferIsAvailable())
return;
view().apply();
@ -66,7 +64,7 @@ void ControlForks::apply()
for (vector<string>::const_iterator it = pids_.begin();
it != pids_.end(); ++it) {
lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_FORKS_KILL, *it));
lyxfunc().dispatch(FuncRequest(LFUN_FORKS_KILL, *it));
}
pids_.clear();

View File

@ -26,7 +26,6 @@
#include "buffer.h"
#include "BufferView.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "gettext.h"
#include "lyxrc.h"
@ -67,11 +66,11 @@ void ControlGraphics::applyParamsToInset()
{
// Set the parameters in the inset, it also returns true if the new
// parameters are different from what was in the inset already.
bool changed = inset()->setParams(params(), lv_.buffer()->filePath());
bool changed = inset()->setParams(params(), buffer()->filePath());
// Tell LyX we've got a change, and mark the document dirty,
// if it changed.
lv_.view()->updateInset(inset(), changed);
bufferview()->updateInset(inset(), changed);
}
@ -97,14 +96,14 @@ string const ControlGraphics::Browse(string const & in_name)
pair<string, string> dir1(_("Clipart|#C#c"), clipdir);
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
// Show the file browser dialog
return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
return browseRelFile(&lv_, in_name, buffer()->filePath(),
title, "*.*", dir1, dir2);
}
string const ControlGraphics::readBB(string const & file)
{
string const abs_file = MakeAbsPath(file, lv_.buffer()->filePath());
string const abs_file = MakeAbsPath(file, buffer()->filePath());
// try to get it from the file, if possible. Zipped files are
// unzipped in the readBB_from_PSFile-Function
@ -133,7 +132,7 @@ string const ControlGraphics::readBB(string const & file)
bool ControlGraphics::isFilenameValid(string const & fname) const
{
// It may be that the filename is relative.
string const name = MakeAbsPath(fname, lv_.buffer()->filePath());
string const name = MakeAbsPath(fname, buffer()->filePath());
return IsFileReadable(name);
}

View File

@ -21,6 +21,10 @@
#endif
#include "ControlInset.h"
// needed to instatiate inset->hideDialog in ControlInset
#include "insets/insetgraphics.h"
#include <utility>
#include <vector>

View File

@ -38,7 +38,7 @@ ControlInclude::ControlInclude(LyXView & lv, Dialogs & d)
void ControlInclude::applyParamsToInset()
{
inset()->set(params());
lv_.view()->updateInset(inset(), true);
bufferview()->updateInset(inset(), true);
}
@ -73,7 +73,7 @@ string const ControlInclude::Browse(string const & in_name, Type in_type)
void ControlInclude::load(string const & file)
{
lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_CHILDOPEN, file));
lyxfunc().dispatch(FuncRequest(LFUN_CHILDOPEN, file));
}

View File

@ -11,13 +11,9 @@
*/
#include "ControlInset.h"
#include "ButtonControllerBase.h"
#include "ViewBase.h"
#include "buffer.h"
#include "debug.h"
#include "frontends/LyXView.h"
#include "insets/insetfloat.h"
#include "insets/insetgraphics.h"
#include "support/LAssert.h"
#include <boost/bind.hpp>
@ -70,7 +66,7 @@ void ControlInset<Inset, Params>::show(Params const & params)
dialog_built_ = true;
}
bc().readOnly(isReadonly());
bc().readOnly(bufferIsReadonly());
view().show();
}
@ -91,7 +87,7 @@ void ControlInset<Inset, Params>::update()
return;
}
bc().readOnly(isReadonly());
bc().readOnly(bufferIsReadonly());
view().update();
}
@ -117,7 +113,7 @@ void ControlInset<Inset, Params>::hide()
template <class Inset, class Params>
void ControlInset<Inset, Params>::apply()
{
if (lv_.buffer()->isReadonly())
if (bufferIsReadonly())
return;
view().apply();

View File

@ -19,9 +19,8 @@
#endif
#include "ControlLog.h"
#include "BufferView.h"
#include "buffer.h"
#include "frontends/LyXView.h"
ControlLog::ControlLog(LyXView & lv, Dialogs & d)
@ -31,7 +30,7 @@ ControlLog::ControlLog(LyXView & lv, Dialogs & d)
void ControlLog::setParams()
{
logfile_ = lv_.view()->buffer()->getLogName();
logfile_ = buffer()->getLogName();
}

View File

@ -31,7 +31,7 @@ void ControlMinipage::applyParamsToInset()
inset()->pageWidth(params().pageWidth);
inset()->pos(params().pos);
lv_.view()->updateInset(inset(), true);
bufferview()->updateInset(inset(), true);
}

View File

@ -18,7 +18,6 @@
#include "ViewBase.h"
#include "ParagraphParameters.h"
#include "Liason.h"
#include "LyXView.h"
#include "BufferView.h"
#include "gettext.h"
#include "buffer.h"
@ -64,13 +63,13 @@ LyXAlignment ControlParagraph::alignPossible() const
void ControlParagraph::apply()
{
if (!lv_.view()->available())
if (!bufferIsAvailable())
return;
view().apply();
LyXText * text(lv_.view()->getLyXText());
text->setParagraph(lv_.view().get(),
LyXText * text(bufferview()->getLyXText());
text->setParagraph(bufferview(),
pp_->lineTop(),
pp_->lineBottom(),
pp_->pagebreakTop(),
@ -83,12 +82,12 @@ void ControlParagraph::apply()
pp_->noindent());
// Actually apply these settings
lv_.view()->update(text,
bufferview()->update(text,
BufferView::SELECT |
BufferView::FITCUR |
BufferView::CHANGE);
lv_.buffer()->markDirty();
buffer()->markDirty();
setMinibuffer(&lv_, _("Paragraph layout set"));
}
@ -100,7 +99,7 @@ void ControlParagraph::setParams()
pp_.reset(new ParagraphParameters());
/// get paragraph
Paragraph const * par_ = lv_.view()->getLyXText()->cursor.par();
Paragraph const * par_ = bufferview()->getLyXText()->cursor.par();
/// Set the paragraph parameters
*pp_ = par_->params();
@ -123,7 +122,7 @@ void ControlParagraph::setParams()
void ControlParagraph::changedParagraph()
{
/// get paragraph
Paragraph const * p = lv_.view()->getLyXText()->cursor.par();
Paragraph const * p = bufferview()->getLyXText()->cursor.par();
if (p == 0) // this is wrong as we don't set par_ here! /* || p == par_) */
return;

View File

@ -14,12 +14,9 @@
#include "ControlPreamble.h"
#include "ViewBase.h"
#include "frontends/LyXView.h"
#include "buffer.h"
#include "Liason.h"
#include "gettext.h"
#include "BufferView.h"
#include "support/LAssert.h"
ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
@ -30,13 +27,13 @@ ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
void ControlPreamble::apply()
{
if (!lv_.view()->available())
if (!bufferIsAvailable())
return;
view().apply();
lv_.buffer()->params.preamble = params();
lv_.buffer()->markDirty();
buffer()->params.preamble = params();
buffer()->markDirty();
Liason::setMinibuffer(&lv_, _("LaTeX preamble set"));
}
@ -51,7 +48,7 @@ string & ControlPreamble::params() const
void ControlPreamble::setParams()
{
delete params_;
params_ = new string(lv_.buffer()->params.preamble);
params_ = new string(buffer()->params.preamble);
}

View File

@ -21,13 +21,11 @@
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "frontends/LyXView.h"
#include "PrinterParams.h"
#include "Liason.h"
#include "helper_funcs.h"
#include "frontends/Alert.h"
#include "gettext.h"
#include "BufferView.h"
#include "support/LAssert.h"
using Liason::printBuffer;
@ -42,12 +40,12 @@ ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
void ControlPrint::apply()
{
if (!lv_.view()->available())
if (!bufferIsAvailable())
return;
view().apply();
if (!printBuffer(lv_.buffer(), params())) {
if (!printBuffer(buffer(), params())) {
Alert::alert(_("Error:"),
_("Unable to print"),
_("Check that your parameters are correct"));
@ -65,7 +63,7 @@ PrinterParams & ControlPrint::params() const
void ControlPrint::setParams()
{
if (params_) delete params_;
params_ = new PrinterParams(getPrinterParams(lv_.buffer()));
params_ = new PrinterParams(getPrinterParams(buffer()));
bc().valid(); // so that the user can press Ok
}
@ -86,6 +84,6 @@ string const ControlPrint::Browse(string const & in_name)
string const pattern = "*.ps";
// Show the file browser dialog
return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
return browseRelFile(&lv_, in_name, buffer()->filePath(),
title, pattern);
}

View File

@ -19,6 +19,7 @@
#include "ControlRef.h"
#include "lyxfunc.h"
#include "buffer.h"
#include "bufferlist.h"
#include "funcrequest.h"
@ -36,29 +37,28 @@ ControlRef::ControlRef(LyXView & lv, Dialogs & d)
vector<string> const ControlRef::getLabelList(string const & name) const
{
Buffer * buffer = bufferlist.getBuffer(MakeAbsPath(name));
if (!buffer)
buffer = lv_.buffer();
return buffer->getLabelList();
Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
if (!buf)
buf = buffer();
return buf->getLabelList();
}
void ControlRef::gotoRef(string const & ref) const
void ControlRef::gotoRef(string const & ref)
{
lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_REF_GOTO, ref));
lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
lyxfunc().dispatch(FuncRequest(LFUN_REF_GOTO, ref));
}
void ControlRef::gotoBookmark() const
void ControlRef::gotoBookmark()
{
lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
}
vector<string> const ControlRef::getBufferList() const
{
vector<string> buffers = bufferlist.getFileNames();
for (vector<string>::iterator it = buffers.begin();
it != buffers.end(); ++it) {
@ -72,7 +72,7 @@ vector<string> const ControlRef::getBufferList() const
int ControlRef::getBufferNum() const
{
vector<string> buffers = bufferlist.getFileNames();
string const name = lv_.buffer()->fileName();
string const name = buffer()->fileName();
vector<string>::const_iterator cit =
find(buffers.begin(), buffers.end(), name);
if (cit == buffers.end())

View File

@ -31,9 +31,9 @@ public:
///
std::vector<string> const getLabelList(string const &) const;
///
void gotoRef(string const &) const;
void gotoRef(string const &);
///
void gotoBookmark() const;
void gotoBookmark();
///
std::vector<string> const getBufferList() const;
///

View File

@ -19,12 +19,9 @@
#include "ControlSearch.h"
#include "Liason.h"
#include "buffer.h"
#include "lyxfind.h"
#include "gettext.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
#include "support/lstrings.h"
@ -37,9 +34,9 @@ ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
void ControlSearch::find(string const & search,
bool casesensitive, bool matchword, bool forward) const
bool casesensitive, bool matchword, bool forward)
{
bool const found = lyxfind::LyXFind(lv_.view().get(), search,
bool const found = lyxfind::LyXFind(bufferview(), search,
forward, casesensitive,
matchword);
@ -49,14 +46,14 @@ void ControlSearch::find(string const & search,
void ControlSearch::replace(string const & search, string const & replace,
bool casesensitive, bool matchword, bool all) const
bool casesensitive, bool matchword, bool all)
{
// If not replacing all instances of the word, then do not
// move on to the next instance once the present instance has been
// changed
bool const once = !all;
int const replace_count =
lyxfind::LyXReplace(lv_.view().get(),
lyxfind::LyXReplace(bufferview(),
search, replace, true, casesensitive,
matchword, all, once);

View File

@ -31,11 +31,11 @@ public:
/// Searches occurence of string
void find(string const & search,
bool casesensitive, bool matchword, bool forward) const;
bool casesensitive, bool matchword, bool forward);
/// Replaces occurence of string
void replace(string const & search, string const & replace,
bool casesensitive, bool matchword, bool all) const;
bool casesensitive, bool matchword, bool all);
private:
/// not needed.

View File

@ -14,8 +14,6 @@
#include "ControlSendto.h"
#include "ViewBase.h"
#include "frontends/LyXView.h"
#include "BufferView.h"
#include "buffer.h"
#include "converter.h"
#include "exporter.h"
@ -43,13 +41,13 @@ vector<Format const *> const ControlSendto::allFormats() const
exports.push_back("lyx");
exports.push_back("text");
if (lv_.buffer()->isLatex())
if (buffer()->isLatex())
exports.push_back("latex");
if (lv_.buffer()->isLinuxDoc())
if (buffer()->isLinuxDoc())
exports.push_back("linuxdoc");
if (lv_.buffer()->isDocBook())
if (buffer()->isDocBook())
exports.push_back("docbook");
if (lv_.buffer()->isLiterate())
if (buffer()->isLiterate())
exports.push_back("literate");
// Loop over these native formats and ascertain what formats we
@ -104,7 +102,7 @@ void ControlSendto::setCommand(string const & cmd)
void ControlSendto::apply()
{
if (!lv_.view()->available())
if (!bufferIsAvailable())
return;
view().apply();
@ -117,15 +115,15 @@ void ControlSendto::apply()
// Output to filename
if (format_->name() == "lyx") {
filename = ChangeExtension(lv_.buffer()->getLatexName(false),
filename = ChangeExtension(buffer()->getLatexName(false),
format_->extension());
if (!lv_.buffer()->tmppath.empty())
filename = AddName(lv_.buffer()->tmppath, filename);
if (!buffer()->tmppath.empty())
filename = AddName(buffer()->tmppath, filename);
lv_.buffer()->writeFile(filename);
buffer()->writeFile(filename);
} else {
Exporter::Export(lv_.buffer(), format_->name(), true, filename);
Exporter::Export(buffer(), format_->name(), true, filename);
}
// Substitute $$FName for filename

View File

@ -24,7 +24,6 @@
#include "Dialogs.h"
#include "Liason.h"
#include "frontends/LyXView.h"
#include "frontends/Alert.h"
#include "support/lstrings.h"
@ -49,15 +48,15 @@ void ControlSpellchecker::setParams()
#ifdef USE_PSPELL
if (lyxrc.use_pspell) {
tmp = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : lv_.buffer()->params.language->code();
lyxrc.isp_alt_lang : buffer()->params.language->code();
speller_ = new PSpell(lv_.view()->buffer()->params, tmp);
speller_ = new PSpell(buffer()->params, tmp);
} else {
#endif
tmp = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : lv_.buffer()->params.language->lang();
lyxrc.isp_alt_lang : buffer()->params.language->lang();
speller_ = new ISpell(lv_.view()->buffer()->params, tmp);
speller_ = new ISpell(buffer()->params, tmp);
#ifdef USE_PSPELL
}
#endif
@ -67,7 +66,7 @@ void ControlSpellchecker::setParams()
if (lang)
rtl_ = lang->RightToLeft();
} else {
rtl_ = lv_.buffer()->params.language->RightToLeft();
rtl_ = buffer()->params.language->RightToLeft();
}
if (!speller_->error().empty()) {
@ -86,12 +85,12 @@ void ControlSpellchecker::check()
stop_ = false;
// clear any old selection
LyXText * text = lv_.view()->getLyXText();
lv_.view()->toggleSelection(true);
lv_.view()->update(text, BufferView::SELECT);
LyXText * text = bufferview()->getLyXText();
bufferview()->toggleSelection(true);
bufferview()->update(text, BufferView::SELECT);
while ((res == SpellBase::OK || res == SpellBase::IGNORE) && !stop_) {
word_ = lv_.view()->nextWord(newval_);
word_ = bufferview()->nextWord(newval_);
if (word_.word().empty()) {
clearParams();
@ -118,7 +117,7 @@ void ControlSpellchecker::check()
}
if (!stop_ && !word_.word().empty())
lv_.view()->selectLastWord();
bufferview()->selectLastWord();
// set suggestions
if (res != SpellBase::OK && res != SpellBase::IGNORE) {
@ -129,7 +128,7 @@ void ControlSpellchecker::check()
void ControlSpellchecker::replace(string const & replacement)
{
lv_.view()->replaceWord(replacement);
bufferview()->replaceWord(replacement);
// fix up the count
--count_;
check();
@ -180,7 +179,7 @@ void ControlSpellchecker::ignoreAll()
void ControlSpellchecker::stop()
{
stop_ = true;
lv_.view()->endOfSpellCheck();
bufferview()->endOfSpellCheck();
}
@ -215,7 +214,7 @@ void ControlSpellchecker::clearParams()
delete speller_;
lv_.view()->endOfSpellCheck();
bufferview()->endOfSpellCheck();
// show closing message if any words were checked.
if (count_ > 0)

View File

@ -19,11 +19,9 @@
#include "ControlTabularCreate.h"
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "BufferView.h"
#include "lyxfunc.h"
#include "funcrequest.h"
#include "frontends/LyXView.h"
#include "support/lstrings.h"
@ -47,11 +45,11 @@ void ControlTabularCreate::setParams()
void ControlTabularCreate::apply()
{
if (!lv_.view()->available())
if (!bufferIsAvailable())
return;
view().apply();
string const val = tostr(params().first) + " " + tostr(params().second);
lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_TABULAR_INSERT, val));
lyxfunc().dispatch(FuncRequest(LFUN_TABULAR_INSERT, val));
}

View File

@ -19,7 +19,6 @@
#include "ControlTexinfo.h"
#include "Dialogs.h"
#include "BufferView.h"
#include "gettext.h"
#include "helper_funcs.h"
#include "tex_helpers.h"

View File

@ -15,11 +15,8 @@
#include "ControlThesaurus.h"
#include "Liason.h"
#include "lyxfind.h"
#include "buffer.h"
#include "gettext.h"
#include "BufferView.h"
#include "frontends/LyXView.h"
using Liason::setMinibuffer;
@ -43,7 +40,7 @@ void ControlThesaurus::replace(string const & newstr)
* deletion/change !
*/
int const replace_count =
lyxfind::LyXReplace(lv_.view().get(), oldstr_, newstr,
lyxfind::LyXReplace(bufferview(), oldstr_, newstr,
true, true, true, false, true);
oldstr_ = newstr;

View File

@ -19,8 +19,6 @@
#include "ControlToc.h"
#include "toc.h"
#include "Dialogs.h"
#include "BufferView.h"
#include "support/lstrings.h" // tostr
@ -41,7 +39,7 @@ void ControlToc::goTo(toc::TocItem const & item) const
vector<string> const ControlToc::getTypes() const
{
return toc::getTypes(lv_.view()->buffer());
return toc::getTypes(buffer());
}
@ -50,11 +48,11 @@ toc::Toc const ControlToc::getContents(string const & type) const
toc::Toc empty_list;
// This shouldn't be possible...
if (!lv_.view()->available()) {
if (!bufferIsAvailable()) {
return empty_list;
}
toc::TocList tmp = toc::getTocList(lv_.view()->buffer());
toc::TocList tmp = toc::getTocList(buffer());
toc::TocList::iterator it = tmp.find(type);
if (it == tmp.end()) {
return empty_list;

View File

@ -22,11 +22,9 @@
#include "Lsstream.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "BufferView.h"
#include "lyxrc.h"
#include "gettext.h"
#include "frontends/LyXView.h"
#include "support/lyxlib.h"
@ -42,13 +40,13 @@ ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
string const ControlVCLog::getBufferFileName() const
{
return lv_.view()->buffer()->fileName();
return buffer()->fileName();
}
stringstream & ControlVCLog::getVCLogFile(stringstream & ss) const
{
string const name = lv_.view()->buffer()->lyxvc.getLogFile();
string const name = buffer()->lyxvc.getLogFile();
std::ifstream in(name.c_str());

View File

@ -1,3 +1,12 @@
2002-08-12 Angus Leeming <leeming@lyx.org>
* FormCitation.C:
* FromRef.C: change due to change of ControlConnections method name,
isReadonly() -> bufferIsReadonly().
* FormIndex.C:
* FormPrint.C: no longer #include "frontends/LyXView.h".
2002-08-12 Angus Leeming <leeming@lyx.org>
* Dialogs.C (c-tor): connect the Tooltips::toggleEnabled method to

View File

@ -307,7 +307,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
fl_set_browser_topline(dialog_->browser_cite, n+1);
}
if (!controller().isReadonly()) {
if (!controller().bufferIsReadonly()) {
if (cit != citekeys.end()) {
setBibButtons(OFF);
setCiteButtons(ON);
@ -322,7 +322,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
if (sel < 1 || sel > citekeys.size())
return ButtonPolicy::SMI_NOOP;
if (!controller().isReadonly()) {
if (!controller().bufferIsReadonly()) {
setBibButtons(OFF);
setCiteButtons(ON);
}

View File

@ -15,7 +15,6 @@
#include "xformsBC.h"
#include "ControlIndex.h"
#include "FormIndex.h"
#include "frontends/LyXView.h"
#include "forms/form_index.h"
#include FORMS_H_LOCATION

View File

@ -18,8 +18,6 @@
#include "FormPrint.h"
#include "forms/form_print.h"
#include "frontends/LyXView.h"
#include "PrinterParams.h"
#include "input_validators.h"

View File

@ -200,7 +200,7 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
if (sel < 1 || sel > refs_.size())
return ButtonPolicy::SMI_NOOP;
if (!controller().isReadonly()) {
if (!controller().bufferIsReadonly()) {
string s = fl_get_browser_line(dialog_->browser_refs, sel);
fl_set_input(dialog_->input_ref, s.c_str());
}