]> git.lyx.org Git - lyx.git/blob - src/insets/insetparent.C
use boost::format
[lyx.git] / src / insets / insetparent.C
1 /**
2  * \file insetparent.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11
12 // Created by asierra 970813
13
14 #include <config.h>
15
16
17 #ifdef __GNUG__
18 #pragma implementation
19 #endif
20
21 #include "insetparent.h"
22 #include "support/filetools.h"
23 #include "BufferView.h"
24 #include "frontends/LyXView.h"
25 #include "support/LOstream.h"
26 #include "funcrequest.h"
27 #include "buffer.h"
28 #include "gettext.h"
29
30 #include "BoostFormat.h"
31
32 using std::ostream;
33
34
35 InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
36         : InsetCommand(p)
37 {
38         string const fn = p.getContents();
39         setContents(MakeAbsPath(fn, bf.filePath()));
40 }
41
42
43 string const InsetParent::getScreenLabel(Buffer const *) const
44 {
45         return boost::io::str(boost::format(_("Parent: %1$s")) % getContents());
46 }
47
48
49 void InsetParent::edit(BufferView * bv, int, int, mouse_button::state)
50 {
51         bv->owner()->dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
52 }
53
54
55 void InsetParent::edit(BufferView * bv, bool)
56 {
57         edit(bv, 0, 0, mouse_button::none);
58 }
59
60
61 // LaTeX must just ignore this command
62 int InsetParent::latex(Buffer const * buf, ostream & os,
63                        bool fragile, bool free_spc) const
64 {
65         os << "%%#{lyx}";
66         InsetCommand::latex(buf, os, fragile, free_spc);
67         return 0;
68 }