remove defaults stuff, let Qt handle no toolbar

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6685 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-04-02 18:08:05 +00:00
parent 436098170f
commit 1423bdb7a7
20 changed files with 195 additions and 251 deletions

View File

@ -1,3 +1,18 @@
2003-04-01 John Levon <levon@movementarian.org>
* ToolbarBackend.h:
* ToolbarBackend.C:
* Makefile.am: rename, remove defaults gunk
* MenuBackend.h:
* MenuBackend.C: remove defaults gunk
* Languages.h:
* Languages.C: remove defaults gunk
* lyx_main.h:
* lyx_main.C: error out if files couldn't be found.
2003-04-02 John Levon <levon@movementarian.org> 2003-04-02 John Levon <levon@movementarian.org>
* text2.C: make incDepth() use parlist * text2.C: make incDepth() use parlist

View File

@ -84,8 +84,8 @@ lyx_SOURCES = \
TextCache.h \ TextCache.h \
Thesaurus.C \ Thesaurus.C \
Thesaurus.h \ Thesaurus.h \
ToolbarDefaults.C \ ToolbarBackend.C \
ToolbarDefaults.h \ ToolbarBackend.h \
WordLangTuple.h \ WordLangTuple.h \
aspell.C \ aspell.C \
aspell_local.h \ aspell_local.h \

View File

