mirror of https://github.com/vitalif/openscad
#879 Implemented wheel zoom for scintilla editor
parent
6ecf72a976
commit
e3960304bd
|
@ -369,6 +369,7 @@ src/FontCache.cc \
|
|||
src/highlighter.cc \
|
||||
src/Preferences.cc \
|
||||
src/OpenCSGWarningDialog.cc \
|
||||
src/editor.cc \
|
||||
src/GLView.cc \
|
||||
src/QGLView.cc \
|
||||
src/AutoUpdater.cc \
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#include "editor.h"
|
||||
#include "Preferences.h"
|
||||
|
||||
void EditorInterface::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
QSettings settings;
|
||||
bool wheelzoom_enabled = Preferences::inst()->getValue("editor/ctrlmousewheelzoom").toBool();
|
||||
if ((event->modifiers() == Qt::ControlModifier) && wheelzoom_enabled) {
|
||||
if (event->delta() > 0)
|
||||
zoomIn();
|
||||
else if (event->delta() < 0)
|
||||
zoomOut();
|
||||
} else {
|
||||
QWidget::wheelEvent(event);
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ public:
|
|||
virtual ~EditorInterface() {}
|
||||
virtual QSize sizeHint(){ QSize size; return size;}
|
||||
virtual void setInitialSizeHint(const QSize&) { }
|
||||
virtual void wheelEvent(QWheelEvent*) { }
|
||||
virtual void wheelEvent(QWheelEvent*);
|
||||
virtual void setTabStopWidth(int) { }
|
||||
virtual QString toPlainText() = 0;
|
||||
virtual QTextDocument *document(){QTextDocument *t = new QTextDocument; return t;}
|
||||
|
|
|
@ -117,20 +117,6 @@ void LegacyEditor::zoomOut()
|
|||
|
||||
}
|
||||
|
||||
void LegacyEditor::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
QSettings settings;
|
||||
bool wheelzoom_enabled = Preferences::inst()->getValue("editor/ctrlmousewheelzoom").toBool();
|
||||
if ((event->modifiers() == Qt::ControlModifier) && wheelzoom_enabled) {
|
||||
if (event->delta() > 0)
|
||||
zoomIn();
|
||||
else if (event->delta() < 0)
|
||||
zoomOut();
|
||||
} else {
|
||||
QWidget::wheelEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void LegacyEditor::setPlainText(const QString &text)
|
||||
{
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QWheelEvent>
|
||||
#include <QScrollBar>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
@ -19,7 +18,6 @@ public:
|
|||
QSize sizeHint() const;
|
||||
void setInitialSizeHint(const QSize&);
|
||||
void setTabStopWidth(int);
|
||||
void wheelEvent(QWheelEvent*);
|
||||
QString toPlainText();
|
||||
QTextCursor textCursor() const;
|
||||
void setTextCursor (const QTextCursor&);
|
||||
|
|
Loading…
Reference in New Issue