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/highlighter.cc \
|
||||||
src/Preferences.cc \
|
src/Preferences.cc \
|
||||||
src/OpenCSGWarningDialog.cc \
|
src/OpenCSGWarningDialog.cc \
|
||||||
|
src/editor.cc \
|
||||||
src/GLView.cc \
|
src/GLView.cc \
|
||||||
src/QGLView.cc \
|
src/QGLView.cc \
|
||||||
src/AutoUpdater.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 ~EditorInterface() {}
|
||||||
virtual QSize sizeHint(){ QSize size; return size;}
|
virtual QSize sizeHint(){ QSize size; return size;}
|
||||||
virtual void setInitialSizeHint(const QSize&) { }
|
virtual void setInitialSizeHint(const QSize&) { }
|
||||||
virtual void wheelEvent(QWheelEvent*) { }
|
virtual void wheelEvent(QWheelEvent*);
|
||||||
virtual void setTabStopWidth(int) { }
|
virtual void setTabStopWidth(int) { }
|
||||||
virtual QString toPlainText() = 0;
|
virtual QString toPlainText() = 0;
|
||||||
virtual QTextDocument *document(){QTextDocument *t = new QTextDocument; return t;}
|
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)
|
void LegacyEditor::setPlainText(const QString &text)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QWheelEvent>
|
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
@ -19,7 +18,6 @@ public:
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
void setInitialSizeHint(const QSize&);
|
void setInitialSizeHint(const QSize&);
|
||||||
void setTabStopWidth(int);
|
void setTabStopWidth(int);
|
||||||
void wheelEvent(QWheelEvent*);
|
|
||||||
QString toPlainText();
|
QString toPlainText();
|
||||||
QTextCursor textCursor() const;
|
QTextCursor textCursor() const;
|
||||||
void setTextCursor (const QTextCursor&);
|
void setTextCursor (const QTextCursor&);
|
||||||
|
|
Loading…
Reference in New Issue