#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
-using support::compare_ascii_no_case;
-using support::os::external_path;
-using support::os::external_path_list;
-using support::os::internal_path;
-using support::os::internal_path_list;
-using support::FileName;
-using support::FileFilterList;
-using support::addPath;
-using support::addName;
-using support::mkdir;
-using support::package;
-
-static std::pair<string, string> parseFontName(string const & name)
+static void parseFontName(QString const & mangled0,
+ string & name, string & foundry)
- string::size_type const idx = name.find('[');
- if (idx == string::npos || idx == 0)
- return make_pair(name, string());
- return make_pair(name.substr(0, idx - 1),
- name.substr(idx + 1, name.size() - idx - 2));
+ string mangled = fromqstr(mangled0);
+ size_t const idx = mangled.find('[');
+ if (idx == string::npos || idx == 0) {
+ name = mangled;
+ foundry.clear();
+ } else {
+ name = mangled.substr(0, idx - 1),
+ foundry = mangled.substr(idx + 1, mangled.size() - idx - 2);
+ }
- pair<string, string> tmp = parseFontName(fromqstr(cb->itemText(i)));
- if (compare_ascii_no_case(tmp.first, family) == 0) {
+ string name, foundry;
+ parseFontName(cb->itemText(i), name, foundry);
+ if (compare_ascii_no_case(name, family) == 0) {
- pair<string, string> tmpfam = parseFontName(family);
+ string tmpname, tmpfoundry;
+ parseFontName(toqstr(family), tmpname, tmpfoundry);
- for (int i = cb->count() - 1; i >= 0; --i) {
- pair<string, string> tmp = parseFontName(fromqstr(cb->itemText(i)));
- if (compare_ascii_no_case(tmp.first, tmpfam.first) == 0) {
+ for (int i = cb->count(); --i >= 0; ) {
+ string name, foundry;
+ parseFontName(cb->itemText(i), name, foundry);
+ if (compare_ascii_no_case(name, foundry) == 0) {
} else {
lyxerr << "FAILED to find the default font: '"
<< foundry << "', '" << family << '\''<< endl;
} else {
lyxerr << "FAILED to find the default font: '"
<< foundry << "', '" << family << '\''<< endl;
- pair<string, string> tmp = parseFontName(fromqstr(info.family()));
- string const & default_font_name = tmp.first;
+ string default_font_name, dummyfoundry;
+ parseFontName(info.family(), default_font_name, dummyfoundry);
-PrefKeyboard::PrefKeyboard(GuiPreferences * form, QWidget * parent)
- : PrefModule(_("Keyboard"), form, parent)
+PrefInput::PrefInput(GuiPreferences * form, QWidget * parent)
+ : PrefModule(_("Keyboard/Mouse"), form, parent)
this, SIGNAL(changed()));
connect(secondKeymapED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
this, SIGNAL(changed()));
connect(secondKeymapED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
{
// FIXME: can derive CB from the two EDs
rc.use_kbmap = keymapCB->isChecked();
rc.primary_kbmap = internal_path(fromqstr(firstKeymapED->text()));
rc.secondary_kbmap = internal_path(fromqstr(secondKeymapED->text()));
{
// FIXME: can derive CB from the two EDs
rc.use_kbmap = keymapCB->isChecked();
rc.primary_kbmap = internal_path(fromqstr(firstKeymapED->text()));
rc.secondary_kbmap = internal_path(fromqstr(secondKeymapED->text()));
{
// FIXME: can derive CB from the two EDs
keymapCB->setChecked(rc.use_kbmap);
firstKeymapED->setText(toqstr(external_path(rc.primary_kbmap)));
secondKeymapED->setText(toqstr(external_path(rc.secondary_kbmap)));
{
// FIXME: can derive CB from the two EDs
keymapCB->setChecked(rc.use_kbmap);
firstKeymapED->setText(toqstr(external_path(rc.primary_kbmap)));
secondKeymapED->setText(toqstr(external_path(rc.secondary_kbmap)));
this, SIGNAL(changed()));
connect(screenHugerED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
this, SIGNAL(changed()));
connect(screenHugerED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
screenTinyED->setValidator(new QDoubleValidator(screenTinyED));
screenSmallestED->setValidator(new QDoubleValidator(screenSmallestED));
screenTinyED->setValidator(new QDoubleValidator(screenTinyED));
screenSmallestED->setValidator(new QDoubleValidator(screenSmallestED));
- boost::tie(rc.roman_font_name, rc.roman_font_foundry)
- = parseFontName(fromqstr(screenRomanCO->currentText()));
- boost::tie(rc.sans_font_name, rc.sans_font_foundry) =
- parseFontName(fromqstr(screenSansCO->currentText()));
- boost::tie(rc.typewriter_font_name, rc.typewriter_font_foundry) =
- parseFontName(fromqstr(screenTypewriterCO->currentText()));
+ parseFontName(screenRomanCO->currentText(),
+ rc.roman_font_name, rc.roman_font_foundry);
+ parseFontName(screenSansCO->currentText(),
+ rc.sans_font_name, rc.sans_font_foundry);
+ parseFontName(screenTypewriterCO->currentText(),
+ rc.typewriter_font_name, rc.typewriter_font_foundry);
rc.font_sizes[FONT_SIZE_LARGEST] = fromqstr(screenLargestED->text());
rc.font_sizes[FONT_SIZE_HUGE] = fromqstr(screenHugeED->text());
rc.font_sizes[FONT_SIZE_HUGER] = fromqstr(screenHugerED->text());
rc.font_sizes[FONT_SIZE_LARGEST] = fromqstr(screenLargestED->text());
rc.font_sizes[FONT_SIZE_HUGE] = fromqstr(screenHugeED->text());
rc.font_sizes[FONT_SIZE_HUGER] = fromqstr(screenHugerED->text());
screenLargestED->setText(toqstr(rc.font_sizes[FONT_SIZE_LARGEST]));
screenHugeED->setText(toqstr(rc.font_sizes[FONT_SIZE_HUGE]));
screenHugerED->setText(toqstr(rc.font_sizes[FONT_SIZE_HUGER]));
screenLargestED->setText(toqstr(rc.font_sizes[FONT_SIZE_LARGEST]));
screenHugeED->setText(toqstr(rc.font_sizes[FONT_SIZE_HUGE]));
screenHugerED->setText(toqstr(rc.font_sizes[FONT_SIZE_HUGER]));
vector<ColorCode>::const_iterator cit = lcolors_.begin();
vector<ColorCode>::const_iterator const end = lcolors_.end();
for (; cit != end; ++cit) {
vector<ColorCode>::const_iterator cit = lcolors_.begin();
vector<ColorCode>::const_iterator const end = lcolors_.end();
for (; cit != end; ++cit) {
switch (displayGraphicsCO->currentIndex()) {
case 3: dtype = graphics::NoDisplay; break;
case 2: dtype = graphics::ColorDisplay; break;
switch (displayGraphicsCO->currentIndex()) {
case 3: dtype = graphics::NoDisplay; break;
case 2: dtype = graphics::ColorDisplay; break;
connect(templateDirPB, SIGNAL(clicked()), this, SLOT(select_templatedir()));
connect(tempDirPB, SIGNAL(clicked()), this, SLOT(select_tempdir()));
connect(backupDirPB, SIGNAL(clicked()), this, SLOT(select_backupdir()));
connect(templateDirPB, SIGNAL(clicked()), this, SLOT(select_templatedir()));
connect(tempDirPB, SIGNAL(clicked()), this, SLOT(select_tempdir()));
connect(backupDirPB, SIGNAL(clicked()), this, SLOT(select_backupdir()));
connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(select_lyxpipe()));
connect(workingDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(select_lyxpipe()));
connect(workingDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(templateDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(backupDirED, SIGNAL(textChanged(QString)),
connect(templateDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(backupDirED, SIGNAL(textChanged(QString)),
void PrefPaths::apply(LyXRC & rc) const
{
rc.document_path = internal_path(fromqstr(workingDirED->text()));
void PrefPaths::apply(LyXRC & rc) const
{
rc.document_path = internal_path(fromqstr(workingDirED->text()));
rc.template_path = internal_path(fromqstr(templateDirED->text()));
rc.backupdir_path = internal_path(fromqstr(backupDirED->text()));
rc.tempdir_path = internal_path(fromqstr(tempDirED->text()));
rc.template_path = internal_path(fromqstr(templateDirED->text()));
rc.backupdir_path = internal_path(fromqstr(backupDirED->text()));
rc.tempdir_path = internal_path(fromqstr(tempDirED->text()));
void PrefPaths::update(LyXRC const & rc)
{
workingDirED->setText(toqstr(external_path(rc.document_path)));
void PrefPaths::update(LyXRC const & rc)
{
workingDirED->setText(toqstr(external_path(rc.document_path)));
templateDirED->setText(toqstr(external_path(rc.template_path)));
backupDirED->setText(toqstr(external_path(rc.backupdir_path)));
tempDirED->setText(toqstr(external_path(rc.tempdir_path)));
templateDirED->setText(toqstr(external_path(rc.template_path)));
backupDirED->setText(toqstr(external_path(rc.backupdir_path)));
tempDirED->setText(toqstr(external_path(rc.tempdir_path)));
+void PrefPaths::select_exampledir()
+{
+ docstring file(form_->browsedir(
+ from_utf8(internal_path(fromqstr(exampleDirED->text()))),
+ _("Select directory for example files")));
+ if (!file.empty())
+ exampleDirED->setText(toqstr(file));
+}
+
+
Converters::const_iterator ccit = form_->converters().begin();
Converters::const_iterator cend = form_->converters().end();
for (; ccit != cend; ++ccit) {
Converters::const_iterator ccit = form_->converters().begin();
Converters::const_iterator cend = form_->converters().end();
for (; ccit != cend; ++ccit) {
ccit->From->prettyname() + " -> " + ccit->To->prettyname();
int type = form_->converters().getNumber(ccit->From->name(), ccit->To->name());
new QListWidgetItem(toqstr(name), convertersLW, type);
ccit->From->prettyname() + " -> " + ccit->To->prettyname();
int type = form_->converters().getNumber(ccit->From->name(), ccit->To->name());
new QListWidgetItem(toqstr(name), convertersLW, type);
- connect(rtlCB, SIGNAL(clicked()),
+ connect(rtlGB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(visualCursorRB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(logicalCursorRB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(markForeignCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
this, SIGNAL(changed()));
connect(markForeignCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
- std::vector<LanguagePair> const langs = getLanguageData(false);
- std::vector<LanguagePair>::const_iterator lit = langs.begin();
- std::vector<LanguagePair>::const_iterator lend = langs.end();
+ vector<LanguagePair> const langs = getLanguageData(false);
+ vector<LanguagePair>::const_iterator lit = langs.begin();
+ vector<LanguagePair>::const_iterator lend = langs.end();
rc.mark_foreign_language = markForeignCB->isChecked();
rc.language_auto_begin = autoBeginCB->isChecked();
rc.language_auto_end = autoEndCB->isChecked();
rc.mark_foreign_language = markForeignCB->isChecked();
rc.language_auto_begin = autoBeginCB->isChecked();
rc.language_auto_end = autoEndCB->isChecked();
markForeignCB->setChecked(rc.mark_foreign_language);
autoBeginCB->setChecked(rc.language_auto_begin);
autoEndCB->setChecked(rc.language_auto_end);
markForeignCB->setChecked(rc.mark_foreign_language);
autoBeginCB->setChecked(rc.language_auto_begin);
autoEndCB->setChecked(rc.language_auto_end);
this, SIGNAL(changed()));
connect(sortEnvironmentsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
this, SIGNAL(changed()));
connect(sortEnvironmentsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(autoSaveSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(autoSaveCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(lastfilesSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(autoSaveSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
connect(autoSaveCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(lastfilesSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
this, SIGNAL(changed()));
lastfilesSB->setMaximum(maxlastfiles);
}
this, SIGNAL(changed()));
lastfilesSB->setMaximum(maxlastfiles);
}
rc.allow_geometry_session = allowGeometrySessionCB->isChecked();
rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
rc.sort_layouts = sortEnvironmentsCB->isChecked();
rc.allow_geometry_session = allowGeometrySessionCB->isChecked();
rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
rc.sort_layouts = sortEnvironmentsCB->isChecked();
+ switch (macroEditStyleCO->currentIndex()) {
+ case 0: rc.macro_edit_style = LyXRC::MACRO_EDIT_INLINE_BOX; break;
+ case 1: rc.macro_edit_style = LyXRC::MACRO_EDIT_INLINE; break;
+ case 2: rc.macro_edit_style = LyXRC::MACRO_EDIT_LIST; break;
+ }
rc.autosave = autoSaveSB->value() * 60;
rc.make_backup = autoSaveCB->isChecked();
rc.num_lastfiles = lastfilesSB->value();
rc.autosave = autoSaveSB->value() * 60;
rc.make_backup = autoSaveCB->isChecked();
rc.num_lastfiles = lastfilesSB->value();
allowGeometrySessionCB->setChecked(rc.allow_geometry_session);
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
sortEnvironmentsCB->setChecked(rc.sort_layouts);
allowGeometrySessionCB->setChecked(rc.allow_geometry_session);
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
sortEnvironmentsCB->setChecked(rc.sort_layouts);
autoSaveSB->setValue(mins);
autoSaveCB->setChecked(rc.make_backup);
lastfilesSB->setValue(rc.num_lastfiles);
autoSaveSB->setValue(mins);
autoSaveCB->setChecked(rc.make_backup);
lastfilesSB->setValue(rc.num_lastfiles);
{
rc.bind_file = internal_path(fromqstr(bindFileED->text()));
// write user_bind and user_unbind to .lyx/bind/user.bind
{
rc.bind_file = internal_path(fromqstr(bindFileED->text()));
// write user_bind and user_unbind to .lyx/bind/user.bind
- string bind_dir = addPath(package().user_support().absFilename(), "bind");
- if (!FileName(bind_dir).exists() && mkdir(FileName(bind_dir), 0777)) {
+ FileName bind_dir(addPath(package().user_support().absFilename(), "bind"));
+ if (!bind_dir.exists() && !bind_dir.createDirectory(0777)) {
lyxerr << "LyX could not create the user bind directory '"
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
return;
}
lyxerr << "LyX could not create the user bind directory '"
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
return;
}
lyxerr << "LyX could not write to the user bind directory '"
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
return;
}
lyxerr << "LyX could not write to the user bind directory '"
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
return;
}
user_bind_.write(user_bind_file.toFilesystemEncoding(), false, false);
user_unbind_.write(user_bind_file.toFilesystemEncoding(), true, true);
// immediately apply the keybindings. Why this is not done before?
user_bind_.write(user_bind_file.toFilesystemEncoding(), false, false);
user_unbind_.write(user_bind_file.toFilesystemEncoding(), true, true);
// immediately apply the keybindings. Why this is not done before?
-GuiPreferences::GuiPreferences(LyXView & lv)
- : GuiDialog(lv, "prefs"), update_screen_font_(false)
+GuiPreferences::GuiPreferences(GuiView & lv)
+ : GuiDialog(lv, "prefs", qt_("Preferences")), update_screen_font_(false)