]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
* Paragraph: erase unused some method and move some members to Paragraph::Private.
[lyx.git] / src / LyX.cpp
index 81094b8ca68850b6420c4ac26d4579ee0eaa408c..f6d513da3fc67ce82bf8f8a9775abeb3d6630678 100644 (file)
@@ -29,6 +29,7 @@
 #include "Format.h"
 #include "gettext.h"
 #include "KeyMap.h"
+#include "CmdDef.h"
 #include "Language.h"
 #include "Session.h"
 #include "Color.h"
@@ -164,6 +165,8 @@ struct LyX::Singletons
        ///
        boost::scoped_ptr<KeyMap> toplevel_keymap_;
        ///
+       boost::scoped_ptr<CmdDef> toplevel_cmddef_;
+       ///
        boost::scoped_ptr<Server> lyx_server_;
        ///
        boost::scoped_ptr<ServerSocket> lyx_socket_;
@@ -315,6 +318,13 @@ KeyMap & LyX::topLevelKeymap()
 }
 
 
+CmdDef & LyX::topLevelCmdDef()
+{
+       BOOST_ASSERT(pimpl_->toplevel_cmddef_.get());
+       return *pimpl_->toplevel_cmddef_.get();
+}
+
+
 Converters & LyX::converters()
 {
        return pimpl_->converters_;
@@ -592,7 +602,7 @@ void LyX::loadFiles()
                        continue;
 
                Buffer * buf = pimpl_->buffer_list_.newBuffer(it->absFilename(), false);
-               if (loadLyXFile(buf, *it)) {
+               if (buf->loadLyXFile(*it)) {
                        ErrorList const & el = buf->errorList("Parse");
                        if (!el.empty())
                                for_each(el.begin(), el.end(),
@@ -961,10 +971,16 @@ bool LyX::init()
        // Set the language defined by the user.
        //setGuiLanguage(lyxrc.gui_language);
 
+       // Set up command definitions
+       pimpl_->toplevel_cmddef_.reset(new CmdDef);
+       pimpl_->toplevel_cmddef_->read(lyxrc.def_file);
+
        // Set up bindings
        pimpl_->toplevel_keymap_.reset(new KeyMap);
        defaultKeyBindings(pimpl_->toplevel_keymap_.get());
        pimpl_->toplevel_keymap_->read(lyxrc.bind_file);
+       // load user bind file user.bind
+       pimpl_->toplevel_keymap_->read("user");
 
        pimpl_->lyxfunc_.initKeySequences(pimpl_->toplevel_keymap_.get());
 
@@ -1015,8 +1031,8 @@ bool LyX::init()
 
 void LyX::defaultKeyBindings(KeyMap  * kbmap)
 {
-       kbmap->bind("Right", FuncRequest(LFUN_CHAR_FORWARD));
-       kbmap->bind("Left", FuncRequest(LFUN_CHAR_BACKWARD));
+       kbmap->bind("Right", FuncRequest(LFUN_CHAR_RIGHT));
+       kbmap->bind("Left", FuncRequest(LFUN_CHAR_LEFT));
        kbmap->bind("Up", FuncRequest(LFUN_UP));
        kbmap->bind("Down", FuncRequest(LFUN_DOWN));
 
@@ -1054,8 +1070,8 @@ void LyX::defaultKeyBindings(KeyMap  * kbmap)
        //kbmap->bind("KP_Divide", FuncRequest(LFUN_SELF_INSERT));
        //kbmap->bind("KP_Multiply", FuncRequest(LFUN_SELF_INSERT));
        //kbmap->bind("KP_Subtract", FuncRequest(LFUN_SELF_INSERT));
-       kbmap->bind("KP_Right", FuncRequest(LFUN_CHAR_FORWARD));
-       kbmap->bind("KP_Left", FuncRequest(LFUN_CHAR_BACKWARD));
+       kbmap->bind("KP_Right", FuncRequest(LFUN_CHAR_RIGHT));
+       kbmap->bind("KP_Left", FuncRequest(LFUN_CHAR_LEFT));
        kbmap->bind("KP_Up", FuncRequest(LFUN_UP));
        kbmap->bind("KP_Down", FuncRequest(LFUN_DOWN));
        kbmap->bind("KP_Home", FuncRequest(LFUN_LINE_BEGIN));