X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FToolbarBackend.h;h=8845b5ddb86ff871a62c97bca3a2335896b067c2;hb=5e0121cf5854a2a0039e6cb4970aeddb18bd4b23;hp=33694481cdfec0b2522353d286a04b77cc13172a;hpb=6c300f72a217722652dc27db9108e1050028979c;p=lyx.git diff --git a/src/ToolbarBackend.h b/src/ToolbarBackend.h index 33694481cd..8845b5ddb8 100644 --- a/src/ToolbarBackend.h +++ b/src/ToolbarBackend.h @@ -13,7 +13,7 @@ #ifndef TOOLBAR_BACKEND_H #define TOOLBAR_BACKEND_H -#include "funcrequest.h" +#include "FuncRequest.h" #include @@ -21,55 +21,97 @@ namespace lyx { -class LyXLex; +class Lexer; - -/// -class ToolbarBackend { +class ToolbarItem { public: - /// The special toolbar actions - enum ItemType { + enum Type { + /// command/action + COMMAND, /// the command buffer - MINIBUFFER = -3, + MINIBUFFER, /// adds space between buttons in the toolbar - SEPARATOR = -2, + SEPARATOR, /// a special combox insead of a button - LAYOUTS = -1, + LAYOUTS, + /// a special widget to insert tabulars + TABLEINSERT, + /// + POPUPMENU, + /// + ICONPALETTE }; - /// action, tooltip - typedef std::pair Item; + ToolbarItem(Type type, + FuncRequest const & func, + docstring const & label = docstring()); + + ToolbarItem(Type type, + std::string const & name = std::string(), + docstring const & label = docstring()); + + ~ToolbarItem(); + + /// item type + Type type_; + /// action + FuncRequest func_; + /// label/tooltip + docstring label_; + /// name + std::string name_; +}; - /// the toolbar items - typedef std::vector Items; +/// +class ToolbarInfo { +public: /// toolbar flags enum Flags { - ON = 1, //< always shown - OFF = 2, //< never shown - MATH = 4, //< shown when in math - TABLE = 8, //< shown when in table + ON = 1, //< show + OFF = 2, //< do not show + MATH = 4, //< show when in math + TABLE = 8, //< show when in table TOP = 16, //< show at top BOTTOM = 32, //< show at bottom LEFT = 64, //< show at left - RIGHT = 128 //< show at right + RIGHT = 128, //< show at right + REVIEW = 256, //< show when change tracking is enabled + AUTO = 512, //< only if AUTO is set, when MATH, TABLE and REVIEW is used + MATHMACROTEMPLATE = 1024 //< show in math macro template }; + /// the toolbar items + typedef std::vector Items; - /// a toolbar - struct Toolbar { - /// toolbar name - std::string name; - /// toolbar GUI name - std::string gui_name; - /// toolbar contents - Items items; - /// flags - Flags flags; - }; + typedef Items::const_iterator item_iterator; - typedef std::vector Toolbars; + explicit ToolbarInfo(std::string const & name = std::string()) + : name(name) {} - typedef Items::const_iterator item_iterator; + /// toolbar name + std::string name; + /// toolbar GUI name + std::string gui_name; + /// toolbar contents + Items items; + /// flags + Flags flags; + /// store flags when coming to fullscreen mode + Flags before_fullscreen; + + /// read a toolbar from the file + ToolbarInfo & read(Lexer &); + +private: + /// add toolbar item + void add(ToolbarItem const &); +}; + + +/// +class ToolbarBackend { +public: + typedef std::vector Toolbars; ToolbarBackend(); @@ -78,21 +120,27 @@ public: Toolbars::const_iterator end() const { return usedtoolbars.end(); } - /// read a toolbar from the file - void read(LyXLex &); + Toolbars::iterator begin() { return usedtoolbars.begin(); } - /// read the used toolbars - void readToolbars(LyXLex &); + Toolbars::iterator end() { return usedtoolbars.end(); } - /// return a full path of an XPM for the given action - static std::string const getIcon(FuncRequest const &); + /// read toolbars from the file + void readToolbars(Lexer &); -private: - /// add the given lfun with tooltip if relevant - void add(Toolbar & tb, FuncRequest const &, - docstring const & tooltip = docstring()); + /// read ui toolbar settings + void readToolbarSettings(Lexer &); - /// all the toolbars + /// + ToolbarInfo const * getDefinedToolbarInfo(std::string const & name) const; + /// + ToolbarInfo * getUsedToolbarInfo(std::string const & name); + + // FIXME should be deleted when every window has its own toolbar config. + /// number of toggleFullScreen calls, i.e. number of FullScreen windows. + int fullScreenWindows; + +private: + /// all the defined toolbars Toolbars toolbars; /// toolbars listed