@ -731,51 +731,6 @@ void MenuBackend::read(LyXLex & lex)
} }
void MenuBackend::defaults()
{
menulist_.clear();
lyxerr[Debug::GUI] << "MenuBackend::defaults: using default values"
<< endl;
Menu file("file");
file
.add(MenuItem(MenuItem::Command, _("New...|N"), "buffer-new"))
.add(MenuItem(MenuItem::Command, _("Open...|O"), "file-open"))
.add(MenuItem(MenuItem::Submenu, _("Import|I"), "import"))
.add(MenuItem(MenuItem::Command, _("Quit|Q"), "lyx-quit"))
.add(MenuItem(MenuItem::Separator))
.add(MenuItem(MenuItem::Lastfiles));
add(file);
Menu import("import");
import
.add(MenuItem(MenuItem::Command,
_("LaTeX...|L"), "buffer-import latex"))
.add(MenuItem(MenuItem::Command,
_("LinuxDoc...|L"), "buffer-import linuxdoc"));
add(import);
Menu edit("edit");
edit
.add(MenuItem(MenuItem::Command, _("Cut"), "cut"))
.add(MenuItem(MenuItem::Command, _("Copy"), "copy"))
.add(MenuItem(MenuItem::Command, _("Paste"), "paste"))
.add(MenuItem(MenuItem::Command, _("Emphasize"), "font-emph"));
add(edit);
Menu documents("documents");
documents.add(MenuItem(MenuItem::Documents));
add(documents);
menubar_.add(MenuItem(MenuItem::Submenu, _("File|F"), "file"))
.add(MenuItem(MenuItem::Submenu, _("Edit|E"), "edit"))
.add(MenuItem(MenuItem::Submenu,
_("Documents|D"), "documents"));
}
void MenuBackend::add(Menu const & menu) void MenuBackend::add(Menu const & menu)
{ {
menulist_.push_back(menu); menulist_.push_back(menu);

View File

@ -178,8 +178,6 @@ public:
typedef MenuList::const_iterator const_iterator; typedef MenuList::const_iterator const_iterator;
/// ///
void read(LyXLex &); void read(LyXLex &);
/// Set default values for menu structure.
void defaults();
/// ///
void add(Menu const &); void add(Menu const &);
/// ///

View File

@ -1,17 +1,16 @@
/* This file is part of /**
* ====================================================== * \file ToolbarBackend.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
* *
* LyX, The Document Processor * \author unknown
* *
* Copyright 1995 Matthias Ettrich * Full author contact details are available in file CREDITS
* Copyright 1995-2001 The LyX Team. */
*
*
* ====================================================== */
#include <config.h> #include <config.h>
#include "ToolbarDefaults.h" #include "ToolbarBackend.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "debug.h" #include "debug.h"
@ -20,7 +19,7 @@
using std::endl; using std::endl;
ToolbarDefaults toolbardefaults; ToolbarBackend toolbarbackend;
namespace { namespace {
@ -45,61 +44,25 @@ struct keyword_item toolTags[TO_LAST - 1] = {
} // end of anon namespace } // end of anon namespace
ToolbarDefaults::ToolbarDefaults() ToolbarBackend::ToolbarBackend()
{ {
init();
} }
void ToolbarDefaults::add(int action) void ToolbarBackend::add(int action)
{ {
defaults.push_back(action); items.push_back(action);
} }
void ToolbarDefaults::init() void ToolbarBackend::read(LyXLex & lex)
{
add(LAYOUTS);
add(LFUN_FILE_OPEN);
//add(LFUN_CLOSEBUFFER);
add(LFUN_MENUWRITE);
add(LFUN_MENUPRINT);
add(SEPARATOR);
add(LFUN_CUT);
add(LFUN_COPY);
add(LFUN_PASTE);
add(SEPARATOR);
add(LFUN_EMPH);
add(LFUN_NOUN);
add(LFUN_FREEFONT_APPLY);
add(SEPARATOR);
add(LFUN_INSET_FOOTNOTE);
add(LFUN_INSET_MARGINAL);
add(LFUN_DEPTH_PLUS);
add(SEPARATOR);
add(LFUN_MATH_MODE);
add(SEPARATOR);
// add(LFUN_INSET_GRAPHICS);
add(LFUN_TABULAR_INSERT);
}
void ToolbarDefaults::read(LyXLex & lex)
{ {
//consistency check //consistency check
if (compare_ascii_no_case(lex.getString(), "toolbar")) { if (compare_ascii_no_case(lex.getString(), "toolbar")) {
lyxerr << "Toolbar::read: ERROR wrong token:`" lyxerr << "ToolbarBackend::read: ERROR wrong token:`"
<< lex.getString() << '\'' << endl; << lex.getString() << '\'' << endl;
} }
defaults.clear();
bool quit = false; bool quit = false;
lex.pushTable(toolTags, TO_LAST - 1); lex.pushTable(toolTags, TO_LAST - 1);
@ -113,7 +76,7 @@ void ToolbarDefaults::read(LyXLex & lex)
if (lex.next(true)) { if (lex.next(true)) {
string const func = lex.getString(); string const func = lex.getString();
lyxerr[Debug::PARSER] lyxerr[Debug::PARSER]
<< "Toolbar::read TO_ADD func: `" << "ToolbarBackend::read TO_ADD func: `"
<< func << '\'' << endl; << func << '\'' << endl;
add(func); add(func);
} }
@ -135,7 +98,7 @@ void ToolbarDefaults::read(LyXLex & lex)
quit = true; quit = true;
break; break;
default: default:
lex.printError("Toolbar::read: " lex.printError("ToolbarBackend::read: "
"Unknown toolbar tag: `$$Token'"); "Unknown toolbar tag: `$$Token'");
break; break;
} }
@ -144,12 +107,12 @@ void ToolbarDefaults::read(LyXLex & lex)
} }
void ToolbarDefaults::add(string const & func) void ToolbarBackend::add(string const & func)
{ {
int const tf = lyxaction.LookupFunc(func); int const tf = lyxaction.LookupFunc(func);
if (tf == -1) { if (tf == -1) {
lyxerr << "Toolbar::add: no LyX command called `" lyxerr << "ToolbarBackend::add: no LyX command called `"
<< func << "' exists!" << endl; << func << "' exists!" << endl;
} else { } else {
add(tf); add(tf);

73
src/ToolbarBackend.h Normal file
View File

@ -0,0 +1,73 @@
// -*- C++ -*-
/**
* \file ToolbarBackend.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author unknown
*
* Full author contact details are available in file CREDITS
*/
#ifndef TOOLBAR_BACKEND_H
#define TOOLBAR_BACKEND_H
#include <vector>
#include "LString.h"
class LyXLex;
///
class ToolbarBackend {
public:
/// The special toolbar actions
enum ItemType {
/// adds space between buttons in the toolbar
SEPARATOR = -3,
/// a special combox insead of a button
LAYOUTS = -2,
/// begin a new line of button (not working)
NEWLINE = -1
};
///
typedef std::vector<int> Items;
///
typedef Items::iterator iterator;
///
typedef Items::const_iterator const_iterator;
///
ToolbarBackend();
///
iterator begin() {
return items.begin();
}
///
const_iterator begin() const {
return items.begin();
}
///
iterator end() {
return items.end();
}
///
const_iterator end() const {
return items.end();
}
///
void read(LyXLex &);
private:
/// This func is just to make it easy for me...
void add(int);
///
void add(string const &);
///
Items items;
};
/// The global instance
extern ToolbarBackend toolbarbackend;
#endif // TOOLBAR_BACKEND_H

View File

@ -1,77 +0,0 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
*
* ====================================================== */
#ifndef TOOLBARDEFAULTS_H
#define TOOLBARDEFAULTS_H
#include <vector>
#include "LString.h"
class LyXLex;
///
class ToolbarDefaults {
public:
/// The special toolbar actions
enum ItemType {
/// adds space between buttons in the toolbar
SEPARATOR = -3,
/// a special combox insead of a button
LAYOUTS = -2,
/// begin a new line of button (not working)
NEWLINE = -1
};
///
typedef std::vector<int> Defaults;
///
typedef Defaults::iterator iterator;
///
typedef Defaults::const_iterator const_iterator;
///
ToolbarDefaults();
///
iterator begin() {
return defaults.begin();
}
///
const_iterator begin() const {
return defaults.begin();
}
///
iterator end() {
return defaults.end();
}
///
const_iterator end() const {
return defaults.end();
}
///
void read(LyXLex &);
private:
///
void init();
/// This func is just to make it easy for me...
void add(int);
///
void add(string const &);
///
Defaults defaults;
};
/// The global instance
extern ToolbarDefaults toolbardefaults;
#endif

View File

@ -1,3 +1,8 @@
2003-04-01 John Levon <levon@movementarian.org>
* Toolbar.h:
* Toolbar.C: ToolbarDefaults got renamed
2003-04-01 Lars Gullik Bjønnes <larsbj@gullik.net> 2003-04-01 Lars Gullik Bjønnes <larsbj@gullik.net>
screen.[Ch]: adjust screen.[Ch]: adjust

View File

@ -12,21 +12,21 @@
#include "Toolbar.h" #include "Toolbar.h"
#include "ToolbarDefaults.h" #include "ToolbarBackend.h"
#include "Toolbar_pimpl.h" #include "Toolbar_pimpl.h"
#include "debug.h" #include "debug.h"
#include "LyXAction.h" #include "LyXAction.h"
using std::endl; using std::endl;
Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd) Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarBackend const & backend)
: last_textclass_(-1) : last_textclass_(-1)
{ {
pimpl_ = new Pimpl(o, x, y); pimpl_ = new Pimpl(o, x, y);
// extracts the toolbar actions from tbd // extracts the toolbar actions from the backend
for (ToolbarDefaults::const_iterator cit = tbd.begin(); for (ToolbarBackend::const_iterator cit = backend.begin();
cit != tbd.end(); ++cit) { cit != backend.end(); ++cit) {
pimpl_->add((*cit)); pimpl_->add((*cit));
lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl; lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl;
} }

View File

@ -16,7 +16,7 @@
#include "LString.h" #include "LString.h"
class LyXView; class LyXView;
class ToolbarDefaults; class ToolbarBackend;
/** The LyX GUI independent toolbar class /** The LyX GUI independent toolbar class
@ -25,7 +25,7 @@ class ToolbarDefaults;
class Toolbar { class Toolbar {
public: public:
/// ///
Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &); Toolbar(LyXView * o, int x, int y, ToolbarBackend const &);
/// ///
~Toolbar(); ~Toolbar();

View File

@ -1,3 +1,9 @@
2003-04-01 John Levon <levon@movementarian.org>
* QtView.C:
* Toolbar_pimpl.C: ToolbarDefaults got renamed,
handle no toolbar
2003-03-31 John Levon <levon@movementarian.org> 2003-03-31 John Levon <levon@movementarian.org>
* lyx_gui.C: return useful default font names, add use_gui * lyx_gui.C: return useful default font names, add use_gui

View File

@ -17,7 +17,7 @@
#include "lyx_cb.h" #include "lyx_cb.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "MenuBackend.h" #include "MenuBackend.h"
#include "ToolbarDefaults.h" #include "ToolbarBackend.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "bufferview_funcs.h" #include "bufferview_funcs.h"
#include "BufferView.h" #include "BufferView.h"
@ -65,7 +65,7 @@ QtView::QtView(unsigned int width, unsigned int height)
::current_view = bufferview_.get(); ::current_view = bufferview_.get();
menubar_.reset(new Menubar(this, menubackend)); menubar_.reset(new Menubar(this, menubackend));
toolbar_.reset(new Toolbar(this, 0, 0, toolbardefaults)); toolbar_.reset(new Toolbar(this, 0, 0, toolbarbackend));
statusBar()->setSizeGripEnabled(false); statusBar()->setSizeGripEnabled(false);

View File

@ -12,7 +12,7 @@
#include <config.h> #include <config.h>
#include "ToolbarDefaults.h" #include "ToolbarBackend.h"
#include "debug.h" #include "debug.h"
#include "gettext.h" #include "gettext.h"
#include "lyxfunc.h" #include "lyxfunc.h"
@ -157,6 +157,9 @@ void Toolbar::Pimpl::changed_layout(string const & sel)
void Toolbar::Pimpl::setLayout(string const & layout) void Toolbar::Pimpl::setLayout(string const & layout)
{ {
if (!combo_)
return;
LyXTextClass const & tc = LyXTextClass const & tc =
owner_->buffer()->params.getLyXTextClass(); owner_->buffer()->params.getLyXTextClass();
@ -180,6 +183,9 @@ void Toolbar::Pimpl::setLayout(string const & layout)
void Toolbar::Pimpl::updateLayoutList(bool force) void Toolbar::Pimpl::updateLayoutList(bool force)
{ {
if (!combo_)
return;
// if we don't need an update, don't ... // if we don't need an update, don't ...
if (combo_->count() && !force) if (combo_->count() && !force)
return; return;
@ -211,12 +217,18 @@ void Toolbar::Pimpl::updateLayoutList(bool force)
void Toolbar::Pimpl::clearLayoutList() void Toolbar::Pimpl::clearLayoutList()
{ {
if (!combo_)
return;
combo_->clear(); combo_->clear();
} }
void Toolbar::Pimpl::openLayoutList() void Toolbar::Pimpl::openLayoutList()
{ {
if (!combo_)
return;
combo_->popup(); combo_->popup();
} }
@ -228,13 +240,13 @@ void Toolbar::Pimpl::add(int action)
} }
switch (action) { switch (action) {
case ToolbarDefaults::SEPARATOR: case ToolbarBackend::SEPARATOR:
toolbars_.back()->addSeparator(); toolbars_.back()->addSeparator();
break; break;
case ToolbarDefaults::NEWLINE: case ToolbarBackend::NEWLINE:
toolbars_.push_back(new QToolBar(owner_)); toolbars_.push_back(new QToolBar(owner_));
break; break;
case ToolbarDefaults::LAYOUTS: { case ToolbarBackend::LAYOUTS: {
combo_ = new QLComboBox(toolbars_.back()); combo_ = new QLComboBox(toolbars_.back());
QSizePolicy p(QSizePolicy::Minimum, QSizePolicy::Fixed); QSizePolicy p(QSizePolicy::Minimum, QSizePolicy::Fixed);
combo_->setSizePolicy(p); combo_->setSizePolicy(p);

View File

@ -53,6 +53,11 @@
but rather use the new controller method. Means that XMinibuffer but rather use the new controller method. Means that XMinibuffer
knows nothing about the LyX kernel. knows nothing about the LyX kernel.
2003-04-01 John Levon <levon@movementarian.org>
* XFormsView.C:
* Toolbar_pimpl.C: ToolbarDefaults got renamed
2003-04-01 John Levon <levon@movementarian.org> 2003-04-01 John Levon <levon@movementarian.org>
* Alert_pimpl.C: format error messages * Alert_pimpl.C: format error messages

View File

@ -26,9 +26,9 @@
#include "Tooltips.h" #include "Tooltips.h"
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include "combox.h" #include "combox.h"
#include "ToolbarBackend.h"
#include "xforms_helpers.h" #include "xforms_helpers.h"
#include "ToolbarDefaults.h"
#include "LyXAction.h" #include "LyXAction.h"
#include "support/LAssert.h" #include "support/LAssert.h"
@ -110,7 +110,7 @@ void Toolbar::Pimpl::update()
ToolbarList::const_iterator p = toollist_.begin(); ToolbarList::const_iterator p = toollist_.begin();
ToolbarList::const_iterator end = toollist_.end(); ToolbarList::const_iterator end = toollist_.end();
for (; p != end; ++p) { for (; p != end; ++p) {
if (p->action == ToolbarDefaults::LAYOUTS && combox_) { if (p->action == ToolbarBackend::LAYOUTS && combox_) {
LyXFunc const & lf = owner_->getLyXFunc(); LyXFunc const & lf = owner_->getLyXFunc();
bool const disable = bool const disable =
lf.getStatus(LFUN_LAYOUT).disabled(); lf.getStatus(LFUN_LAYOUT).disabled();
@ -307,13 +307,13 @@ void Toolbar::Pimpl::add(int action)
item.action = action; item.action = action;
switch (action) { switch (action) {
case ToolbarDefaults::SEPARATOR: case ToolbarBackend::SEPARATOR:
xpos += sepspace; xpos += sepspace;
break; break;
case ToolbarDefaults::NEWLINE: case ToolbarBackend::NEWLINE:
// Not supported yet. // Not supported yet.
break; break;
case ToolbarDefaults::LAYOUTS: case ToolbarBackend::LAYOUTS:
xpos += standardspacing; xpos += standardspacing;
if (combox_) if (combox_)
break; break;

View File

@ -24,7 +24,7 @@
#include "frontends/Timeout.h" #include "frontends/Timeout.h"
#include "frontends/Dialogs.h" #include "frontends/Dialogs.h"
#include "MenuBackend.h" #include "MenuBackend.h"
#include "ToolbarDefaults.h" #include "ToolbarBackend.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "bufferview_funcs.h" #include "bufferview_funcs.h"
#include "BufferView.h" #include "BufferView.h"
@ -142,7 +142,7 @@ void XFormsView::create_form_form_main(int width, int height)
menubar_.reset(new Menubar(this, menubackend)); menubar_.reset(new Menubar(this, menubackend));
toolbar_.reset(new Toolbar(this, air, 30 + air + bw, toolbardefaults)); toolbar_.reset(new Toolbar(this, air, 30 + air + bw, toolbarbackend));
int const ywork = 60 + 2 * air + bw; int const ywork = 60 + 2 * air + bw;
int const workheight = height - ywork - (25 + 2 * air); int const workheight = height - ywork - (25 + 2 * air);

View File

@ -27,20 +27,6 @@ Language const * ignore_language = &ignore_lang;
Language latex_lang("latex", "latex", "Latex", false, 0, "latex", ""); Language latex_lang("latex", "latex", "Latex", false, 0, "latex", "");
Language const * latex_language = &latex_lang; Language const * latex_language = &latex_lang;
void Languages::setDefaults()
{
// We need to set the encoding of latex_lang
latex_lang = Language("latex", "latex", "Latex", false,
encodings.getEncoding("iso8859-1"),
"latex", "");
languagelist["english"] = Language("english", "english", N_("English"),
false,
encodings.getEncoding("iso8859-1"),
"en", "");
english_language = default_language = &languagelist["english"];
}
void Languages::read(string const & filename) void Languages::read(string const & filename)
{ {
// We need to set the encoding of latex_lang // We need to set the encoding of latex_lang

View File

@ -86,8 +86,6 @@ public:
/// ///
void read(string const & filename); void read(string const & filename);
/// ///
void setDefaults();
///
Language const * getLanguage(string const & language) const; Language const * getLanguage(string const & language) const;
/// ///
size_type size() const { size_type size() const {

View File

@ -27,7 +27,7 @@
#include "lyxserver.h" #include "lyxserver.h"
#include "kbmap.h" #include "kbmap.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "ToolbarDefaults.h" #include "ToolbarBackend.h"
#include "MenuBackend.h" #include "MenuBackend.h"
#include "language.h" #include "language.h"
#include "lastfiles.h" #include "lastfiles.h"
@ -74,6 +74,24 @@ BufferList bufferlist;
// convenient to have it here. // convenient to have it here.
boost::scoped_ptr<kb_keymap> toplevel_keymap; boost::scoped_ptr<kb_keymap> toplevel_keymap;
namespace {
void showFileError(string const & error)
{
#if USE_BOOST_FORMAT
Alert::warning(_("Could not read configuration file"),
boost::io::str(boost::format(
_("Error while reading the configuration file\n%1$s.\n"
"Please check your installation.")) % error));
#else
Alert::warning(_("Could not read configuration file"),
string(_("Error while reading the configuration file\n"))
+ error + _(".\nPlease check your installation."));
#endif
exit(EXIT_FAILURE);
}
}
LyX::LyX(int & argc, char * argv[]) LyX::LyX(int & argc, char * argv[])
{ {
@ -126,9 +144,8 @@ LyX::LyX(int & argc, char * argv[])
files.push_back(argv[argi]); files.push_back(argv[argi]);
} }
if (first_start) { if (first_start)
files.push_back(i18nLibFileSearch("examples", "splash.lyx")); files.push_back(i18nLibFileSearch("examples", "splash.lyx"));
}
// Execute batch commands if available // Execute batch commands if available
if (!batch_command.empty()) { if (!batch_command.empty()) {
@ -441,10 +458,12 @@ void LyX::init(bool gui)
system_converters = converters; system_converters = converters;
system_lcolor = lcolor; system_lcolor = lcolor;
// If there is a preferences file we read that instead string prefsfile = "preferences";
// of the old lyxrc file. // back compatibility to lyxs < 1.1.6
if (!readRcFile("preferences")) if (LibFileSearch(string(), prefsfile).empty())
readRcFile("lyxrc"); prefsfile = "lyxrc";
if (!LibFileSearch(string(), prefsfile).empty())
readRcFile(prefsfile);
readEncodingsFile("encodings"); readEncodingsFile("encodings");
readLanguagesFile("languages"); readLanguagesFile("languages");
@ -460,9 +479,8 @@ void LyX::init(bool gui)
// Read menus // Read menus
readUIFile(lyxrc.ui_file); readUIFile(lyxrc.ui_file);
if (lyxerr.debugging(Debug::LYXRC)) { if (lyxerr.debugging(Debug::LYXRC))
lyxrc.print(); lyxrc.print();
}
os::setTmpDir(CreateLyXTmpDir(lyxrc.tempdir_path)); os::setTmpDir(CreateLyXTmpDir(lyxrc.tempdir_path));
system_tempdir = os::getTmpDir(); system_tempdir = os::getTmpDir();
@ -631,33 +649,21 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
} }
bool LyX::readRcFile(string const & name) void LyX::readRcFile(string const & name)
{ {
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl; lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
string const lyxrc_path = LibFileSearch(string(), name); string const lyxrc_path = LibFileSearch(string(), name);
if (!lyxrc_path.empty()) { if (!lyxrc_path.empty()) {
lyxerr[Debug::INIT] << "Found " << name lyxerr[Debug::INIT] << "Found " << name
<< " in " << lyxrc_path << endl; << " in " << lyxrc_path << endl;
if (lyxrc.read(lyxrc_path) < 0) {
#if USE_BOOST_FORMAT if (lyxrc.read(lyxrc_path) >= 0)
Alert::warning(_("Could not read configuration file"), return;
boost::io::str(boost::format(
_("Error while reading the configuration file\n%1$s.\n"
".\nLyX will use the built-in defaults.")) % lyxrc_path));
#else
Alert::warning(_("Could not read configuration file"),
string(_("Error while reading the configuration file\n"))
+ lyxrc_path + _(".\nLyX will use the built-in defaults."));
#endif
return false;
}
return true;
} else {
lyxerr[Debug::INIT] << "Could not find " << name << endl;
} }
return false; showFileError(name);
} }
@ -681,7 +687,7 @@ void LyX::readUIFile(string const & name)
if (ui_path.empty()) { if (ui_path.empty()) {
lyxerr[Debug::INIT] << "Could not find " << name << endl; lyxerr[Debug::INIT] << "Could not find " << name << endl;
menubackend.defaults(); showFileError(name);
return; return;
} }
@ -704,7 +710,7 @@ void LyX::readUIFile(string const & name)
break; break;
case ui_toolbar: case ui_toolbar:
toolbardefaults.read(lex); toolbarbackend.read(lex);
break; break;
default: default:
@ -724,8 +730,7 @@ void LyX::readLanguagesFile(string const & name)
string const lang_path = LibFileSearch(string(), name); string const lang_path = LibFileSearch(string(), name);
if (lang_path.empty()) { if (lang_path.empty()) {
lyxerr[Debug::INIT] << "Could not find " << name << endl; showFileError(name);
languages.setDefaults();
return; return;
} }
languages.read(lang_path); languages.read(lang_path);
@ -739,7 +744,7 @@ void LyX::readEncodingsFile(string const & name)
string const enc_path = LibFileSearch(string(), name); string const enc_path = LibFileSearch(string(), name);
if (enc_path.empty()) { if (enc_path.empty()) {
lyxerr[Debug::INIT] << "Could not find " << name << endl; showFileError(name);
return; return;
} }
encodings.read(enc_path); encodings.read(enc_path);

View File

@ -50,8 +50,8 @@ private:
void deadKeyBindings(kb_keymap * kbmap); void deadKeyBindings(kb_keymap * kbmap);
/// check, set up and configure the user dir if necessary /// check, set up and configure the user dir if necessary
void queryUserLyXDir(bool explicit_userdir); void queryUserLyXDir(bool explicit_userdir);
/// return true if the given prefs file was successfully read /// read lyxrc/preferences
bool readRcFile(string const & name); void readRcFile(string const & name);
/// read the given ui (menu/toolbar) file /// read the given ui (menu/toolbar) file
void readUIFile(string const & name); void readUIFile(string const & name);
/// read the given languages file /// read the given languages file