]> git.lyx.org Git - lyx.git/blob - src/insets/insetparent.C
d94d1227a42194c1e875ee8fb9ea995ec212190d
[lyx.git] / src / insets / insetparent.C
1 /* This file is part of*
2  * ======================================================
3  *
4  *           LyX, The Document Processor
5  *       
6  *          Copyright (C) 1997-1998 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
27
28 extern BufferView *current_view;
29
30
31 InsetParent::InsetParent(string fn, Buffer* owner): InsetCommand("lyxparent")
32 {
33     if (owner)
34         setContents(MakeAbsPath(fn, OnlyPath(owner->getFileName())));
35     else
36         setContents(fn);
37 }
38
39 void InsetParent::Edit(int, int)
40 {    
41     current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_CHILDOPEN, 
42                                                      getContents().c_str());
43 }
44
45 // LaTeX must just ignore this command
46 int InsetParent::Latex(FILE *file, signed char fragile)
47 {
48     fprintf(file, "%%#{lyx}");
49     InsetCommand::Latex(file, fragile);
50     return 0;
51 }
52
53 // LaTeX must just ignore this command
54 int InsetParent::Latex(string &file, signed char fragile)
55 {
56     file += "%%#{lyx}";
57     InsetCommand::Latex(file, fragile);
58     return 0;
59 }