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