]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlEmbeddedFiles.cpp
Embedding: small adjustments of interfaces, single and double click in the embedding...
[lyx.git] / src / frontends / controllers / ControlEmbeddedFiles.cpp
1 /**
2  * \file ControlEmbeddedFiles.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Bo Peng
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "ControlEmbeddedFiles.h"
14
15 #include "Buffer.h"
16
17 #include "FuncRequest.h"
18 #include "gettext.h"
19 #include "debug.h"
20 #include "Format.h"
21
22 #include "frontends/LyXView.h"
23 #include "support/convert.h"
24
25 using std::string;
26
27 namespace lyx {
28 namespace frontend {
29
30 ControlEmbeddedFiles::ControlEmbeddedFiles(Dialog & parent)
31         : Dialog::Controller(parent), embedded_files(NULL)
32 {}
33
34
35 bool ControlEmbeddedFiles::initialiseParams(string const &)
36 {
37         return true;
38 }
39
40
41 void ControlEmbeddedFiles::updateEmbeddedFiles()
42 {
43         // copy buffer embeddedFiles to a local copy
44         kernel().buffer().embeddedFiles().update();
45         embedded_files = &kernel().buffer().embeddedFiles();
46 }
47
48
49 void ControlEmbeddedFiles::dispatchParams()
50 {
51         // lyx view will only be updated if we do something to the main window. :-)
52         kernel().dispatch(FuncRequest(LFUN_MESSAGE, message_));
53 }
54
55
56 void ControlEmbeddedFiles::goTo(EmbeddedFile const & item)
57 {
58         string const tmp = convert<string>(item.parID());
59         kernel().lyxview().dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
60 }
61
62
63 void ControlEmbeddedFiles::view(EmbeddedFile const & item)
64 {
65         formats.view(kernel().buffer(), item, formats.getFormatFromFile(item));
66 }
67
68 } // namespace frontend
69 } // namespace lyx