I don't think I broke too much, if anything at all (word-base operations
might be off, but I don't think so).
It does not address the messy drawing code yet but moves a few lines off
text* and paragraph*
Andre'
--
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)
? lyx_main
? ext_l10n.h
? out
? old.diff
? 1.diff
? s-and-r.diff
? select.diff
? maxima.diff
? workarea.diff.gz
? t.diff
? updown.diff
? bib2.diff
? frontends/qt2/box.diff
? frontends/qt2/xforms/Makefile.in
? mathed/tmp.diff
? mathed/1.diff
? mathed/cut.diff
? mathed/crash.diff
? mathed/haveit
? mathed/script.diff
? mathed/all
? mathed/rmcopyright.sh
? mathed/shared_ptr.diff
? support/.forkedcontr.C.swp
Index: buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.424
diff -u -p -r1.424 buffer.C
--- buffer.C 10 Mar 2003 18:00:28 -0000 1.424
+++ buffer.C 11 Mar 2003 13:36:27 -0000
@@ -49,6 +49,7 @@
#include "insets/inset.h"
#include "insets/inseterror.h"
+#include "insets/insethfill.h"
#include "insets/insetlabel.h"
#include "insets/insetref.h"
#include "insets/inseturl.h"
@@ -966,7 +967,8 @@ Buffer::parseSingleLyXformat2Token(LyXLe
par->insertInset(pos, inset, font, current_change);
++pos;
} else if (token == "\\hfill") {
- par->insertChar(pos, Paragraph::META_HFILL, font, current_change);
+ par->insertInset(pos, new InsetHFill(),
+ LyXFont(LyXFont::ALL_INHERIT, params.language));
++pos;
} else if (token == "\\change_unchanged") {
// Hack ! Needed for empty paragraphs :/
@@ -1617,19 +1619,12 @@ string const Buffer::asciiParagraph(Para
}
break;
- case Paragraph::META_HFILL:
- buffer << word << "\t";
- currlinelen += word.length() + 1;
- word.erase();
- break;
-
default:
if (c == ' ') {
if (linelen > 0 &&
currlinelen + word.length() > linelen - 10) {
buffer << "\n";
- pair<int, string> p =
- addDepth(depth, ltype_depth);
+ pair<int, string> p = addDepth(depth,
ltype_depth);
buffer << p.second;
currlinelen = p.first;
}
Index: paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.246
diff -u -p -r1.246 paragraph.C
--- paragraph.C 9 Mar 2003 12:37:19 -0000 1.246
+++ paragraph.C 11 Mar 2003 13:36:27 -0000
@@ -265,10 +265,6 @@ void Paragraph::write(Buffer const * buf
os << "\n\\newline \n";
column = 0;
break;
- case META_HFILL:
- os << "\n\\hfill \n";
- column = 0;
- break;
case '\\':
os << "\n\\backslash \n";
column = 0;
@@ -433,7 +429,6 @@ void Paragraph::insertInset(pos_type pos
bool Paragraph::insetAllowed(Inset::Code code)
{
//lyxerr << "Paragraph::InsertInsetAllowed" << endl;
-
if (pimpl_->inset_owner)
return pimpl_->inset_owner->insetAllowed(code);
return true;
@@ -443,7 +438,6 @@ bool Paragraph::insetAllowed(Inset::Code
Inset * Paragraph::getInset(pos_type pos)
{
lyx::Assert(pos < size());
-
return insetlist.get(pos);
}
@@ -451,7 +445,6 @@ Inset * Paragraph::getInset(pos_type pos
Inset const * Paragraph::getInset(pos_type pos) const
{
lyx::Assert(pos < size());
-
return insetlist.get(pos);
}
@@ -470,11 +463,11 @@ LyXFont const Paragraph::getFontSettings
}
LyXFont retfont;
- if (cit != end) {
+ if (cit != end)
retfont = cit->font();
- } else if (pos == size() && !empty()) {
+ else if (pos == size() && !empty())
retfont = getFontSettings(bparams, pos - 1);
- } else
+ else
retfont = LyXFont(LyXFont::ALL_INHERIT, getParLanguage(bparams));
return retfont;
@@ -1291,7 +1284,8 @@ bool Paragraph::simpleTeXOnePar(Buffer c
bool Paragraph::isHfill(pos_type pos) const
{
- return IsHfillChar(getChar(pos));
+ return IsInsetChar(getChar(pos))
+ && getInset(pos)->lyxCode() ==
Inset::HFILL_CODE;
}
@@ -1424,25 +1418,22 @@ string const Paragraph::asString(Buffer
string const Paragraph::asString(Buffer const * buffer,
pos_type beg, pos_type end, bool label) const
{
- ostringstream ost;
+ ostringstream os;
if (beg == 0 && label && !params().labelString().empty())
- ost << params().labelString() << ' ';
+ os << params().labelString() << ' ';
for (pos_type i = beg; i < end; ++i) {
value_type const c = getUChar(buffer->params, i);
if (IsPrintable(c))
- ost << c;
+ os << c;
else if (c == META_NEWLINE)
- ost << '\n';
- else if (c == META_HFILL)
- ost << '\t';
- else if (c == META_INSET) {
- getInset(i)->ascii(buffer, ost);
- }
+ os << '\n';
+ else if (c == META_INSET)
+ getInset(i)->ascii(buffer, os);
}
- return STRCONV(ost.str());
+ return STRCONV(os.str());
}
@@ -1451,10 +1442,9 @@ void Paragraph::setInsetOwner(Inset * i)
pimpl_->inset_owner = i;
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
- for (; it != end; ++it) {
+ for (; it != end; ++it)
if (it.getInset())
it.getInset()->setOwner(i);
- }
}
Index: paragraph.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v
retrieving revision 1.61
diff -u -p -r1.61 paragraph.h
--- paragraph.h 9 Mar 2003 12:37:20 -0000 1.61
+++ paragraph.h 11 Mar 2003 13:36:27 -0000
@@ -40,9 +40,7 @@ public:
///
enum META_KIND {
///
- META_HFILL = 1,
- ///
- META_NEWLINE,
+ META_NEWLINE = 2,
///
META_INSET
};
Index: paragraph_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_pimpl.C,v
retrieving revision 1.50
diff -u -p -r1.50 paragraph_pimpl.C
--- paragraph_pimpl.C 3 Mar 2003 21:15:49 -0000 1.50
+++ paragraph_pimpl.C 11 Mar 2003 13:36:27 -0000
@@ -497,9 +497,11 @@ void Paragraph::Pimpl::simpleTeXSpecialC
value_type const c)
{
if (style.pass_thru) {
- if (c != '\0') os << c;
+ if (c != '\0')
+ os << c;
return;
}
+
// Two major modes: LaTeX or plain
// Handle here those cases common to both modes
// and then split to handle the two modes separately.
@@ -572,11 +574,6 @@ void Paragraph::Pimpl::simpleTeXSpecialC
}
basefont = owner_->getLayoutFont(bparams);
running_font = basefont;
- break;
-
- case Paragraph::META_HFILL:
- os << "\\hfill{}";
- column += 7;
break;
default:
Index: sgml.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/sgml.C,v
retrieving revision 1.4
diff -u -p -r1.4 sgml.C
--- sgml.C 27 Nov 2002 10:30:14 -0000 1.4
+++ sgml.C 11 Mar 2003 13:36:27 -0000
@@ -26,8 +26,6 @@ pair<bool, string> escapeChar(char c)
string str;
switch (c) {
- case Paragraph::META_HFILL:
- break;
case Paragraph::META_NEWLINE:
str = '\n';
break;
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.306
diff -u -p -r1.306 text.C
--- text.C 10 Mar 2003 05:03:31 -0000 1.306
+++ text.C 11 Mar 2003 13:36:27 -0000
@@ -221,23 +221,26 @@ int LyXText::singleWidth(BufferView * bv
if (font.language()->RightToLeft()) {
if (font.language()->lang() == "arabic" &&
(lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
- lyxrc.font_norm_type == LyXRC::ISO_10646_1))
+ lyxrc.font_norm_type == LyXRC::ISO_10646_1)) {
if (Encodings::IsComposeChar_arabic(c))
return 0;
else
c = transformChar(c, par, pos);
- else if (font.language()->lang() == "hebrew" &&
+ } else if (font.language()->lang() == "hebrew" &&
Encodings::IsComposeChar_hebrew(c))
return 0;
}
return font_metrics::width(c, font);
- } else if (IsHfillChar(c)) {
- // Because of the representation as vertical lines
- return 3;
- } else if (c == Paragraph::META_INSET) {
+ }
+
+ if (c == Paragraph::META_INSET) {
Inset * tmpinset = par->getInset(pos);
if (tmpinset) {
+ if (tmpinset->lyxCode() == Inset::HFILL_CODE) {
+ // Because of the representation as vertical lines
+ return 3;
+ }
#if 1
// this IS needed otherwise on initialitation we don't get the
fill
// of the row right (ONLY on initialization if we read a file!)
@@ -245,10 +248,11 @@ int LyXText::singleWidth(BufferView * bv
tmpinset->update(bview, font);
#endif
return tmpinset->width(bview, font);
- } else
- return 0;
+ }
+ return 0;
+ }
- } else if (IsSeparatorChar(c))
+ if (IsSeparatorChar(c))
c = ' ';
else if (IsNewlineChar(c))
c = 'n';
@@ -2311,7 +2315,7 @@ void LyXText::changeCase(BufferView & bv
continue;
}
unsigned char c = par->getChar(pos);
- if (!IsInsetChar(c) && !IsHfillChar(c)) {
+ if (!IsInsetChar(c)) {
switch (action) {
case text_lowercase:
c = lowercase(c);
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.42
diff -u -p -r1.42 text3.C
--- text3.C 9 Mar 2003 09:38:47 -0000 1.42
+++ text3.C 11 Mar 2003 13:36:27 -0000
@@ -949,13 +949,6 @@ Inset::RESULT LyXText::dispatch(FuncRequ
specialChar(this, bv, InsetSpecialChar::LDOTS);
break;
- case LFUN_HFILL:
- bv->hideCursor();
- update(bv, false);
- insertChar(bv, Paragraph::META_HFILL);
- update(bv);
- break;
-
case LFUN_END_OF_SENTENCE:
specialChar(this, bv, InsetSpecialChar::END_OF_SENTENCE);
break;
@@ -1617,6 +1610,7 @@ Inset::RESULT LyXText::dispatch(FuncRequ
case LFUN_INDEX_PRINT:
case LFUN_PARENTINSERT:
case LFUN_TOC_INSERT:
+ case LFUN_HFILL:
// do nothing fancy
doInsertInset(this, cmd, false, false);
break;
Index: insets/insetert.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v
retrieving revision 1.105
diff -u -p -r1.105 insetert.C
--- insets/insetert.C 10 Mar 2003 22:12:07 -0000 1.105
+++ insets/insetert.C 11 Mar 2003 13:36:27 -0000
@@ -208,7 +208,6 @@ void InsetERT::write(Buffer const * buf,
Paragraph::value_type c = par->getChar(i);
switch (c) {
case Paragraph::META_INSET:
- case Paragraph::META_HFILL:
lyxerr << "Element is not allowed in insertERT"
<< endl;
case Paragraph::META_NEWLINE:
Index: insets/insethfill.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insethfill.h,v
retrieving revision 1.1
diff -u -p -r1.1 insethfill.h
--- insets/insethfill.h 11 Mar 2003 13:33:14 -0000 1.1
+++ insets/insethfill.h 11 Mar 2003 13:36:27 -0000
@@ -33,6 +33,8 @@ public:
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
void write(Buffer const * buf, ostream & os) const;
+ /// We don't need \begin_inset and \end_inset
+ bool directWrite() const { return true; }
};
#endif
Index: insets/insetquotes.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetquotes.C,v
retrieving revision 1.79
diff -u -p -r1.79 insetquotes.C
--- insets/insetquotes.C 14 Feb 2003 21:39:32 -0000 1.79
+++ insets/insetquotes.C 11 Mar 2003 13:36:27 -0000
@@ -86,7 +86,7 @@ InsetQuotes::InsetQuotes(char c, BufferP
// Decide whether left or right
switch (c) {
case ' ': case '(':
- case Paragraph::META_HFILL:
+ //case Paragraph::META_HFILL:
case Paragraph::META_NEWLINE:
side_ = LeftQ; // left quote
break;
Index: insets/insetspecialchar.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetspecialchar.C,v
retrieving revision 1.56
diff -u -p -r1.56 insetspecialchar.C
--- insets/insetspecialchar.C 13 Feb 2003 16:53:05 -0000 1.56
+++ insets/insetspecialchar.C 11 Mar 2003 13:36:27 -0000
@@ -35,6 +35,7 @@ InsetSpecialChar::Kind InsetSpecialChar:
return kind_;
}
+
int InsetSpecialChar::ascent(BufferView *, LyXFont const & font) const
{
return font_metrics::maxAscent(font);
Index: insets/insetspecialchar.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetspecialchar.h,v
retrieving revision 1.42
diff -u -p -r1.42 insetspecialchar.h
--- insets/insetspecialchar.h 13 Feb 2003 16:53:05 -0000 1.42
+++ insets/insetspecialchar.h 11 Mar 2003 13:36:27 -0000
@@ -71,15 +71,9 @@ public:
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
///
- Inset::Code lyxCode() const
- {
- return Inset::SPECIALCHAR_CODE;
- }
+ Inset::Code lyxCode() const { return Inset::SPECIALCHAR_CODE; }
/// We don't need \begin_inset and \end_inset
- bool directWrite() const
- {
- return true;
- };
+ bool directWrite() const { return true; }
///
void validate(LaTeXFeatures &) const;
Index: support/textutils.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/textutils.h,v
retrieving revision 1.20
diff -u -p -r1.20 textutils.h
--- support/textutils.h 25 Sep 2002 10:03:41 -0000 1.20
+++ support/textutils.h 11 Mar 2003 13:36:27 -0000
@@ -39,14 +39,6 @@ bool IsLineSeparatorChar(char c)
}
-/// return true if the char is a meta-character for hfill
-inline
-bool IsHfillChar(char c)
-{
- return (c == Paragraph::META_HFILL);
-}
-
-
/// return true if the char is a meta-character for an inset
inline
bool IsInsetChar(char c)
@@ -119,7 +111,6 @@ bool IsWordChar(unsigned char c)
{
return !(IsSeparatorChar(c)
|| IsKommaChar(c)
- || IsHfillChar(c)
|| IsInsetChar(c));
}