Rename InsetOptArg as InsetArgument.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34596 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-06-04 22:44:58 +00:00
parent f9377c8bcc
commit 8480d1dd9a
15 changed files with 44 additions and 44 deletions

View File

@ -152,6 +152,7 @@ SOURCES += \
../../src/insets/ExternalSupport.cpp \ ../../src/insets/ExternalSupport.cpp \
../../src/insets/ExternalTemplate.cpp \ ../../src/insets/ExternalTemplate.cpp \
../../src/insets/ExternalTransforms.cpp \ ../../src/insets/ExternalTransforms.cpp \
../../src/insets/InsetArgument.cpp \
../../src/insets/InsetBibitem.cpp \ ../../src/insets/InsetBibitem.cpp \
../../src/insets/InsetBibtex.cpp \ ../../src/insets/InsetBibtex.cpp \
../../src/insets/InsetBox.cpp \ ../../src/insets/InsetBox.cpp \
@ -185,7 +186,6 @@ SOURCES += \
../../src/insets/InsetNewpage.cpp \ ../../src/insets/InsetNewpage.cpp \
../../src/insets/InsetNomencl.cpp \ ../../src/insets/InsetNomencl.cpp \
../../src/insets/InsetNote.cpp \ ../../src/insets/InsetNote.cpp \
../../src/insets/InsetOptArg.cpp \
../../src/insets/InsetPhantom.cpp \ ../../src/insets/InsetPhantom.cpp \
../../src/insets/InsetQuotes.cpp \ ../../src/insets/InsetQuotes.cpp \
../../src/insets/InsetRef.cpp \ ../../src/insets/InsetRef.cpp \
@ -494,6 +494,7 @@ HEADERS += \
../../src/insets/ExternalTemplate.h \ ../../src/insets/ExternalTemplate.h \
../../src/insets/ExternalTransforms.h \ ../../src/insets/ExternalTransforms.h \
../../src/insets/Inset.h \ ../../src/insets/Inset.h \
../../src/insets/InsetArgument.h \
../../src/insets/InsetBibitem.h \ ../../src/insets/InsetBibitem.h \
../../src/insets/InsetBibtex.h \ ../../src/insets/InsetBibtex.h \
../../src/insets/InsetBox.h \ ../../src/insets/InsetBox.h \
@ -527,7 +528,6 @@ HEADERS += \
../../src/insets/InsetNewpage.h \ ../../src/insets/InsetNewpage.h \
../../src/insets/InsetNomencl.h \ ../../src/insets/InsetNomencl.h \
../../src/insets/InsetNote.h \ ../../src/insets/InsetNote.h \
../../src/insets/InsetOptArg.h \
../../src/insets/InsetQuotes.h \ ../../src/insets/InsetQuotes.h \
../../src/insets/InsetPhantom.h \ ../../src/insets/InsetPhantom.h \
../../src/insets/InsetRef.h \ ../../src/insets/InsetRef.h \

View File

