Commit d70f2b0c authored by Thibault Soucarre's avatar Thibault Soucarre

add variable texts

parent e7434a41
......@@ -294,6 +294,17 @@ void Render_alternate::paintGL(){
t,
arial_font);
//draw texts for variables
std::map<long int, Variable_text_>::const_iterator it=_variable_texts.begin();
const std::map<long int, Variable_text_>::const_iterator it_end=_variable_texts.end();
for(;it!=it_end;it++){
renderText ( render_to_screen_x(trace_to_render_x(vertical_line))+3,
render_to_screen_y( trace_to_render_y((*it).second.y) + 0.5),
QString().setNum((*it).second.value),
arial_font);
}
qglColor(Qt::white);
//we calculate the height of the interline we want : max height of the font + 1 pixel to avoid overlapping (metric.height() returns a bigger value, a bit too much)
......@@ -327,7 +338,7 @@ void Render_alternate::paintGL(){
//displayed++;
}//else{skipped++;}
}
/*Draw ruler text*/
std::ostringstream buf_txt;
Element_pos graduation_diff;
Element_pos coeff_prefix;
......@@ -832,8 +843,22 @@ void Render_alternate::release(){
}
void Render_alternate::draw_text_value(long int id,double text, double y){
if(y!=-1){
Variable_text_ buf;
buf.y=y;
buf.value=text;
// printf("adding %f at %f for %p\n", text, y, (void*)id);
_variable_texts[id]=buf;
}else{
//it's an update
Variable_text_ buf=_variable_texts[id];
buf.value=text;
//printf("updating %f at %f for %p\n", text, y, (void*)id);
_variable_texts[id]=buf;
}
}
void Render_alternate::show_minimap(){
}
......
......@@ -75,7 +75,13 @@
class Render_alternate;
class Interface_console;
struct Container_text_;
/*!
* \brief Structure used to store text for variables.
*/
struct Variable_text_{
Element_pos y;
Element_pos value;
};
/*!
* \brief This class redefined the OpenGL widget - QGLWidget - to display the trace.
......@@ -91,6 +97,7 @@ private:
std::vector<Element_pos> _links;
std::vector<Element_pos> _events;
std::vector<Container_text_> _texts;
std::map<long int, Variable_text_> _variable_texts;
glm::mat4 _modelview;
glm::mat4 _projection;
Vbo _containers;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment