1 #ifndef __GTK_POLAR_VIEW_H__
2 #define __GTK_POLAR_VIEW_H__ 1
3 
4 #include <glib.h>
5 #include <glib/gi18n.h>
6 #include <gdk/gdk.h>
7 #include <goocanvas.h>
8 #include <gtk/gtk.h>
9 
10 #include "gtk-sat-data.h"
11 #include "predict-tools.h"
12 
13 /* *INDENT-OFF* */
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17 /* *INDENT-ON* */
18 
19 /** \brief Number of time ticks. */
20 #define TRACK_TICK_NUM 4
21 
22 
23 #define GTK_POLAR_VIEW(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_polar_view_get_type (), GtkPolarView)
24 #define GTK_POLAR_VIEW_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gtk_polar_view_get_type (), GtkPolarViewClass)
25 #define GTK_IS_POLAR_VIEW(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_polar_view_get_type ())
26 #define GTK_TYPE_POLAR_VIEW          (gtk_polar_view_get_type ())
27 #define IS_GTK_POLAR_VIEW(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_polar_view_get_type ())
28 
29 typedef struct _GtkPolarView GtkPolarView;
30 typedef struct _GtkPolarViewClass GtkPolarViewClass;
31 
32 
33 /** Satellite object on graph. */
34 typedef struct {
35     gboolean        selected;   /*!< Satellite is selected. */
36     gboolean        showtrack;  /*!< Show ground track. */
37     gboolean        istarget;   /*!< Is this object the target. */
38     pass_t         *pass;       /*!< Details of the current pass. */
39     GooCanvasItemModel *marker; /*!< Item showing position of satellite. */
40     GooCanvasItemModel *label;  /*!< Item showing the satellite name. */
41     GooCanvasItemModel *track;  /*!< Sky track. */
42     GooCanvasItemModel *trtick[TRACK_TICK_NUM]; /*!< Time ticks along the sky track */
43 } sat_obj_t;
44 
45 #define SAT_OBJ(obj) ((sat_obj_t *)obj)
46 
47 
48     /* graph orientation; start at 12
49        o'clock and go clockwise */
50 typedef enum {
51     POLAR_VIEW_NESW = 0,        /*!< Normal / usual */
52     POLAR_VIEW_NWSE = 1,
53     POLAR_VIEW_SENW = 2,
54     POLAR_VIEW_SWNE = 3
55 } polar_view_swap_t;
56 
57 
58     /* pole identifier */
59 typedef enum {
60     POLAR_VIEW_POLE_N = 0,
61     POLAR_VIEW_POLE_E = 1,
62     POLAR_VIEW_POLE_S = 2,
63     POLAR_VIEW_POLE_W = 3
64 } polar_view_pole_t;
65 
66 
67 struct _GtkPolarView {
68     GtkBox          vbox;
69 
70     GtkWidget      *canvas;     /*!< The canvas widget */
71 
72     GooCanvasItemModel *bgd;
73     GooCanvasItemModel *C00, *C30, *C60;        /*!< 0, 30 and 60 deg elevation circles */
74     GooCanvasItemModel *hl, *vl;        /*!< horizontal and vertical lines */
75     GooCanvasItemModel *N, *S, *E, *W;  /*!< North, South, East and West labels */
76     GooCanvasItemModel *locnam; /*!< Location name */
77     GooCanvasItemModel *curs;   /*!< cursor tracking text */
78     GooCanvasItemModel *next;   /*!< next event text */
79     GooCanvasItemModel *sel;    /*!< Text showing info about selected satellite. */
80 
81     GHashTable     *showtracks_on;
82     GHashTable     *showtracks_off;
83 
84     gdouble         naos;       /*!< Next event time */
85     gint            ncat;       /*!< Next event catnum */
86 
87     gdouble         tstamp;     /*!< Time stamp for calculations; set by GtkSatModule */
88 
89     GKeyFile       *cfgdata;    /*!< module configuration data */
90     GHashTable     *sats;       /*!< Satellites. */
91     qth_t          *qth;        /*!< Pointer to current location. */
92 
93     GHashTable     *obj;        /*!< Canvas items representing each visible satellite */
94 
95     guint           cx;         /*!< center X */
96     guint           cy;         /*!< center Y */
97     guint           r;          /*!< radius */
98     guint           size;       /*!< Size of the box = min(h,w) */
99 
100     guint           refresh;    /*!< Refresh rate. */
101     guint           counter;    /*!< cycle counter. */
102 
103     polar_view_swap_t swap;
104 
105     gboolean        qthinfo;    /*!< Show the QTH info. */
106     gboolean        eventinfo;  /*!< Show info about the next event. */
107     gboolean        cursinfo;   /*!< Track the mouse cursor. */
108     gboolean        extratick;  /*!< Show extra ticks */
109     gboolean        showtrack;  /*!< Automatically show sky tracks. */
110     gboolean        resize;     /*!< Flag indicating that the view has been resized. */
111 };
112 
113 struct _GtkPolarViewClass {
114     GtkBoxClass     parent_class;
115 };
116 
117 
118 GType           gtk_polar_view_get_type(void);
119 
120 GtkWidget      *gtk_polar_view_new(GKeyFile * cfgdata,
121                                    GHashTable * sats, qth_t * qth);
122 void            gtk_polar_view_update(GtkWidget * widget);
123 void            gtk_polar_view_reconf(GtkWidget * widget, GKeyFile * cfgdat);
124 void            gtk_polar_view_reload_sats(GtkWidget * polv,
125                                            GHashTable * sats);
126 void            gtk_polar_view_select_sat(GtkWidget * widget, gint catnum);
127 void            gtk_polar_view_create_track(GtkPolarView * pv, sat_obj_t * obj,
128                                             sat_t * sat);
129 void            gtk_polar_view_delete_track(GtkPolarView * pv, sat_obj_t * obj,
130                                             sat_t * sat);
131 
132 /* *INDENT-OFF* */
133 #ifdef __cplusplus
134 }
135 #endif /* __cplusplus */
136 /* *INDENT-ON* */
137 
138 #endif /* __GTK_POLAR_VIEW_H__ */
139