@ -1003,6 +1003,7 @@ src_insets_header_files = Split('''
ExternalTemplate.h ExternalTemplate.h
ExternalTransforms.h ExternalTransforms.h
Inset.h Inset.h
InsetArgument.h
InsetBibitem.h InsetBibitem.h
InsetBibtex.h InsetBibtex.h
InsetBox.h InsetBox.h
@ -1036,7 +1037,6 @@ src_insets_header_files = Split('''
InsetNewpage.h InsetNewpage.h
InsetNomencl.h InsetNomencl.h
InsetNote.h InsetNote.h
InsetOptArg.h
InsetPhantom.h InsetPhantom.h
InsetPreview.h InsetPreview.h
InsetQuotes.h InsetQuotes.h
@ -1060,6 +1060,7 @@ src_insets_files = Split('''
ExternalTemplate.cpp ExternalTemplate.cpp
ExternalTransforms.cpp ExternalTransforms.cpp
Inset.cpp Inset.cpp
InsetArgument.cpp
InsetBibitem.cpp InsetBibitem.cpp
InsetBibtex.cpp InsetBibtex.cpp
InsetBox.cpp InsetBox.cpp
@ -1092,7 +1093,6 @@ src_insets_files = Split('''
InsetNewpage.cpp InsetNewpage.cpp
InsetNomencl.cpp InsetNomencl.cpp
InsetNote.cpp InsetNote.cpp
InsetOptArg.cpp
InsetPhantom.cpp InsetPhantom.cpp
InsetPreview.cpp InsetPreview.cpp
InsetQuotes.cpp InsetQuotes.cpp

View File

@ -514,6 +514,7 @@ SOURCEFILESINSETS = \
insets/RenderGraphic.cpp \ insets/RenderGraphic.cpp \
insets/RenderPreview.cpp \ insets/RenderPreview.cpp \
insets/Inset.cpp \ insets/Inset.cpp \
insets/InsetArgument.cpp \
insets/InsetBibitem.cpp \ insets/InsetBibitem.cpp \
insets/InsetBibtex.cpp \ insets/InsetBibtex.cpp \
insets/InsetBox.cpp \ insets/InsetBox.cpp \
@ -546,7 +547,6 @@ SOURCEFILESINSETS = \
insets/InsetNewpage.cpp \ insets/InsetNewpage.cpp \
insets/InsetNomencl.cpp \ insets/InsetNomencl.cpp \
insets/InsetNote.cpp \ insets/InsetNote.cpp \
insets/InsetOptArg.cpp \
insets/InsetPhantom.cpp \ insets/InsetPhantom.cpp \
insets/InsetPreview.cpp \ insets/InsetPreview.cpp \
insets/InsetQuotes.cpp \ insets/InsetQuotes.cpp \
@ -568,6 +568,7 @@ HEADERFILESINSETS = \
insets/RenderGraphic.h \ insets/RenderGraphic.h \
insets/RenderPreview.h \ insets/RenderPreview.h \
insets/Inset.h \ insets/Inset.h \
insets/InsetArgument.h \
insets/InsetBibitem.h \ insets/InsetBibitem.h \
insets/InsetBibtex.h \ insets/InsetBibtex.h \
insets/InsetBox.h \ insets/InsetBox.h \
@ -602,7 +603,6 @@ HEADERFILESINSETS = \
insets/InsetNewpage.h \ insets/InsetNewpage.h \
insets/InsetNomencl.h \ insets/InsetNomencl.h \
insets/InsetNote.h \ insets/InsetNote.h \
insets/InsetOptArg.h \
insets/InsetPhantom.h \ insets/InsetPhantom.h \
insets/InsetQuotes.h \ insets/InsetQuotes.h \
insets/InsetRef.h \ insets/InsetRef.h \

View File

@ -39,7 +39,7 @@
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
#include "insets/InsetBibitem.h" #include "insets/InsetBibitem.h"
#include "insets/InsetOptArg.h" #include "insets/InsetArgument.h"
#include "support/lassert.h" #include "support/lassert.h"
#include "support/debug.h" #include "support/debug.h"

View File

@ -56,7 +56,7 @@
#include "insets/InsetLine.h" #include "insets/InsetLine.h"
#include "insets/InsetNewline.h" #include "insets/InsetNewline.h"
#include "insets/InsetNewpage.h" #include "insets/InsetNewpage.h"
#include "insets/InsetOptArg.h" #include "insets/InsetArgument.h"
#include "insets/InsetSpace.h" #include "insets/InsetSpace.h"
#include "insets/InsetSpecialChar.h" #include "insets/InsetSpecialChar.h"
#include "insets/InsetTabular.h" #include "insets/InsetTabular.h"

View File

@ -2342,10 +2342,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
code = INFO_CODE; code = INFO_CODE;
break; break;
case LFUN_OPTIONAL_INSERT: { case LFUN_OPTIONAL_INSERT: {
code = OPTARG_CODE; code = ARG_CODE;
Layout const & lay = cur.paragraph().layout(); Layout const & lay = cur.paragraph().layout();
int const numargs = lay.reqargs + lay.optargs; int const numargs = lay.reqargs + lay.optargs;
enable = cur.paragraph().insetList().count(OPTARG_CODE) < numargs; enable = cur.paragraph().insetList().count(ARG_CODE) < numargs;
break; break;
} }
case LFUN_INDEX_INSERT: case LFUN_INDEX_INSERT:

View File

@ -25,7 +25,7 @@
#include "ParIterator.h" #include "ParIterator.h"
#include "TextClass.h" #include "TextClass.h"
#include "insets/InsetOptArg.h" #include "insets/InsetArgument.h"
#include "support/convert.h" #include "support/convert.h"
#include "support/debug.h" #include "support/debug.h"
@ -142,11 +142,11 @@ bool TocBackend::updateItem(DocIterator const & dit)
InsetList::const_iterator end = par.insetList().end(); InsetList::const_iterator end = par.insetList().end();
for (; it != end; ++it) { for (; it != end; ++it) {
Inset & inset = *it->inset; Inset & inset = *it->inset;
if (inset.lyxCode() == OPTARG_CODE) { if (inset.lyxCode() == ARG_CODE) {
if (!tocstring.empty()) if (!tocstring.empty())
break; break;
Paragraph const & inset_par = Paragraph const & inset_par =
*static_cast<InsetOptArg&>(inset).paragraphs().begin(); *static_cast<InsetArgument&>(inset).paragraphs().begin();
if (!par.labelString().empty()) if (!par.labelString().empty())
tocstring = par.labelString() + ' '; tocstring = par.labelString() + ' ';
tocstring += inset_par.asString(AS_STR_INSETS); tocstring += inset_par.asString(AS_STR_INSETS);

View File

@ -45,7 +45,7 @@
#include "insets/InsetNewpage.h" #include "insets/InsetNewpage.h"
#include "insets/InsetNomencl.h" #include "insets/InsetNomencl.h"
#include "insets/InsetNote.h" #include "insets/InsetNote.h"
#include "insets/InsetOptArg.h" #include "insets/InsetArgument.h"
#include "insets/InsetPhantom.h" #include "insets/InsetPhantom.h"
#include "insets/InsetPreview.h" #include "insets/InsetPreview.h"
#include "insets/InsetRef.h" #include "insets/InsetRef.h"
@ -145,7 +145,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
return new InsetMarginal(buf); return new InsetMarginal(buf);
case LFUN_OPTIONAL_INSERT: case LFUN_OPTIONAL_INSERT:
return new InsetOptArg(buf); return new InsetArgument(buf);
case LFUN_FLOAT_INSERT: case LFUN_FLOAT_INSERT:
return new InsetFloat(buf, to_utf8(cmd.argument())); return new InsetFloat(buf, to_utf8(cmd.argument()));
@ -563,7 +563,7 @@ Inset * readInset(Lexer & lex, Buffer * buf)
} else if (tmptok == "Newline") { } else if (tmptok == "Newline") {
inset.reset(new InsetNewline); inset.reset(new InsetNewline);
} else if (tmptok == "OptArg") { } else if (tmptok == "OptArg") {
inset.reset(new InsetOptArg(buf)); inset.reset(new InsetArgument(buf));
} else if (tmptok == "Float") { } else if (tmptok == "Float") {
inset.reset(new InsetFloat(buf, string())); inset.reset(new InsetFloat(buf, string()));
} else if (tmptok == "Wrap") { } else if (tmptok == "Wrap") {

View File

@ -102,7 +102,7 @@ static void build_translator()
insetnames[FLOAT_LIST_CODE] = InsetName("floatlist"); insetnames[FLOAT_LIST_CODE] = InsetName("floatlist");
insetnames[INDEX_PRINT_CODE] = InsetName("index_print"); insetnames[INDEX_PRINT_CODE] = InsetName("index_print");
insetnames[NOMENCL_PRINT_CODE] = InsetName("nomencl_print"); insetnames[NOMENCL_PRINT_CODE] = InsetName("nomencl_print");
insetnames[OPTARG_CODE] = InsetName("optarg"); insetnames[ARG_CODE] = InsetName("optarg");
insetnames[NEWLINE_CODE] = InsetName("newline"); insetnames[NEWLINE_CODE] = InsetName("newline");
insetnames[LINE_CODE] = InsetName("line"); insetnames[LINE_CODE] = InsetName("line");
insetnames[BRANCH_CODE] = InsetName("branch", _("Branch")); insetnames[BRANCH_CODE] = InsetName("branch", _("Branch"));

View File

@ -1,5 +1,5 @@
/** /**
* \file InsetOptArg.cpp * \file InsetArgument.cpp
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
@ -10,7 +10,7 @@
#include <config.h> #include <config.h>
#include "InsetOptArg.h" #include "InsetArgument.h"
#include "support/debug.h" #include "support/debug.h"
#include "support/docstream.h" #include "support/docstream.h"
@ -21,42 +21,42 @@ using namespace std;
namespace lyx { namespace lyx {
InsetOptArg::InsetOptArg(Buffer * buf) InsetArgument::InsetArgument(Buffer * buf)
: InsetCollapsable(buf) : InsetCollapsable(buf)
{} {}
void InsetOptArg::write(ostream & os) const void InsetArgument::write(ostream & os) const
{ {
os << "OptArg" << "\n"; os << "OptArg" << "\n";
InsetCollapsable::write(os); InsetCollapsable::write(os);
} }
int InsetOptArg::latex(odocstream &, OutputParams const &) const int InsetArgument::latex(odocstream &, OutputParams const &) const
{ {
return 0; return 0;
} }
int InsetOptArg::plaintext(odocstream &, OutputParams const &) const int InsetArgument::plaintext(odocstream &, OutputParams const &) const
{ {
return 0; // do not output optional arguments return 0; // do not output optional arguments
} }
int InsetOptArg::docbook(odocstream &, OutputParams const &) const int InsetArgument::docbook(odocstream &, OutputParams const &) const
{ {
return 0; return 0;
} }
docstring InsetOptArg::xhtml(XHTMLStream &, OutputParams const &) const docstring InsetArgument::xhtml(XHTMLStream &, OutputParams const &) const
{ {
return docstring(); return docstring();
} }
int InsetOptArg::latexArgument(odocstream & os, int InsetArgument::latexArgument(odocstream & os,
OutputParams const & runparams, bool optional) const OutputParams const & runparams, bool optional) const
{ {
odocstringstream ss; odocstringstream ss;

View File

@ -1,6 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
/** /**
* \file InsetOptArg.h * \file InsetArgument.h
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
@ -20,14 +20,14 @@ namespace lyx {
/** /**
* InsetOptArg. Used to insert a short version of sectioning header etc. * InsetArgument. Used to insert a short version of sectioning header etc.
* automatically, or other optional LaTeX arguments * automatically, or other optional LaTeX arguments
*/ */
class InsetOptArg : public InsetCollapsable class InsetArgument : public InsetCollapsable
{ {
public: public:
/// ///
InsetOptArg(Buffer *); InsetArgument(Buffer *);
/// Outputting the parameter of a LaTeX command /// Outputting the parameter of a LaTeX command
int latexArgument(odocstream &, OutputParams const &, int latexArgument(odocstream &, OutputParams const &,
@ -37,7 +37,7 @@ public:
private: private:
/// code of the inset /// code of the inset
InsetCode lyxCode() const { return OPTARG_CODE; } InsetCode lyxCode() const { return ARG_CODE; }
/// ///
docstring name() const { return from_ascii("OptArg"); } docstring name() const { return from_ascii("OptArg"); }
/// Standard LaTeX output -- short-circuited /// Standard LaTeX output -- short-circuited
@ -53,7 +53,7 @@ private:
/// should paragraph indendation be ommitted in any case? /// should paragraph indendation be ommitted in any case?
bool neverIndent() const { return true; } bool neverIndent() const { return true; }
/// ///
Inset * clone() const { return new InsetOptArg(*this); } Inset * clone() const { return new InsetArgument(*this); }
}; };

View File

@ -199,7 +199,7 @@ bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd,
return true; return true;
case LFUN_OPTIONAL_INSERT: case LFUN_OPTIONAL_INSERT:
status.setEnabled(cur.paragraph().insetList().find(OPTARG_CODE) == -1); status.setEnabled(cur.paragraph().insetList().find(ARG_CODE) == -1);
return true; return true;
case LFUN_INSET_TOGGLE: case LFUN_INSET_TOGGLE:

View File

@ -83,7 +83,7 @@ enum InsetCode {
/// ///
INDEX_PRINT_CODE, INDEX_PRINT_CODE,
/// ///
OPTARG_CODE, ARG_CODE,
/// ///
CELL_CODE, CELL_CODE,
/// ///

View File

@ -12,7 +12,7 @@
#include "InsetText.h" #include "InsetText.h"
#include "insets/InsetOptArg.h" #include "insets/InsetArgument.h"
#include "buffer_funcs.h" #include "buffer_funcs.h"
#include "Buffer.h" #include "Buffer.h"
@ -700,12 +700,12 @@ void InsetText::addToToc(DocIterator const & cdit)
//lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl; //lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl;
inset.addToToc(dit); inset.addToToc(dit);
switch (inset.lyxCode()) { switch (inset.lyxCode()) {
case OPTARG_CODE: { case ARG_CODE: {
if (!tocstring.empty()) if (!tocstring.empty())
break; break;
dit.pos() = 0; dit.pos() = 0;
Paragraph const & insetpar = Paragraph const & insetpar =
*static_cast<InsetOptArg&>(inset).paragraphs().begin(); *static_cast<InsetArgument&>(inset).paragraphs().begin();
if (!par.labelString().empty()) if (!par.labelString().empty())
tocstring = par.labelString() + ' '; tocstring = par.labelString() + ' ';
tocstring += insetpar.asString(AS_STR_INSETS); tocstring += insetpar.asString(AS_STR_INSETS);

View File

@ -27,7 +27,7 @@
#include "VSpace.h" #include "VSpace.h"
#include "insets/InsetBibitem.h" #include "insets/InsetBibitem.h"
#include "insets/InsetOptArg.h" #include "insets/InsetArgument.h"
#include "support/lassert.h" #include "support/lassert.h"
#include "support/debug.h" #include "support/debug.h"
@ -284,18 +284,18 @@ int latexArgInsets(Paragraph const & par, odocstream & os,
unsigned int optargs) unsigned int optargs)
{ {
unsigned int totalargs = reqargs + optargs; unsigned int totalargs = reqargs + optargs;
list<InsetOptArg const *> ilist; list<InsetArgument const *> ilist;
InsetList::const_iterator it = par.insetList().begin(); InsetList::const_iterator it = par.insetList().begin();
InsetList::const_iterator end = par.insetList().end(); InsetList::const_iterator end = par.insetList().end();
for (; it != end; ++it) { for (; it != end; ++it) {
if (it->inset->lyxCode() == OPTARG_CODE) { if (it->inset->lyxCode() == ARG_CODE) {
if (ilist.size() >= totalargs) { if (ilist.size() >= totalargs) {
LYXERR0("WARNING: Found extra argument inset."); LYXERR0("WARNING: Found extra argument inset.");
continue; continue;
} }
InsetOptArg const * ins = InsetArgument const * ins =
static_cast<InsetOptArg const *>(it->inset); static_cast<InsetArgument const *>(it->inset);
ilist.push_back(ins); ilist.push_back(ins);
} }
} }
@ -308,7 +308,7 @@ int latexArgInsets(Paragraph const & par, odocstream & os,
if (have_optional_args) { if (have_optional_args) {
unsigned int todo = ilist.size() - reqargs; unsigned int todo = ilist.size() - reqargs;
for (unsigned int i = 0; i < todo; ++i) { for (unsigned int i = 0; i < todo; ++i) {
InsetOptArg const * ins = ilist.front(); InsetArgument const * ins = ilist.front();
ilist.pop_front(); ilist.pop_front();
lines += ins->latexArgument(os, runparams, true); lines += ins->latexArgument(os, runparams, true);
} }
@ -325,7 +325,7 @@ int latexArgInsets(Paragraph const & par, odocstream & os,
// a required argument wasn't given, so we output {} // a required argument wasn't given, so we output {}
os << "{}"; os << "{}";
else { else {
InsetOptArg const * ins = ilist.front(); InsetArgument const * ins = ilist.front();
ilist.pop_front(); ilist.pop_front();
lines += ins->latexArgument(os, runparams, false); lines += ins->latexArgument(os, runparams, false);
} }