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;
|
|
|
|
|
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
|
|
|
|
|
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-12-09 23:19:17 +00:00
|
|
|
extern gboolean on_delete(GtkWidget* w, gpointer data);
|
2012-01-01 21:41:47 +00:00
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
extern void set_divelist_font(const char *);
|
|
|
|
|
2013-01-11 11:24:15 +00:00
|
|
|
extern void update_screen(void);
|
2012-09-21 22:47:06 +00:00
|
|
|
extern void download_dialog(GtkWidget *, gpointer);
|
2013-01-11 11:24:15 +00:00
|
|
|
extern int is_default_dive_computer_device(const char *);
|
|
|
|
extern int is_default_dive_computer(const char *, const char *);
|
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 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
|
|
|
|
2013-01-11 11:24:15 +00:00
|
|
|
extern const char *default_dive_computer_vendor;
|
|
|
|
extern const char *default_dive_computer_product;
|
|
|
|
extern const char *default_dive_computer_device;
|
|
|
|
|
2013-01-08 16:48:13 +00:00
|
|
|
// info.c
|
|
|
|
enum {
|
|
|
|
MATCH_EXACT,
|
|
|
|
MATCH_PREPEND,
|
|
|
|
MATCH_AFTER
|
|
|
|
} found_string_entry;
|
|
|
|
|
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);
|
2013-01-08 16:48:13 +00:00
|
|
|
extern int match_list(GtkListStore *list, const char *string);
|
2012-12-10 21:16:17 +00:00
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
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);
|
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);
|
2013-01-28 15:54:30 +00:00
|
|
|
extern GdkPixbuf *get_gps_icon(void);
|
2011-09-20 19:40:34 +00:00
|
|
|
|
2013-01-28 00:40:01 +00:00
|
|
|
/* Helper functions for gtk combo boxes */
|
|
|
|
extern GtkEntry *get_entry(GtkComboBox *);
|
|
|
|
extern const char *get_active_text(GtkComboBox *);
|
|
|
|
extern void set_active_text(GtkComboBox *, const char *);
|
|
|
|
extern GtkWidget *combo_box_with_model_and_entry(GtkListStore *);
|
|
|
|
|
2013-01-23 03:52:07 +00:00
|
|
|
extern gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data);
|
|
|
|
|
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);
|
2013-01-23 03:52:07 +00:00
|
|
|
extern GtkTreeViewColumn *tree_view_column_add_pixbuf(GtkWidget *tree_view, data_func_t data_func, GtkTreeViewColumn *col);
|
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
|
|
|
|
2013-01-07 19:23:14 +00:00
|
|
|
/* from planner.c */
|
|
|
|
extern void input_plan(void);
|
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
#endif
|