#include "lyxrc.h"
#include "paragraph.h"
-#include "insets/updatableinset.h"
using lyx::pos_type;
return;
}
- InsetOld * inset = par.inInset();
- if (inset && inset->lyxCode() == InsetOld::ERT_CODE) {
+ if (par.ownerCode() == InsetBase::ERT_CODE) {
start_ = -1;
return;
}
* lyxfunc.C (dispatch): output lyxrc.write("preferences", false).
+2004-04-07 André Pönitz <poenitz@gmx.net>
+
+ * cursor.[Ch] (selClear, adjust): remove math
+
+ * cursor_slice.C: more agressive assert
+
+ * lyxfunc.C:
+ * BufferView_pimpl.C: rework mouse event dispatch
+
+ * dociterator.C:
+ * paragraph.C:
+ * text2.C:
+ * text3.C: adjust
+
2004-04-05 André Pönitz <poenitz@gmx.net>
* cursor.[Ch] (valign, halign...): remove unneeded functions
int endpos = cur.selEnd().pos();
- BufferParams const & bufparams = cur.bv().buffer()->params();
+ BufferParams const & bufparams = cur.buffer().params();
boost::tie(endpit, endpos) = realcut ?
cutSelection(bufparams,
text->paragraphs(),
++pos;
copySelection(pars, par, cur.selEnd().par(),
- pos, cur.selEnd().pos(), cur.bv().buffer()->params().textclass);
+ pos, cur.selEnd().pos(), cur.buffer().params().textclass);
}
ErrorList el;
boost::tie(ppp, endpit) =
- pasteSelection(*cur.bv().buffer(),
+ pasteSelection(cur.buffer(),
text->paragraphs(),
cur.par(), cur.pos(),
- cur.bv().buffer()->params().textclass,
+ cur.buffer().params().textclass,
sel_index, el);
- bufferErrors(*cur.bv().buffer(), el);
- text->bv()->showErrorList(_("Paste"));
+ bufferErrors(cur.buffer(), el);
+ cur.bv().showErrorList(_("Paste"));
text->redoParagraphs(cur.par(), endpit);
// Get font setting before we cut
pos_type pos = cur.selEnd().pos();
LyXFont const font = text->getPar(cur.selBegin().par()).
- getFontSettings(cur.bv().buffer()->params(), cur.selBegin().pos());
+ getFontSettings(cur.buffer().params(), cur.selBegin().pos());
// Insert the new string
string::const_iterator cit = str.begin();
/// set default alignment
os << "\\aligndefault " << layout->align << '\n';
- /// is paragraph in inset
- os << "\\ininset " << (par.inInset()?1:0) << '\n';
+ /// paragraph is always in inset. This is redundant.
+ os << "\\ininset " << 1 << '\n';
data = os.str();
}
pars[par].checkInsertChar(font);
// insert the string, don't insert doublespace
bool space_inserted = true;
- bool autobreakrows = !pars[par].inInset() ||
- static_cast<InsetText *>(pars[par].inInset())->getAutoBreakRows();
+ bool autobreakrows = pars[par].autoBreakRows();
for (string::const_iterator cit = str.begin();
cit != str.end(); ++cit) {
if (*cit == '\n') {
BufferView & LCursor::bv() const
{
+ BOOST_ASSERT(bv_);
return *bv_;
}
+Buffer & LCursor::buffer() const
+{
+ BOOST_ASSERT(bv_);
+ BOOST_ASSERT(bv_->buffer());
+ return *bv_->buffer();
+}
+
+
void LCursor::pop()
{
BOOST_ASSERT(size() >= 1);
#include <iosfwd>
#include <vector>
+class Buffer;
class BufferView;
class FuncStatus;
class FuncRequest;
void resetAnchor();
/// access to owning BufferView
BufferView & bv() const;
+ /// access to owning Buffer
+ Buffer & buffer() const;
/// get some interesting description of top position
void info(std::ostream & os) const;
/// are we in math mode (2), text mode (1) or unsure (0)?
void reset(InsetBase &);
/// for spellchecking
void replaceWord(std::string const & replacestring);
- /// update our view
- void update();
/// the event was not (yet) dispatched
void undispatched();
/// the event was already dispatched
if (!dialog_->displayCB->isChecked())
igp.display = lyx::graphics::NoDisplay;
- string value(fromqstr(dialog_->width->text()));
+ string value = fromqstr(dialog_->width->text());
if (dialog_->widthUnit->currentItem() > 0) {
// width/height combination
- int const unitNo = getUnitNo(unit_name_gui,
- fromqstr(dialog_->widthUnit->currentText()));
+ QString const text = dialog_->widthUnit->currentText();
+ int const unitNo = getUnitNo(unit_name_gui, fromqstr(text));
igp.width = LyXLength(value + unit_name_ltx[unitNo]);
igp.scale = 0.0;
} else {
igp.width = LyXLength();
}
value = fromqstr(dialog_->height->text());
- int const unitNo = getUnitNo(unit_name_gui,
- fromqstr(dialog_->heightUnit->currentText()));
+ QString text = dialog_->heightUnit->currentText();
+ int const unitNo = getUnitNo(unit_name_gui, fromqstr(text));
igp.height = LyXLength(value + unit_name_ltx[unitNo]);
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
igp.lyxscale = strToInt(fromqstr(dialog_->displayscale->text()));
igp.rotateAngle = strToDbl(fromqstr(dialog_->angle->text()));
+#warning Guess what happens if the user enters '1e30' here?
while (igp.rotateAngle < -360.0)
igp.rotateAngle += 360.0;
while (igp.rotateAngle > 360.0)
#include <map>
+
namespace {
struct InsetName {
InsetBase::Code code;
};
+
typedef std::map<std::string, InsetBase::Code> TranslatorMap;
+
TranslatorMap const build_translator()
{
InsetName const insetnames[] = {
bool InsetBase::covers(int x, int y) const
{
+ //lyxerr << "InsetBase::covers, x: " << x << " y: " << y
+ // << " xo: " << xo() << " yo: " << yo()
+ // << " x1: " << xo() << " x2: " << xo() + width()
+ // << " y1: " << yo() - ascent() << " y2: " << yo() + descent()
+ // << std::endl;
return x >= xo()
&& x <= xo() + width()
&& y >= yo() - ascent()
#include "insetbranch.h"
#include "buffer.h"
-#include "BufferView.h"
#include "bufferparams.h"
#include "BranchList.h"
#include "cursor.h"
} else if (cmd.argument == "assign"
|| cmd.argument.empty()) {
BranchList const & branchlist =
- cur.bv().buffer()->params().branchlist();
+ cur.buffer().params().branchlist();
if (isBranchSelected(branchlist)) {
if (status() != Open)
setStatus(Open);
switch (cmd.action) {
case LFUN_EXTERNAL_EDIT: {
- Buffer const & buffer = *cur.bv().buffer();
+ Buffer const & buffer = cur.buffer();
InsetExternalParams p;
InsetExternalMailer::string2params(cmd.argument, buffer, p);
external::editExternal(p, buffer);
}
case LFUN_INSET_MODIFY: {
- Buffer const & buffer = *cur.bv().buffer();
+ Buffer const & buffer = cur.buffer();
InsetExternalParams p;
InsetExternalMailer::string2params(cmd.argument, buffer, p);
setParams(p, buffer);
+#warning is this needed?
cur.bv().update();
break;
}
params_.placement = params.placement;
params_.wide = params.wide;
params_.sideways = params.sideways;
- wide(params_.wide, cur.bv().buffer()->params());
- sideways(params_.sideways, cur.bv().buffer()->params());
+ wide(params_.wide, cur.buffer().params());
+ sideways(params_.sideways, cur.buffer().params());
cur.bv().update();
break;
}
{
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
- Buffer const & buffer = *cur.bv().buffer();
+ Buffer const & buffer = cur.buffer();
InsetGraphicsParams p;
InsetGraphicsMailer::string2params(cmd.argument, buffer, p);
if (!p.filename.empty()) {
InsetCommandParams p;
InsetIncludeMailer::string2params(cmd.argument, p);
if (!p.getCmdName().empty()) {
- set(p, *cur.bv().buffer());
+ set(p, cur.buffer());
cur.bv().update();
}
break;
maxCols = max(cols, maxCols);
paste_tabular.reset(
- new LyXTabular(cur.bv().buffer()->params(), rows, maxCols));
+ new LyXTabular(cur.buffer().params(), rows, maxCols));
string::size_type op = 0;
int cell = 0;
ostringstream os;
OutputParams const runparams;
- paste_tabular->plaintext(*cur.bv().buffer(), os, runparams, 0, true, '\t');
+ paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
cur.bv().stuffClipboard(os.str());
return true;
}
if (!cur.selection())
return;
- bool const track = cur.bv().buffer()->params().tracking_changes;
+ bool const track = cur.buffer().params().tracking_changes;
int rs, re, cs, ce;
getSelection(cur, rs, re, cs, ce);
for (int i = rs; i <= re; ++i)
}
cur.clearSelection();
- mergeParagraph(cur.bv().buffer()->params(), paragraphs(), 0);
+ mergeParagraph(cur.buffer().params(), paragraphs(), 0);
}
}
OutputParams const &) const;
///
int linuxdoc(Buffer const &, std::ostream &,
- OutputParams const &) const ;
+ OutputParams const &) const;
///
int docbook(Buffer const &, std::ostream &,
- OutputParams const &) const ;
+ OutputParams const &) const;
///
void validate(LaTeXFeatures & features) const;
///
}
+
WriteStream::WriteStream(ostream & os, bool fragile, bool latex)
: os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
pendingspace_(false), line_(0)
///
WriteStream(std::ostream & os, bool fragile, bool latex);
///
- explicit WriteStream(std::ostream & os_);
+ explicit WriteStream(std::ostream & os);
///
~WriteStream();
///
#include "debug.h"
#include "metricsinfo.h"
#include "output_latex.h"
+#include "outputparams.h"
#include "paragraph.h"
#include "texrow.h"
}
-void MathMBoxInset::write(WriteStream & os) const
+void MathMBoxInset::write(WriteStream & ws) const
{
- os << "\\mbox{\n";
- text_.write(*bv_->buffer(), os.os());
- os << "}";
+ if (ws.latex()) {
+ ws << "\\mbox{\n";
+ TexRow texrow;
+ OutputParams runparams;
+ latexParagraphs(*bv_->buffer(), text_.paragraphs(),
+ ws.os(), texrow, runparams);
+ ws.addlines(texrow.rows());
+ ws << "}";
+ } else {
+ ws << "\\mbox{\n";
+ text_.write(*bv_->buffer(), ws.os());
+ ws << "}";
+ }
}
void MathNestInset::notifyCursorLeaves(LCursor & cur)
{
-/*
+#warning look here
+#if 0
MathArray & ar = cur.cell();
// remove base-only "scripts"
for (pos_type i = 0; i + 1 < size(); ++i) {
MathScriptInset * p = operator[](i).nucleus()->asScriptInset();
- if (p && p->cell(0).empty() && p->cell(1).empty()) {
+ if (p && p->nargs() == 1) {
MathArray ar = p->nuc();
erase(i);
insert(i, ar);
- mathcursor->adjust(i, ar.size() - 1);
+ cur.adjust(i, ar.size() - 1);
}
}
if (p && q && p->name() == q->name()) {
p->cell(0).append(q->cell(0));
erase(i + 1);
- mathcursor->adjust(i, -1);
+ cur.adjust(i, -1);
}
}
-*/
+#endif
}
lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '"
<< everypar << "'" << endl;
BufferParams const & bparams = buf.params();
-
- InsetOld const * in = pit->inInset();
bool further_blank_line = false;
LyXLayout_ptr style;
// length (all in one row) if that is true then we don't allow
// any special options in the paragraph and also we don't allow
// any environment other then "Standard" to be valid!
- if (in == 0 || !in->forceDefaultParagraphs(in)) {
+ if (!pit->forceDefaultParagraphs()) {
style = pit->layout();
if (pit->params().startOfAppendix()) {
}
}
- if (in == 0 || !in->forceDefaultParagraphs(in)) {
+ if (!pit->forceDefaultParagraphs()) {
further_blank_line = false;
if (further_blank_line) {
// if only_body
while (par != endpar) {
- InsetOld * in = par->inInset();
// well we have to check if we are in an inset with unlimited
// length (all in one row) if that is true then we don't allow
// any special options in the paragraph and also we don't allow
// any environment other then "Standard" to be valid!
- if (in == 0 || !in->forceDefaultParagraphs(in)) {
+ if (!par->forceDefaultParagraphs()) {
LyXLayout_ptr const & layout = par->layout();
if (layout->intitle) {
#include "support/types.h"
+
struct OutputParams {
- enum FLAVOR {
- LATEX,
- PDFLATEX
- };
+ //
+ enum FLAVOR {
+ LATEX,
+ PDFLATEX
+ };
- OutputParams() : flavor(LATEX), nice(false),
- moving_arg(false), free_spacing(false),
- use_babel(false), mixed_content(false),
- linelen(0) {}
+ OutputParams()
+ : flavor(LATEX), nice(false), moving_arg(false),
+ free_spacing(false), use_babel(false),
+ mixed_content(false), linelen(0)
+ {}
/** The latex that we export depends occasionally on what is to
compile the file.
*/
- FLAVOR flavor;
+ FLAVOR flavor;
/** Are we to write a 'nice' LaTeX file or not.
This esentially seems to mean whether InsetInclude, InsetGraphics
bool free_spacing;
/** This var is set by the return value from BufferParams::writeLaTeX
- */
+ */
bool use_babel;
/** Used for docbook to see if inside a region of mixed content.
In that case all the white spaces are significant and can not appear
at the begin or end.
- */
+ */
bool mixed_content;
- /** Line lenght to use with ascii export.
- */
+ /** Line length to use with ascii export.
+ */
lyx::size_type linelen;
};
bool Paragraph::insetAllowed(InsetOld_code code)
{
- //lyxerr << "Paragraph::InsertInsetAllowed" << endl;
- if (pimpl_->inset_owner)
- return pimpl_->inset_owner->insetAllowed(code);
- return true;
+ return pimpl_->inset_owner->insetAllowed(code);
}
}
+bool Paragraph::forceDefaultParagraphs() const
+{
+ return inInset()->forceDefaultParagraphs(inInset());
+}
+
+
+bool Paragraph::autoBreakRows() const
+{
+ return static_cast<InsetText *>(inInset())->getAutoBreakRows();
+}
+
+
namespace {
// paragraphs inside floats need different alignment tags to avoid
// unwanted space
-bool noTrivlistCentering(UpdatableInset const * inset)
+bool noTrivlistCentering(InsetBase::Code code)
{
- if (inset) {
- InsetBase::Code const code = inset->lyxCode();
- return code == InsetBase::FLOAT_CODE ||
- code == InsetBase::WRAP_CODE;
- }
- return false;
+ return code == InsetBase::FLOAT_CODE || code == InsetBase::WRAP_CODE;
}
string const corrected_env(string const & suffix, string const & env,
- UpdatableInset const * inset)
+ InsetBase::Code code)
{
string output = suffix + "{";
- if (noTrivlistCentering(inset))
+ if (noTrivlistCentering(code))
output += correction(env);
else
output += env;
break;
case LYX_ALIGN_LEFT: {
string output;
- UpdatableInset const * const inset = pimpl_->inset_owner;
if (getParLanguage(bparams)->babel() != "hebrew")
- output = corrected_env("\\begin", "flushleft", inset);
+ output = corrected_env("\\begin", "flushleft", ownerCode());
else
- output = corrected_env("\\begin", "flushright", inset);
+ output = corrected_env("\\begin", "flushright", ownerCode());
os << output;
column += output.size();
break;
} case LYX_ALIGN_RIGHT: {
string output;
- UpdatableInset const * const inset = pimpl_->inset_owner;
if (getParLanguage(bparams)->babel() != "hebrew")
- output = corrected_env("\\begin", "flushright", inset);
+ output = corrected_env("\\begin", "flushright", ownerCode());
else
- output = corrected_env("\\begin", "flushleft", inset);
+ output = corrected_env("\\begin", "flushleft", ownerCode());
os << output;
column += output.size();
break;
} case LYX_ALIGN_CENTER: {
string output;
- output = corrected_env("\\begin", "center", pimpl_->inset_owner);
+ output = corrected_env("\\begin", "center", ownerCode());
os << output;
column += output.size();
break;
break;
case LYX_ALIGN_LEFT: {
string output;
- UpdatableInset const * const inset = pimpl_->inset_owner;
if (getParLanguage(bparams)->babel() != "hebrew")
- output = corrected_env("\\par\\end", "flushleft", inset);
+ output = corrected_env("\\par\\end", "flushleft", ownerCode());
else
- output = corrected_env("\\par\\end", "flushright", inset);
+ output = corrected_env("\\par\\end", "flushright", ownerCode());
os << output;
column += output.size();
break;
} case LYX_ALIGN_RIGHT: {
string output;
- UpdatableInset const * const inset = pimpl_->inset_owner;
if (getParLanguage(bparams)->babel() != "hebrew")
- output = corrected_env("\\par\\end", "flushright", inset);
+ output = corrected_env("\\par\\end", "flushright", ownerCode());
else
- output = corrected_env("\\par\\end", "flushleft", inset);
+ output = corrected_env("\\par\\end", "flushleft", ownerCode());
os << output;
column += output.size();
break;
} case LYX_ALIGN_CENTER: {
string output;
- output = corrected_env("\\par\\end", "center", pimpl_->inset_owner);
+ output = corrected_env("\\par\\end", "center", ownerCode());
os << output;
column += output.size();
break;
// length (all in one row) if that is true then we don't allow
// any special options in the paragraph and also we don't allow
// any environment other then "Standard" to be valid!
- bool asdefault =
- (inInset() && inInset()->forceDefaultParagraphs(inInset()));
+ bool asdefault = forceDefaultParagraphs();
if (asdefault) {
style = bparams.getLyXTextClass().defaultLayout();
{
return lyxrc.rtl_support
&& getParLanguage(bparams)->RightToLeft()
- && !(inInset() && inInset()->lyxCode() == InsetBase::ERT_CODE);
+ && ownerCode() != InsetBase::ERT_CODE;
}
LyXLayout_ptr const & Paragraph::layout() const
{
-/*
- InsetBase * inset = inInset();
- if (inset && inset->lyxCode() == InsetBase::ENVIRONMENT_CODE)
- return static_cast<InsetEnvironment*>(inset)->layout();
-*/
return layout_;
}
}
+InsetBase::Code Paragraph::ownerCode() const
+{
+ return pimpl_->inset_owner
+ ? pimpl_->inset_owner->lyxCode() : InsetBase::NO_CODE;
+}
+
+
void Paragraph::clearContents()
{
text_.clear();
// for now we just need this, later should we need this in some
// other way we can always add a function to InsetBase too.
- if (pimpl_->inset_owner)
- return pimpl_->inset_owner->lyxCode() == InsetBase::ERT_CODE;
- return false;
+ return ownerCode() == InsetBase::ERT_CODE;
}
{
if (layout()->keepempty)
return true;
- if (pimpl_->inset_owner)
- return pimpl_->inset_owner->lyxCode() == InsetBase::ERT_CODE;
- return false;
+ return ownerCode() == InsetBase::ERT_CODE;
}
#include "lyxlayout_ptr_fwd.h"
#include "RowList_fwd.h"
+#include "insets/insetbase.h" // only for InsetBase::Code
+
#include "support/types.h"
#include <string>
///
void makeSameLayout(Paragraph const & par);
+ ///
+ void setInsetOwner(UpdatableInset * inset);
///
UpdatableInset * inInset() const;
///
- void setInsetOwner(UpdatableInset * inset);
+ InsetBase::Code ownerCode() const;
+ ///
+ bool autoBreakRows() const;
+ ///
+ bool forceDefaultParagraphs() const;
///
lyx::pos_type size() const { return text_.size(); }
}
-double LyXText::spacing(Paragraph const & par) const
+BufferView * LyXText::bv() const
{
- if (par.params().spacing().isDefault())
- return bv()->buffer()->params().spacing().getValue();
- return par.params().spacing().getValue();
+ BOOST_ASSERT(bv_owner != 0);
+ return bv_owner;
}
-BufferView * LyXText::bv() const
+double LyXText::spacing(Paragraph const & par) const
{
- BOOST_ASSERT(bv_owner != 0);
- return bv_owner;
+ if (par.params().spacing().isDefault())
+ return bv()->buffer()->params().spacing().getValue();
+ return par.params().spacing().getValue();
}
&& align == LYX_ALIGN_BLOCK
&& !pars_[pit].params().noindent()
// in tabulars and ert paragraphs are never indented!
- && (!pars_[pit].inInset()
- || (pars_[pit].inInset()->lyxCode() != InsetOld::TABULAR_CODE
- && pars_[pit].inInset()->lyxCode() != InsetOld::ERT_CODE))
+ && (pars_[pit].ownerCode() != InsetOld::TABULAR_CODE
+ && pars_[pit].ownerCode() != InsetOld::ERT_CODE)
&& (pars_[pit].layout() != tclass.defaultLayout()
|| bv()->buffer()->params().paragraph_separation ==
BufferParams::PARSEP_INDENT))
&& cpar.isChangeEdited(0, cur.pos()))
return;
- LyXTextClass const & tclass =
- bv()->buffer()->params().getLyXTextClass();
+ LyXTextClass const & tclass = cur.buffer().params().getLyXTextClass();
LyXLayout_ptr const & layout = cpar.layout();
// this is only allowed, if the current paragraph is not empty
// paragraph before or behind and we should react on that one
// but we can fix this in 1.3.0 (Jug 20020509)
bool const isempty = cpar.allowEmpty() && cpar.empty();
- ::breakParagraph(bv()->buffer()->params(), paragraphs(), cpit,
+ ::breakParagraph(cur.buffer().params(), paragraphs(), cpit,
cur.pos(), keep_layout);
cpit = cur.par();
// layout. I think it is a real bug of all other
// word processors to allow it. It confuses the user.
// Correction: Pasting is always allowed with standard-layout
- Buffer & buf = *bv()->buffer();
+ Buffer & buf = cur.buffer();
BufferParams const & bufparams = buf.params();
LyXTextClass const & tclass = bufparams.getLyXTextClass();
par_type const cpit = cur.par();
string LyXText::currentState(LCursor & cur)
{
BOOST_ASSERT(this == cur.text());
- Buffer * buffer = bv()->buffer();
+ Buffer & buf = cur.buffer();
Paragraph const & par = cur.paragraph();
std::ostringstream os;
- bool const show_change = buffer->params().tracking_changes
+ bool const show_change = buf.params().tracking_changes
&& cur.pos() != cur.lastpos()
&& par.lookupChange(cur.pos()) != Change::UNCHANGED;
if (show_change) {
Change change = par.lookupChangeFull(cur.pos());
- Author const & a = buffer->params().authors().get(change.author);
+ Author const & a = buf.params().authors().get(change.author);
os << _("Change: ") << a.name();
if (!a.email().empty())
os << " (" << a.email() << ")";
// I think we should only show changes from the default
// font. (Asger)
LyXFont font = real_current_font;
- font.reduce(buffer->params().getLyXTextClass().defaultfont());
+ font.reduce(buf.params().getLyXTextClass().defaultfont());
// avoid _(...) re-entrance problem
- string const s = font.stateText(&buffer->params());
+ string const s = font.stateText(&buf.params());
os << bformat(_("Font: %1$s"), s);
- // os << bformat(_("Font: %1$s"), font.stateText(&buffer->params));
+ // os << bformat(_("Font: %1$s"), font.stateText(&buf.params));
// The paragraph depth
int depth = cur.paragraph().getDepth();
}
}
#ifdef DEVEL_VERSION
- os << _(", Paragraph: ") << par.id();
+ os << _(", Inset: ") << &cur.inset();
+ os << _(", Paragraph: ") << cur.par();
+ os << _(", Id: ") << par.id();
os << _(", Position: ") << cur.pos();
Row & row = cur.textRow();
os << bformat(_(", Row b:%1$d e:%2$d"), row.pos(), row.endpos());
- os << _(", Inset: ") << par.inInset();
#endif
return os.str();
}
if (layout->latextype == LATEX_PARAGRAPH || lyxrc.label_init_length < 0)
text.erase();
- string par_text = pars_[pit].asString(*cur.bv().buffer(), false);
+ string par_text = pars_[pit].asString(cur.buffer(), false);
for (int i = 0; i < lyxrc.label_init_length; ++i) {
if (par_text.empty())
break;
{
BOOST_ASSERT(this == cur.text());
// special handling of new environment insets
- BufferParams const & params = bv()->buffer()->params();
+ BufferView & bv = cur.bv();
+ BufferParams const & params = bv.buffer()->params();
LyXLayout_ptr const & lyxlayout = params.getLyXTextClass()[layout];
if (lyxlayout->is_environment) {
// move everything in a new environment inset
lyxerr << "setting layout " << layout << endl;
- bv()->owner()->dispatch(FuncRequest(LFUN_HOME));
- bv()->owner()->dispatch(FuncRequest(LFUN_ENDSEL));
- bv()->owner()->dispatch(FuncRequest(LFUN_CUT));
+ bv.owner()->dispatch(FuncRequest(LFUN_HOME));
+ bv.owner()->dispatch(FuncRequest(LFUN_ENDSEL));
+ bv.owner()->dispatch(FuncRequest(LFUN_CUT));
InsetBase * inset = new InsetEnvironment(params, layout);
insertInset(cur, inset);
//inset->edit(cur, true);
- //bv()->owner()->dispatch(FuncRequest(LFUN_PASTE));
+ //bv.owner()->dispatch(FuncRequest(LFUN_PASTE));
return;
}
// Update current font
real_current_font.update(font,
- bv()->buffer()->params().language,
+ cur.buffer().params().language,
toggleall);
// Reduce to implicit settings
lyxerr << "pos: " << pos << " posend: " << posend << endl;
- BufferParams const & params = bv()->buffer()->params();
+ BufferParams const & params = cur.buffer().params();
// Don't use forwardChar here as posend might have
// pos() == lastpos() and forwardChar would miss it.
par_type tmppit = pit;
InsetBase * in = 0;
bool isOK = false;
- while (tmppit != end && pars_[tmppit].inInset()
- // the single '=' is intended below
- && (in = pars_[tmppit].inInset()))
- {
+ while (tmppit != end) {
+ in = pars_[tmppit].inInset();
if (in->lyxCode() == InsetBase::FLOAT_CODE ||
in->lyxCode() == InsetBase::WRAP_CODE) {
isOK = true;
// only to be sure, should not be neccessary
cur.clearSelection();
- bv()->buffer()->insertStringAsLines(pars_, pit, pos, current_font, str);
+ cur.buffer().insertStringAsLines(pars_, pit, pos, current_font, str);
redoParagraphs(cur.par(), endpit);
cur.resetAnchor();
}
}
- BufferParams const & bufparams = bv()->buffer()->params();
+ BufferParams const & bufparams = cur.buffer().params();
current_font = pars_[pit].getFontSettings(bufparams, pos);
real_current_font = getFont(pit, pos);
if (cur.pos() == cur.lastpos()
- && bidi.isBoundary(*bv()->buffer(), pars_[pit], cur.pos())
+ && bidi.isBoundary(cur.buffer(), pars_[pit], cur.pos())
&& !cur.boundary()) {
Language const * lang = pars_[pit].getParLanguage(bufparams);
current_font.setLanguage(lang);
setCursor(cur, cur.par(), cur.pos() - 1, true, false);
if (!checkAndActivateInset(cur, false)) {
if (false && !boundary &&
- bidi.isBoundary(*bv()->buffer(), cur.paragraph(), cur.pos() + 1))
+ bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos() + 1))
setCursor(cur, cur.par(), cur.pos() + 1, true, true);
}
return;
if (cur.pos() != cur.lastpos()) {
if (!checkAndActivateInset(cur, true)) {
setCursor(cur, cur.par(), cur.pos() + 1, true, false);
- if (false && bidi.isBoundary(*bv()->buffer(), cur.paragraph(),
+ if (false && bidi.isBoundary(cur.buffer(), cur.paragraph(),
cur.pos()))
setCursor(cur, cur.par(), cur.pos(), true, true);
}
if (font.language() != ignore_language ||
font.number() != LyXFont::IGNORE) {
Paragraph & par = cur.paragraph();
- text->bidi.computeTables(par, *cur.bv().buffer(), cur.textRow());
+ text->bidi.computeTables(par, cur.buffer(), cur.textRow());
if (cur.boundary() !=
- text->bidi.isBoundary(*cur.bv().buffer(), par,
+ text->bidi.isBoundary(cur.buffer(), par,
cur.pos(),
text->real_current_font))
text->setCursor(cur, cur.par(), cur.pos(),
lyx::par_type cpar = cur.par();
int x = cur.x_target();
- int y = bv()->top_y();
+ int y = cur.bv().top_y();
setCursorFromCoordinates(cur, x, y);
if (cpar == cur.par() && cpos == cur.pos()) {
cursorUp(cur);
}
- bv()->updateScrollbar();
+ cur.bv().updateScrollbar();
finishUndo();
}
lyx::par_type cpar = cur.par();
int x = cur.x_target();
- int y = bv()->top_y() + bv()->workHeight();
+ int y = cur.bv().top_y() + cur.bv().workHeight();
setCursorFromCoordinates(cur, x, y);
if (cpar == cur.par() && cpos == cur.pos()) {
cursorDown(cur);
}
- bv()->updateScrollbar();
+ cur.bv().updateScrollbar();
finishUndo();
}