]> git.lyx.org Git - lyx.git/blob - src/LyXView.h
Angus insetindex patch + protect patch from Dekel
[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
21 #include "Timeout.h"
22 #include "support/utility.hpp"
23
24 // uncomment this line to try out the new menus
25 #define NEW_MENUBAR 1
26
27 class LyXFunc;
28 class Toolbar;
29 class MiniBuffer;
30 class Intl;
31 class Buffer;
32 #ifdef NEW_MENUBAR
33 class Menubar;
34 #else
35 class Menus;
36 #endif
37
38 class BufferView;
39 class Dialogs;
40
41 #ifdef SIGC_CXX_NAMESPACES
42 using SigC::Object;
43 #endif
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 : public Object, public noncopyable {
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;
73
74         ///
75         BufferView * view() const;
76
77         /// returns a pointer to the form.
78         FL_FORM * getForm() const;
79
80         /// return a pointer to the toolbar
81         Toolbar * getToolbar() const;
82
83         /// sets the layout in the toolbar layout combox
84         void setLayout(int layout);
85
86         /// update the toolbar
87         void updateToolbar();
88
89         /// return a pointer to the lyxfunc
90         LyXFunc * getLyXFunc() const;
91
92         /// return a pointer to the minibuffer
93         MiniBuffer * getMiniBuffer() const;
94
95 #ifdef NEW_MENUBAR
96         ///
97         Menubar * getMenubar() const;
98
99         ///
100         void updateMenubar();
101 #else
102         ///
103         Menus * getMenus() const;
104 #endif
105         ///
106         Intl * getIntl() const;
107
108         ///
109         Dialogs * getDialogs() { return dialogs_; }
110
111         ///
112         void updateLayoutChoice();
113
114         /// Updates the title of the window
115         void updateWindowTitle();
116
117
118         /// Show state (toolbar and font in minibuffer)
119         void showState();
120
121         /// Reset autosave timer
122         void resetAutosaveTimer();
123 private:
124         /// 
125         LyXFunc * lyxfunc;
126         /// 
127         Toolbar * toolbar;
128         /// 
129         MiniBuffer * minibuffer;
130 #ifdef NEW_MENUBAR
131         ///
132         Menubar * menubar;
133 #else
134         ///
135         Menus * menus;
136 #endif
137         ///
138         Intl * intl;
139         ///
140         Dialogs * dialogs_;
141
142         /** This is supposed to be a pointer or a list of pointers to the
143            BufferViews currently being shown in the LyXView. So far
144            this is not used, but that should change pretty soon. (Lgb) */
145         BufferView * bufferview;
146         ///
147         void invalidateLayoutChoice();
148         ///
149         void UpdateDocumentClassChoice();
150 public:
151         ///
152         static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
153         /** This callback is run when a close event is sent from the
154           window manager. */
155         static int atCloseMainFormCB(FL_FORM *, void *);
156         /// A callback
157         void AutoSave();
158 private:
159         ///
160         Timeout autosave_timeout;
161         /// makes the main form.
162         void create_form_form_main(int width, int height);
163         /// A pointer to the form.      
164         FL_FORM * form_;
165         /** The last textclass layout list in the layout choice selector
166           This should probably be moved to the toolbar, but for now it's
167         here. (Asger) */
168         int last_textclass;
169 };
170 #endif