+2002-08-12 Angus Leeming <leeming@lyx.org>
+
+ * buffer.[Ch] (getLabelList): constify.
2002-08-07 André Pönitz <poenitz@gmx.net>
}
-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());
}
///
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. */
+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.
#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"
// 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();
}
#endif
#include "ControlBibtex.h"
+#include "buffer.h"
#include "BufferView.h"
#include "lyxrc.h"
#include "helper_funcs.h"
#include "gettext.h"
#include "support/lstrings.h"
-#include "frontends/LyXView.h"
using std::pair;
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();
}
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);
}
#include "bufferview_funcs.h" // ToggleAndShow
#include "gettext.h"
#include "language.h"
-#include "BufferView.h"
#include "frontends/LyXView.h"
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"));
}
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));
#endif
#include "ControlCitation.h"
+#include "buffer.h"
using std::vector;
using std::pair;
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;
bool ControlCitation::usingNatbib() const
{
- return lv_.buffer()->params.use_natbib;
+ return buffer()->params.use_natbib;
}
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);
#include "ControlCommand.h"
#include "buffer.h"
#include "Dialogs.h"
-#include "frontends/LyXView.h"
#include "lyxfunc.h"
#include "BufferView.h"
#include "funcrequest.h"
void ControlCommand::applyParamsToInset()
{
inset()->setParams(params());
- lv_.view()->updateInset(inset(), true);
+ bufferview()->updateInset(inset(), true);
}
{
if (action_ == LFUN_NOACTION)
return;
- lv_.getLyXFunc()->dispatch(FuncRequest(action_, params().getAsString()));
+ lyxfunc().dispatch(FuncRequest(action_, params().getAsString()));
}
* \author John Levon <levon@movementarian.org>
*/
+#include <config.h>
+
#ifdef __GNUG__
#pragma implementation
#endif
#ifndef CONTROLCOMMANDBUFFER_H
#define CONTROLCOMMANDBUFFER_H
-#include <config.h>
-
#include "LString.h"
#include <vector>
#include "ViewBase.h"
#include "Dialogs.h"
#include "buffer.h"
+#include "BufferView.h"
#include "frontends/LyXView.h"
}
-bool ControlConnectBase::isReadonly() const
+bool ControlConnectBase::bufferIsReadonly() const
{
if (!lv_.buffer())
return true;
}
+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())
#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
///
ControlConnectBase(LyXView &, Dialogs &);
/// The View may need to know if the buffer is read-only.
- bool isReadonly() const;
+ bool bufferIsReadonly() const;
///
DocTypes docType() const;
*/
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_;
*/
#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)
template <class Base>
void ControlDialog<Base>::show()
{
- if (isBufferDependent() && !lv_.view()->available())
+ if (isBufferDependent() && !bufferIsAvailable())
return;
connect();
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();
return;
}
- bc().readOnly(isReadonly());
+ bc().readOnly(bufferIsReadonly());
view().update();
}
void ControlERT::applyParamsToInset()
{
- inset()->status(lv_.view().get(), params().status);
+ inset()->status(bufferview(), params().status);
}
#endif
#include "ControlExternal.h"
+#include "buffer.h"
#include "BufferView.h"
#include "gettext.h"
#include "helper_funcs.h"
void ControlExternal::applyParamsToInset()
{
inset()->setFromParams(params());
- lv_.view()->updateInset(inset(), true);
+ bufferview()->updateInset(inset(), true);
}
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();
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();
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();
{
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;
{
inset()->placement(params().placement);
inset()->wide(params().wide);
- lv_.view()->updateInset(inset(), true);
+ bufferview()->updateInset(inset(), true);
}
#include "ControlInset.h"
+// needed to instatiate inset->hideDialog in ControlInset
+#include "insets/insetfloat.h"
+
class InsetFloat;
///
#include "ControlForks.h"
#include "ViewBase.h"
-#include "BufferView.h"
-#include "frontends/LyXView.h"
#include "lyxfunc.h"
#include "funcrequest.h"
void ControlForks::apply()
{
- if (!lv_.view()->available())
+ if (!bufferIsAvailable())
return;
view().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();
#include "buffer.h"
#include "BufferView.h"
#include "Dialogs.h"
-#include "frontends/LyXView.h"
#include "gettext.h"
#include "lyxrc.h"
{
// 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);
}
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
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);
}
#endif
#include "ControlInset.h"
+
+// needed to instatiate inset->hideDialog in ControlInset
+#include "insets/insetgraphics.h"
+
#include <utility>
#include <vector>
void ControlInclude::applyParamsToInset()
{
inset()->set(params());
- lv_.view()->updateInset(inset(), true);
+ bufferview()->updateInset(inset(), true);
}
void ControlInclude::load(string const & file)
{
- lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_CHILDOPEN, file));
+ lyxfunc().dispatch(FuncRequest(LFUN_CHILDOPEN, file));
}
*/
#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>
dialog_built_ = true;
}
- bc().readOnly(isReadonly());
+ bc().readOnly(bufferIsReadonly());
view().show();
}
return;
}
- bc().readOnly(isReadonly());
+ bc().readOnly(bufferIsReadonly());
view().update();
}
template <class Inset, class Params>
void ControlInset<Inset, Params>::apply()
{
- if (lv_.buffer()->isReadonly())
+ if (bufferIsReadonly())
return;
view().apply();
#endif
#include "ControlLog.h"
-#include "BufferView.h"
+#include "buffer.h"
-#include "frontends/LyXView.h"
ControlLog::ControlLog(LyXView & lv, Dialogs & d)
void ControlLog::setParams()
{
- logfile_ = lv_.view()->buffer()->getLogName();
+ logfile_ = buffer()->getLogName();
}
inset()->pageWidth(params().pageWidth);
inset()->pos(params().pos);
- lv_.view()->updateInset(inset(), true);
+ bufferview()->updateInset(inset(), true);
}
#include "ViewBase.h"
#include "ParagraphParameters.h"
#include "Liason.h"
-#include "LyXView.h"
#include "BufferView.h"
#include "gettext.h"
#include "buffer.h"
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(),
pp_->noindent());
// Actually apply these settings
- lv_.view()->update(text,
- BufferView::SELECT |
- BufferView::FITCUR |
- BufferView::CHANGE);
+ bufferview()->update(text,
+ BufferView::SELECT |
+ BufferView::FITCUR |
+ BufferView::CHANGE);
- lv_.buffer()->markDirty();
+ buffer()->markDirty();
setMinibuffer(&lv_, _("Paragraph layout set"));
}
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();
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;
#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)
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"));
}
void ControlPreamble::setParams()
{
delete params_;
- params_ = new string(lv_.buffer()->params.preamble);
+ params_ = new string(buffer()->params.preamble);
}
#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;
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"));
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
}
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);
}
#include "ControlRef.h"
#include "lyxfunc.h"
+#include "buffer.h"
#include "bufferlist.h"
#include "funcrequest.h"
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) {
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())
///
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;
///
#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"
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);
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);
/// 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.
#include "ControlSendto.h"
#include "ViewBase.h"
-#include "frontends/LyXView.h"
-#include "BufferView.h"
#include "buffer.h"
#include "converter.h"
#include "exporter.h"
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
void ControlSendto::apply()
{
- if (!lv_.view()->available())
+ if (!bufferIsAvailable())
return;
view().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
#include "Dialogs.h"
#include "Liason.h"
-#include "frontends/LyXView.h"
#include "frontends/Alert.h"
#include "support/lstrings.h"
#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
if (lang)
rtl_ = lang->RightToLeft();
} else {
- rtl_ = lv_.buffer()->params.language->RightToLeft();
+ rtl_ = buffer()->params.language->RightToLeft();
}
if (!speller_->error().empty()) {
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();
}
if (!stop_ && !word_.word().empty())
- lv_.view()->selectLastWord();
+ bufferview()->selectLastWord();
// set suggestions
if (res != SpellBase::OK && res != SpellBase::IGNORE) {
void ControlSpellchecker::replace(string const & replacement)
{
- lv_.view()->replaceWord(replacement);
+ bufferview()->replaceWord(replacement);
// fix up the count
--count_;
check();
void ControlSpellchecker::stop()
{
stop_ = true;
- lv_.view()->endOfSpellCheck();
+ bufferview()->endOfSpellCheck();
}
delete speller_;
- lv_.view()->endOfSpellCheck();
+ bufferview()->endOfSpellCheck();
// show closing message if any words were checked.
if (count_ > 0)
#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"
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));
}
#include "ControlTexinfo.h"
#include "Dialogs.h"
-#include "BufferView.h"
#include "gettext.h"
#include "helper_funcs.h"
#include "tex_helpers.h"
#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;
* 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;
#include "ControlToc.h"
#include "toc.h"
-#include "Dialogs.h"
-#include "BufferView.h"
#include "support/lstrings.h" // tostr
vector<string> const ControlToc::getTypes() const
{
- return toc::getTypes(lv_.view()->buffer());
+ return toc::getTypes(buffer());
}
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;
#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"
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());
+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
fl_set_browser_topline(dialog_->browser_cite, n+1);
}
- if (!controller().isReadonly()) {
+ if (!controller().bufferIsReadonly()) {
if (cit != citekeys.end()) {
setBibButtons(OFF);
setCiteButtons(ON);
if (sel < 1 || sel > citekeys.size())
return ButtonPolicy::SMI_NOOP;
- if (!controller().isReadonly()) {
+ if (!controller().bufferIsReadonly()) {
setBibButtons(OFF);
setCiteButtons(ON);
}
#include "xformsBC.h"
#include "ControlIndex.h"
#include "FormIndex.h"
-#include "frontends/LyXView.h"
#include "forms/form_index.h"
#include FORMS_H_LOCATION
#include "FormPrint.h"
#include "forms/form_print.h"
-#include "frontends/LyXView.h"
-
#include "PrinterParams.h"
#include "input_validators.h"
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());
}