]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/lyx_gui.C
Missing files, get keyboard partly working
[lyx.git] / src / frontends / qt2 / lyx_gui.C
1 /**
2  * \file lyx_gui.C
3  * Copyright 2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author unknown
7  * \author John Levon <moz@compsoc.man.ac.uk>
8  */
9
10 #include <config.h>
11  
12 #include "lyx_gui.h"
13  
14 #include "support/lyxlib.h"
15 #include "support/os.h"
16 #include "support/filetools.h"
17  
18 #include "debug.h"
19 #include "gettext.h"
20  
21 #include "lyx_main.h"
22 #include "lyxrc.h"
23
24 // FIXME: move this stuff out again
25 #include "bufferlist.h"
26 #include "lyxfunc.h"
27 #include "lyxserver.h"
28 #include "BufferView.h"
29 #include "QtView.h"
30  
31 #include <fcntl.h>
32
33 #include <boost/bind.hpp>
34  
35 #include <qapplication.h>
36  
37 #ifndef CXX_GLOBAL_CSTD
38 using std::exit;
39 #endif
40
41 using std::vector;
42 using std::hex;
43 using std::endl;
44  
45 extern bool finished;
46 extern BufferList bufferlist;
47  
48 // FIXME: wrong place !
49 LyXServer * lyxserver;
50  
51 void lyx_gui::parse_init(int & argc, char * argv[])
52 {
53         static QApplication a(argc, argv);
54 }
55  
56
57 void lyx_gui::parse_lyxrc()
58 {
59         // FIXME !!!! 
60         lyxrc.dpi = 95;
61 }
62
63  
64 void lyx_gui::start(string const & batch, vector<string> files)
65 {
66         // initial geometry
67         int xpos = -1;
68         int ypos = -1;
69         unsigned int width = 690;
70         unsigned int height = 510;
71  
72         QtView view(width, height);
73         view.show(xpos, ypos, "LyX");
74         view.init();
75
76         Buffer * last = 0;
77  
78         // FIXME: some code below needs moving
79
80         lyxserver = new LyXServer(view.getLyXFunc(), lyxrc.lyxpipes);
81  
82         vector<string>::const_iterator cit = files.begin();
83         vector<string>::const_iterator end = files.end();
84         for (; cit != end; ++cit) {
85                 Buffer * b = bufferlist.loadLyXFile(*cit);
86                 if (b) {
87                         last = b;
88                 }
89         }
90
91         // switch to the last buffer successfully loaded
92         if (last) {
93                 view.view()->buffer(last);
94         }
95
96         // handle the batch commands the user asked for
97         if (!batch.empty()) {
98                 view.getLyXFunc()->verboseDispatch(batch, false);
99         }
100
101         while (!finished) {
102                 qApp->processEvents();
103         }
104                  
105         // FIXME 
106         delete lyxserver;
107 }
108  
109  
110 void lyx_gui::init_graphics()
111 {
112         // FIXME
113 }