Merge branch 'master' of github.com:openscad/openscad
|
@ -259,6 +259,7 @@ HEADERS += src/typedefs.h \
|
||||||
src/OpenCSGWarningDialog.h \
|
src/OpenCSGWarningDialog.h \
|
||||||
src/AboutDialog.h \
|
src/AboutDialog.h \
|
||||||
src/FontListDialog.h \
|
src/FontListDialog.h \
|
||||||
|
src/FontListTableView.h \
|
||||||
src/builtin.h \
|
src/builtin.h \
|
||||||
src/calc.h \
|
src/calc.h \
|
||||||
src/context.h \
|
src/context.h \
|
||||||
|
@ -428,6 +429,7 @@ SOURCES += src/version_check.cc \
|
||||||
src/UIUtils.cc \
|
src/UIUtils.cc \
|
||||||
src/Dock.cc \
|
src/Dock.cc \
|
||||||
src/FontListDialog.cc \
|
src/FontListDialog.cc \
|
||||||
|
src/FontListTableView.cc \
|
||||||
src/launchingscreen.cc \
|
src/launchingscreen.cc \
|
||||||
src/legacyeditor.cc \
|
src/legacyeditor.cc \
|
||||||
src/LibraryInfoDialog.cc
|
src/LibraryInfoDialog.cc
|
||||||
|
@ -554,7 +556,3 @@ INSTALLS += icons
|
||||||
man.path = $$PREFIX/share/man/man1
|
man.path = $$PREFIX/share/man/man1
|
||||||
man.extra = cp -f doc/openscad.1 \"\$(INSTALL_ROOT)$${man.path}/$${FULLNAME}.1\"
|
man.extra = cp -f doc/openscad.1 \"\$(INSTALL_ROOT)$${man.path}/$${FULLNAME}.1\"
|
||||||
INSTALLS += man
|
INSTALLS += man
|
||||||
|
|
||||||
CONFIG(winconsole) {
|
|
||||||
include(winconsole.pri)
|
|
||||||
}
|
|
||||||
|
|
|
@ -254,8 +254,8 @@ case $OS in
|
||||||
echo "cant find $TARGET/openscad.exe. build failed. stopping."
|
echo "cant find $TARGET/openscad.exe. build failed. stopping."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
# make console pipe-able openscad.com - see winconsole.pri for info
|
# make console pipe-able openscad.com - see winconsole.pro for info
|
||||||
qmake CONFIG+=winconsole ../openscad.pro
|
qmake ../winconsole.pro
|
||||||
make
|
make
|
||||||
if [ ! -e $TARGET/openscad.com ]; then
|
if [ ! -e $TARGET/openscad.com ]; then
|
||||||
echo "cant find $TARGET/openscad.com. build failed. stopping."
|
echo "cant find $TARGET/openscad.com. build failed. stopping."
|
||||||
|
|
|
@ -11,5 +11,3 @@ cd "$TOPDIR" || exit 1
|
||||||
|
|
||||||
echo "Compiling language files..."
|
echo "Compiling language files..."
|
||||||
./scripts/translation-update.sh updatemo
|
./scripts/translation-update.sh updatemo
|
||||||
|
|
||||||
echo "Done."
|
|
||||||
|
|
|
@ -60,14 +60,16 @@ void FontListDialog::selection_changed(const QItemSelection ¤t, const QIte
|
||||||
{
|
{
|
||||||
if (current.count() == 0) {
|
if (current.count() == 0) {
|
||||||
copyButton->setEnabled(false);
|
copyButton->setEnabled(false);
|
||||||
|
tableView->setDragText("");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QModelIndex &idx = proxy->mapToSource(current.indexes().at(0));
|
const QModelIndex &idx = proxy->mapToSource(current.indexes().at(0));
|
||||||
const QString name = model->item(idx.row(), 0)->text();
|
const QString name = model->item(idx.row(), 0)->text();
|
||||||
const QString style = model->item(idx.row(), 1)->text();
|
const QString style = model->item(idx.row(), 1)->text();
|
||||||
selection = QString("\"%1:style=%2\"").arg(name).arg(style);
|
selection = QString("\"%1:style=%2\"").arg(quote(name)).arg(quote(style));
|
||||||
copyButton->setEnabled(true);
|
copyButton->setEnabled(true);
|
||||||
|
tableView->setDragText(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontListDialog::update_font_list()
|
void FontListDialog::update_font_list()
|
||||||
|
@ -117,3 +119,28 @@ void FontListDialog::update_font_list()
|
||||||
|
|
||||||
delete list;
|
delete list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Quote a string according to the requirements of font-config.
|
||||||
|
* See http://www.freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||||
|
*
|
||||||
|
* The '\', '-', ':' and ',' characters in family names must be preceded
|
||||||
|
* by a '\' character to avoid having them misinterpreted. Similarly, values
|
||||||
|
* containing '\', '=', '_', ':' and ',' must also have them preceded by a
|
||||||
|
* '\' character. The '\' characters are stripped out of the family name and
|
||||||
|
* values as the font name is read.
|
||||||
|
*
|
||||||
|
* @param text unquoted string
|
||||||
|
* @return quoted text
|
||||||
|
*/
|
||||||
|
QString FontListDialog::quote(const QString& text)
|
||||||
|
{
|
||||||
|
QString result = text;
|
||||||
|
result.replace('\\', "\\\\")
|
||||||
|
.replace('-', "\\-")
|
||||||
|
.replace(':', "\\:")
|
||||||
|
.replace(',', "\\,")
|
||||||
|
.replace('=', "\\=")
|
||||||
|
.replace('_', "\\_");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
#include "qtgettext.h"
|
#include "qtgettext.h"
|
||||||
#include "ui_FontListDialog.h"
|
#include "ui_FontListDialog.h"
|
||||||
|
|
||||||
#define STRINGIFY(x) #x
|
|
||||||
#define TOSTRING(x) STRINGIFY(x)
|
|
||||||
|
|
||||||
class FontListDialog : public QDialog, public Ui::FontListDialog
|
class FontListDialog : public QDialog, public Ui::FontListDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
@ -27,6 +24,8 @@ signals:
|
||||||
void font_selected(const QString font);
|
void font_selected(const QString font);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString quote(const QString& text);
|
||||||
|
|
||||||
QString selection;
|
QString selection;
|
||||||
QStandardItemModel *model;
|
QStandardItemModel *model;
|
||||||
QSortFilterProxyModel *proxy;
|
QSortFilterProxyModel *proxy;
|
||||||
|
|
|
@ -67,7 +67,17 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="5">
|
<item row="2" column="0" colspan="5">
|
||||||
<widget class="QTableView" name="tableView"/>
|
<widget class="FontListTableView" name="tableView">
|
||||||
|
<property name="dragEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="dragDropMode">
|
||||||
|
<enum>QAbstractItemView::DragOnly</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" colspan="5">
|
<item row="0" column="0" colspan="5">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
@ -100,6 +110,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FontListTableView</class>
|
||||||
|
<extends>QTableView</extends>
|
||||||
|
<header>FontListTableView.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../openscad.qrc"/>
|
<include location="../openscad.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* OpenSCAD (www.openscad.org)
|
||||||
|
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||||
|
* Marius Kintel <marius@kintel.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* As a special exception, you have permission to link this program
|
||||||
|
* with the CGAL library and distribute executables, as long as you
|
||||||
|
* follow the requirements of the GNU GPL in regard to all of the
|
||||||
|
* software in the executable aside from CGAL.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <QDrag>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QMimeData>
|
||||||
|
|
||||||
|
#include "qtgettext.h"
|
||||||
|
#include "FontListDialog.h"
|
||||||
|
|
||||||
|
FontListTableView::FontListTableView(QWidget *parent) : QTableView(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void FontListTableView::setDragText(const QString &text)
|
||||||
|
{
|
||||||
|
this->text = text.trimmed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FontListTableView::startDrag(Qt::DropActions supportedActions)
|
||||||
|
{
|
||||||
|
if (text.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMimeData *mimeData = new QMimeData;
|
||||||
|
mimeData->setText(text);
|
||||||
|
|
||||||
|
QFontMetrics fm(font());
|
||||||
|
QRect rect(0, 0, fm.width(text), fm.height());
|
||||||
|
QPixmap pixmap(rect.width(), rect.height());
|
||||||
|
pixmap.fill(Qt::transparent);
|
||||||
|
|
||||||
|
QPainter painter(&pixmap);
|
||||||
|
painter.setFont(font());
|
||||||
|
painter.drawText(rect, Qt::AlignCenter, text);
|
||||||
|
|
||||||
|
QDrag *drag = new QDrag(this);
|
||||||
|
drag->setPixmap(pixmap);
|
||||||
|
drag->setMimeData(mimeData);
|
||||||
|
drag->setHotSpot(QPoint(-10, rect.height() + 6));
|
||||||
|
drag->exec(supportedActions, Qt::CopyAction);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QTableView>
|
||||||
|
|
||||||
|
class FontListTableView : public QTableView
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FontListTableView(QWidget *parent = NULL);
|
||||||
|
void setDragText(const QString &text);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void startDrag(Qt::DropActions supportedActions);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString text;
|
||||||
|
};
|
|
@ -71,6 +71,7 @@ public:
|
||||||
QAction *actionRecentFile[UIUtils::maxRecentFiles];
|
QAction *actionRecentFile[UIUtils::maxRecentFiles];
|
||||||
QMap<QString, QString> knownFileExtensions;
|
QMap<QString, QString> knownFileExtensions;
|
||||||
|
|
||||||
|
QLabel *versionLabel;
|
||||||
QWidget *editorDockTitleWidget;
|
QWidget *editorDockTitleWidget;
|
||||||
QWidget *consoleDockTitleWidget;
|
QWidget *consoleDockTitleWidget;
|
||||||
|
|
||||||
|
@ -116,6 +117,7 @@ private:
|
||||||
void show_examples();
|
void show_examples();
|
||||||
void setDockWidgetTitle(QDockWidget *dockWidget, QString prefix, bool topLevel);
|
void setDockWidgetTitle(QDockWidget *dockWidget, QString prefix, bool topLevel);
|
||||||
void addKeyboardShortCut(const QList<QAction *> &actions);
|
void addKeyboardShortCut(const QList<QAction *> &actions);
|
||||||
|
void updateStatusBar(class ProgressWidget *progressWidget);
|
||||||
|
|
||||||
EditorInterface *editor;
|
EditorInterface *editor;
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,12 @@ void OpenCSGRenderer::renderCSGChain(CSGChain *chain, GLint *shaderinfo,
|
||||||
const Color4f &c = j_obj.color;
|
const Color4f &c = j_obj.color;
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixd(j_obj.matrix.data());
|
glMultMatrixd(j_obj.matrix.data());
|
||||||
csgmode_e csgmode = j_obj.type == CSGTerm::TYPE_DIFFERENCE ? CSGMODE_DIFFERENCE : CSGMODE_NORMAL;
|
csgmode_e csgmode = csgmode_e(
|
||||||
|
(highlight ?
|
||||||
|
CSGMODE_HIGHLIGHT :
|
||||||
|
(background ? CSGMODE_BACKGROUND : CSGMODE_NORMAL)) |
|
||||||
|
(j_obj.type == CSGTerm::TYPE_DIFFERENCE ? CSGMODE_DIFFERENCE : 0));
|
||||||
|
|
||||||
ColorMode colormode = COLORMODE_NONE;
|
ColorMode colormode = COLORMODE_NONE;
|
||||||
if (background) {
|
if (background) {
|
||||||
if (j_obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
if (j_obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
||||||
|
@ -99,11 +104,9 @@ void OpenCSGRenderer::renderCSGChain(CSGChain *chain, GLint *shaderinfo,
|
||||||
else {
|
else {
|
||||||
colormode = COLORMODE_BACKGROUND;
|
colormode = COLORMODE_BACKGROUND;
|
||||||
}
|
}
|
||||||
csgmode = csgmode_e(csgmode + 10);
|
|
||||||
} else if (j_obj.type == CSGTerm::TYPE_DIFFERENCE) {
|
} else if (j_obj.type == CSGTerm::TYPE_DIFFERENCE) {
|
||||||
if (j_obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
if (j_obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
||||||
colormode = COLORMODE_HIGHLIGHT;
|
colormode = COLORMODE_HIGHLIGHT;
|
||||||
csgmode = csgmode_e(csgmode + 20);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
colormode = COLORMODE_CUTOUT;
|
colormode = COLORMODE_CUTOUT;
|
||||||
|
@ -111,7 +114,6 @@ void OpenCSGRenderer::renderCSGChain(CSGChain *chain, GLint *shaderinfo,
|
||||||
} else {
|
} else {
|
||||||
if (j_obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
if (j_obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
||||||
colormode = COLORMODE_HIGHLIGHT;
|
colormode = COLORMODE_HIGHLIGHT;
|
||||||
csgmode = csgmode_e(csgmode + 20);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
colormode = COLORMODE_MATERIAL;
|
colormode = COLORMODE_MATERIAL;
|
||||||
|
@ -139,9 +141,12 @@ void OpenCSGRenderer::renderCSGChain(CSGChain *chain, GLint *shaderinfo,
|
||||||
|
|
||||||
prim->geom = i_obj.geom;
|
prim->geom = i_obj.geom;
|
||||||
prim->m = i_obj.matrix;
|
prim->m = i_obj.matrix;
|
||||||
prim->csgmode = i_obj.type == CSGTerm::TYPE_DIFFERENCE ? CSGMODE_DIFFERENCE : CSGMODE_NORMAL;
|
prim->csgmode = csgmode_e(
|
||||||
if (highlight) prim->csgmode = csgmode_e(prim->csgmode + 20);
|
(highlight ?
|
||||||
else if (background) prim->csgmode = csgmode_e(prim->csgmode + 10);
|
CSGMODE_HIGHLIGHT :
|
||||||
|
(background ? CSGMODE_BACKGROUND : CSGMODE_NORMAL)) |
|
||||||
|
(i_obj.type == CSGTerm::TYPE_DIFFERENCE ? CSGMODE_DIFFERENCE : 0));
|
||||||
|
|
||||||
primitives.push_back(prim);
|
primitives.push_back(prim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,15 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight,
|
||||||
const Color4f &c = obj.color;
|
const Color4f &c = obj.color;
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixd(m.data());
|
glMultMatrixd(m.data());
|
||||||
csgmode_e csgmode = obj.type == CSGTerm::TYPE_DIFFERENCE ? CSGMODE_DIFFERENCE : CSGMODE_NORMAL;
|
csgmode_e csgmode = csgmode_e(
|
||||||
|
(highlight ?
|
||||||
|
CSGMODE_HIGHLIGHT :
|
||||||
|
(background ? CSGMODE_BACKGROUND : CSGMODE_NORMAL)) |
|
||||||
|
(obj.type == CSGTerm::TYPE_DIFFERENCE ? CSGMODE_DIFFERENCE : 0));
|
||||||
ColorMode colormode = COLORMODE_NONE;
|
ColorMode colormode = COLORMODE_NONE;
|
||||||
ColorMode edge_colormode = COLORMODE_NONE;
|
ColorMode edge_colormode = COLORMODE_NONE;
|
||||||
|
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
csgmode = csgmode_e(csgmode + 20);
|
|
||||||
colormode = COLORMODE_HIGHLIGHT;
|
colormode = COLORMODE_HIGHLIGHT;
|
||||||
edge_colormode = COLORMODE_HIGHLIGHT_EDGES;
|
edge_colormode = COLORMODE_HIGHLIGHT_EDGES;
|
||||||
} else if (background) {
|
} else if (background) {
|
||||||
|
@ -89,16 +92,11 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight,
|
||||||
else {
|
else {
|
||||||
colormode = COLORMODE_BACKGROUND;
|
colormode = COLORMODE_BACKGROUND;
|
||||||
}
|
}
|
||||||
csgmode = csgmode_e(csgmode + 10);
|
|
||||||
edge_colormode = COLORMODE_BACKGROUND_EDGES;
|
edge_colormode = COLORMODE_BACKGROUND_EDGES;
|
||||||
} else if (fberror) {
|
} else if (fberror) {
|
||||||
if (highlight) csgmode = csgmode_e(csgmode + 20);
|
|
||||||
else if (background) csgmode = csgmode_e(csgmode + 10);
|
|
||||||
else csgmode = csgmode_e(csgmode);
|
|
||||||
} else if (obj.type == CSGTerm::TYPE_DIFFERENCE) {
|
} else if (obj.type == CSGTerm::TYPE_DIFFERENCE) {
|
||||||
if (obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
if (obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
||||||
colormode = COLORMODE_HIGHLIGHT;
|
colormode = COLORMODE_HIGHLIGHT;
|
||||||
csgmode = csgmode_e(csgmode + 20);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
colormode = COLORMODE_CUTOUT;
|
colormode = COLORMODE_CUTOUT;
|
||||||
|
@ -107,7 +105,6 @@ void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight,
|
||||||
} else {
|
} else {
|
||||||
if (obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
if (obj.flag & CSGTerm::FLAG_HIGHLIGHT) {
|
||||||
colormode = COLORMODE_HIGHLIGHT;
|
colormode = COLORMODE_HIGHLIGHT;
|
||||||
csgmode = csgmode_e(csgmode + 20);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
colormode = COLORMODE_MATERIAL;
|
colormode = COLORMODE_MATERIAL;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
|
#include "openscad.h"
|
||||||
#include "launchingscreen.h"
|
#include "launchingscreen.h"
|
||||||
#include "ui_launchingscreen.h"
|
#include "ui_launchingscreen.h"
|
||||||
|
|
||||||
|
@ -26,7 +27,9 @@ LaunchingScreen::LaunchingScreen(QWidget *parent) : QDialog(parent)
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
this->setStyleSheet("QDialog {background-image:url(':/icons/background.png')}"
|
this->setStyleSheet("QDialog {background-image:url(':/icons/background.png')}"
|
||||||
"QPushButton {color:white;}");
|
"QPushButton {color:white;}");
|
||||||
|
|
||||||
|
this->versionNumberLabel->setText(openscad_version.c_str());
|
||||||
|
|
||||||
QStringList recentFiles = UIUtils::recentFiles();
|
QStringList recentFiles = UIUtils::recentFiles();
|
||||||
for (int a = 0;a < recentFiles.size();a++) {
|
for (int a = 0;a < recentFiles.size();a++) {
|
||||||
QFileInfo fileInfo(recentFiles[a]);
|
QFileInfo fileInfo(recentFiles[a]);
|
||||||
|
@ -75,7 +78,7 @@ QString LaunchingScreen::selectedFile()
|
||||||
return this->selection;
|
return this->selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaunchingScreen::enableRecentButton(const QModelIndex & current, const QModelIndex & previous)
|
void LaunchingScreen::enableRecentButton(const QModelIndex &, const QModelIndex &)
|
||||||
{
|
{
|
||||||
this->openRecentButton->setEnabled(true);
|
this->openRecentButton->setEnabled(true);
|
||||||
this->openRecentButton->setDefault(true);
|
this->openRecentButton->setDefault(true);
|
||||||
|
@ -91,7 +94,7 @@ void LaunchingScreen::openRecent()
|
||||||
checkOpen(item->data(Qt::UserRole));
|
checkOpen(item->data(Qt::UserRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaunchingScreen::enableExampleButton(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
void LaunchingScreen::enableExampleButton(QTreeWidgetItem *current, QTreeWidgetItem *)
|
||||||
{
|
{
|
||||||
const bool enable = current->childCount() == 0;
|
const bool enable = current->childCount() == 0;
|
||||||
this->openExampleButton->setEnabled(enable);
|
this->openExampleButton->setEnabled(enable);
|
||||||
|
|
|
@ -6,10 +6,16 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>618</width>
|
<width>620</width>
|
||||||
<height>418</height>
|
<height>418</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>600</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Welcome to OpenSCAD</string>
|
<string>Welcome to OpenSCAD</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -331,16 +337,32 @@ QPushButton:pressed {
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0" colspan="2">
|
<item row="8" column="1">
|
||||||
|
<widget class="QLabel" name="versionNumberLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Version</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
<widget class="QCheckBox" name="checkBox">
|
<widget class="QCheckBox" name="checkBox">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<width>600</width>
|
<horstretch>0</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "openscad.h"
|
||||||
#include "GeometryCache.h"
|
#include "GeometryCache.h"
|
||||||
#include "ModuleCache.h"
|
#include "ModuleCache.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
@ -124,15 +125,6 @@ QSet<MainWindow*> *MainWindow::getWindows()
|
||||||
// Global application state
|
// Global application state
|
||||||
unsigned int GuiLocker::gui_locked = 0;
|
unsigned int GuiLocker::gui_locked = 0;
|
||||||
|
|
||||||
#define QUOTE(x__) # x__
|
|
||||||
#define QUOTED(x__) QUOTE(x__)
|
|
||||||
|
|
||||||
static char helptitle[] =
|
|
||||||
"OpenSCAD " QUOTED(OPENSCAD_VERSION)
|
|
||||||
#ifdef OPENSCAD_COMMIT
|
|
||||||
" (git " QUOTED(OPENSCAD_COMMIT) ")"
|
|
||||||
#endif
|
|
||||||
"\nhttp://www.openscad.org\n\n";
|
|
||||||
static char copyrighttext[] =
|
static char copyrighttext[] =
|
||||||
"Copyright (C) 2009-2014 The OpenSCAD Developers\n"
|
"Copyright (C) 2009-2014 The OpenSCAD Developers\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -189,6 +181,9 @@ MainWindow::MainWindow(const QString &filename)
|
||||||
this->consoleDock->setConfigKey("view/hideConsole");
|
this->consoleDock->setConfigKey("view/hideConsole");
|
||||||
this->consoleDock->setAction(this->viewActionHideConsole);
|
this->consoleDock->setAction(this->viewActionHideConsole);
|
||||||
|
|
||||||
|
this->versionLabel = NULL; // must be initialized before calling updateStatusBar()
|
||||||
|
updateStatusBar(NULL);
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
editortype = settings.value("editor/editortype").toString();
|
editortype = settings.value("editor/editortype").toString();
|
||||||
useScintilla = (editortype != "Simple Editor");
|
useScintilla = (editortype != "Simple Editor");
|
||||||
|
@ -407,6 +402,7 @@ MainWindow::MainWindow(const QString &filename)
|
||||||
|
|
||||||
setCurrentOutput();
|
setCurrentOutput();
|
||||||
|
|
||||||
|
std::string helptitle = openscad_version + "\nhttp://www.openscad.org\n\n";
|
||||||
PRINT(helptitle);
|
PRINT(helptitle);
|
||||||
PRINT(copyrighttext);
|
PRINT(copyrighttext);
|
||||||
PRINT("");
|
PRINT("");
|
||||||
|
@ -687,7 +683,7 @@ MainWindow::~MainWindow()
|
||||||
|
|
||||||
void MainWindow::showProgress()
|
void MainWindow::showProgress()
|
||||||
{
|
{
|
||||||
this->statusBar()->addPermanentWidget(qobject_cast<ProgressWidget*>(sender()));
|
updateStatusBar(qobject_cast<ProgressWidget*>(sender()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::report_func(const class AbstractNode*, void *vp, int mark)
|
void MainWindow::report_func(const class AbstractNode*, void *vp, int mark)
|
||||||
|
@ -1060,9 +1056,7 @@ void MainWindow::compileCSG(bool procevents)
|
||||||
PRINT("CSG generation cancelled.");
|
PRINT("CSG generation cancelled.");
|
||||||
}
|
}
|
||||||
progress_report_fin();
|
progress_report_fin();
|
||||||
this->statusBar()->removeWidget(this->progresswidget);
|
updateStatusBar(NULL);
|
||||||
delete this->progresswidget;
|
|
||||||
this->progresswidget = NULL;
|
|
||||||
|
|
||||||
PRINT("Compiling design (CSG Products normalization)...");
|
PRINT("Compiling design (CSG Products normalization)...");
|
||||||
if (procevents) QApplication::processEvents();
|
if (procevents) QApplication::processEvents();
|
||||||
|
@ -1800,15 +1794,47 @@ void MainWindow::actionRenderDone(shared_ptr<const Geometry> root_geom)
|
||||||
PRINT("WARNING: No top level geometry to render");
|
PRINT("WARNING: No top level geometry to render");
|
||||||
}
|
}
|
||||||
|
|
||||||
this->statusBar()->removeWidget(this->progresswidget);
|
updateStatusBar(NULL);
|
||||||
delete this->progresswidget;
|
|
||||||
this->progresswidget = NULL;
|
|
||||||
this->contentschanged = false;
|
this->contentschanged = false;
|
||||||
compileEnded();
|
compileEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ENABLE_CGAL */
|
#endif /* ENABLE_CGAL */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch version label and progress widget. When switching to the progress
|
||||||
|
* widget, the new instance is passed by the caller.
|
||||||
|
* In case of resetting back to the version label, NULL will be passed and
|
||||||
|
* multiple calls can happen. So this method must guard against adding the
|
||||||
|
* version label multiple times.
|
||||||
|
*
|
||||||
|
* @param progressWidget a pointer to the progress widget to show or NULL in
|
||||||
|
* case the display should switch back to the version label.
|
||||||
|
*/
|
||||||
|
void MainWindow::updateStatusBar(ProgressWidget *progressWidget)
|
||||||
|
{
|
||||||
|
QStatusBar *sb = this->statusBar();
|
||||||
|
if (progressWidget == NULL) {
|
||||||
|
if (this->progresswidget != NULL) {
|
||||||
|
sb->removeWidget(this->progresswidget);
|
||||||
|
delete this->progresswidget;
|
||||||
|
this->progresswidget = NULL;
|
||||||
|
}
|
||||||
|
if (versionLabel == NULL) {
|
||||||
|
versionLabel = new QLabel(openscad_version.c_str());
|
||||||
|
sb->addPermanentWidget(this->versionLabel);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this->versionLabel != NULL) {
|
||||||
|
sb->removeWidget(this->versionLabel);
|
||||||
|
delete this->versionLabel;
|
||||||
|
this->versionLabel = NULL;
|
||||||
|
}
|
||||||
|
sb->addPermanentWidget(progressWidget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::actionDisplayAST()
|
void MainWindow::actionDisplayAST()
|
||||||
{
|
{
|
||||||
setCurrentOutput();
|
setCurrentOutput();
|
||||||
|
@ -2403,7 +2429,6 @@ void MainWindow::helpAbout()
|
||||||
qApp->setWindowIcon(QApplication::windowIcon());
|
qApp->setWindowIcon(QApplication::windowIcon());
|
||||||
AboutDialog *dialog = new AboutDialog(this);
|
AboutDialog *dialog = new AboutDialog(this);
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
//QMessageBox::information(this, "About OpenSCAD", QString(helptitle) + QString(copyrighttext));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::helpHomepage()
|
void MainWindow::helpHomepage()
|
||||||
|
|
|
@ -90,6 +90,17 @@ std::string currentdir;
|
||||||
static bool arg_info = false;
|
static bool arg_info = false;
|
||||||
static std::string arg_colorscheme;
|
static std::string arg_colorscheme;
|
||||||
|
|
||||||
|
#define QUOTE(x__) # x__
|
||||||
|
#define QUOTED(x__) QUOTE(x__)
|
||||||
|
|
||||||
|
std::string openscad_versionnumber = QUOTED(OPENSCAD_VERSION)
|
||||||
|
#ifdef OPENSCAD_COMMIT
|
||||||
|
" (git " QUOTED(OPENSCAD_COMMIT) ")"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
std::string openscad_version = "OpenSCAD " + openscad_versionnumber;
|
||||||
|
|
||||||
class Echostream : public std::ofstream
|
class Echostream : public std::ofstream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -590,7 +601,9 @@ void dialogThreadFunc(FontCacheInitializer *initializer)
|
||||||
void dialogInitHandler(FontCacheInitializer *initializer, void *)
|
void dialogInitHandler(FontCacheInitializer *initializer, void *)
|
||||||
{
|
{
|
||||||
QProgressDialog dialog;
|
QProgressDialog dialog;
|
||||||
dialog.setLabelText("Fontconfig needs to update its font cache.\nThis can take up to a couple of minutes.");
|
dialog.setLabelText(_("Fontconfig needs to update its font cache.\nThis can take up to a couple of minutes."));
|
||||||
|
dialog.setMinimum(0);
|
||||||
|
dialog.setMaximum(0);
|
||||||
dialog.setCancelButton(0);
|
dialog.setCancelButton(0);
|
||||||
|
|
||||||
QFutureWatcher<void> futureWatcher;
|
QFutureWatcher<void> futureWatcher;
|
||||||
|
@ -617,6 +630,9 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
QApplication app(argc, argv, true); //useGUI);
|
QApplication app(argc, argv, true); //useGUI);
|
||||||
|
// remove ugly frames in the QStatusBar when using additional widgets
|
||||||
|
app.setStyleSheet("QStatusBar::item { border: 0px solid black }; ");
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
app.installEventFilter(new EventFilter(&app));
|
app.installEventFilter(new EventFilter(&app));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,3 +34,11 @@ extern std::string commandline_commands;
|
||||||
// The CWD when application started. We shouldn't change CWD, but until we stop
|
// The CWD when application started. We shouldn't change CWD, but until we stop
|
||||||
// doing this, use currentdir to get the original CWD.
|
// doing this, use currentdir to get the original CWD.
|
||||||
extern std::string currentdir;
|
extern std::string currentdir;
|
||||||
|
|
||||||
|
extern std::string versionnumber;
|
||||||
|
|
||||||
|
// Just the number (might have the git commit as suffix), e.g. 2014.12.23.
|
||||||
|
extern std::string openscad_versionnumber;
|
||||||
|
|
||||||
|
// The string "OpenSCAD " and the version number.
|
||||||
|
extern std::string openscad_version;
|
||||||
|
|
|
@ -240,7 +240,7 @@ void PolySet::render_surface(Renderer::csgmode_e csgmode, const Transform3d &m,
|
||||||
#endif /* ENABLE_OPENCSG */
|
#endif /* ENABLE_OPENCSG */
|
||||||
if (this->dim == 2) {
|
if (this->dim == 2) {
|
||||||
// Render 2D objects 1mm thick, but differences slightly larger
|
// Render 2D objects 1mm thick, but differences slightly larger
|
||||||
double zbase = 1 + (csgmode & CSGMODE_DIFFERENCE_FLAG) * 0.1;
|
double zbase = 1 + ((csgmode & CSGMODE_DIFFERENCE_FLAG) ? 0.1 : 0);
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
|
|
||||||
// Render top+bottom
|
// Render top+bottom
|
||||||
|
@ -369,7 +369,7 @@ void PolySet::render_edges(Renderer::csgmode_e csgmode) const
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Render 2D objects 1mm thick, but differences slightly larger
|
// Render 2D objects 1mm thick, but differences slightly larger
|
||||||
double zbase = 1 + (csgmode & CSGMODE_DIFFERENCE_FLAG) * 0.1;
|
double zbase = 1 + ((csgmode & CSGMODE_DIFFERENCE_FLAG) ? 0.1 : 0);
|
||||||
|
|
||||||
BOOST_FOREACH(const Outline2d &o, polygon.outlines()) {
|
BOOST_FOREACH(const Outline2d &o, polygon.outlines()) {
|
||||||
// Render top+bottom outlines
|
// Render top+bottom outlines
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
difference() {
|
||||||
|
square(10, center=true);
|
||||||
|
#circle(3);
|
||||||
|
}
|
||||||
|
#if (true) square([11,12]);
|
||||||
|
|
||||||
|
#translate([0,-12]) difference() {
|
||||||
|
square(10, center = true);
|
||||||
|
square(5, center = true);
|
||||||
|
}
|
After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 8.4 KiB |
|
@ -0,0 +1,15 @@
|
||||||
|
group() {
|
||||||
|
difference() {
|
||||||
|
square(size = [10, 10], center = true);
|
||||||
|
# circle($fn = 0, $fa = 12, $fs = 2, r = 3);
|
||||||
|
}
|
||||||
|
# group() {
|
||||||
|
square(size = [11, 12], center = false);
|
||||||
|
}
|
||||||
|
# multmatrix([[1, 0, 0, 0], [0, 1, 0, -12], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||||
|
difference() {
|
||||||
|
square(size = [10, 10], center = true);
|
||||||
|
square(size = [5, 5], center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.3 KiB |
|
@ -1,28 +0,0 @@
|
||||||
# Windows console issues workaround stub.
|
|
||||||
#
|
|
||||||
# Usage: put at the end of .pro file, then run qmake CONFIG+=winconsole
|
|
||||||
#
|
|
||||||
# This attempts to solve the problem of piping OpenSCAD under windows
|
|
||||||
# command line (GUI mode programs in Windows dont allow this). We use
|
|
||||||
# the 'devenv' solution, which means building two binaries:
|
|
||||||
# openscad.exe, and openscad.com, the latter being a wrapper for the
|
|
||||||
# former. See src/winconsole.c for more details.
|
|
||||||
#
|
|
||||||
# Qmake doesn't like building two binaries in the same directory so we
|
|
||||||
# depend on release-common.sh to call qmake twice and package the file properly
|
|
||||||
|
|
||||||
CONFIG(winconsole) {
|
|
||||||
TEMPLATE = app
|
|
||||||
TARGET = openscad_winconsole
|
|
||||||
FORMS =
|
|
||||||
HEADERS =
|
|
||||||
FLEXSOURCES =
|
|
||||||
BISONSOURCES =
|
|
||||||
RESOURCES =
|
|
||||||
SOURCES = src/winconsole.c
|
|
||||||
CONFIG += console # sets IMAGE_SUBSYSTEM_WINDOWS_CUI in binary
|
|
||||||
LIBS -= $$LIBS
|
|
||||||
RC_FILE -= $$RC_FILE
|
|
||||||
QMAKE_POST_LINK = cd $(DESTDIR) && mv openscad_winconsole.exe openscad.com
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Windows console issues workaround stub.
|
||||||
|
#
|
||||||
|
# This attempts to solve the problem of piping OpenSCAD under windows
|
||||||
|
# command line (GUI mode programs in Windows dont allow this). We use
|
||||||
|
# the 'devenv' solution, which means building two binaries:
|
||||||
|
# openscad.exe, and openscad.com, the latter being a wrapper for the
|
||||||
|
# former. See src/winconsole.c for more details.
|
||||||
|
#
|
||||||
|
# Qmake doesn't like building two binaries in the same directory so we
|
||||||
|
# depend on release-common.sh to call qmake twice and package the file
|
||||||
|
# properly
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
TARGET = openscad_winconsole
|
||||||
|
FORMS =
|
||||||
|
HEADERS =
|
||||||
|
FLEXSOURCES =
|
||||||
|
BISONSOURCES =
|
||||||
|
RESOURCES =
|
||||||
|
SOURCES = src/winconsole.c
|
||||||
|
CONFIG -= qt
|
||||||
|
CONFIG += console # sets IMAGE_SUBSYSTEM_WINDOWS_CUI in binary
|
||||||
|
QMAKE_POST_LINK = cd $(DESTDIR) && mv openscad_winconsole.exe openscad.com
|