mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-13 20:09:59 +00:00
make mouse scroll wheel zoom configurable
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34955 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
30bae1710a
commit
0d386d7c25
@ -173,6 +173,7 @@ LexerKeyword lyxrcTags[] = {
|
|||||||
{ "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
|
{ "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
|
||||||
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
|
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
|
||||||
{ "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
|
{ "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
|
||||||
|
{ "\\scroll_whell_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
|
||||||
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
|
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
|
||||||
{ "\\set_color", LyXRC::RC_SET_COLOR },
|
{ "\\set_color", LyXRC::RC_SET_COLOR },
|
||||||
{ "\\show_banner", LyXRC::RC_SHOW_BANNER },
|
{ "\\show_banner", LyXRC::RC_SHOW_BANNER },
|
||||||
@ -320,6 +321,7 @@ void LyXRC::setDefaults()
|
|||||||
date_insert_format = "%x";
|
date_insert_format = "%x";
|
||||||
cursor_follows_scrollbar = false;
|
cursor_follows_scrollbar = false;
|
||||||
scroll_below_document = false;
|
scroll_below_document = false;
|
||||||
|
scroll_whell_zoom = SCROLL_WHEEL_ZOOM_CTRL;
|
||||||
paragraph_markers = false;
|
paragraph_markers = false;
|
||||||
mac_like_word_movement = false;
|
mac_like_word_movement = false;
|
||||||
macro_edit_style = MACRO_EDIT_INLINE_BOX;
|
macro_edit_style = MACRO_EDIT_INLINE_BOX;
|
||||||
@ -1195,6 +1197,23 @@ int LyXRC::read(Lexer & lexrc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case RC_SCROLL_WHEEL_ZOOM:
|
||||||
|
if (lexrc.next()) {
|
||||||
|
string const tmp = lexrc.getString();
|
||||||
|
if (tmp == "ctrl")
|
||||||
|
scroll_whell_zoom = SCROLL_WHEEL_ZOOM_CTRL;
|
||||||
|
else if (tmp == "shift")
|
||||||
|
scroll_whell_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
|
||||||
|
else if (tmp == "option")
|
||||||
|
scroll_whell_zoom = SCROLL_WHEEL_ZOOM_OPTION;
|
||||||
|
else {
|
||||||
|
scroll_whell_zoom = SCROLL_WHEEL_ZOOM_OFF;
|
||||||
|
if (tmp != "off" && tmp != "false")
|
||||||
|
LYXERR0("Unrecognized scroll_whell_zoom status \""
|
||||||
|
<< tmp << '"');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
// Obsoteted in 1.4.0
|
// Obsoteted in 1.4.0
|
||||||
case RC_USETEMPDIR:
|
case RC_USETEMPDIR:
|
||||||
@ -2571,6 +2590,29 @@ 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_SCROLL_WHEEL_ZOOM:
|
||||||
|
if (ignore_system_lyxrc ||
|
||||||
|
scroll_whell_zoom != system_lyxrc.scroll_whell_zoom) {
|
||||||
|
string status;
|
||||||
|
switch (scroll_whell_zoom) {
|
||||||
|
case SCROLL_WHEEL_ZOOM_OFF:
|
||||||
|
status = "off";
|
||||||
|
break;
|
||||||
|
case SCROLL_WHEEL_ZOOM_CTRL:
|
||||||
|
status = "ctrl";
|
||||||
|
break;
|
||||||
|
case SCROLL_WHEEL_ZOOM_SHIFT:
|
||||||
|
status = "shift";
|
||||||
|
break;
|
||||||
|
case SCROLL_WHEEL_ZOOM_OPTION:
|
||||||
|
status = "option";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
os << "\\scroll_whell_zoom " << status << '\n';
|
||||||
|
}
|
||||||
|
if (tag != RC_LAST)
|
||||||
|
break;
|
||||||
|
|
||||||
os << "\n#\n"
|
os << "\n#\n"
|
||||||
<< "# FORMATS SECTION ##########################\n"
|
<< "# FORMATS SECTION ##########################\n"
|
||||||
<< "#\n\n";
|
<< "#\n\n";
|
||||||
@ -2909,6 +2951,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
|||||||
case LyXRC::RC_FORWARD_SEARCH_PDF:
|
case LyXRC::RC_FORWARD_SEARCH_PDF:
|
||||||
case LyXRC::RC_EXPORT_OVERWRITE:
|
case LyXRC::RC_EXPORT_OVERWRITE:
|
||||||
case LyXRC::RC_DEFAULT_DECIMAL_POINT:
|
case LyXRC::RC_DEFAULT_DECIMAL_POINT:
|
||||||
|
case LyXRC::RC_SCROLL_WHEEL_ZOOM:
|
||||||
case LyXRC::RC_LAST:
|
case LyXRC::RC_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
10
src/LyXRC.h
10
src/LyXRC.h
@ -156,6 +156,7 @@ public:
|
|||||||
RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
|
RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
|
||||||
RC_SCREEN_ZOOM,
|
RC_SCREEN_ZOOM,
|
||||||
RC_SCROLL_BELOW_DOCUMENT,
|
RC_SCROLL_BELOW_DOCUMENT,
|
||||||
|
RC_SCROLL_WHEEL_ZOOM,
|
||||||
RC_SERVERPIPE,
|
RC_SERVERPIPE,
|
||||||
RC_SET_COLOR,
|
RC_SET_COLOR,
|
||||||
RC_SHOW_BANNER,
|
RC_SHOW_BANNER,
|
||||||
@ -502,6 +503,15 @@ public:
|
|||||||
int export_overwrite;
|
int export_overwrite;
|
||||||
/// Default decimal point when aligning table columns on decimal
|
/// Default decimal point when aligning table columns on decimal
|
||||||
std::string default_decimal_point;
|
std::string default_decimal_point;
|
||||||
|
///
|
||||||
|
enum ScrollWheelZoom {
|
||||||
|
SCROLL_WHEEL_ZOOM_OFF,
|
||||||
|
SCROLL_WHEEL_ZOOM_CTRL,
|
||||||
|
SCROLL_WHEEL_ZOOM_SHIFT,
|
||||||
|
SCROLL_WHEEL_ZOOM_OPTION
|
||||||
|
};
|
||||||
|
///
|
||||||
|
ScrollWheelZoom scroll_whell_zoom;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -460,6 +460,10 @@ PrefInput::PrefInput(GuiPreferences * form)
|
|||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
connect(mouseWheelSpeedSB, SIGNAL(valueChanged(double)),
|
connect(mouseWheelSpeedSB, SIGNAL(valueChanged(double)),
|
||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
|
connect(scrollzoomEnableCB, SIGNAL(clicked()),
|
||||||
|
this, SIGNAL(changed()));
|
||||||
|
connect(scrollzoomValueCO, SIGNAL(activated(int)),
|
||||||
|
this, SIGNAL(changed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -470,6 +474,21 @@ void PrefInput::apply(LyXRC & rc) const
|
|||||||
rc.primary_kbmap = internal_path(fromqstr(firstKeymapED->text()));
|
rc.primary_kbmap = internal_path(fromqstr(firstKeymapED->text()));
|
||||||
rc.secondary_kbmap = internal_path(fromqstr(secondKeymapED->text()));
|
rc.secondary_kbmap = internal_path(fromqstr(secondKeymapED->text()));
|
||||||
rc.mouse_wheel_speed = mouseWheelSpeedSB->value();
|
rc.mouse_wheel_speed = mouseWheelSpeedSB->value();
|
||||||
|
if (scrollzoomEnableCB->isChecked()) {
|
||||||
|
switch (scrollzoomValueCO->currentIndex()) {
|
||||||
|
case 0:
|
||||||
|
rc.scroll_whell_zoom = LyXRC::SCROLL_WHEEL_ZOOM_CTRL;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
rc.scroll_whell_zoom = LyXRC::SCROLL_WHEEL_ZOOM_SHIFT;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
rc.scroll_whell_zoom = LyXRC::SCROLL_WHEEL_ZOOM_OPTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rc.scroll_whell_zoom = LyXRC::SCROLL_WHEEL_ZOOM_OFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -480,6 +499,23 @@ void PrefInput::update(LyXRC const & rc)
|
|||||||
firstKeymapED->setText(toqstr(external_path(rc.primary_kbmap)));
|
firstKeymapED->setText(toqstr(external_path(rc.primary_kbmap)));
|
||||||
secondKeymapED->setText(toqstr(external_path(rc.secondary_kbmap)));
|
secondKeymapED->setText(toqstr(external_path(rc.secondary_kbmap)));
|
||||||
mouseWheelSpeedSB->setValue(rc.mouse_wheel_speed);
|
mouseWheelSpeedSB->setValue(rc.mouse_wheel_speed);
|
||||||
|
switch (rc.scroll_whell_zoom) {
|
||||||
|
case LyXRC::SCROLL_WHEEL_ZOOM_OFF:
|
||||||
|
scrollzoomEnableCB->setChecked(false);
|
||||||
|
break;
|
||||||
|
case LyXRC::SCROLL_WHEEL_ZOOM_CTRL:
|
||||||
|
scrollzoomEnableCB->setChecked(true);
|
||||||
|
scrollzoomValueCO->setCurrentIndex(0);
|
||||||
|
break;
|
||||||
|
case LyXRC::SCROLL_WHEEL_ZOOM_SHIFT:
|
||||||
|
scrollzoomEnableCB->setChecked(true);
|
||||||
|
scrollzoomValueCO->setCurrentIndex(1);
|
||||||
|
break;
|
||||||
|
case LyXRC::SCROLL_WHEEL_ZOOM_OPTION:
|
||||||
|
scrollzoomEnableCB->setChecked(true);
|
||||||
|
scrollzoomValueCO->setCurrentIndex(2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -516,6 +552,12 @@ void PrefInput::on_keymapCB_toggled(bool keymap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PrefInput::on_scrollzoomEnableCB_toggled(bool enabled)
|
||||||
|
{
|
||||||
|
scrollzoomValueCO->setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// PrefCompletion
|
// PrefCompletion
|
||||||
|
@ -183,6 +183,7 @@ private Q_SLOTS:
|
|||||||
void on_firstKeymapPB_clicked(bool);
|
void on_firstKeymapPB_clicked(bool);
|
||||||
void on_secondKeymapPB_clicked(bool);
|
void on_secondKeymapPB_clicked(bool);
|
||||||
void on_keymapCB_toggled(bool);
|
void on_keymapCB_toggled(bool);
|
||||||
|
void on_scrollzoomEnableCB_toggled(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString testKeymap(QString const & keymap);
|
QString testKeymap(QString const & keymap);
|
||||||
|
@ -817,7 +817,24 @@ void GuiWorkArea::wheelEvent(QWheelEvent * ev)
|
|||||||
// 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)
|
||||||
double const delta = ev->delta() / 120.0;
|
double const delta = ev->delta() / 120.0;
|
||||||
if (ev->modifiers() & Qt::ControlModifier) {
|
bool zoom = false;
|
||||||
|
switch (lyxrc.scroll_whell_zoom) {
|
||||||
|
case LyXRC::SCROLL_WHEEL_ZOOM_CTRL:
|
||||||
|
zoom = ev->modifiers() & Qt::ControlModifier;
|
||||||
|
zoom &= !(ev->modifiers() & (Qt::ShiftModifier || Qt::AltModifier));
|
||||||
|
break;
|
||||||
|
case LyXRC::SCROLL_WHEEL_ZOOM_SHIFT:
|
||||||
|
zoom = ev->modifiers() & Qt::ShiftModifier;
|
||||||
|
zoom &= !(ev->modifiers() & (Qt::ControlModifier || Qt::AltModifier));
|
||||||
|
break;
|
||||||
|
case LyXRC::SCROLL_WHEEL_ZOOM_OPTION:
|
||||||
|
zoom = ev->modifiers() & Qt::AltModifier;
|
||||||
|
zoom &= !(ev->modifiers() & (Qt::ShiftModifier || Qt::ControlModifier));
|
||||||
|
break;
|
||||||
|
case LyXRC::SCROLL_WHEEL_ZOOM_OFF:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (zoom) {
|
||||||
docstring arg = convert<docstring>(int(5 * delta));
|
docstring arg = convert<docstring>(int(5 * delta));
|
||||||
lyx::dispatch(FuncRequest(LFUN_BUFFER_ZOOM_IN, arg));
|
lyx::dispatch(FuncRequest(LFUN_BUFFER_ZOOM_IN, arg));
|
||||||
return;
|
return;
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>426</width>
|
<width>432</width>
|
||||||
<height>227</height>
|
<height>303</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -177,6 +177,81 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="scrollzoomGB">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>65</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Scroll wheel zoom</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>304</width>
|
||||||
|
<height>27</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetNoConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="scrollzoomEnableCB">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="scrollzoomValueCO">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ctrl</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Shift</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Option</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user