mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Massive cleanup
Mostly coding style and whitespace changes plus making lots of functions static that have no need to be extern. This also helped find a bit of code that is actually no longer used. This should have absolutely no functional impact - all changes should be purely cosmetic. But it removes a bunch of lines of code and makes the rest easier to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
468d3f28f9
commit
e3a8ed5183
17 changed files with 103 additions and 164 deletions
|
@ -29,19 +29,15 @@ extern int subsurface_fill_device_list(GtkListStore *store);
|
||||||
extern const char *subsurface_icon_name(void);
|
extern const char *subsurface_icon_name(void);
|
||||||
extern void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
extern void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
||||||
GtkWidget *vbox, GtkUIManager *ui_manager);
|
GtkWidget *vbox, GtkUIManager *ui_manager);
|
||||||
extern void quit(GtkWidget *w, gpointer data);
|
|
||||||
extern gboolean on_delete(GtkWidget* w, gpointer data);
|
extern gboolean on_delete(GtkWidget* w, gpointer data);
|
||||||
|
|
||||||
extern void set_divelist_font(const char *);
|
extern void set_divelist_font(const char *);
|
||||||
|
|
||||||
extern void import_files(GtkWidget *, gpointer);
|
|
||||||
extern void update_screen(void);
|
extern void update_screen(void);
|
||||||
extern void download_dialog(GtkWidget *, gpointer);
|
extern void download_dialog(GtkWidget *, gpointer);
|
||||||
extern int is_default_dive_computer_device(const char *);
|
extern int is_default_dive_computer_device(const char *);
|
||||||
extern int is_default_dive_computer(const char *, const char *);
|
extern int is_default_dive_computer(const char *, const char *);
|
||||||
extern void add_dive_cb(GtkWidget *, gpointer);
|
extern void add_dive_cb(GtkWidget *, gpointer);
|
||||||
extern void report_error(GError* error);
|
|
||||||
extern int process_ui_events(void);
|
|
||||||
extern void update_progressbar(progressbar_t *progress, double value);
|
extern void update_progressbar(progressbar_t *progress, double value);
|
||||||
extern void update_progressbar_text(progressbar_t *progress, const char *text);
|
extern void update_progressbar_text(progressbar_t *progress, const char *text);
|
||||||
|
|
||||||
|
@ -60,14 +56,11 @@ extern GtkWidget *create_date_time_widget(struct tm *time, GtkWidget **cal, GtkW
|
||||||
extern void add_string_list_entry(const char *string, GtkListStore *list);
|
extern void add_string_list_entry(const char *string, GtkListStore *list);
|
||||||
extern int match_list(GtkListStore *list, const char *string);
|
extern int match_list(GtkListStore *list, const char *string);
|
||||||
|
|
||||||
extern GtkWidget *dive_profile_widget(void);
|
|
||||||
extern GtkWidget *dive_info_frame(void);
|
extern GtkWidget *dive_info_frame(void);
|
||||||
extern GtkWidget *extended_dive_info_widget(void);
|
extern GtkWidget *extended_dive_info_widget(void);
|
||||||
extern GtkWidget *equipment_widget(int w_idx);
|
extern GtkWidget *equipment_widget(int w_idx);
|
||||||
extern GtkWidget *single_stats_widget(void);
|
extern GtkWidget *single_stats_widget(void);
|
||||||
extern GtkWidget *total_stats_widget(void);
|
extern GtkWidget *total_stats_widget(void);
|
||||||
extern GtkWidget *cylinder_list_widget(int w_idx);
|
|
||||||
extern GtkWidget *weightsystem_list_widget(int w_idx);
|
|
||||||
|
|
||||||
extern GtkWidget *dive_list_create(void);
|
extern GtkWidget *dive_list_create(void);
|
||||||
extern void dive_list_destroy(void);
|
extern void dive_list_destroy(void);
|
||||||
|
|
3
dive.h
3
dive.h
|
@ -113,9 +113,7 @@ typedef struct {
|
||||||
} weightsystem_t;
|
} weightsystem_t;
|
||||||
|
|
||||||
extern gboolean cylinder_nodata(cylinder_t *cyl);
|
extern gboolean cylinder_nodata(cylinder_t *cyl);
|
||||||
extern gboolean cylinder_nosamples(cylinder_t *cyl);
|
|
||||||
extern gboolean cylinder_none(void *_data);
|
extern gboolean cylinder_none(void *_data);
|
||||||
extern gboolean no_cylinders(cylinder_t *cyl);
|
|
||||||
extern gboolean no_weightsystems(weightsystem_t *ws);
|
extern gboolean no_weightsystems(weightsystem_t *ws);
|
||||||
extern gboolean weightsystems_equal(weightsystem_t *ws1, weightsystem_t *ws2);
|
extern gboolean weightsystems_equal(weightsystem_t *ws1, weightsystem_t *ws2);
|
||||||
|
|
||||||
|
@ -374,7 +372,6 @@ extern gboolean autogroup;
|
||||||
#define DIVE_NEEDS_TRIP(_dive) ((_dive)->tripflag == TF_NONE)
|
#define DIVE_NEEDS_TRIP(_dive) ((_dive)->tripflag == TF_NONE)
|
||||||
|
|
||||||
extern void add_dive_to_trip(struct dive *, dive_trip_t *);
|
extern void add_dive_to_trip(struct dive *, dive_trip_t *);
|
||||||
extern void remove_dive_from_trip(struct dive *);
|
|
||||||
|
|
||||||
extern void delete_single_dive(int idx);
|
extern void delete_single_dive(int idx);
|
||||||
extern void add_single_dive(int idx, struct dive *dive);
|
extern void add_single_dive(int idx, struct dive *dive);
|
||||||
|
|
26
divelist.c
26
divelist.c
|
@ -163,7 +163,7 @@ static struct dive *dive_from_path(GtkTreePath *path)
|
||||||
|
|
||||||
/* make sure that if we expand a summary row that is selected, the children show
|
/* make sure that if we expand a summary row that is selected, the children show
|
||||||
up as selected, too */
|
up as selected, too */
|
||||||
void row_expanded_cb(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data)
|
static void row_expanded_cb(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data)
|
||||||
{
|
{
|
||||||
GtkTreeIter child;
|
GtkTreeIter child;
|
||||||
GtkTreeModel *model = MODEL(dive_list);
|
GtkTreeModel *model = MODEL(dive_list);
|
||||||
|
@ -208,7 +208,7 @@ static int selected_children(GtkTreeModel *model, GtkTreeIter *iter)
|
||||||
|
|
||||||
/* Make sure that if we collapse a summary row with any selected children, the row
|
/* Make sure that if we collapse a summary row with any selected children, the row
|
||||||
shows up as selected too */
|
shows up as selected too */
|
||||||
void row_collapsed_cb(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data)
|
static void row_collapsed_cb(GtkTreeView *tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model = MODEL(dive_list);
|
GtkTreeModel *model = MODEL(dive_list);
|
||||||
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dive_list.tree_view));
|
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dive_list.tree_view));
|
||||||
|
@ -873,7 +873,7 @@ GdkPixbuf *get_gps_icon(void)
|
||||||
return gdk_pixbuf_from_pixdata(&my_pixbuf, TRUE, NULL);
|
return gdk_pixbuf_from_pixdata(&my_pixbuf, TRUE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *get_gps_icon_for_dive(struct dive *dive)
|
static GdkPixbuf *get_gps_icon_for_dive(struct dive *dive)
|
||||||
{
|
{
|
||||||
if (dive_has_location(dive))
|
if (dive_has_location(dive))
|
||||||
return get_gps_icon();
|
return get_gps_icon();
|
||||||
|
@ -1143,7 +1143,7 @@ static void find_new_trip_start_time(dive_trip_t *trip)
|
||||||
trip->when = when;
|
trip->when = when;
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_dive_from_trip(struct dive *dive)
|
static void remove_dive_from_trip(struct dive *dive)
|
||||||
{
|
{
|
||||||
struct dive *next, **pprev;
|
struct dive *next, **pprev;
|
||||||
dive_trip_t *trip = dive->divetrip;
|
dive_trip_t *trip = dive->divetrip;
|
||||||
|
@ -1509,7 +1509,7 @@ void add_dive_cb(GtkWidget *menuitem, gpointer data)
|
||||||
free(dive);
|
free(dive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_trip_cb(GtkWidget *menuitem, GtkTreePath *path)
|
static void edit_trip_cb(GtkWidget *menuitem, GtkTreePath *path)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
timestamp_t when;
|
timestamp_t when;
|
||||||
|
@ -1522,19 +1522,19 @@ void edit_trip_cb(GtkWidget *menuitem, GtkTreePath *path)
|
||||||
gtk_tree_store_set(STORE(dive_list), &iter, DIVE_LOCATION, dive_trip->location, -1);
|
gtk_tree_store_set(STORE(dive_list), &iter, DIVE_LOCATION, dive_trip->location, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_selected_dives_cb(GtkWidget *menuitem, gpointer data)
|
static void edit_selected_dives_cb(GtkWidget *menuitem, gpointer data)
|
||||||
{
|
{
|
||||||
edit_multi_dive_info(NULL);
|
edit_multi_dive_info(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_dive_from_path_cb(GtkWidget *menuitem, GtkTreePath *path)
|
static void edit_dive_from_path_cb(GtkWidget *menuitem, GtkTreePath *path)
|
||||||
{
|
{
|
||||||
struct dive *dive = dive_from_path(path);
|
struct dive *dive = dive_from_path(path);
|
||||||
|
|
||||||
edit_multi_dive_info(dive);
|
edit_multi_dive_info(dive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_dive_when_cb(GtkWidget *menuitem, struct dive *dive)
|
static void edit_dive_when_cb(GtkWidget *menuitem, struct dive *dive)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog, *cal, *h, *m;
|
GtkWidget *dialog, *cal, *h, *m;
|
||||||
timestamp_t when;
|
timestamp_t when;
|
||||||
|
@ -2002,7 +2002,7 @@ static void remove_from_trip_cb(GtkWidget *menuitem, GtkTreePath *path)
|
||||||
mark_divelist_changed(TRUE);
|
mark_divelist_changed(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_trip(GtkTreePath *trippath, gboolean force_no_trip)
|
static void remove_trip(GtkTreePath *trippath, gboolean force_no_trip)
|
||||||
{
|
{
|
||||||
GtkTreeIter newiter, parent, child, *lastiter = &parent;
|
GtkTreeIter newiter, parent, child, *lastiter = &parent;
|
||||||
struct dive *dive;
|
struct dive *dive;
|
||||||
|
@ -2041,7 +2041,7 @@ void remove_trip(GtkTreePath *trippath, gboolean force_no_trip)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_trip_cb(GtkWidget *menuitem, GtkTreePath *trippath)
|
static void remove_trip_cb(GtkWidget *menuitem, GtkTreePath *trippath)
|
||||||
{
|
{
|
||||||
int success;
|
int success;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
@ -2063,7 +2063,7 @@ void remove_trip_cb(GtkWidget *menuitem, GtkTreePath *trippath)
|
||||||
mark_divelist_changed(TRUE);
|
mark_divelist_changed(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void merge_trips_cb(GtkWidget *menuitem, GtkTreePath *trippath)
|
static void merge_trips_cb(GtkWidget *menuitem, GtkTreePath *trippath)
|
||||||
{
|
{
|
||||||
GtkTreePath *prevpath;
|
GtkTreePath *prevpath;
|
||||||
GtkTreeIter thistripiter, prevtripiter;
|
GtkTreeIter thistripiter, prevtripiter;
|
||||||
|
@ -2630,7 +2630,7 @@ static void deselect_dive(int idx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean modify_selection_cb(GtkTreeSelection *selection, GtkTreeModel *model,
|
static gboolean modify_selection_cb(GtkTreeSelection *selection, GtkTreeModel *model,
|
||||||
GtkTreePath *path, gboolean was_selected, gpointer userdata)
|
GtkTreePath *path, gboolean was_selected, gpointer userdata)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
|
@ -2845,7 +2845,7 @@ static GtkTreeIter *get_iter_from_idx(int idx)
|
||||||
return iteridx.iter;
|
return iteridx.iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void scroll_to_selected(GtkTreeIter *iter)
|
static void scroll_to_selected(GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
GtkTreePath *treepath;
|
GtkTreePath *treepath;
|
||||||
treepath = gtk_tree_model_get_path(MODEL(dive_list), iter);
|
treepath = gtk_tree_model_get_path(MODEL(dive_list), iter);
|
||||||
|
|
18
equipment.c
18
equipment.c
|
@ -462,7 +462,7 @@ gboolean cylinder_nodata(cylinder_t *cyl)
|
||||||
!cyl->end.mbar;
|
!cyl->end.mbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean cylinder_nosamples(cylinder_t *cyl)
|
static gboolean cylinder_nosamples(cylinder_t *cyl)
|
||||||
{
|
{
|
||||||
return !cyl->sample_start.mbar &&
|
return !cyl->sample_start.mbar &&
|
||||||
!cyl->sample_end.mbar;
|
!cyl->sample_end.mbar;
|
||||||
|
@ -474,19 +474,9 @@ gboolean cylinder_none(void *_data)
|
||||||
return cylinder_nodata(cyl) && cylinder_nosamples(cyl);
|
return cylinder_nodata(cyl) && cylinder_nosamples(cyl);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean no_cylinders(cylinder_t *cyl)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_CYLINDERS; i++)
|
|
||||||
if (!cylinder_none(cyl + i))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* descriptions are equal if they are both NULL or both non-NULL
|
/* descriptions are equal if they are both NULL or both non-NULL
|
||||||
and the same text */
|
and the same text */
|
||||||
gboolean description_equal(const char *desc1, const char *desc2)
|
static gboolean description_equal(const char *desc1, const char *desc2)
|
||||||
{
|
{
|
||||||
return ((! desc1 && ! desc2) ||
|
return ((! desc1 && ! desc2) ||
|
||||||
(desc1 && desc2 && strcmp(desc1, desc2) == 0));
|
(desc1 && desc2 && strcmp(desc1, desc2) == 0));
|
||||||
|
@ -1440,7 +1430,7 @@ static void ws_row_activated_cb(GtkTreeView *tree_view,
|
||||||
ws_edit_cb(GTK_WIDGET(tree_view), w_idx);
|
ws_edit_cb(GTK_WIDGET(tree_view), w_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *cylinder_list_widget(int w_idx)
|
static GtkWidget *cylinder_list_widget(int w_idx)
|
||||||
{
|
{
|
||||||
GtkListStore *model = cylinder_list[w_idx].model;
|
GtkListStore *model = cylinder_list[w_idx].model;
|
||||||
GtkWidget *tree_view;
|
GtkWidget *tree_view;
|
||||||
|
@ -1469,7 +1459,7 @@ GtkWidget *cylinder_list_widget(int w_idx)
|
||||||
return tree_view;
|
return tree_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *weightsystem_list_widget(int w_idx)
|
static GtkWidget *weightsystem_list_widget(int w_idx)
|
||||||
{
|
{
|
||||||
GtkListStore *model = weightsystem_list[w_idx].model;
|
GtkListStore *model = weightsystem_list[w_idx].model;
|
||||||
GtkWidget *tree_view;
|
GtkWidget *tree_view;
|
||||||
|
|
42
gtk-gui.c
42
gtk-gui.c
|
@ -35,8 +35,9 @@ GtkWidget *notebook;
|
||||||
int error_count;
|
int error_count;
|
||||||
const char *existing_filename;
|
const char *existing_filename;
|
||||||
|
|
||||||
static struct device_info *nicknamelist;
|
|
||||||
static struct device_info *holdnicknames = NULL;
|
static struct device_info *holdnicknames = NULL;
|
||||||
|
static GtkWidget *dive_profile_widget(void);
|
||||||
|
static void import_files(GtkWidget *, gpointer);
|
||||||
|
|
||||||
static void remember_dc(const char *model, uint32_t deviceid, const char *nickname)
|
static void remember_dc(const char *model, uint32_t deviceid, const char *nickname)
|
||||||
{
|
{
|
||||||
|
@ -57,18 +58,6 @@ static void remove_dc(const char *model, uint32_t deviceid)
|
||||||
free(remove_device_info(model, deviceid));
|
free(remove_device_info(model, deviceid));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_nickname_list_entry(struct device_info *nnl){
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
printf("Address of entry is %p root is at %p\n", nnl, nicknamelist);
|
|
||||||
printf("Model = %s\n",nnl->model);
|
|
||||||
printf("Device = %x\n", nnl->deviceid);
|
|
||||||
printf("Nickname = %s\n", nnl->nickname);
|
|
||||||
printf("Address of next entry is %p\n",nnl->next);
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *dive_profile;
|
static GtkWidget *dive_profile;
|
||||||
|
|
||||||
GtkActionGroup *action_group;
|
GtkActionGroup *action_group;
|
||||||
|
@ -338,7 +327,7 @@ static void on_destroy(GtkWidget* w, gpointer data)
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void quit(GtkWidget *w, gpointer data)
|
static void quit(GtkWidget *w, gpointer data)
|
||||||
{
|
{
|
||||||
/* Make sure to flush any modified dive data */
|
/* Make sure to flush any modified dive data */
|
||||||
update_dive(NULL);
|
update_dive(NULL);
|
||||||
|
@ -1787,7 +1776,7 @@ static void zoom_event(int x, int y, double inc)
|
||||||
zoom_factor = inc;
|
zoom_factor = inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
|
static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
|
||||||
{
|
{
|
||||||
switch (event->direction) {
|
switch (event->direction) {
|
||||||
case GDK_SCROLL_UP:
|
case GDK_SCROLL_UP:
|
||||||
|
@ -1803,7 +1792,7 @@ gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer user_da
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean clicked(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
static gboolean clicked(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||||
{
|
{
|
||||||
switch (event->button) {
|
switch (event->button) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1818,7 +1807,7 @@ gboolean clicked(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean released(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
static gboolean released(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||||
{
|
{
|
||||||
switch (event->button) {
|
switch (event->button) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1832,7 +1821,7 @@ gboolean released(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean motion(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
|
static gboolean motion(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
|
||||||
{
|
{
|
||||||
if (zoom_x < 0)
|
if (zoom_x < 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1843,7 +1832,7 @@ gboolean motion(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *dive_profile_widget(void)
|
static GtkWidget *dive_profile_widget(void)
|
||||||
{
|
{
|
||||||
GtkWidget *da;
|
GtkWidget *da;
|
||||||
|
|
||||||
|
@ -1863,19 +1852,6 @@ GtkWidget *dive_profile_widget(void)
|
||||||
return da;
|
return da;
|
||||||
}
|
}
|
||||||
|
|
||||||
int process_ui_events(void)
|
|
||||||
{
|
|
||||||
int ret=0;
|
|
||||||
|
|
||||||
while (gtk_events_pending()) {
|
|
||||||
if (gtk_main_iteration_do(0)) {
|
|
||||||
ret = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void do_import_file(gpointer data, gpointer user_data)
|
static void do_import_file(gpointer data, gpointer user_data)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
@ -1889,7 +1865,7 @@ static void do_import_file(gpointer data, gpointer user_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void import_files(GtkWidget *w, gpointer data)
|
static void import_files(GtkWidget *w, gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *fs_dialog;
|
GtkWidget *fs_dialog;
|
||||||
const char *current_default;
|
const char *current_default;
|
||||||
|
|
6
info.c
6
info.c
|
@ -619,7 +619,7 @@ struct location_update {
|
||||||
void (*callback)(float, float);
|
void (*callback)(float, float);
|
||||||
} location_update;
|
} location_update;
|
||||||
|
|
||||||
void print_gps_coordinates(char *buffer, int len, float lat, float lon)
|
static void print_gps_coordinates(char *buffer, int len, float lat, float lon)
|
||||||
{
|
{
|
||||||
unsigned int latdeg, londeg;
|
unsigned int latdeg, londeg;
|
||||||
float latmin, lonmin;
|
float latmin, lonmin;
|
||||||
|
@ -638,7 +638,7 @@ void print_gps_coordinates(char *buffer, int len, float lat, float lon)
|
||||||
lonh, londeg, UTF8_DEGREE, lonmin);
|
lonh, londeg, UTF8_DEGREE, lonmin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_gps_entry(float lat, float lon)
|
static void update_gps_entry(float lat, float lon)
|
||||||
{
|
{
|
||||||
char gps_text[45];
|
char gps_text[45];
|
||||||
|
|
||||||
|
@ -831,7 +831,7 @@ static void update_cylinder(cylinder_t *dst, cylinder_t *src, cylinder_t *orig)
|
||||||
data if it has changed in the master dive and the other dive
|
data if it has changed in the master dive and the other dive
|
||||||
either has no entries for the equipment or the same entries
|
either has no entries for the equipment or the same entries
|
||||||
as the master dive had before it was edited */
|
as the master dive had before it was edited */
|
||||||
void update_equipment_data(struct dive *dive, struct dive *master)
|
static void update_equipment_data(struct dive *dive, struct dive *master)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
12
profile.c
12
profile.c
|
@ -3,11 +3,6 @@
|
||||||
* uses cairo to draw it
|
* uses cairo to draw it
|
||||||
*/
|
*/
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
@ -173,7 +168,7 @@ void init_profile_background(struct graphics_context *gc)
|
||||||
set_source_rgba(gc, BACKGROUND);
|
set_source_rgba(gc, BACKGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pattern_add_color_stop_rgba(struct graphics_context *gc, cairo_pattern_t *pat, double o, color_indice_t c)
|
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];
|
const color_t *col = &profile_color[c];
|
||||||
struct rgba rgb = col->media[gc->printer];
|
struct rgba rgb = col->media[gc->printer];
|
||||||
|
@ -1234,9 +1229,10 @@ static struct plot_info *analyze_plot_info(struct plot_info *pi)
|
||||||
entry->velocity = velocity((entry[0].depth - entry[past].depth) /
|
entry->velocity = velocity((entry[0].depth - entry[past].depth) /
|
||||||
(entry[0].sec - entry[past].sec));
|
(entry[0].sec - entry[past].sec));
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
entry->velocity = STABLE;
|
entry->velocity = STABLE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* One-, two- and three-minute minmax data */
|
/* One-, two- and three-minute minmax data */
|
||||||
for (i = 0; i < nr; i++) {
|
for (i = 0; i < nr; i++) {
|
||||||
|
@ -1699,7 +1695,7 @@ static void populate_cylinder_pressure_data(int idx, int start, int end, struct
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .. and the last entry with the ending cylinder pressure */
|
/* .. and the last entry with the ending cylinder pressure */
|
||||||
for (i = pi->nr; --i >= 0; ) {
|
for (i = pi->nr; --i >= 0; /* nothing */) {
|
||||||
struct plot_data *entry = pi->entry+i;
|
struct plot_data *entry = pi->entry+i;
|
||||||
if (entry->cylinderindex != idx)
|
if (entry->cylinderindex != idx)
|
||||||
continue;
|
continue;
|
||||||
|
|
32
statistics.c
32
statistics.c
|
@ -3,19 +3,12 @@
|
||||||
* controlled through the following interfaces:
|
* controlled through the following interfaces:
|
||||||
*
|
*
|
||||||
* void show_dive_stats(struct dive *dive)
|
* void show_dive_stats(struct dive *dive)
|
||||||
* void flush_dive_stats_changes(struct dive *dive)
|
|
||||||
*
|
*
|
||||||
* called from gtk-ui:
|
* called from gtk-ui:
|
||||||
* GtkWidget *stats_widget(void)
|
* GtkWidget *stats_widget(void)
|
||||||
*/
|
*/
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <gdk/gdkkeysyms.h>
|
|
||||||
|
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
@ -335,7 +328,7 @@ static void process_interval_stats(stats_t stats_interval, GtkTreeIter *parent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_statistics()
|
static void clear_statistics()
|
||||||
{
|
{
|
||||||
GtkTreeStore *store;
|
GtkTreeStore *store;
|
||||||
|
|
||||||
|
@ -360,7 +353,7 @@ static void key_press_event(GtkWidget *window, GdkEventKey *event, gpointer data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_yearly_stats()
|
static void update_yearly_stats()
|
||||||
{
|
{
|
||||||
int i, j, combined_months, month = 0;
|
int i, j, combined_months, month = 0;
|
||||||
GtkTreeIter year_iter, month_iter;
|
GtkTreeIter year_iter, month_iter;
|
||||||
|
@ -468,9 +461,9 @@ static void process_all_dives(struct dive *dive, struct dive **prev_dive)
|
||||||
if (current_year != tm.tm_year + 1900) {
|
if (current_year != tm.tm_year + 1900) {
|
||||||
current_year = tm.tm_year + 1900;
|
current_year = tm.tm_year + 1900;
|
||||||
process_dive(dp, &(stats_yearly[++year_iter]));
|
process_dive(dp, &(stats_yearly[++year_iter]));
|
||||||
} else
|
} else {
|
||||||
process_dive(dp, &(stats_yearly[year_iter]));
|
process_dive(dp, &(stats_yearly[year_iter]));
|
||||||
|
}
|
||||||
stats_yearly[year_iter].selection_size++;
|
stats_yearly[year_iter].selection_size++;
|
||||||
stats_yearly[year_iter].period = current_year;
|
stats_yearly[year_iter].period = current_year;
|
||||||
|
|
||||||
|
@ -483,7 +476,6 @@ static void process_all_dives(struct dive *dive, struct dive **prev_dive)
|
||||||
if (prev_month != current_month || prev_year != current_year)
|
if (prev_month != current_month || prev_year != current_year)
|
||||||
month_iter++;
|
month_iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_dive(dp, &(stats_monthly[month_iter]));
|
process_dive(dp, &(stats_monthly[month_iter]));
|
||||||
stats_monthly[month_iter].selection_size++;
|
stats_monthly[month_iter].selection_size++;
|
||||||
stats_monthly[month_iter].period = current_month;
|
stats_monthly[month_iter].period = current_month;
|
||||||
|
@ -526,9 +518,9 @@ static void set_label(GtkWidget *w, const char *fmt, ...)
|
||||||
static char *get_time_string(int seconds, int maxdays)
|
static char *get_time_string(int seconds, int maxdays)
|
||||||
{
|
{
|
||||||
static char buf[80];
|
static char buf[80];
|
||||||
if (maxdays && seconds > 3600 * 24 * maxdays)
|
if (maxdays && seconds > 3600 * 24 * maxdays) {
|
||||||
snprintf(buf, sizeof(buf), _("more than %d days"), maxdays);
|
snprintf(buf, sizeof(buf), _("more than %d days"), maxdays);
|
||||||
else {
|
} else {
|
||||||
int days = seconds / 3600 / 24;
|
int days = seconds / 3600 / 24;
|
||||||
int hours = (seconds - days * 3600 * 24) / 3600;
|
int hours = (seconds - days * 3600 * 24) / 3600;
|
||||||
int minutes = (seconds - days * 3600 * 24 - hours * 3600) / 60;
|
int minutes = (seconds - days * 3600 * 24 - hours * 3600) / 60;
|
||||||
|
@ -591,9 +583,9 @@ static void show_single_dive_stats(struct dive *dive)
|
||||||
set_label(single_w.air_press, _("unknown"));
|
set_label(single_w.air_press, _("unknown"));
|
||||||
}
|
}
|
||||||
value = get_volume_units(dive->sac, &decimals, &unit);
|
value = get_volume_units(dive->sac, &decimals, &unit);
|
||||||
if (value > 0) {
|
if (value > 0)
|
||||||
set_label(single_w.sac, _("%.*f %s/min"), decimals, value, unit);
|
set_label(single_w.sac, _("%.*f %s/min"), decimals, value, unit);
|
||||||
} else
|
else
|
||||||
set_label(single_w.sac, "");
|
set_label(single_w.sac, "");
|
||||||
set_label(single_w.otu, "%d", dive->otu);
|
set_label(single_w.otu, "%d", dive->otu);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@ -626,9 +618,10 @@ static void show_single_dive_stats(struct dive *dive)
|
||||||
if (gas_used) {
|
if (gas_used) {
|
||||||
value = get_volume_units(gas_used, &decimals, &unit);
|
value = get_volume_units(gas_used, &decimals, &unit);
|
||||||
set_label(single_w.gas_used, "%.*f %s", decimals, value, unit);
|
set_label(single_w.gas_used, "%.*f %s", decimals, value, unit);
|
||||||
} else
|
} else {
|
||||||
set_label(single_w.gas_used, "");
|
set_label(single_w.gas_used, "");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* this gets called when at least two but not all dives are selected */
|
/* this gets called when at least two but not all dives are selected */
|
||||||
static void get_ranges(char *buffer, int size)
|
static void get_ranges(char *buffer, int size)
|
||||||
|
@ -753,11 +746,6 @@ void show_dive_stats(struct dive *dive)
|
||||||
show_total_dive_stats(dive);
|
show_total_dive_stats(dive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush_dive_stats_changes(struct dive *dive)
|
|
||||||
{
|
|
||||||
/* We do nothing: we require the "Ok" button press */
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label)
|
static GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label)
|
||||||
{
|
{
|
||||||
GtkWidget *label_widget;
|
GtkWidget *label_widget;
|
||||||
|
|
|
@ -202,8 +202,7 @@ static gboolean uemis_init(const char *path)
|
||||||
#endif
|
#endif
|
||||||
if (sscanf(tmp + 1, "%d", &filenr) != 1)
|
if (sscanf(tmp + 1, "%d", &filenr) != 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
filenr = 0;
|
filenr = 0;
|
||||||
#if UEMIS_DEBUG & 2
|
#if UEMIS_DEBUG & 2
|
||||||
fprintf(debugfile, "::r req.txt skipped as there were fewer than 5 bytes\n");
|
fprintf(debugfile, "::r req.txt skipped as there were fewer than 5 bytes\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue