]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/Kernel.h
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / Kernel.h
index 9e35603ef218a0dc0d0cb74a6e32ff2b21432d48..f046c7f1509785478a4402783f9f22f2703a23f1 100644 (file)
 #ifndef KERNEL_H
 #define KERNEL_H
 
-
-#include "LString.h"
-
+#include <string>
 
 class Buffer;
 class BufferView;
 class FuncRequest;
 class LyXView;
 
+namespace lyx {
+namespace frontend {
 
 /** \c Kernel is a wrapper making the LyX kernel available to the dialog.
  * (Ie, it provides an interface to the Model part of the Model-Controller-
@@ -33,21 +33,19 @@ public:
        /// \param lv is the access point for the dialog to the LyX kernel.
        Kernel(LyXView & lv);
 
-       /** This method is the primary puypose of the class. It provides
+       /** This method is the primary purpose of the class. It provides
         *  the "gateway" by which the dialog can send a request (of a
         *  change in the data, for more information) to the kernel.
         *  \param fr is the encoding of the request.
-        *  \param verbose is set to true if the completed action should
-        *  be displayed in the minibuffer.
         */
-       void dispatch(FuncRequest const & fr, bool verbose = false) const;
+       void dispatch(FuncRequest const & fr) const;
 
        /** The dialog has received a request from the user
-        *  (who pressed the "Restore" buuton) to update contents.
+        *  (who pressed the "Restore" button) to update contents.
         *  It must, therefore, ask the kernel to provide this information.
         *  \param name is used to identify the dialog to the kernel.
         */
-       void updateDialog(string const & name) const;
+       void updateDialog(std::string const & name) const;
 
        /** A request from the Controller that future changes to the data
         *  stored by the dialog are not applied to the inset currently
@@ -55,7 +53,7 @@ public:
         *  a new inset at the cursor position.
         *  \param name is used to identify the dialog to the kernel.
         */
-       void disconnect(string const & name) const;
+       void disconnect(std::string const & name) const;
 
        /** \name Kernel Wrappers
         *  Simple wrapper functions to Buffer methods.
@@ -63,22 +61,26 @@ public:
        //@{
        bool isBufferAvailable() const;
        bool isBufferReadonly() const;
-       string const bufferFilepath() const;
+       std::string const bufferFilepath() const;
        //@}
 
-       /** \enum DocTypes used to flag the different kinds of buffer
+       /** \enum DocType used to flag the different kinds of buffer
         *  without making the kernel header files available to the
         *  dialog's Controller or View.
         */
-       enum DocTypes {
+       enum DocType {
                LATEX,
                LITERATE,
                LINUXDOC,
                DOCBOOK
        };
        /// The type of the current buffer.
-       DocTypes docType() const;
+       DocType docType() const;
 
+       /** A request that the GUI be redrawn,
+        *  e.g. because the colors have been remapped.
+        */
+       void redrawGUI() const;
 
        /** \name Kernel Nasties
         *  Unpleasantly public internals of the LyX kernel.
@@ -100,4 +102,19 @@ private:
 };
 
 
+/** \c KernelDocType is a wrapper for Kernel::DocType.
+ *  It can be forward-declared and passed as a function argument without
+ *  having to expose Kernel.h.
+ */
+class KernelDocType {
+public:
+       KernelDocType(Kernel::DocType val) : val_(val) {}
+       operator Kernel::DocType() const { return val_; }
+private:
+       Kernel::DocType val_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
 #endif // KERNEL_H