1 /**************************************************************************** 2 * MeshLab o o * 3 * A versatile mesh processing toolbox o o * 4 * _ O _ * 5 * Copyright(C) 2005-2008 \/)\/ * 6 * Visual Computing Lab /\/| * 7 * ISTI - Italian National Research Council | * 8 * \ * 9 * All rights reserved. * 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 * This program is distributed in the hope that it will be useful, * 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 * for more details. * 21 * * 22 ****************************************************************************/ 23 24 #ifndef RFX_DIALOG_H_ 25 #define RFX_DIALOG_H_ 26 27 /* syntax highlighter for vertex and fragment editor */ 28 #include <QSyntaxHighlighter> 29 class GLSLSynHlighter : public QSyntaxHighlighter 30 { 31 public: 32 GLSLSynHlighter(QTextDocument *parent = 0); 33 34 protected: 35 void highlightBlock(const QString &text); 36 37 private: 38 struct HighlightingRule 39 { 40 QRegExp pattern; 41 QTextCharFormat format; 42 }; 43 QVector<HighlightingRule> highlightingRules; 44 45 QTextCharFormat kwordsFormat; 46 QTextCharFormat builtinsFormat; 47 QTextCharFormat functionFormat; 48 QTextCharFormat singleLineCommentFormat; 49 QTextCharFormat multiLineCommentFormat; 50 51 QRegExp commentStartExpression; 52 QRegExp commentEndExpression; 53 }; 54 55 56 /* Shader Properties dialog */ 57 #include <cassert> 58 #include <climits> 59 #include <cfloat> 60 #include <QMap> 61 #include <typeinfo> 62 #include <QLabel> 63 #include <QPicture> 64 #include <QSpinBox> 65 #include <QDoubleSpinBox> 66 #include <QTableWidget> 67 #include <QTableWidgetItem> 68 #include <QHeaderView> 69 #include <QSignalMapper> 70 #include <QFileDialog> 71 #include <QColor> 72 #include <QDockWidget> 73 #include "ui_rfx_dialog.h" 74 #include "rfx_shader.h" 75 #include "rfx_specialuniform.h" 76 #include "rfx_colorbox.h" 77 78 class RfxDialog : public QDockWidget 79 { 80 Q_OBJECT 81 82 public: 83 RfxDialog(RfxShader*, QAction*, QGLWidget *parent = 0); 84 virtual ~RfxDialog(); 85 86 87 static const float DECTOINT; 88 static const float INTTODEC; 89 90 enum DialogTabs { UNIFORM_TAB, TEXTURE_TAB, ALL_TABS }; 91 92 public slots: 93 void PassSelected(int); 94 void TextureSelected(int); 95 void ChangeTexture(int); 96 void ChangeValue(const QString&); 97 void extendRange(double); 98 void extendRange(int); 99 void mapSliderLineEdit(QWidget*); 100 101 private: 102 void setupTabs(); 103 void AddUniformBox(RfxUniform*, int); 104 void DrawIFace(QGridLayout*, RfxUniform*, int idx, int rows, int columns); 105 void CleanTab(int); 106 107 Ui::RfxDock ui; 108 QGLWidget *mGLWin; 109 QMultiMap<int, QWidget*> widgetsByTab; 110 int selPass; 111 RfxShader *shader; 112 GLSLSynHlighter *vertHL; 113 GLSLSynHlighter *fragHL; 114 }; 115 #endif /* RFX_DIALOG_H_ */ 116