void Plotter::UpdateView() { // Track value based on last log sample if( (track || trigger_edge) && !(linked_plotter_x || linked_plotter_y) ) { float newTrackVal[2]; ComputeTrackValue(newTrackVal); if(target.x.max <= newTrackVal[0] ) { ScrollView(newTrackVal[0]-last_track_val[0], newTrackVal[1]-last_track_val[1] ); } last_track_val[0] = newTrackVal[0]; last_track_val[1] = newTrackVal[1]; } const float sf = 1.0f / 20.0f; // XYRange d = target - rview; // rview += d * sf; if( linked_plotter_x ) { // Synchronise rview and target with linked plotter rview.x = linked_plotter_x->rview.x; target.x = linked_plotter_x->target.x; }else{ // Animate view window toward target Rangef d = target.x - rview.x; rview.x += d * sf; } if( linked_plotter_y ) { // Synchronise rview and target with linked plotter rview.y = linked_plotter_y->rview.y; target.y = linked_plotter_y->target.y; }else{ // Animate view window toward target Rangef d = target.y - rview.y; rview.y += d * sf; } }
void Ctrl::ScrollView(int dx, int dy) { ScrollView(Rect(GetSize()), dx, dy); }
void Ctrl::ScrollView(int x, int y, int cx, int cy, int dx, int dy) { ScrollView(RectC(x, y, cx, cy), dx, dy); }
void PartitionListView::AttachedToWindow() { Inherited::AttachedToWindow(); PartitionColumn::InitTextMargin(ScrollView()); }
void Plotter::Special(View&, InputSpecial inType, float x, float y, float p1, float p2, float /*p3*/, float /*p4*/, int button_state) { if(inType == InputSpecialScroll) { const float d[2] = {p1,-p2}; const float is[2] = {rview.x.Size(),rview.y.Size() }; const float df[2] = {is[0]*d[0]/(float)v.w, is[1]*d[1]/(float)v.h}; ScrollView(-df[0], -df[1]); } else if(inType == InputSpecialZoom) { float scalex = 1.0; float scaley = 1.0; #ifdef _OSX_ if (button_state & KeyModifierCmd) { #else if (button_state & KeyModifierCtrl) { #endif scalex = 1-p1; }else{ scaley = 1-p1; } const float c[2] = { track || trigger_edge ? last_track_val[0] : hover[0], hover[1] }; ScaleView(scalex, scaley, c[0], c[1]); } // Update hover status (after potential resizing) ScreenToPlot( (int)x, (int)y, hover[0], hover[1]); } void Plotter::AddSeries(const std::string& x_expr, const std::string& y_expr, DrawingMode drawing_mode, Colour colour, const std::string& title, DataLog *log) { if( !std::isfinite(colour.r) ) { colour = colour_wheel.GetUniqueColour(); } plotseries.push_back( PlotSeries() ); plotseries.back().CreatePlot(x_expr, y_expr, colour, (title == "$y") ? y_expr : title); plotseries.back().log = log; plotseries.back().drawing_mode = (GLenum)drawing_mode; } void Plotter::ClearSeries() { plotseries.clear(); } Marker& Plotter::AddMarker(Marker::Direction d, float value, Marker::Equality leg, Colour c ) { return AddMarker(Marker(d,value,leg,c)); } Marker& Plotter::AddMarker( const Marker& marker ) { plotmarkers.push_back( marker ); return plotmarkers.back(); }
void TeamsListView::AttachedToWindow() { Inherited::AttachedToWindow(); TeamsColumn::InitTextMargin(ScrollView()); }