X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyX.h;h=6c6db63c0e0b464d6043b7ce1f73011c69c0fa56;hb=fa2f219d928f7b07ee98cb499f78f7581b62dabc;hp=5a82c9037c10f2c87c4d9e596f086711ac5b1b7a;hpb=145585dc189203d37dd9eb78e071f8cc2959f82c;p=lyx.git diff --git a/src/LyX.h b/src/LyX.h index 5a82c9037c..6c6db63c0e 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -4,7 +4,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Lars Gullik Bjønnes + * \author Lars Gullik Bjønnes * \author Jean-Marc Lasgouttes * \author John Levon * @@ -22,6 +22,8 @@ class BufferList; class CmdDef; class Converters; class ErrorItem; +class FuncRequest; +class FuncStatus; class KeyMap; class LyXFunc; class Messages; @@ -30,6 +32,7 @@ class Movers; class Server; class ServerSocket; class Session; +class SpellChecker; extern bool use_gui; @@ -38,6 +41,10 @@ class Application; class LyXView; } +namespace graphics { +class Previews; +} + /// initial startup class LyX { public: @@ -48,60 +55,9 @@ public: /// Execute LyX. int exec(int & argc, char * argv[]); - /// Try to exit LyX properly. - /// \p exit_code is 0 by default, if a non zero value is passed, - /// emergencyCleanup() will be called before exiting. - void exit(int exit_code = 0) const; - - static LyX & ref(); - static LyX const & cref(); - - /// in the case of failure - void emergencyCleanup() const; - - /// - BufferList & bufferList(); - BufferList const & bufferList() const; - /// - Session & session(); - Session const & session() const; - /// - LyXFunc & lyxFunc(); - LyXFunc const & lyxFunc() const; - /// - Server & server(); - Server const & server() const; - /// - ServerSocket & socket(); - ServerSocket const & socket() const; - - /// - frontend::Application & application(); - frontend::Application const & application() const; - - /// - CmdDef & topLevelCmdDef(); - - /// - Converters & converters(); - Converters & systemConverters(); - - /// - Messages & getMessages(std::string const & language); - /// - Messages & getGuiMessages(); - /// - void setGuiLanguage(std::string const & language); - /// frontend::LyXView * newLyXView(); - /// Execute batch commands if available. - void execBatchCommands(); - - /// - void addFileToLoad(std::string const &); - private: /// noncopyable LyX(LyX const &); @@ -119,11 +75,15 @@ private: */ int init(int & argc, char * argv[]); + /// Execute batch commands if available. + void execCommands(); + /// Load files passed at command-line. + /// return true on success false if we encounter an error /** This method is used only in non-GUI mode. */ - void loadFiles(); + bool loadFiles(); /// initial LyX set up bool init(); @@ -148,6 +108,9 @@ private: /// shows up a parsing error on screen void printError(ErrorItem const &); + /// + Messages & messages(std::string const & language); + /// Use the Pimpl idiom to hide the internals. // Mostly used for singletons. struct Impl; @@ -156,14 +119,46 @@ private: /// has this user started lyx for the first time? bool first_start; + friend FuncStatus getStatus(FuncRequest const & action); + friend void dispatch(FuncRequest const & action); + friend BufferList & theBufferList(); + friend LyXFunc & theLyXFunc(); + friend Server & theServer(); + friend ServerSocket & theServerSocket(); + friend Converters & theConverters(); + friend Converters & theSystemConverters(); + friend Messages & getMessages(std::string const & language); + friend Messages & getGuiMessages(); + friend KeyMap & theTopLevelKeymap(); friend Movers & theMovers(); friend Mover const & getMover(std::string const & fmt); friend void setMover(std::string const & fmt, std::string const & command); friend Movers & theSystemMovers(); friend frontend::Application * theApp(); - friend KeyMap & theTopLevelKeymap(); + friend graphics::Previews & thePreviews(); + friend Session & theSession(); + friend CmdDef & theTopLevelCmdDef(); + friend SpellChecker * theSpellChecker(); + friend void setSpellChecker(); + friend void setRcGuiLanguage(); + friend void emergencyCleanup(); + friend void execBatchCommands(); + friend void lyx_exit(int exit_code); }; + +/// in the case of failure +void emergencyCleanup(); +/// Try to exit LyX properly. +/// \p exit_code is 0 by default, if a non zero value is passed, +/// emergencyCleanup() will be called before exiting. +void lyx_exit(int exit_code); +/// Set the language defined by the user. +void setRcGuiLanguage(); +/// Execute batch commands if available. +void execBatchCommands(); + } // namespace lyx #endif // LYX_H +