]> git.lyx.org Git - lyx.git/blob - src/insets/insetparent.C
Another clean-up patch from Angus
[lyx.git] / src / insets / insetparent.C
1 /* This file is part of*
2  * ====================================================== 
3  *
4  *           LyX, The Document Processor
5  *       
6  *           Copyright 1997-2000 The LyX Team.
7  * 
8  * ====================================================== */
9
10
11 // Created by asierra 970813
12
13 #include <config.h>
14
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include "insetparent.h"
21 #include "support/filetools.h"
22 #include "BufferView.h"
23 #include "LyXView.h"
24 #include "lyxfunc.h"
25 #include "commandtags.h"
26 #include "buffer.h"
27 #include "gettext.h"
28
29 using std::ostream;
30
31 InsetParent::InsetParent(InsetCommandParams const & p, Buffer * bf)
32         : InsetCommand(p)
33 {
34         string fn = p.getContents();
35         if (bf)
36                 setContents(MakeAbsPath(fn, OnlyPath(bf->fileName())));
37         else
38                 setContents(fn);
39 }
40
41
42 string InsetParent::getScreenLabel() const 
43 {
44         return string(_("Parent:")) + getContents();
45 }
46
47
48 void InsetParent::Edit(BufferView * bv, int, int, unsigned int)
49 {    
50         bv->owner()->getLyXFunc()->
51                 Dispatch(LFUN_CHILDOPEN, getContents().c_str());
52 }
53
54
55 // LaTeX must just ignore this command
56 int InsetParent::Latex(Buffer const * buf, ostream & os,
57                        bool fragile, bool free_spc) const
58 {
59         os << "%%#{lyx}";
60         InsetCommand::Latex(buf, os, fragile, free_spc);
61         return 0;
62 }