4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
15 #include "InsetText.h"
16 #include "RenderButton.h"
19 #include "support/Translator.h"
21 /* InsetInfo displays shortcuts, lyxrc, package and textclass
22 availability and menu information in a non-editable boxed InsetText.
24 Output of such as inset may vary from system to system, depending
25 on LyX and LaTeX configurations. Two LyX help files, LaTeXConfig.lyx
26 and Shortcuts.lyx make heavy use of this inset. The former uses it
27 to display the availability of packages and textclasses, the latter
28 uses it to display currently used shortcuts.
30 This inset has two arguments: the type and argument of the information.
31 The screen and latex output is the content of the information. An
32 InsetInfo can have type "shortcut", "lyxrc", "package", "textclass", or
33 "menu". Arguments and outputs vary by type.
35 shortcut: name of the LFUN such as "math-insert \alpha". The syntax
36 is the same as what is used in the bind and ui files.
37 The output of this inset is all shortcuts separated by comma.
39 lyxrc: name of the rc entry such as "bind_file". Look in src/LyXRC.h
40 for available entries. The output is the content of this RC
43 package: name of a latex package such as "listings". The output is
46 textclass: name of a textclass such as "article". The output is "yes"
49 menu: name of the LFUN such as "paste". The syntax is the same as
50 what is used in the bind and ui files. The output is the
51 menu item that trigger this LFUN. For example, "File > Paste".
52 '>' is actually \lyxarrow (an InsetSpecialChar).
55 Because this inset is intended to be used only by document maintainers,
56 there is no GUI, no menu entry for this inset. A user can define a
57 shortcut for "info-insert" (e.g. C-S-I), and
59 1. input the type and argument of this inset, e.g. "menu paste", in
61 2. select the text and run "info-insert" (e.g. press C-S-I).
63 An alternative method is to enter command "info-insert type args" in
64 the command buffer (view->Toolbar->Command Buffer).
70 /** Used to insert index labels
72 class InsetInfo : public InsetText {
75 UNKNOWN_INFO, // Invalid type
76 SHORTCUT_INFO, // Keyboard shortcut
77 LYXRC_INFO, // RC entry
78 PACKAGE_INFO, // Availability of package
79 TEXTCLASS_INFO, // Availability of textclass
80 MENU_INFO, // Which menu item is used for certain function
84 InsetInfo(BufferParams const & bp, std::string const & info = std::string());
86 Inset * editXY(Cursor & cur, int x, int y);
88 EDITABLE editable() const { return NOT_EDITABLE; }
90 void draw(PainterInfo & pi, int x, int y) const;
92 void read(Buffer const &, Lexer & lex);
94 void write(Buffer const & buf, std::ostream & os) const;
96 void doDispatch(Cursor & cur, FuncRequest & cmd);
98 InsetCode lyxCode() const { return INFO_CODE; }
100 void setInfo(std::string const & info);
102 bool setMouseHover(bool mouse_hover);
105 /// The translator between the information type enum and corresponding string.
106 Translator<info_type, std::string> const & nameTranslator() const;
107 /// update info_ and text
110 virtual Inset * clone() const { return new InsetInfo(*this); }
115 /// store the buffer parameter
116 BufferParams const & bp_;