From 5eb823abb8ba91dbab098d7195094d0f76e4f332 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 21 Nov 2013 12:36:36 +0000 Subject: UI text node outline --- rotord/src/nodes_drawing.h | 19 +++++++++++++++++++ rotord/src/rotor.cpp | 5 +++++ rotord/src/rotor.h | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) (limited to 'rotord/src') 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 &settings):UI_text() { + base_settings(settings); + }; + ~UI_text(){}; + UI_text* clone(map &_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(); + add_type("ui_text",new UI_text(),category["UI"]); + } bool Signal_input::connect(Node* source) { connection=dynamic_cast(source); @@ -135,6 +138,7 @@ Json::Value Node_factory::list_node(Rotor::Node* _node){ if (dynamic_cast (_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 (type)!=nullptr) XML.addAttribute("node","output","signal",i); if (dynamic_cast (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 &_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 &settings,string key,string def=""){ if (settings.find(key)!=settings.end()) return settings[key]; else return def;}; float find_setting(map &settings,string key,float def){ if (settings.find(key)!=settings.end()) return toFloat(settings[key]); else return def;}; -- cgit v1.2.3