Moved the plot from the cairo version to the Qt version

Started working on the Qt version of the Plot, initially
nothing is printed - but this is not a bad thing,
the program doesn't explodes too. :)

some work had to be done about the 'bool/gboolean' stuff
so I removed all gbooleans in the code that I'v encountered.

A new file was created ( profile.h ) so I could put the
signatures of helper methods that cairo used to call.

till now the code computes the max limits.
Next patch the first drawing will be made.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-05-04 17:24:23 -03:00 committed by Dirk Hohndel
parent ec4d4566ad
commit fa82ba6079
4 changed files with 182 additions and 133 deletions

View file

@ -1,18 +1,26 @@
#ifndef DISPLAY_H
#define DISPLAY_H
#include <cairo.h>
#ifdef __cplusplus
extern "C" {
#else
#if __STDC_VERSION__ >= 199901L
#include <stdbool.h>
#else
typedef int bool;
#endif
#endif
#define SCALE_SCREEN 1.0
#define SCALE_PRINT (1.0 / get_screen_dpi())
#warning "PORT THE get_screen_dpi to Qt"
#define SCALE_PRINT 1.0
//#define SCALE_PRINT (1.0 / get_screen_dpi())
extern void repaint_dive(void);
extern void do_print(void);
extern gdouble get_screen_dpi(void);
// Commented out because I don't know how to get the dpi on a paint device yet.
// extern gdouble get_screen_dpi(void);
/* Plot info with smoothing, velocity indication
* and one-, two- and three-minute minimums and maximums */
@ -24,10 +32,15 @@ struct plot_info {
int mintemp, maxtemp;
double endtempcoord;
double maxpp;
gboolean has_ndl;
bool has_ndl;
struct plot_data *entry;
};
/*
// I'm not sure if this is needed anymore - but keeping this here
// so I wont break stuff trying to redo the well.
*/
/*
* Cairo scaling really is horribly horribly mis-designed.
*
@ -38,8 +51,6 @@ struct plot_info {
*/
struct graphics_context {
int printer;
cairo_t *cr;
cairo_rectangle_t drawing_area;
double maxx, maxy;
double leftx, rightx;
double topy, bottomy;
@ -61,7 +72,7 @@ struct options {
enum { PRETTY, TABLE, TWOPERPAGE } type;
int print_selected;
int color_selected;
gboolean notes_up;
bool notes_up;
int profile_height, notes_height, tanks_height;
};