mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 21:55:29 +00:00
Another clean-up patch from Angus
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@953 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f4b8943ebb
commit
cd694827a9
53
ChangeLog
53
ChangeLog
@ -1,3 +1,56 @@
|
||||
2000-08-04 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/support/strerror.c: remove C++ comment.
|
||||
|
||||
2000-08-04 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/commandtags.h: LFUN_INDEX_CREATE_LAST reverts to
|
||||
LFUN_INDEX_INSERT_LAST
|
||||
|
||||
* src/texrow.C (getIdFromRow): changed from const_iterator to
|
||||
iterator, allowing code to compile with DEC cxx
|
||||
|
||||
* src/frontends/xforms/FormCitation.[Ch]: made vector<string>
|
||||
stores part of the class, as suggested by Allan. Will allow
|
||||
multiple LyXViews.
|
||||
(apply): test to apply uses InsetCommandParams operator!=
|
||||
|
||||
* src/frontends/xforms/FormIndex.C: moved set_minsize into build
|
||||
(apply): test to apply uses InsetCommandParams operator!=
|
||||
|
||||
* src/frontends/xforms/FormToc.[Ch]: made vector<string>
|
||||
stores part of the class.
|
||||
(update): removed limits on min/max size.
|
||||
|
||||
* src/frontends/xforms/FormUrl.C: moved set_minsize into build
|
||||
(apply): test to apply uses InsetCommandParams operator!=
|
||||
|
||||
* src/insets/insetcommand.[Ch] InsetCommand made noncopyable
|
||||
(Read, Write, scanCommand, getCommand): moved functionality
|
||||
into InsetCommandParams.
|
||||
(Clone): removed
|
||||
(getScreenLabel): made pure virtual
|
||||
new InsetCommandParams operators== and !=
|
||||
|
||||
* src/insets/insetbib.[Ch] (InsetBibKey, InsetBibtex): new
|
||||
c-tors based on InsetCommandParams. Removed others.
|
||||
* src/insets/insetinclude.[Ch]: ditto
|
||||
* src/insets/insetlabel.[Ch]: ditto
|
||||
* src/insets/insetparent.[Ch]: ditto
|
||||
* src/insets/insetref.[Ch]: ditto. Also moved gotoLabel into .C
|
||||
|
||||
* src/buffer.C (parseSingleLyXformat2Token, readInset): all
|
||||
insets derived from InsetCommand created using similar c-tors
|
||||
based on InsetCommandParams
|
||||
* src/lyx_cb.C (MenuInsertLabel, RefSelectCB): ditto
|
||||
* src/menus.C (ShowRefsMenu): ditto
|
||||
* src/paragraph.C (Clone): ditto
|
||||
* src/text2.C (SetCounter): ditto
|
||||
* src/lyxfunc.C (Dispatch) ditto
|
||||
Also recreated old InsetIndex behaviour exactly. Can now
|
||||
index-insert at the start of a paragraph and index-insert-last
|
||||
without launching the pop-up.
|
||||
|
||||
2000-08-03 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* lib/lyxrc.example: mark te pdf options as non functional.
|
||||
|
3
INSTALL
3
INSTALL
@ -275,7 +275,8 @@ Preparing a binary distribution for the use of others
|
||||
in some private place and running it. In particular, check the
|
||||
output of `ldd lyx' to know which libraries are really needed.
|
||||
|
||||
o Upload your binary file to ftp.lyx.org:/pub/lyx/uploads.
|
||||
o Upload your binary file to ftp.devel.lyx.org:/pub/incoming, and
|
||||
notify larsbj@lyx.org.
|
||||
|
||||
|
||||
Problems
|
||||
|
@ -249,7 +249,7 @@ void LyXAction::init()
|
||||
N_("Insert hyphenation point"), Noop },
|
||||
{ LFUN_INDEX_CREATE, "index-insert",
|
||||
N_("Insert index item"), Noop },
|
||||
{ LFUN_INDEX_CREATE_LAST, "index-insert-last",
|
||||
{ LFUN_INDEX_INSERT_LAST, "index-insert-last",
|
||||
N_("Insert last index item"), Noop },
|
||||
{ LFUN_INDEX_PRINT, "index-print", N_("Insert index list"),
|
||||
Noop },
|
||||
|
63
src/buffer.C
63
src/buffer.C
@ -489,7 +489,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
if (pp.first) {
|
||||
params.textclass = pp.second;
|
||||
} else {
|
||||
lex.printError("Unknown textclass `$$Token'");
|
||||
lex.printError("Unknown textclass `$$Token'");
|
||||
params.textclass = 0;
|
||||
}
|
||||
if (!textclasslist.Load(params.textclass)) {
|
||||
@ -889,7 +889,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
} else if (tmptok == "Include") {
|
||||
Inset * inset = new InsetInclude(string(), this);
|
||||
InsetCommandParams p( "Include" );
|
||||
Inset * inset = new InsetInclude(p, this);
|
||||
inset->Read(this, lex);
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
@ -951,25 +952,25 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
} else if (tmptok == "LatexCommand") {
|
||||
InsetCommand inscmd;
|
||||
inscmd.Read(this, lex);
|
||||
InsetCommandParams inscmd;
|
||||
inscmd.Read(lex);
|
||||
Inset * inset = 0;
|
||||
if (inscmd.getCmdName() == "cite") {
|
||||
inset = new InsetCitation(inscmd.params());
|
||||
inset = new InsetCitation(inscmd);
|
||||
} else if (inscmd.getCmdName() == "bibitem") {
|
||||
lex.printError("Wrong place for bibitem");
|
||||
inset = inscmd.Clone();
|
||||
inset = new InsetBibKey(inscmd);
|
||||
} else if (inscmd.getCmdName() == "BibTeX") {
|
||||
inset = new InsetBibtex(inscmd.getContents(), inscmd.getOptions(), this);
|
||||
inset = new InsetBibtex(inscmd, this);
|
||||
} else if (inscmd.getCmdName() == "index") {
|
||||
inset = new InsetIndex(inscmd.params());
|
||||
inset = new InsetIndex(inscmd);
|
||||
} else if (inscmd.getCmdName() == "include") {
|
||||
inset = new InsetInclude(inscmd.getContents(), this);
|
||||
inset = new InsetInclude(inscmd, this);
|
||||
} else if (inscmd.getCmdName() == "label") {
|
||||
inset = new InsetLabel(inscmd.getCommand());
|
||||
inset = new InsetLabel(inscmd);
|
||||
} else if (inscmd.getCmdName() == "url"
|
||||
|| inscmd.getCmdName() == "htmlurl") {
|
||||
inset = new InsetUrl(inscmd.params());
|
||||
inset = new InsetUrl(inscmd);
|
||||
} else if (inscmd.getCmdName() == "ref"
|
||||
|| inscmd.getCmdName() == "pageref"
|
||||
|| inscmd.getCmdName() == "vref"
|
||||
@ -982,11 +983,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
|| inscmd.getCmdName() == "listofalgorithms"
|
||||
|| inscmd.getCmdName() == "listoffigures"
|
||||
|| inscmd.getCmdName() == "listoftables") {
|
||||
inset = new InsetTOC(inscmd.params());
|
||||
inset = new InsetTOC(inscmd);
|
||||
} else if (inscmd.getCmdName() == "printindex") {
|
||||
inset = new InsetPrintIndex(inscmd.params());
|
||||
inset = new InsetPrintIndex(inscmd);
|
||||
} else if (inscmd.getCmdName() == "lyxparent") {
|
||||
inset = new InsetParent(inscmd.getContents(), this);
|
||||
inset = new InsetParent(inscmd, this);
|
||||
}
|
||||
|
||||
if (inset) {
|
||||
@ -1054,8 +1055,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
}
|
||||
++pos;
|
||||
} else if (token == "\\bibitem") { // ale970302
|
||||
if (!par->bibkey)
|
||||
par->bibkey = new InsetBibKey;
|
||||
if (!par->bibkey) {
|
||||
InsetCommandParams p( "bibitem" );
|
||||
par->bibkey = new InsetBibKey(p);
|
||||
}
|
||||
par->bibkey->Read(this, lex);
|
||||
}else if (token == "\\backslash") {
|
||||
par->InsertChar(pos, '\\', font);
|
||||
@ -1120,7 +1123,8 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
} else if (tmptok == "Include") {
|
||||
Inset * inset = new InsetInclude(string(), this);
|
||||
InsetCommandParams p( "Include" );
|
||||
Inset * inset = new InsetInclude(p, this);
|
||||
inset->Read(this, lex);
|
||||
par->InsertInset(pos, inset, font);
|
||||
++pos;
|
||||
@ -1181,26 +1185,25 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
|
||||
//inset->Read(this, lex);
|
||||
par->InsertInset(pos, inset, font);
|
||||
} else if (tmptok == "LatexCommand") {
|
||||
InsetCommand inscmd;
|
||||
inscmd.Read(this, lex);
|
||||
InsetCommandParams inscmd;
|
||||
inscmd.Read(lex);
|
||||
Inset * inset = 0;
|
||||
if (inscmd.getCmdName() == "cite") {
|
||||
inset = new InsetCitation(inscmd.params());
|
||||
inset = new InsetCitation(inscmd);
|
||||
} else if (inscmd.getCmdName() == "bibitem") {
|
||||
lex.printError("Wrong place for bibitem");
|
||||
inset = inscmd.Clone();
|
||||
inset = new InsetBibKey(inscmd);
|
||||
} else if (inscmd.getCmdName() == "BibTeX") {
|
||||
inset = new InsetBibtex(inscmd.getContents(),
|
||||
inscmd.getOptions(), this);
|
||||
inset = new InsetBibtex(inscmd, this);
|
||||
} else if (inscmd.getCmdName() == "index") {
|
||||
inset = new InsetIndex(inscmd.params());
|
||||
inset = new InsetIndex(inscmd);
|
||||
} else if (inscmd.getCmdName() == "include") {
|
||||
inset = new InsetInclude(inscmd.getContents(), this);
|
||||
inset = new InsetInclude(inscmd, this);
|
||||
} else if (inscmd.getCmdName() == "label") {
|
||||
inset = new InsetLabel(inscmd.getCommand());
|
||||
inset = new InsetLabel(inscmd);
|
||||
} else if (inscmd.getCmdName() == "url"
|
||||
|| inscmd.getCmdName() == "htmlurl") {
|
||||
inset = new InsetUrl(inscmd.params());
|
||||
inset = new InsetUrl(inscmd);
|
||||
} else if (inscmd.getCmdName() == "ref"
|
||||
|| inscmd.getCmdName() == "pageref"
|
||||
|| inscmd.getCmdName() == "vref"
|
||||
@ -1214,11 +1217,11 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
|
||||
|| inscmd.getCmdName() == "listofalgorithms"
|
||||
|| inscmd.getCmdName() == "listoffigures"
|
||||
|| inscmd.getCmdName() == "listoftables") {
|
||||
inset = new InsetTOC(inscmd.params());
|
||||
inset = new InsetTOC(inscmd);
|
||||
} else if (inscmd.getCmdName() == "printindex") {
|
||||
inset = new InsetPrintIndex(inscmd.params());
|
||||
inset = new InsetPrintIndex(inscmd);
|
||||
} else if (inscmd.getCmdName() == "lyxparent") {
|
||||
inset = new InsetParent(inscmd.getContents(), this);
|
||||
inset = new InsetParent(inscmd, this);
|
||||
}
|
||||
|
||||
if (inset) {
|
||||
|
@ -199,7 +199,7 @@ enum kb_action {
|
||||
LFUN_CITATION_INSERT, // AAS 97-02-23
|
||||
LFUN_INSERT_BIBTEX, // AAS 97-02-23
|
||||
LFUN_INDEX_CREATE, // Lgb 97-02-27
|
||||
LFUN_INDEX_CREATE_LAST, // 180 // Reh 98-09-17
|
||||
LFUN_INDEX_INSERT_LAST, // 180 // Reh 98-09-17
|
||||
LFUN_INDEX_PRINT, // Lgb 97-02-27
|
||||
LFUN_APROPOS, // Asger 1997-02-27
|
||||
LFUN_LATEX_LOG, // Lgb 97-04-05
|
||||
|
@ -35,10 +35,6 @@ using std::max;
|
||||
using std::min;
|
||||
using std::find;
|
||||
|
||||
static vector<string> citekeys;
|
||||
static vector<string> bibkeys;
|
||||
static vector<string> bibkeysInfo;
|
||||
|
||||
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
|
||||
: FormCommand(lv, d, _("Citation")), dialog_(0)
|
||||
{
|
||||
@ -73,7 +69,7 @@ void FormCitation::build()
|
||||
|
||||
FL_FORM * const FormCitation::form() const
|
||||
{
|
||||
if( dialog_ && dialog_->form_citation )
|
||||
if( dialog_ ) // no need to test for dialog_->citation
|
||||
return dialog_->form_citation;
|
||||
else
|
||||
return 0;
|
||||
@ -102,8 +98,6 @@ void FormCitation::update()
|
||||
keys = frontStrip( split(keys, tmp, ',') );
|
||||
}
|
||||
|
||||
fl_freeze_form( dialog_->form_citation );
|
||||
|
||||
updateBrowser( dialog_->bibBrsr, bibkeys );
|
||||
updateBrowser( dialog_->citeBrsr, citekeys );
|
||||
fl_clear_browser( dialog_->infoBrsr );
|
||||
@ -123,8 +117,6 @@ void FormCitation::update()
|
||||
setSize( size, bibPresent );
|
||||
|
||||
fl_set_input( dialog_->textAftr, params.getOptions().c_str() );
|
||||
|
||||
fl_unfreeze_form( dialog_->form_citation );
|
||||
}
|
||||
|
||||
|
||||
@ -417,9 +409,7 @@ void FormCitation::apply()
|
||||
if( inset_ != 0 )
|
||||
{
|
||||
// Only update if contents have changed
|
||||
if( params.getCmdName() != inset_->getCmdName() ||
|
||||
params.getContents() != inset_->getContents() ||
|
||||
params.getOptions() != inset_->getOptions() ) {
|
||||
if( params != inset_->params() ) {
|
||||
inset_->setParams( params );
|
||||
lv_->view()->updateInset( inset_, true );
|
||||
}
|
||||
|
@ -23,6 +23,15 @@ struct FD_form_citation;
|
||||
*/
|
||||
class FormCitation : public FormCommand {
|
||||
public:
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
///
|
||||
FormCitation(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormCitation();
|
||||
//@}
|
||||
|
||||
private:
|
||||
///
|
||||
enum State {
|
||||
DOWN,
|
||||
@ -34,15 +43,6 @@ public:
|
||||
ON,
|
||||
OFF
|
||||
};
|
||||
/**@name Constructors and Destructors */
|
||||
//@{
|
||||
/// #FormCitation x(LyXFunc ..., Dialogs ...);#
|
||||
FormCitation(LyXView *, Dialogs *);
|
||||
///
|
||||
~FormCitation();
|
||||
//@}
|
||||
|
||||
private:
|
||||
/// Build the dialog
|
||||
virtual void build();
|
||||
/// Filter the inputs
|
||||
@ -69,6 +69,12 @@ private:
|
||||
|
||||
/// Real GUI implementation.
|
||||
FD_form_citation * dialog_;
|
||||
///
|
||||
std::vector<string> citekeys;
|
||||
///
|
||||
std::vector<string> bibkeys;
|
||||
///
|
||||
std::vector<string> bibkeysInfo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -47,12 +47,18 @@ FormIndex::~FormIndex()
|
||||
void FormIndex::build()
|
||||
{
|
||||
dialog_ = build_index();
|
||||
|
||||
int w = form()->w;
|
||||
int h = form()->h;
|
||||
|
||||
fl_set_form_minsize(form(), w, h);
|
||||
fl_set_form_maxsize(form(), 2*w, h);
|
||||
}
|
||||
|
||||
|
||||
FL_FORM * const FormIndex::form() const
|
||||
{
|
||||
if( dialog_ && dialog_->form_index )
|
||||
if( dialog_ ) // no need to test for dialog_->form_index
|
||||
return dialog_->form_index;
|
||||
else
|
||||
return 0;
|
||||
@ -61,18 +67,6 @@ FL_FORM * const FormIndex::form() const
|
||||
|
||||
void FormIndex::update()
|
||||
{
|
||||
static int ow = -1, oh;
|
||||
|
||||
if (ow < 0) {
|
||||
ow = dialog_->form_index->w;
|
||||
oh = dialog_->form_index->h;
|
||||
|
||||
fl_set_form_minsize(dialog_->form_index, ow, oh);
|
||||
fl_set_form_maxsize(dialog_->form_index, 2*ow, oh);
|
||||
}
|
||||
|
||||
fl_freeze_form( dialog_->form_index );
|
||||
|
||||
fl_set_input(dialog_->key, params.getContents().c_str());
|
||||
|
||||
if( lv_->buffer()->isReadonly() ) {
|
||||
@ -84,8 +78,6 @@ void FormIndex::update()
|
||||
fl_activate_object( dialog_->ok );
|
||||
fl_set_object_lcol( dialog_->ok, FL_BLACK );
|
||||
}
|
||||
|
||||
fl_unfreeze_form( dialog_->form_index );
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +90,7 @@ void FormIndex::apply()
|
||||
if( inset_ != 0 )
|
||||
{
|
||||
// Only update if contents have changed
|
||||
if( params.getContents() != inset_->getContents() ) {
|
||||
if( params != inset_->params() ) {
|
||||
inset_->setParams( params );
|
||||
lv_->view()->updateInset( inset_, true );
|
||||
}
|
||||
|
@ -23,12 +23,9 @@
|
||||
#include "Dialogs.h"
|
||||
#include "FormToc.h"
|
||||
#include "LyXView.h"
|
||||
#include "buffer.h"
|
||||
#include "form_toc.h"
|
||||
#include "lyxtext.h"
|
||||
|
||||
static vector<Buffer::TocItem> toclist;
|
||||
|
||||
FormToc::FormToc(LyXView * lv, Dialogs * d)
|
||||
: FormCommand(lv, d, _("Table of Contents")), dialog_(0)
|
||||
{
|
||||
@ -58,12 +55,14 @@ void FormToc::build()
|
||||
dialog_ = build_toc();
|
||||
fl_addto_choice(dialog_->type,
|
||||
_(" TOC | LOF | LOT | LOA "));
|
||||
|
||||
// Don't need to limit size of this dialog
|
||||
}
|
||||
|
||||
|
||||
FL_FORM * const FormToc::form() const
|
||||
{
|
||||
if( dialog_ && dialog_->form_toc )
|
||||
if( dialog_ ) // no need to test for dialog_->form_toc
|
||||
return dialog_->form_toc;
|
||||
else
|
||||
return 0;
|
||||
@ -72,16 +71,6 @@ FL_FORM * const FormToc::form() const
|
||||
|
||||
void FormToc::update()
|
||||
{
|
||||
static int ow = -1, oh;
|
||||
|
||||
if (ow < 0) {
|
||||
ow = form()->w;
|
||||
oh = form()->h;
|
||||
|
||||
fl_set_form_minsize(form(), ow, oh);
|
||||
fl_set_form_maxsize(form(), 2*ow, oh);
|
||||
}
|
||||
|
||||
Buffer::TocType type;
|
||||
|
||||
if( params.getCmdName() == "tableofcontents" )
|
||||
|
@ -17,6 +17,7 @@
|
||||
#endif
|
||||
|
||||
#include "FormCommand.h"
|
||||
#include "buffer.h"
|
||||
struct FD_form_toc;
|
||||
|
||||
/** This class provides an XForms implementation of the FormToc Dialog.
|
||||
@ -50,6 +51,8 @@ private:
|
||||
|
||||
/// Real GUI implementation.
|
||||
FD_form_toc * dialog_;
|
||||
///
|
||||
std::vector<Buffer::TocItem> toclist;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -47,12 +47,18 @@ FormUrl::~FormUrl()
|
||||
void FormUrl::build()
|
||||
{
|
||||
dialog_ = build_url();
|
||||
|
||||
int w = form()->w;
|
||||
int h = form()->h;
|
||||
|
||||
fl_set_form_minsize(form(), w, h);
|
||||
fl_set_form_maxsize(form(), 2*w, h);
|
||||
}
|
||||
|
||||
|
||||
FL_FORM * const FormUrl::form() const
|
||||
{
|
||||
if( dialog_ && dialog_->form_url )
|
||||
if( dialog_ ) // no need to test for dialog_->form_url
|
||||
return dialog_->form_url;
|
||||
else
|
||||
return 0;
|
||||
@ -61,18 +67,6 @@ FL_FORM * const FormUrl::form() const
|
||||
|
||||
void FormUrl::update()
|
||||
{
|
||||
static int ow = -1, oh;
|
||||
|
||||
if (ow < 0) {
|
||||
ow = dialog_->form_url->w;
|
||||
oh = dialog_->form_url->h;
|
||||
|
||||
fl_set_form_minsize(dialog_->form_url, ow, oh);
|
||||
fl_set_form_maxsize(dialog_->form_url, 2*ow, oh);
|
||||
}
|
||||
|
||||
fl_freeze_form( dialog_->form_url );
|
||||
|
||||
fl_set_input(dialog_->url, params.getContents().c_str());
|
||||
fl_set_input(dialog_->name, params.getOptions().c_str());
|
||||
|
||||
@ -94,8 +88,6 @@ void FormUrl::update()
|
||||
fl_activate_object( dialog_->ok );
|
||||
fl_set_object_lcol( dialog_->ok, FL_BLACK );
|
||||
}
|
||||
|
||||
fl_unfreeze_form( dialog_->form_url );
|
||||
}
|
||||
|
||||
|
||||
@ -114,9 +106,7 @@ void FormUrl::apply()
|
||||
if( inset_ != 0 )
|
||||
{
|
||||
// Only update if contents have changed
|
||||
if( params.getCmdName() != inset_->getCmdName() ||
|
||||
params.getContents() != inset_->getContents() ||
|
||||
params.getOptions() != inset_->getOptions() ) {
|
||||
if( params != inset_->params() ) {
|
||||
inset_->setParams( params );
|
||||
lv_->view()->updateInset( inset_, true );
|
||||
}
|
||||
|
@ -72,19 +72,10 @@ FD_bibitem_form * create_form_bibitem_form(void)
|
||||
}
|
||||
|
||||
|
||||
InsetBibKey::InsetBibKey(string const & key, string const & label)
|
||||
: InsetCommand("bibitem", key, label)
|
||||
InsetBibKey::InsetBibKey(InsetCommandParams const & p)
|
||||
: InsetCommand(p)
|
||||
{
|
||||
counter = 1;
|
||||
if (key.empty())
|
||||
setCmdName(" ");
|
||||
}
|
||||
|
||||
|
||||
InsetBibKey::InsetBibKey(InsetBibKey const * b)
|
||||
: InsetCommand("bibitem", b->getContents(), b->getOptions())
|
||||
{
|
||||
counter = b->counter;
|
||||
}
|
||||
|
||||
|
||||
@ -97,6 +88,14 @@ InsetBibKey::~InsetBibKey()
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetBibKey::Clone() const
|
||||
{
|
||||
InsetBibKey * b = new InsetBibKey(params());
|
||||
b->setCounter(counter);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
void InsetBibKey::callback( FD_bibitem_form * form, long data )
|
||||
{
|
||||
switch (data) {
|
||||
@ -201,9 +200,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(InsetCommandParams const & p, Buffer * o)
|
||||
: InsetCommand(p), owner(o)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include <vector>
|
||||
#include "insetcommand.h"
|
||||
|
||||
class Buffer;
|
||||
struct FD_bibitem_form;
|
||||
@ -30,17 +30,11 @@ struct FD_bibitem_form;
|
||||
class InsetBibKey : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetBibKey() : InsetCommand("bibitem") { counter = 1; }
|
||||
///
|
||||
explicit
|
||||
InsetBibKey(string const & key, string const & label = string());
|
||||
///
|
||||
explicit
|
||||
InsetBibKey(InsetBibKey const *);
|
||||
InsetBibKey(InsetCommandParams const &);
|
||||
///
|
||||
~InsetBibKey();
|
||||
///
|
||||
Inset * Clone() const { return new InsetBibKey(this); }
|
||||
Inset * Clone() const;
|
||||
/** Currently \bibitem is used as a LyX2.x command,
|
||||
so we need this method.
|
||||
*/
|
||||
@ -83,36 +77,25 @@ private:
|
||||
*/
|
||||
class InsetBibtex : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetBibtex() : InsetCommand("BibTeX") { owner = 0; }
|
||||
///
|
||||
InsetBibtex(string const & dbase, string const & style,
|
||||
Buffer *);
|
||||
InsetBibtex(InsetCommandParams const &, Buffer *);
|
||||
///
|
||||
~InsetBibtex();
|
||||
|
||||
///
|
||||
Inset * Clone() const {
|
||||
return new InsetBibtex(getContents(), getOptions(), owner);
|
||||
}
|
||||
///
|
||||
Inset::Code LyxCode() const
|
||||
{
|
||||
return Inset::BIBTEX_CODE;
|
||||
}
|
||||
Inset * Clone() const { return new InsetBibtex(params(), owner); }
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code LyxCode() const { return Inset::BIBTEX_CODE; }
|
||||
///
|
||||
void Edit(BufferView *, int x, int y, unsigned int button);
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool freespace) const;
|
||||
///
|
||||
std::vector<std::pair<string,string> > getKeys() const;
|
||||
///
|
||||
EDITABLE Editable() const {
|
||||
return IS_EDITABLE;
|
||||
}
|
||||
///
|
||||
bool addDatabase(string const &);
|
||||
///
|
||||
|
@ -16,11 +16,10 @@
|
||||
#endif
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include "support/utility.hpp"
|
||||
|
||||
/** Used to insert citations
|
||||
*/
|
||||
class InsetCitation : public InsetCommand, public noncopyable {
|
||||
class InsetCitation : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetCitation(InsetCommandParams const &);
|
||||
|
@ -59,38 +59,25 @@ void InsetCommandParams::setFromString( string const & b )
|
||||
}
|
||||
|
||||
|
||||
InsetCommand::InsetCommand()
|
||||
{}
|
||||
|
||||
|
||||
InsetCommand::InsetCommand( string const & n,
|
||||
string const & c,
|
||||
string const & o )
|
||||
: p_(n, c, o)
|
||||
{}
|
||||
|
||||
|
||||
InsetCommand::InsetCommand( InsetCommandParams const & p )
|
||||
: p_( p.getCmdName(), p.getContents(), p.getOptions() )
|
||||
{}
|
||||
|
||||
|
||||
void InsetCommand::setParams(InsetCommandParams const & p )
|
||||
bool InsetCommandParams::operator==(InsetCommandParams const & o) const
|
||||
{
|
||||
p_.setCmdName( p.getCmdName() );
|
||||
p_.setContents( p.getContents() );
|
||||
p_.setOptions( p.getOptions() );
|
||||
if( cmdname != o.cmdname ) return false;
|
||||
if( contents != o.contents ) return false;
|
||||
if( options != o.options ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// In lyxf3 this will be just LaTeX
|
||||
void InsetCommand::Write(Buffer const *, ostream & os) const
|
||||
bool InsetCommandParams::operator!=(InsetCommandParams const & o) const
|
||||
{
|
||||
os << "LatexCommand " << getCommand() << "\n";
|
||||
if( cmdname != o.cmdname ) return true;
|
||||
if( contents != o.contents ) return true;
|
||||
if( options != o.options ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void InsetCommand::scanCommand(string const & cmd)
|
||||
void InsetCommandParams::scanCommand(string const & cmd)
|
||||
{
|
||||
string tcmdname, toptions, tcontents;
|
||||
|
||||
@ -153,7 +140,7 @@ void InsetCommand::scanCommand(string const & cmd)
|
||||
|
||||
|
||||
// This function will not be necessary when lyx3
|
||||
void InsetCommand::Read(Buffer const *, LyXLex & lex)
|
||||
void InsetCommandParams::Read(LyXLex & lex)
|
||||
{
|
||||
string token;
|
||||
|
||||
@ -175,6 +162,35 @@ void InsetCommand::Read(Buffer const *, LyXLex & lex)
|
||||
}
|
||||
|
||||
|
||||
void InsetCommandParams::Write(ostream & os) const
|
||||
{
|
||||
os << "LatexCommand " << getCommand() << "\n";
|
||||
}
|
||||
|
||||
|
||||
string InsetCommandParams::getCommand() const
|
||||
{
|
||||
string s;
|
||||
if (!getCmdName().empty()) s += "\\"+getCmdName();
|
||||
if (!getOptions().empty()) s += "["+getOptions()+']';
|
||||
s += "{"+getContents()+'}';
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
InsetCommand::InsetCommand( InsetCommandParams const & p )
|
||||
: p_( p.getCmdName(), p.getContents(), p.getOptions() )
|
||||
{}
|
||||
|
||||
|
||||
void InsetCommand::setParams(InsetCommandParams const & p )
|
||||
{
|
||||
p_.setCmdName( p.getCmdName() );
|
||||
p_.setContents( p.getContents() );
|
||||
p_.setOptions( p.getOptions() );
|
||||
}
|
||||
|
||||
|
||||
int InsetCommand::Latex(Buffer const *, ostream & os,
|
||||
bool /*fragile*/, bool/*fs*/) const
|
||||
{
|
||||
@ -199,19 +215,3 @@ int InsetCommand::DocBook(Buffer const *, ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetCommand::Clone() const
|
||||
{
|
||||
return new InsetCommand(getCmdName(), getContents(), getOptions());
|
||||
}
|
||||
|
||||
|
||||
string InsetCommand::getCommand() const
|
||||
{
|
||||
string s;
|
||||
if (!getCmdName().empty()) s += "\\"+getCmdName();
|
||||
if (!getOptions().empty()) s += "["+getOptions()+']';
|
||||
s += "{"+getContents()+'}';
|
||||
return s;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "insetbutton.h"
|
||||
#include <sigc++/signal_system.h>
|
||||
#include "support/utility.hpp"
|
||||
|
||||
#ifdef SIGC_CXX_NAMESPACES
|
||||
using SigC::Signal0;
|
||||
@ -39,6 +40,18 @@ public:
|
||||
string const & c = string(),
|
||||
string const & o = string());
|
||||
///
|
||||
bool operator==(InsetCommandParams const &) const;
|
||||
///
|
||||
bool operator!=(InsetCommandParams const &) const;
|
||||
///
|
||||
void Read(LyXLex &);
|
||||
/// Parse the command
|
||||
void scanCommand(string const &);
|
||||
///
|
||||
void Write(std::ostream &) const;
|
||||
/// Build the complete LaTeX command
|
||||
string getCommand() const;
|
||||
///
|
||||
string const & getCmdName() const { return cmdname; }
|
||||
///
|
||||
string const & getOptions() const { return options; }
|
||||
@ -54,7 +67,6 @@ public:
|
||||
string getAsString() const;
|
||||
///
|
||||
void setFromString( string const & );
|
||||
|
||||
private:
|
||||
///
|
||||
string cmdname;
|
||||
@ -65,27 +77,20 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class InsetCommand : public InsetButton {
|
||||
class InsetCommand : public InsetButton, public noncopyable {
|
||||
public:
|
||||
///
|
||||
InsetCommand();
|
||||
///
|
||||
explicit
|
||||
InsetCommand(string const & n,
|
||||
string const & c = string(),
|
||||
string const & o = string());
|
||||
///
|
||||
explicit
|
||||
InsetCommand(InsetCommandParams const &);
|
||||
///
|
||||
virtual ~InsetCommand() { hide(); };
|
||||
///
|
||||
void Write(Buffer const *, std::ostream &) const;
|
||||
|
||||
/// Parse the command.
|
||||
void scanCommand(string const & cmd);
|
||||
void Write(Buffer const *, std::ostream & os) const
|
||||
{ p_.Write( os ); }
|
||||
///
|
||||
virtual void Read(Buffer const *, LyXLex & lex);
|
||||
virtual void Read(Buffer const *, LyXLex & lex)
|
||||
{ p_.Read( lex ); }
|
||||
/// Can remove one InsetBibKey is modified
|
||||
void scanCommand(string const & c) { p_.scanCommand( c ); };
|
||||
///
|
||||
virtual int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
@ -96,12 +101,7 @@ public:
|
||||
///
|
||||
virtual int DocBook(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
Inset * Clone() const;
|
||||
///
|
||||
Inset::Code LyxCode() const
|
||||
{
|
||||
return Inset::NO_CODE;
|
||||
}
|
||||
Inset::Code LyxCode() const { return Inset::NO_CODE; }
|
||||
|
||||
/** Get the label that appears at screen.
|
||||
|
||||
@ -109,9 +109,9 @@ public:
|
||||
confusion with lyxinset::getLabel(int), but I've seen that
|
||||
it wasn't. I hope you never confuse again both methods. (ale)
|
||||
*/
|
||||
virtual string getScreenLabel() const { return getCommand(); }
|
||||
/// Build the complete LaTeX command
|
||||
string getCommand() const;
|
||||
virtual string getScreenLabel() const = 0;
|
||||
///
|
||||
string getCommand() const { return p_.getCommand(); }
|
||||
///
|
||||
string const & getCmdName() const { return p_.getCmdName(); }
|
||||
///
|
||||
|
@ -210,11 +210,9 @@ static string unique_id() {
|
||||
}
|
||||
|
||||
|
||||
InsetInclude::InsetInclude(string const & fname, Buffer * bf)
|
||||
: InsetCommand("include")
|
||||
InsetInclude::InsetInclude(InsetCommandParams const & p, Buffer * bf)
|
||||
: InsetCommand(p), master(bf)
|
||||
{
|
||||
master = bf;
|
||||
setContents(fname);
|
||||
flag = InsetInclude::INCLUDE;
|
||||
noload = false;
|
||||
include_label = unique_id();
|
||||
@ -240,7 +238,7 @@ InsetInclude::~InsetInclude()
|
||||
|
||||
Inset * InsetInclude::Clone() const
|
||||
{
|
||||
InsetInclude * ii = new InsetInclude (getContents(), master);
|
||||
InsetInclude * ii = new InsetInclude (params(), master);
|
||||
ii->setNoLoad(isNoLoad());
|
||||
// By default, the newly created inset is of `include' type,
|
||||
// so we do not test this case.
|
||||
|
@ -26,15 +26,8 @@ struct LaTeXFeatures;
|
||||
*/
|
||||
class InsetInclude: public InsetCommand {
|
||||
public:
|
||||
#if 0
|
||||
///
|
||||
InsetInclude(): InsetCommand("include")
|
||||
{
|
||||
flag = InsetInclude::INCLUDE;
|
||||
}
|
||||
#endif
|
||||
///
|
||||
InsetInclude(string const &, Buffer *);
|
||||
InsetInclude(InsetCommandParams const &, Buffer *);
|
||||
///
|
||||
~InsetInclude();
|
||||
///
|
||||
|
@ -17,13 +17,12 @@
|
||||
#endif
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include "support/utility.hpp"
|
||||
|
||||
struct LaTeXFeatures;
|
||||
|
||||
/** Used to insert index labels
|
||||
*/
|
||||
class InsetIndex : public InsetCommand, public noncopyable {
|
||||
class InsetIndex : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetIndex(InsetCommandParams const &);
|
||||
@ -38,7 +37,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class InsetPrintIndex : public InsetCommand, public noncopyable {
|
||||
class InsetPrintIndex : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetPrintIndex(InsetCommandParams const &);
|
||||
|
@ -28,16 +28,9 @@ using std::pair;
|
||||
/* Label. Used to insert a label automatically */
|
||||
|
||||
|
||||
InsetLabel::InsetLabel(string const & cmd)
|
||||
{
|
||||
scanCommand(cmd);
|
||||
}
|
||||
|
||||
|
||||
Inset * InsetLabel::Clone() const
|
||||
{
|
||||
return new InsetLabel(getCommand());
|
||||
}
|
||||
InsetLabel::InsetLabel(InsetCommandParams const & p)
|
||||
: InsetCommand(p)
|
||||
{}
|
||||
|
||||
|
||||
vector<string> InsetLabel::getLabelList() const
|
||||
|
@ -17,29 +17,24 @@
|
||||
#endif
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include "LString.h"
|
||||
|
||||
///
|
||||
class InsetLabel : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
explicit
|
||||
InsetLabel(string const & cmd);
|
||||
InsetLabel(InsetCommandParams const &);
|
||||
///
|
||||
InsetLabel() : InsetCommand("label") {}
|
||||
///
|
||||
Inset * Clone() const;
|
||||
///
|
||||
Inset::Code LyxCode() const { return Inset::LABEL_CODE; }
|
||||
///
|
||||
std::vector<string> getLabelList() const;
|
||||
Inset * Clone() const { return new InsetLabel(params()); }
|
||||
///
|
||||
string getScreenLabel() const { return getContents(); }
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code LyxCode() const { return Inset::LABEL_CODE; }
|
||||
///
|
||||
void Edit(BufferView *, int, int, unsigned int);
|
||||
///
|
||||
std::vector<string> getLabelList() const;
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
///
|
||||
|
@ -28,11 +28,12 @@
|
||||
|
||||
using std::ostream;
|
||||
|
||||
InsetParent::InsetParent(string const & fn, Buffer * owner)
|
||||
: InsetCommand("lyxparent")
|
||||
InsetParent::InsetParent(InsetCommandParams const & p, Buffer * bf)
|
||||
: InsetCommand(p)
|
||||
{
|
||||
if (owner)
|
||||
setContents(MakeAbsPath(fn, OnlyPath(owner->fileName())));
|
||||
string fn = p.getContents();
|
||||
if (bf)
|
||||
setContents(MakeAbsPath(fn, OnlyPath(bf->fileName())));
|
||||
else
|
||||
setContents(fn);
|
||||
}
|
||||
|
@ -26,27 +26,22 @@ class Buffer;
|
||||
*/
|
||||
class InsetParent : public InsetCommand {
|
||||
public:
|
||||
/// Non-standard LyX macro
|
||||
InsetParent() : InsetCommand("lyxparent") {}
|
||||
///
|
||||
explicit
|
||||
InsetParent(string const & fn, Buffer * owner = 0);
|
||||
InsetParent(InsetCommandParams const &, Buffer * owner = 0);
|
||||
///
|
||||
Inset * Clone() const { return new InsetParent(params()); }
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code LyxCode() const { return Inset::PARENT_CODE; }
|
||||
///
|
||||
void Edit(BufferView *, int, int, unsigned int);
|
||||
///
|
||||
int Latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
///
|
||||
Inset * Clone() const { return new InsetParent(getContents()); }
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
///
|
||||
void Edit(BufferView *, int, int, unsigned int);
|
||||
///
|
||||
EDITABLE Editable() const {
|
||||
return IS_EDITABLE;
|
||||
}
|
||||
///
|
||||
Inset::Code LyxCode() const { return Inset::PARENT_CODE; }
|
||||
///
|
||||
void setParent(string fn) { setContents(fn); }
|
||||
};
|
||||
#endif
|
||||
|
@ -23,24 +23,12 @@ using std::endl;
|
||||
extern BufferView * current_view;
|
||||
|
||||
|
||||
InsetRef::InsetRef(string const & cmd, Buffer * bf)
|
||||
: master(bf)
|
||||
InsetRef::InsetRef(InsetCommandParams const & p, Buffer * bf)
|
||||
: InsetCommand(p), master(bf)
|
||||
{
|
||||
scanCommand(cmd);
|
||||
GenerateFlag();
|
||||
}
|
||||
|
||||
|
||||
InsetRef::InsetRef(InsetCommand const & inscmd, Buffer * bf)
|
||||
: master(bf)
|
||||
{
|
||||
setCmdName(inscmd.getCmdName());
|
||||
setContents(inscmd.getContents());
|
||||
setOptions(inscmd.getOptions());
|
||||
GenerateFlag();
|
||||
}
|
||||
|
||||
|
||||
void InsetRef::GenerateFlag()
|
||||
{
|
||||
if (getCmdName() == "ref")
|
||||
@ -101,10 +89,8 @@ int InsetRef::Latex(Buffer const *, ostream & os,
|
||||
if(getOptions().empty())
|
||||
os << escape(getCommand());
|
||||
else {
|
||||
string ns;
|
||||
InsetCommand clone(getCmdName(),
|
||||
getContents(), ns);
|
||||
os << escape(clone.getCommand());
|
||||
InsetCommandParams p( getCmdName(), getContents(), "" );
|
||||
os << escape(p.getCommand());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -168,3 +154,11 @@ void InsetRef::Validate(LaTeXFeatures & features) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetRef::gotoLabel()
|
||||
{
|
||||
if (master) {
|
||||
master->getUser()->gotoLabel(getContents());
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,8 @@
|
||||
#endif
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include "buffer.h"
|
||||
|
||||
class Buffer;
|
||||
struct LaTeXFeatures;
|
||||
|
||||
/** The reference inset
|
||||
@ -43,28 +43,20 @@ public:
|
||||
};
|
||||
|
||||
///
|
||||
InsetRef() : InsetCommand("ref") { flag = InsetRef::REF; }
|
||||
InsetRef(InsetCommandParams const &, Buffer *);
|
||||
///
|
||||
InsetRef(string const &, Buffer *);
|
||||
Inset * Clone() const { return new InsetRef(params(), master); }
|
||||
///
|
||||
InsetRef(InsetCommand const &, Buffer *);
|
||||
///
|
||||
Inset * Clone() const {
|
||||
return new InsetRef (getCommand(), master);
|
||||
}
|
||||
string getScreenLabel() const;
|
||||
///
|
||||
EDITABLE Editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
Inset::Code LyxCode() const { return Inset::REF_CODE; }
|
||||
///
|
||||
void Edit(BufferView *, int, int, unsigned int);
|
||||
///
|
||||
EDITABLE Editable() const {
|
||||
return IS_EDITABLE;
|
||||
}
|
||||
///
|
||||
bool display() const { return false; }
|
||||
///
|
||||
string getScreenLabel() const;
|
||||
///
|
||||
void Toggle();
|
||||
///
|
||||
void gotoLabel();
|
||||
@ -89,13 +81,4 @@ private:
|
||||
///
|
||||
Buffer * master;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
void InsetRef::gotoLabel()
|
||||
{
|
||||
if (master) {
|
||||
master->getUser()->gotoLabel(getContents());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -17,11 +17,10 @@
|
||||
#endif
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include "support/utility.hpp"
|
||||
|
||||
/** Used to insert table of contents
|
||||
*/
|
||||
class InsetTOC : public InsetCommand, public noncopyable {
|
||||
class InsetTOC : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetTOC(InsetCommandParams const & p) : InsetCommand(p) {}
|
||||
|
@ -16,13 +16,12 @@
|
||||
#endif
|
||||
|
||||
#include "insetcommand.h"
|
||||
#include "support/utility.hpp"
|
||||
|
||||
struct LaTeXFeatures;
|
||||
|
||||
/** The url inset
|
||||
*/
|
||||
class InsetUrl : public InsetCommand, public noncopyable {
|
||||
class InsetUrl : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
explicit
|
||||
|
25
src/lyx_cb.C
25
src/lyx_cb.C
@ -1145,9 +1145,9 @@ void MenuInsertLabel(char const * arg)
|
||||
}
|
||||
}
|
||||
if (!label.empty()) {
|
||||
InsetLabel * new_inset = new InsetLabel;
|
||||
new_inset->setContents(label);
|
||||
current_view->insertInset(new_inset);
|
||||
InsetCommandParams p( "label", label );
|
||||
InsetLabel * inset = new InsetLabel( p );
|
||||
current_view->insertInset( inset );
|
||||
}
|
||||
AllowInput(current_view);
|
||||
}
|
||||
@ -2928,19 +2928,16 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data)
|
||||
return;
|
||||
}
|
||||
|
||||
static string const commands[5]
|
||||
= { "\\ref", "\\pageref", "\\vref", "\\vpageref",
|
||||
"\\prettyref"};
|
||||
string t = commands[data];
|
||||
|
||||
static string const cmdname[5]
|
||||
= { "ref", "pageref", "vref", "vpageref", "prettyref"};
|
||||
InsetCommandParams p( cmdname[data] );
|
||||
p.setContents( s );
|
||||
|
||||
if (current_view->buffer()->isSGML())
|
||||
t += "[" + u + "]" + "{" + s + "}";
|
||||
else
|
||||
t += "{" + s + "}";
|
||||
p.setOptions( u );
|
||||
|
||||
Inset * new_inset =
|
||||
new InsetRef(t, current_view->buffer());
|
||||
current_view->insertInset(new_inset);
|
||||
Inset * inset = new InsetRef( p, current_view->buffer() );
|
||||
current_view->insertInset( inset );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2572,20 +2572,19 @@ string LyXFunc::Dispatch(int ac,
|
||||
// ale970405+lasgoutt970425
|
||||
// The argument can be up to two tokens separated
|
||||
// by a space. The first one is the bibstyle.
|
||||
string lsarg(argument);
|
||||
string bibstyle = token(lsarg, ' ', 1);
|
||||
string db = token(argument, ' ', 0);
|
||||
string bibstyle = token(argument, ' ', 1);
|
||||
if (bibstyle.empty())
|
||||
bibstyle = "plain";
|
||||
InsetBibtex * new_inset
|
||||
= new InsetBibtex(token(lsarg, ' ', 0),
|
||||
bibstyle,
|
||||
owner->buffer());
|
||||
|
||||
InsetCommandParams p( "BibTeX", db, bibstyle );
|
||||
InsetBibtex * inset = new InsetBibtex(p, owner->buffer());
|
||||
|
||||
if (owner->view()->insertInset(new_inset)) {
|
||||
if (lsarg.empty())
|
||||
new_inset->Edit(owner->view(), 0, 0, 0);
|
||||
if (owner->view()->insertInset(inset)) {
|
||||
if (argument.empty())
|
||||
inset->Edit(owner->view(), 0, 0, 0);
|
||||
} else
|
||||
delete new_inset;
|
||||
delete inset;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2621,28 +2620,22 @@ string LyXFunc::Dispatch(int ac,
|
||||
break;
|
||||
|
||||
case LFUN_INDEX_CREATE:
|
||||
case LFUN_INDEX_CREATE_LAST:
|
||||
{
|
||||
// Can't do that at the beginning of a paragraph.
|
||||
if (owner->view()->text->cursor.pos() - 1 < 0)
|
||||
break;
|
||||
|
||||
InsetCommandParams p( "index" );
|
||||
|
||||
if (!argument.empty()) {
|
||||
p.setContents( argument );
|
||||
} else {
|
||||
//get the current word for an argument
|
||||
LyXParagraph::size_type lastpos =
|
||||
if( argument.empty() ) {
|
||||
// Get the word immediately preceding the cursor
|
||||
LyXParagraph::size_type curpos =
|
||||
owner->view()->text->cursor.pos() - 1;
|
||||
// Get the current word. note that this must be done
|
||||
// before inserting the inset, or the inset will
|
||||
// break the word
|
||||
string curstring(owner->view()
|
||||
->text->cursor.par()->GetWord(lastpos));
|
||||
|
||||
//make the new inset and write the current word into it
|
||||
string curstring;
|
||||
if( curpos >= 0 )
|
||||
curstring = owner->view()->text
|
||||
->cursor.par()->GetWord(curpos);
|
||||
|
||||
p.setContents( curstring );
|
||||
} else {
|
||||
p.setContents( argument );
|
||||
}
|
||||
|
||||
owner->getDialogs()->createIndex( p.getAsString() );
|
||||
@ -2653,8 +2646,29 @@ string LyXFunc::Dispatch(int ac,
|
||||
{
|
||||
InsetCommandParams p;
|
||||
p.setFromString( argument );
|
||||
|
||||
InsetIndex * inset = new InsetIndex( p );
|
||||
|
||||
if (!owner->view()->insertInset(inset))
|
||||
delete inset;
|
||||
else
|
||||
owner->view()->updateInset( inset, true );
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INDEX_INSERT_LAST:
|
||||
{
|
||||
// Get word immediately preceding the cursor
|
||||
LyXParagraph::size_type curpos =
|
||||
owner->view()->text->cursor.pos() - 1;
|
||||
// Can't do that at the beginning of a paragraph
|
||||
if( curpos < 0 ) break;
|
||||
|
||||
string curstring( owner->view()->text
|
||||
->cursor.par()->GetWord(curpos) );
|
||||
|
||||
InsetCommandParams p( "index", curstring );
|
||||
InsetIndex * inset = new InsetIndex( p );
|
||||
|
||||
if (!owner->view()->insertInset(inset))
|
||||
delete inset;
|
||||
else
|
||||
@ -2664,7 +2678,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
case LFUN_INDEX_PRINT:
|
||||
{
|
||||
InsetCommandParams p("printindex");
|
||||
InsetCommandParams p( "printindex" );
|
||||
Inset * inset = new InsetPrintIndex(p);
|
||||
if (!owner->view()->insertInset(inset, "Standard", true))
|
||||
delete inset;
|
||||
@ -2674,20 +2688,21 @@ string LyXFunc::Dispatch(int ac,
|
||||
case LFUN_PARENTINSERT:
|
||||
{
|
||||
lyxerr << "arg " << argument << endl;
|
||||
Inset * new_inset = new InsetParent(argument, owner->buffer());
|
||||
if (!owner->view()->insertInset(new_inset, "Standard", true))
|
||||
delete new_inset;
|
||||
InsetCommandParams p( "lyxparent", argument );
|
||||
Inset * inset = new InsetParent(p, owner->buffer());
|
||||
if (!owner->view()->insertInset(inset, "Standard", true))
|
||||
delete inset;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CHILDINSERT:
|
||||
{
|
||||
Inset * new_inset = new InsetInclude(argument,
|
||||
owner->buffer());
|
||||
if (owner->view()->insertInset(new_inset, "Standard", true))
|
||||
new_inset->Edit(owner->view(), 0, 0, 0);
|
||||
InsetCommandParams p( "Include", argument );
|
||||
Inset * inset = new InsetInclude(p, owner->buffer());
|
||||
if (owner->view()->insertInset(inset, "Standard", true))
|
||||
inset->Edit(owner->view(), 0, 0, 0);
|
||||
else
|
||||
delete new_inset;
|
||||
delete inset;
|
||||
}
|
||||
break;
|
||||
|
||||
|
12
src/menus.C
12
src/menus.C
@ -1563,11 +1563,11 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
|
||||
men->_view->getLyXFunc()->Dispatch(LFUN_REFGOTO,
|
||||
label_list[num].c_str());
|
||||
else {
|
||||
static string const commands[5]
|
||||
= { "\\ref", "\\pageref", "\\vref", "\\vpageref",
|
||||
"\\prettyref"};
|
||||
string t = commands[type] + "{" + label_list[num] + "}";
|
||||
men->currentView()->insertInset(new InsetRef(t, buffer));
|
||||
static string const cmdname[5]
|
||||
= { "ref", "pageref", "vref", "vpageref", "prettyref"};
|
||||
InsetCommandParams p( cmdname[type] );
|
||||
p.setContents( label_list[num] );
|
||||
men->currentView()->insertInset(new InsetRef(p, buffer));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1901,7 +1901,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
|
||||
case 14: tmpfunc->Dispatch(LFUN_INSERT_REF); break;
|
||||
case 15: tmpfunc->Dispatch(LFUN_CITATION_CREATE); break;
|
||||
case 16: tmpfunc->Dispatch(LFUN_INDEX_CREATE); break;
|
||||
case 17: tmpfunc->Dispatch(LFUN_INDEX_CREATE_LAST); break;
|
||||
case 17: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;
|
||||
case 18: tmpfunc->Dispatch(LFUN_URL); break;
|
||||
}
|
||||
}
|
||||
|
@ -1651,8 +1651,10 @@ LyXParagraph * LyXParagraph::Clone() const
|
||||
result->inset_owner = inset_owner;
|
||||
|
||||
// ale970302
|
||||
result->bibkey = (bibkey) ? new InsetBibKey(bibkey): 0;
|
||||
|
||||
if (bibkey)
|
||||
result->bibkey = static_cast<InsetBibKey *>(bibkey->Clone());
|
||||
else
|
||||
result->bibkey = 0;
|
||||
|
||||
// copy everything behind the break-position to the new paragraph
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// $Id: strerror.c,v 1.2 1999/10/02 16:21:10 larsbj Exp $
|
||||
/* $Id: strerror.c,v 1.3 2000/08/04 13:12:30 lasgouttes Exp $ */
|
||||
|
||||
#if !defined(lint) && !defined(WITH_WARNINGS)
|
||||
static char vcid[] = "$Id: strerror.c,v 1.2 1999/10/02 16:21:10 larsbj Exp $";
|
||||
static char vcid[] = "$Id: strerror.c,v 1.3 2000/08/04 13:12:30 lasgouttes Exp $";
|
||||
#endif /* lint */
|
||||
|
||||
extern int sys_nerr ;
|
||||
|
@ -53,8 +53,8 @@ void TexRow::newline()
|
||||
|
||||
void TexRow::getIdFromRow(int row, int & id, int & pos) const
|
||||
{
|
||||
RowList::const_iterator cit = rowlist.begin();
|
||||
RowList::const_iterator end = rowlist.end();
|
||||
RowList::iterator cit = rowlist.begin();
|
||||
RowList::iterator end = rowlist.end();
|
||||
for (; cit != end; ++cit) {
|
||||
if ((*cit).rownumber() == row) break;
|
||||
}
|
||||
|
@ -2027,8 +2027,10 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
|
||||
int i = LABEL_COUNTER_ENUMI - LABEL_COUNTER_CHAPTER + par->enumdepth;
|
||||
par->incCounter(i);
|
||||
int number = par->getCounter(i);
|
||||
if (!par->bibkey)
|
||||
par->bibkey = new InsetBibKey();
|
||||
if (!par->bibkey) {
|
||||
InsetCommandParams p( "bibitem" );
|
||||
par->bibkey = new InsetBibKey(p);
|
||||
}
|
||||
par->bibkey->setCounter(number);
|
||||
par->labelstring = layout.labelstring();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user