128 lines
2.1 KiB
C++
128 lines
2.1 KiB
C++
#ifndef _CUTICLE_FRAME_H
|
|
#define _CUTICLE_FRAME_H
|
|
|
|
#include<vector>
|
|
#include<set>
|
|
#include<wx/frame.h>
|
|
#include<wx/panel.h>
|
|
#include<wx/aui/aui.h>
|
|
#include<wx/button.h>
|
|
#include<wx/spinctrl.h>
|
|
#include<wx/statusbr.h>
|
|
#include<wx/toolbar.h>
|
|
#include<wx/checkbox.h>
|
|
|
|
#include<hi/node.h>
|
|
|
|
#include<hi/img.h>
|
|
|
|
struct NodeGraph;
|
|
struct ImageViewer;
|
|
struct Timeline;
|
|
struct ctTimeCtrl;
|
|
|
|
struct Frame : wxFrame {
|
|
wxAuiManager aui;
|
|
|
|
ImageViewer *viewer;
|
|
NodeGraph *graph;
|
|
Timeline *timeline;
|
|
|
|
wxStatusBar *stba;
|
|
wxToolBar *tlba;
|
|
|
|
struct {
|
|
ctTimeCtrl *duration;
|
|
wxCheckBox *durationEnable;
|
|
|
|
wxButton *btnPerform;
|
|
} toolbar;
|
|
|
|
Frame();
|
|
virtual ~Frame();
|
|
};
|
|
|
|
struct GrNode : wxPanel {
|
|
struct Port {
|
|
wxString name;
|
|
enum class Type {
|
|
NONE, FILE_OPEN, COLOR, VEC1, VEC2, VEC3, VEC4, TEXT, SAMPLE, FILE_SAVE, MIC_SOURCE, WINDOW_SOURCE
|
|
} type;
|
|
};
|
|
std::vector<Port> sinks;
|
|
std::vector<Port> sources;
|
|
|
|
wxString name;
|
|
|
|
CHiPubNode *logical;
|
|
|
|
GrNode(NodeGraph*);
|
|
virtual ~GrNode();
|
|
|
|
bool MouseOverPort(wxPoint p, bool &source, int &i);
|
|
|
|
void MakeKeyframe(int i);
|
|
|
|
virtual void Fit() override;
|
|
};
|
|
|
|
struct ImageViewer : wxPanel {
|
|
wxPoint pos;
|
|
wxImage img;
|
|
wxBitmap bm;
|
|
size_t bufW, bufH;
|
|
uint8_t *buf = nullptr;
|
|
float siez = 512;
|
|
|
|
wxPoint drag;
|
|
|
|
ImageViewer(Frame*);
|
|
virtual ~ImageViewer() = default;
|
|
|
|
void SetImage(CHiImage *img);
|
|
void ResizeImage(float);
|
|
};
|
|
|
|
struct NodeGraph : wxPanel {
|
|
struct Link {
|
|
GrNode *input;
|
|
int i;
|
|
GrNode *output;
|
|
int o;
|
|
|
|
struct Comparator {
|
|
bool operator ()(const Link &a, const Link &b) {
|
|
if(a.input != b.input) return a.input < b.input;
|
|
else if(a.i != b.i) return a.i < b.i;
|
|
else if(a.output != b.output) return a.output < b.output;
|
|
else return a.o < b.o;
|
|
}
|
|
};
|
|
};
|
|
|
|
GrNode *attacheeNode = NULL;
|
|
int attacheePort;
|
|
int attacheePortIsSource;
|
|
|
|
GrNode *dragged = NULL;
|
|
wxPoint dragPos;
|
|
|
|
CHiNodeGraph *backendNG = NULL;
|
|
|
|
std::vector<GrNode*> gnodes;
|
|
std::vector<Link> links;
|
|
|
|
NodeGraph(Frame*);
|
|
virtual ~NodeGraph();
|
|
|
|
void Alinken(Link l);
|
|
|
|
void Dirtify(GrNode *g);
|
|
|
|
bool DetectCycles(GrNode*);
|
|
};
|
|
|
|
|
|
|
|
#endif
|