X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/28c82d8b28ffaae83acf74f348ddb7f864d0ce58..ab4553c3321e7d41330252da08d42a4c3b558110:/src/acquire.h diff --git a/src/acquire.h b/src/acquire.h index f38e4a97..988ca0ee 100644 --- a/src/acquire.h +++ b/src/acquire.h @@ -27,6 +27,7 @@ #include "vikwindow.h" #include "viklayerspanel.h" #include "vikviewport.h" +#include "babel.h" typedef struct _VikDataSourceInterface VikDataSourceInterface; @@ -38,13 +39,16 @@ typedef struct { VikViewport *vvp; GtkWidget *dialog; gboolean ok; /* if OK is false when we exit, we MUST free w */ - VikDataSourceInterface *interface; + VikDataSourceInterface *source_interface; gpointer user_data; } acq_dialog_widgets_t; +/* Direct, URL & Shell types process the results with GPSBabel to create tracks/waypoint */ typedef enum { VIK_DATASOURCE_GPSBABEL_DIRECT, - VIK_DATASOURCE_SHELL_CMD + VIK_DATASOURCE_URL, + VIK_DATASOURCE_SHELL_CMD, + VIK_DATASOURCE_INTERNAL } vik_datasource_type_t; typedef enum { @@ -60,7 +64,6 @@ typedef enum { VIK_DATASOURCE_INPUTTYPE_TRWLAYER_TRACK } vik_datasource_inputtype_t; - /* returns pointer to state if OK, otherwise NULL */ typedef gpointer (*VikDataSourceInitFunc) (); @@ -72,12 +75,16 @@ typedef void (*VikDataSourceAddSetupWidgetsFunc) ( GtkWidget *dialog, VikViewpor /* if VIK_DATASOURCE_GPSBABEL_DIRECT, babelargs and inputfile. if VIK_DATASOURCE_SHELL_CMD, shellcmd and inputtype. + if VIK_DATASOURCE_URL, url and inputtype. set both to NULL to signal refusal (ie already downloading) */ typedef void (*VikDataSourceGetCmdStringFunc) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype ); typedef void (*VikDataSourceGetCmdStringFuncWithInput) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype, const gchar *input_file_name ); typedef void (*VikDataSourceGetCmdStringFuncWithInputInput) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype, const gchar *input_file_name, const gchar *input_track_file_name ); +/* The actual function to do stuff - must report success/failure */ +typedef gboolean (*VikDataSourceProcessFunc) ( gpointer vtl, const gchar *cmd, const gchar *extra, BabelStatusFunc status_cb, acq_dialog_widgets_t *adw ); + /* */ typedef void (*VikDataSourceProgressFunc) (gpointer c, gpointer data, acq_dialog_widgets_t *w); @@ -87,6 +94,7 @@ typedef void (*VikDataSourceAddProgressWidgetsFunc) ( GtkWidget *dialog, gpoint /* Frees any widgets created for the setup or progress dialogs, any allocated state, etc. */ typedef void (*VikDataSourceCleanupFunc) ( gpointer user_data ); +typedef void (*VikDataSourceOffFunc) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype );; struct _VikDataSourceInterface { const gchar *window_title; @@ -94,6 +102,7 @@ struct _VikDataSourceInterface { vik_datasource_type_t type; vik_datasource_mode_t mode; vik_datasource_inputtype_t inputtype; + gboolean autoview; gboolean keep_dialog_open; /* when done */ @@ -106,10 +115,12 @@ struct _VikDataSourceInterface { /* or VikDataSourceGetCmdStringFuncWithInput, if inputtype is not NONE */ VikDataSourceGetCmdStringFunc get_cmd_string_func; + VikDataSourceProcessFunc process_func; + VikDataSourceProgressFunc progress_func; VikDataSourceAddProgressWidgetsFunc add_progress_widgets_func; VikDataSourceCleanupFunc cleanup_func; - + VikDataSourceOffFunc off_func; /*** UI Building ***/ VikLayerParam * params; @@ -125,7 +136,7 @@ struct _VikDataSourceInterface { /**********************************/ /* for sources with no input data */ -void a_acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikDataSourceInterface *interface ); +void a_acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikDataSourceInterface *source_interface ); /* Create a sub menu intended for rightclicking on a TRWLayer. menu called "Filter" * returns NULL if no filters */ @@ -140,8 +151,8 @@ GtkWidget *a_acquire_trwlayer_track_menu (VikWindow *vw, VikLayersPanel *vlp, Vi * returns NULL if no applicable filters */ GtkWidget *a_acquire_track_menu (VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikTrack *tr); -/* sets aplication-wide track to use with filter. references the track. */ -void a_acquire_set_filter_track ( VikTrack *tr, const gchar *name ); +/* sets application-wide track to use with filter. references the track. */ +void a_acquire_set_filter_track ( VikTrack *tr ); #endif