From dd3842505b22a768c9b3f71d7e675f9c06381699 Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Wed, 30 Jan 2008 21:20:29 +0000 Subject: [PATCH] * a configuration value for the mouse wheel scrolling speed: lyxrc.mouse_wheel_speed git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22717 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyXFunc.cpp | 1 + src/LyXRC.cpp | 20 +++ src/LyXRC.h | 3 + src/frontends/qt4/GuiWorkArea.cpp | 10 +- src/frontends/qt4/ui/PrefInputUi.ui | 187 +++++++++++++++++++++++++ src/frontends/qt4/ui/PrefKeyboardUi.ui | 128 ----------------- 6 files changed, 219 insertions(+), 130 deletions(-) create mode 100644 src/frontends/qt4/ui/PrefInputUi.ui delete mode 100644 src/frontends/qt4/ui/PrefKeyboardUi.ui diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 289c3f8923..4c46f03425 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -2214,6 +2214,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_MACRO_EDIT_STYLE: case LyXRC::RC_MAKE_BACKUP: case LyXRC::RC_MARK_FOREIGN_LANGUAGE: + case LyXRC::RC_MOUSE_WHEEL_SPEED: case LyXRC::RC_NUMLASTFILES: case LyXRC::RC_PATH_PREFIX: if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) { diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index e266772bb5..d327d32901 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -98,6 +98,7 @@ keyword_item lyxrcTags[] = { { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE }, { "\\make_backup", LyXRC::RC_MAKE_BACKUP }, { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE }, + { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED }, { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES }, { "\\path_prefix", LyXRC::RC_PATH_PREFIX }, { "\\personal_dictionary", LyXRC::RC_PERS_DICT }, @@ -228,6 +229,7 @@ void LyXRC::setDefaults() { auto_region_delete = true; auto_reset_options = false; plaintext_linelen = 65; + mouse_wheel_speed = 1.0; num_lastfiles = maxlastfiles; check_lastfiles = true; use_lastfilepos = true; @@ -734,6 +736,12 @@ int LyXRC::read(Lexer & lexrc) } break; + case RC_MOUSE_WHEEL_SPEED: + if (lexrc.next()) { + mouse_wheel_speed = lexrc.getFloat(); + } + break; + case RC_NUMLASTFILES: if (lexrc.next()) { num_lastfiles = lexrc.getInteger(); @@ -1942,6 +1950,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_MOUSE_WHEEL_SPEED: + if (ignore_system_lyxrc || + mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) { + os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n'; + } + if (tag != RC_LAST) + break; case RC_NUMLASTFILES: if (ignore_system_lyxrc || num_lastfiles != system_lyxrc.num_lastfiles) { @@ -2530,6 +2545,11 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Select to control the highlighting of words with a language foreign to that of the document."); break; + case RC_MOUSE_WHEEL_SPEED: + str = bformat(_("The scrolling speed of the mouse wheel. "), + maxlastfiles); + break; + case RC_NUMLASTFILES: str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."), maxlastfiles); diff --git a/src/LyXRC.h b/src/LyXRC.h index 5d8ed983ee..ace663e113 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -86,6 +86,7 @@ public: RC_MACRO_EDIT_STYLE, RC_MAKE_BACKUP, RC_MARK_FOREIGN_LANGUAGE, + RC_MOUSE_WHEEL_SPEED, RC_NUMLASTFILES, RC_PATH_PREFIX, RC_PERS_DICT, @@ -253,6 +254,8 @@ public: /// Whether or not save/restore session information /// like windows position and geometry. bool allow_geometry_session; + /// Scrolling speed of the mouse wheel + double mouse_wheel_speed; /// Zoom factor for screen fonts unsigned int zoom; /// Screen font sizes in points for each font size diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 76308482d8..e31d15a55a 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -658,9 +658,15 @@ void GuiWorkArea::wheelEvent(QWheelEvent * e) { // Wheel rotation by one notch results in a delta() of 120 (see // documentation of QWheelEvent) - int const lines = qApp->wheelScrollLines() * e->delta() / 120; + double const lines = qApp->wheelScrollLines() + * lyxrc.mouse_wheel_speed + * e->delta() / 120.0; + lyxerr << "wheelScrollLines = " << qApp->wheelScrollLines() + << " delta = " << e->delta() + << " lines = " << lines + << std::endl; verticalScrollBar()->setValue(verticalScrollBar()->value() - - lines * verticalScrollBar()->singleStep()); + int(lines * verticalScrollBar()->singleStep())); } diff --git a/src/frontends/qt4/ui/PrefInputUi.ui b/src/frontends/qt4/ui/PrefInputUi.ui new file mode 100644 index 0000000000..26fca38254 --- /dev/null +++ b/src/frontends/qt4/ui/PrefInputUi.ui @@ -0,0 +1,187 @@ + + PrefKeyboardUi + + + + 0 + 0 + 392 + 297 + + + + + + + + + + Keyboard + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + Use &keyboard map + + + false + + + + + + + false + + + &First: + + + firstKeymapED + + + + + + + false + + + + + + + false + + + Br&owse... + + + false + + + + + + + false + + + S&econd: + + + secondKeymapED + + + + + + + false + + + + + + + false + + + Bro&wse... + + + false + + + + + + + + + + Mouse + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + Wheel scrolling speed: + + + + + + + 1.0 is the standard scrolling speed with the mouse wheel. Higher values will speed it up, low values slow it down. + + + 1 + + + 0.100000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + qt_helpers.h + + + + diff --git a/src/frontends/qt4/ui/PrefKeyboardUi.ui b/src/frontends/qt4/ui/PrefKeyboardUi.ui deleted file mode 100644 index ca6c609f7c..0000000000 --- a/src/frontends/qt4/ui/PrefKeyboardUi.ui +++ /dev/null @@ -1,128 +0,0 @@ - - PrefKeyboardUi - - - - 0 - 0 - 338 - 253 - - - - - - - - 11 - - - 6 - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - false - - - - - - - false - - - - - - - false - - - Bro&wse... - - - false - - - - - - - false - - - S&econd: - - - secondKeymapED - - - - - - - false - - - &First: - - - firstKeymapED - - - - - - - false - - - Br&owse... - - - false - - - - - - - Use &keyboard map - - - false - - - - - - - keymapCB - firstKeymapED - firstKeymapPB - secondKeymapED - secondKeymapPB - - - qt_helpers.h - - - - -- 2.39.2