2009-06-20 16:10:55 +04:00
/*
* OpenSCAD ( www . openscad . at )
* Copyright ( C ) 2009 Clifford Wolf < clifford @ clifford . at >
*
* 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 .
*
* 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
*
*/
# ifndef OPENSCAD_H
# define OPENSCAD_H
2009-06-24 14:59:15 +04:00
// this must be defined as early as possible
// so QHash<> and friends can see it..
# include <qglobal.h>
static inline uint qHash ( double v ) {
// not beauty but good enough..
union { double d ; uint u [ 2 ] ; } x ;
x . u [ 0 ] = 0 ; x . u [ 1 ] = 0 ; x . d = v ;
return x . u [ 0 ] ^ x . u [ 1 ] ;
}
2009-06-25 12:12:41 +04:00
# ifdef ENABLE_OPENCSG
// this must be included before the GL headers
# include <GL / glew.h>
# endif
2009-06-20 23:00:19 +04:00
# include <QHash>
2009-07-03 11:51:22 +04:00
# include <QCache>
2009-06-20 23:00:19 +04:00
# include <QVector>
2009-06-23 23:56:46 +04:00
# include <QMainWindow>
# include <QSplitter>
# include <QTextEdit>
# include <QGLWidget>
2009-06-27 14:04:57 +04:00
# include <QPointer>
2009-06-23 23:56:46 +04:00
2009-06-21 10:53:46 +04:00
# include <stdio.h>
2009-06-23 23:56:46 +04:00
# include <errno.h>
2009-06-21 10:53:46 +04:00
# include <stdlib.h>
2009-06-23 23:56:46 +04:00
# include <string.h>
2009-06-21 10:53:46 +04:00
# include <math.h>
2009-06-20 23:00:19 +04:00
2009-06-21 20:41:38 +04:00
# include <fstream>
# include <iostream>
2009-06-20 23:00:19 +04:00
class Value ;
class Expression ;
class AbstractFunction ;
class BuiltinFunction ;
class Function ;
class AbstractModule ;
class ModuleInstanciation ;
class Module ;
class Context ;
2009-06-24 19:39:08 +04:00
class PolySet ;
2009-06-25 12:12:41 +04:00
class CSGTerm ;
class CSGChain ;
2009-06-20 23:00:19 +04:00
class AbstractNode ;
2009-06-24 19:39:08 +04:00
class AbstractPolyNode ;
2009-06-20 23:00:19 +04:00
class Value
{
public :
2009-06-23 14:31:25 +04:00
enum type_e {
UNDEFINED ,
BOOL ,
NUMBER ,
RANGE ,
VECTOR ,
STRING
} ;
enum type_e type ;
bool b ;
double num ;
2009-06-30 22:05:10 +04:00
QVector < Value * > vec ;
double range_begin ;
double range_step ;
double range_end ;
2009-06-21 12:59:53 +04:00
QString text ;
2009-06-20 23:00:19 +04:00
2009-06-23 14:31:25 +04:00
Value ( ) ;
2009-06-30 22:05:10 +04:00
~ Value ( ) ;
2009-06-23 14:31:25 +04:00
Value ( bool v ) ;
Value ( double v ) ;
Value ( const QString & t ) ;
Value ( const Value & v ) ;
2009-06-20 23:00:19 +04:00
Value & operator = ( const Value & v ) ;
2009-06-23 14:31:25 +04:00
2009-07-01 12:06:06 +04:00
Value operator ! ( ) const ;
Value operator & & ( const Value & v ) const ;
Value operator | | ( const Value & v ) const ;
2009-06-20 23:00:19 +04:00
Value operator + ( const Value & v ) const ;
Value operator - ( const Value & v ) const ;
Value operator * ( const Value & v ) const ;
Value operator / ( const Value & v ) const ;
Value operator % ( const Value & v ) const ;
2009-07-01 12:06:06 +04:00
Value operator < ( const Value & v ) const ;
Value operator < = ( const Value & v ) const ;
Value operator = = ( const Value & v ) const ;
Value operator ! = ( const Value & v ) const ;
Value operator > = ( const Value & v ) const ;
Value operator > ( const Value & v ) const ;
2009-06-20 23:00:19 +04:00
Value inv ( ) const ;
2009-06-21 10:53:46 +04:00
2009-06-30 22:05:10 +04:00
bool getnum ( double & v ) const ;
2009-07-20 21:45:39 +04:00
bool getv2 ( double & x , double & y ) const ;
2009-06-30 22:05:10 +04:00
bool getv3 ( double & x , double & y , double & z ) const ;
2009-06-21 10:53:46 +04:00
QString dump ( ) const ;
2009-06-23 14:31:25 +04:00
private :
void reset_undef ( ) ;
2009-06-20 23:00:19 +04:00
} ;
class Expression
{
public :
QVector < Expression * > children ;
2009-06-30 22:05:10 +04:00
Value * const_value ;
2009-06-20 23:00:19 +04:00
QString var_name ;
QString call_funcname ;
QVector < QString > call_argnames ;
2009-07-01 12:06:06 +04:00
// Boolean: ! && ||
// Operators: * / % + -
// Relations: < <= == != >= >
// Vector element: []
// Condition operator: ?:
2009-06-20 23:00:19 +04:00
// Invert (prefix '-'): I
// Constant value: C
2009-06-23 14:31:25 +04:00
// Create Range: R
2009-06-21 10:53:46 +04:00
// Create Vector: V
2009-06-23 14:31:25 +04:00
// Create Matrix: M
2009-06-21 10:53:46 +04:00
// Lookup Variable: L
2009-06-23 14:31:25 +04:00
// Lookup member per name: N
2009-06-20 23:00:19 +04:00
// Function call: F
2009-07-01 12:06:06 +04:00
QString type ;
2009-06-20 23:00:19 +04:00
Expression ( ) ;
~ Expression ( ) ;
2009-06-21 10:53:46 +04:00
Value evaluate ( const Context * context ) const ;
QString dump ( ) const ;
2009-06-20 23:00:19 +04:00
} ;
class AbstractFunction
{
public :
virtual ~ AbstractFunction ( ) ;
2009-06-21 10:53:46 +04:00
virtual Value evaluate ( const Context * ctx , const QVector < QString > & call_argnames , const QVector < Value > & call_argvalues ) const ;
virtual QString dump ( QString indent , QString name ) const ;
2009-06-20 23:00:19 +04:00
} ;
class BuiltinFunction : public AbstractFunction
{
public :
typedef Value ( * eval_func_t ) ( const QVector < Value > & args ) ;
eval_func_t eval_func ;
BuiltinFunction ( eval_func_t f ) : eval_func ( f ) { }
virtual ~ BuiltinFunction ( ) ;
2009-06-21 10:53:46 +04:00
virtual Value evaluate ( const Context * ctx , const QVector < QString > & call_argnames , const QVector < Value > & call_argvalues ) const ;
virtual QString dump ( QString indent , QString name ) const ;
2009-06-20 23:00:19 +04:00
} ;
class Function : public AbstractFunction
{
public :
QVector < QString > argnames ;
QVector < Expression * > argexpr ;
2009-06-21 10:53:46 +04:00
Expression * expr ;
2009-06-20 23:00:19 +04:00
Function ( ) { }
virtual ~ Function ( ) ;
2009-06-21 10:53:46 +04:00
virtual Value evaluate ( const Context * ctx , const QVector < QString > & call_argnames , const QVector < Value > & call_argvalues ) const ;
virtual QString dump ( QString indent , QString name ) const ;
2009-06-20 23:00:19 +04:00
} ;
extern QHash < QString , AbstractFunction * > builtin_functions ;
extern void initialize_builtin_functions ( ) ;
extern void destroy_builtin_functions ( ) ;
class AbstractModule
{
public :
virtual ~ AbstractModule ( ) ;
2009-07-01 13:48:25 +04:00
virtual AbstractNode * evaluate ( const Context * ctx , const ModuleInstanciation * inst ) const ;
2009-06-21 10:53:46 +04:00
virtual QString dump ( QString indent , QString name ) const ;
2009-06-20 23:00:19 +04:00
} ;
class ModuleInstanciation
{
public :
QString label ;
QString modname ;
QVector < QString > argnames ;
QVector < Expression * > argexpr ;
2009-07-01 13:48:25 +04:00
QVector < Value > argvalues ;
2009-06-21 10:53:46 +04:00
QVector < ModuleInstanciation * > children ;
2009-06-20 23:00:19 +04:00
2009-07-01 13:48:25 +04:00
bool tag_root ;
bool tag_highlight ;
const Context * ctx ;
ModuleInstanciation ( ) : tag_root ( false ) , tag_highlight ( false ) , ctx ( NULL ) { }
2009-06-20 23:00:19 +04:00
~ ModuleInstanciation ( ) ;
2009-06-21 10:53:46 +04:00
2009-06-21 12:59:53 +04:00
QString dump ( QString indent ) const ;
AbstractNode * evaluate ( const Context * ctx ) const ;
2009-06-20 23:00:19 +04:00
} ;
class Module : public AbstractModule
{
public :
QVector < QString > argnames ;
QVector < Expression * > argexpr ;
2009-06-21 15:41:11 +04:00
QVector < QString > assignments_var ;
QVector < Expression * > assignments_expr ;
2009-06-20 23:00:19 +04:00
QHash < QString , AbstractFunction * > functions ;
QHash < QString , AbstractModule * > modules ;
2009-06-21 10:53:46 +04:00
QVector < ModuleInstanciation * > children ;
2009-06-20 23:00:19 +04:00
Module ( ) { }
virtual ~ Module ( ) ;
2009-07-01 13:48:25 +04:00
virtual AbstractNode * evaluate ( const Context * ctx , const ModuleInstanciation * inst ) const ;
2009-06-21 10:53:46 +04:00
virtual QString dump ( QString indent , QString name ) const ;
2009-06-20 23:00:19 +04:00
} ;
extern QHash < QString , AbstractModule * > builtin_modules ;
extern void initialize_builtin_modules ( ) ;
extern void destroy_builtin_modules ( ) ;
2009-06-30 00:30:43 +04:00
extern void register_builtin_csgops ( ) ;
extern void register_builtin_transform ( ) ;
extern void register_builtin_primitives ( ) ;
extern void register_builtin_control ( ) ;
2009-07-14 09:25:55 +04:00
extern void register_builtin_render ( ) ;
2009-07-17 03:11:08 +04:00
extern void register_builtin_dxf_linear_extrude ( ) ;
2009-07-17 04:34:15 +04:00
extern void register_builtin_dxf_rotate_extrude ( ) ;
2009-06-21 15:41:11 +04:00
2009-06-20 23:00:19 +04:00
class Context
{
public :
2009-06-21 10:53:46 +04:00
const Context * parent ;
2009-06-20 23:00:19 +04:00
QHash < QString , Value > variables ;
2009-06-26 08:32:52 +04:00
QHash < QString , Value > config_variables ;
2009-06-21 15:41:11 +04:00
const QHash < QString , AbstractFunction * > * functions_p ;
const QHash < QString , AbstractModule * > * modules_p ;
2009-06-20 23:00:19 +04:00
2009-06-26 08:32:52 +04:00
static QVector < const Context * > ctx_stack ;
Context ( const Context * parent = NULL ) ;
~ Context ( ) ;
2009-06-20 23:00:19 +04:00
void args ( const QVector < QString > & argnames , const QVector < Expression * > & argexpr , const QVector < QString > & call_argnames , const QVector < Value > & call_argvalues ) ;
2009-06-26 08:32:52 +04:00
void set_variable ( QString name , Value value ) ;
2009-07-20 21:45:39 +04:00
Value lookup_variable ( QString name , bool silent = false ) const ;
2009-06-26 08:32:52 +04:00
2009-06-21 10:53:46 +04:00
Value evaluate_function ( QString name , const QVector < QString > & argnames , const QVector < Value > & argvalues ) const ;
2009-07-01 13:48:25 +04:00
AbstractNode * evaluate_module ( const ModuleInstanciation * inst ) const ;
2009-06-20 23:00:19 +04:00
} ;
2009-07-17 03:11:08 +04:00
class DxfData
{
public :
struct Point {
double x , y ;
Point ( ) : x ( 0 ) , y ( 0 ) { }
Point ( double x , double y ) : x ( x ) , y ( y ) { }
} ;
struct Line {
Point * p [ 2 ] ;
Line ( Point * p1 , Point * p2 ) { p [ 0 ] = p1 ; p [ 1 ] = p2 ; }
Line ( ) { p [ 0 ] = NULL ; p [ 1 ] = NULL ; }
} ;
struct Path {
QList < Point * > points ;
bool is_closed , is_inner ;
Path ( ) : is_closed ( false ) , is_inner ( false ) { }
} ;
QList < Point > points ;
QList < Path > paths ;
2009-07-20 21:45:39 +04:00
DxfData ( double fn , double fs , double fa , QString filename , QString layername = QString ( ) , double xorigin = 0.0 , double yorigin = 0.0 , double scale = 1.0 ) ;
2009-07-17 03:11:08 +04:00
Point * p ( double x , double y ) ;
} ;
2009-06-21 15:41:11 +04:00
// The CGAL template magic slows down the compilation process by a factor of 5.
// So we only include the declaration of AbstractNode where it is needed...
# ifdef INCLUDE_ABSTRACT_NODE_DETAILS
2009-06-23 23:56:46 +04:00
# ifdef ENABLE_CGAL
2009-06-21 15:41:11 +04:00
# include <CGAL/Gmpq.h>
# include <CGAL/Cartesian.h>
# include <CGAL/Polyhedron_3.h>
# include <CGAL/Nef_polyhedron_3.h>
2009-06-21 20:41:38 +04:00
# include <CGAL/IO/Polyhedron_iostream.h>
2009-06-21 15:41:11 +04:00
2009-06-21 20:41:38 +04:00
typedef CGAL : : Cartesian < CGAL : : Gmpq > CGAL_Kernel ;
2009-06-21 15:41:11 +04:00
typedef CGAL : : Polyhedron_3 < CGAL_Kernel > CGAL_Polyhedron ;
2009-06-21 20:41:38 +04:00
typedef CGAL_Polyhedron : : HalfedgeDS CGAL_HDS ;
typedef CGAL : : Polyhedron_incremental_builder_3 < CGAL_HDS > CGAL_Polybuilder ;
2009-06-21 15:41:11 +04:00
typedef CGAL : : Nef_polyhedron_3 < CGAL_Kernel > CGAL_Nef_polyhedron ;
typedef CGAL_Nef_polyhedron : : Aff_transformation_3 CGAL_Aff_transformation ;
typedef CGAL_Nef_polyhedron : : Vector_3 CGAL_Vector ;
typedef CGAL_Nef_polyhedron : : Plane_3 CGAL_Plane ;
typedef CGAL_Nef_polyhedron : : Point_3 CGAL_Point ;
2009-06-23 23:56:46 +04:00
# endif /* ENABLE_CGAL */
2009-06-25 12:12:41 +04:00
# ifdef ENABLE_OPENCSG
# include <opencsg.h>
# endif
2009-06-24 14:59:15 +04:00
class PolySet
{
public :
struct Point {
double x , y , z ;
Point ( ) : x ( 0 ) , y ( 0 ) , z ( 0 ) { }
Point ( double x , double y , double z ) : x ( x ) , y ( y ) , z ( z ) { }
} ;
typedef QList < Point > Polygon ;
QVector < Polygon > polygons ;
2009-06-27 03:36:23 +04:00
double m [ 16 ] ;
2009-07-15 01:47:32 +04:00
int convexity ;
2009-06-24 14:59:15 +04:00
PolySet ( ) ;
void append_poly ( ) ;
void append_vertex ( double x , double y , double z ) ;
void insert_vertex ( double x , double y , double z ) ;
2009-06-27 03:36:23 +04:00
void setmatrix ( double m [ 16 ] ) ;
2009-06-25 12:12:41 +04:00
enum colormode_e {
COLOR_NONE ,
COLOR_MATERIAL ,
2009-07-01 15:09:19 +04:00
COLOR_CUTOUT ,
COLOR_HIGHLIGHT
2009-06-25 12:12:41 +04:00
} ;
2009-06-26 21:07:40 +04:00
void render_surface ( colormode_e colormode , GLint * shaderinfo = NULL ) const ;
2009-06-25 12:12:41 +04:00
void render_edges ( colormode_e colormode ) const ;
2009-06-24 14:59:15 +04:00
# ifdef ENABLE_CGAL
CGAL_Nef_polyhedron render_cgal_nef_polyhedron ( ) const ;
# endif
} ;
class CSGTerm
{
public :
enum type_e {
PRIMITIVE ,
UNION ,
INTERSECTION ,
DIFFERENCE
} ;
type_e type ;
PolySet * polyset ;
2009-06-24 19:39:08 +04:00
QString label ;
2009-06-24 14:59:15 +04:00
CSGTerm * left ;
CSGTerm * right ;
int refcounter ;
2009-06-27 03:36:23 +04:00
CSGTerm ( PolySet * polyset , QString label ) ;
2009-06-24 14:59:15 +04:00
CSGTerm ( type_e type , CSGTerm * left , CSGTerm * right ) ;
2009-06-24 19:39:08 +04:00
CSGTerm * normalize ( ) ;
CSGTerm * normalize_tail ( ) ;
2009-06-24 14:59:15 +04:00
CSGTerm * link ( ) ;
void unlink ( ) ;
2009-06-24 19:39:08 +04:00
QString dump ( ) ;
2009-06-24 14:59:15 +04:00
} ;
2009-06-25 12:12:41 +04:00
class CSGChain
{
public :
QVector < PolySet * > polysets ;
QVector < CSGTerm : : type_e > types ;
QVector < QString > labels ;
CSGChain ( ) ;
void add ( PolySet * polyset , CSGTerm : : type_e type , QString label ) ;
void import ( CSGTerm * term , CSGTerm : : type_e type = CSGTerm : : UNION ) ;
QString dump ( ) ;
} ;
2009-06-24 14:59:15 +04:00
2009-06-20 23:00:19 +04:00
class AbstractNode
{
public :
QVector < AbstractNode * > children ;
2009-07-01 13:48:25 +04:00
const ModuleInstanciation * modinst ;
2009-06-21 15:41:11 +04:00
2009-06-21 16:43:52 +04:00
int progress_mark ;
void progress_prepare ( ) ;
void progress_report ( ) const ;
2009-06-24 14:59:15 +04:00
int idx ;
static int idx_counter ;
2009-07-03 11:51:22 +04:00
QString dump_cache ;
2009-06-24 14:59:15 +04:00
2009-07-01 13:48:25 +04:00
AbstractNode ( const ModuleInstanciation * mi ) ;
2009-06-21 15:41:11 +04:00
virtual ~ AbstractNode ( ) ;
2009-06-23 23:56:46 +04:00
# ifdef ENABLE_CGAL
2009-07-03 11:51:22 +04:00
static QCache < QString , CGAL_Nef_polyhedron > cgal_nef_cache ;
virtual QString cgal_nef_cache_id ( ) const ;
2009-06-21 15:41:11 +04:00
virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron ( ) const ;
2009-06-24 14:59:15 +04:00
# endif
2009-07-01 15:09:19 +04:00
virtual CSGTerm * render_csg_term ( double m [ 16 ] , QVector < CSGTerm * > * highlights ) const ;
2009-06-21 15:41:11 +04:00
virtual QString dump ( QString indent ) const ;
2009-06-20 23:00:19 +04:00
} ;
2009-06-24 14:59:15 +04:00
class AbstractPolyNode : public AbstractNode
{
public :
enum render_mode_e {
RENDER_CGAL ,
RENDER_OPENCSG
} ;
2009-07-01 13:48:25 +04:00
AbstractPolyNode ( const ModuleInstanciation * mi ) : AbstractNode ( mi ) { } ;
2009-06-24 14:59:15 +04:00
virtual PolySet * render_polyset ( render_mode_e mode ) const ;
# ifdef ENABLE_CGAL
virtual CGAL_Nef_polyhedron render_cgal_nef_polyhedron ( ) const ;
# endif
2009-07-01 15:09:19 +04:00
virtual CSGTerm * render_csg_term ( double m [ 16 ] , QVector < CSGTerm * > * highlights ) const ;
2009-06-24 14:59:15 +04:00
} ;
2009-06-21 16:43:52 +04:00
extern int progress_report_count ;
extern void ( * progress_report_f ) ( const class AbstractNode * , void * , int ) ;
extern void * progress_report_vp ;
void progress_report_prep ( AbstractNode * root , void ( * f ) ( const class AbstractNode * node , void * vp , int mark ) , void * vp ) ;
void progress_report_fin ( ) ;
2009-06-23 23:56:46 +04:00
# else
2009-06-24 14:59:15 +04:00
// Needed for Mainwin::root_N
2009-06-23 23:56:46 +04:00
// this is a bit hackish - but a pointer is a pointer..
struct CGAL_Nef_polyhedron ;
2009-06-21 15:41:11 +04:00
# endif /* HIDE_ABSTRACT_NODE_DETAILS */
2009-06-23 23:56:46 +04:00
class GLView : public QGLWidget
{
Q_OBJECT
public :
void ( * renderfunc ) ( void * ) ;
void * renderfunc_vp ;
double viewer_distance ;
double object_rot_y ;
double object_rot_z ;
2009-06-27 02:01:53 +04:00
double w_h_ratio ;
GLint shaderinfo [ 11 ] ;
2009-06-26 17:29:48 +04:00
2009-06-23 23:56:46 +04:00
GLView ( QWidget * parent = NULL ) ;
protected :
bool mouse_drag_active ;
int last_mouse_x ;
int last_mouse_y ;
void wheelEvent ( QWheelEvent * event ) ;
void mousePressEvent ( QMouseEvent * event ) ;
void mouseMoveEvent ( QMouseEvent * event ) ;
void mouseReleaseEvent ( QMouseEvent * event ) ;
void initializeGL ( ) ;
void resizeGL ( int w , int h ) ;
void paintGL ( ) ;
} ;
class MainWindow : public QMainWindow
{
Q_OBJECT
public :
QString filename ;
QSplitter * s1 , * s2 ;
QTextEdit * editor ;
GLView * screen ;
QTextEdit * console ;
Context root_ctx ;
AbstractModule * root_module ;
2009-07-01 15:09:19 +04:00
AbstractNode * absolute_root_node ;
2009-06-24 19:39:08 +04:00
CSGTerm * root_raw_term ;
CSGTerm * root_norm_term ;
2009-06-25 12:12:41 +04:00
CSGChain * root_chain ;
2009-06-23 23:56:46 +04:00
# ifdef ENABLE_CGAL
CGAL_Nef_polyhedron * root_N ;
# endif
2009-07-01 15:09:19 +04:00
QVector < CSGTerm * > highlight_terms ;
CSGChain * highlights_chain ;
AbstractNode * root_node ;
2009-07-03 01:21:05 +04:00
bool enableOpenCSG ;
2009-07-01 15:09:19 +04:00
2009-06-23 23:56:46 +04:00
MainWindow ( const char * filename = 0 ) ;
~ MainWindow ( ) ;
2009-06-27 14:20:24 +04:00
private :
void load ( ) ;
2009-07-01 15:09:19 +04:00
void find_root_tag ( AbstractNode * n ) ;
2009-06-27 14:20:24 +04:00
void compile ( ) ;
2009-06-23 23:56:46 +04:00
private slots :
void actionNew ( ) ;
void actionOpen ( ) ;
void actionSave ( ) ;
void actionSaveAs ( ) ;
2009-06-27 14:20:24 +04:00
void actionReload ( ) ;
2009-06-27 14:04:57 +04:00
2009-07-01 02:30:22 +04:00
private slots :
void editIndent ( ) ;
void editUnindent ( ) ;
void editComment ( ) ;
void editUncomment ( ) ;
2009-06-25 02:38:31 +04:00
private slots :
2009-06-27 14:20:24 +04:00
void actionReloadCompile ( ) ;
2009-06-23 23:56:46 +04:00
void actionCompile ( ) ;
# ifdef ENABLE_CGAL
void actionRenderCGAL ( ) ;
# endif
void actionDisplayAST ( ) ;
2009-06-24 14:59:15 +04:00
void actionDisplayCSGTree ( ) ;
void actionDisplayCSGProducts ( ) ;
2009-06-23 23:56:46 +04:00
void actionExportSTL ( ) ;
void actionExportOFF ( ) ;
2009-06-25 02:38:31 +04:00
public :
# ifdef ENABLE_OPENCSG
QAction * actViewModeOpenCSG ;
# endif
# ifdef ENABLE_CGAL
QAction * actViewModeCGALSurface ;
QAction * actViewModeCGALGrid ;
# endif
2009-06-25 12:12:41 +04:00
QAction * actViewModeThrownTogether ;
2009-07-02 19:12:10 +04:00
QAction * actViewModeShowEdges ;
2009-06-25 02:38:31 +04:00
void viewModeActionsUncheck ( ) ;
private slots :
# ifdef ENABLE_OPENCSG
void viewModeOpenCSG ( ) ;
# endif
# ifdef ENABLE_CGAL
void viewModeCGALSurface ( ) ;
void viewModeCGALGrid ( ) ;
# endif
2009-06-25 12:12:41 +04:00
void viewModeThrownTogether ( ) ;
2009-07-02 19:12:10 +04:00
void viewModeShowEdges ( ) ;
2009-06-23 23:56:46 +04:00
} ;
extern AbstractModule * parse ( const char * text , int debug ) ;
2009-07-17 04:34:15 +04:00
extern int get_fragments_from_r ( double r , double fn , double fs , double fa ) ;
2009-06-21 10:53:46 +04:00
2009-06-27 14:04:57 +04:00
extern QPointer < MainWindow > current_win ;
# define PRINT(_msg) do { if (current_win.isNull()) fprintf(stderr, "%s\n", QString(_msg).toAscii().data()); else current_win->console->append(_msg); } while (0)
# define PRINTF(_fmt, ...) do { QString _m; _m.sprintf(_fmt, ##__VA_ARGS__); PRINT(_m); } while (0)
# define PRINTA(_fmt, ...) do { QString _m = QString(_fmt).arg(__VA_ARGS__); PRINT(_m); } while (0)
2009-06-20 16:10:55 +04:00
# endif