From 1f524f2c41c73113c7529703e6f3274fdcc19956 Mon Sep 17 00:00:00 2001 From: rezaali Date: Thu, 20 Feb 2014 21:31:48 -0800 Subject: [PATCH] removed ofxUIEnvelopEditor --- .../project.pbxproj | 12 - example-AllWidgets/src/ofApp.cpp | 9 - example-AllWidgets/src/ofApp.h | 1 - .../bin/data/GUI/gui1Settings.xml | 5 - .../bin/data/GUI/guiSettings.xml | 5 - example-CustomPlacement/src/ofApp.cpp | 10 +- example-CustomWidgets/bin/data/settings.xml | 10 + example-SaveLoadSettings/bin/data/gui2.xml | 2 +- example-SaveLoadSettings/bin/data/gui3.xml | 5 + example-SaveLoadSettings/bin/data/gui4.xml | 11 +- example-SaveLoadSettings/src/ofApp.cpp | 2 +- .../project.pbxproj | 12 - src/ofxUICanvas.cpp | 25 -- src/ofxUICanvas.h | 6 +- src/ofxUIDefines.h | 29 +- src/ofxUIEnvelope.cpp | 103 ----- src/ofxUIEnvelope.h | 46 -- src/ofxUIEnvelopeEditor.cpp | 423 ------------------ src/ofxUIEnvelopeEditor.h | 90 ---- src/ofxUIFPS.cpp | 1 - src/ofxUIOFWrapper.h | 6 +- src/ofxUIRadio.cpp | 1 + src/ofxUITextInput.cpp | 7 +- src/ofxUIWidgets.h | 1 - 24 files changed, 47 insertions(+), 775 deletions(-) delete mode 100644 src/ofxUIEnvelope.cpp delete mode 100644 src/ofxUIEnvelope.h delete mode 100644 src/ofxUIEnvelopeEditor.cpp delete mode 100644 src/ofxUIEnvelopeEditor.h diff --git a/example-AllWidgets/example-AllWidgets.xcodeproj/project.pbxproj b/example-AllWidgets/example-AllWidgets.xcodeproj/project.pbxproj index 3941d19b4..9eebcdb6c 100644 --- a/example-AllWidgets/example-AllWidgets.xcodeproj/project.pbxproj +++ b/example-AllWidgets/example-AllWidgets.xcodeproj/project.pbxproj @@ -20,8 +20,6 @@ 9E42EF5C189EECDB00C2F4E4 /* ofxUICircleSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E7211B9189EE9470079DE42 /* ofxUICircleSlider.cpp */; }; 9E42EF5D189EECDB00C2F4E4 /* ofxUIDragableLabelButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E7211BC189EE9470079DE42 /* ofxUIDragableLabelButton.cpp */; }; 9E42EF5E189EECDB00C2F4E4 /* ofxUIDropDownList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E7211BE189EE9470079DE42 /* ofxUIDropDownList.cpp */; }; - 9E42EF5F189EECDB00C2F4E4 /* ofxUIEnvelope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E7211C0189EE9470079DE42 /* ofxUIEnvelope.cpp */; }; - 9E42EF60189EECDB00C2F4E4 /* ofxUIEnvelopeEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E7211C2189EE9470079DE42 /* ofxUIEnvelopeEditor.cpp */; }; 9E42EF61189EECDB00C2F4E4 /* ofxUIEventArgs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E7211C4189EE9470079DE42 /* ofxUIEventArgs.cpp */; }; 9E42EF62189EECDB00C2F4E4 /* ofxUIFPS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E7211C6189EE9470079DE42 /* ofxUIFPS.cpp */; }; 9E42EF63189EECDB00C2F4E4 /* ofxUIFPSSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E7211C8189EE9470079DE42 /* ofxUIFPSSlider.cpp */; }; @@ -134,10 +132,6 @@ 9E7211BD189EE9470079DE42 /* ofxUIDragableLabelButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIDragableLabelButton.h; sourceTree = ""; }; 9E7211BE189EE9470079DE42 /* ofxUIDropDownList.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIDropDownList.cpp; sourceTree = ""; }; 9E7211BF189EE9470079DE42 /* ofxUIDropDownList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIDropDownList.h; sourceTree = ""; }; - 9E7211C0189EE9470079DE42 /* ofxUIEnvelope.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIEnvelope.cpp; sourceTree = ""; }; - 9E7211C1189EE9470079DE42 /* ofxUIEnvelope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIEnvelope.h; sourceTree = ""; }; - 9E7211C2189EE9470079DE42 /* ofxUIEnvelopeEditor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIEnvelopeEditor.cpp; sourceTree = ""; }; - 9E7211C3189EE9470079DE42 /* ofxUIEnvelopeEditor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIEnvelopeEditor.h; sourceTree = ""; }; 9E7211C4189EE9470079DE42 /* ofxUIEventArgs.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIEventArgs.cpp; sourceTree = ""; }; 9E7211C5189EE9470079DE42 /* ofxUIEventArgs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIEventArgs.h; sourceTree = ""; }; 9E7211C6189EE9470079DE42 /* ofxUIFPS.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIFPS.cpp; sourceTree = ""; }; @@ -320,10 +314,6 @@ 9E7211BD189EE9470079DE42 /* ofxUIDragableLabelButton.h */, 9E7211BE189EE9470079DE42 /* ofxUIDropDownList.cpp */, 9E7211BF189EE9470079DE42 /* ofxUIDropDownList.h */, - 9E7211C0189EE9470079DE42 /* ofxUIEnvelope.cpp */, - 9E7211C1189EE9470079DE42 /* ofxUIEnvelope.h */, - 9E7211C2189EE9470079DE42 /* ofxUIEnvelopeEditor.cpp */, - 9E7211C3189EE9470079DE42 /* ofxUIEnvelopeEditor.h */, 9E7211EF189EE9480079DE42 /* ofxUISlider.cpp */, 9E7211F0189EE9480079DE42 /* ofxUISlider.h */, 9E7211C4189EE9470079DE42 /* ofxUIEventArgs.cpp */, @@ -587,8 +577,6 @@ 9E42EF5C189EECDB00C2F4E4 /* ofxUICircleSlider.cpp in Sources */, 9E42EF5D189EECDB00C2F4E4 /* ofxUIDragableLabelButton.cpp in Sources */, 9E42EF5E189EECDB00C2F4E4 /* ofxUIDropDownList.cpp in Sources */, - 9E42EF5F189EECDB00C2F4E4 /* ofxUIEnvelope.cpp in Sources */, - 9E42EF60189EECDB00C2F4E4 /* ofxUIEnvelopeEditor.cpp in Sources */, 9E42EF61189EECDB00C2F4E4 /* ofxUIEventArgs.cpp in Sources */, 9E42EF62189EECDB00C2F4E4 /* ofxUIFPS.cpp in Sources */, 9E42EF63189EECDB00C2F4E4 /* ofxUIFPSSlider.cpp in Sources */, diff --git a/example-AllWidgets/src/ofApp.cpp b/example-AllWidgets/src/ofApp.cpp index b43ec0380..1f39c2420 100644 --- a/example-AllWidgets/src/ofApp.cpp +++ b/example-AllWidgets/src/ofApp.cpp @@ -128,7 +128,6 @@ void ofApp::exit() delete gui5; delete[] buffer; delete img; - delete env; } //-------------------------------------------------------------- @@ -416,14 +415,6 @@ void ofApp::setGUI3() gui3->setWidgetPosition(OFX_UI_WIDGET_POSITION_DOWN); gui3->addSpacer(); - env = new ofxUIEnvelope(); - for(float i = 0; i <= 5; i++) - { - env->addPoint(i/5.0, i/5.0); - } - - gui3->addWidgetDown(new ofxUIEnvelopeEditor("ENV", env, 200, 128)); - vector items; items.push_back("FIRST ITEM"); items.push_back("SECOND ITEM"); items.push_back("THIRD ITEM"); items.push_back("FOURTH ITEM"); items.push_back("FIFTH ITEM"); items.push_back("SIXTH ITEM"); diff --git a/example-AllWidgets/src/ofApp.h b/example-AllWidgets/src/ofApp.h index 97e562ee7..ba5e2d8e9 100644 --- a/example-AllWidgets/src/ofApp.h +++ b/example-AllWidgets/src/ofApp.h @@ -50,5 +50,4 @@ class ofApp : public ofBaseApp{ float *buffer; ofImage *img; - ofxUIEnvelope *env; }; diff --git a/example-CanvasMapVector/bin/data/GUI/gui1Settings.xml b/example-CanvasMapVector/bin/data/GUI/gui1Settings.xml index 0e4cec7b5..ccaaaf2bc 100644 --- a/example-CanvasMapVector/bin/data/GUI/gui1Settings.xml +++ b/example-CanvasMapVector/bin/data/GUI/gui1Settings.xml @@ -1,8 +1,3 @@ - - 4 - FPS - 60.007865906 - 4 BG_RED diff --git a/example-ContextualMenu/bin/data/GUI/guiSettings.xml b/example-ContextualMenu/bin/data/GUI/guiSettings.xml index 9dc440e4a..598f2bfab 100755 --- a/example-ContextualMenu/bin/data/GUI/guiSettings.xml +++ b/example-ContextualMenu/bin/data/GUI/guiSettings.xml @@ -1,8 +1,3 @@ - - 4 - FPS - 59.953403473 - 4 RADIUS diff --git a/example-CustomPlacement/src/ofApp.cpp b/example-CustomPlacement/src/ofApp.cpp index ddd184c3b..425726f1a 100755 --- a/example-CustomPlacement/src/ofApp.cpp +++ b/example-CustomPlacement/src/ofApp.cpp @@ -20,14 +20,14 @@ void ofApp::setup() gui->addWidgetDown(new ofxUILabel("CUSTOM WIDGET LAYOUT", OFX_UI_FONT_LARGE), OFX_UI_ALIGN_RIGHT); gui->addWidget(new ofxUILabel(360, 300, "2D PAD", OFX_UI_FONT_MEDIUM)); - gui->addWidgetSouthOf(new ofxUI2DPad(320, 190, ofPoint(320*.5,190*.5), "PAD"), "2D PAD"); - gui->addWidgetWestOf(new ofxUITextInput(160, "TEXT INPUT", "Input Text", OFX_UI_FONT_LARGE), "PAD"); + gui->addWidgetSouthOf(new ofxUI2DPad("PAD", ofPoint(0, 320), ofPoint(0, 190), ofPoint(320*.5,190*.5), 320, 190), "2D PAD"); + gui->addWidgetWestOf(new ofxUITextInput("TEXT INPUT", "Input Text", 320, dim, 0, 0, OFX_UI_FONT_MEDIUM), "PAD"); gui->addWidgetEastOf(new ofxUISlider("0", 0.0, 255.0, 150, dim, 190), "PAD"); - gui->addWidgetNorthOf(new ofxUIToggle(dim, dim, false, "D_GRID"), "TEXT INPUT"); - gui->addWidgetWestOf(new ofxUIToggle(dim, dim, true, "D2"), "D_GRID"); + gui->addWidgetNorthOf(new ofxUIToggle("D_GRID", false, dim, dim), "2D PAD"); + gui->addWidgetWestOf(new ofxUIToggle("D2", true, dim, dim), "D_GRID"); gui->addWidgetNorthOf(new ofxUISlider("GREEN", 0.0, 255.0, &green, 320, dim), "D2"); gui->addWidgetNorthOf(new ofxUISlider("BLUE", 0.0, 255.0, &blue, 320, dim), "GREEN"); - gui->addWidgetLeft(new ofxUIToggle(dim, dim, true, "NEW")); + gui->addWidgetLeft(new ofxUIToggle("NEW", true, dim, dim)); gui->addWidgetSouthOf(new ofxUISlider("RED", 0.0, 255.0, &red, 320, dim), "PAD"); gui->autoSizeToFitWidgets(); diff --git a/example-CustomWidgets/bin/data/settings.xml b/example-CustomWidgets/bin/data/settings.xml index da1e74cae..3d20b8161 100644 --- a/example-CustomWidgets/bin/data/settings.xml +++ b/example-CustomWidgets/bin/data/settings.xml @@ -33,6 +33,11 @@ 88 255 + + 22 + DDL + 0 + 17 FIRST @@ -53,6 +58,11 @@ FOURTH 0 + + 22 + MULTIPLE + 0 + 17 FIFTH diff --git a/example-SaveLoadSettings/bin/data/gui2.xml b/example-SaveLoadSettings/bin/data/gui2.xml index fef933c35..e8e88e398 100644 --- a/example-SaveLoadSettings/bin/data/gui2.xml +++ b/example-SaveLoadSettings/bin/data/gui2.xml @@ -17,7 +17,7 @@ 8 - NUMBER DIALER + DIALER 5000.000000000 diff --git a/example-SaveLoadSettings/bin/data/gui3.xml b/example-SaveLoadSettings/bin/data/gui3.xml index dff6d22e8..7a8485968 100644 --- a/example-SaveLoadSettings/bin/data/gui3.xml +++ b/example-SaveLoadSettings/bin/data/gui3.xml @@ -200,6 +200,11 @@ IMAGETGL 0 + + 22 + DROP DOWN LIST + 0 + 17 FIRST ITEM diff --git a/example-SaveLoadSettings/bin/data/gui4.xml b/example-SaveLoadSettings/bin/data/gui4.xml index d5653d5e5..e4023e34e 100644 --- a/example-SaveLoadSettings/bin/data/gui4.xml +++ b/example-SaveLoadSettings/bin/data/gui4.xml @@ -8,18 +8,13 @@ 26 BILABEL - 74.384239197 + 75.000000000 25 MINIMAL 0.000000000 - - 4 - FPS SLIDER - 59.998012543 - 28 SAMPLER @@ -35,7 +30,3 @@ IMAGE TOGGLE 1 - - 44 - SORTABLE LIST - diff --git a/example-SaveLoadSettings/src/ofApp.cpp b/example-SaveLoadSettings/src/ofApp.cpp index 52cd171d4..a7ee26b3c 100644 --- a/example-SaveLoadSettings/src/ofApp.cpp +++ b/example-SaveLoadSettings/src/ofApp.cpp @@ -281,7 +281,7 @@ void ofApp::setGUI2() gui2->addSpacer(); gui2->addLabel("NUMBER DIALER"); - gui2->addNumberDialer("NUMBER DIALER", -10000, 10000, 5000, 1); + gui2->addNumberDialer("DIALER", -10000, 10000, 5000, 1); gui2->addSpacer(); gui2->addLabel("LABEL BUTTON", OFX_UI_FONT_MEDIUM); diff --git a/example-Tutorial/example-Tutorial.xcodeproj/project.pbxproj b/example-Tutorial/example-Tutorial.xcodeproj/project.pbxproj index 0ff065ba8..2ebeceb4c 100644 --- a/example-Tutorial/example-Tutorial.xcodeproj/project.pbxproj +++ b/example-Tutorial/example-Tutorial.xcodeproj/project.pbxproj @@ -20,8 +20,6 @@ 9E42EF2D189EEC8900C2F4E4 /* ofxUICircleSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E42EED1189EEB9000C2F4E4 /* ofxUICircleSlider.cpp */; }; 9E42EF2E189EEC8900C2F4E4 /* ofxUIDragableLabelButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E42EED4189EEB9000C2F4E4 /* ofxUIDragableLabelButton.cpp */; }; 9E42EF2F189EEC8900C2F4E4 /* ofxUIDropDownList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E42EED6189EEB9000C2F4E4 /* ofxUIDropDownList.cpp */; }; - 9E42EF30189EEC8900C2F4E4 /* ofxUIEnvelope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E42EED8189EEB9000C2F4E4 /* ofxUIEnvelope.cpp */; }; - 9E42EF31189EEC8900C2F4E4 /* ofxUIEnvelopeEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E42EEDA189EEB9000C2F4E4 /* ofxUIEnvelopeEditor.cpp */; }; 9E42EF32189EEC8900C2F4E4 /* ofxUIEventArgs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E42EEDC189EEB9000C2F4E4 /* ofxUIEventArgs.cpp */; }; 9E42EF33189EEC8900C2F4E4 /* ofxUIFPS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E42EEDE189EEB9000C2F4E4 /* ofxUIFPS.cpp */; }; 9E42EF34189EEC8900C2F4E4 /* ofxUIFPSSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E42EEE0189EEB9000C2F4E4 /* ofxUIFPSSlider.cpp */; }; @@ -134,10 +132,6 @@ 9E42EED5189EEB9000C2F4E4 /* ofxUIDragableLabelButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIDragableLabelButton.h; sourceTree = ""; }; 9E42EED6189EEB9000C2F4E4 /* ofxUIDropDownList.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIDropDownList.cpp; sourceTree = ""; }; 9E42EED7189EEB9000C2F4E4 /* ofxUIDropDownList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIDropDownList.h; sourceTree = ""; }; - 9E42EED8189EEB9000C2F4E4 /* ofxUIEnvelope.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIEnvelope.cpp; sourceTree = ""; }; - 9E42EED9189EEB9000C2F4E4 /* ofxUIEnvelope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIEnvelope.h; sourceTree = ""; }; - 9E42EEDA189EEB9000C2F4E4 /* ofxUIEnvelopeEditor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIEnvelopeEditor.cpp; sourceTree = ""; }; - 9E42EEDB189EEB9000C2F4E4 /* ofxUIEnvelopeEditor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIEnvelopeEditor.h; sourceTree = ""; }; 9E42EEDC189EEB9000C2F4E4 /* ofxUIEventArgs.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIEventArgs.cpp; sourceTree = ""; }; 9E42EEDD189EEB9000C2F4E4 /* ofxUIEventArgs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxUIEventArgs.h; sourceTree = ""; }; 9E42EEDE189EEB9000C2F4E4 /* ofxUIFPS.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxUIFPS.cpp; sourceTree = ""; }; @@ -309,8 +303,6 @@ 9E42EED1189EEB9000C2F4E4 /* ofxUICircleSlider.cpp */, 9E42EED4189EEB9000C2F4E4 /* ofxUIDragableLabelButton.cpp */, 9E42EED6189EEB9000C2F4E4 /* ofxUIDropDownList.cpp */, - 9E42EED8189EEB9000C2F4E4 /* ofxUIEnvelope.cpp */, - 9E42EEDA189EEB9000C2F4E4 /* ofxUIEnvelopeEditor.cpp */, 9E42EEDC189EEB9000C2F4E4 /* ofxUIEventArgs.cpp */, 9E42EEDE189EEB9000C2F4E4 /* ofxUIFPS.cpp */, 9E42EEE0189EEB9000C2F4E4 /* ofxUIFPSSlider.cpp */, @@ -357,8 +349,6 @@ 9E42EED3189EEB9000C2F4E4 /* ofxUIDefines.h */, 9E42EED5189EEB9000C2F4E4 /* ofxUIDragableLabelButton.h */, 9E42EED7189EEB9000C2F4E4 /* ofxUIDropDownList.h */, - 9E42EED9189EEB9000C2F4E4 /* ofxUIEnvelope.h */, - 9E42EEDB189EEB9000C2F4E4 /* ofxUIEnvelopeEditor.h */, 9E42EEDD189EEB9000C2F4E4 /* ofxUIEventArgs.h */, 9E42EEDF189EEB9000C2F4E4 /* ofxUIFPS.h */, 9E42EEE1189EEB9000C2F4E4 /* ofxUIFPSSlider.h */, @@ -587,8 +577,6 @@ 9E42EF2D189EEC8900C2F4E4 /* ofxUICircleSlider.cpp in Sources */, 9E42EF2E189EEC8900C2F4E4 /* ofxUIDragableLabelButton.cpp in Sources */, 9E42EF2F189EEC8900C2F4E4 /* ofxUIDropDownList.cpp in Sources */, - 9E42EF30189EEC8900C2F4E4 /* ofxUIEnvelope.cpp in Sources */, - 9E42EF31189EEC8900C2F4E4 /* ofxUIEnvelopeEditor.cpp in Sources */, 9E42EF32189EEC8900C2F4E4 /* ofxUIEventArgs.cpp in Sources */, 9E42EF33189EEC8900C2F4E4 /* ofxUIFPS.cpp in Sources */, 9E42EF34189EEC8900C2F4E4 /* ofxUIFPSSlider.cpp in Sources */, diff --git a/src/ofxUICanvas.cpp b/src/ofxUICanvas.cpp index cad1fffe3..e0f85fe10 100644 --- a/src/ofxUICanvas.cpp +++ b/src/ofxUICanvas.cpp @@ -1650,31 +1650,6 @@ ofxUI2DPad* ofxUICanvas::add2DPad(string _name, ofxUIVec3f _rangeX, ofxUIVec3f _ return widget; } -/* CUSTOM ENVELOPE EDITOR */ -ofxUIEnvelopeEditor* ofxUICanvas::addEnvelopeEditor(string _name, ofxUIVec3f _rangeX, ofxUIVec3f _rangeY, ofxUIVec3f _value, float h) -{ - if(h == -1) - { - h = globalGraphHeight; - } - float dim = rect->getWidth()-widgetSpacing*2; - ofxUIEnvelopeEditor* widget = new ofxUIEnvelopeEditor(_name, dim, h, 0, 0); - addWidgetPosition(widget, widgetPosition, widgetAlign); - return widget; -} - -ofxUIEnvelopeEditor* ofxUICanvas::addEnvelopeEditor(string _name, ofxUIVec3f _rangeX, ofxUIVec3f _rangeY, ofxUIVec3f _value, float w, float h, float x, float y) -{ - if(h == -1) - { - h = globalGraphHeight; - } - ofxUIEnvelopeEditor* widget = new ofxUIEnvelopeEditor(_name, w, h, x, y); - addWidgetPosition(widget, widgetPosition, widgetAlign); - return widget; -} - - ofxUITextInput* ofxUICanvas::addTextInput(string _name, string _textstring, int _size) { float h = 0; diff --git a/src/ofxUICanvas.h b/src/ofxUICanvas.h index 3c03fa0cb..2bf7251a0 100755 --- a/src/ofxUICanvas.h +++ b/src/ofxUICanvas.h @@ -193,11 +193,7 @@ class ofxUICanvas : public ofxUIWidget, public ofxUIAppCBGlue ofxUI2DPad* add2DPad(string _name, ofxUIVec3f _rangeX, ofxUIVec3f _rangeY, ofxUIVec3f _value, float w, float h, float x = 0, float y = 0); ofxUI2DPad* add2DPad(string _name, ofxUIVec3f _rangeX, ofxUIVec3f _rangeY, ofxUIVec3f *_value); ofxUI2DPad* add2DPad(string _name, ofxUIVec3f _rangeX, ofxUIVec3f _rangeY, ofxUIVec3f *_value, float w, float h, float x = 0, float y = 0); - - /* CUSTOM ENVELOPE EDITOR */ - ofxUIEnvelopeEditor* addEnvelopeEditor(string _name, ofxUIVec3f _rangeX, ofxUIVec3f _rangeY, ofxUIVec3f _value, float h = -1); - ofxUIEnvelopeEditor* addEnvelopeEditor(string _name, ofxUIVec3f _rangeX, ofxUIVec3f _rangeY, ofxUIVec3f _value, float w, float h = -1, float x = 0, float y = 0); - + ofxUITextInput* addTextInput(string _name, string _textstring, int _size = -1); ofxUITextInput* addTextInput(string _name, string _textstring, float w, float h = 0, float x = 0, float y = 0, int _size = -1); diff --git a/src/ofxUIDefines.h b/src/ofxUIDefines.h index 9e8958399..7db824fc3 100644 --- a/src/ofxUIDefines.h +++ b/src/ofxUIDefines.h @@ -28,6 +28,19 @@ #include "ofxXmlSettings.h" #endif +#ifdef TARGET_OF_IOS + #define OFX_UI_FONT_NAME "GUI/Helvetica.ttf" +#else + #define OFX_UI_FONT_NAME "sans-serif" +#endif + +#define OFX_UI_FONT_RESOLUTION 150 +#define OFX_UI_FONT_LARGE_SIZE 10 +#define OFX_UI_FONT_MEDIUM_SIZE 8 +#define OFX_UI_FONT_SMALL_SIZE 6 + +#define OFX_UI_LABEL_DRAW_BACK false + #define OFX_UI_STATE_NORMAL 0 #define OFX_UI_STATE_OVER 1 #define OFX_UI_STATE_DOWN 2 @@ -57,7 +70,6 @@ #define OFX_UI_COLOR_PADDED ofxUIColor(0, OFX_UI_COLOR_PADDED_ALPHA) //rect's padded color #define OFX_UI_COLOR_PADDED_OUTLINE ofxUIColor(255, OFX_UI_COLOR_PADDED_OUTLINE_ALPHA) //rect's padded outline color - #define OFX_UI_DRAW_PADDING false #define OFX_UI_DRAW_PADDING_OUTLINE false @@ -230,17 +242,4 @@ enum ofxUIThemeType OFX_UI_THEME_MINORANGE, OFX_UI_THEME_GRAYDAY, OFX_UI_THEME_MINBLACK -}; - -#ifdef TARGET_OF_IOS - #define OFX_UI_FONT_NAME "GUI/Helvetica.ttf" -#else - #define OFX_UI_FONT_NAME "sans-serif" -#endif - -#define OFX_UI_FONT_RESOLUTION 150 -#define OFX_UI_FONT_LARGE_SIZE 10 -#define OFX_UI_FONT_MEDIUM_SIZE 8 -#define OFX_UI_FONT_SMALL_SIZE 6 - -#define OFX_UI_LABEL_DRAW_BACK false \ No newline at end of file +}; \ No newline at end of file diff --git a/src/ofxUIEnvelope.cpp b/src/ofxUIEnvelope.cpp deleted file mode 100644 index e7611ed9f..000000000 --- a/src/ofxUIEnvelope.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -// ofxUIEnvelope.cpp -// GenMax -// -// Created by Mitchell Nordine on 28/01/2014. -// -// - -#include "ofxUIEnvelope.h" - -bool comparePointsX(ofVec3f pointA, ofVec3f pointB) -{ - return pointA.x < pointB.x; -} - -void ofxUIEnvelope::addPoint(double x, double y, float curve) -{ - ofVec3f point = ofVec3f(x, y, curve); - points.push_back(point); - sortPointsByX(); - return; -} - -void ofxUIEnvelope::sortPointsByX() -{ - sort(points.begin(), points.end(), comparePointsX); - return; -} - -//Interpolates through envelope points to find value y at position x. -double ofxUIEnvelope::getY(double _x) -{ - - x = _x; - int i; - - /* Iterate through to find correct envelope point */ - for (i=0; i < points.size() && x >= points.at(i).x; i++){} - - /* Interpolate between points */ - interpolation = interpolate(points.at(i-1), points.at(i)); - - /* Multiply interpolation by position and add onto previous point value */ - y = interpolation + points.at(i-1).y; - - return y; - -} - -vector & ofxUIEnvelope::getPoints() -{ - return points; -} - - -// Interpolates via a bezier curve whose depth is start.z -double ofxUIEnvelope::interpolate(ofVec3f start, ofVec3f end) -{ - - /* Find time passed from start of interpolation */ - xPos = x - start.x; - - /* Find length of interpolation */ - length = end.x - start.x; - - /* Set gradient for interpolation */ - gradientY = end.y - start.y; - gradient = length / gradientY; - - /* Consider bezier curve here - I've included original bezier code I used, - feel free to get rid of unnecessary stuff, just thought you might be - interested. */ - - /* All points needed for a Bezier: - double x1 = 0.0 - double x2 = gradientX/2.0f - double x3 = gradientX - double y1 = 0.0 */ - double y2 = (gradientY/2.0) + start.z * (gradientY/2.0); /* - double y3 = gradientY */ - - percentX = xPos / length; - - /* Re-adjust linear trajectory */ - //float xa = getBezierPt(0.0f, x2, xPos); - float ya = getBezierPt(0.0, y2, percentX); - //float xb = getBezierPt(x2, gradientX, xPos); - float yb = getBezierPt(y2, gradientY, percentX); - - /* Add gradient and Bezier together */ - result = getBezierPt(ya, yb, percentX); - - return result; - -} - -double ofxUIEnvelope::getBezierPt(float n1, float n2, float percentage) -{ - float difference = n2 - n1; - return n1 + (difference * percentage); -} - - diff --git a/src/ofxUIEnvelope.h b/src/ofxUIEnvelope.h deleted file mode 100644 index c0e9a41bf..000000000 --- a/src/ofxUIEnvelope.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// ofxUIEnvelope.h -// GenMax -// -// Created by Mitchell Nordine on 28/01/2014. -// -// - -#pragma once - -/* Header Includes */ - -#include "ofMain.h" - -/* This is needed for ofxUIEnvelope::sortPointsByX(). */ -bool comparePointsX(ofVec3f pointA, ofVec3f pointB); - -class ofxUIEnvelope { - -public: - - void addPoint(double x, double y, float curve = 0); - void sortPointsByX(); - double getY(double _x); - vector & getPoints(); - -private: - - double interpolate(ofVec3f start, ofVec3f end); - double getBezierPt(float n1, float n2, float percentage); - - double x, y; - double interpolation; - double xPos; - double length; - double gradient; - double gradientY; - double percentX; - double result; - -public: - vector points; /* x = x, time, etc - y = y, value, etc - z = bezier curve value */ - -}; diff --git a/src/ofxUIEnvelopeEditor.cpp b/src/ofxUIEnvelopeEditor.cpp deleted file mode 100644 index 238c5b37a..000000000 --- a/src/ofxUIEnvelopeEditor.cpp +++ /dev/null @@ -1,423 +0,0 @@ -/********************************************************************************** - - Copyright (C) 2012 Syed Reza Ali (www.syedrezaali.com) - Created by Mitchell Nordine on 28/01/2014. - Refactored & Edited by Reza Ali on 02/02/2014 - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - - **********************************************************************************/ - -#include "ofxUIEnvelopeEditor.h" -#include "ofxUI.h" -#include "ofxUIUtils.h" - -ofxUIEnvelopeEditor::ofxUIEnvelopeEditor(string _name, float w, float h, float x, float y) : ofxUIWidgetWithLabel() -{ - useReference = false; - init(_name, NULL, w, h, x, y); -} - -ofxUIEnvelopeEditor::ofxUIEnvelopeEditor(string _name, ofxUIEnvelope *_envelope, float w, float h, float x, float y) :ofxUIWidgetWithLabel() -{ - useReference = true; - init(_name, _envelope, w, h, x, y); -} - -ofxUIEnvelopeEditor::~ofxUIEnvelopeEditor() -{ - if(!useReference) - { - delete envelope; - } -} - -void ofxUIEnvelopeEditor::init(string _name, ofxUIEnvelope *_envelope, float w, float h, float x, float y) -{ - initRect(x, y, w, h); - name = string(_name); - kind = OFX_UI_WIDGET_ENVELOPEEDITOR; - - draw_fill = true; - draw_outline = true; - - if(useReference) - { - envelope = _envelope; - } - else - { - envelope = new ofxUIEnvelope(); - } - - labelPrecision = 2; - label = new ofxUILabel(0,h+padding*2.0,(name+" LABEL"), (name + ":"), OFX_UI_FONT_SMALL); - addEmbeddedWidget(label); - - hitThreshold = 0.05; - pointNodeRadius = OFX_UI_GLOBAL_PADDING*1.5; - pointNodeRectWidth = OFX_UI_GLOBAL_PADDING*2.5; - pointNodeRectHeight = OFX_UI_GLOBAL_PADDING*2.5; - bHitPoint = false; - bHitCurve = false; - hitPoint = NULL; - hitCurve = NULL; - hitCurveNext = NULL; -} - -void ofxUIEnvelopeEditor::updateEnvelopeData() -{ - envelope->sortPointsByX(); - - float rX = rect->getX(); - float rY = rect->getY(); - - polyline.clear(); - - for(int i = 0; i < rect->getWidth(); i++) - { - float x = rX + i; - float nx = (double)i/rect->getWidth(); - float y = rY + envelope->getY(nx)*rect->getHeight(); - polyline.addVertex(x, y); - } -} - -void ofxUIEnvelopeEditor::drawFill() -{ - if(draw_fill) - { - ofxUIFill(); - ofxUISetColor(color_fill); - drawEnvelope(); - updateEnvelopeData(); - } -} - -void ofxUIEnvelopeEditor::setParent(ofxUIWidget *_parent) -{ - ofxUIWidgetWithLabel::setParent(_parent); -} - -void ofxUIEnvelopeEditor::mouseMoved(int x, int y) -{ - if(rect->inside(x, y)) - { - state = OFX_UI_STATE_OVER; - } - else - { - state = OFX_UI_STATE_NORMAL; - } - stateChange(); -} - -void ofxUIEnvelopeEditor::mouseDragged(int x, int y, int button) -{ - if(hit && (bHitPoint || bHitCurve)) - { - state = OFX_UI_STATE_DOWN; - ofxUIVec2f pos = rect->percentInside(x, y); - pos.x = MIN(1.0, MAX(0.0, pos.x)); - pos.y = MIN(1.0, MAX(0.0, pos.y)); - if(bHitPoint) - { - moveGrabbedPoint(pos.x, pos.y); - } - else if(bHitCurve) - { - moveGrabbedCurve(pos.x, pos.y); - } - triggerEvent(this); - } - else - { - state = OFX_UI_STATE_NORMAL; - } - stateChange(); -} - -//---------------------------------------------------- - -void ofxUIEnvelopeEditor::mousePressed(int x, int y, int button) -{ - if(rect->inside(x, y)) - { - hit = true; - state = OFX_UI_STATE_DOWN; - - ofxUIVec2f pos = rect->percentInside(x, y); - pos.x = MIN(1.0, MAX(0.0, pos.x)); - pos.y = MIN(1.0, MAX(0.0, pos.y)); - - if(button == 0) - { - checkForClosestPointNode(pos.x, pos.y); - } - else if(!bHitCurve && !hitPoint) - { - deleteClosestPointNode(pos.x, pos.y); - } - - triggerEvent(this); - } - else - { - state = OFX_UI_STATE_NORMAL; - } - stateChange(); -} - -//---------------------------------------------------- - -void ofxUIEnvelopeEditor::mouseReleased(int x, int y, int button) -{ - if(hit) - { -#ifdef TARGET_OPENGLES - state = OFX_UI_STATE_NORMAL; -#else - state = OFX_UI_STATE_OVER; -#endif - - if(bHitPoint) - { - bHitPoint = false; - hitPoint = NULL; - } - else if(bHitCurve) - { - bHitCurve = false; - hitCurve = NULL; - hitCurveNext = NULL; - } - else - { - ofxUIVec2f pos = rect->percentInside(x, y); - pos.x = MIN(1.0, MAX(0.0, pos.x)); - pos.y = MIN(1.0, MAX(0.0, pos.y)); - addEnvelopePoint(pos.x, pos.y); - triggerEvent(this); - } - } - else - { - state = OFX_UI_STATE_NORMAL; - } - stateChange(); - hit = false; -} - -void ofxUIEnvelopeEditor::stateChange() -{ - switch (state) { - case OFX_UI_STATE_NORMAL: - { - draw_fill_highlight = false; - draw_outline_highlight = false; - label->unfocus(); - } - break; - case OFX_UI_STATE_OVER: - { - draw_fill_highlight = false; - draw_outline_highlight = true; - label->unfocus(); - } - break; - case OFX_UI_STATE_DOWN: - { - draw_outline_highlight = true; - label->focus(); - } - break; - case OFX_UI_STATE_SUSTAINED: - { - draw_fill_highlight = false; - draw_outline_highlight = false; - label->unfocus(); - } - break; - - default: - break; - } -} - -bool ofxUIEnvelopeEditor::isDraggable() -{ - return true; -} - -void ofxUIEnvelopeEditor::setLabelPrecision(int _precision) -{ - labelPrecision = _precision; -} - -#ifndef OFX_UI_NO_XML - -void ofxUIEnvelopeEditor::saveState(ofxXmlSettings *XML) -{ -// XML->setValue("XValue", getScaledValue().x, 0); -// XML->setValue("YValue", getScaledValue().y, 0); -} - -void ofxUIEnvelopeEditor::loadState(ofxXmlSettings *XML) -{ -// setValue(ofxUIVec3f(XML->getValue("XValue", getScaledValue().x, 0), XML->getValue("YValue", getScaledValue().y, 0))); -} - -#endif - -void ofxUIEnvelopeEditor::addEnvelopePoint(float x, float y) -{ - envelope->addPoint(x, y); -} - -void ofxUIEnvelopeEditor::setEnvelope(ofxUIEnvelope *_envelope) -{ - if(!useReference) - { - delete envelope; - useReference = true; - } - envelope = _envelope; -} - -void ofxUIEnvelopeEditor::drawEnvelope(){ - - vector points = envelope->getPoints(); - int size = points.size(); - float rX = rect->getX(); - float rY = rect->getY(); - - ofxUISetRectMode(OFX_UI_RECTMODE_CENTER); - ofxUINoFill(); - for (int i = 0; i < size; i++) - { - float x = rX + points[i].x*rect->getWidth(); - float y = rY + points[i].y*rect->getHeight(); - - ofxUICircle(x, y, pointNodeRadius); - - if(i < size-1) - { - float nx = rX + points[i+1].x*rect->getWidth(); - float hx = (x + nx)/2.0; - ofxUIDrawRect(hx, rY + envelope->getY((hx-rX)/rect->getWidth())*rect->getHeight(), pointNodeRectWidth, pointNodeRectHeight); - } - } - ofxUIFill(); - ofxUISetRectMode(OFX_UI_RECTMODE_CORNER); - - polyline.draw(); -} - -bool ofxUIEnvelopeEditor::checkForClosestPointNode(float x, float y) -{ - vector &points = envelope->getPoints(); - int size = envelope->points.size(); - - for(int i=0; i < size; i++) - { - if(ofDist(points[i].x, points[i].y, x, y) <= hitThreshold) - { - bHitPoint = true; - hitPoint = &points[i]; - return bHitPoint; - } - - if(checkForClosestCurveNode(i, x, y)) - { - return true; - } - } -} - -bool ofxUIEnvelopeEditor::deleteClosestPointNode(float x, float y) -{ - int size = envelope->points.size(); - - for(int i=0; i < size; i++) - { - if(ofDist(envelope->points[i].x, envelope->points[i].y, x, y) <= hitThreshold) - { - envelope->points.erase(envelope->points.begin()+i); - return true; - } - } - return false; -} - - -bool ofxUIEnvelopeEditor::checkForClosestCurveNode(int i, float x, float y) -{ - int size = envelope->points.size(); - if(i < size-1) - { - float rW = rect->getWidth(); - float rH = rect->getHeight(); - - float cX = envelope->points[i].x; - float cY = envelope->points[i].y; - - float nX = envelope->points[i+1].x; - float nY = envelope->points[i+1].y; - - float hX = (cX+nX)/2.0f; - float hY = envelope->getY(hX); - - float distance = ofDist(hX, hY, x, y); - - if (distance <= hitThreshold) - { - bHitCurve = true; - hitCurve = &envelope->points[i]; - hitCurveNext = &envelope->points[i+1]; - return true; - } - } - return false; -} - -void ofxUIEnvelopeEditor::moveGrabbedPoint(float x, float y) -{ - if(hitPoint != NULL) - { - hitPoint->x = x; - hitPoint->y = y; - } -} - -void ofxUIEnvelopeEditor::moveGrabbedCurve(float x, float y) -{ - if(hitCurveNext != NULL && hitCurve != NULL) - { - float curveBasePoint = (hitCurve->y + hitCurveNext->y)/2.0f; - - if(hitCurveNext->y >= hitCurve->y) - { - hitCurve->z = ofxUIMap(y, curveBasePoint, hitCurveNext->y, 0.0f, 1.0f, true); - } - else if(hitCurveNext->y < hitCurve->y) - { - hitCurve->z = ofxUIMap(y, curveBasePoint, hitCurve->y, 0.0f, -1.0f, true); - } - } -} \ No newline at end of file diff --git a/src/ofxUIEnvelopeEditor.h b/src/ofxUIEnvelopeEditor.h deleted file mode 100644 index 933279a1e..000000000 --- a/src/ofxUIEnvelopeEditor.h +++ /dev/null @@ -1,90 +0,0 @@ -// -// ofxUIEnvelopeEditor.h -// GenMax -// -// Created by Mitchell Nordine on 28/01/2014. -// -// - -#pragma once - -#include "ofxUIWidgetWithLabel.h" -#include "ofxUIEnvelope.h" - -/* - - - NOTE: - - Hope this isn't too messy! I made this a while ago when I first started using oF! - - You'll notice I have some functions in here for handling a "frequency" - envelope - This is basically just an envelope that displays in a way that the lower - values are much more visible/accessible than the higher ones. This is done via - the functions that are right at the bottom of the file "toFrequency" and - "toOriginal". This is basically just a Cubic function and a cubed root. I find this - ridiculously helpful for working with audio, but perhaps the syntax can be changed - and the methods can be made much more efficient / cleaner? Perhaps the x in the - pow( ,x) function could be a public variable? Please let me know your thoughts, - having some kind of pow display option is definitely a feature I'd like to - keep if we can :-) - - Also, some of my "isClicked" booleans are probably unnecessary, not sure how to - reference these states on the fly from oF yet. - - - mitch. - - - */ - -class ofxUIEnvelopeEditor : public ofxUIWidgetWithLabel { - -public: - - ofxUIEnvelopeEditor(string _name, float w, float h, float x = 0, float y = 0); - ofxUIEnvelopeEditor(string _name, ofxUIEnvelope *_envelope, float w, float h, float x = 0, float y = 0); - ~ofxUIEnvelopeEditor(); - void init(string _name, ofxUIEnvelope *_envelope, float w, float h, float x = 0, float y = 0); - void setParent(ofxUIWidget *_parent); - void updateEnvelopeData(); - void drawFill(); - void mouseMoved(int x, int y); - void mouseDragged(int x, int y, int button); - void mousePressed(int x, int y, int button); - void mouseReleased(int x, int y, int button); - void stateChange(); - bool isDraggable(); - void setLabelPrecision(int _precision); -#ifndef OFX_UI_NO_XML - virtual void saveState(ofxXmlSettings *XML); - virtual void loadState(ofxXmlSettings *XML); -#endif - - void addEnvelopePoint(float x, float y); - void setEnvelope(ofxUIEnvelope *_envelope); - void drawEnvelope(); - bool checkForClosestPointNode(float x, float y); - bool deleteClosestPointNode(float x, float y); - bool checkForClosestCurveNode(int i, float x, float y); - void moveGrabbedPoint(float x, float y); - void moveGrabbedCurve(float x, float y); - -protected: - float hitThreshold; - float pointNodeRadius; - float pointNodeRectWidth; - float pointNodeRectHeight; - - ofxUIVec3f *hitPoint; - ofxUIVec3f *hitCurve; - ofxUIVec3f *hitCurveNext; - bool bHitPoint; - bool bHitCurve; - ofPolyline polyline; - ofxUIEnvelope *envelope; - int labelPrecision; - float increment; - bool useReference; -}; - - diff --git a/src/ofxUIFPS.cpp b/src/ofxUIFPS.cpp index 151163e35..4fac27e2f 100644 --- a/src/ofxUIFPS.cpp +++ b/src/ofxUIFPS.cpp @@ -62,7 +62,6 @@ void ofxUIFPS::setLabelPrecision(int _precision) { void ofxUIFPS::setParent(ofxUIWidget *_parent) { parent = _parent; - ofxUIRectangle *labelrect = label->getRect(); rect->setHeight(label->getRect()->getHeight()); rect->setWidth(label->getRect()->getWidth()); calculatePaddingRect(); diff --git a/src/ofxUIOFWrapper.h b/src/ofxUIOFWrapper.h index d8a271fd7..9a776719f 100644 --- a/src/ofxUIOFWrapper.h +++ b/src/ofxUIOFWrapper.h @@ -27,9 +27,13 @@ #include "ofMain.h" #include "ofPoint.h" +#ifndef OFX_UI_FONT_RENDERER +#define OFX_UI_FONT_RENDERER ofTrueTypeFont +#endif + typedef ofVec3f ofxUIVec3f; typedef ofVec2f ofxUIVec2f; -typedef ofTrueTypeFont ofxUIFont; +typedef OFX_UI_FONT_RENDERER ofxUIFont; typedef ofColor ofxUIColor; #if defined( TARGET_OF_IPHONE ) || defined( TARGET_OF_IOS ) || defined( TARGET_ANDROID ) diff --git a/src/ofxUIRadio.cpp b/src/ofxUIRadio.cpp index b888fdeba..6c1e21b11 100644 --- a/src/ofxUIRadio.cpp +++ b/src/ofxUIRadio.cpp @@ -178,4 +178,5 @@ string ofxUIRadio::getActiveName() { return active->getName(); } + return ""; } \ No newline at end of file diff --git a/src/ofxUITextInput.cpp b/src/ofxUITextInput.cpp index 60a191545..6fb532afe 100644 --- a/src/ofxUITextInput.cpp +++ b/src/ofxUITextInput.cpp @@ -36,9 +36,9 @@ void ofxUITextInput::init(string _name, string _textstring, float w, float h, fl initRect(x,y,w,h); name = string(_name); kind = OFX_UI_WIDGET_TEXTINPUT; - textstring = _textstring; - defaultstring = _textstring; - displaystring = _textstring; + textstring = string(_textstring); + defaultstring = string(_textstring); + displaystring = string(_textstring); clicked = false; //the widget's value autoclear = true; @@ -408,7 +408,6 @@ void ofxUITextInput::setParent(ofxUIWidget *_parent) defaultX = labelrect->getX(false); cursorWidth = label->getStringWidth("."); - while(label->getStringWidth(textstring) > rect->getWidth()-padding*2.0) { string::iterator it; diff --git a/src/ofxUIWidgets.h b/src/ofxUIWidgets.h index 7279d5f72..0fa7d56b5 100644 --- a/src/ofxUIWidgets.h +++ b/src/ofxUIWidgets.h @@ -40,7 +40,6 @@ #include "ofxUIMultiImageToggle.h" #include "ofxUIRadio.h" #include "ofxUI2DPad.h" -#include "ofxUIEnvelopeEditor.h" // Custom Envelope Editor Widget #include "ofxUI2DGraph.h" #include "ofxUITextInput.h" #include "ofxUITextArea.h"