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
This commit is contained in:
Jean-Marc Lasgouttes 2000-12-11 13:41:21 +00:00
parent 891bff2bfe
commit 5a19e70f45
5 changed files with 48 additions and 35 deletions

View File

@ -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)".

View 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

View 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);

View 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.
bind_file = tmp;
}
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;
}
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;

View 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);
};
///