1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
#pragma once
#include "ofMain.h"
#include "ofxGui.h"
#include "ofxXmlSettings.h"
#include "ofxSVG.h"
#include "ofxClipper.h"
#include "ofxMidi.h"
#include "ofxPONK.h"
#include "lineTransformer.h"
#include "lineSegmenter.h"
static ofVec2f DISPLAYSIZE(200,200);
static int panelnum=1;
class vectorPanel {
public:
vectorPanel(
string _title="",
ofVec2f _size=DISPLAYSIZE,
ofVec2f _pos=ofPoint(5,5))
{
size=_size;
position=_pos;
panel.setup(_title,"",0,size.y+5);
}
void draw(){
ofPushMatrix();
ofTranslate(position);
ofSetColor(255);
ofNoFill();
ofDrawRectangle(0,0,size.x,size.y);
panel.draw();
ofPushMatrix();
ofTranslate(size/2);
drawcontent();
ofPopMatrix();
ofPopMatrix();
}
virtual void drawcontent();
private:
ofVec2f size;
ofPoint position;
ofxPanel panel;
};
class svgPanel: public vectorPanel{
public:
svgPanel(
string _title="",
ofVec2f _size=DISPLAYSIZE,
ofVec2f _pos=ofPoint(5,5)
) : vectorPanel(_title,_size,_pos){}
void load(string filename){
ofLog()<<"loading SVG "<<filename;
svg.load(filename);
//gui code contains segmenters
}
void drawcontent(){
svg.draw();
}
private:
ofxSVG svg;
};
class ofApp: public ofBaseApp, public ofxMidiListener {
public:
ofApp() :
networkinput("network",DISPLAYSIZE,ofPoint(5,5)),
svginput("svg",DISPLAYSIZE,ofPoint(210,5)),
textinput("text",DISPLAYSIZE,ofPoint(415,5)) {}
void setup();
void update();
void draw();
void exit();
void keyPressed(ofKeyEventArgs &keyargs);
void keyReleased(ofKeyEventArgs & args);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void newMidiMessage(ofxMidiMessage& eventArgs);
//======================================= //MIDI
ofxMidiIn midiIn;
ofxMidiMessage midiMessage;
//======================================= //saving settings
ofxXmlSettings XML;
void default_settings();
void save_settings();
void load_settings();
//======================================= //inputs
svgPanel networkinput;
svgPanel svginput;
svgPanel textinput;
};
|