SeExpr

ExprControlCollection.h
Go to the documentation of this file.
1 /*
2 * Copyright Disney Enterprises, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License
6 * and the following modification to it: Section 6 Trademarks.
7 * deleted and replaced with:
8 *
9 * 6. Trademarks. This License does not grant permission to use the
10 * trade names, trademarks, service marks, or product names of the
11 * Licensor and its affiliates, except as required for reproducing
12 * the content of the NOTICE file.
13 *
14 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * @file ExprControlCollection.h
18 * @brief Manages/creates a bunch of ExprControls by using expression text
19 * @author aselle
20 */
21 #ifndef _ExprControlCollection_h
22 #define _ExprControlCollection_h
23 #include <vector>
24
25 #include <QTimer>
26 #include <QRegExp>
27 #include <QTextBrowser>
28 #include <QPlainTextEdit>
29 #include <QDialog>
30 #include <QLineEdit>
31 #include <QCheckBox>
32 #include <QSlider>
33 #include "ExprControl.h"
34
35 class QVBoxLayout;
36 class QRadioButton;
37 class EditableExpression;
38
40 class ExprAddDialog : public QDialog {
41 Q_OBJECT;
42
43 public:
44 QLineEdit *variableName;
45 QTabWidget *tabWidget;
46 QLineEdit *intDefault;
47 QLineEdit *intMin;
48 QLineEdit *intMax;
49 QLineEdit *floatDefault;
50 QLineEdit *floatMin;
51 QLineEdit *floatMax;
52 QLineEdit *vectorDefault0;
53 QLineEdit *vectorDefault1;
54 QLineEdit *vectorDefault2;
55 QLineEdit *vectorMin;
56 QLineEdit *vectorMax;
57 QLineEdit *curveLookup;
58 QLineEdit *colorCurveLookup;
59 QLineEdit *animCurveLookup;
60 QLineEdit *animCurveLink;
61 QLineEdit *swatchLookup;
62 QLineEdit *deepWaterLookup;
63 QRadioButton *rainbowPaletteBtn;
64 QRadioButton *grayPaletteBtn;
65 QColor color;
66 QPushButton *colorWidget;
67 QComboBox *stringTypeWidget;
68 QLineEdit *stringDefaultWidget;
69 QLineEdit *stringNameWidget;
70
71 ExprAddDialog(int &count, QWidget *parent = 0);
72 const char *initSwatch();
73 private
74 slots:
75 void colorChooseClicked();
76 };
77
81 class ExprControlCollection : public QWidget {
82 Q_OBJECT;
83
84 int _linkedId;
85 int count;
86 bool showAddButton;
87
88 // holds a representation factored into the controls
89 EditableExpression *editableExpression;
90
91 public:
92 ExprControlCollection(QWidget *parent = 0, bool showAddButton = true);
93 ~ExprControlCollection();
94
95 private:
96 // TODO: put back
97 std::vector<ExprControl *> _controls;
98 QVBoxLayout *controlLayout;
99
100 public:
102 void updateText(const int id, QString &text);
104 bool rebuildControls(const QString &expressionText, std::vector<QString> &variables);
105
107 int numControls() { return _controls.size(); }
108
109 void showEditor(int idx);
110
112 static void setAnimCurveCallback(AnimCurveControl::AnimCurveCallback callback) {
113 AnimCurveControl::setAnimCurveCallback(callback);
114 }
115
116 private
117 slots:
119 void addControlDialog();
121 void singleControlChanged(int id);
123 void linkColorLink(int id);
125 void linkColorEdited(int id, QColor color);
126 signals:
128 void controlChanged(int id);
130 void linkColorOutput(QColor color);
133 void insertString(const std::string &controlString);
134 public
135 slots:
138 void linkColorInput(QColor color);
139 };
140
141 #endif
ExprControlCollection::_controls
std::vector< ExprControl * > _controls
Definition: ExprControlCollection.h:97
AnimCurveControl::setAnimCurveCallback
static void setAnimCurveCallback(AnimCurveCallback callback)
Definition: ExprControl.cpp:669
ExprAddDialog::grayPaletteBtn
QRadioButton * grayPaletteBtn
Definition: ExprControlCollection.h:64
ExprAddDialog::vectorDefault0
QLineEdit * vectorDefault0
Definition: ExprControlCollection.h:52
EditableExpression
Factors a SeExpr into an editable expression with controls (i.e. value boxes, curve boxes)
Definition: EditableExpression.h:29
ExprAddDialog::rainbowPaletteBtn
QRadioButton * rainbowPaletteBtn
Definition: ExprControlCollection.h:63
ExprAddDialog::initSwatch
const char * initSwatch()
Definition: ExprControlCollection.cpp:256
ExprControlCollection::ExprControlCollection
ExprControlCollection(QWidget *parent=0, bool showAddButton=true)
Definition: ExprControlCollection.cpp:40
variables
</pre > Once we have this we need an instance to store our variable and provide a reference to that We make it because it may be useful to use the same ExprVarRef from multiple expressions ! For if you have expressions that all have access to the same variables
Definition: tutorial.txt:128
ExprControlCollection::setAnimCurveCallback
static void setAnimCurveCallback(AnimCurveControl::AnimCurveCallback callback)
Anim curve callback.
Definition: ExprControlCollection.h:112
ExprAddDialog::color
QColor color
Definition: ExprControlCollection.h:65
ExprControlCollection::showEditor
void showEditor(int idx)
Definition: ExprControlCollection.cpp:413
ExprControlCollection::_linkedId
int _linkedId
Definition: ExprControlCollection.h:82
ExprControlCollection::linkColorOutput
void linkColorOutput(QColor color)
Gives information about when a link color was changed.
ExprAddDialog::vectorMax
QLineEdit * vectorMax
Definition: ExprControlCollection.h:56
ExprAddDialog::variableName
QLineEdit * variableName
Definition: ExprControlCollection.h:41
ExprAddDialog::colorCurveLookup
QLineEdit * colorCurveLookup
Definition: ExprControlCollection.h:58
ExprAddDialog::floatDefault
QLineEdit * floatDefault
Definition: ExprControlCollection.h:49
ExprControlCollection
Definition: ExprControlCollection.h:81
ExprControlCollection::linkColorLink
void linkColorLink(int id)
Notification by a control that a new color link is desired.
Definition: ExprControlCollection.cpp:424
ExprControlCollection::count
int count
Definition: ExprControlCollection.h:85
ExprControlCollection::controlLayout
QVBoxLayout * controlLayout
Definition: ExprControlCollection.h:98
ExprAddDialog::vectorMin
QLineEdit * vectorMin
Definition: ExprControlCollection.h:55
ExprAddDialog::vectorDefault1
QLineEdit * vectorDefault1
Definition: ExprControlCollection.h:53
ExprControlCollection::insertString
void insertString(const std::string &controlString)
ExprAddDialog::stringTypeWidget
QComboBox * stringTypeWidget
Definition: ExprControlCollection.h:67
ExprControlCollection::numControls
int numControls()
Number of controls.
Definition: ExprControlCollection.h:107
ExprAddDialog::colorChooseClicked
void colorChooseClicked()
Definition: ExprControlCollection.cpp:247
ExprAddDialog::swatchLookup
QLineEdit * swatchLookup
Definition: ExprControlCollection.h:61
ExprAddDialog::floatMin
QLineEdit * floatMin
Definition: ExprControlCollection.h:50
ExprControlCollection::editableExpression
EditableExpression * editableExpression
Definition: ExprControlCollection.h:89
ExprControlCollection::updateText
void updateText(const int id, QString &text)
Request new text, given taking into account control id's new values.
Definition: ExprControlCollection.cpp:441
ExprAddDialog::curveLookup
QLineEdit * curveLookup
Definition: ExprControlCollection.h:57
ExprAddDialog::tabWidget
QTabWidget * tabWidget
Definition: ExprControlCollection.h:45
ExprControlCollection::rebuildControls
bool rebuildControls(const QString &expressionText, std::vector< QString > &variables)
Rebuild the controls given the new expressionText. Return any local variables found.
Definition: ExprControlCollection.cpp:334
ExprControlCollection::linkColorEdited
void linkColorEdited(int id, QColor color)
Notification by a control that a color is edited (when it is linked)
Definition: ExprControlCollection.cpp:431
ExprAddDialog::intMax
QLineEdit * intMax
Definition: ExprControlCollection.h:48
AnimCurveControl::AnimCurveCallback
void(* AnimCurveCallback)(const std::string &, animlib::AnimCurve &curve)
Definition: ExprControl.h:291
ExprAddDialog::intMin
QLineEdit * intMin
Definition: ExprControlCollection.h:47
ExprAddDialog::animCurveLookup
QLineEdit * animCurveLookup
Definition: ExprControlCollection.h:59
ExprControlCollection::showAddButton
bool showAddButton
Definition: ExprControlCollection.h:86
ExprControl.h
ExprAddDialog::colorWidget
QPushButton * colorWidget
Definition: ExprControlCollection.h:66
ExprControlCollection::~ExprControlCollection
~ExprControlCollection()
Definition: ExprControlCollection.cpp:59
ExprAddDialog
This class is the UI for adding widgets.
Definition: ExprControlCollection.h:40
ExprAddDialog::ExprAddDialog
ExprAddDialog(int &count, QWidget *parent=0)
Definition: ExprControlCollection.cpp:61
ExprAddDialog::deepWaterLookup
QLineEdit * deepWaterLookup
Definition: ExprControlCollection.h:62
ExprAddDialog::stringDefaultWidget
QLineEdit * stringDefaultWidget
Definition: ExprControlCollection.h:68
ExprAddDialog::vectorDefault2
QLineEdit * vectorDefault2
Definition: ExprControlCollection.h:54
ExprAddDialog::floatMax
QLineEdit * floatMax
Definition: ExprControlCollection.h:51
ExprControlCollection::addControlDialog
void addControlDialog()
When a user clicks "Add Widget" button.
Definition: ExprControlCollection.cpp:266
ExprControlCollection::singleControlChanged
void singleControlChanged(int id)
Notification when by a control whenever it is edited.
Definition: ExprControlCollection.cpp:446
ExprAddDialog::stringNameWidget
QLineEdit * stringNameWidget
Definition: ExprControlCollection.h:69
ExprAddDialog::intDefault
QLineEdit * intDefault
Definition: ExprControlCollection.h:46
ExprControlCollection::controlChanged
void controlChanged(int id)
Notification that a specific control was changed.
ExprAddDialog::animCurveLink
QLineEdit * animCurveLink
Definition: ExprControlCollection.h:60
ExprControlCollection::linkColorInput
void linkColorInput(QColor color)
Definition: ExprControlCollection.cpp:435