diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-11-21 12:36:36 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-11-21 12:36:36 +0000 |
| commit | 5eb823abb8ba91dbab098d7195094d0f76e4f332 (patch) | |
| tree | 0c5b7b7e21fcf46e5c6d6b63db1de23483296537 | |
| parent | b46286b8262cd5a4b96ac318a6d85d3db39e09e5 (diff) | |
UI text node outline
| -rw-r--r-- | rotord/src/nodes_drawing.h | 19 | ||||
| -rw-r--r-- | rotord/src/rotor.cpp | 5 | ||||
| -rw-r--r-- | rotord/src/rotor.h | 3 |
3 files changed, 26 insertions, 1 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index 77a74cb..288514c 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -111,6 +111,25 @@ namespace Rotor { } private: }; + class UI_text: public Text_base { + public: + UI_text(){ + title="UI_text"; + description="Draws text entered by the user"; + create_attribute("text","Text to draw","Text","hello, world!"); + NODEID="22b47bea-52a9-11e3-b2b3-74d02b29f6a6"; + UItype="text"; + }; + UI_text(map<string,string> &settings):UI_text() { + base_settings(settings); + }; + ~UI_text(){}; + UI_text* clone(map<string,string> &_settings) { return new UI_text(_settings);}; + string select_text(const Frame_spec &frame){ + return attributes["text"]->value; + } + private: + }; class Lyrics: public Text_base { public: Lyrics(){ diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp index 0bb9341..b7bf642 100644 --- a/rotord/src/rotor.cpp +++ b/rotord/src/rotor.cpp @@ -77,6 +77,9 @@ Node_factory::Node_factory(){ add_type("echo_trails",new Echo_trails(),category["FX"]); add_type("video_feedback",new Video_feedback(),category["FX"]); + category["UI"]=vector<Node*>(); + add_type("ui_text",new UI_text(),category["UI"]); + } bool Signal_input::connect(Node* source) { connection=dynamic_cast<Signal_node*>(source); @@ -135,6 +138,7 @@ Json::Value Node_factory::list_node(Rotor::Node* _node){ if (dynamic_cast<Image_node*> (_node)!=nullptr) node["output"]="image"; node["description"]=_node->description; node["NODEID"]=_node->NODEID; + node["UItype"]=_node->UItype; if (_node->inputs.size()){ node["signal_inputs"]=Json::arrayValue; for (auto& input: _node->inputs) { @@ -204,6 +208,7 @@ void Node_factory::list_node(Rotor::Node* type,xmlIO XML,int i){ XML.addAttribute("node","title",type->title,i); XML.addAttribute("node","description",type->description,i); XML.addAttribute("node","NODEID",type->NODEID,i); + XML.addAttribute("node","UItype",type->UItype,i); if (dynamic_cast<Signal_node*> (type)!=nullptr) XML.addAttribute("node","output","signal",i); if (dynamic_cast<Image_node*> (type)!=nullptr) XML.addAttribute("node","output","image",i); XML.pushTag("node",i); diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index 0833096..3874df6 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -280,7 +280,7 @@ namespace Rotor { }; class Node{ public: - Node(){duplicate_inputs=false;}; + Node(){duplicate_inputs=false;UItype="";}; virtual Node* clone(map<string,string> &_settings)=0; //pure virtual virtual ~Node(){ for (auto a: attributes) delete a.second; @@ -320,6 +320,7 @@ namespace Rotor { string ID; string NODEID; string title; + string UItype; bool duplicate_inputs; string find_setting(map<string,string> &settings,string key,string def=""){ if (settings.find(key)!=settings.end()) return settings[key]; else return def;}; float find_setting(map<string,string> &settings,string key,float def){ if (settings.find(key)!=settings.end()) return toFloat(settings[key]); else return def;}; |
