mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Have some C++ file in the project
Rename gtk-gui.c to qt-gui.cpp, and make the necessary changes so that the project still builds. Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
This commit is contained in:
parent
42365ede79
commit
578d633d01
13 changed files with 124 additions and 65 deletions
2
Makefile
2
Makefile
|
@ -184,7 +184,7 @@ MSGOBJS=$(addprefix share/locale/,$(MSGLANGS:.po=.UTF-8/LC_MESSAGES/subsurface.m
|
||||||
|
|
||||||
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o deco.o planner.o \
|
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o deco.o planner.o \
|
||||||
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o uemis-downloader.o \
|
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o uemis-downloader.o \
|
||||||
gtk-gui.o statistics.o file.o cochran.o device.o download-dialog.o prefs.o \
|
qt-gui.o statistics.o file.o cochran.o device.o download-dialog.o prefs.o \
|
||||||
webservice.o sha1.o $(GPSOBJ) $(OSSUPPORT).o $(RESFILE)
|
webservice.o sha1.o $(GPSOBJ) $(OSSUPPORT).o $(RESFILE)
|
||||||
|
|
||||||
DEPS = $(wildcard .dep/*.dep)
|
DEPS = $(wildcard .dep/*.dep)
|
||||||
|
|
|
@ -9,7 +9,7 @@ static void name(GtkWidget *w, gpointer data) \
|
||||||
#define OPTIONCALLBACK(name, option) \
|
#define OPTIONCALLBACK(name, option) \
|
||||||
static void name(GtkWidget *w, gpointer data) \
|
static void name(GtkWidget *w, gpointer data) \
|
||||||
{ \
|
{ \
|
||||||
GtkWidget **entry = data; \
|
GtkWidget **entry = (GtkWidget**)data; \
|
||||||
option = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); \
|
option = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); \
|
||||||
update_screen(); \
|
update_screen(); \
|
||||||
if (entry) \
|
if (entry) \
|
||||||
|
|
8
device.h
8
device.h
|
@ -1,6 +1,10 @@
|
||||||
#ifndef DEVICE_INFO_H
|
#ifndef DEVICE_INFO_H
|
||||||
#define DEVICE_INFO_H
|
#define DEVICE_INFO_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
struct device_info {
|
struct device_info {
|
||||||
const char *model;
|
const char *model;
|
||||||
uint32_t deviceid;
|
uint32_t deviceid;
|
||||||
|
@ -17,4 +21,8 @@ extern struct device_info *create_device_info(const char *model, uint32_t device
|
||||||
extern struct device_info *remove_device_info(const char *model, uint32_t deviceid);
|
extern struct device_info *remove_device_info(const char *model, uint32_t deviceid);
|
||||||
extern struct device_info *head_of_device_info_list(void);
|
extern struct device_info *head_of_device_info_list(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
#include <gdk/gdkkeysyms-compat.h>
|
#include <gdk/gdkkeysyms-compat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
extern GtkWidget *main_window;
|
extern GtkWidget *main_window;
|
||||||
|
|
||||||
/* we want a progress bar as part of the device_data_t - let's abstract this out */
|
/* we want a progress bar as part of the device_data_t - let's abstract this out */
|
||||||
|
@ -117,4 +121,8 @@ GError *uemis_download(const char *path, progressbar_t *progress, GtkDialog *dia
|
||||||
/* from planner.c */
|
/* from planner.c */
|
||||||
extern void input_plan(void);
|
extern void input_plan(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SCALE_SCREEN 1.0
|
#define SCALE_SCREEN 1.0
|
||||||
#define SCALE_PRINT (1.0 / get_screen_dpi())
|
#define SCALE_PRINT (1.0 / get_screen_dpi())
|
||||||
|
|
||||||
|
@ -63,4 +67,8 @@ struct options {
|
||||||
|
|
||||||
extern char zoomed_plot, dc_number;
|
extern char zoomed_plot, dc_number;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
10
dive.h
10
dive.h
|
@ -15,6 +15,10 @@
|
||||||
|
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define O2_IN_AIR 209 // permille
|
#define O2_IN_AIR 209 // permille
|
||||||
#define N2_IN_AIR 781
|
#define N2_IN_AIR 781
|
||||||
#define O2_DENSITY 1429 // mg/Liter
|
#define O2_DENSITY 1429 // mg/Liter
|
||||||
|
@ -523,7 +527,7 @@ static inline struct divecomputer *get_dive_dc(struct dive *dive, int nr)
|
||||||
#define for_each_gps_location(_i,_x) \
|
#define for_each_gps_location(_i,_x) \
|
||||||
for ((_i) = 0; ((_x) = get_gps_location(_i, &gps_location_table)) != NULL; (_i)++)
|
for ((_i) = 0; ((_x) = get_gps_location(_i, &gps_location_table)) != NULL; (_i)++)
|
||||||
|
|
||||||
static inline struct dive *get_dive_by_diveid(int diveid, int deviceid)
|
static inline struct dive *get_dive_by_diveid(uint32_t diveid, uint32_t deviceid)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct dive *dive;
|
struct dive *dive;
|
||||||
|
@ -700,6 +704,10 @@ extern char *debugfilename;
|
||||||
extern FILE *debugfile;
|
extern FILE *debugfile;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "pref.h"
|
#include "pref.h"
|
||||||
|
|
||||||
#endif /* DIVE_H */
|
#endif /* DIVE_H */
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#ifndef DIVELIST_H
|
#ifndef DIVELIST_H
|
||||||
#define DIVELIST_H
|
#define DIVELIST_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
struct dive;
|
struct dive;
|
||||||
|
|
||||||
extern void dive_list_update_dives(void);
|
extern void dive_list_update_dives(void);
|
||||||
|
@ -16,4 +20,9 @@ extern void select_prev_dive(void);
|
||||||
extern void show_and_select_dive(struct dive *dive);
|
extern void show_and_select_dive(struct dive *dive);
|
||||||
extern double init_decompression(struct dive * dive);
|
extern double init_decompression(struct dive * dive);
|
||||||
extern void export_all_dives_uddf_cb();
|
extern void export_all_dives_uddf_cb();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
16
linux.c
16
linux.c
|
@ -9,7 +9,7 @@ const char system_divelist_default_font[] = "Sans 8";
|
||||||
|
|
||||||
GConfClient *gconf;
|
GConfClient *gconf;
|
||||||
|
|
||||||
static char *gconf_name(char *name)
|
static char *gconf_name(const char *name)
|
||||||
{
|
{
|
||||||
static char buf[255] = "/apps/subsurface/";
|
static char buf[255] = "/apps/subsurface/";
|
||||||
|
|
||||||
|
@ -23,32 +23,32 @@ void subsurface_open_conf(void)
|
||||||
gconf = gconf_client_get_default();
|
gconf = gconf_client_get_default();
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_unset_conf(char *name)
|
void subsurface_unset_conf(const char *name)
|
||||||
{
|
{
|
||||||
gconf_client_unset(gconf, gconf_name(name), NULL);
|
gconf_client_unset(gconf, gconf_name(name), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf(char *name, const char *value)
|
void subsurface_set_conf(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
gconf_client_set_string(gconf, gconf_name(name), value, NULL);
|
gconf_client_set_string(gconf, gconf_name(name), value, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf_bool(char *name, int value)
|
void subsurface_set_conf_bool(const char *name, int value)
|
||||||
{
|
{
|
||||||
gconf_client_set_bool(gconf, gconf_name(name), value > 0, NULL);
|
gconf_client_set_bool(gconf, gconf_name(name), value > 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf_int(char *name, int value)
|
void subsurface_set_conf_int(const char *name, int value)
|
||||||
{
|
{
|
||||||
gconf_client_set_int(gconf, gconf_name(name), value , NULL);
|
gconf_client_set_int(gconf, gconf_name(name), value , NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *subsurface_get_conf(char *name)
|
const char *subsurface_get_conf(const char *name)
|
||||||
{
|
{
|
||||||
return gconf_client_get_string(gconf, gconf_name(name), NULL);
|
return gconf_client_get_string(gconf, gconf_name(name), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int subsurface_get_conf_bool(char *name)
|
int subsurface_get_conf_bool(const char *name)
|
||||||
{
|
{
|
||||||
GConfValue *val;
|
GConfValue *val;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
@ -61,7 +61,7 @@ int subsurface_get_conf_bool(char *name)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int subsurface_get_conf_int(char *name)
|
int subsurface_get_conf_int(const char *name)
|
||||||
{
|
{
|
||||||
int val = gconf_client_get_int(gconf, gconf_name(name), NULL);
|
int val = gconf_client_get_int(gconf, gconf_name(name), NULL);
|
||||||
if(!val)
|
if(!val)
|
||||||
|
|
14
macos.c
14
macos.c
|
@ -30,29 +30,29 @@ void subsurface_open_conf(void)
|
||||||
/* nothing at this time */
|
/* nothing at this time */
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_unset_conf(char *name)
|
void subsurface_unset_conf(const char *name)
|
||||||
{
|
{
|
||||||
CFPreferencesSetAppValue(CFSTR_VAR(name), NULL, SUBSURFACE_PREFERENCES);
|
CFPreferencesSetAppValue(CFSTR_VAR(name), NULL, SUBSURFACE_PREFERENCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf(char *name, const char *value)
|
void subsurface_set_conf(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
CFPreferencesSetAppValue(CFSTR_VAR(name), CFSTR_VAR(value), SUBSURFACE_PREFERENCES);
|
CFPreferencesSetAppValue(CFSTR_VAR(name), CFSTR_VAR(value), SUBSURFACE_PREFERENCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf_bool(char *name, int value)
|
void subsurface_set_conf_bool(const char *name, int value)
|
||||||
{
|
{
|
||||||
CFPreferencesSetAppValue(CFSTR_VAR(name),
|
CFPreferencesSetAppValue(CFSTR_VAR(name),
|
||||||
value ? kCFBooleanTrue : kCFBooleanFalse, SUBSURFACE_PREFERENCES);
|
value ? kCFBooleanTrue : kCFBooleanFalse, SUBSURFACE_PREFERENCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf_int(char *name, int value)
|
void subsurface_set_conf_int(const char *name, int value)
|
||||||
{
|
{
|
||||||
CFNumberRef numRef = CFNumberCreate(NULL, kCFNumberIntType, &value);
|
CFNumberRef numRef = CFNumberCreate(NULL, kCFNumberIntType, &value);
|
||||||
CFPreferencesSetAppValue(CFSTR_VAR(name), numRef, SUBSURFACE_PREFERENCES);
|
CFPreferencesSetAppValue(CFSTR_VAR(name), numRef, SUBSURFACE_PREFERENCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *subsurface_get_conf(char *name)
|
const char *subsurface_get_conf(char *name)
|
||||||
{
|
{
|
||||||
CFPropertyListRef strpref;
|
CFPropertyListRef strpref;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ const void *subsurface_get_conf(char *name)
|
||||||
return strdup(CFStringGetCStringPtr(strpref, kCFStringEncodingMacRoman));
|
return strdup(CFStringGetCStringPtr(strpref, kCFStringEncodingMacRoman));
|
||||||
}
|
}
|
||||||
|
|
||||||
int subsurface_get_conf_bool(char *name)
|
int subsurface_get_conf_bool(const char *name)
|
||||||
{
|
{
|
||||||
Boolean boolpref, exists;
|
Boolean boolpref, exists;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ int subsurface_get_conf_bool(char *name)
|
||||||
return boolpref;
|
return boolpref;
|
||||||
}
|
}
|
||||||
|
|
||||||
int subsurface_get_conf_int(char *name)
|
int subsurface_get_conf_int(const char *name)
|
||||||
{
|
{
|
||||||
Boolean exists;
|
Boolean exists;
|
||||||
CFIndex value;
|
CFIndex value;
|
||||||
|
|
22
pref.h
22
pref.h
|
@ -1,6 +1,10 @@
|
||||||
#ifndef PREF_H
|
#ifndef PREF_H
|
||||||
#define PREF_H
|
#define PREF_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gboolean cylinder;
|
gboolean cylinder;
|
||||||
gboolean temperature;
|
gboolean temperature;
|
||||||
|
@ -43,13 +47,13 @@ extern struct preferences prefs, default_prefs;
|
||||||
#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
|
#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
|
||||||
|
|
||||||
extern void subsurface_open_conf(void);
|
extern void subsurface_open_conf(void);
|
||||||
extern void subsurface_set_conf(char *name, const char *value);
|
extern void subsurface_set_conf(const char *name, const char *value);
|
||||||
extern void subsurface_set_conf_bool(char *name, gboolean value);
|
extern void subsurface_set_conf_bool(const char *name, gboolean value);
|
||||||
extern void subsurface_set_conf_int(char *name, int value);
|
extern void subsurface_set_conf_int(const char *name, int value);
|
||||||
extern void subsurface_unset_conf(char *name);
|
extern void subsurface_unset_conf(const char *name);
|
||||||
extern const void *subsurface_get_conf(char *name);
|
extern const char *subsurface_get_conf(const char *name);
|
||||||
extern int subsurface_get_conf_bool(char *name);
|
extern int subsurface_get_conf_bool(const char *name);
|
||||||
extern int subsurface_get_conf_int(char *name);
|
extern int subsurface_get_conf_int(const char *name);
|
||||||
extern void subsurface_flush_conf(void);
|
extern void subsurface_flush_conf(void);
|
||||||
extern void subsurface_close_conf(void);
|
extern void subsurface_close_conf(void);
|
||||||
|
|
||||||
|
@ -59,4 +63,8 @@ extern const char *system_default_filename();
|
||||||
extern void load_preferences(void);
|
extern void load_preferences(void);
|
||||||
extern void save_preferences(void);
|
extern void save_preferences(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* PREF_H */
|
#endif /* PREF_H */
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
|
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#include <gdk-pixbuf/gdk-pixdata.h>
|
#include <gdk-pixbuf/gdk-pixdata.h>
|
||||||
#include "subsurface-icon.h"
|
|
||||||
|
|
||||||
#if HAVE_OSM_GPS_MAP
|
#if HAVE_OSM_GPS_MAP
|
||||||
#include <osm-gps-map-source.h>
|
#include <osm-gps-map-source.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const GdkPixdata subsurface_icon_pixbuf = {};
|
||||||
|
|
||||||
GtkWidget *main_window;
|
GtkWidget *main_window;
|
||||||
GtkWidget *main_vbox;
|
GtkWidget *main_vbox;
|
||||||
GtkWidget *error_info_bar;
|
GtkWidget *error_info_bar;
|
||||||
|
@ -224,7 +225,7 @@ static gboolean ask_save_changes()
|
||||||
GtkWidget *dialog, *label, *content;
|
GtkWidget *dialog, *label, *content;
|
||||||
gboolean quit = TRUE;
|
gboolean quit = TRUE;
|
||||||
dialog = gtk_dialog_new_with_buttons(_("Save Changes?"),
|
dialog = gtk_dialog_new_with_buttons(_("Save Changes?"),
|
||||||
GTK_WINDOW(main_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_WINDOW(main_window), GtkDialogFlags(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
|
||||||
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
|
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
|
||||||
GTK_STOCK_NO, GTK_RESPONSE_NO,
|
GTK_STOCK_NO, GTK_RESPONSE_NO,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
@ -320,7 +321,7 @@ static void file_open(GtkWidget *w, gpointer data)
|
||||||
fn_glist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
|
fn_glist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
|
||||||
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
filename = fn_glist->data;
|
filename = (char *)fn_glist->data;
|
||||||
parse_file(filename, &error, TRUE);
|
parse_file(filename, &error, TRUE);
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
{
|
{
|
||||||
|
@ -609,16 +610,16 @@ void update_screen()
|
||||||
update_dive_list_col_visibility();
|
update_dive_list_col_visibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITCALLBACK(set_meter, length, METERS)
|
UNITCALLBACK(set_meter, length, units::METERS)
|
||||||
UNITCALLBACK(set_feet, length, FEET)
|
UNITCALLBACK(set_feet, length, units::FEET)
|
||||||
UNITCALLBACK(set_bar, pressure, BAR)
|
UNITCALLBACK(set_bar, pressure, units::BAR)
|
||||||
UNITCALLBACK(set_psi, pressure, PSI)
|
UNITCALLBACK(set_psi, pressure, units::PSI)
|
||||||
UNITCALLBACK(set_liter, volume, LITER)
|
UNITCALLBACK(set_liter, volume, units::LITER)
|
||||||
UNITCALLBACK(set_cuft, volume, CUFT)
|
UNITCALLBACK(set_cuft, volume, units::CUFT)
|
||||||
UNITCALLBACK(set_celsius, temperature, CELSIUS)
|
UNITCALLBACK(set_celsius, temperature, units::CELSIUS)
|
||||||
UNITCALLBACK(set_fahrenheit, temperature, FAHRENHEIT)
|
UNITCALLBACK(set_fahrenheit, temperature, units::FAHRENHEIT)
|
||||||
UNITCALLBACK(set_kg, weight, KG)
|
UNITCALLBACK(set_kg, weight, units::KG)
|
||||||
UNITCALLBACK(set_lbs, weight, LBS)
|
UNITCALLBACK(set_lbs, weight, units::LBS)
|
||||||
|
|
||||||
OPTIONCALLBACK(otu_toggle, prefs.visible_cols.otu)
|
OPTIONCALLBACK(otu_toggle, prefs.visible_cols.otu)
|
||||||
OPTIONCALLBACK(maxcns_toggle, prefs.visible_cols.maxcns)
|
OPTIONCALLBACK(maxcns_toggle, prefs.visible_cols.maxcns)
|
||||||
|
@ -667,7 +668,7 @@ static gboolean gfhigh_edit(GtkWidget *w, GdkEvent *event, gpointer _data)
|
||||||
|
|
||||||
static void event_toggle(GtkWidget *w, gpointer _data)
|
static void event_toggle(GtkWidget *w, gpointer _data)
|
||||||
{
|
{
|
||||||
gboolean *plot_ev = _data;
|
gboolean *plot_ev = (gboolean *)_data;
|
||||||
|
|
||||||
*plot_ev = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
|
*plot_ev = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
|
||||||
}
|
}
|
||||||
|
@ -710,7 +711,7 @@ static void pick_default_file(GtkWidget *w, GtkButton *button)
|
||||||
|
|
||||||
list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(fs_dialog));
|
list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(fs_dialog));
|
||||||
if (g_slist_length(list) == 1)
|
if (g_slist_length(list) == 1)
|
||||||
gtk_button_set_label(button, list->data);
|
gtk_button_set_label(button, (const gchar *)list->data);
|
||||||
g_slist_free(list);
|
g_slist_free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,28 +780,28 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
|
||||||
gtk_container_add(GTK_CONTAINER(frame), box);
|
gtk_container_add(GTK_CONTAINER(frame), box);
|
||||||
|
|
||||||
create_radio(box, _("Depth:"),
|
create_radio(box, _("Depth:"),
|
||||||
_("Meter"), set_meter, (prefs.units.length == METERS),
|
_("Meter"), set_meter, (prefs.units.length == units::METERS),
|
||||||
_("Feet"), set_feet, (prefs.units.length == FEET),
|
_("Feet"), set_feet, (prefs.units.length == units::FEET),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
create_radio(box, _("Pressure:"),
|
create_radio(box, _("Pressure:"),
|
||||||
_("Bar"), set_bar, (prefs.units.pressure == BAR),
|
_("Bar"), set_bar, (prefs.units.pressure == units::BAR),
|
||||||
_("PSI"), set_psi, (prefs.units.pressure == PSI),
|
_("PSI"), set_psi, (prefs.units.pressure == units::PSI),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
create_radio(box, _("Volume:"),
|
create_radio(box, _("Volume:"),
|
||||||
_("Liter"), set_liter, (prefs.units.volume == LITER),
|
_("Liter"), set_liter, (prefs.units.volume == units::LITER),
|
||||||
_("CuFt"), set_cuft, (prefs.units.volume == CUFT),
|
_("CuFt"), set_cuft, (prefs.units.volume == units::CUFT),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
create_radio(box, _("Temperature:"),
|
create_radio(box, _("Temperature:"),
|
||||||
_("Celsius"), set_celsius, (prefs.units.temperature == CELSIUS),
|
_("Celsius"), set_celsius, (prefs.units.temperature == units::CELSIUS),
|
||||||
_("Fahrenheit"), set_fahrenheit, (prefs.units.temperature == FAHRENHEIT),
|
_("Fahrenheit"), set_fahrenheit, (prefs.units.temperature == units::FAHRENHEIT),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
create_radio(box, _("Weight:"),
|
create_radio(box, _("Weight:"),
|
||||||
_("kg"), set_kg, (prefs.units.weight == KG),
|
_("kg"), set_kg, (prefs.units.weight == units::KG),
|
||||||
_("lbs"), set_lbs, (prefs.units.weight == LBS),
|
_("lbs"), set_lbs, (prefs.units.weight == units::LBS),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
frame = gtk_frame_new(_("Show Columns"));
|
frame = gtk_frame_new(_("Show Columns"));
|
||||||
|
@ -1082,7 +1083,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
|
||||||
|
|
||||||
static void create_toggle(const char* label, int *on, void *_data)
|
static void create_toggle(const char* label, int *on, void *_data)
|
||||||
{
|
{
|
||||||
GtkWidget *button, *table = _data;
|
GtkWidget *button, *table = GTK_WIDGET(_data);
|
||||||
int rows, cols, x, y;
|
int rows, cols, x, y;
|
||||||
static int count;
|
static int count;
|
||||||
|
|
||||||
|
@ -1345,7 +1346,7 @@ static void edit_dc_delete_rows(GtkTreeView *view)
|
||||||
selected_rows = gtk_tree_selection_get_selected_rows(selection, &model);
|
selected_rows = gtk_tree_selection_get_selected_rows(selection, &model);
|
||||||
|
|
||||||
for (list = selected_rows; list; list = g_list_next(list)) {
|
for (list = selected_rows; list; list = g_list_next(list)) {
|
||||||
path = list->data;
|
path = (GtkTreePath *)list->data;
|
||||||
ref = gtk_tree_row_reference_new(model, path);
|
ref = gtk_tree_row_reference_new(model, path);
|
||||||
row_references = g_list_append(row_references, ref);
|
row_references = g_list_append(row_references, ref);
|
||||||
}
|
}
|
||||||
|
@ -1441,7 +1442,7 @@ static void edit_dc_nicknames(GtkWidget *w, gpointer data)
|
||||||
|
|
||||||
dialog = gtk_dialog_new_with_buttons(_("Edit Dive Computer Nicknames"),
|
dialog = gtk_dialog_new_with_buttons(_("Edit Dive Computer Nicknames"),
|
||||||
GTK_WINDOW(main_window),
|
GTK_WINDOW(main_window),
|
||||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
GtkDialogFlags(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
|
||||||
GTK_STOCK_DELETE,
|
GTK_STOCK_DELETE,
|
||||||
SUB_RESPONSE_DELETE,
|
SUB_RESPONSE_DELETE,
|
||||||
GTK_STOCK_CANCEL,
|
GTK_STOCK_CANCEL,
|
||||||
|
@ -1509,7 +1510,7 @@ static void edit_dc_nicknames(GtkWidget *w, gpointer data)
|
||||||
if (res == SUB_RESPONSE_DELETE) {
|
if (res == SUB_RESPONSE_DELETE) {
|
||||||
confirm = gtk_dialog_new_with_buttons(_("Delete a dive computer information entry"),
|
confirm = gtk_dialog_new_with_buttons(_("Delete a dive computer information entry"),
|
||||||
GTK_WINDOW(dialog),
|
GTK_WINDOW(dialog),
|
||||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
GtkDialogFlags(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
|
||||||
GTK_STOCK_YES,
|
GTK_STOCK_YES,
|
||||||
GTK_RESPONSE_YES,
|
GTK_RESPONSE_YES,
|
||||||
GTK_STOCK_NO,
|
GTK_STOCK_NO,
|
||||||
|
@ -1855,7 +1856,8 @@ static int tooltips;
|
||||||
void attach_tooltip(int x, int y, int w, int h, const char *text, struct event *event)
|
void attach_tooltip(int x, int y, int w, int h, const char *text, struct event *event)
|
||||||
{
|
{
|
||||||
cairo_rectangle_t *rect;
|
cairo_rectangle_t *rect;
|
||||||
tooltip_rects = realloc(tooltip_rects, (tooltips + 1) * sizeof(tooltip_record_t));
|
tooltip_rects = (tooltip_record_t *)
|
||||||
|
realloc(tooltip_rects, (tooltips + 1) * sizeof(tooltip_record_t));
|
||||||
rect = &tooltip_rects[tooltips].rect;
|
rect = &tooltip_rects[tooltips].rect;
|
||||||
rect->x = x;
|
rect->x = x;
|
||||||
rect->y = y;
|
rect->y = y;
|
||||||
|
@ -1975,7 +1977,7 @@ static gboolean draw_callback(GtkWidget *widget, cairo_t *cr, gpointer data)
|
||||||
static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||||
{
|
{
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
static struct graphics_context gc = { .printer = 0 };
|
static struct graphics_context gc = { 0 };
|
||||||
|
|
||||||
/* the drawing area gives TOTAL width * height - x,y is used as the topx/topy offset
|
/* the drawing area gives TOTAL width * height - x,y is used as the topx/topy offset
|
||||||
* so effective drawing area is width-2x * height-2y */
|
* so effective drawing area is width-2x * height-2y */
|
||||||
|
@ -2021,7 +2023,7 @@ static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer
|
||||||
|
|
||||||
static void add_gas_change_cb(GtkWidget *menuitem, gpointer data)
|
static void add_gas_change_cb(GtkWidget *menuitem, gpointer data)
|
||||||
{
|
{
|
||||||
double *x = data;
|
double *x = (double *)data;
|
||||||
int when = x_to_time(*x);
|
int when = x_to_time(*x);
|
||||||
int cylnr = select_cylinder(current_dive, when);
|
int cylnr = select_cylinder(current_dive, when);
|
||||||
if (cylnr >= 0) {
|
if (cylnr >= 0) {
|
||||||
|
@ -2061,7 +2063,7 @@ int confirm_dialog(int when, char *action_text, char *event_text)
|
||||||
|
|
||||||
static void add_bookmark_cb(GtkWidget *menuitem, gpointer data)
|
static void add_bookmark_cb(GtkWidget *menuitem, gpointer data)
|
||||||
{
|
{
|
||||||
double *x = data;
|
double *x = (double *)data;
|
||||||
int when = x_to_time(*x);
|
int when = x_to_time(*x);
|
||||||
|
|
||||||
if (confirm_dialog(when, _("Add"), _("bookmark"))){
|
if (confirm_dialog(when, _("Add"), _("bookmark"))){
|
||||||
|
@ -2089,7 +2091,7 @@ static struct event *event_at_x(double rel_x)
|
||||||
|
|
||||||
static void remove_event_cb(GtkWidget *menuitem, gpointer data)
|
static void remove_event_cb(GtkWidget *menuitem, gpointer data)
|
||||||
{
|
{
|
||||||
struct event *event = data;
|
struct event *event = (struct event *)data;
|
||||||
if (confirm_dialog(event->time.seconds, _("Remove"), _(event->name))){
|
if (confirm_dialog(event->time.seconds, _("Remove"), _(event->name))){
|
||||||
struct event **ep = ¤t_dc->events;
|
struct event **ep = ¤t_dc->events;
|
||||||
while (ep && *ep != event)
|
while (ep && *ep != event)
|
||||||
|
@ -2204,7 +2206,7 @@ static GtkWidget *dive_profile_widget(void)
|
||||||
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;
|
||||||
parse_file(data, &error, FALSE);
|
parse_file((const char *)data, &error, FALSE);
|
||||||
|
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
{
|
{
|
|
@ -1,3 +1,11 @@
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void webservice_download_dialog(void);
|
extern void webservice_download_dialog(void);
|
||||||
extern gboolean webservice_request_user_xml(const gchar *, gchar **, guint *, guint *);
|
extern gboolean webservice_request_user_xml(const gchar *, gchar **, guint *, guint *);
|
||||||
extern int divelogde_upload(char *fn);
|
extern int divelogde_upload(char *fn);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
10
windows.c
10
windows.c
|
@ -20,12 +20,12 @@ void subsurface_open_conf(void)
|
||||||
printf("CreateKey Software\\subsurface failed %ld\n", success);
|
printf("CreateKey Software\\subsurface failed %ld\n", success);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_unset_conf(char *name)
|
void subsurface_unset_conf(const char *name)
|
||||||
{
|
{
|
||||||
RegDeleteValue(hkey, (LPCTSTR)name);
|
RegDeleteValue(hkey, (LPCTSTR)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf(char *name, const char *value)
|
void subsurface_set_conf(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
/* since we are using the pointer 'value' as both an actual
|
/* since we are using the pointer 'value' as both an actual
|
||||||
* pointer to the string setting and as a way to pass the
|
* pointer to the string setting and as a way to pass the
|
||||||
|
@ -52,17 +52,17 @@ void subsurface_set_conf(char *name, const char *value)
|
||||||
free(wname);
|
free(wname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf_int(char *name, int value)
|
void subsurface_set_conf_int(const char *name, int value)
|
||||||
{
|
{
|
||||||
RegSetValueEx(hkey, (LPCTSTR)name, 0, REG_DWORD, (const BYTE *)&value, 4);
|
RegSetValueEx(hkey, (LPCTSTR)name, 0, REG_DWORD, (const BYTE *)&value, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_set_conf_bool(char *name, int value)
|
void subsurface_set_conf_bool(const char *name, int value)
|
||||||
{
|
{
|
||||||
subsurface_set_conf_int(name, value);
|
subsurface_set_conf_int(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *subsurface_get_conf(char *name)
|
const char *subsurface_get_conf(const char *name)
|
||||||
{
|
{
|
||||||
const int csize = 64;
|
const int csize = 64;
|
||||||
int blen = 0;
|
int blen = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue