Re-enable dive computer selectiom

This had been disabled by some redraw optimizations in commit
81406b80c6ec ("Fix loading a second dive, after the first file was
loaded."). We need to redraw the plot not only if the dive changed but
also if the selected divecomputer changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-22 20:31:27 -07:00
parent 33135e37a5
commit 7757363953
2 changed files with 9 additions and 7 deletions

View file

@ -114,7 +114,7 @@ extern struct ev_select *ev_namelist;
extern int evn_allocated;
extern int evn_used;
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0)
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0)
{
gc.printer = false;
setScene(new QGraphicsScene());
@ -222,11 +222,17 @@ void ProfileGraphicsView::clear()
void ProfileGraphicsView::plot(struct dive *d)
{
if (dive == d)
struct divecomputer *dc;
if (d)
dc = select_dc(&d->dc);
if (dive == d && (d && dc == diveDC))
return;
clear();
dive = d;
diveDC = d ? dc : NULL;
if(!isVisible() || !dive){
return;
@ -244,9 +250,6 @@ void ProfileGraphicsView::plot(struct dive *d)
scene()->addItem(toolTip);
struct divecomputer *dc = &dive->dc;
// Fix this for printing / screen later.
// plot_set_scale(scale_mode_t);
@ -283,8 +286,6 @@ void ProfileGraphicsView::plot(struct dive *d)
gc.maxx = (profile_grid_area.width() - 2 * profile_grid_area.x());
gc.maxy = (profile_grid_area.height() - 2 * profile_grid_area.y());
dc = select_dc(dc);
/* This is per-dive-computer. Right now we just do the first one */
gc.pi = *create_plot_info(dive, dc, &gc);

View file

@ -98,6 +98,7 @@ private:
ToolTipItem *toolTip;
graphics_context gc;
struct dive *dive;
struct divecomputer *diveDC;
int zoomLevel;
// Top Level Items.