+2003-06-07 John Levon <levon@movementarian.org>
+
+ * buffer.C:
+ * paragraph_funcs.C:
+ * paragraph_pimpl.C:
+ * text.C:
+ * text2.C:
+ * paragraph.h:
+ * paragraph.C: allow InsetERT to freely space lines,
+ and some consolidation of code
+
2003-06-06 José Matos <jamatos@fep.up.pt>
* buffer.C (makeDocBookFile): fix bug #821
for(string::const_iterator cit = str.begin();
cit != str.end(); ++cit) {
if (*cit == '\n') {
- if (autobreakrows && (!par->empty() || layout->keepempty)) {
+ if (autobreakrows && (!par->empty() || par->allowEmpty())) {
breakParagraph(params, paragraphs, par, pos,
layout->isEnvironment());
++par;
}
// do not insert consecutive spaces if !free_spacing
} else if ((*cit == ' ' || *cit == '\t') &&
- space_inserted && !layout->free_spacing &&
- !par->isFreeSpacing())
- {
+ space_inserted && !par->isFreeSpacing()) {
continue;
} else if (*cit == '\t') {
- if (!layout->free_spacing && !par->isFreeSpacing()) {
+ if (!par->isFreeSpacing()) {
// tabs are like spaces here
par->insertChar(pos, ' ', font);
++pos;
bool ws;
string str;
boost::tie(ws, str) = sgml::escapeChar(c);
- if (ws && !style->free_spacing && !par->isFreeSpacing()) {
+ if (ws && !par->isFreeSpacing()) {
// in freespacing mode, spaces are
// non-breaking characters
if (desc_on) {// if char is ' ' then...
if (style->pass_thru) {
os << c;
- } else if (style->free_spacing || par->isFreeSpacing() || c != ' ') {
+ } else if (par->isFreeSpacing() || c != ' ') {
os << str;
- } else if (desc_on ==1) {
+ } else if (desc_on == 1) {
++char_line_count;
os << "\n</term><listitem><para>";
desc_on = 2;
+2003-06-07 John Levon <levon@movementarian.org>
+
+ * insetert.C (latex): make a newline mean just that not
+ a new par
+
2003-06-07 José Matos <jamatos@fep.up.pt>
* insethfill.[Ch] (linuxdoc, docbook): implement output
}
++par;
if (par != end) {
- os << "\n\n";
- lines += 2;
+ os << "\n";
+ ++lines;
}
}
string orig_file = params().filename;
string const rel_file = MakeRelPath(orig_file, buf->filePath());
- if (!IsFileReadable(rel_file))
+ if (!IsFileReadable(orig_file)) {
+ lyxerr[Debug::GRAPHICS]
+ << "InsetGraphics::prepareFile\n"
+ << "No file '" << orig_file << "' can be found!" << endl;
return rel_file;
+ }
bool const zipped = zippedFile(orig_file);
(before + '{' + relative_file + " not found!}" + after);
os << latex_str;
+ lyxerr[Debug::GRAPHICS] << "InsetGraphics::latex outputting:\n"
+ << latex_str << endl;
// Return how many newlines we issued.
return int(lyx::count(latex_str.begin(), latex_str.end(),'\n') + 1);
}
int Paragraph::stripLeadingSpaces()
{
- if (layout()->free_spacing || isFreeSpacing())
+ if (isFreeSpacing())
return 0;
int i = 0;
bool Paragraph::isFreeSpacing() const
{
+ if (layout()->free_spacing)
+ return true;
+
// for now we just need this, later should we need this in some
// other way we can always add a function to Inset::() too.
if (pimpl_->inset_owner && pimpl_->inset_owner->owner())
}
+bool Paragraph::allowEmpty() const
+{
+ if (layout()->keepempty)
+ return true;
+ if (pimpl_->inset_owner && pimpl_->inset_owner->owner())
+ return (pimpl_->inset_owner->owner()->lyxCode() == Inset::ERT_CODE);
+ return false;
+}
+
+
bool operator==(Paragraph const & lhs, Paragraph const & rhs)
{
#warning FIXME this implementatoin must be completely wrong...
///
int stripLeadingSpaces();
- ///
+ /// return true if we allow multiple spaces
bool isFreeSpacing() const;
+ /// return true if we allow this par to stay empty
+ bool allowEmpty() const;
+
///
ParagraphParameters & params();
///
tmp->setLabelWidthString(par->params().labelWidthString());
}
- bool const isempty = (par->layout()->keepempty && par->empty());
+ bool const isempty = (par->allowEmpty() && par->empty());
if (!isempty && (par->size() > pos || par->empty() || flag == 2)) {
tmp->layout(par->layout());
lex.next();
font.setLyXColor(lex.getString());
} else if (token == "\\InsetSpace" || token == "\\SpecialChar") {
- LyXLayout_ptr const & layout = par.layout();
// Insets don't make sense in a free-spacing context! ---Kayvan
- if (layout->free_spacing || par.isFreeSpacing()) {
+ if (par.isFreeSpacing()) {
if (token == "\\InsetSpace")
par.insertChar(par.size(), ' ', font, change);
else if (lex.isOK()) {
&& getChar(i - 1) != ' '
&& (i < size() - 1)
// same in FreeSpacing mode
- && !style.free_spacing
- && !owner_->isFreeSpacing()
+ && !owner_->isFreeSpacing()
// In typewriter mode, we want to avoid
// ! . ? : at the end of a line
&& !(font.family() == LyXFont::TYPEWRITER_FAMILY
LyXLayout_ptr const & layout = cursor.par()->layout();
// this is only allowed, if the current paragraph is not empty or caption
- // and if it has not the keepempty flag aktive
- if (cursor.par()->empty()
- && layout->labeltype != LABEL_SENSITIVE
- && !layout->keepempty)
+ // and if it has not the keepempty flag active
+ if (cursor.par()->empty() && !cursor.par()->allowEmpty()
+ && layout->labeltype != LABEL_SENSITIVE)
return;
setUndo(bv(), Undo::FINISH, cursor.par());
// breakParagraph call should return a bool if it inserts the
// 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 = (layout->keepempty && cursor.par()->empty());
+ bool const isempty = (cursor.par()->allowEmpty() && cursor.par()->empty());
::breakParagraph(bv()->buffer()->params, paragraphs, cursor.par(), cursor.pos(),
keep_layout);
return false;
// Do not delete empty paragraphs with keepempty set.
- if (old_cursor.par()->layout()->keepempty)
+ if (old_cursor.par()->allowEmpty())
return false;
// only do our magic if we changed paragraph