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