diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Preferences.cc | 3 | ||||
-rw-r--r-- | src/dxfdata.cc | 2 | ||||
-rw-r--r-- | src/editor.cc | 37 | ||||
-rw-r--r-- | src/editor.h | 5 | ||||
-rw-r--r-- | src/version_check.h | 2 |
5 files changed, 47 insertions, 2 deletions
diff --git a/src/Preferences.cc b/src/Preferences.cc index 802c50c..e70a2a1 100644 --- a/src/Preferences.cc +++ b/src/Preferences.cc @@ -67,6 +67,9 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent) connect(this->fontSize, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(on_fontSize_editTextChanged(const QString &))); + // reset GUI fontsize if fontSize->addItem emitted signals that changed it. + this->fontSize->setEditText( QString("%1").arg( savedsize ) ); + // Setup default settings this->defaultmap["3dview/colorscheme"] = this->colorSchemeChooser->currentItem()->text(); this->defaultmap["advanced/opencsg_show_warning"] = true; diff --git a/src/dxfdata.cc b/src/dxfdata.cc index 00b246f..4b542d1 100644 --- a/src/dxfdata.cc +++ b/src/dxfdata.cc @@ -238,7 +238,7 @@ DxfData::DxfData(double fn, double fs, double fa, int n = get_fragments_from_r(r_major, fn, fs, fa); n = (int)ceil(n * sweep_angle / (2 * M_PI)); // Vector2d p1; - Vector2d p1; + Vector2d p1; p1 << 0,0; for (int i=0;i<=n;i++) { double a = (ellipse_start_angle + sweep_angle*i/n); // Vector2d p2(cos(a)*r_major, sin(a)*r_minor); diff --git a/src/editor.cc b/src/editor.cc index 4482558..bba8d4f 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -1,4 +1,5 @@ #include "editor.h" +#include "Preferences.h" #ifndef _QCODE_EDIT_ void Editor::indentSelection() @@ -70,4 +71,40 @@ void Editor::uncommentSelection() cursor.setPosition(p2, QTextCursor::KeepAnchor); setTextCursor(cursor); } + +void Editor::zoomIn() +{ + // See also QT's implementation in QEditor.cpp + QSettings settings; + QFont tmp_font = this->font() ; + if ( font().pointSize() >= 1 ) + tmp_font.setPointSize( 1 + font().pointSize() ); + else + tmp_font.setPointSize( 1 ); + settings.setValue("editor/fontsize", tmp_font.pointSize()); + this->setFont( tmp_font ); +} + +void Editor::zoomOut() +{ + QSettings settings; + QFont tmp_font = this->font(); + if ( font().pointSize() >= 2 ) + tmp_font.setPointSize( -1 + font().pointSize() ); + else + tmp_font.setPointSize( 1 ); + settings.setValue("editor/fontsize", tmp_font.pointSize()); + this->setFont( tmp_font ); +} + +void Editor::wheelEvent ( QWheelEvent * event ) +{ + if (event->modifiers() == Qt::ControlModifier) { + if (event->delta() > 0 ) + zoomIn(); + else if (event->delta() < 0 ) + zoomOut(); + } +} + #endif diff --git a/src/editor.h b/src/editor.h index 3088d20..bb338b0 100644 --- a/src/editor.h +++ b/src/editor.h @@ -1,6 +1,7 @@ #include <QObject> #include <QString> #include <QWidget> +#include <QWheelEvent> #ifdef _QCODE_EDIT_ #include <qeditor.h> @@ -24,6 +25,8 @@ public slots: #else Editor(QWidget *parent) : QTextEdit(parent) { setAcceptRichText(false); } public slots: + void zoomIn(); + void zoomOut(); void setLineWrapping(bool on) { if(on) setWordWrapMode(QTextOption::WrapAnywhere); } void setContentModified(bool y) { document()->setModified(y); } bool isContentModified() { return document()->isModified(); } @@ -31,5 +34,7 @@ public slots: void unindentSelection(); void commentSelection(); void uncommentSelection(); +private: + void wheelEvent ( QWheelEvent * event ); #endif }; diff --git a/src/version_check.h b/src/version_check.h index 4d10b0b..8e131be 100644 --- a/src/version_check.h +++ b/src/version_check.h @@ -53,7 +53,7 @@ a time, to avoid confusion. #error CGAL library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check #else -#if CGAL_VERSION_NR < 1040001000 +#if CGAL_VERSION_NR < 1040021000 #warning "=======================" #warning "." #warning "." |