From 8ed9dbabde30b31a6a14e032fa42f682a196ef7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sat, 15 Jul 2000 23:51:46 +0000 Subject: [PATCH] read the Changelog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@885 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 81 +++++++++++++++++++ src/BackStack.h | 3 + src/ColorHandler.C | 1 + src/DepTable.C | 1 - src/FloatList.C | 21 +++++ src/FloatList.h | 4 + src/Floating.h | 6 ++ src/TextCache.C | 7 +- src/buffer.C | 24 +++++- src/debug.h | 4 +- src/insets/insetbib.C | 26 +++--- src/insets/insetbib.h | 19 +++-- src/insets/insetbutton.C | 4 - src/insets/insetbutton.h | 3 - src/insets/insetcite.C | 6 +- src/insets/insetcite.h | 4 +- src/insets/insetcollapsable.C | 14 +++- src/insets/insetcollapsable.h | 5 +- src/insets/insetcommand.C | 9 +-- src/insets/insetcommand.h | 2 +- src/insets/inseterror.C | 11 +-- src/insets/inseterror.h | 7 +- src/insets/insetexternal.C | 3 +- src/insets/insetexternal.h | 7 +- src/insets/insetfloat.C | 61 ++++++++------ src/insets/insetfloat.h | 10 ++- src/insets/insetfoot.C | 14 +--- src/insets/insetfoot.h | 2 - src/insets/insetfootlike.C | 13 +-- src/insets/insetfootlike.h | 4 +- src/insets/insetgraphics.C | 3 +- src/insets/insetgraphics.h | 3 +- src/insets/insetinclude.C | 3 +- src/insets/insetinclude.h | 10 ++- src/insets/insetindex.C | 16 ++-- src/insets/insetindex.h | 6 +- src/insets/insetinfo.C | 18 ++--- src/insets/insetinfo.h | 3 +- src/insets/insetlabel.h | 3 +- src/insets/insetlatex.C | 147 ---------------------------------- src/insets/insetlatex.h | 69 ---------------- src/insets/insetlatexaccent.C | 9 +-- src/insets/insetlatexaccent.h | 6 +- src/insets/insetlist.C | 11 --- src/insets/insetlist.h | 6 +- src/insets/insetmarginal.C | 43 ++++------ src/insets/insetmarginal.h | 2 - src/insets/insetminipage.C | 12 --- src/insets/insetminipage.h | 6 +- src/insets/insetparent.h | 3 +- src/insets/insetquotes.C | 24 +++--- src/insets/insetquotes.h | 8 +- src/insets/insetref.h | 5 +- src/insets/insetspecialchar.h | 3 +- src/insets/insettabular.C | 31 ++++--- src/insets/insettabular.h | 27 +++---- src/insets/insettext.h | 3 +- src/insets/insettheorem.C | 12 --- src/insets/insettheorem.h | 4 +- src/insets/inseturl.C | 4 +- src/insets/inseturl.h | 3 +- src/insets/lyxinset.h | 3 +- src/intl.h | 3 +- src/layout.h | 1 - src/lyx_gui_misc.h | 2 +- src/lyxcursor.h | 2 - src/lyxfunc.C | 18 +++-- src/lyxparagraph.h | 37 +++------ src/mathed/formula.h | 8 +- src/mathed/math_defs.h | 49 +++++++----- src/mathed/math_delim.C | 11 +-- src/mathed/math_panel.h | 14 ++-- src/mathed/math_parser.h | 24 +++--- src/mathed/math_utils.C | 11 +-- src/paragraph.C | 118 ++++++++++++++++----------- src/support/DebugStream.h | 5 +- src/support/lstrings.h | 6 +- src/support/lyxmanip.h | 4 +- src/support/lyxstring.h | 66 ++------------- src/support/textutils.h | 24 +++--- src/text.C | 4 +- src/vspace.h | 2 +- 82 files changed, 583 insertions(+), 708 deletions(-) delete mode 100644 src/insets/insetlatex.C delete mode 100644 src/insets/insetlatex.h diff --git a/ChangeLog b/ChangeLog index d0d93f6d50..d819737e01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,84 @@ +2000-07-16 Lars Gullik Bjønnes + + * some whitespace chagnes to a number of files. + + * src/support/DebugStream.h: change to make it easier for + doc++ to parse correctly. + * src/support/lyxstring.h: ditto + + * src/mathed/math_utils.C (compara): change to have only one + operator() + (MathedLookupBOP): change because of the above. + + * src/mathed/math_delim.C (math_deco_compare): change to have only + one operator() + (search_deco): change becasue of the above. + + * src/insets/insettabular.C (DrawCellSelection): use std::swap + instead of manually coded one. + + * src/insets/insetquotes.C (Read): read the \end_inset too + + * src/insets/insetlatex.h: remove file + * src/insets/insetlatex.C: remove file + + * src/insets/insetindex.[Ch] (InsetPrintIndex): remove default + constructor + (InsetPrintIndex): remove destructor + + * src/insets/insetinclude.h: remove default constructor + + * src/insets/insetfloat.C: work to make it work better + + * src/insets/inseterror.[Ch] (InsetError): remove default constructor + + * src/insets/insetcite.h (InsetCitation): remove default constructor + + * src/insets/insetbutton.[Ch] (InsetButton): remove default constructor + + * src/text.C (GetColumnNearX): comment out some currently unused code. + + * src/paragraph.C (writeFile): move some initializations closer to + first use. + (CutIntoMinibuffer): small change to use new matchIT operator + (Erase): ditto + (Erase): ditto + (InsertChar): ditto + (InsertInset): ditto + (GetInset): ditto + (GetInset): ditto + (InsetIterator): ditto + (Erase): small change to use new matchFT operator + (InsertChar): ditto + (GetFontSettings): ditto + (HighestFontInRange): ditto + (SetFont): ditto + + * src/lyxparagraph.h: some chars changed to value_type + (matchIT): because of some stronger checking (perhaps too strong) + in SGI STL, the two operator() unified to one. + (matchFT): ditto + + * src/lyxfunc.C (Dispatch): code to insert InsetFloat improved + + * src/buffer.C (parseSingleLyXformat2Token): static string to hold + the last inset read added + (parseSingleLyXformat2Token): some more (future) compability code added + (parseSingleLyXformat2Token): warning about solitary \end_inset added + (parseSingleLyXformat2Token): set last_inset_read + (parseSingleLyXformat2Token): more code to read new "Float" correctly + (parseSingleLyXformat2Token): don't double intializw string next_token + + * src/TextCache.C (text_fits::operator()): add const's to the signature + (has_buffer::operator()): ditto + + * src/Floating.h: add some comments on the class + + * src/FloatList.[Ch] (typeExist): new method + (getType): ditto + + * src/BackStack.h: added default constructor, wanted by Gcc. + 2000-07-14 Juergen Vigna * src/insets/insettext.C (clear): fixed for multiple paragraps/layouts. diff --git a/src/BackStack.h b/src/BackStack.h index 152ca7355a..d1dc6f973c 100644 --- a/src/BackStack.h +++ b/src/BackStack.h @@ -24,6 +24,9 @@ private: /// struct BackStackItem { /// + BackStackItem() + : x(0), y(0) {} + /// BackStackItem(string const & f, int xx, int yy) : fname(f), x(xx), y(yy) {} /// Filename diff --git a/src/ColorHandler.C b/src/ColorHandler.C index 48aea3a9ca..ce6410a5b0 100644 --- a/src/ColorHandler.C +++ b/src/ColorHandler.C @@ -195,6 +195,7 @@ GC LyXColorHandler::getGCLinepars(PainterBase::line_style ls, GCCapStyle | GCJoinStyle | GCFunction, &val); } + // update GC cache after color redefinition void LyXColorHandler::updateColor (LColor::color c) { diff --git a/src/DepTable.C b/src/DepTable.C index d2fc3f1b90..1b8f32a1d6 100644 --- a/src/DepTable.C +++ b/src/DepTable.C @@ -119,7 +119,6 @@ void DepTable::remove_files_with_extension(string const & suf) tmp[(*cit).first] = (*cit).second; } deplist.swap(tmp); - } diff --git a/src/FloatList.C b/src/FloatList.C index d0a7263d88..61ac278a5d 100644 --- a/src/FloatList.C +++ b/src/FloatList.C @@ -56,5 +56,26 @@ string FloatList::defaultPlacement(string const & t) const } +bool FloatList::typeExist(string const & t) const +{ + List::const_iterator cit = list.find(t); + return cit != list.end(); +} + + +Floating const & FloatList::getType(string const & t) const +{ + // I wish we could use exceptions + List::const_iterator cit = list.find(t); + if (cit != list.end()) + return (*cit).second; +#ifdef HAVE_EXCEPTIONS + throw UnknownFloatType(t); +#else + static Floating empty_float; + return empty_float; +#endif +} + // The global floatlist FloatList floatList; diff --git a/src/FloatList.h b/src/FloatList.h index a328edb7d0..c231d52521 100644 --- a/src/FloatList.h +++ b/src/FloatList.h @@ -32,6 +32,10 @@ public: void newFloat(Floating const & fl); /// string defaultPlacement(string const & t) const; + /// + bool typeExist(string const & t) const; + /// + Floating const & getType(string const & t) const; private: /// List list; diff --git a/src/Floating.h b/src/Floating.h index b845ea289e..bb7b78d731 100644 --- a/src/Floating.h +++ b/src/Floating.h @@ -16,6 +16,12 @@ #pragma interface #endif +/** This is a "float layout" object. It contains the parameters for how to + handle the different kinds of floats, default ones and user created ones. + Objects of this class is stored in a container in FloatList. The different + InsetFloat(s) have a pointer/reference through the name of the Floating + so that it knows how the different floats should be handled. +*/ class Floating { public: /// diff --git a/src/TextCache.C b/src/TextCache.C index 52645966f4..5e11893eb9 100644 --- a/src/TextCache.C +++ b/src/TextCache.C @@ -35,7 +35,7 @@ class text_fits { public: text_fits(Buffer * b, int p) : buf(b), pw(p) {} - bool operator()(TextCache::value_type & vt) { + bool operator()(TextCache::value_type const & vt) const { if (vt.first == buf && vt.second.first == pw) return true; return false; @@ -70,6 +70,7 @@ private: ostream & os; }; + void TextCache::show(ostream & os, string const & str) { os << "TextCache: " << str << endl; @@ -84,7 +85,7 @@ void TextCache::show(ostream & os, TextCache::value_type const & vt) } -void TextCache::add(Buffer *buf, int workwidth, LyXText * text) +void TextCache::add(Buffer * buf, int workwidth, LyXText * text) { lyxerr.debug() << "TextCache::add " << text; if (bufferlist.isLoaded(buf)) { @@ -116,7 +117,7 @@ class has_buffer { public: has_buffer(Buffer * b) : buf(b) {} - bool operator()(TextCache::value_type & vt) { + bool operator()(TextCache::value_type const & vt) const{ if (vt.first == buf) return true; return false; } diff --git a/src/buffer.C b/src/buffer.C index 2dd798f084..40889f032d 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -307,7 +307,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, LyXParagraph::footnote_kind & footnotekind) { bool the_end_read = false; - + // We'll remove this later. (Lgb) + static string last_inset_read; + if (token[0] != '\\') { for (string::const_iterator cit = token.begin(); cit != token.end(); ++cit) { @@ -393,14 +395,23 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, } else if (tmptok == "margin") { inset = new InsetMarginal; } else if (tmptok == "fig") { + inset = new InsetFloat("figure"); //inset = new InsetFigure; } else if (tmptok == "tab") { + inset = new InsetFloat("table"); //inset = new InsetTable; } else if (tmptok == "alg") { + inset = new InsetFloat("algorithm"); //inset = new InsetAlgorithm; } else if (tmptok == "wide-fig") { + InsetFloat * tmp = new InsetFloat("figure"); + tmp->wide(true); + inset = tmp; //inset = new InsetFigure(true); } else if (tmptok == "wide-tab") { + InsetFloat * tmp = new InsetFloat("table"); + tmp->wide(true); + inset = tmp; //inset = new InsetTable(true); } @@ -790,6 +801,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, par->labelwidthstring = lex.GetString(); // do not delete this token, it is still needed! } else if (token == "\\end_inset") { + lyxerr << "Solitary \\end_inset. Missing \\begin_inset?.\n" + << "Last inset read was: " << last_inset_read + << endl; // Simply ignore this. The insets do not have // to read this. // But insets should read it, it is a part of @@ -798,6 +812,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, // Should be moved out into its own function/method. (Lgb) lex.next(); string tmptok = lex.GetString(); + last_inset_read = tmptok; // test the different insets if (tmptok == "Quotes") { Inset * inset = new InsetQuotes; @@ -865,7 +880,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, par->InsertInset(pos, inset, font); ++pos; } else if (tmptok == "Float") { - Inset * inset = new InsetFloat; + lex.next(); + string tmptok = lex.GetString(); + Inset * inset = new InsetFloat(tmptok); inset->Read(this, lex); par->InsertInset(pos, inset, font); ++pos; @@ -938,9 +955,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, // Insets don't make sense in a free-spacing context! ---Kayvan if (layout.free_spacing) { if (lex.IsOK()) { - string next_token; lex.next(); - next_token = lex.GetString(); + string next_token = lex.GetString(); if (next_token == "\\-") { par->InsertChar(pos, '-', font); } else if (next_token == "\\protected_separator" diff --git a/src/debug.h b/src/debug.h index 8f787f728c..18a1e3216e 100644 --- a/src/debug.h +++ b/src/debug.h @@ -79,7 +79,7 @@ struct Debug { }; -/// + inline void operator|= (Debug::type & d1, Debug::type d2) { @@ -90,7 +90,7 @@ void operator|= (Debug::type & d1, Debug::type d2) #include "support/DebugStream.h" -/// + std::ostream & operator<<(std::ostream & o, Debug::type t); extern DebugStream lyxerr; diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 2c34fbf6c9..73ac251a42 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -34,15 +34,17 @@ FD_bibitem_form * bibitem_form = 0; FD_bibitem_form * create_form_bibitem_form(void); -extern "C" void bibitem_cb(FL_OBJECT *, long data) +extern "C" +void bibitem_cb(FL_OBJECT *, long data) { InsetBibKey::Holder * holder = static_cast (bibitem_form->bibitem_form->u_vdata); - + holder->inset->callback( bibitem_form, data ); } + FD_bibitem_form * create_form_bibitem_form(void) { FL_OBJECT * obj; @@ -71,8 +73,8 @@ FD_bibitem_form * create_form_bibitem_form(void) } -InsetBibKey::InsetBibKey(string const & key, string const & label): - InsetCommand("bibitem", key, label) +InsetBibKey::InsetBibKey(string const & key, string const & label) + : InsetCommand("bibitem", key, label) { counter = 1; if (key.empty()) @@ -80,8 +82,8 @@ InsetBibKey::InsetBibKey(string const & key, string const & label): } -InsetBibKey::InsetBibKey(InsetBibKey const * b): - InsetCommand("bibitem", b->getContents(), b->getOptions()) +InsetBibKey::InsetBibKey(InsetBibKey const * b) + : InsetCommand("bibitem", b->getContents(), b->getOptions()) { counter = b->counter; } @@ -98,11 +100,9 @@ InsetBibKey::~InsetBibKey() void InsetBibKey::callback( FD_bibitem_form * form, long data ) { - switch (data) - { + switch (data) { case 1: - if(!holder.view->buffer()->isReadonly()) - { + if(!holder.view->buffer()->isReadonly()) { setContents(fl_get_input(form->key)); setOptions(fl_get_input(form->label)); // shouldn't mark the buffer dirty unless @@ -164,7 +164,7 @@ string InsetBibKey::getScreenLabel() const } -/* +/** The value in "Key:" isn't allways set right after a few bibkey insets have been added/removed. Perhaps the wrong object is deleted/used somewhere upwards? @@ -205,8 +205,8 @@ void InsetBibKey::Edit(BufferView * bv, int, int, unsigned int) InsetBibtex::InsetBibtex(string const & dbase, string const & style, Buffer * o) : InsetCommand("BibTeX", dbase, style), owner(o) -{ -} +{} + InsetBibtex::~InsetBibtex() { diff --git a/src/insets/insetbib.h b/src/insets/insetbib.h index 0ca6e3de19..f0b302ab77 100644 --- a/src/insets/insetbib.h +++ b/src/insets/insetbib.h @@ -27,7 +27,7 @@ struct FD_bibitem_form; Must be automatically inserted as the first object in a bibliography paragraph. */ -class InsetBibKey: public InsetCommand { +class InsetBibKey : public InsetCommand { public: /// InsetBibKey() : InsetCommand("bibitem") { counter = 1; } @@ -41,7 +41,9 @@ public: ~InsetBibKey(); /// Inset * Clone() const { return new InsetBibKey(this); } - /// Currently \bibitem is used as a LyX2.x command, so we need this method. + /** Currently \bibitem is used as a LyX2.x command, + so we need this method. + */ void Write(Buffer const *, std::ostream &) const; /// void Read(Buffer const *, LyXLex & lex); @@ -69,7 +71,7 @@ public: BufferView * view; }; - private: +private: /// int counter; /// @@ -79,7 +81,7 @@ public: /** Used to insert BibTeX's information */ -class InsetBibtex: public InsetCommand { +class InsetBibtex : public InsetCommand { public: /// InsetBibtex() : InsetCommand("BibTeX") { owner = 0; } @@ -93,7 +95,7 @@ public: Inset * Clone() const { return new InsetBibtex(getCmdName(), getOptions(), 0); } - /// + /// Inset::Code LyxCode() const { return Inset::BIBTEX_CODE; @@ -103,9 +105,10 @@ public: /// void Edit(BufferView *, int x, int y, unsigned int button); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool freespace) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool freespace) const; /// - std::vector< std::pair > getKeys() const; + std::vector > getKeys() const; /// EDITABLE Editable() const { return IS_EDITABLE; @@ -116,7 +119,7 @@ public: bool delDatabase(string const &); /// bool display() const { return true; } - + /// struct Holder { InsetBibtex * inset; BufferView * view; diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C index d208918a18..f5c467eaa1 100644 --- a/src/insets/insetbutton.C +++ b/src/insets/insetbutton.C @@ -23,10 +23,6 @@ using std::ostream; using std::endl; -InsetButton::InsetButton() -{ -} - int InsetButton::ascent(BufferView * bv, LyXFont const &) const { LyXFont font(LyXFont::ALL_SANE); diff --git a/src/insets/insetbutton.h b/src/insets/insetbutton.h index 5ef251fc69..7176769d71 100644 --- a/src/insets/insetbutton.h +++ b/src/insets/insetbutton.h @@ -23,9 +23,6 @@ */ class InsetButton: public Inset { public: - /// - InsetButton(); - /// int ascent(BufferView *, LyXFont const &) const; /// diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index 9f31ae2186..3c31e29335 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -19,10 +19,11 @@ #include "BufferView.h" #include "frontends/Dialogs.h" + InsetCitation::InsetCitation(string const & key, string const & note) : InsetCommand("cite", key, note), dialogs_(0) -{ -} +{} + InsetCitation::~InsetCitation() { @@ -33,7 +34,6 @@ InsetCitation::~InsetCitation() string InsetCitation::getScreenLabel() const { string temp("["); - temp += getContents(); if( !getOptions().empty() ) { diff --git a/src/insets/insetcite.h b/src/insets/insetcite.h index 3aa04702ab..e3faef1579 100644 --- a/src/insets/insetcite.h +++ b/src/insets/insetcite.h @@ -20,7 +20,7 @@ class Dialogs; /** Used to insert citations */ -class InsetCitation: public InsetCommand { +class InsetCitation : public InsetCommand { public: /// explicit @@ -39,7 +39,7 @@ public: void Edit(BufferView *, int, int, unsigned int); private: /// - InsetCitation() : InsetCommand("cite"), dialogs_(0) {} + //InsetCitation() : InsetCommand("cite"), dialogs_(0) {} /// Dialogs * dialogs_; }; diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 4c8207c4ce..8e3b78f304 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -280,7 +280,8 @@ void InsetCollapsable::InsetKeyPress(XKeyEvent * xke) } -int InsetCollapsable::Latex(Buffer const * buf, ostream & os, bool fragile, bool free_spc) const +int InsetCollapsable::Latex(Buffer const * buf, ostream & os, + bool fragile, bool free_spc) const { return inset->Latex(buf, os, fragile, free_spc); } @@ -289,8 +290,7 @@ int InsetCollapsable::Latex(Buffer const * buf, ostream & os, bool fragile, bool int InsetCollapsable::getMaxWidth(Painter & pain, UpdatableInset const * inset) const { - int w; - w = UpdatableInset::getMaxWidth(pain,inset); + int w = UpdatableInset::getMaxWidth(pain,inset); if (w < 0) { return w; @@ -302,6 +302,7 @@ int InsetCollapsable::getMaxWidth(Painter & pain, return w; // - top_x - widthCollapsed; } + #if 0 int InsetCollapsable::getMaxTextWidth(Painter & pain, UpdatableInset const * inset) const @@ -310,6 +311,7 @@ int InsetCollapsable::getMaxTextWidth(Painter & pain, } #endif + void InsetCollapsable::update(BufferView * bv, LyXFont const & font, bool reinit) { @@ -340,8 +342,10 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font, inset->update(bv, font); } + UpdatableInset::RESULT -InsetCollapsable::LocalDispatch(BufferView * bv, int action, string const & arg) +InsetCollapsable::LocalDispatch(BufferView * bv, int action, + string const & arg) { UpdatableInset::RESULT result = inset->LocalDispatch(bv, action, arg); if (result == FINISHED) @@ -349,6 +353,7 @@ InsetCollapsable::LocalDispatch(BufferView * bv, int action, string const & arg) return result; } + bool InsetCollapsable::LockInsetInInset(BufferView * bv, UpdatableInset * in) { if (inset == in) @@ -423,6 +428,7 @@ void InsetCollapsable::SetFont(BufferView * bv, inset->SetFont(bv, font, toggleall); } + bool InsetCollapsable::doClearArea() const { return inset->doClearArea(); diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index e717107d0d..e01b0cbc19 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -91,7 +91,8 @@ public: /// UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const { return 0; } /// @@ -120,7 +121,9 @@ public: int getMaxWidth(Painter & pain, UpdatableInset const *) const; /// LyXText * getLyXText(BufferView *) const; + /// void deleteLyXText(BufferView *, bool recursive=true) const; + /// void resizeLyXText(BufferView *) const; protected: diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index ed02526b37..b5758e107c 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -23,15 +23,13 @@ using std::endl; InsetCommand::InsetCommand() -{ -} +{} InsetCommand::InsetCommand(string const & cmd, string const & arg, string const & opt) : cmdname(cmd), options(opt), contents(arg) -{ -} +{} // In lyxf3 this will be just LaTeX @@ -127,7 +125,8 @@ void InsetCommand::Read(Buffer const *, LyXLex & lex) } -int InsetCommand::Latex(Buffer const *, ostream & os, bool /*fragile*/, bool/*fs*/) const +int InsetCommand::Latex(Buffer const *, ostream & os, + bool /*fragile*/, bool/*fs*/) const { os << getCommand(); return 0; diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h index fe0c8e9258..68c82a945e 100644 --- a/src/insets/insetcommand.h +++ b/src/insets/insetcommand.h @@ -24,7 +24,7 @@ * Similar to InsetLaTeX but having control of the basic structure of a * LaTeX command: \name[options]{contents}. */ -class InsetCommand: public InsetButton { +class InsetCommand : public InsetButton { public: /// InsetCommand(); diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 59bbcc2fb0..7cfdd4b250 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -25,17 +25,17 @@ using std::ostream; /* Error, used for the LaTeX-Error Messages */ +#if 0 InsetError::InsetError() { form = 0; } +#endif InsetError::InsetError(string const & str) - : contents(str) -{ - form = 0; -} + : contents(str), form(0) +{} InsetError::~InsetError() @@ -155,7 +155,8 @@ void InsetError::CloseErrorCB(FL_OBJECT * ob, long) // A C wrapper -extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data) +extern "C" +void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data) { InsetError::CloseErrorCB(ob , data); } diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h index de7ccb67fa..d1a19f8491 100644 --- a/src/insets/inseterror.h +++ b/src/insets/inseterror.h @@ -26,13 +26,15 @@ The edit-operation opens a dialog with the text of the error-message. The inset is displayed as "Error" in a box, and automatically deleted. */ -class InsetError: public Inset { +class InsetError : public Inset { public: /// explicit InsetError(string const & string); +#if 0 /// InsetError(); +#endif /// ~InsetError(); /// @@ -48,7 +50,8 @@ public: /// void Read(Buffer const *, LyXLex & lex); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 1747cb6132..caaad36f99 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -269,7 +269,8 @@ void InsetExternal::Edit(BufferView * bv, CancelCloseBoxCB, 0); } holder.view = bv; - fl_addto_choice(form_external->templatechoice, getTemplateString().c_str()); + fl_addto_choice(form_external->templatechoice, + getTemplateString().c_str()); fl_set_input(form_external->filename, filename.c_str()); fl_set_input(form_external->parameters, parameters.c_str()); if (!templatename.empty()) { diff --git a/src/insets/insetexternal.h b/src/insets/insetexternal.h index ea542c7574..58f1b6763c 100644 --- a/src/insets/insetexternal.h +++ b/src/insets/insetexternal.h @@ -86,7 +86,8 @@ public: static void cancelCB(FL_OBJECT *, long); private: /// Write the output for a specific file format - int write(string const & format, Buffer const *, std::ostream &) const; + int write(string const & format, Buffer const *, + std::ostream &) const; /// Apply the changes void doApply(BufferView * bv); @@ -107,7 +108,9 @@ private: /// Substitute meta-variables in this string string doSubstitution(Buffer const *, string const & s) const; - /// Get the LyX name of the currently selected template in the choice list + /** Get the LyX name of the currently selected + template in the choice list + */ string getCurrentTemplate() const; /// Get a certain template from a LyX name diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index e60f5c36eb..e0809a3b37 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -17,13 +17,13 @@ #include "gettext.h" #include "lyxfont.h" #include "BufferView.h" -#include "Painter.h" #include "lyxtext.h" #include "insets/insettext.h" #include "support/LOstream.h" #include "FloatList.h" #include "LaTeXFeatures.h" #include "debug.h" +#include "Floating.h" using std::ostream; using std::endl; @@ -78,9 +78,12 @@ using std::endl; // // Lgb -InsetFloat::InsetFloat() : InsetCollapsable() +InsetFloat::InsetFloat(string const & type) + : InsetCollapsable() { - setLabel(_("float")); + string lab(_("float:")); + lab += type; + setLabel(lab); LyXFont font(LyXFont::ALL_SANE); font.decSize(); font.decSize(); @@ -88,16 +91,20 @@ InsetFloat::InsetFloat() : InsetCollapsable() setLabelFont(font); setAutoCollapse(false); setInsetName("Float"); - floatType = "table"; - floatPlacement = "H"; + floatType = type; + //floatPlacement = "H"; } void InsetFloat::Write(Buffer const * buf, ostream & os) const { os << getInsetName() - << "\ntype " << floatType - << "\nplacement " << floatPlacement << "\n"; + << " " << floatType + << "\nplacement "; + if (floatPlacement.empty()) + os << floatList.getType(floatType).placement << "\n"; + else + os << floatPlacement << "\n"; InsetCollapsable::Write(buf, os); } @@ -107,12 +114,6 @@ void InsetFloat::Read(Buffer const * buf, LyXLex & lex) if (lex.IsOK()) { lex.next(); string token = lex.GetString(); - if (token == "type") { - lex.next(); - floatType = lex.GetString(); - } - lex.next(); - token = lex.GetString(); if (token == "placement") { lex.next(); floatPlacement = lex.GetString(); @@ -130,7 +131,7 @@ void InsetFloat::Validate(LaTeXFeatures & features) const Inset * InsetFloat::Clone() const { - InsetFloat * result = new InsetFloat; + InsetFloat * result = new InsetFloat(floatType); result->inset->init(inset); result->collapsed = collapsed; @@ -170,17 +171,6 @@ bool InsetFloat::InsertInsetAllowed(Inset * in) const } -#if 0 -LyXFont InsetFloat::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const -{ - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; -} -#endif - - void InsetFloat::InsetButtonRelease(BufferView * bv, int x, int y, int button) { if (x >= 0 @@ -196,3 +186,24 @@ void InsetFloat::InsetButtonRelease(BufferView * bv, int x, int y, int button) } } + +void InsetFloat::wide(bool w) +{ + wide_ = w; + if (wide_) { + string lab(_("float:")); + lab += floatType; + lab += "*"; + setLabel(lab); + } else { + string lab(_("float:")); + lab += floatType; + setLabel(lab); + } +} + + +bool InsetFloat::wide() const +{ + return wide_; +} diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index 8669911d5e..62e51aae9e 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -26,7 +26,7 @@ class Painter; class InsetFloat : public InsetCollapsable { public: /// - InsetFloat(); + InsetFloat(string const &); /// void Write(Buffer const * buf, std::ostream & os) const; /// @@ -44,14 +44,18 @@ public: /// bool InsertInsetAllowed(Inset * inset) const; /// -// LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const; - /// void InsetButtonRelease(BufferView * bv, int x, int y, int button); + /// + void wide(bool w); + /// + bool wide() const; private: /// string floatType; /// string floatPlacement; + /// + bool wide_; }; #endif diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index 4857207529..732c0441b4 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -27,7 +27,8 @@ using std::ostream; using std::endl; -InsetFoot::InsetFoot() : InsetFootlike() +InsetFoot::InsetFoot() + : InsetFootlike() { setLabel(_("foot")); setInsetName("Foot"); @@ -70,14 +71,3 @@ bool InsetFoot::InsertInsetAllowed(Inset * in) const } return true; } - - -#if 0 -LyXFont InsetFoot::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const -{ - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; -} -#endif diff --git a/src/insets/insetfoot.h b/src/insets/insetfoot.h index 566c6e2db5..d84e1327c2 100644 --- a/src/insets/insetfoot.h +++ b/src/insets/insetfoot.h @@ -37,8 +37,6 @@ public: const char * EditMessage() const; /// bool InsertInsetAllowed(Inset * inset) const; - /// - //LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const; }; #endif diff --git a/src/insets/insetfootlike.C b/src/insets/insetfootlike.C index e6e448052d..527dc644c6 100644 --- a/src/insets/insetfootlike.C +++ b/src/insets/insetfootlike.C @@ -16,7 +16,7 @@ #include "insetfootlike.h" #include "lyxfont.h" -#include "BufferView.h" +#include "buffer.h" #include "lyxtext.h" #include "support/LOstream.h" @@ -40,14 +40,3 @@ void InsetFootlike::Write(Buffer const * buf, ostream & os) const os << getInsetName() << "\n"; InsetCollapsable::Write(buf, os); } - - -#if 0 -LyXFont InsetFootlike::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const -{ - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; -} -#endif diff --git a/src/insets/insetfootlike.h b/src/insets/insetfootlike.h index ab2eeb0f97..c0e98fe94b 100644 --- a/src/insets/insetfootlike.h +++ b/src/insets/insetfootlike.h @@ -20,6 +20,8 @@ #include "insetcollapsable.h" +// To have this class is probably a bit overkill... (Lgb) + /** The footnote inset */ @@ -29,8 +31,6 @@ public: InsetFootlike(); /// void Write(Buffer const * buf, std::ostream & os) const; - /// - //LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const; }; #endif diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 40ee1688d0..bfcc2088c2 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -32,7 +32,8 @@ extern string system_tempdir; string browseFile(); -extern "C" void GraphicxCB(FL_OBJECT * obj, long arg) +extern "C" +void GraphicxCB(FL_OBJECT * obj, long arg) { lyxerr << "GraphicxCB: obj = " << obj << " arg = " << arg << endl; switch (arg) { diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 16fba287f6..43fe14c26b 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -48,7 +48,8 @@ public: fragile == true means, that the inset should take care about fragile commands by adding a \protect before. */ - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 440190bb54..1e08cce899 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -93,7 +93,8 @@ FD_include * create_form_include(void) FD_include * form = 0; -extern "C" void include_cb(FL_OBJECT *, long arg) +extern "C" +void include_cb(FL_OBJECT *, long arg) { InsetInclude * inset = static_cast(form->include->u_vdata); diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h index 5dc86d56fc..0adf74ca74 100644 --- a/src/insets/insetinclude.h +++ b/src/insets/insetinclude.h @@ -27,11 +27,13 @@ struct LaTeXFeatures; */ class InsetInclude: public InsetCommand { public: +#if 0 /// InsetInclude(): InsetCommand("include") { flag = InsetInclude::INCLUDE; } +#endif /// InsetInclude(string const &, Buffer *); /// @@ -64,7 +66,9 @@ public: /// void Validate(LaTeXFeatures &) const; - /// Input inserts anything inside a paragraph, Display can give some visual feedback + /** Input inserts anything inside a paragraph. + Display can give some visual feedback + */ bool display() const; /// string getScreenLabel() const; @@ -88,7 +92,9 @@ public: */ bool isVerb() const; /// - bool isVerbVisibleSpace() const { return flag == InsetInclude::VERBAST;} + bool isVerbVisibleSpace() const { + return flag == InsetInclude::VERBAST; + } /// bool isInclude() const { return flag == InsetInclude::INCLUDE;} /// diff --git a/src/insets/insetindex.C b/src/insets/insetindex.C index 7e617a84af..c009b38848 100644 --- a/src/insets/insetindex.C +++ b/src/insets/insetindex.C @@ -17,7 +17,8 @@ FD_index_form * index_form = 0; -extern "C" void index_cb(FL_OBJECT *, long data) +extern "C" +void index_cb(FL_OBJECT *, long data) { InsetIndex::Holder * holder = static_cast @@ -59,8 +60,7 @@ FD_index_form * create_form_index_form() InsetIndex::InsetIndex(string const & key) : InsetCommand("index", key) -{ -} +{} InsetIndex::~InsetIndex() @@ -100,7 +100,8 @@ void InsetIndex::Edit(BufferView * bv, int, int, unsigned int) if (!index_form) { index_form = create_form_index_form(); - fl_set_form_atclose(index_form->index_form, CancelCloseBoxCB, 0); + fl_set_form_atclose(index_form->index_form, + CancelCloseBoxCB, 0); } holder.inset = this; @@ -128,22 +129,25 @@ string InsetIndex::getScreenLabel() const // InsetPrintIndex // +#if 0 InsetPrintIndex::InsetPrintIndex() : InsetCommand("printindex") { owner = 0; } +#endif InsetPrintIndex::InsetPrintIndex(Buffer * o) : InsetCommand("printindex"), owner(o) -{ -} +{} +#if 0 InsetPrintIndex::~InsetPrintIndex() { } +#endif string InsetPrintIndex::getScreenLabel() const diff --git a/src/insets/insetindex.h b/src/insets/insetindex.h index a5a2ac9068..50a2e4cf20 100644 --- a/src/insets/insetindex.h +++ b/src/insets/insetindex.h @@ -27,7 +27,7 @@ struct FD_index_form; /** Used to insert index labels */ -class InsetIndex: public InsetCommand { +class InsetIndex : public InsetCommand { public: /// InsetIndex() : InsetCommand("index") {} @@ -62,12 +62,16 @@ public: class InsetPrintIndex : public InsetCommand { public: +#if 0 /// InsetPrintIndex(); +#endif /// InsetPrintIndex(Buffer *); +#if 0 /// ~InsetPrintIndex(); +#endif /// Updates needed features for this inset. void Validate(LaTeXFeatures & features) const; /// diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C index 3a9fa245b1..1f4e68e7b4 100644 --- a/src/insets/insetinfo.C +++ b/src/insets/insetinfo.C @@ -35,21 +35,18 @@ extern BufferView * current_view; InsetInfo::InsetInfo() -{ - form = 0; -} + : form(0) +{} -InsetInfo::InsetInfo(string const & string) - : contents(string) -{ - form = 0; -} +InsetInfo::InsetInfo(string const & str) + : contents(str), form(0) +{} InsetInfo::~InsetInfo() { - if (form){ + if (form) { fl_hide_form(form); fl_free_form(form); form = 0; @@ -182,7 +179,8 @@ void InsetInfo::CloseInfoCB(FL_OBJECT * ob, long) // This is just a wrapper. -extern "C" void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data) +extern "C" +void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data) { InsetInfo::CloseInfoCB(ob, data); } diff --git a/src/insets/insetinfo.h b/src/insets/insetinfo.h index 30b3fcb020..8b01e35455 100644 --- a/src/insets/insetinfo.h +++ b/src/insets/insetinfo.h @@ -50,7 +50,8 @@ public: /// void Read(Buffer const *, LyXLex & lex); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetlabel.h b/src/insets/insetlabel.h index eb5bfe1b64..750a3508ad 100644 --- a/src/insets/insetlabel.h +++ b/src/insets/insetlabel.h @@ -40,7 +40,8 @@ public: /// void Edit(BufferView *, int, int, unsigned int); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetlatex.C b/src/insets/insetlatex.C deleted file mode 100644 index 664c041a9c..0000000000 --- a/src/insets/insetlatex.C +++ /dev/null @@ -1,147 +0,0 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. - * - * ====================================================== */ - -#include - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "insetlatex.h" -#include "lyxdraw.h" - -/* Latex. Used to insert Latex-Code automatically */ - - -InsetLatex::InsetLatex() -{ -} - - -InsetLatex::InsetLatex(string const & string) - : contents(string) -{ -} - - -InsetLatex::~InsetLatex() -{ -} - - -int InsetLatex::Ascent(LyXFont const & font) const -{ - return font.maxAscent() + 1; -} - - -int InsetLatex::Descent(LyXFont const & font) const -{ - return font.maxDescent() + 1; -} - - -int InsetLatex::Width(LyXFont const & font) const -{ - return 6 + font.stringWidth(contents); -} - - -void InsetLatex::Draw(LyXFont font, LyXScreen & scr, - int baseline, float & x) -{ - // Latex-insets are always LaTeX, so just correct the font */ - font.setLatex(LyXFont::ON); - - // Draw it as a box with the LaTeX text - x += 1; - - scr.fillRectangle(gc_lighted, int(x), baseline - Ascent(font) +1 , - Width(font) - 2, Ascent(font) + Descent(font) -2); - - scr.drawRectangle(gc_foot, int(x), baseline - Ascent(font) + 1, - Width(font)-2, Ascent(font)+Descent(font)-2); - - scr.drawString(font, contents, baseline, int(x+2)); - x += Width(font) - 1; -} - - -void InsetLatex::Write(FILE * file) -{ - fprintf(file, "Latex %s\n", contents.c_str()); -} - - -void InsetLatex::Read(Buffer const *, LyXLex & lex) -{ - FILE * file = lex.getFile(); - char c = 0; - string tmp; - while (!feof(file) && (c = fgetc(file)) != '\n') { - tmp += char(c); - } - contents = tmp; -} - - -int InsetLatex::Latex(FILE * file, signed char /*fragile*/, bool /*fs*/) -{ - fprintf(file, "%s", contents.c_str()); - return 0; -} - - -int InsetLatex::Latex(string & file, signed char /*fragile*/, bool /*fs*/) -{ - file += contents; - return 0; -} - - -int InsetLatex::Ascii(string & file) -{ - file += contents; - return 0; -} - - -int InsetLatex::Linuxdoc(string & file) -{ - file += contents; - return 0; -} - - -int InsetLatex::DocBook(string & file) -{ - file += contents; - return 0; -} - - -bool InsetLatex::Deletable() const -{ - return false; -} - - -InsetLatex * InsetLatex::Clone() const -{ - InsetLatex * result = new InsetLatex(contents); - return result; -} - - -Inset::Code InsetLatex::LyxCode() const -{ - if (contents == "\\tableofcontents") return Inset::TOC_CODE; - return Inset::NO_CODE; -} diff --git a/src/insets/insetlatex.h b/src/insets/insetlatex.h deleted file mode 100644 index ad875ced24..0000000000 --- a/src/insets/insetlatex.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- -/* This file is part of* - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright (C) 1995 Matthias Ettrich - * - * ====================================================== */ - -#ifndef INSET_LATEX_H -#define INSET_LATEX_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include "lyxinset.h" -#include "LString.h" - -/** Latex. Used to insert non-deletable LaTeX-Code automatically - - Behaves as LaTeXDels, but cannot be deleted with the normal - delete/backspace operations. This is used when you insert a LaTeX - figure (done as "\input "), but you still have to type the filename - yourself after the inset. */ -class InsetLatex : public Inset { -public: - /// - InsetLatex(); - /// - explicit - InsetLatex(string const & string); - /// - ~InsetLatex(); - /// - int Ascent(LyXFont const & font) const; - /// - int Descent(LyXFont const & font) const; - /// - int Width(LyXFont const & font) const; - /// - void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x); - /// - void Write(FILE * file); - /// - void Read(Buffer const *, LyXLex & lex); - /// - int Latex(FILE * file, signed char fragile, bool free_spc); - /// - int Latex(string & file, signed char fragile, bool free_spc); - /// - int Ascii(string & file) const; - /// - int Linuxdoc(string & file); - /// - int DocBook(string & file); - /// - bool Deletable() const; - /// - Inset * Clone() const; - /// - Inset::Code LyxCode() const; -private: - /// - string contents; -}; - -#endif diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index bfefc9945c..dbb8106205 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -30,13 +30,12 @@ using std::endl; /* Later modified by Lars G. Bjønnes, larsbj@lyx.org */ InsetLatexAccent::InsetLatexAccent() -{ - candisp = false; -} + : candisp(false) +{} -InsetLatexAccent::InsetLatexAccent(string const & string) - : contents(string) +InsetLatexAccent::InsetLatexAccent(string const & str) + : contents(str) { checkContents(); } diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index 3e116f6af0..c61bfec1c6 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -30,7 +30,7 @@ class InsetLatexAccent : public Inset { public: /// - InsetLatexAccent(); + InsetLatexAccent(); /// explicit InsetLatexAccent(string const & string); @@ -54,7 +54,8 @@ public: /// void Read(Buffer const *, LyXLex & lex); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// @@ -137,6 +138,7 @@ private: mutable char ic; }; + bool InsetLatexAccent::CanDisplay() { return candisp; diff --git a/src/insets/insetlist.C b/src/insets/insetlist.C index a126b40e67..0b33ce08f7 100644 --- a/src/insets/insetlist.C +++ b/src/insets/insetlist.C @@ -17,7 +17,6 @@ #include "gettext.h" #include "lyxfont.h" #include "BufferView.h" -#include "Painter.h" #include "lyxtext.h" #include "insets/insettext.h" #include "support/LOstream.h" @@ -94,13 +93,3 @@ bool InsetList::InsertInsetAllowed(Inset * in) const } return true; } - - -#if 0 -LyXFont InsetList::GetDrawFont(BufferView * bv,LyXParagraph * p, int pos) const -{ - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; -} -#endif diff --git a/src/insets/insetlist.h b/src/insets/insetlist.h index 4aaa2bfc9c..b8a0e1c3f5 100644 --- a/src/insets/insetlist.h +++ b/src/insets/insetlist.h @@ -18,9 +18,7 @@ #include "insetcollapsable.h" -class Painter; - -/** The footnote inset +/** The list inset */ class InsetList : public InsetCollapsable { @@ -39,8 +37,6 @@ public: const char * EditMessage() const; /// bool InsertInsetAllowed(Inset * inset) const; - /// -// LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const; }; #endif diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index 86bba7f28e..017a0e642d 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -37,11 +37,11 @@ InsetMarginal::InsetMarginal() Inset * InsetMarginal::Clone() const { - InsetMarginal * result = new InsetMarginal; - result->inset->init(inset); - - result->collapsed = collapsed; - return result; + InsetMarginal * result = new InsetMarginal; + result->inset->init(inset); + + result->collapsed = collapsed; + return result; } @@ -54,31 +54,20 @@ char const * InsetMarginal::EditMessage() const int InsetMarginal::Latex(Buffer const * buf, ostream & os, bool fragile, bool fp) const { - os << "\\marginpar{%\n"; - - int i = inset->Latex(buf, os, fragile, fp); - os << "}%\n"; - - return i + 2; + os << "\\marginpar{%\n"; + + int i = inset->Latex(buf, os, fragile, fp); + os << "}%\n"; + + return i + 2; } bool InsetMarginal::InsertInsetAllowed(Inset * in) const { - if ((in->LyxCode() == Inset::FOOT_CODE) || - (in->LyxCode() == Inset::MARGIN_CODE)) { - return false; - } - return true; + if ((in->LyxCode() == Inset::FOOT_CODE) || + (in->LyxCode() == Inset::MARGIN_CODE)) { + return false; + } + return true; } - - -#if 0 -LyXFont InsetMarginal::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const -{ - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; -} -#endif diff --git a/src/insets/insetmarginal.h b/src/insets/insetmarginal.h index 5d19e9579e..cf68c7631f 100644 --- a/src/insets/insetmarginal.h +++ b/src/insets/insetmarginal.h @@ -35,8 +35,6 @@ public: const char * EditMessage() const; /// bool InsertInsetAllowed(Inset * inset) const; - /// - //LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const; }; #endif diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 5cd5e8e366..80083833d4 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -17,7 +17,6 @@ #include "gettext.h" #include "lyxfont.h" #include "BufferView.h" -#include "Painter.h" #include "lyxtext.h" #include "insets/insettext.h" #include "support/LOstream.h" @@ -112,14 +111,3 @@ bool InsetMinipage::InsertInsetAllowed(Inset * in) const } return true; } - - -#if 0 -LyXFont InsetMinipage::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const -{ - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; -} -#endif diff --git a/src/insets/insetminipage.h b/src/insets/insetminipage.h index 540d68c46c..a9800d08fd 100644 --- a/src/insets/insetminipage.h +++ b/src/insets/insetminipage.h @@ -18,9 +18,7 @@ #include "insetcollapsable.h" -class Painter; - -/** The footnote inset +/** The minipage inset */ class InsetMinipage : public InsetCollapsable { @@ -39,8 +37,6 @@ public: const char * EditMessage() const; /// bool InsertInsetAllowed(Inset * inset) const; - /// -// LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const; }; #endif diff --git a/src/insets/insetparent.h b/src/insets/insetparent.h index 48bccbd0f0..861ac9d2a6 100644 --- a/src/insets/insetparent.h +++ b/src/insets/insetparent.h @@ -32,7 +32,8 @@ public: explicit InsetParent(string const & fn, Buffer * owner = 0); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// Inset * Clone() const { return new InsetParent(getContents()); } /// diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index f0ae0ebc8c..e8e5bde31a 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -73,8 +73,7 @@ InsetQuotes::InsetQuotes(InsetQuotes::quote_language l, InsetQuotes::quote_side s, InsetQuotes::quote_times t) : language(l), side(s), times(t) -{ -} +{} InsetQuotes::InsetQuotes(char c, BufferParams const & params) @@ -189,9 +188,12 @@ int InsetQuotes::width(BufferView *, LyXFont const & font) const } -LyXFont InsetQuotes::ConvertFont(LyXFont font) +//LyXFont InsetQuotes::ConvertFont(LyXFont font) +// I really belive this should be +LyXFont InsetQuotes::ConvertFont(LyXFont const & f) { - /* quotes-insets cannot be latex of any kind */ + LyXFont font(f); + // quotes-insets cannot be latex of any kind font.setLatex(LyXFont::OFF); return font; } @@ -221,10 +223,16 @@ void InsetQuotes::Read(Buffer const *, LyXLex & lex) { lex.nextToken(); ParseString(lex.GetString()); + lex.next(); + string tmp(lex.GetString()); + if (tmp != "\\end_inset") + lyxerr << "LyX Warning: Missing \\end_inset " + "in InsetQuotes::Read." << endl; } -int InsetQuotes::Latex(Buffer const *, ostream & os, bool /*fragile*/, bool) const +int InsetQuotes::Latex(Buffer const *, ostream & os, + bool /*fragile*/, bool) const { string doclang = current_view->buffer()->GetLanguage(); @@ -233,11 +241,9 @@ int InsetQuotes::Latex(Buffer const *, ostream & os, bool /*fragile*/, bool) con if (lyxrc.fontenc == "T1") { qstr = latex_quote_t1[times][quoteind]; - } - else if (doclang == "default") { + } else if (doclang == "default") { qstr = latex_quote_ot1[times][quoteind]; - } - else if (language == InsetQuotes::FrenchQ + } else if (language == InsetQuotes::FrenchQ && times == InsetQuotes::DoubleQ && doclang == "frenchb") { if (side == InsetQuotes::LeftQ) diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index 6445d0c4ba..de07412d66 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -27,7 +27,7 @@ struct LaTeXFeatures; Used for the various quotes. German, English, French, all either double or single **/ -class InsetQuotes: public Inset { +class InsetQuotes : public Inset { public: /// enum quote_language { @@ -80,13 +80,15 @@ public: /// void draw(BufferView *, LyXFont const &, int, float &, bool) const; /// - LyXFont ConvertFont(LyXFont font); + LyXFont ConvertFont(LyXFont const & font); + //LyXFont ConvertFont(LyXFont font); /// void Write(Buffer const *, std::ostream &) const; /// void Read(Buffer const *, LyXLex & lex); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetref.h b/src/insets/insetref.h index 653d078d8b..f000853828 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -22,7 +22,7 @@ struct LaTeXFeatures; /** The reference inset */ -class InsetRef: public InsetCommand { +class InsetRef : public InsetCommand { public: /// enum Ref_Flags { @@ -69,7 +69,8 @@ public: /// void gotoLabel(); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index 9d99b0e62d..8a2bbf90e5 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -56,7 +56,8 @@ public: /// Will not be used when lyxf3 void Read(Buffer const *, LyXLex & lex); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 1a42ac18f1..6e6aeac44a 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -5,7 +5,7 @@ * * Copyright 2000 The LyX Team. * - *====================================================== + * ====================================================== */ #include @@ -40,6 +40,7 @@ using std::ostream; using std::ifstream; using std::max; using std::endl; +using std::swap; #define cellstart(p) ((p % 2) == 0) @@ -154,7 +155,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline, float & x, bool cleared) const { Painter & pain = bv->painter(); - int i, j, cell=0; + int i, j, cell = 0; int nx; float cx; @@ -252,8 +253,6 @@ void InsetTabular::DrawCellLines(Painter & pain, int x, int baseline, void InsetTabular::DrawCellSelection(Painter & pain, int x, int baseline, int row, int column, int cell) const { - int tmp; - int cs = tabular->column_of_cell(sel_cell_start); int ce = tabular->column_of_cell(sel_cell_end); if (cs > ce) { @@ -265,11 +264,7 @@ void InsetTabular::DrawCellSelection(Painter & pain, int x, int baseline, int rs = tabular->row_of_cell(sel_cell_start); int re = tabular->row_of_cell(sel_cell_end); - if (rs > re) { - tmp = rs; - rs = re; - re = tmp; - } + if (rs > re) swap(rs, re); if ((column >= cs) && (column <= ce) && (row >= rs) && (row <= re)) { int w = tabular->GetWidthOfColumn(cell); @@ -353,6 +348,7 @@ void InsetTabular::InsetUnlock(BufferView * bv) locked = false; } + void InsetTabular::UpdateLocal(BufferView * bv, UpdateCodes what, bool mark_dirty) { @@ -362,6 +358,7 @@ void InsetTabular::UpdateLocal(BufferView * bv, UpdateCodes what, resetPos(bv); } + bool InsetTabular::LockInsetInInset(BufferView * bv, UpdatableInset * inset) { lyxerr[Debug::INSETS] << "InsetTabular::LockInsetInInset(" <Latex(buf, os, fragile, fp); } @@ -744,6 +744,7 @@ int InsetTabular::Ascii(Buffer const *, ostream &) const return 0; } + int InsetTabular::Linuxdoc(Buffer const *, ostream &) const { return 0; @@ -875,6 +876,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const resetPos(bv); } + int InsetTabular::getCellXPos(int cell) const { int c; @@ -889,6 +891,7 @@ int InsetTabular::getCellXPos(int cell) const ADD_TO_TABULAR_WIDTH); } + void InsetTabular::resetPos(BufferView * bv) const { if (!locked) @@ -1259,6 +1262,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val) } } + bool InsetTabular::ActivateCellInset(BufferView * bv, int x, int y, int button, bool behind) { @@ -1284,6 +1288,7 @@ bool InsetTabular::ActivateCellInset(BufferView * bv, int x, int y, int button, return true; } + bool InsetTabular::InsetHit(BufferView * bv, int x, int ) const { InsetText * inset = tabular->GetCellInset(actcell); @@ -1300,6 +1305,7 @@ bool InsetTabular::InsetHit(BufferView * bv, int x, int ) const } } + // This returns paperWidth() if the cell-width is unlimited or the width // in pixels if we have a pwidth for this cell. int InsetTabular::GetMaxWidthOfCell(Painter &, int cell) const @@ -1311,6 +1317,7 @@ int InsetTabular::GetMaxWidthOfCell(Painter &, int cell) const return VSpace(s).inPixels( 0, 0); } + int InsetTabular::getMaxWidth(Painter & pain, UpdatableInset const * inset) const { @@ -1330,7 +1337,9 @@ int InsetTabular::getMaxWidth(Painter & pain, return w; } -void InsetTabular::recomputeTextInsets(BufferView * bv, const LyXFont & font) const + +void InsetTabular::recomputeTextInsets(BufferView * bv, + LyXFont const & font) const { InsetText * inset; int cell; diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 2bae6750c2..ab4cbb06cc 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -72,7 +72,7 @@ public: SELECTION }; /// - InsetTabular(Buffer *, int rows=1, int columns=1); + InsetTabular(Buffer *, int rows = 1, int columns = 1); /// InsetTabular(InsetTabular const &, Buffer *); /// @@ -92,7 +92,7 @@ public: /// void draw(BufferView *, const LyXFont &, int , float &, bool) const; /// - void update(BufferView *, LyXFont const &, bool =false); + void update(BufferView *, LyXFont const &, bool = false); /// const char * EditMessage() const; /// @@ -106,7 +106,7 @@ public: /// bool LockInsetInInset(BufferView *, UpdatableInset *); /// - bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr=false); + bool UnlockInsetInInset(BufferView *, UpdatableInset *, bool lr = false); /// bool UpdateInsetInInset(BufferView *, Inset *); /// @@ -148,7 +148,7 @@ public: /// void ToggleInsetCursor(BufferView *); /// - void TabularFeatures(BufferView * bv, int feature, string val=""); + void TabularFeatures(BufferView * bv, int feature, string val = string()); /// int GetActCell() { return actcell; } /// @@ -166,10 +166,11 @@ public: LyXTabular * tabular; private: - bool calculate_dimensions_of_cells(BufferView *, LyXFont const &, bool =false) const; + bool calculate_dimensions_of_cells(BufferView *, LyXFont const &, + bool =false) const; /// - void DrawCellLines(Painter &, int x, int baseline, int row, int cell) - const; + void DrawCellLines(Painter &, int x, int baseline, + int row, int cell) const; /// void DrawCellSelection(Painter &, int x, int baseline, int row, int column, int cell) const; @@ -180,8 +181,8 @@ private: /// void setPos(BufferView *, int x, int y) const; /// - UpdatableInset::RESULT moveRight(BufferView *, bool lock=true); - UpdatableInset::RESULT moveLeft(BufferView *, bool lock=true); + UpdatableInset::RESULT moveRight(BufferView *, bool lock = true); + UpdatableInset::RESULT moveLeft(BufferView *, bool lock = true); UpdatableInset::RESULT moveUp(BufferView *); UpdatableInset::RESULT moveDown(BufferView *); bool moveNextCell(BufferView *); @@ -196,7 +197,7 @@ private: bool hasSelection() const {return ((sel_pos_start != sel_pos_end) || (sel_cell_start != sel_cell_end));} /// - bool ActivateCellInset(BufferView *, int x=0, int y=0, int button=0, + bool ActivateCellInset(BufferView *, int x = 0, int y = 0, int button = 0, bool behind = false); /// bool InsetHit(BufferView * bv, int x, int y) const; @@ -208,10 +209,8 @@ private: /// /// Private structures and variables /// - InsetText - * the_locking_inset; - Buffer - * buffer; + InsetText * the_locking_inset; + Buffer * buffer; mutable LyXCursor cursor, old_cursor; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index b4b76b8790..b5dab5d5f1 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -110,7 +110,8 @@ public: /// UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const { return 0; } /// diff --git a/src/insets/insettheorem.C b/src/insets/insettheorem.C index 388d876ccd..4394b3ac23 100644 --- a/src/insets/insettheorem.C +++ b/src/insets/insettheorem.C @@ -18,7 +18,6 @@ #include "gettext.h" #include "lyxfont.h" #include "BufferView.h" -#include "Painter.h" #include "lyxtext.h" #include "support/LOstream.h" #include "debug.h" @@ -92,14 +91,3 @@ bool InsetTheorem::InsertInsetAllowed(Inset * inset) const } return true; } - - -#if 0 -LyXFont InsetTheorem::GetDrawFont(BufferView * bv, - LyXParagraph * p, int pos) const -{ - LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos); - fn.decSize().decSize(); - return fn; -} -#endif diff --git a/src/insets/insettheorem.h b/src/insets/insettheorem.h index e3d3a92cab..46485caa06 100644 --- a/src/insets/insettheorem.h +++ b/src/insets/insettheorem.h @@ -18,7 +18,7 @@ #include "insetcollapsable.h" -/** The footnote inset +/** The theorem inset */ class InsetTheorem : public InsetCollapsable { @@ -39,8 +39,6 @@ public: const char * EditMessage() const; /// bool InsertInsetAllowed(Inset * inset) const; - /// - //LyXFont GetDrawFont(BufferView *, LyXParagraph * par, int pos) const; }; #endif diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index 722e439784..240dc34609 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -16,6 +16,7 @@ using std::ostream; + InsetUrl::InsetUrl(string const & cmd) : fd_form_url(0) { @@ -104,7 +105,8 @@ void InsetUrl::CloseUrlCB(FL_OBJECT * ob, long) } -extern "C" void C_InsetUrl_CloseUrlCB(FL_OBJECT * ob, long data) +extern "C" +void C_InsetUrl_CloseUrlCB(FL_OBJECT * ob, long data) { InsetUrl::CloseUrlCB(ob, data); } diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index a610455b31..3b4f1e8ade 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -72,7 +72,8 @@ public: /// void gotoLabel(); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index ec4d9b1a95..ba66d0f74b 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -31,7 +31,6 @@ class LyXText; struct LaTeXFeatures; - /// Insets class Inset { public: @@ -128,7 +127,7 @@ public: virtual void draw(BufferView *, LyXFont const &, int baseline, float & x, bool cleared) const = 0; /// update the inset representation - virtual void update(BufferView *, LyXFont const &, bool =false) + virtual void update(BufferView *, LyXFont const &, bool = false) {} /// virtual LyXFont ConvertFont(LyXFont font); diff --git a/src/intl.h b/src/intl.h index 57382a5a16..e85036ceab 100644 --- a/src/intl.h +++ b/src/intl.h @@ -56,7 +56,7 @@ public: void InitKeyMapper(bool on); /// Get the Translation Manager - inline TransManager * getTrans(); + TransManager * getTrans(); /// bool keymapon; /// @@ -94,6 +94,7 @@ private: }; +inline TransManager * Intl::getTrans() { return trans; diff --git a/src/layout.h b/src/layout.h index bc9dd8c153..5aa994442e 100644 --- a/src/layout.h +++ b/src/layout.h @@ -507,7 +507,6 @@ private: }; -/// inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2) { diff --git a/src/lyx_gui_misc.h b/src/lyx_gui_misc.h index 8d67900ba5..92525efcea 100644 --- a/src/lyx_gui_misc.h +++ b/src/lyx_gui_misc.h @@ -65,7 +65,7 @@ void WarnReadonly(string const & file); float getScreenDPI(); // inlined functions -/// rings the audio bell. +// rings the audio bell. inline void LyXBell() { // if (audio()) ON/OFF switch yet to be implemented diff --git a/src/lyxcursor.h b/src/lyxcursor.h index 7606a066b0..7c4bed06ba 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -70,7 +70,6 @@ private: }; -/// inline bool operator==(LyXCursor const & a, LyXCursor const & b) { @@ -80,7 +79,6 @@ bool operator==(LyXCursor const & a, LyXCursor const & b) } -/// inline bool operator!=(LyXCursor const & a, LyXCursor const & b) { diff --git a/src/lyxfunc.C b/src/lyxfunc.C index a254da5d13..164a193fb8 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -88,6 +88,7 @@ using std::istringstream; #include "menus.h" #include "bufferview_funcs.h" #include "frontends/Dialogs.h" +#include "FloatList.h" using std::pair; using std::endl; @@ -2066,11 +2067,18 @@ string LyXFunc::Dispatch(int ac, case LFUN_INSET_FLOAT: { - InsetFloat * new_inset = new InsetFloat; - if (owner->view()->insertInset(new_inset)) - new_inset->Edit(owner->view(), 0, 0, 0); - else - delete new_inset; + // check if the float type exist + if (floatList.typeExist(argument)) { + InsetFloat * new_inset = new InsetFloat(argument); + if (owner->view()->insertInset(new_inset)) + new_inset->Edit(owner->view(), 0, 0, 0); + else + delete new_inset; + } else { + lyxerr << "Non-existant float type: " + << argument << endl; + } + } break; diff --git a/src/lyxparagraph.h b/src/lyxparagraph.h index 717b387063..7261cc91e0 100644 --- a/src/lyxparagraph.h +++ b/src/lyxparagraph.h @@ -214,9 +214,11 @@ public: void fitToSize() { text.resize(text.size()); } + /// void setContentsFromPar(LyXParagraph * par) { text = par->text; } + /// void clearContents() { text.clear(); } @@ -406,11 +408,11 @@ public: */ LyXFont getFont(BufferParams const &, size_type pos) const; /// - char GetChar(size_type pos); + value_type GetChar(size_type pos); /// - char GetChar(size_type pos) const; + value_type GetChar(size_type pos) const; /// The position must already exist. - void SetChar(size_type pos, char c) { + void SetChar(size_type pos, value_type c) { text[pos] = c; } @@ -422,9 +424,9 @@ public: LyXFont::FONT_SIZE HighestFontInRange(size_type startpos, size_type endpos) const; /// - void InsertChar(size_type pos, char c); + void InsertChar(size_type pos, value_type c); /// - void InsertChar(size_type pos, char c, LyXFont const &); + void InsertChar(size_type pos, value_type c, LyXFont const &); /// void InsertInset(size_type pos, Inset * inset); /// @@ -533,17 +535,11 @@ private: friend struct matchIT; /// struct matchIT { - /// used by lower_bound + /// used by lower_bound and upper_bound inline int operator()(LyXParagraph::InsetTable const & a, - LyXParagraph::size_type pos) const { - return a.pos < pos; - } - /// used by upper_bound - inline - int operator()(LyXParagraph::size_type pos, - LyXParagraph::InsetTable const & a) const { - return pos < a.pos; + LyXParagraph::InsetTable const & b) const { + return a.pos < b.pos; } }; /** A font entry covers a range of positions. Notice that the @@ -576,17 +572,11 @@ private: friend struct matchFT; /// struct matchFT { - /// used by lower_bound + /// used by lower_bound and upper_bound inline int operator()(LyXParagraph::FontTable const & a, - LyXParagraph::size_type pos) const { - return a.pos < pos; - } - /// used by upper_bound - inline - int operator()(LyXParagraph::size_type pos, - LyXParagraph::FontTable const & a) const { - return pos < a.pos; + LyXParagraph::FontTable const & b) const { + return a.pos < b.pos; } }; @@ -665,7 +655,6 @@ public: } /// inset_iterator InsetIterator(size_type pos); - }; #endif diff --git a/src/mathed/formula.h b/src/mathed/formula.h index b2406d0578..fa9412e33f 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -53,7 +53,8 @@ public: /// void Read(Buffer const *, LyXLex & lex); /// - int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const; + int Latex(Buffer const *, std::ostream &, + bool fragile, bool free_spc) const; /// int Ascii(Buffer const *, std::ostream &) const; /// @@ -113,12 +114,17 @@ public: std::vector getLabelList() const; protected: + /// void UpdateLocal(BufferView * bv); + /// MathParInset * par; + /// static MathedCursor * mathcursor; private: + /// bool disp_flag; + /// string label; }; diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index 747addcd70..a53709a1eb 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -280,8 +280,11 @@ class MathedInset { /// short size; /// Default metrics - static int df_asc, df_des, df_width; - + static int df_asc; + /// + static int df_des; + /// + static int df_width; /// In a near future maybe we use a better fonts renderer than X void drawStr(Painter &, short, int, int, int, byte const *, int); /// @@ -391,20 +394,22 @@ class MathParInset: public MathedInset { /// Paragraph data is stored here LyxArrayBase * array; /// Cursor start position - int xo, yo; + int xo; + /// + int yo; /// short flag; private: /// virtual void setFlag(MathedParFlag f) { flag |= f; } - /// + /// friend class InsetFormula; - /// + /// friend class MathedXIter; - /// + /// friend class MathedCursor; - /// + /// friend LyxArrayBase * mathed_parse(unsigned flags = 0, LyxArrayBase * a = 0, MathParInset ** p = 0); @@ -462,9 +467,9 @@ struct MathedRowSt { bool numbered; /// MathedRowSt * next; - /// + /// friend class MathMatrixInset; - /// + /// friend class MathedXIter; }; @@ -511,12 +516,14 @@ class MathMatrixInset: public MathParInset { /// Use this to manage the extra information independently of paragraph MathedRowSt * getRowSt() const { return row; } - /// + /// void setRowSt(MathedRowSt * r) { row = r; } protected: /// Number of columns & rows - int nc, nr; + int nc; + /// + int nr; /// tab sizes int * ws; /// @@ -546,56 +553,56 @@ int mathed_parser_lineno(); int MathedLookupBOP(short); /************************ Inline functions ********************************/ -/// + inline bool MathIsInset(short x) { return LM_TC_INSET <= x && x <= LM_TC_ACTIVE_INSET; } -/// + inline bool MathIsFont(short x) { return LM_TC_CONST <= x && x <= LM_TC_BSYM; } -/// + inline bool MathIsAlphaFont(short x) { return LM_TC_VAR <= x && x <= LM_TC_TEXTRM; } -/// + inline bool MathIsActive(short x) { return LM_TC_INSET < x && x <= LM_TC_ACTIVE_INSET; } -/// + inline bool MathIsUp(short x) { return x == LM_TC_UP; } -/// + inline bool MathIsDown(short x) { return x == LM_TC_DOWN; } -/// + inline bool MathIsScript(short x) { return x == LM_TC_DOWN || x == LM_TC_UP; } -/// + inline bool MathIsBOPS(short x) { @@ -603,14 +610,14 @@ bool MathIsBOPS(short x) } -/// + inline bool MathIsBinary(short x) { return x == LM_TC_BOP || x == LM_TC_BOPS; } -/// + inline bool MathIsSymbol(short x) { return LM_TC_SYMB <= x && x <= LM_TC_BSYM; diff --git a/src/mathed/math_delim.C b/src/mathed/math_delim.C index fc128941ea..be58ebd343 100644 --- a/src/mathed/math_delim.C +++ b/src/mathed/math_delim.C @@ -298,17 +298,12 @@ void Matriz::transf(float xp, float yp, float & x, float & y) struct math_deco_compare { - /// for use by sort + /// for use by sort and lower_bound inline int operator()(math_deco_struct const & a, math_deco_struct const & b) const { return a.code < b.code; } - /// for use by lower_bound - inline - int operator()(math_deco_struct const & a, int b) const { - return a.code < b; - } }; @@ -357,10 +352,12 @@ math_deco_struct const & search_deco(int code) static math_deco_struct const * search_deco(int code) { + math_deco_struct search_elem = { code, 0, 0 }; + math_deco_struct * res = lower_bound(math_deco_table, math_deco_table + math_deco_table_size, - code, math_deco_compare()); + search_elem, math_deco_compare()); if (res != math_deco_table + math_deco_table_size && res->code == code) return res; diff --git a/src/mathed/math_panel.h b/src/mathed/math_panel.h index b6ce86ca5a..def59e64bd 100644 --- a/src/mathed/math_panel.h +++ b/src/mathed/math_panel.h @@ -32,7 +32,7 @@ enum { MM_APPLY, MM_OK }; -/// + typedef FL_OBJECT * FL_OBJECTP; /// Class to manage bitmap menu bars @@ -44,13 +44,13 @@ class BitmapMenu { protected: /// BitmapMenu * next, * prev; + /// Number of bitmaps + int nb; + /// Current bitmap + int i; + /// Border width + int ww; /// - int nb; // Number of bitmaps - /// - int i; // Current bitmap - /// - int ww; // Border width - /// int x, y, w, h; /// FL_FORM * form; diff --git a/src/mathed/math_parser.h b/src/mathed/math_parser.h index 84410087da..474a484ebc 100644 --- a/src/mathed/math_parser.h +++ b/src/mathed/math_parser.h @@ -25,12 +25,12 @@ #include "symbol_def.h" -/// + #define LM_TK_OPEN '{' -/// + #define LM_TK_CLOSE '}' -/// + enum MathTokenEnum { LM_TK_BOP = 256, @@ -66,32 +66,32 @@ enum MathTokenEnum LM_TK_STACK }; -/// + struct latexkeys { char const * name; short token; int id; }; -/// + latexkeys * in_word_set (register char const * str, register int len); -/// + latexkeys * lm_get_key(int index); -/// + latexkeys * lm_get_key_by_id(int id, short tc = LM_TK_SYM); -/// + typedef union{ - /// + unsigned char c; - /// + char * s; - /// + int i; - /// + latexkeys * l; } YYSTYPE; diff --git a/src/mathed/math_utils.C b/src/mathed/math_utils.C index 0d9c61c1e4..3852d6fe5f 100644 --- a/src/mathed/math_utils.C +++ b/src/mathed/math_utils.C @@ -64,17 +64,12 @@ binary_op_pair binary_op_table[] = { struct compara { - // used by sort + // used by sort and lower_bound inline int operator()(binary_op_pair const & a, binary_op_pair const & b) const { return a.id < b.id; } - // used by lower_bound - inline - int operator()(binary_op_pair const & a, short int id) const { - return a.id < id; - } }; @@ -88,10 +83,12 @@ int MathedLookupBOP(short id) sort(binary_op_table, binary_op_table + bopCount, compara()); issorted = true; } + + binary_op_pair search_elem = { id, 0 }; binary_op_pair * res = lower_bound(binary_op_table, binary_op_table + bopCount, - id, compara()); + search_elem, compara()); if (res != binary_op_table + bopCount && res->id == id) return res->isrel; else diff --git a/src/paragraph.C b/src/paragraph.C index de63c27ae8..ad1812dc79 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -130,11 +130,6 @@ void LyXParagraph::writeFile(Buffer const * buf, ostream & os, BufferParams const & params, char footflag, char dth) const { - LyXFont font1, font2; - int column = 0; - int h = 0; - char c = 0; - if (footnoteflag != LyXParagraph::NO_FOOTNOTE || !previous || previous->footnoteflag == LyXParagraph::NO_FOOTNOTE) { @@ -209,6 +204,7 @@ void LyXParagraph::writeFile(Buffer const * buf, ostream & os, // Alignment? if (align != LYX_ALIGN_LAYOUT) { + int h = 0; switch (align) { case LYX_ALIGN_LEFT: h = 1; break; case LYX_ALIGN_RIGHT: h = 2; break; @@ -254,9 +250,9 @@ void LyXParagraph::writeFile(Buffer const * buf, ostream & os, if (bibkey) bibkey->Write(buf, os); - font1 = LyXFont(LyXFont::ALL_INHERIT,params.language_info); + LyXFont font1(LyXFont::ALL_INHERIT,params.language_info); - column = 0; + int column = 0; for (size_type i = 0; i < size(); ++i) { if (!i) { os << "\n"; @@ -264,14 +260,14 @@ void LyXParagraph::writeFile(Buffer const * buf, ostream & os, } // Write font changes - font2 = GetFontSettings(params, i); + LyXFont font2 = GetFontSettings(params, i); if (font2 != font1) { font2.lyxWriteChanges(font1, os); column = 0; font1 = font2; } - c = GetChar(i); + value_type c = GetChar(i); switch (c) { case META_INSET: { @@ -443,9 +439,11 @@ void LyXParagraph::CutIntoMinibuffer(BufferParams const & bparams, // the inset, not just a clone. Otherwise // the inset would be deleted when calling Erase(pos) // find the entry - InsetList::iterator it = lower_bound(insetlist.begin(), - insetlist.end(), - pos, matchIT()); + InsetTable search_elem(pos, 0); + InsetList::iterator it = + lower_bound(insetlist.begin(), + insetlist.end(), + search_elem, matchIT()); if (it != insetlist.end() && (*it).pos == pos) (*it).inset = 0; } else { @@ -552,9 +550,11 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos) // if it is an inset, delete the inset entry if (text[pos] == LyXParagraph::META_INSET) { // find the entry - InsetList::iterator it = lower_bound(insetlist.begin(), - insetlist.end(), - pos, matchIT()); + InsetTable search_inset(pos, 0); + InsetList::iterator it = + lower_bound(insetlist.begin(), + insetlist.end(), + search_inset, matchIT()); if (it != insetlist.end() && (*it).pos == pos) { delete (*it).inset; insetlist.erase(it); @@ -563,9 +563,12 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos) text.erase(text.begin() + pos); // Erase entries in the tables. - FontList::iterator it = lower_bound(fontlist.begin(), - fontlist.end(), - pos, matchFT()); + FontTable search_font(pos, LyXFont()); + + FontList::iterator it = + lower_bound(fontlist.begin(), + fontlist.end(), + search_font, matchFT()); if (it != fontlist.end() && (*it).pos == pos && (pos == 0 || (it != fontlist.begin() && (*(it-1)).pos == pos - 1))) { @@ -588,9 +591,11 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos) --(*it).pos; // Update the inset table. - for (InsetList::iterator it = upper_bound(insetlist.begin(), - insetlist.end(), - pos, matchIT()); + InsetTable search_inset(pos, 0); + for (InsetList::iterator it = + upper_bound(insetlist.begin(), + insetlist.end(), + search_inset, matchIT()); it != insetlist.end(); ++it) --(*it).pos; } else { @@ -600,7 +605,8 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos) } -void LyXParagraph::InsertChar(LyXParagraph::size_type pos, char c) +void LyXParagraph::InsertChar(LyXParagraph::size_type pos, + LyXParagraph::value_type c) { LyXFont f(LyXFont::ALL_INHERIT); InsertChar(pos, c, f); @@ -608,7 +614,8 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos, char c) void LyXParagraph::InsertChar(LyXParagraph::size_type pos, - char c, LyXFont const & font) + LyXParagraph::value_type c, + LyXFont const & font) { // > because last is the next unused position, and you can // use it if you want @@ -626,16 +633,18 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos, } text.insert(text.begin() + pos, c); // Update the font table. + FontTable search_font(pos, LyXFont()); for (FontList::iterator it = lower_bound(fontlist.begin(), fontlist.end(), - pos, matchFT()); + search_font, matchFT()); it != fontlist.end(); ++it) ++(*it).pos; // Update the inset table. + InsetTable search_inset(pos, 0); for (InsetList::iterator it = lower_bound(insetlist.begin(), insetlist.end(), - pos, matchIT()); + search_inset, matchIT()); it != insetlist.end(); ++it) ++(*it).pos; @@ -676,9 +685,10 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos, Assert(text[pos] == META_INSET); // Add a new entry in the inset table. + InsetTable search_inset(pos, 0); InsetList::iterator it = lower_bound(insetlist.begin(), insetlist.end(), - pos, matchIT()); + search_inset, matchIT()); if (it != insetlist.end() && (*it).pos == pos) lyxerr << "ERROR (LyXParagraph::InsertInset): " "there is an inset in position: " << pos << endl; @@ -716,9 +726,10 @@ Inset * LyXParagraph::GetInset(LyXParagraph::size_type pos) return 0; } // Find the inset. + InsetTable search_inset(pos, 0); InsetList::iterator it = lower_bound(insetlist.begin(), insetlist.end(), - pos, matchIT()); + search_inset, matchIT()); if (it != insetlist.end() && (*it).pos == pos) return (*it).inset; @@ -752,9 +763,10 @@ Inset const * LyXParagraph::GetInset(LyXParagraph::size_type pos) const return 0; } // Find the inset. + InsetTable search_inset(pos, 0); InsetList::const_iterator cit = lower_bound(insetlist.begin(), insetlist.end(), - pos, matchIT()); + search_inset, matchIT()); if (cit != insetlist.end() && (*cit).pos == pos) return (*cit).inset; @@ -776,9 +788,10 @@ LyXFont LyXParagraph::GetFontSettings(BufferParams const & bparams, LyXParagraph::size_type pos) const { if (pos < size()) { + FontTable search_font(pos, LyXFont()); FontList::const_iterator cit = lower_bound(fontlist.begin(), fontlist.end(), - pos, matchFT()); + search_font, matchFT()); if (cit != fontlist.end()) return (*cit).font; } @@ -889,16 +902,19 @@ LyXParagraph::HighestFontInRange(LyXParagraph::size_type startpos, LyXFont::FONT_SIZE maxsize = LyXFont::SIZE_TINY; if (fontlist.empty()) return maxsize; - + + FontTable end_search(endpos, LyXFont()); FontList::const_iterator end_it = lower_bound(fontlist.begin(), fontlist.end(), - endpos, matchFT()); + end_search, matchFT()); if (end_it != fontlist.end()) ++end_it; - for (FontList::const_iterator cit = lower_bound(fontlist.begin(), - fontlist.end(), - startpos, matchFT()); + FontTable start_search(startpos, LyXFont()); + for (FontList::const_iterator cit = + lower_bound(fontlist.begin(), + fontlist.end(), + start_search, matchFT()); cit != end_it; ++cit) { LyXFont::FONT_SIZE size = (*cit).font.size(); if (size > maxsize && size <= LyXFont::SIZE_HUGER) @@ -908,7 +924,8 @@ LyXParagraph::HighestFontInRange(LyXParagraph::size_type startpos, } -char LyXParagraph::GetChar(LyXParagraph::size_type pos) +LyXParagraph::value_type +LyXParagraph::GetChar(LyXParagraph::size_type pos) { Assert(pos >= 0); @@ -966,7 +983,8 @@ char LyXParagraph::GetChar(LyXParagraph::size_type pos) } -char LyXParagraph::GetChar(LyXParagraph::size_type pos) const +LyXParagraph::value_type +LyXParagraph::GetChar(LyXParagraph::size_type pos) const { Assert(pos >= 0); @@ -1149,9 +1167,10 @@ void LyXParagraph::SetFont(LyXParagraph::size_type pos, // in a new kernel. (Asger) // Next search font table + FontTable search_font(pos, LyXFont()); FontList::iterator it = lower_bound(fontlist.begin(), fontlist.end(), - pos, matchFT()); + search_font, matchFT()); unsigned int i = it - fontlist.begin(); bool notfound = it == fontlist.end(); @@ -1998,11 +2017,13 @@ int LyXParagraph::AutoDeleteInsets() } -LyXParagraph::inset_iterator LyXParagraph::InsetIterator(LyXParagraph::size_type pos) +LyXParagraph::inset_iterator +LyXParagraph::InsetIterator(LyXParagraph::size_type pos) { + InsetTable search_inset(pos, 0); InsetList::iterator it = lower_bound(insetlist.begin(), insetlist.end(), - pos, matchIT()); + search_inset, matchIT()); return inset_iterator(it); } @@ -2402,7 +2423,7 @@ bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf, } } - int c = GetChar(i); + value_type c = GetChar(i); // Fully instantiated font LyXFont font = getFont(bparams, i); @@ -2566,7 +2587,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(Buffer const * buf, bool first_in_cell = true; for (size_type i = 0; i < size(); ++i) { - char c = GetChar(i); + value_type c = GetChar(i); if (table->IsContRow(current_cell_number + 1)) { if (c == LyXParagraph::META_NEWLINE) ++current_cell_number; @@ -2603,7 +2624,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(Buffer const * buf, open_font = false; } // Blanks are printed before start of fontswitch - if (c == ' '){ + if (c == ' ') { SimpleTeXBlanks(os, texrow, i, column, font, style); } // Do we need to change font? @@ -2711,11 +2732,11 @@ bool LyXParagraph::TeXContTableRows(Buffer const * buf, size_type lastpos = i; int cell = table->CellHasContRow(current_cell_number); ++current_cell_number; - char c; + value_type c; while(cell >= 0) { // first find the right position i = lastpos; - for (; (i < size()) && (current_cell_number inline string tostr(T const & t) diff --git a/src/support/lyxmanip.h b/src/support/lyxmanip.h index bc106bed79..52dc69692a 100644 --- a/src/support/lyxmanip.h +++ b/src/support/lyxmanip.h @@ -9,7 +9,7 @@ struct NewLineAndDepth_ { int depth_; }; -/// +// inline NewLineAndDepth_ newlineAndDepth(int n) { @@ -18,7 +18,7 @@ NewLineAndDepth_ newlineAndDepth(int n) return nlad_; } -/// +// inline std::ostream & operator<<(std::ostream & os, NewLineAndDepth_ const & nlad_) { diff --git a/src/support/lyxstring.h b/src/support/lyxstring.h index 8ed99ec079..c594ed99b5 100644 --- a/src/support/lyxstring.h +++ b/src/support/lyxstring.h @@ -33,7 +33,7 @@ #include // for size_t -/** A string class for LyX +/* A string class for LyX This is a permanent String class. It is modeled closely after the C++ STL string class. In comparison with STL string lyxstring lack support for @@ -90,8 +90,7 @@ When you want to copy an lyxstring, just do */ class lyxstring { public: - /**@name Typedefs */ - //@{ + /* Typedefs */ /// typedef char value_type; @@ -124,7 +123,6 @@ public: const_reference> const_reverse_iterator; #endif - //@} /// iterator begin(); @@ -144,11 +142,10 @@ public: /// const_reverse_iterator rend() const; #endif - /**@name Constructors and Deconstructors. lyxstring has the same + /* Constructors and Deconstructors. lyxstring has the same constructors as STL, except the one using iterators, one other difference is that lyxstring, do not allow the optional allocator parameter. */ - //@{ /// "all characters" marker static const size_type npos; @@ -163,7 +160,6 @@ public: lyxstring(value_type const *, size_type n); /// #lyxstring x("abc")# -// explicit lyxstring(value_type const *); /// lyxstring(5, 'n') -> "nnnnn" @@ -185,12 +181,6 @@ public: /// ~lyxstring(); - //@} - - - /**@name Size and Capacity */ - //@{ - /// number of characters size_type size() const; @@ -215,11 +205,6 @@ public: /// void reserve(size_type res_arg = 0); - //@} - - /**@name Assignment */ - //@{ - /// lyxstring & operator=(lyxstring const &); @@ -258,11 +243,7 @@ public: } } #endif - //@} - /**@name Element Access. Since lyxstring does not use exceptions, - an abort is called on out-of-range access to at(). */ - /// unchecked access const_reference operator[](size_type) const; @@ -275,11 +256,6 @@ public: /// checked access reference at(size_type); - //@} - - /**@name Insert */ - //@{ - // add characters after (*this)[length()-1]: /// @@ -365,11 +341,6 @@ public: } #endif - //@} - - /**@name Find */ - //@{ - /// size_type find(lyxstring const &, size_type i = 0) const; @@ -450,12 +421,6 @@ public: /// size_type find_last_not_of(value_type c, size_type i = npos) const; - //*} - - - /**@name Replace */ - //@{ - // replace [(*this)[i], (*this)[i+n]] with other characters: /// @@ -510,30 +475,19 @@ public: /// iterator erase(iterator first, iterator last); - //@} - - - /**@name Conversion to C-style Strings */ - //@{ - /// value_type const * c_str() const; - /** Note that this is STL compilant, so you can not assume + /* Note that this is STL compilant, so you can not assume that the returned array has a trailing '\0'. */ value_type const * data() const; - /** This one returns a verbatim copy. Not the trailing '\0' + /* This one returns a verbatim copy. Not the trailing '\0' The caller must provide a buffer with engough room. */ size_type copy(value_type * buf, size_type len, size_type pos = 0) const; - //@} - - - /**@name Comparisons. Combined > and == */ - //@{ /// int compare(lyxstring const & str) const; @@ -552,18 +506,10 @@ public: int compare(size_type pos, size_type n, value_type const * p, size_type n2 = npos) const; - //@} - - - /**@name Substrings */ - //@{ - /// lyxstring substr(size_type i = 0, size_type n = npos) const; - //@} - private: // These three operators can be used to discover erronous use of // ints and strings. However a conforming C++ compiler will flag @@ -590,7 +536,7 @@ private: /// A string is a pointer to it's representation Srep * rep; - /** Note: The empty_rep is a local static in each function that + /* Note: The empty_rep is a local static in each function that benefits from one. There is no "global" empty srep but lyxstring doesn't need one (no code actually relies upon a single empty srep). diff --git a/src/support/textutils.h b/src/support/textutils.h index 0427659fcf..87369e7933 100644 --- a/src/support/textutils.h +++ b/src/support/textutils.h @@ -14,35 +14,35 @@ #include -/// +// inline bool IsNewlineChar(char c) { return (c == LyXParagraph::META_NEWLINE); } -/// +// inline bool IsSeparatorChar(char c) { return (c == ' '); } -/// +// inline bool IsHfillChar(char c) { return (c == LyXParagraph::META_HFILL); } -/// +// inline bool IsInsetChar(char c) { return (c == LyXParagraph::META_INSET); } -/// +// inline bool IsFloatChar(char c) { return (c == LyXParagraph::META_FOOTNOTE @@ -55,14 +55,14 @@ bool IsFloatChar(char c) { } -/// +// inline bool IsLineSeparatorChar(char c) { return (c == ' '); } -/// +// inline bool IsKommaChar(char c) { return (c == ',' @@ -93,7 +93,7 @@ bool IsKommaChar(char c) { } -/// +// inline bool IsLetterChar(unsigned char c) { return ((c >= 'A' && c <= 'Z') @@ -102,21 +102,21 @@ bool IsLetterChar(unsigned char c) { } -/// +// inline bool IsPrintable(unsigned char c) { return (c >= ' '); } -/// +// inline bool IsPrintableNonspace(unsigned char c) { return (c > ' '); } -/// Word is not IsSeparator or IsKomma or IsHfill or IsFloat or IsInset. +// Word is not IsSeparator or IsKomma or IsHfill or IsFloat or IsInset. inline bool IsWordChar(unsigned char c) { return !( IsSeparatorChar( c ) @@ -127,7 +127,7 @@ bool IsWordChar(unsigned char c) { } -/// +// inline bool IsLetterCharOrDigit(char ch) { diff --git a/src/text.C b/src/text.C index 1dff79e464..ee8bce819a 100644 --- a/src/text.C +++ b/src/text.C @@ -4776,11 +4776,13 @@ int LyXText::GetColumnNearX(BufferView * bview, Row * row, int & x, vc = last + 1; boundary = false; +#if 0 // currently unused bool lastrow = (!row->next() || row->next()->par() != row->par()); bool rtl = (lastrow) ? row->par()->isRightToLeftPar(bview->buffer()->params) : false; - +#endif + if (row->pos() > last) // Row is empty? c = row->pos(); #warning This is wrong, please have a look Dekel (Jug) diff --git a/src/vspace.h b/src/vspace.h index 92ae532319..e16f6fe793 100644 --- a/src/vspace.h +++ b/src/vspace.h @@ -159,7 +159,7 @@ protected: LyXLength::UNIT plus_uni, minus_uni; }; -/// + inline bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2) { -- 2.39.5