Revision 69 EditorActions.cpp
| EditorActions.cpp (revision 69) | ||
|---|---|---|
| 31 | 31 |
#include "EditorActions.h" |
| 32 | 32 |
#include "EditorCore.h" |
| 33 | 33 |
|
| 34 |
// =========================================================================== |
|
| 35 |
// =========================================================================== |
|
| 36 |
// =========================================================================== |
|
| 37 |
|
|
| 34 | 38 |
resizeControl::resizeControl(EditorPanel *ed) : ofxArgosUI_Control("resizeControl") {
|
| 35 | 39 |
controlType = "resizeControl"; |
| 36 | 40 |
editor = ed; |
| ... | ... | |
| 113 | 117 |
|
| 114 | 118 |
ofDisableAlphaBlending(); |
| 115 | 119 |
|
| 120 |
} |
|
| 121 |
|
|
| 122 |
// =========================================================================== |
|
| 123 |
// =========================================================================== |
|
| 124 |
// =========================================================================== |
|
| 125 |
|
|
| 126 |
moveControl::moveControl(EditorPanel *ed) : ofxArgosUI_Control("moveControl") {
|
|
| 127 |
controlType = "moveControl"; |
|
| 128 |
editor = ed; |
|
| 129 |
dragging = false; |
|
| 130 |
} |
|
| 131 |
|
|
| 132 |
void moveControl::setControl() {
|
|
| 133 |
if (focus.focused != NULL){
|
|
| 134 |
setPos(focus.focused->x, focus.focused->y); |
|
| 135 |
setSize(focus.focused->width, focus.focused->height); |
|
| 136 |
} |
|
| 137 |
} |
|
| 138 |
|
|
| 139 |
void moveControl::onRollOver(int x, int y) {
|
|
| 140 |
glutSetCursor(GLUT_CURSOR_INFO); |
|
| 141 |
} |
|
| 142 |
|
|
| 143 |
void moveControl::onRollOut() {
|
|
| 144 |
glutSetCursor(GLUT_CURSOR_LEFT_ARROW); |
|
| 145 |
} |
|
| 146 |
|
|
| 147 |
void moveControl::onDragOutside(int x, int y, int button) {
|
|
| 148 |
|
|
| 149 |
glutSetCursor(GLUT_CURSOR_INFO); |
|
| 150 |
|
|
| 151 |
dragging = true; |
|
| 152 |
|
|
| 153 |
dragX = (floor(((float) x / 20)) * 20); |
|
| 154 |
dragY = (floor(((float) y / 20)) * 20); |
|
| 155 |
|
|
| 156 |
} |
|
| 157 |
|
|
| 158 |
void moveControl::onRelease(int x, int y, int button) {
|
|
| 159 |
glutSetCursor(GLUT_CURSOR_LEFT_ARROW); |
|
| 160 |
|
|
| 161 |
dragging = false; |
|
| 162 |
|
|
| 163 |
} |
|
| 164 |
|
|
| 165 |
void moveControl::onReleaseOutside(int x, int y, int button) {
|
|
| 166 |
glutSetCursor(GLUT_CURSOR_LEFT_ARROW); |
|
| 167 |
|
|
| 168 |
dragging = false; |
|
| 169 |
|
|
| 170 |
if (focus.focused != NULL){
|
|
| 171 |
editor->updateLocation(newX, newY); |
|
| 172 |
} |
|
| 173 |
|
|
| 174 |
} |
|
| 175 |
|
|
| 176 |
void moveControl::update() {}
|
|
| 177 |
|
|
| 178 |
void moveControl::draw() {
|
|
| 179 |
|
|
| 180 |
setControl(); |
|
| 181 |
|
|
| 182 |
if (dragging) {
|
|
| 183 |
|
|
| 184 |
if (focus.focused != NULL){
|
|
| 185 |
ofNoFill(); |
|
| 186 |
ofSetColor(255, 255, 255); ; |
|
| 187 |
|
|
| 188 |
newX = dragX; |
|
| 189 |
newY = dragY; |
|
| 190 |
|
|
| 191 |
ofRect(newX, newY, width, height); |
|
| 192 |
|
|
| 193 |
} |
|
| 194 |
} |
|
| 195 |
|
|
| 196 |
ofEnableAlphaBlending(); |
|
| 197 |
|
|
| 198 |
glPushMatrix(); |
|
| 199 |
|
|
| 200 |
ofFill(); |
|
| 201 |
ofSetColor(0xe3e3e3); |
|
| 202 |
//ofRect(x, y, 5, 5); |
|
| 203 |
ofNoFill(); |
|
| 204 |
|
|
| 205 |
glPopMatrix(); |
|
| 206 |
|
|
| 207 |
ofDisableAlphaBlending(); |
|
| 208 |
|
|
| 116 | 209 |
} |
Also available in: Unified diff
