2011-09-20 19:40:34 +00:00
|
|
|
#ifndef DISPLAY_GTK_H
|
|
|
|
#define DISPLAY_GTK_H
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gdk/gdk.h>
|
2013-01-02 21:01:02 +00:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
#if GTK_CHECK_VERSION(2,22,0)
|
|
|
|
#include <gdk/gdkkeysyms-compat.h>
|
|
|
|
#endif
|
2011-09-20 19:40:34 +00:00
|
|
|
|
|
|
|
extern GtkWidget *main_window;
|
|
|
|
|
|
|
|
/* we want a progress bar as part of the device_data_t - let's abstract this out */
|
|
|
|
typedef struct {
|
|
|
|
GtkWidget *bar;
|
|
|
|
} progressbar_t;
|
|
|
|
|
2011-09-27 17:16:40 +00:00
|
|
|
typedef struct {
|
2011-10-23 20:36:37 +00:00
|
|
|
gboolean cylinder;
|
|
|
|
gboolean temperature;
|
2012-08-07 18:24:40 +00:00
|
|
|
gboolean totalweight;
|
2012-08-14 23:07:25 +00:00
|
|
|
gboolean suit;
|
2011-10-23 20:36:37 +00:00
|
|
|
gboolean nitrox;
|
2011-09-27 17:16:40 +00:00
|
|
|
gboolean sac;
|
|
|
|
gboolean otu;
|
2012-12-11 05:18:48 +00:00
|
|
|
gboolean maxcns;
|
2011-09-27 17:16:40 +00:00
|
|
|
} visible_cols_t;
|
|
|
|
|
2012-11-01 17:04:12 +00:00
|
|
|
typedef struct {
|
|
|
|
gboolean po2;
|
|
|
|
gboolean pn2;
|
|
|
|
gboolean phe;
|
2012-11-10 16:58:42 +00:00
|
|
|
double po2_threshold;
|
|
|
|
double pn2_threshold;
|
|
|
|
double phe_threshold;
|
|
|
|
} partial_pressure_graphs_t;
|
2012-11-01 17:04:12 +00:00
|
|
|
|
2012-12-10 17:20:57 +00:00
|
|
|
struct preferences {
|
|
|
|
struct units output_units;
|
|
|
|
visible_cols_t visible_cols;
|
|
|
|
partial_pressure_graphs_t pp_graphs;
|
|
|
|
gboolean profile_red_ceiling;
|
2013-01-03 06:45:21 +00:00
|
|
|
gboolean profile_calc_ceiling;
|
2013-01-03 07:22:07 +00:00
|
|
|
gboolean calc_ceiling_3m_incr;
|
2013-01-04 05:31:22 +00:00
|
|
|
double gflow;
|
|
|
|
double gfhigh;
|
2012-12-10 17:20:57 +00:00
|
|
|
};
|
2012-11-01 18:44:18 +00:00
|
|
|
|
2012-12-10 17:20:57 +00:00
|
|
|
extern struct preferences prefs;
|
|
|
|
|
|
|
|
#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
|
2012-11-01 18:44:18 +00:00
|
|
|
|
2011-11-24 06:56:57 +00:00
|
|
|
typedef enum {
|
|
|
|
PREF_BOOL,
|
|
|
|
PREF_STRING
|
|
|
|
} pref_type_t;
|
|
|
|
|
|
|
|
#define BOOL_TO_PTR(_cond) ((_cond) ? (void *)1 : NULL)
|
|
|
|
#define PTR_TO_BOOL(_ptr) ((_ptr) != NULL)
|
|
|
|
|
2012-01-03 04:49:10 +00:00
|
|
|
#if defined __APPLE__
|
|
|
|
#define CTRLCHAR "<Meta>"
|
2012-07-17 14:49:27 +00:00
|
|
|
#define SHIFTCHAR "<Shift>"
|
2012-01-03 19:18:04 +00:00
|
|
|
#define PREFERENCE_ACCEL "<Meta>comma"
|
2012-01-03 04:49:10 +00:00
|
|
|
#else
|
|
|
|
#define CTRLCHAR "<Control>"
|
2012-07-17 14:49:27 +00:00
|
|
|
#define SHIFTCHAR "<Shift>"
|
2012-01-03 04:49:10 +00:00
|
|
|
#define PREFERENCE_ACCEL NULL
|
|
|
|
#endif
|
|
|
|
|
2011-11-24 06:56:57 +00:00
|
|
|
extern void subsurface_open_conf(void);
|
|
|
|
extern void subsurface_set_conf(char *name, pref_type_t type, const void *value);
|
|
|
|
extern const void *subsurface_get_conf(char *name, pref_type_t type);
|
2012-05-02 17:03:48 +00:00
|
|
|
extern void subsurface_flush_conf(void);
|
2011-11-24 06:56:57 +00:00
|
|
|
extern void subsurface_close_conf(void);
|
|
|
|
|
2012-10-26 22:52:39 +00:00
|
|
|
extern int subsurface_fill_device_list(GtkListStore *store);
|
2011-12-28 23:57:36 +00:00
|
|
|
extern const char *subsurface_icon_name(void);
|
2012-01-03 04:49:10 +00:00
|
|
|
extern void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
|
|
|
GtkWidget *vbox, GtkUIManager *ui_manager);
|
2012-09-12 16:18:56 +00:00
|
|
|
extern void quit(GtkWidget *w, gpointer data);
|
2012-12-09 23:19:17 +00:00
|
|
|
extern gboolean on_delete(GtkWidget* w, gpointer data);
|
2012-01-01 21:41:47 +00:00
|
|
|
|
2012-10-26 22:52:39 +00:00
|
|
|
extern int is_default_dive_computer_device(const char *name);
|
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
extern const char *divelist_font;
|
|
|
|
extern void set_divelist_font(const char *);
|
|
|
|
|
2012-09-21 23:12:12 +00:00
|
|
|
extern void import_files(GtkWidget *, gpointer);
|
2012-09-21 22:47:06 +00:00
|
|
|
extern void download_dialog(GtkWidget *, gpointer);
|
2012-06-28 01:09:26 +00:00
|
|
|
extern void add_dive_cb(GtkWidget *, gpointer);
|
2011-09-20 19:40:34 +00:00
|
|
|
extern void report_error(GError* error);
|
|
|
|
extern int process_ui_events(void);
|
|
|
|
extern void update_progressbar(progressbar_t *progress, double value);
|
2012-05-03 00:40:39 +00:00
|
|
|
extern void update_progressbar_text(progressbar_t *progress, const char *text);
|
2011-09-20 19:40:34 +00:00
|
|
|
|
2012-12-10 21:16:17 +00:00
|
|
|
extern GtkWidget *create_date_time_widget(struct tm *time, GtkWidget **cal, GtkWidget **h, GtkWidget **m);
|
2013-01-06 07:14:42 +00:00
|
|
|
extern void add_string_list_entry(const char *string, GtkListStore *list);
|
2012-12-10 21:16:17 +00:00
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
extern GtkWidget *dive_profile_widget(void);
|
|
|
|
extern GtkWidget *dive_info_frame(void);
|
|
|
|
extern GtkWidget *extended_dive_info_widget(void);
|
2012-08-15 22:21:34 +00:00
|
|
|
extern GtkWidget *equipment_widget(int w_idx);
|
2012-01-15 22:29:08 +00:00
|
|
|
extern GtkWidget *single_stats_widget(void);
|
|
|
|
extern GtkWidget *total_stats_widget(void);
|
2012-08-15 22:21:34 +00:00
|
|
|
extern GtkWidget *cylinder_list_widget(int w_idx);
|
|
|
|
extern GtkWidget *weightsystem_list_widget(int w_idx);
|
2011-09-20 19:40:34 +00:00
|
|
|
|
|
|
|
extern GtkWidget *dive_list_create(void);
|
2012-10-01 22:52:43 +00:00
|
|
|
extern void dive_list_destroy(void);
|
2011-09-20 19:40:34 +00:00
|
|
|
|
2012-03-14 17:01:34 +00:00
|
|
|
unsigned int amount_selected;
|
|
|
|
|
2012-08-20 12:48:07 +00:00
|
|
|
extern void process_selected_dives(void);
|
2012-03-14 17:01:34 +00:00
|
|
|
|
2011-10-02 20:05:12 +00:00
|
|
|
typedef void (*data_func_t)(GtkTreeViewColumn *col,
|
|
|
|
GtkCellRenderer *renderer,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gpointer data);
|
|
|
|
|
Add capability of custom sorts to divelist columns
.. and use this for the nitrox column, which can now be more complex
than just a single number.
The rule for the "nitrox" column is now:
- we look up the highest Oxygen and Helium mix for the dive
(Note: we look them up independently, so if you have a EAN50 deco
bottle, and a 20% Helium low-oxygen bottle for the deep portion, then
we'll consider the dive to be a "50% Oxygen, 20% Helium" dive, even
though you obviously never used that combination at the same time)
- we sort by Helium first, Oxygen second. So a dive with a 10% Helium
mix is considered to be "stronger" than a 50% Nitrox mix.
- If Helium is non-zero, we show "O2/He", otherwise we show just "O2"
(or "air"). So "21/20" means "21% oxygen, 20% Helium", while "40"
means "Ean 40".
- I got rid of the decimals. We save them, and you can see them in the
dive equipment details, but for the dive list we just use rounded
percentages.
Let's see how many bugs I introduced. I don't actually have any trimix
dives, but I edited a few for (very limited) testing.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-11 22:38:58 +00:00
|
|
|
typedef gint (*sort_func_t)(GtkTreeModel *model,
|
|
|
|
GtkTreeIter *a,
|
|
|
|
GtkTreeIter *b,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2011-12-11 19:40:17 +00:00
|
|
|
#define ALIGN_LEFT 1
|
|
|
|
#define ALIGN_RIGHT 2
|
|
|
|
#define INVISIBLE 4
|
|
|
|
#define UNSORTABLE 8
|
2013-01-05 20:16:02 +00:00
|
|
|
#define EDITABLE 16
|
2011-12-11 19:40:17 +00:00
|
|
|
|
2011-10-02 20:05:12 +00:00
|
|
|
extern GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title,
|
2011-12-11 19:40:17 +00:00
|
|
|
data_func_t data_func, unsigned int flags);
|
2011-10-02 20:05:12 +00:00
|
|
|
|
2012-11-29 00:11:19 +00:00
|
|
|
GError *uemis_download(const char *path, progressbar_t *progress, GtkDialog *dialog, gboolean force_download);
|
2012-09-25 14:28:47 +00:00
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
#endif
|