* 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
This commit is contained in:
Stefan Schimanski 2008-01-30 21:20:29 +00:00
parent ddec18ca01
commit dd3842505b
6 changed files with 219 additions and 130 deletions

View File

@ -2214,6 +2214,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
case LyXRC::RC_MACRO_EDIT_STYLE: case LyXRC::RC_MACRO_EDIT_STYLE:
case LyXRC::RC_MAKE_BACKUP: case LyXRC::RC_MAKE_BACKUP:
case LyXRC::RC_MARK_FOREIGN_LANGUAGE: case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
case LyXRC::RC_MOUSE_WHEEL_SPEED:
case LyXRC::RC_NUMLASTFILES: case LyXRC::RC_NUMLASTFILES:
case LyXRC::RC_PATH_PREFIX: case LyXRC::RC_PATH_PREFIX:
if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) { if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {

View File

@ -98,6 +98,7 @@ keyword_item lyxrcTags[] = {
{ "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE }, { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
{ "\\make_backup", LyXRC::RC_MAKE_BACKUP }, { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
{ "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE }, { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
{ "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
{ "\\num_lastfiles", LyXRC::RC_NUMLASTFILES }, { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
{ "\\path_prefix", LyXRC::RC_PATH_PREFIX }, { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
{ "\\personal_dictionary", LyXRC::RC_PERS_DICT }, { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
@ -228,6 +229,7 @@ void LyXRC::setDefaults() {
auto_region_delete = true; auto_region_delete = true;
auto_reset_options = false; auto_reset_options = false;
plaintext_linelen = 65; plaintext_linelen = 65;
mouse_wheel_speed = 1.0;
num_lastfiles = maxlastfiles; num_lastfiles = maxlastfiles;
check_lastfiles = true; check_lastfiles = true;
use_lastfilepos = true; use_lastfilepos = true;
@ -734,6 +736,12 @@ int LyXRC::read(Lexer & lexrc)
} }
break; break;
case RC_MOUSE_WHEEL_SPEED:
if (lexrc.next()) {
mouse_wheel_speed = lexrc.getFloat();
}
break;
case RC_NUMLASTFILES: case RC_NUMLASTFILES:
if (lexrc.next()) { if (lexrc.next()) {
num_lastfiles = lexrc.getInteger(); 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) if (tag != RC_LAST)
break; 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: case RC_NUMLASTFILES:
if (ignore_system_lyxrc || if (ignore_system_lyxrc ||
num_lastfiles != system_lyxrc.num_lastfiles) { 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."); str = _("Select to control the highlighting of words with a language foreign to that of the document.");
break; break;
case RC_MOUSE_WHEEL_SPEED:
str = bformat(_("The scrolling speed of the mouse wheel. "),
maxlastfiles);
break;
case RC_NUMLASTFILES: case RC_NUMLASTFILES:
str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."), str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
maxlastfiles); maxlastfiles);

View File

@ -86,6 +86,7 @@ public:
RC_MACRO_EDIT_STYLE, RC_MACRO_EDIT_STYLE,
RC_MAKE_BACKUP, RC_MAKE_BACKUP,
RC_MARK_FOREIGN_LANGUAGE, RC_MARK_FOREIGN_LANGUAGE,
RC_MOUSE_WHEEL_SPEED,
RC_NUMLASTFILES, RC_NUMLASTFILES,
RC_PATH_PREFIX, RC_PATH_PREFIX,
RC_PERS_DICT, RC_PERS_DICT,
@ -253,6 +254,8 @@ public:
/// Whether or not save/restore session information /// Whether or not save/restore session information
/// like windows position and geometry. /// like windows position and geometry.
bool allow_geometry_session; bool allow_geometry_session;
/// Scrolling speed of the mouse wheel
double mouse_wheel_speed;
/// Zoom factor for screen fonts /// Zoom factor for screen fonts
unsigned int zoom; unsigned int zoom;
/// Screen font sizes in points for each font size /// Screen font sizes in points for each font size

View File

@ -658,9 +658,15 @@ void GuiWorkArea::wheelEvent(QWheelEvent * e)
{ {
// Wheel rotation by one notch results in a delta() of 120 (see // Wheel rotation by one notch results in a delta() of 120 (see
// documentation of QWheelEvent) // 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() - verticalScrollBar()->setValue(verticalScrollBar()->value() -
lines * verticalScrollBar()->singleStep()); int(lines * verticalScrollBar()->singleStep()));
} }

View File

@ -0,0 +1,187 @@
<ui version="4.0" >
<class>PrefKeyboardUi</class>
<widget class="QWidget" name="PrefKeyboardUi" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>392</width>
<height>297</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="keyboardGB" >
<property name="title" >
<string>Keyboard</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="3" >
<widget class="QCheckBox" name="keymapCB" >
<property name="text" >
<string>Use &amp;keyboard map</string>
</property>
<property name="checked" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="firstKeymapLA" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>&amp;First:</string>
</property>
<property name="buddy" >
<cstring>firstKeymapED</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="firstKeymapED" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="firstKeymapPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Br&amp;owse...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="secondKeymapLA" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>S&amp;econd:</string>
</property>
<property name="buddy" >
<cstring>secondKeymapED</cstring>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="secondKeymapED" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QPushButton" name="secondKeymapPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Bro&amp;wse...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mouseGB" >
<property name="title" >
<string>Mouse</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="scrollingSpeedLA" >
<property name="text" >
<string>Wheel scrolling speed:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="mouseWheelSpeedSB" >
<property name="toolTip" >
<string>1.0 is the standard scrolling speed with the mouse wheel. Higher values will speed it up, low values slow it down.</string>
</property>
<property name="decimals" >
<number>1</number>
</property>
<property name="minimum" >
<double>0.100000000000000</double>
</property>
<property name="maximum" >
<double>10.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.100000000000000</double>
</property>
<property name="value" >
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<includes>
<include location="local" >qt_helpers.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -1,128 +0,0 @@
<ui version="4.0" >
<class>PrefKeyboardUi</class>
<widget class="QWidget" name="PrefKeyboardUi" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>338</width>
<height>253</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>11</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="3" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="firstKeymapED" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="secondKeymapED" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QPushButton" name="secondKeymapPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Bro&amp;wse...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="secondKeymapLA" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>S&amp;econd:</string>
</property>
<property name="buddy" >
<cstring>secondKeymapED</cstring>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="firstKeymapLA" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>&amp;First:</string>
</property>
<property name="buddy" >
<cstring>firstKeymapED</cstring>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="firstKeymapPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Br&amp;owse...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3" >
<widget class="QCheckBox" name="keymapCB" >
<property name="text" >
<string>Use &amp;keyboard map</string>
</property>
<property name="checked" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>keymapCB</tabstop>
<tabstop>firstKeymapED</tabstop>
<tabstop>firstKeymapPB</tabstop>
<tabstop>secondKeymapED</tabstop>
<tabstop>secondKeymapPB</tabstop>
</tabstops>
<includes>
<include location="local" >qt_helpers.h</include>
</includes>
<resources/>
<connections/>
</ui>