From 1584507071a2aa4cb27801e980dce0e1843069a4 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Mon, 1 Oct 2012 20:12:05 +0100 Subject: passing parent pointer --- liveengine/src/testApp.cpp | 39 ++++++++++++++++--------- liveengine/src/testApp.h | 73 +++++++++++++++++++++++++++++----------------- 2 files changed, 73 insertions(+), 39 deletions(-) (limited to 'liveengine/src') diff --git a/liveengine/src/testApp.cpp b/liveengine/src/testApp.cpp index 7053421..7f0ff47 100755 --- a/liveengine/src/testApp.cpp +++ b/liveengine/src/testApp.cpp @@ -16,14 +16,18 @@ guiWindow::~guiWindow(){ cout << "gui window destroyed" << endl; } void guiWindow::setup(){} -void guiWindow::setGui(ofxPanel *panel){ - gui=panel; +void guiWindow::setParent(testApp *p){ + parent=p; } void guiWindow::draw(){ - gui->draw(); + parent->gui.draw(); } +void guiWindow::dragEvent(ofDragInfo dragInfo, ofxFenster* win){ + printf("gui received file:%s\n",dragInfo.files[0].c_str()); +} + //-------------------------------------------------------------- void testApp::setup(){ int midiPort=0; @@ -52,7 +56,7 @@ void testApp::setup(){ note=0; makeColours(); - + colShift=0; controlColours=false; @@ -94,17 +98,20 @@ void testApp::setup(){ //preview window stuff + prevWin=new previewWindow(); win=ofxFensterManager::get()->createFenster(0, 0, 600, 800, OF_WINDOW); ofAddListener(win->events.mouseDragged, this, &testApp::mousePressedEvent); ofAddListener(win->events.mousePressed, this, &testApp::mousePressedEvent); ofAddListener(win->events.keyPressed, this, &testApp::keyPressedEvent); + ofAddListener(win->events.fileDragEvent, this, &testApp::refDragEvent); win->setWindowTitle("preview"); - win->addListener(&prevWin); - prevWin.setup(); - prevWin.setBuffer(&vp1.rb2); + win->addListener(prevWin); + prevWin->setup(); + prevWin->setBuffer(&vp1.rb2); fullscreenoutput=false; + guiWin=new guiWindow(); gui.setup("","panel.xml",0,0); gui.add(reversemain.setup("reverse main", false)); gui.add(controlColours.setup("control colours", false)); @@ -118,13 +125,13 @@ void testApp::setup(){ //gui window stuff ofxFenster* win2=ofxFensterManager::get()->createFenster(0, 0, 200, 400, OF_WINDOW); - //ofAddListener(win2->events.mouseDragged, this, &testApp::mousePressedEvent); - //ofAddListener(win2->events.mousePressed, this, &testApp::mousePressedEvent); + ofAddListener(win2->events.fileDragEvent, this, &testApp::refDragEvent); + //ofAddListener(win2->events.mousePressed, 0, &testApp::mousePressedEvent); //ofAddListener(win2->events.keyPressed, this, &testApp::keyPressedEvent); win2->setWindowTitle("config"); - win2->addListener(&guiWin); - guiWin.setup(); - guiWin.setGui(&gui); + win2->addListener(guiWin); + guiWin->setup(); + guiWin->setParent(this); } @@ -452,8 +459,14 @@ void testApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- +void testApp::refDragEvent(ofDragInfo &dragInfo){ + dragEvent(dragInfo); +} +void testApp::dragEvent(ofDragInfo dragInfo, ofxFenster* win){ + dragEvent(dragInfo); +} void testApp::dragEvent(ofDragInfo dragInfo){ - + printf("received file:%s\n",dragInfo.files[0].c_str()); } void testApp::mousePressedEvent(ofMouseEventArgs &args) { diff --git a/liveengine/src/testApp.h b/liveengine/src/testApp.h index 0da5eae..a03ad4b 100755 --- a/liveengine/src/testApp.h +++ b/liveengine/src/testApp.h @@ -28,6 +28,11 @@ object remembers playback head/ heads initial footage set for each track: program change? (does this leave any room for creative input) or set via gui? +video playback object +still image object + +load files in gui - loadable area + creative input - alter layers live via AVS compatible system which also allows local MIDI control, scripting, manipulating layers etc @@ -78,24 +83,17 @@ option to randomise colours on each note #include "viewport.h" -class previewWindow: public ofxFensterListener{ -public: - ~previewWindow(); - ofFbo *rb; - void setup(); - void setBuffer(ofFbo *buffer); - void draw(); -}; - -class guiWindow: public ofxFensterListener{ -public: - ~guiWindow(); - ofxPanel *gui; - void setup(); - void setGui(ofxPanel *panel); - void draw(); +/* +enum PropertyAttribute { + None = 0, + ReadOnly = 1 << 0, + DontEnum = 1 << 1, + DontDelete = 1 << 2 }; +*/ +class previewWindow; +class guiWindow; //#define GRAB_TEXTURE @@ -115,9 +113,11 @@ class testApp : public ofxFensterListener, public ofxMidiListener{ void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); - void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); + void dragEvent(ofDragInfo dragInfo); + void dragEvent(ofDragInfo dragInfo,ofxFenster* win); + void refDragEvent(ofDragInfo &args); void mousePressedEvent(ofMouseEventArgs &args); void keyPressedEvent(ofKeyEventArgs &args); @@ -134,7 +134,7 @@ class testApp : public ofxFensterListener, public ofxMidiListener{ //to be moved into svg object gui bool debug; - + bool fullscreenoutput; float lastnoteTime; @@ -147,16 +147,16 @@ class testApp : public ofxFensterListener, public ofxMidiListener{ int xshift,yshift; ofColor* controller_colours; - + float colShift; viewport vp1,vp2; - previewWindow prevWin; - guiWindow guiWin; - + previewWindow *prevWin; + guiWindow *guiWin; + ofxFenster* win; - + int midiChannel; ofxMidiIn midiIn; @@ -164,7 +164,7 @@ class testApp : public ofxFensterListener, public ofxMidiListener{ void newMidiMessage(ofxMidiEventArgs& eventArgs); playlist list; - + ofxPanel gui; ofxToggle reversemain; ofxToggle controlColours; @@ -172,10 +172,31 @@ class testApp : public ofxFensterListener, public ofxMidiListener{ ofxToggle transparentBlack; ofxButton resetDrawscale; ofxButton resetFBscale; - + void resetDrawscalePressed(bool & pressed); void resetFBscalePressed(bool & pressed); - + +}; + + +class previewWindow: public ofxFensterListener{ +public: + ~previewWindow(); + ofFbo *rb; + void setup(); + void setBuffer(ofFbo *buffer); + void draw(); +}; + +class guiWindow: public ofxFensterListener{ +public: + ~guiWindow(); + testApp *parent; + void setup(); + void setParent(testApp *p); + void draw(); + void dragEvent(ofDragInfo dragInfo,ofxFenster* win); }; + -- cgit v1.2.3