diff options
Diffstat (limited to 'rotord/src/nodes_drawing.h')
| -rw-r--r-- | rotord/src/nodes_drawing.h | 71 |
1 files changed, 53 insertions, 18 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index de4270c..84c9122 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -58,30 +58,22 @@ namespace Rotor { private: }; - class Text: public Draw_node { + class Text_base: public Draw_node { public: - Text(){ - title="Text"; - description="Draws text"; - create_attribute("text","Text to draw","Text","hello, world!"); + Text_base(){ create_attribute("colour","Colour to fill","Colour","FFFFFF"); create_attribute("font","font to use","Font","Sans",{"Sans","Sans Mono","Serif"}); - create_parameter("number","number","Number to draw","Number",-99999999.0f); create_parameter("size","number","Point size of font","size",50.0f); - UID="7da93b94-2d0b-11e3-8940-77bce0f9d3e8"; + NODEID="7da93b94-2d0b-11e3-8940-77bce0f9d3e8"; }; - Text(map<string,string> &settings):Text() { + Text_base(map<string,string> &settings):Text_base() { base_settings(settings); }; - ~Text(){}; - Text* clone(map<string,string> &_settings) { return new Text(_settings);}; + ~Text_base(){}; + Text_base* clone(map<string,string> &_settings) { return new Text_base(_settings);}; void vector_output(cairo_t * cr,const Frame_spec &frame){ colour=Colour(attributes["colour"]->value); - string text; - if (parameters["number"]->value>-99999998.0f){ - text=toString(parameters["number"]->value,4); - } - else text=attributes["text"]->value; + string text=select_text(frame); cairo_text_extents_t te; cairo_set_source_rgb(cr, colour.Rfloat(),colour.Gfloat(),colour.Bfloat()); cairo_select_font_face (cr, ("DejaVu "+attributes["font"]->value).c_str(), @@ -92,6 +84,49 @@ namespace Rotor { cairo_show_text (cr, text.c_str()); cairo_fill(cr); } + virtual string select_text(const Frame_spec &frame){ + return "hello, world!"; + } + private: + }; + class Text: public Text_base { + public: + Text(){ + title="Text"; + description="Draws text"; + create_attribute("text","Text to draw","Text","hello, world!"); + create_parameter("number","number","Number to draw","Number",-99999999.0f); + NODEID="fdea0b88-4de7-11e3-9235-74d02b29f6a6"; + }; + Text(map<string,string> &settings):Text() { + base_settings(settings); + }; + ~Text(){}; + Text* clone(map<string,string> &_settings) { return new Text(_settings);}; + string select_text(const Frame_spec &frame){ + if (parameters["number"]->value>-99999998.0f){ + return toString(parameters["number"]->value,4); + } + else return attributes["text"]->value; + } + private: + }; + class Lyrics_text: public Text_base { + public: + Lyrics_text(){ + title="Lyrics text"; + description="Draws lyrics text"; + create_attribute("lyrics","Lyrics to draw","Lyrics","hello, world!"); + NODEID="ac4318b8-4de9-11e3-b2eb-74d02b29f6a6"; + }; + Lyrics_text(map<string,string> &settings):Lyrics_text() { + base_settings(settings); + }; + ~Lyrics_text(){}; + Lyrics_text* clone(map<string,string> &_settings) { return new Lyrics_text(_settings);}; + string select_text(const Frame_spec &frame){ + return "Hello, world!"; + } private: }; #define SHAPE_circle 1 @@ -104,7 +139,7 @@ namespace Rotor { description="Draws filled shapes"; create_attribute("shape","Shape to draw","Shape","square",{"circle","square","triangle"}); create_attribute("colour","Colour to fill","Colour","FFFFFF"); - UID="88c30140-2d0b-11e3-8db2-679d596166c1"; + NODEID="88c30140-2d0b-11e3-8db2-679d596166c1"; }; Shape(map<string,string> &settings):Shape() { base_settings(settings); @@ -169,7 +204,7 @@ namespace Rotor { Waves(){ title="Waves"; description="Draws audio waveforms"; - UID="4dd50c56-3b2d-11e3-8691-74d02b29f6a6"; + NODEID="4dd50c56-3b2d-11e3-8691-74d02b29f6a6"; create_attribute("stroke","Colour of line stroke","Stroke","FFFFFF"); create_attribute("fill","Colour of line fill","Fill","11AA11"); create_attribute("mode","Drawing mode","Mode","line",{"line","fill","both"}); @@ -229,7 +264,7 @@ namespace Rotor { title="SVG"; description="Draws svg files"; create_attribute("filename","SVG file to draw","Filename",""); - UID="88c30140-2d0b-11e3-8db2-679d596166c1"; + NODEID="88c30140-2d0b-11e3-8db2-679d596166c1"; rsvg=nullptr; //g_type_init(); //does this have to be done only once? }; |
