From 9ece8ba258d5a965b97dfc7677b6881138a9fda9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Thu, 18 May 2000 13:26:04 +0000 Subject: [PATCH] whitespace and pass by const reference and use Inset::Code instead of char as type git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@739 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/buffer.C | 10 +++++----- src/insets/inset.C | 5 +++++ src/insets/insetfoot.C | 7 ++++--- src/paragraph.C | 5 +++-- src/tabular.C | 11 +++++------ src/tabular.h | 6 +++--- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/buffer.C b/src/buffer.C index a252e64c19..7d167f3f35 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -2280,7 +2280,7 @@ void Buffer::makeLinuxDocFile(string const & fname, int column) // treat as a special case for compatibility with old code if (par->GetChar(0) == LyXParagraph::META_INSET) { Inset * inset = par->GetInset(0); - char lyx_code = inset->LyxCode(); + Inset::Code lyx_code = inset->LyxCode(); if (lyx_code == Inset::TOC_CODE){ string temp = "toc"; sgmlOpenTag(ofs, depth, temp); @@ -2966,7 +2966,7 @@ void Buffer::makeDocBookFile(string const & fname, int column) // more WYSIWYM handling. if (par->GetChar(0) == LyXParagraph::META_INSET) { Inset * inset = par->GetInset(0); - char lyx_code = inset->LyxCode(); + Inset::Code lyx_code = inset->LyxCode(); if (lyx_code == Inset::LABEL_CODE){ command_name += " id=\""; command_name += (static_cast(inset))->getContents(); @@ -2975,7 +2975,7 @@ void Buffer::makeDocBookFile(string const & fname, int column) } } - sgmlOpenTag(ofs, depth+command_depth, command_name); + sgmlOpenTag(ofs, depth + command_depth, command_name); item_name = "title"; sgmlOpenTag(ofs, depth + 1 + command_depth, item_name); break; @@ -3824,11 +3824,11 @@ string Buffer::getBibkeyList(char delim) // Search for Bibtex or Include inset while ((inset = par->ReturnNextInsetPointer(pos))) { - if (inset-> LyxCode() == Inset::BIBTEX_CODE) { + if (inset->LyxCode() == Inset::BIBTEX_CODE) { if (!bibkeys.empty()) bibkeys += delim; bibkeys += static_cast(inset)->getKeys(delim); - } else if (inset-> LyxCode() == Inset::INCLUDE_CODE) { + } else if (inset->LyxCode() == Inset::INCLUDE_CODE) { string bk = static_cast(inset)->getKeys(delim); if (!bk.empty()) { if (!bibkeys.empty()) diff --git a/src/insets/inset.C b/src/insets/inset.C index 0cb824c21f..bf489a6475 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -41,6 +41,7 @@ Inset::EDITABLE Inset::Editable() const return NOT_EDITABLE; } + bool Inset::IsTextInset() const { return ((LyxCode() == TEXT_CODE) || @@ -49,6 +50,7 @@ bool Inset::IsTextInset() const (LyxCode() == MARGIN_CODE)); } + void Inset::Validate(LaTeXFeatures &) const { } @@ -122,10 +124,12 @@ void UpdatableInset::ToggleInsetCursor(BufferView *) { } + void UpdatableInset::ShowInsetCursor(BufferView *) { } + void UpdatableInset::HideInsetCursor(BufferView *) { } @@ -179,6 +183,7 @@ UpdatableInset::LocalDispatch(BufferView *, int, string const &) return UNDISPATCHED; } + int UpdatableInset::getMaxWidth(Painter & pain, UpdatableInset const *) const { if (owner()) diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index 6900078dc4..897b289888 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -24,7 +24,7 @@ using std::ostream; using std::endl; InsetFoot::InsetFoot(Buffer * bf) - : InsetCollapsable(bf) + : InsetCollapsable(bf) { setLabel(_("foot")); LyXFont font(LyXFont::ALL_SANE); @@ -72,6 +72,7 @@ bool InsetFoot::InsertInset(BufferView * bv, Inset * inset) return InsetText::InsertInset(bv, inset); } + bool InsetFoot::InsertInsetAllowed(Inset * inset) const { if ((inset->LyxCode() == Inset::FOOT_CODE) || @@ -81,10 +82,10 @@ bool InsetFoot::InsertInsetAllowed(Inset * inset) const return true; } + LyXFont InsetFoot::GetDrawFont(LyXParagraph * p, int pos) const { LyXFont fn = InsetCollapsable::GetDrawFont(p, pos); - fn.decSize(); - fn.decSize(); + fn.decSize().decSize(); return fn; } diff --git a/src/paragraph.C b/src/paragraph.C index 3cc070c241..6cf88c4815 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -662,15 +662,16 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos, } -bool LyXParagraph::InsertInsetAllowed(Inset *inset) +bool LyXParagraph::InsertInsetAllowed(Inset * inset) { if (inset_owner) { - printf("CODE:%d\n",inset->LyxCode()); + lyxerr << "CODE: << " << inset->LyxCode() << endl; return inset_owner->InsertInsetAllowed(inset); } return true; } + Inset * LyXParagraph::GetInset(LyXParagraph::size_type pos) { if (pos >= size()) { diff --git a/src/tabular.C b/src/tabular.C index 2649941c18..1499877bf3 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -725,7 +725,7 @@ bool LyXTabular::SetAlignment(int cell, char align) } -bool LyXTabular::SetPWidth(int cell, string width) +bool LyXTabular::SetPWidth(int cell, string const & width) { bool flag = !width.empty(); @@ -748,7 +748,7 @@ bool LyXTabular::SetPWidth(int cell, string width) } -bool LyXTabular::SetAlignSpecial(int cell, string special, int what) +bool LyXTabular::SetAlignSpecial(int cell, string const & special, int what) { if (what == SET_SPECIAL_MULTI) cellinfo_of_cell(cell)->align_special = special; @@ -1199,7 +1199,7 @@ void LyXTabular::Read(LyXLex & lex) } -void LyXTabular::OldFormatRead(LyXLex & lex, string fl) +void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl) { int version; int i, j; @@ -1217,14 +1217,13 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string fl) int h = 0; istream & is = lex.getStream(); - string s; - s = fl; + string s(fl); if (s.length() > 8) version = atoi(s.c_str() + 8); else version = 1; - int * cont_row_info; + //int * cont_row_info; // unused if (version < 5) { lyxerr << "Tabular format < 5 is not supported anymore\n" diff --git a/src/tabular.h b/src/tabular.h index a3de031131..01cbc001e1 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -134,9 +134,9 @@ public: /// Returns true if a complete update is necessary, otherwise false bool SetAlignment(int cell, char align); /// - bool SetPWidth(int cell, string width); + bool SetPWidth(int cell, string const & width); /// - bool SetAlignSpecial(int cell, string special, int what); + bool SetAlignSpecial(int cell, string const & special, int what); /// char GetAlignment(int cell) const; // add approp. signedness /// @@ -176,7 +176,7 @@ public: /// void Read(LyXLex &); /// - void OldFormatRead(LyXLex &, string); + void OldFormatRead(LyXLex &, string const &); /// /// helper function for Latex returns number of newlines /// -- 2.39.2