]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 2 Nov 2011 19:39:55 +0000 (12:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 2 Nov 2011 19:39:55 +0000 (12:39 -0700)
* 'add-info-stats-page' of git://github.com/dirkhh/subsurface:
  Add Info & Stats page to the notebook
  Even more places with pressure and volume conversions
  Further cleanup of pressure and volume conversions
  Use unit functions to get column headers, add unit function for pressure
  More consistency improvements
  Add new helper function to get temperature and unit

1  2 
dive.h
gtk-gui.c
main.c

diff --combined dive.h
index eda8d6b34d33b4424aabb74df958e7172438b005,2fae0c92ef24d1fd5ae3e08b93f87512cd4f277b..cf11e1f89384bb34176e9eb5c14879cb89f73be1
--- 1/dive.h
--- 2/dive.h
+++ b/dive.h
@@@ -86,7 -86,20 +86,20 @@@ typedef struct 
        pressure_t start, end;
  } cylinder_t;
  
+ extern int get_pressure_units(unsigned int mb, const char **units);
  extern double get_depth_units(unsigned int mm, int *frac, const char **units);
+ extern double get_volume_units(unsigned int mm, int *frac, const char **units);
+ extern double get_temp_units(unsigned int mm, const char **units);
+ static inline double ml_to_cuft(int ml)
+ {
+       return ml / 28316.8466;
+ }
+ static inline double cuft_to_l(double cuft)
+ {
+       return cuft * 28.3168466;
+ }
  
  static inline double mm_to_feet(int mm)
  {
@@@ -129,16 -142,31 +142,31 @@@ static inline int to_K(temperature_t te
        return (temp.mkelvin + 499)/1000;
  }
  
+ static inline double psi_to_bar(double psi)
+ {
+       return psi / 14.5037738;
+ }
  static inline int to_PSI(pressure_t pressure)
  {
        return pressure.mbar * 0.0145037738 + 0.5;
  }
  
+ static inline double bar_to_atm(double bar)
+ {
+       return bar / 1.01325;
+ }
  static inline double to_ATM(pressure_t pressure)
  {
        return pressure.mbar / 1013.25;
  }
  
+ static inline int mbar_to_PSI(int mbar)
+ {
+       pressure_t p = {mbar};
+       return to_PSI(p);
+ }
  struct sample {
        duration_t time;
        depth_t depth;
@@@ -176,7 -204,7 +204,7 @@@ struct dive 
        depth_t visibility;
        temperature_t airtemp, watertemp;
        cylinder_t cylinder[MAX_CYLINDERS];
-       int otu;
+       int sac, otu;
        struct event *events;
        int samples, alloc_samples;
        struct sample sample[];
@@@ -231,6 -259,8 +259,8 @@@ extern void flush_dive_info_changes(str
  extern void show_dive_equipment(struct dive *);
  extern void flush_dive_equipment_changes(struct dive *);
  
+ extern void show_dive_stats(struct dive *);
  extern void update_dive(struct dive *new_dive);
  extern void save_dives(const char *filename);
  
@@@ -257,7 -287,7 +287,7 @@@ extern void add_event(struct dive *dive
  
  /* UI related protopypes */
  
 -extern void init_ui(int argc, char **argv);
 +extern void init_ui(int *argcp, char ***argvp);
  
  extern void run_ui(void);
  
diff --combined gtk-gui.c
index 676c0d063a4d1356d60e32c48d125c7aa79bb18a,dd79f7311f4b8a71c1dd24333d5a2abd6d227339..339b13f4c37c67cbec6681525425d261700f8fe3
+++ b/gtk-gui.c
@@@ -739,13 -739,14 +739,14 @@@ static int get_from_registry(HKEY hkey
  }
  #endif
  
 -void init_ui(int argc, char **argv)
 +void init_ui(int *argcp, char ***argvp)
  {
        GtkWidget *win;
        GtkWidget *notebook;
        GtkWidget *dive_info;
        GtkWidget *dive_list;
        GtkWidget *equipment;
+       GtkWidget *stats;
        GtkWidget *menubar;
        GtkWidget *vbox;
        GdkScreen *screen;
                "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, 0
        };
  
 -      gtk_init(&argc, &argv);
 +      gtk_init(argcp, argvp);
        settings = gtk_settings_get_default();
        gtk_settings_set_long_property(settings, "gtk_tooltip_timeout", 10, "subsurface setting");
  
        equipment = equipment_widget();
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), equipment, gtk_label_new("Equipment"));
  
+       /* Frame for dive statistics */
+       stats = stats_widget();
+       gtk_notebook_append_page(GTK_NOTEBOOK(notebook), stats, gtk_label_new("Info & Stats"));
        gtk_widget_set_app_paintable(win, TRUE);
        gtk_widget_show_all(win);
  
diff --combined main.c
index 471abc7b4acee1f1c1f4ddca9c6a16784d19630d,680bf217126388154db9b40a0d744ca5768b6e7b..9aaa5d1f42ca61b384fb37740a7ebbbefe9472dc
--- 1/main.c
--- 2/main.c
+++ b/main.c
@@@ -193,6 -193,7 +193,7 @@@ void update_dive(struct dive *new_dive
        if (new_dive) {
                show_dive_info(new_dive);
                show_dive_equipment(new_dive);
+               show_dive_stats(new_dive);
        }
        buffered_dive = new_dive;
  }
@@@ -217,7 -218,7 +218,7 @@@ int main(int argc, char **argv
  
        parse_xml_init();
  
 -      init_ui(argc, argv);
 +      init_ui(&argc, &argv);
        
        for (i = 1; i < argc; i++) {
                const char *a = argv[i];