From 054406b420c7a4bbabbe839f25966fa121adfb5f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 7 Oct 2013 13:43:17 -0700 Subject: [PATCH] Remove even more code and declarations There's lots more stuff that can go. Signed-off-by: Dirk Hohndel --- display.h | 21 +----------------- dive.h | 16 -------------- divelist.c | 46 --------------------------------------- divelist.h | 14 ++---------- equipment.c | 8 ------- profile.c | 4 ---- qt-ui/profilegraphics.cpp | 8 ------- 7 files changed, 3 insertions(+), 114 deletions(-) diff --git a/display.h b/display.h index 153a9368e..62f0b7dd0 100644 --- a/display.h +++ b/display.h @@ -8,10 +8,6 @@ extern "C" { #define SCALE_SCREEN 1.0 #define SCALE_PRINT (1.0 / get_screen_dpi()) -extern void repaint_dive(void); -extern void do_print(void); - -// Commented out because I don't know how to get the dpi on a paint device yet. extern double get_screen_dpi(void); /* Plot info with smoothing, velocity indication @@ -29,17 +25,7 @@ struct plot_info { }; /* -// 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. - * - * Which is sad, because I really like Cairo otherwise. But - * the fact that the line width is scaled with the same scale - * as the coordinate system is a f*&%ing disaster. So we - * can't use it, and instead have this butt-ugly wrapper thing.. + * handy datastructure to keep all of our scaling data in one place */ struct graphics_context { int printer; @@ -52,13 +38,8 @@ struct graphics_context { typedef enum { SC_SCREEN, SC_PRINT } scale_mode_t; -extern void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale); extern struct divecomputer *select_dc(struct divecomputer *main); -extern void init_profile_background(struct graphics_context *gc); -extern void attach_tooltip(int x, int y, int w, int h, const char *text, struct event *event); extern void get_plot_details(struct graphics_context *gc, int time, char *buf, int bufsize); -extern int x_to_time(double x); -extern int x_abs(double x); struct options { enum { PRETTY, TABLE, TWOPERPAGE } type; diff --git a/dive.h b/dive.h index ed13a335d..ff7e0328e 100644 --- a/dive.h +++ b/dive.h @@ -611,20 +611,6 @@ extern int parse_dm4_buffer(const char *url, const char *buf, int size, struct d extern void parse_file(const char *filename, char **error); -extern void show_dive_info(struct dive *); - -extern void show_dive_equipment(struct dive *, int w_idx); -extern void clear_equipment_widgets(void); - -extern void show_dive_stats(struct dive *); -extern void clear_stats_widgets(void); - -extern void show_gps_locations(void); -extern void show_gps_location(struct dive *, void (*callback)(float, float)); - -extern void show_yearly_stats(void); - -extern void update_dive(struct dive *new_dive); extern void save_dives(const char *filename); extern void save_dives_logic(const char *filename, bool select_only); extern void save_dive(FILE *f, struct dive *dive); @@ -667,8 +653,6 @@ extern int add_new_dive(struct dive *dive); extern bool edit_trip(dive_trip_t *trip); extern int edit_dive_info(struct dive *dive, bool newdive); extern int edit_multi_dive_info(struct dive *single_dive); -extern void dive_list_update_dives(void); -extern void flush_divelist(struct dive *dive); extern void set_dc_nickname(struct dive *dive); extern void set_autogroup(bool value); diff --git a/divelist.c b/divelist.c index 1e4e344c1..921f9d4ee 100644 --- a/divelist.c +++ b/divelist.c @@ -22,7 +22,6 @@ * void add_dive_to_trip(struct dive *dive, dive_trip_t *trip) * dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive) * void autogroup_dives(void) - * void clear_trip_indexes(void) * void delete_single_dive(int idx) * void add_single_dive(int idx, struct dive *dive) * void merge_two_dives(struct dive *a, struct dive *b) @@ -92,43 +91,6 @@ dive_trip_t *find_trip_by_idx(int idx) return NULL; } -int dive_nr_sort(int idx_a, int idx_b, timestamp_t when_a, timestamp_t when_b) -{ - struct dive *a, *b; - dive_trip_t *tripa = NULL, *tripb = NULL; - - if (idx_a < 0) { - a = NULL; - tripa = find_trip_by_idx(idx_a); - } else { - a = get_dive(idx_a); - if (a) - tripa = a->divetrip; - } - - if (idx_b < 0) { - b = NULL; - tripb = find_trip_by_idx(idx_b); - } else { - b = get_dive(idx_b); - if (b) - tripb = b->divetrip; - } - - /* - * Compare dive dates within the same trip (or when there - * are no trips involved at all). But if we have two - * different trips use the trip dates for comparison - */ - if (tripa != tripb) { - if (tripa) - when_a = tripa->when; - if (tripb) - when_b = tripb->when; - } - return when_a - when_b; -} - int trip_has_selected_dives(dive_trip_t *trip) { struct dive *dive; @@ -846,14 +808,6 @@ void autogroup_dives(void) #endif } -void clear_trip_indexes(void) -{ - dive_trip_t *trip; - - for (trip = dive_trip_list; trip != NULL; trip = trip->next) - trip->index = 0; -} - /* this implements the mechanics of removing the dive from the table, * but doesn't deal with updating dive trips, etc */ void delete_single_dive(int idx) diff --git a/divelist.h b/divelist.h index af52a0368..1a07dbb64 100644 --- a/divelist.h +++ b/divelist.h @@ -7,21 +7,11 @@ extern "C" { struct dive; -extern void report_dives(bool imported, bool prefer_imported); -extern void dive_list_update_dives(void); -extern void update_dive_list_col_visibility(void); -extern void update_dive_list_units(void); -extern void flush_divelist(struct dive *); extern void update_cylinder_related_info(struct dive *); extern void mark_divelist_changed(int); extern int unsaved_changes(void); extern void remove_autogen_trips(void); -extern void select_next_dive(void); -extern void select_prev_dive(void); -extern void show_and_select_dive(struct dive *dive); extern double init_decompression(struct dive * dive); -extern void export_all_dives_uddf_cb(); -extern void upload_all_dives_divelogs_cb(); /* divelist core logic functions */ extern void process_dives(bool imported, bool prefer_imported); @@ -29,9 +19,9 @@ extern char *get_dive_date_string(timestamp_t when); extern char *get_short_dive_date_string(timestamp_t when); extern char *get_trip_date_string(timestamp_t when, int nr); extern char *get_nitrox_string(struct dive *dive); -extern void clear_trip_indexes(void); + extern dive_trip_t *find_trip_by_idx(int idx); -extern int dive_nr_sort(int idx_a, int idx_b, timestamp_t when_a, timestamp_t when_b); + extern int trip_has_selected_dives(dive_trip_t *trip); extern void get_depth_values(int depth, int *depth_int, int *depth_decimal, int *show_decimal); extern void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2low_p); diff --git a/equipment.c b/equipment.c index 9d6ab40f9..8d113ed2b 100644 --- a/equipment.c +++ b/equipment.c @@ -1,12 +1,4 @@ /* equipment.c */ -/* creates the UI for the equipment page - - * controlled through the following interfaces: - * - * void show_dive_equipment(struct dive *dive, int w_idx) - * - * called from gtk-ui: - * GtkWidget *equipment_widget(int w_idx) - */ #include #include #include diff --git a/profile.c b/profile.c index b360c6f1c..4f451a377 100644 --- a/profile.c +++ b/profile.c @@ -1,6 +1,5 @@ /* profile.c */ /* creates all the necessary data for drawing the dive profile - * uses cairo to draw it */ #include "gettext.h" #include @@ -22,9 +21,6 @@ char dc_number = 0; static struct plot_data *last_pi_entry = NULL; -#define cairo_set_line_width_scaled(cr, w) \ - cairo_set_line_width((cr), (w) * plot_scale); - /* debugging tool - not normally used */ static void dump_pi (struct plot_info *pi) { diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 74a8857e2..d19623a4a 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -321,14 +321,6 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw) plot_pp_text(); } - /* now shift the translation back by half the margin; - * this way we can draw the vertical scales on both sides */ - //cairo_translate(gc->cr, -drawing_area->x / 2.0, 0); - - //gc->maxx += drawing_area->x; - //gc->leftx = -(drawing_area->x / drawing_area->width) / 2.0; - //gc->rightx = 1.0 - gc->leftx; - plot_depth_scale(); #if 0