]> git.lyx.org Git - lyx.git/blob - src/insets/insetparent.C
the lfun3 patches (overall cleanup and "localizing" dispatch() in mathed)
[lyx.git] / src / insets / insetparent.C
1 /* This file is part of*
2  * ======================================================
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 1997-2001 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 "frontends/LyXView.h"
24 #include "support/LOstream.h"
25 #include "funcrequest.h"
26 #include "buffer.h"
27 #include "gettext.h"
28
29 using std::ostream;
30
31
32 InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
33         : InsetCommand(p)
34 {
35         string const fn = p.getContents();
36         setContents(MakeAbsPath(fn, bf.filePath()));
37 }
38
39
40 string const InsetParent::getScreenLabel(Buffer const *) const
41 {
42         return string(_("Parent:")) + getContents();
43 }
44
45
46 void InsetParent::edit(BufferView * bv, int, int, mouse_button::state)
47 {    
48         bv->owner()->dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
49 }
50
51
52 void InsetParent::edit(BufferView * bv, bool)
53 {
54         edit(bv, 0, 0, mouse_button::none);
55 }
56
57
58 // LaTeX must just ignore this command
59 int InsetParent::latex(Buffer const * buf, ostream & os,
60                        bool fragile, bool free_spc) const
61 {
62         os << "%%#{lyx}";
63         InsetCommand::latex(buf, os, fragile, free_spc);
64         return 0;
65 }