From 71f51fd2eefb198cb1c3ec410256bf39efb4054b Mon Sep 17 00:00:00 2001 From: Christopher Baker Date: Wed, 26 Dec 2012 19:44:27 -0600 Subject: [PATCH] In progress check in. Prior to multitouch integration. --- TODO.txt | 30 + example-basic/src/main.cpp | 4 +- example-basic/src/testApp.cpp | 553 +- example-basic/src/testApp.h | 88 +- iphone-example/Project.xcconfig | 14 + iphone-example/bin/data/.gitignore | 3 + .../emptyExample.xcodeproj/project.pbxproj | 426 + .../contents.xcworkspacedata | 7 + .../UserInterfaceState.xcuserstate | 8889 +++++++++++++++++ .../xcschemes/emptyExample.xcscheme | 72 + .../xcschemes/xcschememanagement.plist | 22 + iphone-example/iPhone_Prefix.pch | 8 + iphone-example/ofxiphone-Info.plist | 36 + iphone-example/src/main.mm | 8 + iphone-example/src/testApp.h | 28 + iphone-example/src/testApp.mm | 80 + junk/ofTrueTypeFont_.cpp | 906 ++ junk/ofTrueTypeFont_.h | 120 + junk/ofxGuiColorData.cpp | 40 + junk/ofxGuiColorData.h | 27 + junk/ofxGuiData.cpp | 10 + junk/ofxGuiData.h | 25 + junk/ofxGuiDataTypes.h | 425 + junk/ofxGuiLimitedRectangle.h | 26 + junk/ofxGuiRectUtils.cpp | 674 ++ junk/ofxGuiRectUtils.h | 146 + junk/ofxGuiRectangle.cpp | 9 + junk/ofxGuiRectangle.h | 31 + junk/ofxGuiTextArea.cpp | 331 + junk/ofxGuiTextArea.h | 173 + junk/ofxGuiTextField.cpp | 331 + junk/ofxGuiTextField.h | 170 + src/defaults/ofxMuiDefaults.cpp | 300 +- src/defaults/ofxMuiDefaults.h | 33 +- src/helpers/ofxMuiFont.cpp | 1424 --- src/helpers/ofxMuiFont.h | 337 - src/{helpers => objects/base}/ofxMuiBox.cpp | 277 +- src/{helpers => objects/base}/ofxMuiBox.h | 174 +- src/objects/base/ofxMuiObject.cpp | 231 +- src/objects/base/ofxMuiObject.h | 119 +- src/objects/base/ofxMuiTrueTypeFont.cpp | 171 - src/objects/base/ofxMuiTrueTypeFont.h | 43 - src/objects/impl/ofxMuiButton.cpp | 59 +- src/objects/impl/ofxMuiButton.h | 15 +- src/objects/impl/ofxMuiPanel.cpp | 105 +- src/objects/impl/ofxMuiPanel.h | 25 +- src/objects/impl/ofxMuiWindow.cpp | 64 +- src/ofxMui.cpp | 89 +- src/ofxMui.h | 44 +- src/types/ofxMuiBoxProperties.h | 20 +- src/types/ofxMuiColor.h | 2 + src/types/ofxMuiFont.h | 11 + src/types/ofxMuiTouch.cpp | 56 + src/types/ofxMuiTouch.h | 44 + src/{types => utils}/ofxMuiDeferredDrawTask.h | 0 src/{helpers => utils}/ofxMuiEnabler.cpp | 82 +- src/{helpers => utils}/ofxMuiEnabler.h | 27 +- src/{helpers => utils}/ofxMuiKeyMapper.cpp | 0 src/{helpers => utils}/ofxMuiKeyMapper.h | 2 + src/{types => utils}/ofxMuiRange.cpp | 0 src/{types => utils}/ofxMuiRange.h | 3 + src/{helpers => utils}/ofxMuiUtils.h | 0 .../ofxMuiColorPicker.cpp} | 72 +- .../ofxMuiColorPicker.h} | 20 +- src/{objects/impl => widgets}/ofxMuiKnob.cpp | 18 +- src/{objects/impl => widgets}/ofxMuiKnob.h | 0 src/{objects/impl => widgets}/ofxMuiLabel.cpp | 16 +- src/{objects/impl => widgets}/ofxMuiLabel.h | 6 +- .../base => widgets}/ofxMuiLabelledObject.cpp | 16 +- .../base => widgets}/ofxMuiLabelledObject.h | 0 .../impl => widgets}/ofxMuiNumberBox.cpp | 8 +- .../impl => widgets}/ofxMuiNumberBox.h | 0 src/{objects/impl => widgets}/ofxMuiQuad.cpp | 0 src/{objects/impl => widgets}/ofxMuiQuad.h | 0 .../impl => widgets}/ofxMuiSlider.cpp | 52 +- src/{objects/impl => widgets}/ofxMuiSlider.h | 1 + .../base => widgets}/ofxMuiTextBlock.cpp | 10 +- .../base => widgets}/ofxMuiTextBlock.h | 16 +- src/{helpers => widgets}/ofxMuiTextUtils.h | 6 +- .../impl => widgets}/ofxMuiTooltip.cpp | 9 +- src/{objects/impl => widgets}/ofxMuiTooltip.h | 0 81 files changed, 14397 insertions(+), 3322 deletions(-) create mode 100644 TODO.txt create mode 100644 iphone-example/Project.xcconfig create mode 100644 iphone-example/bin/data/.gitignore create mode 100644 iphone-example/emptyExample.xcodeproj/project.pbxproj create mode 100644 iphone-example/emptyExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 iphone-example/emptyExample.xcodeproj/project.xcworkspace/xcuserdata/bakercp.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 iphone-example/emptyExample.xcodeproj/xcuserdata/bakercp.xcuserdatad/xcschemes/emptyExample.xcscheme create mode 100644 iphone-example/emptyExample.xcodeproj/xcuserdata/bakercp.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 iphone-example/iPhone_Prefix.pch create mode 100644 iphone-example/ofxiphone-Info.plist create mode 100644 iphone-example/src/main.mm create mode 100755 iphone-example/src/testApp.h create mode 100755 iphone-example/src/testApp.mm create mode 100644 junk/ofTrueTypeFont_.cpp create mode 100644 junk/ofTrueTypeFont_.h create mode 100644 junk/ofxGuiColorData.cpp create mode 100644 junk/ofxGuiColorData.h create mode 100644 junk/ofxGuiData.cpp create mode 100644 junk/ofxGuiData.h create mode 100644 junk/ofxGuiDataTypes.h create mode 100644 junk/ofxGuiLimitedRectangle.h create mode 100644 junk/ofxGuiRectUtils.cpp create mode 100644 junk/ofxGuiRectUtils.h create mode 100644 junk/ofxGuiRectangle.cpp create mode 100644 junk/ofxGuiRectangle.h create mode 100644 junk/ofxGuiTextArea.cpp create mode 100644 junk/ofxGuiTextArea.h create mode 100644 junk/ofxGuiTextField.cpp create mode 100644 junk/ofxGuiTextField.h delete mode 100644 src/helpers/ofxMuiFont.cpp delete mode 100644 src/helpers/ofxMuiFont.h rename src/{helpers => objects/base}/ofxMuiBox.cpp (77%) rename src/{helpers => objects/base}/ofxMuiBox.h (74%) delete mode 100644 src/objects/base/ofxMuiTrueTypeFont.cpp delete mode 100644 src/objects/base/ofxMuiTrueTypeFont.h create mode 100644 src/types/ofxMuiFont.h create mode 100644 src/types/ofxMuiTouch.cpp create mode 100644 src/types/ofxMuiTouch.h rename src/{types => utils}/ofxMuiDeferredDrawTask.h (100%) rename src/{helpers => utils}/ofxMuiEnabler.cpp (86%) rename src/{helpers => utils}/ofxMuiEnabler.h (92%) rename src/{helpers => utils}/ofxMuiKeyMapper.cpp (100%) rename src/{helpers => utils}/ofxMuiKeyMapper.h (97%) rename src/{types => utils}/ofxMuiRange.cpp (100%) rename src/{types => utils}/ofxMuiRange.h (99%) rename src/{helpers => utils}/ofxMuiUtils.h (100%) rename src/{objects/impl/ofxGuiColorPicker.cpp => widgets/ofxMuiColorPicker.cpp} (80%) rename src/{objects/impl/ofxGuiColorPicker.h => widgets/ofxMuiColorPicker.h} (85%) rename src/{objects/impl => widgets}/ofxMuiKnob.cpp (97%) rename src/{objects/impl => widgets}/ofxMuiKnob.h (100%) rename src/{objects/impl => widgets}/ofxMuiLabel.cpp (97%) rename src/{objects/impl => widgets}/ofxMuiLabel.h (96%) rename src/{objects/base => widgets}/ofxMuiLabelledObject.cpp (94%) rename src/{objects/base => widgets}/ofxMuiLabelledObject.h (100%) rename src/{objects/impl => widgets}/ofxMuiNumberBox.cpp (97%) rename src/{objects/impl => widgets}/ofxMuiNumberBox.h (100%) rename src/{objects/impl => widgets}/ofxMuiQuad.cpp (100%) rename src/{objects/impl => widgets}/ofxMuiQuad.h (100%) rename src/{objects/impl => widgets}/ofxMuiSlider.cpp (90%) rename src/{objects/impl => widgets}/ofxMuiSlider.h (99%) rename src/{objects/base => widgets}/ofxMuiTextBlock.cpp (97%) rename src/{objects/base => widgets}/ofxMuiTextBlock.h (92%) rename src/{helpers => widgets}/ofxMuiTextUtils.h (99%) rename src/{objects/impl => widgets}/ofxMuiTooltip.cpp (96%) rename src/{objects/impl => widgets}/ofxMuiTooltip.h (100%) diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..b24be03 --- /dev/null +++ b/TODO.txt @@ -0,0 +1,30 @@ +TODO + +- move everything to a resource folder in the lib ... ? +- ofPtr for over all +- FIX ALL STL::VECTOR iterations (http://stackoverflow.com/questions/409348/iteration-over-vector-in-c) +- MOVE ALL POCO NOTIFICATIONS TO DATA ABSTRACTIONS? +- Add double-click trackinng in core. + -- add dc handling to windows + -- add dc handling to sliders +- Implement mouse hiding and position setting during drag +- -- VS BETTER DRAGGING BEHAVIOR + +NAMES: + +ofxUIKit +ofxUI + +ofxGUI + +ofxNUI +ofxGuiKit +ofxUIKit +ofxGuiToolkit +ofxEZGui +ofxGTK +ofxUTK +ofxCommonGui +ofxUIKit + + diff --git a/example-basic/src/main.cpp b/example-basic/src/main.cpp index 6a32c6a..0201775 100644 --- a/example-basic/src/main.cpp +++ b/example-basic/src/main.cpp @@ -1,12 +1,10 @@ #include "ofMain.h" #include "testApp.h" -#include "ofAppGlutWindow.h" //======================================================================== int main( ){ - ofAppGlutWindow window; - ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context + ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN diff --git a/example-basic/src/testApp.cpp b/example-basic/src/testApp.cpp index 315b548..3130a95 100644 --- a/example-basic/src/testApp.cpp +++ b/example-basic/src/testApp.cpp @@ -1,574 +1,63 @@ #include "testApp.h" -//#include "gui.h" - -//#include - - //-------------------------------------------------------------- void testApp::setup(){ - //ofSetFrameRate(30); - ofSetVerticalSync(true); - - - - /*txt = "Az ZA AW wA AA TLOREM jIDd amet? CONectetur. adipiscing elit Crasporta lectus fermentum turpis bibendum in vehicula ligula pulvinar";.\nEtiam vitae lectus elit, ut aliquet dui. Sed odio eros, ultrices\nfacilisis rhoncus ac, viverra eget dolor. ";Vivamus ac erat a nisi laoreet ultricies. Donec tellus ligula,\ngravida quis laoreet non, scelerisque ac eros. Vestibulum \nelit orci, aliquet eget semper rutrum, aliquet nec arcu. Curabitur tempor iaculis ultricies. Proin vehicula mattis risus sit amet facilisis. Fusce quis pharetra elit. Nunc sodales sollicitudin consequat. Quisque a quam egestas arcu aliquet blandit sed a ligula.\nQuisAzque a sapien sed leo consequat hendrerit eget adipiscing justo. Donec id augue vitae mi dapibus congue. Suspendisse in metus a justo vestibulum ullamcorper\n vitae condimentum arcu. Sed volutpat laoreet odio eget gravida. Suspendisse quis quam quis velit vulputate dignissim. In quis purus placerat enim euismod ultrices. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas quis dolor purus, ac congue magna. Sed sit amet justo sit amet dui varius volutpat. In pellentesque interdum arcu, vel aliquet neque faucibus nec. Mauris eget tellus augue. Nam nisl quam, convallis id egestas vel, fringilla ac metus. Quisque sodales purus et velit fringilla aliquam.\nPellentesque a lorem diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam accumsan neque in mauris dignissim eu dapibus diam ultrices. Ut rhoncus, justo a ullamcorper mattis, lectus neque vestibulum nisi, non bibendum justo elit id diam. Vestibulum vel sapien mi. Donec a tortor risus. Ut est neque, molestie accumsan aliquet in, dapibus eget mi. Nam et enim mauris, vitae porttitor nulla. Aenean porttitor leo quis diam mattis at aliquam ante rutrum. Morbi quis ante neque.";*/ - - - - // txt = "Think it your unique\n designs evaluated."; -// txt = "Think it your unique\n (designs) evaluated. "; - txt = "Think it your unique \r\n(designs) evaluated. "; - - - // txt = "Think it your unique\n (designs) evaluated. "; - -// txt = "Think it your unique designs evaluated. "; - //txt += "evaluated by experts in typography ";//+ "\n"; - - //txt += "fabulous prizes, recognition and the ";//+ "\n"; - //txt += "envy of your peers! Not only that, your ";//+ "\n"; - //txt += "work will be offered for sale around ";//+ "\n"; - //txt += "the world by the best alternative type ";//+ "\n"; - //txt += "foundry going. And that would be ";//+ "\n"; - //txt += "us...GarageFonts."; - - /* - txt = "Aay&<=>AbAG$1$2%=$3$4$$$5AXBXKLMN<&CXDXEXFXGXHXXIXJXK\n"; - txt += "XLXMXN?AKLMNXOXPXQXRXSXTXU\n"; -*/ - - - ofxMuiFont::Settings settings; - - settings.fontFilename = "Calibri.ttf";//automat.ttf";//gui/default/fonts/ProggySquare.ttf"; - settings.fontSize = 30; - settings.bAntiAliased = true; - settings.bForceAutoHinting = false; - settings.bUseKerning = true; - - ttf.loadFont(settings); - - bb = ofRectangle(0,0,82 ,300); - offsets = ttf.getCharacterOffsets(txt,bb); - - /* - cout << "in here: " << endl; - for(int i = 0; i < offsets.size(); i++) { - cout << (char)offsets[i].c << " " << offsets[i].offset << endl; - } - cout << "done." << endl; - */ - - - /* - settings.bUseKerning = false; - ttf2.loadFont(settings); - - cout << "hasKerning=" << ttf.hasKerning() << endl; - cout << "Az" << ttf.getHorizontalKerning('A','z') << endl; - - cout << "hasKerning=" << ttf2.hasKerning() << endl; - cout << "Az" << ttf2.getHorizontalKerning('A','z') << endl; -*/ - - - // ttf.loadFont("verdana.ttf",96,true,true,true); -// ttf.loadFont("verdana.ttf",96,true,true,true); -// ttf.loadFont("verdana.ttf",96,true,true,true); -// ttf.loadFont("verdana.ttf",96,true,true,true); - // ttf.setLetterSpacing(3); - // ttf.setSpaceSize(100); - - // img.loadImage("tree.jpeg"); - - gui = new ofxMui(ofGetWidth(), ofGetHeight()); - - /* - tb = new ofxMuiTextBlock(&ttf); - tb->setBlockWidth(500); - - tb->setText(txt); - - tb->setLineBreakMode(LINE_BREAK_MODE_WORD); - tb->setLineTruncationMode(LINE_TRUNCATION_MODE_CLIP); - -// tb->setCapsStyle(LABEL_CAPS_TITLE_CASE); -// tb->setCapsStyle(LABEL_CAPS_TOGGLE_CASE); - */ - float xPos = 600; - float yPos = 0; - float w = 300; - float h = 50; - -// nb0 = new ofxMuiNumberBox("XXSMALL/DEFAULT",xPos,yPos); -// gui->addGuiObject(nb0); - - knob0 = new ofxMuiKnob("The KNOB", xPos,yPos); - knob0->setBounds(0,1024); - knob0->setRange(255,768); - gui->addGuiObject(knob0); - - - - - lab0 = new ofxMuiLabel("XXSMALL/DEFAULT", xPos, yPos);//, w, h); - lab0->setFontSize(SIZE_XXSMALL); - //lab0->setOrientation(OF_ORIENTATION_90_LEFT); - gui->addGuiObject(lab0); - lab1 = new ofxMuiLabel("XSMALL/DEFAULT", xPos, lab0->getBottom());//,w, h); - lab1->setFontSize(SIZE_XSMALL); - gui->addGuiObject(lab1); - lab2 = new ofxMuiLabel("SMALL/DEFAULT", xPos, lab1->getBottom());//,w, h); - lab2->setFontSize(SIZE_SMALL); - gui->addGuiObject(lab2); - lab3 = new ofxMuiLabel("MED/DEFAULT", xPos, lab2->getBottom());//,w, h); - lab3->setFontSize(SIZE_MEDIUM); - gui->addGuiObject(lab3); - lab4 = new ofxMuiLabel("LARGE/DEFAULT", xPos, lab3->getBottom());//,w, h); - lab4->setFontSize(SIZE_LARGE); - gui->addGuiObject(lab4); - lab5 = new ofxMuiLabel("XLARGE/DEFAULT", xPos, lab4->getBottom());//,w, h); - lab5->setFontSize(SIZE_XLARGE); - gui->addGuiObject(lab5); - lab6 = new ofxMuiLabel("XXLARGE/DEFAULT", xPos, lab5->getBottom());//,w, h); - lab6->setFontSize(SIZE_XXLARGE); - gui->addGuiObject(lab6); - lab6->setOrientation(OF_ORIENTATION_180); - - - lab0i = new ofxMuiLabel("LABEL 0", 250, 150); - lab0i->setFontSize(SIZE_SMALL); - lab0i->setOrientation(OF_ORIENTATION_DEFAULT); - gui->addGuiObject(lab0i); - lab1i = new ofxMuiLabel("LABEL 1", 250, 150 + 50); - lab1i->setFontSize(SIZE_MEDIUM); - lab1i->setOrientation(OF_ORIENTATION_DEFAULT); - gui->addGuiObject(lab1i); - lab2i = new ofxMuiLabel("LABEL 2", 250, 150 + 100); - lab2i->setFontSize(SIZE_LARGE); - lab2i->setOrientation(OF_ORIENTATION_DEFAULT); - gui->addGuiObject(lab2i); - - - - button = new ofxMuiButton("MY BIG ASS BUTTON", ofGetWidth() / 2, ofGetHeight() / 2); - gui->addGuiObject(button); - - - - sliderH = new ofxMuiSlider("SLIDER ONE AND A HALF",100,100);//,10,10); - //sliderH->disableLabel(); - //sliderH->setSliderHeight(10); - //sliderH->getLabel()->setFontSize(SIZE_XSMALL); - //sliderH->getValueLabel()->setFontSize(SIZE_XSMALL); - sliderH->setBoundsMin(-1); - sliderH->setBoundsMax(1); - sliderH->setRange(-.5, .8); - sliderH->setValue(0.5); - gui->addGuiObject(sliderH); - - sliderV = new ofxMuiSlider("SLIDER TWO",100,150);//,10,10); - sliderV->setOrientation(OF_ORIENTATION_90_LEFT); - sliderV->setBoundsMin(-1000); - sliderV->setBoundsMax(1000); - sliderV->setValue(0.5); - gui->addGuiObject(sliderV); - - slider0 = new ofxMuiSlider("SLIDER TWO",400,50);//,10,10); - slider0->setOrientation(OF_ORIENTATION_90_LEFT); - //slider0->setLabelPosition(ALIGN_RIGHT); - slider0->setBoundsMin(-1000); - slider0->setBoundsMax(1000); - slider0->setValue(0.5); - slider0->setRange(-900, 344); - gui->addGuiObject(slider0); - - - slider1 = new ofxMuiSlider("SLIDER TWO",400,300);//,10,10); - //slider1->setLabelPosition(ALIGN_TOP); - slider1->setBoundsMin(-1000); - slider1->setBoundsMax(1000); - slider1->setValue(0.5); - slider1->setRange(-900, 344); - gui->addGuiObject(slider1); - - - - button = new ofxMuiButton("BUTTON 0", 10, 200); - button0 = new ofxMuiButton("BUTTON 1", 10, 200+40); - button0->setButtonIcon(ICON_TARGET); - button0->setRoundFrame(true); - - button1 = new ofxMuiButton("BUTTON 2", 10, 200+80); - button1->setButtonIcon(ICON_X); - - button2 = new ofxMuiButton("BUTTON 3", 10, 200+120); - button2->setButtonIcon(ICON_PLUSMINUS); - button3 = new ofxMuiButton("BUTTON 3", 10, 200+160); - button3->setButtonIcon(ICON_CHECK); - button4 = new ofxMuiButton("BUTTON 3", 10, 200+200); - - gui->addGuiObject(button); - gui->addGuiObject(button0); - gui->addGuiObject(button1); - gui->addGuiObject(button2); - gui->addGuiObject(button3); - gui->addGuiObject(button4); - - - - // panel = gui->addWindow("TESTING PANEL", 10, 10); - - /* - panel1 = gui->addWindow("TESTING PANEL 2", 20, 20); - - - //picker = panel->addColorPicker("MCP"); - - - slider = panel->addSlider("My Slider"); - //slider->setUseHandle(true); - //slider->setHandleSize(30); - //slider->setOrientation(ORIENTATION_VERTICAL); - - slider = panel->addSlider("My Slider HORZ"); - - knob = panel->addKnob("My Knob"); - nb = panel->addNumberBox("My NumberBox"); - - //obj = new ofxMuiButton("BUTTON", 600,600); - //obj->getLabel()->setName("b_U_TTTOON"); - //gui->addGuiObject(obj); - - slider = new ofxMuiSlider("MY SLIDER", 500, 500); - slider->setSliderWidth(400); - slider->setSliderHeight(50); - //slider->setGlobalMinMax(0.0, 100.0); - //slider->setMinMax(25.0f, 89.0f); - slider->disableLabels(); - gui->addGuiObject(slider); - - */ - - setupGui(); - bkg = 0; - ofBackground(0); //35,42,43,10);//bkg); - -} - -void testApp::newButtonEvent(const void * sender, int & i){ - /* - //cout << "gout a callback ... " << endl; - - if(sender == myButton) { - cout << "go ta new button events!!!" << endl; - - } else { - cout << "got a button event, but it was from someone else ... "; - } - */ -} - - - -//-------------------------------------------------------------- -void testApp::update(){ - //tb->update(); -} -void testApp::draw(){ - - - /* - ofPushMatrix(); - - float xx = ofGetWidth() / 2.0f; - float yy = ofGetHeight() / 2.0f; - - ofTranslate(xx,yy); - - - ofFill(); - ofSetColor(255); - - if(true) { - - bb.set(0,0, mouseX - xx, mouseY - yy); - - ofFill(); - ofSetColor(255); - ttf.drawString(txt,bb); - - ofNoFill(); - ofSetColor(255,255,0); - ofRect(bb); - } else { - ttf.drawString(offsets); - - for(int i = 0; i < offsets.size(); i++) { - ofNoFill(); - ofSetColor(255,255,0); - ofCharacter vvv = offsets[i]; - if(vvv.c == ' ') { - ofRect(vvv.offset, 5,10); - } else { - ofEllipse(vvv.offset, 5,5); - } - } - - ofNoFill(); - - - ofSetColor(255,255,0); - ofRect(bb); - } - - - - */ - - - /* - ofRectangle bb = ttf.getStringBoundingBox(vv, true); - ofRectangle bb2 = ttf.getStringBoundingBox(vv, false); - - ofNoFill(); - ofSetColor(255,255,0); - ofRect(bb); - ofSetColor(0,255,0); - ofRect(bb2); - ofFill(); - ofSetColor(255); - */ - + gui = ofxSharedMui(new ofxMui()); + pad = ofxMultiTouchInput::Instance(); + int nObjects = 20; - - // for(int i = 0; i < vv.size(); i++) { - // ofFill(); - // ofSetColor(0,255,255); - // ofCharacter vvv = vv[i]; + for(int i = 0; i < nObjects; i++) { - // cout << "VVV=" << (char)vvv.c << " VV=" << (char)offsets[i].c << endl; + int rw = ofRandom(100,200); + int rh = ofRandom(100,200); + int rx = ofRandom(0,ofGetWidth()-rw); + int ry = ofRandom(0,ofGetHeight()-rh); - // ttf.drawChar(vvv.c, vvv.offset); + ofxMuiObject* obj = new ofxMuiObject(rx,ry,rw,rh); - // ofEllipse(vvv.offset, 5,5); - // } - - - - - // ofNoFill(); - // ofSetColor(255,255,0); - // ofRect(bb); - - - /* - ofTranslate(0,mouseY); - //tb->draw(0,0); - ofRectangle bb3 = ttf2.getStringBoundingBox(t, 0,0, false); - ofNoFill(); - ofSetColor(255,255,0); - ofRect(bb3); - ofFill(); - ofSetColor(255,255,0); - vector v = ttf2.drawString(t,0,0); - */ - /* - - - ofTranslate(0,200); - ofNoFill(); - ofSetColor(255,255,0); - ofRect(bb); - ttf.drawStringAsShapes(t,0,0); - - ofTranslate(0,200); - - ofNoFill(); - ofSetColor(0,255,0); - float stringWidth = ttf.singleLineWidth(t,s0,t.length()); - ofRect(0,-ttf.getSize(),stringWidth,ttf.getSize()); - ttf.drawString(t,0,0); - - // cout << stringWidth << "==" << bb.width << endl; - */ - - ofPopMatrix(); - - - - - - //img.draw(0,0); - - - /* - ofFill(); - ofSetColor(255); - //img.draw(0,0); - - //ofxMuiLabel* panelEDBValueLabel = panel->enableDisableButton->getValueLabel(); - //ofxMuiLabel* panelEDBLabel = panel->enableDisableButton->getLabel(); - - ofSetColor(0,255,0); - ofNoFill(); - //ofCircle(panelEDBValueLabel->getBoxScreenPosition(), 10); - - //panel->minMaxButton; - - ofSetColor(255,255,0); - - ofPushMatrix(); - ofTranslate(mouseX,mouseY); //zz); - -// obj->getLabel()->get - // ofRect(obj->getLabel()->getHitBox()); - - ofPopMatrix(); + obj->setIsDragMoveable(true); - ofSetColor(0,255,0); - ofFill(); - - - ofDrawBitmapString(ofToString(ofGetFrameRate()), ofGetWidth()-100, 20); - - ofSetColor(255,255,0); - - - - - if( mouseX < 100) { - ofSetColor(255,255,0); - } else { - ofSetColor(255,0,0); + gui->addGuiObject(obj); } - ofLine(100,0,100,ofGetHeight()); - - ofRect(0,300,100,100); - - string txt; - */ - /* - txt = ""; - txt += "NB >> " + nb->getName() + " : " + ofToString(nb->getHitBoxScreenPosition()) + "\n"; - txt += "NB >> VALUE_LABEL >> " + nb->getValueLabel()->getParent()->getName() + "(" + ofToString(nb->getValueLabel()->getParent()->getHitBoxScreenPosition()) + ")" + " : " + ofToString(nb->getValueLabel()->getHitBoxScreenPosition()) + "\n"; - txt += "NB >> LABEL >>" + nb->getLabel()->getParent()->getName() + " : " + ofToString(nb->getLabel()->getHitBoxScreenPosition()) + "\n"; - */ - -// txt += ""; - - //ofDrawBitmapString(txt, 100,300); - - /* - txt = ""; - txt += "SLIDER >> " + ofToString(slider->getHitBoxScreenPosition()) + "\n"; - txt += "SLIDER >> VALUE_LABEL >> " + ofToString(slider->getValueLabel()->getHitBoxScreenPosition()) + "\n"; - txt += "SLIDER >> LABEL >>" + ofToString(slider->getLabel()->getHitBoxScreenPosition()) + "\n"; - */ - - //ofDrawBitmapString(txt, 600,300); - /* - ofDrawBitmapString( picker->getDebugString(), 100,400); - ofDrawBitmapString(obj->getLabel()->getDebugString(), 100,500); - ofDrawBitmapString( obj->getDebugString(), 100,600); - - */ - - /* - ofEnableAlphaBlending(); - ofFill(); - ofSetColor(255,127); - - for(int i = 0 ; i < rects.size(); i++) { - ofRect(rects[i]); - } - - ofNoFill(); - ofSetColor(0,255,0,127); - ofRect(bb); - ofDisableAlphaBlending(); - */ - } -void testApp::printModifiers() { - - /* - //cout << "NUM KEYS PRESSED => " << endl; - cout << "CTRL=" << ofGetModifierPressed(OF_KEY_CTRL) << " "; - cout << "ALT=" << ofGetModifierPressed(OF_KEY_ALT) << " "; - cout << "SHIFT=" << ofGetModifierPressed(OF_KEY_SHIFT) << " "; - cout << endl; - */ - +//-------------------------------------------------------------- +void testApp::update(){ +} +//-------------------------------------------------------------- +void testApp::draw(){ + ofSetColor(255); } //-------------------------------------------------------------- void testApp::keyPressed(int key){ - printModifiers(); - - if(key == 'a') { - sliderH->setBounds(ofxMuiRange(-1000,1000)); - sliderH->setRange(-100,100); - } else if(key == 'b') { - sliderH->setBounds(ofxMuiRange(-1,1)); - sliderH->clearRange(); - } else if(key == 'c') { - sliderH->enableLabels(); - } else if(key == 'd') { - sliderH->disableLabel(); - } - - if(key == '-') { - s1--; - if(s1 < 0) s1 = 0; - } else if (key == '+') { - s1++; - } - } //-------------------------------------------------------------- void testApp::keyReleased(int key){ - printModifiers(); } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ - printModifiers(); } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ - printModifiers(); } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ - printModifiers(); - - /* - - ofRectangle oo = ofRectangle(x,y,ofRandom(30),ofRandom(30)); - rects.push_back(oo); - - */ - // ofxMuiBox::getBoundingBox(rects, bb); - } //-------------------------------------------------------------- void testApp::mouseReleased(int x, int y, int button){ - printModifiers(); } - //-------------------------------------------------------------- void testApp::windowResized(int w, int h){ } @@ -579,10 +68,4 @@ void testApp::dragEvent(ofDragInfo dragInfo) { //-------------------------------------------------------------- void testApp::gotMessage(ofMessage msg) { -} - - -void testApp::setupGui(){ -} - - +} \ No newline at end of file diff --git a/example-basic/src/testApp.h b/example-basic/src/testApp.h index 3daa6ec..2ee6b31 100644 --- a/example-basic/src/testApp.h +++ b/example-basic/src/testApp.h @@ -4,12 +4,7 @@ #include "ofMain.h" #include "ofxMui.h" - -#include "ofxMuiWindow.h" -#include "ofxMuiTextBlock.h" -#include "ofxMuiTrueTypeFont.h" -//#include "MyCustomControllerObject.h" -//#include "TestObject.h" +#include "ofxMultiTouchInput.h" class testApp : public ofBaseApp { @@ -19,8 +14,6 @@ class testApp : public ofBaseApp { void update(); void draw(); - void setupGui(); - void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y ); @@ -31,83 +24,8 @@ class testApp : public ofBaseApp { void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); - float bkg; - - //ofxMuiSlider* mySlider; - //ofxMuiLabelledButton* myButton; - //ofxMuiLabelledButton* myOtherButton; - - void printModifiers(); - - ofImage img; - - void newButtonEvent(const void * sender, int & i); - - ofxMui* gui; - ofxMuiButton* button; - ofxMuiButton* button0; - ofxMuiButton* button1; - ofxMuiButton* button2; - ofxMuiButton* button3; - ofxMuiButton* button4; - - //, obj; - //ofxMuiColorPicker* picker; - //ofxMuiWindow* panel; - //ofxMuiWindow* panel1; - // ofxMuiPanel* obj; - //ofxMuiLabelledButton* obj; - ofxMuiSlider* sliderH; - ofxMuiSlider* sliderV; - ofxMuiSlider* slider0; - ofxMuiSlider* slider1; - ofxMuiSlider* slider2; - ofxMuiSlider* slider3; - - - ofxMuiLabel* lab0; - ofxMuiLabel* lab1; - ofxMuiLabel* lab2; - ofxMuiLabel* lab3; - ofxMuiLabel* lab4; - ofxMuiLabel* lab5; - ofxMuiLabel* lab6; - ofxMuiLabel* lab7; - - ofxMuiLabel* lab0i; - ofxMuiLabel* lab1i; - ofxMuiLabel* lab2i; - ofxMuiLabel* lab3i; - - ofxMuiNumberBox* nb0; - ofxMuiNumberBox* nb1; - ofxMuiNumberBox* nb2; - ofxMuiNumberBox* nb3; - - - ofxMuiKnob* knob0; - //ofxMuiNumberBox* nb; - - //ofxTestObj* obj; - //MyCustomControllerObject* guiObj; - - vector rects; - vector solvedRects; - ofRectangle bb; - - - ofxMuiTextBlock* tb;; - ofxMuiTrueTypeFont ttf; - //ofxMuiTrueTypeFont ttf2; - - vector offsets; + ofxSharedMui gui; - int s0, s1; + ofxMultiTouchInput* pad; - string txt; - /* - TestObject* a1; - TestObject a2; - TestObject* a3; - */ }; diff --git a/iphone-example/Project.xcconfig b/iphone-example/Project.xcconfig new file mode 100644 index 0000000..1a590ae --- /dev/null +++ b/iphone-example/Project.xcconfig @@ -0,0 +1,14 @@ +//THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. +//THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED +OF_PATH = ../../.. + +//THIS HAS ALL THE HEADER AND LIBS FOR OF CORE +#include "../../../libs/openFrameworksCompiled/project/iphone/CoreOF.xcconfig" + +OTHER_LDFLAGS = $(OF_CORE_LIBS) +HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) + +COMPRESS_PNG_FILES = NO +GCC_THUMB_SUPPORT = NO +IPHONEOS_DEPLOYMENT_TARGET = 3.1 +TARGETED_DEVICE_FAMILY = 1 diff --git a/iphone-example/bin/data/.gitignore b/iphone-example/bin/data/.gitignore new file mode 100644 index 0000000..0a9e2b1 --- /dev/null +++ b/iphone-example/bin/data/.gitignore @@ -0,0 +1,3 @@ +# Ignore everything in here apart from the .gitignore file +* +!.gitignore \ No newline at end of file diff --git a/iphone-example/emptyExample.xcodeproj/project.pbxproj b/iphone-example/emptyExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b606c19 --- /dev/null +++ b/iphone-example/emptyExample.xcodeproj/project.pbxproj @@ -0,0 +1,426 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; + 5326AEA810A23A0500278DE6 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5326AEA710A23A0500278DE6 /* CoreLocation.framework */; }; + 53F323EB10A20EDB00E0DAE4 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53F323EA10A20EDB00E0DAE4 /* OpenAL.framework */; }; + BB16EBD20F2B2A9500518274 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB16EBD10F2B2A9500518274 /* OpenGLES.framework */; }; + BB16EBD90F2B2AB500518274 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB16EBD80F2B2AB500518274 /* QuartzCore.framework */; }; + BB24DD8F10DA77E000E9C588 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = BB24DD8C10DA77E000E9C588 /* Default.png */; }; + BB24DD9010DA77E000E9C588 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = BB24DD8D10DA77E000E9C588 /* Icon.png */; }; + BB24DDCA10DA781C00E9C588 /* ofxiphone-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB24DDC910DA781C00E9C588 /* ofxiphone-Info.plist */; }; + BBE5EAB80F49AD8400F28951 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBE5EAB70F49AD8400F28951 /* AudioToolbox.framework */; }; + E41D3ED713B38FB500A75A5D /* Project.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = E41D3ED613B38FB500A75A5D /* Project.xcconfig */; }; + E41D3EE613B3906D00A75A5D /* CoreOF.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = E41D3EE513B3906D00A75A5D /* CoreOF.xcconfig */; }; + E41D400B13B39D2100A75A5D /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41D400613B39D2100A75A5D /* AVFoundation.framework */; }; + E41D400C13B39D2100A75A5D /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41D400713B39D2100A75A5D /* CoreMedia.framework */; }; + E41D400D13B39D2100A75A5D /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41D400813B39D2100A75A5D /* CoreVideo.framework */; }; + E41D400E13B39D2100A75A5D /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41D400913B39D2100A75A5D /* MapKit.framework */; }; + E41D421413B3A95300A75A5D /* libofxiPhone_iphoneos_Debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E41D410213B3A0D800A75A5D /* libofxiPhone_iphoneos_Debug.a */; }; + E4A823A412561BE3002F86A2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4A823A312561BE3002F86A2 /* CoreGraphics.framework */; }; + E4D8936E11527B74007E1F53 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4D8936B11527B74007E1F53 /* main.mm */; }; + E4D8936F11527B74007E1F53 /* testApp.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4D8936D11527B74007E1F53 /* testApp.mm */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + E41D410113B3A0D800A75A5D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E41D40FD13B3A0D800A75A5D /* iPhone+OF Lib.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = BB24DED610DA7A3F00E9C588; + remoteInfo = "iPhone+OF Static Library"; + }; + E41D410313B3A11300A75A5D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E41D40FD13B3A0D800A75A5D /* iPhone+OF Lib.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = BB24DE5C10DA7A3F00E9C588; + remoteInfo = "iPhone+OF Static Library"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* emptyExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = emptyExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 32CA4F630368D1EE00C91783 /* iPhone_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iPhone_Prefix.pch; sourceTree = ""; }; + 5326AEA710A23A0500278DE6 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + 53F323EA10A20EDB00E0DAE4 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; + BB16EBD10F2B2A9500518274 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + BB16EBD80F2B2AB500518274 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + BB24DD8C10DA77E000E9C588 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; + BB24DD8D10DA77E000E9C588 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; + BB24DDC910DA781C00E9C588 /* ofxiphone-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ofxiphone-Info.plist"; sourceTree = ""; }; + BBE5EAB70F49AD8400F28951 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + E41D3ED613B38FB500A75A5D /* Project.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Project.xcconfig; sourceTree = ""; }; + E41D3EE513B3906D00A75A5D /* CoreOF.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CoreOF.xcconfig; path = ../../../libs/openFrameworksCompiled/project/iphone/CoreOF.xcconfig; sourceTree = SOURCE_ROOT; }; + E41D400613B39D2100A75A5D /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + E41D400713B39D2100A75A5D /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + E41D400813B39D2100A75A5D /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + E41D400913B39D2100A75A5D /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; + E41D40FD13B3A0D800A75A5D /* iPhone+OF Lib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "iPhone+OF Lib.xcodeproj"; path = "../../../libs/openFrameworksCompiled/project/iphone/iPhone+OF Lib.xcodeproj"; sourceTree = SOURCE_ROOT; }; + E4A823A312561BE3002F86A2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + E4D8936B11527B74007E1F53 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = main.mm; path = src/main.mm; sourceTree = SOURCE_ROOT; }; + E4D8936C11527B74007E1F53 /* testApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testApp.h; path = src/testApp.h; sourceTree = SOURCE_ROOT; }; + E4D8936D11527B74007E1F53 /* testApp.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = testApp.mm; path = src/testApp.mm; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E41D421413B3A95300A75A5D /* libofxiPhone_iphoneos_Debug.a in Frameworks */, + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, + BB16EBD20F2B2A9500518274 /* OpenGLES.framework in Frameworks */, + BB16EBD90F2B2AB500518274 /* QuartzCore.framework in Frameworks */, + BBE5EAB80F49AD8400F28951 /* AudioToolbox.framework in Frameworks */, + 53F323EB10A20EDB00E0DAE4 /* OpenAL.framework in Frameworks */, + 5326AEA810A23A0500278DE6 /* CoreLocation.framework in Frameworks */, + E4A823A412561BE3002F86A2 /* CoreGraphics.framework in Frameworks */, + E41D400B13B39D2100A75A5D /* AVFoundation.framework in Frameworks */, + E41D400C13B39D2100A75A5D /* CoreMedia.framework in Frameworks */, + E41D400D13B39D2100A75A5D /* CoreVideo.framework in Frameworks */, + E41D400E13B39D2100A75A5D /* MapKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* emptyExample.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + E4D8936A11527B74007E1F53 /* src */, + BB24DD8B10DA77E000E9C588 /* data */, + BB24E1F710DAA51900E9C588 /* openFrameworks */, + BB16F26B0F2B646B00518274 /* addons */, + BB16E9930F2B1E5900518274 /* libs */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* core frameworks */ = { + isa = PBXGroup; + children = ( + E41D400613B39D2100A75A5D /* AVFoundation.framework */, + E41D400713B39D2100A75A5D /* CoreMedia.framework */, + E41D400813B39D2100A75A5D /* CoreVideo.framework */, + E41D400913B39D2100A75A5D /* MapKit.framework */, + 53F323EA10A20EDB00E0DAE4 /* OpenAL.framework */, + E4A823A312561BE3002F86A2 /* CoreGraphics.framework */, + BBE5EAB70F49AD8400F28951 /* AudioToolbox.framework */, + BB16EBD80F2B2AB500518274 /* QuartzCore.framework */, + BB16EBD10F2B2A9500518274 /* OpenGLES.framework */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765FC0DF74451002DB57D /* CoreGraphics.framework */, + 5326AEA710A23A0500278DE6 /* CoreLocation.framework */, + ); + name = "core frameworks"; + sourceTree = ""; + }; + BB16E9930F2B1E5900518274 /* libs */ = { + isa = PBXGroup; + children = ( + BBE5E94E0F497BD800F28951 /* core */, + ); + name = libs; + sourceTree = ""; + }; + BB16F26B0F2B646B00518274 /* addons */ = { + isa = PBXGroup; + children = ( + ); + name = addons; + sourceTree = ""; + }; + BB24DD8B10DA77E000E9C588 /* data */ = { + isa = PBXGroup; + children = ( + BB24DD8C10DA77E000E9C588 /* Default.png */, + BB24DD8D10DA77E000E9C588 /* Icon.png */, + ); + name = data; + path = bin/data; + sourceTree = ""; + }; + BB24E1F710DAA51900E9C588 /* openFrameworks */ = { + isa = PBXGroup; + children = ( + E41D40FD13B3A0D800A75A5D /* iPhone+OF Lib.xcodeproj */, + 32CA4F630368D1EE00C91783 /* iPhone_Prefix.pch */, + BB24DDC910DA781C00E9C588 /* ofxiphone-Info.plist */, + E41D3EE513B3906D00A75A5D /* CoreOF.xcconfig */, + E41D3ED613B38FB500A75A5D /* Project.xcconfig */, + ); + name = openFrameworks; + sourceTree = ""; + }; + BBE5E94E0F497BD800F28951 /* core */ = { + isa = PBXGroup; + children = ( + 29B97323FDCFA39411CA2CEA /* core frameworks */, + ); + name = core; + sourceTree = ""; + }; + E41D40FE13B3A0D800A75A5D /* Products */ = { + isa = PBXGroup; + children = ( + E41D410213B3A0D800A75A5D /* libofxiPhone_iphoneos_Debug.a */, + ); + name = Products; + sourceTree = ""; + }; + E4D8936A11527B74007E1F53 /* src */ = { + isa = PBXGroup; + children = ( + E4D8936B11527B74007E1F53 /* main.mm */, + E4D8936D11527B74007E1F53 /* testApp.mm */, + E4D8936C11527B74007E1F53 /* testApp.h */, + ); + path = src; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* emptyExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "emptyExample" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + 9255DD331112741900D6945E /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + E41D410413B3A11300A75A5D /* PBXTargetDependency */, + ); + name = emptyExample; + productName = iPhone; + productReference = 1D6058910D05DD3D006BFB54 /* emptyExample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "emptyExample" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = E41D40FE13B3A0D800A75A5D /* Products */; + ProjectRef = E41D40FD13B3A0D800A75A5D /* iPhone+OF Lib.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* emptyExample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + E41D410213B3A0D800A75A5D /* libofxiPhone_iphoneos_Debug.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libofxiPhone_iphoneos_Debug.a; + remoteRef = E41D410113B3A0D800A75A5D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BB24DD8F10DA77E000E9C588 /* Default.png in Resources */, + BB24DD9010DA77E000E9C588 /* Icon.png in Resources */, + BB24DDCA10DA781C00E9C588 /* ofxiphone-Info.plist in Resources */, + E41D3ED713B38FB500A75A5D /* Project.xcconfig in Resources */, + E41D3EE613B3906D00A75A5D /* CoreOF.xcconfig in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 9255DD331112741900D6945E /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cp -rf bin/data/ \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app\""; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E4D8936E11527B74007E1F53 /* main.mm in Sources */, + E4D8936F11527B74007E1F53 /* testApp.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + E41D410413B3A11300A75A5D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "iPhone+OF Static Library"; + targetProxy = E41D410313B3A11300A75A5D /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = iPhone_Prefix.pch; + INFOPLIST_FILE = "ofxiphone-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.6; + PRODUCT_NAME = "${TARGET_NAME}"; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = iPhone_Prefix.pch; + INFOPLIST_FILE = "ofxiphone-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.6; + PRODUCT_NAME = "${TARGET_NAME}"; + SDKROOT = iphoneos; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E41D3ED613B38FB500A75A5D /* Project.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COMPRESS_PNG_FILES = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; + GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO; + GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO; + GCC_WARN_PROTOTYPE_CONVERSION = NO; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + MACOSX_DEPLOYMENT_TARGET = 10.5; + ONLY_ACTIVE_ARCH = NO; + PREBINDING = NO; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; + SDKROOT = iphoneos4.1; + TARGETED_DEVICE_FAMILY = 1; + WARNING_LDFLAGS = "-no_arch_warnings"; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E41D3ED613B38FB500A75A5D /* Project.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COMPRESS_PNG_FILES = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_THUMB_SUPPORT = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + MACOSX_DEPLOYMENT_TARGET = 10.5; + ONLY_ACTIVE_ARCH = NO; + PREBINDING = NO; + SDKROOT = iphoneos4.1; + TARGETED_DEVICE_FAMILY = 1; + WARNING_LDFLAGS = "-no_arch_warnings"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "emptyExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "emptyExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/iphone-example/emptyExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iphone-example/emptyExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..da00dc2 --- /dev/null +++ b/iphone-example/emptyExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/iphone-example/emptyExample.xcodeproj/project.xcworkspace/xcuserdata/bakercp.xcuserdatad/UserInterfaceState.xcuserstate b/iphone-example/emptyExample.xcodeproj/project.xcworkspace/xcuserdata/bakercp.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..c75a98a --- /dev/null +++ b/iphone-example/emptyExample.xcodeproj/project.xcworkspace/xcuserdata/bakercp.xcuserdatad/UserInterfaceState.xcuserstate @@ -0,0 +1,8889 @@ + + + + + $archiver + NSKeyedArchiver + $objects + + $null + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 2 + + + CF$UID + 3 + + + NS.objects + + + CF$UID + 4 + + + CF$UID + 435 + + + + EAA640EE-01C7-49C7-8503-747C5EE5F460 + IDEWorkspaceDocument + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 5 + + + CF$UID + 6 + + + CF$UID + 7 + + + CF$UID + 8 + + + CF$UID + 9 + + + CF$UID + 10 + + + CF$UID + 11 + + + CF$UID + 12 + + + NS.objects + + + CF$UID + 13 + + + CF$UID + 14 + + + CF$UID + 15 + + + CF$UID + 17 + + + CF$UID + 2 + + + CF$UID + 11 + + + CF$UID + 18 + + + CF$UID + 17 + + + + IDEWindowToolbarIsVisible + IDEWindowFrame + IDEOrderedWorkspaceTabControllers + IDEWindowInFullscreenMode + IDEWorkspaceWindowControllerUniqueIdentifier + IDEActiveWorkspaceTabController + IDEWorkspaceTabController_F569B76B-1B4C-418F-8651-39C827DD2471 + IDEWindowTabBarIsVisible + + {{40, 4}, {1400, 874}} + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 11 + + + + + $classes + + NSArray + NSObject + + $classname + NSArray + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 19 + + + CF$UID + 20 + + + CF$UID + 21 + + + CF$UID + 22 + + + CF$UID + 23 + + + CF$UID + 24 + + + CF$UID + 25 + + + CF$UID + 26 + + + NS.objects + + + CF$UID + 27 + + + CF$UID + 13 + + + CF$UID + 28 + + + CF$UID + 385 + + + CF$UID + 391 + + + CF$UID + 426 + + + CF$UID + 17 + + + CF$UID + 329 + + + + IDETabLabel + IDEShowNavigator + IDEEditorArea + IDEWorkspaceTabControllerUtilityAreaSplitView + IDENavigatorArea + IDEWorkspaceTabControllerDesignAreaSplitView + IDEShowUtilities + AssistantEditorsLayout + emptyExample.xcodeproj + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 29 + + + CF$UID + 30 + + + CF$UID + 31 + + + CF$UID + 32 + + + CF$UID + 33 + + + CF$UID + 34 + + + CF$UID + 35 + + + CF$UID + 36 + + + NS.objects + + + CF$UID + 13 + + + CF$UID + 37 + + + CF$UID + 340 + + + CF$UID + 13 + + + CF$UID + 329 + + + CF$UID + 365 + + + CF$UID + 373 + + + CF$UID + 374 + + + + ShowDebuggerArea + IDEEditorMode_Standard + IDEEDitorArea_DebugArea + IDEShowEditor + EditorMode + DebuggerSplitView + DefaultPersistentRepresentations + layoutTree + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 38 + + + NS.objects + + + CF$UID + 39 + + + + EditorLayout_PersistentRepresentation + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 40 + + + NS.objects + + + CF$UID + 41 + + + + Main + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 42 + + + CF$UID + 43 + + + CF$UID + 44 + + + NS.objects + + + CF$UID + 45 + + + CF$UID + 329 + + + CF$UID + 338 + + + + EditorLayout_StateSavingStateDictionaries + EditorLayout_Selected + EditorLayout_Geometry + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 46 + + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 47 + + + CF$UID + 48 + + + CF$UID + 49 + + + CF$UID + 50 + + + CF$UID + 51 + + + CF$UID + 52 + + + CF$UID + 53 + + + NS.objects + + + CF$UID + 54 + + + CF$UID + 55 + + + CF$UID + 67 + + + CF$UID + 333 + + + CF$UID + 333 + + + CF$UID + 334 + + + CF$UID + 335 + + + + FileDataType + ArchivableRepresentation + EditorState + NavigableItemName + DocumentNavigableItemName + DocumentExtensionIdentifier + DocumentURL + com.apple.xcode.project + + $class + + CF$UID + 66 + + DocumentLocation + + CF$UID + 62 + + DomainIdentifier + + CF$UID + 56 + + IdentifierPath + + CF$UID + 57 + + IndexOfDocumentIdentifier + + CF$UID + 61 + + + Xcode.IDENavigableItemDomain.WorkspaceStructure + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 58 + + + + + $class + + CF$UID + 60 + + Identifier + + CF$UID + 59 + + + emptyExample + + $classes + + IDEArchivableStringIndexPair + NSObject + + $classname + IDEArchivableStringIndexPair + + 9223372036854775807 + + $class + + CF$UID + 65 + + documentURL + + CF$UID + 63 + + timestamp + + CF$UID + 0 + + + + $class + + CF$UID + 64 + + NS.string + file://localhost/Users/bakercp/Desktop/myOf/openFrameworks/_MYAPPS/ofxGui/iphone-example/emptyExample.xcodeproj/ + + + $classes + + NSMutableString + NSString + NSObject + + $classname + NSMutableString + + + $classes + + DVTDocumentLocation + NSObject + + $classname + DVTDocumentLocation + + + $classes + + IDENavigableItemArchivableRepresentation + NSObject + + $classname + IDENavigableItemArchivableRepresentation + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 68 + + + CF$UID + 69 + + + CF$UID + 70 + + + CF$UID + 71 + + + NS.objects + + + CF$UID + 72 + + + CF$UID + 85 + + + CF$UID + 86 + + + CF$UID + 332 + + + + Xcode3ProjectEditor.sourceList.splitview + Xcode3ProjectEditorPreviousTargetEditorClass + Xcode3ProjectEditorSelectedDocumentLocations + Xcode3ProjectEditor_Xcode3BuildSettingsEditor + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 73 + + + NS.objects + + + CF$UID + 74 + + + + DVTSplitViewItems + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 75 + + + CF$UID + 81 + + + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 78 + + + CF$UID + 79 + + + + DVTIdentifier + DVTViewMagnitude + + 170 + + $classes + + NSDictionary + NSObject + + $classname + NSDictionary + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 78 + + + CF$UID + 82 + + + + 970 + + $classes + + NSMutableArray + NSArray + NSObject + + $classname + NSMutableArray + + + $classes + + NSMutableDictionary + NSDictionary + NSObject + + $classname + NSMutableDictionary + + Xcode3BuildSettingsEditor + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 87 + + + + + $class + + CF$UID + 331 + + documentURL + + CF$UID + 88 + + selection + + CF$UID + 90 + + timestamp + + CF$UID + 89 + + + file://localhost/Users/bakercp/Desktop/myOf/openFrameworks/_MYAPPS/ofxGui/iphone-example/emptyExample.xcodeproj/ + 333161550.93976998 + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 91 + + + CF$UID + 92 + + + CF$UID + 93 + + + NS.objects + + + CF$UID + 94 + + + CF$UID + 95 + + + CF$UID + 96 + + + + Editor + Target + Xcode3BuildSettingsEditorLocations + Xcode3BuildSettingsEditor + emptyExample + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 97 + + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 98 + + + CF$UID + 99 + + + CF$UID + 100 + + + CF$UID + 101 + + + CF$UID + 102 + + + CF$UID + 103 + + + NS.objects + + + CF$UID + 104 + + + CF$UID + 327 + + + CF$UID + 329 + + + CF$UID + 329 + + + CF$UID + 329 + + + CF$UID + 330 + + + + Collapsed Build Property Categories + Selected Build Properties + Xcode3BuildSettingsEditorDisplayMode + Xcode3BuildPropertyValueDisplayMode + Xcode3BuildSettingsEditorMode + Xcode3BuildPropertyNameDisplayMode + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 105 + + + CF$UID + 106 + + + CF$UID + 107 + + + CF$UID + 108 + + + CF$UID + 109 + + + CF$UID + 110 + + + CF$UID + 111 + + + CF$UID + 112 + + + CF$UID + 113 + + + CF$UID + 114 + + + CF$UID + 115 + + + CF$UID + 116 + + + CF$UID + 117 + + + CF$UID + 118 + + + CF$UID + 119 + + + CF$UID + 120 + + + CF$UID + 121 + + + CF$UID + 122 + + + CF$UID + 123 + + + CF$UID + 124 + + + CF$UID + 125 + + + CF$UID + 126 + + + CF$UID + 127 + + + CF$UID + 128 + + + CF$UID + 129 + + + CF$UID + 130 + + + CF$UID + 131 + + + CF$UID + 132 + + + CF$UID + 133 + + + CF$UID + 134 + + + CF$UID + 135 + + + CF$UID + 136 + + + CF$UID + 137 + + + CF$UID + 138 + + + CF$UID + 139 + + + CF$UID + 140 + + + CF$UID + 141 + + + CF$UID + 142 + + + CF$UID + 143 + + + CF$UID + 144 + + + CF$UID + 145 + + + CF$UID + 146 + + + CF$UID + 147 + + + CF$UID + 148 + + + CF$UID + 149 + + + CF$UID + 150 + + + CF$UID + 151 + + + CF$UID + 152 + + + CF$UID + 153 + + + CF$UID + 154 + + + CF$UID + 155 + + + CF$UID + 156 + + + CF$UID + 157 + + + CF$UID + 158 + + + CF$UID + 159 + + + CF$UID + 160 + + + CF$UID + 161 + + + CF$UID + 162 + + + CF$UID + 163 + + + CF$UID + 164 + + + CF$UID + 165 + + + CF$UID + 166 + + + CF$UID + 167 + + + CF$UID + 168 + + + CF$UID + 169 + + + CF$UID + 170 + + + CF$UID + 171 + + + CF$UID + 172 + + + CF$UID + 173 + + + CF$UID + 174 + + + CF$UID + 175 + + + CF$UID + 176 + + + CF$UID + 177 + + + CF$UID + 178 + + + CF$UID + 179 + + + CF$UID + 180 + + + CF$UID + 181 + + + CF$UID + 182 + + + CF$UID + 183 + + + CF$UID + 184 + + + CF$UID + 185 + + + CF$UID + 186 + + + CF$UID + 187 + + + CF$UID + 188 + + + CF$UID + 189 + + + CF$UID + 190 + + + CF$UID + 191 + + + CF$UID + 192 + + + CF$UID + 193 + + + CF$UID + 194 + + + CF$UID + 195 + + + CF$UID + 196 + + + CF$UID + 197 + + + CF$UID + 198 + + + CF$UID + 199 + + + CF$UID + 200 + + + CF$UID + 201 + + + CF$UID + 202 + + + CF$UID + 203 + + + CF$UID + 204 + + + CF$UID + 205 + + + CF$UID + 206 + + + CF$UID + 207 + + + CF$UID + 208 + + + CF$UID + 209 + + + CF$UID + 210 + + + CF$UID + 211 + + + CF$UID + 212 + + + CF$UID + 213 + + + CF$UID + 214 + + + CF$UID + 215 + + + CF$UID + 216 + + + CF$UID + 217 + + + CF$UID + 218 + + + CF$UID + 219 + + + CF$UID + 220 + + + CF$UID + 221 + + + CF$UID + 222 + + + CF$UID + 223 + + + CF$UID + 224 + + + CF$UID + 225 + + + CF$UID + 226 + + + CF$UID + 227 + + + CF$UID + 228 + + + CF$UID + 229 + + + CF$UID + 230 + + + CF$UID + 231 + + + CF$UID + 232 + + + CF$UID + 233 + + + CF$UID + 234 + + + CF$UID + 235 + + + CF$UID + 236 + + + CF$UID + 237 + + + CF$UID + 238 + + + CF$UID + 239 + + + CF$UID + 240 + + + CF$UID + 241 + + + CF$UID + 242 + + + CF$UID + 243 + + + CF$UID + 244 + + + CF$UID + 245 + + + CF$UID + 246 + + + CF$UID + 247 + + + CF$UID + 248 + + + CF$UID + 249 + + + CF$UID + 250 + + + CF$UID + 251 + + + CF$UID + 252 + + + CF$UID + 253 + + + CF$UID + 254 + + + CF$UID + 255 + + + CF$UID + 256 + + + CF$UID + 257 + + + CF$UID + 258 + + + CF$UID + 259 + + + CF$UID + 260 + + + CF$UID + 261 + + + CF$UID + 262 + + + CF$UID + 263 + + + CF$UID + 264 + + + CF$UID + 265 + + + CF$UID + 266 + + + CF$UID + 267 + + + CF$UID + 268 + + + CF$UID + 269 + + + CF$UID + 270 + + + CF$UID + 271 + + + CF$UID + 272 + + + CF$UID + 273 + + + CF$UID + 274 + + + CF$UID + 275 + + + CF$UID + 276 + + + CF$UID + 277 + + + CF$UID + 278 + + + CF$UID + 279 + + + CF$UID + 280 + + + CF$UID + 281 + + + CF$UID + 282 + + + CF$UID + 283 + + + CF$UID + 284 + + + CF$UID + 285 + + + CF$UID + 286 + + + CF$UID + 287 + + + CF$UID + 288 + + + CF$UID + 289 + + + CF$UID + 290 + + + CF$UID + 291 + + + CF$UID + 292 + + + CF$UID + 293 + + + CF$UID + 294 + + + CF$UID + 295 + + + CF$UID + 296 + + + CF$UID + 297 + + + CF$UID + 298 + + + CF$UID + 299 + + + CF$UID + 300 + + + CF$UID + 301 + + + CF$UID + 302 + + + CF$UID + 303 + + + CF$UID + 304 + + + CF$UID + 305 + + + CF$UID + 306 + + + CF$UID + 307 + + + CF$UID + 308 + + + CF$UID + 309 + + + CF$UID + 310 + + + CF$UID + 311 + + + CF$UID + 312 + + + CF$UID + 313 + + + CF$UID + 314 + + + CF$UID + 315 + + + CF$UID + 316 + + + CF$UID + 317 + + + CF$UID + 318 + + + CF$UID + 319 + + + CF$UID + 320 + + + CF$UID + 321 + + + CF$UID + 322 + + + CF$UID + 323 + + + CF$UID + 324 + + + CF$UID + 325 + + + CF$UID + 326 + + + + + $class + + CF$UID + 64 + + NS.string + Architectures||ADDITIONAL_SDKS + + + $class + + CF$UID + 64 + + NS.string + Architectures||ARCHS + + + $class + + CF$UID + 64 + + NS.string + Architectures||SDKROOT + + + $class + + CF$UID + 64 + + NS.string + Architectures||ONLY_ACTIVE_ARCH + + + $class + + CF$UID + 64 + + NS.string + Architectures||SUPPORTED_PLATFORMS + + + $class + + CF$UID + 64 + + NS.string + Architectures||VALID_ARCHS + + + $class + + CF$UID + 64 + + NS.string + Build Locations||SYMROOT + + + $class + + CF$UID + 64 + + NS.string + Build Locations||OBJROOT + + + $class + + CF$UID + 64 + + NS.string + Build Locations||SHARED_PRECOMPS_DIR + + + $class + + CF$UID + 64 + + NS.string + Build Options||BUILD_VARIANTS + + + $class + + CF$UID + 64 + + NS.string + Build Options||GCC_VERSION + + + $class + + CF$UID + 64 + + NS.string + Build Options||DEBUG_INFORMATION_FORMAT + + + $class + + CF$UID + 64 + + NS.string + Build Options||ENABLE_OPENMP_SUPPORT + + + $class + + CF$UID + 64 + + NS.string + Build Options||GENERATE_PROFILING_CODE + + + $class + + CF$UID + 64 + + NS.string + Build Options||PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR + + + $class + + CF$UID + 64 + + NS.string + Build Options||RUN_CLANG_STATIC_ANALYZER + + + $class + + CF$UID + 64 + + NS.string + Build Options||SCAN_ALL_SOURCE_FILES_FOR_INCLUDES + + + $class + + CF$UID + 64 + + NS.string + Build Options||VALIDATE_PRODUCT + + + $class + + CF$UID + 64 + + NS.string + Code Signing||CODE_SIGN_ENTITLEMENTS + + + $class + + CF$UID + 64 + + NS.string + Code Signing||CODE_SIGN_RESOURCE_RULES_PATH + + + $class + + CF$UID + 64 + + NS.string + Code Signing||OTHER_CODE_SIGN_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Deployment||STRIPFLAGS + + + $class + + CF$UID + 64 + + NS.string + Deployment||ALTERNATE_GROUP + + + $class + + CF$UID + 64 + + NS.string + Deployment||ALTERNATE_OWNER + + + $class + + CF$UID + 64 + + NS.string + Deployment||ALTERNATE_MODE + + + $class + + CF$UID + 64 + + NS.string + Deployment||ALTERNATE_PERMISSIONS_FILES + + + $class + + CF$UID + 64 + + NS.string + Deployment||COMBINE_HIDPI_IMAGES + + + $class + + CF$UID + 64 + + NS.string + Deployment||DEPLOYMENT_LOCATION + + + $class + + CF$UID + 64 + + NS.string + Deployment||DEPLOYMENT_POSTPROCESSING + + + $class + + CF$UID + 64 + + NS.string + Deployment||INSTALL_GROUP + + + $class + + CF$UID + 64 + + NS.string + Deployment||INSTALL_OWNER + + + $class + + CF$UID + 64 + + NS.string + Deployment||INSTALL_MODE_FLAG + + + $class + + CF$UID + 64 + + NS.string + Deployment||DSTROOT + + + $class + + CF$UID + 64 + + NS.string + Deployment||INSTALL_PATH + + + $class + + CF$UID + 64 + + NS.string + Deployment||MACOSX_DEPLOYMENT_TARGET + + + $class + + CF$UID + 64 + + NS.string + Deployment||SKIP_INSTALL + + + $class + + CF$UID + 64 + + NS.string + Deployment||COPY_PHASE_STRIP + + + $class + + CF$UID + 64 + + NS.string + Deployment||STRIP_INSTALLED_PRODUCT + + + $class + + CF$UID + 64 + + NS.string + Deployment||STRIP_STYLE + + + $class + + CF$UID + 64 + + NS.string + Deployment||TARGETED_DEVICE_FAMILY + + + $class + + CF$UID + 64 + + NS.string + Deployment||SEPARATE_STRIP + + + $class + + CF$UID + 64 + + NS.string + Deployment||IPHONEOS_DEPLOYMENT_TARGET + + + $class + + CF$UID + 64 + + NS.string + Kernel Module||MODULE_NAME + + + $class + + CF$UID + 64 + + NS.string + Kernel Module||MODULE_START + + + $class + + CF$UID + 64 + + NS.string + Kernel Module||MODULE_STOP + + + $class + + CF$UID + 64 + + NS.string + Kernel Module||MODULE_VERSION + + + $class + + CF$UID + 64 + + NS.string + Linking||BUNDLE_LOADER + + + $class + + CF$UID + 64 + + NS.string + Linking||DYLIB_COMPATIBILITY_VERSION + + + $class + + CF$UID + 64 + + NS.string + Linking||DYLIB_CURRENT_VERSION + + + $class + + CF$UID + 64 + + NS.string + Linking||DEAD_CODE_STRIPPING + + + $class + + CF$UID + 64 + + NS.string + Linking||LINKER_DISPLAYS_MANGLED_NAMES + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_NO_PIE + + + $class + + CF$UID + 64 + + NS.string + Linking||PRESERVE_DEAD_CODE_INITS_AND_TERMS + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_DYLIB_INSTALL_NAME + + + $class + + CF$UID + 64 + + NS.string + Linking||EXPORTED_SYMBOLS_FILE + + + $class + + CF$UID + 64 + + NS.string + Linking||INIT_ROUTINE + + + $class + + CF$UID + 64 + + NS.string + Linking||LINK_WITH_STANDARD_LIBRARIES + + + $class + + CF$UID + 64 + + NS.string + Linking||MACH_O_TYPE + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_OPENMP_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||ORDER_FILE + + + $class + + CF$UID + 64 + + NS.string + Linking||OTHER_LDFLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||GENERATE_MASTER_OBJECT_FILE + + + $class + + CF$UID + 64 + + NS.string + Linking||PRELINK_LIBS + + + $class + + CF$UID + 64 + + NS.string + Linking||KEEP_PRIVATE_EXTERNS + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_RUNPATH_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Linking||SEPARATE_SYMBOL_EDIT + + + $class + + CF$UID + 64 + + NS.string + Linking||PRELINK_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||SECTORDER_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||UNEXPORTED_SYMBOLS_FILE + + + $class + + CF$UID + 64 + + NS.string + Linking||WARNING_LDFLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_GENERATE_MAP_FILE + + + $class + + CF$UID + 64 + + NS.string + Packaging||COMPRESS_PNG_FILES + + + $class + + CF$UID + 64 + + NS.string + Packaging||APPLY_RULES_IN_COPY_FILES + + + $class + + CF$UID + 64 + + NS.string + Packaging||EXECUTABLE_EXTENSION + + + $class + + CF$UID + 64 + + NS.string + Packaging||EXECUTABLE_PREFIX + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_EXPAND_BUILD_SETTINGS + + + $class + + CF$UID + 64 + + NS.string + Packaging||GENERATE_PKGINFO_FILE + + + $class + + CF$UID + 64 + + NS.string + Packaging||FRAMEWORK_VERSION + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_FILE + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_OTHER_PREPROCESSOR_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_OUTPUT_FORMAT + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_PREPROCESSOR_DEFINITIONS + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_PREFIX_HEADER + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_PREPROCESS + + + $class + + CF$UID + 64 + + NS.string + Packaging||COPYING_PRESERVES_HFS_DATA + + + $class + + CF$UID + 64 + + NS.string + Packaging||PRIVATE_HEADERS_FOLDER_PATH + + + $class + + CF$UID + 64 + + NS.string + Packaging||PRODUCT_NAME + + + $class + + CF$UID + 64 + + NS.string + Packaging||PLIST_FILE_OUTPUT_FORMAT + + + $class + + CF$UID + 64 + + NS.string + Packaging||PUBLIC_HEADERS_FOLDER_PATH + + + $class + + CF$UID + 64 + + NS.string + Packaging||STRINGS_FILE_OUTPUT_ENCODING + + + $class + + CF$UID + 64 + + NS.string + Packaging||WRAPPER_EXTENSION + + + $class + + CF$UID + 64 + + NS.string + Search Paths||FRAMEWORK_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Search Paths||HEADER_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Search Paths||LIBRARY_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Search Paths||REZ_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Search Paths||EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES + + + $class + + CF$UID + 64 + + NS.string + Search Paths||INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES + + + $class + + CF$UID + 64 + + NS.string + Search Paths||USER_HEADER_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Unit Testing||OTHER_TEST_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Unit Testing||TEST_AFTER_BUILD + + + $class + + CF$UID + 64 + + NS.string + Unit Testing||TEST_HOST + + + $class + + CF$UID + 64 + + NS.string + Unit Testing||TEST_RIG + + + $class + + CF$UID + 64 + + NS.string + Versioning||CURRENT_PROJECT_VERSION + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_FILE + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_EXPORT_DECL + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_PREFIX + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_SUFFIX + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSIONING_SYSTEM + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_BUILDER + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_FAST_OBJC_DISPATCH + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_OBJC_CALL_CXX_CDTORS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_THUMB_SUPPORT + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SSE3_EXTENSIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SSE41_EXTENSIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SSE42_EXTENSIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_STRICT_ALIASING + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_FEEDBACK_DIRECTED_OPTIMIZATION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_GENERATE_TEST_COVERAGE_FILES + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_INLINES_ARE_PRIVATE_EXTERN + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_INSTRUMENT_PROGRAM_FLOW_ARCS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_KERNEL_DEVELOPMENT + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_DEBUGGING_SYMBOLS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_REUSE_STRINGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_NO_COMMON_BLOCKS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_OBJC_GC + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_FAST_MATH + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SYMBOL_SEPARATION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_THREADSAFE_STATICS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_SYMBOLS_PRIVATE_EXTERN + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_UNROLL_LOOPS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_CHAR_IS_UNSIGNED_CHAR + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_ASM_KEYWORD + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_C_LANGUAGE_STANDARD + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_CHECK_RETURN_VALUE_OF_OPERATOR_NEW + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_INPUT_FILETYPE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_CPP_EXCEPTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_CPP_RTTI + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_LINK_WITH_DYNAMIC_LIBRARIES + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_OBJC_EXCEPTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_TRIGRAPHS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_FLOATING_POINT_LIBRARY_CALLS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_USE_INDIRECT_FUNCTION_CALLS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_USE_REGISTER_FUNCTION_CALLS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_INCREASE_PRECOMPILED_HEADER_SHARING + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_CW_ASM_SYNTAX + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||OTHER_CFLAGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||OTHER_CPLUSPLUSFLAGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_PRECOMPILE_PREFIX_HEADER + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_PREFIX_HEADER + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_BUILTIN_FUNCTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_PASCAL_STRINGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_FORCE_CPU_SUBTYPE_ALL + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_SHORT_ENUMS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_USE_STANDARD_INCLUDE_SEARCHING + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Preprocessing||GCC_PREPROCESSOR_DEFINITIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Preprocessing||GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_CHECK_SWITCH_STATEMENTS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_FOUR_CHARACTER_CONSTANTS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_SHADOW + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_64_TO_32_BIT_CONVERSION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_INHIBIT_ALL_WARNINGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_ABOUT_RETURN_TYPE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_MISSING_PARENTHESES + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_ABOUT_MISSING_PROTOTYPES + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_ABOUT_MISSING_NEWLINE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_NON_VIRTUAL_DESTRUCTOR + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||WARNING_CFLAGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_PEDANTIC + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_PROTOTYPE_CONVERSION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_SIGN_COMPARE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_STRICT_SELECTOR_MATCH + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_TREAT_WARNINGS_AS_ERRORS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_TYPECHECK_CALLS_TO_PRINTF + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNDECLARED_SELECTOR + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNINITIALIZED_AUTOS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNKNOWN_PRAGMAS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_FUNCTION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_LABEL + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_PARAMETER + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_VALUE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_VARIABLE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_CAIRO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_FMODEX + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_FREEIMAGE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_FREETYPE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_FREETYPE2 + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_GLEW + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_GLU + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_OF + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_OFXACCELEROMETER + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_OFXIPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_OFXMULTITOUCH + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_POCO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_RTAUDIO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_TESS2 + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_CAIRO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_FREEIMAGE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_FREEIMAGE_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_FREETYPE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_GLEW + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_GLU + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_GLU_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_POCOFOUNDATION_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_POCONET_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_POCOUTIL_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_POCOXML_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_RTAUDIO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_TESS + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_TESS_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||MISC_FLAGS + + + $class + + CF$UID + 64 + + NS.string + User-Defined||OF_CORE_HEADERS + + + $class + + CF$UID + 64 + + NS.string + User-Defined||OF_CORE_LIBS + + + $class + + CF$UID + 64 + + NS.string + User-Defined||OF_PATH + + + $class + + CF$UID + 64 + + NS.string + User-Defined||PREBINDING + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 328 + + + + + $class + + CF$UID + 64 + + NS.string + Deployment||MACOSX_DEPLOYMENT_TARGET + + 0 + 1 + + $classes + + Xcode3ProjectDocumentLocation + DVTDocumentLocation + NSObject + + $classname + Xcode3ProjectDocumentLocation + + + $class + + CF$UID + 84 + + NS.keys + + NS.objects + + + emptyExample + Xcode.Xcode3ProjectSupport.EditorDocument.Xcode3Project + + $class + + CF$UID + 337 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 336 + + + file://localhost/Users/bakercp/Desktop/myOf/openFrameworks/_MYAPPS/ofxGui/iphone-example/emptyExample.xcodeproj/ + + $classes + + NSURL + NSObject + + $classname + NSURL + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 339 + + + + {{0, 0}, {1140, 661}} + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 341 + + + CF$UID + 342 + + + CF$UID + 343 + + + CF$UID + 344 + + + CF$UID + 345 + + + CF$UID + 346 + + + NS.objects + + + CF$UID + 330 + + + CF$UID + 347 + + + CF$UID + 349 + + + CF$UID + 330 + + + CF$UID + 357 + + + CF$UID + 363 + + + + LayoutFocusMode + console + IDEDebuggerAreaSplitView + LayoutMode + IDEDebugArea_SplitView + variables + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 348 + + + NS.objects + + + CF$UID + 329 + + + + ConsoleFilterMode + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 73 + + + NS.objects + + + CF$UID + 350 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 351 + + + CF$UID + 354 + + + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 352 + + + CF$UID + 353 + + + + VariablesView + 570 + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 355 + + + CF$UID + 356 + + + + ConsoleArea + 569 + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 73 + + + NS.objects + + + CF$UID + 358 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 359 + + + CF$UID + 361 + + + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 352 + + + CF$UID + 360 + + + + 570 + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 355 + + + CF$UID + 362 + + + + 569 + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 364 + + + NS.objects + + + CF$UID + 330 + + + + VariablesViewSelectedScope + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 73 + + + NS.objects + + + CF$UID + 366 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 367 + + + CF$UID + 370 + + + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 368 + + + CF$UID + 369 + + + + IDEEditor + 683 + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 371 + + + CF$UID + 372 + + + + IDEDebuggerArea + 115 + + $class + + CF$UID + 84 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 384 + + geniusEditorContextNode + + CF$UID + 0 + + primaryEditorContextNode + + CF$UID + 375 + + rootLayoutTreeNode + + CF$UID + 381 + + + + $class + + CF$UID + 383 + + children + + CF$UID + 0 + + contentType + 1 + documentArchivableRepresentation + + CF$UID + 376 + + orientation + 0 + parent + + CF$UID + 381 + + + + $class + + CF$UID + 66 + + DocumentLocation + + CF$UID + 62 + + DomainIdentifier + + CF$UID + 56 + + IdentifierPath + + CF$UID + 377 + + IndexOfDocumentIdentifier + + CF$UID + 380 + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 378 + + + + + $class + + CF$UID + 60 + + Identifier + + CF$UID + 379 + + + emptyExample + 9223372036854775807 + + $class + + CF$UID + 383 + + children + + CF$UID + 382 + + contentType + 0 + documentArchivableRepresentation + + CF$UID + 0 + + orientation + 0 + parent + + CF$UID + 0 + + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 375 + + + + + $classes + + IDEWorkspaceTabControllerLayoutTreeNode + NSObject + + $classname + IDEWorkspaceTabControllerLayoutTreeNode + + + $classes + + IDEWorkspaceTabControllerLayoutTree + NSObject + + $classname + IDEWorkspaceTabControllerLayoutTree + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 73 + + + NS.objects + + + CF$UID + 386 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 387 + + + CF$UID + 389 + + + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 78 + + + CF$UID + 388 + + + + 574 + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 78 + + + CF$UID + 390 + + + + 224 + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 392 + + + CF$UID + 393 + + + CF$UID + 394 + + + NS.objects + + + CF$UID + 395 + + + CF$UID + 394 + + + CF$UID + 409 + + + + Xcode.IDEKit.Navigator.Structure + SelectedNavigator + Xcode.IDEKit.Navigator.Issues + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 396 + + + CF$UID + 397 + + + CF$UID + 398 + + + CF$UID + 399 + + + CF$UID + 400 + + + CF$UID + 401 + + + CF$UID + 402 + + + NS.objects + + + CF$UID + 403 + + + CF$UID + 17 + + + CF$UID + 404 + + + CF$UID + 17 + + + CF$UID + 17 + + + CF$UID + 406 + + + CF$UID + 404 + + + + IDEVisibleRect + IDEUnsavedDocumentFilteringEnabled + IDENavigatorExpandedItemsBeforeFilteringSet + IDERecentDocumentFilteringEnabled + IDESCMStatusFilteringEnabled + IDESelectedObjects + IDEExpandedItemsSet + {{0, 0}, {259, 754}} + + $class + + CF$UID + 405 + + NS.objects + + + + $classes + + NSSet + NSObject + + $classname + NSSet + + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 407 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 408 + + + + emptyExample + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 410 + + + CF$UID + 411 + + + CF$UID + 412 + + + CF$UID + 413 + + + CF$UID + 414 + + + CF$UID + 415 + + + CF$UID + 416 + + + CF$UID + 417 + + + CF$UID + 418 + + + NS.objects + + + CF$UID + 17 + + + CF$UID + 419 + + + CF$UID + 420 + + + CF$UID + 422 + + + CF$UID + 423 + + + CF$UID + 17 + + + CF$UID + 424 + + + CF$UID + 17 + + + CF$UID + 425 + + + + IDEErrorFilteringEnabled + IDEVisibleRect + IDECollapsedFiles + IDEExpandedIssues + IDESelectedNavigables + IDEShowsByType + IDECollapsedTypes + IDERecentFilteringEnabled + IDECollapsedGroups + {{0, 0}, {259, 732}} + + $class + + CF$UID + 421 + + NS.objects + + + + $classes + + NSMutableSet + NSSet + NSObject + + $classname + NSMutableSet + + + $class + + CF$UID + 421 + + NS.objects + + + + $class + + CF$UID + 83 + + NS.objects + + + + $class + + CF$UID + 421 + + NS.objects + + + + $class + + CF$UID + 421 + + NS.objects + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 73 + + + NS.objects + + + CF$UID + 427 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 428 + + + CF$UID + 430 + + + CF$UID + 432 + + + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 23 + + + CF$UID + 429 + + + + 260 + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 21 + + + CF$UID + 431 + + + + 1140 + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 433 + + + CF$UID + 434 + + + + IDEUtilitiesArea + 260 + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 436 + + + CF$UID + 437 + + + CF$UID + 438 + + + CF$UID + 439 + + + CF$UID + 440 + + + CF$UID + 441 + + + CF$UID + 442 + + + CF$UID + 443 + + + CF$UID + 444 + + + CF$UID + 445 + + + NS.objects + + + CF$UID + 17 + + + CF$UID + 446 + + + CF$UID + 329 + + + CF$UID + 692 + + + CF$UID + 697 + + + CF$UID + 700 + + + CF$UID + 731 + + + CF$UID + 732 + + + CF$UID + 17 + + + CF$UID + 17 + + + + BreakpointsActivated + DefaultEditorStatesForURLs + DebuggingWindowBehavior + ActiveRunDestination + ActiveScheme + LastCompletedPersistentSchemeBasedActivityReport + DocumentWindows + RecentEditorDocumentURLs + AppFocusInMiniDebugging + MiniDebuggingConsole + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 447 + + + NS.objects + + + CF$UID + 448 + + + + Xcode.Xcode3ProjectSupport.EditorDocument.Xcode3Project + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 449 + + + NS.objects + + + CF$UID + 450 + + + + + $class + + CF$UID + 337 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 63 + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 68 + + + CF$UID + 69 + + + CF$UID + 70 + + + CF$UID + 71 + + + NS.objects + + + CF$UID + 451 + + + CF$UID + 457 + + + CF$UID + 458 + + + CF$UID + 691 + + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 73 + + + NS.objects + + + CF$UID + 452 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 453 + + + CF$UID + 455 + + + + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 78 + + + CF$UID + 454 + + + + 170 + + $class + + CF$UID + 80 + + NS.keys + + + CF$UID + 76 + + + CF$UID + 77 + + + NS.objects + + + CF$UID + 78 + + + CF$UID + 456 + + + + 970 + Xcode3BuildSettingsEditor + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 459 + + + + + $class + + CF$UID + 331 + + documentURL + + CF$UID + 88 + + selection + + CF$UID + 461 + + timestamp + + CF$UID + 460 + + + 333161550.93181902 + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 91 + + + CF$UID + 92 + + + CF$UID + 462 + + + NS.objects + + + CF$UID + 463 + + + CF$UID + 95 + + + CF$UID + 464 + + + + Xcode3BuildSettingsEditorLocations + Xcode3BuildSettingsEditor + + $class + + CF$UID + 16 + + NS.objects + + + CF$UID + 465 + + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 98 + + + CF$UID + 99 + + + CF$UID + 100 + + + CF$UID + 101 + + + CF$UID + 102 + + + CF$UID + 103 + + + NS.objects + + + CF$UID + 466 + + + CF$UID + 689 + + + CF$UID + 329 + + + CF$UID + 329 + + + CF$UID + 329 + + + CF$UID + 330 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 467 + + + CF$UID + 468 + + + CF$UID + 469 + + + CF$UID + 470 + + + CF$UID + 471 + + + CF$UID + 472 + + + CF$UID + 473 + + + CF$UID + 474 + + + CF$UID + 475 + + + CF$UID + 476 + + + CF$UID + 477 + + + CF$UID + 478 + + + CF$UID + 479 + + + CF$UID + 480 + + + CF$UID + 481 + + + CF$UID + 482 + + + CF$UID + 483 + + + CF$UID + 484 + + + CF$UID + 485 + + + CF$UID + 486 + + + CF$UID + 487 + + + CF$UID + 488 + + + CF$UID + 489 + + + CF$UID + 490 + + + CF$UID + 491 + + + CF$UID + 492 + + + CF$UID + 493 + + + CF$UID + 494 + + + CF$UID + 495 + + + CF$UID + 496 + + + CF$UID + 497 + + + CF$UID + 498 + + + CF$UID + 499 + + + CF$UID + 500 + + + CF$UID + 501 + + + CF$UID + 502 + + + CF$UID + 503 + + + CF$UID + 504 + + + CF$UID + 505 + + + CF$UID + 506 + + + CF$UID + 507 + + + CF$UID + 508 + + + CF$UID + 509 + + + CF$UID + 510 + + + CF$UID + 511 + + + CF$UID + 512 + + + CF$UID + 513 + + + CF$UID + 514 + + + CF$UID + 515 + + + CF$UID + 516 + + + CF$UID + 517 + + + CF$UID + 518 + + + CF$UID + 519 + + + CF$UID + 520 + + + CF$UID + 521 + + + CF$UID + 522 + + + CF$UID + 523 + + + CF$UID + 524 + + + CF$UID + 525 + + + CF$UID + 526 + + + CF$UID + 527 + + + CF$UID + 528 + + + CF$UID + 529 + + + CF$UID + 530 + + + CF$UID + 531 + + + CF$UID + 532 + + + CF$UID + 533 + + + CF$UID + 534 + + + CF$UID + 535 + + + CF$UID + 536 + + + CF$UID + 537 + + + CF$UID + 538 + + + CF$UID + 539 + + + CF$UID + 540 + + + CF$UID + 541 + + + CF$UID + 542 + + + CF$UID + 543 + + + CF$UID + 544 + + + CF$UID + 545 + + + CF$UID + 546 + + + CF$UID + 547 + + + CF$UID + 548 + + + CF$UID + 549 + + + CF$UID + 550 + + + CF$UID + 551 + + + CF$UID + 552 + + + CF$UID + 553 + + + CF$UID + 554 + + + CF$UID + 555 + + + CF$UID + 556 + + + CF$UID + 557 + + + CF$UID + 558 + + + CF$UID + 559 + + + CF$UID + 560 + + + CF$UID + 561 + + + CF$UID + 562 + + + CF$UID + 563 + + + CF$UID + 564 + + + CF$UID + 565 + + + CF$UID + 566 + + + CF$UID + 567 + + + CF$UID + 568 + + + CF$UID + 569 + + + CF$UID + 570 + + + CF$UID + 571 + + + CF$UID + 572 + + + CF$UID + 573 + + + CF$UID + 574 + + + CF$UID + 575 + + + CF$UID + 576 + + + CF$UID + 577 + + + CF$UID + 578 + + + CF$UID + 579 + + + CF$UID + 580 + + + CF$UID + 581 + + + CF$UID + 582 + + + CF$UID + 583 + + + CF$UID + 584 + + + CF$UID + 585 + + + CF$UID + 586 + + + CF$UID + 587 + + + CF$UID + 588 + + + CF$UID + 589 + + + CF$UID + 590 + + + CF$UID + 591 + + + CF$UID + 592 + + + CF$UID + 593 + + + CF$UID + 594 + + + CF$UID + 595 + + + CF$UID + 596 + + + CF$UID + 597 + + + CF$UID + 598 + + + CF$UID + 599 + + + CF$UID + 600 + + + CF$UID + 601 + + + CF$UID + 602 + + + CF$UID + 603 + + + CF$UID + 604 + + + CF$UID + 605 + + + CF$UID + 606 + + + CF$UID + 607 + + + CF$UID + 608 + + + CF$UID + 609 + + + CF$UID + 610 + + + CF$UID + 611 + + + CF$UID + 612 + + + CF$UID + 613 + + + CF$UID + 614 + + + CF$UID + 615 + + + CF$UID + 616 + + + CF$UID + 617 + + + CF$UID + 618 + + + CF$UID + 619 + + + CF$UID + 620 + + + CF$UID + 621 + + + CF$UID + 622 + + + CF$UID + 623 + + + CF$UID + 624 + + + CF$UID + 625 + + + CF$UID + 626 + + + CF$UID + 627 + + + CF$UID + 628 + + + CF$UID + 629 + + + CF$UID + 630 + + + CF$UID + 631 + + + CF$UID + 632 + + + CF$UID + 633 + + + CF$UID + 634 + + + CF$UID + 635 + + + CF$UID + 636 + + + CF$UID + 637 + + + CF$UID + 638 + + + CF$UID + 639 + + + CF$UID + 640 + + + CF$UID + 641 + + + CF$UID + 642 + + + CF$UID + 643 + + + CF$UID + 644 + + + CF$UID + 645 + + + CF$UID + 646 + + + CF$UID + 647 + + + CF$UID + 648 + + + CF$UID + 649 + + + CF$UID + 650 + + + CF$UID + 651 + + + CF$UID + 652 + + + CF$UID + 653 + + + CF$UID + 654 + + + CF$UID + 655 + + + CF$UID + 656 + + + CF$UID + 657 + + + CF$UID + 658 + + + CF$UID + 659 + + + CF$UID + 660 + + + CF$UID + 661 + + + CF$UID + 662 + + + CF$UID + 663 + + + CF$UID + 664 + + + CF$UID + 665 + + + CF$UID + 666 + + + CF$UID + 667 + + + CF$UID + 668 + + + CF$UID + 669 + + + CF$UID + 670 + + + CF$UID + 671 + + + CF$UID + 672 + + + CF$UID + 673 + + + CF$UID + 674 + + + CF$UID + 675 + + + CF$UID + 676 + + + CF$UID + 677 + + + CF$UID + 678 + + + CF$UID + 679 + + + CF$UID + 680 + + + CF$UID + 681 + + + CF$UID + 682 + + + CF$UID + 683 + + + CF$UID + 684 + + + CF$UID + 685 + + + CF$UID + 686 + + + CF$UID + 687 + + + CF$UID + 688 + + + + + $class + + CF$UID + 64 + + NS.string + Architectures||ADDITIONAL_SDKS + + + $class + + CF$UID + 64 + + NS.string + Architectures||ARCHS + + + $class + + CF$UID + 64 + + NS.string + Architectures||SDKROOT + + + $class + + CF$UID + 64 + + NS.string + Architectures||ONLY_ACTIVE_ARCH + + + $class + + CF$UID + 64 + + NS.string + Architectures||SUPPORTED_PLATFORMS + + + $class + + CF$UID + 64 + + NS.string + Architectures||VALID_ARCHS + + + $class + + CF$UID + 64 + + NS.string + Build Locations||SYMROOT + + + $class + + CF$UID + 64 + + NS.string + Build Locations||OBJROOT + + + $class + + CF$UID + 64 + + NS.string + Build Locations||SHARED_PRECOMPS_DIR + + + $class + + CF$UID + 64 + + NS.string + Build Options||BUILD_VARIANTS + + + $class + + CF$UID + 64 + + NS.string + Build Options||GCC_VERSION + + + $class + + CF$UID + 64 + + NS.string + Build Options||DEBUG_INFORMATION_FORMAT + + + $class + + CF$UID + 64 + + NS.string + Build Options||ENABLE_OPENMP_SUPPORT + + + $class + + CF$UID + 64 + + NS.string + Build Options||GENERATE_PROFILING_CODE + + + $class + + CF$UID + 64 + + NS.string + Build Options||PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR + + + $class + + CF$UID + 64 + + NS.string + Build Options||RUN_CLANG_STATIC_ANALYZER + + + $class + + CF$UID + 64 + + NS.string + Build Options||SCAN_ALL_SOURCE_FILES_FOR_INCLUDES + + + $class + + CF$UID + 64 + + NS.string + Build Options||VALIDATE_PRODUCT + + + $class + + CF$UID + 64 + + NS.string + Code Signing||CODE_SIGN_ENTITLEMENTS + + + $class + + CF$UID + 64 + + NS.string + Code Signing||CODE_SIGN_RESOURCE_RULES_PATH + + + $class + + CF$UID + 64 + + NS.string + Code Signing||OTHER_CODE_SIGN_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Deployment||STRIPFLAGS + + + $class + + CF$UID + 64 + + NS.string + Deployment||ALTERNATE_GROUP + + + $class + + CF$UID + 64 + + NS.string + Deployment||ALTERNATE_OWNER + + + $class + + CF$UID + 64 + + NS.string + Deployment||ALTERNATE_MODE + + + $class + + CF$UID + 64 + + NS.string + Deployment||ALTERNATE_PERMISSIONS_FILES + + + $class + + CF$UID + 64 + + NS.string + Deployment||COMBINE_HIDPI_IMAGES + + + $class + + CF$UID + 64 + + NS.string + Deployment||DEPLOYMENT_LOCATION + + + $class + + CF$UID + 64 + + NS.string + Deployment||DEPLOYMENT_POSTPROCESSING + + + $class + + CF$UID + 64 + + NS.string + Deployment||INSTALL_GROUP + + + $class + + CF$UID + 64 + + NS.string + Deployment||INSTALL_OWNER + + + $class + + CF$UID + 64 + + NS.string + Deployment||INSTALL_MODE_FLAG + + + $class + + CF$UID + 64 + + NS.string + Deployment||DSTROOT + + + $class + + CF$UID + 64 + + NS.string + Deployment||INSTALL_PATH + + + $class + + CF$UID + 64 + + NS.string + Deployment||MACOSX_DEPLOYMENT_TARGET + + + $class + + CF$UID + 64 + + NS.string + Deployment||SKIP_INSTALL + + + $class + + CF$UID + 64 + + NS.string + Deployment||COPY_PHASE_STRIP + + + $class + + CF$UID + 64 + + NS.string + Deployment||STRIP_INSTALLED_PRODUCT + + + $class + + CF$UID + 64 + + NS.string + Deployment||STRIP_STYLE + + + $class + + CF$UID + 64 + + NS.string + Deployment||TARGETED_DEVICE_FAMILY + + + $class + + CF$UID + 64 + + NS.string + Deployment||SEPARATE_STRIP + + + $class + + CF$UID + 64 + + NS.string + Deployment||IPHONEOS_DEPLOYMENT_TARGET + + + $class + + CF$UID + 64 + + NS.string + Kernel Module||MODULE_NAME + + + $class + + CF$UID + 64 + + NS.string + Kernel Module||MODULE_START + + + $class + + CF$UID + 64 + + NS.string + Kernel Module||MODULE_STOP + + + $class + + CF$UID + 64 + + NS.string + Kernel Module||MODULE_VERSION + + + $class + + CF$UID + 64 + + NS.string + Linking||BUNDLE_LOADER + + + $class + + CF$UID + 64 + + NS.string + Linking||DYLIB_COMPATIBILITY_VERSION + + + $class + + CF$UID + 64 + + NS.string + Linking||DYLIB_CURRENT_VERSION + + + $class + + CF$UID + 64 + + NS.string + Linking||DEAD_CODE_STRIPPING + + + $class + + CF$UID + 64 + + NS.string + Linking||LINKER_DISPLAYS_MANGLED_NAMES + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_NO_PIE + + + $class + + CF$UID + 64 + + NS.string + Linking||PRESERVE_DEAD_CODE_INITS_AND_TERMS + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_DYLIB_INSTALL_NAME + + + $class + + CF$UID + 64 + + NS.string + Linking||EXPORTED_SYMBOLS_FILE + + + $class + + CF$UID + 64 + + NS.string + Linking||INIT_ROUTINE + + + $class + + CF$UID + 64 + + NS.string + Linking||LINK_WITH_STANDARD_LIBRARIES + + + $class + + CF$UID + 64 + + NS.string + Linking||MACH_O_TYPE + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_OPENMP_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||ORDER_FILE + + + $class + + CF$UID + 64 + + NS.string + Linking||OTHER_LDFLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||GENERATE_MASTER_OBJECT_FILE + + + $class + + CF$UID + 64 + + NS.string + Linking||PRELINK_LIBS + + + $class + + CF$UID + 64 + + NS.string + Linking||KEEP_PRIVATE_EXTERNS + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_RUNPATH_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Linking||SEPARATE_SYMBOL_EDIT + + + $class + + CF$UID + 64 + + NS.string + Linking||PRELINK_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||SECTORDER_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||UNEXPORTED_SYMBOLS_FILE + + + $class + + CF$UID + 64 + + NS.string + Linking||WARNING_LDFLAGS + + + $class + + CF$UID + 64 + + NS.string + Linking||LD_GENERATE_MAP_FILE + + + $class + + CF$UID + 64 + + NS.string + Packaging||COMPRESS_PNG_FILES + + + $class + + CF$UID + 64 + + NS.string + Packaging||APPLY_RULES_IN_COPY_FILES + + + $class + + CF$UID + 64 + + NS.string + Packaging||EXECUTABLE_EXTENSION + + + $class + + CF$UID + 64 + + NS.string + Packaging||EXECUTABLE_PREFIX + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_EXPAND_BUILD_SETTINGS + + + $class + + CF$UID + 64 + + NS.string + Packaging||GENERATE_PKGINFO_FILE + + + $class + + CF$UID + 64 + + NS.string + Packaging||FRAMEWORK_VERSION + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_FILE + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_OTHER_PREPROCESSOR_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_OUTPUT_FORMAT + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_PREPROCESSOR_DEFINITIONS + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_PREFIX_HEADER + + + $class + + CF$UID + 64 + + NS.string + Packaging||INFOPLIST_PREPROCESS + + + $class + + CF$UID + 64 + + NS.string + Packaging||COPYING_PRESERVES_HFS_DATA + + + $class + + CF$UID + 64 + + NS.string + Packaging||PRIVATE_HEADERS_FOLDER_PATH + + + $class + + CF$UID + 64 + + NS.string + Packaging||PRODUCT_NAME + + + $class + + CF$UID + 64 + + NS.string + Packaging||PLIST_FILE_OUTPUT_FORMAT + + + $class + + CF$UID + 64 + + NS.string + Packaging||PUBLIC_HEADERS_FOLDER_PATH + + + $class + + CF$UID + 64 + + NS.string + Packaging||STRINGS_FILE_OUTPUT_ENCODING + + + $class + + CF$UID + 64 + + NS.string + Packaging||WRAPPER_EXTENSION + + + $class + + CF$UID + 64 + + NS.string + Search Paths||FRAMEWORK_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Search Paths||HEADER_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Search Paths||LIBRARY_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Search Paths||REZ_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Search Paths||EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES + + + $class + + CF$UID + 64 + + NS.string + Search Paths||INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES + + + $class + + CF$UID + 64 + + NS.string + Search Paths||USER_HEADER_SEARCH_PATHS + + + $class + + CF$UID + 64 + + NS.string + Unit Testing||OTHER_TEST_FLAGS + + + $class + + CF$UID + 64 + + NS.string + Unit Testing||TEST_AFTER_BUILD + + + $class + + CF$UID + 64 + + NS.string + Unit Testing||TEST_HOST + + + $class + + CF$UID + 64 + + NS.string + Unit Testing||TEST_RIG + + + $class + + CF$UID + 64 + + NS.string + Versioning||CURRENT_PROJECT_VERSION + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_FILE + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_EXPORT_DECL + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_PREFIX + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_SUFFIX + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSIONING_SYSTEM + + + $class + + CF$UID + 64 + + NS.string + Versioning||VERSION_INFO_BUILDER + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_FAST_OBJC_DISPATCH + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_OBJC_CALL_CXX_CDTORS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_THUMB_SUPPORT + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SSE3_EXTENSIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SSE41_EXTENSIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SSE42_EXTENSIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_STRICT_ALIASING + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_FEEDBACK_DIRECTED_OPTIMIZATION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_GENERATE_TEST_COVERAGE_FILES + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_INLINES_ARE_PRIVATE_EXTERN + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_INSTRUMENT_PROGRAM_FLOW_ARCS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_KERNEL_DEVELOPMENT + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_DEBUGGING_SYMBOLS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_REUSE_STRINGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_NO_COMMON_BLOCKS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_OBJC_GC + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_FAST_MATH + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_ENABLE_SYMBOL_SEPARATION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_THREADSAFE_STATICS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_SYMBOLS_PRIVATE_EXTERN + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Code Generation||GCC_UNROLL_LOOPS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_CHAR_IS_UNSIGNED_CHAR + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_ASM_KEYWORD + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_C_LANGUAGE_STANDARD + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_CHECK_RETURN_VALUE_OF_OPERATOR_NEW + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_INPUT_FILETYPE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_CPP_EXCEPTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_CPP_RTTI + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_LINK_WITH_DYNAMIC_LIBRARIES + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_OBJC_EXCEPTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_TRIGRAPHS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_FLOATING_POINT_LIBRARY_CALLS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_USE_INDIRECT_FUNCTION_CALLS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_USE_REGISTER_FUNCTION_CALLS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_INCREASE_PRECOMPILED_HEADER_SHARING + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_CW_ASM_SYNTAX + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||OTHER_CFLAGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||OTHER_CPLUSPLUSFLAGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_PRECOMPILE_PREFIX_HEADER + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_PREFIX_HEADER + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_BUILTIN_FUNCTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_ENABLE_PASCAL_STRINGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_FORCE_CPU_SUBTYPE_ALL + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_SHORT_ENUMS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Language||GCC_USE_STANDARD_INCLUDE_SEARCHING + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Preprocessing||GCC_PREPROCESSOR_DEFINITIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Preprocessing||GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_CHECK_SWITCH_STATEMENTS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_FOUR_CHARACTER_CONSTANTS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_SHADOW + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_64_TO_32_BIT_CONVERSION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_INHIBIT_ALL_WARNINGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_ABOUT_RETURN_TYPE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_MISSING_PARENTHESES + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_ABOUT_MISSING_PROTOTYPES + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_ABOUT_MISSING_NEWLINE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_NON_VIRTUAL_DESTRUCTOR + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||WARNING_CFLAGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_PEDANTIC + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_PROTOTYPE_CONVERSION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_SIGN_COMPARE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_STRICT_SELECTOR_MATCH + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_TREAT_WARNINGS_AS_ERRORS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_TYPECHECK_CALLS_TO_PRINTF + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNDECLARED_SELECTOR + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNINITIALIZED_AUTOS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNKNOWN_PRAGMAS + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_FUNCTION + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_LABEL + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_PARAMETER + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_VALUE + + + $class + + CF$UID + 64 + + NS.string + GCC 4.2 - Warnings||GCC_WARN_UNUSED_VARIABLE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_CAIRO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_FMODEX + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_FREEIMAGE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_FREETYPE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_FREETYPE2 + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_GLEW + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_GLU + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_OF + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_OFXACCELEROMETER + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_OFXIPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_OFXMULTITOUCH + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_POCO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_RTAUDIO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||HEADER_TESS2 + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_CAIRO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_FREEIMAGE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_FREEIMAGE_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_FREETYPE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_GLEW + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_GLU + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_GLU_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_POCOFOUNDATION_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_POCONET_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_POCOUTIL_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_POCOXML_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_RTAUDIO + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_TESS + + + $class + + CF$UID + 64 + + NS.string + User-Defined||LIB_TESS_IPHONE + + + $class + + CF$UID + 64 + + NS.string + User-Defined||MISC_FLAGS + + + $class + + CF$UID + 64 + + NS.string + User-Defined||OF_CORE_HEADERS + + + $class + + CF$UID + 64 + + NS.string + User-Defined||OF_CORE_LIBS + + + $class + + CF$UID + 64 + + NS.string + User-Defined||OF_PATH + + + $class + + CF$UID + 64 + + NS.string + User-Defined||PREBINDING + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 690 + + + + + $class + + CF$UID + 64 + + NS.string + Deployment||MACOSX_DEPLOYMENT_TARGET + + + $class + + CF$UID + 84 + + NS.keys + + NS.objects + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 693 + + + CF$UID + 694 + + + NS.objects + + + CF$UID + 695 + + + CF$UID + 696 + + + + IDEDeviceLocation + IDEDeviceArchitecture + dvtdevice-iphonesimulator:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk-iPad + i386 + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 698 + + + NS.objects + + + CF$UID + 699 + + + + IDENameString + emptyExample + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 701 + + + CF$UID + 702 + + + CF$UID + 703 + + + NS.objects + + + CF$UID + 704 + + + CF$UID + 729 + + + CF$UID + 730 + + + + IDEActivityReportCompletionSummaryStringSegments + IDEActivityReportOptions + IDEActivityReportTitle + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 705 + + + CF$UID + 712 + + + CF$UID + 715 + + + CF$UID + 720 + + + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 706 + + + CF$UID + 707 + + + CF$UID + 708 + + + NS.objects + + + CF$UID + 709 + + + CF$UID + 710 + + + CF$UID + 711 + + + + IDEActivityReportStringSegmentPriority + IDEActivityReportStringSegmentBackSeparator + IDEActivityReportStringSegmentStringValue + 2 + + Build + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 706 + + + CF$UID + 707 + + + CF$UID + 708 + + + NS.objects + + + CF$UID + 713 + + + CF$UID + 714 + + + CF$UID + 408 + + + + 4 + : + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 706 + + + CF$UID + 707 + + + CF$UID + 708 + + + NS.objects + + + CF$UID + 716 + + + CF$UID + 717 + + + CF$UID + 718 + + + + 1 + │ + + $class + + CF$UID + 719 + + NS.data + + YnBsaXN0MDDUAQIDBAUGOzxYJHZlcnNpb25YJG9iamVjdHNZJGFy + Y2hpdmVyVCR0b3ASAAGGoK0HCA8QGhscJCUrMTQ3VSRudWxs0wkK + CwwNDlxOU0F0dHJpYnV0ZXNWJGNsYXNzWE5TU3RyaW5ngAOADIAC + WVN1Y2NlZWRlZNMKERITFBdXTlMua2V5c1pOUy5vYmplY3RzgAui + FRaABIAFohgZgAaACVZOU0ZvbnRXTlNDb2xvctQKHR4fICEiI1ZO + U05hbWVWTlNTaXplWE5TZkZsYWdzgAiAByNAJgAAAAAAABENEF8Q + EUx1Y2lkYUdyYW5kZS1Cb2xk0iYnKClaJGNsYXNzbmFtZVgkY2xh + c3Nlc1ZOU0ZvbnSiKCpYTlNPYmplY3TTCiwtLi8wXE5TQ29sb3JT + cGFjZVdOU1doaXRlgAoQA0IwANImJzIzV05TQ29sb3KiMirSJic1 + NlxOU0RpY3Rpb25hcnmiNSrSJic4OV8QEk5TQXR0cmlidXRlZFN0 + cmluZ6I6Kl8QEk5TQXR0cmlidXRlZFN0cmluZ18QD05TS2V5ZWRB + cmNoaXZlctE9PlRyb290gAEACAARABoAIwAtADIANwBFAEsAUgBf + AGYAbwBxAHMAdQB/AIYAjgCZAJsAngCgAKIApQCnAKkAsAC4AMEA + yADPANgA2gDcAOUA6AD8AQEBDAEVARwBHwEoAS8BPAFEAUYBSAFL + AVABWAFbAWABbQFwAXUBigGNAaIBtAG3AbwAAAAAAAACAQAAAAAA + AAA/AAAAAAAAAAAAAAAAAAABvg== + + + + $classes + + NSMutableData + NSData + NSObject + + $classname + NSMutableData + + + $class + + CF$UID + 84 + + NS.keys + + + CF$UID + 706 + + + CF$UID + 721 + + + CF$UID + 722 + + + CF$UID + 708 + + + CF$UID + 723 + + + CF$UID + 724 + + + NS.objects + + + CF$UID + 725 + + + CF$UID + 330 + + + CF$UID + 726 + + + CF$UID + 728 + + + CF$UID + 330 + + + CF$UID + 330 + + + + IDEActivityReportStringSegmentType + IDEActivityReportStringSegmentDate + IDEActivityReportStringSegmentDateStyle + IDEActivityReportStringSegmentTimeStyle + 3 + + $class + + CF$UID + 727 + + NS.time + 333157476.13652903 + + + $classes + + NSDate + NSObject + + $classname + NSDate + + Today at 6:44 PM + 106 + iPhone+OF Static Library + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 2 + + + + + $class + + CF$UID + 83 + + NS.objects + + + CF$UID + 733 + + + + + $class + + CF$UID + 337 + + NS.base + + CF$UID + 0 + + NS.relative + + CF$UID + 88 + + + + $top + + State + + CF$UID + 1 + + + $version + 100000 + + diff --git a/iphone-example/emptyExample.xcodeproj/xcuserdata/bakercp.xcuserdatad/xcschemes/emptyExample.xcscheme b/iphone-example/emptyExample.xcodeproj/xcuserdata/bakercp.xcuserdatad/xcschemes/emptyExample.xcscheme new file mode 100644 index 0000000..541f40e --- /dev/null +++ b/iphone-example/emptyExample.xcodeproj/xcuserdata/bakercp.xcuserdatad/xcschemes/emptyExample.xcscheme @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone-example/emptyExample.xcodeproj/xcuserdata/bakercp.xcuserdatad/xcschemes/xcschememanagement.plist b/iphone-example/emptyExample.xcodeproj/xcuserdata/bakercp.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..0ba941f --- /dev/null +++ b/iphone-example/emptyExample.xcodeproj/xcuserdata/bakercp.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + emptyExample.xcscheme + + orderHint + 1 + + + SuppressBuildableAutocreation + + 1D6058900D05DD3D006BFB54 + + primary + + + + + diff --git a/iphone-example/iPhone_Prefix.pch b/iphone-example/iPhone_Prefix.pch new file mode 100644 index 0000000..fd3401c --- /dev/null +++ b/iphone-example/iPhone_Prefix.pch @@ -0,0 +1,8 @@ +// +// Prefix header for all source files of the 'iPhone' target in the 'iPhone' project +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/iphone-example/ofxiphone-Info.plist b/iphone-example/ofxiphone-Info.plist new file mode 100644 index 0000000..43db2fa --- /dev/null +++ b/iphone-example/ofxiphone-Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CFBundleIdentifier + ${PRODUCT_NAME:identifier} + UIStatusBarHidden + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + LSRequiresIPhoneOS + + UIApplicationExitsOnSuspend + + UIInterfaceOrientation + UIInterfaceOrientationPortrait + + diff --git a/iphone-example/src/main.mm b/iphone-example/src/main.mm new file mode 100644 index 0000000..a0b6b4c --- /dev/null +++ b/iphone-example/src/main.mm @@ -0,0 +1,8 @@ +#include "ofMain.h" +#include "testApp.h" + +int main(){ + ofSetupOpenGL(1024,768, OF_FULLSCREEN); // <-------- setup the GL context + + ofRunApp(new testApp); +} diff --git a/iphone-example/src/testApp.h b/iphone-example/src/testApp.h new file mode 100755 index 0000000..9ec2835 --- /dev/null +++ b/iphone-example/src/testApp.h @@ -0,0 +1,28 @@ +#pragma once + +#include "ofMain.h" +#include "ofxiPhone.h" +#include "ofxiPhoneExtras.h" + +class testApp : public ofxiPhoneApp { + +public: + void setup(); + void update(); + void draw(); + void exit(); + + void touchDown(ofTouchEventArgs &touch); + void touchMoved(ofTouchEventArgs &touch); + void touchUp(ofTouchEventArgs &touch); + void touchDoubleTap(ofTouchEventArgs &touch); + void touchCancelled(ofTouchEventArgs &touch); + + void lostFocus(); + void gotFocus(); + void gotMemoryWarning(); + void deviceOrientationChanged(int newOrientation); + +}; + + diff --git a/iphone-example/src/testApp.mm b/iphone-example/src/testApp.mm new file mode 100755 index 0000000..bc27c6a --- /dev/null +++ b/iphone-example/src/testApp.mm @@ -0,0 +1,80 @@ +#include "testApp.h" + +//-------------------------------------------------------------- +void testApp::setup(){ + // register touch events + ofRegisterTouchEvents(this); + + // initialize the accelerometer + ofxAccelerometer.setup(); + + //iPhoneAlerts will be sent to this. + ofxiPhoneAlerts.addListener(this); + + //If you want a landscape oreintation + //iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT); + + ofBackground(127,127,127); +} + +//-------------------------------------------------------------- +void testApp::update(){ + +} + +//-------------------------------------------------------------- +void testApp::draw(){ + +} + +//-------------------------------------------------------------- +void testApp::exit(){ + +} + +//-------------------------------------------------------------- +void testApp::touchDown(ofTouchEventArgs &touch){ + +} + +//-------------------------------------------------------------- +void testApp::touchMoved(ofTouchEventArgs &touch){ + +} + +//-------------------------------------------------------------- +void testApp::touchUp(ofTouchEventArgs &touch){ + +} + +//-------------------------------------------------------------- +void testApp::touchDoubleTap(ofTouchEventArgs &touch){ + +} + +//-------------------------------------------------------------- +void testApp::lostFocus(){ + +} + +//-------------------------------------------------------------- +void testApp::gotFocus(){ + +} + +//-------------------------------------------------------------- +void testApp::gotMemoryWarning(){ + +} + +//-------------------------------------------------------------- +void testApp::deviceOrientationChanged(int newOrientation){ + +} + + +//-------------------------------------------------------------- +void testApp::touchCancelled(ofTouchEventArgs& args){ + +} + diff --git a/junk/ofTrueTypeFont_.cpp b/junk/ofTrueTypeFont_.cpp new file mode 100644 index 0000000..4e4da2f --- /dev/null +++ b/junk/ofTrueTypeFont_.cpp @@ -0,0 +1,906 @@ +#include "ofTrueTypeFont.h" +//-------------------------- + +#include "ft2build.h" +#include "freetype2/freetype/freetype.h" +#include "freetype2/freetype/ftglyph.h" +#include "freetype2/freetype/ftoutln.h" +#include "freetype2/freetype/fttrigon.h" + +#include + +#include "ofUtils.h" +#include "ofGraphics.h" + +static bool printVectorInfo = false; +static int ttfGlobalDpi = 96; + +//-------------------------------------------------------- +void ofTrueTypeFont::setGlobalDpi(int newDpi){ + ttfGlobalDpi = newDpi; +} + +//-------------------------------------------------------- +static ofTTFCharacter makeContoursForCharacter(FT_Face &face); +static ofTTFCharacter makeContoursForCharacter(FT_Face &face){ + + //int num = face->glyph->outline.n_points; + int nContours = face->glyph->outline.n_contours; + int startPos = 0; + + char * tags = face->glyph->outline.tags; + FT_Vector * vec = face->glyph->outline.points; + + ofTTFCharacter charOutlines; + charOutlines.setUseShapeColor(false); + + for(int k = 0; k < nContours; k++){ + if( k > 0 ){ + startPos = face->glyph->outline.contours[k-1]+1; + } + int endPos = face->glyph->outline.contours[k]+1; + + if( printVectorInfo )printf("--NEW CONTOUR\n\n"); + + //vector testOutline; + ofPoint lastPoint; + + for(int j = startPos; j < endPos; j++){ + + if( FT_CURVE_TAG(tags[j]) == FT_CURVE_TAG_ON ){ + lastPoint.set((float)vec[j].x, (float)-vec[j].y, 0); + if( printVectorInfo )printf("flag[%i] is set to 1 - regular point - %f %f \n", j, lastPoint.x, lastPoint.y); + //testOutline.push_back(lastPoint); + charOutlines.lineTo(lastPoint/64); + + }else{ + if( printVectorInfo )printf("flag[%i] is set to 0 - control point \n", j); + + if( FT_CURVE_TAG(tags[j]) == FT_CURVE_TAG_CUBIC ){ + if( printVectorInfo )printf("- bit 2 is set to 2 - CUBIC\n"); + + int prevPoint = j-1; + if( j == 0){ + prevPoint = endPos-1; + } + + int nextIndex = j+1; + if( nextIndex >= endPos){ + nextIndex = startPos; + } + + ofPoint nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y ); + + //we need two control points to draw a cubic bezier + bool lastPointCubic = ( FT_CURVE_TAG(tags[prevPoint]) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG(tags[prevPoint]) == FT_CURVE_TAG_CUBIC); + + if( lastPointCubic ){ + ofPoint controlPoint1((float)vec[prevPoint].x, (float)-vec[prevPoint].y); + ofPoint controlPoint2((float)vec[j].x, (float)-vec[j].y); + ofPoint nextPoint((float) vec[nextIndex].x, -(float) vec[nextIndex].y); + + //cubic_bezier(testOutline, lastPoint.x, lastPoint.y, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, nextPoint.x, nextPoint.y, 8); + charOutlines.bezierTo(controlPoint1.x/64, controlPoint1.y/64, controlPoint2.x/64, controlPoint2.y/64, nextPoint.x/64, nextPoint.y/64); + } + + }else{ + + ofPoint conicPoint( (float)vec[j].x, -(float)vec[j].y ); + + if( printVectorInfo )printf("- bit 2 is set to 0 - conic- \n"); + if( printVectorInfo )printf("--- conicPoint point is %f %f \n", conicPoint.x, conicPoint.y); + + //If the first point is connic and the last point is connic then we need to create a virutal point which acts as a wrap around + if( j == startPos ){ + bool prevIsConnic = ( FT_CURVE_TAG( tags[endPos-1] ) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG( tags[endPos-1]) != FT_CURVE_TAG_CUBIC ); + + if( prevIsConnic ){ + ofPoint lastConnic((float)vec[endPos - 1].x, (float)-vec[endPos - 1].y); + lastPoint = (conicPoint + lastConnic) / 2; + + if( printVectorInfo ) printf("NEED TO MIX WITH LAST\n"); + if( printVectorInfo )printf("last is %f %f \n", lastPoint.x, lastPoint.y); + } + } + + //bool doubleConic = false; + + int nextIndex = j+1; + if( nextIndex >= endPos){ + nextIndex = startPos; + } + + ofPoint nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y ); + + if( printVectorInfo )printf("--- last point is %f %f \n", lastPoint.x, lastPoint.y); + + bool nextIsConnic = ( FT_CURVE_TAG( tags[nextIndex] ) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG( tags[nextIndex]) != FT_CURVE_TAG_CUBIC ); + + //create a 'virtual on point' if we have two connic points + if( nextIsConnic ){ + nextPoint = (conicPoint + nextPoint) / 2; + if( printVectorInfo )printf("|_______ double connic!\n"); + } + if( printVectorInfo )printf("--- next point is %f %f \n", nextPoint.x, nextPoint.y); + + //quad_bezier(testOutline, lastPoint.x, lastPoint.y, conicPoint.x, conicPoint.y, nextPoint.x, nextPoint.y, 8); + charOutlines.quadBezierTo(lastPoint.x/64, lastPoint.y/64, conicPoint.x/64, conicPoint.y/64, nextPoint.x/64, nextPoint.y/64); + + if( nextIsConnic ){ + lastPoint = nextPoint; + } + } + } + + //end for + } + charOutlines.close(); + } + + return charOutlines; +} + +#ifdef TARGET_ANDROID + #include + set all_fonts; + void ofUnloadAllFontTextures(){ + set::iterator it; + for(it=all_fonts.begin();it!=all_fonts.end();it++){ + (*it)->unloadTextures(); + } + } + void ofReloadAllFontTextures(){ + set::iterator it; + for(it=all_fonts.begin();it!=all_fonts.end();it++){ + (*it)->reloadTextures(); + } + } + +#endif + +bool compare_cps(const charProps & c1, const charProps & c2){ + if(c1.tH == c2.tH) return c1.tW > c2.tW; + else return c1.tH > c2.tH; +} + +//------------------------------------------------------------------ +ofTrueTypeFont::ofTrueTypeFont(){ + bLoadedOk = false; + bMakeContours = false; + #ifdef TARGET_ANDROID + all_fonts.insert(this); + #endif + //cps = NULL; + letterSpacing = 1; + spaceSize = 1; + + // 3 pixel border around the glyph + // We show 2 pixels of this, so that blending looks good. + // 1 pixels is hidden because we don't want to see the real edge of the texture + + border = 3; + //visibleBorder = 2; + stringQuads.setMode(OF_PRIMITIVE_TRIANGLES); + binded = false; +} + +//------------------------------------------------------------------ +ofTrueTypeFont::~ofTrueTypeFont(){ + + if (bLoadedOk){ + unloadTextures(); + } + + #ifdef TARGET_ANDROID + all_fonts.erase(this); + #endif +} + +void ofTrueTypeFont::unloadTextures(){ + if(!bLoadedOk) return; + + texAtlas.clear(); + bLoadedOk = false; +} + +void ofTrueTypeFont::reloadTextures(){ + loadFont(filename, fontSize, bAntiAliased, bFullCharacterSet, false); +} + +//----------------------------------------------------------- +bool ofTrueTypeFont::loadFont(string filename, int fontsize, bool _bAntiAliased, bool _bFullCharacterSet, bool makeContours, float simplifyAmt, int dpi, bool forceAutoHinting) { + + bMakeContours = makeContours; + + //------------------------------------------------ + if (bLoadedOk == true){ + + // we've already been loaded, try to clean up : + unloadTextures(); + } + //------------------------------------------------ + + if( dpi == 0 ){ + dpi = ttfGlobalDpi; + } + + filename = ofToDataPath(filename); + + bLoadedOk = false; + bAntiAliased = _bAntiAliased; + bFullCharacterSet = _bFullCharacterSet; + fontSize = fontsize; + + //--------------- load the library and typeface + + FT_Error err; + FT_Library library; + + err = FT_Init_FreeType( &library ); + if (err){ + ofLog(OF_LOG_ERROR,"ofTrueTypeFont::loadFont - Error initializing freetype lib: FT_Error = %d", err); + return false; + } + + FT_Face face; + + err = FT_New_Face( library, filename.c_str(), 0, &face ); + if (err) { + // simple error table in lieu of full table (see fterrors.h) + string errorString = "unknown freetype"; + if(err == 1) errorString = "INVALID FILENAME"; + ofLog(OF_LOG_ERROR,"ofTrueTypeFont::loadFont - %s: %s: FT_Error = %d", errorString.c_str(), filename.c_str(), err); + return false; + } + + FT_Set_Char_Size( face, fontsize << 6, fontsize << 6, dpi, dpi); + lineHeight = fontsize * 1.43f; + + //------------------------------------------------------ + //kerning would be great to support: + //ofLog(OF_LOG_NOTICE,"FT_HAS_KERNING ? %i", FT_HAS_KERNING(face)); + //------------------------------------------------------ + + nCharacters = bFullCharacterSet ? 256 : 128 - NUM_CHARACTER_TO_START; + + //--------------- initialize character info and textures + cps.resize(nCharacters); + + if(bMakeContours){ + charOutlines.clear(); + charOutlines.assign(nCharacters, ofTTFCharacter()); + } + + vector expanded_data(nCharacters); + + long areaSum=0; + + FT_Int32 loadMode = forceAutoHinting ? FT_LOAD_DEFAULT : FT_LOAD_TARGET_LIGHT; + FT_Render_Mode renderMode = bAntiAliased ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO; + //--------------------- load each char ----------------------- + for (int i = 0 ; i < nCharacters; i++){ + + //------------------------------------------ anti aliased or not: + err = FT_Load_Glyph( face, + FT_Get_Char_Index( face, (unsigned char)(i+NUM_CHARACTER_TO_START) ), + loadMode ); + if(err){ + ofLog(OF_LOG_ERROR,"ofTrueTypeFont::loadFont - Error with FT_Load_Glyph %i: FT_Error = %d", i, err); + } + + FT_Render_Glyph(face->glyph, renderMode); + + //------------------------------------------ + + FT_Bitmap& bitmap = face->glyph->bitmap; + + + // prepare the texture: + /*int width = ofNextPow2( bitmap.width + border*2 ); + int height = ofNextPow2( bitmap.rows + border*2 ); + + + // ------------------------- this is fixing a bug with small type + // ------------------------- appearantly, opengl has trouble with + // ------------------------- width or height textures of 1, so we + // ------------------------- we just set it to 2... + if (width == 1) width = 2; + if (height == 1) height = 2;*/ + + + if(bMakeContours){ + if( printVectorInfo )printf("\n\ncharacter %c: \n", char( i+NUM_CHARACTER_TO_START ) ); + + //int character = i + NUM_CHARACTER_TO_START; + charOutlines[i] = makeContoursForCharacter( face ); + if(simplifyAmt>0) + charOutlines[i].simplify(simplifyAmt); + charOutlines[i].getTessellation(); + } + + + // ------------------------- + // info about the character: + cps[i].character = i; + cps[i].height = face->glyph->bitmap_top; + cps[i].width = face->glyph->bitmap.width; + cps[i].setWidth = face->glyph->advance.x >> 6; + cps[i].topExtent = face->glyph->bitmap.rows; + cps[i].leftExtent = face->glyph->bitmap_left; + + int width = cps[i].width; + int height = bitmap.rows; + + cps[i].tW = width; + cps[i].tH = height; + + int fheight = cps[i].height; + int bwidth = cps[i].width; + int top = cps[i].topExtent - cps[i].height; + int lextent = cps[i].leftExtent; + + float corr, stretch; + + //this accounts for the fact that we are showing 2*visibleBorder extra pixels + //so we make the size of each char that many pixels bigger + stretch = 0;//(float)(visibleBorder * 2); + + corr = (float)(( (fontSize - fheight) + top) - fontSize); + + cps[i].x1 = lextent + bwidth + stretch; + cps[i].y1 = fheight + corr + stretch; + cps[i].x2 = (float) lextent; + cps[i].y2 = -top + corr; + + + // Allocate Memory For The Texture Data. + expanded_data[i].allocate(width, height, 2); + //-------------------------------- clear data: + expanded_data[i].set(0,255); // every luminance pixel = 255 + expanded_data[i].set(1,0); + + + if (bAntiAliased == true){ + ofPixels bitmapPixels; + bitmapPixels.setFromExternalPixels(bitmap.buffer,bitmap.width,bitmap.rows,1); + expanded_data[i].setChannel(1,bitmapPixels); + } else { + //----------------------------------- + // true type packs monochrome info in a + // 1-bit format, hella funky + // here we unpack it: + unsigned char *src = bitmap.buffer; + for(int j=0; j sortedCopy = cps; + sort(sortedCopy.begin(),sortedCopy.end(),&compare_cps); + + // pack in a texture, algorithm to calculate min w/h from + // http://upcommons.upc.edu/pfc/bitstream/2099.1/7720/1/TesiMasterJonas.pdf + //cout << areaSum << endl; + + bool packed = false; + float alpha = logf(areaSum)*1.44269; + + int w; + int h; + while(!packed){ + w = pow(2,floor((alpha/2.f) + 0.5)); // there doesn't seem to be a round in cmath for windows. + //w = pow(2,round(alpha/2.f)); + h = w;//pow(2,round(alpha - round(alpha/2.f))); + int x=0; + int y=0; + int maxRowHeight = sortedCopy[0].tH + border*2; + for(int i=0;i<(int)cps.size();i++){ + if(x+sortedCopy[i].tW + border*2>w){ + x = 0; + y += maxRowHeight; + maxRowHeight = sortedCopy[i].tH + border*2; + if(y + maxRowHeight > h){ + alpha++; + break; + } + } + x+= sortedCopy[i].tW + border*2; + if(i==(int)cps.size()-1) packed = true; + } + + } + + + + ofPixels atlasPixels; + atlasPixels.allocate(w,h,2); + atlasPixels.set(0,255); + atlasPixels.set(1,0); + + int x=0; + int y=0; + int maxRowHeight = sortedCopy[0].tH + border*2; + for(int i=0;i<(int)cps.size();i++){ + ofPixels & charPixels = expanded_data[sortedCopy[i].character]; + + if(x+sortedCopy[i].tW + border*2>w){ + x = 0; + y += maxRowHeight; + maxRowHeight = sortedCopy[i].tH + border*2; + } + + cps[sortedCopy[i].character].t2 = float(x + border)/float(w); + cps[sortedCopy[i].character].v2 = float(y + border)/float(h); + cps[sortedCopy[i].character].t1 = float(cps[sortedCopy[i].character].tW + x + border)/float(w); + cps[sortedCopy[i].character].v1 = float(cps[sortedCopy[i].character].tH + y + border)/float(h); + charPixels.pasteInto(atlasPixels,x+border,y+border); + x+= sortedCopy[i].tW + border*2; + } + + + texAtlas.allocate(atlasPixels.getWidth(),atlasPixels.getHeight(),GL_LUMINANCE_ALPHA,false); + + if(bAntiAliased && fontsize>20){ + texAtlas.setTextureMinMagFilter(GL_LINEAR,GL_LINEAR); + }else{ + texAtlas.setTextureMinMagFilter(GL_NEAREST,GL_NEAREST); + } + + texAtlas.loadData(atlasPixels.getPixels(),atlasPixels.getWidth(),atlasPixels.getHeight(),GL_LUMINANCE_ALPHA); + + // ------------- close the library and typeface + FT_Done_Face(face); + FT_Done_FreeType(library); + bLoadedOk = true; + return true; +} + +//----------------------------------------------------------- +bool ofTrueTypeFont::isLoaded() { + return bLoadedOk; +} + +//----------------------------------------------------------- +bool ofTrueTypeFont::isAntiAliased() { + return bAntiAliased; +} + +//----------------------------------------------------------- +bool ofTrueTypeFont::hasFullCharacterSet() { + return bFullCharacterSet; +} + +//----------------------------------------------------------- +int ofTrueTypeFont::getSize() { + return fontSize; +} + +//----------------------------------------------------------- +void ofTrueTypeFont::setLineHeight(float _newLineHeight) { + lineHeight = _newLineHeight; +} + +//----------------------------------------------------------- +float ofTrueTypeFont::getLineHeight(){ + return lineHeight; +} + +//----------------------------------------------------------- +void ofTrueTypeFont::setLetterSpacing(float _newletterSpacing) { + letterSpacing = _newletterSpacing; +} + +//----------------------------------------------------------- +float ofTrueTypeFont::getLetterSpacing(){ + return letterSpacing; +} + +//----------------------------------------------------------- +void ofTrueTypeFont::setSpaceSize(float _newspaceSize) { + spaceSize = _newspaceSize; +} + +//----------------------------------------------------------- +float ofTrueTypeFont::getSpaceSize(){ + return spaceSize; +} + +//------------------------------------------------------------------ +ofTTFCharacter ofTrueTypeFont::getCharacterAsPoints(int character){ + if( bMakeContours == false ){ + ofLog(OF_LOG_ERROR, "getCharacterAsPoints: contours not created, call loadFont with makeContours set to true" ); + } + + if( bMakeContours && + (int)charOutlines.size() > 0 && + character >= NUM_CHARACTER_TO_START && + character - NUM_CHARACTER_TO_START < (int)charOutlines.size()){ + return charOutlines[character-NUM_CHARACTER_TO_START]; + } else { + if(charOutlines.empty()) charOutlines.push_back(ofTTFCharacter()); + return charOutlines[0]; + } +} + +//----------------------------------------------------------- +void ofTrueTypeFont::drawChar(int c, float x, float y) { + + if (c >= nCharacters){ + //ofLog(OF_LOG_ERROR,"Error : char (%i) not allocated -- line %d in %s", (c + NUM_CHARACTER_TO_START), __LINE__,__FILE__); + return; + } + + float x1, y1, x2, y2; + float t1, v1, t2, v2; + t2 = cps[c].t2; + v2 = cps[c].v2; + t1 = cps[c].t1; + v1 = cps[c].v1; + + x1 = cps[c].x1+x; + y1 = cps[c].y1+y; + x2 = cps[c].x2+x; + y2 = cps[c].y2+y; + + int firstIndex = stringQuads.getVertices().size(); + + stringQuads.addVertex(ofVec3f(x1,y1)); + stringQuads.addVertex(ofVec3f(x2,y1)); + stringQuads.addVertex(ofVec3f(x2,y2)); + stringQuads.addVertex(ofVec3f(x1,y2)); + + stringQuads.addTexCoord(ofVec2f(t1,v1)); + stringQuads.addTexCoord(ofVec2f(t2,v1)); + stringQuads.addTexCoord(ofVec2f(t2,v2)); + stringQuads.addTexCoord(ofVec2f(t1,v2)); + + stringQuads.addIndex(firstIndex); + stringQuads.addIndex(firstIndex+1); + stringQuads.addIndex(firstIndex+2); + stringQuads.addIndex(firstIndex+2); + stringQuads.addIndex(firstIndex+3); + stringQuads.addIndex(firstIndex); +} + +//----------------------------------------------------------- +vector ofTrueTypeFont::getStringAsPoints(string str){ + + vector shapes; + + if (!bLoadedOk){ + ofLog(OF_LOG_ERROR,"Error : font not allocated -- line %d in %s", __LINE__,__FILE__); + return shapes; + } + + int index = 0; + float X = 0.0f; + float Y = 0.0f; + + int len = (int)str.length(); + + while(index < len){ + int cy = (unsigned char)str[index] - NUM_CHARACTER_TO_START; + if (cy < nCharacters){ // full char set or not? + if (str[index] == '\n') { + Y += lineHeight; + X = 0.0f; //reset X Pos back to zero + } else if (str[index] == ' ') { + int cy = (int)'p' - NUM_CHARACTER_TO_START; + X += cps[cy].width * letterSpacing * spaceSize; + } else { + shapes.push_back(getCharacterAsPoints(str[index])); + shapes.back().translate(ofPoint(X,Y)); + X += cps[cy].setWidth * letterSpacing; + } + } + index++; + } + + return shapes; +} + +//----------------------------------------------------------- +void ofTrueTypeFont::drawCharAsShape(int c, float x, float y) { + if (c >= nCharacters){ + ofLog(OF_LOG_ERROR,"Error : char (%i) not allocated -- line %d in %s", (c + NUM_CHARACTER_TO_START), __LINE__,__FILE__); + return; + } + //----------------------- + + int cu = c; + ofTTFCharacter & charRef = charOutlines[cu]; + charRef.setFilled(ofGetStyle().bFill); + charRef.draw(x,y); +} + +//----------------------------------------------------------- +float ofTrueTypeFont::stringWidth(string c) { + ofRectangle rect = getStringBoundingBox(c, 0,0); + return rect.width; +} + +//----------------------------------------------------------- +int ofTrueTypeFont::getCharPropertyIndex(int c) { + int cy = c - NUM_CHARACTER_TO_START; + if (cy < nCharacters){ // full char set or not? + return cy; + } else { + //ofLog(OF_LOG_ERROR,"ofTrueTypeFont::getCharProperty - char out of range"); + return -1; + } +} + +//----------------------------------------------------------- +charProps ofTrueTypeFont::getCharProp(int c) { + int index = getCharPropertyIndex(c); + charProps cp; + if(index > -1) { + cp = cps[index]; + } + return cp; +} + + +//----------------------------------------------------------- +float ofTrueTypeFont::charWidth(int c) { + if (!bLoadedOk){ + ofLog(OF_LOG_ERROR,"ofTrueTypeFont::charWidth - font not allocated"); + return 0; + } + + int index = getCharPropertyIndex(c); + charProps cp; + if(index > -1) { + cp = cps[index]; + if(c == ' ') { + int cy = getCharPropertyIndex('p'); + return cps[cy].width * letterSpacing * spaceSize; + // zach - this is a bug to fix -- for now, we don't currently deal with ' ' in calculating string bounding box + } else { + //return cp.setWidth * letterSpacing; + return cp.width * letterSpacing; + } + + } else { + return 0; + } +} + +//----------------------------------------------------------- +ofRectangle ofTrueTypeFont::getStringBoundingBox(string c, float x, float y){ + + ofRectangle myRect(0,0,0,0); + + if (!bLoadedOk){ + ofLog(OF_LOG_ERROR,"ofTrueTypeFont::getStringBoundingBox - font not allocated"); + return myRect; + } + + int index = 0; + float X = 0.0f; + float Y = 0.0f; + + int len = (int)c.length(); + float minx = numeric_limits::max(); + float miny = numeric_limits::max(); + float maxx = -numeric_limits::max(); + float maxy = -numeric_limits::max(); + + if ( len < 1 || cps.empty() ) return myRect; + + while(index < len) { + int cy = getCharPropertyIndex(c[index]); + if (cy > -1){ // full char set or not? + charProps cp = cps[cy]; + if (c[index] == '\n') { + Y += lineHeight; + X = 0 ; //reset X Pos back to zero + } else if (c[index] == ' ') { + cy = getCharPropertyIndex('p'); + X += cps[cy].width * letterSpacing * spaceSize; + } else { + + float xo = x + X; + float yo = y + Y; + float x1 = xo + cp.x1; + float x2 = xo + cp.x2; + float y1 = yo + cp.y1; + float y2 = yo + cp.y2; + + minx = MIN(minx,x2); + miny = MIN(minx,y2); + maxx = MAX(maxx,x1); + maxy = MAX(maxy,y1); + + X += cps[cy].setWidth * letterSpacing; + + } + } + + index++; + } + + myRect.x = minx; + myRect.y = miny; + myRect.width = maxx-minx; + myRect.height = maxy-miny; + + return myRect; +} + +//----------------------------------------------------------- +float ofTrueTypeFont::stringHeight(string c) { + ofRectangle rect = getStringBoundingBox(c, 0,0); + return rect.height; +} + +//===================================================================== +void ofTrueTypeFont::drawString(string c, float x, float y) { + + /*glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + texAtlas.draw(0,0);*/ + + if (!bLoadedOk){ + ofLog(OF_LOG_ERROR,"ofTrueTypeFont::drawString - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); + return; + } + + int index = 0; + float X = 0.0f; + float Y = 0.0f; + + bool alreadyBinded = binded; + + if(!alreadyBinded) bind(); + + int len = (int)c.length(); + + ofPushMatrix(); + ofTranslate(x, y); + + while(index < len){ + int cy = (unsigned char)c[index] - NUM_CHARACTER_TO_START; + if (cy < nCharacters){ // full char set or not? + if (c[index] == '\n') { + Y += lineHeight; + X = 0 ; //reset X Pos back to zero + }else if (c[index] == ' ') { + int cy = (int)'p' - NUM_CHARACTER_TO_START; + X += cps[cy].width * letterSpacing * spaceSize; + } else { + drawChar(cy, X, Y); + X += cps[cy].setWidth * letterSpacing; + } + } + index++; + } + + ofPopMatrix(); + + if(!alreadyBinded) unbind(); + +} + +//----------------------------------------------------------- +void ofTrueTypeFont::bind(){ + if(!binded){ + // we need transparency to draw text, but we don't know + // if that is set up in outside of this function + // we "pushAttrib", turn on alpha and "popAttrib" + // http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html + + // **** note **** + // I have read that pushAttrib() is slow, if used often, + // maybe there is a faster way to do this? + // ie, check if blending is enabled, etc... + // glIsEnabled().... glGet()... + // http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html + // ************** + // (a) record the current "alpha state, blend func, etc" + #ifndef TARGET_OPENGLES + glPushAttrib(GL_COLOR_BUFFER_BIT); + #else + blend_enabled = glIsEnabled(GL_BLEND); + texture_2d_enabled = glIsEnabled(GL_TEXTURE_2D); + glGetIntegerv( GL_BLEND_SRC, &blend_src ); + glGetIntegerv( GL_BLEND_DST, &blend_dst ); + #endif + + // (b) enable our regular ALPHA blending! + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + texAtlas.bind(); + stringQuads.clear(); + binded = true; + } +} + +//----------------------------------------------------------- +void ofTrueTypeFont::unbind(){ + if(binded){ + stringQuads.drawFaces(); + texAtlas.unbind(); + + #ifndef TARGET_OPENGLES + glPopAttrib(); + #else + if( !blend_enabled ) + glDisable(GL_BLEND); + if( !texture_2d_enabled ) + glDisable(GL_TEXTURE_2D); + glBlendFunc( blend_src, blend_dst ); + #endif + binded = false; + } +} + +//===================================================================== +void ofTrueTypeFont::drawStringAsShapes(string c, float x, float y) { + + if (!bLoadedOk){ + ofLog(OF_LOG_ERROR,"ofTrueTypeFont::drawStringAsShapes - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); + return; + }; + + //----------------------- error checking + if (!bMakeContours){ + ofLog(OF_LOG_ERROR,"ofTrueTypeFont::drawStringAsShapes - Error : contours not created for this font - call loadFont with makeContours set to true"); + return; + } + + int index = 0; + float X = 0.0f; + float Y = 0.0f; + + ofPushMatrix(); + ofTranslate(x, y); + int len = (int)c.length(); + + while(index < len){ + int cy = (unsigned char)c[index] - NUM_CHARACTER_TO_START; + if (cy < nCharacters){ // full char set or not? + if (c[index] == '\n') { + Y += lineHeight; + X = 0 ; //reset X Pos back to zero + }else if (c[index] == ' ') { + int cy = (int)'p' - NUM_CHARACTER_TO_START; + X += cps[cy].width; // * letterSpacing * spaceSize // TODO + //glTranslated(cps[cy].width, 0, 0); + } else { + drawCharAsShape(cy, X, Y); + X += cps[cy].setWidth; // * letterSpacing; // TODO + //glTranslated(cps[cy].setWidth, 0, 0); + } + } + index++; + } + + ofPopMatrix(); + +} + +//----------------------------------------------------------- +int ofTrueTypeFont::getNumCharacters() { + return nCharacters; +} + + diff --git a/junk/ofTrueTypeFont_.h b/junk/ofTrueTypeFont_.h new file mode 100644 index 0000000..88632cb --- /dev/null +++ b/junk/ofTrueTypeFont_.h @@ -0,0 +1,120 @@ +#pragma once + + +#include +#include "ofPoint.h" +#include "ofRectangle.h" +#include "ofConstants.h" +#include "ofPath.h" +#include "ofTexture.h" +#include "ofMesh.h" + +//-------------------------------------------------- +typedef struct { + int character; + int height; + int width; + int setWidth; + int topExtent; + int leftExtent; + float tW,tH; + float x1,x2,y1,y2; + float t1,t2,v1,v2; + +} charProps; + + +typedef ofPath ofTTFCharacter; + +//-------------------------------------------------- +#define NUM_CHARACTER_TO_START 33 // 0 - 32 are control characters, no graphics needed. + +class ofTrueTypeFont{ + +public: + + + ofTrueTypeFont(); + virtual ~ofTrueTypeFont(); + + //set the default dpi for all typefaces. + static void setGlobalDpi(int newDpi); + + // -- default (without dpi), non-full char set, anti aliased, 96 dpi: + bool loadFont(string filename, int fontsize, bool _bAntiAliased=true, bool _bFullCharacterSet=false, bool makeContours=false, float simplifyAmt=0.3, int dpi=0, bool forceAutoHinting=false); + + bool isLoaded(); + bool isAntiAliased(); + bool hasFullCharacterSet(); + + int getSize(); + float getLineHeight(); + void setLineHeight(float height); + float getLetterSpacing(); + void setLetterSpacing(float spacing); + float getSpaceSize(); + void setSpaceSize(float size); + float stringWidth(string s); + float stringHeight(string s); + + float charWidth(int c); + charProps getCharProp(int c); + + ofRectangle getStringBoundingBox(string s, float x, float y); + + void drawString(string s, float x, float y); + void drawStringAsShapes(string s, float x, float y); + + // get the num chars in the loaded char set + int getNumCharacters(); + + + ofTTFCharacter getCharacterAsPoints(int character); + vector getStringAsPoints(string str); + + void bind(); + void unbind(); + +protected: + bool bLoadedOk; + bool bAntiAliased; + bool bFullCharacterSet; + int nCharacters; + + vector charOutlines; + + float lineHeight; + float letterSpacing; + float spaceSize; + + vector cps; // properties for each character + int getCharPropertyIndex(int c); + + int fontSize; + bool bMakeContours; + + void drawChar(int c, float x, float y); + void drawCharAsShape(int c, float x, float y); + + int border;//, visibleBorder; + string filename; + + ofTexture texAtlas; + bool binded; + ofMesh stringQuads; + +private: +#ifdef TARGET_ANDROID + friend void ofUnloadAllFontTextures(); + friend void ofReloadAllFontTextures(); +#endif +#ifdef TARGET_OPENGLES + GLint blend_src, blend_dst; + GLboolean blend_enabled; + GLboolean texture_2d_enabled; +#endif + void unloadTextures(); + void reloadTextures(); +}; + + diff --git a/junk/ofxGuiColorData.cpp b/junk/ofxGuiColorData.cpp new file mode 100644 index 0000000..d8a8b09 --- /dev/null +++ b/junk/ofxGuiColorData.cpp @@ -0,0 +1,40 @@ +#include "ofxGuiColorData.h" + +//-------------------------------------------------------------- +ofxGuiColorData::ofxGuiColorData() { + +} + +//-------------------------------------------------------------- +ofxGuiColorData::ofxGuiColorData(ofColor _value) { + +} + +//-------------------------------------------------------------- +ofxGuiColorData::~ofxGuiColorData() { + +}; + +//-------------------------------------------------------------- +ofColor ofxGuiColorData::getValue(int index) { + return value; +} + +//-------------------------------------------------------------- +void setValue(ofColor _val) { + + value = _val; dataChanged(); + +} + +//-------------------------------------------------------------- +string toString() { + + string s; + s+= "A:" + ofToString((int)value.a) + " "; + s+= "R:" + ofToString((int)value.r) + " "; + s+= "G:" + ofToString((int)value.g) + " "; + s+= "B:" + ofToString((int)value.b); + + return s; +} diff --git a/junk/ofxGuiColorData.h b/junk/ofxGuiColorData.h new file mode 100644 index 0000000..7ae6740 --- /dev/null +++ b/junk/ofxGuiColorData.h @@ -0,0 +1,27 @@ +#pragma once + +#include "ofMain.h" +#include "ofxGuiData.h" + +class ofxGuiColorData : ofxGuiData { +public: + ofxGuiColorData() : value(ofColor(0)) {} + ofxGuiColorData(ofColor _value) : value(_value) {} + ~ofxGuiColorData() {}; + ofColor getValue() { return value; } + void setValue(ofColor _val) { value = _val; dataChanged();} + + string toString() { + + string s; + s+= "A:" + ofToString((int)value.a) + " "; + s+= "R:" + ofToString((int)value.r) + " "; + s+= "G:" + ofToString((int)value.g) + " "; + s+= "B:" + ofToString((int)value.b); + + return s; + } + +protected: + vector values; +}; diff --git a/junk/ofxGuiData.cpp b/junk/ofxGuiData.cpp new file mode 100644 index 0000000..9050610 --- /dev/null +++ b/junk/ofxGuiData.cpp @@ -0,0 +1,10 @@ +// +// ofxGuiData.cpp +// BasicExample +// +// Created by Christopher Baker on 1/9/12. +// Copyright (c) 2012 School of the Art Institute of Chicago. All rights reserved. +// + +#include "ofxGuiData.h" + diff --git a/junk/ofxGuiData.h b/junk/ofxGuiData.h new file mode 100644 index 0000000..3b3844d --- /dev/null +++ b/junk/ofxGuiData.h @@ -0,0 +1,25 @@ +// +// ofxGuiData.h +// BasicExample +// +// Created by Christopher Baker on 1/9/12. +// Copyright (c) 2012 School of the Art Institute of Chicago. All rights reserved. +// + + +#pragma once + +#include "ofMain.h" + +class ofxGuiData { +public: + ofxGuiData() {} + virtual ~ofxGuiData(); + + virtual int getNumValues() {}; + virtual void toString(int index) {}; + +protected: + virtual void dataChanged(int index) {}; + +}; \ No newline at end of file diff --git a/junk/ofxGuiDataTypes.h b/junk/ofxGuiDataTypes.h new file mode 100644 index 0000000..da7e07a --- /dev/null +++ b/junk/ofxGuiDataTypes.h @@ -0,0 +1,425 @@ +// +// ofxGuiDataTypes.h +// BasicExample +// +// Created by Christopher Baker on 7/21/11. +// Copyright 2011 School of the Art Institute of Chicago. All rights reserved. +// + +#pragma once + +//#include +#include "ofMain.h" + +// TODO: createa way to bind to variables? + + + + +/* + +class ofxGuiBoolData { +public: + ofxGuiBoolData() : value(true) {} + ofxGuiBoolData(bool _value) : value(_value) {} + ~ofxGuiBoolData() {}; + void toggleValue() {setValue(!value);} + bool getValue() { return value; } + void setValue(bool _val) { value = _val; dataChanged();} + + string toString() { + return value ? "TRUE" : "FALSE"; + } + +protected: + virtual void dataChanged() {}; + + bool value; +}; + + + + + + + +template +class ofxGuiData_ { +public: + + //-------------------------------------------------------------- + ofxGuiData_ () { + init(); + } + + //-------------------------------------------------------------- + ofxGuiData_ (DataType d) { + init(d); + } + + //-------------------------------------------------------------- + ~ofxGuiData_ () {}; + + //-------------------------------------------------------------- + DataType getValue() { + return quantize(value); // return the conditionally quantized value + } + + //-------------------------------------------------------------- + void setValue(DataType _val) { + if(value == _val) return; // short circuit if no change + DataType prevVal = value; + value = _val; + constrainValue(); + // only send data changed value IF ultimately there was a change + if(prevVal != value) { + dataChanged(); + } + } + + //-------------------------------------------------------------- + void setIncrementValue(DataType _incrementValue) { incrementValue = _incrementValue; } + + //-------------------------------------------------------------- + DataType getIncrementValue() { return incrementValue; } + + + //-------------------------------------------------------------- + void setMinValue(DataType _minValue) { + localRange.setMin(_minValue); + + + + // if the constrain process changes data, send a message + if(constrainValue()) dataChanged(); + } + + + //-------------------------------------------------------------- + void setMaxValue(DataType _maxValue) { + /* + maxValueSet=true; + + if(globalMaxValueSet) { + minValue = MAX(globalMinValue, _minValue); + } else { + setGlobalMinValue(_minValue); + minValue = _minValue; + } + // if the constrain process changes data, send a message + if(constrainValue()) dataChanged(); + if(globalMaxValueSet) { + //maxValue = quantize(_maxValue); + maxValue = MIN(globalMaxValue, maxValue); + } else { + maxValue = _maxValue; + setGlobalMaxValue(_maxValue); + } + + if(globalMinValueSet) { + + } else { + + } + + + maxValueSet=true; + + DataType oldValue = value; + value = ofClamp(value, minValue, maxValue); + if(value != oldValue) dataChanged(); + */ + } + + + + // local minima/maxima + //-------------------------------------------------------------- + DataType getMinValue() {return minValue;} + //-------------------------------------------------------------- + DataType getMaxValue() {return maxValue;} + //-------------------------------------------------------------- + bool isMinValueSet() {return minValueSet;} + //-------------------------------------------------------------- + void clearMinValue() {minValueSet = false;} + //-------------------------------------------------------------- + bool isMaxValueSet() {return maxValueSet;} + //-------------------------------------------------------------- + void clearMaxValue() {maxValueSet = false;} + + // global minima/maxima + //-------------------------------------------------------------- + DataType getGlobalMinValue() {return globalMinValue;} + //-------------------------------------------------------------- + DataType getGlobalMaxValue() {return globalMaxValue;} + //-------------------------------------------------------------- + bool isGlobalMinValueSet() {return globalMinValueSet;} + //-------------------------------------------------------------- + void clearGlobalMinValue() {globalMinValueSet = false;} + //-------------------------------------------------------------- + bool isGlobalMaxValueSet() {return globalMaxValueSet;} + //-------------------------------------------------------------- + void clearGlobalMaxValue() {globalMaxValueSet = false;} + + // setting global minima/maxima + //-------------------------------------------------------------- + void setGlobalMinValue(DataType _globalMinValue) { + globalMinValue = _globalMinValue; + globalMinValueSet = true; + + // check to see if it is greater than the current global max + if(isGlobalMaxValueSet()) { + globalMinValue = MIN(globalMinValue, globalMaxValue); + } + + // this will get set even if it is not enabled + if(minValue < globalMinValue) { + setMinValue(globalMinValue); + } + + // this will get set even if it is not enabled + if(maxValue < globalMinValue) { + setMaxValue(globalMinValue); + } + + // checkValue(); + } + + + //-------------------------------------------------------------- + void setGlobalMaxValue(DataType _globalMaxValue) { + globalMaxValue = _globalMaxValue; + globalMaxValueSet = true; + + if(isGlobalMinValueSet() && globalMaxValue < globalMinValue) { + globalMaxValue = globalMinValue; + } + + if(isMaxValueSet() && maxValue > globalMaxValue) { + setMaxValue(globalMaxValue); + } + + if(isMinValueSet() && minValue > globalMaxValue) { + setMinValue(globalMinValue); + } + + // checkValue(); + } + + + + + + + + + + + + + + + + + + + + + //-------------------------------------------------------------- + void setNormMinMax(float _minValue, float _maxValue) { + setNormMinValue(_minValue); + setNormMaxValue(_maxValue); + } + + //-------------------------------------------------------------- + void setNormMinValue(float n) { + setMinValue(normToGlobal(n)); + } + + //-------------------------------------------------------------- + void setNormMaxValue(float n) { + setMaxValue(normToGlobal(n)); + } + + //-------------------------------------------------------------- + DataType normToGlobal(float n) { + return (DataType)ofLerp(globalMinValue, globalMaxValue, n); + } + + + //-------------------------------------------------------------- + void setGlobalMinMax(DataType _globalMinValue, DataType _globalMaxValue) { + setGlobalMinValue(_globalMinValue); + setGlobalMaxValue(_globalMaxValue); + } + + //-------------------------------------------------------------- + void setMinMax(DataType _minValue, DataType _maxValue) { + setMinValue(_minValue); + setMaxValue(_maxValue); + } + + //-------------------------------------------------------------- + int getQuantizationSteps() { + return quantizeSteps; + }; + + //-------------------------------------------------------------- + void setQuantizatioSteps(int _quantizeSteps) { + if(_quantizeSteps < 0) { + setQuantize(false); + } else { + quantizeSteps = _quantizeSteps; + setQuantize(true); + } + } + + //-------------------------------------------------------------- + void setQuantize(bool _doQuantize) { + doQuantize = _doQuantize; + } + + //-------------------------------------------------------------- + void increaseValue() {add(incrementValue);} + //-------------------------------------------------------------- + void decreaseValue() {add(-incrementValue);} + + //-------------------------------------------------------------- + DataType getNormalizedMinValue() { + return ofNormalize(minValue, globalMinValue, globalMaxValue); + } + + //-------------------------------------------------------------- + DataType getNormalizedMaxValue() { + return ofNormalize(maxValue, globalMinValue, globalMaxValue); + } + + //-------------------------------------------------------------- + DataType getNormalizedValue() { + + if(globalMinValueSet && globalMaxValueSet) { + // will quantize in setValue + return ofNormalize(value, globalMinValue, globalMaxValue); + } else { + ofLog(OF_LOG_WARNING,"ofxGuiFloatData: getNormalizedValue() called, w/o global max or min values defined. Doing nothing. VALUE=%d (%d, %d)",value, globalMinValueSet, globalMaxValueSet); + return value; + } + } + + //-------------------------------------------------------------- + void setDisplayPrecision(int _displayPrecision) {displayPrecision = _displayPrecision;} + //-------------------------------------------------------------- + int getDisplayPrecision() {return displayPrecision;} + + //-------------------------------------------------------------- + string toString() { + return ofToString(getValue(),displayPrecision); + } + + //-------------------------------------------------------------- + void add(DataType f) { setValue(value + f); } + +protected: + + // returns true if data is changed + bool constrainValue() { + DataType prevValue = value; + // check against global max/min + if(globalMinValueSet) value = MAX(globalMinValue, value); + if(globalMaxValueSet) value = MIN(globalMaxValue, value); + // check against local max/min + if(minValueSet) value = MAX(minValue, value); + if(maxValueSet) value = MIN(maxValue, value); + // callback on change + return (prevValue != value); + } + + + + //-------------------------------------------------------------- + void init() { + init(0); + } + + //-------------------------------------------------------------- + void init(DataType d) { + value = d; + + minValue = 0; + maxValue = 0; + minValueSet = false; + maxValueSet = false; + + globalMinValue = 0; + globalMaxValue = 0; + globalMinValueSet = false; + globalMaxValueSet = false; + + quantizeSteps = 1024; + doQuantize = false; + + if(sizeof(DataType) == sizeof(float) || sizeof(DataType) == sizeof(double)) { + incrementValue = 0.01; + displayPrecision = 2; + } else { + incrementValue = 1; + displayPrecision = 0; + } + } + + //-------------------------------------------------------------- + virtual void dataChanged() {}; + + //-------------------------------------------------------------- + DataType quantize(DataType value) { + if(doQuantize && globalMinValueSet && globalMaxValueSet) { + int bucketNum = floor(ofClamp((getNormalizedValue() * quantizeSteps), 0, quantizeSteps-1)); + return ofMap(bucketNum, 0, quantizeSteps-1, globalMinValue, globalMaxValue); + } else { + return value; + } + } + + //-------------------------------------------------------------- + // for setting the value + void setValueFromNormalized(DataType normalizedPosition) { + if(globalMinValueSet && globalMaxValueSet) { + setValue(ofLerp(globalMinValue,globalMaxValue,normalizedPosition)); + } else { + ofLog(OF_LOG_WARNING,"ofxGuiFloatData: getNormalizedValue() called, w/o global max or min values defined. Doing nothing."); + } + } + + //-------------------------------------------------------------- + +private: + + // the value + DataType value; + + // the increment step + DataType incrementValue; + + + + // local minima and maxima for ranges + DataType minValue, maxValue; + bool minValueSet, maxValueSet; + + // global minima and maxima for ranges + DataType globalMinValue, globalMaxValue; + bool globalMinValueSet, globalMaxValueSet; + + + // quantization + int quantizeSteps; + bool doQuantize; + + // display precision + int displayPrecision; + +}; + +typedef ofxGuiData_ ofxGuiDataf; +typedef ofxGuiData_ ofxGuiDatai; + diff --git a/junk/ofxGuiLimitedRectangle.h b/junk/ofxGuiLimitedRectangle.h new file mode 100644 index 0000000..eef6d5d --- /dev/null +++ b/junk/ofxGuiLimitedRectangle.h @@ -0,0 +1,26 @@ +// +// ofxGuiLimitedRectangle.h +// BasicExample +// +// Created by Christopher P. Baker on 8/13/11. +// Copyright 2011 __MyCompanyName__. All rights reserved. +// + +#pragma once + +#include "ofMain.h" + + +class ofxGuiLimitedRectangle : private ofRectangle { + +public: + + +protected: + + +private: + + + +} diff --git a/junk/ofxGuiRectUtils.cpp b/junk/ofxGuiRectUtils.cpp new file mode 100644 index 0000000..59b60b8 --- /dev/null +++ b/junk/ofxGuiRectUtils.cpp @@ -0,0 +1,674 @@ +#include "ofxGuiRectUtils.h" + + +////-------------------------------------------------------------- +//ofRectangle ofxGuiRectUtils::intersection(const ofRectangle* r0, const ofRectangle* r1) { +// ofRectangle r(0,0,0,0); +// +// if(intersect(r0, r1)) { +// r.x = MAX(r0->x, r1->x); +// r.y = MAX(r0->y, r1->y); +// r.width = MIN(r0->x + r0->width, r1->x + r1->width); +// r.height = MIN(r0->y + r0->height, r1->y + r1->height); +// } +// +// return r; +//} +// +////-------------------------------------------------------------- +//bool ofxGuiRectUtils::contains(const ofRectangle* r0, const ofRectangle* r1) { +// return r1->x >= r0->x && r1->x + r1->width <= r0->x + r0->width && +// r1->y >= r0->y && r1->y + r1->height <= r0->y + r0->height; +// +//} +// +////-------------------------------------------------------------- +//bool ofxGuiRectUtils::intersect(const ofRectangle* r0, const ofRectangle* r1) { +// return r0->x < (r1->x + r1->width) && +// (r0->x + r0->width) > r1->x && +// r0->y < (r1->y + r1->height) && +// (r0->y + r0->height) > r1->y; +//} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::horzAlign(ofRectangle* rect, + ofxGuiAlign align, + const ofRectangle bb, + ofPoint rectAnchor) { + + switch(align) { + case ALIGN_NONE: + case ALIGN_BASELINE: + case ALIGN_TOP: + case ALIGN_BOTTOM: + case ALIGN_JUSTIFY_Y: + case ALIGN_CENTER_Y: + case ALIGN_JUSTIFY_X: + ofLog(OF_LOG_WARNING,"horzAlign: not horz align enum, ignoring"); + return; // not horizontal + case ALIGN_LEFT: + rect->x = bb.x - rectAnchor.x; + break; + case ALIGN_RIGHT: + rect->x = bb.x + bb.width - rectAnchor.x; + break; + case ALIGN_CENTER_X: + rect->x = bb.x + bb.width / 2.0f - rectAnchor.x; + break; + } +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::vertAlign(ofRectangle* rect, + ofxGuiAlign align, + const ofRectangle bb, + ofPoint rectAnchor) { + + switch(align) { + case ALIGN_NONE: + case ALIGN_BASELINE: + case ALIGN_JUSTIFY_Y: + case ALIGN_JUSTIFY_X: + case ALIGN_LEFT: + case ALIGN_RIGHT: + case ALIGN_CENTER_X: + ofLog(OF_LOG_WARNING,"vertAlign: not vert align enum, ignoring"); + return; // not horizontal + case ALIGN_TOP: + rect->y = bb.y - rectAnchor.y; + break; + case ALIGN_BOTTOM: + rect->y = bb.y + bb.height - rectAnchor.y; + break; + case ALIGN_CENTER_Y: + rect->y = bb.y + bb.height / 2.0f - rectAnchor.y; + break; + } +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::align(ofRectangle* rect, + ofxGuiAlign _hAlign, + ofxGuiAlign _vAlign, + const ofRectangle bb, + ofPoint rectAnchor) { + horzAlign(rect, _hAlign, bb, rectAnchor); + vertAlign(rect, _vAlign, bb, rectAnchor); +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::align(vector& rects, + ofxGuiAlign _objectAlign, + ofxGuiAlign _anchorAlign, + ofxGuiAlignTo _alignTo, + const ofRectangle bb) { + + ofxGuiRange _x, _y, _width, _height; + getExtrema(rects,_x,_y,_width,_height); + + float alignX = 0.0f; + float alignY = 0.0f; + + ofRectangle boundingBox = bb; + + switch(_alignTo) { + case ALIGN_TO_NONE: + ofLog(OF_LOG_WARNING,"ofGuiRectUtils::align : Attempting to align to nothing, but you gotta align to something, so assuming the anchor."); + case ALIGN_TO_ANCHOR: + alignX = bb.x; + alignY = bb.y; + case ALIGN_TO_SELECTION: + getBoundingBox(rects, boundingBox); + // now pass through to the next case b/c we have determined the bounding box + case ALIGN_TO_BOUNDING_BOX: + alignX = boundingBox.x; + alignY = boundingBox.y; + switch(_anchorAlign) { + case ALIGN_NONE: + ofLog(OF_LOG_WARNING,"ofGuiRectUtils::align : Attempting to align to nothing, but you gotta align to something, so assuming left."); + case ALIGN_LEFT: + case ALIGN_TOP: + // already took care of these two above + case ALIGN_JUSTIFY_X: + case ALIGN_JUSTIFY_Y: + case ALIGN_BASELINE: + break; + case ALIGN_CENTER_X: + alignX = boundingBox.x + (boundingBox.width / 2.0); + break; + case ALIGN_CENTER_Y: + alignY = boundingBox.y + (boundingBox.height / 2.0); + break; + case ALIGN_RIGHT: + alignX = boundingBox.x + boundingBox.width; + break; + case ALIGN_BOTTOM: + alignY = boundingBox.y + boundingBox.height; + break; + } + break; + } + + for(vector::iterator rr = rects.begin(); rr != rects.end(); ++rr) { + ofRectangle* r = *rr; // get the pointer + + switch(_objectAlign) { + // X ALIGN (HORZ) + case ALIGN_NONE: + ofLog(OF_LOG_WARNING,"ofGuiRectUtils::align : Attempting to align to nothing, but you gotta align to something, so assuming left."); + case ALIGN_LEFT: + case ALIGN_JUSTIFY_X: + r->x = alignX; + break; + case ALIGN_RIGHT: + r->x = alignX - r->width; + break; + case ALIGN_CENTER_X: + r->x = alignX - r->width / 2.0f; + break; + // Y ALIGN (VERT) + case ALIGN_TOP: + case ALIGN_JUSTIFY_Y: + case ALIGN_BASELINE: + r->y = alignY; + break; + case ALIGN_BOTTOM: + r->y = alignY - r->height; + break; + case ALIGN_CENTER_Y: + r->y = alignY - r->height / 2.0f; + break; + + } + } + + +} +//-------------------------------------------------------------- +void ofxGuiRectUtils::distribute(vector& rects, + ofxGuiAlign _objectAlign, + ofxGuiAlignTo _alignTo, + const ofRectangle bb) { + + if(rects.size() < 2) { + ofLog(OF_LOG_WARNING,"ofGuiRectUtils::distribute : Need more than one item to distribute"); + return; + } + + bool aligningHorizontally = isHorizontalAlignment(_objectAlign); + + // make sure the bounding box is useful + if(_alignTo == ALIGN_TO_BOUNDING_BOX && + ((aligningHorizontally && bb.width <= 0 ) || + (!aligningHorizontally && bb.height <= 0))) { + ofLog(OF_LOG_WARNING,"ofGuiRectUtils::distribute : Bounding box is of 0 width and/or height. Aligning to selection."); + _alignTo = ALIGN_TO_SELECTION; + } + + float totalRectSpan = 0; + ofRectangle boundingBox = bb; + vector sortedRectangles; + for(vector::iterator it = rects.begin(); it != rects.end(); ++it) { + sortedRectangles.push_back((*it)); + totalRectSpan += aligningHorizontally ? (*it)->width : (*it)->height; + } + + // sort rectangle pointers so we can sort them + // spatially while preserving the incoming vector + // order for layering, etc. + sortRectanglesByPosition(sortedRectangles, _objectAlign); + + switch(_alignTo) { + case ALIGN_TO_NONE: + case ALIGN_TO_ANCHOR: + /* + string mess = "ofGuiRectUtils::distribute : "; + mess += "??";//"ofxGuiGetAlignString(_alignTo); //TODO + mess += " ignored, aligning to slection."; + ofLog(OF_LOG_WARNING,mess); + */ + case ALIGN_TO_SELECTION: + // if we are aligning to the selection, then we have to make our own bounding box + // and then we pass through and use it. + getBoundingBox(rects, boundingBox); + case ALIGN_TO_BOUNDING_BOX: + + int numElements = sortedRectangles.size() - 1; + float currentPos = 0; + float totalSpan = 0; + float increment = 0; + + ofRectangle* firstRect = sortedRectangles.front(); + ofRectangle* lastRect = sortedRectangles.back(); + + // set the position of the first and last elements. + // when we cycle through the rest of the rects, + // we will calculate our spacing during the first rect + // and then we will ignore the very last rect, as we + // already set the position of first and last below. + if(aligningHorizontally) { + firstRect->x = boundingBox.x; + lastRect->x = boundingBox.x + boundingBox.width - lastRect->width; + } else { + firstRect->y = boundingBox.y; + lastRect->y = boundingBox.y + boundingBox.height - lastRect->height; + } + + + //int i = 0; + + // go through all squares, except the last + for(vector::iterator it = sortedRectangles.begin(); it != sortedRectangles.end(); ++it) { + ofRectangle* r = (*it); // get the pointer + + bool isFirst = (r == firstRect); // make a note to see if we are on the first element + + switch(_objectAlign) { + case ALIGN_NONE: // ALIGN_NONE will result in a left align + case ALIGN_LEFT: + + if(isFirst) { + totalSpan = lastRect->x - firstRect->x; + increment = totalSpan / numElements; + currentPos = r->x; + } else { + r->x = currentPos; + } + currentPos += increment; + break; + case ALIGN_RIGHT: + if(isFirst) { + totalSpan = (lastRect->x + lastRect->width) - (firstRect->x + firstRect->width); + increment = totalSpan / numElements; + currentPos = (firstRect->x + firstRect->width); + } else { + r->x = (currentPos - r->width); + } + currentPos += increment; + break; + case ALIGN_CENTER_X: + if(isFirst) { + totalSpan = (lastRect->x + lastRect->width / 2.0f) - (firstRect->x + firstRect->width / 2.0f); + increment = totalSpan / numElements; + currentPos = firstRect->x + (firstRect->width) / 2.0f; + } else { + r->x = (currentPos - r->width / 2.0f); + } + currentPos += increment; + break; + case ALIGN_JUSTIFY_X: + if(isFirst) { + totalRectSpan -= (firstRect->width + lastRect->width); + totalSpan = (lastRect->x) - (firstRect->x + firstRect->width) - totalRectSpan; + increment = totalSpan / numElements; + currentPos = firstRect->x; + } else { + r->x = currentPos; + } + currentPos += (r->width + increment); + break; + // vertical alignment + case ALIGN_TOP: + if(isFirst) { + totalSpan = lastRect->y - firstRect->y; + increment = totalSpan / numElements; + currentPos = r->y; + } else { + r->y = currentPos; + } + currentPos += increment; + break; + case ALIGN_BOTTOM: + if(isFirst) { + totalSpan = (lastRect->y + lastRect->height) - (firstRect->y + firstRect->height); + increment = totalSpan / numElements; + currentPos = (firstRect->y + firstRect->height); + } else { + r->y = (currentPos - r->height); + } + currentPos += increment; + break; + case ALIGN_BASELINE: // BASELINE ALIGN IS NOT IMPLEMENTED, BUT COULD BE, FOR NOW, IT IS + // LIKE ALIGNING TO THE CENTER Y POSITION. + case ALIGN_CENTER_Y: + if(isFirst) { + totalSpan = (lastRect->y + lastRect->height / 2.0f) - (firstRect->y + firstRect->height / 2.0f); + increment = totalSpan / numElements; + currentPos = firstRect->y + (firstRect->height) / 2.0f; + } else { + r->y = (currentPos - r->height / 2); + } + currentPos += increment; + break; + case ALIGN_JUSTIFY_Y: + if(isFirst) { + totalRectSpan -= (firstRect->height + lastRect->height); + totalSpan = (lastRect->y) - (firstRect->y + firstRect->height) - totalRectSpan; + increment = totalSpan / numElements; + currentPos = firstRect->y; + } else { + r->y = (currentPos); + } + currentPos += (r->height + increment); + break; + } + + } + } +} +//-------------------------------------------------------------- +// like distribute, but doesn't rely on the max and min places to fit +void ofxGuiRectUtils::stack(vector& rects, + ofxGuiAlign selfAlign, + ofxGuiAlign hGroupAlign, + ofxGuiAlign vGroupAlign, + float spacing, + ofPoint anchor, + bool reverseStackOrder) { + + ofRectangle bb = ofRectangle(anchor,0,0); + + bool isSelfAlignHorizontal = !isHorizontalAlignment(selfAlign); // opposite + + // self align the rects + ofxGuiRectUtils::align(rects,selfAlign,ALIGN_LEFT,ALIGN_TO_BOUNDING_BOX,bb); + + int numElements = rects.size() - 1; + float currentPos = 0; + float totalSpan = 0; + float increment = 0; + + if(isSelfAlignHorizontal) { + currentPos = anchor.x; + } else { + currentPos = anchor.y; + } + + // make a local copy that is ordered in reverse + vector selected = rects; + if(reverseStackOrder) { + reverse(selected.begin(), selected.end()); + } + + for(vector::iterator it = selected.begin(); it != selected.end(); ++it) { + ofRectangle* r = (*it); // get the pointer + + if(isSelfAlignHorizontal) { + r->x = currentPos; + increment = r->width + spacing; + currentPos += increment; + } else { + r->y = currentPos; + increment = r->height + spacing; + currentPos += increment; + } + } + + // now do group alignment + ofRectangle groupBox; + getBoundingBox(selected, groupBox); + + // do final vert and horz group adjustments and short circuit if needed + for(vector::iterator it = selected.begin(); it != selected.end(); ++it) { + ofRectangle* r = (*it); // get the pointer + + // move everything to a common + // vAlign TOP, hAlign LEFT situation + if(selfAlign == ALIGN_BOTTOM) { + r->y += groupBox.height; + } else if(selfAlign == ALIGN_RIGHT) { + r->x += groupBox.width; + } else if(selfAlign == ALIGN_CENTER_X) { + r->x += groupBox.width / 2.0f; + } else if(selfAlign == ALIGN_CENTER_Y) { + r->y += groupBox.height / 2.0f; + } + + // now make group corrections + if(hGroupAlign == ALIGN_RIGHT) { + r->x -= groupBox.width; + } else if(hGroupAlign == ALIGN_CENTER_X) { + r->x -= groupBox.width / 2.0f; + } + + if(vGroupAlign == ALIGN_TOP) { + r->y -= groupBox.height; + } else if(vGroupAlign == ALIGN_CENTER_Y) { + r->y -= groupBox.height / 2.0f; + } + } +} + + +//-------------------------------------------------------------- +void ofxGuiRectUtils::wrap(vector& rects, + ofRectangle& boundingBox, + float horizontalSpace, + float verticalSpace, + ofxGuiAlign hAlign, + ofxGuiAlign vLineAlign, + float lineHeight) { + + // a grid of rects. each inner rect group represents a "line" + vector< vector > rows; + vector* currentLineRef; + + bool firstTime = true; + float currentX = 0; + float currentY = 0; + + // first pass is to go through and make lines of the appropriate length + for(vector::iterator it = rects.begin(); it != rects.end(); ++it) { + ofRectangle* r = (*it); // get the pointer + + if(firstTime || (currentX + r->width) > boundingBox.width) { + if(firstTime) { + firstTime = false; + } else { + cout << "\tNUM COLS=" << currentLineRef->size() << endl; + } + + + + vector newLine; + rows.push_back(newLine); + currentLineRef = &newLine; + + } + + currentLineRef->push_back(r); + currentX += (r->width + horizontalSpace); + } + + + cout << "NUM ROWS=" << rows.size() << endl; + + // second pass horizontal alignment + + + // third pass vertical alignment + + +} +/* +//-------------------------------------------------------------- +void ofxGuiRectUtils::tile(vector& rects, ofRectangle& boundingBox) { +} + */ +//-------------------------------------------------------------- +void ofxGuiRectUtils::cascade(vector& rects, ofRectangle& boundingBox, ofPoint offset) { + + float currentX = boundingBox.x; + float currentY = boundingBox.y; + + int currentRow = 0; + int currentColumn = 0; + + for(vector::iterator it = rects.begin(); it != rects.end(); ++it) { + ofRectangle* r = (*it); // get the pointer + + if((currentY + r->height) > (boundingBox.y + boundingBox.height)) { + // new row, new column + currentColumn++; + currentX = currentColumn * offset.x + boundingBox.x; + currentRow = 0;//++; + currentY = boundingBox.y;// = currentRow * offset.y + boundingBox.y; + } + + r->x = currentX; + r->y = currentY; + + currentX += offset.x; + currentY += offset.y; + + } + +} +//-------------------------------------------------------------- +void ofxGuiRectUtils::getExtrema(vector& rects, ofxGuiRange& _x, ofxGuiRange& _y, ofxGuiRange& _width, ofxGuiRange& _height) { + // set to min + _x.invertExtrema(); + _y.invertExtrema(); + _width.invertExtrema(); + _height.invertExtrema(); + + for(vector::iterator it = rects.begin(); it != rects.end(); ++it) { + _x.expandToFit((*it)->x); + _y.expandToFit((*it)->y); + _width.expandToFit((*it)->width); + _height.expandToFit((*it)->height); + } +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::getBoundingBox(vector& rects, ofRectangle& boundingBox) { + ofxGuiRange _x, _y; + _x.invertExtrema(); // this sets MIN to abs max + _y.invertExtrema(); // this sets MAX to abs min + + for(vector::iterator it = rects.begin(); it != rects.end(); ++it) { + _x.expandToFit((*it)->x); + _y.expandToFit((*it)->y); + _x.expandToFit((*it)->x + (*it)->width); + _y.expandToFit((*it)->y + (*it)->height); + } + + boundingBox.x = _x.getMin(); + boundingBox.y = _y.getMin(); + boundingBox.width = _x.getMax() -_x.getMin(); + boundingBox.height = _y.getMax() -_y.getMin(); +} + + +//-------------------------------------------------------------- +void ofxGuiRectUtils::selectRectangles(vector& toTest, vector& selected, const ofRectangle boundingBox, bool enclosed) { + selected.clear(); + for(vector::iterator it = toTest.begin(); it != toTest.end(); ++it) { + if(enclosed) { + if(boundingBox.inside(*(*it))) { + selected.push_back((*it)); + } + } else { + if(boundingBox.intersects(*(*it))) { + selected.push_back(*it); + } + } + } +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::selectRectangles(vector& toTest, vector& selected, ofPoint pnt, bool findAll) { + selected.clear(); + for(vector::iterator it = toTest.begin(); it != toTest.end(); ++it) { + if((*it)->inside(pnt)) { + selected.push_back((*it)); + if(!findAll) break; + } + } +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::sortRectanglesByPosition(vector& rects, + ofxGuiAlign _align) { + + switch(_align) { + case ALIGN_NONE: + // ALIGN is interpreted by + // HORIZONTAL ALIGNMENTS + case ALIGN_LEFT: + sort(rects.begin(), rects.end(), sortByLeftBorders); + break; + case ALIGN_RIGHT: + sort(rects.begin(), rects.end(), sortByRightBorders); + break; + case ALIGN_JUSTIFY_X: + case ALIGN_CENTER_X: + sort(rects.begin(), rects.end(), sortByHorizontalCenters); + break; + // VERTICAL ALIGNMENTS + case ALIGN_BASELINE: + case ALIGN_TOP: + sort(rects.begin(), rects.end(), sortByTopBorders); + break; + case ALIGN_BOTTOM: + sort(rects.begin(), rects.end(), sortByBottomBorders); + break; + case ALIGN_JUSTIFY_Y: + case ALIGN_CENTER_Y: + sort(rects.begin(), rects.end(), sortByVerticalCenters); + break; + } +} + + +//-------------------------------------------------------------- +void ofxGuiRectUtils::sortRectanglesByWidth(vector& rects) { + sort(rects.begin(), rects.end(), sortByWidths); +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::sortRectanglesByHeight(vector& rects) { + sort(rects.begin(), rects.end(), sortByHeights); +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::sortRectanglesByArea(vector& rects) { + sort(rects.begin(), rects.end(), sortByArea); +} + +//-------------------------------------------------------------- +void ofxGuiRectUtils::sortRectanglesByPerimieter(vector& rects) { + sort(rects.begin(), rects.end(), sortByPerimeter); +} + +//-------------------------------------------------------------- +string ofxGuiRectUtils::toString(ofRectangle* rect) { + string s = ""; + s += ofToString(rect->x) + ", " + ofToString(rect->y) + " | "; + s += ofToString(rect->width) + ", " + ofToString(rect->height); + return s; +} + +//-------------------------------------------------------------- +bool ofxGuiRectUtils::isHorizontalAlignment(ofxGuiAlign align) { + switch(align) { + case ALIGN_NONE: + case ALIGN_LEFT: + case ALIGN_RIGHT: + case ALIGN_JUSTIFY_X: + case ALIGN_CENTER_X: + return true; + case ALIGN_BASELINE: + case ALIGN_TOP: + case ALIGN_BOTTOM: + case ALIGN_JUSTIFY_Y: + case ALIGN_CENTER_Y: + return false; + } + +} + + + + + diff --git a/junk/ofxGuiRectUtils.h b/junk/ofxGuiRectUtils.h new file mode 100644 index 0000000..9966426 --- /dev/null +++ b/junk/ofxGuiRectUtils.h @@ -0,0 +1,146 @@ +// +// ofxGuiRectUtils.h +// BasicExample +// +// Created by Christopher Baker on 1/16/12. +// Copyright (c) 2012 School of the Art Institute of Chicago. All rights reserved. +// + +#pragma once + +#include "ofMain.h" +#include "ofxGuiConstants.h" +#include "ofxGuiRange.h" + +class ofxGuiRectUtils { +public: + // alignment and distribution + + // utilities for rectangles + +// static ofRectangle intersection(const ofRectangle* rect0, +// const ofRectangle* rect1); +// +// static bool intersect(const ofRectangle* rect0, +// const ofRectangle* rect1); +// +// static bool contains(const ofRectangle* r0, +// const ofRectangle* r1); + + + // utilities for alignment and distribution + + static void vertAlign(ofRectangle* rect, + ofxGuiAlign align, + const ofRectangle bb, + ofPoint rectAnchor = ofPoint(0,0)); + + static void horzAlign(ofRectangle* rect, + ofxGuiAlign align, + const ofRectangle bb, + ofPoint rectAnchor = ofPoint(0,0)); + + + static void align(ofRectangle* rect, + ofxGuiAlign _hAlign, + ofxGuiAlign _vAlign, + const ofRectangle bb, + ofPoint rectAnchor = ofPoint(0,0)); + + static void align(vector& rects, + ofxGuiAlign _objectAlign = ALIGN_LEFT, + ofxGuiAlign _anchorAlign = ALIGN_LEFT, + ofxGuiAlignTo _alignTo = ALIGN_TO_SELECTION, + const ofRectangle bb = ofRectangle(0,0,0,0)); + + static void distribute(vector& rects, + ofxGuiAlign _objectAlign = ALIGN_LEFT, + ofxGuiAlignTo _alignTo = ALIGN_TO_SELECTION, + const ofRectangle bb = ofRectangle(0,0,0,0)); + + // utilities for stacking and flowing + static void stack(vector& rects, + ofxGuiAlign selfAlign = ALIGN_LEFT, + ofxGuiAlign hGroupAlign = ALIGN_LEFT, + ofxGuiAlign vGroupAlign = ALIGN_TOP, + float spacing = 0, + ofPoint anchor = ofPoint(0,0), + bool reverseStackOrder = false); + + + static void wrap(vector& rects, + ofRectangle& boundingBox, + float horizontalSpace = 0, + float verticalSpace = 0, + ofxGuiAlign hAlign = ALIGN_LEFT, + ofxGuiAlign vLineAlign = ALIGN_TOP, + float lineHeight = 0); + + /* + static void tile(vector& rects, + ofRectangle& boundingBox); + */ + + static void cascade(vector& rects, + ofRectangle& boundingBox, + ofPoint offset = ofPoint(25,50)); + + /* + // TODO: + // https://github.com/jakesgordon/bin-packing/ + + static void pack(vector& rects, + ofRectangle& boundingBox); + */ + + // statistical utilities + static void getExtrema(vector& rects, + ofxGuiRange& _x, + ofxGuiRange& _y, + ofxGuiRange& _width, + ofxGuiRange& _height); + + static void getBoundingBox(vector& rects, + ofRectangle& boundingBox); + + + static void selectRectangles(vector& toTest, + vector& selected, + const ofRectangle boundingBox, + bool enclosed=true); + + static void selectRectangles(vector& toTest, + vector& selected, + const ofPoint pnt, + bool findAll = false); + + // sorting + static void sortRectanglesByPosition(vector& rects, + ofxGuiAlign _align = ALIGN_LEFT); + static void sortRectanglesByWidth(vector& rects); + static void sortRectanglesByHeight(vector& rects); + static void sortRectanglesByArea(vector& rects); + static void sortRectanglesByPerimieter(vector& rects); + + // utils + static string toString(ofRectangle*); + + + +protected: + + static bool isHorizontalAlignment(ofxGuiAlign align); + + static bool sortByLeftBorders( ofRectangle* r0, ofRectangle* r1) { return (r0->x ) < (r1->x ); } + static bool sortByTopBorders( ofRectangle* r0, ofRectangle* r1) { return (r0->y ) < (r1->y ); } + static bool sortByRightBorders( ofRectangle* r0, ofRectangle* r1) { return (r0->x + r0->width ) < (r1->x + r1->width ); } + static bool sortByBottomBorders( ofRectangle* r0, ofRectangle* r1) { return (r0->y + r0->height) < (r1->y + r1->height); } + static bool sortByHorizontalCenters(ofRectangle* r0, ofRectangle* r1) { return (r0->x ) < (r1->x ); } + static bool sortByVerticalCenters( ofRectangle* r0, ofRectangle* r1) { return (r0->y ) < (r1->y ); } + static bool sortByWidths( ofRectangle* r0, ofRectangle* r1) { return (r0->width ) < (r1->width ); } + static bool sortByHeights( ofRectangle* r0, ofRectangle* r1) { return (r0->height ) < (r1->height ); } + static bool sortByArea( ofRectangle* r0, ofRectangle* r1) { return (r0->width*r0->height) < (r1->width*r1->height); } + static bool sortByPerimeter( ofRectangle* r0, ofRectangle* r1) { return (2*(r0->width+r0->height)) < (2*(r1->width+r1->height)); } + +}; + diff --git a/junk/ofxGuiRectangle.cpp b/junk/ofxGuiRectangle.cpp new file mode 100644 index 0000000..e4639c1 --- /dev/null +++ b/junk/ofxGuiRectangle.cpp @@ -0,0 +1,9 @@ +// +// ofxGuiRectangle.cpp +// BasicExample +// +// Created by Christopher Baker on 1/16/12. +// Copyright (c) 2012 School of the Art Institute of Chicago. All rights reserved. +// + +#include "ofxGuiRectangle.h" \ No newline at end of file diff --git a/junk/ofxGuiRectangle.h b/junk/ofxGuiRectangle.h new file mode 100644 index 0000000..56fd068 --- /dev/null +++ b/junk/ofxGuiRectangle.h @@ -0,0 +1,31 @@ +// +// ofxGuiRectangle.h +// BasicExample +// +// Created by Christopher Baker on 1/16/12. +// Copyright (c) 2012 School of the Art Institute of Chicago. All rights reserved. +// + +#pragma once + +#include "ofMain.h" + +class ofxGuiRectangle : ofRectangle { + +public: + ofxGuiRectangle (); + ofxGuiRectangle (ofxGuiRectangle const & r); + virtual ~ofxGuiRectangle (); + void set (ofxGuiRectangle const & rect); + + float getX(); + float getY(); + float getWidth(); + float getHeight(); + + void setX(float _x); + void setY(float _y); + + ofPoint getCorner(int i = 0); // clock-wise from Northwest + +}; \ No newline at end of file diff --git a/junk/ofxGuiTextArea.cpp b/junk/ofxGuiTextArea.cpp new file mode 100644 index 0000000..0681d82 --- /dev/null +++ b/junk/ofxGuiTextArea.cpp @@ -0,0 +1,331 @@ +// +// ofxGuiLabel.cpp +// emptyExample +// +// Created by Christopher Baker on 7/11/11. +// Copyright 2011 Kitchen Budapest. All rights reserved. +// + +#include "ofxGuiLabel.h" + + +//-------------------------------------------------------------- +ofxGuiLabel::ofxGuiLabel(const string& _name, + int _x, + int _y, + int _width, + int _height, + bool _enabled) : + ofxGuiObject(_name, + _x, + _y, + _width, + _height, + _enabled) { + init(); +} +//-------------------------------------------------------------- +ofxGuiLabel::ofxGuiLabel(const string& _name, + int _x, + int _y, + bool _enabled) : + ofxGuiObject(_name, + _x, + _y, + _enabled) { + init(); +} + +ofxGuiLabel::ofxGuiLabel(const string& _name, + bool _enabled) : + ofxGuiObject(_name, + _enabled) { + init(); +} + +ofxGuiLabel::ofxGuiLabel(bool _enabled) : + ofxGuiObject(_enabled) { + init(); +} + +//-------------------------------------------------------------- +ofxGuiLabel::~ofxGuiLabel() { + +} + +//-------------------------------------------------------------- +void ofxGuiLabel::init() { + + setObjectType("LABEL"); + + displayText = name; + pDisplayText = name; + + text = name; + pText = name; + + setBoxProperties(defaults->labelBoxProperties); + + setFontSize(SIZE_SMALL); // chooses the font + + capsStyle = LABEL_CAPS_NONE; + + if(text.empty()) { + hide(); + } + + cursorPosition = 0.0f; + widthAtCursor = 0.0f; + + setOrientation(OF_ORIENTATION_DEFAULT); + + //cout << "\t\tLABEL CALLING SET NEEDS FROM LABEL INIT " << getName() << endl; + + lineBreakMode = LINE_BREAK_MODE_TAIL_TRUNCATION; + truncationString = "..."; + + isMultiline = false; + + requestBoxLayout(); +} + + +//-------------------------------------------------------------- +void ofxGuiLabel::draw() { + + ofPushStyle(); + ofPushMatrix(); + { + if(!displayText.empty()) { + ofSetColor(cText.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + + ofPushMatrix(); + // TODO: add support for various text alignments + ofRectangle drawOffsets = displayStringBoundingBox; + + switch(orientation) { + case OF_ORIENTATION_UNKNOWN: // if unknown, use default + case OF_ORIENTATION_DEFAULT: + ofTranslate(0, labelFont->getSize()); + break; + case OF_ORIENTATION_180: + ofTranslate(displayStringBoundingBox.width, getContentBoxHeight() - labelFont->getSize()); + ofRotateZ(180); + break; + case OF_ORIENTATION_90_RIGHT: + ofTranslate(0,0); + ofRotateZ(90); + break; + case OF_ORIENTATION_90_LEFT: + // TODO: this is off in the Y direction ... not sure why. + ofTranslate(labelFont->getSize(), + getContentBoxHeight()); + ofRotateZ(-90); + break; + } + + + + labelFont->drawString(displayText,drawOffsets.x,drawOffsets.y); + ofPopMatrix(); + } + + } + ofPopMatrix(); + ofPopStyle(); + +} + +//-------------------------------------------------------------- +void ofxGuiLabel::setText(string _text) { + text = _text; + requestBoxLayout(); +} + +//-------------------------------------------------------------- +string ofxGuiLabel::getText() { + return text; +} + +//-------------------------------------------------------------- +string ofxGuiLabel::getDisplayText() { + return displayText; +} + +//-------------------------------------------------------------- +void ofxGuiLabel::setFontSize(ofxGuiSize _labelSize) { + labelSize = _labelSize; + labelFont = defaults->getFont(_labelSize); + requestBoxLayout(); +} + +//-------------------------------------------------------------- +ofxGuiSize ofxGuiLabel::getFontSize() { + return labelSize; +} + + +//-------------------------------------------------------------- +void ofxGuiLabel::setCapsStyle(int _capsStyle) { + capsStyle = _capsStyle; + requestBoxLayout(); +} + +//-------------------------------------------------------------- +int ofxGuiLabel::getCapsStyle() const { + return capsStyle; +} + +//-------------------------------------------------------------- +void ofxGuiLabel::setLineBreakMode(int _lineBreakMode) { + lineBreakMode = _lineBreakMode; + requestBoxLayout(); +} + +//-------------------------------------------------------------- +int ofxGuiLabel::getLineBreakMode() const { + return lineBreakMode; +} + +//-------------------------------------------------------------- +void ofxGuiLabel::setTruncationString(const string& _truncationString) { + truncationString = _truncationString; + requestBoxLayout(); +} + +//-------------------------------------------------------------- +string ofxGuiLabel::getTruncationString() const { + return truncationString; +} + +//-------------------------------------------------------------- +bool ofxGuiLabel::empty() const { + return text.empty(); +} + +//-------------------------------------------------------------- +void ofxGuiLabel::doContentBoxLayout() { + + displayText = text; + + // get the bounding box of an unmodified string + fullStringBoundingBox = labelFont->getStringBoundingBox(text, 0,0); + + switch (capsStyle) { + case LABEL_CAPS_NONE: + break; + case LABEL_CAPS_UPPER: + toUpperInPlace(displayText); + break; + case LABEL_CAPS_LOWER: + toLowerInPlace(displayText); + break; + default: + // do nothing + break; + } + + if(lineBreakMode != LINE_BREAK_MODE_WORD_NONE && isFixedWidth()) { + + // TODO + // TODO, this CAN depend on alignent as well + switch (lineBreakMode) { + case LINE_BREAK_MODE_WORD_NONE: + case LINE_BREAK_MODE_WORD_WRAP: + case LINE_BREAK_MODE_CHARACTER_WRAP: + case LINE_BREAK_MODE_CLIP: + case LINE_BREAK_MODE_HEAD_TRUNCATION: + case LINE_BREAK_MODE_TAIL_TRUNCATION: + case LINE_BREAK_MODE_MIDDLE_TRUNCATION: + break; + } + + string testString = displayText; + } + + displayStringBoundingBox = labelFont->getStringBoundingBox(displayText,0,0); + + + + //cout << "display text rect for (displayText)=>" << displayText << "<| " << ofxGuiRectUtils::toString(&displayTextRect) << endl; + + + switch(orientation) { + case OF_ORIENTATION_UNKNOWN: // if unknown, use default + case OF_ORIENTATION_DEFAULT: + case OF_ORIENTATION_180: + //cout << labelFont ->getSize() << endl; + // place anchor on upper left corner + displayStringBoundingBox.x = 0;// + displayStringBoundingBox.y = 0;//y += displayTextRect.height; + break; + case OF_ORIENTATION_90_RIGHT: + case OF_ORIENTATION_90_LEFT: + float tmp = displayStringBoundingBox.width; + displayStringBoundingBox.width = displayStringBoundingBox.height; + displayStringBoundingBox.height = tmp; + displayStringBoundingBox.y = 0; + break; + } + + + //cout << "display text rect: " << ofxGuiRectUtils::toString(&displayTextRect) << endl; + + setContentBoxWidth(displayStringBoundingBox.width); // should always be 0,0 + setContentBoxHeight(displayStringBoundingBox.height); // should always be 0,0 + setHitBox(getContentBox()); // the whole thing + + //TODO PARENT NEEDS LAYOUT UPDATE WHEN LABEL PROPOERTIES ARE SET DURING SETUP + //setParentNeedsLayoutUpdate(true); +} + +//-------------------------------------------------------------- +void breakLines(const ofxGuiLabelLineBreakMode& lineBreakMode, + const ofxGuiAlign& hAlign, + const ofxGuiAlign& vAlign, + string& s, + const string& truncationString, + float targetWidth, + float targetHeight, + int maxLines) { + // does nothing yet. + // ideally it should be a part of the truetype font class + // just returns the oritginal string. + // but will do amazing things one day. +} + +//-------------------------------------------------------------- +void ofxGuiLabel::breakSingleLine(const ofxGuiLabelLineBreakMode& lineBreakMode, + string& s, + const string& truncationString, + float targetWidth, + int& truncationIndex) { +// does nothing yet. +// just returns the oritginal string. +// but will do amazing things one day. + +// there is probably a smart way to find the breaks quickly +// (rather than cycling through the entire string) +// http://www.fredosaurus.com/notes-cpp/algorithms/searching/binarysearch.html +} + +//-------------------------------------------------------------- +void ofxGuiLabel::buildFromXml() +{ + //props->mListener->handleGui(mParamId, kofxGui_Set_Bool, &value, sizeof(bool)); +} + +//-------------------------------------------------------------- +void ofxGuiLabel::saveToXml() +{ + //int id = saveObjectData(); + //bool value = (buttonType == TYPE_TRIGGER) ? false : (value == true); + + //props->mXml.setValue("OBJECT:VALUE", value, id); +} + + + + + + diff --git a/junk/ofxGuiTextArea.h b/junk/ofxGuiTextArea.h new file mode 100644 index 0000000..1ba78c2 --- /dev/null +++ b/junk/ofxGuiTextArea.h @@ -0,0 +1,173 @@ +// +// ofxGuiLabel.h +// emptyExample +// +// Created by Christopher Baker on 7/11/11. +// Copyright 2011 Kitchen Budapest. All rights reserved. +// + +#pragma once + +#include "ofxGuiObject.h" +#include + +using Poco::toUpper; +using Poco::toLower; +using Poco::toUpperInPlace; +using Poco::toLowerInPlace; + + +//enum ofxGuiLabelCaps { +// LABEL_CAPS_NONE = 0, +// LABEL_CAPS_UPPER = 1, +// LABEL_CAPS_LOWER = 2 +// // small small caps? :) +//}; +// +//// mirrors ios +//enum ofxGuiLabelLineBreakMode { +// LINE_BREAK_MODE_WORD_NONE = 0, +// LINE_BREAK_MODE_WORD_WRAP, +// LINE_BREAK_MODE_CHARACTER_WRAP, +// LINE_BREAK_MODE_CLIP, +// LINE_BREAK_MODE_HEAD_TRUNCATION, +// LINE_BREAK_MODE_TAIL_TRUNCATION, +// LINE_BREAK_MODE_MIDDLE_TRUNCATION +//}; + + +class ofxGuiLabel : public ofxGuiObject { +public: + + ofxGuiLabel(const string& _name, int _x, int _y, int _width, int _height, bool _enabled = true); + ofxGuiLabel(const string& _name, int _x, int _y, bool _enabled = true); + ofxGuiLabel(const string& _name, bool _enabled = true); + ofxGuiLabel(bool _enabled = true); + virtual ~ofxGuiLabel(); + + //-------------------------------------------------------------- + // INHERITED FROM SUPERCLASS /////////////////////////////////// + //-------------------------------------------------------------- + void draw(); + + //-------------------------------------------------------------- + // PERSISTENCE ///////////////////////////////////////////////// + //-------------------------------------------------------------- + + void buildFromXml(); + void saveToXml(); + + //-------------------------------------------------------------- + // GETTERS AND SETTERS ///////////////////////////////////////// + //-------------------------------------------------------------- + + void setText(const string& text); + string getText() const; + + string getDisplayText() const; + + void setFontSize(const ofxGuiSize& _fontSize); + ofxGuiSize getFontSize() const; + + void setCapsStyle(int _capsStyle); + int getCapsStyle() const; + + void setLineBreakMode(int _lineBreakMode); + int getLineBreakMode() const; + + void setTruncationString(const string& _truncationString) const; + string getTruncationString() const; + + + bool empty() const; + + /* + float getWidth(); + float getHeight(); + */ +// int getCursorPosition() const { +// +// ofVec2f p; +// if(isCustomHitBox()) { +// +// p = screenToHitBox(mousePosition); +// cout << "NAME=>" << name << endl; +// if(hasParent()) { +// cout << "PARENT NAME =" << getParent()->getName() << endl; +// } else { +// cout << "NO PARENT" << endl; +// } +// cout << "customHitBox" << getHitBoxOffset().x << "/" << getHitBoxOffset().y << ":" << getHitBoxWidth() << "/" << getHitBoxHeight() << endl; +// } else { +// p = screenToContentBox(mousePosition); +// cout << "NONcustomHitBox" << getHitBoxOffset().x << "/" << getHitBoxOffset().y << ":" << getHitBoxWidth() << "/" << getHitBoxHeight() << endl; +// } +// +// cout << p.x << "X=" << x << ">><<" << width << endl; +// +// float width = 0.0f; +// for(int i = displayText.size(); i >= 0; i--) { +// width = labelFont->stringWidth(displayText.substr(0,i)); +// if( p.x >= width ) { +// cursorPosition = i; +// widthAtCursor = width; +// break; +// } +// } +// return cursorPosition; +// } + + +protected: + + void init(); + + //-------------------------------------------------------------- + // INHERITED FROM SUPERCLASS /////////////////////////////////// + //-------------------------------------------------------------- + + void doContentBoxLayout(); + + //-------------------------------------------------------------- + // VARIABLES /////////////////////////////////////////////////// + //-------------------------------------------------------------- + + int cursorPosition; + float widthAtCursor; + + ofxGuiLabelCaps capsStyle; + + string text; // the label text + string pText; // the previous label text + string displayText; // the actual adjusted string for display + string pDisplayText; // previous displayString (for undos?) + + ofRectangle fullStringBoundingBox; + ofRectangle displayStringBoundingBox; + + ofTrueTypeFont* labelFont; + ofxGuiSize labelSize; + +// ofxGuiLabelLineBreakMode lineBreakMode; + int lineBreakMode; + + string truncationString; + + bool isMultiline; + + void breakLines(const ofxGuiLabelLineBreakMode& lineBreakMode, + const ofxGuiAlign& hAlign, + const ofxGuiAlign& vAlign, + string& s, + const string& truncationString, + float targetWidth, + float targetHeight, + int maxLines = numeric_limits::max()); + + void breakSingleLine(const ofxGuiLabelLineBreakMode lineBreakMode, + string& s, + const string& truncationString, + float targetWidth, + int& truncationIndex); + +}; \ No newline at end of file diff --git a/junk/ofxGuiTextField.cpp b/junk/ofxGuiTextField.cpp new file mode 100644 index 0000000..dbe0724 --- /dev/null +++ b/junk/ofxGuiTextField.cpp @@ -0,0 +1,331 @@ +// +// ofxGuiLabel.cpp +// emptyExample +// +// Created by Christopher Baker on 7/11/11. +// Copyright 2011 Kitchen Budapest. All rights reserved. +// + +#include "ofxGuiLabel.h" + + +//-------------------------------------------------------------- +ofxGuiLabel::ofxGuiLabel(string _name, + int _x, + int _y, + int _width, + int _height, + bool _enabled) : + ofxGuiObject(_name, + _x, + _y, + _width, + _height, + _enabled) { + init(); +} +//-------------------------------------------------------------- +ofxGuiLabel::ofxGuiLabel(string _name, + int _x, + int _y, + bool _enabled) : + ofxGuiObject(_name, + _x, + _y, + _enabled) { + init(); +} + +ofxGuiLabel::ofxGuiLabel(string _name, + bool _enabled) : + ofxGuiObject(_name, + _enabled) { + init(); +} + +ofxGuiLabel::ofxGuiLabel(bool _enabled) : + ofxGuiObject(_enabled) { + init(); +} + +//-------------------------------------------------------------- +ofxGuiLabel::~ofxGuiLabel() { + +} + +//-------------------------------------------------------------- +void ofxGuiLabel::init() { + + setObjectType("LABEL"); + + displayText = name; + pDisplayText = name; + + text = name; + pText = name; + + setBoxProperties(defaults->labelBoxProperties); + + setFontSize(SIZE_SMALL); // chooses the font + + capsStyle = LABEL_CAPS_NONE; + + if(text.empty()) { + hide(); + } + + cursorPosition = 0.0f; + widthAtCursor = 0.0f; + + setOrientation(OF_ORIENTATION_DEFAULT); + + //cout << "\t\tLABEL CALLING SET NEEDS FROM LABEL INIT " << getName() << endl; + + lineBreakMode = LINE_BREAK_MODE_TAIL_TRUNCATION; + truncationString = "..."; + + isMultiline = false; + + requestBoxLayout(); +} + + +//-------------------------------------------------------------- +void ofxGuiLabel::draw() { + + ofPushStyle(); + ofPushMatrix(); + { + if(!displayText.empty()) { + ofSetColor(cText.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + + ofPushMatrix(); + // TODO: add support for various text alignments + ofRectangle drawOffsets = displayStringBoundingBox; + + switch(orientation) { + case OF_ORIENTATION_UNKNOWN: // if unknown, use default + case OF_ORIENTATION_DEFAULT: + ofTranslate(0, labelFont->getSize()); + break; + case OF_ORIENTATION_180: + ofTranslate(displayStringBoundingBox.width, getContentBoxHeight() - labelFont->getSize()); + ofRotateZ(180); + break; + case OF_ORIENTATION_90_RIGHT: + ofTranslate(0,0); + ofRotateZ(90); + break; + case OF_ORIENTATION_90_LEFT: + // TODO: this is off in the Y direction ... not sure why. + ofTranslate(labelFont->getSize(), + getContentBoxHeight()); + ofRotateZ(-90); + break; + } + + + + labelFont->drawString(displayText,drawOffsets.x,drawOffsets.y); + ofPopMatrix(); + } + + } + ofPopMatrix(); + ofPopStyle(); + +} + +//-------------------------------------------------------------- +void ofxGuiLabel::setText(string _text) { + text = _text; + requestBoxLayout(); +} + +//-------------------------------------------------------------- +string ofxGuiLabel::getText() { + return text; +} + +//-------------------------------------------------------------- +string ofxGuiLabel::getDisplayText() { + return displayText; +} + +//-------------------------------------------------------------- +void ofxGuiLabel::setFontSize(ofxGuiSize _labelSize) { + labelSize = _labelSize; + labelFont = defaults->getFont(_labelSize); + requestBoxLayout(); +} + +//-------------------------------------------------------------- +ofxGuiSize ofxGuiLabel::getFontSize() { + return labelSize; +} + + +//-------------------------------------------------------------- +void ofxGuiLabel::setCapsStyle(const ofxGuiLabelCaps& _capsStyle) { + capsStyle = _capsStyle; + requestBoxLayout(); +} + +//-------------------------------------------------------------- +ofxGuiLabelCaps ofxGuiLabel::getCapsStyle() const { + return capsStyle; +} + +//-------------------------------------------------------------- +void ofxGuiLabel::setLineBreakMode(const ofxGuiLabelLineBreakMode& _lineBreakMode) { + lineBreakMode = _lineBreakMode; + requestBoxLayout(); +} + +//-------------------------------------------------------------- +ofxGuiLabelLineBreakMode ofxGuiLabel::getLineBreakMode() const { + return lineBreakMode; +} + +//-------------------------------------------------------------- +void ofxGuiLabel::setTruncationString(string _truncationString) { + truncationString = _truncationString; + requestBoxLayout(); +} + +//-------------------------------------------------------------- +string ofxGuiLabel::getTruncationString() { + return truncationString; +} + +//-------------------------------------------------------------- +bool ofxGuiLabel::empty() { + return text.empty(); +} + +//-------------------------------------------------------------- +void ofxGuiLabel::doContentBoxLayout() { + + displayText = text; + + // get the bounding box of an unmodified string + fullStringBoundingBox = labelFont->getStringBoundingBox(text, 0,0); + + switch (capsStyle) { + case LABEL_CAPS_NONE: + break; + case LABEL_CAPS_UPPER: + toUpperInPlace(displayText); + break; + case LABEL_CAPS_LOWER: + toLowerInPlace(displayText); + break; + default: + // do nothing + break; + } + + if(lineBreakMode != LINE_BREAK_MODE_WORD_NONE && isFixedWidth()) { + + // TODO + // TODO, this CAN depend on alignent as well + switch (lineBreakMode) { + case LINE_BREAK_MODE_WORD_NONE: + case LINE_BREAK_MODE_WORD_WRAP: + case LINE_BREAK_MODE_CHARACTER_WRAP: + case LINE_BREAK_MODE_CLIP: + case LINE_BREAK_MODE_HEAD_TRUNCATION: + case LINE_BREAK_MODE_TAIL_TRUNCATION: + case LINE_BREAK_MODE_MIDDLE_TRUNCATION: + break; + } + + string testString = displayText; + } + + displayStringBoundingBox = labelFont->getStringBoundingBox(displayText,0,0); + + + + //cout << "display text rect for (displayText)=>" << displayText << "<| " << ofxGuiRectUtils::toString(&displayTextRect) << endl; + + + switch(orientation) { + case OF_ORIENTATION_UNKNOWN: // if unknown, use default + case OF_ORIENTATION_DEFAULT: + case OF_ORIENTATION_180: + //cout << labelFont ->getSize() << endl; + // place anchor on upper left corner + displayStringBoundingBox.x = 0;// + displayStringBoundingBox.y = 0;//y += displayTextRect.height; + break; + case OF_ORIENTATION_90_RIGHT: + case OF_ORIENTATION_90_LEFT: + float tmp = displayStringBoundingBox.width; + displayStringBoundingBox.width = displayStringBoundingBox.height; + displayStringBoundingBox.height = tmp; + displayStringBoundingBox.y = 0; + break; + } + + + //cout << "display text rect: " << ofxGuiRectUtils::toString(&displayTextRect) << endl; + + setContentBoxWidth(displayStringBoundingBox.width); // should always be 0,0 + setContentBoxHeight(displayStringBoundingBox.height); // should always be 0,0 + setHitBox(getContentBox()); // the whole thing + + //TODO PARENT NEEDS LAYOUT UPDATE WHEN LABEL PROPOERTIES ARE SET DURING SETUP + //setParentNeedsLayoutUpdate(true); +} + +//-------------------------------------------------------------- +void breakLines(const ofxGuiLabelLineBreakMode lineBreakMode, + const ofxGuiAlign hAlign, + const ofxGuiAlign vAlign, + string& s, + const string truncationString, + float targetWidth, + float targetHeight, + int maxLines) { + // does nothing yet. + // ideally it should be a part of the truetype font class + // just returns the oritginal string. + // but will do amazing things one day. +} + +//-------------------------------------------------------------- +void ofxGuiLabel::breakSingleLine(const ofxGuiLabelLineBreakMode lineBreakMode, + string& s, + const string truncationString, + float targetWidth, + int& truncationIndex) { +// does nothing yet. +// just returns the oritginal string. +// but will do amazing things one day. + +// there is probably a smart way to find the breaks quickly +// (rather than cycling through the entire string) +// http://www.fredosaurus.com/notes-cpp/algorithms/searching/binarysearch.html +} + +//-------------------------------------------------------------- +void ofxGuiLabel::buildFromXml() +{ + //props->mListener->handleGui(mParamId, kofxGui_Set_Bool, &value, sizeof(bool)); +} + +//-------------------------------------------------------------- +void ofxGuiLabel::saveToXml() +{ + //int id = saveObjectData(); + //bool value = (buttonType == TYPE_TRIGGER) ? false : (value == true); + + //props->mXml.setValue("OBJECT:VALUE", value, id); +} + + + + + + diff --git a/junk/ofxGuiTextField.h b/junk/ofxGuiTextField.h new file mode 100644 index 0000000..9c90e5f --- /dev/null +++ b/junk/ofxGuiTextField.h @@ -0,0 +1,170 @@ +// +// ofxGuiLabel.h +// emptyExample +// +// Created by Christopher Baker on 7/11/11. +// Copyright 2011 Kitchen Budapest. All rights reserved. +// + +#pragma once + +#include "ofxGuiObject.h" +#include + +using Poco::toUpper; +using Poco::toLower; +using Poco::toUpperInPlace; +using Poco::toLowerInPlace; + +enum ofxGuiLabelCaps { + LABEL_CAPS_NONE = 0, + LABEL_CAPS_UPPER = 1, + LABEL_CAPS_LOWER = 2 + // small small caps? :) +}; + +// mirrors ios +enum ofxGuiLabelLineBreakMode { + LINE_BREAK_MODE_WORD_NONE = 0, + LINE_BREAK_MODE_WORD_WRAP, + LINE_BREAK_MODE_CHARACTER_WRAP, + LINE_BREAK_MODE_CLIP, + LINE_BREAK_MODE_HEAD_TRUNCATION, + LINE_BREAK_MODE_TAIL_TRUNCATION, + LINE_BREAK_MODE_MIDDLE_TRUNCATION +}; + +class ofxGuiLabel : public ofxGuiObject { +public: + + ofxGuiLabel(string _name, int _x, int _y, int _width, int _height, bool _enabled = true); + ofxGuiLabel(string _name, int _x, int _y, bool _enabled = true); + ofxGuiLabel(string _name, bool _enabled = true); + ofxGuiLabel(bool _enabled = true); + virtual ~ofxGuiLabel(); + + //-------------------------------------------------------------- + // INHERITED FROM SUPERCLASS /////////////////////////////////// + //-------------------------------------------------------------- + void draw(); + + //-------------------------------------------------------------- + // PERSISTENCE ///////////////////////////////////////////////// + //-------------------------------------------------------------- + + void buildFromXml(); + void saveToXml(); + + //-------------------------------------------------------------- + // GETTERS AND SETTERS ///////////////////////////////////////// + //-------------------------------------------------------------- + + void setText(string text); + string getText(); + + string getDisplayText(); + + void setFontSize(ofxGuiSize _fontSize); + ofxGuiSize getFontSize(); + + void setCapsStyle(ofxGuiLabelCaps _capsStyle); + ofxGuiLabelCaps getCapsStyle(); + + void setLineBreakMode(ofxGuiLabelLineBreakMode _lineBreakMode); + ofxGuiLabelLineBreakMode getLineBreakMode(); + + void setTruncationString(string _truncationString); + string getTruncationString(); + + + bool empty(); + + /* + float getWidth(); + float getHeight(); + */ + int getCursorPosition() { + + ofVec2f p; + if(isCustomHitBox()) { + + p = screenToHitBox(mousePosition); + cout << "NAME=>" << name << endl; + if(hasParent()) { + cout << "PARENT NAME =" << getParent()->getName() << endl; + } else { + cout << "NO PARENT" << endl; + } + cout << "customHitBox" << getHitBoxOffset().x << "/" << getHitBoxOffset().y << ":" << getHitBoxWidth() << "/" << getHitBoxHeight() << endl; + } else { + p = screenToContentBox(mousePosition); + cout << "NONcustomHitBox" << getHitBoxOffset().x << "/" << getHitBoxOffset().y << ":" << getHitBoxWidth() << "/" << getHitBoxHeight() << endl; + } + + cout << p.x << "X=" << x << ">><<" << width << endl; + + float width = 0.0f; + for(int i = displayText.size(); i >= 0; i--) { + width = labelFont->stringWidth(displayText.substr(0,i)); + if( p.x >= width ) { + cursorPosition = i; + widthAtCursor = width; + break; + } + } + return cursorPosition; + } + + +protected: + + void init(); + + //-------------------------------------------------------------- + // INHERITED FROM SUPERCLASS /////////////////////////////////// + //-------------------------------------------------------------- + + void doContentBoxLayout(); + + //-------------------------------------------------------------- + // VARIABLES /////////////////////////////////////////////////// + //-------------------------------------------------------------- + + int cursorPosition; + float widthAtCursor; + + ofxGuiLabelCaps capsStyle; + + string text; // the label text + string pText; // the previous label text + string displayText; // the actual adjusted string for display + string pDisplayText; // previous displayString (for undos?) + + ofRectangle fullStringBoundingBox; + ofRectangle displayStringBoundingBox; + + ofTrueTypeFont* labelFont; + ofxGuiSize labelSize; + + ofxGuiLabelLineBreakMode lineBreakMode; + + string truncationString; + + bool isMultiline; + + void breakLines(const ofxGuiLabelLineBreakMode lineBreakMode, + const ofxGuiAlign hAlign, + const ofxGuiAlign vAlign, + string& s, + const string truncationString, + float targetWidth, + float targetHeight, + int maxLines = numeric_limits::max()); + + void breakSingleLine(const ofxGuiLabelLineBreakMode lineBreakMode, + string& s, + const string truncationString, + float targetWidth, + int& truncationIndex); + +}; \ No newline at end of file diff --git a/src/defaults/ofxMuiDefaults.cpp b/src/defaults/ofxMuiDefaults.cpp index 4f2156e..3ebe43a 100644 --- a/src/defaults/ofxMuiDefaults.cpp +++ b/src/defaults/ofxMuiDefaults.cpp @@ -24,6 +24,7 @@ #include "ofxMuiDefaults.h" + static int ofxMuiDebugIndentLevel = 0; // handy colors @@ -113,70 +114,101 @@ void ofxMuiDefaults::initShared() { // sharedLabelBoxProperties // sharedLabelCleanBoxProperties - hitBoxProperties = ofxMuiBoxProperties(0); - - boxProperties = ofxMuiBoxProperties(2,2,2,2, - 4,4,4,4, - 2,2,2,2); - - - sharedLabelBoxProperties = boxProperties; - - sharedLabelCleanBoxProperties = ofxMuiBoxProperties(3,3,3,3, - 1,1,1,1, - 0,0,0,0); - - valueLabelBoxProperties = ofxMuiBoxProperties(4,4,4,4, - 4,4,4,4, - 0,0,0,0); - - // default colors - cBox = ofxMuiColor(ofColor(255,0,0,50));//,ALPHA_OFF)); - //cBox = ofxMuiColor(ofColor(255,ALPHA_OFF)); - - //cBorder = ofxMuiColor(COLOR_MEDIUM_GRAY); - cBorder = ofxMuiColor(ofColor(255,0,0,200)); + if(layoutDebug) { + hitBoxProperties = ofxMuiBoxProperties(10,15,20); + + boxProperties = ofxMuiBoxProperties(10,15,20); + + + sharedLabelBoxProperties = boxProperties; + + sharedLabelCleanBoxProperties = ofxMuiBoxProperties(10); + + valueLabelBoxProperties = ofxMuiBoxProperties(10); + } else { + hitBoxProperties = ofxMuiBoxProperties(0); + + boxProperties = ofxMuiBoxProperties(2,2,2,2, + 4,4,4,4, + 2,2,2,2); + + + sharedLabelBoxProperties = boxProperties; + + sharedLabelCleanBoxProperties = ofxMuiBoxProperties(3,3,3,3, + 1,1,1,1, + 0,0,0,0); + + valueLabelBoxProperties = ofxMuiBoxProperties(4,4,4,4, + 4,4,4,4, + 0,0,0,0); + } - //cPadding = ofxMuiColor(DEFAULT_COLOR_NORMAL); - cPadding = ofxMuiColor(DEFAULT_COLOR_NORMAL); + if(layoutDebug) { + // default colors + cBox = ofxMuiColor(ofColor(255,0,0)); + cBorder = ofxMuiColor(ofColor(0,255,0)); + cPadding = ofxMuiColor(ofColor(0,0,255)); + cContent = ofxMuiColor(ofColor(255,255,0)); + cHit = ofxMuiColor(ofColor(255,0,255)); + + cText = ofxMuiColor(ofColor(0,255,255)); + + cShadow = ofxMuiColor(ofColor(255,127)); + + cActiveAreaForeground = ofxMuiColor(ofColor(127,127,0)); + cActiveAreaBackground = ofxMuiColor(ofColor(127,0,127)); + cActiveAreaFrame = ofxMuiColor(ofColor(0,127,255)); - // cContent = ofxMuiColor(ofColor(COLOR_BLACK,ALPHA_OFF)); - cContent = ofxMuiColor(ofColor(255,ALPHA_OFF)); - - cHit = ofxMuiColor(ofColor(255,ALPHA_OFF)); - - cText = ofxMuiColor(COLOR_WHITE, - COLOR_WHITE, // hover - COLOR_WHITE, // active - DEFAULT_COLOR_DISABLED // disabled - ); - - cShadow = ofxMuiColor(DEFAULT_COLOR_NORMAL, // normal - DEFAULT_COLOR_NORMAL, // hover - DEFAULT_COLOR_NORMAL, // active - DEFAULT_COLOR_DISABLED // disabled - ); - - cActiveAreaForeground = ofxMuiColor(COLOR_YELLOW); - cActiveAreaBackground = ofxMuiColor(COLOR_MEDIUM_BLUE); - cActiveAreaFrame = ofxMuiColor(COLOR_LIGHT_BLUE); - - /* - cActiveAreaForeground = ofxMuiColor(COLOR_MEDIUM_BLUE, // normal - COLOR_LIGHT_BLUE, // hover - COLOR_LIGHT_RED, // active - DEFAULT_COLOR_DISABLED // disabled - ); - - cActiveAreaBackground = ofxMuiColor(COLOR_MEDIUM_GRAY); - - cActiveAreaFrame = ofxMuiColor(COLOR_MEDIUM_GRAY, // normal - COLOR_MEDIUM_BLUE, // hover - COLOR_LIGHT_BLUE, // active - DEFAULT_COLOR_DISABLED // disabled - ); - */ - + } else { + + // default colors + cBox = ofxMuiColor(ofColor(255,0,0,50));//,ALPHA_OFF)); + //cBox = ofxMuiColor(ofColor(255,ALPHA_OFF)); + + //cBorder = ofxMuiColor(COLOR_MEDIUM_GRAY); + cBorder = ofxMuiColor(ofColor(255,0,0,200)); + + //cPadding = ofxMuiColor(DEFAULT_COLOR_NORMAL); + cPadding = ofxMuiColor(DEFAULT_COLOR_NORMAL); + + // cContent = ofxMuiColor(ofColor(COLOR_BLACK,ALPHA_OFF)); + cContent = ofxMuiColor(ofColor(255,ALPHA_OFF)); + + cHit = ofxMuiColor(ofColor(255,ALPHA_OFF)); + + cText = ofxMuiColor(COLOR_WHITE, + COLOR_WHITE, // hover + COLOR_WHITE, // active + DEFAULT_COLOR_DISABLED // disabled + ); + + cShadow = ofxMuiColor(DEFAULT_COLOR_NORMAL, // normal + DEFAULT_COLOR_NORMAL, // hover + DEFAULT_COLOR_NORMAL, // active + DEFAULT_COLOR_DISABLED // disabled + ); + + cActiveAreaForeground = ofxMuiColor(COLOR_YELLOW); + cActiveAreaBackground = ofxMuiColor(COLOR_MEDIUM_BLUE); + cActiveAreaFrame = ofxMuiColor(COLOR_LIGHT_BLUE); + + /* + cActiveAreaForeground = ofxMuiColor(COLOR_MEDIUM_BLUE, // normal + COLOR_LIGHT_BLUE, // hover + COLOR_LIGHT_RED, // active + DEFAULT_COLOR_DISABLED // disabled + ); + + cActiveAreaBackground = ofxMuiColor(COLOR_MEDIUM_GRAY); + + cActiveAreaFrame = ofxMuiColor(COLOR_MEDIUM_GRAY, // normal + COLOR_MEDIUM_BLUE, // hover + COLOR_LIGHT_BLUE, // active + DEFAULT_COLOR_DISABLED // disabled + ); + */ + } doShadow = false; shadowOffset = ofVec2f(2,2); alphaScale = 1.0; @@ -330,8 +362,6 @@ void ofxMuiDefaults::initFonts() { string largeFontFile = fontsDir + "Lucida Grande.ttf"; string xLargeFontFile = fontsDir + "Lucida Grande.ttf"; string xxLargeFontFile = fontsDir + "Lucida Grande.ttf"; - - //cout << smallFontFile << endl; @@ -346,67 +376,68 @@ void ofxMuiDefaults::initFonts() { cCurrentPath[sizeof(cCurrentPath) - 1] = '\0'; /* not really required */ - ofxMuiFont::Settings settings; - - settings.bAntiAliased = false; - settings.bForceAutoHinting = true; - settings.bUseKerning = true; - - settings.fontFilename = xxSmallFontFile; - settings.fontSize = 6; - - if(!xxSmallFont.loadFont(settings)) - ofLogError("ofxMuiDefaults::initFonts(): failed to load xxSmallFontFile="+xxSmallFontFile); - - settings.fontFilename = xSmallFontFile; - settings.fontSize = 8; - settings.bAntiAliased = false; - settings.bForceAutoHinting = true; - - if(!xSmallFont.loadFont(settings)) - ofLogError("ofxMuiDefaults::initFonts(): failed to load xSmallFontFile="+xSmallFontFile); - - settings.fontFilename = smallFontFile; - settings.fontSize = 10; - settings.bAntiAliased = false; - settings.bForceAutoHinting = true; - - if(!smallFont.loadFont(settings)) - ofLogError("ofxMuiDefaults::initFonts(): failed to load smallFontFile="+smallFontFile); - //smallFont.loadFont(smallFontFile,6,true,true); - - settings.fontFilename = mediumFontFile; - settings.fontSize = 12; - settings.bAntiAliased = false; - settings.bForceAutoHinting = true; - - if(!mediumFont.loadFont(settings)) - ofLogError("ofxMuiDefaults::initFonts(): failed to load mediumFontFile="+mediumFontFile); - - settings.fontFilename = largeFontFile; - settings.fontSize = 14; - settings.bAntiAliased = true; - settings.bForceAutoHinting = false; - - if(!largeFont.loadFont(settings)) - ofLogError("ofxMuiDefaults::initFonts(): failed to load largeFontFile="+largeFontFile); - - settings.fontFilename = xLargeFontFile; - settings.fontSize = 16; - settings.bAntiAliased = true; - settings.bForceAutoHinting = false; - - if(!xLargeFont.loadFont(settings)) - ofLogError("ofxMuiDefaults::initFonts(): failed to load xLargeFontFile="+xLargeFontFile); - - settings.fontFilename = xxLargeFontFile; - settings.fontSize = 20; - settings.bAntiAliased = true; - settings.bForceAutoHinting = false; - - if(!xxLargeFont.loadFont(settings)) - ofLogError("ofxMuiDefaults::initFonts(): failed to load xxLargeFontFile="+xxLargeFontFile); - } +// ofxMuiFont::Settings settings; +// +// settings.bAntiAliased = false; +// settings.bForceAutoHinting = true; +// settings.bUseKerning = true; +// +// settings.fontFilename = xxSmallFontFile; +// settings.fontSize = 6; +// +// if(!xxSmallFont.loadFont(settings)) +// ofLogError("ofxMuiDefaults::initFonts(): failed to load xxSmallFontFile="+xxSmallFontFile); +// +// settings.fontFilename = xSmallFontFile; +// settings.fontSize = 8; +// settings.bAntiAliased = false; +// settings.bForceAutoHinting = true; +// +// if(!xSmallFont.loadFont(settings)) +// ofLogError("ofxMuiDefaults::initFonts(): failed to load xSmallFontFile="+xSmallFontFile); +// +// settings.fontFilename = smallFontFile; +// settings.fontSize = 10; +// settings.bAntiAliased = false; +// settings.bForceAutoHinting = true; +// +// if(!smallFont.loadFont(settings)) +// ofLogError("ofxMuiDefaults::initFonts(): failed to load smallFontFile="+smallFontFile); +// //smallFont.loadFont(smallFontFile,6,true,true); +// +// settings.fontFilename = mediumFontFile; +// settings.fontSize = 12; +// settings.bAntiAliased = false; +// settings.bForceAutoHinting = true; +// +// if(!mediumFont.loadFont(settings)) +// ofLogError("ofxMuiDefaults::initFonts(): failed to load mediumFontFile="+mediumFontFile); +// +// settings.fontFilename = largeFontFile; +// settings.fontSize = 14; +// settings.bAntiAliased = true; +// settings.bForceAutoHinting = false; +// +// if(!largeFont.loadFont(settings)) +// ofLogError("ofxMuiDefaults::initFonts(): failed to load largeFontFile="+largeFontFile); +// +// settings.fontFilename = xLargeFontFile; +// settings.fontSize = 16; +// settings.bAntiAliased = true; +// settings.bForceAutoHinting = false; +// +// if(!xLargeFont.loadFont(settings)) +// ofLogError("ofxMuiDefaults::initFonts(): failed to load xLargeFontFile="+xLargeFontFile); +// +// settings.fontFilename = xxLargeFontFile; +// settings.fontSize = 20; +// settings.bAntiAliased = true; +// settings.bForceAutoHinting = false; +// +// if(!xxLargeFont.loadFont(settings)) +// ofLogError("ofxMuiDefaults::initFonts(): failed to load xxLargeFontFile="+xxLargeFontFile); +// +} //-------------------------------------------------------------- void ofxMuiDefaults::initIcons() { @@ -414,12 +445,11 @@ void ofxMuiDefaults::initIcons() { loadCustomIcon(ICON_X, iconsDir+"close.gif", iconsDir+"blank.gif"); loadCustomIcon(ICON_PLUSMINUS, iconsDir+"add.gif", iconsDir+"subtract.gif"); loadCustomIcon(ICON_CHECK, iconsDir+"check.gif", iconsDir+"blank.gif"); - loadCustomIcon(ICON_TARGET, iconsDir+"target.gif", iconsDir+"blank.gif"); + loadCustomIcon(ICON_TARGET, iconsDir+"target.gif", iconsDir+"blank.gif"); } - //-------------------------------------------------------------- -ofxMuiTrueTypeFont* ofxMuiDefaults::getFont(ofxMuiSize fontSize) { +ofxMuiFont* ofxMuiDefaults::getFont(ofxMuiSize fontSize) { switch(fontSize) { case SIZE_XXSMALL: return getXXSmallFont(); @@ -439,31 +469,31 @@ ofxMuiTrueTypeFont* ofxMuiDefaults::getFont(ofxMuiSize fontSize) { } } //-------------------------------------------------------------- -ofxMuiTrueTypeFont* ofxMuiDefaults::getXXSmallFont() { +ofxMuiFont* ofxMuiDefaults::getXXSmallFont() { return &xxSmallFont; } //-------------------------------------------------------------- -ofxMuiTrueTypeFont* ofxMuiDefaults::getXSmallFont() { +ofxMuiFont* ofxMuiDefaults::getXSmallFont() { return &xSmallFont; } //-------------------------------------------------------------- -ofxMuiTrueTypeFont* ofxMuiDefaults::getSmallFont() { +ofxMuiFont* ofxMuiDefaults::getSmallFont() { return &smallFont; } //-------------------------------------------------------------- -ofxMuiTrueTypeFont* ofxMuiDefaults::getMediumFont() { +ofxMuiFont* ofxMuiDefaults::getMediumFont() { return &mediumFont; } //-------------------------------------------------------------- -ofxMuiTrueTypeFont* ofxMuiDefaults::getLargeFont() { +ofxMuiFont* ofxMuiDefaults::getLargeFont() { return &largeFont; } //-------------------------------------------------------------- -ofxMuiTrueTypeFont* ofxMuiDefaults::getXLargeFont() { +ofxMuiFont* ofxMuiDefaults::getXLargeFont() { return &xLargeFont; } //-------------------------------------------------------------- -ofxMuiTrueTypeFont* ofxMuiDefaults::getXXLargeFont() { +ofxMuiFont* ofxMuiDefaults::getXXLargeFont() { return &xxLargeFont; } diff --git a/src/defaults/ofxMuiDefaults.h b/src/defaults/ofxMuiDefaults.h index 703c3f7..a9208bd 100644 --- a/src/defaults/ofxMuiDefaults.h +++ b/src/defaults/ofxMuiDefaults.h @@ -25,11 +25,12 @@ #pragma once #include "ofMain.h" +#include "ofxMuiFont.h" #include "ofxMuiConstants.h" #include "ofxMuiColor.h" #include "ofxMuiIcon.h" #include "ofxMuiBoxProperties.h" -#include "ofxMuiTrueTypeFont.h" + // The goal of this class is to provide an easy way for people to // set their own skins / default values for the gui. It uses a standard @@ -90,14 +91,14 @@ class ofxMuiDefaults { // FONTS - ofxMuiTrueTypeFont* getFont(ofxMuiSize fontSize); - ofxMuiTrueTypeFont* getXXSmallFont(); - ofxMuiTrueTypeFont* getXSmallFont(); - ofxMuiTrueTypeFont* getSmallFont(); - ofxMuiTrueTypeFont* getMediumFont(); - ofxMuiTrueTypeFont* getLargeFont(); - ofxMuiTrueTypeFont* getXLargeFont(); - ofxMuiTrueTypeFont* getXXLargeFont(); + ofxMuiFont* getFont(ofxMuiSize fontSize); + ofxMuiFont* getXXSmallFont(); + ofxMuiFont* getXSmallFont(); + ofxMuiFont* getSmallFont(); + ofxMuiFont* getMediumFont(); + ofxMuiFont* getLargeFont(); + ofxMuiFont* getXLargeFont(); + ofxMuiFont* getXXLargeFont(); // SHARED ofxMuiBoxProperties sharedLabelBoxProperties; @@ -215,13 +216,13 @@ class ofxMuiDefaults { } // FONTS - ofxMuiTrueTypeFont xxSmallFont; - ofxMuiTrueTypeFont xSmallFont; - ofxMuiTrueTypeFont smallFont; - ofxMuiTrueTypeFont mediumFont; - ofxMuiTrueTypeFont largeFont; - ofxMuiTrueTypeFont xLargeFont; - ofxMuiTrueTypeFont xxLargeFont; + ofxMuiFont xxSmallFont; + ofxMuiFont xSmallFont; + ofxMuiFont smallFont; + ofxMuiFont mediumFont; + ofxMuiFont largeFont; + ofxMuiFont xLargeFont; + ofxMuiFont xxLargeFont; private: diff --git a/src/helpers/ofxMuiFont.cpp b/src/helpers/ofxMuiFont.cpp deleted file mode 100644 index 9b8cdbd..0000000 --- a/src/helpers/ofxMuiFont.cpp +++ /dev/null @@ -1,1424 +0,0 @@ -/*============================================================================== - - Copyright (c) 2009-2012 Christopher Baker - - 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 "ofxMuiFont.h" - -#include "ft2build.h" -#include "freetype2/freetype/freetype.h" -#include "freetype2/freetype/ftglyph.h" -#include "freetype2/freetype/ftoutln.h" -#include "freetype2/freetype/fttrigon.h" - -#include - -#include "ofUtils.h" -#include "ofGraphics.h" - -static bool printVectorInfo = false; -static int fontGlobalDpi = 96; - -ofxMuiFont::Settings::Settings() { - fontFilename = ""; // must set on load - fontSize = 12; - fontDpi = 0; // if <= 0 will default to fontGlobalDpi - bAntiAliased = true; - bForceAutoHinting = false; - bUseKerning = false; - bFullCharacterSet = false; - bMakeContours = false; - contourSimplifyAmt = 0.3; - fallbackSpaceChar = 'p'; - faceNum = 0; -} - -//-------------------------------------------------------- -void ofxMuiFont::setGlobalDpi(int newDpi){ - fontGlobalDpi = newDpi; -} - -//-------------------------------------------------------- -static ofCharacter makeContoursForCharacter(FT_Face &face); -static ofCharacter makeContoursForCharacter(FT_Face &face){ - - //int num = face->glyph->outline.n_points; - int nContours = face->glyph->outline.n_contours; - int startPos = 0; - - char * tags = face->glyph->outline.tags; - FT_Vector * vec = face->glyph->outline.points; - - ofCharacter charOutlines; - charOutlines.setUseShapeColor(false); - - for(int k = 0; k < nContours; k++){ - if( k > 0 ){ - startPos = face->glyph->outline.contours[k-1]+1; - } - int endPos = face->glyph->outline.contours[k]+1; - - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "--NEW CONTOUR\n"); - } - - //vector testOutline; - ofPoint lastPoint; - - for(int j = startPos; j < endPos; j++){ - - if( FT_CURVE_TAG(tags[j]) == FT_CURVE_TAG_ON ){ - lastPoint.set((float)vec[j].x, (float)-vec[j].y, 0); - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "flag[%i] is set to 1 - regular point - %f %f", j, lastPoint.x, lastPoint.y); - } - //testOutline.push_back(lastPoint); - charOutlines.lineTo(lastPoint/64); - - }else{ - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "flag[%i] is set to 0 - control point", j); - } - - if( FT_CURVE_TAG(tags[j]) == FT_CURVE_TAG_CUBIC ){ - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "- bit 2 is set to 2 - CUBIC"); - } - - int prevPoint = j-1; - if( j == 0){ - prevPoint = endPos-1; - } - - int nextIndex = j+1; - if( nextIndex >= endPos){ - nextIndex = startPos; - } - - ofPoint nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y ); - - //we need two control points to draw a cubic bezier - bool lastPointCubic = ( FT_CURVE_TAG(tags[prevPoint]) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG(tags[prevPoint]) == FT_CURVE_TAG_CUBIC); - - if( lastPointCubic ){ - ofPoint controlPoint1((float)vec[prevPoint].x, (float)-vec[prevPoint].y); - ofPoint controlPoint2((float)vec[j].x, (float)-vec[j].y); - ofPoint nextPoint((float) vec[nextIndex].x, -(float) vec[nextIndex].y); - - //cubic_bezier(testOutline, lastPoint.x, lastPoint.y, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, nextPoint.x, nextPoint.y, 8); - charOutlines.bezierTo(controlPoint1.x/64, controlPoint1.y/64, controlPoint2.x/64, controlPoint2.y/64, nextPoint.x/64, nextPoint.y/64); - } - - }else{ - - ofPoint conicPoint( (float)vec[j].x, -(float)vec[j].y ); - - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "- bit 2 is set to 0 - conic- "); - ofLog(OF_LOG_NOTICE, "--- conicPoint point is %f %f", conicPoint.x, conicPoint.y); - } - - //If the first point is connic and the last point is connic then we need to create a virutal point which acts as a wrap around - if( j == startPos ){ - bool prevIsConnic = ( FT_CURVE_TAG( tags[endPos-1] ) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG( tags[endPos-1]) != FT_CURVE_TAG_CUBIC ); - - if( prevIsConnic ){ - ofPoint lastConnic((float)vec[endPos - 1].x, (float)-vec[endPos - 1].y); - lastPoint = (conicPoint + lastConnic) / 2; - - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "NEED TO MIX WITH LAST"); - ofLog(OF_LOG_NOTICE, "last is %f %f", lastPoint.x, lastPoint.y); - } - } - } - - //bool doubleConic = false; - - int nextIndex = j+1; - if( nextIndex >= endPos){ - nextIndex = startPos; - } - - ofPoint nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y ); - - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "--- last point is %f %f", lastPoint.x, lastPoint.y); - } - - bool nextIsConnic = ( FT_CURVE_TAG( tags[nextIndex] ) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG( tags[nextIndex]) != FT_CURVE_TAG_CUBIC ); - - //create a 'virtual on point' if we have two connic points - if( nextIsConnic ){ - nextPoint = (conicPoint + nextPoint) / 2; - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "|_______ double connic!"); - } - } - if(printVectorInfo){ - ofLog(OF_LOG_NOTICE, "--- next point is %f %f", nextPoint.x, nextPoint.y); - } - - //quad_bezier(testOutline, lastPoint.x, lastPoint.y, conicPoint.x, conicPoint.y, nextPoint.x, nextPoint.y, 8); - charOutlines.quadBezierTo(lastPoint.x/64, lastPoint.y/64, conicPoint.x/64, conicPoint.y/64, nextPoint.x/64, nextPoint.y/64); - - if( nextIsConnic ){ - lastPoint = nextPoint; - } - } - } - - //end for - } - charOutlines.close(); - } - - return charOutlines; -} - -#ifdef TARGET_ANDROID - #include - set all_fonts; - void ofUnloadAllFontTextures(){ - set::iterator it; - for(it=all_fonts.begin();it!=all_fonts.end();it++){ - (*it)->unloadTextures(); - } - } - void ofReloadAllFontTextures(){ - set::iterator it; - for(it=all_fonts.begin();it!=all_fonts.end();it++){ - (*it)->reloadTextures(); - } - } - -#endif - -bool compare_cps(const ofCharacterProperty & c1, const ofCharacterProperty & c2){ - if(c1.tH == c2.tH) return c1.tW > c2.tW; - else return c1.tH > c2.tH; -} - -//------------------------------------------------------------------ -ofxMuiFont::ofxMuiFont(){ - bLoadedOk = false; - #ifdef TARGET_ANDROID - all_fonts.insert(this); - #endif - - resetMetrics(); - - // 3 pixel border around the glyph - // We show 2 pixels of this, so that blending looks good. - // 1 pixels is hidden because we don't want to see the real edge of the texture - - border = 3; - //visibleBorder = 2; - stringQuads.setMode(OF_PRIMITIVE_TRIANGLES); - binded = false; -} - -//------------------------------------------------------------------ -ofxMuiFont::~ofxMuiFont(){ - - if (bLoadedOk){ - unloadTextures(); - } - - #ifdef TARGET_ANDROID - all_fonts.erase(this); - #endif -} - -void ofxMuiFont::unloadTextures(){ - if(!bLoadedOk) return; - - texAtlas.clear(); - resetMetrics(); - bLoadedOk = false; -} - -void ofxMuiFont::reloadTextures(){ - loadFont(settings); -} - -void ofxMuiFont::resetMetrics() { - bHasKerning = false; // even though we request kerning, it may not be supported in the font - bHasContours = false; - - fontFamilyName = ""; - fontStyleName = ""; - - numFacesInFont = -1; - currentFaceIndex = -1; - maxAdvanceWidth = -1; - maxAdvanceHeight = -1; - underlinePosition = -1; - underlineThickness = -1; - ascender = -1; - descender = -1; - height = -1; - - lineHeight = 1.0f; - letterSpacing = 1.0f; - spaceSize = 1.0f; -} - - -//----------------------------------------------------------- -bool ofxMuiFont::loadFont(string fontFilename, - int fontSize, - bool bAntiAliased, - bool bFullCharacterSet, - bool bMakeContours, - float contourSimplifyAmt, - int fontDpi) { - - settings.fontFilename = fontFilename; - settings.fontSize = fontSize; - settings.fontDpi = fontDpi; - settings.bAntiAliased = bAntiAliased; - settings.bFullCharacterSet = bFullCharacterSet; - settings.bMakeContours = bMakeContours; - settings.contourSimplifyAmt = contourSimplifyAmt; - // all else is set in the default settings constructor -} - - -//----------------------------------------------------------- -bool ofxMuiFont::loadFont(Settings _settings) { - - if(_settings.fontFilename.empty()) { - ofLog(OF_LOG_ERROR,"ofxMuiFont::loadFont - No font name specified."); - return false; - } - - settings = _settings; - - //------------------------------------------------ - if (bLoadedOk == true){ - // we've already been loaded, try to clean up : - unloadTextures(); - } - //------------------------------------------------ - - int fontDpi = settings.fontDpi; - - if( fontDpi == 0 ){ - settings.fontDpi = fontGlobalDpi; - } - - string fontFilenameWithPath = ofToDataPath(settings.fontFilename); - - bLoadedOk = false; - - //--------------- load the library and typeface - - FT_Error err; - - FT_Library library; - - err = FT_Init_FreeType( &library ); - if (err){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::loadFont - Error initializing freetype lib: FT_Error = %d", err); - return false; - } - - FT_Face face; - - err = FT_New_Face( library, fontFilenameWithPath.c_str(), 0, &face ); - if (err) { - // simple error table in lieu of full table (see fterrors.h) - string errorString = "unknown freetype"; - if(err == 1) errorString = "INVALID FILENAME"; - ofLog(OF_LOG_ERROR,"ofxMuiFont::loadFont - %s: %s: FT_Error = %d", errorString.c_str(), fontFilenameWithPath.c_str(), err); - return false; - } - - float fontSize = settings.fontSize << 6; - FT_Set_Char_Size( face, fontSize, fontSize, fontDpi, fontDpi); - lineHeight = settings.fontSize * 1.43f; - - nCharacters = settings.bFullCharacterSet ? 256 : 128 - NUM_CHARACTER_TO_START_; - - //------------------------------------------------------ - //kerning would be great to support: - //ofLog(OF_LOG_NOTICE,"FT_HAS_KERNING ? %i", FT_HAS_KERNING(face)); - //------------------------------------------------------ - - bHasKerning = FT_HAS_KERNING(face) > 0 && settings.bUseKerning; - - bool isScalable = FT_IS_SCALABLE(face); // does have scalable outlines? - // true for TrueType, Type 1, Type 42, CID, OpenType/CFF, and PFR font formats. - // parameters below only valid for scalable fonts; - fontFamilyName = face->family_name; - fontStyleName = face->style_name; - maxAdvanceWidth = (int)face->max_advance_width >> 6; - maxAdvanceHeight = (int)face->max_advance_height >> 6; - underlinePosition = (int)face->underline_position >> 6; - underlineThickness = (int)face->underline_thickness >> 6; - descender = -1 * ((int)face->descender >> 6); // free type descenders are negative - ascender = (int)face->ascender >> 6; - height = (int)face->height >> 6; - - //--------------- initialize character info and textures - cps.resize(nCharacters); - - bHasContours = settings.bMakeContours; - if(bHasContours){ - charOutlines.clear(); - charOutlines.assign(nCharacters, ofCharacter()); - } - - vector expanded_data(nCharacters); - - long areaSum=0; - - FT_Int32 loadMode = settings.bForceAutoHinting ? FT_LOAD_DEFAULT : FT_LOAD_TARGET_LIGHT; - FT_Render_Mode renderMode = settings.bAntiAliased ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO; - - //--------------------- load each char ----------------------- - for (int i = 0 ; i < nCharacters; i++){ - - //------------------------------------------ anti aliased or not: - - int thisChar = indexToChar(i); - - err = FT_Load_Glyph( face, - FT_Get_Char_Index( face, thisChar ), - loadMode ); - if(err){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::loadFont - Error with FT_Load_Glyph %i: FT_Error = %d", i, err); - } - - FT_Render_Glyph(face->glyph, renderMode); - - //------------------------------------------ - FT_Bitmap& bitmap= face->glyph->bitmap; - - // prepare the texture: - /*int width = ofNextPow2( bitmap.width + border*2 ); - int height = ofNextPow2( bitmap.rows + border*2 ); - - - // ------------------------- this is fixing a bug with small type - // ------------------------- appearantly, opengl has trouble with - // ------------------------- width or height textures of 1, so we - // ------------------------- we just set it to 2... - if (width == 1) width = 2; - if (height == 1) height = 2;*/ - - - if(bHasContours){ - if( printVectorInfo ) { - printf("\n\ncharacter %c: \n", char( thisChar ) ); - } - charOutlines[i] = makeContoursForCharacter( face ); - if(settings.contourSimplifyAmt>0) { - charOutlines[i].simplify(settings.contourSimplifyAmt); - } - charOutlines[i].getTessellation(); - } - - - // ------------------------- - // info about the character: - cps[i].characterIndex = i; - cps[i].character = indexToChar(i); - cps[i].height = face->glyph->bitmap_top; - cps[i].width = face->glyph->bitmap.width; - cps[i].setWidth = face->glyph->advance.x >> 6; - cps[i].topExtent = face->glyph->bitmap.rows; - cps[i].leftExtent = face->glyph->bitmap_left; - - int width = cps[i].width; - int height = bitmap.rows; - - cps[i].tW = width; - cps[i].tH = height; - - int fheight = cps[i].height; - int bwidth = cps[i].width; - int top = cps[i].topExtent - cps[i].height; - int lextent = cps[i].leftExtent; - - float corr, stretch; - - //this accounts for the fact that we are showing 2*visibleBorder extra pixels - //so we make the size of each char that many pixels bigger - stretch = 0;//(float)(visibleBorder * 2); - - corr = (float)(( (settings.fontSize - fheight) + top) - settings.fontSize); - - cps[i].x1 = lextent + bwidth + stretch; - cps[i].y1 = fheight + corr + stretch; - cps[i].x2 = (float) lextent; - cps[i].y2 = -top + corr; - - if(bHasKerning) { - // build kerning table if possible and requested - cps[i].kern.resize(nCharacters); - - FT_Vector kerning; - FT_UInt kerning_mode = FT_KERNING_DEFAULT; // default for now - FT_Error kerningError; - - for (int j = 0 ; j < nCharacters; j++){ - kerningError = FT_Get_Kerning( face, /* handle to face object */ - thisChar, /* left glyph index */ - indexToChar(j),/* right glyph index */ - kerning_mode, /* kerning mode */ - &kerning ); /* target vector */ - - if(!kerningError) { - ofVec2f k((kerning.x >> 6),(kerning.y >> 6)); - if(k.x != 0 || k.y != 0) cps[i].kern[j] = k; - } else { - ofLog(OF_LOG_ERROR,"ofxMuiFont::loadFont - Error with FT_Get_Kerning %i/%i: FT_Error = %d", i, j, kerningError); - } - } - } - - - // Allocate Memory For The Texture Data. - expanded_data[i].allocate(width, height, 2); - //-------------------------------- clear data: - expanded_data[i].set(0,255); // every luminance pixel = 255 - expanded_data[i].set(1,0); - - if (settings.bAntiAliased == true){ - ofPixels bitmapPixels; - bitmapPixels.setFromExternalPixels(bitmap.buffer,bitmap.width,bitmap.rows,1); - expanded_data[i].setChannel(1,bitmapPixels); - } else { - //----------------------------------- - // true type packs monochrome info in a - // 1-bit format, hella funky - // here we unpack it: - unsigned char *src = bitmap.buffer; - for(int j=0; j sortedCopy = cps; - sort(sortedCopy.begin(),sortedCopy.end(),&compare_cps); - - // pack in a texture, algorithm to calculate min w/h from - // http://upcommons.upc.edu/pfc/bitstream/2099.1/7720/1/TesiMasterJonas.pdf - //cout << areaSum << endl; - - bool packed = false; - float alpha = logf(areaSum)*1.44269; - - int w; - int h; - while(!packed){ - w = pow(2,floor((alpha/2.f) + 0.5)); // there doesn't seem to be a round in cmath for windows. - //w = pow(2,round(alpha/2.f)); - h = w;//pow(2,round(alpha - round(alpha/2.f))); - int x=0; - int y=0; - int maxRowHeight = sortedCopy[0].tH + border*2; - for(int i=0;i<(int)cps.size();i++){ - if(x+sortedCopy[i].tW + border*2>w){ - x = 0; - y += maxRowHeight; - maxRowHeight = sortedCopy[i].tH + border*2; - if(y + maxRowHeight > h){ - alpha++; - break; - } - } - x+= sortedCopy[i].tW + border*2; - if(i==(int)cps.size()-1) packed = true; - } - - } - - // create the atlas - ofPixels atlasPixels; - atlasPixels.allocate(w,h,2); - atlasPixels.set(0,255); - atlasPixels.set(1,0); - - - int x=0; - int y=0; - int maxRowHeight = sortedCopy[0].tH + border*2; - for(int i=0;i<(int)cps.size();i++){ - ofPixels & charPixels = expanded_data[sortedCopy[i].characterIndex]; - - if(x+sortedCopy[i].tW + border*2>w){ - x = 0; - y += maxRowHeight; - maxRowHeight = sortedCopy[i].tH + border*2; - } - - cps[sortedCopy[i].characterIndex].t2 = float(x + border)/float(w); - cps[sortedCopy[i].characterIndex].v2 = float(y + border)/float(h); - cps[sortedCopy[i].characterIndex].t1 = float(cps[sortedCopy[i].characterIndex].tW + x + border)/float(w); - cps[sortedCopy[i].characterIndex].v1 = float(cps[sortedCopy[i].characterIndex].tH + y + border)/float(h); - charPixels.pasteInto(atlasPixels,x+border,y+border); - x+= sortedCopy[i].tW + border*2; - } - - - texAtlas.allocate(atlasPixels.getWidth(),atlasPixels.getHeight(),GL_LUMINANCE_ALPHA,false); - - if(settings.bAntiAliased && settings.fontSize > 20){ - texAtlas.setTextureMinMagFilter(GL_LINEAR,GL_LINEAR); - }else{ - texAtlas.setTextureMinMagFilter(GL_NEAREST,GL_NEAREST); - } - - texAtlas.loadData(atlasPixels.getPixels(),atlasPixels.getWidth(),atlasPixels.getHeight(),GL_LUMINANCE_ALPHA); - - // ------------- close the library and typeface - FT_Done_Face(face); - FT_Done_FreeType(library); - bLoadedOk = true; - return true; -} - -//----------------------------------------------------------- -bool ofxMuiFont::isLoaded() { - return bLoadedOk; -} - -//----------------------------------------------------------- -bool ofxMuiFont::isAntiAliased() { - return settings.bAntiAliased; -} - -//----------------------------------------------------------- -bool ofxMuiFont::hasFullCharacterSet() { - return settings.bFullCharacterSet; -} - -//----------------------------------------------------------- -bool ofxMuiFont::hasKerning() { - return bHasKerning; -} - -//----------------------------------------------------------- -bool ofxMuiFont::hasContours() { - return bHasContours; -} - -//----------------------------------------------------------- -int ofxMuiFont::getSize() { - return settings.fontSize; -} - -//----------------------------------------------------------- -void ofxMuiFont::setLineHeight(float _newLineHeight) { - lineHeight = _newLineHeight; -} - -//----------------------------------------------------------- -float ofxMuiFont::getLineHeight(){ - return lineHeight; -} - -//----------------------------------------------------------- -void ofxMuiFont::setLetterSpacing(float _letterSpacing) { - letterSpacing = _letterSpacing; -} - -//----------------------------------------------------------- -float ofxMuiFont::getLetterSpacing(){ - return letterSpacing; -} - -//----------------------------------------------------------- -void ofxMuiFont::setSpaceSize(float _spaceSize) { - spaceSize = _spaceSize; -} - -//----------------------------------------------------------- -float ofxMuiFont::getSpaceSize(){ - return spaceSize; -} - -//------------------------------------------------------------------ -ofCharacter ofxMuiFont::getCharacterAsPoints(int character, float x, float y){ - return getCharacterAsPoints(character, ofPoint(x,y)); -} - -//------------------------------------------------------------------ -ofCharacter ofxMuiFont::getCharacterAsPoints(int character, ofPoint p){ - if(bHasContours == false ){ - ofLog(OF_LOG_ERROR, "getCharacterAsPoints: contours not created, call loadFont with makeContours set to true" ); - } - - if( bHasContours && !charOutlines.empty() && isInShapeCharacterSet(character) ){ - ofCharacter ch = charOutlines[charToIndex(character)]; - ch.translate(p); - return ch; - }else{ - if(charOutlines.empty()) { - charOutlines.push_back(ofCharacter()); - } - return charOutlines[0]; - } -} - -//------------------------------------------------------------------ -bool ofxMuiFont::isInCharacterSet(int character) { - return character >= NUM_CHARACTER_TO_START_ && charToIndex(character) < nCharacters; -} - -//------------------------------------------------------------------ -bool ofxMuiFont::isInShapeCharacterSet(int character) { - return character >= NUM_CHARACTER_TO_START_ && charToIndex(character) < (int)charOutlines.size(); -} - - -//----------------------------------------------------------- -ofCharacter ofxMuiFont::drawChar(int character, float x, float y, bool asShapes) { - - bool alreadyBinded = binded; - if(!alreadyBinded) bind(); - - ofPoint p(x,y); - - ofTextAlignHorz hAlign = OF_TEXT_ALIGN_HORZ_LEFT;//ofGetTextAlignHorz(); // not part of ofStyles yet - ofTextAlignVert vAlign = OF_TEXT_ALIGN_VERT_TOP;//ofGetTextAlignVert(); // not part of ofStyles yet - - // no adjustments if hAlign -> left and vAlign -> baseline - - // make horizontal adjustments - if (hAlign == OF_TEXT_ALIGN_HORZ_CENTER) { - p.x -= _widthChar(character) / 2.0f; - } else if (hAlign == OF_TEXT_ALIGN_HORZ_RIGHT) { - p.x -= _widthChar(character); - } - - // make vertical adjustments - if (vAlign == OF_TEXT_ALIGN_VERT_CENTER) { - p.y += getAscender() / 2; - } else if (vAlign == OF_TEXT_ALIGN_VERT_TOP) { - p.y += getAscender(); - } else if (vAlign == OF_TEXT_ALIGN_VERT_BOTTOM) { - p.y -= getDescender(); - } - - // render - _drawChar(character, p, asShapes); - - // record and return actual offsets - ofCharacter co; - co.c = character; - co.offset = p; - - if(!alreadyBinded) unbind(); - - return co; - -} - -//----------------------------------------------------------- -ofCharacter ofxMuiFont::drawChar(int character, ofPoint p, bool asShapes) { - return drawChar(character,p.x,p.y,asShapes); -} - -//----------------------------------------------------------- -ofCharacter ofxMuiFont::drawCharAsShapes(int character, float x, float y) { - return drawChar(character, x, y, true); -} - -//----------------------------------------------------------- -ofCharacter ofxMuiFont::drawCharAsShapes(int character, ofPoint p) { - return drawChar(character, p.x, p.y, true); -} - - -//----------------------------------------------------------- -vector ofxMuiFont::getStringAsPoints(string s, float x, float y, float w, float h) { - ofRectangle boundingBox(x,y,w,h); - return getStringAsPoints(s,boundingBox); -} - -//----------------------------------------------------------- -vector ofxMuiFont::getStringAsPoints(string s, ofRectangle boundingBox) { - - vector shapes; - - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - return shapes; - }; - - vector offsets = getCharacterOffsets(s, boundingBox); - - for(int i = 0; i < (int)offsets.size(); i++) { - shapes.push_back(getCharacterAsPoints(s[i])); - shapes.back().translate(offsets[i].offset); - } - - return shapes; -} - -//----------------------------------------------------------- -vector ofxMuiFont::getCharacterOffsets(string s, float x, float y, float w, float h) { - ofRectangle boundingBox(x,y,w,h); - return getCharacterOffsets(s, boundingBox); -} - -//----------------------------------------------------------- -vector ofxMuiFont::getCharacterOffsets(string s, ofRectangle boundingBox) { - return textLayout(s, boundingBox, false, false); -} - -//----------------------------------------------------------- -float ofxMuiFont::stringWidth(string c) { - float width = 0; - int index = 0; - int start = 0; - int length = (int)c.length(); - - while (index < length) { - if (c[index] == '\n') { - width = MAX(width, _widthString(c, start, index)); - start = index+1; - } - index++; - } - - if (start < length) { - width = MAX(width, _widthString(c, start, index)); - } - - return width; -} - -//----------------------------------------------------------- -float ofxMuiFont::_widthChar(int character) { - int charIndex = charToIndex(character); - if(isInCharacterSet(character)) { // is it in our char set? - float xScale = letterSpacing; - if(character == ' ') xScale *= spaceSize; // respect legacy space size - return cps[charIndex].setWidth * xScale; // no kerning for single - } else { - // char was not in our character set, zero width - ofLogVerbose("ofxMuiFont::_widthChar character was not in set : " + ofToString((char)character)); - return 0.0f; - } -} - - -//----------------------------------------------------------- -float ofxMuiFont::_widthString(string c, int start, int stop) { - // assume no new lines - float width = 0.0f; - if(start >= 0 && stop < (int)c.length() - 1) { - for (int i = start; i < stop; i++) { - width += charWidth(c[i]); // scaling in charWidth - if((i - 1) >= start) { // apply kerning if needed - width += getHorizontalKerning(c[i-1], c[i]); - } - } - } else { - // start or stop were out of bounds - ofLogWarning("ofxMuiFont::_widthString start / stop were out of bounds."); - } - return width; -} - - -//----------------------------------------------------------- -ofVec2f ofxMuiFont::getKerning(int leftChar, int rightChar) { - ofVec2f k(0.0f,0.0f); - - if(bHasKerning && isInCharacterSet(leftChar) && isInCharacterSet(rightChar) ) { - k = cps[charToIndex(leftChar)].kern[charToIndex(rightChar)]; - } - - return k; -} - -//----------------------------------------------------------- -float ofxMuiFont::getHorizontalKerning(int leftChar, int rightChar) { - return getKerning(leftChar, rightChar).x; -} - -//----------------------------------------------------------- -float ofxMuiFont::getVerticalKerning(int leftChar, int rightChar) { - return getKerning(leftChar, rightChar).y; -} - -//----------------------------------------------------------- -int ofxMuiFont::charToIndex(int character) { - return (character - NUM_CHARACTER_TO_START_); -} - -//----------------------------------------------------------- -int ofxMuiFont::indexToChar(int index) { - return (index + NUM_CHARACTER_TO_START_); -} - -//----------------------------------------------------------- -ofRectangle ofxMuiFont::getStringBoundingBox(vector offsets, bool shrinkToContours) { - - vector::iterator it = offsets.begin(); - - // keep track of mins and maxs for bounding box - // initialize to extremes for min/max calcs - float minx, miny, maxx, maxy; - miny = minx = numeric_limits::max(); - maxx = maxy = -numeric_limits::max(); - - while(it != offsets.end()) { - - int character = (*it).c; - ofVec2f offset = (*it).offset; - int charIndex = charToIndex(character); - - if(shrinkToContours) { - minx = MIN(minx,(offset.x + cps[charIndex].x2)); // min x - miny = MIN(miny,(offset.y + cps[charIndex].y2)); // min y - maxx = MAX(maxx,(offset.x + cps[charIndex].x1)); // max x - maxy = MAX(maxy,(offset.y + cps[charIndex].y1)); // max y - } else { - minx = 0; - miny = 0; - maxx = MAX(maxx,offset.x + cps[charIndex].setWidth); // max x - maxy = MAX(maxy,offset.y + settings.fontSize); // max y - } - - ++it; - } - - return ofRectangle(minx, miny, maxx-minx, maxy-miny); -} - -//----------------------------------------------------------- -ofRectangle ofxMuiFont::getStringBoundingBox(string s, ofPoint p, bool shrinkToContours) { - return getStringBoundingBox(s, p.x, p.y, shrinkToContours); -} - -//----------------------------------------------------------- -ofRectangle ofxMuiFont::getStringBoundingBox(string s, float x, float y, bool shrinkToContours ){ - - if ( s.empty() || cps.empty() ) return ofRectangle(); - return getStringBoundingBox(getCharacterOffsets(s, x, y), shrinkToContours); - - /* - int index = 0; - float X = 0.0f; - float Y = 0.0f; - - int len = (int)s.length(); - - while(index < len) { - int charIndex = charToIndex(s[index]); - - if(s[index] == '\n') { - Y += lineHeight; // go to next row - X = 0.0f; //reset X Pos back to zero - } else if(isInCharacterSet(s[index])) { - // draw the character - - if(skrinkToContours) { - minx = MIN(minx,(X + cps[charIndex].x2)); // min x - miny = MIN(miny,(Y + cps[charIndex].y2)); // min y - maxx = MAX(maxx,(X + cps[charIndex].x1)); // max x - maxy = MAX(maxy,(Y + cps[charIndex].y1)); // max y - } else { - minx = 0; - miny = 0; - maxx = MAX(maxx,X + cps[charIndex].setWidth); // max x - maxy = MAX(maxy,Y + settings.fontSize); // max y - } - - // calculate horizontal scaling - float xScale = letterSpacing; // respect existing letter spacing scaler - if(s[index] == ' ') xScale *= spaceSize; // respect existing space char scaler - - // advance the cursor - X += (cps[charIndex].setWidth * xScale); - - // adjust the cursor for kerning if needed - if(bHasKerning && ((index + 1) < len) && s[index+1] != '\n') { - X += getKerning(s[index], s[index+1]).x; - } - } else { - // unknown character - } - - index++; - } - */ -} - - -//----------------------------------------------------------- -float ofxMuiFont::stringHeight(string s) { - ofRectangle rect = getStringBoundingBox(s, 0,0); - return rect.height; -} - -vector ofxMuiFont::drawString(string s, float x, float y, float w, float h, bool asShapes) { - ofRectangle boundingBox(x,y,w,h); - return textLayout(s, boundingBox, true, asShapes); -} - -//===================================================================== -vector ofxMuiFont::drawString(string s, ofRectangle boundingBox, bool asShapes) { - return textLayout(s, boundingBox, true, asShapes); -} - - -//===================================================================== -void ofxMuiFont::drawString(vector offsets, ofVec2f offset, bool asShapes) { - ofPushMatrix(); - ofTranslate(offset); - - // enable binding for the group - bool alreadyBinded = binded; - if(!alreadyBinded) bind(); - - for(int i = 0; i < (int)offsets.size(); i++) { - _drawChar(offsets[i].c, offsets[i].offset, asShapes); - } - - if(!alreadyBinded) unbind(); - - ofPopMatrix(); -} - - - -//===================================================================== -vector ofxMuiFont::drawStringAsShapes(string s, float x, float y, float w, float h) { - ofRectangle boundingBox(x,y,w,h); - return textLayout(s, boundingBox, true, true); -} - -//===================================================================== -vector ofxMuiFont::drawStringAsShapes(string s, ofRectangle boundingBox) { - return textLayout(s, boundingBox, true, true); -} - -//===================================================================== -void ofxMuiFont::drawStringAsShapes(vector offsets, ofVec2f offset) { - return drawString(offsets,offset,true); -} - -//===================================================================== -void ofxMuiFont::_drawChar(int character, ofPoint p, bool asShapes) { - - if(character == ' ' || character == '\r' || character == '\n') { - return; // we never draw spaces (?) - } - - if (!isInCharacterSet(character)){ - ofLog(OF_LOG_WARNING,"Error : char (%i) not allocated -- line %d in %s", character, __LINE__,__FILE__); - return; - } - - - int charIndex = charToIndex(character); - - // bind here if needed - - if(asShapes) { - ofCharacter & charRef = charOutlines[charIndex]; - charRef.setFilled(ofGetStyle().bFill); - charRef.draw(p.x,p.y); // TODO, add draw(ofPoint) to ofPath - } else { - - bool alreadyBinded = binded; - if(!alreadyBinded) bind(); - - float x1, y1, x2, y2; - float t1, v1, t2, v2; - t2 = cps[charIndex].t2; - v2 = cps[charIndex].v2; - t1 = cps[charIndex].t1; - v1 = cps[charIndex].v1; - - x1 = cps[charIndex].x1+p.x; - y1 = cps[charIndex].y1+p.y; - x2 = cps[charIndex].x2+p.x; - y2 = cps[charIndex].y2+p.y; - - int firstIndex = stringQuads.getVertices().size(); - - stringQuads.addVertex(ofVec3f(x1,y1)); - stringQuads.addVertex(ofVec3f(x2,y1)); - stringQuads.addVertex(ofVec3f(x2,y2)); - stringQuads.addVertex(ofVec3f(x1,y2)); - - stringQuads.addTexCoord(ofVec2f(t1,v1)); - stringQuads.addTexCoord(ofVec2f(t2,v1)); - stringQuads.addTexCoord(ofVec2f(t2,v2)); - stringQuads.addTexCoord(ofVec2f(t1,v2)); - - stringQuads.addIndex(firstIndex); - stringQuads.addIndex(firstIndex+1); - stringQuads.addIndex(firstIndex+2); - stringQuads.addIndex(firstIndex+2); - stringQuads.addIndex(firstIndex+3); - stringQuads.addIndex(firstIndex); - - if(!alreadyBinded) unbind(); - - } - - - -} - - - -//----------------------------------------------------------- -vector ofxMuiFont::textLayout(string s, - ofRectangle bb, - bool draw, - bool drawShapes) { - - vector offsets; - - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::drawString - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - return offsets; - } - - if (drawShapes && !bHasContours){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::drawStringAsShapes - Error : contours not created for this font - call loadFont with makeContours set to true"); - return offsets; - } - - ofTextAlignHorz hAlign = OF_TEXT_ALIGN_HORZ_LEFT;//ofGetTextAlignHorz(); - ofTextAlignVert vAlign = OF_TEXT_ALIGN_VERT_TOP;//ofGetTextAlignVert(); - - // bind as a group of textures if we are drawing - bool alreadyBinded = binded; - if(draw && !drawShapes && !alreadyBinded) bind(); - - float bbX = bb.x; // init @ the bounding box x - float bbY = bb.y; // init @ the bounding box y - float bbW = bb.width; - float bbH = bb.height; - // nice to use an ofPoly instead of a ofRect for a variety of bounding shapes - - // word wrapping! - int index = 0; - float X = 0; // current x // will adjust all offsets - float Y = 0; // current y // will adjust all offsets - - int len = (int)s.length(); - - float lineHeight = getLineHeight(); - - // iteration parameters - int lastWordStart = 0; - - bool isCharBreakMode = false;// (lineBreakMode == LINE_BREAK_MODE_NONE || - //lineBreakMode == LINE_BREAK_MODE_CHARACTER); - - string inputString = s; - - vector< vector > lines; - vector< float > lineWidths; - - lines.push_back(vector()); - - for(int i = 0; i < len; i++) { - - bool hasNextChar = (i + 1) < len; - bool hasLastChar = (i > 0); - - const int lastChar = hasLastChar ? inputString[i-1] : -1; - const int thisChar = inputString[i]; - const int nextChar = hasNextChar ? inputString[i+1] : -1; - - float thisCharWidth = _widthChar(thisChar); - float thisCharKerning = hasNextChar ? getHorizontalKerning(thisChar, nextChar) : 0.0f; - - bool isThisCharSpace = Poco::Ascii::isSpace(thisChar); - bool isLastCharSpace = hasLastChar && Poco::Ascii::isSpace(lastChar); - - bool isLastCharNewline = hasLastChar && (thisChar == '\n'); - bool isThisCharNewline = (thisChar == '\n'); - - // make this more complicated later - // soft hyphens, etc - bool canBreak = (i > 0) && (!isThisCharSpace); - - if((!isThisCharSpace && (isLastCharSpace))) { - lastWordStart = i; - } - - - float thisCharOffset = (thisCharKerning + thisCharWidth); - float proposedLineWidth = (X + thisCharOffset ); - float currentWordLength = proposedLineWidth - ( ( i > 0 ) ? offsets[lastWordStart].offset.x : 0.0f); - - if(isThisCharNewline || (canBreak && proposedLineWidth > bbW)) { - - Y += lineHeight; // next line - - if(!isThisCharNewline && lastWordStart != i && currentWordLength <= bbW) { - float wordStartOffset = offsets[lastWordStart].offset.x; - // shift all letters - for(int k = lastWordStart; k < i; k++) { - offsets[k].offset.x -= wordStartOffset; - offsets[k].offset.y = Y; - } - - X -= wordStartOffset; - } else { - X = 0; - } - - lines.push_back(vector()); - - } - - ofCharacter charOffset; - charOffset.c = thisChar; - charOffset.offset = ofVec2f(X,Y); - offsets.push_back(charOffset); - X += thisCharOffset; - - lines.back().push_back(&charOffset); - - } - - - for(int i = 0; i < lines.size(); i++) { - //cout << "i=" << i << ">>" << lines[i].size() << "<<>>"; - for(int j = 0; j < lines[i].size(); j++) { - ofCharacter* _char = lines[i].at(j); - if(draw) { - _drawChar(_char->c, _char->offset, drawShapes); - } - - //cout << "|" << _char->c; - } - //cout << endl; - } - - - - //cout << "lines found = " << lines.size() << endl; - - - /* - float currentY = -FLT_MAX; - int currentLineZ = -1; - //cout << ">>"; - float lineMaxX = 0; - for(int k = 0; k < offsets.size(); k++) { - ofCharacter thisChar = offsets[k]; - - if(thisChar.offset.y > currentY) { - currentLineZ++; - currentY = thisChar.offset.y; - // cout << endl; - // cout << currentLine << ": "; - } - - // cout << (char)thisChar.c; - - - if(draw) { - _drawChar(thisChar.c, thisChar.offset, drawShapes); - } - } - */ - - - // cout << "-----------" << endl; - - // release textures if we previously bound them - if(draw && !drawShapes && !alreadyBinded) unbind(); - - return offsets; -} - - -//----------------------------------------------------------- -void ofxMuiFont::bind(){ - if(!binded){ - // we need transparency to draw text, but we don't know - // if that is set up in outside of this function - // we "pushAttrib", turn on alpha and "popAttrib" - // http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html - - // **** note **** - // I have read that pushAttrib() is slow, if used often, - // maybe there is a faster way to do this? - // ie, check if blending is enabled, etc... - // glIsEnabled().... glGet()... - // http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html - // ************** - // (a) record the current "alpha state, blend func, etc" - #ifndef TARGET_OPENGLES - glPushAttrib(GL_COLOR_BUFFER_BIT); - #else - blend_enabled = glIsEnabled(GL_BLEND); - texture_2d_enabled = glIsEnabled(GL_TEXTURE_2D); - glGetIntegerv( GL_BLEND_SRC, &blend_src ); - glGetIntegerv( GL_BLEND_DST, &blend_dst ); - #endif - - // (b) enable our regular ALPHA blending! - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - texAtlas.bind(); - stringQuads.clear(); - binded = true; - } -} - -//----------------------------------------------------------- -void ofxMuiFont::unbind(){ - if(binded){ - stringQuads.drawFaces(); - texAtlas.unbind(); - - #ifndef TARGET_OPENGLES - glPopAttrib(); - #else - if( !blend_enabled ) - glDisable(GL_BLEND); - if( !texture_2d_enabled ) - glDisable(GL_TEXTURE_2D); - glBlendFunc( blend_src, blend_dst ); - #endif - binded = false; - } -} - - -//----------------------------------------------------------- -int ofxMuiFont::getNumCharacters() { - return nCharacters; -} - -//----------------------------------------------------------- -string ofxMuiFont::getFamilyName() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getFamilyName - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return fontFamilyName; -} -//----------------------------------------------------------- -string ofxMuiFont::getStyleName() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getStyleName - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return fontStyleName; -} -//----------------------------------------------------------- -int ofxMuiFont::getNumFacesInFont() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getNumFacesInFont - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return numFacesInFont; -} -//----------------------------------------------------------- -int ofxMuiFont::getCurrentFaceIndex() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getCurrentFaceIndex - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return currentFaceIndex; -} -//----------------------------------------------------------- -int ofxMuiFont::getMaxAdvanceWidth() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getMaxAdvanceWidth - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return maxAdvanceWidth; -} -//----------------------------------------------------------- -int ofxMuiFont::getMaxAdvanceHeight() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getMaxAdvanceHeight - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return maxAdvanceHeight; -} -//----------------------------------------------------------- -int ofxMuiFont::getUnderlinePosition() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getUnderlinePosition - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return underlinePosition; -} -//----------------------------------------------------------- -int ofxMuiFont::getUnderlineThickness() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getUnderlineThickness - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return underlineThickness; -} -//----------------------------------------------------------- -int ofxMuiFont::getAscender() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getAscender - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return ascender; -} -//----------------------------------------------------------- -int ofxMuiFont::getDescender() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getDescender - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return descender; -} -//----------------------------------------------------------- -int ofxMuiFont::getHeight() { - if (!bLoadedOk){ - ofLog(OF_LOG_ERROR,"ofxMuiFont::getHeight - Error : font not allocated -- line %d in %s", __LINE__,__FILE__); - } - return height; -} - - - diff --git a/src/helpers/ofxMuiFont.h b/src/helpers/ofxMuiFont.h deleted file mode 100644 index fb0ba6d..0000000 --- a/src/helpers/ofxMuiFont.h +++ /dev/null @@ -1,337 +0,0 @@ -/*============================================================================== - - Copyright (c) 2009-2012 Christopher Baker - - 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. - - ==============================================================================*/ - -#pragma once - -#include -#include "ofPoint.h" -#include "ofRectangle.h" -#include "ofConstants.h" -#include "ofPath.h" -#include "ofTexture.h" -#include "ofMesh.h" - -#include "ofxMuiConstants.h" - -#include -#include -#include -#include - -// from processing -static int EXTRA_CHARS[] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, - 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, - 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, - 0x00B0, 0x00B1, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00BA, - 0x00BB, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, - 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, - 0x00CE, 0x00CF, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, - 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, - 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FF, 0x0102, 0x0103, - 0x0104, 0x0105, 0x0106, 0x0107, 0x010C, 0x010D, 0x010E, 0x010F, - 0x0110, 0x0111, 0x0118, 0x0119, 0x011A, 0x011B, 0x0131, 0x0139, - 0x013A, 0x013D, 0x013E, 0x0141, 0x0142, 0x0143, 0x0144, 0x0147, - 0x0148, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, 0x0158, - 0x0159, 0x015A, 0x015B, 0x015E, 0x015F, 0x0160, 0x0161, 0x0162, - 0x0163, 0x0164, 0x0165, 0x016E, 0x016F, 0x0170, 0x0171, 0x0178, - 0x0179, 0x017A, 0x017B, 0x017C, 0x017D, 0x017E, 0x0192, 0x02C6, - 0x02C7, 0x02D8, 0x02D9, 0x02DA, 0x02DB, 0x02DC, 0x02DD, 0x03A9, - 0x03C0, 0x2013, 0x2014, 0x2018, 0x2019, 0x201A, 0x201C, 0x201D, - 0x201E, 0x2020, 0x2021, 0x2022, 0x2026, 0x2030, 0x2039, 0x203A, - 0x2044, 0x20AC, 0x2122, 0x2202, 0x2206, 0x220F, 0x2211, 0x221A, - 0x221E, 0x222B, 0x2248, 0x2260, 0x2264, 0x2265, 0x25CA, 0xF8FF, - 0xFB01, 0xFB02 -}; - -/*static public char[] CHARSET; -static { - CHARSET = new char[126-33+1 + EXTRA_CHARS.length]; - int index = 0; - for (int i = 33; i <= 126; i++) { - CHARSET[index++] = (char)i; - } - for (int i = 0; i < EXTRA_CHARS.length; i++) { - CHARSET[index++] = EXTRA_CHARS[i]; - } -}; - */ - -//-------------------------------------------------- -typedef struct { - int characterIndex; - int character; - int height; - int width; - int setWidth; - int topExtent; - int leftExtent; - float tW,tH; - float x1,x2,y1,y2; - float t1,t2,v1,v2; - - vector kern; - -} ofCharacterProperty; - -//typedef ofPath ofCharacter; - -class ofCharacter : public ofPath { - -public: - int c; - ofVec2f offset; - bool isShape; -}; - -typedef vector ofTextLine; - -class ofTextBlock { -public: - ofTextBlock(string _text); - ofTextBlock(string _text, float _x, float _y); - ofTextBlock(string _text, float _x, float _y, float _w, float _h); - ofTextBlock(string _text, ofRectangle const & _rect); - virtual ~ofTextBlock(); - - void draw(); - - - -private: - ofRectangle rect; - string text; - - -}; - - -//-------------------------------------------------- -#define NUM_CHARACTER_TO_START_ 32 // 0 - 31 are control characters, no graphics needed. - // include space to get the font's setWidth -class ofxMuiFont{ - -public: - struct Settings; - - ofxMuiFont(); - virtual ~ofxMuiFont(); - - //set the default dpi for all typefaces. - static void setGlobalDpi(int newDpi); - - bool loadFont(Settings _settings); // no default b/c filename must be specified - // -- default (without dpi), non-full char set, anti aliased, 96 dpi: - bool loadFont(string filename, - int fontsize, - bool _bAntiAliased=true, - bool _bFullCharacterSet=false, - bool makeContours=false, - float simplifyAmt=0.3, - int dpi=0); - - bool isLoaded(); - bool isAntiAliased(); - bool hasKerning(); - bool hasContours(); - bool hasFullCharacterSet(); - - int getSize(); - float getLineHeight(); - void setLineHeight(float height); - float getLetterSpacing(); - void setLetterSpacing(float spacing); - float getSpaceSize(); - void setSpaceSize(float size); - - // font properties - // read only variables set by the font. see below for details - string getFamilyName(); - string getStyleName(); - int getNumFacesInFont(); - int getCurrentFaceIndex(); - int getMaxAdvanceWidth(); - int getMaxAdvanceHeight(); - int getUnderlinePosition(); - int getUnderlineThickness(); - int getAscender(); - int getDescender(); - int getHeight(); - - ofVec2f getKerning(int leftChar, int rightChar); - float getHorizontalKerning(int leftChar, int rightChar); - float getVerticalKerning(int leftChar, int rightChar); - - // get the num chars in the loaded char set - int getNumCharacters(); - - // measurements - float stringWidth(string s); - float stringHeight(string s); - float charWidth(int character); - - // bounding boxes - ofRectangle getStringBoundingBox(string s, float x = 0.0f, float y = 0.0f, bool shrinkToContours = true); - ofRectangle getStringBoundingBox(string s, ofPoint p, bool shrinkToContours = true); - ofRectangle getStringBoundingBox(vector offsets, bool shrinkToContours = true); - - // drawing! - // characters - ofCharacter drawChar(int character, float x, float y, bool asShapes = false); - ofCharacter drawChar(int character, ofPoint p, bool asShapes = false); - ofCharacter drawCharAsShapes(int character, float x, float y); - ofCharacter drawCharAsShapes(int character, ofPoint p); - - - // strings - vector drawString(string s, float x = 0.0f, float y = 0.0f, float w = FLT_MAX, float h = FLT_MAX, bool asShapes = false); - vector drawString(string s, ofRectangle boundingBox, bool asShapes = false); - void drawString(vector offsets, ofVec2f offset = ofVec2f(0,0), bool asShapes = false); - vector drawStringAsShapes(string s, float x = 0.0f, float y = 0.0f, float w = FLT_MAX, float h = FLT_MAX); - vector drawStringAsShapes(string s, ofRectangle boundingBox); - void drawStringAsShapes(vector offsets, ofVec2f offset = ofVec2f(0,0)); - - - ofCharacter getCharacterAsPoints(int character, float x = 0.0f, float y = 0.0f); - ofCharacter getCharacterAsPoints(int character, ofPoint p); - - vector getStringAsPoints(string s, float x = 0.0f, float y = 0.0f, float w = FLT_MAX, float h = FLT_MAX); - vector getStringAsPoints(string s, ofRectangle boundingBox); - - vector getCharacterOffsets(string s, float x = 0.0f, float y = 0.0f, float w = FLT_MAX, float h = FLT_MAX); - vector getCharacterOffsets(string s, ofRectangle boundingBox); - - // texture - void bind(); - void unbind(); - - struct Settings { // the settings critical for font allocation - - string fontFilename; // the font filename - int fontSize; // the font file size - int fontDpi; // the font dpi - bool bAntiAliased; // should the font be created w/ antialiasing - bool bForceAutoHinting; // should auto hinting be forced - bool bUseKerning; // should a kerning table be generated - bool bFullCharacterSet; // should the font be created w/ a full character set - bool bMakeContours; // should the font be created with contourse - float contourSimplifyAmt; // contour simplification factor - int fallbackSpaceChar; // in the event that a font does not contain a setWidth - // for the space ' ' character, the width of this char - // will be used. Defaults to 'p'; - int faceNum; // for fonts that contain multiple faces - Settings(); - }; - - - -protected: - - Settings settings; // all settings required for font allocation - - bool bLoadedOk; // is the font ready to use - bool bHasKerning; - bool bHasContours; - - // read only variables, set by the font - string fontFamilyName; - string fontStyleName; - - int numFacesInFont; // The number of faces in the font file. - int currentFaceIndex; // The currently loaded face index. Usually 0 - - int maxAdvanceWidth; // The maximal advance width, in pixels, for all glyphs in this face. - // This can be used to make word wrapping computations faster. - int maxAdvanceHeight; // The maximal advance height, in pixels, for all glyphs in this face. - // This is only relevant for vertical layouts, and is set to ‘height’ - // for fonts that do not provide vertical metrics. - int underlinePosition; // The position, in pixels, of the underline line for this face. - // It's the center of the underlining stem. - int underlineThickness; // The thickness, in pixels, of the underline for this face. - int ascender; // The typographic ascender of the face, expressed in pixels - int descender; // The typographic descender of the face, expressed in pixels - int height; // The height is the vertical distance between two consecutive baselines, - // expressed in pixels. It is always positive. - - - // scaling parameters that do not affect font allocation - float lineHeight; - float letterSpacing; - float spaceSize; - - void resetMetrics(); // will reset metrics - - // layout - vector textLayout(string s, ofRectangle bb, bool draw, bool drawShapes); - - // character properties - int nCharacters; // the size of the cps vector - vector cps; // the character properties - vector charOutlines; // character outlines - - // helper functions - bool isInShapeCharacterSet(int character); - bool isInCharacterSet(int character); - - int indexToChar(int index); - int charToIndex(int character); - - // drawing helper functions -// void drawChar(int c, ofPoint p, bool asShapes = false); -// void drawCharAsShape(int c, ofPoint p); - - // internal measurement functions - float _widthChar(int character); - float _widthString(string s, int start, int stop); - - // internal draw functions - void _drawChar(int character, ofPoint p, bool asShapes = false); - - // texture related variables - int border;//, visibleBorder; - bool binded; - ofTexture texAtlas; - ofMesh stringQuads; - -private: -#ifdef TARGET_ANDROID - friend void ofUnloadAllFontTextures(); - friend void ofReloadAllFontTextures(); -#endif -#ifdef TARGET_OPENGLES - GLint blend_src, blend_dst; - GLboolean blend_enabled; - GLboolean texture_2d_enabled; -#endif - void unloadTextures(); - void reloadTextures(); -}; - - diff --git a/src/helpers/ofxMuiBox.cpp b/src/objects/base/ofxMuiBox.cpp similarity index 77% rename from src/helpers/ofxMuiBox.cpp rename to src/objects/base/ofxMuiBox.cpp index db7ca68..aa8af0d 100644 --- a/src/helpers/ofxMuiBox.cpp +++ b/src/objects/base/ofxMuiBox.cpp @@ -27,66 +27,68 @@ //-------------------------------------------------------------- // we explicitly set the frame size, and disallow auto adjusting ofxMuiBox::ofxMuiBox(ofRectangle _rect) : - ofxMuiBoxProperties(), - needsNewLine(true), + fixedWidth(true), + fixedHeight(true), +// needsNewLine(true), needsLayout(false), parentNeedsLayout(false), isLayoutSetupComplete(false), hContentAlign(OF_ALIGN_HORZ_LEFT), vContentAlign(OF_ALIGN_VERT_TOP) { - set(_rect); - hitBox = ofRectangle(); - contentBox = ofRectangle(); + box.set(_rect); + contentBox = ofRectangle(0,0,getWidth(),getHeight()); + hitBox = contentBox; } //-------------------------------------------------------------- ofxMuiBox::ofxMuiBox(float _x, float _y, float _w, float _h) : - ofxMuiBoxProperties(), - needsNewLine(true), + fixedWidth(true), + fixedHeight(true), +// needsNewLine(true), needsLayout(false), parentNeedsLayout(false), isLayoutSetupComplete(false), hContentAlign(OF_ALIGN_HORZ_LEFT), vContentAlign(OF_ALIGN_VERT_TOP) { - set(_x,_y,_w,_h); - hitBox = ofRectangle(); - contentBox = ofRectangle(); + box.set(_x,_y,_w,_h); + contentBox = ofRectangle(0,0,getWidth(),getHeight()); + hitBox = contentBox; } //-------------------------------------------------------------- // we only set the frame position, and allow auto adjusting ofxMuiBox::ofxMuiBox(float _x, float _y) : - ofxMuiBoxProperties(), - needsNewLine(true), + fixedWidth(false), + fixedHeight(false), +// needsNewLine(true), needsLayout(false), parentNeedsLayout(false), isLayoutSetupComplete(false), hContentAlign(OF_ALIGN_HORZ_LEFT), vContentAlign(OF_ALIGN_VERT_TOP) { - set(_x,_y,0,0); - hitBox = ofRectangle(); - contentBox = ofRectangle(); + box.set(_x,_y,0,0); + contentBox = ofRectangle(0,0,getWidth(),getHeight()); + hitBox = contentBox; } //-------------------------------------------------------------- // we set nothing and allow auto adjusting ofxMuiBox::ofxMuiBox() : - ofxMuiBoxProperties(), fixedWidth(false), fixedHeight(false), - needsNewLine(true), +// needsNewLine(true), needsLayout(false), parentNeedsLayout(false), isLayoutSetupComplete(false), hContentAlign(OF_ALIGN_HORZ_LEFT), vContentAlign(OF_ALIGN_VERT_TOP) { - set(ofRectangle(0,0,0,0)); - hitBox = ofRectangle(); - contentBox = ofRectangle(); + box.set(0,0,0,0); + contentBox = ofRectangle(0,0,getWidth(),getHeight()); + hitBox = contentBox; } //-------------------------------------------------------------- @@ -129,7 +131,7 @@ void ofxMuiBox::ofxFrame(float _x, float _y, float _width, float _height, ofxMui // arcs at the moment. come back to this later ... with ofPolyline perhaps? // draw the object frame FRAME IF shown - if(border.top > 0) { + if(boxProps.border.top > 0) { ofxRect(quadProp.left, 0, quadW, @@ -165,7 +167,7 @@ void ofxMuiBox::ofxFrame(float _x, float _y, float _width, float _height, ofxMui quadProp.bottom ); - if(border.right > 0) { + if(boxProps.border.right > 0) { // upper right corner piece ofxRect(_width-quadProp.right, quadH+quadProp.top, @@ -193,16 +195,62 @@ void ofxMuiBox::ofxFrame(float _x, float _y, float _width, float _height, ofxMui ofPopMatrix(); } +//-------------------------------------------------------------- +void ofxMuiBox::setBoxProperties(const ofxMuiBoxProperties& props) { + boxProps = props; +} + +//-------------------------------------------------------------- +ofxMuiBoxProperties ofxMuiBox::getBoxProperties() const { + return boxProps; +} + +//-------------------------------------------------------------- +ofRectangle ofxMuiBox::getBox() const { + return box; +} + +//-------------------------------------------------------------- +ofRectangle& ofxMuiBox::getBoxRef() { + return box; +} + +//-------------------------------------------------------------- +ofPoint ofxMuiBox::getPosition() const { + return box.getPosition(); +} + +//-------------------------------------------------------------- +void ofxMuiBox::setPosition(const ofPoint& p) { + box.setPosition(p); +} +//-------------------------------------------------------------- +void ofxMuiBox::setPosition(float x, float y) { + box.setPosition(x,y); +} +//-------------------------------------------------------------- +float ofxMuiBox::getX() const { + return box.getX(); +} +//-------------------------------------------------------------- +float ofxMuiBox::getY() const { + return box.getY(); +} +//-------------------------------------------------------------- +void ofxMuiBox::setX(float x) { + box.setX(x); +} //-------------------------------------------------------------- -ofRectangle ofxMuiBox::getBox() { - return ofRectangle(*this); +void ofxMuiBox::setY(float y) { + box.setY(y); } + ////-------------------------------------------------------------- //void ofxMuiBox::setX(float _x, bool _updateParent) { // x = _x; @@ -312,26 +360,28 @@ void ofxMuiBox::clearMinY() { //-------------------------------------------------------------- void ofxMuiBox::setWidth(float _width) { - if(_width >= 0) width = _width; - fixedWidth = (width > 0); + box.setWidth(_width); + box.standardize(); + fixedWidth = (box.width > 0); requestBoxLayout(); } //-------------------------------------------------------------- void ofxMuiBox::setHeight(float _height) { - if(_height >= 0) height = _height; - fixedHeight = (height > 0); + box.setHeight(_height); + box.standardize(); + fixedHeight = (box.height > 0); requestBoxLayout(); } //-------------------------------------------------------------- float ofxMuiBox::getWidth() const { - return width; + return box.getWidth(); } //-------------------------------------------------------------- float ofxMuiBox::getHeight() const { - return height; + return box.getHeight(); } //-------------------------------------------------------------- @@ -374,17 +424,17 @@ ofVec2f ofxMuiBox::getBorderBoxOffset() const { //-------------------------------------------------------------- float ofxMuiBox::getBorderBoxSideOffset(const ofxMuiBoxSide& side) const { - return margin.get(side); + return boxProps.margin.get(side); } //-------------------------------------------------------------- float ofxMuiBox::getBorderBoxWidth() const { - return width - (margin.right + margin.left); + return box.width - (boxProps.margin.right + boxProps.margin.left); } //-------------------------------------------------------------- float ofxMuiBox::getBorderBoxHeight() const { - return height - (margin.top + margin.bottom); + return box.height - (boxProps.margin.top + boxProps.margin.bottom); } //-------------------------------------------------------------- @@ -423,18 +473,22 @@ ofVec2f ofxMuiBox::getPaddingBoxOffset() const { //-------------------------------------------------------------- float ofxMuiBox::getPaddingBoxSideOffset(const ofxMuiBoxSide& side) const { - return margin.get(side) + border.get(side); + return boxProps.margin.get(side) + boxProps.border.get(side); } //-------------------------------------------------------------- float ofxMuiBox::getPaddingBoxWidth() const { - return width - (border.right + border.left) - (margin.right + margin.left); + return box.width + - (boxProps.border.right + boxProps.border.left) + - (boxProps.margin.right + boxProps.margin.left); } //-------------------------------------------------------------- float ofxMuiBox::getPaddingBoxHeight() const { - return height - (border.top + border.bottom) - (margin.top + margin.bottom); + return box.height + - (boxProps.border.top + boxProps.border.bottom) + - (boxProps.margin.top + boxProps.margin.bottom); } //-------------------------------------------------------------- @@ -466,7 +520,10 @@ float ofxMuiBox::getPaddingBoxCenterY() const { bool ofxMuiBox::insidePaddingBox(const ofPoint& _point) const { // this function assumes that the point has already been offset to the padding box // thus it sees if the point is between x 0/width and y 0/height - return _point.x > 0 && _point.y > 0 && _point.x < getPaddingBoxWidth() && _point.y < getPaddingBoxHeight(); + return _point.x > 0 && + _point.y > 0 && + _point.x < getPaddingBoxWidth() && + _point.y < getPaddingBoxHeight(); } //-------------------------------------------------------------- @@ -487,7 +544,7 @@ ofVec2f ofxMuiBox::getContentBoxOffset() const { //-------------------------------------------------------------- float ofxMuiBox::getContentBoxSideOffset(const ofxMuiBoxSide& side) const { - return margin.get(side) + border.get(side) + padding.get(side); + return boxProps.margin.get(side) + boxProps.border.get(side) + boxProps.padding.get(side); } //-------------------------------------------------------------- @@ -605,7 +662,7 @@ ofVec2f ofxMuiBox::getHitBoxOffset() const { //-------------------------------------------------------------- void ofxMuiBox::setHitBox(const ofRectangle& _hitBox) { - //cout << "SETHITBOX ="<< _hitBox.x << "|" << _hitBox.y << "|" << _hitBox.width << "|" << _hitBox.height << endl; + cout << "SETHITBOX ="<< _hitBox.x << "|" << _hitBox.y << "|" << _hitBox.width << "|" << _hitBox.height << endl; setHitBox(_hitBox.x, _hitBox.y, @@ -616,36 +673,19 @@ void ofxMuiBox::setHitBox(const ofRectangle& _hitBox) { //-------------------------------------------------------------- void ofxMuiBox::setHitBox(float _x, float _y, float _width, float _height) { - //cout << "SETHITBOX <><>="<< _x << "|" << _y << "|" << _width << "|" << _height << endl; - + ofRectangle newHitBox(_x,_y,_width,_height); - if(_x < 0) { - ofLog(OF_LOG_ERROR,"ofxMuiBox: Set a negative hitbox x position. Not possible."); - return; - } + // make all dimensions positive + newHitBox.standardize(); - if(_y < 0) { - ofLog(OF_LOG_ERROR,"ofxMuiBox: Set a negative hitbox y position. Not possible."); - return; - } - - if(_width < 0) { - ofLog(OF_LOG_ERROR,"ofxMuiBox: Set a negative hitbox height. Not possible."); - return; - } - - if(_height < 0) { - ofLog(OF_LOG_ERROR,"ofxMuiBox: Set a negative hitbox height. Not possible."); - return; - } - -// hitBox = ofRectangle(_x,_y,_width,_height); + hitBox = newHitBox; + hasCustomHitBox = true; } //-------------------------------------------------------------- void ofxMuiBox::setHitBoxX(float _x) { if(_x < 0) { - ofLog(OF_LOG_ERROR,"ofxMuiBox: Set a negative hitbox x position. Not possible."); + ofLogError("ofxMuiBox") << "Set a negative hitbox x position. Not possible."; return; } @@ -655,7 +695,7 @@ void ofxMuiBox::setHitBoxX(float _x) { //-------------------------------------------------------------- void ofxMuiBox::setHitBoxY(float _y) { if(_y < 0) { - ofLog(OF_LOG_ERROR,"ofxMuiBox: Set a negative hitbox y position. Not possible."); + ofLogError("ofxMuiBox") << "Set a negative hitbox y position. Not possible."; return; } hasCustomHitBox = true; @@ -664,7 +704,7 @@ void ofxMuiBox::setHitBoxY(float _y) { //-------------------------------------------------------------- void ofxMuiBox::setHitBoxWidth(float _width) { if(_width < 0) { - ofLog(OF_LOG_ERROR,"ofxMuiBox: Set a negative hitbox height. Not possible."); + ofLogError("ofxMuiBox") << "Set a negative hitbox height. Not possible."; return; } @@ -680,18 +720,12 @@ void ofxMuiBox::setHitBoxWidth(float _width) { //-------------------------------------------------------------- void ofxMuiBox::setHitBoxHeight(float _height) { if(_height < 0) { - ofLog(OF_LOG_ERROR,"ofxMuiBox: Set a negative hitbox height. Not possible."); + ofLogError("ofxMuiBox") << "Set a negative hitbox height. Not possible."; return; } - //cout << "Setting the height to " << _height;; - - hasCustomHitBox = true; hitBox.height = _height; - - //cout << " hitBox.height =" << hitBox.height << endl;; - } @@ -804,6 +838,7 @@ ofVec2f ofxMuiBox::getBoxScreenPosition() const { //-------------------------------------------------------------- bool ofxMuiBox::insideBox(const ofPoint& _point) const { + // TODO: let ofRectangle // this function assumes that the point has already been offset to the border box // thus it sees if the point is between x 0/width and y 0/height return _point.x > 0 && _point.y > 0 && _point.x < getWidth() && _point.y < getHeight(); @@ -851,17 +886,17 @@ bool ofxMuiBox::hitTest(float screenX, float screenY) const { } -//-------------------------------------------------------------- -void ofxMuiBox::setNeedsNewLine(bool _needsNewLine) { - needsNewLine = _needsNewLine; - setParentNeedsLayoutUpdate(true); -} - -//-------------------------------------------------------------- -bool ofxMuiBox::getNeedsNewLine() const { - return needsNewLine; -} - +////-------------------------------------------------------------- +//void ofxMuiBox::setNeedsNewLine(bool _needsNewLine) { +// needsNewLine = _needsNewLine; +// setParentNeedsLayoutUpdate(true); +//} +// +////-------------------------------------------------------------- +//bool ofxMuiBox::getNeedsNewLine() const { +// return needsNewLine; +//} +// //-------------------------------------------------------------- void ofxMuiBox::setNeedsLayoutUpdate(bool _needsLayout) { needsLayout = _needsLayout; @@ -888,9 +923,12 @@ void ofxMuiBox::requestBoxLayout() { // allow it to do so until the update loop comes around. // this allows one to configure objects in the setup without // entering everything in through the object's constructor - if (isLayoutSetupComplete) { + + if (!isLayoutSetupComplete) { + //cout << "-- in here" << endl; setNeedsLayoutUpdate(true); } else { + //cout << "in here 2" << endl; doLayout(); } } @@ -904,32 +942,42 @@ void ofxMuiBox::checkBounds() { //-------------------------------------------------------------- void ofxMuiBox::checkBoundsX() { - x = xRange.constrain(x); + box.x = xRange.constrain(box.x); } //-------------------------------------------------------------- void ofxMuiBox::checkBoundsY() { - y = yRange.constrain(y); + box.y = yRange.constrain(box.y); } //-------------------------------------------------------------- void ofxMuiBox::doLayout() { + //cout << "0-ofxMuiBox::doLayout" << endl << boxToString() << endl; + doContentBoxLayout(); + //cout << "1-ofxMuiBox::doLayout" << endl << boxToString() << endl; if(!fixedWidth) { - width = contentBox.width; - width += (margin.right + margin.left); - width += (border.right + border.left); - width += (padding.right + padding.left); + cout << "!fixedWidth" << endl; + box.width = contentBox.width; + box.width += (boxProps.margin.right + boxProps.margin.left); + box.width += (boxProps.border.right + boxProps.border.left); + box.width += (boxProps.padding.right + boxProps.padding.left); } if(!fixedHeight) { - height = contentBox.height; - height += (margin.top + margin.bottom); - height += (border.top + border.bottom); - height += (padding.top + padding.bottom); + cout << "!fixedHeight" << endl; + box.height = contentBox.height; + box.height += (boxProps.margin.top + boxProps.margin.bottom); + box.height += (boxProps.border.top + boxProps.border.bottom); + box.height += (boxProps.padding.top + boxProps.padding.bottom); } needsLayout = false; + + + //cout << "2-ofxMuiBox::doLayout" << endl<< boxToString() << endl; + + } @@ -954,5 +1002,48 @@ ofAlignVert ofxMuiBox::getContentAlignVert() const { return vContentAlign; } +//-------------------------------------------------------------- +string ofxMuiBox::boxToString() +{ + + // THE GUI BOX! + // __________________________________________________________ + // |BOX - RENDERED AS A FILLED QUAD | + // | CORNER CAN BE ANYWHERE INSIDE OF PARENT | + // | (SCREEN OR PANEL OR OBJECT | + // | ____________________________________________________ | + // | M |BORDER BOX - RENDERED AS A FRAME | | + // | A | CORNER ALWAYS @ 0,0 | | + // | A | | | + // | R | B | | + // | G | O __________________________________________ | | + // | I | R |PADDING BOX - RENDERED AS A FILLED QUAD | | | + // | N | D | CORNER ALWAYS @ 0,0 | | | + // | N | D | | | | + // | | E | P ___________________________________ | | | + // | | R | A |CONTENT BOX - RENDERD BY OBJECT | | | | + // | | | D | | | | | + // | | | D | CORNER ALWAYS @ 0,0 | | | | + // | | | I | | | | | + // | | | N | ___________________________ | | | | + // | | | G | | | | | | | + // | | | | | CORNER CAN BE ANYWHERE | | | | | + // | | | | | INSIDE THE CONTENT BOX | | | | | + // | | | | | | | | | | + // | | | | | HIT BOX - | | | | | + // | | | | | RENDERED BY OBJECT | | | | | + // | | | | | This is the "hot" zone" | | | | | + + + stringstream ss; + ss << "[BOX : " << ofToString(getBox().getX(),0,3,' ') << "/" << ofToString(getBox().getY(),0,3,' ') << "," << ofToString(getBox().getWidth(),0,3,' ') << "/" << ofToString(getBox().getHeight(),0,3,' ') << "]" << endl; + ss << "[BORDER : " << ofToString(getBorderBox().getX(),0,3,' ') << "/" << ofToString(getBorderBox().getY(),0,3,' ') << "," << ofToString(getBorderBox().getWidth(),0,3,' ') << "/" << ofToString(getBorderBox().getHeight(),0,3,' ') << "]" << endl; + ss << "[PADDING: " << ofToString(getPaddingBox().getX(),0,3,' ') << "/" << ofToString(getPaddingBox().getY(),0,3,' ') << "," << ofToString(getPaddingBox().getWidth(),0,3,' ') << "/" << ofToString(getPaddingBox().getHeight(),0,3,' ') << "]" << endl; + ss << "[HIT BOX: " << ofToString(getHitBox().getX(),0,3,' ') << "/" << ofToString(getHitBox().getY(),0,3,' ') << "," << ofToString(getHitBox().getWidth(),0,3,' ') << "/" << ofToString(getHitBox().getHeight(),0,3,' ') << "]" << endl; + + return ss.str(); +} + + diff --git a/src/helpers/ofxMuiBox.h b/src/objects/base/ofxMuiBox.h similarity index 74% rename from src/helpers/ofxMuiBox.h rename to src/objects/base/ofxMuiBox.h index 84607ac..2a9fef6 100644 --- a/src/helpers/ofxMuiBox.h +++ b/src/objects/base/ofxMuiBox.h @@ -28,7 +28,69 @@ #include "ofxMuiConstants.h" #include "ofxMuiRange.h" #include "ofxMuiBoxProperties.h" -#include "ofxRectangleUtils.h" +//#include "ofxRectangleUtils.h" + +enum ofxMuiHitRegions { + INSIDE_BOX, + INSIDE_MARGIN, + INSIDE_BORDER_BOX, + ON_BORDER, + IN_PADDING_BOX, + IN_PADDING, + IN_CONTENT, + IN_LOCAL, + IN_HIT_BOX, +}; + +class ofxMuiHitArgs { +public: + + bool isInRegion(ofxMuiHitRegions region) { + + switch (region) { + case INSIDE_BOX: + return isInsideBox(); + case INSIDE_MARGIN: + return isInsideMargin(); + case INSIDE_BORDER_BOX: + return isInsideBorderBox(); + case ON_BORDER: + return isInsideBoder(); + case IN_PADDING_BOX: + return isInsidePaddingBox(); + case IN_PADDING: + return isInsidePadding(); + case IN_CONTENT: + return isInsideContentBox(); + case IN_LOCAL: + return isInsideLocal(); + case IN_HIT_BOX: + return isInsideHitBox(); + default: + ofLogError("ofxMuiHitArgs") << "Unknown ofxMuiHitRegions: " << region; + break; + } + + } + + bool isInsideBox() { return bInsideBox; } + bool isInsideBorderBox() { return bInsideBorderBox; } + bool isInsidePaddingBox() { return bInsidePaddingBox; } + bool isInsideContentBox() { return bInsideContentBox; } + bool isInsideHitBox() { return bInsideHitBox; } + + bool isInsideMargin() { return bInsideBox && !bInsideBorderBox; } + bool isInsideBoder() { return bInsideBorderBox && !bInsidePaddingBox; } + bool isInsidePadding() { return bInsidePaddingBox && !bInsideContentBox; } + bool isInsideLocal() { return bInsideContentBox && !bInsideHitBox; } + + bool bInsideBox; + bool bInsideBorderBox; + bool bInsidePaddingBox; + bool bInsideContentBox; + bool bInsideHitBox; +}; + enum ofxMuiBoxCoordinates { @@ -44,9 +106,11 @@ enum ofxMuiBoxCoordinates { // the base box properties is not protected and any changes must be manually // followed by a call to setNeedsLayoutUpdate(). perhaps // there is a good way around this -- a callback in the box properties? -class ofxMuiBox : public ofRectangle, public ofxMuiBoxProperties { +class ofxMuiBox /*: public ofRectangle, public ofxMuiBoxProperties */ { public: + + // THE GUI BOX! // __________________________________________________________ // |BOX - RENDERED AS A FILLED QUAD | @@ -66,11 +130,11 @@ class ofxMuiBox : public ofRectangle, public ofxMuiBoxProperties { // | | | D | | | | | // | | | D | CORNER ALWAYS @ 0,0 | | | | // | | | I | | | | | - // | | | N | ___________________________ | | | | - // | | | G | | | | | | | - // | | | | | CORNER CAN BE ANYWHERE | | | | | - // | | | | | INSIDE THE CONTENT BOX | | | | | - // | | | | | | | | | | + // | | | N | L ___________________________ | | | | + // | | | G | O | | | | | | + // | | | | C | CORNER CAN BE ANYWHERE | | | | | + // | | | | A | INSIDE THE CONTENT BOX | | | | | + // | | | | L | | | | | | // | | | | | HIT BOX - | | | | | // | | | | | RENDERED BY OBJECT | | | | | // | | | | | This is the "hot" zone" | | | | | @@ -121,7 +185,38 @@ class ofxMuiBox : public ofRectangle, public ofxMuiBoxProperties { // GUI BOX ///////////////////////////////////////////////////// //-------------------------------------------------------------- - ofRectangle getBox(); + void setBoxProperties(const ofxMuiBoxProperties& props); + ofxMuiBoxProperties getBoxProperties() const; + + ofRectangle getBox() const; + ofRectangle& getBoxRef(); + + ofPoint getPosition() const; + void setPosition(const ofPoint& p); + void setPosition(float x, float y); + + float getX() const; + float getY() const; + + void setX(float x); + void setY(float y); + +// ofRectangle getAABB() const; + + + +// ofPoint getAnchor() const; +// void setAnchor(const ofPoint& p); +// void setAnchor(float x, float y); +// +// float getAnchorX() const; +// float getAnchorY() const; +// +// void setAnchorX(float x); +// void setAnchorY(float y); +// +// float getAngle() const; +// void setAngle(float angle); bool insideBox(const ofPoint& _point) const; @@ -152,8 +247,6 @@ class ofxMuiBox : public ofRectangle, public ofxMuiBoxProperties { // by explicitly setting width or height, it is implied that // you want a fixed width and / or fixed height. - - void setWidth(float _width); void setHeight(float _height); @@ -299,9 +392,50 @@ class ofxMuiBox : public ofRectangle, public ofxMuiBoxProperties { // this will not be called if the click is not in the content box - bool hitTest(const ofPoint& contentBoxX) const; + bool hitTest(const ofPoint& contentBoxXY) const; virtual bool hitTest(float contentBoxX, float contentBoxY) const; + bool isInsideBox(const ofPoint& contentBoxX); + bool isInsideBorderBox(); + bool isInsidePaddingBox(); + bool isInsideContentBox(); + bool isInsideHitBox(); + + + + // THE GUI BOX! + // __________________________________________________________ + // |BOX - RENDERED AS A FILLED QUAD | + // | CORNER CAN BE ANYWHERE INSIDE OF PARENT | + // | (SCREEN OR PANEL OR OBJECT | + // | ____________________________________________________ | + // | M |BORDER BOX - RENDERED AS A FRAME | | + // | A | CORNER ALWAYS @ 0,0 | | + // | A | | | + // | R | B | | + // | G | O __________________________________________ | | + // | I | R |PADDING BOX - RENDERED AS A FILLED QUAD | | | + // | N | D | CORNER ALWAYS @ 0,0 | | | + // | N | D | | | | + // | | E | P ___________________________________ | | | + // | | R | A |CONTENT BOX - RENDERD BY OBJECT | | | | + // | | | D | | | | | + // | | | D | CORNER ALWAYS @ 0,0 | | | | + // | | | I | | | | | + // | | | N | ___________________________ | | | | + // | | | G | | | | | | | + // | | | | | CORNER CAN BE ANYWHERE | | | | | + // | | | | | INSIDE THE CONTENT BOX | | | | | + // | | | | | | | | | | + + + + + + + + + //-------------------------------------------------------------- // LAYOUT ////////////////////////////////////////////////////// //-------------------------------------------------------------- @@ -331,6 +465,9 @@ class ofxMuiBox : public ofRectangle, public ofxMuiBoxProperties { ofAlignHorz getContentAlignHorz() const; ofAlignVert getContentAlignVert() const; + string boxToString(); + + protected: // static members @@ -347,24 +484,33 @@ class ofxMuiBox : public ofRectangle, public ofxMuiBoxProperties { // The hitbox is always defined in terms of its // offset from the content box. - bool needsNewLine; + // bool needsNewLine; bool needsLayout; bool parentNeedsLayout; // each object must do its own content box layout - virtual void doContentBoxLayout() {}; + virtual void doContentBoxLayout() { + ofLogWarning("ofxMuiBox") << "doContentBoxLayout(): not implemented."; + }; bool isLayoutSetupComplete; private: + ofxMuiBoxProperties boxProps; + +// float angle; +// ofPoint anchorPoint; +// bool canRotate; + + + ofRectangle box; ofRectangle contentBox; bool hasCustomHitBox; ofRectangle hitBox; - ofxMuiRange xRange; ofxMuiRange yRange; diff --git a/src/objects/base/ofxMuiObject.cpp b/src/objects/base/ofxMuiObject.cpp index a301282..e22db4a 100644 --- a/src/objects/base/ofxMuiObject.cpp +++ b/src/objects/base/ofxMuiObject.cpp @@ -25,36 +25,28 @@ #include "ofxMuiObject.h" //-------------------------------------------------------------- -ofxMuiObject::ofxMuiObject(const string& _name, int _x, int _y, int _width, int _height, bool _enabled) : +ofxMuiObject::ofxMuiObject(/*const string& _name, */float _x, float _y, float _width, float _height, bool _enabled) : ofxMuiBox(_x,_y,_width,_height), ofxMuiEnabler(_enabled), - ofxMuiKeyMapper(), - name(_name) { +ofxMuiKeyMapper(){//, +// name(_name) { init(); } + //-------------------------------------------------------------- -ofxMuiObject::ofxMuiObject(const string& _name, int _x, int _y, bool _enabled) : +ofxMuiObject::ofxMuiObject(/*const string& _name, */ float _x, float _y, bool _enabled) : ofxMuiBox(_x,_y), ofxMuiEnabler(_enabled), - ofxMuiKeyMapper(), - name(_name) { +ofxMuiKeyMapper(){//, +// name(_name) { init(); } //-------------------------------------------------------------- -ofxMuiObject::ofxMuiObject(const string& _name, bool _enabled) : +ofxMuiObject::ofxMuiObject(/*const string& _name, */bool _enabled) : ofxMuiBox(), ofxMuiEnabler(_enabled), - ofxMuiKeyMapper(), - name(_name) { - init(); -} - -//-------------------------------------------------------------- -ofxMuiObject::ofxMuiObject(bool _enabled) : - ofxMuiBox(), - ofxMuiEnabler(_enabled), - ofxMuiKeyMapper(), - name("NULL") { +ofxMuiKeyMapper() {//, +// name(_name) { init(); } @@ -69,13 +61,13 @@ ofxMuiObject::~ofxMuiObject() { void ofxMuiObject::init() { defaults = &ofxMuiDefaults::getInstance(); // get a link to the singleton - tooltip = name; - tooltipEnabled = false; + //tooltip = name; + //bTooltipEnabled = false; parent = NULL; - _isMouseDown = false; - _isMouseOver = false; + _isTouchDown = false; + _isTouchOver = false; // drag'n'drop _isDragMoveable = false; @@ -84,6 +76,11 @@ void ofxMuiObject::init() { _isHitDragable = true; _isHitDragOrigin = false; + + _isSelectable = false; + _isSelectDragable = false; + + _isDropSender = false; // can we drop this thing on something _isDropReceiver = false; // can we receive a dropped object @@ -169,7 +166,7 @@ void ofxMuiObject::_update(ofEventArgs &e) { if(isUpdateHandler()) { // do the local update - if (isMouseOver() || isMouseDown() || isDragging()) { + if (isTouchOver() || isTouchDown() || isDragging()) { isActiveTimer += isActiveTimerRate; } else { isActiveTimer -= isActiveTimerRate; @@ -372,7 +369,7 @@ ofxMuiObject* ofxMuiObject::_keyPressed(ofKeyEventArgs &e, ofxMuiObject* handled } if(isKeyboardHandler() && canHandleIt(handled) && executeKeyMappedFunc(key)) { - onKeyPressed(); // just an alert (should be earlier?) + onKeyPressed(key); // just an alert (should be earlier?) handled = this; } @@ -402,7 +399,7 @@ ofxMuiObject* ofxMuiObject::_keyReleased(ofKeyEventArgs &e, ofxMuiObject* handle } if(isKeyboardHandler() && canHandleIt(handled) && executeKeyMappedFunc(key)) { - onKeyReleased(); + onKeyReleased(key); handled = this; } @@ -417,7 +414,7 @@ ofxMuiObject* ofxMuiObject::_mouseMoved(ofMouseEventArgs &e, ofxMuiObject* handl saveMouseEvent(e); - if(propagateMouseEvents()) { + if(propagateTouchEvents()) { ofxMuiObject* newHandler = NULL; for(int i = (childObjects.size()-1); i >= 0; i--) { ofxMuiPushObject(childObjects[i]); @@ -432,22 +429,22 @@ ofxMuiObject* ofxMuiObject::_mouseMoved(ofMouseEventArgs &e, ofxMuiObject* handl bool didHit = hitTest(mousePosition); // if mouse is over the object - if(isMouseHandler() && canHandleIt(handled) && didHit) { + if(isTouchHandler() && canHandleIt(handled) && didHit) { // if the mouse wasn't over it already - if(!isMouseOver()) { - onRollOver(); // call onRollOver - _isMouseOver = true; // update flag + if(!isTouchOver()) { + onHoverIn(); + _isTouchOver = true; // update flag } else { // we were already on it! - onMouseMove(); // and trigger onMouseMove + onHoverOn(); // and trigger } handled = this; // this is the handler now! - } else if(isMouseOver()) { // if mouse is not over the object, but the flag is true (From previous frame) - _isMouseOver = false; // update flag - onRollOut(); // call onRollOut + } else if(isTouchOver()) { // if mouse is not over the object, but the flag is true (From previous frame) + _isTouchOver = false; // update flag + onHoverOut(); // call } else { // unaffected } @@ -459,12 +456,12 @@ ofxMuiObject* ofxMuiObject::_mouseMoved(ofMouseEventArgs &e, ofxMuiObject* handl ofxMuiObject* ofxMuiObject::_mouseDragged(ofMouseEventArgs &e, ofxMuiObject* handled) { - + cout << "_____DRAGGING_____ isDragging()=" << isDragging() << endl; if(!isEnabled() || isHidden()) return NULL; saveMouseEvent(e); - if(propagateMouseEvents()) { + if(propagateTouchEvents()) { ofxMuiObject* newHandler = NULL; for(int i = (childObjects.size()-1); i >= 0; i--) { ofxMuiPushObject(childObjects[i]); @@ -476,34 +473,50 @@ ofxMuiObject* ofxMuiObject::_mouseDragged(ofMouseEventArgs &e, ofxMuiObject* han } } } - + bool didHit = hitTest(mousePosition); - if(isMouseHandler() && (isDragging() || (canHandleIt(handled) && didHit && isMouseDown()))) { + cout << "_____DIDHIT=" << didHit << "_____" << endl; + + if(isTouchHandler() && (isDragging() || (canHandleIt(handled) && didHit && isTouchDown()))) { + cout << "1" << endl; if(!isDragging()) { + cout << "1a" << endl; + _isDragging = true; dragStartPosition = mousePosition; // if (isHitDragable() && insideHitBox(screenToHitBox(mousePosition))) { if (isHitDragable() && hitTest(mousePosition)) { + cout << "1b" << endl; + cout << "hit drag origin = true" << endl;; _isHitDragOrigin = true; } else { + cout << "1c" << endl; + cout << "hit drag origin = false" << endl;; _isHitDragOrigin = false; } onDragStart(); } else { + cout << "XXXX" << endl; totalDragDelta = mousePosition - dragStartPosition; onDrag(); } - if(isDragMoveable() && (!isHitDragable() && isHitDragOrigin())) { + cout << "2 isDragMoveable=" << isDragMoveable() << endl; + cout << "2 isHitDragable=" << isHitDragable() << endl; + cout << "2 isHitDragOrigin=" << isHitDragOrigin() << endl; + + if(isDragMoveable() && isHitDragOrigin() && isHitDragable()) { + cout << "2a" << endl; + ofVec2f pos = getPosition(); - ofVec2f maxB = getMax(); - ofVec2f minB = getMin(); + ofVec2f maxB = getBox().getMax(); + ofVec2f minB = getBox().getMin(); ofVec2f inWPos; if(hasParent()) { @@ -512,6 +525,9 @@ ofxMuiObject* ofxMuiObject::_mouseDragged(ofMouseEventArgs &e, ofxMuiObject* han inWPos = screenToHitBox(mousePosition); } + cout << "YYY" << endl; + + //cout << "2b" << endl; // (inWPos.x > minB.x && deltaMousePosition.x > 0) @@ -519,16 +535,14 @@ ofxMuiObject* ofxMuiObject::_mouseDragged(ofMouseEventArgs &e, ofxMuiObject* han // (inWPos.x < (maxB.x + hitBox.width) && deltaMousePosition.x < 0)) { + //if((inWPos.x > minB.x && deltaMousePosition.x > 0) || + // (inWPos.x < maxB.x && deltaMousePosition.x < 0)) { +// getBox().translateX(deltaMousePosition.x); + //} + + ofRectangle& boxRef = getBoxRef(); + boxRef.translate(deltaMousePosition); - - - if((inWPos.x > minB.x && deltaMousePosition.x > 0) || - (inWPos.x < maxB.x && deltaMousePosition.x < 0)) { - translateX(deltaMousePosition.x); - } - - - translateY(deltaMousePosition.y); onDragMoving(); } @@ -566,7 +580,7 @@ ofxMuiObject* ofxMuiObject::_mousePressed(ofMouseEventArgs &e, ofxMuiObject* han saveMouseEvent(e); - if(propagateMouseEvents()) { + if(propagateTouchEvents()) { ofxMuiObject* newHandler = NULL; for(int i = (childObjects.size()-1); i >= 0; i--) { ofxMuiPushObject(childObjects[i]); @@ -582,9 +596,9 @@ ofxMuiObject* ofxMuiObject::_mousePressed(ofMouseEventArgs &e, ofxMuiObject* han bool didHit = hitTest(mousePosition); - if(isMouseHandler() && canHandleIt(handled) && didHit) { - if(!isMouseDown()) { - _isMouseDown = true; + if(isTouchHandler() && canHandleIt(handled) && didHit) { + if(!isTouchDown()) { + _isTouchDown = true; onPress(); if(numClicks == 2 && pMousePosition == mousePosition) { onDoublePress(); @@ -592,7 +606,7 @@ ofxMuiObject* ofxMuiObject::_mousePressed(ofMouseEventArgs &e, ofxMuiObject* han } handled = this; // set this as handled } else { // if mouse is not over - _isMouseDown = false; + _isTouchDown = false; onPressOutside(); // someone else was pressed } @@ -606,7 +620,7 @@ ofxMuiObject* ofxMuiObject::_mouseReleased(ofMouseEventArgs &e, ofxMuiObject* ha saveMouseEvent(e); - if(propagateMouseEvents()) { + if(propagateTouchEvents()) { ofxMuiObject* newHandler = NULL; for(int i = (childObjects.size()-1); i >= 0; i--) { ofxMuiPushObject(childObjects[i]); @@ -622,7 +636,7 @@ ofxMuiObject* ofxMuiObject::_mouseReleased(ofMouseEventArgs &e, ofxMuiObject* ha // hit test bool didHit = hitTest(mousePosition); - if(isMouseHandler() && (isDragging() || didHit)) { + if(isTouchHandler() && (isDragging() || didHit)) { // this is either the object being dragged or an object being dropped upon if(isDragging()) { @@ -650,8 +664,8 @@ ofxMuiObject* ofxMuiObject::_mouseReleased(ofMouseEventArgs &e, ofxMuiObject* ha // in any case, the mouse is no longer down _isDragging = false; - _isMouseDown = false; - _isMouseOver = isMouseHandler() && didHit; + _isTouchDown = false; + _isTouchOver = isTouchHandler() && didHit; return handled; } @@ -720,13 +734,13 @@ bool ofxMuiObject::isDropReceiver() const { } //-------------------------------------------------------------- -bool ofxMuiObject::isMouseDown() const { - return _isMouseDown; +bool ofxMuiObject::isTouchDown() const { + return _isTouchDown; } //-------------------------------------------------------------- -bool ofxMuiObject::isMouseOver() const { - return _isMouseOver; +bool ofxMuiObject::isTouchOver() const { + return _isTouchOver; } @@ -839,10 +853,10 @@ ofVec2f ofxMuiObject::getContentBoxScreenPosition() { string ofxMuiObject::getDebugString() { ostringstream out; - out << name << " "; - out << "mX/mY: " << mousePosition << endl; +//out << name << " "; + out << "mX/mY: " << mousePosition << endl; out << "dX/dY: " << deltaMousePosition << endl; - out << "mouseOver: " << isMouseOver() << " mouseDown: " << isMouseDown() << " isDragging: " << isDragging() << endl; + out << "mouseOver: " << isTouchOver() << " mouseDown: " << isTouchDown() << " isDragging: " << isDragging() << endl; if(isDragging()) { out << dragStartPosition << endl; @@ -853,15 +867,15 @@ string ofxMuiObject::getDebugString() { } -//-------------------------------------------------------------- -void ofxMuiObject::setName(string _name) { - name = _name; -} - -//-------------------------------------------------------------- -string ofxMuiObject::getName() { - return name; -} +////-------------------------------------------------------------- +//void ofxMuiObject::setName(string _name) { +// name = _name; +//} +// +////-------------------------------------------------------------- +//string ofxMuiObject::getName() { +// return name; +//} //-------------------------------------------------------------- string ofxMuiObject::getObjectType() { @@ -902,25 +916,25 @@ bool ofxMuiObject::isOrientationHorizontal() { -//-------------------------------------------------------------- -string ofxMuiObject::getTooltip() const { - return tooltip; -} - -//-------------------------------------------------------------- -void ofxMuiObject::setTooltip(const string& _tooltip) { - tooltip = _tooltip; -} - -//-------------------------------------------------------------- -bool ofxMuiObject::isTooltipEnabled() const { - return tooltipEnabled; -} - -//-------------------------------------------------------------- -void ofxMuiObject::setTooltipEnabled(bool _enabled) { - tooltipEnabled = _enabled; -} +////-------------------------------------------------------------- +//string ofxMuiObject::getTooltip() const { +// return tooltip; +//} +// +////-------------------------------------------------------------- +//void ofxMuiObject::setTooltip(const string& _tooltip) { +// tooltip = _tooltip; +//} +// +////-------------------------------------------------------------- +//bool ofxMuiObject::isTooltipEnabled() const { +// return bTooltipEnabled; +//} +// +////-------------------------------------------------------------- +//void ofxMuiObject::setTooltipEnabled(bool _enabled) { +// bTooltipEnabled = _enabled; +//} //-------------------------------------------------------------- ofxMuiObject* ofxMuiObject::getParent() { @@ -935,8 +949,14 @@ void ofxMuiObject::setParent(ofxMuiObject* _parent) { //-------------------------------------------------------------- void ofxMuiObject::addChild(ofxMuiObject* child) { + if(child == NULL) { + ofLogWarning("ofxMuiObject") << "addChild() : child is NULL."; + return; + } + if(child->hasParent()) { - ofLog(OF_LOG_WARNING, "ofxMuiObject::addChild() : child already has parent ... not advised."); + ofLogWarning("ofxMuiObject") << "addChild() : child already has parent. Failing."; + return; } child->setParent(this); @@ -986,7 +1006,7 @@ bool ofxMuiObject::removeChild(ofxMuiObject* child) { //-------------------------------------------------------------- void ofxMuiObject::drawBox() { - ofColor boxColor = cBox.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale); + ofColor boxColor = cBox.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); if(boxColor.a > 0) { ofFill(); ofSetColor(boxColor); @@ -996,17 +1016,17 @@ void ofxMuiObject::drawBox() { //-------------------------------------------------------------- void ofxMuiObject::drawBorder() { - ofColor borderColor = cBorder.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale); + ofColor borderColor = cBorder.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); if(borderColor.a > 0) { ofFill(); ofSetColor(borderColor); - ofxFrame(0,0,getBorderBoxWidth(),getBorderBoxHeight(),border); + ofxFrame(0,0,getBorderBoxWidth(),getBorderBoxHeight(),getBoxProperties().border); } } //-------------------------------------------------------------- void ofxMuiObject::drawPaddingBox() { - ofColor paddingColor = cPadding.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale); + ofColor paddingColor = cPadding.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); if(paddingColor.a > 0) { ofFill(); ofSetColor(paddingColor); @@ -1016,7 +1036,7 @@ void ofxMuiObject::drawPaddingBox() { //-------------------------------------------------------------- void ofxMuiObject::drawContentBox() { - ofColor contentColor = cContent.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale); + ofColor contentColor = cContent.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); if(contentColor.a > 0) { ofFill(); ofSetColor(contentColor); @@ -1028,7 +1048,7 @@ void ofxMuiObject::drawContentBox() { void ofxMuiObject::drawShadowBox() { // DRAW THE SHADOW if alpha is set above 0 if(doShadow) { - ofColor shadowColor = cShadow.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale); + ofColor shadowColor = cShadow.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); if(shadowColor.a > 0) { ofPushMatrix(); ofTranslate(shadowOffset); @@ -1040,6 +1060,15 @@ void ofxMuiObject::drawShadowBox() { } } +//------------------------------------------------------------- +void ofxMuiObject::draw() { + ofColor hitColor = cHit.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); + if(hitColor.a > 0) { + ofFill(); + ofSetColor(hitColor); + ofxRect(0,0,getHitBoxWidth(),getHitBoxHeight()); + } +} //-------------------------------------------------------------- float ofxMuiObject::getAlphaScale() const { diff --git a/src/objects/base/ofxMuiObject.h b/src/objects/base/ofxMuiObject.h index b98b07b..6cb1710 100644 --- a/src/objects/base/ofxMuiObject.h +++ b/src/objects/base/ofxMuiObject.h @@ -34,17 +34,23 @@ #include "ofxMuiKeyMapper.h" -class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMapper { +class ofxMuiObject : public ofxMuiBox, + public ofxMuiEnabler, + public ofxMuiKeyMapper +{ public: //-------------------------------------------------------------- // CONSTRUCTORS+DESTRUCTORS //////////////////////////////////// //-------------------------------------------------------------- - ofxMuiObject(const string& _name, int _x, int _y, int _width, int _height, bool _enabled = true); - ofxMuiObject(const string& _name, int _x, int _y, bool _enabled = true); - ofxMuiObject(const string& _name, bool _enabled = true); ofxMuiObject(bool _enabled = true); + ofxMuiObject(float _x, float _y, bool _enabled = true); + ofxMuiObject(float _x, float _y, float _width, float _height, bool _enabled = true); + +// ofxMuiObject(const string& _name, float _x, float _y, float _width, float _height, bool _enabled = true); +// ofxMuiObject(const string& _name, float _x, float _y, bool _enabled = true); +// ofxMuiObject(const string& _name, bool _enabled = true); virtual ~ofxMuiObject(); @@ -92,7 +98,7 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap virtual void drawContentBox(); // draw Content Box - virtual void draw() = 0; // draw the contents of content box + virtual void draw(); // draw the contents of content box virtual void exit() {} @@ -114,12 +120,12 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap void doSetEnabled(bool _enabled); - //-------------------------------------------------------------- - // LABELS ////////////////////////////////////////////////////// - //-------------------------------------------------------------- - - void setName(string _label); - string getName(); +// //-------------------------------------------------------------- +// // LABELS ////////////////////////////////////////////////////// +// //-------------------------------------------------------------- +// +// void setName(string _label); +// string getName(); //-------------------------------------------------------------- // DRAGGING+DROPPING /////////////////////////////////////////// @@ -129,6 +135,11 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap void setIsDragMoveable(bool _val); // can we drag this thing around bool isDragMoveable() const; + void setIsSelectable(bool _val); + bool isSelectable() const; + + + bool isDragging() const; bool isHitDragable() const; @@ -147,18 +158,18 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap // INTERACTIVE INPUT /////////////////////////////////////////// //-------------------------------------------------------------- - bool isMouseDown() const; - bool isMouseOver() const; + bool isTouchDown() const; + bool isTouchOver() const; //-------------------------------------------------------------- // TOOLTIP ///////////////////////////////////////////////////// //-------------------------------------------------------------- - string getTooltip() const; - void setTooltip(const string& _tooltip); - - bool isTooltipEnabled() const; - void setTooltipEnabled(bool _enable); +// string getTooltip() const; +// void setTooltip(const string& _tooltip); +// +// bool isTooltipEnabled() const; +// void setTooltipEnabled(bool _enable); //-------------------------------------------------------------- // OBJECT TREE AND FAMILY ////////////////////////////////////// @@ -233,8 +244,8 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap //-------------------------------------------------------------- - bool tooltipEnabled; - string tooltip; +// bool bTooltipEnabled; +// string tooltip; @@ -259,30 +270,31 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap float getActiveTimer(); //-------------------------------------------------------------- - // MOUSE MOVEMENT CALLBACKS //////////////////////////////////// + // HOVER MOVEMENT CALLBACKS //////////////////////////////////// //-------------------------------------------------------------- + // these will generally not be called with touch-based systems - // onRollOver: called when mouse enters object x, y, width, height - virtual void onRollOver() {} - // onRollOut: called when mouse leaves object x, y, width, height - virtual void onRollOut() {} - // onMouseMove: called when mouse moves while over object x, y, width, height - virtual void onMouseMove() {} + // onHoverIn: called when mouse/touch hover/rolls enters object x, y, width, height + virtual void onHoverIn() {} + // onHoverOut: called when mouse/touch hover/rolls exits object x, y, width, height + virtual void onHoverOut() {} + // onHoverOn: called when mouse/touch hover/rolls moves while over object x, y, width, height + virtual void onHoverOn() {} //-------------------------------------------------------------- - // MOUSE PRESS CALLBACKS /////////////////////////////////////// + // TOUCH PRESS CALLBACKS /////////////////////////////////////// //-------------------------------------------------------------- - // onPress: called when mouse presses while over object + // onPress: called when touch presses while over object virtual void onPress() {} - // onDoublePress: called when mouse is double-clicked while over object + // onDoublePress: called when double-touched over object virtual void onDoublePress() {} - // onPressOutside: called when mouse presses while outside object + // onPressOutside: called when touch presses while outside object virtual void onPressOutside() {} - // onRelease: called when mouse releases while over object + // onRelease: called when touch releases while over object virtual void onRelease() {} // onReleaseOutside: called when mouse releases outside @@ -290,7 +302,7 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap virtual void onReleaseOutside() {} //-------------------------------------------------------------- - // MOUSE DRAG CALLBACKS //////////////////////////////////////// + // TOUCH DRAG CALLBACKS //////////////////////////////////////// //-------------------------------------------------------------- // onDrag: called on the handling object ANYTIME the mouse is @@ -310,10 +322,10 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap // onDragMoving: this is called when the object is being moved via dragging virtual void onDragMoving() {}; - // onDragOver: called when mouse moves while over object + // onDragOver: called when touch moves while over object // and button is down (but not dragging object) virtual void onDragOver() {} - // onDragOutside: called when mouse moves while outside + // onDragOutside: called when touch moves while outside // the object after being clicked on it virtual void onDragOutside() {} @@ -361,9 +373,9 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap //-------------------------------------------------------------- // onKeyPressed: called when a key is pressed with the object in focus - virtual void onKeyPressed() {} + virtual void onKeyPressed(int key) {} // onKeyReleased: called when a key is released with the obejct in focus - virtual void onKeyReleased() {} + virtual void onKeyReleased(int key) {} //-------------------------------------------------------------- // COLORS/SHADOWS ////////////////////////////////////////////// @@ -410,9 +422,9 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap // LABELS/TEXT ///////////////////////////////////////////////// //-------------------------------------------------------------- - string name; // the name of this paramater - // serves as the default for tooltips and - // (in some cases) display text +// string name; // the name of this paramater +// // serves as the default for tooltips and +// // (in some cases) display text string objectType; @@ -427,11 +439,12 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap int pKey; bool keyboardOnPress; - // mouse states - bool _isMouseDown; - bool _isMouseOver; + // touch states + bool _isTouchDown; + bool _isTouchOver; - // mouse positions + // touch positions + // TODO this needs to be a vector ofVec2f mousePosition; ofVec2f pMousePosition; @@ -448,18 +461,32 @@ class ofxMuiObject : public ofxMuiBox, public ofxMuiEnabler, public ofxMuiKeyMap // allow for easy fading in and out and other float isActiveTimer; float isActiveTimerRate; - + + //-------------------------------------------------------------- // DRAGGING+DROPPING /////////////////////////////////////////// //-------------------------------------------------------------- + + bool _isDragMoveable; // can we drag this thing around bool _isDragging; // is dragging - // for times when we start a drag inside of a hit + // for times when we start a drag inside of a hit box bool _isHitDragable; bool _isHitDragOrigin; + bool _isSelectable; + bool _isSelectDragable; + + + + + + + + + ofVec2f dragStartPosition; // where we were before the dragging started ofVec2f totalDragDelta; // the total delta diff between dragstart // position and current mousePositio diff --git a/src/objects/base/ofxMuiTrueTypeFont.cpp b/src/objects/base/ofxMuiTrueTypeFont.cpp deleted file mode 100644 index b5d2ae5..0000000 --- a/src/objects/base/ofxMuiTrueTypeFont.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/*============================================================================== - - Copyright (c) 2009-2012 Christopher Baker - - 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 - -#include "ft2build.h" -#include "freetype2/freetype/freetype.h" -#include "freetype2/freetype/ftglyph.h" -#include "freetype2/freetype/ftoutln.h" -#include "freetype2/freetype/fttrigon.h" - -#include - -#include "ofUtils.h" -#include "ofGraphics.h" -/* -static bool printVectorInfo = false; -static int fontGlobalDpi = 96; - -//-------------------------------------------------------- -static ofTTFCharacter makeContoursForCharacter(FT_Face &face); -static ofTTFCharacter makeContoursForCharacter(FT_Face &face){ - - //int num = face->glyph->outline.n_points; - int nContours = face->glyph->outline.n_contours; - int startPos = 0; - - char * tags = face->glyph->outline.tags; - FT_Vector * vec = face->glyph->outline.points; - - ofTTFCharacter charOutlines; - charOutlines.setUseShapeColor(false); - - for(int k = 0; k < nContours; k++){ - if( k > 0 ){ - startPos = face->glyph->outline.contours[k-1]+1; - } - int endPos = face->glyph->outline.contours[k]+1; - - if( printVectorInfo )printf("--NEW CONTOUR\n\n"); - - //vector testOutline; - ofPoint lastPoint; - - for(int j = startPos; j < endPos; j++){ - - if( FT_CURVE_TAG(tags[j]) == FT_CURVE_TAG_ON ){ - lastPoint.set((float)vec[j].x, (float)-vec[j].y, 0); - if( printVectorInfo )printf("flag[%i] is set to 1 - regular point - %f %f \n", j, lastPoint.x, lastPoint.y); - //testOutline.push_back(lastPoint); - charOutlines.lineTo(lastPoint/64); - - }else{ - if( printVectorInfo )printf("flag[%i] is set to 0 - control point \n", j); - - if( FT_CURVE_TAG(tags[j]) == FT_CURVE_TAG_CUBIC ){ - if( printVectorInfo )printf("- bit 2 is set to 2 - CUBIC\n"); - - int prevPoint = j-1; - if( j == 0){ - prevPoint = endPos-1; - } - - int nextIndex = j+1; - if( nextIndex >= endPos){ - nextIndex = startPos; - } - - ofPoint nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y ); - - //we need two control points to draw a cubic bezier - bool lastPointCubic = ( FT_CURVE_TAG(tags[prevPoint]) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG(tags[prevPoint]) == FT_CURVE_TAG_CUBIC); - - if( lastPointCubic ){ - ofPoint controlPoint1((float)vec[prevPoint].x, (float)-vec[prevPoint].y); - ofPoint controlPoint2((float)vec[j].x, (float)-vec[j].y); - ofPoint nextPoint((float) vec[nextIndex].x, -(float) vec[nextIndex].y); - - //cubic_bezier(testOutline, lastPoint.x, lastPoint.y, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, nextPoint.x, nextPoint.y, 8); - charOutlines.bezierTo(controlPoint1.x/64, controlPoint1.y/64, controlPoint2.x/64, controlPoint2.y/64, nextPoint.x/64, nextPoint.y/64); - } - - }else{ - - ofPoint conicPoint( (float)vec[j].x, -(float)vec[j].y ); - - if( printVectorInfo )printf("- bit 2 is set to 0 - conic- \n"); - if( printVectorInfo )printf("--- conicPoint point is %f %f \n", conicPoint.x, conicPoint.y); - - //If the first point is connic and the last point is connic then we need to create a virutal point which acts as a wrap around - if( j == startPos ){ - bool prevIsConnic = ( FT_CURVE_TAG( tags[endPos-1] ) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG( tags[endPos-1]) != FT_CURVE_TAG_CUBIC ); - - if( prevIsConnic ){ - ofPoint lastConnic((float)vec[endPos - 1].x, (float)-vec[endPos - 1].y); - lastPoint = (conicPoint + lastConnic) / 2; - - if( printVectorInfo ) printf("NEED TO MIX WITH LAST\n"); - if( printVectorInfo )printf("last is %f %f \n", lastPoint.x, lastPoint.y); - } - } - - //bool doubleConic = false; - - int nextIndex = j+1; - if( nextIndex >= endPos){ - nextIndex = startPos; - } - - ofPoint nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y ); - - if( printVectorInfo )printf("--- last point is %f %f \n", lastPoint.x, lastPoint.y); - - bool nextIsConnic = ( FT_CURVE_TAG( tags[nextIndex] ) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG( tags[nextIndex]) != FT_CURVE_TAG_CUBIC ); - - //create a 'virtual on point' if we have two connic points - if( nextIsConnic ){ - nextPoint = (conicPoint + nextPoint) / 2; - if( printVectorInfo )printf("|_______ double connic!\n"); - } - if( printVectorInfo )printf("--- next point is %f %f \n", nextPoint.x, nextPoint.y); - - //quad_bezier(testOutline, lastPoint.x, lastPoint.y, conicPoint.x, conicPoint.y, nextPoint.x, nextPoint.y, 8); - charOutlines.quadBezierTo(lastPoint.x/64, lastPoint.y/64, conicPoint.x/64, conicPoint.y/64, nextPoint.x/64, nextPoint.y/64); - - if( nextIsConnic ){ - lastPoint = nextPoint; - } - } - } - - //end for - } - charOutlines.close(); - } - - return charOutlines; -} - -bool compare_cps(const charProps & c1, const charProps & c2){ - if(c1.tH == c2.tH) return c1.tW > c2.tW; - else return c1.tH > c2.tH; -} - -//----------------------------------------------------------- -vector ofxMuiTrueTypeFont::getCharacterProperties() { - return cps; -} -*/ - diff --git a/src/objects/base/ofxMuiTrueTypeFont.h b/src/objects/base/ofxMuiTrueTypeFont.h deleted file mode 100644 index 14cd241..0000000 --- a/src/objects/base/ofxMuiTrueTypeFont.h +++ /dev/null @@ -1,43 +0,0 @@ -/*============================================================================== - - Copyright (c) 2009-2012 Christopher Baker - - 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. - - ==============================================================================*/ - -#pragma once - -#include "ofxMuiFont.h" - - -class ofxMuiTrueTypeFont : public ofxMuiFont { - -public: -/* - // -- default (without dpi), non-full char set, anti aliased, 96 dpi: - bool loadFont(string filename, int fontsize, bool _bAntiAliased=true, bool _bFullCharacterSet=false, bool makeContours=false, float simplifyAmt=0.3, int dpi=0, bool forceAutoHinting=false); - - vector getCharacterProperties(); -*/ -protected: - -private: - -}; \ No newline at end of file diff --git a/src/objects/impl/ofxMuiButton.cpp b/src/objects/impl/ofxMuiButton.cpp index 8fed50e..cbb7c8a 100644 --- a/src/objects/impl/ofxMuiButton.cpp +++ b/src/objects/impl/ofxMuiButton.cpp @@ -25,28 +25,28 @@ #include "ofxMuiButton.h" ofxMuiButton::ofxMuiButton(const string& _name, int _x, int _y, int _width, int _height, bool _enabled) : -ofxMuiLabelledObject(_name, _x, _y, _width, _height, _enabled), +ofxMuiObject(/*_name, */_x, _y, _width, _height, _enabled), ofxMuiNumberData(ofxMui_BOOL) { init(); } //-------------------------------------------------------------- ofxMuiButton::ofxMuiButton(const string& _name, int _x, int _y,bool _enabled) : -ofxMuiLabelledObject(_name, _x, _y, _enabled), +ofxMuiObject(/*_name, */ _x, _y, _enabled), ofxMuiNumberData(ofxMui_BOOL) { init(); } //-------------------------------------------------------------- ofxMuiButton::ofxMuiButton(const string& _name,bool _enabled) : -ofxMuiLabelledObject(_name, _enabled), +ofxMuiObject(/*_name, */ _enabled), ofxMuiNumberData(ofxMui_BOOL) { init(); } //-------------------------------------------------------------- ofxMuiButton::ofxMuiButton(bool _enabled) : -ofxMuiLabelledObject(_enabled), +ofxMuiObject(_enabled), ofxMuiNumberData(ofxMui_BOOL) { init(); } @@ -63,8 +63,7 @@ void ofxMuiButton::init() { // override the superclass setBoxProperties(defaults->buttonBoxProperties); - buttonType = TYPE_SWITCH; - + buttonType = BUTTON_TYPE_TOGGLE; setButtonIcon(ICON_DEFAULT); @@ -76,10 +75,10 @@ void ofxMuiButton::init() { // custom, just for the button itself (i.e. no clicking on the label) setHitBox(0, 0, defaults->buttonWidth, defaults->buttonHeight); - label->setText(name); - label->enable(); +// label->setText(name); +// label->enable(); - requestBoxLayout(); + // requestBoxLayout(); } @@ -97,7 +96,7 @@ void ofxMuiButton::dataChanged(int index) { //-------------------------------------------------------------- void ofxMuiButton::draw() { - + ofPushStyle(); ofPushMatrix(); // initial push @@ -106,7 +105,7 @@ void ofxMuiButton::draw() //--------- DRAW THE BUTTON BACKGROUND // default ofFill(); - ofSetColor(cActiveAreaBackground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaBackground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); if(roundFrame) { // assuming that the icon is square ... ofCircle(getHitBoxWidth()/2, getHitBoxHeight()/2, getHitBoxWidth()/2); @@ -115,7 +114,7 @@ void ofxMuiButton::draw() } ofNoFill(); - ofSetColor(cActiveAreaForeground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaForeground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); if(useIcon) { int iconWidth = icon->getIcon(getValue())->getWidth(); @@ -156,7 +155,7 @@ void ofxMuiButton::draw() } ofNoFill(); - ofSetColor(cActiveAreaFrame.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaFrame.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); if(roundFrame) { // assuming that the icon is square ... ofCircle(getHitBoxWidth()/2, getHitBoxHeight()/2, getHitBoxWidth()/2); @@ -171,13 +170,15 @@ void ofxMuiButton::draw() } //-------------------------------------------------------------- -void ofxMuiButton::onPress() -{ - if(mouseButton == 0) { +void ofxMuiButton::onPress() { + + cout << "onpress!" << endl; + + if(mouseButton == 0) { // left click - if (buttonType == TYPE_SWITCH) { + if (buttonType == BUTTON_TYPE_TOGGLE) { toggle(); - } else if(buttonType == TYPE_TRIGGER) { + } else if(buttonType == BUTTON_TYPE_BANG) { setValue(true); // turn on } } @@ -188,7 +189,7 @@ void ofxMuiButton::onRelease() { if(mouseButton == 0) { // left click - if(buttonType == TYPE_TRIGGER) { + if(buttonType == BUTTON_TYPE_BANG) { setValue(false); // turn of } } @@ -199,7 +200,7 @@ void ofxMuiButton::onReleaseOutside() { if(mouseDown && mouseButton == 0) { // left click - if(buttonType == TYPE_TRIGGER) { + if(buttonType == BUTTON_TYPE_BANG) { setValue(false); // turn on } } @@ -215,7 +216,7 @@ void ofxMuiButton::loadFromXml(ofxXmlSettings& xml) void ofxMuiButton::saveToXml(ofxXmlSettings& xml) { int id = saveObjectData(); - bool value = (buttonType == TYPE_TRIGGER) ? false : (value == true); + bool value = (buttonType == BUTTON_TYPE_BANG) ? false : (value == true); //props->mXml.setValue("OBJECT:VALUE", value, id); } @@ -305,6 +306,10 @@ bool ofxMuiButton::getRoundFrame() { //-------------------------------------------------------------- void ofxMuiButton::doContentBoxLayout() { + //cout << "0: ofxMuiButton::doContentBoxLayout=>" << endl << boxToString() << endl; + + + /* // TODO: handle the case where the label is EMPTY // vertical ofxMuiLabelCaps @@ -320,11 +325,17 @@ void ofxMuiButton::doContentBoxLayout() { // label to the right label->setX(getHitBoxWidth()); // label to the right - setHitBoxX(0); - + */ +// setHitBoxX(0); + + // TODO: this doesn't account for auto widths ... - setContentBoxWidth(getHitBoxWidth() + label->getWidth()); + setContentBoxHeight(getHitBoxHeight()); + setContentBoxWidth(getHitBoxWidth());// + label->getWidth()); + + //cout << "1: ofxMuiButton::doContentBoxLayout=>" << endl << boxToString() << endl; + } diff --git a/src/objects/impl/ofxMuiButton.h b/src/objects/impl/ofxMuiButton.h index 5b3bd13..4abefe6 100644 --- a/src/objects/impl/ofxMuiButton.h +++ b/src/objects/impl/ofxMuiButton.h @@ -28,16 +28,17 @@ #include "ofxMuiLabelledObject.h" #include "ofxMuiIcon.h" #include "ofxMuiNumberData.h" - +#include "ofxRectangleUtils.h" enum ofxMuiButtonType { - TYPE_SWITCH, - TYPE_TRIGGER /* like a bang */ + BUTTON_TYPE_TOGGLE, + BUTTON_TYPE_BANG /* like a bang */ }; -class ofxMuiButton : public ofxMuiLabelledObject, public ofxMuiNumberData { - +class ofxMuiButton : public ofxMuiObject, + public ofxMuiNumberData +{ public: ofxMuiButton(const string& _name, int _x, int _y, int _width, int _height, bool _enabled = true); @@ -87,9 +88,6 @@ class ofxMuiButton : public ofxMuiLabelledObject, public ofxMuiNumberData { void setRoundFrame(bool _roundFrame); bool getRoundFrame(); - - - //-------------------------------------------------------------- // EVENTS ////////////////////////////////////////////////////// //-------------------------------------------------------------- @@ -109,7 +107,6 @@ class ofxMuiButton : public ofxMuiLabelledObject, public ofxMuiNumberData { void onPress(); void onRelease(); void onReleaseOutside(); - void doContentBoxLayout(); //-------------------------------------------------------------- diff --git a/src/objects/impl/ofxMuiPanel.cpp b/src/objects/impl/ofxMuiPanel.cpp index 5154b85..c68e610 100644 --- a/src/objects/impl/ofxMuiPanel.cpp +++ b/src/objects/impl/ofxMuiPanel.cpp @@ -26,25 +26,25 @@ //-------------------------------------------------------------- ofxMuiPanel::ofxMuiPanel(const string& _name, int _x, int _y, int _width, int _height, bool _enabled) : -ofxMuiLabelledObject(_name, _x, _y, _width, _height, _enabled) { +ofxMuiObject(/*_name, */_x, _y, _width, _height, _enabled) { init(); } //-------------------------------------------------------------- ofxMuiPanel::ofxMuiPanel(const string& _name, int _x, int _y,bool _enabled) : -ofxMuiLabelledObject(_name, _x, _y, _enabled) { +ofxMuiObject(/*_name, */ _x, _y, _enabled) { init(); } //-------------------------------------------------------------- ofxMuiPanel::ofxMuiPanel(const string& _name,bool _enabled) : -ofxMuiLabelledObject(_name, _enabled) { +ofxMuiObject(/*_name, */ _enabled) { init(); } //-------------------------------------------------------------- ofxMuiPanel::ofxMuiPanel(bool _enabled) : -ofxMuiLabelledObject(_enabled) { +ofxMuiObject(_enabled) { init(); } @@ -54,19 +54,24 @@ ofxMuiPanel::~ofxMuiPanel() {} //-------------------------------------------------------------- void ofxMuiPanel::init() { setObjectType("PANEL"); - setTooltip(""); +// setTooltip(""); requestBoxLayout(); } //-------------------------------------------------------------- void ofxMuiPanel::draw() { + cout << ">>PANEL" << getBox().x << "/" << getBox().y << "/" << getBox().width << "/" << getBox().height << endl; + + ofPushStyle(); ofPushMatrix(); // initial push ofTranslate(getHitBoxPosition()); - ofxRect(0, 0, width, height); + ofSetColor(255,80); + + ofxRect(getBox()); ofNoFill(); ofPopMatrix(); @@ -79,22 +84,22 @@ ofxMuiButton* ofxMuiPanel::addButton(string name) { addChild(button); return button; } - -//-------------------------------------------------------------- -ofxMuiButton* ofxMuiPanel::addTrigger(string name) { - ofxMuiButton* button = new ofxMuiButton(name); - button->setButtonType(TYPE_TRIGGER); - addChild(button); - return button; -} - -//-------------------------------------------------------------- -ofxMuiButton* ofxMuiPanel::addSwitch(string name) { - ofxMuiButton* button = new ofxMuiButton(name); - button->setButtonType(TYPE_SWITCH); - addChild(button); - return button; -} +// +////-------------------------------------------------------------- +//ofxMuiButton* ofxMuiPanel::addBang(string name) { +// ofxMuiButton* button = new ofxMuiButton(name); +// button->setButtonType(BUTTON_TYPE_BANG); +// addChild(button); +// return button; +//} +// +////-------------------------------------------------------------- +//ofxMuiButton* ofxMuiPanel::addToggle(string name) { +// ofxMuiButton* button = new ofxMuiButton(name); +// button->setButtonType(BUTTON_TYPE_TOGGLE); +// addChild(button); +// return button; +//} ////-------------------------------------------------------------- @@ -104,27 +109,27 @@ ofxMuiButton* ofxMuiPanel::addSwitch(string name) { // return picker; //} -//-------------------------------------------------------------- -ofxMuiSlider* ofxMuiPanel::addSlider(string name) { - ofxMuiSlider* slider = new ofxMuiSlider(name); - addChild(slider); - return slider; -} - -//-------------------------------------------------------------- -ofxMuiKnob* ofxMuiPanel::addKnob(string name) { - ofxMuiKnob* knob = new ofxMuiKnob(name); - addChild(knob); - return knob; -} - -//-------------------------------------------------------------- -ofxMuiNumberBox* ofxMuiPanel::addNumberBox(string name) { - ofxMuiNumberBox* numberBox = new ofxMuiNumberBox(name); - addChild(numberBox); - return numberBox; -} - +////-------------------------------------------------------------- +//ofxMuiSlider* ofxMuiPanel::addSlider(string name) { +// ofxMuiSlider* slider = new ofxMuiSlider(name); +// addChild(slider); +// return slider; +//} +// +////-------------------------------------------------------------- +//ofxMuiKnob* ofxMuiPanel::addKnob(string name) { +// ofxMuiKnob* knob = new ofxMuiKnob(name); +// addChild(knob); +// return knob; +//} +// +////-------------------------------------------------------------- +//ofxMuiNumberBox* ofxMuiPanel::addNumberBox(string name) { +// ofxMuiNumberBox* numberBox = new ofxMuiNumberBox(name); +// addChild(numberBox); +// return numberBox; +//} +// /* ofxMuiSlider* ofxMuiPanel::addSlider(string _name, @@ -302,23 +307,23 @@ void ofxMuiPanel::doContentBoxLayout() { // TODO: center this int labelY = 0; - label->setPosition(currentX, labelY); +// label->setPosition(currentX, labelY); - maxX = MAX(maxX, label->getPosition().x + label->getWidth()); - - currentY+=label->getHeight(); +// maxX = MAX(maxX, label->getPosition().x + label->getWidth()); +// +// currentY+=label->getHeight(); currentX = 0; for(int i = 0; i < childObjects.size(); i++) { - if(childObjects[i] != label && - childObjects[i] != valueLabel) { +// if(childObjects[i] != label && +// childObjects[i] != valueLabel) { currentX = 0; childObjects[i]->setPosition(currentX,currentY); currentY += childObjects[i]->getHeight(); maxX = MAX(maxX,childObjects[i]->getWidth()); - } +// } } diff --git a/src/objects/impl/ofxMuiPanel.h b/src/objects/impl/ofxMuiPanel.h index af82873..cc68197 100644 --- a/src/objects/impl/ofxMuiPanel.h +++ b/src/objects/impl/ofxMuiPanel.h @@ -24,15 +24,15 @@ #pragma once -#include "ofxMuiLabelledObject.h" +//#include "ofxMuiLabelledObject.h" #include "ofxMuiButton.h" //#include "ofxMuiColorPicker.h" -#include "ofxMuiSlider.h" -#include "ofxMuiKnob.h" -#include "ofxMuiNumberBox.h" +//#include "ofxMuiSlider.h" +//#include "ofxMuiKnob.h" +//#include "ofxMuiNumberBox.h" //-------------------------------------------------------------- -class ofxMuiPanel : public ofxMuiLabelledObject +class ofxMuiPanel : public ofxMuiObject { public: @@ -47,14 +47,14 @@ class ofxMuiPanel : public ofxMuiLabelledObject ofxMuiButton* addButton(string name = ""); - ofxMuiButton* addSwitch(string name = ""); - ofxMuiButton* addTrigger(string name = ""); +// ofxMuiButton* addToggle(string name = ""); +// ofxMuiButton* addBang(string name = ""); // ofxMuiColorPicker* addColorPicker(string name = ""); - ofxMuiSlider* addSlider(string name = ""); +// ofxMuiSlider* addSlider(string name = ""); - ofxMuiKnob* addKnob(string name = ""); - ofxMuiNumberBox* addNumberBox(string name = ""); +// ofxMuiKnob* addKnob(string name = ""); +// ofxMuiNumberBox* addNumberBox(string name = ""); /* ofxMuiLabelledButton* addButtonTrigger(string name); @@ -99,7 +99,4 @@ class ofxMuiPanel : public ofxMuiLabelledObject -}; - -//-------------------------------------------------------------- - +}; \ No newline at end of file diff --git a/src/objects/impl/ofxMuiWindow.cpp b/src/objects/impl/ofxMuiWindow.cpp index fc2c3c6..20cd508 100644 --- a/src/objects/impl/ofxMuiWindow.cpp +++ b/src/objects/impl/ofxMuiWindow.cpp @@ -64,27 +64,29 @@ void ofxMuiWindow::init() { isMinimized = false; _isDragMoveable = true; - setTooltip(""); +// setTooltip(""); setBoxProperties(defaults->windowBoxProperties); - + // draw the min max/ active inactive buttons enableDisableButton = new ofxMuiButton(); + enableDisableButton->setButtonIcon(defaults->windowBoxEnableDisableIcon); enableDisableButton->keyBind_toggleValue(defaults->keyboardEnableDisable); - enableDisableButton->setTooltip("Enable/Disable (" + ofToString(defaults->keyboardEnableDisable) + ")"); - enableDisableButton->setTooltipEnabled(true); - addChild(enableDisableButton); +// enableDisableButton->setTooltip("Enable/Disable (" + ofToString(defaults->keyboardEnableDisable) + ")"); +// enableDisableButton->setTooltipEnabled(true); + + addChild(enableDisableButton); minMaxButton = new ofxMuiButton(); minMaxButton->setButtonIcon(defaults->windowBoxMinMaxIcon); minMaxButton->keyBind_toggleValue(defaults->keyboardMinMax); - minMaxButton->setTooltip("Minimize/Maximize (" + ofToString(defaults->keyboardMinMax) + ")"); - minMaxButton->setTooltipEnabled(true); +// minMaxButton->setTooltip("Minimize/Maximize (" + ofToString(defaults->keyboardMinMax) + ")"); +// minMaxButton->setTooltipEnabled(true); addChild(minMaxButton); - + requestBoxLayout(); - + } //-------------------------------------------------------------- @@ -162,7 +164,7 @@ void ofxMuiWindow::draw() { } - + */ @@ -190,9 +192,9 @@ void ofxMuiWindow::maximize() { for(int i = 0; i < childObjects.size(); i++) { if(childObjects[i] != enableDisableButton && - childObjects[i] != minMaxButton && + childObjects[i] != minMaxButton /*&& childObjects[i] != label && - childObjects[i] != valueLabel) { + childObjects[i] != valueLabel*/) { childObjects[i]->show(); } } @@ -208,9 +210,9 @@ void ofxMuiWindow::minimize() { // disallow mouse / keyboard input when hidden for(int i = 0; i < childObjects.size(); i++) { if(childObjects[i] != enableDisableButton && - childObjects[i] != minMaxButton && - childObjects[i] != label && - childObjects[i] != valueLabel) { + childObjects[i] != minMaxButton/*&& + childObjects[i] != label && + childObjects[i] != valueLabel*/) { childObjects[i]->hide(); } } @@ -247,7 +249,7 @@ void ofxMuiWindow::saveToXml(ofxXmlSettings& xml) //-------------------------------------------------------------- void ofxMuiWindow::doContentBoxLayout() { - + cout << "doing content box layout " << endl; int currentX = 0; int currentY = 0; @@ -263,18 +265,18 @@ void ofxMuiWindow::doContentBoxLayout() { // position the label // TODO: center this - int labelY = (minMaxButton->getY() + minMaxButton->getHeight()) / 2.0 -label->getHeight() / 2.0 ; - label->setPosition(currentX, labelY); - - - maxX = MAX(maxX, label->getPosition().x + label->getWidth()); - - currentY+=MAX(MAX(enableDisableButton->getHeight(), - minMaxButton->getHeight()), - label->getHeight()); - - - currentX = 0; +// int labelY = (minMaxButton->getY() + minMaxButton->getHeight()) / 2.0 -label->getHeight() / 2.0 ; +// label->setPosition(currentX, labelY); +// +// +// maxX = MAX(maxX, label->getPosition().x + label->getWidth()); +// +// currentY+=MAX(MAX(enableDisableButton->getHeight(), +// minMaxButton->getHeight()), +// label->getHeight()); +// +// +// currentX = 0; minimizedRect.x = 0; minimizedRect.y = 0; @@ -289,9 +291,9 @@ void ofxMuiWindow::doContentBoxLayout() { } else { for(int i = 0; i < childObjects.size(); i++) { if(childObjects[i] != enableDisableButton && - childObjects[i] != minMaxButton && - childObjects[i] != label && - childObjects[i] != valueLabel) { + childObjects[i] != minMaxButton/*&& + childObjects[i] != label && + childObjects[i] != valueLabel*/) { currentX = 0; childObjects[i]->setPosition(currentX,currentY); currentY += childObjects[i]->getHeight(); diff --git a/src/ofxMui.cpp b/src/ofxMui.cpp index 33708b2..2da8852 100644 --- a/src/ofxMui.cpp +++ b/src/ofxMui.cpp @@ -29,15 +29,15 @@ ofxMui::ofxMui() : ofxMuiEnabler() { width = ofGetWidth(); height = ofGetHeight(); + autoResize = true; init(); - - } //-------------------------------------------------------------- ofxMui::ofxMui(int _w, int _h) : ofxMuiEnabler() { width = _w; height = _h; + autoResize = false; init(); } @@ -60,6 +60,14 @@ ofxMui::~ofxMui() { ofRemoveListener(ofEvents().mouseReleased, this, &ofxMui::mouseReleased); ofRemoveListener(ofEvents().mousePressed, this, &ofxMui::mousePressed); + +//#ifdef defined(TARGET_OF_IPHONE) || defined(TARGET_ANDROID) + ofRemoveListener(ofEvents().touchDown, this, &ofxMui::touchDown); + ofRemoveListener(ofEvents().touchMoved, this, &ofxMui::touchMoved); + ofRemoveListener(ofEvents().touchUp, this, &ofxMui::touchUp); + ofRemoveListener(ofEvents().touchDoubleTap, this, &ofxMui::touchDoubleTap); + ofRemoveListener(ofEvents().touchCancelled, this, &ofxMui::touchCancelled); +//#ifdef for(int i = 0; i < mObjects.size(); i++) { delete mObjects[i]; } @@ -86,12 +94,18 @@ void ofxMui::init() { ofAddListener(ofEvents().mouseReleased, this, &ofxMui::mouseReleased); ofAddListener(ofEvents().mousePressed, this, &ofxMui::mousePressed); + ofAddListener(ofEvents().touchDown, this, &ofxMui::touchDown); + ofAddListener(ofEvents().touchMoved, this, &ofxMui::touchMoved); + ofAddListener(ofEvents().touchUp, this, &ofxMui::touchUp); + ofAddListener(ofEvents().touchDoubleTap, this, &ofxMui::touchDoubleTap); + ofAddListener(ofEvents().touchCancelled, this, &ofxMui::touchCancelled); + mXmlDone = true; // dragging - dragPreviousPosition = ofVec2f(-FLT_MAX, -FLT_MAX); // the last poistion in the drag world + //dragPreviousPosition = ofVec2f(-FLT_MAX, -FLT_MAX); // the last poistion in the drag world - tooltip.setText("tooltip!"); + //tooltip.setText("tooltip!"); handled = NULL; @@ -104,6 +118,8 @@ void ofxMui::init() { // prepare the fbo for fbo.allocate(width, height); + + autoResize = true; } //-------------------------------------------------------------- @@ -127,12 +143,11 @@ void ofxMui::update(ofEventArgs &e) { } } - tooltip._update(e); + //tooltip._update(e); } //-------------------------------------------------------------- -void ofxMui::draw(ofEventArgs &e) -{ +void ofxMui::draw(ofEventArgs &e) { fbo.begin(); { ofPushStyle(); @@ -145,7 +160,7 @@ void ofxMui::draw(ofEventArgs &e) mObjects[i]->_draw(e); ofxMuiPopObject(); } - tooltip._draw(e); + //tooltip._draw(e); ofDisableAlphaBlending(); } ofPopStyle(); @@ -159,8 +174,7 @@ void ofxMui::draw(ofEventArgs &e) } //-------------------------------------------------------------- -void ofxMui::exit(ofEventArgs &e) -{ +void ofxMui::exit(ofEventArgs &e) { if(isEnabled()) { for(int i = 0; i < mObjects.size(); i++) { ofxMuiPushObject(mObjects[i]); @@ -171,8 +185,17 @@ void ofxMui::exit(ofEventArgs &e) } //-------------------------------------------------------------- -void ofxMui::windowResized(ofResizeEventArgs &e) -{ +void ofxMui::windowResized(ofResizeEventArgs &e) { + + if(autoResize) { + width = e.width; + height = e.height; + + if(e.width != fbo.getWidth() || e.height != fbo.getHeight()) { + fbo.allocate(e.width, e.height); + } + } + if(isEnabled()) { for(int i = 0; i < mObjects.size(); i++) { ofxMuiPushObject(mObjects[i]); @@ -182,7 +205,6 @@ void ofxMui::windowResized(ofResizeEventArgs &e) } } - //-------------------------------------------------------------- void ofxMui::fileDragEvent(ofDragInfo &e) { @@ -234,6 +256,7 @@ void ofxMui::keyReleased(ofKeyEventArgs &e) { } } } + //-------------------------------------------------------------- void ofxMui::mouseMoved(ofMouseEventArgs &e) { @@ -246,7 +269,7 @@ void ofxMui::mouseMoved(ofMouseEventArgs &e) { ofxMuiPopObject(); } - tooltip.setObject(handled, e); + //tooltip.setObject(handled, e); } @@ -259,8 +282,8 @@ void ofxMui::mouseDragged(ofMouseEventArgs &e) { isMouseDragging = true; - tooltip.setObject(NULL, e); - tooltip.cancel(); + //tooltip.setObject(NULL, e); + //tooltip.cancel(); if(isEnabled()) { @@ -293,8 +316,8 @@ void ofxMui::mousePressed(ofMouseEventArgs &e) { isMousePressed = true; handled = NULL; // must be unhadled - tooltip.setObject(NULL, e); - tooltip.cancel(); + //tooltip.setObject(NULL, e); + //tooltip.cancel(); if(isEnabled()) { ofxMuiObject* newHandler = NULL; @@ -330,7 +353,7 @@ void ofxMui::mouseReleased(ofMouseEventArgs &e) { } - tooltip.setObject(handled, e); + //tooltip.setObject(handled, e); } @@ -338,6 +361,32 @@ void ofxMui::mouseReleased(ofMouseEventArgs &e) { } +//-------------------------------------------------------------- +void ofxMui::touchDown(ofTouchEventArgs & touch) { + cout << "down" << endl; +} + +//-------------------------------------------------------------- +void ofxMui::touchMoved(ofTouchEventArgs& touch) { + cout << "move" << endl; +} +//-------------------------------------------------------------- + +void ofxMui::touchUp(ofTouchEventArgs& touch) { + cout << "up" << endl; +} + +//-------------------------------------------------------------- +void ofxMui::touchDoubleTap(ofTouchEventArgs& touch) { + cout << "double tap" << endl; +} + +//-------------------------------------------------------------- +void ofxMui::touchCancelled(ofTouchEventArgs& touch) { + cout << "cancel" << endl; +} + + //-------------------------------------------------------------- void ofxMui::bringToFront(int index) { if(index >= 0 && index < mObjects.size()) { @@ -360,7 +409,7 @@ void ofxMui::bringForward(int index) { if(index < (mObjects.size() - 1)) { swap(mObjects[index], mObjects[index+1]); } else { - ofLog(OF_LOG_VERBOSE, "Already at the front."); + ofLogVerbose("ofxMui") << "Already at the front."; } } else { ofLog(OF_LOG_ERROR, "Index out of range."); diff --git a/src/ofxMui.h b/src/ofxMui.h index 309abc4..f27ea6e 100644 --- a/src/ofxMui.h +++ b/src/ofxMui.h @@ -24,12 +24,16 @@ #pragma once +#include + //-------------------------------------------------------------- #include "ofxMuiUtils.h" #include "ofxMuiObject.h" -#include "ofxMuiTooltip.h" +#include "ofxMuiTouch.h" +//#include "ofxMuiTooltip.h" #include "ofxMuiWindow.h" + #define ofxMui_VERSION "1.0" // class ofxMuiObject; @@ -39,9 +43,10 @@ class ofxMuiObject; class ofxMui : public ofxMuiEnabler, public ofxMuiKeyMapper { public: + ofxMui(); - ofxMui(int w, int h); + ofxMui(int w, int h); // auto resize virtual ~ofxMui(); // core oF event suite @@ -53,12 +58,29 @@ class ofxMui : public ofxMuiEnabler, public ofxMuiKeyMapper { void fileDragEvent(ofDragInfo &e); void gotMessage(ofMessage &e); + // input events void keyPressed(ofKeyEventArgs &e); void keyReleased(ofKeyEventArgs &e); + void mouseMoved(ofMouseEventArgs &e); void mouseDragged(ofMouseEventArgs &e); void mousePressed(ofMouseEventArgs &e); void mouseReleased(ofMouseEventArgs &e); + + void touchDown(ofTouchEventArgs & touch); + void touchMoved(ofTouchEventArgs& touch); + void touchUp(ofTouchEventArgs& touch); + void touchDoubleTap(ofTouchEventArgs& touch); + void touchCancelled(ofTouchEventArgs& touch); + + + + + + + + + /// TODO: ALL OF THE BABOVE MOUSE FUNCTIONS SHOULD BE FUNNELED INTO THE TOUCH HANDLERS ofxMuiWindow* addWindow(string name, int x, int y); bool removePanel(ofxMuiPanel* panel); @@ -70,8 +92,15 @@ class ofxMui : public ofxMuiEnabler, public ofxMuiKeyMapper { vector mObjects; vector ::iterator mObjectsIter; + + vector selectedMObjects; + + ofxMuiObject* handled; // is the current active object (mouse over) - ofVec2f dragPreviousPosition; + + //set handled; // for multi-touch + + //ofVec2f dragPreviousPosition; // Panel layer operations void bringToFront(int index); @@ -79,12 +108,15 @@ class ofxMui : public ofxMuiEnabler, public ofxMuiKeyMapper { void sendToBack(int index); void sendBackward(int index); - ofxMuiTooltip tooltip; + //ofxMuiTooltip tooltip; ofxMuiObject* addGuiObject(ofxMuiObject* obj); bool removeGuiObject(ofxMuiObject* obj); - ofFbo* getFboRef(); + //ofFbo& getFboRef(); + + + map activeTouches; private: @@ -99,6 +131,7 @@ class ofxMui : public ofxMuiEnabler, public ofxMuiKeyMapper { bool isMousePressed; bool isMouseDragging; + bool autoResize; int width; int height; @@ -106,3 +139,4 @@ class ofxMui : public ofxMuiEnabler, public ofxMuiKeyMapper { //-------------------------------------------------------------- +typedef ofPtr ofxSharedMui; diff --git a/src/types/ofxMuiBoxProperties.h b/src/types/ofxMuiBoxProperties.h index ab78a3f..b610792 100644 --- a/src/types/ofxMuiBoxProperties.h +++ b/src/types/ofxMuiBoxProperties.h @@ -26,6 +26,8 @@ #include "ofMain.h" + +// TODO: this can now be replaced by combinations of ofAlignVert & ofAlignHorz enum ofxMuiBoxSide { SIDE_LEFT = 0, SIDE_TOP, @@ -33,6 +35,13 @@ enum ofxMuiBoxSide { SIDE_BOTTOM }; +enum ofxMuiBoxCorner { + TOP_LEFT = 0, + TOP_RIGHT, + BOTTOM_RIGHT, + BOTTOM_LEFT +}; + class ofxMuiBoxPropertyQuad { public: @@ -116,7 +125,6 @@ class ofxMuiBoxPropertyQuad { }; class ofxMuiBoxProperties { - public: //-------------------------------------------------------------- @@ -147,6 +155,16 @@ class ofxMuiBoxProperties { //-------------------------------------------------------------- +// float getTotalVerticalPadding() const; +// float getTotalHorizontalPadding() const; +// +// float getTotalVerticalMargin() const; +// float getTotalHorizontalMargin() const; +// +// float getTotalVerticalBorder() const; +// float getTotalHorizontalBorder() const; + + // get po ofxMuiBoxPropertyQuad* getPadding(); ofxMuiBoxPropertyQuad* getMargin(); diff --git a/src/types/ofxMuiColor.h b/src/types/ofxMuiColor.h index e097cef..825a893 100644 --- a/src/types/ofxMuiColor.h +++ b/src/types/ofxMuiColor.h @@ -45,4 +45,6 @@ class ofxMuiColor { bool isEnabled, float alphaScale); + + }; diff --git a/src/types/ofxMuiFont.h b/src/types/ofxMuiFont.h new file mode 100644 index 0000000..5e7c007 --- /dev/null +++ b/src/types/ofxMuiFont.h @@ -0,0 +1,11 @@ +// +// ofxMuiFont.h +// BasicExample +// +// Created by Christopher P. Baker on 9/16/12. +// +// + +#include "ofMain.h" + +typedef ofTrueTypeFont ofxMuiFont; diff --git a/src/types/ofxMuiTouch.cpp b/src/types/ofxMuiTouch.cpp new file mode 100644 index 0000000..6dad1c2 --- /dev/null +++ b/src/types/ofxMuiTouch.cpp @@ -0,0 +1,56 @@ +// +// ofxMuiTouch.cpp +// example-basic +// +// Created by Christopher P. Baker on 12/22/12. +// +// + +#include "ofxMuiTouch.h" + +//-------------------------------------------------------------- +ofxMuiTouch::ofxMuiTouch() {} +//-------------------------------------------------------------- +ofxMuiTouch::~ofxMuiTouch() {} + +//-------------------------------------------------------------- +void ofxMuiTouch::update(const ofTouchEventArgs& evt) { + +} + +//-------------------------------------------------------------- +void ofxMuiTouch::update(const ofMouseEventArgs& evt) { + +} + + +//-------------------------------------------------------------- +ofVec2f ofxMuiTouch::getPosition() const { + return position; +} + +//-------------------------------------------------------------- +ofVec2f ofxMuiTouch::getLastPosition() const { + return lastPosition; +} + +//-------------------------------------------------------------- +ofVec2f ofxMuiTouch::getVelocity() const { + return position - lastPosition; +} + +//-------------------------------------------------------------- +unsigned long long ofxMuiTouch::getLastUpdated() const { + return lastUpdated; +} + +//-------------------------------------------------------------- +unsigned int ofxMuiTouch::getId() const { + return id; +} + +//-------------------------------------------------------------- +unsigned int ofxMuiTouch::getModifiers() const { + return modifiers; +} + diff --git a/src/types/ofxMuiTouch.h b/src/types/ofxMuiTouch.h new file mode 100644 index 0000000..cbae479 --- /dev/null +++ b/src/types/ofxMuiTouch.h @@ -0,0 +1,44 @@ +// +// ofxMuiTouch.h +// example-basic +// +// Created by Christopher P. Baker on 12/22/12. +// +// + +#pragma once + +#include "ofMain.h" + +#include "ofxMuiObject.h" + +class ofxMuiTouch { +public: + ofxMuiTouch(); + virtual ~ofxMuiTouch(); + + void update(const ofTouchEventArgs& evt); + void update(const ofMouseEventArgs& evt); + + + ofVec2f getPosition() const; + ofVec2f getLastPosition() const; + ofVec2f getVelocity() const; + + unsigned long long getLastUpdated() const; + + unsigned int getId() const; + unsigned int getModifiers() const; + + +protected: + + unsigned int id; + unsigned int modifiers; + + ofVec2f position; + ofVec2f lastPosition; + + unsigned long long lastUpdated; + +}; \ No newline at end of file diff --git a/src/types/ofxMuiDeferredDrawTask.h b/src/utils/ofxMuiDeferredDrawTask.h similarity index 100% rename from src/types/ofxMuiDeferredDrawTask.h rename to src/utils/ofxMuiDeferredDrawTask.h diff --git a/src/helpers/ofxMuiEnabler.cpp b/src/utils/ofxMuiEnabler.cpp similarity index 86% rename from src/helpers/ofxMuiEnabler.cpp rename to src/utils/ofxMuiEnabler.cpp index 4d6d44e..e65f335 100644 --- a/src/helpers/ofxMuiEnabler.cpp +++ b/src/utils/ofxMuiEnabler.cpp @@ -35,10 +35,12 @@ _updateEvents(true), _propagateUpdateEvents(true), _drawEvents(true), _propagateDrawEvents(true), -_mouseEvents(true), -_propagateMouseEvents(true), +//_mouseEvents(true), +//_propagateMouseEvents(true), _keyboardEvents(true), _propagateKeyboardEvents(true), +_touchEvents(true), +_propagateTouchEvents(true), _messageEvents(true), _propagateMessageEvents(true), _fileDragEvents(true), @@ -58,10 +60,12 @@ _updateEvents(true), _propagateUpdateEvents(true), _drawEvents(true), _propagateDrawEvents(true), -_mouseEvents(true), -_propagateMouseEvents(true), +//_mouseEvents(true), +//_propagateMouseEvents(true), _keyboardEvents(true), _propagateKeyboardEvents(true), +_touchEvents(true), +_propagateTouchEvents(true), _messageEvents(true), _propagateMessageEvents(true), _fileDragEvents(true), @@ -71,15 +75,12 @@ _propagateWindowResizedEvents(true) { } - //-------------------------------------------------------------- -ofxMuiEnabler::~ofxMuiEnabler() { - // nothing to do -} +ofxMuiEnabler::~ofxMuiEnabler() {} //-------------------------------------------------------------- bool ofxMuiEnabler::isEnabled() const { - return _enabled; + return _enabled; } //-------------------------------------------------------------- @@ -121,7 +122,6 @@ bool ofxMuiEnabler::isLocked() const { //-------------------------------------------------------------- void ofxMuiEnabler::setLocked(bool _val) { - if(isEnabled() && _val != _locked) { _locked = _val; doSetLocked(_val); @@ -140,8 +140,6 @@ bool ofxMuiEnabler::isHidden() const { //-------------------------------------------------------------- void ofxMuiEnabler::setHidden(bool _val) { - //if(_val) //cout << "HIDING" << endl; - // else //cout << "SHOWING" << endl; _hidden = _val; } @@ -152,7 +150,6 @@ void ofxMuiEnabler::hide() { //-------------------------------------------------------------- void ofxMuiEnabler::show() { - //cout << ">>>>>>> SHOW -- "; setHidden(false); } @@ -220,51 +217,72 @@ void ofxMuiEnabler::setPropagateUpdateEvents(bool _val) { } +////-------------------------------------------------------------- +//bool ofxMuiEnabler::isMouseHandler() const { +// return _mouseEvents; +//} +// +////-------------------------------------------------------------- +//void ofxMuiEnabler::setIsMouseHandler(bool _val) { +// _mouseEvents = _val; +//} +// +////-------------------------------------------------------------- +//bool ofxMuiEnabler::propagateMouseEvents() { +// return _propagateMouseEvents; +//} +// +////-------------------------------------------------------------- +//void ofxMuiEnabler::setPropagateMouseEvents(bool _val) { +// _propagateMouseEvents = _val; +//} + + //-------------------------------------------------------------- -bool ofxMuiEnabler::isMouseHandler() const { - return _mouseEvents; +bool ofxMuiEnabler::isKeyboardHandler() { + return _keyboardEvents; } //-------------------------------------------------------------- -void ofxMuiEnabler::setIsMouseHandler(bool _val) { - _mouseEvents = _val; +void ofxMuiEnabler::setIsKeyboardHandler(bool _val) { + _keyboardEvents = _val; } //-------------------------------------------------------------- -bool ofxMuiEnabler::propagateMouseEvents() { - return _propagateMouseEvents; +bool ofxMuiEnabler::propagateKeyboardEvents() { + return _propagateKeyboardEvents; } //-------------------------------------------------------------- -void ofxMuiEnabler::setPropagateMouseEvents(bool _val) { - _propagateMouseEvents = _val; +void ofxMuiEnabler::setPropagateKeyboardEvents(bool _val) { + _propagateKeyboardEvents = _val; } - //-------------------------------------------------------------- -bool ofxMuiEnabler::isKeyboardHandler() { - return _keyboardEvents; +bool ofxMuiEnabler::isTouchHandler() const { + return _touchEvents; } //-------------------------------------------------------------- -void ofxMuiEnabler::setIsKeyboardHandler(bool _val) { - _keyboardEvents = _val; +void ofxMuiEnabler::setIsTouchHandler(bool _val) { + _touchEvents = _val; } //-------------------------------------------------------------- -bool ofxMuiEnabler::propagateKeyboardEvents() { - return _propagateKeyboardEvents; +bool ofxMuiEnabler::propagateTouchEvents() { + return _propagateTouchEvents; } //-------------------------------------------------------------- -void ofxMuiEnabler::setPropagateKeyboardEvents(bool _val) { - _propagateKeyboardEvents = _val; +void ofxMuiEnabler::setPropagateTouchEvents(bool _val) { + _propagateTouchEvents = _val; } //-------------------------------------------------------------- -void ofxMuiEnabler::setPropagatePeripheralEvents(bool _val) { +void ofxMuiEnabler::setPropagateInputEvents(bool _val) { setPropagateKeyboardEvents(_val); - setPropagateMouseEvents(_val); + setPropagateTouchEvents(_val); +// setPropagateMouseEvents(_val); } diff --git a/src/helpers/ofxMuiEnabler.h b/src/utils/ofxMuiEnabler.h similarity index 92% rename from src/helpers/ofxMuiEnabler.h rename to src/utils/ofxMuiEnabler.h index ed7197d..07e4a3a 100644 --- a/src/helpers/ofxMuiEnabler.h +++ b/src/utils/ofxMuiEnabler.h @@ -108,23 +108,30 @@ class ofxMuiEnabler { // INPUT EVENT HANDLING //////////////////////////////////////// //-------------------------------------------------------------- - bool isMouseHandler() const; - void setIsMouseHandler(bool _isMouseHandler); +// bool isMouseHandler() const; +// void setIsMouseHandler(bool _isMouseHandler); bool isKeyboardHandler(); void setIsKeyboardHandler(bool _isKeyboardHandler); + bool isTouchHandler() const; + void setIsTouchHandler(bool _isTouchHandler); + // propagation - bool propagateMouseEvents(); - void setPropagateMouseEvents(bool _propagateMouse); - +// bool propagateMouseEvents(); +// void setPropagateMouseEvents(bool _propagateMouse); +// bool propagateKeyboardEvents(); void setPropagateKeyboardEvents(bool _propagateKeyboard); + bool propagateTouchEvents(); + void setPropagateTouchEvents(bool _propagateTouchEvents); + + // utility - void setPropagatePeripheralEvents(bool _propagatePeripheralInput); + void setPropagateInputEvents(bool _propagateInputEvents); //-------------------------------------------------------------- // OTHER EVENT HANDLING //////////////////////////////////////// @@ -167,7 +174,6 @@ class ofxMuiEnabler { virtual void onUnlocked() {}; private: - // this object bool _enabled; @@ -191,12 +197,15 @@ class ofxMuiEnabler { bool _drawEvents; bool _propagateDrawEvents; - bool _mouseEvents; - bool _propagateMouseEvents; +// bool _mouseEvents; +// bool _propagateMouseEvents; bool _keyboardEvents; bool _propagateKeyboardEvents; + bool _touchEvents; + bool _propagateTouchEvents; + bool _messageEvents; bool _propagateMessageEvents; diff --git a/src/helpers/ofxMuiKeyMapper.cpp b/src/utils/ofxMuiKeyMapper.cpp similarity index 100% rename from src/helpers/ofxMuiKeyMapper.cpp rename to src/utils/ofxMuiKeyMapper.cpp diff --git a/src/helpers/ofxMuiKeyMapper.h b/src/utils/ofxMuiKeyMapper.h similarity index 97% rename from src/helpers/ofxMuiKeyMapper.h rename to src/utils/ofxMuiKeyMapper.h index b5c6be9..61e2bc8 100644 --- a/src/helpers/ofxMuiKeyMapper.h +++ b/src/utils/ofxMuiKeyMapper.h @@ -56,6 +56,8 @@ class ofxMuiKeyMapper { ofxMuiKeyMapper(); virtual ~ofxMuiKeyMapper(); + + // all keys should be described with keys + key modifiers bool removeKeyMap(int key); void setKeyMap(int key, KeyMappedFunc func); bool isKeyMapped(int key); diff --git a/src/types/ofxMuiRange.cpp b/src/utils/ofxMuiRange.cpp similarity index 100% rename from src/types/ofxMuiRange.cpp rename to src/utils/ofxMuiRange.cpp diff --git a/src/types/ofxMuiRange.h b/src/utils/ofxMuiRange.h similarity index 99% rename from src/types/ofxMuiRange.h rename to src/utils/ofxMuiRange.h index 8957cdf..ab1022c 100644 --- a/src/types/ofxMuiRange.h +++ b/src/utils/ofxMuiRange.h @@ -26,6 +26,9 @@ #include "ofMain.h" + +// TODO: use ofxRange + class ofxMuiRange { public: diff --git a/src/helpers/ofxMuiUtils.h b/src/utils/ofxMuiUtils.h similarity index 100% rename from src/helpers/ofxMuiUtils.h rename to src/utils/ofxMuiUtils.h diff --git a/src/objects/impl/ofxGuiColorPicker.cpp b/src/widgets/ofxMuiColorPicker.cpp similarity index 80% rename from src/objects/impl/ofxGuiColorPicker.cpp rename to src/widgets/ofxMuiColorPicker.cpp index 04b5f04..03749c2 100644 --- a/src/objects/impl/ofxGuiColorPicker.cpp +++ b/src/widgets/ofxMuiColorPicker.cpp @@ -1,58 +1,58 @@ // -// ofxGuiColorPicker.cpp +// ofxMuiColorPicker.cpp // BasicExample // // Created by Christopher Baker on 7/24/11. // Copyright 2011 School of the Art Institute of Chicago. All rights reserved. // -#include "ofxGuiColorPicker.h" +#include "ofxMuiColorPicker.h" -ofxGuiColorPicker::ofxGuiColorPicker(string _name, int _x, int _y, int _width, int _height, bool _enabled) : -ofxGuiLabelledObject(_name, _x, _y, _width, _height, _enabled), -ofxGuiNumberData(OFXGUI_FLOAT_ARRAY, 4) { +ofxMuiColorPicker::ofxMuiColorPicker(string _name, int _x, int _y, int _width, int _height, bool _enabled) : +ofxMuiLabelledObject(_name, _x, _y, _width, _height, _enabled), +ofxMuiNumberData(ofxMui_FLOAT_ARRAY, 4) { init(); } //-------------------------------------------------------------- -ofxGuiColorPicker::ofxGuiColorPicker(string _name, int _x, int _y,bool _enabled) : -ofxGuiLabelledObject(_name, _x, _y, _enabled), -ofxGuiNumberData(OFXGUI_FLOAT_ARRAY, 4) { +ofxMuiColorPicker::ofxMuiColorPicker(string _name, int _x, int _y,bool _enabled) : +ofxMuiLabelledObject(_name, _x, _y, _enabled), +ofxMuiNumberData(ofxMui_FLOAT_ARRAY, 4) { init(); } //-------------------------------------------------------------- -ofxGuiColorPicker::ofxGuiColorPicker(string _name,bool _enabled) : -ofxGuiLabelledObject(_name, _enabled), -ofxGuiNumberData(OFXGUI_FLOAT_ARRAY, 4) { +ofxMuiColorPicker::ofxMuiColorPicker(string _name,bool _enabled) : +ofxMuiLabelledObject(_name, _enabled), +ofxMuiNumberData(ofxMui_FLOAT_ARRAY, 4) { init(); } //-------------------------------------------------------------- -ofxGuiColorPicker::ofxGuiColorPicker(bool _enabled) : -ofxGuiLabelledObject(_enabled), -ofxGuiNumberData(OFXGUI_FLOAT_ARRAY, 4) { +ofxMuiColorPicker::ofxMuiColorPicker(bool _enabled) : +ofxMuiLabelledObject(_enabled), +ofxMuiNumberData(ofxMui_FLOAT_ARRAY, 4) { init(); } //-------------------------------------------------------------- -ofxGuiColorPicker::~ofxGuiColorPicker() { +ofxMuiColorPicker::~ofxMuiColorPicker() { } //-------------------------------------------------------------- -void ofxGuiColorPicker::update() { +void ofxMuiColorPicker::update() { ofColor c = getValue(); //tooltip = "HEX: "+ofColorToHexString(getValue()); //tooltip+= "\n"; - tooltip.clear(); - tooltip+= "A: " + ofToString((int)c.a) + "\n"; - tooltip+= "R: " + ofToString((int)c.r) + "\n"; - tooltip+= "G: " + ofToString((int)c.g) + "\n"; - tooltip+= "B: " + ofToString((int)c.b); +// tooltip.clear(); +// tooltip+= "A: " + ofToString((int)c.a) + "\n"; +// tooltip+= "R: " + ofToString((int)c.r) + "\n"; +// tooltip+= "G: " + ofToString((int)c.g) + "\n"; +// tooltip+= "B: " + ofToString((int)c.b); } //-------------------------------------------------------------- -void ofxGuiColorPicker::init() { +void ofxMuiColorPicker::init() { // super class init should have already been called in the constructor def list setObjectType("COLOR_PICKER"); @@ -86,18 +86,18 @@ void ofxGuiColorPicker::init() { } //-------------------------------------------------------------- -void ofxGuiColorPicker::dataChanged() { - //ofNotifyEvent(ofxGuiColorPickerEvent, value, this); +void ofxMuiColorPicker::dataChanged() { + //ofNotifyEvent(ofxMuiColorPickerEvent, value, this); } //-------------------------------------------------------------- -//void ofxGuiColorPicker::keyBind_toggleValue(int key) { +//void ofxMuiColorPicker::keyBind_toggleValue(int key) { // setKeyMap(key,bind(&ofxGuiButton::toggleValue, ref(*this))); //} //-------------------------------------------------------------- -void ofxGuiColorPicker::draw() { +void ofxMuiColorPicker::draw() { //if(name == "MCP") { // cout << "in here" << endl; @@ -171,27 +171,27 @@ void ofxGuiColorPicker::draw() { } //-------------------------------------------------------------- -void ofxGuiColorPicker::onPress() { +void ofxMuiColorPicker::onPress() { showEyeDroperPreview = false; cursor = screenToHitBox(mousePosition); //setValue(picker.getColor(cursor.x,cursor.y)); } //-------------------------------------------------------------- -void ofxGuiColorPicker::onDragOver() { +void ofxMuiColorPicker::onDragOver() { showEyeDroperPreview = false; cursor = screenToHitBox(mousePosition); //setValue(picker.getColor(cursor.x,cursor.y)); } //-------------------------------------------------------------- -void ofxGuiColorPicker::onDragOutside() { +void ofxMuiColorPicker::onDragOutside() { showEyeDroperPreview = true; } //-------------------------------------------------------------- -void ofxGuiColorPicker::onReleaseOutside() { +void ofxMuiColorPicker::onReleaseOutside() { // grab the ceter color and set it @@ -199,18 +199,18 @@ void ofxGuiColorPicker::onReleaseOutside() { } //-------------------------------------------------------------- -void ofxGuiColorPicker::buildFromXml() +void ofxMuiColorPicker::buildFromXml() { //props->mListener->handleGui(mParamId, kofxGui_Set_Bool, &value, sizeof(bool)); } //-------------------------------------------------------------- -void ofxGuiColorPicker::saveToXml() +void ofxMuiColorPicker::saveToXml() { } //-------------------------------------------------------------- -void ofxGuiColorPicker::doContentBoxLayout() { +void ofxMuiColorPicker::doContentBoxLayout() { // // // // regenerate the picker image @@ -241,7 +241,7 @@ void ofxGuiColorPicker::doContentBoxLayout() { -void ofxGuiColorPicker::generatePicker (int w, int h) +void ofxMuiColorPicker::generatePicker (int w, int h) { // draw color. int cw = w - 0.2f*w; // the color width @@ -277,7 +277,7 @@ void ofxGuiColorPicker::generatePicker (int w, int h) } -void ofxGuiColorPicker::setGradient(int x, int y, float w, float h, ofColor c1, ofColor c2 ) +void ofxMuiColorPicker::setGradient(int x, int y, float w, float h, ofColor c1, ofColor c2 ) { float deltaR = c2.r - c1.r; float deltaG = c2.g - c1.g; @@ -293,7 +293,7 @@ void ofxGuiColorPicker::setGradient(int x, int y, float w, float h, ofColor c1, } } -void ofxGuiColorPicker::drawRect( int rx, int ry, int rw, int rh, ofColor rc ) { +void ofxMuiColorPicker::drawRect( int rx, int ry, int rw, int rh, ofColor rc ) { for(int i=rx; i ofxGuiColorPickerEvent; + ofEvent ofxMuiColorPickerEvent; }; diff --git a/src/objects/impl/ofxMuiKnob.cpp b/src/widgets/ofxMuiKnob.cpp similarity index 97% rename from src/objects/impl/ofxMuiKnob.cpp rename to src/widgets/ofxMuiKnob.cpp index 7daebbd..93101ef 100644 --- a/src/objects/impl/ofxMuiKnob.cpp +++ b/src/widgets/ofxMuiKnob.cpp @@ -144,11 +144,14 @@ void ofxMuiKnob::boundsChanged(int index) { //-------------------------------------------------------------- void ofxMuiKnob::update() { - tooltip = toString(); - valueLabel->setText(tooltip); - valueLabel->setTooltip(tooltip); - +// tooltip = toString(); +// valueLabel->setText(tooltip); +// valueLabel->setTooltip(tooltip); +// if(needsRedraw) { // dial shape needs update due to data change + + cout << "here" << endl; + if(getBounds().isBounded()) { innerRadiusW = getHitBoxHalfWidth() * innerRadiusPct; @@ -167,7 +170,6 @@ void ofxMuiKnob::update() { dialShape.arcNegative(0,0,innerRadiusW,innerRadiusH,angleBounds1,angleBounds0); dialShape.close(); - if(getRange().isBounded()) { @@ -203,9 +205,9 @@ void ofxMuiKnob::update() { void ofxMuiKnob::draw() { // pre calculate colors for reuse - ofColor activeAreaBackground = cActiveAreaBackground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale); - ofColor activeAreaFrame = cActiveAreaFrame.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale); - ofColor activeForeground = cActiveAreaForeground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale); + ofColor activeAreaBackground = cActiveAreaBackground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); + ofColor activeAreaFrame = cActiveAreaFrame.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); + ofColor activeForeground = cActiveAreaForeground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale); ofEnableAlphaBlending(); ofPushStyle(); diff --git a/src/objects/impl/ofxMuiKnob.h b/src/widgets/ofxMuiKnob.h similarity index 100% rename from src/objects/impl/ofxMuiKnob.h rename to src/widgets/ofxMuiKnob.h diff --git a/src/objects/impl/ofxMuiLabel.cpp b/src/widgets/ofxMuiLabel.cpp similarity index 97% rename from src/objects/impl/ofxMuiLabel.cpp rename to src/widgets/ofxMuiLabel.cpp index bf4fb10..d69d542 100644 --- a/src/objects/impl/ofxMuiLabel.cpp +++ b/src/widgets/ofxMuiLabel.cpp @@ -32,7 +32,7 @@ ofxMuiLabel::ofxMuiLabel(const string& _name, int _width, int _height, bool _enabled) : - ofxMuiObject(_name, + ofxMuiObject(/*_name,*/ _x, _y, _width, @@ -45,7 +45,7 @@ ofxMuiLabel::ofxMuiLabel(const string& _name, int _x, int _y, bool _enabled) : - ofxMuiObject(_name, + ofxMuiObject(/*_name,*/ _x, _y, _enabled) { @@ -54,7 +54,7 @@ ofxMuiLabel::ofxMuiLabel(const string& _name, ofxMuiLabel::ofxMuiLabel(const string& _name, bool _enabled) : - ofxMuiObject(_name, + ofxMuiObject(/*_name,*/ _enabled) { init(); } @@ -74,11 +74,11 @@ void ofxMuiLabel::init() { setObjectType("LABEL"); - displayText = name; - pDisplayText = name; + //displayText = name; + //pDisplayText = name; - text = name; - pText = name; + //text = name; + //pText = name; setBoxProperties(defaults->labelBoxProperties); @@ -112,7 +112,7 @@ void ofxMuiLabel::draw() { ofPushMatrix(); { if(!displayText.empty()) { - ofSetColor(cText.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cText.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); ofPushMatrix(); // TODO: add support for various text alignments diff --git a/src/objects/impl/ofxMuiLabel.h b/src/widgets/ofxMuiLabel.h similarity index 96% rename from src/objects/impl/ofxMuiLabel.h rename to src/widgets/ofxMuiLabel.h index 8e9694f..eca7e86 100644 --- a/src/objects/impl/ofxMuiLabel.h +++ b/src/widgets/ofxMuiLabel.h @@ -89,9 +89,9 @@ class ofxMuiLabel : public ofxMuiObject { if(isCustomHitBox()) { p = screenToHitBox(mousePosition); - cout << "NAME=>" << name << endl; + //cout << "NAME=>" << name << endl; if(hasParent()) { - cout << "PARENT NAME =" << getParent()->getName() << endl; + // cout << "PARENT NAME =" << getParent()->getName() << endl; } else { cout << "NO PARENT" << endl; } @@ -101,7 +101,7 @@ class ofxMuiLabel : public ofxMuiObject { cout << "NONcustomHitBox" << getHitBoxOffset().x << "/" << getHitBoxOffset().y << ":" << getHitBoxWidth() << "/" << getHitBoxHeight() << endl; } - cout << p.x << "X=" << x << ">><<" << width << endl; + //cout << p.x << "X=" << x << ">><<" << width << endl; float width = 0.0f; for(int i = displayText.size(); i >= 0; i--) { diff --git a/src/objects/base/ofxMuiLabelledObject.cpp b/src/widgets/ofxMuiLabelledObject.cpp similarity index 94% rename from src/objects/base/ofxMuiLabelledObject.cpp rename to src/widgets/ofxMuiLabelledObject.cpp index a2ec501..9413f93 100644 --- a/src/objects/base/ofxMuiLabelledObject.cpp +++ b/src/widgets/ofxMuiLabelledObject.cpp @@ -26,19 +26,19 @@ //-------------------------------------------------------------- ofxMuiLabelledObject::ofxMuiLabelledObject(string _name, int _x, int _y, int _width, int _height, bool _enabled) : -ofxMuiObject(_name, _x, _y, _width, _height, _enabled) { +ofxMuiObject(/*_name,*/_x, _y, _width, _height, _enabled) { init(); } //-------------------------------------------------------------- ofxMuiLabelledObject::ofxMuiLabelledObject(string _name, int _x, int _y,bool _enabled) : -ofxMuiObject(_name, _x, _y, _enabled) { +ofxMuiObject(/*_name,*/ _x, _y, _enabled) { init(); } //-------------------------------------------------------------- ofxMuiLabelledObject::ofxMuiLabelledObject(string _name,bool _enabled) : -ofxMuiObject(_name, _enabled) { +ofxMuiObject(/*_name,*/ _enabled) { init(); } @@ -61,22 +61,22 @@ ofxMuiLabelledObject::~ofxMuiLabelledObject() { void ofxMuiLabelledObject::init() { // add the labels - label = new ofxMuiLabel(name); + label = new ofxMuiLabel();//ofxMuiLabel(name); label->setBoxProperties(defaults->sharedLabelBoxProperties); - label->setName("LABEL"); + //label->setName("LABEL"); label->setText("NULL"); label->disable(); valueLabel = new ofxMuiLabel(); valueLabel->setBoxProperties(defaults->valueLabelBoxProperties); - valueLabel->setName("VALUE LABEL"); + //valueLabel->setName("VALUE LABEL"); valueLabel->setText("NULL"); valueLabel->disable(); - label->setIsMouseHandler(false); + label->setIsTouchHandler(false); label->setIsKeyboardHandler(false); - valueLabel->setIsMouseHandler(false); + valueLabel->setIsTouchHandler(false); valueLabel->setIsKeyboardHandler(false); labelPositionHorz = OF_ALIGN_HORZ_RIGHT; diff --git a/src/objects/base/ofxMuiLabelledObject.h b/src/widgets/ofxMuiLabelledObject.h similarity index 100% rename from src/objects/base/ofxMuiLabelledObject.h rename to src/widgets/ofxMuiLabelledObject.h diff --git a/src/objects/impl/ofxMuiNumberBox.cpp b/src/widgets/ofxMuiNumberBox.cpp similarity index 97% rename from src/objects/impl/ofxMuiNumberBox.cpp rename to src/widgets/ofxMuiNumberBox.cpp index af3de74..eb2b54e 100644 --- a/src/objects/impl/ofxMuiNumberBox.cpp +++ b/src/widgets/ofxMuiNumberBox.cpp @@ -84,9 +84,9 @@ void ofxMuiNumberBox::init() { //-------------------------------------------------------------- void ofxMuiNumberBox::update() { - tooltip = toString(); - valueLabel->setText(tooltip); - valueLabel->setTooltip(tooltip); +// tooltip = toString(); +// valueLabel->setText(tooltip); +// valueLabel->setTooltip(tooltip); } //-------------------------------------------------------------- @@ -101,7 +101,7 @@ void ofxMuiNumberBox::draw() { // default ofFill(); - ofSetColor(cActiveAreaForeground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaForeground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); ofxRect(0, 0, getHitBoxWidth(),getHitBoxHeight()); /* diff --git a/src/objects/impl/ofxMuiNumberBox.h b/src/widgets/ofxMuiNumberBox.h similarity index 100% rename from src/objects/impl/ofxMuiNumberBox.h rename to src/widgets/ofxMuiNumberBox.h diff --git a/src/objects/impl/ofxMuiQuad.cpp b/src/widgets/ofxMuiQuad.cpp similarity index 100% rename from src/objects/impl/ofxMuiQuad.cpp rename to src/widgets/ofxMuiQuad.cpp diff --git a/src/objects/impl/ofxMuiQuad.h b/src/widgets/ofxMuiQuad.h similarity index 100% rename from src/objects/impl/ofxMuiQuad.h rename to src/widgets/ofxMuiQuad.h diff --git a/src/objects/impl/ofxMuiSlider.cpp b/src/widgets/ofxMuiSlider.cpp similarity index 90% rename from src/objects/impl/ofxMuiSlider.cpp rename to src/widgets/ofxMuiSlider.cpp index f00367a..67cc0a6 100644 --- a/src/objects/impl/ofxMuiSlider.cpp +++ b/src/widgets/ofxMuiSlider.cpp @@ -79,7 +79,7 @@ void ofxMuiSlider::init() { normCtrlDragStartMin = 0.0f; normCtrlDragStartMax = 1.0f; - label->setText(name); +// label->setText(name); label->enable(); valueLabel->setText("NULL"); @@ -99,27 +99,27 @@ void ofxMuiSlider::dataChanged() { //-------------------------------------------------------------- void ofxMuiSlider::update() { - tooltip = toString(); - valueLabel->setText(tooltip); - valueLabel->setTooltip(tooltip); +// tooltip = toString(); +// valueLabel->setText(tooltip); +// valueLabel->setTooltip(tooltip); //cout << "setting alhpa scale of label valueLabel->setAlphaScale(getActiveTimer()); // take care of fading - switch(orientation) { - case OF_ORIENTATION_UNKNOWN: - case OF_ORIENTATION_DEFAULT: - case OF_ORIENTATION_180: - valueLabel->alignTo(getHitBox(), - OF_ALIGN_HORZ_LEFT, - OF_ALIGN_VERT_CENTER); - break; - case OF_ORIENTATION_90_RIGHT: - case OF_ORIENTATION_90_LEFT: - valueLabel->alignTo(getHitBox(), - OF_ALIGN_HORZ_CENTER, - OF_ALIGN_VERT_BOTTOM); - break; - } +// switch(orientation) { +// case OF_ORIENTATION_UNKNOWN: +// case OF_ORIENTATION_DEFAULT: +// case OF_ORIENTATION_180: +// valueLabel->alignTo(getHitBox(), +// OF_ALIGN_HORZ_LEFT, +// OF_ALIGN_VERT_CENTER); +// break; +// case OF_ORIENTATION_90_RIGHT: +// case OF_ORIENTATION_90_LEFT: +// valueLabel->alignTo(getHitBox(), +// OF_ALIGN_HORZ_CENTER, +// OF_ALIGN_VERT_BOTTOM); +// break; +// } } //-------------------------------------------------------------- @@ -149,16 +149,16 @@ void ofxMuiSlider::draw() { // background ofFill(); - ofSetColor(cActiveAreaBackground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaBackground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); ofxRect(_x, 0, _w, getHitBoxHeight()); // the value - ofSetColor(cActiveAreaForeground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaForeground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); ofxRect(_x, 0, vWidth, getHitBoxHeight()); // the ofNoFill(); - ofSetColor(cActiveAreaFrame.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaFrame.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); // range handles ofLine(_x, 0, _x, getHitBoxHeight()); @@ -184,16 +184,16 @@ void ofxMuiSlider::draw() { // background ofFill(); - ofSetColor(cActiveAreaBackground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaBackground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); ofxRect(0, yMax, getHitBoxWidth(), yRange); // the value - ofSetColor(cActiveAreaForeground.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaForeground.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); ofxRect(0, yPos, getHitBoxWidth(), yHeight); // the ofNoFill(); - ofSetColor(cActiveAreaFrame.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaFrame.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); // range handles ofLine(0, yPos, getHitBoxWidth(), yPos); @@ -203,7 +203,7 @@ void ofxMuiSlider::draw() { } ofNoFill(); - ofSetColor(cActiveAreaFrame.get(isMouseOver(),isMouseDown(),isEnabled(),alphaScale)); + ofSetColor(cActiveAreaFrame.get(isTouchOver(),isTouchDown(),isEnabled(),alphaScale)); ofRect(0, 0, getHitBoxWidth(), getHitBoxHeight() ); ofPopMatrix(); diff --git a/src/objects/impl/ofxMuiSlider.h b/src/widgets/ofxMuiSlider.h similarity index 99% rename from src/objects/impl/ofxMuiSlider.h rename to src/widgets/ofxMuiSlider.h index 5b34292..fafd706 100644 --- a/src/objects/impl/ofxMuiSlider.h +++ b/src/widgets/ofxMuiSlider.h @@ -26,6 +26,7 @@ #include "ofxMuiLabelledObject.h" #include "ofxMuiNumberData.h" +#include "ofxRectangleUtils.h" //-------------------------------------------------------------- class ofxMuiSlider : public ofxMuiLabelledObject, public ofxMuiNumberData { diff --git a/src/objects/base/ofxMuiTextBlock.cpp b/src/widgets/ofxMuiTextBlock.cpp similarity index 97% rename from src/objects/base/ofxMuiTextBlock.cpp rename to src/widgets/ofxMuiTextBlock.cpp index 8ad66b3..1c93f7c 100644 --- a/src/objects/base/ofxMuiTextBlock.cpp +++ b/src/widgets/ofxMuiTextBlock.cpp @@ -25,7 +25,7 @@ #include "ofxMuiTextBlock.h" //-------------------------------------------------------------- -ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiTrueTypeFont* _font) { +ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiFont* _font) { font = _font; text = ""; blockWidth = numeric_limits::max(); @@ -33,7 +33,7 @@ ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiTrueTypeFont* _font) { init(); } //-------------------------------------------------------------- -ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiTrueTypeFont* _font, const string& _text) { +ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiFont* _font, const string& _text) { font = _font; text = _text; blockWidth = numeric_limits::max(); @@ -41,7 +41,7 @@ ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiTrueTypeFont* _font, const string& _text) init(); } //-------------------------------------------------------------- -ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiTrueTypeFont* _font, const string& _text, float _width) { +ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiFont* _font, const string& _text, float _width) { font = _font; text = _text; blockWidth = _width; @@ -49,7 +49,7 @@ ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiTrueTypeFont* _font, const string& _text, init(); } //-------------------------------------------------------------- -ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiTrueTypeFont* _font, const string& _text, float _width, float _height) { +ofxMuiTextBlock::ofxMuiTextBlock(ofxMuiFont* _font, const string& _text, float _width, float _height) { font = _font; text = _text; blockWidth = _width; @@ -352,7 +352,7 @@ vector ofxMuiTextBlock::getDisplayTextLines() const { } //-------------------------------------------------------------- -void ofxMuiTextBlock::setFont(ofxMuiTrueTypeFont* _font) { +void ofxMuiTextBlock::setFont(ofxMuiFont* _font) { font = _font; needsUpdate = true; } diff --git a/src/objects/base/ofxMuiTextBlock.h b/src/widgets/ofxMuiTextBlock.h similarity index 92% rename from src/objects/base/ofxMuiTextBlock.h rename to src/widgets/ofxMuiTextBlock.h index 8f5e781..f9cd92f 100644 --- a/src/objects/base/ofxMuiTextBlock.h +++ b/src/widgets/ofxMuiTextBlock.h @@ -27,7 +27,7 @@ #include "ofMain.h" #include "ofxMuiConstants.h" #include "ofxMuiTextUtils.h" -#include "ofxMuiTrueTypeFont.h" +#include "ofxMuiFont.h" #include #include #include @@ -44,10 +44,10 @@ using Poco::RegularExpression; class ofxMuiTextBlock { public: - ofxMuiTextBlock(ofxMuiTrueTypeFont* font); - ofxMuiTextBlock(ofxMuiTrueTypeFont* font, const string& _text); - ofxMuiTextBlock(ofxMuiTrueTypeFont* font, const string& _text, float _width); - ofxMuiTextBlock(ofxMuiTrueTypeFont* font, const string& _text, float _width, float _height); + ofxMuiTextBlock(ofxMuiFont* font); + ofxMuiTextBlock(ofxMuiFont* font, const string& _text); + ofxMuiTextBlock(ofxMuiFont* font, const string& _text, float _width); + ofxMuiTextBlock(ofxMuiFont* font, const string& _text, float _width, float _height); virtual ~ofxMuiTextBlock(); @@ -73,8 +73,8 @@ class ofxMuiTextBlock { void setTextColor(const ofColor& _cText); ofColor getTextColor() const; - ofxMuiTrueTypeFont* getFont(); - void setFont(ofxMuiTrueTypeFont* _font); + ofxMuiFont* getFont(); + void setFont(ofxMuiFont* _font); void setCapsStyle(const ofxMuiCapsMode& _capsStyle); ofxMuiCapsMode getCapsStyle() const; @@ -175,7 +175,7 @@ class ofxMuiTextBlock { ofRectangle displayStringBoundingBox; // style - ofxMuiTrueTypeFont* font; + ofxMuiFont* font; ofColor cTextColor; ofxMuiCapsMode capsStyle; ofxMuiLineBreakMode lineBreakMode; diff --git a/src/helpers/ofxMuiTextUtils.h b/src/widgets/ofxMuiTextUtils.h similarity index 99% rename from src/helpers/ofxMuiTextUtils.h rename to src/widgets/ofxMuiTextUtils.h index 6e6e7c6..a0fb4c2 100644 --- a/src/helpers/ofxMuiTextUtils.h +++ b/src/widgets/ofxMuiTextUtils.h @@ -25,7 +25,7 @@ #pragma once #include "ofMain.h" -#include "ofxMuiTrueTypeFont.h" +#include "ofxMuiFont.h" #include #include #include @@ -72,7 +72,7 @@ enum ofxMuiLineBreakMode { //-------------------------------------------------------------- -static void applyTruncation(ofxMuiTrueTypeFont* ttf, +static void applyTruncation(ofxMuiFont* ttf, string& stringToTruncate, float& stringToTruncateWidth, float maximumWidth, @@ -252,7 +252,7 @@ static void applyCaps(string& displayText, ofxMuiCapsMode capsStyle) { //-------------------------------------------------------------- -static void breakLines(ofxMuiTrueTypeFont* ttf, +static void breakLines(ofxMuiFont* ttf, string& stringToWrap, vector& breakPos, vector& charPos, diff --git a/src/objects/impl/ofxMuiTooltip.cpp b/src/widgets/ofxMuiTooltip.cpp similarity index 96% rename from src/objects/impl/ofxMuiTooltip.cpp rename to src/widgets/ofxMuiTooltip.cpp index 9543964..7821499 100644 --- a/src/objects/impl/ofxMuiTooltip.cpp +++ b/src/widgets/ofxMuiTooltip.cpp @@ -133,7 +133,7 @@ void ofxMuiTooltip::setObject(ofxMuiObject* _object, ofMouseEventArgs &e) { touchOff(); touchOn(ofVec2f(e.x,e.y)); currentObject = _object; - setText(currentObject->getTooltip()); + // setText(currentObject->getTooltip()); } } @@ -153,10 +153,9 @@ void ofxMuiTooltip::touchOn(const ofVec2f& mousePosition) { } if(isTouching && !isLocked) { - pX = x; - pY = y; - x = mousePosition.x + vTooltipOffset.x; - y = mousePosition.y + vTooltipOffset.y; + pX = getX(); + pY = getY(); + setPosition(mousePosition + vTooltipOffset); } } diff --git a/src/objects/impl/ofxMuiTooltip.h b/src/widgets/ofxMuiTooltip.h similarity index 100% rename from src/objects/impl/ofxMuiTooltip.h rename to src/widgets/ofxMuiTooltip.h