2002-09-25 14:26:13 +00:00
|
|
|
/**
|
|
|
|
* \file insetparent.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* \author Alejandro Aguilar Sierra
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Created by asierra 970813
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "insetparent.h"
|
1999-10-02 16:21:10 +00:00
|
|
|
#include "support/filetools.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "BufferView.h"
|
2002-05-23 12:08:47 +00:00
|
|
|
#include "frontends/LyXView.h"
|
2001-07-30 13:35:08 +00:00
|
|
|
#include "support/LOstream.h"
|
2002-08-07 08:11:41 +00:00
|
|
|
#include "funcrequest.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
#include "buffer.h"
|
2000-07-14 07:52:03 +00:00
|
|
|
#include "gettext.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2003-03-30 20:25:44 +00:00
|
|
|
#include "support/BoostFormat.h"
|
2002-11-21 18:33:09 +00:00
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
using std::ostream;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
|
2001-07-06 15:57:54 +00:00
|
|
|
InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
|
2000-08-04 13:12:30 +00:00
|
|
|
: InsetCommand(p)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2000-11-04 10:00:12 +00:00
|
|
|
string const fn = p.getContents();
|
2002-01-14 23:31:23 +00:00
|
|
|
setContents(MakeAbsPath(fn, bf.filePath()));
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
1999-12-07 00:44:53 +00:00
|
|
|
|
2002-03-21 17:09:55 +00:00
|
|
|
string const InsetParent::getScreenLabel(Buffer const *) const
|
2000-04-04 00:19:15 +00:00
|
|
|
{
|
2002-11-24 15:20:31 +00:00
|
|
|
#if USE_BOOST_FORMAT
|
|
|
|
return boost::io::str(boost::format(_("Parent: %s")) % getContents());
|
|
|
|
#else
|
|
|
|
return _("Parent: ") + getContents();
|
|
|
|
#endif
|
2000-04-04 00:19:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-26 17:33:14 +00:00
|
|
|
void InsetParent::edit(BufferView * bv, int, int, mouse_button::state)
|
2002-11-21 18:33:09 +00:00
|
|
|
{
|
2002-08-13 17:43:40 +00:00
|
|
|
bv->owner()->dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
1999-12-07 00:44:53 +00:00
|
|
|
|
2001-07-20 14:18:48 +00:00
|
|
|
void InsetParent::edit(BufferView * bv, bool)
|
|
|
|
{
|
2002-05-26 17:33:14 +00:00
|
|
|
edit(bv, 0, 0, mouse_button::none);
|
2001-07-20 14:18:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// LaTeX must just ignore this command
|
2001-06-28 10:25:20 +00:00
|
|
|
int InsetParent::latex(Buffer const * buf, ostream & os,
|
2000-04-19 01:42:55 +00:00
|
|
|
bool fragile, bool free_spc) const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
1999-12-07 00:44:53 +00:00
|
|
|
os << "%%#{lyx}";
|
2001-06-28 10:25:20 +00:00
|
|
|
InsetCommand::latex(buf, os, fragile, free_spc);
|
1999-12-07 00:44:53 +00:00
|
|
|
return 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|