diff --git a/src/Preferences.cc b/src/Preferences.cc index 0fedbb84..2c149696 100644 --- a/src/Preferences.cc +++ b/src/Preferences.cc @@ -65,6 +65,12 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent) this->defaultmap["editor/fontsize"] = 12; this->defaultmap["editor/syntaxhighlight"] = "For Light Background"; +#if defined (Q_OS_MAC) + this->defaultmap["editor/ctrlmousewheelzoom"] = false; +#else + this->defaultmap["editor/ctrlmousewheelzoom"] = true; +#endif + uint savedsize = getValue("editor/fontsize").toUInt(); QFontDatabase db; foreach(uint size, db.standardSizes()) { @@ -373,6 +379,12 @@ void Preferences::on_forceGoldfeatherBox_toggled(bool state) emit openCSGSettingsChanged(); } +void Preferences::on_mouseWheelZoomBox_toggled(bool state) +{ + QSettings settings; + settings.setValue("editor/ctrlmousewheelzoom", state); +} + void Preferences::keyPressEvent(QKeyEvent *e) { #ifdef Q_OS_MAC @@ -435,6 +447,8 @@ void Preferences::updateGUI() int shidx = this->syntaxHighlight->findText(shighlight); if (shidx >= 0) this->syntaxHighlight->setCurrentIndex(shidx); + this->mouseWheelZoomBox->setChecked(getValue("editor/ctrlmousewheelzoom").toBool()); + if (AutoUpdater *updater = AutoUpdater::updater()) { this->updateCheckBox->setChecked(updater->automaticallyChecksForUpdates()); this->snapshotCheckBox->setChecked(updater->enableSnapshots()); diff --git a/src/Preferences.h b/src/Preferences.h index d74ada90..62e7ee5e 100644 --- a/src/Preferences.h +++ b/src/Preferences.h @@ -32,6 +32,7 @@ public slots: void on_polysetCacheSizeEdit_textChanged(const QString &); void on_opencsgLimitEdit_textChanged(const QString &); void on_forceGoldfeatherBox_toggled(bool); + void on_mouseWheelZoomBox_toggled(bool); void on_updateCheckBox_toggled(bool); void on_snapshotCheckBox_toggled(bool); void on_checkNowButton_clicked(); diff --git a/src/Preferences.ui b/src/Preferences.ui index 4c76c7eb..a078bbfb 100644 --- a/src/Preferences.ui +++ b/src/Preferences.ui @@ -165,7 +165,7 @@ - + 0 @@ -182,24 +182,14 @@ - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 30 - 20 - - - - + + + 0 + 0 + + For Light Background @@ -217,6 +207,62 @@ + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 30 + 20 + + + + + + + + + + 5 + + + + + + 75 + true + + + + Use Ctrl/Cmd-Mouse-wheel to zoom text + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -417,8 +463,8 @@ 0 0 - 98 - 36 + 803 + 325 diff --git a/src/editor.cc b/src/editor.cc index 8f45b0a0..3c0e0194 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -104,6 +104,11 @@ void Editor::zoomOut() void Editor::wheelEvent ( QWheelEvent * event ) { + QSettings settings; + if (!Preferences::inst()->getValue("editor/ctrlmousewheelzoom").toBool()) { + return; + // see numerous bug reports on mailing list + } if (event->modifiers() == Qt::ControlModifier) { if (event->delta() > 0 ) zoomIn();