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