]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetInfo.h
More GuiInfo usability work
[lyx.git] / src / insets / InsetInfo.h
index ebe987b9cc671e78a54d0b68fbd4b1a07f82c47c..e1c42a7c91578573fe6694cb3d237e773049d0c1 100644 (file)
 #ifndef INSET_INFO_H
 #define INSET_INFO_H
 
-#include "InsetCollapsable.h"
-#include "Cursor.h"
+#include "InsetCollapsible.h"
 
-#include "support/gettext.h"
-#include "support/Translator.h"
+namespace lyx {
+
+class Cursor;
 
 /* InsetInfo displays shortcuts, lyxrc, package and textclass
 availability and menu information in a non-editable boxed InsetText.
@@ -30,7 +30,7 @@ uses it to display currently used shortcuts.
 This inset has two arguments: the type and argument of the information. The
 screen and latex output is the content of the information. An InsetInfo can
 have type "shortcuts", "shortcut", "lyxrc", "package", "textclass", "menu",
-or "buffer". Arguments and outputs vary by type.
+"buffer" or "vcs". Arguments and outputs vary by type.
 
 shortcuts: argument of this type of InsetInfo is the name of the LFUN such as
     "math-insert \alpha". The syntax is the same as what is used in the bind
@@ -56,11 +56,18 @@ menu: argument is the name of the LFUN such as "paste". The syntax is the same
 
 icon: argument is the name of the LFUN such as "paste". The syntax is the same
     as what is used in the bind and ui files. The output is the icon use in
-    the toolbar for this LFUN.
+    the toolbar for this LFUN. Alternatively, argument can be the icon path
+    without extension specified with respect to the images directory.
 
 buffer: argument can be one of "name", "path", "class". This inset output the
     filename, path, and textclass of this buffer.
 
+lyxinfo: argument must (presently) be "version". This inset outputs information
+    about the version of LyX currently in use.
+
+vcs: argument can be one of "revision", "tree-revision", "author", "time", "date".
+    This insets outputs revision control information, if available.
+
 There is currently no GUI, no menu entry for this inset. A user can define a
 shortcut for "info-insert" (e.g. C-S-I), and
 
@@ -73,9 +80,7 @@ the command buffer (view->Toolbar->Command Buffer).
 
 */
 
-namespace lyx {
-
-class InsetInfo : public InsetCollapsable {
+class InsetInfo : public InsetCollapsible {
 public:
        enum info_type {
                UNKNOWN_INFO,   // Invalid type
@@ -87,6 +92,8 @@ public:
                MENU_INFO,      // Which menu item is used for certain function
                ICON_INFO,      // which toolbar icon is used for certain function
                BUFFER_INFO,    // Buffer related information
+               LYX_INFO,        // LyX version information
+               VCS_INFO,        // Version control information
        };
 
        ///
@@ -94,9 +101,14 @@ public:
        ///
        InsetCode lyxCode() const { return INFO_CODE; }
        ///
-       docstring name() const;
+       docstring layoutName() const;
        ///
        Inset * editXY(Cursor & cur, int x, int y);
+       /** FIXME: we would like to do that, but then InsetText::updateBuffer breaks
+        * on info insets. Do we need to run this method on InsetInfo contents?
+        * Having a InsetInfo that hides an InsetText is really annoying, actually.
+        */
+       ///bool isActive() const { return false; }
        ///
        bool editable() const { return false; }
        ///
@@ -112,35 +124,47 @@ public:
        ///
        bool validateModifyArgument(docstring const & argument) const;
        ///
+       std::vector<std::pair<std::string,docstring>> getArguments(std::string const &) const;
+       ///
        bool showInsetDialog(BufferView * bv) const;
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
+       /// Force inset into LTR environment if surroundings are RTL
+       bool forceLTR() const;
        ///
        void setInfo(std::string const & info);
-       /// update info_ and text
-       void updateInfo();
+       ///
+       void updateBuffer(ParIterator const & it, UpdateType utype);
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const;
        ///
-       docstring contextMenu(BufferView const &, int, int) const;
-       /// should paragraph indendation be ommitted in any case?
+       std::string contextMenu(BufferView const &, int, int) const;
+       ///
+       std::string contextMenuName() const;
+       /// should paragraph indendation be omitted in any case?
        bool neverIndent() const { return true; }
 
 private:
        ///
        virtual Inset * clone() const { return new InsetInfo(*this); }
        ///
-       void error(std::string const & err);
+       void error(docstring const & err, Language const *);
        ///
-       void setText(docstring const & str);
+       void info(docstring const & err, Language const *);
+       ///
+       void setText(docstring const & str, Language const *);
        // make sure that the other version of setText is still available.
-       using InsetCollapsable::setText;
+       using InsetCollapsible::setText;
+       ///
+       bool initialized_;
        ///
        info_type type_;
        ///
        std::string name_;
+       ///
+       bool force_ltr_;
 };