summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-12-11 14:12:48 +0000
committerTim Redfern <tim@eclectronics.org>2013-12-11 14:12:48 +0000
commit1bae3f889b11933353d4ef31c692c9b7cb9f5047 (patch)
tree0f3e97e82d861482bd3b6f37e47dc718c8842ab2
parent328453e61a8992729c0ecc661ad324b63af6b41d (diff)
prototypes for UI number types
-rw-r--r--rotord/src/nodes_drawing.h2
-rw-r--r--rotord/src/rotor.cpp6
-rw-r--r--rotord/src/rotor.h3
3 files changed, 7 insertions, 4 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h
index cbc8702..ec70b96 100644
--- a/rotord/src/nodes_drawing.h
+++ b/rotord/src/nodes_drawing.h
@@ -128,7 +128,7 @@ namespace Rotor {
title="UI_text";
description="Draws text entered by the user";
create_attribute("text","Text to draw","Text","hello, world!");
- create_attribute("UItype" "UI type","UI type to use","text",{"text"});
+ UItype="text";
NODEID="22b47bea-52a9-11e3-b2b3-74d02b29f6a6";
};
UI_text(map<string,string> &settings):UI_text() {
diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp
index 36eb2fa..d16d9f4 100644
--- a/rotord/src/rotor.cpp
+++ b/rotord/src/rotor.cpp
@@ -81,6 +81,8 @@ Node_factory::Node_factory(){
category["UI"]=vector<Node*>();
add_type("ui_text",new UI_text(),category["UI"]);
add_type("number",new Number(),category["UI"]);
+ add_type("dial",new Dial(),category["UI"]);
+ add_type("slider",new Slider(),category["UI"]);
}
double Signal_input::get_time_used(){
@@ -164,7 +166,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;
+ node["UItype"]=_node->UItype;
if (_node->inputs.size()){
node["signal_inputs"]=Json::arrayValue;
for (auto& input: _node->inputs) {
@@ -234,7 +236,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);
+ 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 766802f..0013313 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -338,7 +338,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;
@@ -379,6 +379,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;};
double find_setting(map<string,string> &settings,string key,double def){ if (settings.find(key)!=settings.end()) return toFloat(settings[key]); else return def;};