]> git.lyx.org Git - lyx.git/commitdiff
Try to fix the bind_file debacle. Please test
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 11 Dec 2000 13:41:21 +0000 (13:41 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 11 Dec 2000 13:41:21 +0000 (13:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1273 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
po/POTFILES.in
src/lyx_main.C
src/lyxrc.C
src/lyxrc.h

index fedb3ccc71e50c8c8d01f79f0d7d97d6a05e5434..58557966d839117e8fa50ad94b577eaf18d2acbb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2000-12-11  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
+       * src/lyxrc.C (readBindFileIfNeeded): new method. Reads the main
+       bind file if it has not been done yet.
+       (read): remove local bindFile variable. Try to fix the handling of
+       RC_BIND and RC_BINDFILE.
+
+       * src/lyx_main.C (init): use readBindFileIfNeeded().
+
        * lib/languages: Change description of german to "German (new
        spelling)".
 
index 6bbe76c9238b543b588a1d074c3a5eb31ac3312f..59c622c5603bf49229119b68e9af317e5922d8d6 100644 (file)
@@ -53,35 +53,35 @@ src/frontends/kde/refdlg.C
 src/frontends/kde/tocdlg.C
 src/frontends/kde/urldlg.C
 src/frontends/xforms/FormBase.h
-src/frontends/xforms/form_citation.C
 src/frontends/xforms/FormCitation.C
-src/frontends/xforms/form_copyright.C
+src/frontends/xforms/form_citation.C
 src/frontends/xforms/FormCopyright.C
-src/frontends/xforms/form_document.C
+src/frontends/xforms/form_copyright.C
 src/frontends/xforms/FormDocument.C
-src/frontends/xforms/form_error.C
+src/frontends/xforms/form_document.C
 src/frontends/xforms/FormError.C
-src/frontends/xforms/form_graphics.C
+src/frontends/xforms/form_error.C
 src/frontends/xforms/FormGraphics.C
-src/frontends/xforms/form_index.C
+src/frontends/xforms/form_graphics.C
 src/frontends/xforms/FormIndex.C
+src/frontends/xforms/form_index.C
 src/frontends/xforms/FormInset.h
-src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormParagraph.C
-src/frontends/xforms/form_preferences.C
+src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormPreferences.C
-src/frontends/xforms/form_print.C
+src/frontends/xforms/form_preferences.C
 src/frontends/xforms/FormPrint.C
-src/frontends/xforms/form_ref.C
+src/frontends/xforms/form_print.C
 src/frontends/xforms/FormRef.C
-src/frontends/xforms/form_tabular.C
+src/frontends/xforms/form_ref.C
 src/frontends/xforms/FormTabular.C
-src/frontends/xforms/form_tabular_create.C
+src/frontends/xforms/form_tabular.C
 src/frontends/xforms/FormTabularCreate.C
-src/frontends/xforms/form_toc.C
+src/frontends/xforms/form_tabular_create.C
 src/frontends/xforms/FormToc.C
-src/frontends/xforms/form_url.C
+src/frontends/xforms/form_toc.C
 src/frontends/xforms/FormUrl.C
+src/frontends/xforms/form_url.C
 src/frontends/xforms/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
 src/frontends/xforms/xform_helpers.C
index 60f322ea01d5474294b104edc4076f18a06be1e9..caf25a6908a24e8a7ef8d745d5f6a1e9cced187a 100644 (file)
@@ -424,8 +424,7 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
 
        // Ensure that we have really read a bind file, so that LyX is
        // usable.
-       if (!lyxrc.hasBindFile)
-               lyxrc.ReadBindFile();
+       lyxrc.readBindFileIfNeeded();
 
        // Read menus
        ReadUIFile(lyxrc.ui_file);
index f4caddcd0b627abb4c836a7207553053b7cb29e7..58eda541fb822f565b9c41c07e482a9798352745 100644 (file)
@@ -153,6 +153,8 @@ LyXRC::LyXRC()
 
 
 void LyXRC::setDefaults() {
+       bind_file = "cua";
+       hasBindFile = false;
        ui_file = "default";
        // Get printer from the environment. If fail, use default "",
        // assuming that everything is set up correctly.
@@ -222,7 +224,6 @@ void LyXRC::setDefaults() {
        isp_use_pers_dict = false;
        isp_use_esc_chars = false;
        use_kbmap = false;
-       hasBindFile = false;
        rtl_support = false;
        auto_number = true;
        mark_foreign_language = true;
@@ -260,12 +261,14 @@ int LyXRC::ReadBindFile(string const & name)
        return result;
 }
 
+void LyXRC::readBindFileIfNeeded()
+{
+       if (!hasBindFile)
+               ReadBindFile(bind_file);
+}
 
 int LyXRC::read(string const & filename)
-{
-       // Default bindfile.
-       static string const bindFile("cua");
-       
+{      
        LyXLex lexrc(lyxrcTags, lyxrcCount);
        if (lyxerr.debugging(Debug::PARSER))
                lexrc.printTable(lyxerr);
@@ -306,13 +309,16 @@ int LyXRC::read(string const & filename)
                case RC_BINDFILE:                     // RVDK_PATCH_5
                        if (lexrc.next()) {
                                string tmp(lexrc.GetString());
-                               if (bind_file.empty()) {
-                                       // we only need the name of the first
-                                       // bind file since that (usually)
-                                       // includes several others.
+                               if (hasBindFile)
+                                       // We are already in the
+                                       // "actually read bind file"
+                                       // mode.
+                                       ReadBindFile(tmp);
+                               else
+                                       // We are still in the "just
+                                       // remember the name of the
+                                       // bind file" mode.
                                        bind_file = tmp;
-                               }
-                               ReadBindFile(tmp);
                        }
                        break;
                        
@@ -678,10 +684,8 @@ int LyXRC::read(string const & filename)
                        // we should not do an explicit binding before
                        // loading a bind file. So, in this case, load
                        // the default bind file.
-                       if (!hasBindFile) {
-                               bind_file = bindFile;
-                               ReadBindFile();
-                       }
+                       readBindFileIfNeeded();
+
                        // !!!chb, dynamic key binding...
                        int action, res = 0;
                        string seq, cmd;
index 831505e9704008a8938cf93a98fd17bbcced5097..6de67fc60a26173a603452c96488837f225670c9 100644 (file)
@@ -130,15 +130,13 @@ enum LyXRCTags {
        ///
        int read (string const & filename);
        ///
+       void readBindFileIfNeeded();
+       ///
        void write(string const & filename) const;
        ///
         void print() const;
        ///
        void output(std::ostream & os) const;
-       /// Is a bind file already (or currently) read?
-       bool hasBindFile;
-       ///
-       int ReadBindFile(string const & name = "cua");
        ///
        static string const getDescription(LyXRCTags);
        ///
@@ -334,6 +332,11 @@ enum LyXRCTags {
        bool cursor_follows_scrollbar;
        ///
        int label_init_length;
+private:
+       /// Is a bind file already (or currently) read?
+       bool hasBindFile;
+       ///
+       int ReadBindFile(string const & name);
 };
 
 ///