diff options
-rw-r--r-- | profile.c | 70 | ||||
-rw-r--r-- | qt-ui/profilegraphics.cpp | 2 | ||||
-rw-r--r-- | qt-ui/profilegraphics.h | 28 |
3 files changed, 3 insertions, 97 deletions
@@ -41,40 +41,6 @@ int x_abs(double x) { return x - last_gc.drawing_area.x; } - -static void move_to(struct graphics_context *gc, double x, double y) -{ - cairo_move_to(gc->cr, SCALE(gc, x, y)); -} - -static void line_to(struct graphics_context *gc, double x, double y) -{ - cairo_line_to(gc->cr, SCALE(gc, x, y)); -} - -static void set_source_rgba(struct graphics_context *gc, color_indice_t c) -{ - const color_t *col = &profile_color[c]; - struct rgba rgb = col->media[gc->printer]; - double r = rgb.r; - double g = rgb.g; - double b = rgb.b; - double a = rgb.a; - - cairo_set_source_rgba(gc->cr, r, g, b, a); -} - -void init_profile_background(struct graphics_context *gc) -{ - set_source_rgba(gc, BACKGROUND); -} - -static void pattern_add_color_stop_rgba(struct graphics_context *gc, cairo_pattern_t *pat, double o, color_indice_t c) -{ - const color_t *col = &profile_color[c]; - struct rgba rgb = col->media[gc->printer]; - cairo_pattern_add_color_stop_rgba(pat, o, rgb.r, rgb.g, rgb.b, rgb.a); -} #endif /* USE_GTK_UI */ /* debugging tool - not normally used */ @@ -281,27 +247,6 @@ static void plot_minmax_profile(struct graphics_context *gc, struct plot_info *p plot_minmax_profile_minute(gc, pi, 0); } -static void plot_pp_text(struct graphics_context *gc, struct plot_info *pi) -{ - double pp, dpp, m; - int hpos; - static const text_render_options_t tro = {PP_TEXT_SIZE, PP_LINES, LEFT, MIDDLE}; - - setup_pp_limits(gc, pi); - pp = floor(pi->maxpp * 10.0) / 10.0 + 0.2; - dpp = pp > 4 ? 1.0 : 0.5; - hpos = pi->entry[pi->nr - 1].sec; - set_source_rgba(gc, PP_LINES); - for (m = 0.0; m <= pp; m += dpp) { - move_to(gc, 0, m); - line_to(gc, hpos, m); - cairo_stroke(gc->cr); - plot_text(gc, &tro, hpos + 30, m, "%.1f", m); - } -} - -/* gets both the actual start and end pressure as well as the scaling factors */ - #endif /* USE_GTK_UI */ int get_cylinder_pressure_range(struct graphics_context *gc) @@ -1140,21 +1085,6 @@ struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, s return analyze_plot_info(pi); } -#if USE_GTK_UI -static void plot_set_scale(scale_mode_t scale) -{ - switch (scale) { - default: - case SC_SCREEN: - plot_scale = SCALE_SCREEN; - break; - case SC_PRINT: - plot_scale = SCALE_PRINT; - break; - } -} -#endif - /* make sure you pass this the FIRST dc - it just walks the list */ static int nr_dcs(struct divecomputer *main) { diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 8fa8e94a6..ad6cbb172 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -335,7 +335,6 @@ void ProfileGraphicsView::plot_pp_text() hpos = gc.pi.entry[gc.pi.nr - 1].sec; QColor c = profile_color[PP_LINES].first(); - qDebug() << pp << dpp; for (m = 0.0; m <= pp; m += dpp) { QGraphicsLineItem *item = new QGraphicsLineItem(SCALEGC(0, m), SCALEGC(hpos, m)); QPen pen(defaultPen); @@ -1091,7 +1090,6 @@ void ProfileGraphicsView::plot_temperature_profile() } if (last) { to = QPointF(SCALEGC(sec, mkelvin)); - //qDebug() << from << to; QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y()); QPen pen(defaultPen); pen.setColor(color); diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index 394a97a9f..268226843 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -11,31 +11,9 @@ struct graphics_context; struct plot_info; typedef struct text_render_options text_render_options_t; -/**! - * - * Hookay, so, if you wanna extend the ToolTips that are displayed - * in the Profile Graph, there's one 'toolTip' widget already on it, - * you can just pass it to your Reimplementation of QGraphiscItem - * and do the following: - * - * EventItem::setController(ToolTipItem *c) - * { - * controller = c; - * } - * - * void EventItem::hoverEnterEvent(QGraphicsSceneHoverEvent* event) - * { - * controller->addToolTip(text, icon); - * } - * - * void EventItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event) - * { - * controller->removeToolTip(text); - * } - * - * Remember to removeToolTip when you don't want it to be displayed. - * - **/ +/* To use a tooltip, simply ->setToolTip on the QGraphicsItem that you want + * or, if it's a "global" tooltip, set it on the mouseMoveEvent of the ProfileGraphicsView. + */ class ToolTipItem :public QObject, public QGraphicsPathItem { Q_OBJECT |