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