]> git.street.me.uk Git - andy/viking.git/blame - src/acquire.h
Add tooltips for Preferences and Layer Parameters.
[andy/viking.git] / src / acquire.h
CommitLineData
1d1bc3c1
EB
1/*
2 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
3 *
4 * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef _VIKING_ACQUIRE_H
23#define _VIKING_ACQUIRE_H
24
a25c4c50
GB
25#include <gtk/gtk.h>
26
27#include "vikwindow.h"
28#include "viklayerspanel.h"
29#include "vikviewport.h"
0944940f 30#include "babel.h"
a25c4c50 31
722b5481
RN
32G_BEGIN_DECLS
33
cf697cc2
EB
34typedef struct _VikDataSourceInterface VikDataSourceInterface;
35
fba47910
GB
36/**
37 * acq_dialog_widgets_t:
38 *
39 * global data structure used to expose the progress dialog to the worker thread.
40 */
7b3479e3
EB
41typedef struct {
42 GtkWidget *status;
43 VikWindow *vw;
44 VikLayersPanel *vlp;
45 VikViewport *vvp;
46 GtkWidget *dialog;
47 gboolean ok; /* if OK is false when we exit, we MUST free w */
62ddf770 48 VikDataSourceInterface *source_interface;
65f0ccab 49 gpointer user_data;
7b3479e3
EB
50} acq_dialog_widgets_t;
51
28c82d8b
EB
52typedef enum {
53 VIK_DATASOURCE_CREATENEWLAYER,
54 VIK_DATASOURCE_ADDTOLAYER
55} vik_datasource_mode_t;
56/* TODO: replace track/layer? */
57
58typedef enum {
59 VIK_DATASOURCE_INPUTTYPE_NONE = 0,
60 VIK_DATASOURCE_INPUTTYPE_TRWLAYER,
61 VIK_DATASOURCE_INPUTTYPE_TRACK,
62 VIK_DATASOURCE_INPUTTYPE_TRWLAYER_TRACK
63} vik_datasource_inputtype_t;
7b3479e3 64
fba47910
GB
65/**
66 * VikDataSourceInitFunc:
67 *
68 * Returns: pointer to state if OK, otherwise %NULL
69 */
65f0ccab 70typedef gpointer (*VikDataSourceInitFunc) ();
92255687 71
fba47910
GB
72/**
73 * VikDataSourceCheckExistenceFunc:
74 *
75 * Returns: %NULL if OK, otherwise returns an error message.
76 */
92255687
EB
77typedef gchar *(*VikDataSourceCheckExistenceFunc) ();
78
fba47910
GB
79/**
80 * VikDataSourceAddSetupWidgetsFunc:
81 *
82 * Create widgets to show in a setup dialog, set up state via user_data.
83 */
65f0ccab
AF
84typedef void (*VikDataSourceAddSetupWidgetsFunc) ( GtkWidget *dialog, VikViewport *vvp, gpointer user_data );
85
fba47910
GB
86/**
87 * VikDataSourceGetCmdStringFunc:
eb3f9398
GB
88 * @user_data: provided by #VikDataSourceInterface.init_func or dialog with params
89 * @args: the arguments computed for #VikDataSourceInterface.process_func
90 * @extra: extra arguments for #VikDataSourceInterface.process_func
fba47910 91 *
fba47910
GB
92 * set both to %NULL to signal refusal (ie already downloading).
93 */
eb3f9398 94typedef void (*VikDataSourceGetCmdStringFunc) ( gpointer user_data, gchar **args, gchar **extra );
65f0ccab 95
28c82d8b
EB
96typedef void (*VikDataSourceGetCmdStringFuncWithInput) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype, const gchar *input_file_name );
97typedef void (*VikDataSourceGetCmdStringFuncWithInputInput) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype, const gchar *input_file_name, const gchar *input_track_file_name );
98
fba47910
GB
99/**
100 * VikDataSourceProcessFunc:
c12a9108
GB
101 * @vtl:
102 * @cmd: the arguments computed by #VikDataSourceInterface.get_cmd_string_func
103 * @extra: the extra arguments computed by #VikDataSourceInterface.get_cmd_string_func
104 * @status_cb: the #VikDataSourceInterface.progress_func
fba47910
GB
105 *
106 * The actual function to do stuff - must report success/failure.
107 */
0944940f
RN
108typedef gboolean (*VikDataSourceProcessFunc) ( gpointer vtl, const gchar *cmd, const gchar *extra, BabelStatusFunc status_cb, acq_dialog_widgets_t *adw );
109
65f0ccab 110/* */
5564dd66 111typedef void (*VikDataSourceProgressFunc) ( BabelProgressCode c, gpointer data, acq_dialog_widgets_t *w );
65f0ccab 112
fba47910
GB
113/**
114 * VikDataSourceAddProgressWidgetsFunc:
115 *
116 * Creates widgets to show in a progress dialog, may set up state via user_data.
117 */
65f0ccab
AF
118typedef void (*VikDataSourceAddProgressWidgetsFunc) ( GtkWidget *dialog, gpointer user_data );
119
fba47910
GB
120/**
121 * VikDataSourceCleanupFunc:
122 *
123 * Frees any widgets created for the setup or progress dialogs, any allocated state, etc.
124 */
65f0ccab
AF
125typedef void (*VikDataSourceCleanupFunc) ( gpointer user_data );
126
2b756ea0 127typedef void (*VikDataSourceOffFunc) ( gpointer user_data, gchar **babelargs_or_shellcmd, gchar **inputfile_or_inputtype );;
7b3479e3 128
c12a9108
GB
129/**
130 * VikDataSourceInterface:
131 *
132 * Main interface.
133 */
cf697cc2 134struct _VikDataSourceInterface {
a8d46e0b 135 const gchar *window_title;
7b3479e3 136 const gchar *layer_title;
28c82d8b
EB
137 vik_datasource_mode_t mode;
138 vik_datasource_inputtype_t inputtype;
d2525524 139 gboolean autoview;
28c82d8b
EB
140 gboolean keep_dialog_open; /* when done */
141
7b3479e3 142
28c82d8b 143 /*** Manual UI Building ***/
65f0ccab
AF
144 VikDataSourceInitFunc init_func;
145 VikDataSourceCheckExistenceFunc check_existence_func;
146 VikDataSourceAddSetupWidgetsFunc add_setup_widgets_func;
28c82d8b
EB
147 /*** ***/
148
149 /* or VikDataSourceGetCmdStringFuncWithInput, if inputtype is not NONE */
65f0ccab 150 VikDataSourceGetCmdStringFunc get_cmd_string_func;
7b3479e3 151
0944940f
RN
152 VikDataSourceProcessFunc process_func;
153
7b3479e3
EB
154 VikDataSourceProgressFunc progress_func;
155 VikDataSourceAddProgressWidgetsFunc add_progress_widgets_func;
156 VikDataSourceCleanupFunc cleanup_func;
2b756ea0 157 VikDataSourceOffFunc off_func;
28c82d8b
EB
158
159 /*** UI Building ***/
160 VikLayerParam * params;
161 guint16 params_count;
162 VikLayerParamData * params_defaults;
163 gchar ** params_groups;
164 guint8 params_groups_count;
165
cf697cc2 166};
7b3479e3 167
28c82d8b
EB
168/**********************************/
169/**********************************/
170/**********************************/
7b3479e3 171
62ddf770 172void a_acquire ( VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikDataSourceInterface *source_interface );
1d1bc3c1 173
28c82d8b
EB
174GtkWidget *a_acquire_trwlayer_menu (VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikTrwLayer *vtl);
175
28c82d8b
EB
176GtkWidget *a_acquire_trwlayer_track_menu (VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikTrwLayer *vtl);
177
28c82d8b
EB
178GtkWidget *a_acquire_track_menu (VikWindow *vw, VikLayersPanel *vlp, VikViewport *vvp, VikTrack *tr);
179
ce4bd1cf 180void a_acquire_set_filter_track ( VikTrack *tr );
28c82d8b 181
722b5481 182G_END_DECLS
28c82d8b 183
1d1bc3c1 184#endif