#include "BufferList.h"
#include "Color.h"
#include "ConverterCache.h"
-#include "debug.h"
#include "FuncRequest.h"
-#include "gettext.h"
#include "GuiFontExample.h"
#include "GuiKeySymbol.h"
#include "KeyMap.h"
#include "paper.h"
#include "Session.h"
+#include "support/debug.h"
+#include "support/FileFilterList.h"
#include "support/FileName.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
-#include "support/lyxlib.h"
#include "support/os.h"
#include "support/Package.h"
-#include "support/FileFilterList.h"
#include "graphics/GraphicsTypes.h"
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QValidator>
-#include <QCloseEvent>
#include <iomanip>
#include <sstream>
using namespace Ui;
-using std::endl;
-using std::ostringstream;
-using std::string;
-using std::vector;
+using namespace std;
+using namespace lyx::support;
+using namespace lyx::support::os;
namespace lyx {
namespace frontend {
-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;
-
/////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////
template<class A>
-static size_t findPos_helper(std::vector<A> const & vec, A const & val)
+static size_t findPos_helper(vector<A> const & vec, A const & val)
{
- typedef typename std::vector<A>::const_iterator Cit;
+ typedef typename vector<A>::const_iterator Cit;
- Cit it = std::find(vec.begin(), vec.end(), val);
+ Cit it = find(vec.begin(), vec.end(), val);
if (it == vec.end())
return 0;
- return std::distance(vec.begin(), it);
+ return distance(vec.begin(), it);
}
static void parseFontName(QString const & mangled0,
string & name, string & foundry)
{
- std::string mangled = fromqstr(mangled0);
+ string mangled = fromqstr(mangled0);
size_t const idx = mangled.find('[');
if (idx == string::npos || idx == 0) {
name = mangled;
/////////////////////////////////////////////////////////////////////
//
-// PrefKeyboard
+// PrefInput
//
/////////////////////////////////////////////////////////////////////
-PrefKeyboard::PrefKeyboard(GuiPreferences * form, QWidget * parent)
- : PrefModule(_("Keyboard"), form, parent)
+PrefInput::PrefInput(GuiPreferences * form, QWidget * parent)
+ : PrefModule(_("Keyboard/Mouse"), form, parent)
{
setupUi(this);
this, SIGNAL(changed()));
connect(secondKeymapED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+ connect(inlineDelaySB, SIGNAL(valueChanged(double)),
+ this, SIGNAL(changed()));
+ connect(inlineMathCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(inlineTextCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(inlineDotsCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(popupDelaySB, SIGNAL(valueChanged(double)),
+ this, SIGNAL(changed()));
+ connect(popupMathCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(popupTextCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(popupAfterCompleteCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(mouseWheelSpeedSB, SIGNAL(valueChanged(double)),
+ this, SIGNAL(changed()));
}
-void PrefKeyboard::apply(LyXRC & rc) const
+void PrefInput::apply(LyXRC & rc) const
{
// 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()));
+ rc.completion_inline_delay = inlineDelaySB->value();
+ rc.completion_inline_math = inlineMathCB->isChecked();
+ rc.completion_inline_text = inlineTextCB->isChecked();
+ rc.completion_inline_dots = inlineDotsCB->isChecked() ? 13 : -1;
+ rc.completion_popup_delay = popupDelaySB->value();
+ rc.completion_popup_math = popupMathCB->isChecked();
+ rc.completion_popup_text = popupTextCB->isChecked();
+ rc.completion_popup_after_complete
+ = popupAfterCompleteCB->isChecked();
+ rc.mouse_wheel_speed = mouseWheelSpeedSB->value();
}
-void PrefKeyboard::update(LyXRC const & rc)
+void PrefInput::update(LyXRC const & rc)
{
// 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)));
+ inlineDelaySB->setValue(rc.completion_inline_delay);
+ inlineMathCB->setChecked(rc.completion_inline_math);
+ inlineTextCB->setChecked(rc.completion_inline_text);
+ inlineDotsCB->setChecked(rc.completion_inline_dots != -1);
+ popupDelaySB->setValue(rc.completion_popup_delay);
+ popupMathCB->setChecked(rc.completion_popup_math);
+ popupTextCB->setChecked(rc.completion_popup_text);
+ popupAfterCompleteCB->setChecked(rc.completion_popup_after_complete);
+ mouseWheelSpeedSB->setValue(rc.mouse_wheel_speed);
}
-QString PrefKeyboard::testKeymap(QString keymap)
+QString PrefInput::testKeymap(QString keymap)
{
return toqstr(form_->browsekbmap(from_utf8(internal_path(fromqstr(keymap)))));
}
-void PrefKeyboard::on_firstKeymapPB_clicked(bool)
+void PrefInput::on_firstKeymapPB_clicked(bool)
{
QString const file = testKeymap(firstKeymapED->text());
if (!file.isEmpty())
}
-void PrefKeyboard::on_secondKeymapPB_clicked(bool)
+void PrefInput::on_secondKeymapPB_clicked(bool)
{
QString const file = testKeymap(secondKeymapED->text());
if (!file.isEmpty())
}
-void PrefKeyboard::on_keymapCB_toggled(bool keymap)
+void PrefInput::on_keymapCB_toggled(bool keymap)
{
firstKeymapLA->setEnabled(keymap);
secondKeymapLA->setEnabled(keymap);
this, SIGNAL(changed()));
connect(screenHugerED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
+ connect(pixmapCacheCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
screenTinyED->setValidator(new QDoubleValidator(screenTinyED));
screenSmallestED->setValidator(new QDoubleValidator(screenSmallestED));
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.use_pixmap_cache = pixmapCacheCB->isChecked();
if (rc.font_sizes != oldrc.font_sizes
|| rc.roman_font_name != oldrc.roman_font_name
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]));
+
+ pixmapCacheCB->setChecked(rc.use_pixmap_cache);
+#if defined(Q_WS_X11)
+ pixmapCacheCB->setEnabled(false);
+#endif
+
}
lcolors_.push_back(lc);
}
- std::sort(lcolors_.begin(), lcolors_.end(), ColorSorter());
+ sort(lcolors_.begin(), lcolors_.end(), ColorSorter());
vector<ColorCode>::const_iterator cit = lcolors_.begin();
vector<ColorCode>::const_iterator const end = lcolors_.end();
for (; cit != end; ++cit) {
connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(select_lyxpipe()));
connect(workingDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
- connect(exampleDirPB, SIGNAL(textChanged(QString)),
+ connect(exampleDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(templateDirED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
{
docstring file(form_->browsedir(
from_utf8(internal_path(fromqstr(exampleDirED->text()))),
- _("Select a document templates directory")));
+ _("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) {
- std::string const name =
+ string const name =
ccit->From->prettyname() + " -> " + ccit->To->prettyname();
int type = form_->converters().getNumber(ccit->From->name(), ccit->To->name());
new QListWidgetItem(toqstr(name), convertersLW, type);
{
}
-std::string FormatNameValidator::str(Formats::const_iterator it) const
+string FormatNameValidator::str(Formats::const_iterator it) const
{
return it->name();
}
}
-std::string FormatPrettynameValidator::str(Formats::const_iterator it) const
+string FormatPrettynameValidator::str(Formats::const_iterator it) const
{
return it->prettyname();
}
{
setupUi(this);
- 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()));
defaultLanguageCO->clear();
// store the lang identifiers for later
- 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();
lang_.clear();
for (; lit != lend; ++lit) {
defaultLanguageCO->addItem(toqstr(lit->first));
void PrefLanguage::apply(LyXRC & rc) const
{
// FIXME: remove rtl_support bool
- rc.rtl_support = rtlCB->isChecked();
+ rc.rtl_support = rtlGB->isChecked();
+ rc.visual_cursor = rtlGB->isChecked() && visualCursorRB->isChecked();
rc.mark_foreign_language = markForeignCB->isChecked();
rc.language_auto_begin = autoBeginCB->isChecked();
rc.language_auto_end = autoEndCB->isChecked();
void PrefLanguage::update(LyXRC const & rc)
{
// FIXME: remove rtl_support bool
- rtlCB->setChecked(rc.rtl_support);
+ rtlGB->setChecked(rc.rtl_support);
+ if (rc.visual_cursor)
+ visualCursorRB->setChecked(true);
+ else
+ logicalCursorRB->setChecked(true);
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()));
+ connect(macroEditStyleCO, SIGNAL(activated(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()));
- connect(pixmapCacheCB, SIGNAL(toggled(bool)),
+ connect(tooltipCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
+ connect(fullscreenLimitGB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
+ connect(fullscreenWidthSB, SIGNAL(valueChanged(int)),
+ this, SIGNAL(changed()));
+ connect(toggleTabbarCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
+ connect(toggleScrollbarCB, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
+ connect(toggleToolbarsCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
lastfilesSB->setMaximum(maxlastfiles);
}
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.use_pixmap_cache = pixmapCacheCB->isChecked();
+ rc.use_tooltip = tooltipCB->isChecked();
+ rc.full_screen_toolbars = toggleToolbarsCB->isChecked();
+ rc.full_screen_scrollbar = toggleScrollbarCB->isChecked();
+ rc.full_screen_tabbar = toggleTabbarCB->isChecked();
+ rc.full_screen_width = fullscreenWidthSB->value();
+ rc.full_screen_limit = fullscreenLimitGB->isChecked();
}
allowGeometrySessionCB->setChecked(rc.allow_geometry_session);
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
sortEnvironmentsCB->setChecked(rc.sort_layouts);
+ macroEditStyleCO->setCurrentIndex(rc.macro_edit_style);
// convert to minutes
int mins(rc.autosave / 60);
if (rc.autosave && !mins)
autoSaveSB->setValue(mins);
autoSaveCB->setChecked(rc.make_backup);
lastfilesSB->setValue(rc.num_lastfiles);
- pixmapCacheCB->setChecked(rc.use_pixmap_cache);
-#if defined(Q_WS_X11)
- pixmapCacheGB->setEnabled(false);
-#endif
+ tooltipCB->setChecked(rc.use_tooltip);
+ toggleScrollbarCB->setChecked(rc.full_screen_scrollbar);
+ toggleToolbarsCB->setChecked(rc.full_screen_toolbars);
+ toggleTabbarCB->setChecked(rc.full_screen_tabbar);
+ fullscreenWidthSB->setValue(rc.full_screen_width);
+ fullscreenLimitGB->setChecked(rc.full_screen_limit);
+
}
{
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;
}
- if (!FileName(bind_dir).isDirWritable()) {
+ if (!bind_dir.isDirWritable()) {
lyxerr << "LyX could not write to the user bind directory '"
<< bind_dir << "'. All user-defined key bindings will be lost." << endl;
return;
}
- FileName user_bind_file = FileName(addName(bind_dir, "user.bind"));
+ FileName user_bind_file(bind_dir.absFilename() + "/user.bind");
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(GuiView & lv)
- : GuiDialog(lv, "prefs"), update_screen_font_(false)
+ : GuiDialog(lv, "prefs", qt_("Preferences")), update_screen_font_(false)
{
setupUi(this);
- setViewTitle(_("Preferences"));
QDialog::setModal(false);
add(new PrefScreenFonts(this));
add(new PrefColors(this));
add(new PrefDisplay);
- add(new PrefKeyboard(this));
+ add(new PrefInput(this));
add(new PrefPaths(this));
}
-void GuiPreferences::closeEvent(QCloseEvent * e)
-{
- slotClose();
- e->accept();
-}
-
-
void GuiPreferences::change_adaptor()
{
changed();
}
-bool GuiPreferences::initialiseParams(std::string const &)
+bool GuiPreferences::initialiseParams(string const &)
{
rc_ = lyxrc;
formats_ = lyx::formats;