Contents of /trunk/src/misc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 288 - (hide annotations)
Mon Jun 7 19:19:50 2010 UTC (13 years, 11 months ago) by harbaum
File MIME type: text/plain
File size: 4898 byte(s)
GPS focus enable, portrait support and some attribute icon work
1 harbaum 1 /*
2     * Copyright (C) 2008 Till Harbaum <till@harbaum.org>.
3     *
4     * This file is part of GPXView.
5     *
6     * GPXView 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 3 of the License, or
9     * (at your option) any later version.
10     *
11     * GPXView 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 GPXView. If not, see <http://www.gnu.org/licenses/>.
18     */
19    
20     #ifndef MISC_H
21     #define MISC_H
22    
23     #define SIZE_NORMAL 0
24     #define SIZE_BIG 1 /* effect only on non-maemo */
25     #define SIZE_SMALL 2 /* effect only on maemo */
26    
27     #define STRIKETHROUGH_NONE 0
28     #define STRIKETHROUGH 1
29     #define STRIKETHROUGH_RED 2
30    
31     #ifdef USE_MAEMO
32     #define GTK_LABEL_BIG(a) gtk_label_new(a)
33     #define GTK_LABEL_SMALL(a) gtk_label_small(a)
34     GtkWidget *gtk_label_small(char *str);
35     #else
36     #define GTK_LABEL_SMALL(a) gtk_label_new(a)
37     #define GTK_LABEL_BIG(a) gtk_label_big(a)
38     GtkWidget *gtk_label_big(char *str);
39     #endif
40    
41 harbaum 223 gboolean pos_valid(pos_t *pos);
42    
43 harbaum 1 GtkWidget *gtk_label_attrib(char *str, int size, int strikethrough);
44     GtkWidget *gtk_button_attrib(char *str, int size, int strikethrough);
45     void gtk_label_attrib_set(GtkWidget *label,
46     char *str, int size, int strikethrough);
47    
48     void pos_lat_str(char *str, int len, float latitude);
49     void pos_lon_str(char *str, int len, float longitude);
50     GtkWidget *pos_lat(float latitude, int size, int strikethrough);
51     GtkWidget *pos_lon(float longitude, int size, int strikethrough);
52     float pos_parse_lat(char *str);
53     float pos_parse_lon(char *str);
54     const char *pos_get_bearing_str(pos_t from, pos_t to);
55    
56     void textbox_enable(GtkWidget *widget);
57     void textbox_disable(GtkWidget *widget);
58    
59     int checkdir(char *dir);
60     char strlastchr(char *str);
61    
62     pos_t *get_pos(appdata_t *appdata);
63    
64     GtkWidget *lat_entry_new(float lat);
65     GtkWidget *lon_entry_new(float lon);
66 harbaum 221 float lat_entry_get(GtkWidget *widget);
67     float lon_entry_get(GtkWidget *widget);
68     void lat_entry_set(GtkWidget *widget, float lat);
69     void lon_entry_set(GtkWidget *widget, float lon);
70    
71     void lat_label_set(GtkWidget *widget, float lat);
72     void lon_label_set(GtkWidget *widget, float lon);
73     void lat_label_attrib_set(GtkWidget *widget, float lat,
74     int size, int strikethrough);
75     void lon_label_attrib_set(GtkWidget *widget, float lon,
76     int size, int strikethrough);
77    
78 harbaum 223 void distance_str(char *str, int len, float dist, gboolean mil);
79     float distance_parse(char *str, gboolean imperial);
80 harbaum 1 GtkWidget *dist_entry_new(float dist, gboolean mil);
81 harbaum 223 float dist_entry_get(GtkWidget *widget, gboolean mil);
82     void dist_entry_set(GtkWidget *widget, float dist, gboolean mil);
83 harbaum 1
84 harbaum 223 void angle_str(char *str, int len, float angle);
85     float angle_parse(char *str);
86     GtkWidget *angle_entry_new(float angle);
87     float angle_entry_get(GtkWidget *widget);
88     void angle_entry_set(GtkWidget *widget, float angle);
89    
90 harbaum 198 GtkWidget *left_label_new(char *str);
91    
92 harbaum 1 #ifndef USE_MAEMO
93     #ifdef ENABLE_BROWSER_INTERFACE
94     extern int browser_url(appdata_t *appdata, char *url);
95     #endif
96     #endif
97    
98 harbaum 77 void rmdir_recursive(char *path);
99 harbaum 137 GtkWidget *link_button_attrib(appdata_t *appdata, char *str, char *url,
100     int size, int strikethrough);
101     GtkWidget *link_button_by_id(appdata_t *appdata, char *str,
102     const char *type, int id);
103 harbaum 138 GtkWidget *link_icon_button_by_id(appdata_t *appdata, GtkWidget *icon,
104     const char *type, int id);
105 harbaum 165 GtkWidget *simple_text_widget(char *text);
106 harbaum 212
107 harbaum 231 /* convenience-addons for the lat/lon entries */
108 harbaum 221 GtkWidget *preset_coordinate_picker(appdata_t *appdata, GtkWidget *lat_entry, GtkWidget *lon_entry);
109 harbaum 231 GtkWidget *goto_coordinate(appdata_t *appdata, GtkWidget *lat_entry, GtkWidget *lon_entry);
110 harbaum 221
111 harbaum 212 GtkWidget *entry_new(void);
112    
113 harbaum 214 gboolean pos_differ(pos_t *pos1, pos_t *pos2);
114 harbaum 223 gboolean pos_valid(pos_t *pos);
115 harbaum 214
116 harbaum 223 void misc_init(void);
117    
118 harbaum 233 GtkWidget *toggle_button_new_with_label(char *label);
119     void toggle_button_set_active(GtkWidget *button, gboolean active);
120     gboolean toggle_button_get_active(GtkWidget *button);
121    
122     GtkWidget *check_button_new_with_label(char *label);
123     void check_button_set_active(GtkWidget *button, gboolean active);
124     gboolean check_button_get_active(GtkWidget *button);
125    
126     GtkWidget *button_new(void);
127     GtkWidget *button_new_with_label(char *label);
128    
129     GtkWidget *export_file(char *sel_title, char **filename);
130    
131 harbaum 244 GtkWidget *number_editor_new(int current, int min, int max);
132     int number_editor_get_value(GtkWidget *widget);
133    
134 harbaum 288 GtkWidget *notebook_new(void);
135     void notebook_append_page(GtkWidget *notebook, GtkWidget *page, char *label);
136     GtkWidget *notebook_get_gtk_notebook(GtkWidget *notebook);
137    
138     GtkWidget *text_wrap(char *str);
139     void text_set(GtkWidget *view, char *str);
140    
141 harbaum 1 #endif // MISC_H