return pimpl_->getCurrentChange();
}
-
+
void BufferView::beforeChange(LyXText * text)
{
pimpl_->beforeChange(text);
void restorePosition(unsigned int i);
/// does the given bookmark have a saved position ?
bool isSavedPosition(unsigned int i);
-
+
/// return the current change at the cursor
Change const getCurrentChange();
2003-03-04 Lars Gullik Bjønnes <larsbj@gullik.net>
+ * several files: ws changes only
+
* paragraph_funcs.C (TeXOnePar): take ParagraphList::iterator as args
(TeXEnvironment): ditto
(TeXDeeper): ditto
namespace {
-// FIXME: stupid name
+// FIXME: stupid name
Paragraph * buf = 0;
textclass_type textclass = 0;
}
return true;
}
-
+
bool actually_erased = false;
-
+
// clear end/begin fragments of the first/last par in selection
actually_erased |= (startpar)->erase(start, startpar->size());
if ((*endpar)->erase(0, end)) {
- actually_erased = true;
+ actually_erased = true;
end = 0;
}
-
+
// Loop through the deleted pars if any, erasing as needed
-
+
Paragraph * pit = startpar->next();
-
+
while (1) {
// *endpar can be 0
if (!pit)
break;
-
+
Paragraph * next = pit->next();
-
+
// "erase" the contents of the par
if (pit != *endpar) {
actually_erased |= pit->erase(0, pit->size());
if (next) {
next->previous(pit->previous());
}
-
+
delete pit;
}
}
-
+
if (pit == *endpar)
break;
-
+
pit = next;
}
-#if 0 // FIXME: why for cut but not copy ?
+#if 0 // FIXME: why for cut but not copy ?
// the cut selection should begin with standard layout
if (realcut) {
buf->params().clear();
buf->bibkey = 0;
buf->layout(textclasslist[buffer->params.textclass].defaultLayoutName());
}
-#endif
+#endif
if (!startpar->next())
return true;
-
+
Buffer * buffer = current_view->buffer();
if (doclear) {
if (!actually_erased)
return true;
-
+
// paste the paragraphs again, if possible
if (startpar->hasSameLayout(startpar->next()) ||
startpar->next()->empty()) {
return true;
}
-
+
bool CutAndPaste::copySelection(Paragraph * startpar, Paragraph * endpar,
int start, int end, char tc)
{
/// used by lower_bound and upper_bound
inline
int operator()(InsetList::InsetTable const & a,
- InsetList::InsetTable const & b) const
+ InsetList::InsetTable const & b) const
{
return a.pos < b.pos;
}
lf->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
}
-
+
};
/*
* CLASS TEXERRORS
++count;
lyxerr[Debug::LATEX] << "Run #" << count << endl;
if (lfun) {
- showRunMessage(lfun, count);
+ showRunMessage(lfun, count);
}
this->operator()();
{
if (kind_ != Command)
return string();
-
+
// Get the keys bound to this action, but keep only the
// first one later
string bindings = toplevel_keymap->findbinding(action_);
items_.push_back(i);
return *this;
}
-
+
switch (i.kind()) {
case MenuItem::Command:
{
break;
default:
items_.push_back(i);
- }
+ }
return *this;
}
/// returns true if the entry should be ommited when disabled
bool optional() const { return optional_; }
/// returns the status of the lfun associated with this entry
- FuncStatus const & status() const { return status_; }
+ FuncStatus const & status() const { return status_; }
/// returns the status of the lfun associated with this entry
- FuncStatus & status() { return status_; }
+ FuncStatus & status() { return status_; }
/// returns the status of the lfun associated with this entry
- void status(FuncStatus const & status) { status_ = status; }
+ void status(FuncStatus const & status) { status_ = status; }
/// returns the binding associated to this action
string const binding() const;
/// the description of the submenu (if relevant)
#include <iosfwd>
#include "LString.h"
-
+
class Author {
public:
Author() {}
-
+
Author(string n, string e)
: name_(n), email_(e) {}
string const email() const {
return email_;
}
-
+
friend std::istream & operator>>(std::istream & os, Author & a);
private:
string email_;
};
-
+
class AuthorList {
public:
int record(Author const & a);
void record(int id, Author const & a);
-
+
Author const & get(int id);
typedef std::map<int, Author> Authors;
-
+
Authors::const_iterator begin() const;
Authors::const_iterator end() const;
private:
Authors authors_;
};
-
+
bool operator==(Author const & l, Author const & r);
-
-std::ostream & operator<<(std::ostream & os, Author const & a);
-
-std::istream & operator>>(std::istream & os, Author & a);
-
+
+std::ostream & operator<<(std::ostream & os, Author const & a);
+
+std::istream & operator>>(std::istream & os, Author & a);
+
#endif // AUTHOR_H
bstore.push_back(tmpbuf);
return tmpbuf;
}
-
+
void BufferList::closeAll()
{
state << _(" at ") << ctime(&change.changetime);
state << " : ";
}
-
+
// I think we should only show changes from the default
// font. (Asger)
LyXFont font = text->real_current_font;
*/
#include <config.h>
-
-#include "changes.h"
+
+#include "changes.h"
#include "debug.h"
#include "author.h"
-
+
#include "support/LAssert.h"
#include "support/LOstream.h"
-
+
using std::vector;
using std::endl;
using lyx::pos_type;
-
+
bool operator==(Change const & l, Change const & r)
{
return l.type == r.type && l.author == r.author
&& l.changetime == r.changetime;
}
-
+
bool operator!=(Change const & l, Change const & r)
{
return !(l == r);
}
-
+
bool operator==(Changes::Range const & r1, Changes::Range const & r2)
{
- return r1.start == r2.start && r1.end == r2.end;
+ return r1.start == r2.start && r1.end == r2.end;
}
{
return !(r1 == r2);
}
-
-
+
+
bool Changes::Range::contains(Range const & r) const
{
return r.start >= start && r.end <= end;
{
return r.contains(*this);
}
-
+
bool Changes::Range::contains(pos_type pos) const
{
return pos >= start && pos < end;
}
-
+
bool Changes::Range::loose_contains(pos_type pos) const
{
return pos >= start && pos <= end;
}
-
+
bool Changes::Range::intersects(Range const & r) const
{
return contained(r) || contains(r)
|| contains(r.start) || contains(r.end);
}
-
-
+
+
Changes::Changes(Change::Type type)
: empty_type_(type)
{
set(change, pos, pos + 1);
}
-
+
void Changes::set(Change::Type type, pos_type pos)
{
set(type, pos, pos + 1);
}
-
+
void Changes::set(Change::Type type, pos_type start, pos_type end)
{
set(Change(type), start, end);
}
-
+
void Changes::set(Change change, pos_type start, pos_type end)
{
ChangeTable::iterator it = table_.begin();
lyxerr[Debug::CHANGES] << "changeset of " << change.type
<< " author " << change.author << " time " << change.changetime
<< " in range " << start << "," << end << endl;
-
+
Range const new_range(start, end);
-
+
// remove all sub-ranges
for (; it != table_.end();) {
if (new_range != it->range && it->range.contained(new_range)) {
}
ChangeRange c(*it);
-
+
lyxerr[Debug::CHANGES] << "Using change of type " << c.change.type
<< " over " << c.range.start << "," << c.range.end << endl;
-
- // split head
+
+ // split head
if (c.range.start < start) {
it = table_.insert(it, ChangeRange(c.range.start, start, c.change));
lyxerr[Debug::CHANGES] << "Splitting head of type " << c.change.type
it->range.end = end;
it->change = change;
lyxerr[Debug::CHANGES] << "Resetting to new change" << endl;
-
+
// split tail
if (c.range.end > end) {
++it;
ChangeTable::iterator end = table_.end();
bool found = false;
-
+
for (; it != end; ++it) {
Range & range(it->range);
-
+
lyxerr[Debug::CHANGES] << "era:Range of type " << it->change.type << " is "
- << it->range.start << "," << it->range.end << endl;
-
+ << it->range.start << "," << it->range.end << endl;
+
if (range.contains(pos)) {
found = true;
--range.end;
--range.end;
}
}
- check();
+ check();
merge();
}
set(change, pos);
return;
}
-
+
ChangeTable::iterator it = table_.begin();
for (; it != table_.end(); ++it) {
Range & range(it->range);
-
+
if (range.contains(pos)) {
if (it->change.type != Change::INSERTED) {
set(change, pos);
}
}
-
+
void Changes::add(Change change, ChangeTable::size_type pos)
{
ChangeTable::iterator it = table_.begin();
ChangeTable::iterator end = table_.end();
bool found = false;
-
+
for (; it != end; ++it) {
Range & range(it->range);
-
+
if (!found && range.loose_contains(pos)) {
found = true;
lyxerr[Debug::CHANGES] << "Found range of "
- << range.start << "," << range.end << endl;
+ << range.start << "," << range.end << endl;
++range.end;
continue;
}
set(change, pos);
}
-
+
Change const Changes::lookupFull(pos_type pos) const
{
if (!table_.size()) {
lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl;
return Change(empty_type_);
}
-
+
ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator end = table_.end();
if (it->range.contains(pos))
return it->change;
}
-
+
check();
lyx::Assert(0);
return Change(Change::UNCHANGED);
}
-
+
Change::Type Changes::lookup(pos_type pos) const
{
lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl;
return empty_type_;
}
-
+
ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator end = table_.end();
if (it->range.contains(pos))
return it->change.type;
}
-
+
check();
lyx::Assert(0);
return Change::UNCHANGED;
lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl;
return empty_type_ != Change::UNCHANGED;
}
-
+
ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator itend = table_.end();
for (; it != itend; ++it) {
lyxerr[Debug::CHANGES] << "Looking for " << start << ","
- << end << " in " << it->range.start << ","
- << it->range.end << "of type " << it->change.type << endl;
+ << end << " in " << it->range.start << ","
+ << it->range.end << "of type " << it->change.type << endl;
if (it->range.intersects(Range(start, end))
&& it->change.type != Change::UNCHANGED) {
lyxerr[Debug::CHANGES] << "Found intersection of "
return true;
}
}
-
+
return false;
}
-
+
bool Changes::isChangeEdited(lyx::pos_type start, lyx::pos_type end) const
{
if (!table_.size()) {
lyxerr[Debug::CHANGES] << "Empty, type is " << empty_type_ << endl;
return empty_type_ != Change::INSERTED;
}
-
+
ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator itend = table_.end();
if (it->range.intersects(Range(start, end ? end - 1 : 0))
&& it->change.type != Change::INSERTED) {
return true;
- }
- }
+ }
+ }
return false;
}
-
+
void Changes::merge()
{
lyxerr[Debug::CHANGES] << "Starting merge" << endl;
while (it != table_.end()) {
lyxerr[Debug::CHANGES] << "Range of type " << it->change.type << " is "
- << it->range.start << "," << it->range.end << endl;
-
+ << it->range.start << "," << it->range.end << endl;
+
if (it->range.start == it->range.end) {
lyxerr[Debug::CHANGES] << "Removing empty range for pos "
<< it->range.start << endl;
it = table_.begin();
continue;
}
-
+
if (it + 1 == table_.end())
break;
-
+
if (it->change == (it + 1)->change) {
lyxerr[Debug::CHANGES] << "Merging equal ranges "
<< it->range.start << "," << it->range.end
<< " and " << (it + 1)->range.start << ","
- << (it + 1)->range.end << endl;
+ << (it + 1)->range.end << endl;
(it + 1)->range.start = it->range.start;
table_.erase(it);
// start again
++it;
}
-
+
lyxerr[Debug::CHANGES] << "Merge ended" << endl;
check();
}
-
+
void Changes::check() const
{
ChangeTable::const_iterator it = table_.begin();
ChangeTable::const_iterator end = table_.end();
bool dont_assert(true);
-
+
lyxerr[Debug::CHANGES] << "Changelist:" << endl;
for (; it != end; ++it) {
lyxerr[Debug::CHANGES] << "Range of type " << it->change.type << " is "
<< it->range.start << "," << it->range.end << " author "
- << it->change.author << " time " << it->change.changetime << endl;
+ << it->change.author << " time " << it->change.changetime << endl;
if (it + 1 == end)
break;
if (range.end != next.start)
dont_assert = false;
}
- lyxerr[Debug::CHANGES] << "End" << endl;
+ lyxerr[Debug::CHANGES] << "End" << endl;
lyx::Assert(dont_assert);
}
-
+
int Changes::latexMarkChange(std::ostream & os, Change::Type old, Change::Type change)
-{
+{
if (old == change)
return 0;
string const end("\\changeend{}");
string const son("\\overstrikeon{}");
string const soff("\\overstrikeoff{}");
-
+
int column = 0;
-
+
if (old == Change::DELETED) {
os << soff;
column += soff.length();
}
-
+
switch (change) {
case Change::UNCHANGED:
os << end;
}
break;
}
-
+
return column;
}
return;
column = 0;
-
+
switch (change.type) {
case Change::UNCHANGED:
os << "\n\\change_unchanged\n";
t = curtime;
os << "\n\\change_deleted " << change.author
<< " " << t << "\n";
-
+
break;
}
}
Format::Format(string const & n, string const & e, string const & p,
- string const & s, string const & v): name_(n),
- extension_(e),
- prettyname_(p),
+ string const & s, string const & v): name_(n),
+ extension_(e),
+ prettyname_(p),
shortcut_(s),
- viewer_(v)
+ viewer_(v)
{}
char c;
string s;
is >> c;
- if (c == '"')
+ if (c == '"')
getline(is, s, '"');
else {
is.putback(c);
}
vector<Graph::Vertex> Graph::vertices_;
-
-
#include <vector>
class Graph {
-public:
+public:
Graph() : numedges_(0) {};
///
typedef std::vector<int> EdgePath;
// static due to the setvbuf. Ugly.
static char o_buf[BUFSIZ];
-
+
// We need to throw an exception not do this
pipein[0] = pipein[1] = pipeout[0] = pipeout[1]
= pipeerr[0] = pipeerr[1] = -1;
child_.reset(li);
if (li->start() == -1) {
error_ = _("Could not create an ispell process.\nYou may not have "
- " the right languages installed.");
+ " the right languages installed.");
child_.reset(0);
return;
}
}
}
-
+
SearchResult nextChange(BufferView * bv, LyXText * text, pos_type & length)
{
Paragraph * par = text->cursor.par();
return SR_NOT_FOUND;
}
}
-
-
+
+
SearchResult findNextChange(BufferView * bv, LyXText * text, pos_type & length)
{
if (text->selection.set())
bv->update(bv->getLyXText(), BufferView::SELECT | BufferView::FITCUR);
pos_type length;
-
+
if (bv->theLockingInset()) {
bool found = bv->theLockingInset()->nextChange(bv, length);
-
+
// We found the stuff inside the inset so we don't have to
// do anything as the inset did all the update for us!
if (found)
return true;
-
+
// We now are in the main text but if we did a forward
// search we have to put the cursor behind the inset.
bv->text->cursorRight(bv, true);
bv->toggleSelection();
text->clearSelection();
-
+
SearchResult result = nextChange(bv, text, length);
lyxerr << "Result is " << result << endl;
-
+
bool found = true;
-
+
// If we found the cursor inside an inset we will get back
// SR_FOUND_NOUPDATE and we don't have to do anything as the
// inset did it already.
return found;
}
-
+
} // end lyxfind namespace
/// find the next change in the buffer
bool findNextChange(BufferView * bv);
-
+
SearchResult findNextChange(BufferView * bv, LyXText * text, lyx::pos_type & length);
-
+
SearchResult nextChange(BufferView * bv, LyXText * text, lyx::pos_type & length);
-
+
} // end namespace LyXFind
-
+
#endif // LYXFIND_H
// should be moved from the LyXRC class).
use_gui = true;
pdf_mode = false;
-
+
user_name = lyx::user_name();
-
+
user_email = lyx::user_email();
if (user_email.empty())
if (lexrc.next())
user_email = lexrc.getString();
break;
-
+
case RC_LAST: break; // this is just a dummy
}
}
top_of_text_ = top;
}
-
+
unsigned int Row::top_of_text() const
{
return top_of_text_;
}
-
+
void Row::baseline(unsigned int b)
{
baseline_ = b;
lyx::pos_type lastPos() const;
/// return the position of the last normal, printable character in this row
lyx::pos_type lastPrintablePos() const;
-
+
/**
* Returns the number of separators.
* The separator on the very last column doesnt count.
*/
int numberOfSeparators() const;
- /**
+ /**
* Returns the number of hfills. It works like a LaTeX \hfill:
* the hfills at the beginning and at the end are ignored.
* This is much more useful than not to ignore!
/// accept selected change
void acceptChange(BufferView * bv);
- /// reject selected change
+ /// reject selected change
void rejectChange(BufferView * bv);
-
+
/** 'selects" the next word, where the cursor is not in
and returns this word as string. THe cursor will be moved
to the beginning of this word.
unsigned char c = str[0];
str[0] = transformChar(c, pos);
}
-
+
bool prev_struckout(isDeletedText(par_, pos));
bool prev_newtext(isInsertedText(par_, pos));
-
+
++vpos;
// collect as much similar chars as we can
if (prev_struckout != isDeletedText(par_, pos))
break;
-
+
if (prev_newtext != isInsertedText(par_, pos))
break;
-
+
if (arabic && Encodings::IsComposeChar_arabic(c))
break;
if (hebrew && Encodings::IsComposeChar_hebrew(c))
pos_type const start = row_.pos();
pos_type const end = row_.lastPrintablePos();
- if (!par_.isChanged(start, end))
+ if (!par_.isChanged(start, end))
return;
-
+
int const height = (row_.next()
- ? row_.height() + row_.next()->top_of_text()
+ ? row_.height() + row_.next()->top_of_text()
: row_.baseline());
-
+
pain_.fillRectangle(4, yo_, 5, height, LColor::changebar);
}
-
+
void RowPainter::paintAppendix()
{
// FIXME: can be just width_ ?
} else {
// adding or removing space
bool const added = vsp.kind() != VSpace::LENGTH ||
- vsp.length().len().value() > 0.0;
+ vsp.length().len().value() > 0.0;
ty1 = added ? (start + arrow_size) : start;
ty2 = added ? start : (start + arrow_size);
by1 = added ? (end - arrow_size) : end;
bool running_strikeout = false;
bool is_struckout = false;
float last_strikeout_x = 0.0;
-
+
pos_type vpos = row_.pos();
while (vpos <= last) {
if (x_ > bv_.workWidth())
break;
pos_type pos = text_.vis2log(vpos);
-
+
if (x_ + singleWidth(pos) < 0) {
x_ += singleWidth(pos);
++vpos;
continue;
}
-
+
is_struckout = isDeletedText(par_, pos);
if (is_struckout && !running_strikeout) {
running_strikeout = true;
last_strikeout_x = x_;
}
-
+
bool const highly_editable_inset = par_.isInset(pos)
&& isHighlyEditableInset(par_.getInset(pos));
LColor::strikeout, Painter::line_solid, Painter::line_thin);
running_strikeout = false;
}
-
+
if (main_body > 0 && pos == main_body - 1) {
int const lwidth = font_metrics::width(layout->labelsep,
getLabelFont());
++vpos;
} else {
if (paintFromPos(vpos))
- return true;
+ return true;
}
}
-
+
// if we reach the end of a struck out range, paint it
if (running_strikeout) {
int const middle = yo_ + row_.top_of_text()
// changebar
paintChangeBar();
-
+
if (row_.isParStart()) {
paintFirst();
}