]> git.lyx.org Git - features.git/blob - src/frontends/Application.C
22417f7ed605b2f9f19b56e6cb3c5fe5dc5f8a6d
[features.git] / src / frontends / Application.C
1 /**
2  * \file frontend/Application.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Abdelrazak Younes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "Application.h"
14
15 #include "funcrequest.h"
16 #include "LyXAction.h"
17 #include "lyxrc.h"
18 #include "LyXView.h"
19
20 #include "support/lstrings.h"
21 #include "support/os.h"
22 #include "support/package.h"
23
24 #include <boost/scoped_ptr.hpp>
25
26 using lyx::support::package;
27
28 namespace lyx {
29 namespace frontend {
30
31
32 Application::Application(int &, char **)
33 {
34 }
35
36
37 LyXFunc & Application::lyxFunc()
38 {
39         return *lyxfunc_.get(); 
40 }
41
42
43 LyXFunc const & Application::lyxFunc() const
44 {
45         return *lyxfunc_.get(); 
46 }
47
48
49 LyXServer & Application::server()
50 {
51         return *lyx_server_.get(); 
52 }
53
54
55 LyXServer const & Application::server() const 
56 {
57         return *lyx_server_.get(); 
58 }
59
60
61 LyXServerSocket & Application::socket()
62 {
63         return *lyx_socket_.get();
64 }
65
66
67 LyXServerSocket const & Application::socket() const
68 {
69         return *lyx_socket_.get();
70 }
71
72
73 BufferList & Application::bufferList()
74 {
75         return buffer_list_;
76 }
77
78
79 BufferList const & Application::bufferList() const
80 {
81         return buffer_list_;
82 }
83
84
85 void Application::setBufferView(BufferView * buffer_view)
86 {
87         buffer_view_ = buffer_view;
88 }
89
90
91 int Application::start(std::string const & batch)
92 {
93         lyx_server_.reset(new LyXServer(lyxfunc_.get(), lyxrc.lyxpipes));
94         lyx_socket_.reset(new LyXServerSocket(lyxfunc_.get(), 
95                 lyx::support::os::internal_path(package().temp_dir() + "/lyxsocket")));
96
97         // handle the batch commands the user asked for
98         if (!batch.empty()) {
99                 lyxfunc_->dispatch(lyxaction.lookupFunc(batch));
100         }
101
102         return exec();
103 }
104
105
106 } // namespace frontend
107 } // namespace lyx