]> git.lyx.org Git - lyx.git/blobdiff - src/LyXView.h
fix to #241 and #300 from John
[lyx.git] / src / LyXView.h
index 0f6d4597925f5df608b69d58847c72ed4f2c1924..425469ac881ca230a89b78dba943f86272fd89c6 100644 (file)
@@ -1,97 +1,86 @@
 // -*- C++ -*-
-/* This file is part of
- * ======================================================
- * 
- *           LyX, The Document Processor
- *        
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-1998 The LyX Team.
- *
- * ====================================================== */
-
-#ifndef LyXView_H
-#define LyXView_H
+
+#ifndef LYXVIEW_BASE_H
+#define LYXVIEW_BASE_H
 
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-#include FORMS_H_LOCATION
-#include "lyx.h"
-#include "buffer.h"
-#include "menus.h"
-#include "BufferView.h"
-#include "layout.h"
+#include <boost/utility.hpp>
+#include <sigc++/signal_system.h>
 
-class LyXFunc;
+#include "LString.h"
+#include "support/types.h"
+
+class Buffer;
 class Toolbar;
 class MiniBuffer;
 class Intl;
+class Menubar;
+
+class BufferView;
+class Dialogs;
+class LyXFunc;
+class Timeout;
 
 ///
-struct  FD_form_main {
+class LyXView : public SigC::Object, boost::noncopyable {
+public:
        ///
-       FL_FORM *form_main;
+       LyXView();
        ///
-       FL_OBJECT *timer_autosave;
+       virtual ~LyXView();
        ///
-       FL_OBJECT *timer_update;
+       virtual void init() = 0;
        ///
-       void *vdata;
+       virtual void setPosition(int, int) = 0;
        ///
-       long ldata;
-};
-
-
-
-/**
-  This class is the form containing the view of the buffer. The actual buffer
-  view is supposed (at least IMHO) to be another class, that shows its output
-  in one or more LyXView's.
- */
-class LyXView {
-public:
-       /// constructor
-       LyXView(int w, int h);
-
-       /// destructor
-       ~LyXView();
-
-       /// Where to place the form.
-       void setPosition(int, int);
-
-       /// Show the main form.
-       void show(int, int, char const * t= "LyX");
-
-       /// init (should probably be removed later) (Lgb)
-       void init();
-
+       virtual void show(int, int, string const &) = 0;
        /// Redraw the main form.
-       void redraw();
+       virtual void redraw() = 0;
+
+       /// Resize all BufferViews in this LyXView (because the width changed)
+       void resize();
 
        /// returns the buffer currently shown in the main form.
-       Buffer * currentBuffer(){ return bufferview->currentBuffer();}
+       Buffer * buffer() const;
 
        ///
-       BufferView * currentView() { return bufferview; }
-
-       /// returns a pointer to the form.
-       FL_FORM * getForm() { return _form; }
+       BufferView * view() const;
 
        /// return a pointer to the toolbar
-       Toolbar * getToolbar() { return toolbar; }
+       Toolbar * getToolbar() const;
+
+       /// sets the layout in the toolbar layout combox
+       void setLayout(string const & layout);
+       /// update the toolbar
+       void updateToolbar();
 
        /// return a pointer to the lyxfunc
-       LyXFunc * getLyXFunc() { return lyxfunc; }
+       LyXFunc * getLyXFunc() const;
 
        /// return a pointer to the minibuffer
-       MiniBuffer * getMiniBuffer() { return minibuffer; }
+       MiniBuffer * getMiniBuffer() const;
+
+       ///
+       void message(string const &);
+       ///
+       void messagePush(string const & str);
+       ///
+       void messagePop();
+
+       ///
+       Menubar * getMenubar() const;
 
        ///
-       Menus * getMenus() { return menus; }
+       void updateMenubar();
 
        ///
-       Intl * getIntl() { return intl; }
+       Intl * getIntl() const;
+
+       ///
+       Dialogs * getDialogs() { return dialogs_; }
 
        ///
        void updateLayoutChoice();
@@ -99,46 +88,41 @@ public:
        /// Updates the title of the window
        void updateWindowTitle();
 
+       /// Show state (toolbar and font in minibuffer)
+       void showState();
+
        /// Reset autosave timer
        void resetAutosaveTimer();
-private:
-       /// 
-       LyXFunc * lyxfunc;
-       /// 
-       Toolbar * toolbar;
-       /// 
-       MiniBuffer * minibuffer;
        ///
-       Menus * menus;
+       virtual void prohibitInput() const = 0;
        ///
-       Intl * intl;
-
+       virtual void allowInput() const = 0;
+protected:
+       ///
+       Menubar * menubar;
+       ///
+       Toolbar * toolbar;
        /** This is supposed to be a pointer or a list of pointers to the
           BufferViews currently being shown in the LyXView. So far
           this is not used, but that should change pretty soon. (Lgb) */
        BufferView * bufferview;
        ///
-       void invalidateLayoutChoice();
+       MiniBuffer * minibuffer;
        ///
-       void UpdateDocumentClassChoice();
-public:
-       ///
-       static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
-       /** This callback is run when a close event is sent from the
-         window manager. */
-       static int atCloseMainFormCB(FL_FORM *, void *);
-       /// A callback
-       static void AutosaveTimerCB(FL_OBJECT *, long);
+       Intl * intl;
+       ///
+       Timeout * autosave_timeout;
        /// A callback
-       static void UpdateTimerCB(FL_OBJECT *, long);
+       void AutoSave();
+       ///
+       void invalidateLayoutChoice();
 private:
-       /// makes the main form.
-       FD_form_main * create_form_form_main(int width, int height);
-       /// A pointer to the form.      
-       FD_form_main * _form_main;
-       /// A pointer to the form.      
-       FL_FORM * _form;
-
+       ///
+       LyXFunc * lyxfunc;
+       ///
+       Dialogs * dialogs_;
+       ///
+       virtual void setWindowTitle(string const &, string const &) = 0;
        /** The last textclass layout list in the layout choice selector
          This should probably be moved to the toolbar, but for now it's
        here. (Asger) */