From 5a19e70f4551ead9225f0dc767747be0bf9e45b2 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 11 Dec 2000 13:41:21 +0000 Subject: [PATCH] Try to fix the bind_file debacle. Please test git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1273 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 7 +++++++ po/POTFILES.in | 28 ++++++++++++++-------------- src/lyx_main.C | 3 +-- src/lyxrc.C | 34 +++++++++++++++++++--------------- src/lyxrc.h | 11 +++++++---- 5 files changed, 48 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index fedb3ccc71..58557966d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2000-12-11 Jean-Marc Lasgouttes + * 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)". diff --git a/po/POTFILES.in b/po/POTFILES.in index 6bbe76c923..59c622c560 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/src/lyx_main.C b/src/lyx_main.C index 60f322ea01..caf25a6908 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -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); diff --git a/src/lyxrc.C b/src/lyxrc.C index f4caddcd0b..58eda541fb 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -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; diff --git a/src/lyxrc.h b/src/lyxrc.h index 831505e970..6de67fc60a 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -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); }; /// -- 2.39.2