]> git.lyx.org Git - lyx.git/blob - src/LyXView.h
the runlatex merge
[lyx.git] / src / LyXView.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-1998 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef LyXView_H
13 #define LyXView_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include FORMS_H_LOCATION
20 #include "lyx.h"
21 #include "buffer.h"
22 #include "menus.h"
23 #include "BufferView.h"
24 #include "layout.h"
25
26 class LyXFunc;
27 class Toolbar;
28 class MiniBuffer;
29 class Intl;
30
31 ///
32 struct  FD_form_main {
33         ///
34         FL_FORM *form_main;
35         ///
36         FL_OBJECT *timer_autosave;
37         ///
38         FL_OBJECT *timer_update;
39         ///
40         void *vdata;
41         ///
42         long ldata;
43 };
44
45
46
47 /**
48   This class is the form containing the view of the buffer. The actual buffer
49   view is supposed (at least IMHO) to be another class, that shows its output
50   in one or more LyXView's.
51  */
52 class LyXView {
53 public:
54         /// constructor
55         LyXView(int w, int h);
56
57         /// destructor
58         ~LyXView();
59
60         /// Where to place the form.
61         void setPosition(int, int);
62
63         /// Show the main form.
64         void show(int, int, char const * t= "LyX");
65
66         /// init (should probably be removed later) (Lgb)
67         void init();
68
69         /// Redraw the main form.
70         void redraw();
71
72         /// returns the buffer currently shown in the main form.
73         Buffer * currentBuffer(){ return bufferview->currentBuffer();}
74
75         ///
76         BufferView * currentView() { return bufferview; }
77
78         /// returns a pointer to the form.
79         FL_FORM * getForm() { return _form; }
80
81         /// return a pointer to the toolbar
82         Toolbar * getToolbar() { return toolbar; }
83
84         /// return a pointer to the lyxfunc
85         LyXFunc * getLyXFunc() { return lyxfunc; }
86
87         /// return a pointer to the minibuffer
88         MiniBuffer * getMiniBuffer() { return minibuffer; }
89
90         ///
91         Menus * getMenus() { return menus; }
92
93         ///
94         Intl * getIntl() { return intl; }
95
96         ///
97         void updateLayoutChoice();
98
99         /// Updates the title of the window
100         void updateWindowTitle();
101
102         /// Reset autosave timer
103         void resetAutosaveTimer();
104 private:
105         /// 
106         LyXFunc * lyxfunc;
107         /// 
108         Toolbar * toolbar;
109         /// 
110         MiniBuffer * minibuffer;
111         ///
112         Menus * menus;
113         ///
114         Intl * intl;
115
116         /** This is supposed to be a pointer or a list of pointers to the
117            BufferViews currently being shown in the LyXView. So far
118            this is not used, but that should change pretty soon. (Lgb) */
119         BufferView * bufferview;
120         ///
121         void invalidateLayoutChoice();
122         ///
123         void UpdateDocumentClassChoice();
124 public:
125         ///
126         static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
127         /** This callback is run when a close event is sent from the
128           window manager. */
129         static int atCloseMainFormCB(FL_FORM *, void *);
130         /// A callback
131         static void AutosaveTimerCB(FL_OBJECT *, long);
132         /// A callback
133         static void UpdateTimerCB(FL_OBJECT *, long);
134 private:
135         /// makes the main form.
136         FD_form_main * create_form_form_main(int width, int height);
137         /// A pointer to the form.      
138         FD_form_main * _form_main;
139         /// A pointer to the form.      
140         FL_FORM * _form;
141
142         /** The last textclass layout list in the layout choice selector
143           This should probably be moved to the toolbar, but for now it's
144         here. (Asger) */
145         int last_textclass;
146 };
147 #endif