diff options
author | Marius Kintel <marius@kintel.net> | 2012-07-24 02:43:43 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-07-24 02:43:43 (GMT) |
commit | f1634d545dafecb745f32fa786d351e95b545280 (patch) | |
tree | 36342df7c93328f4db71988466e21c10b429a0ef | |
parent | ec01e7f492cb750221464dc09d8d3e3d18607d18 (diff) | |
parent | dcb8c201199d45c082992377bcabda92574abd83 (diff) |
Merge branch 'master' of github.com:openscad/openscad
Conflicts:
scripts/linux-build-dependencies.sh
-rw-r--r-- | README.md | 20 | ||||
-rwxr-xr-x | scripts/freebsd-build-dependencies.sh | 28 | ||||
-rwxr-xr-x | scripts/linux-build-dependencies.sh | 7 | ||||
-rw-r--r-- | scripts/setenv-freebsdbuild.sh | 6 | ||||
-rw-r--r-- | src/Preferences.cc | 3 | ||||
-rw-r--r-- | src/editor.cc | 37 | ||||
-rw-r--r-- | src/editor.h | 5 |
7 files changed, 102 insertions, 4 deletions
@@ -97,6 +97,20 @@ Follow the instructions for the platform you're compiling on below. * [Bison (2.4)](http://www.gnu.org/software/bison/) * [Flex (2.5.35)](http://flex.sourceforge.net/) +### Getting the source code + +Install git (http://git-scm.com/) onto your system. Then run a clone: + + git clone git://github.com/openscad/openscad.git + +This will download the latest sources into a directory named 'openscad'. + +To pull the MCAD library (http://reprap.org/wiki/MCAD), do the following: + + cd openscad + git submodule init + git submodule update + ### Building for Mac OS X First, make sure that you have XCode installed to get GCC. Then after @@ -124,9 +138,9 @@ Then after you've cloned this git repository, use a package manager to download packages for the dependency libraries listed above. Convenience scripts are provided for some popular systems: -Ubuntu, Debian: ./scripts/ubuntu-build-dependencies.sh -OpenSUSE: ./scripts/opensuse-build-dependencies.sh -Fedora, Redhat: ./scripts/fedora-build-dependencies.sh + Ubuntu, Debian: ./scripts/ubuntu-build-dependencies.sh + OpenSUSE: ./scripts/opensuse-build-dependencies.sh + Fedora: ./scripts/fedora-build-dependencies.sh Check your library versions to make sure they meet the minimum requirements listed above. After that follow the Compilation diff --git a/scripts/freebsd-build-dependencies.sh b/scripts/freebsd-build-dependencies.sh new file mode 100755 index 0000000..4ea61de --- /dev/null +++ b/scripts/freebsd-build-dependencies.sh @@ -0,0 +1,28 @@ +#!/usr/local/bin/bash -e + +echo "Tested on FreeBSD 9. Please see README.md for info on older systems." + +if [ "`pkg_info | grep -i cgal `" ]; then + echo Stopping. Please remove any CGAL packages you have installed and restart + exit +fi + +if [ "`pkg_info | grep -i opencsg`" ]; then + echo Stopping. Please remove any OpenCSG packages you have installed and restart + exit +fi + +OPENSCADDIR=$PWD +if [ ! -f $OPENSCADDIR/openscad.pro ]; then + echo "Must be run from the OpenSCAD source root directory" + exit 0 +fi + +. ./scripts/setenv-freebsdbuild.sh + +pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr +pkg_add -r xorg libGLU libXmu libXi xorg-vfbserver glew +pkg_add -r qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic + +BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs +BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index be27d2a..a9dbbc5 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -207,6 +207,10 @@ build_opencsg() fi fi + if [ `uname | grep FreeBSD` ]; then + sed -ibak s/X11R6/local/g src/Makefile + fi + if [ "`command -v qmake-qt4`" ]; then OPENCSG_QMAKE=qmake-qt4 else @@ -225,6 +229,7 @@ build_opencsg() fi make + cp -av lib/* $DEPLOYDIR/lib cp -av include/* $DEPLOYDIR/include cd $OPENSCADDIR @@ -267,7 +272,7 @@ if [ ! $NUMCPU ]; then fi if [ ! -d $BASEDIR/bin ]; then - mkdir --parents $BASEDIR/bin + mkdir -p $BASEDIR/bin fi echo "Using basedir:" $BASEDIR diff --git a/scripts/setenv-freebsdbuild.sh b/scripts/setenv-freebsdbuild.sh new file mode 100644 index 0000000..49f1783 --- /dev/null +++ b/scripts/setenv-freebsdbuild.sh @@ -0,0 +1,6 @@ +# run with '. ./scripts/setenv-freebsdbuild.sh' + +# use in conjuction with freebsd-build-dependencies.sh + +QMAKESPEC=freebsd-g++ +QTDIR=/usr/local/share/qt4 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/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 }; |